repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
sf17k/sdlada | Ada | 1,591 | ads | --------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2014 Luke A. Guest
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
-- SDL.Inputs.Joysticks.Game_Controllers.Makers
--------------------------------------------------------------------------------------------------------------------
package SDL.Inputs.Joysticks.Game_Controllers.Makers is
function Create (Device : in Devices) return Game_Controller;
procedure Create (Device : in Devices; Actual_Controller : out Game_Controller);
end SDL.Inputs.Joysticks.Game_Controllers.Makers;
|
charlie5/cBound | Ada | 1,525 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_set_access_control_request_t is
-- Item
--
type Item is record
major_opcode : aliased Interfaces.Unsigned_8;
mode : aliased Interfaces.Unsigned_8;
length : aliased Interfaces.Unsigned_16;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_set_access_control_request_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_set_access_control_request_t.Item,
Element_Array => xcb.xcb_set_access_control_request_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_set_access_control_request_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_set_access_control_request_t.Pointer,
Element_Array => xcb.xcb_set_access_control_request_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_set_access_control_request_t;
|
Noremac201/sample-programs | Ada | 506 | adb | procedure Main is
type Bubble_Array is array (Integer range <>) of Integer;
procedure Bubble_Sort (Arr : in out Bubble_Array) is
Temp : Integer;
begin
for I in reverse Arr'Range loop
for J in Arr'First .. I loop
if Arr(I) < Arr(J) then
Temp := Arr(J);
Arr(J) := Arr(I);
Arr(I) := Temp;
end if;
end loop;
end loop;
end Bubble_Sort;
Arr : Bubble_Array := (7, 3, 5, 5, 11);
begin
Bubble_Sort(Arr);
end Main;
|
zhmu/ananas | Ada | 206 | ads | package Discr36 is
type R (D : Boolean := True) is record
case D is
when True => I : Integer;
when False => null;
end case;
end record;
function N return Natural;
end Discr36;
|
reznikmm/matreshka | Ada | 3,769 | 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.Table_First_Row_End_Column_Attributes is
pragma Preelaborate;
type ODF_Table_First_Row_End_Column_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Table_First_Row_End_Column_Attribute_Access is
access all ODF_Table_First_Row_End_Column_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Table_First_Row_End_Column_Attributes;
|
reznikmm/matreshka | Ada | 5,576 | 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$
------------------------------------------------------------------------------
with Qt4.Font_Metrics;
with Qt4.Point_Fs;
with Qt4.Fonts;
with Qt4.Strings;
package body Modeler.Package_Items is
function To_Q_String
(Item : AMF.Optional_String) return Qt4.Strings.Q_String;
-------------------
-- Bounding_Rect --
-------------------
overriding function Bounding_Rect
(Self : not null access constant Package_Item)
return Qt4.Rect_Fs.Q_Rect_F is
begin
return Qt4.Rect_Fs.Create (0.0, 0.0, 150.0, 100.0);
end Bounding_Rect;
------------------
-- Constructors --
------------------
package body Constructors is
------------
-- Create --
------------
function Create
(Element : not null AMF.CMOF.Packages.CMOF_Package_Access;
Parent : access Qt4.Graphics_Items.Q_Graphics_Item'Class := null)
return not null Package_Item_Access is
begin
return Self : constant not null Package_Item_Access
:= new Package_Item
do
Qt4.Graphics_Items.Directors.Constructors.Initialize
(Self, Parent);
Self.Element := Element;
Self.Set_Flag (Qt4.Graphics_Items.Item_Is_Movable);
end return;
end Create;
end Constructors;
-----------
-- Paint --
-----------
overriding procedure Paint
(Self : not null access Package_Item;
Painter : in out Qt4.Painters.Q_Painter'Class;
Option :
Qt4.Style_Option_Graphics_Items.Q_Style_Option_Graphics_Item'Class;
Widget : access Qt4.Widgets.Q_Widget'Class := null)
is
use type Qt4.Q_Real;
begin
Painter.Draw_Rect (Qt4.Rect_Fs.Create (0.0, 0.0, 120.0, 20.0));
Painter.Draw_Rect (Qt4.Rect_Fs.Create (0.0, 20.0, 150.0, 80.0));
Painter.Draw_Text
(Qt4.Point_Fs.Create (1.0, 17.0),
To_Q_String (Self.Element.Get_Name));
end Paint;
-----------------
-- To_Q_String --
-----------------
function To_Q_String
(Item : AMF.Optional_String) return Qt4.Strings.Q_String is
begin
if Item.Is_Empty then
return Qt4.Strings.Create;
else
return Qt4.Strings.From_Ucs_4 (Item.Value.To_Wide_Wide_String);
end if;
end To_Q_String;
end Modeler.Package_Items;
|
ohenley/black | Ada | 76 | ads | package Black is
pragma Pure;
Protocol_Error : exception;
end Black;
|
wookey-project/ewok-legacy | Ada | 32 | adb | ../../stm32f439/Ada/soc-nvic.adb |
reznikmm/matreshka | Ada | 3,674 | 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.Chart_Plot_Area_Elements is
pragma Preelaborate;
type ODF_Chart_Plot_Area is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Chart_Plot_Area_Access is
access all ODF_Chart_Plot_Area'Class
with Storage_Size => 0;
end ODF.DOM.Chart_Plot_Area_Elements;
|
MinimSecure/unum-sdk | Ada | 855 | adb | -- Copyright 2008-2016 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Ident;
procedure Assign is
Q: array (1..5) of Integer := (2, 3, 5, 7, 11);
begin
Q(1) := Ident (Q(3)); -- START
end Assign;
|
reznikmm/matreshka | Ada | 4,932 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Generic_Collections;
package AMF.OCL.Void_Types.Collections is
pragma Preelaborate;
package OCL_Void_Type_Collections is
new AMF.Generic_Collections
(OCL_Void_Type,
OCL_Void_Type_Access);
type Set_Of_OCL_Void_Type is
new OCL_Void_Type_Collections.Set with null record;
Empty_Set_Of_OCL_Void_Type : constant Set_Of_OCL_Void_Type;
type Ordered_Set_Of_OCL_Void_Type is
new OCL_Void_Type_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_OCL_Void_Type : constant Ordered_Set_Of_OCL_Void_Type;
type Bag_Of_OCL_Void_Type is
new OCL_Void_Type_Collections.Bag with null record;
Empty_Bag_Of_OCL_Void_Type : constant Bag_Of_OCL_Void_Type;
type Sequence_Of_OCL_Void_Type is
new OCL_Void_Type_Collections.Sequence with null record;
Empty_Sequence_Of_OCL_Void_Type : constant Sequence_Of_OCL_Void_Type;
private
Empty_Set_Of_OCL_Void_Type : constant Set_Of_OCL_Void_Type
:= (OCL_Void_Type_Collections.Set with null record);
Empty_Ordered_Set_Of_OCL_Void_Type : constant Ordered_Set_Of_OCL_Void_Type
:= (OCL_Void_Type_Collections.Ordered_Set with null record);
Empty_Bag_Of_OCL_Void_Type : constant Bag_Of_OCL_Void_Type
:= (OCL_Void_Type_Collections.Bag with null record);
Empty_Sequence_Of_OCL_Void_Type : constant Sequence_Of_OCL_Void_Type
:= (OCL_Void_Type_Collections.Sequence with null record);
end AMF.OCL.Void_Types.Collections;
|
kraileth/ravenadm | Ada | 4,240 | ads | -- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../License.txt
with Definitions; use Definitions;
private with Ada.Characters.Latin_1;
private with Parameters;
package Configure is
menu_error : exception;
-- Interactive configuration menu
procedure launch_configure_menu;
-- Print out configuration value
-- If input not 'A' - 'Q', return "Error: Input must be character 'A'...'Q'"
procedure print_configuration_value (option : Character);
private
package LAT renames Ada.Characters.Latin_1;
package PM renames Parameters;
indent : constant String (1 .. 3) := (others => LAT.Space);
type option is range 1 .. 17;
type default is range 1 .. 10;
subtype ofield is String (1 .. 30);
type desc_type is array (option) of ofield;
type default_type is array (default) of ofield;
descriptions : constant desc_type :=
(
"[A] System root directory ",
"[B] Toolchain directory ",
"[C] Localbase directory ",
"[D] Conspiracy directory ",
"[E] Custom ports directory ",
"[F] Distfiles directory ",
"[G] Profile directory (logs+) ",
"[H] Packages directory ",
"[I] Compiler cache directory ",
"[J] Build base directory ",
"[K] Num. concurrent builders ",
"[L] Max. jobs per builder ",
"[M] Avoid use of tmpfs ",
"[N] Fetch prebuilt packages ",
"[O] Display using ncurses ",
"[P] Always record options ",
"[Q] Assume default options "
);
version_desc : constant default_type :=
(
"[A] Firebird SQL server ",
"[B] Lua (language) ",
"[C] MySQL-workalike server ",
"[D] Perl (language) ",
"[E] PHP (language) ",
"[F] PostgreSQL server ",
"[G] Python 3 (language) ",
"[H] Ruby (language) ",
"[I] SSL/TLS library ",
"[J] TCL/TK toolkit "
);
optX5A : constant String := "[V] Set version defaults (e.g. perl, ruby, mysql ...)";
optX1A : constant String := "[>] Switch/create profiles (changes discarded)";
optX1B : constant String := "[>] Switch/create profiles";
optX4B : constant String := "[<] Delete alternative profile";
optX2A : constant String := "[ESC] Exit without saving changes";
optX3A : constant String := "[RET] Save changes (starred) ";
optX3B : constant String := "[RET] Exit ";
dupe : PM.configuration_record;
version_A : constant String := default_firebird & ":3.0";
version_B : constant String := "5.2:" & default_lua & ":5.4";
version_C : constant String := "oracle-5.6:oracle-5.7:" & default_mysql & ":" &
"mariadb-10.2:mariadb-10.3:mariadb-10.4:mariadb-10.5:" &
"percona-5.6:percona-5.7:percona-8.0";
version_D : constant String := default_perl & ":5.32";
version_E : constant String := "7.3:" & default_php & ":8.0";
version_F : constant String := "9.6:10:11:" & default_pgsql & ":13";
version_G : constant String := default_python3 & ":3.9";
version_H : constant String := "2.6:" & default_ruby & ":3.0";
version_I : constant String := "openssl:openssl-devel:" & default_ssl & ":libressl-devel";
version_J : constant String := "8.5:" & default_tcltk;
procedure clear_screen;
procedure print_header;
procedure print_opt (opt : option; pristine : in out Boolean);
procedure change_directory_option (opt : option; pristine : in out Boolean);
procedure change_boolean_option (opt : option; pristine : in out Boolean);
procedure change_positive_option (opt : option; pristine : in out Boolean);
procedure delete_profile;
procedure switch_profile;
procedure move_to_defaults_menu (pristine_def : in out Boolean);
procedure print_default (def : default; pristine_def : in out Boolean);
procedure update_version
(def : default;
choices : String;
label : String);
procedure print_menu
(pristine : in out Boolean;
extra_profiles : Boolean;
pristine_def : Boolean);
end Configure;
|
optikos/oasis | Ada | 3,306 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Element_Vectors;
with Program.Elements.Declarations;
with Program.Elements.Defining_Identifiers;
with Program.Lexical_Elements;
with Program.Elements.Expressions;
package Program.Elements.Discriminant_Specifications is
pragma Pure (Program.Elements.Discriminant_Specifications);
type Discriminant_Specification is
limited interface and Program.Elements.Declarations.Declaration;
type Discriminant_Specification_Access is
access all Discriminant_Specification'Class with Storage_Size => 0;
not overriding function Names
(Self : Discriminant_Specification)
return not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Vector_Access is abstract;
not overriding function Object_Subtype
(Self : Discriminant_Specification)
return not null Program.Elements.Element_Access is abstract;
not overriding function Default_Expression
(Self : Discriminant_Specification)
return Program.Elements.Expressions.Expression_Access is abstract;
not overriding function Has_Not_Null
(Self : Discriminant_Specification)
return Boolean is abstract;
type Discriminant_Specification_Text is limited interface;
type Discriminant_Specification_Text_Access is
access all Discriminant_Specification_Text'Class with Storage_Size => 0;
not overriding function To_Discriminant_Specification_Text
(Self : aliased in out Discriminant_Specification)
return Discriminant_Specification_Text_Access is abstract;
not overriding function Colon_Token
(Self : Discriminant_Specification_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Not_Token
(Self : Discriminant_Specification_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Null_Token
(Self : Discriminant_Specification_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Assignment_Token
(Self : Discriminant_Specification_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Semicolon_Token
(Self : Discriminant_Specification_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
type Discriminant_Specification_Vector is
limited interface and Program.Element_Vectors.Element_Vector;
type Discriminant_Specification_Vector_Access is
access all Discriminant_Specification_Vector'Class with Storage_Size => 0;
overriding function Element
(Self : Discriminant_Specification_Vector;
Index : Positive)
return not null Program.Elements.Element_Access is abstract
with Post'Class => Element'Result.Is_Discriminant_Specification;
function To_Discriminant_Specification
(Self : Discriminant_Specification_Vector'Class;
Index : Positive)
return not null Discriminant_Specification_Access
is (Self.Element (Index).To_Discriminant_Specification);
end Program.Elements.Discriminant_Specifications;
|
vasil-sd/ada-tlsf | Ada | 1,522 | adb | package body TLSF.Proof.Util.Vectors with SPARK_Mode is
----------
-- Find --
----------
function Find
(Container : V.Sequence; E : Element_Type) return Extended_Index_Type
is
begin
if V.Last(Container) >= Index_Type'First then
for Idx in Index_Type'First..Index_Type(V.Last(Container)) loop
if (V.Get(Container, Idx) = E) then
return Idx;
end if;
pragma Loop_Invariant
(not V.Contains(Container, Index_Type'First, Idx, E));
end loop;
end if;
return Extended_Index_Type'First;
end Find;
-----------------
-- Find_Second --
-----------------
function Find_Second
(Container : V.Sequence; E : Element_Type) return Extended_Index_Type
is
use Ada.Containers;
Len : Count_Type renames V.Length(Container);
First_Idx : constant Extended_Index_Type := Find (Container, E);
begin
if Len > 1 and First_Idx in Index_Type'First .. Extended_Index_Type'Pred(V.Last(Container)) then
for Idx in Extended_Index_Type'Succ(First_Idx)..V.Last(Container) loop
if V.Get(Container, Idx) = E then
pragma Assert (Find(Container, E) < Idx and
Idx > Index_Type'First);
return Idx;
end if;
pragma Loop_Invariant (Find(Container, E) < Idx);
end loop;
end if;
return Extended_Index_Type'First;
end Find_Second;
end TLSF.Proof.Util.Vectors;
|
reznikmm/matreshka | Ada | 4,697 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Visitors;
with ODF.DOM.Style_Columns_Elements;
package Matreshka.ODF_Style.Columns_Elements is
type Style_Columns_Element_Node is
new Matreshka.ODF_Style.Abstract_Style_Element_Node
and ODF.DOM.Style_Columns_Elements.ODF_Style_Columns
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Style_Columns_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Style_Columns_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Style_Columns_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Leave_Node
(Self : not null access Style_Columns_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Visit_Node
(Self : not null access Style_Columns_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
end Matreshka.ODF_Style.Columns_Elements;
|
emacsmirror/ada-mode | Ada | 116,158 | adb | -- generated parser support file. -*- buffer-read-only:t -*-
-- command line: wisitoken-bnf-generate.exe --generate LR1 Ada_Emacs re2c PROCESS text_rep ada_annex_p.wy
--
-- Copyright (C) 2013 - 2022 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, or (at
-- your option) any later version.
--
-- This software is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
with SAL;
with WisiToken.Lexer.re2c;
with ada_annex_p_re2c_c;
with Ada_Annex_P_Process_Actions; use Ada_Annex_P_Process_Actions;
package body Ada_Annex_P_Process_LR1_Main is
function Is_Block_Delimited (ID : in WisiToken.Token_ID) return Boolean
is begin
case To_Token_Enum (ID) is
when
COMMENT_ID |
GNAT_PREP_IF_ID |
GNAT_PREP_ELSIF_ID |
GNAT_PREP_ELSE_ID |
GNAT_PREP_END_IF_ID |
CONFLICT_MARK_A_ID |
CONFLICT_MARK_B_ID |
CONFLICT_MARK_END_ID |
PLACEHOLDER_ID |
STRING_LITERAL_ID |
CHARACTER_LITERAL_ID => return True;
when others => return False;
end case;
end Is_Block_Delimited;
function Same_Block_Delimiters (ID : in WisiToken.Token_ID) return Boolean
is begin
case To_Token_Enum (ID) is
when COMMENT_ID => return False;
when GNAT_PREP_IF_ID => return False;
when GNAT_PREP_ELSIF_ID => return False;
when GNAT_PREP_ELSE_ID => return False;
when GNAT_PREP_END_IF_ID => return False;
when CONFLICT_MARK_A_ID => return False;
when CONFLICT_MARK_B_ID => return False;
when CONFLICT_MARK_END_ID => return False;
when PLACEHOLDER_ID => return False;
when STRING_LITERAL_ID => return True;
when CHARACTER_LITERAL_ID => return True;
when others => return False;
end case;
end Same_Block_Delimiters;
function Escape_Delimiter_Doubled (ID : in WisiToken.Token_ID) return Boolean
is begin
case To_Token_Enum (ID) is
when STRING_LITERAL_ID => return True;
when others => return False;
end case;
end Escape_Delimiter_Doubled;
function Start_Delimiter_Length (ID : in WisiToken.Token_ID) return Integer
is begin
case To_Token_Enum (ID) is
when COMMENT_ID => return 2;
when GNAT_PREP_IF_ID => return 3;
when GNAT_PREP_ELSIF_ID => return 6;
when GNAT_PREP_ELSE_ID => return 5;
when GNAT_PREP_END_IF_ID => return 7;
when CONFLICT_MARK_A_ID => return 7;
when CONFLICT_MARK_B_ID => return 7;
when CONFLICT_MARK_END_ID => return 7;
when PLACEHOLDER_ID => return 1;
when STRING_LITERAL_ID => return 1;
when CHARACTER_LITERAL_ID => return 1;
when others => raise SAL.Programmer_Error; return 0;
end case;
end Start_Delimiter_Length;
function End_Delimiter_Length (ID : in WisiToken.Token_ID) return Integer
is begin
case To_Token_Enum (ID) is
when
COMMENT_ID |
GNAT_PREP_IF_ID |
GNAT_PREP_ELSIF_ID |
GNAT_PREP_ELSE_ID |
GNAT_PREP_END_IF_ID |
CONFLICT_MARK_A_ID |
CONFLICT_MARK_B_ID |
CONFLICT_MARK_END_ID |
STRING_LITERAL_ID |
CHARACTER_LITERAL_ID => return 1;
when PLACEHOLDER_ID => return 1;
when others => raise SAL.Programmer_Error; return 0;
end case;
end End_Delimiter_Length;
function New_Line_Is_End_Delimiter (ID : in WisiToken.Token_ID) return Boolean
is begin
return
(case To_Token_Enum (ID) is
when COMMENT_ID => True,
when GNAT_PREP_IF_ID => True,
when GNAT_PREP_ELSIF_ID => True,
when GNAT_PREP_ELSE_ID => True,
when GNAT_PREP_END_IF_ID => True,
when CONFLICT_MARK_A_ID => True,
when CONFLICT_MARK_B_ID => True,
when CONFLICT_MARK_END_ID => True,
when PLACEHOLDER_ID => True,
when STRING_LITERAL_ID => True,
when CHARACTER_LITERAL_ID => True,
when others => raise SAL.Programmer_Error);
end New_Line_Is_End_Delimiter;
function Find_End_Delimiter
(Source : in WisiToken.Lexer.Source;
ID : in WisiToken.Token_ID;
Token_Start : in WisiToken.Buffer_Pos)
return WisiToken.Buffer_Pos
is begin
return
(case To_Token_Enum (ID) is
when COMMENT_ID => WisiToken.Lexer.Find_New_Line (Source, Token_Start),
when GNAT_PREP_IF_ID => WisiToken.Lexer.Find_New_Line (Source, Token_Start),
when GNAT_PREP_ELSIF_ID => WisiToken.Lexer.Find_New_Line (Source, Token_Start),
when GNAT_PREP_ELSE_ID => WisiToken.Lexer.Find_New_Line (Source, Token_Start),
when GNAT_PREP_END_IF_ID => WisiToken.Lexer.Find_New_Line (Source, Token_Start),
when CONFLICT_MARK_A_ID => WisiToken.Lexer.Find_New_Line (Source, Token_Start),
when CONFLICT_MARK_B_ID => WisiToken.Lexer.Find_New_Line (Source, Token_Start),
when CONFLICT_MARK_END_ID => WisiToken.Lexer.Find_New_Line (Source, Token_Start),
when PLACEHOLDER_ID => WisiToken.Lexer.Find_String (Source, Token_Start, "}"),
when STRING_LITERAL_ID => WisiToken.Lexer.Find_String_Or_New_Line (Source, Token_Start, """"),
when CHARACTER_LITERAL_ID => WisiToken.Lexer.Find_String_Or_New_Line (Source, Token_Start, """"),
when others => raise SAL.Programmer_Error);
end Find_End_Delimiter;
function Find_Scan_End
(Source : in WisiToken.Lexer.Source;
ID : in WisiToken.Token_ID;
Region : in WisiToken.Buffer_Region;
Inserted : in Boolean;
Start : in Boolean)
return WisiToken.Buffer_Pos
is
use WisiToken;
begin
return
(case To_Token_Enum (ID) is
when COMMENT_ID =>
(if Inserted then Region.Last
elsif Start then Region.Last
else Lexer.Find_New_Line (Source, Region.Last)),
when GNAT_PREP_IF_ID =>
(if Inserted then Region.Last
elsif Start then Region.Last
else Lexer.Find_New_Line (Source, Region.Last)),
when GNAT_PREP_ELSIF_ID =>
(if Inserted then Region.Last
elsif Start then Region.Last
else Lexer.Find_New_Line (Source, Region.Last)),
when GNAT_PREP_ELSE_ID =>
(if Inserted then Region.Last
elsif Start then Region.Last
else Lexer.Find_New_Line (Source, Region.Last)),
when GNAT_PREP_END_IF_ID =>
(if Inserted then Region.Last
elsif Start then Region.Last
else Lexer.Find_New_Line (Source, Region.Last)),
when CONFLICT_MARK_A_ID =>
(if Inserted then Region.Last
elsif Start then Region.Last
else Lexer.Find_New_Line (Source, Region.Last)),
when CONFLICT_MARK_B_ID =>
(if Inserted then Region.Last
elsif Start then Region.Last
else Lexer.Find_New_Line (Source, Region.Last)),
when CONFLICT_MARK_END_ID =>
(if Inserted then Region.Last
elsif Start then Region.Last
else Lexer.Find_New_Line (Source, Region.Last)),
when PLACEHOLDER_ID =>
(if Inserted then Region.Last
elsif Start then Region.Last
else Lexer.Find_String_Or_New_Line (Source, Region.Last, "{")),
when STRING_LITERAL_ID => Lexer.Find_New_Line (Source, Region.Last),
when CHARACTER_LITERAL_ID => Lexer.Find_New_Line (Source, Region.Last),
when others => raise SAL.Programmer_Error);
end Find_Scan_End;
function Contains_End_Delimiter
(Source : in WisiToken.Lexer.Source;
ID : in WisiToken.Token_ID;
Region : in WisiToken.Buffer_Region)
return WisiToken.Base_Buffer_Pos
is
use WisiToken;
begin
return
(case To_Token_Enum (ID) is
when COMMENT_ID => Lexer.Find_New_Line (Source, Region),
when GNAT_PREP_IF_ID => Lexer.Find_New_Line (Source, Region),
when GNAT_PREP_ELSIF_ID => Lexer.Find_New_Line (Source, Region),
when GNAT_PREP_ELSE_ID => Lexer.Find_New_Line (Source, Region),
when GNAT_PREP_END_IF_ID => Lexer.Find_New_Line (Source, Region),
when CONFLICT_MARK_A_ID => Lexer.Find_New_Line (Source, Region),
when CONFLICT_MARK_B_ID => Lexer.Find_New_Line (Source, Region),
when CONFLICT_MARK_END_ID => Lexer.Find_New_Line (Source, Region),
when PLACEHOLDER_ID => Lexer.Find_String_Or_New_Line (Source, Region, "}"),
when STRING_LITERAL_ID => Lexer.Find_String_Or_New_Line (Source, Region, """"),
when CHARACTER_LITERAL_ID => Lexer.Find_String_Or_New_Line (Source, Region, "'"),
when others => raise SAL.Programmer_Error);
end Contains_End_Delimiter;
function Line_Begin_Char_Pos
(Source : in WisiToken.Lexer.Source;
Token : in WisiToken.Lexer.Token;
Line : in WisiToken.Line_Number_Type)
return WisiToken.Buffer_Pos
is
pragma Unreferenced (Source, Line);
use all type WisiToken.Base_Buffer_Pos;
begin
case To_Token_Enum (Token.ID) is
when NEW_LINE_ID => return Token.Char_Region.Last + 1;
when COMMENT_ID => return Token.Char_Region.Last + 1;
when GNAT_PREP_IF_ID => return Token.Char_Region.Last + 1;
when GNAT_PREP_ELSIF_ID => return Token.Char_Region.Last + 1;
when GNAT_PREP_ELSE_ID => return Token.Char_Region.Last + 1;
when GNAT_PREP_END_IF_ID => return Token.Char_Region.Last + 1;
when CONFLICT_MARK_A_ID => return Token.Char_Region.Last + 1;
when CONFLICT_MARK_B_ID => return Token.Char_Region.Last + 1;
when CONFLICT_MARK_END_ID => return Token.Char_Region.Last + 1;
when others => raise SAL.Programmer_Error;
end case;
end Line_Begin_Char_Pos;
function Can_Contain_New_Line (ID : in WisiToken.Token_ID) return Boolean
is begin
case To_Token_Enum (ID) is
when NEW_LINE_ID => return True;
when COMMENT_ID => return True;
when GNAT_PREP_IF_ID => return True;
when GNAT_PREP_ELSIF_ID => return True;
when GNAT_PREP_ELSE_ID => return True;
when GNAT_PREP_END_IF_ID => return True;
when CONFLICT_MARK_A_ID => return True;
when CONFLICT_MARK_B_ID => return True;
when CONFLICT_MARK_END_ID => return True;
when others => return False;
end case;
end Can_Contain_New_Line;
function Terminated_By_New_Line (ID : in WisiToken.Token_ID) return Boolean
is begin
case To_Token_Enum (ID) is
when NEW_LINE_ID => return True;
when COMMENT_ID => return True;
when GNAT_PREP_IF_ID => return True;
when GNAT_PREP_ELSIF_ID => return True;
when GNAT_PREP_ELSE_ID => return True;
when GNAT_PREP_END_IF_ID => return True;
when CONFLICT_MARK_A_ID => return True;
when CONFLICT_MARK_B_ID => return True;
when CONFLICT_MARK_END_ID => return True;
when STRING_LITERAL_ID => return True;
when CHARACTER_LITERAL_ID => return True;
when others => return False;
end case;
end Terminated_By_New_Line;
package Lexer is new WisiToken.Lexer.re2c
(ada_annex_p_re2c_c.New_Lexer,
ada_annex_p_re2c_c.Free_Lexer,
ada_annex_p_re2c_c.Reset_Lexer,
ada_annex_p_re2c_c.Set_Verbosity,
ada_annex_p_re2c_c.Set_Position,
ada_annex_p_re2c_c.Next_Token,
Is_Block_Delimited,
Same_Block_Delimiters,
Escape_Delimiter_Doubled,
Start_Delimiter_Length,
End_Delimiter_Length,
New_Line_Is_End_Delimiter,
Find_End_Delimiter,
Contains_End_Delimiter,
Find_Scan_End,
Line_Begin_Char_Pos,
Can_Contain_New_Line,
Terminated_By_New_Line);
function Create_Parse_Table
(Text_Rep_File_Name : in String)
return WisiToken.Parse.LR.Parse_Table_Ptr
is
use WisiToken.Parse.LR;
McKenzie_Param : constant McKenzie_Param_Type :=
(First_Terminal => 11,
Last_Terminal => 119,
First_Nonterminal => 120,
Last_Nonterminal => 466,
Insert =>
(4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 2, 4, 4,
4),
Delete =>
(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3),
Push_Back =>
(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
Undo_Reduce =>
(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
Minimal_Complete_Cost_Delta => -3,
Fast_Forward => 2,
Matching_Begin => 1,
Ignore_Check_Fail => 2,
Check_Limit => 4,
Zombie_Limit => 4,
Check_Delta_Limit => 100,
Enqueue_Limit => 58000);
Table : constant Parse_Table_Ptr := Get_Text_Rep (Text_Rep_File_Name);
begin
Table.Error_Recover_Enabled := True;
Table.McKenzie_Param := McKenzie_Param;
Table.Max_Parallel := 20;
return Table;
end Create_Parse_Table;
function Create_Productions return WisiToken.Syntax_Trees.Production_Info_Trees.Vector
is begin
return Result : WisiToken.Syntax_Trees.Production_Info_Trees.Vector do
Result.Set_First_Last (120, 466);
Result (123).RHSs.Set_First_Last (0, 1);
Result (123).RHSs (0).In_Parse_Action := null;
Result (123).RHSs (0).Post_Parse_Action := pragma_argument_association_list_0'Access;
Result (123).RHSs (1).In_Parse_Action := null;
Result (123).RHSs (1).Post_Parse_Action := pragma_argument_association_list_1'Access;
Result (124).RHSs.Set_First_Last (0, 3);
Result (124).RHSs (0).In_Parse_Action := null;
Result (124).RHSs (0).Post_Parse_Action := pragma_g_0'Access;
Result (124).RHSs (1).In_Parse_Action := null;
Result (124).RHSs (1).Post_Parse_Action := pragma_g_1'Access;
Result (124).RHSs (2).In_Parse_Action := null;
Result (124).RHSs (2).Post_Parse_Action := pragma_g_2'Access;
Result (124).RHSs (3).In_Parse_Action := null;
Result (124).RHSs (3).Post_Parse_Action := pragma_g_3'Access;
Result (128).RHSs.Set_First_Last (0, 5);
Result (128).RHSs (0).In_Parse_Action := null;
Result (128).RHSs (0).Post_Parse_Action := full_type_declaration_0'Access;
Result (128).RHSs (1).In_Parse_Action := null;
Result (128).RHSs (1).Post_Parse_Action := full_type_declaration_1'Access;
Result (128).RHSs (2).In_Parse_Action := null;
Result (128).RHSs (2).Post_Parse_Action := full_type_declaration_2'Access;
Result (128).RHSs (3).In_Parse_Action := null;
Result (128).RHSs (3).Post_Parse_Action := full_type_declaration_3'Access;
Result (128).RHSs (4).In_Parse_Action := null;
Result (128).RHSs (4).Post_Parse_Action := null;
Result (128).RHSs (5).In_Parse_Action := null;
Result (128).RHSs (5).Post_Parse_Action := null;
Result (130).RHSs.Set_First_Last (0, 1);
Result (130).RHSs (0).In_Parse_Action := null;
Result (130).RHSs (0).Post_Parse_Action := subtype_declaration_0'Access;
Result (130).RHSs (1).In_Parse_Action := null;
Result (130).RHSs (1).Post_Parse_Action := subtype_declaration_1'Access;
Result (135).RHSs.Set_First_Last (0, 49);
Result (135).RHSs (0).In_Parse_Action := null;
Result (135).RHSs (0).Post_Parse_Action := object_declaration_0'Access;
Result (135).RHSs (1).In_Parse_Action := null;
Result (135).RHSs (1).Post_Parse_Action := object_declaration_1'Access;
Result (135).RHSs (2).In_Parse_Action := null;
Result (135).RHSs (2).Post_Parse_Action := object_declaration_2'Access;
Result (135).RHSs (3).In_Parse_Action := null;
Result (135).RHSs (3).Post_Parse_Action := object_declaration_3'Access;
Result (135).RHSs (4).In_Parse_Action := null;
Result (135).RHSs (4).Post_Parse_Action := object_declaration_4'Access;
Result (135).RHSs (5).In_Parse_Action := null;
Result (135).RHSs (5).Post_Parse_Action := object_declaration_5'Access;
Result (135).RHSs (6).In_Parse_Action := null;
Result (135).RHSs (6).Post_Parse_Action := object_declaration_6'Access;
Result (135).RHSs (7).In_Parse_Action := null;
Result (135).RHSs (7).Post_Parse_Action := object_declaration_7'Access;
Result (135).RHSs (8).In_Parse_Action := null;
Result (135).RHSs (8).Post_Parse_Action := object_declaration_8'Access;
Result (135).RHSs (9).In_Parse_Action := null;
Result (135).RHSs (9).Post_Parse_Action := object_declaration_9'Access;
Result (135).RHSs (10).In_Parse_Action := null;
Result (135).RHSs (10).Post_Parse_Action := object_declaration_10'Access;
Result (135).RHSs (11).In_Parse_Action := null;
Result (135).RHSs (11).Post_Parse_Action := object_declaration_11'Access;
Result (135).RHSs (12).In_Parse_Action := null;
Result (135).RHSs (12).Post_Parse_Action := object_declaration_12'Access;
Result (135).RHSs (13).In_Parse_Action := null;
Result (135).RHSs (13).Post_Parse_Action := object_declaration_13'Access;
Result (135).RHSs (14).In_Parse_Action := null;
Result (135).RHSs (14).Post_Parse_Action := object_declaration_14'Access;
Result (135).RHSs (15).In_Parse_Action := null;
Result (135).RHSs (15).Post_Parse_Action := object_declaration_15'Access;
Result (135).RHSs (16).In_Parse_Action := null;
Result (135).RHSs (16).Post_Parse_Action := object_declaration_16'Access;
Result (135).RHSs (17).In_Parse_Action := null;
Result (135).RHSs (17).Post_Parse_Action := object_declaration_17'Access;
Result (135).RHSs (18).In_Parse_Action := null;
Result (135).RHSs (18).Post_Parse_Action := object_declaration_18'Access;
Result (135).RHSs (19).In_Parse_Action := null;
Result (135).RHSs (19).Post_Parse_Action := object_declaration_19'Access;
Result (135).RHSs (20).In_Parse_Action := null;
Result (135).RHSs (20).Post_Parse_Action := object_declaration_20'Access;
Result (135).RHSs (21).In_Parse_Action := null;
Result (135).RHSs (21).Post_Parse_Action := object_declaration_21'Access;
Result (135).RHSs (22).In_Parse_Action := null;
Result (135).RHSs (22).Post_Parse_Action := object_declaration_22'Access;
Result (135).RHSs (23).In_Parse_Action := null;
Result (135).RHSs (23).Post_Parse_Action := object_declaration_23'Access;
Result (135).RHSs (24).In_Parse_Action := null;
Result (135).RHSs (24).Post_Parse_Action := object_declaration_24'Access;
Result (135).RHSs (25).In_Parse_Action := null;
Result (135).RHSs (25).Post_Parse_Action := object_declaration_25'Access;
Result (135).RHSs (26).In_Parse_Action := null;
Result (135).RHSs (26).Post_Parse_Action := object_declaration_26'Access;
Result (135).RHSs (27).In_Parse_Action := null;
Result (135).RHSs (27).Post_Parse_Action := object_declaration_27'Access;
Result (135).RHSs (28).In_Parse_Action := null;
Result (135).RHSs (28).Post_Parse_Action := object_declaration_28'Access;
Result (135).RHSs (29).In_Parse_Action := null;
Result (135).RHSs (29).Post_Parse_Action := object_declaration_29'Access;
Result (135).RHSs (30).In_Parse_Action := null;
Result (135).RHSs (30).Post_Parse_Action := object_declaration_30'Access;
Result (135).RHSs (31).In_Parse_Action := null;
Result (135).RHSs (31).Post_Parse_Action := object_declaration_31'Access;
Result (135).RHSs (32).In_Parse_Action := null;
Result (135).RHSs (32).Post_Parse_Action := object_declaration_32'Access;
Result (135).RHSs (33).In_Parse_Action := null;
Result (135).RHSs (33).Post_Parse_Action := object_declaration_33'Access;
Result (135).RHSs (34).In_Parse_Action := null;
Result (135).RHSs (34).Post_Parse_Action := object_declaration_34'Access;
Result (135).RHSs (35).In_Parse_Action := null;
Result (135).RHSs (35).Post_Parse_Action := object_declaration_35'Access;
Result (135).RHSs (36).In_Parse_Action := null;
Result (135).RHSs (36).Post_Parse_Action := object_declaration_36'Access;
Result (135).RHSs (37).In_Parse_Action := null;
Result (135).RHSs (37).Post_Parse_Action := object_declaration_37'Access;
Result (135).RHSs (38).In_Parse_Action := null;
Result (135).RHSs (38).Post_Parse_Action := object_declaration_38'Access;
Result (135).RHSs (39).In_Parse_Action := null;
Result (135).RHSs (39).Post_Parse_Action := object_declaration_39'Access;
Result (135).RHSs (40).In_Parse_Action := null;
Result (135).RHSs (40).Post_Parse_Action := object_declaration_40'Access;
Result (135).RHSs (41).In_Parse_Action := null;
Result (135).RHSs (41).Post_Parse_Action := object_declaration_41'Access;
Result (135).RHSs (42).In_Parse_Action := null;
Result (135).RHSs (42).Post_Parse_Action := object_declaration_42'Access;
Result (135).RHSs (43).In_Parse_Action := null;
Result (135).RHSs (43).Post_Parse_Action := object_declaration_43'Access;
Result (135).RHSs (44).In_Parse_Action := null;
Result (135).RHSs (44).Post_Parse_Action := object_declaration_44'Access;
Result (135).RHSs (45).In_Parse_Action := null;
Result (135).RHSs (45).Post_Parse_Action := object_declaration_45'Access;
Result (135).RHSs (46).In_Parse_Action := null;
Result (135).RHSs (46).Post_Parse_Action := object_declaration_46'Access;
Result (135).RHSs (47).In_Parse_Action := null;
Result (135).RHSs (47).Post_Parse_Action := object_declaration_47'Access;
Result (135).RHSs (48).In_Parse_Action := null;
Result (135).RHSs (48).Post_Parse_Action := null;
Result (135).RHSs (49).In_Parse_Action := null;
Result (135).RHSs (49).Post_Parse_Action := null;
Result (136).RHSs.Set_First_Last (0, 1);
Result (136).RHSs (0).In_Parse_Action := null;
Result (136).RHSs (0).Post_Parse_Action := defining_identifier_list_0'Access;
Result (136).RHSs (1).In_Parse_Action := null;
Result (136).RHSs (1).Post_Parse_Action := defining_identifier_list_1'Access;
Result (137).RHSs.Set_First_Last (0, 0);
Result (137).RHSs (0).In_Parse_Action := null;
Result (137).RHSs (0).Post_Parse_Action := number_declaration_0'Access;
Result (141).Optimized_List := True;
Result (142).RHSs.Set_First_Last (0, 0);
Result (142).RHSs (0).In_Parse_Action := null;
Result (142).RHSs (0).Post_Parse_Action := enumeration_type_definition_0'Access;
Result (144).RHSs.Set_First_Last (0, 1);
Result (144).RHSs (0).In_Parse_Action := null;
Result (144).RHSs (0).Post_Parse_Action := integer_type_definition_0'Access;
Result (144).RHSs (1).In_Parse_Action := null;
Result (144).RHSs (1).Post_Parse_Action := integer_type_definition_1'Access;
Result (155).Optimized_List := True;
Result (156).RHSs.Set_First_Last (0, 0);
Result (156).RHSs (0).In_Parse_Action := null;
Result (156).RHSs (0).Post_Parse_Action := unconstrained_array_definition_0'Access;
Result (158).Optimized_List := True;
Result (159).RHSs.Set_First_Last (0, 0);
Result (159).RHSs (0).In_Parse_Action := null;
Result (159).RHSs (0).Post_Parse_Action := constrained_array_definition_0'Access;
Result (163).RHSs.Set_First_Last (0, 1);
Result (163).RHSs (0).In_Parse_Action := null;
Result (163).RHSs (0).Post_Parse_Action := discrete_range_0'Access;
Result (163).RHSs (1).In_Parse_Action := null;
Result (163).RHSs (1).Post_Parse_Action := discrete_range_1'Access;
Result (166).Optimized_List := True;
Result (167).RHSs.Set_First_Last (0, 0);
Result (167).RHSs (0).In_Parse_Action := null;
Result (167).RHSs (0).Post_Parse_Action := known_discriminant_part_0'Access;
Result (168).RHSs.Set_First_Last (0, 5);
Result (168).RHSs (0).In_Parse_Action := null;
Result (168).RHSs (0).Post_Parse_Action := discriminant_specification_0'Access;
Result (168).RHSs (1).In_Parse_Action := null;
Result (168).RHSs (1).Post_Parse_Action := discriminant_specification_1'Access;
Result (168).RHSs (2).In_Parse_Action := null;
Result (168).RHSs (2).Post_Parse_Action := discriminant_specification_2'Access;
Result (168).RHSs (3).In_Parse_Action := null;
Result (168).RHSs (3).Post_Parse_Action := discriminant_specification_3'Access;
Result (168).RHSs (4).In_Parse_Action := null;
Result (168).RHSs (4).Post_Parse_Action := discriminant_specification_4'Access;
Result (168).RHSs (5).In_Parse_Action := null;
Result (168).RHSs (5).Post_Parse_Action := discriminant_specification_5'Access;
Result (170).RHSs.Set_First_Last (0, 2);
Result (170).RHSs (0).In_Parse_Action := null;
Result (170).RHSs (0).Post_Parse_Action := record_definition_0'Access;
Result (170).RHSs (1).In_Parse_Action := null;
Result (170).RHSs (1).Post_Parse_Action := record_definition_1'Access;
Result (170).RHSs (2).In_Parse_Action := null;
Result (170).RHSs (2).Post_Parse_Action := null;
Result (171).RHSs.Set_First_Last (0, 3);
Result (171).RHSs (0).In_Parse_Action := null;
Result (171).RHSs (0).Post_Parse_Action := null;
Result (171).RHSs (1).In_Parse_Action := null;
Result (171).RHSs (1).Post_Parse_Action := null;
Result (171).RHSs (2).In_Parse_Action := null;
Result (171).RHSs (2).Post_Parse_Action := null;
Result (171).RHSs (3).In_Parse_Action := null;
Result (171).RHSs (3).Post_Parse_Action := component_list_3'Access;
Result (173).RHSs.Set_First_Last (0, 3);
Result (173).RHSs (0).In_Parse_Action := null;
Result (173).RHSs (0).Post_Parse_Action := component_declaration_0'Access;
Result (173).RHSs (1).In_Parse_Action := null;
Result (173).RHSs (1).Post_Parse_Action := component_declaration_1'Access;
Result (173).RHSs (2).In_Parse_Action := null;
Result (173).RHSs (2).Post_Parse_Action := component_declaration_2'Access;
Result (173).RHSs (3).In_Parse_Action := null;
Result (173).RHSs (3).Post_Parse_Action := component_declaration_3'Access;
Result (174).RHSs.Set_First_Last (0, 1);
Result (174).RHSs (0).In_Parse_Action := null;
Result (174).RHSs (0).Post_Parse_Action := null;
Result (174).RHSs (1).In_Parse_Action := null;
Result (174).RHSs (1).Post_Parse_Action := variant_list_1'Access;
Result (175).RHSs.Set_First_Last (0, 0);
Result (175).RHSs (0).In_Parse_Action := null;
Result (175).RHSs (0).Post_Parse_Action := variant_part_0'Access;
Result (176).RHSs.Set_First_Last (0, 0);
Result (176).RHSs (0).In_Parse_Action := null;
Result (176).RHSs (0).Post_Parse_Action := variant_0'Access;
Result (178).RHSs.Set_First_Last (0, 3);
Result (178).RHSs (0).In_Parse_Action := null;
Result (178).RHSs (0).Post_Parse_Action := discrete_choice_0'Access;
Result (178).RHSs (1).In_Parse_Action := null;
Result (178).RHSs (1).Post_Parse_Action := discrete_choice_1'Access;
Result (178).RHSs (2).In_Parse_Action := null;
Result (178).RHSs (2).Post_Parse_Action := discrete_choice_2'Access;
Result (178).RHSs (3).In_Parse_Action := null;
Result (178).RHSs (3).Post_Parse_Action := null;
Result (179).RHSs.Set_First_Last (0, 0);
Result (179).RHSs (0).In_Parse_Action := null;
Result (179).RHSs (0).Post_Parse_Action := record_extension_part_0'Access;
Result (180).RHSs.Set_First_Last (0, 3);
Result (180).RHSs (0).In_Parse_Action := null;
Result (180).RHSs (0).Post_Parse_Action := abstract_subprogram_declaration_0'Access;
Result (180).RHSs (1).In_Parse_Action := null;
Result (180).RHSs (1).Post_Parse_Action := abstract_subprogram_declaration_1'Access;
Result (180).RHSs (2).In_Parse_Action := null;
Result (180).RHSs (2).Post_Parse_Action := abstract_subprogram_declaration_2'Access;
Result (180).RHSs (3).In_Parse_Action := null;
Result (180).RHSs (3).Post_Parse_Action := abstract_subprogram_declaration_3'Access;
Result (182).RHSs.Set_First_Last (0, 1);
Result (182).RHSs (0).In_Parse_Action := null;
Result (182).RHSs (0).Post_Parse_Action := interface_list_0'Access;
Result (182).RHSs (1).In_Parse_Action := null;
Result (182).RHSs (1).Post_Parse_Action := interface_list_1'Access;
Result (186).RHSs.Set_First_Last (0, 1);
Result (186).RHSs (0).In_Parse_Action := null;
Result (186).RHSs (0).Post_Parse_Action := access_to_subprogram_definition_0'Access;
Result (186).RHSs (1).In_Parse_Action := null;
Result (186).RHSs (1).Post_Parse_Action := access_to_subprogram_definition_1'Access;
Result (188).RHSs.Set_First_Last (0, 11);
Result (188).RHSs (0).In_Parse_Action := null;
Result (188).RHSs (0).Post_Parse_Action := access_definition_0'Access;
Result (188).RHSs (1).In_Parse_Action := null;
Result (188).RHSs (1).Post_Parse_Action := access_definition_1'Access;
Result (188).RHSs (2).In_Parse_Action := null;
Result (188).RHSs (2).Post_Parse_Action := access_definition_2'Access;
Result (188).RHSs (3).In_Parse_Action := null;
Result (188).RHSs (3).Post_Parse_Action := access_definition_3'Access;
Result (188).RHSs (4).In_Parse_Action := null;
Result (188).RHSs (4).Post_Parse_Action := access_definition_4'Access;
Result (188).RHSs (5).In_Parse_Action := null;
Result (188).RHSs (5).Post_Parse_Action := access_definition_5'Access;
Result (188).RHSs (6).In_Parse_Action := null;
Result (188).RHSs (6).Post_Parse_Action := access_definition_6'Access;
Result (188).RHSs (7).In_Parse_Action := null;
Result (188).RHSs (7).Post_Parse_Action := access_definition_7'Access;
Result (188).RHSs (8).In_Parse_Action := null;
Result (188).RHSs (8).Post_Parse_Action := access_definition_8'Access;
Result (188).RHSs (9).In_Parse_Action := null;
Result (188).RHSs (9).Post_Parse_Action := access_definition_9'Access;
Result (188).RHSs (10).In_Parse_Action := null;
Result (188).RHSs (10).Post_Parse_Action := access_definition_10'Access;
Result (188).RHSs (11).In_Parse_Action := null;
Result (188).RHSs (11).Post_Parse_Action := access_definition_11'Access;
Result (189).RHSs.Set_First_Last (0, 3);
Result (189).RHSs (0).In_Parse_Action := null;
Result (189).RHSs (0).Post_Parse_Action := incomplete_type_declaration_0'Access;
Result (189).RHSs (1).In_Parse_Action := null;
Result (189).RHSs (1).Post_Parse_Action := incomplete_type_declaration_1'Access;
Result (189).RHSs (2).In_Parse_Action := null;
Result (189).RHSs (2).Post_Parse_Action := incomplete_type_declaration_2'Access;
Result (189).RHSs (3).In_Parse_Action := null;
Result (189).RHSs (3).Post_Parse_Action := incomplete_type_declaration_3'Access;
Result (195).RHSs.Set_First_Last (0, 8);
Result (195).RHSs (0).In_Parse_Action := name_0_check'Access;
Result (195).RHSs (0).Post_Parse_Action := null;
Result (195).RHSs (1).In_Parse_Action := null;
Result (195).RHSs (1).Post_Parse_Action := null;
Result (195).RHSs (2).In_Parse_Action := null;
Result (195).RHSs (2).Post_Parse_Action := null;
Result (195).RHSs (3).In_Parse_Action := name_3_check'Access;
Result (195).RHSs (3).Post_Parse_Action := null;
Result (195).RHSs (4).In_Parse_Action := null;
Result (195).RHSs (4).Post_Parse_Action := null;
Result (195).RHSs (5).In_Parse_Action := null;
Result (195).RHSs (5).Post_Parse_Action := null;
Result (195).RHSs (6).In_Parse_Action := null;
Result (195).RHSs (6).Post_Parse_Action := null;
Result (195).RHSs (7).In_Parse_Action := null;
Result (195).RHSs (7).Post_Parse_Action := null;
Result (195).RHSs (8).In_Parse_Action := null;
Result (195).RHSs (8).Post_Parse_Action := null;
Result (196).RHSs.Set_First_Last (0, 1);
Result (196).RHSs (0).In_Parse_Action := direct_name_0_check'Access;
Result (196).RHSs (0).Post_Parse_Action := direct_name_0'Access;
Result (196).RHSs (1).In_Parse_Action := direct_name_1_check'Access;
Result (196).RHSs (1).Post_Parse_Action := null;
Result (198).RHSs.Set_First_Last (0, 0);
Result (198).RHSs (0).In_Parse_Action := null;
Result (198).RHSs (0).Post_Parse_Action := slice_0'Access;
Result (199).RHSs.Set_First_Last (0, 0);
Result (199).RHSs (0).In_Parse_Action := selected_component_0_check'Access;
Result (199).RHSs (0).Post_Parse_Action := selected_component_0'Access;
Result (204).RHSs.Set_First_Last (0, 1);
Result (204).RHSs (0).In_Parse_Action := null;
Result (204).RHSs (0).Post_Parse_Action := range_attribute_designator_0'Access;
Result (204).RHSs (1).In_Parse_Action := null;
Result (204).RHSs (1).Post_Parse_Action := range_attribute_designator_1'Access;
Result (205).RHSs.Set_First_Last (0, 6);
Result (205).RHSs (0).In_Parse_Action := null;
Result (205).RHSs (0).Post_Parse_Action := null;
Result (205).RHSs (1).In_Parse_Action := null;
Result (205).RHSs (1).Post_Parse_Action := null;
Result (205).RHSs (2).In_Parse_Action := null;
Result (205).RHSs (2).Post_Parse_Action := null;
Result (205).RHSs (3).In_Parse_Action := null;
Result (205).RHSs (3).Post_Parse_Action := null;
Result (205).RHSs (4).In_Parse_Action := null;
Result (205).RHSs (4).Post_Parse_Action := aggregate_4'Access;
Result (205).RHSs (5).In_Parse_Action := null;
Result (205).RHSs (5).Post_Parse_Action := aggregate_5'Access;
Result (205).RHSs (6).In_Parse_Action := null;
Result (205).RHSs (6).Post_Parse_Action := aggregate_6'Access;
Result (206).RHSs.Set_First_Last (0, 0);
Result (206).RHSs (0).In_Parse_Action := null;
Result (206).RHSs (0).Post_Parse_Action := record_aggregate_0'Access;
Result (208).RHSs.Set_First_Last (0, 1);
Result (208).RHSs (0).In_Parse_Action := null;
Result (208).RHSs (0).Post_Parse_Action := record_component_association_0'Access;
Result (208).RHSs (1).In_Parse_Action := null;
Result (208).RHSs (1).Post_Parse_Action := record_component_association_1'Access;
Result (209).RHSs.Set_First_Last (0, 1);
Result (209).RHSs (0).In_Parse_Action := null;
Result (209).RHSs (0).Post_Parse_Action := null;
Result (209).RHSs (1).In_Parse_Action := null;
Result (209).RHSs (1).Post_Parse_Action := component_choice_list_1'Access;
Result (210).RHSs.Set_First_Last (0, 0);
Result (210).RHSs (0).In_Parse_Action := null;
Result (210).RHSs (0).Post_Parse_Action := extension_aggregate_0'Access;
Result (212).RHSs.Set_First_Last (0, 1);
Result (212).RHSs (0).In_Parse_Action := null;
Result (212).RHSs (0).Post_Parse_Action := expression_list_0'Access;
Result (212).RHSs (1).In_Parse_Action := null;
Result (212).RHSs (1).Post_Parse_Action := expression_list_1'Access;
Result (213).RHSs.Set_First_Last (0, 3);
Result (213).RHSs (0).In_Parse_Action := null;
Result (213).RHSs (0).Post_Parse_Action := positional_array_aggregate_0'Access;
Result (213).RHSs (1).In_Parse_Action := null;
Result (213).RHSs (1).Post_Parse_Action := positional_array_aggregate_1'Access;
Result (213).RHSs (2).In_Parse_Action := null;
Result (213).RHSs (2).Post_Parse_Action := positional_array_aggregate_2'Access;
Result (213).RHSs (3).In_Parse_Action := null;
Result (213).RHSs (3).Post_Parse_Action := positional_array_aggregate_3'Access;
Result (215).RHSs.Set_First_Last (0, 1);
Result (215).RHSs (0).In_Parse_Action := null;
Result (215).RHSs (0).Post_Parse_Action := named_array_aggregate_0'Access;
Result (215).RHSs (1).In_Parse_Action := null;
Result (215).RHSs (1).Post_Parse_Action := named_array_aggregate_1'Access;
Result (216).Optimized_List := True;
Result (217).RHSs.Set_First_Last (0, 1);
Result (217).RHSs (0).In_Parse_Action := null;
Result (217).RHSs (0).Post_Parse_Action := array_component_association_0'Access;
Result (217).RHSs (1).In_Parse_Action := null;
Result (217).RHSs (1).Post_Parse_Action := null;
Result (219).RHSs.Set_First_Last (0, 0);
Result (219).RHSs (0).In_Parse_Action := null;
Result (219).RHSs (0).Post_Parse_Action := record_delta_aggregate_0'Access;
Result (220).RHSs.Set_First_Last (0, 1);
Result (220).RHSs (0).In_Parse_Action := null;
Result (220).RHSs (0).Post_Parse_Action := array_delta_aggregate_0'Access;
Result (220).RHSs (1).In_Parse_Action := null;
Result (220).RHSs (1).Post_Parse_Action := array_delta_aggregate_1'Access;
Result (221).RHSs.Set_First_Last (0, 3);
Result (221).RHSs (0).In_Parse_Action := null;
Result (221).RHSs (0).Post_Parse_Action := iterated_element_association_0'Access;
Result (221).RHSs (1).In_Parse_Action := null;
Result (221).RHSs (1).Post_Parse_Action := iterated_element_association_1'Access;
Result (221).RHSs (2).In_Parse_Action := null;
Result (221).RHSs (2).Post_Parse_Action := iterated_element_association_2'Access;
Result (221).RHSs (3).In_Parse_Action := null;
Result (221).RHSs (3).Post_Parse_Action := iterated_element_association_3'Access;
Result (229).Optimized_List := True;
Result (230).RHSs.Set_First_Last (0, 1);
Result (230).RHSs (0).In_Parse_Action := null;
Result (230).RHSs (0).Post_Parse_Action := membership_choice_0'Access;
Result (230).RHSs (1).In_Parse_Action := null;
Result (230).RHSs (1).Post_Parse_Action := membership_choice_1'Access;
Result (232).Optimized_List := True;
Result (234).RHSs.Set_First_Last (0, 4);
Result (234).RHSs (0).In_Parse_Action := null;
Result (234).RHSs (0).Post_Parse_Action := primary_0'Access;
Result (234).RHSs (1).In_Parse_Action := null;
Result (234).RHSs (1).Post_Parse_Action := null;
Result (234).RHSs (2).In_Parse_Action := null;
Result (234).RHSs (2).Post_Parse_Action := primary_2'Access;
Result (234).RHSs (3).In_Parse_Action := null;
Result (234).RHSs (3).Post_Parse_Action := null;
Result (234).RHSs (4).In_Parse_Action := null;
Result (234).RHSs (4).Post_Parse_Action := null;
Result (240).RHSs.Set_First_Last (0, 0);
Result (240).RHSs (0).In_Parse_Action := null;
Result (240).RHSs (0).Post_Parse_Action := elsif_expression_item_0'Access;
Result (241).RHSs.Set_First_Last (0, 1);
Result (241).RHSs (0).In_Parse_Action := null;
Result (241).RHSs (0).Post_Parse_Action := null;
Result (241).RHSs (1).In_Parse_Action := null;
Result (241).RHSs (1).Post_Parse_Action := elsif_expression_list_1'Access;
Result (242).RHSs.Set_First_Last (0, 3);
Result (242).RHSs (0).In_Parse_Action := null;
Result (242).RHSs (0).Post_Parse_Action := if_expression_0'Access;
Result (242).RHSs (1).In_Parse_Action := null;
Result (242).RHSs (1).Post_Parse_Action := if_expression_1'Access;
Result (242).RHSs (2).In_Parse_Action := null;
Result (242).RHSs (2).Post_Parse_Action := if_expression_2'Access;
Result (242).RHSs (3).In_Parse_Action := null;
Result (242).RHSs (3).Post_Parse_Action := if_expression_3'Access;
Result (244).RHSs.Set_First_Last (0, 1);
Result (244).RHSs (0).In_Parse_Action := null;
Result (244).RHSs (0).Post_Parse_Action := null;
Result (244).RHSs (1).In_Parse_Action := null;
Result (244).RHSs (1).Post_Parse_Action := case_expression_alternative_list_1'Access;
Result (245).RHSs.Set_First_Last (0, 0);
Result (245).RHSs (0).In_Parse_Action := null;
Result (245).RHSs (0).Post_Parse_Action := case_expression_0'Access;
Result (246).RHSs.Set_First_Last (0, 0);
Result (246).RHSs (0).In_Parse_Action := null;
Result (246).RHSs (0).Post_Parse_Action := case_expression_alternative_0'Access;
Result (247).RHSs.Set_First_Last (0, 1);
Result (247).RHSs (0).In_Parse_Action := null;
Result (247).RHSs (0).Post_Parse_Action := quantified_expression_0'Access;
Result (247).RHSs (1).In_Parse_Action := null;
Result (247).RHSs (1).Post_Parse_Action := quantified_expression_1'Access;
Result (249).RHSs.Set_First_Last (0, 1);
Result (249).RHSs (0).In_Parse_Action := null;
Result (249).RHSs (0).Post_Parse_Action := declare_expression_0'Access;
Result (249).RHSs (1).In_Parse_Action := null;
Result (249).RHSs (1).Post_Parse_Action := declare_expression_1'Access;
Result (254).RHSs.Set_First_Last (0, 0);
Result (254).RHSs (0).In_Parse_Action := null;
Result (254).RHSs (0).Post_Parse_Action := reduction_specification_0'Access;
Result (255).RHSs.Set_First_Last (0, 0);
Result (255).RHSs (0).In_Parse_Action := null;
Result (255).RHSs (0).Post_Parse_Action := qualified_expression_0'Access;
Result (257).RHSs.Set_First_Last (0, 3);
Result (257).RHSs (0).In_Parse_Action := null;
Result (257).RHSs (0).Post_Parse_Action := null;
Result (257).RHSs (1).In_Parse_Action := null;
Result (257).RHSs (1).Post_Parse_Action := null;
Result (257).RHSs (2).In_Parse_Action := null;
Result (257).RHSs (2).Post_Parse_Action := subtype_indication_paren_constraint_2'Access;
Result (257).RHSs (3).In_Parse_Action := null;
Result (257).RHSs (3).Post_Parse_Action := subtype_indication_paren_constraint_3'Access;
Result (264).RHSs.Set_First_Last (0, 0);
Result (264).RHSs (0).In_Parse_Action := null;
Result (264).RHSs (0).Post_Parse_Action := null_statement_0'Access;
Result (265).RHSs.Set_First_Last (0, 0);
Result (265).RHSs (0).In_Parse_Action := null;
Result (265).RHSs (0).Post_Parse_Action := label_0'Access;
Result (267).RHSs.Set_First_Last (0, 0);
Result (267).RHSs (0).In_Parse_Action := null;
Result (267).RHSs (0).Post_Parse_Action := assignment_statement_0'Access;
Result (269).RHSs.Set_First_Last (0, 0);
Result (269).RHSs (0).In_Parse_Action := null;
Result (269).RHSs (0).Post_Parse_Action := elsif_statement_item_0'Access;
Result (271).RHSs.Set_First_Last (0, 3);
Result (271).RHSs (0).In_Parse_Action := null;
Result (271).RHSs (0).Post_Parse_Action := if_statement_0'Access;
Result (271).RHSs (1).In_Parse_Action := null;
Result (271).RHSs (1).Post_Parse_Action := if_statement_1'Access;
Result (271).RHSs (2).In_Parse_Action := null;
Result (271).RHSs (2).Post_Parse_Action := if_statement_2'Access;
Result (271).RHSs (3).In_Parse_Action := null;
Result (271).RHSs (3).Post_Parse_Action := if_statement_3'Access;
Result (273).RHSs.Set_First_Last (0, 0);
Result (273).RHSs (0).In_Parse_Action := null;
Result (273).RHSs (0).Post_Parse_Action := case_statement_0'Access;
Result (274).RHSs.Set_First_Last (0, 0);
Result (274).RHSs (0).In_Parse_Action := null;
Result (274).RHSs (0).Post_Parse_Action := case_statement_alternative_0'Access;
Result (275).RHSs.Set_First_Last (0, 1);
Result (275).RHSs (0).In_Parse_Action := loop_statement_0_check'Access;
Result (275).RHSs (0).Post_Parse_Action := loop_statement_0'Access;
Result (275).RHSs (1).In_Parse_Action := loop_statement_1_check'Access;
Result (275).RHSs (1).Post_Parse_Action := loop_statement_1'Access;
Result (276).RHSs.Set_First_Last (0, 8);
Result (276).RHSs (0).In_Parse_Action := null;
Result (276).RHSs (0).Post_Parse_Action := iteration_scheme_0'Access;
Result (276).RHSs (1).In_Parse_Action := null;
Result (276).RHSs (1).Post_Parse_Action := iteration_scheme_1'Access;
Result (276).RHSs (2).In_Parse_Action := null;
Result (276).RHSs (2).Post_Parse_Action := iteration_scheme_2'Access;
Result (276).RHSs (3).In_Parse_Action := null;
Result (276).RHSs (3).Post_Parse_Action := iteration_scheme_3'Access;
Result (276).RHSs (4).In_Parse_Action := null;
Result (276).RHSs (4).Post_Parse_Action := iteration_scheme_4'Access;
Result (276).RHSs (5).In_Parse_Action := null;
Result (276).RHSs (5).Post_Parse_Action := iteration_scheme_5'Access;
Result (276).RHSs (6).In_Parse_Action := null;
Result (276).RHSs (6).Post_Parse_Action := iteration_scheme_6'Access;
Result (276).RHSs (7).In_Parse_Action := null;
Result (276).RHSs (7).Post_Parse_Action := iteration_scheme_7'Access;
Result (276).RHSs (8).In_Parse_Action := null;
Result (276).RHSs (8).Post_Parse_Action := iteration_scheme_8'Access;
Result (277).RHSs.Set_First_Last (0, 1);
Result (277).RHSs (0).In_Parse_Action := null;
Result (277).RHSs (0).Post_Parse_Action := chunk_specification_0'Access;
Result (277).RHSs (1).In_Parse_Action := null;
Result (277).RHSs (1).Post_Parse_Action := chunk_specification_1'Access;
Result (285).RHSs.Set_First_Last (0, 1);
Result (285).RHSs (0).In_Parse_Action := label_opt_0_check'Access;
Result (285).RHSs (0).Post_Parse_Action := null;
Result (285).RHSs (1).In_Parse_Action := null;
Result (285).RHSs (1).Post_Parse_Action := null;
Result (286).RHSs.Set_First_Last (0, 1);
Result (286).RHSs (0).In_Parse_Action := block_statement_0_check'Access;
Result (286).RHSs (0).Post_Parse_Action := block_statement_0'Access;
Result (286).RHSs (1).In_Parse_Action := block_statement_1_check'Access;
Result (286).RHSs (1).Post_Parse_Action := block_statement_1'Access;
Result (287).RHSs.Set_First_Last (0, 1);
Result (287).RHSs (0).In_Parse_Action := null;
Result (287).RHSs (0).Post_Parse_Action := null;
Result (287).RHSs (1).In_Parse_Action := null;
Result (287).RHSs (1).Post_Parse_Action := statement_AND_list_1'Access;
Result (288).RHSs.Set_First_Last (0, 0);
Result (288).RHSs (0).In_Parse_Action := null;
Result (288).RHSs (0).Post_Parse_Action := parallel_block_statement_0'Access;
Result (289).RHSs.Set_First_Last (0, 3);
Result (289).RHSs (0).In_Parse_Action := null;
Result (289).RHSs (0).Post_Parse_Action := exit_statement_0'Access;
Result (289).RHSs (1).In_Parse_Action := null;
Result (289).RHSs (1).Post_Parse_Action := exit_statement_1'Access;
Result (289).RHSs (2).In_Parse_Action := null;
Result (289).RHSs (2).Post_Parse_Action := exit_statement_2'Access;
Result (289).RHSs (3).In_Parse_Action := null;
Result (289).RHSs (3).Post_Parse_Action := exit_statement_3'Access;
Result (290).RHSs.Set_First_Last (0, 0);
Result (290).RHSs (0).In_Parse_Action := null;
Result (290).RHSs (0).Post_Parse_Action := goto_statement_0'Access;
Result (291).RHSs.Set_First_Last (0, 3);
Result (291).RHSs (0).In_Parse_Action := null;
Result (291).RHSs (0).Post_Parse_Action := subprogram_declaration_0'Access;
Result (291).RHSs (1).In_Parse_Action := null;
Result (291).RHSs (1).Post_Parse_Action := subprogram_declaration_1'Access;
Result (291).RHSs (2).In_Parse_Action := null;
Result (291).RHSs (2).Post_Parse_Action := subprogram_declaration_2'Access;
Result (291).RHSs (3).In_Parse_Action := null;
Result (291).RHSs (3).Post_Parse_Action := subprogram_declaration_3'Access;
Result (292).RHSs.Set_First_Last (0, 1);
Result (292).RHSs (0).In_Parse_Action := subprogram_specification_0_check'Access;
Result (292).RHSs (0).Post_Parse_Action := null;
Result (292).RHSs (1).In_Parse_Action := subprogram_specification_1_check'Access;
Result (292).RHSs (1).Post_Parse_Action := null;
Result (293).RHSs.Set_First_Last (0, 0);
Result (293).RHSs (0).In_Parse_Action := procedure_specification_0_check'Access;
Result (293).RHSs (0).Post_Parse_Action := procedure_specification_0'Access;
Result (294).RHSs.Set_First_Last (0, 0);
Result (294).RHSs (0).In_Parse_Action := function_specification_0_check'Access;
Result (294).RHSs (0).Post_Parse_Action := function_specification_0'Access;
Result (296).RHSs.Set_First_Last (0, 2);
Result (296).RHSs (0).In_Parse_Action := null;
Result (296).RHSs (0).Post_Parse_Action := result_profile_0'Access;
Result (296).RHSs (1).In_Parse_Action := null;
Result (296).RHSs (1).Post_Parse_Action := result_profile_1'Access;
Result (296).RHSs (2).In_Parse_Action := null;
Result (296).RHSs (2).Post_Parse_Action := result_profile_2'Access;
Result (297).RHSs.Set_First_Last (0, 1);
Result (297).RHSs (0).In_Parse_Action := null;
Result (297).RHSs (0).Post_Parse_Action := parameter_and_result_profile_0'Access;
Result (297).RHSs (1).In_Parse_Action := null;
Result (297).RHSs (1).Post_Parse_Action := null;
Result (298).Optimized_List := True;
Result (299).RHSs.Set_First_Last (0, 0);
Result (299).RHSs (0).In_Parse_Action := null;
Result (299).RHSs (0).Post_Parse_Action := formal_part_0'Access;
Result (300).RHSs.Set_First_Last (0, 9);
Result (300).RHSs (0).In_Parse_Action := null;
Result (300).RHSs (0).Post_Parse_Action := parameter_specification_0'Access;
Result (300).RHSs (1).In_Parse_Action := null;
Result (300).RHSs (1).Post_Parse_Action := parameter_specification_1'Access;
Result (300).RHSs (2).In_Parse_Action := null;
Result (300).RHSs (2).Post_Parse_Action := parameter_specification_2'Access;
Result (300).RHSs (3).In_Parse_Action := null;
Result (300).RHSs (3).Post_Parse_Action := parameter_specification_3'Access;
Result (300).RHSs (4).In_Parse_Action := null;
Result (300).RHSs (4).Post_Parse_Action := parameter_specification_4'Access;
Result (300).RHSs (5).In_Parse_Action := null;
Result (300).RHSs (5).Post_Parse_Action := parameter_specification_5'Access;
Result (300).RHSs (6).In_Parse_Action := null;
Result (300).RHSs (6).Post_Parse_Action := parameter_specification_6'Access;
Result (300).RHSs (7).In_Parse_Action := null;
Result (300).RHSs (7).Post_Parse_Action := parameter_specification_7'Access;
Result (300).RHSs (8).In_Parse_Action := null;
Result (300).RHSs (8).Post_Parse_Action := parameter_specification_8'Access;
Result (300).RHSs (9).In_Parse_Action := null;
Result (300).RHSs (9).Post_Parse_Action := parameter_specification_9'Access;
Result (306).Optimized_List := True;
Result (308).RHSs.Set_First_Last (0, 1);
Result (308).RHSs (0).In_Parse_Action := name_opt_0_check'Access;
Result (308).RHSs (0).Post_Parse_Action := null;
Result (308).RHSs (1).In_Parse_Action := null;
Result (308).RHSs (1).Post_Parse_Action := null;
Result (309).RHSs.Set_First_Last (0, 3);
Result (309).RHSs (0).In_Parse_Action := subprogram_body_0_check'Access;
Result (309).RHSs (0).Post_Parse_Action := subprogram_body_0'Access;
Result (309).RHSs (1).In_Parse_Action := subprogram_body_1_check'Access;
Result (309).RHSs (1).Post_Parse_Action := subprogram_body_1'Access;
Result (309).RHSs (2).In_Parse_Action := subprogram_body_2_check'Access;
Result (309).RHSs (2).Post_Parse_Action := subprogram_body_2'Access;
Result (309).RHSs (3).In_Parse_Action := subprogram_body_3_check'Access;
Result (309).RHSs (3).Post_Parse_Action := subprogram_body_3'Access;
Result (310).RHSs.Set_First_Last (0, 0);
Result (310).RHSs (0).In_Parse_Action := null;
Result (310).RHSs (0).Post_Parse_Action := procedure_call_statement_0'Access;
Result (311).RHSs.Set_First_Last (0, 0);
Result (311).RHSs (0).In_Parse_Action := null;
Result (311).RHSs (0).Post_Parse_Action := function_call_0'Access;
Result (313).RHSs.Set_First_Last (0, 3);
Result (313).RHSs (0).In_Parse_Action := null;
Result (313).RHSs (0).Post_Parse_Action := actual_parameter_part_0'Access;
Result (313).RHSs (1).In_Parse_Action := null;
Result (313).RHSs (1).Post_Parse_Action := actual_parameter_part_1'Access;
Result (313).RHSs (2).In_Parse_Action := null;
Result (313).RHSs (2).Post_Parse_Action := actual_parameter_part_2'Access;
Result (313).RHSs (3).In_Parse_Action := null;
Result (313).RHSs (3).Post_Parse_Action := actual_parameter_part_3'Access;
Result (314).RHSs.Set_First_Last (0, 1);
Result (314).RHSs (0).In_Parse_Action := null;
Result (314).RHSs (0).Post_Parse_Action := assoc_expression_0'Access;
Result (314).RHSs (1).In_Parse_Action := null;
Result (314).RHSs (1).Post_Parse_Action := null;
Result (315).RHSs.Set_First_Last (0, 2);
Result (315).RHSs (0).In_Parse_Action := null;
Result (315).RHSs (0).Post_Parse_Action := parameter_association_0'Access;
Result (315).RHSs (1).In_Parse_Action := null;
Result (315).RHSs (1).Post_Parse_Action := parameter_association_1'Access;
Result (315).RHSs (2).In_Parse_Action := null;
Result (315).RHSs (2).Post_Parse_Action := null;
Result (316).RHSs.Set_First_Last (0, 1);
Result (316).RHSs (0).In_Parse_Action := null;
Result (316).RHSs (0).Post_Parse_Action := simple_return_statement_0'Access;
Result (316).RHSs (1).In_Parse_Action := null;
Result (316).RHSs (1).Post_Parse_Action := simple_return_statement_1'Access;
Result (317).RHSs.Set_First_Last (0, 7);
Result (317).RHSs (0).In_Parse_Action := null;
Result (317).RHSs (0).Post_Parse_Action := extended_return_object_declaration_0'Access;
Result (317).RHSs (1).In_Parse_Action := null;
Result (317).RHSs (1).Post_Parse_Action := extended_return_object_declaration_1'Access;
Result (317).RHSs (2).In_Parse_Action := null;
Result (317).RHSs (2).Post_Parse_Action := extended_return_object_declaration_2'Access;
Result (317).RHSs (3).In_Parse_Action := null;
Result (317).RHSs (3).Post_Parse_Action := extended_return_object_declaration_3'Access;
Result (317).RHSs (4).In_Parse_Action := null;
Result (317).RHSs (4).Post_Parse_Action := extended_return_object_declaration_4'Access;
Result (317).RHSs (5).In_Parse_Action := null;
Result (317).RHSs (5).Post_Parse_Action := extended_return_object_declaration_5'Access;
Result (317).RHSs (6).In_Parse_Action := null;
Result (317).RHSs (6).Post_Parse_Action := extended_return_object_declaration_6'Access;
Result (317).RHSs (7).In_Parse_Action := null;
Result (317).RHSs (7).Post_Parse_Action := extended_return_object_declaration_7'Access;
Result (318).RHSs.Set_First_Last (0, 1);
Result (318).RHSs (0).In_Parse_Action := null;
Result (318).RHSs (0).Post_Parse_Action := extended_return_statement_0'Access;
Result (318).RHSs (1).In_Parse_Action := null;
Result (318).RHSs (1).Post_Parse_Action := extended_return_statement_1'Access;
Result (320).RHSs.Set_First_Last (0, 3);
Result (320).RHSs (0).In_Parse_Action := null;
Result (320).RHSs (0).Post_Parse_Action := null_procedure_declaration_0'Access;
Result (320).RHSs (1).In_Parse_Action := null;
Result (320).RHSs (1).Post_Parse_Action := null_procedure_declaration_1'Access;
Result (320).RHSs (2).In_Parse_Action := null;
Result (320).RHSs (2).Post_Parse_Action := null_procedure_declaration_2'Access;
Result (320).RHSs (3).In_Parse_Action := null;
Result (320).RHSs (3).Post_Parse_Action := null_procedure_declaration_3'Access;
Result (321).RHSs.Set_First_Last (0, 3);
Result (321).RHSs (0).In_Parse_Action := null;
Result (321).RHSs (0).Post_Parse_Action := expression_function_declaration_0'Access;
Result (321).RHSs (1).In_Parse_Action := null;
Result (321).RHSs (1).Post_Parse_Action := expression_function_declaration_1'Access;
Result (321).RHSs (2).In_Parse_Action := null;
Result (321).RHSs (2).Post_Parse_Action := expression_function_declaration_2'Access;
Result (321).RHSs (3).In_Parse_Action := null;
Result (321).RHSs (3).Post_Parse_Action := expression_function_declaration_3'Access;
Result (322).RHSs.Set_First_Last (0, 0);
Result (322).RHSs (0).In_Parse_Action := null;
Result (322).RHSs (0).Post_Parse_Action := package_declaration_0'Access;
Result (324).Optimized_List := True;
Result (325).RHSs.Set_First_Last (0, 11);
Result (325).RHSs (0).In_Parse_Action := package_specification_0_check'Access;
Result (325).RHSs (0).Post_Parse_Action := package_specification_0'Access;
Result (325).RHSs (1).In_Parse_Action := package_specification_1_check'Access;
Result (325).RHSs (1).Post_Parse_Action := package_specification_1'Access;
Result (325).RHSs (2).In_Parse_Action := package_specification_2_check'Access;
Result (325).RHSs (2).Post_Parse_Action := package_specification_2'Access;
Result (325).RHSs (3).In_Parse_Action := package_specification_3_check'Access;
Result (325).RHSs (3).Post_Parse_Action := package_specification_3'Access;
Result (325).RHSs (4).In_Parse_Action := package_specification_4_check'Access;
Result (325).RHSs (4).Post_Parse_Action := package_specification_4'Access;
Result (325).RHSs (5).In_Parse_Action := package_specification_5_check'Access;
Result (325).RHSs (5).Post_Parse_Action := package_specification_5'Access;
Result (325).RHSs (6).In_Parse_Action := package_specification_6_check'Access;
Result (325).RHSs (6).Post_Parse_Action := package_specification_6'Access;
Result (325).RHSs (7).In_Parse_Action := package_specification_7_check'Access;
Result (325).RHSs (7).Post_Parse_Action := package_specification_7'Access;
Result (325).RHSs (8).In_Parse_Action := package_specification_8_check'Access;
Result (325).RHSs (8).Post_Parse_Action := package_specification_8'Access;
Result (325).RHSs (9).In_Parse_Action := package_specification_9_check'Access;
Result (325).RHSs (9).Post_Parse_Action := package_specification_9'Access;
Result (325).RHSs (10).In_Parse_Action := package_specification_10_check'Access;
Result (325).RHSs (10).Post_Parse_Action := package_specification_10'Access;
Result (325).RHSs (11).In_Parse_Action := package_specification_11_check'Access;
Result (325).RHSs (11).Post_Parse_Action := package_specification_11'Access;
Result (326).RHSs.Set_First_Last (0, 3);
Result (326).RHSs (0).In_Parse_Action := package_body_0_check'Access;
Result (326).RHSs (0).Post_Parse_Action := package_body_0'Access;
Result (326).RHSs (1).In_Parse_Action := package_body_1_check'Access;
Result (326).RHSs (1).Post_Parse_Action := package_body_1'Access;
Result (326).RHSs (2).In_Parse_Action := package_body_2_check'Access;
Result (326).RHSs (2).Post_Parse_Action := package_body_2'Access;
Result (326).RHSs (3).In_Parse_Action := package_body_3_check'Access;
Result (326).RHSs (3).Post_Parse_Action := package_body_3'Access;
Result (327).RHSs.Set_First_Last (0, 23);
Result (327).RHSs (0).In_Parse_Action := null;
Result (327).RHSs (0).Post_Parse_Action := private_type_declaration_0'Access;
Result (327).RHSs (1).In_Parse_Action := null;
Result (327).RHSs (1).Post_Parse_Action := private_type_declaration_1'Access;
Result (327).RHSs (2).In_Parse_Action := null;
Result (327).RHSs (2).Post_Parse_Action := private_type_declaration_2'Access;
Result (327).RHSs (3).In_Parse_Action := null;
Result (327).RHSs (3).Post_Parse_Action := private_type_declaration_3'Access;
Result (327).RHSs (4).In_Parse_Action := null;
Result (327).RHSs (4).Post_Parse_Action := private_type_declaration_4'Access;
Result (327).RHSs (5).In_Parse_Action := null;
Result (327).RHSs (5).Post_Parse_Action := private_type_declaration_5'Access;
Result (327).RHSs (6).In_Parse_Action := null;
Result (327).RHSs (6).Post_Parse_Action := private_type_declaration_6'Access;
Result (327).RHSs (7).In_Parse_Action := null;
Result (327).RHSs (7).Post_Parse_Action := private_type_declaration_7'Access;
Result (327).RHSs (8).In_Parse_Action := null;
Result (327).RHSs (8).Post_Parse_Action := private_type_declaration_8'Access;
Result (327).RHSs (9).In_Parse_Action := null;
Result (327).RHSs (9).Post_Parse_Action := private_type_declaration_9'Access;
Result (327).RHSs (10).In_Parse_Action := null;
Result (327).RHSs (10).Post_Parse_Action := private_type_declaration_10'Access;
Result (327).RHSs (11).In_Parse_Action := null;
Result (327).RHSs (11).Post_Parse_Action := private_type_declaration_11'Access;
Result (327).RHSs (12).In_Parse_Action := null;
Result (327).RHSs (12).Post_Parse_Action := private_type_declaration_12'Access;
Result (327).RHSs (13).In_Parse_Action := null;
Result (327).RHSs (13).Post_Parse_Action := private_type_declaration_13'Access;
Result (327).RHSs (14).In_Parse_Action := null;
Result (327).RHSs (14).Post_Parse_Action := private_type_declaration_14'Access;
Result (327).RHSs (15).In_Parse_Action := null;
Result (327).RHSs (15).Post_Parse_Action := private_type_declaration_15'Access;
Result (327).RHSs (16).In_Parse_Action := null;
Result (327).RHSs (16).Post_Parse_Action := private_type_declaration_16'Access;
Result (327).RHSs (17).In_Parse_Action := null;
Result (327).RHSs (17).Post_Parse_Action := private_type_declaration_17'Access;
Result (327).RHSs (18).In_Parse_Action := null;
Result (327).RHSs (18).Post_Parse_Action := private_type_declaration_18'Access;
Result (327).RHSs (19).In_Parse_Action := null;
Result (327).RHSs (19).Post_Parse_Action := private_type_declaration_19'Access;
Result (327).RHSs (20).In_Parse_Action := null;
Result (327).RHSs (20).Post_Parse_Action := private_type_declaration_20'Access;
Result (327).RHSs (21).In_Parse_Action := null;
Result (327).RHSs (21).Post_Parse_Action := private_type_declaration_21'Access;
Result (327).RHSs (22).In_Parse_Action := null;
Result (327).RHSs (22).Post_Parse_Action := private_type_declaration_22'Access;
Result (327).RHSs (23).In_Parse_Action := null;
Result (327).RHSs (23).Post_Parse_Action := private_type_declaration_23'Access;
Result (328).RHSs.Set_First_Last (0, 47);
Result (328).RHSs (0).In_Parse_Action := null;
Result (328).RHSs (0).Post_Parse_Action := private_extension_declaration_0'Access;
Result (328).RHSs (1).In_Parse_Action := null;
Result (328).RHSs (1).Post_Parse_Action := private_extension_declaration_1'Access;
Result (328).RHSs (2).In_Parse_Action := null;
Result (328).RHSs (2).Post_Parse_Action := private_extension_declaration_2'Access;
Result (328).RHSs (3).In_Parse_Action := null;
Result (328).RHSs (3).Post_Parse_Action := private_extension_declaration_3'Access;
Result (328).RHSs (4).In_Parse_Action := null;
Result (328).RHSs (4).Post_Parse_Action := private_extension_declaration_4'Access;
Result (328).RHSs (5).In_Parse_Action := null;
Result (328).RHSs (5).Post_Parse_Action := private_extension_declaration_5'Access;
Result (328).RHSs (6).In_Parse_Action := null;
Result (328).RHSs (6).Post_Parse_Action := private_extension_declaration_6'Access;
Result (328).RHSs (7).In_Parse_Action := null;
Result (328).RHSs (7).Post_Parse_Action := private_extension_declaration_7'Access;
Result (328).RHSs (8).In_Parse_Action := null;
Result (328).RHSs (8).Post_Parse_Action := private_extension_declaration_8'Access;
Result (328).RHSs (9).In_Parse_Action := null;
Result (328).RHSs (9).Post_Parse_Action := private_extension_declaration_9'Access;
Result (328).RHSs (10).In_Parse_Action := null;
Result (328).RHSs (10).Post_Parse_Action := private_extension_declaration_10'Access;
Result (328).RHSs (11).In_Parse_Action := null;
Result (328).RHSs (11).Post_Parse_Action := private_extension_declaration_11'Access;
Result (328).RHSs (12).In_Parse_Action := null;
Result (328).RHSs (12).Post_Parse_Action := private_extension_declaration_12'Access;
Result (328).RHSs (13).In_Parse_Action := null;
Result (328).RHSs (13).Post_Parse_Action := private_extension_declaration_13'Access;
Result (328).RHSs (14).In_Parse_Action := null;
Result (328).RHSs (14).Post_Parse_Action := private_extension_declaration_14'Access;
Result (328).RHSs (15).In_Parse_Action := null;
Result (328).RHSs (15).Post_Parse_Action := private_extension_declaration_15'Access;
Result (328).RHSs (16).In_Parse_Action := null;
Result (328).RHSs (16).Post_Parse_Action := private_extension_declaration_16'Access;
Result (328).RHSs (17).In_Parse_Action := null;
Result (328).RHSs (17).Post_Parse_Action := private_extension_declaration_17'Access;
Result (328).RHSs (18).In_Parse_Action := null;
Result (328).RHSs (18).Post_Parse_Action := private_extension_declaration_18'Access;
Result (328).RHSs (19).In_Parse_Action := null;
Result (328).RHSs (19).Post_Parse_Action := private_extension_declaration_19'Access;
Result (328).RHSs (20).In_Parse_Action := null;
Result (328).RHSs (20).Post_Parse_Action := private_extension_declaration_20'Access;
Result (328).RHSs (21).In_Parse_Action := null;
Result (328).RHSs (21).Post_Parse_Action := private_extension_declaration_21'Access;
Result (328).RHSs (22).In_Parse_Action := null;
Result (328).RHSs (22).Post_Parse_Action := private_extension_declaration_22'Access;
Result (328).RHSs (23).In_Parse_Action := null;
Result (328).RHSs (23).Post_Parse_Action := private_extension_declaration_23'Access;
Result (328).RHSs (24).In_Parse_Action := null;
Result (328).RHSs (24).Post_Parse_Action := private_extension_declaration_24'Access;
Result (328).RHSs (25).In_Parse_Action := null;
Result (328).RHSs (25).Post_Parse_Action := private_extension_declaration_25'Access;
Result (328).RHSs (26).In_Parse_Action := null;
Result (328).RHSs (26).Post_Parse_Action := private_extension_declaration_26'Access;
Result (328).RHSs (27).In_Parse_Action := null;
Result (328).RHSs (27).Post_Parse_Action := private_extension_declaration_27'Access;
Result (328).RHSs (28).In_Parse_Action := null;
Result (328).RHSs (28).Post_Parse_Action := private_extension_declaration_28'Access;
Result (328).RHSs (29).In_Parse_Action := null;
Result (328).RHSs (29).Post_Parse_Action := private_extension_declaration_29'Access;
Result (328).RHSs (30).In_Parse_Action := null;
Result (328).RHSs (30).Post_Parse_Action := private_extension_declaration_30'Access;
Result (328).RHSs (31).In_Parse_Action := null;
Result (328).RHSs (31).Post_Parse_Action := private_extension_declaration_31'Access;
Result (328).RHSs (32).In_Parse_Action := null;
Result (328).RHSs (32).Post_Parse_Action := private_extension_declaration_32'Access;
Result (328).RHSs (33).In_Parse_Action := null;
Result (328).RHSs (33).Post_Parse_Action := private_extension_declaration_33'Access;
Result (328).RHSs (34).In_Parse_Action := null;
Result (328).RHSs (34).Post_Parse_Action := private_extension_declaration_34'Access;
Result (328).RHSs (35).In_Parse_Action := null;
Result (328).RHSs (35).Post_Parse_Action := private_extension_declaration_35'Access;
Result (328).RHSs (36).In_Parse_Action := null;
Result (328).RHSs (36).Post_Parse_Action := private_extension_declaration_36'Access;
Result (328).RHSs (37).In_Parse_Action := null;
Result (328).RHSs (37).Post_Parse_Action := private_extension_declaration_37'Access;
Result (328).RHSs (38).In_Parse_Action := null;
Result (328).RHSs (38).Post_Parse_Action := private_extension_declaration_38'Access;
Result (328).RHSs (39).In_Parse_Action := null;
Result (328).RHSs (39).Post_Parse_Action := private_extension_declaration_39'Access;
Result (328).RHSs (40).In_Parse_Action := null;
Result (328).RHSs (40).Post_Parse_Action := private_extension_declaration_40'Access;
Result (328).RHSs (41).In_Parse_Action := null;
Result (328).RHSs (41).Post_Parse_Action := private_extension_declaration_41'Access;
Result (328).RHSs (42).In_Parse_Action := null;
Result (328).RHSs (42).Post_Parse_Action := private_extension_declaration_42'Access;
Result (328).RHSs (43).In_Parse_Action := null;
Result (328).RHSs (43).Post_Parse_Action := private_extension_declaration_43'Access;
Result (328).RHSs (44).In_Parse_Action := null;
Result (328).RHSs (44).Post_Parse_Action := private_extension_declaration_44'Access;
Result (328).RHSs (45).In_Parse_Action := null;
Result (328).RHSs (45).Post_Parse_Action := private_extension_declaration_45'Access;
Result (328).RHSs (46).In_Parse_Action := null;
Result (328).RHSs (46).Post_Parse_Action := private_extension_declaration_46'Access;
Result (328).RHSs (47).In_Parse_Action := null;
Result (328).RHSs (47).Post_Parse_Action := private_extension_declaration_47'Access;
Result (329).RHSs.Set_First_Last (0, 1);
Result (329).RHSs (0).In_Parse_Action := null;
Result (329).RHSs (0).Post_Parse_Action := overriding_indicator_0'Access;
Result (329).RHSs (1).In_Parse_Action := null;
Result (329).RHSs (1).Post_Parse_Action := overriding_indicator_1'Access;
Result (332).RHSs.Set_First_Last (0, 0);
Result (332).RHSs (0).In_Parse_Action := null;
Result (332).RHSs (0).Post_Parse_Action := use_package_clause_0'Access;
Result (333).RHSs.Set_First_Last (0, 1);
Result (333).RHSs (0).In_Parse_Action := null;
Result (333).RHSs (0).Post_Parse_Action := use_type_clause_0'Access;
Result (333).RHSs (1).In_Parse_Action := null;
Result (333).RHSs (1).Post_Parse_Action := use_type_clause_1'Access;
Result (335).RHSs.Set_First_Last (0, 7);
Result (335).RHSs (0).In_Parse_Action := null;
Result (335).RHSs (0).Post_Parse_Action := object_renaming_declaration_0'Access;
Result (335).RHSs (1).In_Parse_Action := null;
Result (335).RHSs (1).Post_Parse_Action := object_renaming_declaration_1'Access;
Result (335).RHSs (2).In_Parse_Action := null;
Result (335).RHSs (2).Post_Parse_Action := object_renaming_declaration_2'Access;
Result (335).RHSs (3).In_Parse_Action := null;
Result (335).RHSs (3).Post_Parse_Action := object_renaming_declaration_3'Access;
Result (335).RHSs (4).In_Parse_Action := null;
Result (335).RHSs (4).Post_Parse_Action := object_renaming_declaration_4'Access;
Result (335).RHSs (5).In_Parse_Action := null;
Result (335).RHSs (5).Post_Parse_Action := object_renaming_declaration_5'Access;
Result (335).RHSs (6).In_Parse_Action := null;
Result (335).RHSs (6).Post_Parse_Action := object_renaming_declaration_6'Access;
Result (335).RHSs (7).In_Parse_Action := null;
Result (335).RHSs (7).Post_Parse_Action := object_renaming_declaration_7'Access;
Result (336).RHSs.Set_First_Last (0, 1);
Result (336).RHSs (0).In_Parse_Action := null;
Result (336).RHSs (0).Post_Parse_Action := exception_renaming_declaration_0'Access;
Result (336).RHSs (1).In_Parse_Action := null;
Result (336).RHSs (1).Post_Parse_Action := exception_renaming_declaration_1'Access;
Result (337).RHSs.Set_First_Last (0, 1);
Result (337).RHSs (0).In_Parse_Action := null;
Result (337).RHSs (0).Post_Parse_Action := package_renaming_declaration_0'Access;
Result (337).RHSs (1).In_Parse_Action := null;
Result (337).RHSs (1).Post_Parse_Action := package_renaming_declaration_1'Access;
Result (338).RHSs.Set_First_Last (0, 3);
Result (338).RHSs (0).In_Parse_Action := null;
Result (338).RHSs (0).Post_Parse_Action := subprogram_renaming_declaration_0'Access;
Result (338).RHSs (1).In_Parse_Action := null;
Result (338).RHSs (1).Post_Parse_Action := subprogram_renaming_declaration_1'Access;
Result (338).RHSs (2).In_Parse_Action := null;
Result (338).RHSs (2).Post_Parse_Action := subprogram_renaming_declaration_2'Access;
Result (338).RHSs (3).In_Parse_Action := null;
Result (338).RHSs (3).Post_Parse_Action := subprogram_renaming_declaration_3'Access;
Result (339).RHSs.Set_First_Last (0, 5);
Result (339).RHSs (0).In_Parse_Action := null;
Result (339).RHSs (0).Post_Parse_Action := generic_renaming_declaration_0'Access;
Result (339).RHSs (1).In_Parse_Action := null;
Result (339).RHSs (1).Post_Parse_Action := generic_renaming_declaration_1'Access;
Result (339).RHSs (2).In_Parse_Action := null;
Result (339).RHSs (2).Post_Parse_Action := generic_renaming_declaration_2'Access;
Result (339).RHSs (3).In_Parse_Action := null;
Result (339).RHSs (3).Post_Parse_Action := generic_renaming_declaration_3'Access;
Result (339).RHSs (4).In_Parse_Action := null;
Result (339).RHSs (4).Post_Parse_Action := generic_renaming_declaration_4'Access;
Result (339).RHSs (5).In_Parse_Action := null;
Result (339).RHSs (5).Post_Parse_Action := generic_renaming_declaration_5'Access;
Result (340).RHSs.Set_First_Last (0, 11);
Result (340).RHSs (0).In_Parse_Action := task_type_declaration_0_check'Access;
Result (340).RHSs (0).Post_Parse_Action := task_type_declaration_0'Access;
Result (340).RHSs (1).In_Parse_Action := task_type_declaration_1_check'Access;
Result (340).RHSs (1).Post_Parse_Action := task_type_declaration_1'Access;
Result (340).RHSs (2).In_Parse_Action := null;
Result (340).RHSs (2).Post_Parse_Action := task_type_declaration_2'Access;
Result (340).RHSs (3).In_Parse_Action := task_type_declaration_3_check'Access;
Result (340).RHSs (3).Post_Parse_Action := task_type_declaration_3'Access;
Result (340).RHSs (4).In_Parse_Action := task_type_declaration_4_check'Access;
Result (340).RHSs (4).Post_Parse_Action := task_type_declaration_4'Access;
Result (340).RHSs (5).In_Parse_Action := null;
Result (340).RHSs (5).Post_Parse_Action := task_type_declaration_5'Access;
Result (340).RHSs (6).In_Parse_Action := task_type_declaration_6_check'Access;
Result (340).RHSs (6).Post_Parse_Action := task_type_declaration_6'Access;
Result (340).RHSs (7).In_Parse_Action := task_type_declaration_7_check'Access;
Result (340).RHSs (7).Post_Parse_Action := task_type_declaration_7'Access;
Result (340).RHSs (8).In_Parse_Action := null;
Result (340).RHSs (8).Post_Parse_Action := task_type_declaration_8'Access;
Result (340).RHSs (9).In_Parse_Action := task_type_declaration_9_check'Access;
Result (340).RHSs (9).Post_Parse_Action := task_type_declaration_9'Access;
Result (340).RHSs (10).In_Parse_Action := task_type_declaration_10_check'Access;
Result (340).RHSs (10).Post_Parse_Action := task_type_declaration_10'Access;
Result (340).RHSs (11).In_Parse_Action := null;
Result (340).RHSs (11).Post_Parse_Action := task_type_declaration_11'Access;
Result (341).RHSs.Set_First_Last (0, 5);
Result (341).RHSs (0).In_Parse_Action := single_task_declaration_0_check'Access;
Result (341).RHSs (0).Post_Parse_Action := single_task_declaration_0'Access;
Result (341).RHSs (1).In_Parse_Action := single_task_declaration_1_check'Access;
Result (341).RHSs (1).Post_Parse_Action := single_task_declaration_1'Access;
Result (341).RHSs (2).In_Parse_Action := null;
Result (341).RHSs (2).Post_Parse_Action := single_task_declaration_2'Access;
Result (341).RHSs (3).In_Parse_Action := single_task_declaration_3_check'Access;
Result (341).RHSs (3).Post_Parse_Action := single_task_declaration_3'Access;
Result (341).RHSs (4).In_Parse_Action := single_task_declaration_4_check'Access;
Result (341).RHSs (4).Post_Parse_Action := single_task_declaration_4'Access;
Result (341).RHSs (5).In_Parse_Action := null;
Result (341).RHSs (5).Post_Parse_Action := single_task_declaration_5'Access;
Result (343).RHSs.Set_First_Last (0, 1);
Result (343).RHSs (0).In_Parse_Action := task_definition_0_check'Access;
Result (343).RHSs (0).Post_Parse_Action := task_definition_0'Access;
Result (343).RHSs (1).In_Parse_Action := task_definition_1_check'Access;
Result (343).RHSs (1).Post_Parse_Action := task_definition_1'Access;
Result (345).RHSs.Set_First_Last (0, 1);
Result (345).RHSs (0).In_Parse_Action := task_body_0_check'Access;
Result (345).RHSs (0).Post_Parse_Action := task_body_0'Access;
Result (345).RHSs (1).In_Parse_Action := task_body_1_check'Access;
Result (345).RHSs (1).Post_Parse_Action := task_body_1'Access;
Result (346).RHSs.Set_First_Last (0, 7);
Result (346).RHSs (0).In_Parse_Action := protected_type_declaration_0_check'Access;
Result (346).RHSs (0).Post_Parse_Action := protected_type_declaration_0'Access;
Result (346).RHSs (1).In_Parse_Action := protected_type_declaration_1_check'Access;
Result (346).RHSs (1).Post_Parse_Action := protected_type_declaration_1'Access;
Result (346).RHSs (2).In_Parse_Action := protected_type_declaration_2_check'Access;
Result (346).RHSs (2).Post_Parse_Action := protected_type_declaration_2'Access;
Result (346).RHSs (3).In_Parse_Action := protected_type_declaration_3_check'Access;
Result (346).RHSs (3).Post_Parse_Action := protected_type_declaration_3'Access;
Result (346).RHSs (4).In_Parse_Action := protected_type_declaration_4_check'Access;
Result (346).RHSs (4).Post_Parse_Action := protected_type_declaration_4'Access;
Result (346).RHSs (5).In_Parse_Action := protected_type_declaration_5_check'Access;
Result (346).RHSs (5).Post_Parse_Action := protected_type_declaration_5'Access;
Result (346).RHSs (6).In_Parse_Action := protected_type_declaration_6_check'Access;
Result (346).RHSs (6).Post_Parse_Action := protected_type_declaration_6'Access;
Result (346).RHSs (7).In_Parse_Action := protected_type_declaration_7_check'Access;
Result (346).RHSs (7).Post_Parse_Action := protected_type_declaration_7'Access;
Result (347).RHSs.Set_First_Last (0, 3);
Result (347).RHSs (0).In_Parse_Action := single_protected_declaration_0_check'Access;
Result (347).RHSs (0).Post_Parse_Action := single_protected_declaration_0'Access;
Result (347).RHSs (1).In_Parse_Action := single_protected_declaration_1_check'Access;
Result (347).RHSs (1).Post_Parse_Action := single_protected_declaration_1'Access;
Result (347).RHSs (2).In_Parse_Action := single_protected_declaration_2_check'Access;
Result (347).RHSs (2).Post_Parse_Action := single_protected_declaration_2'Access;
Result (347).RHSs (3).In_Parse_Action := single_protected_declaration_3_check'Access;
Result (347).RHSs (3).Post_Parse_Action := single_protected_declaration_3'Access;
Result (350).RHSs.Set_First_Last (0, 11);
Result (350).RHSs (0).In_Parse_Action := protected_definition_0_check'Access;
Result (350).RHSs (0).Post_Parse_Action := protected_definition_0'Access;
Result (350).RHSs (1).In_Parse_Action := null;
Result (350).RHSs (1).Post_Parse_Action := protected_definition_1'Access;
Result (350).RHSs (2).In_Parse_Action := protected_definition_2_check'Access;
Result (350).RHSs (2).Post_Parse_Action := protected_definition_2'Access;
Result (350).RHSs (3).In_Parse_Action := null;
Result (350).RHSs (3).Post_Parse_Action := protected_definition_3'Access;
Result (350).RHSs (4).In_Parse_Action := protected_definition_4_check'Access;
Result (350).RHSs (4).Post_Parse_Action := protected_definition_4'Access;
Result (350).RHSs (5).In_Parse_Action := null;
Result (350).RHSs (5).Post_Parse_Action := protected_definition_5'Access;
Result (350).RHSs (6).In_Parse_Action := protected_definition_6_check'Access;
Result (350).RHSs (6).Post_Parse_Action := protected_definition_6'Access;
Result (350).RHSs (7).In_Parse_Action := null;
Result (350).RHSs (7).Post_Parse_Action := protected_definition_7'Access;
Result (350).RHSs (8).In_Parse_Action := protected_definition_8_check'Access;
Result (350).RHSs (8).Post_Parse_Action := protected_definition_8'Access;
Result (350).RHSs (9).In_Parse_Action := null;
Result (350).RHSs (9).Post_Parse_Action := protected_definition_9'Access;
Result (350).RHSs (10).In_Parse_Action := protected_definition_10_check'Access;
Result (350).RHSs (10).Post_Parse_Action := protected_definition_10'Access;
Result (350).RHSs (11).In_Parse_Action := null;
Result (350).RHSs (11).Post_Parse_Action := protected_definition_11'Access;
Result (354).RHSs.Set_First_Last (0, 3);
Result (354).RHSs (0).In_Parse_Action := protected_body_0_check'Access;
Result (354).RHSs (0).Post_Parse_Action := protected_body_0'Access;
Result (354).RHSs (1).In_Parse_Action := protected_body_1_check'Access;
Result (354).RHSs (1).Post_Parse_Action := protected_body_1'Access;
Result (354).RHSs (2).In_Parse_Action := protected_body_2_check'Access;
Result (354).RHSs (2).Post_Parse_Action := protected_body_2'Access;
Result (354).RHSs (3).In_Parse_Action := protected_body_3_check'Access;
Result (354).RHSs (3).Post_Parse_Action := protected_body_3'Access;
Result (356).RHSs.Set_First_Last (0, 7);
Result (356).RHSs (0).In_Parse_Action := null;
Result (356).RHSs (0).Post_Parse_Action := entry_declaration_0'Access;
Result (356).RHSs (1).In_Parse_Action := null;
Result (356).RHSs (1).Post_Parse_Action := entry_declaration_1'Access;
Result (356).RHSs (2).In_Parse_Action := null;
Result (356).RHSs (2).Post_Parse_Action := entry_declaration_2'Access;
Result (356).RHSs (3).In_Parse_Action := null;
Result (356).RHSs (3).Post_Parse_Action := entry_declaration_3'Access;
Result (356).RHSs (4).In_Parse_Action := null;
Result (356).RHSs (4).Post_Parse_Action := entry_declaration_4'Access;
Result (356).RHSs (5).In_Parse_Action := null;
Result (356).RHSs (5).Post_Parse_Action := entry_declaration_5'Access;
Result (356).RHSs (6).In_Parse_Action := null;
Result (356).RHSs (6).Post_Parse_Action := entry_declaration_6'Access;
Result (356).RHSs (7).In_Parse_Action := null;
Result (356).RHSs (7).Post_Parse_Action := entry_declaration_7'Access;
Result (357).RHSs.Set_First_Last (0, 3);
Result (357).RHSs (0).In_Parse_Action := accept_statement_0_check'Access;
Result (357).RHSs (0).Post_Parse_Action := accept_statement_0'Access;
Result (357).RHSs (1).In_Parse_Action := null;
Result (357).RHSs (1).Post_Parse_Action := accept_statement_1'Access;
Result (357).RHSs (2).In_Parse_Action := accept_statement_2_check'Access;
Result (357).RHSs (2).Post_Parse_Action := accept_statement_2'Access;
Result (357).RHSs (3).In_Parse_Action := null;
Result (357).RHSs (3).Post_Parse_Action := accept_statement_3'Access;
Result (359).RHSs.Set_First_Last (0, 1);
Result (359).RHSs (0).In_Parse_Action := entry_body_0_check'Access;
Result (359).RHSs (0).Post_Parse_Action := entry_body_0'Access;
Result (359).RHSs (1).In_Parse_Action := entry_body_1_check'Access;
Result (359).RHSs (1).Post_Parse_Action := entry_body_1'Access;
Result (360).RHSs.Set_First_Last (0, 1);
Result (360).RHSs (0).In_Parse_Action := null;
Result (360).RHSs (0).Post_Parse_Action := entry_body_formal_part_0'Access;
Result (360).RHSs (1).In_Parse_Action := null;
Result (360).RHSs (1).Post_Parse_Action := entry_body_formal_part_1'Access;
Result (361).RHSs.Set_First_Last (0, 0);
Result (361).RHSs (0).In_Parse_Action := null;
Result (361).RHSs (0).Post_Parse_Action := entry_barrier_0'Access;
Result (363).RHSs.Set_First_Last (0, 1);
Result (363).RHSs (0).In_Parse_Action := null;
Result (363).RHSs (0).Post_Parse_Action := requeue_statement_0'Access;
Result (363).RHSs (1).In_Parse_Action := null;
Result (363).RHSs (1).Post_Parse_Action := requeue_statement_1'Access;
Result (365).RHSs.Set_First_Last (0, 0);
Result (365).RHSs (0).In_Parse_Action := null;
Result (365).RHSs (0).Post_Parse_Action := delay_until_statement_0'Access;
Result (366).RHSs.Set_First_Last (0, 0);
Result (366).RHSs (0).In_Parse_Action := null;
Result (366).RHSs (0).Post_Parse_Action := delay_relative_statement_0'Access;
Result (368).RHSs.Set_First_Last (0, 1);
Result (368).RHSs (0).In_Parse_Action := null;
Result (368).RHSs (0).Post_Parse_Action := guard_select_0'Access;
Result (368).RHSs (1).In_Parse_Action := null;
Result (368).RHSs (1).Post_Parse_Action := null;
Result (369).RHSs.Set_First_Last (0, 1);
Result (369).RHSs (0).In_Parse_Action := null;
Result (369).RHSs (0).Post_Parse_Action := null;
Result (369).RHSs (1).In_Parse_Action := null;
Result (369).RHSs (1).Post_Parse_Action := select_alternative_list_1'Access;
Result (370).RHSs.Set_First_Last (0, 1);
Result (370).RHSs (0).In_Parse_Action := null;
Result (370).RHSs (0).Post_Parse_Action := selective_accept_0'Access;
Result (370).RHSs (1).In_Parse_Action := null;
Result (370).RHSs (1).Post_Parse_Action := selective_accept_1'Access;
Result (371).RHSs.Set_First_Last (0, 0);
Result (371).RHSs (0).In_Parse_Action := null;
Result (371).RHSs (0).Post_Parse_Action := guard_0'Access;
Result (375).RHSs.Set_First_Last (0, 0);
Result (375).RHSs (0).In_Parse_Action := null;
Result (375).RHSs (0).Post_Parse_Action := terminate_alternative_0'Access;
Result (376).RHSs.Set_First_Last (0, 0);
Result (376).RHSs (0).In_Parse_Action := null;
Result (376).RHSs (0).Post_Parse_Action := timed_entry_call_0'Access;
Result (378).RHSs.Set_First_Last (0, 0);
Result (378).RHSs (0).In_Parse_Action := null;
Result (378).RHSs (0).Post_Parse_Action := conditional_entry_call_0'Access;
Result (379).RHSs.Set_First_Last (0, 0);
Result (379).RHSs (0).In_Parse_Action := null;
Result (379).RHSs (0).Post_Parse_Action := asynchronous_select_0'Access;
Result (382).RHSs.Set_First_Last (0, 0);
Result (382).RHSs (0).In_Parse_Action := null;
Result (382).RHSs (0).Post_Parse_Action := abort_statement_0'Access;
Result (383).RHSs.Set_First_Last (0, 1);
Result (383).RHSs (0).In_Parse_Action := compilation_0_check'Access;
Result (383).RHSs (0).Post_Parse_Action := compilation_0'Access;
Result (383).RHSs (1).In_Parse_Action := null;
Result (383).RHSs (1).Post_Parse_Action := compilation_1'Access;
Result (384).RHSs.Set_First_Last (0, 5);
Result (384).RHSs (0).In_Parse_Action := null;
Result (384).RHSs (0).Post_Parse_Action := null;
Result (384).RHSs (1).In_Parse_Action := null;
Result (384).RHSs (1).Post_Parse_Action := compilation_unit_1'Access;
Result (384).RHSs (2).In_Parse_Action := null;
Result (384).RHSs (2).Post_Parse_Action := compilation_unit_2'Access;
Result (384).RHSs (3).In_Parse_Action := null;
Result (384).RHSs (3).Post_Parse_Action := null;
Result (384).RHSs (4).In_Parse_Action := null;
Result (384).RHSs (4).Post_Parse_Action := null;
Result (384).RHSs (5).In_Parse_Action := null;
Result (384).RHSs (5).Post_Parse_Action := null;
Result (386).RHSs.Set_First_Last (0, 1);
Result (386).RHSs (0).In_Parse_Action := null;
Result (386).RHSs (0).Post_Parse_Action := limited_with_clause_0'Access;
Result (386).RHSs (1).In_Parse_Action := null;
Result (386).RHSs (1).Post_Parse_Action := limited_with_clause_1'Access;
Result (387).RHSs.Set_First_Last (0, 1);
Result (387).RHSs (0).In_Parse_Action := null;
Result (387).RHSs (0).Post_Parse_Action := nonlimited_with_clause_0'Access;
Result (387).RHSs (1).In_Parse_Action := null;
Result (387).RHSs (1).Post_Parse_Action := nonlimited_with_clause_1'Access;
Result (389).RHSs.Set_First_Last (0, 3);
Result (389).RHSs (0).In_Parse_Action := null;
Result (389).RHSs (0).Post_Parse_Action := subprogram_body_stub_0'Access;
Result (389).RHSs (1).In_Parse_Action := null;
Result (389).RHSs (1).Post_Parse_Action := subprogram_body_stub_1'Access;
Result (389).RHSs (2).In_Parse_Action := null;
Result (389).RHSs (2).Post_Parse_Action := subprogram_body_stub_2'Access;
Result (389).RHSs (3).In_Parse_Action := null;
Result (389).RHSs (3).Post_Parse_Action := subprogram_body_stub_3'Access;
Result (390).RHSs.Set_First_Last (0, 1);
Result (390).RHSs (0).In_Parse_Action := null;
Result (390).RHSs (0).Post_Parse_Action := package_body_stub_0'Access;
Result (390).RHSs (1).In_Parse_Action := null;
Result (390).RHSs (1).Post_Parse_Action := package_body_stub_1'Access;
Result (391).RHSs.Set_First_Last (0, 1);
Result (391).RHSs (0).In_Parse_Action := null;
Result (391).RHSs (0).Post_Parse_Action := task_body_stub_0'Access;
Result (391).RHSs (1).In_Parse_Action := null;
Result (391).RHSs (1).Post_Parse_Action := task_body_stub_1'Access;
Result (392).RHSs.Set_First_Last (0, 1);
Result (392).RHSs (0).In_Parse_Action := null;
Result (392).RHSs (0).Post_Parse_Action := protected_body_stub_0'Access;
Result (392).RHSs (1).In_Parse_Action := null;
Result (392).RHSs (1).Post_Parse_Action := protected_body_stub_1'Access;
Result (393).RHSs.Set_First_Last (0, 0);
Result (393).RHSs (0).In_Parse_Action := null;
Result (393).RHSs (0).Post_Parse_Action := subunit_0'Access;
Result (394).RHSs.Set_First_Last (0, 1);
Result (394).RHSs (0).In_Parse_Action := null;
Result (394).RHSs (0).Post_Parse_Action := exception_declaration_0'Access;
Result (394).RHSs (1).In_Parse_Action := null;
Result (394).RHSs (1).Post_Parse_Action := exception_declaration_1'Access;
Result (395).RHSs.Set_First_Last (0, 2);
Result (395).RHSs (0).In_Parse_Action := null;
Result (395).RHSs (0).Post_Parse_Action := null;
Result (395).RHSs (1).In_Parse_Action := null;
Result (395).RHSs (1).Post_Parse_Action := null;
Result (395).RHSs (2).In_Parse_Action := null;
Result (395).RHSs (2).Post_Parse_Action := exception_handler_list_2'Access;
Result (396).RHSs.Set_First_Last (0, 1);
Result (396).RHSs (0).In_Parse_Action := null;
Result (396).RHSs (0).Post_Parse_Action := handled_sequence_of_statements_0'Access;
Result (396).RHSs (1).In_Parse_Action := null;
Result (396).RHSs (1).Post_Parse_Action := handled_sequence_of_statements_1'Access;
Result (397).Optimized_List := True;
Result (398).RHSs.Set_First_Last (0, 1);
Result (398).RHSs (0).In_Parse_Action := null;
Result (398).RHSs (0).Post_Parse_Action := exception_handler_0'Access;
Result (398).RHSs (1).In_Parse_Action := null;
Result (398).RHSs (1).Post_Parse_Action := exception_handler_1'Access;
Result (401).RHSs.Set_First_Last (0, 2);
Result (401).RHSs (0).In_Parse_Action := null;
Result (401).RHSs (0).Post_Parse_Action := raise_statement_0'Access;
Result (401).RHSs (1).In_Parse_Action := null;
Result (401).RHSs (1).Post_Parse_Action := raise_statement_1'Access;
Result (401).RHSs (2).In_Parse_Action := null;
Result (401).RHSs (2).Post_Parse_Action := raise_statement_2'Access;
Result (402).RHSs.Set_First_Last (0, 1);
Result (402).RHSs (0).In_Parse_Action := null;
Result (402).RHSs (0).Post_Parse_Action := raise_expression_0'Access;
Result (402).RHSs (1).In_Parse_Action := null;
Result (402).RHSs (1).Post_Parse_Action := raise_expression_1'Access;
Result (404).RHSs.Set_First_Last (0, 1);
Result (404).RHSs (0).In_Parse_Action := null;
Result (404).RHSs (0).Post_Parse_Action := generic_subprogram_declaration_0'Access;
Result (404).RHSs (1).In_Parse_Action := null;
Result (404).RHSs (1).Post_Parse_Action := generic_subprogram_declaration_1'Access;
Result (405).RHSs.Set_First_Last (0, 0);
Result (405).RHSs (0).In_Parse_Action := null;
Result (405).RHSs (0).Post_Parse_Action := generic_package_declaration_0'Access;
Result (406).RHSs.Set_First_Last (0, 1);
Result (406).RHSs (0).In_Parse_Action := null;
Result (406).RHSs (0).Post_Parse_Action := generic_formal_part_0'Access;
Result (406).RHSs (1).In_Parse_Action := null;
Result (406).RHSs (1).Post_Parse_Action := generic_formal_part_1'Access;
Result (408).RHSs.Set_First_Last (0, 9);
Result (408).RHSs (0).In_Parse_Action := null;
Result (408).RHSs (0).Post_Parse_Action := generic_instantiation_0'Access;
Result (408).RHSs (1).In_Parse_Action := null;
Result (408).RHSs (1).Post_Parse_Action := generic_instantiation_1'Access;
Result (408).RHSs (2).In_Parse_Action := null;
Result (408).RHSs (2).Post_Parse_Action := generic_instantiation_2'Access;
Result (408).RHSs (3).In_Parse_Action := null;
Result (408).RHSs (3).Post_Parse_Action := generic_instantiation_3'Access;
Result (408).RHSs (4).In_Parse_Action := null;
Result (408).RHSs (4).Post_Parse_Action := generic_instantiation_4'Access;
Result (408).RHSs (5).In_Parse_Action := null;
Result (408).RHSs (5).Post_Parse_Action := generic_instantiation_5'Access;
Result (408).RHSs (6).In_Parse_Action := null;
Result (408).RHSs (6).Post_Parse_Action := generic_instantiation_6'Access;
Result (408).RHSs (7).In_Parse_Action := null;
Result (408).RHSs (7).Post_Parse_Action := generic_instantiation_7'Access;
Result (408).RHSs (8).In_Parse_Action := null;
Result (408).RHSs (8).Post_Parse_Action := generic_instantiation_8'Access;
Result (408).RHSs (9).In_Parse_Action := null;
Result (408).RHSs (9).Post_Parse_Action := generic_instantiation_9'Access;
Result (409).RHSs.Set_First_Last (0, 11);
Result (409).RHSs (0).In_Parse_Action := null;
Result (409).RHSs (0).Post_Parse_Action := formal_object_declaration_0'Access;
Result (409).RHSs (1).In_Parse_Action := null;
Result (409).RHSs (1).Post_Parse_Action := formal_object_declaration_1'Access;
Result (409).RHSs (2).In_Parse_Action := null;
Result (409).RHSs (2).Post_Parse_Action := formal_object_declaration_2'Access;
Result (409).RHSs (3).In_Parse_Action := null;
Result (409).RHSs (3).Post_Parse_Action := formal_object_declaration_3'Access;
Result (409).RHSs (4).In_Parse_Action := null;
Result (409).RHSs (4).Post_Parse_Action := formal_object_declaration_4'Access;
Result (409).RHSs (5).In_Parse_Action := null;
Result (409).RHSs (5).Post_Parse_Action := formal_object_declaration_5'Access;
Result (409).RHSs (6).In_Parse_Action := null;
Result (409).RHSs (6).Post_Parse_Action := formal_object_declaration_6'Access;
Result (409).RHSs (7).In_Parse_Action := null;
Result (409).RHSs (7).Post_Parse_Action := formal_object_declaration_7'Access;
Result (409).RHSs (8).In_Parse_Action := null;
Result (409).RHSs (8).Post_Parse_Action := formal_object_declaration_8'Access;
Result (409).RHSs (9).In_Parse_Action := null;
Result (409).RHSs (9).Post_Parse_Action := formal_object_declaration_9'Access;
Result (409).RHSs (10).In_Parse_Action := null;
Result (409).RHSs (10).Post_Parse_Action := formal_object_declaration_10'Access;
Result (409).RHSs (11).In_Parse_Action := null;
Result (409).RHSs (11).Post_Parse_Action := formal_object_declaration_11'Access;
Result (411).RHSs.Set_First_Last (0, 7);
Result (411).RHSs (0).In_Parse_Action := null;
Result (411).RHSs (0).Post_Parse_Action := formal_complete_type_declaration_0'Access;
Result (411).RHSs (1).In_Parse_Action := null;
Result (411).RHSs (1).Post_Parse_Action := formal_complete_type_declaration_1'Access;
Result (411).RHSs (2).In_Parse_Action := null;
Result (411).RHSs (2).Post_Parse_Action := formal_complete_type_declaration_2'Access;
Result (411).RHSs (3).In_Parse_Action := null;
Result (411).RHSs (3).Post_Parse_Action := formal_complete_type_declaration_3'Access;
Result (411).RHSs (4).In_Parse_Action := null;
Result (411).RHSs (4).Post_Parse_Action := formal_complete_type_declaration_4'Access;
Result (411).RHSs (5).In_Parse_Action := null;
Result (411).RHSs (5).Post_Parse_Action := formal_complete_type_declaration_5'Access;
Result (411).RHSs (6).In_Parse_Action := null;
Result (411).RHSs (6).Post_Parse_Action := formal_complete_type_declaration_6'Access;
Result (411).RHSs (7).In_Parse_Action := null;
Result (411).RHSs (7).Post_Parse_Action := formal_complete_type_declaration_7'Access;
Result (412).RHSs.Set_First_Last (0, 7);
Result (412).RHSs (0).In_Parse_Action := null;
Result (412).RHSs (0).Post_Parse_Action := formal_incomplete_type_declaration_0'Access;
Result (412).RHSs (1).In_Parse_Action := null;
Result (412).RHSs (1).Post_Parse_Action := formal_incomplete_type_declaration_1'Access;
Result (412).RHSs (2).In_Parse_Action := null;
Result (412).RHSs (2).Post_Parse_Action := formal_incomplete_type_declaration_2'Access;
Result (412).RHSs (3).In_Parse_Action := null;
Result (412).RHSs (3).Post_Parse_Action := formal_incomplete_type_declaration_3'Access;
Result (412).RHSs (4).In_Parse_Action := null;
Result (412).RHSs (4).Post_Parse_Action := formal_incomplete_type_declaration_4'Access;
Result (412).RHSs (5).In_Parse_Action := null;
Result (412).RHSs (5).Post_Parse_Action := formal_incomplete_type_declaration_5'Access;
Result (412).RHSs (6).In_Parse_Action := null;
Result (412).RHSs (6).Post_Parse_Action := formal_incomplete_type_declaration_6'Access;
Result (412).RHSs (7).In_Parse_Action := null;
Result (412).RHSs (7).Post_Parse_Action := formal_incomplete_type_declaration_7'Access;
Result (415).RHSs.Set_First_Last (0, 17);
Result (415).RHSs (0).In_Parse_Action := null;
Result (415).RHSs (0).Post_Parse_Action := formal_derived_type_definition_0'Access;
Result (415).RHSs (1).In_Parse_Action := null;
Result (415).RHSs (1).Post_Parse_Action := formal_derived_type_definition_1'Access;
Result (415).RHSs (2).In_Parse_Action := null;
Result (415).RHSs (2).Post_Parse_Action := formal_derived_type_definition_2'Access;
Result (415).RHSs (3).In_Parse_Action := null;
Result (415).RHSs (3).Post_Parse_Action := formal_derived_type_definition_3'Access;
Result (415).RHSs (4).In_Parse_Action := null;
Result (415).RHSs (4).Post_Parse_Action := formal_derived_type_definition_4'Access;
Result (415).RHSs (5).In_Parse_Action := null;
Result (415).RHSs (5).Post_Parse_Action := formal_derived_type_definition_5'Access;
Result (415).RHSs (6).In_Parse_Action := null;
Result (415).RHSs (6).Post_Parse_Action := formal_derived_type_definition_6'Access;
Result (415).RHSs (7).In_Parse_Action := null;
Result (415).RHSs (7).Post_Parse_Action := formal_derived_type_definition_7'Access;
Result (415).RHSs (8).In_Parse_Action := null;
Result (415).RHSs (8).Post_Parse_Action := formal_derived_type_definition_8'Access;
Result (415).RHSs (9).In_Parse_Action := null;
Result (415).RHSs (9).Post_Parse_Action := formal_derived_type_definition_9'Access;
Result (415).RHSs (10).In_Parse_Action := null;
Result (415).RHSs (10).Post_Parse_Action := formal_derived_type_definition_10'Access;
Result (415).RHSs (11).In_Parse_Action := null;
Result (415).RHSs (11).Post_Parse_Action := formal_derived_type_definition_11'Access;
Result (415).RHSs (12).In_Parse_Action := null;
Result (415).RHSs (12).Post_Parse_Action := formal_derived_type_definition_12'Access;
Result (415).RHSs (13).In_Parse_Action := null;
Result (415).RHSs (13).Post_Parse_Action := formal_derived_type_definition_13'Access;
Result (415).RHSs (14).In_Parse_Action := null;
Result (415).RHSs (14).Post_Parse_Action := formal_derived_type_definition_14'Access;
Result (415).RHSs (15).In_Parse_Action := null;
Result (415).RHSs (15).Post_Parse_Action := formal_derived_type_definition_15'Access;
Result (415).RHSs (16).In_Parse_Action := null;
Result (415).RHSs (16).Post_Parse_Action := formal_derived_type_definition_16'Access;
Result (415).RHSs (17).In_Parse_Action := null;
Result (415).RHSs (17).Post_Parse_Action := formal_derived_type_definition_17'Access;
Result (426).RHSs.Set_First_Last (0, 3);
Result (426).RHSs (0).In_Parse_Action := null;
Result (426).RHSs (0).Post_Parse_Action := formal_concrete_subprogram_declaration_0'Access;
Result (426).RHSs (1).In_Parse_Action := null;
Result (426).RHSs (1).Post_Parse_Action := formal_concrete_subprogram_declaration_1'Access;
Result (426).RHSs (2).In_Parse_Action := null;
Result (426).RHSs (2).Post_Parse_Action := formal_concrete_subprogram_declaration_2'Access;
Result (426).RHSs (3).In_Parse_Action := null;
Result (426).RHSs (3).Post_Parse_Action := formal_concrete_subprogram_declaration_3'Access;
Result (427).RHSs.Set_First_Last (0, 3);
Result (427).RHSs (0).In_Parse_Action := null;
Result (427).RHSs (0).Post_Parse_Action := formal_abstract_subprogram_declaration_0'Access;
Result (427).RHSs (1).In_Parse_Action := null;
Result (427).RHSs (1).Post_Parse_Action := formal_abstract_subprogram_declaration_1'Access;
Result (427).RHSs (2).In_Parse_Action := null;
Result (427).RHSs (2).Post_Parse_Action := formal_abstract_subprogram_declaration_2'Access;
Result (427).RHSs (3).In_Parse_Action := null;
Result (427).RHSs (3).Post_Parse_Action := formal_abstract_subprogram_declaration_3'Access;
Result (429).RHSs.Set_First_Last (0, 0);
Result (429).RHSs (0).In_Parse_Action := null;
Result (429).RHSs (0).Post_Parse_Action := default_name_0'Access;
Result (430).RHSs.Set_First_Last (0, 1);
Result (430).RHSs (0).In_Parse_Action := null;
Result (430).RHSs (0).Post_Parse_Action := formal_package_declaration_0'Access;
Result (430).RHSs (1).In_Parse_Action := null;
Result (430).RHSs (1).Post_Parse_Action := formal_package_declaration_1'Access;
Result (432).RHSs.Set_First_Last (0, 1);
Result (432).RHSs (0).In_Parse_Action := null;
Result (432).RHSs (0).Post_Parse_Action := aspect_association_0'Access;
Result (432).RHSs (1).In_Parse_Action := null;
Result (432).RHSs (1).Post_Parse_Action := aspect_association_1'Access;
Result (434).RHSs.Set_First_Last (0, 0);
Result (434).RHSs (0).In_Parse_Action := null;
Result (434).RHSs (0).Post_Parse_Action := aspect_specification_0'Access;
Result (437).RHSs.Set_First_Last (0, 0);
Result (437).RHSs (0).In_Parse_Action := null;
Result (437).RHSs (0).Post_Parse_Action := attribute_definition_clause_0'Access;
Result (438).RHSs.Set_First_Last (0, 0);
Result (438).RHSs (0).In_Parse_Action := null;
Result (438).RHSs (0).Post_Parse_Action := enumeration_representation_clause_0'Access;
Result (440).RHSs.Set_First_Last (0, 7);
Result (440).RHSs (0).In_Parse_Action := null;
Result (440).RHSs (0).Post_Parse_Action := record_representation_clause_0'Access;
Result (440).RHSs (1).In_Parse_Action := null;
Result (440).RHSs (1).Post_Parse_Action := record_representation_clause_1'Access;
Result (440).RHSs (2).In_Parse_Action := null;
Result (440).RHSs (2).Post_Parse_Action := record_representation_clause_2'Access;
Result (440).RHSs (3).In_Parse_Action := null;
Result (440).RHSs (3).Post_Parse_Action := record_representation_clause_3'Access;
Result (440).RHSs (4).In_Parse_Action := null;
Result (440).RHSs (4).Post_Parse_Action := record_representation_clause_4'Access;
Result (440).RHSs (5).In_Parse_Action := null;
Result (440).RHSs (5).Post_Parse_Action := record_representation_clause_5'Access;
Result (440).RHSs (6).In_Parse_Action := null;
Result (440).RHSs (6).Post_Parse_Action := record_representation_clause_6'Access;
Result (440).RHSs (7).In_Parse_Action := null;
Result (440).RHSs (7).Post_Parse_Action := record_representation_clause_7'Access;
Result (441).RHSs.Set_First_Last (0, 0);
Result (441).RHSs (0).In_Parse_Action := null;
Result (441).RHSs (0).Post_Parse_Action := component_clause_0'Access;
Result (451).Optimized_List := True;
Result (453).RHSs.Set_First_Last (0, 1);
Result (453).RHSs (0).In_Parse_Action := null;
Result (453).RHSs (0).Post_Parse_Action := delta_constraint_0'Access;
Result (453).RHSs (1).In_Parse_Action := null;
Result (453).RHSs (1).Post_Parse_Action := delta_constraint_1'Access;
Result (454).RHSs.Set_First_Last (0, 0);
Result (454).RHSs (0).In_Parse_Action := null;
Result (454).RHSs (0).Post_Parse_Action := at_clause_0'Access;
Result (456).Optimized_List := True;
Result (457).Optimized_List := True;
Result (458).Optimized_List := True;
Result (459).Optimized_List := True;
Result (460).Optimized_List := True;
Result (461).Optimized_List := True;
Result (462).Optimized_List := True;
Result (463).Optimized_List := True;
Result (464).Optimized_List := True;
Result (465).Optimized_List := True;
Result (466).Optimized_List := True;
end return;
end Create_Productions;
function Create_Parser
(Trace : in WisiToken.Trace_Access;
User_Data : in WisiToken.Syntax_Trees.User_Data_Access;
Language_Fixes : in WisiToken.Parse.LR.Parser.Language_Fixes_Access;
Language_Matching_Begin_Tokens : in WisiToken.Parse.LR.Parser.Language_Matching_Begin_Tokens_Access;
Language_String_ID_Set : in WisiToken.Parse.LR.Parser.Language_String_ID_Set_Access;
Text_Rep_File_Name : in String)
return WisiToken.Parse.LR.Parser.Parser
is begin
return Parser : WisiToken.Parse.LR.Parser.Parser do
Parser.Tree.Lexer := Lexer.New_Lexer (Trace, Ada_Annex_P_Process_Actions.Descriptor'Access);
Parser.Productions := Create_Productions;
Parser.User_Data := User_Data;
Parser.Partial_Parse_Active := Ada_Annex_P_Process_Actions.Partial_Parse_Active'Access;
Parser.Partial_Parse_Byte_Goal := Ada_Annex_P_Process_Actions.Partial_Parse_Byte_Goal'Access;
Parser.Table := Create_Parse_Table (Text_Rep_File_Name);
Parser.Language_Fixes := Language_Fixes;
Parser.Language_Matching_Begin_Tokens := Language_Matching_Begin_Tokens;
Parser.Language_String_ID_Set := Language_String_ID_Set;
end return;
end Create_Parser;
end Ada_Annex_P_Process_LR1_Main;
|
ribasco/rpi-tools | Ada | 126 | ads | -- { dg-do compile }
with Array5_Pkg1; use Array5_Pkg1;
package Array5 is
C : constant Integer := Arr'Last;
end Array5;
|
stcarrez/ada-wiki | Ada | 2,773 | ads | -----------------------------------------------------------------------
-- wiki-streams -- Wiki input and output streams
-- Copyright (C) 2011, 2012, 2013, 2015, 2016, 2020, 2022 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Wiki.Strings;
-- == Input and Output streams {#wiki-streams} ==
-- The `Wiki.Streams` package defines the interfaces used by
-- the parser or renderer to read and write their outputs.
--
-- The `Input_Stream` interface defines the interface that must be implemented to
-- read the source Wiki content. The `Read` procedure is called by the parser
-- repeatedly while scanning the Wiki content.
--
-- The `Output_Stream` interface is the interface used by the renderer
-- to write their outputs. It defines the `Write` procedure to write
-- a single character or a string.
--
-- @include wiki-streams-html.ads
-- @include wiki-streams-builders.ads
-- @include wiki-streams-html-builders.ads
-- @include wiki-streams-text_io.ads
-- @include wiki-streams-html-text_io.ads
package Wiki.Streams is
pragma Preelaborate;
type Input_Stream is limited interface;
type Input_Stream_Access is access all Input_Stream'Class;
-- Read the input stream and fill the `Into` buffer until either it is full or
-- we reach the end of line. Returns in `Last` the last valid position in the
-- `Into` buffer. When there is no character to read, return True in
-- the `Eof` indicator.
procedure Read (Input : in out Input_Stream;
Into : in out Wiki.Strings.WString;
Last : out Natural;
Eof : out Boolean) is abstract;
type Output_Stream is limited interface;
type Output_Stream_Access is access all Output_Stream'Class;
-- Write the string to the output stream.
procedure Write (Stream : in out Output_Stream;
Content : in Wiki.Strings.WString) is abstract;
-- Write a single character to the output stream.
procedure Write (Stream : in out Output_Stream;
Char : in Wiki.Strings.WChar) is abstract;
end Wiki.Streams;
|
zrmyers/VulkanAda | Ada | 6,864 | 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.GenFMatrix;
with Vulkan.Math.Vec4;
use Vulkan.Math.GenFMatrix;
use Vulkan.Math.Vec4;
--------------------------------------------------------------------------------
--< @group Vulkan Math Basic Types
--------------------------------------------------------------------------------
--< @summary
--< This package provides a single precision floating point matrix with 2 rows
--< and 4 columns.
--------------------------------------------------------------------------------
package Vulkan.Math.Mat3x4 is
pragma Preelaborate;
pragma Pure;
--< A 2x3 matrix of single-precision floating point numbers.
subtype Vkm_Mat3x4 is Vkm_Mat(
last_row_index => 2, last_column_index => 3);
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Mat3x4 type.
--<
--< @description
--< Construct a 2x3 matrix with each component set to zero.
--<
--< @return
--< A 2x3 matrix.
----------------------------------------------------------------------------
function Make_Mat3x4 return Vkm_Mat3x4 is
(GFM.Make_GenMatrix(cN => 3, rN => 2)) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Mat3x4 type.
--<
--< @description
--< Construct a 2x3 matrix with each component set to a different value.
--<
--< | value1 value3 value5 value7 |
--< | value2 value4 value6 value8 |
--<
--< @param value1
--< The first value to set for the matrix.
--<
--< @param value2
--< The second value to set for the matrix.
--<
--< @param value3
--< The third value to set for the matrix.
--<
--< @param value4
--< The fourth value to set for the matrix.
--<
--< @param value5
--< The fifth value to set for the matrix.
--<
--< @param value6
--< The sixth value to set for the matrix.
--<
--< @param value7
--< The seventh value to set for the matrix.
--<
--< @param value8
--< The eighth value to set for the matrix.
--<
--< @param value9
--< The ninth value to set for the matrix.
--<
--< @param value10
--< The tenth value to set for the matrix.
--<
--< @param value11
--< The eleventh value to set for the matrix.
--<
--< @return
--< A 3x4 matrix.
----------------------------------------------------------------------------
function Make_Mat3x4 (
value1, value2 , value3 , value4 ,
value5, value6 , value7 , value8 ,
value9, value10, value11, value12 : in Vkm_Float) return Vkm_Mat3x4 is
(GFM.Make_GenMatrix(
cN => 3, rN => 2,
c0r0_val => value1, c0r1_val => value5, c0r2_val => value9,
c1r0_val => value2, c1r1_val => value6, c1r2_val => value10,
c2r0_val => value3, c2r1_val => value7, c2r2_val => value11,
c3r0_val => value4, c3r1_val => value8, c3r2_val => value12)) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Mat3x4 type.
--<
--< @description
--< Construct a 3x4 matrix with each row set to the value of a 4 dimmensional
--< vector.
--<
--< | value1.x value1.y value1.z value1.w |
--< | value2.x value2.y value2.z value2.w |
--<
--< @param value1
--< The first value to set for the matrix.
--<
--< @param value2
--< The second value to set for the matrix.
--<
--< @return
--< A 3x4 matrix.
----------------------------------------------------------------------------
function Make_Mat3x4 (
value1, value2, value3: in Vkm_Vec4) return Vkm_Mat3x4 is
(GFM.Make_GenMatrix(
cN => 3, rN => 2,
c0r0_val => value1.x, c0r1_val => value2.x, c0r2_val => value3.x,
c1r0_val => value1.y, c1r1_val => value2.y, c1r2_val => value3.y,
c2r0_val => value1.z, c2r1_val => value2.z, c2r2_val => value3.z,
c3r0_val => value1.w, c3r1_val => value2.w, c3r2_val => value3.w)) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Mat3x4 type.
--<
--< @description
--< Construct a 2x3 matrix using values from an existing matrix.
--<
--< If the provided matrix has dimmensions that are not the same as this
--< matrix, the corresponding element in the 4x4 identity matrix is used for
--< out of bounds accesses.
--<
--< @param value1
--< The submatrix to extract values from.
--<
--< @return
--< A 3x4 matrix.
----------------------------------------------------------------------------
function Make_Mat3x4 (
value1 : in Vkm_Mat) return Vkm_Mat3x4 is
(GFM.Make_GenMatrix(
cN => 3, rN => 2,
c0r0_val => value1.c0r0, c0r1_val => value1.c0r1, c0r2_val => value1.c0r2,
c1r0_val => value1.c1r0, c1r1_val => value1.c1r1, c1r2_val => value1.c1r2,
c2r0_val => value1.c2r0, c2r1_val => value1.c2r1, c2r2_val => value1.c2r2,
c3r0_val => value1.c3r0, c3r1_val => value1.c3r1, c3r2_val => value1.c3r2)) with Inline;
end Vulkan.Math.Mat3x4;
|
AdaCore/training_material | Ada | 7,480 | adb | ------------------------------------------------------------------------------
-- --
-- Hardware Abstraction Layer for STM32 Targets --
-- --
-- Copyright (C) 2014, 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 STM32F4.RCC; use STM32F4.RCC;
package body STM32F4.SPI is
Baud_Rate_Value : constant array (SPI_Baud_Rate_Prescaler) of Bits_3 :=
(BRP_2 => 2#000#,
BRP_4 => 2#001#,
BRP_8 => 2#010#,
BRP_16 => 2#011#,
BRP_32 => 2#100#,
BRP_64 => 2#101#,
BRP_128 => 2#110#,
BRP_256 => 2#111#);
---------------
-- Configure --
---------------
procedure Configure (Port : in out SPI_Port; Conf : SPI_Configuration) is
CTRL1 : SPI_Control_Register := Port.CTRL1;
I2S_Conf : SPI_I2S_Config_Register := Port.I2S_Conf;
begin
case Conf.Mode is
when Master =>
CTRL1.Master_Select := 1;
CTRL1.Slave_Select := 1;
when Slave =>
CTRL1.Master_Select := 0;
CTRL1.Slave_Select := 0;
end case;
case Conf.Direction is
when D2Lines_FullDuplex =>
CTRL1.BiDir_Mode := 0;
CTRL1.Output_BiDir := 0;
CTRL1.RXOnly := 0;
when D2Lines_RxOnly =>
CTRL1.BiDir_Mode := 0;
CTRL1.Output_BiDir := 0;
CTRL1.RXOnly := 1;
when D1Line_Rx =>
CTRL1.BiDir_Mode := 1;
CTRL1.Output_BiDir := 0;
CTRL1.RXOnly := 0;
when D1Line_Tx =>
CTRL1.BiDir_Mode := 1;
CTRL1.Output_BiDir := 1;
CTRL1.RXOnly := 0;
end case;
CTRL1.Data_Frame_Fmt := (if Conf.Data_Size = Data_16 then 1 else 0);
CTRL1.Clock_Polarity := (if Conf.Clock_Polarity = High then 1 else 0);
CTRL1.Clock_Phase := (if Conf.Clock_Phase = P2Edge then 1 else 0);
CTRL1.Soft_Slave_Mgt := (if Conf.Slave_Management = Soft then 1 else 0);
CTRL1.Baud_Rate_Ctrl := Baud_Rate_Value (Conf.Baud_Rate_Prescaler);
CTRL1.LSB_First := (if Conf.First_Bit = LSB then 1 else 0);
Port.CTRL1 := CTRL1;
-- Activate the SPI mode (Reset I2SMOD bit in I2SCFGR register)
I2S_Conf := Port.I2S_Conf;
I2S_Conf.Mode_Select := 0;
Port.I2S_Conf := I2S_Conf;
Port.CRC_Poly := Conf.CRC_Poly;
end Configure;
------------
-- Enable --
------------
procedure Enable (Port : in out SPI_Port) is
CTRL1 : SPI_Control_Register := Port.CTRL1;
begin
CTRL1.SPI_Enable := 1;
Port.CTRL1 := CTRL1;
end Enable;
-------------
-- Disable --
-------------
procedure Disable (Port : in out SPI_Port) is
CTRL1 : SPI_Control_Register := Port.CTRL1;
begin
CTRL1.SPI_Enable := 0;
Port.CTRL1 := CTRL1;
end Disable;
-------------
-- Enabled --
-------------
function Enabled (Port : SPI_Port) return Boolean is
begin
return Port.CTRL1.SPI_Enable = 1;
end Enabled;
----------
-- Send --
----------
procedure Send (Port : in out SPI_Port; Data : Half_Word) is
begin
Port.Data := Data;
end Send;
----------
-- Data --
----------
function Data (Port : SPI_Port) return Half_Word is
begin
return Port.Data;
end Data;
----------
-- Send --
----------
procedure Send (Port : in out SPI_Port; Data : Byte) is
begin
Send (Port, Half_Word (Data));
end Send;
----------
-- Data --
----------
function Data (Port : SPI_Port) return Byte is
begin
return Byte (Half_Word'(Data (Port)));
end Data;
-----------------
-- Tx_Is_Empty --
-----------------
function Tx_Is_Empty (Port : SPI_Port) return Boolean is
begin
return Port.Status.TX_Buffer_Empty;
end Tx_Is_Empty;
-----------------
-- Rx_Is_Empty --
-----------------
function Rx_Is_Empty (Port : SPI_Port) return Boolean is
begin
return not Port.Status.RX_Buffer_Not_Empty;
end Rx_Is_Empty;
----------
-- Busy --
----------
function Busy (Port : SPI_Port) return Boolean is
begin
return Port.Status.Busy_Flag;
end Busy;
----------------------------
-- Channel_Side_Indicated --
----------------------------
function Channel_Side_Indicated (Port : SPI_Port) return Boolean is
begin
return Port.Status.Channel_Side;
end Channel_Side_Indicated;
------------------------
-- Underrun_Indicated --
------------------------
function Underrun_Indicated (Port : SPI_Port) return Boolean is
begin
return Port.Status.Underrun_Flag;
end Underrun_Indicated;
-------------------------
-- CRC_Error_Indicated --
-------------------------
function CRC_Error_Indicated (Port : SPI_Port) return Boolean is
begin
return Port.Status.CRC_Error_Flag;
end CRC_Error_Indicated;
--------------------------
-- Mode_Fault_Indicated --
--------------------------
function Mode_Fault_Indicated (Port : SPI_Port) return Boolean is
begin
return Port.Status.Mode_Fault;
end Mode_Fault_Indicated;
-----------------------
-- Overrun_Indicated --
-----------------------
function Overrun_Indicated (Port : SPI_Port) return Boolean is
begin
return Port.Status.Overrun_Flag;
end Overrun_Indicated;
-------------------------------
-- Frame_Fmt_Error_Indicated --
-------------------------------
function Frame_Fmt_Error_Indicated (Port : SPI_Port) return Boolean is
begin
return Port.Status.Frame_Fmt_Error;
end Frame_Fmt_Error_Indicated;
end STM32F4.SPI;
|
sungyeon/drake | Ada | 433 | ads | pragma License (Unrestricted);
-- extended unit
with Ada.References.Strings;
with Ada.Streams.Block_Transmission.Strings;
with Ada.Strings.Generic_Bounded;
package Ada.Strings.Bounded_Strings is
new Generic_Bounded (
Character,
String,
Streams.Block_Transmission.Strings.Read,
Streams.Block_Transmission.Strings.Write,
References.Strings.Slicing);
pragma Preelaborate (Ada.Strings.Bounded_Strings);
|
AdaCore/libadalang | Ada | 138 | adb | with P; use P;
procedure proc is
procedure B is
begin
null;
end B;
--% node.p_previous_part()
begin
null;
end proc;
|
sonneveld/adazmq | Ada | 2,294 | adb | -- Multithreaded Hello World server
with Ada.Command_Line;
with Ada.Text_IO;
with GNAT.Formatted_String;
with ZMQ;
procedure MTServer is
use type GNAT.Formatted_String.Formatted_String;
type Context_Access is access all ZMQ.Context_Type'Class;
task type Worker_Routine_Type is
entry Start (Context_A : Context_Access);
end Worker_Routine_Type;
task body Worker_Routine_Type is
Context : Context_Access := null;
begin
accept Start (Context_A : Context_Access) do
Context := Context_A;
end Start;
declare
-- Socket to talk to dispatcher
Receiver : ZMQ.Socket_Type'Class := Context.New_Socket (ZMQ.ZMQ_REP);
begin
Receiver.Connect ("inproc://workers");
loop
declare
Msg : constant String := Receiver.Recv;
begin
Ada.Text_IO.Put_Line (-(+"Received request: [%s]"&Msg));
-- Do some 'work'
delay 1.0;
-- Send reply back to client
Receiver.Send ("World");
end;
end loop;
-- We never get here, but clean up anyhow
Receiver.Close;
end;
end Worker_Routine_Type;
function Main return Ada.Command_Line.Exit_Status
is
Context : aliased ZMQ.Context_Type := ZMQ.New_Context;
-- Socket to talk to clients
Clients : ZMQ.Socket_Type'Class := Context.New_Socket (ZMQ.ZMQ_ROUTER);
-- Socket to talk to workers
Workers : ZMQ.Socket_Type'Class := Context.New_Socket (ZMQ.ZMQ_DEALER);
begin
Clients.Bind ("tcp://*:5555");
Workers.Bind ("inproc://workers");
-- Launch pool of worker threads
declare
Tasks : array (1 .. 5) of Worker_Routine_Type;
begin
for T of Tasks loop
T.Start (Context'Unrestricted_Access);
end loop;
-- Connect work threads to client threads via a queue proxy
ZMQ.Proxy (Clients, Workers);
-- We never get here, but clean up anyhow
Clients.Close;
Workers.Close;
-- Program will not leave this block until tasks above exit.
end;
Context.Term;
return 0;
end Main;
begin
Ada.Command_Line.Set_Exit_Status (Main);
end MTServer;
|
reznikmm/matreshka | Ada | 3,618 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Elements.Generic_Hash;
function AMF.UML.Activity_Groups.Hash is
new AMF.Elements.Generic_Hash (UML_Activity_Group, UML_Activity_Group_Access);
|
stcarrez/ada-util | Ada | 5,439 | adb | -----------------------------------------------------------------------
-- util-files-rolling-tests -- Unit tests for rolling file manager
-- Copyright (C) 2022 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Directories;
with Ada.Calendar.Formatting;
with Util.Test_Caller;
package body Util.Files.Rolling.Tests is
package Caller is new Util.Test_Caller (Test, "Files");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test Util.Files.Rolling.Rollover (Ascending)",
Test_Rolling_Ascending'Access);
Caller.Add_Test (Suite, "Test Util.Files.Rolling.Rollover (Descending)",
Test_Rolling_Descending'Access);
end Add_Tests;
-- ------------------------------
-- Test the Format procedure with its pattern replacement.
-- ------------------------------
procedure Test_Format (T : in out Test) is
D1 : constant Ada.Calendar.Time := Ada.Calendar.Formatting.Time_Of (2011, 11, 19, 0, 0, 0);
begin
Util.Tests.Assert_Equals (T, "test/file10.log",
Format ("test/file%i.log", D1, 10),
"Invalid format");
Util.Tests.Assert_Equals (T, "test-11/file-11",
Format ("test-%i/file-%i", D1, 11),
"Invalid format");
Util.Tests.Assert_Equals (T, "test-2011-11-19.log",
Format ("test-%d{YYYY-MM-dd}.log", D1, 11),
"Invalid format");
end Test_Format;
-- ------------------------------
-- Test a rolling manager configured with ascending rolling mode.
-- ------------------------------
procedure Test_Rolling_Ascending (T : in out Test) is
Dir : constant String := Util.Tests.Get_Test_Path ("rolling");
Pat : constant String := Compose (Dir, "rolling-%i.txt");
Manager : File_Manager;
begin
-- Erase target directory to make sure it is empty for this test.
if Ada.Directories.Exists (Dir) then
Ada.Directories.Delete_Tree (Dir);
end if;
Manager.Initialize ("rolling.txt", Pat,
Policy => (Kind => No_Policy),
Strategy => (Ascending_Strategy, 1, 10));
for I in 1 .. 20 loop
Write_File (Path => Manager.Get_Current_Path,
Content => "Content" & Natural'Image (I));
Manager.Rollover;
end loop;
for I in 1 .. 10 loop
declare
Name : constant String := "rolling-" & Util.Strings.Image (I) & ".txt";
Path : constant String := Compose (Dir, Name);
Result : Unbounded_String;
begin
T.Assert (Ada.Directories.Exists (Path), "File '" & Path & "' not found");
Read_File (Path, Result);
Util.Tests.Assert_Equals (T, "Content" & Natural'Image (I + 10),
To_String (Result),
"Invalid rolling" & Natural'Image (I));
end;
end loop;
end Test_Rolling_Ascending;
-- ------------------------------
-- Test a rolling manager configured with descending rolling mode.
-- ------------------------------
procedure Test_Rolling_Descending (T : in out Test) is
Dir : constant String := Util.Tests.Get_Test_Path ("rolling");
Pat : constant String := Compose (Dir, "roll-desc-%i.txt");
Manager : File_Manager;
begin
-- Erase target directory to make sure it is empty for this test.
if Ada.Directories.Exists (Dir) then
Ada.Directories.Delete_Tree (Dir);
end if;
Manager.Initialize ("rolling.txt", Pat,
Policy => (Kind => No_Policy),
Strategy => (Descending_Strategy, 1, 10));
for I in 1 .. 20 loop
Write_File (Path => Manager.Get_Current_Path,
Content => "Content" & Natural'Image (I));
Manager.Rollover;
end loop;
for I in 1 .. 10 loop
declare
Name : constant String := "roll-desc-" & Util.Strings.Image (I) & ".txt";
Path : constant String := Compose (Dir, Name);
Result : Unbounded_String;
begin
T.Assert (Ada.Directories.Exists (Path), "File '" & Path & "' not found");
Read_File (Path, Result);
Util.Tests.Assert_Equals (T, "Content" & Natural'Image (20 - I + 1),
To_String (Result),
"Invalid rolling" & Natural'Image (I));
end;
end loop;
end Test_Rolling_Descending;
end Util.Files.Rolling.Tests;
|
reznikmm/slimp | Ada | 882 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package Slim.Messages.DSCO is
type DSCO_Message is new Message with private;
private
type DSCO_Message is new Base_Message
(Max_8 => 1,
Max_16 => 0,
Max_32 => 0,
Max_64 => 0)
with null record;
overriding function Read
(Data : not null access
League.Stream_Element_Vectors.Stream_Element_Vector)
return DSCO_Message;
overriding procedure Write
(Self : DSCO_Message;
Tag : out Message_Tag;
Data : out League.Stream_Element_Vectors.Stream_Element_Vector);
overriding procedure Visit
(Self : not null access DSCO_Message;
Visiter : in out Slim.Message_Visiters.Visiter'Class);
end Slim.Messages.DSCO;
|
jrcarter/Ada_GUI | Ada | 33,916 | ads | -- Ada_GUI implementation based on Gnoga. Adapted 2021
-- --
-- GNOGA - The GNU Omnificent GUI for Ada --
-- --
-- G N O G A . G U I . E L E M E N T --
-- --
-- S p e c --
-- --
-- --
-- Copyright (C) 2014 David Botton --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are --
-- granted additional permissions described in the GCC Runtime Library --
-- Exception, version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- For more information please go to http://www.gnoga.com --
------------------------------------------------------------------------------
with Ada.Containers.Vectors;
with Ada.Containers.Indefinite_Hashed_Maps;
with Ada.Strings.Hash;
with Ada_GUI.Gnoga.Colors;
package Ada_GUI.Gnoga.Gui.Element is
-------------------------------------------------------------------------
-- Element_Type
-------------------------------------------------------------------------
type Element_Type is new Gnoga.Gui.Base_Type with private;
type Element_Access is access all Element_Type;
type Pointer_To_Element_Class is access all Element_Type'Class;
-- Element_Type is the parent class of all Gnoga GUI elements.
-- It is generally used internally to create and bind Gnoga elements to
-- HTML5 DOM elements.
package Element_Type_Arrays is
new Ada.Containers.Vectors
(Index_Type => Positive,
Element_Type => Pointer_To_Element_Class,
"=" => Element."=");
package Element_Type_Maps is
new Ada.Containers.Indefinite_Hashed_Maps (String,
Pointer_To_Element_Class,
Ada.Strings.Hash,
Equivalent_Keys => "=");
subtype Element_Type_Array is Element_Type_Arrays.Vector;
-- Arrays of Base_Types
subtype Element_Type_Map is Element_Type_Maps.Map;
-- String to Base_Type associative array
-------------------------------------------------------------------------
-- Element_Type - Creation Methods
-------------------------------------------------------------------------
procedure Create_From_HTML (Element : in out Element_Type;
Parent : in out Gnoga.Gui.Base_Type'Class;
HTML : in String;
ID : in String := "");
-- Create a Gnoga element with HTML not attached to the DOM. If ID is blank
-- Gnoga will generate a unique one for it. The created object will be
-- stored on the browser but will not be inserted in to the DOM until
-- Place_Inside_Top_Of, Place_Inside_Bottom_Of, Place_Before, Place_After
-- is called. This is done automatically if Parent is a child type of
-- Gnoga_Gui.View.View_Base_Type unless the Auto_Place property is
-- set to False _before_ any creation method is called.
-- Quotes in HTML have to be escaped if any.
--
-- Note: All IDs _must_ be unique for use in Gnoga.
HTML_Namespace : constant String := "http://www.w3.org/1999/xhtml";
MathML_Namespace : constant String := "http://www.w3.org/1998/Math/MathML";
SVG_Namespace : constant String := "http://www.w3.org/2000/svg";
XLink_Namespace : constant String := "http://www.w3.org/1999/xlink";
XMLNS_Namespace : constant String := "http://www.w3.org/2000/xmlns/";
XML_Namespace : constant String :=
"http://www.w3.org/XML/1998/namespace";
procedure Create_XML_Element
(Element : in out Element_Type;
Parent : in out Gnoga.Gui.Base_Type'Class;
Namespace : in String;
Element_Type : in String;
ID : in String := "");
-- Create an XML element using XML Namespace.
-------------------------------------------------------------------------
-- Element_Type - Properties
-------------------------------------------------------------------------
-- Element Properties --
procedure Access_Key (Element : in out Element_Type; Value : String);
function Access_Key (Element : Element_Type) return String;
-- Used for hot key access to element. [special key] + Access_Key
-- The [special key] per browser and platform is:
--
-- Browser Windows Linux Mac
-- ----------------- ------- ----- ---
-- Internet Explorer [Alt] N/A N/A
-- Chrome [Alt] [Alt] [Control][Alt]
-- Firefox [Alt][Shift] [Alt][Shift] [Control][Alt]
-- Safari [Alt] N/A [Control][Alt]
-- Opera 15+ [Alt] [Alt] [Alt]
procedure Advisory_Title (Element : in out Element_Type; Value : in String);
function Advisory_Title (Element : Element_Type) return String;
-- Advisory_Title of Element, usually used for body and image maps
procedure Class_Name (Element : in out Element_Type; Value : in String);
function Class_Name (Element : Element_Type) return String;
-- CSS Class name, can be multiple separated by <space>
-- See Add_Class, Remove_Class and Toggle_Class Methods for adding and
-- removing individual or groups of classes in an easier way.
procedure Editable (Element : in out Element_Type;
Value : in Boolean := True);
function Editable (Element : Element_Type) return Boolean;
-- Note: This will make almost any element with content editable, even
-- non form types in most browsers.
procedure Draggable (Element : in out Element_Type;
Value : in Boolean := True);
function Draggable (Element : Element_Type) return Boolean;
-- In order to make an object draggable in addition to Draggable being true
-- the On_Drag_Start event _must_ be bound as well to set the Drag_Text.
-- To receive a drop, you need to bind On_Drop. See Gnoga.Gui
procedure Inner_HTML (Element : in out Element_Type; Value : in String);
function Inner_HTML (Element : Element_Type) return String;
-- This will completely replace the inner html of an element. This will
-- remove any Elements within Element from the DOM. If those elements
-- have ID_Types of Gnoga_ID they are still available and can be placed
-- in the DOM again using the Element.Place_* methods. However if they
-- were of ID_Type DOM_ID they are lost forever.
function Outer_HTML (Element : Element_Type) return String;
-- Returns the HTML for Element and all its contents.
-- Text Content Properties --
-- <tag>Text Content</tag> - Text content is the content contained by the
-- tag. This should not be confused with the
-- "Value" of a Form Tag.
-- (See. Gnoga.Gui.Element.Form.Value)
procedure Language_Code (Element : in out Element_Type; Value : in String);
function Language_Code (Element : Element_Type) return String;
procedure Tab_Index (Element : in out Element_Type; Value : in Natural);
function Tab_Index (Element : Element_Type) return Natural;
procedure Spell_Check (Element : in out Element_Type;
Value : in Boolean := True);
function Spell_Check (Element : Element_Type) return Boolean;
-- If true Element is subject to browser spell checking if Editable is
-- also true.
procedure Text (Element : in out Element_Type; Value : in String);
function Text (Element : Element_Type) return String;
-- Text content of element.
type Text_Direction_Type is (Left_To_Right, Right_To_Left);
procedure Text_Direction (Element : in out Element_Type;
Value : in Text_Direction_Type);
function Text_Direction (Element : Element_Type) return Text_Direction_Type;
-- BiDi text direction
-- Visibility and Layout Properties --
procedure Hidden (Element : in out Element_Type;
Value : in Boolean := True);
function Hidden (Element : Element_Type) return Boolean;
-- The hidden property will make an element invisible, however unlike
-- the property Visible which uses CSS to hide the Element, Hidden implies
-- the element is semantically not relevant not just visually and will
-- _also_ remove it from layout similar to setting Element.Display (None).
procedure Visible (Element : in out Element_Type;
Value : in Boolean := True);
function Visible (Element : Element_Type) return Boolean;
-- This will cause the Element to no longer be visible but it will still
-- take up space where it was in the layout. Use Element.Hidden to also
-- remove from layout.
-- Note: that each property, Visible, Hidden and Display (None) all work
-- independently and do not reflect the actual client side visual state
-- but the property state. To check if an object is for sure not visible
-- would require checking all three properties.
procedure Display (Element : in out Element_Type;
Value : in String);
function Display (Element : Element_Type) return String;
-- Display sets the CSS Display property that handles how elements are
-- treated by the browser layout engine.
--
-- Common Values:
--
-- none - Remove Element from layout but remain in the DOM this is
-- similar to Element.Hidden, but not like Element.Visible
-- that makes the element not visible but still take up
-- space in layout.
--
-- block - Displays an element starting on a new line and stretches
-- out to the left and right as far as it can. e.g. <div> by
-- default
--
-- inline - Wraps with text in a paragraph. e.g. <span> by default
--
-- inline-block - Flows with paragraph but will always fill from left to
-- right.
--
-- flex - Use the "flexbox" model
-- Box Properties --
type Clear_Side_Type is (Left, Right, Both);
procedure Clear_Side (Element : in out Element_Type;
Value : in Clear_Side_Type);
-- When using "float" for layout sets if the right or left side
-- of Block should be clear of any "floated" Element.
type Float_Type is (None, Left, Right);
procedure Layout_Float (Element : in out Element_Type;
Value : in Float_Type);
-- Sets if Element should "float" to the left or right until touching
-- the closest element.
type Overflow_Type is (Visible, Hidden, Scroll, Auto);
procedure Overflow (Element : in out Element_Type;
Value : in Overflow_Type);
function Overflow (Element : Element_Type) return Overflow_Type;
-- How to handle overflow of contents of an element's box
-- The default is Visible - no clipping.
procedure Overflow_X (Element : in out Element_Type;
Value : in Overflow_Type);
procedure Overflow_Y (Element : in out Element_Type;
Value : in Overflow_Type);
-- How to handle overflow of contents of an element's box for X or Y
-- The default is Visible - no clipping.
type Resizable_Type is (None, Both, Horizontal, Vertical);
procedure Resizable (Element : in out Element_Type;
Value : in Resizable_Type);
function Resizable (Element : Element_Type) return Resizable_Type;
-- If overflow is not set to visible, sets if element can be resized
-- by user.
type Position_Type is (Static, Absolute, Fixed, Relative);
procedure Position (Element : in out Element_Type;
Value : in Position_Type);
function Position (Element : Element_Type) return Position_Type;
-- Determines how the properties left, right, top and bottom are
-- interpreted.
--
-- Static - According to document flow, position properties have no
-- affect.
-- Absolute - Position properties are relative to the first non-static
-- element in the DOM before Element
-- Fixed - Position properties are relative to browser window
-- Relative - Position properties are relative to where the static position
-- of the element would in the normal document flow.
type Vertical_Align_Type is (Baseline, Sub, Super, Top, Middle, Bottom,
Text_Top, Text_Bottom);
procedure Vertical_Align (Element : in out Element_Type;
Value : in Vertical_Align_Type);
-- Vertical alignment of Element
type Box_Sizing_Type is (Content_Box, Border_Box);
procedure Box_Sizing (Element : in out Element_Type;
Value : in Box_Sizing_Type);
function Box_Sizing (Element : Element_Type) return Box_Sizing_Type;
-- Affects if height and width properties represent just the content or
-- the border, margin, padding, scroll and content area as a whole.
-- The default is Content_Box
procedure Z_Index (Element : in out Element_Type;
Value : in Integer);
-- Set stack order of element
-- Note: Z_Index only works on Elements with Position Type of absolute,
-- relative and fixed.
procedure Margin (Element : in out Element_Type;
Top : in String := "0";
Right : in String := "0";
Bottom : in String := "0";
Left : in String := "0");
-- Each can be - length|auto|initial|inherit
procedure Padding (Element : in out Element_Type;
Top : in String := "0";
Right : in String := "0";
Bottom : in String := "0";
Left : in String := "0");
-- Each can be - length|initial|inherit
function Position_Top (Element : Element_Type) return Integer;
function Position_Left (Element : Element_Type) return Integer;
-- Position in pixels relative to Element's parent in the DOM
function Offset_From_Top (Element : Element_Type) return Integer;
function Offset_From_Left (Element : Element_Type) return Integer;
-- Position in pixels relative to the document
procedure Left (Element : in out Element_Type;
Value : in Integer;
Unit : in String := "px");
procedure Left (Element : in out Element_Type;
Value : in String);
function Left (Element : Element_Type) return String;
procedure Right (Element : in out Element_Type;
Value : in Integer;
Unit : in String := "px");
procedure Right (Element : in out Element_Type;
Value : in String);
function Right (Element : Element_Type) return String;
procedure Top (Element : in out Element_Type;
Value : in Integer;
Unit : in String := "px");
procedure Top (Element : in out Element_Type;
Value : in String);
function Top (Element : Element_Type) return String;
procedure Bottom (Element : in out Element_Type;
Value : in Integer;
Unit : in String := "px");
procedure Bottom (Element : in out Element_Type;
Value : in String);
function Bottom (Element : Element_Type) return String;
procedure Box_Height (Element : in out Element_Type;
Value : in Integer;
Unit : in String := "px");
procedure Box_Height (Element : in out Element_Type;
Value : in String);
function Box_Height (Element : Element_Type) return String;
-- Box height based on Box_Sizing
procedure Box_Width (Element : in out Element_Type;
Value : in Integer;
Unit : in String := "px");
procedure Box_Width (Element : in out Element_Type;
Value : in String);
function Box_Width (Element : Element_Type) return String;
-- Box with based on Box_Sizing
procedure Minimum_Height (Element : in out Element_Type;
Value : in Integer;
Unit : in String := "px");
procedure Minimum_Height (Element : in out Element_Type;
Value : in String);
function Minimum_Height (Element : Element_Type) return String;
procedure Maximum_Height (Element : in out Element_Type;
Value : in Integer;
Unit : in String := "px");
procedure Maximum_Height (Element : in out Element_Type;
Value : in String);
function Maximum_Height (Element : Element_Type) return String;
procedure Minimum_Width (Element : in out Element_Type;
Value : in Integer;
Unit : in String := "px");
procedure Minimum_Width (Element : in out Element_Type;
Value : in String);
function Minimum_Width (Element : Element_Type) return String;
procedure Maximum_Width (Element : in out Element_Type;
Value : in Integer;
Unit : in String := "px");
procedure Maximum_Width (Element : in out Element_Type;
Value : in String);
function Maximum_Width (Element : Element_Type) return String;
-- For reference:
-- | Margin | Border | Padding | Scroll | [Element] | Scroll | Padding ...
-- Height and Width of Element are in Base_Type
-- All the following have the advantage of the CSS related size properties
-- in that the results are always pixels and numeric.
procedure Inner_Height (Element : in out Element_Type; Value : in Integer);
function Inner_Height (Element : Element_Type) return Integer;
-- Includes padding but not border
procedure Inner_Width (Element : in out Element_Type; Value : in Integer);
function Inner_Width (Element : Element_Type) return Integer;
-- Includes padding but not border
function Outer_Height (Element : Element_Type) return Integer;
-- Includes padding and border but not margin
function Outer_Width (Element : Element_Type) return Integer;
-- Includes padding and border but not margin
function Outer_Height_To_Margin (Element : Element_Type) return Integer;
-- Includes padding and border and margin
function Outer_Width_To_Margin
(Element : Element_Type) return Integer;
-- Includes padding and border and margin
function Client_Width (Element : Element_Type) return Natural;
-- Inner width of an element in pixels.
-- CSS width + CSS padding - width of vertical scrollbar (if present)
-- Does not include the border or margin.
function Client_Height (Element : Element_Type) return Natural;
-- Inner height of an element in pixels.
-- CSS height + CSS padding - height of horizontal scrollbar (if present)
-- Does not include the border or margin.
function Client_Left (Element : Element_Type) return Natural;
-- The width of the left border of an element in pixels.
--. It does not include the margin or padding.
function Client_Top (Element : Element_Type) return Natural;
-- The width of the top border of an element in pixels.
--. It does not include the margin or padding.
function Offset_Width (Element : Element_Type) return Integer;
-- CSS width + CSS padding + width of vertical scrollbar (if present) +
-- Border
function Offset_Height (Element : Element_Type) return Integer;
-- CSS height + CSS padding + height of horizontal scrollbar (if present) +
-- Border
function Offset_Left (Element : Element_Type) return Integer;
-- The width from parent element border to child border left
function Offset_Top (Element : Element_Type) return Integer;
-- The width from parent element border to child border top
function Scroll_Width (Element : Element_Type) return Natural;
-- Either the width in pixels of the content of an element or the width of
-- the element itself, whichever is greater
function Scroll_Height (Element : Element_Type) return Natural;
-- Height of an element's content, including content not visible on the
-- screen due to overflow.
procedure Scroll_Left (Element : in out Element_Type; Value : Integer);
function Scroll_Left (Element : Element_Type) return Integer;
-- The number of pixels that an element's content is scrolled to the left.
-- For RTL languages is negative.
procedure Scroll_Top (Element : in out Element_Type; Value : Integer);
function Scroll_Top (Element : Element_Type) return Integer;
-- The number of pixels that an element's content has been scrolled
-- upward.
-- Style Properties --
-- Color --
procedure Color (Element : in out Element_Type; Value : String);
procedure Color (Element : in out Element_Type;
RGBA : in Gnoga.RGBA_Type);
procedure Color (Element : in out Element_Type;
Enum : Gnoga.Colors.Color_Enumeration);
function Color (Element : Element_Type) return Gnoga.RGBA_Type;
procedure Opacity (Element : in out Element_Type;
Alpha : in Gnoga.Alpha_Type);
function Opacity (Element : Element_Type) return Gnoga.Alpha_Type;
-- Background --
type Background_Attachment_Type is (Scroll, Fixed, Local);
procedure Background_Attachment
(Element : in out Element_Type;
Value : in Background_Attachment_Type);
function Background_Attachment (Element : Element_Type)
return Background_Attachment_Type;
procedure Background_Color (Element : in out Element_Type;
Value : in String);
procedure Background_Color (Element : in out Element_Type;
RGBA : in Gnoga.RGBA_Type);
procedure Background_Color
(Element : in out Element_Type;
Enum : in Gnoga.Colors.Color_Enumeration);
function Background_Color (Element : Element_Type)
return Gnoga.RGBA_Type;
procedure Background_Image (Element : in out Element_Type;
Value : in String);
function Background_Image (Element : Element_Type) return String;
-- proper syntax is "url(...)" | "" to clear
procedure Background_Position (Element : in out Element_Type;
Value : in String);
function Background_Position (Element : Element_Type) return String;
-- combination of 2 - left/right/center/top/bottom | %x %y | x y
procedure Background_Origin (Element : in out Element_Type;
Value : in String);
function Background_Origin (Element : Element_Type) return String;
-- Background position property is relative to origin of:
-- padding-box|border-box|content-box
procedure Background_Repeat (Element : in out Element_Type;
Value : in String);
function Background_Repeat (Element : Element_Type) return String;
-- repeat|repeat-x|repeat-y|no-repeat
procedure Background_Clip (Element : in out Element_Type;
Value : in String);
function Background_Clip (Element : Element_Type) return String;
-- border-box|padding-box|content-box
procedure Background_Size (Element : in out Element_Type;
Value : in String);
function Background_Size (Element : Element_Type) return String;
-- auto| w h | % = cover of parent | contain
-- Border --
type Border_Style is (None, Hidden, Dotted, Dashed, Solid, Double, Groove,
Ridge, Inset, Outset);
procedure Border (Element : in out Element_Type;
Width : in String := "medium";
Style : in Border_Style := Solid;
Color : in Gnoga.Colors.Color_Enumeration :=
Gnoga.Colors.Black);
-- Width = medium|thin|thick|length|initial|inherit;
-- If Color is "" then border is same as Element.Color
procedure Border_Radius (Element : in out Element_Type;
Radius : in String := "0");
-- Curve of borders
-- Radius = length|%|initial|inherit
procedure Shadow (Element : in out Element_Type;
Horizontal_Position : in String;
Vertical_Position : in String;
Blur : in String := "";
Spread : in String := "";
Color : in Gnoga.Colors.Color_Enumeration := Gnoga.Colors.Black;
Inset_Shadow : in Boolean := False);
procedure Shadow_None (Element : in out Element_Type);
type Outline_Style_Type is (None, Hidden, Dotted, Dashed, Solid, Double,
Groove, Ridge, Inset, Outset);
procedure Outline (Element : in out Element_Type;
Color : in String := "invert";
Style : in Outline_Style_Type := None;
Width : in String := "medium");
procedure Cursor (Element : in out Element_Type;
Value : in String);
function Cursor (Element : Element_Type) return String;
-- Sets the cursor to a standard type or an image
-- if set to url(url_to_image). When using a url is best
-- to suggest an alternate cursor, e.g. "url(url_to_image),auto"
-- A list of standard cursor types can be found at:
-- http://www.w3schools.com/cssref/pr_class_cursor.asp
-- Text --
type Font_Style_Type is (Normal, Italic, Oblique);
type Font_Weight_Type is (Weight_Normal, Weight_Bold,
Weight_Bolder, Weight_Lighter,
Weight_100, Weight_200, Weight_300,
Weight_400, Weight_500, Weight_600,
Weight_700, Weight_800, Weight_900);
function Image (Value : in Gnoga.Gui.Element.Font_Weight_Type) return String;
function Value (Value : in String) return Gnoga.Gui.Element.Font_Weight_Type;
type Font_Variant_Type is (Normal, Small_Caps);
type System_Font_Type is (Caption, Icon, Menu, Message_Box, Small_Caption,
Status_Bar);
procedure Font (Element : in out Element_Type;
Family : in String := "sans-serif";
Height : in String := "medium";
Style : in Font_Style_Type := Normal;
Weight : in Font_Weight_Type := Weight_Normal;
Variant : in Font_Variant_Type := Normal);
procedure Font (Element : in out Element_Type;
System_Font : in System_Font_Type);
-- Sets or returns the current font properties for text content
type Alignment_Type is (Left, Right, Center, At_Start, To_End);
procedure Text_Alignment (Element : in out Element_Type;
Value : in Alignment_Type);
-- Text Alignment, At_Start = Left, and To_End = Right in ltr languages
-- in rtl languages At_Start = Right, and To_End = Left.
-- Framework Properties --
procedure Auto_Place (Element : in out Element_Type; Value : Boolean);
function Auto_Place (Element : Element_Type) return Boolean;
-- Elements by default are created outside the DOM and therefore not
-- visible. If Auto_Place is set to false _before_ Create is called on
-- an Element, View's will not place the Element in to the DOM as is
-- the View's default behavior. Custom widgets that have child widgets
-- should be designed to respect this property. Auto_Place if set to
-- False will also prevent Auto_Set_View if Element's Parent is a Window
-- General Access to Element --
procedure Style (Element : in out Element_Type;
Name : in String;
Value : in String);
procedure Style (Element : in out Element_Type;
Name : in String;
Value : in Integer);
function Style (Element : Element_Type; Name : String) return String;
function Style (Element : Element_Type; Name : String) return Integer;
-- General access to style Name
procedure Attribute (Element : in out Element_Type;
Name : in String;
Value : in String);
function Attribute (Element : Element_Type; Name : String) return String;
-- General access to attribute Name
-- Traversal Properties --
procedure First_Child (Element : in out Element_Type;
Child : in out Element_Type'Class);
-- If Child does not have an html id than Element_Type will have an
-- ID of undefined and therefore attached to no actual HTML element.
procedure Next_Sibling (Element : in out Element_Type;
Sibling : in out Element_Type'Class);
-- If Sibling does not have an html id than Element_Type will have an
-- ID of undefined and therefore attached to no actual HTML element.
-- Internal Properties --
function HTML_Tag (Element : Element_Type) return String;
-------------------------------------------------------------------------
-- Element_Type - Methods
-------------------------------------------------------------------------
-- Element Methods --
procedure Click (Element : in out Element_Type);
-- Simulate click on element
procedure Add_Class (Element : in out Element_Type; Class_Name : in String);
-- Adds one or more Class_Name(s) to Element
procedure Remove_Class (Element : in out Element_Type;
Class_Name : in String);
-- Removes one or more Class_Name(s) to Element
procedure Toggle_Class (Element : in out Element_Type;
Class_Name : in String);
-- Toggles on and off one or more Class_Name(s) to Element
-- DOM Placement Methods --
procedure Place_Inside_Top_Of (Element : in out Element_Type;
Target : in out Element_Type'Class);
procedure Place_Inside_Bottom_Of (Element : in out Element_Type;
Target : in out Element_Type'Class);
procedure Place_Before (Element : in out Element_Type;
Target : in out Element_Type'Class);
procedure Place_After (Element : in out Element_Type;
Target : in out Element_Type'Class);
procedure Remove (Element : in out Element_Type);
-- Removes an element from the DOM, if the ID_Type is DOM_ID, the ID
-- will be changed to a unique Gnoga_ID before removal.
private
type Element_Type is new Gnoga.Gui.Base_Type with
record
Auto_Place : Boolean := True;
end record;
end Ada_GUI.Gnoga.Gui.Element;
|
stcarrez/ada-awa | Ada | 16,058 | ads | -----------------------------------------------------------------------
-- AWA.Comments.Models -- AWA.Comments.Models
-----------------------------------------------------------------------
-- File generated by Dynamo DO NOT MODIFY
-- Template used: templates/model/package-spec.xhtml
-- Ada Generator: https://github.com/stcarrez/dynamo Version 1.4.0
-----------------------------------------------------------------------
-- Copyright (C) 2023 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
pragma Warnings (Off);
with ADO.Sessions;
with ADO.Objects;
with ADO.Statements;
with ADO.SQL;
with ADO.Schemas;
with ADO.Queries;
with ADO.Queries.Loaders;
with Ada.Calendar;
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded;
with Util.Beans.Objects;
with Util.Beans.Objects.Enums;
with Util.Beans.Basic.Lists;
with ADO.Audits;
with AWA.Users.Models;
with Util.Beans.Methods;
pragma Warnings (On);
package AWA.Comments.Models is
pragma Style_Checks ("-mrIu");
-- --------------------
-- The format type defines the message format type.
-- --------------------
type Format_Type is (FORMAT_TEXT, FORMAT_WIKI, FORMAT_HTML);
for Format_Type use (FORMAT_TEXT => 0, FORMAT_WIKI => 1, FORMAT_HTML => 2);
package Format_Type_Objects is
new Util.Beans.Objects.Enums (Format_Type);
type Nullable_Format_Type is record
Is_Null : Boolean := True;
Value : Format_Type;
end record;
-- --------------------
-- The status type defines whether the comment is visible or not.
-- The comment can be put in the COMMENT_WAITING state so that
-- it is not immediately visible. It must be put in the COMMENT_PUBLISHED
-- state to be visible.
-- --------------------
type Status_Type is (COMMENT_PUBLISHED, COMMENT_WAITING, COMMENT_SPAM, COMMENT_BLOCKED, COMMENT_ARCHIVED);
for Status_Type use (COMMENT_PUBLISHED => 0, COMMENT_WAITING => 1, COMMENT_SPAM => 2, COMMENT_BLOCKED => 3, COMMENT_ARCHIVED => 4);
package Status_Type_Objects is
new Util.Beans.Objects.Enums (Status_Type);
type Nullable_Status_Type is record
Is_Null : Boolean := True;
Value : Status_Type;
end record;
type Comment_Ref is new ADO.Objects.Object_Ref with null record;
-- --------------------
-- The Comment table records a user comment associated with a database entity.
-- The comment can be associated with any other database record.
-- --------------------
-- Create an object key for Comment.
function Comment_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Comment from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Comment_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Comment : constant Comment_Ref;
function "=" (Left, Right : Comment_Ref'Class) return Boolean;
-- Set the comment publication date
procedure Set_Create_Date (Object : in out Comment_Ref;
Value : in Ada.Calendar.Time);
-- Get the comment publication date
function Get_Create_Date (Object : in Comment_Ref)
return Ada.Calendar.Time;
-- Set the comment message.
procedure Set_Message (Object : in out Comment_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Message (Object : in out Comment_Ref;
Value : in String);
-- Get the comment message.
function Get_Message (Object : in Comment_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Message (Object : in Comment_Ref)
return String;
-- Set the entity identifier to which this comment is associated
procedure Set_Entity_Id (Object : in out Comment_Ref;
Value : in ADO.Identifier);
-- Get the entity identifier to which this comment is associated
function Get_Entity_Id (Object : in Comment_Ref)
return ADO.Identifier;
-- Set the comment identifier
procedure Set_Id (Object : in out Comment_Ref;
Value : in ADO.Identifier);
-- Get the comment identifier
function Get_Id (Object : in Comment_Ref)
return ADO.Identifier;
-- Get the optimistic lock version.
function Get_Version (Object : in Comment_Ref)
return Integer;
-- Set the entity type that identifies the table to which the comment is associated.
procedure Set_Entity_Type (Object : in out Comment_Ref;
Value : in ADO.Entity_Type);
-- Get the entity type that identifies the table to which the comment is associated.
function Get_Entity_Type (Object : in Comment_Ref)
return ADO.Entity_Type;
-- Set the comment status to decide whether the comment is visible (published) or not.
procedure Set_Status (Object : in out Comment_Ref;
Value : in Status_Type);
-- Get the comment status to decide whether the comment is visible (published) or not.
function Get_Status (Object : in Comment_Ref)
return Status_Type;
-- Set the comment format type.
procedure Set_Format (Object : in out Comment_Ref;
Value : in Format_Type);
-- Get the comment format type.
function Get_Format (Object : in Comment_Ref)
return Format_Type;
--
procedure Set_Author (Object : in out Comment_Ref;
Value : in AWA.Users.Models.User_Ref'Class);
--
function Get_Author (Object : in Comment_Ref)
return AWA.Users.Models.User_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Comment_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Comment_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Reload from the database the same object if it was modified.
-- Returns True in `Updated` if the object was reloaded.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Reload (Object : in out Comment_Ref;
Session : in out ADO.Sessions.Session'Class;
Updated : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Comment_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Comment_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Comment_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Comment_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
COMMENT_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Comment_Ref);
-- Copy of the object.
procedure Copy (Object : in Comment_Ref;
Into : in out Comment_Ref);
-- --------------------
-- The comment information.
-- --------------------
type Comment_Info is
new Util.Beans.Basic.Bean with record
-- the comment identifier.
Id : ADO.Identifier;
-- the comment author's name.
Author : Ada.Strings.Unbounded.Unbounded_String;
-- the comment author's email.
Email : Ada.Strings.Unbounded.Unbounded_String;
-- the comment date.
Date : Ada.Calendar.Time;
-- the comment format type.
Format : Format_Type;
-- the comment text.
Comment : Ada.Strings.Unbounded.Unbounded_String;
-- the comment status.
Status : Status_Type;
end record;
-- Get the bean attribute identified by the name.
overriding
function Get_Value (From : in Comment_Info;
Name : in String) return Util.Beans.Objects.Object;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out Comment_Info;
Name : in String;
Value : in Util.Beans.Objects.Object);
package Comment_Info_Beans is
new Util.Beans.Basic.Lists (Element_Type => Comment_Info);
package Comment_Info_Vectors renames Comment_Info_Beans.Vectors;
subtype Comment_Info_List_Bean is Comment_Info_Beans.List_Bean;
type Comment_Info_List_Bean_Access is access all Comment_Info_List_Bean;
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
procedure List (Object : in out Comment_Info_List_Bean'Class;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
subtype Comment_Info_Vector is Comment_Info_Vectors.Vector;
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
procedure List (Object : in out Comment_Info_Vector;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
Query_Comment_List : constant ADO.Queries.Query_Definition_Access;
Query_All_Comment_List : constant ADO.Queries.Query_Definition_Access;
type Comment_Bean is abstract new AWA.Comments.Models.Comment_Ref
and Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with null record;
-- This bean provides some methods that can be used in a Method_Expression.
overriding
function Get_Method_Bindings (From : in Comment_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out Comment_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
procedure Create (Bean : in out Comment_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
procedure Delete (Bean : in out Comment_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
procedure Save (Bean : in out Comment_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
procedure Publish (Bean : in out Comment_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
private
COMMENT_NAME : aliased constant String := "awa_comment";
COL_0_1_NAME : aliased constant String := "create_date";
COL_1_1_NAME : aliased constant String := "message";
COL_2_1_NAME : aliased constant String := "entity_id";
COL_3_1_NAME : aliased constant String := "id";
COL_4_1_NAME : aliased constant String := "version";
COL_5_1_NAME : aliased constant String := "entity_type";
COL_6_1_NAME : aliased constant String := "status";
COL_7_1_NAME : aliased constant String := "format";
COL_8_1_NAME : aliased constant String := "author_id";
COMMENT_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 9,
Table => COMMENT_NAME'Access,
Members => (
1 => COL_0_1_NAME'Access,
2 => COL_1_1_NAME'Access,
3 => COL_2_1_NAME'Access,
4 => COL_3_1_NAME'Access,
5 => COL_4_1_NAME'Access,
6 => COL_5_1_NAME'Access,
7 => COL_6_1_NAME'Access,
8 => COL_7_1_NAME'Access,
9 => COL_8_1_NAME'Access)
);
COMMENT_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= COMMENT_DEF'Access;
COMMENT_AUDIT_DEF : aliased constant ADO.Audits.Auditable_Mapping :=
(Count => 3,
Of_Class => COMMENT_DEF'Access,
Members => (
1 => 1,
2 => 6,
3 => 7)
);
COMMENT_AUDIT_TABLE : constant ADO.Audits.Auditable_Mapping_Access
:= COMMENT_AUDIT_DEF'Access;
Null_Comment : constant Comment_Ref
:= Comment_Ref'(ADO.Objects.Object_Ref with null record);
type Comment_Impl is
new ADO.Audits.Auditable_Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => COMMENT_DEF'Access,
With_Audit => COMMENT_AUDIT_DEF'Access)
with record
Create_Date : Ada.Calendar.Time;
Message : Ada.Strings.Unbounded.Unbounded_String;
Entity_Id : ADO.Identifier;
Version : Integer;
Entity_Type : ADO.Entity_Type;
Status : Status_Type;
Format : Format_Type;
Author : AWA.Users.Models.User_Ref;
end record;
type Comment_Access is access all Comment_Impl;
overriding
procedure Destroy (Object : access Comment_Impl);
overriding
procedure Find (Object : in out Comment_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Comment_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Comment_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Comment_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Create (Object : in out Comment_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Comment_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Comment_Ref'Class;
Impl : out Comment_Access);
package File_1 is
new ADO.Queries.Loaders.File (Path => "comment-queries.xml",
Sha1 => "80302F51E2EC9855EFAFB43954D724A697C1F8E6");
package Def_Commentinfo_Comment_List is
new ADO.Queries.Loaders.Query (Name => "comment-list",
File => File_1.File'Access);
Query_Comment_List : constant ADO.Queries.Query_Definition_Access
:= Def_Commentinfo_Comment_List.Query'Access;
package Def_Commentinfo_All_Comment_List is
new ADO.Queries.Loaders.Query (Name => "all-comment-list",
File => File_1.File'Access);
Query_All_Comment_List : constant ADO.Queries.Query_Definition_Access
:= Def_Commentinfo_All_Comment_List.Query'Access;
end AWA.Comments.Models;
|
alkhimey/Ada_Curve | Ada | 2,844 | adb | -- The MIT License (MIT)
--
-- Copyright (c) 2016 [email protected]
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.
--
--
separate (Main)
procedure Draw_Control_Points(Control_Points : CRV.Control_Points_Array;
Hovered_Point : Natural := 0;
Selected_Point : Natural := 0) is
begin
-- Draw the control points (as squares)
--
for I in Control_Points'Range Loop
declare
Token : Gl.Immediate.Input_Token := GL.Immediate.Start (Polygon);
D : constant := 4.0;
begin
if I = Selected_Point then
Gl.Immediate.Set_Color (GL.Types.Colors.Color'(0.3, 0.3, 0.3, 0.0));
elsif I = Hovered_Point then
Gl.Immediate.Set_Color (GL.Types.Colors.Color'(0.0, 0.5, 0.0, 0.0));
else
Gl.Immediate.Set_Color (GL.Types.Colors.Color'(0.6, 0.6, 0.6, 0.0));
end if;
GL.Immediate.Add_Vertex(Token, Vector2'
(Control_Points(I)(CRV.X) + D,
Control_Points(I)(CRV.Y) + D));
GL.Immediate.Add_Vertex(Token, Vector2'
(Control_Points(I)(CRV.X) - D,
Control_Points(I)(CRV.Y) + D));
GL.Immediate.Add_Vertex(Token, Vector2'
(Control_Points(I)(CRV.X) - D,
Control_Points(I)(CRV.Y) - D));
GL.Immediate.Add_Vertex(Token, Vector2'
(Control_Points(I)(CRV.X) + D,
Control_Points(I)(CRV.Y) - D));
end;
end loop;
end Draw_Control_Points;
|
io7m/coreland-stack-ada | Ada | 1,425 | adb | with Test;
with Stack;
procedure t_init1 is
package Int_Stack is new Stack (Element_Type => Natural);
Stack : Int_Stack.Stack_t;
Caught : Boolean;
begin
Test.Assert
(Check => Int_Stack.Size (Stack) = 0,
Pass_Message => "Stack is empty",
Fail_Message => "Stack not empty at initialization");
-- catch Pop exception
declare
X : Natural;
begin
Int_Stack.Pop (Stack, X);
Test.Assert
(Check => X'Valid,
Pass_Message => "Valid X",
Fail_Message => "Invalid X");
exception
when Constraint_Error => Caught := True;
end;
Test.Assert
(Check => Caught,
Pass_Message => "Caught underflow",
Fail_Message => "Failed to catch underflow");
-- catch Pop exception
begin
Int_Stack.Pop_Discard (Stack);
exception
when Constraint_Error => Caught := True;
end;
Test.Assert
(Check => Caught,
Pass_Message => "Caught underflow",
Fail_Message => "Failed to catch underflow");
-- catch Peek exception
declare
X : Natural;
begin
Int_Stack.Peek (Stack, X);
Test.Assert
(Check => X'Valid,
Pass_Message => "Valid X",
Fail_Message => "Invalid X");
exception
when Constraint_Error => Caught := True;
end;
Test.Assert
(Check => Caught,
Pass_Message => "Caught underflow",
Fail_Message => "Failed to catch underflow");
end t_init1;
|
reznikmm/matreshka | Ada | 3,704 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Fo_Margin_Top_Attributes is
pragma Preelaborate;
type ODF_Fo_Margin_Top_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Fo_Margin_Top_Attribute_Access is
access all ODF_Fo_Margin_Top_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Fo_Margin_Top_Attributes;
|
apple-oss-distributions/old_ncurses | Ada | 24,176 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- ncurses --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 2000 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Eugene V. Melaragno <[email protected]> 2000
-- Version Control
-- $Revision: 1.1.1.1 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with ncurses2.util; use ncurses2.util;
with Terminal_Interface.Curses; use Terminal_Interface.Curses;
with Interfaces.C;
with System.Storage_Elements;
with System.Address_To_Access_Conversions;
with Ada.Text_IO;
-- with Ada.Real_Time; use Ada.Real_Time;
-- TODO is there a way to use Real_Time or Ada.Calendar in place of
-- gettimeofday?
-- Demonstrate pads.
procedure ncurses2.demo_pad is
type timestruct is record
seconds : Integer;
microseconds : Integer;
end record;
type myfunc is access function (w : Window) return Key_Code;
function gettime return timestruct;
procedure do_h_line (y : Line_Position;
x : Column_Position;
c : Attributed_Character;
to : Column_Position);
procedure do_v_line (y : Line_Position;
x : Column_Position;
c : Attributed_Character;
to : Line_Position);
function padgetch (win : Window) return Key_Code;
function panner_legend (line : Line_Position) return Boolean;
procedure panner_legend (line : Line_Position);
procedure panner_h_cleanup (from_y : Line_Position;
from_x : Column_Position;
to_x : Column_Position);
procedure panner_v_cleanup (from_y : Line_Position;
from_x : Column_Position;
to_y : Line_Position);
procedure panner (pad : Window;
top_xp : Column_Position;
top_yp : Line_Position;
portyp : Line_Position;
portxp : Column_Position;
pgetc : myfunc);
function gettime return timestruct is
retval : timestruct;
use Interfaces.C;
type timeval is record
tv_sec : long;
tv_usec : long;
end record;
pragma Convention (C, timeval);
-- TODO function from_timeval is new Ada.Unchecked_Conversion(
-- timeval_a, System.Storage_Elements.Integer_Address);
-- should Interfaces.C.Pointers be used here?
package myP is new System.Address_To_Access_Conversions (timeval);
use myP;
t : Object_Pointer := new timeval;
function gettimeofday
(TP : System.Storage_Elements.Integer_Address;
TZP : System.Storage_Elements.Integer_Address) return int;
pragma Import (C, gettimeofday, "gettimeofday");
tmp : int;
begin
tmp := gettimeofday (System.Storage_Elements.To_Integer
(myP.To_Address (t)),
System.Storage_Elements.To_Integer
(myP.To_Address (null)));
retval.seconds := Integer (t.tv_sec);
retval.microseconds := Integer (t.tv_usec);
return retval;
end gettime;
-- in C, The behavior of mvhline, mvvline for negative/zero length is
-- unspecified, though we can rely on negative x/y values to stop the
-- macro. Except Ada makes Line_Position(-1) = Natural - 1 so forget it.
procedure do_h_line (y : Line_Position;
x : Column_Position;
c : Attributed_Character;
to : Column_Position) is
begin
if to > x then
Move_Cursor (Line => y, Column => x);
Horizontal_Line (Line_Size => Natural (to - x), Line_Symbol => c);
end if;
end do_h_line;
procedure do_v_line (y : Line_Position;
x : Column_Position;
c : Attributed_Character;
to : Line_Position) is
begin
if to > y then
Move_Cursor (Line => y, Column => x);
Vertical_Line (Line_Size => Natural (to - y), Line_Symbol => c);
end if;
end do_v_line;
function padgetch (win : Window) return Key_Code is
c : Key_Code;
c2 : Character;
begin
c := Getchar (win);
c2 := Code_To_Char (c);
case c2 is
when '!' =>
ShellOut (False);
return Key_Refresh;
when Character'Val (Character'Pos ('r') mod 16#20#) => -- CTRL('r')
End_Windows;
Refresh;
return Key_Refresh;
when Character'Val (Character'Pos ('l') mod 16#20#) => -- CTRL('l')
return Key_Refresh;
when 'U' =>
return Key_Cursor_Up;
when 'D' =>
return Key_Cursor_Down;
when 'R' =>
return Key_Cursor_Right;
when 'L' =>
return Key_Cursor_Left;
when '+' =>
return Key_Insert_Line;
when '-' =>
return Key_Delete_Line;
when '>' =>
return Key_Insert_Char;
when '<' =>
return Key_Delete_Char;
-- when ERR=> /* FALLTHRU */
when 'q' =>
return (Key_Exit);
when others =>
return (c);
end case;
end padgetch;
show_panner_legend : Boolean := True;
function panner_legend (line : Line_Position) return Boolean is
legend : constant array (0 .. 3) of String (1 .. 61) :=
(
"Use arrow keys (or U,D,L,R) to pan, q to quit (?,t,s flags) ",
"Use ! to shell-out. Toggle legend:?, timer:t, scroll mark:s.",
"Use +,- (or j,k) to grow/shrink the panner vertically. ",
"Use <,> (or h,l) to grow/shrink the panner horizontally. ");
legendsize : constant := 4;
n : Integer := legendsize - Integer (Lines - line);
begin
if line < Lines and n >= 0 then
Move_Cursor (Line => line, Column => 0);
if show_panner_legend then
Add (Str => legend (n));
end if;
Clear_To_End_Of_Line;
return show_panner_legend;
end if;
return False;
end panner_legend;
procedure panner_legend (line : Line_Position) is
tmp : Boolean;
begin
tmp := panner_legend (line);
end panner_legend;
procedure panner_h_cleanup (from_y : Line_Position;
from_x : Column_Position;
to_x : Column_Position) is
begin
if not panner_legend (from_y) then
do_h_line (from_y, from_x, Blank2, to_x);
end if;
end panner_h_cleanup;
procedure panner_v_cleanup (from_y : Line_Position;
from_x : Column_Position;
to_y : Line_Position) is
begin
if not panner_legend (from_y) then
do_v_line (from_y, from_x, Blank2, to_y);
end if;
end panner_v_cleanup;
procedure panner (pad : Window;
top_xp : Column_Position;
top_yp : Line_Position;
portyp : Line_Position;
portxp : Column_Position;
pgetc : myfunc) is
function f (y : Line_Position) return Line_Position;
function f (x : Column_Position) return Column_Position;
function greater (y1, y2 : Line_Position) return Integer;
function greater (x1, x2 : Column_Position) return Integer;
top_x : Column_Position := top_xp;
top_y : Line_Position := top_yp;
porty : Line_Position := portyp;
portx : Column_Position := portxp;
-- f[x] returns max[x - 1, 0]
function f (y : Line_Position) return Line_Position is
begin
if y > 0 then
return y - 1;
else
return y; -- 0
end if;
end f;
function f (x : Column_Position) return Column_Position is
begin
if x > 0 then
return x - 1;
else
return x; -- 0
end if;
end f;
function greater (y1, y2 : Line_Position) return Integer is
begin
if y1 > y2 then
return 1;
else
return 0;
end if;
end greater;
function greater (x1, x2 : Column_Position) return Integer is
begin
if x1 > x2 then
return 1;
else
return 0;
end if;
end greater;
pymax : Line_Position;
basey : Line_Position := 0;
pxmax : Column_Position;
basex : Column_Position := 0;
c : Key_Code;
scrollers : Boolean := True;
before, after : timestruct;
timing : Boolean := True;
package floatio is new Ada.Text_IO.Float_IO (Long_Float);
begin
Get_Size (pad, pymax, pxmax);
Allow_Scrolling (Mode => False); -- we don't want stdscr to scroll!
c := Key_Refresh;
loop
-- During shell-out, the user may have resized the window. Adjust
-- the port size of the pad to accommodate this. Ncurses
-- automatically resizes all of the normal windows to fit on the
-- new screen.
if top_x > Columns then
top_x := Columns;
end if;
if portx > Columns then
portx := Columns;
end if;
if top_y > Lines then
top_y := Lines;
end if;
if porty > Lines then
porty := Lines;
end if;
case c is
when Key_Refresh | Character'Pos ('?') =>
if c = Key_Refresh then
Erase;
else -- '?'
show_panner_legend := not show_panner_legend;
end if;
panner_legend (Lines - 4);
panner_legend (Lines - 3);
panner_legend (Lines - 2);
panner_legend (Lines - 1);
when Character'Pos ('t') =>
timing := not timing;
if not timing then
panner_legend (Lines - 1);
end if;
when Character'Pos ('s') =>
scrollers := not scrollers;
-- Move the top-left corner of the pad, keeping the
-- bottom-right corner fixed.
when Character'Pos ('h') =>
-- increase-columns: move left edge to left
if top_x <= 0 then
Beep;
else
panner_v_cleanup (top_y, top_x, porty);
top_x := top_x - 1;
end if;
when Character'Pos ('j') =>
-- decrease-lines: move top-edge down
if top_y >= porty then
Beep;
else
if top_y /= 0 then
panner_h_cleanup (top_y - 1, f (top_x), portx);
end if;
top_y := top_y + 1;
end if;
when Character'Pos ('k') =>
-- increase-lines: move top-edge up
if top_y <= 0 then
Beep;
else
top_y := top_y - 1;
panner_h_cleanup (top_y, top_x, portx);
end if;
when Character'Pos ('l') =>
-- decrease-columns: move left-edge to right
if top_x >= portx then
Beep;
else
if top_x /= 0 then
panner_v_cleanup (f (top_y), top_x - 1, porty);
end if;
top_x := top_x + 1;
end if;
-- Move the bottom-right corner of the pad, keeping the
-- top-left corner fixed.
when Key_Insert_Char =>
-- increase-columns: move right-edge to right
if portx >= pxmax or portx >= Columns then
Beep;
else
panner_v_cleanup (f (top_y), portx - 1, porty);
portx := portx + 1;
-- C had ++portx instead of portx++, weird.
end if;
when Key_Insert_Line =>
-- increase-lines: move bottom-edge down
if porty >= pymax or porty >= Lines then
Beep;
else
panner_h_cleanup (porty - 1, f (top_x), portx);
porty := porty + 1;
end if;
when Key_Delete_Char =>
-- decrease-columns: move bottom edge up
if portx <= top_x then
Beep;
else
portx := portx - 1;
panner_v_cleanup (f (top_y), portx, porty);
end if;
when Key_Delete_Line =>
-- decrease-lines
if porty <= top_y then
Beep;
else
porty := porty - 1;
panner_h_cleanup (porty, f (top_x), portx);
end if;
when Key_Cursor_Left =>
-- pan leftwards
if basex > 0 then
basex := basex - 1;
else
Beep;
end if;
when Key_Cursor_Right =>
-- pan rightwards
-- if (basex + portx - (pymax > porty) < pxmax)
if (basex + portx -
Column_Position (greater (pymax, porty)) < pxmax) then
-- if basex + portx < pxmax or
-- (pymax > porty and basex + portx - 1 < pxmax) then
basex := basex + 1;
else
Beep;
end if;
when Key_Cursor_Up =>
-- pan upwards
if basey > 0 then
basey := basey - 1;
else
Beep;
end if;
when Key_Cursor_Down =>
-- pan downwards
-- same as if (basey + porty - (pxmax > portx) < pymax)
if (basey + porty -
Line_Position (greater (pxmax, portx)) < pymax) then
-- if (basey + porty < pymax) or
-- (pxmax > portx and basey + porty - 1 < pymax) then
basey := basey + 1;
else
Beep;
end if;
when Character'Pos ('H') |
Key_Home |
Key_Find =>
basey := 0;
when Character'Pos ('E') |
Key_End |
Key_Select =>
basey := pymax - porty;
if basey < 0 then -- basey := max(basey, 0);
basey := 0;
end if;
when others =>
Beep;
end case;
-- more writing off the screen.
-- Interestingly, the exception is not handled if
-- we put a block around this.
-- delcare --begin
if top_y /= 0 and top_x /= 0 then
Add (Line => top_y - 1, Column => top_x - 1,
Ch => ACS_Map (ACS_Upper_Left_Corner));
end if;
if top_x /= 0 then
do_v_line (top_y, top_x - 1, ACS_Map (ACS_Vertical_Line), porty);
end if;
if top_y /= 0 then
do_h_line (top_y - 1, top_x, ACS_Map (ACS_Horizontal_Line), portx);
end if;
-- exception when Curses_Exception => null; end;
-- in C was ... pxmax > portx - 1
if scrollers and pxmax >= portx then
declare
length : Column_Position := portx - top_x - 1;
lowend, highend : Column_Position;
begin
-- Instead of using floats, I'll use integers only.
lowend := top_x + (basex * length) / pxmax;
highend := top_x + ((basex + length) * length) / pxmax;
do_h_line (porty - 1, top_x, ACS_Map (ACS_Horizontal_Line),
lowend);
if highend < portx then
Switch_Character_Attribute
(Attr => (Reverse_Video => True, others => False),
On => True);
do_h_line (porty - 1, lowend, Blank2, highend + 1);
Switch_Character_Attribute
(Attr => (Reverse_Video => True, others => False),
On => False);
do_h_line (porty - 1, highend + 1,
ACS_Map (ACS_Horizontal_Line), portx);
end if;
end;
else
do_h_line (porty - 1, top_x, ACS_Map (ACS_Horizontal_Line), portx);
end if;
if scrollers and pymax >= porty then
declare
length : Line_Position := porty - top_y - 1;
lowend, highend : Line_Position;
begin
lowend := top_y + (basey * length) / pymax;
highend := top_y + ((basey + length) * length) / pymax;
do_v_line (top_y, portx - 1, ACS_Map (ACS_Vertical_Line),
lowend);
if highend < porty then
Switch_Character_Attribute
(Attr => (Reverse_Video => True, others => False),
On => True);
do_v_line (lowend, portx - 1, Blank2, highend + 1);
Switch_Character_Attribute
(Attr => (Reverse_Video => True, others => False),
On => False);
do_v_line (highend + 1, portx - 1,
ACS_Map (ACS_Vertical_Line), porty);
end if;
end;
else
do_v_line (top_y, portx - 1, ACS_Map (ACS_Vertical_Line), porty);
end if;
if top_y /= 0 then
Add (Line => top_y - 1, Column => portx - 1,
Ch => ACS_Map (ACS_Upper_Right_Corner));
end if;
if top_x /= 0 then
Add (Line => porty - 1, Column => top_x - 1,
Ch => ACS_Map (ACS_Lower_Left_Corner));
end if;
declare
begin
-- Here is another place where it is possible
-- to write to the corner of the screen.
Add (Line => porty - 1, Column => portx - 1,
Ch => ACS_Map (ACS_Lower_Right_Corner));
exception
when Curses_Exception => null;
end;
before := gettime;
Refresh_Without_Update;
declare
-- the C version allows the panel to have a zero height
-- wich raise the exception
begin
Refresh_Without_Update
(
pad,
basey, basex,
top_y, top_x,
porty - Line_Position (greater (pxmax, portx)) - 1,
portx - Column_Position (greater (pymax, porty)) - 1);
exception
when Curses_Exception => null;
end;
Update_Screen;
if timing then declare
s : String (1 .. 7);
elapsed : Long_Float;
begin
after := gettime;
elapsed := (Long_Float (after.seconds - before.seconds) +
Long_Float (after.microseconds - before.microseconds)
/ 1.0e6);
Move_Cursor (Line => Lines - 1, Column => Columns - 20);
floatio.Put (s, elapsed, Aft => 3, Exp => 0);
Add (Str => s);
Refresh;
end;
end if;
c := pgetc (pad);
exit when c = Key_Exit;
end loop;
Allow_Scrolling (Mode => True);
end panner;
Gridsize : constant := 3;
Gridcount : Integer := 0;
Pad_High : constant Line_Count := 200;
Pad_Wide : constant Column_Count := 200;
panpad : Window := New_Pad (Pad_High, Pad_Wide);
begin
if panpad = Null_Window then
Cannot ("cannot create requested pad");
return;
end if;
for i in 0 .. Pad_High - 1 loop
for j in 0 .. Pad_Wide - 1 loop
if i mod Gridsize = 0 and j mod Gridsize = 0 then
if i = 0 or j = 0 then
Add (panpad, '+');
else
-- depends on ASCII?
Add (panpad,
Ch => Character'Val (Character'Pos ('A') +
Gridcount mod 26));
Gridcount := Gridcount + 1;
end if;
elsif i mod Gridsize = 0 then
Add (panpad, '-');
elsif j mod Gridsize = 0 then
Add (panpad, '|');
else
declare
-- handle the write to the lower right corner error
begin
Add (panpad, ' ');
exception
when Curses_Exception => null;
end;
end if;
end loop;
end loop;
panner_legend (Lines - 4);
panner_legend (Lines - 3);
panner_legend (Lines - 2);
panner_legend (Lines - 1);
Set_KeyPad_Mode (panpad, True);
-- Make the pad (initially) narrow enough that a trace file won't wrap.
-- We'll still be able to widen it during a test, since that's required
-- for testing boundaries.
panner (panpad, 2, 2, Lines - 5, Columns - 15, padgetch'Access);
Delete (panpad);
End_Windows; -- Hmm, Erase after End_Windows
Erase;
end ncurses2.demo_pad;
|
MinimSecure/unum-sdk | Ada | 921 | adb | -- Copyright 2007-2016 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure Foo is
I : Integer := 1;
begin
Call_Me (Int => 1, Flt => 2.0, Bln => True, Ary => (1, 4, 8), Chr => 'j',
Sad => I'Address, Rec => (A => 3, B => 7));
end Foo;
|
zhmu/ananas | Ada | 30,872 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S T R I N G S . U N B O U N D E D --
-- --
-- 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 Ada.Strings.Fixed;
with Ada.Strings.Search;
with Ada.Unchecked_Deallocation;
package body Ada.Strings.Unbounded is
function Sum (Left : Natural; Right : Integer) return Natural with Inline;
-- Returns summary of Left and Right, raise Constraint_Error on overflow
function Mul (Left, Right : Natural) return Natural with Inline;
-- Returns multiplication of Left and Right, raise Constraint_Error on
-- overflow.
function Saturated_Sum (Left : Natural; Right : Integer) return Natural;
-- Returns summary of Left and Right or Natural'Last on overflow
function Saturated_Mul (Left, Right : Natural) return Natural;
-- Returns multiplication of Left and Right or Natural'Last on overflow
---------
-- "&" --
---------
function "&"
(Left : Unbounded_String;
Right : Unbounded_String) return Unbounded_String
is
L_Length : constant Natural := Left.Last;
R_Length : constant Natural := Right.Last;
Result : Unbounded_String;
begin
Result.Last := Sum (L_Length, R_Length);
Result.Reference := new String (1 .. Result.Last);
Result.Reference (1 .. L_Length) :=
Left.Reference (1 .. Left.Last);
Result.Reference (L_Length + 1 .. Result.Last) :=
Right.Reference (1 .. Right.Last);
return Result;
end "&";
function "&"
(Left : Unbounded_String;
Right : String) return Unbounded_String
is
L_Length : constant Natural := Left.Last;
Result : Unbounded_String;
begin
Result.Last := Sum (L_Length, Right'Length);
Result.Reference := new String (1 .. Result.Last);
Result.Reference (1 .. L_Length) := Left.Reference (1 .. Left.Last);
Result.Reference (L_Length + 1 .. Result.Last) := Right;
return Result;
end "&";
function "&"
(Left : String;
Right : Unbounded_String) return Unbounded_String
is
R_Length : constant Natural := Right.Last;
Result : Unbounded_String;
begin
Result.Last := Sum (Left'Length, R_Length);
Result.Reference := new String (1 .. Result.Last);
Result.Reference (1 .. Left'Length) := Left;
Result.Reference (Left'Length + 1 .. Result.Last) :=
Right.Reference (1 .. Right.Last);
return Result;
end "&";
function "&"
(Left : Unbounded_String;
Right : Character) return Unbounded_String
is
Result : Unbounded_String;
begin
Result.Last := Sum (Left.Last, 1);
Result.Reference := new String (1 .. Result.Last);
Result.Reference (1 .. Result.Last - 1) :=
Left.Reference (1 .. Left.Last);
Result.Reference (Result.Last) := Right;
return Result;
end "&";
function "&"
(Left : Character;
Right : Unbounded_String) return Unbounded_String
is
Result : Unbounded_String;
begin
Result.Last := Sum (Right.Last, 1);
Result.Reference := new String (1 .. Result.Last);
Result.Reference (1) := Left;
Result.Reference (2 .. Result.Last) :=
Right.Reference (1 .. Right.Last);
return Result;
end "&";
---------
-- "*" --
---------
function "*"
(Left : Natural;
Right : Character) return Unbounded_String
is
Result : Unbounded_String;
begin
Result.Last := Left;
Result.Reference := new String (1 .. Left);
for J in Result.Reference'Range loop
Result.Reference (J) := Right;
end loop;
return Result;
end "*";
function "*"
(Left : Natural;
Right : String) return Unbounded_String
is
Len : constant Natural := Right'Length;
K : Positive;
Result : Unbounded_String;
begin
Result.Last := Mul (Left, Len);
Result.Reference := new String (1 .. Result.Last);
K := 1;
for J in 1 .. Left loop
Result.Reference (K .. K + Len - 1) := Right;
K := K + Len;
end loop;
return Result;
end "*";
function "*"
(Left : Natural;
Right : Unbounded_String) return Unbounded_String
is
Len : constant Natural := Right.Last;
K : Positive;
Result : Unbounded_String;
begin
Result.Last := Mul (Left, Len);
Result.Reference := new String (1 .. Result.Last);
K := 1;
for J in 1 .. Left loop
Result.Reference (K .. K + Len - 1) :=
Right.Reference (1 .. Right.Last);
K := K + Len;
end loop;
return Result;
end "*";
---------
-- "<" --
---------
function "<"
(Left : Unbounded_String;
Right : Unbounded_String) return Boolean
is
begin
return
Left.Reference (1 .. Left.Last) < Right.Reference (1 .. Right.Last);
end "<";
function "<"
(Left : Unbounded_String;
Right : String) return Boolean
is
begin
return Left.Reference (1 .. Left.Last) < Right;
end "<";
function "<"
(Left : String;
Right : Unbounded_String) return Boolean
is
begin
return Left < Right.Reference (1 .. Right.Last);
end "<";
----------
-- "<=" --
----------
function "<="
(Left : Unbounded_String;
Right : Unbounded_String) return Boolean
is
begin
return
Left.Reference (1 .. Left.Last) <= Right.Reference (1 .. Right.Last);
end "<=";
function "<="
(Left : Unbounded_String;
Right : String) return Boolean
is
begin
return Left.Reference (1 .. Left.Last) <= Right;
end "<=";
function "<="
(Left : String;
Right : Unbounded_String) return Boolean
is
begin
return Left <= Right.Reference (1 .. Right.Last);
end "<=";
---------
-- "=" --
---------
function "="
(Left : Unbounded_String;
Right : Unbounded_String) return Boolean
is
begin
return
Left.Reference (1 .. Left.Last) = Right.Reference (1 .. Right.Last);
end "=";
function "="
(Left : Unbounded_String;
Right : String) return Boolean
is
begin
return Left.Reference (1 .. Left.Last) = Right;
end "=";
function "="
(Left : String;
Right : Unbounded_String) return Boolean
is
begin
return Left = Right.Reference (1 .. Right.Last);
end "=";
---------
-- ">" --
---------
function ">"
(Left : Unbounded_String;
Right : Unbounded_String) return Boolean
is
begin
return
Left.Reference (1 .. Left.Last) > Right.Reference (1 .. Right.Last);
end ">";
function ">"
(Left : Unbounded_String;
Right : String) return Boolean
is
begin
return Left.Reference (1 .. Left.Last) > Right;
end ">";
function ">"
(Left : String;
Right : Unbounded_String) return Boolean
is
begin
return Left > Right.Reference (1 .. Right.Last);
end ">";
----------
-- ">=" --
----------
function ">="
(Left : Unbounded_String;
Right : Unbounded_String) return Boolean
is
begin
return
Left.Reference (1 .. Left.Last) >= Right.Reference (1 .. Right.Last);
end ">=";
function ">="
(Left : Unbounded_String;
Right : String) return Boolean
is
begin
return Left.Reference (1 .. Left.Last) >= Right;
end ">=";
function ">="
(Left : String;
Right : Unbounded_String) return Boolean
is
begin
return Left >= Right.Reference (1 .. Right.Last);
end ">=";
------------
-- Adjust --
------------
procedure Adjust (Object : in out Unbounded_String) is
begin
-- Copy string, except we do not copy the statically allocated null
-- string since it can never be deallocated. Note that we do not copy
-- extra string room here to avoid dragging unused allocated memory.
if Object.Reference /= Null_String'Access then
Object.Reference := new String'(Object.Reference (1 .. Object.Last));
end if;
end Adjust;
------------
-- Append --
------------
procedure Append
(Source : in out Unbounded_String;
New_Item : Unbounded_String)
is
begin
Realloc_For_Chunk (Source, New_Item.Last);
Source.Reference (Source.Last + 1 .. Source.Last + New_Item.Last) :=
New_Item.Reference (1 .. New_Item.Last);
Source.Last := Source.Last + New_Item.Last;
end Append;
procedure Append
(Source : in out Unbounded_String;
New_Item : String)
is
begin
Realloc_For_Chunk (Source, New_Item'Length);
Source.Reference (Source.Last + 1 .. Source.Last + New_Item'Length) :=
New_Item;
Source.Last := Source.Last + New_Item'Length;
end Append;
procedure Append
(Source : in out Unbounded_String;
New_Item : Character)
is
begin
Realloc_For_Chunk (Source, 1);
Source.Reference (Source.Last + 1) := New_Item;
Source.Last := Source.Last + 1;
end Append;
-----------
-- Count --
-----------
function Count
(Source : Unbounded_String;
Pattern : String;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
is
begin
return
Search.Count (Source.Reference (1 .. Source.Last), Pattern, Mapping);
end Count;
function Count
(Source : Unbounded_String;
Pattern : String;
Mapping : Maps.Character_Mapping_Function) return Natural
is
begin
return
Search.Count (Source.Reference (1 .. Source.Last), Pattern, Mapping);
end Count;
function Count
(Source : Unbounded_String;
Set : Maps.Character_Set) return Natural
is
begin
return Search.Count (Source.Reference (1 .. Source.Last), Set);
end Count;
------------
-- Delete --
------------
function Delete
(Source : Unbounded_String;
From : Positive;
Through : Natural) return Unbounded_String
is
begin
return
To_Unbounded_String
(Fixed.Delete (Source.Reference (1 .. Source.Last), From, Through));
end Delete;
procedure Delete
(Source : in out Unbounded_String;
From : Positive;
Through : Natural)
is
begin
if From > Through then
null;
elsif From < Source.Reference'First or else Through > Source.Last then
raise Index_Error;
else
declare
Len : constant Natural := Through - From + 1;
begin
Source.Reference (From .. Source.Last - Len) :=
Source.Reference (Through + 1 .. Source.Last);
Source.Last := Source.Last - Len;
end;
end if;
end Delete;
-------------
-- Element --
-------------
function Element
(Source : Unbounded_String;
Index : Positive) return Character
is
begin
if Index <= Source.Last then
return Source.Reference (Index);
else
raise Strings.Index_Error;
end if;
end Element;
--------------
-- Finalize --
--------------
procedure Finalize (Object : in out Unbounded_String) is
procedure Deallocate is
new Ada.Unchecked_Deallocation (String, String_Access);
begin
-- Note: Don't try to free statically allocated null string
if Object.Reference /= Null_String'Access then
declare
Old : String_Access := Object.Reference;
-- The original reference cannot be null, so we must create a
-- copy which will become null when deallocated.
begin
Deallocate (Old);
Object.Reference := Null_Unbounded_String.Reference;
end;
Object.Last := 0;
end if;
end Finalize;
----------------
-- Find_Token --
----------------
procedure Find_Token
(Source : Unbounded_String;
Set : Maps.Character_Set;
From : Positive;
Test : Strings.Membership;
First : out Positive;
Last : out Natural)
is
begin
Search.Find_Token
(Source.Reference (From .. Source.Last), Set, Test, First, Last);
end Find_Token;
procedure Find_Token
(Source : Unbounded_String;
Set : Maps.Character_Set;
Test : Strings.Membership;
First : out Positive;
Last : out Natural)
is
begin
Search.Find_Token
(Source.Reference (1 .. Source.Last), Set, Test, First, Last);
end Find_Token;
----------
-- Free --
----------
procedure Free (X : in out String_Access) is
procedure Deallocate is
new Ada.Unchecked_Deallocation (String, String_Access);
begin
-- Note: Do not try to free statically allocated null string
if X /= Null_Unbounded_String.Reference then
Deallocate (X);
end if;
end Free;
----------
-- Head --
----------
function Head
(Source : Unbounded_String;
Count : Natural;
Pad : Character := Space) return Unbounded_String
is
begin
return To_Unbounded_String
(Fixed.Head (Source.Reference (1 .. Source.Last), Count, Pad));
end Head;
procedure Head
(Source : in out Unbounded_String;
Count : Natural;
Pad : Character := Space)
is
Old : String_Access := Source.Reference;
begin
Source.Reference :=
new String'(Fixed.Head (Source.Reference (1 .. Source.Last),
Count, Pad));
Source.Last := Source.Reference'Length;
Free (Old);
end Head;
-----------
-- Index --
-----------
function Index
(Source : Unbounded_String;
Pattern : String;
Going : Strings.Direction := Strings.Forward;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
is
begin
return Search.Index
(Source.Reference (1 .. Source.Last), Pattern, Going, Mapping);
end Index;
function Index
(Source : Unbounded_String;
Pattern : String;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function) return Natural
is
begin
return Search.Index
(Source.Reference (1 .. Source.Last), Pattern, Going, Mapping);
end Index;
function Index
(Source : Unbounded_String;
Set : Maps.Character_Set;
Test : Strings.Membership := Strings.Inside;
Going : Strings.Direction := Strings.Forward) return Natural
is
begin
return Search.Index
(Source.Reference (1 .. Source.Last), Set, Test, Going);
end Index;
function Index
(Source : Unbounded_String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
is
begin
return Search.Index
(Source.Reference (1 .. Source.Last), Pattern, From, Going, Mapping);
end Index;
function Index
(Source : Unbounded_String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function) return Natural
is
begin
return Search.Index
(Source.Reference (1 .. Source.Last), Pattern, From, Going, Mapping);
end Index;
function Index
(Source : Unbounded_String;
Set : Maps.Character_Set;
From : Positive;
Test : Membership := Inside;
Going : Direction := Forward) return Natural
is
begin
return Search.Index
(Source.Reference (1 .. Source.Last), Set, From, Test, Going);
end Index;
function Index_Non_Blank
(Source : Unbounded_String;
Going : Strings.Direction := Strings.Forward) return Natural
is
begin
return
Search.Index_Non_Blank
(Source.Reference (1 .. Source.Last), Going);
end Index_Non_Blank;
function Index_Non_Blank
(Source : Unbounded_String;
From : Positive;
Going : Direction := Forward) return Natural
is
begin
return
Search.Index_Non_Blank
(Source.Reference (1 .. Source.Last), From, Going);
end Index_Non_Blank;
----------------
-- Initialize --
----------------
procedure Initialize (Object : in out Unbounded_String) is
begin
Object.Reference := Null_Unbounded_String.Reference;
Object.Last := 0;
end Initialize;
------------
-- Insert --
------------
function Insert
(Source : Unbounded_String;
Before : Positive;
New_Item : String) return Unbounded_String
is
begin
return To_Unbounded_String
(Fixed.Insert (Source.Reference (1 .. Source.Last), Before, New_Item));
end Insert;
procedure Insert
(Source : in out Unbounded_String;
Before : Positive;
New_Item : String)
is
begin
if Before not in Source.Reference'First .. Source.Last + 1 then
raise Index_Error;
end if;
Realloc_For_Chunk (Source, New_Item'Length);
Source.Reference
(Before + New_Item'Length .. Source.Last + New_Item'Length) :=
Source.Reference (Before .. Source.Last);
Source.Reference (Before .. Before + New_Item'Length - 1) := New_Item;
Source.Last := Source.Last + New_Item'Length;
end Insert;
------------
-- Length --
------------
function Length (Source : Unbounded_String) return Natural is
begin
return Source.Last;
end Length;
---------
-- Mul --
---------
function Mul (Left, Right : Natural) return Natural is
pragma Unsuppress (Overflow_Check);
begin
return Left * Right;
end Mul;
---------------
-- Overwrite --
---------------
function Overwrite
(Source : Unbounded_String;
Position : Positive;
New_Item : String) return Unbounded_String
is
begin
return To_Unbounded_String
(Fixed.Overwrite
(Source.Reference (1 .. Source.Last), Position, New_Item));
end Overwrite;
procedure Overwrite
(Source : in out Unbounded_String;
Position : Positive;
New_Item : String)
is
NL : constant Natural := New_Item'Length;
begin
if Position <= Source.Last - NL + 1 then
Source.Reference (Position .. Position + NL - 1) := New_Item;
else
declare
Old : String_Access := Source.Reference;
begin
Source.Reference := new String'
(Fixed.Overwrite
(Source.Reference (1 .. Source.Last), Position, New_Item));
Source.Last := Source.Reference'Length;
Free (Old);
end;
end if;
end Overwrite;
---------------
-- Put_Image --
---------------
procedure Put_Image
(S : in out Ada.Strings.Text_Buffers.Root_Buffer_Type'Class;
V : Unbounded_String) is
begin
String'Put_Image (S, To_String (V));
end Put_Image;
-----------------------
-- Realloc_For_Chunk --
-----------------------
procedure Realloc_For_Chunk
(Source : in out Unbounded_String;
Chunk_Size : Natural)
is
Growth_Factor : constant := 2;
-- The growth factor controls how much extra space is allocated when
-- we have to increase the size of an allocated unbounded string. By
-- allocating extra space, we avoid the need to reallocate on every
-- append, particularly important when a string is built up by repeated
-- append operations of small pieces. This is expressed as a factor so
-- 2 means add 1/2 of the length of the string as growth space.
Min_Mul_Alloc : constant := Standard'Maximum_Alignment;
-- Allocation will be done by a multiple of Min_Mul_Alloc This causes
-- no memory loss as most (all?) malloc implementations are obliged to
-- align the returned memory on the maximum alignment as malloc does not
-- know the target alignment.
S_Length : constant Natural := Source.Reference'Length;
begin
if Chunk_Size > S_Length - Source.Last then
declare
New_Size : constant Positive :=
Saturated_Sum
(Sum (S_Length, Chunk_Size), S_Length / Growth_Factor);
New_Rounded_Up_Size : constant Positive :=
Saturated_Mul
((New_Size - 1) / Min_Mul_Alloc + 1, Min_Mul_Alloc);
Tmp : constant String_Access :=
new String (1 .. New_Rounded_Up_Size);
Old : String_Access := Source.Reference;
-- The original reference cannot be null, so we must create a copy
-- which will become null when deallocated.
begin
Tmp (1 .. Source.Last) := Source.Reference (1 .. Source.Last);
Free (Old);
Source.Reference := Tmp;
end;
end if;
end Realloc_For_Chunk;
---------------------
-- Replace_Element --
---------------------
procedure Replace_Element
(Source : in out Unbounded_String;
Index : Positive;
By : Character)
is
begin
if Index <= Source.Last then
Source.Reference (Index) := By;
else
raise Strings.Index_Error;
end if;
end Replace_Element;
-------------------
-- Replace_Slice --
-------------------
function Replace_Slice
(Source : Unbounded_String;
Low : Positive;
High : Natural;
By : String) return Unbounded_String
is
begin
return To_Unbounded_String
(Fixed.Replace_Slice
(Source.Reference (1 .. Source.Last), Low, High, By));
end Replace_Slice;
procedure Replace_Slice
(Source : in out Unbounded_String;
Low : Positive;
High : Natural;
By : String)
is
Old : String_Access := Source.Reference;
begin
Source.Reference := new String'
(Fixed.Replace_Slice
(Source.Reference (1 .. Source.Last), Low, High, By));
Source.Last := Source.Reference'Length;
Free (Old);
end Replace_Slice;
-------------------
-- Saturated_Mul --
-------------------
function Saturated_Mul (Left, Right : Natural) return Natural is
begin
return Mul (Left, Right);
exception
when Constraint_Error =>
return Natural'Last;
end Saturated_Mul;
-----------------
-- Saturated_Sum --
-----------------
function Saturated_Sum (Left : Natural; Right : Integer) return Natural is
begin
return Sum (Left, Right);
exception
when Constraint_Error =>
return Natural'Last;
end Saturated_Sum;
--------------------------
-- Set_Unbounded_String --
--------------------------
procedure Set_Unbounded_String
(Target : out Unbounded_String;
Source : String)
is
Old : String_Access := Target.Reference;
begin
Target.Last := Source'Length;
Target.Reference := new String (1 .. Source'Length);
Target.Reference.all := Source;
Free (Old);
end Set_Unbounded_String;
-----------
-- Slice --
-----------
function Slice
(Source : Unbounded_String;
Low : Positive;
High : Natural) return String
is
begin
-- Note: test of High > Length is in accordance with AI95-00128
if Low > Source.Last + 1 or else High > Source.Last then
raise Index_Error;
else
return Source.Reference (Low .. High);
end if;
end Slice;
---------
-- Sum --
---------
function Sum (Left : Natural; Right : Integer) return Natural is
pragma Unsuppress (Overflow_Check);
begin
return Left + Right;
end Sum;
----------
-- Tail --
----------
function Tail
(Source : Unbounded_String;
Count : Natural;
Pad : Character := Space) return Unbounded_String is
begin
return To_Unbounded_String
(Fixed.Tail (Source.Reference (1 .. Source.Last), Count, Pad));
end Tail;
procedure Tail
(Source : in out Unbounded_String;
Count : Natural;
Pad : Character := Space)
is
Old : String_Access := Source.Reference;
begin
Source.Reference := new String'
(Fixed.Tail (Source.Reference (1 .. Source.Last), Count, Pad));
Source.Last := Source.Reference'Length;
Free (Old);
end Tail;
---------------
-- To_String --
---------------
function To_String (Source : Unbounded_String) return String is
begin
return Source.Reference (1 .. Source.Last);
end To_String;
-------------------------
-- To_Unbounded_String --
-------------------------
function To_Unbounded_String (Source : String) return Unbounded_String is
Result : Unbounded_String;
begin
-- Do not allocate an empty string: keep the default
if Source'Length > 0 then
Result.Last := Source'Length;
Result.Reference := new String (1 .. Source'Length);
Result.Reference.all := Source;
end if;
return Result;
end To_Unbounded_String;
function To_Unbounded_String
(Length : Natural) return Unbounded_String
is
Result : Unbounded_String;
begin
-- Do not allocate an empty string: keep the default
if Length > 0 then
Result.Last := Length;
Result.Reference := new String (1 .. Length);
end if;
return Result;
end To_Unbounded_String;
---------------
-- Translate --
---------------
function Translate
(Source : Unbounded_String;
Mapping : Maps.Character_Mapping) return Unbounded_String
is
begin
return To_Unbounded_String
(Fixed.Translate (Source.Reference (1 .. Source.Last), Mapping));
end Translate;
procedure Translate
(Source : in out Unbounded_String;
Mapping : Maps.Character_Mapping)
is
begin
Fixed.Translate (Source.Reference (1 .. Source.Last), Mapping);
end Translate;
function Translate
(Source : Unbounded_String;
Mapping : Maps.Character_Mapping_Function) return Unbounded_String
is
begin
return To_Unbounded_String
(Fixed.Translate (Source.Reference (1 .. Source.Last), Mapping));
end Translate;
procedure Translate
(Source : in out Unbounded_String;
Mapping : Maps.Character_Mapping_Function)
is
begin
Fixed.Translate (Source.Reference (1 .. Source.Last), Mapping);
end Translate;
----------
-- Trim --
----------
function Trim
(Source : Unbounded_String;
Side : Trim_End) return Unbounded_String
is
begin
return To_Unbounded_String
(Fixed.Trim (Source.Reference (1 .. Source.Last), Side));
end Trim;
procedure Trim
(Source : in out Unbounded_String;
Side : Trim_End)
is
Old : String_Access := Source.Reference;
begin
Source.Reference := new String'
(Fixed.Trim (Source.Reference (1 .. Source.Last), Side));
Source.Last := Source.Reference'Length;
Free (Old);
end Trim;
function Trim
(Source : Unbounded_String;
Left : Maps.Character_Set;
Right : Maps.Character_Set) return Unbounded_String
is
begin
return To_Unbounded_String
(Fixed.Trim (Source.Reference (1 .. Source.Last), Left, Right));
end Trim;
procedure Trim
(Source : in out Unbounded_String;
Left : Maps.Character_Set;
Right : Maps.Character_Set)
is
Old : String_Access := Source.Reference;
begin
Source.Reference := new String'
(Fixed.Trim (Source.Reference (1 .. Source.Last), Left, Right));
Source.Last := Source.Reference'Length;
Free (Old);
end Trim;
---------------------
-- Unbounded_Slice --
---------------------
function Unbounded_Slice
(Source : Unbounded_String;
Low : Positive;
High : Natural) return Unbounded_String
is
begin
if Low - 1 > Source.Last or else High > Source.Last then
raise Index_Error;
else
return To_Unbounded_String (Source.Reference.all (Low .. High));
end if;
end Unbounded_Slice;
procedure Unbounded_Slice
(Source : Unbounded_String;
Target : out Unbounded_String;
Low : Positive;
High : Natural)
is
begin
if Low - 1 > Source.Last or else High > Source.Last then
raise Index_Error;
else
Target := To_Unbounded_String (Source.Reference.all (Low .. High));
end if;
end Unbounded_Slice;
end Ada.Strings.Unbounded;
|
onox/orka | Ada | 6,098 | 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.
with GL.Low_Level;
package GL.Objects.Queries is
pragma Preelaborate;
type Query_Type is
(Vertices_Submitted,
Primitives_Submitted,
Vertex_Shader_Invocations,
Tess_Control_Shader_Invocations,
Tess_Evaluation_Shader_Invocations,
Geometry_Shader_Primitives_Emitted,
Fragment_Shader_Invocations,
Compute_Shader_Invocations,
Clipping_Input_Primitives,
Clipping_Output_Primitives,
Geometry_Shader_Invocations,
Time_Elapsed,
Samples_Passed,
Any_Samples_Passed,
Primitives_Generated,
Any_Samples_Passed_Conservative,
Timestamp);
-- Has to be defined here because of the subtype declaration below
for Query_Type use
(Vertices_Submitted => 16#82EE#,
Primitives_Submitted => 16#82EF#,
Vertex_Shader_Invocations => 16#82F0#,
Tess_Control_Shader_Invocations => 16#82F1#,
Tess_Evaluation_Shader_Invocations => 16#82F2#,
Geometry_Shader_Primitives_Emitted => 16#82F3#,
Fragment_Shader_Invocations => 16#82F4#,
Compute_Shader_Invocations => 16#82F5#,
Clipping_Input_Primitives => 16#82F6#,
Clipping_Output_Primitives => 16#82F7#,
Geometry_Shader_Invocations => 16#887F#,
Time_Elapsed => 16#88BF#,
Samples_Passed => 16#8914#,
Any_Samples_Passed => 16#8C2F#,
Primitives_Generated => 16#8C87#,
Any_Samples_Passed_Conservative => 16#8D6A#,
Timestamp => 16#8E28#);
for Query_Type'Size use Low_Level.Enum'Size;
subtype Async_Query_Type is Query_Type
range Vertices_Submitted .. Any_Samples_Passed_Conservative;
subtype Timestamp_Query_Type is Query_Type range Timestamp .. Timestamp;
subtype Stream_Query_Type is Query_Type
with Static_Predicate =>
Stream_Query_Type in Primitives_Generated;
type Query_Param is (Result, Result_Available, Result_No_Wait);
type Query (Target : Query_Type) is new GL_Object with private;
overriding
procedure Initialize_Id (Object : in out Query);
overriding
procedure Delete_Id (Object : in out Query);
overriding
function Identifier (Object : Query) return Types.Debug.Identifier is
(Types.Debug.Query);
type Active_Query is limited new Ada.Finalization.Limited_Controlled with private;
function Begin_Query
(Object : in out Query;
Index : in Natural := 0) return Active_Query'Class
with Pre => Object.Target in Async_Query_Type and
(if Object.Target not in Stream_Query_Type then Index = 0);
-- Start an asynchronous query. The value returned is of a controlled
-- type, meaning you must assign it to some local variable, so that
-- the query will be automatically ended when the variable goes out
-- of scope.
--
-- Queries of type Timestamp are not used within a scope. For such
-- a query you can record the time into the query object by calling
-- Record_Current_Time.
--
-- Certain queries support multiple query operations; one for each
-- index. The index represents the vertex output stream used in a
-- Geometry Shader. These targets are:
--
-- * Primitives_Generated
function Result_Available (Object : in out Query) return Boolean;
-- Return true if a result is available, false otherwise. This function
-- can be used to avoid calling Result (and thereby stalling the CPU)
-- when the result is not yet available.
function Result_If_Available (Object : in out Query; Default : Boolean) return Boolean;
function Result_If_Available (Object : in out Query; Default : Natural) return Natural;
function Result_If_Available (Object : in out Query; Default : UInt64) return UInt64;
-- Return the result if available, otherwise return the default value
function Result (Object : in out Query) return Boolean;
function Result (Object : in out Query) return Natural;
function Result (Object : in out Query) return UInt64;
-- Return the result. If the result is not yet available, then the
-- CPU will stall until the result becomes available. This means
-- that if you do not call Result_Available, then this function call
-- will make the query synchronous.
procedure Record_Current_Time (Object : in out Query);
-- Record the time when the GPU has completed all previous commands
-- in a query object. The result must be retrieved asynchronously using
-- one of the Result functions.
function Get_Current_Time return Long;
-- Return the time when the GPU has received (but not necessarily
-- completed) all previous commands. Calling this function stalls the CPU.
private
for Query_Param use (Result => 16#8866#,
Result_Available => 16#8867#,
Result_No_Wait => 16#9194#);
for Query_Param'Size use Low_Level.Enum'Size;
type Query (Target : Query_Type) is new GL_Object with null record;
type Active_Query is limited new Ada.Finalization.Limited_Controlled with record
Target : Query_Type;
Index : Natural;
Finalized : Boolean;
end record;
overriding
procedure Finalize (Object : in out Active_Query);
end GL.Objects.Queries;
|
RREE/ada-util | Ada | 1,509 | ads | -----------------------------------------------------------------------
-- util-dates-tests - Test for dates
-- Copyright (C) 2018, 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.Tests;
package Util.Dates.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
-- Test converting a date in ISO8601.
procedure Test_ISO8601_Image (T : in out Test);
-- Test converting a string in ISO8601 into a date.
procedure Test_ISO8601_Value (T : in out Test);
-- Test value convertion errors.
procedure Test_ISO8601_Error (T : in out Test);
-- Test Is_Same_Day operation.
procedure Test_Is_Same_Day (T : in out Test);
-- Test Get_Day_Count operation.
procedure Test_Get_Day_Count (T : in out Test);
end Util.Dates.Tests;
|
sungyeon/drake | Ada | 194 | ads | pragma License (Unrestricted);
with Ada.Numerics.Short_Complex_Types;
with Ada.Text_IO.Complex_IO;
package Ada.Short_Complex_Text_IO is
new Text_IO.Complex_IO (Numerics.Short_Complex_Types);
|
reznikmm/matreshka | Ada | 8,176 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
private with Ada.Finalization;
with League.Holders;
with League.JSON.Arrays;
with League.JSON.Objects;
with League.Strings;
private with Matreshka.JSON_Types;
package League.JSON.Values is
pragma Preelaborate;
type JSON_Value_Kinds is
(Empty_Value,
Boolean_Value,
Number_Value,
String_Value,
Array_Value,
Object_Value,
Null_Value);
type JSON_Value is tagged private;
pragma Preelaborable_Initialization (JSON_Value);
Empty_JSON_Value : constant JSON_Value;
Null_JSON_Value : constant JSON_Value;
function To_JSON_Value (Value : Boolean) return JSON_Value;
function To_JSON_Value
(Value : League.Holders.Universal_Float) return JSON_Value;
function To_JSON_Value
(Value : League.Holders.Universal_Integer) return JSON_Value;
function To_JSON_Value
(Value : League.Strings.Universal_String) return JSON_Value;
function To_JSON_Value (Value : League.Holders.Holder) return JSON_Value;
function Is_Array (Self : JSON_Value'Class) return Boolean;
-- Returns true if the value contains an array.
function Is_Boolean (Self : JSON_Value'Class) return Boolean;
-- Returns true if the value contains a boolean.
function Is_Empty (Self : JSON_Value'Class) return Boolean;
-- Returns true if the value is empty. This can happen in certain error
-- cases as e.g. accessing a non existing key in a JSON_Object.
function Is_Float_Number (Self : JSON_Value'Class) return Boolean;
-- Returns true if the value contains a float number.
function Is_Integer_Number (Self : JSON_Value'Class) return Boolean;
-- Returns true if the value contains an integer number.
function Is_Null (Self : JSON_Value'Class) return Boolean;
-- Returns true if the value is null.
function Is_Number (Self : JSON_Value'Class) return Boolean;
-- Returns true if the value contains a number.
function Is_Object (Self : JSON_Value'Class) return Boolean;
-- Returns true if the value contains an object.
function Is_String (Self : JSON_Value'Class) return Boolean;
-- Returns true if the value contains a string.
function Kind (Self : JSON_Value'Class) return JSON_Value_Kinds;
-- Returns type of the value.
function To_Array
(Self : JSON_Value'Class;
Default : League.JSON.Arrays.JSON_Array
:= League.JSON.Arrays.Empty_JSON_Array)
return League.JSON.Arrays.JSON_Array;
-- Converts the value to an array and returns it.
--
-- If type of value is not Type_Array, the Default will be returned.
function To_Boolean
(Self : JSON_Value'Class; Default : Boolean := False) return Boolean;
-- Converts the value to a bool and returns it.
--
-- If type of value is not Type_Boolean, the Default will be returned.
function To_Float
(Self : JSON_Value'Class;
Default : League.Holders.Universal_Float := 0.0)
return League.Holders.Universal_Float;
-- Converts the value to a float and returns it.
--
-- If type of value is not Type_Number, the Default will be returned.
function To_Holder (Self : JSON_Value'Class) return League.Holders.Holder;
-- Converts the value to a holder.
function To_Integer
(Self : JSON_Value'Class;
Default : League.Holders.Universal_Integer := 0)
return League.Holders.Universal_Integer;
-- Converts the value to an integer and returns it.
--
-- If type of value is not Type_Number, the Default will be returned.
function To_Object
(Self : JSON_Value'Class;
Default : League.JSON.Objects.JSON_Object
:= League.JSON.Objects.Empty_JSON_Object)
return League.JSON.Objects.JSON_Object;
-- Converts the value to an object and returns it.
--
-- If type of value is not Type_Object, the Default will be returned.
function To_String
(Self : JSON_Value'Class;
Default : League.Strings.Universal_String
:= League.Strings.Empty_Universal_String)
return League.Strings.Universal_String;
-- Converts the value to a string and returns it.
--
-- If type of value is not Type_String, the Default will be returned.
private
type JSON_Value is new Ada.Finalization.Controlled with record
Data : Matreshka.JSON_Types.Shared_JSON_Value_Access
:= Matreshka.JSON_Types.Empty_Shared_JSON_Value'Access;
end record;
overriding procedure Adjust (Self : in out JSON_Value);
overriding procedure Finalize (Self : in out JSON_Value);
Empty_JSON_Value : constant JSON_Value
:= (Ada.Finalization.Controlled with
Data => Matreshka.JSON_Types.Empty_Shared_JSON_Value'Access);
Null_JSON_Value : constant JSON_Value
:= (Ada.Finalization.Controlled with
Data => Matreshka.JSON_Types.Null_Shared_JSON_Value'Access);
end League.JSON.Values;
|
zhmu/ananas | Ada | 623 | adb | -- { dg-do compile }
-- { dg-options "-w" }
package body Vect10 is
procedure Add_Mul (X : in out Unit; Y, Z : in Unit) is
begin
X := X + Y * Z;
end;
pragma Inline_Always (Add_Mul);
procedure Proc
(F : in Rec_Vector;
First_Index : in Natural;
Last_Index : in Natural;
Result : out Unit)
is
begin
Result := (others => 0.0);
for I in First_Index + 1 .. Last_Index loop
declare
Local : Rec renames F (I);
begin
Add_Mul (Result, Local.Val, Local.Val);
end;
end loop;
end;
end Vect10;
|
reznikmm/matreshka | Ada | 4,009 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Meta_Frame_Count_Attributes;
package Matreshka.ODF_Meta.Frame_Count_Attributes is
type Meta_Frame_Count_Attribute_Node is
new Matreshka.ODF_Meta.Abstract_Meta_Attribute_Node
and ODF.DOM.Meta_Frame_Count_Attributes.ODF_Meta_Frame_Count_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Meta_Frame_Count_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Meta_Frame_Count_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Meta.Frame_Count_Attributes;
|
eqcola/ada-ado | Ada | 3,324 | ads | -----------------------------------------------------------------------
-- ADO Drivers -- Database Drivers
-- Copyright (C) 2010, 2011, 2012, 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.Properties;
-- == Introduction ==
-- The <b>ADO.Drivers</b> package represents the database driver that will create
-- database connections and provide the database specific implementation. The driver
-- is either statically linked to the application and can be loaded dynamically if it was
-- built as a shared library. For a dynamic load, the driver shared library name must be
-- prefixed by <b>libada_ado_</b>. For example, for a <tt>mysql</tt> driver, the shared
-- library name is <tt>libada_ado_mysql.so</tt>.
--
-- === Initialization ===
-- The <b>ADO</b> runtime must be initialized by calling one of the <b>Initialize</b> operation.
-- A property file contains the configuration for the database drivers and the database
-- connection properties.
--
-- ADO.Drivers.Initialize ("db.properties");
--
-- Once initialized, a configuration property can be retrieved by using the <tt>Get_Config</tt>
-- operation.
--
-- URI : constant String := ADO.Drivers.Get_Config ("ado.database");
--
-- === Connection string ===
-- The database connection string is an URI that specifies the database driver to use as well
-- as the information for the database driver to connect to the database.
-- The driver connection is a string of the form:
--
-- driver://[host][:port]/[database][?property1][=value1]...
--
-- The database connection string is passed to the session factory that maintains connections
-- to the database (see ADO.Sessions.Factory).
--
package ADO.Drivers is
use Ada.Strings.Unbounded;
-- Raised when the connection URI is invalid.
Connection_Error : exception;
-- Raised for all errors reported by the database
DB_Error : exception;
type Driver_Index is new Natural range 0 .. 4;
-- Initialize the drivers and the library by reading the property file
-- and configure the runtime with it.
procedure Initialize (Config : in String);
-- Initialize the drivers and the library and configure the runtime with the given properties.
procedure Initialize (Config : in Util.Properties.Manager'Class);
-- Get the global configuration property identified by the name.
-- If the configuration property does not exist, returns the default value.
function Get_Config (Name : in String;
Default : in String := "") return String;
private
-- Initialize the drivers which are available.
procedure Initialize;
end ADO.Drivers;
|
vasil-sd/ada-tlsf | Ada | 345 | ads | generic
type Modular_Type is mod <>;
package BitOperations.Types With
SPARK_Mode, Pure is
Pragma Assert (Modular_Type'Last = 2 ** Modular_Type'Size - 1);
subtype Modular is Modular_Type;
subtype Bit_Position is Natural range 0 .. Modular'Size - 1;
subtype Mask_Size is Natural range 1 .. Modular'Size;
end BitOperations.Types;
|
psyomn/ash | Ada | 868 | adb | -- Copyright 2019 Simon Symeonidis (psyomn)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with AUnit;
with AUnit.Reporter.Text;
with AUnit.Run;
with Ash_Suite; use Ash_Suite;
procedure Test_Ash is
procedure Runner is new AUnit.Run.Test_Runner (Suite);
Reporter : AUnit.Reporter.Text.Text_Reporter;
begin
Runner (Reporter);
end Test_Ash;
|
reznikmm/matreshka | Ada | 3,636 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- SQL Database Access --
-- --
-- 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 SQL.Databases.Internals is
--------------
-- Internal --
--------------
function Internal
(Self : SQL_Database'Class)
return Matreshka.Internals.SQL_Drivers.Database_Access is
begin
return Self.Data;
end Internal;
end SQL.Databases.Internals;
|
tsoding/ada-probe | Ada | 1,991 | adb | with Ada.Text_IO; use Ada.Text_IO;
package body Aids.Env is
function Index_Of(Line: in String; X: in Character; Result: out Integer) return Boolean is
begin
for Index in Line'Range loop
if Line(Index) = X then
Result := Index;
return True;
end if;
end loop;
return False;
end;
function Slurp(File_Path: String) return Env_Hashed_Map.Map is
Result: Env_Hashed_Map.Map;
File: File_Type;
Line_Number: Integer := 1;
begin
Open(File => File,
Mode => In_File,
Name => File_Path);
while not End_Of_File(File) loop
declare
Line: String := Get_Line(File);
Index : Integer;
begin
if Index_Of(Line, '=', Index) then
declare
Key : Unbounded_String := To_Unbounded_String(Line(Line'First..Index-1));
Value : Unbounded_String := To_Unbounded_String(Line(Index+1..Line'Last));
begin
Env_Hashed_Map.Insert(Result, Key, Value);
end;
else
raise Syntax_Error with (File_Path
& ":"
& Integer'Image(Line_Number)
& ": Expected separator `=`");
end if;
Line_Number := Line_Number + 1;
end;
end loop;
Close(File);
return Result;
end;
function Find(Env: in Typ; Key: in Unbounded_String; Value: out Unbounded_String) return Boolean is
C: Env_Hashed_Map.Cursor := Env_Hashed_Map.Find(Env, Key);
begin
if Env_Hashed_Map.Has_Element(C) then
Value := Env_Hashed_Map.Element(C);
return True;
end if;
return False;
end;
end Aids.Env;
|
thorstel/Advent-of-Code-2018 | Ada | 344 | ads | with Interfaces; use Interfaces;
generic
Register_Size : Natural := 4;
package Opcode_Helper is
type Registers is
array (Natural range 0 .. Register_Size - 1) of Unsigned_64;
function Execute_Instruction
(Op : String;
Reg : Registers;
A, B, C : Unsigned_64)
return Registers;
end Opcode_Helper;
|
sungyeon/drake | Ada | 55,814 | adb | with Ada.Exception_Identification.From_Here;
with Ada.Exceptions.Finally;
with Ada.Unchecked_Deallocation;
with System.Form_Parameters;
with System.UTF_Conversions;
package body Ada.Naked_Text_IO is
use Exception_Identification.From_Here;
use type IO_Modes.File_External;
use type IO_Modes.File_External_Spec;
use type IO_Modes.File_Mode;
use type IO_Modes.File_New_Line;
use type IO_Modes.File_New_Line_Spec;
use type Streams.Stream_Element_Offset;
use type System.UTF_Conversions.UCS_4;
procedure unreachable
with Import,
Convention => Intrinsic, External_Name => "__builtin_unreachable";
pragma No_Return (unreachable);
function To_Pointer (Value : System.Address)
return access Streams.Root_Stream_Type'Class
with Import, Convention => Intrinsic;
-- the parameter Form
function Select_External (Spec : IO_Modes.File_External_Spec)
return IO_Modes.File_External;
function Select_External (Spec : IO_Modes.File_External_Spec)
return IO_Modes.File_External is
begin
case Spec is
when IO_Modes.UTF_8 =>
return IO_Modes.UTF_8;
when IO_Modes.Locale =>
declare
Locale_Support : constant Boolean :=
System.Native_Text_IO.Default_External = IO_Modes.Locale;
begin
if Locale_Support then
return IO_Modes.Locale; -- Windows
else
return IO_Modes.UTF_8; -- POSIX
end if;
end;
when IO_Modes.By_Target =>
return System.Native_Text_IO.Default_External;
end case;
end Select_External;
function Select_New_Line (Spec : IO_Modes.File_New_Line_Spec)
return IO_Modes.File_New_Line;
function Select_New_Line (Spec : IO_Modes.File_New_Line_Spec)
return IO_Modes.File_New_Line is
begin
case Spec is
when IO_Modes.LF | IO_Modes.CR | IO_Modes.CR_LF =>
return IO_Modes.File_New_Line (Spec);
when IO_Modes.By_Target =>
return System.Native_Text_IO.Default_New_Line;
end case;
end Select_New_Line;
-- implementation of the parameter Form
procedure Set (
Form : in out System.Native_Text_IO.Packed_Form;
Keyword : String;
Item : String) is
begin
if Keyword = "external" then
if Item'Length > 0 and then Item (Item'First) = 'd' then -- dbcs
Form.External := IO_Modes.Locale;
elsif Item'Length > 0
and then Item (Item'First) = 'u'
and then Item (Item'Last) = '8'
then -- utf-8
Form.External := IO_Modes.UTF_8;
end if;
elsif Keyword = "wcem" then
-- compatibility with GNAT runtime
if Item'Length > 0 and then Item (Item'First) = '8' then
Form.External := IO_Modes.UTF_8;
end if;
elsif Keyword = "nl" then -- abbr or new_line
if Item'Length > 0 and then Item (Item'First) = 'l' then -- lf
Form.New_Line := IO_Modes.LF;
elsif Item'Length > 0 and then Item (Item'First) = 'c' then -- cr
Form.New_Line := IO_Modes.CR;
elsif Item'Length > 0 and then Item (Item'First) = 'm' then
Form.New_Line := IO_Modes.CR_LF;
end if;
else
Streams.Naked_Stream_IO.Set (Form.Stream_Form, Keyword, Item);
end if;
end Set;
function Pack (Form : String) return System.Native_Text_IO.Packed_Form is
Keyword_First : Positive;
Keyword_Last : Natural;
Item_First : Positive;
Item_Last : Natural;
Last : Natural;
begin
return Result : System.Native_Text_IO.Packed_Form := Default_Form do
Last := Form'First - 1;
while Last < Form'Last loop
System.Form_Parameters.Get (
Form (Last + 1 .. Form'Last),
Keyword_First,
Keyword_Last,
Item_First,
Item_Last,
Last);
Set (
Result,
Form (Keyword_First .. Keyword_Last),
Form (Item_First .. Item_Last));
end loop;
end return;
end Pack;
procedure Unpack (
Form : System.Native_Text_IO.Packed_Form;
Result : out Streams.Naked_Stream_IO.Form_String;
Last : out Natural)
is
subtype Valid_File_External_Spec is
IO_Modes.File_External_Spec range IO_Modes.UTF_8 .. IO_Modes.Locale;
New_Last : Natural;
begin
Streams.Naked_Stream_IO.Unpack (Form.Stream_Form, Result, Last);
if Form.External /= IO_Modes.By_Target then
if Last /= Streams.Naked_Stream_IO.Form_String'First - 1 then
New_Last := Last + 1;
Result (New_Last) := ',';
Last := New_Last;
end if;
case Valid_File_External_Spec (Form.External) is
when IO_Modes.UTF_8 =>
New_Last := Last + 14;
Result (Last + 1 .. New_Last) := "external=utf-8";
when IO_Modes.Locale =>
New_Last := Last + 13;
Result (Last + 1 .. New_Last) := "external=dbcs";
end case;
Last := New_Last;
end if;
if Form.New_Line /= IO_Modes.By_Target then
if Last /= Streams.Naked_Stream_IO.Form_String'First - 1 then
New_Last := Last + 1;
Result (New_Last) := ',';
Last := New_Last;
end if;
case IO_Modes.File_New_Line (Form.New_Line) is
when IO_Modes.LF =>
New_Last := Last + 5;
Result (Last + 1 .. New_Last) := "lm=lf";
Last := New_Last;
when IO_Modes.CR =>
New_Last := Last + 5;
Result (Last + 1 .. New_Last) := "lm=cr";
Last := New_Last;
when IO_Modes.CR_LF =>
New_Last := Last + 4;
Result (Last + 1 .. New_Last) := "lm=m";
Last := New_Last;
end case;
end if;
end Unpack;
-- non-controlled
procedure Free (X : in out Non_Controlled_File_Type);
procedure Free (X : in out Non_Controlled_File_Type) is
procedure Raw_Free is
new Unchecked_Deallocation (Text_Type, Non_Controlled_File_Type);
begin
System.Native_IO.Free (X.Name);
Raw_Free (X);
end Free;
type Open_Access is not null access procedure (
File : in out Streams.Naked_Stream_IO.Non_Controlled_File_Type;
Mode : IO_Modes.File_Mode;
Name : String;
Form : System.Native_IO.Packed_Form);
pragma Favor_Top_Level (Open_Access);
procedure Open_File (
Open_Proc : Open_Access;
File : in out Non_Controlled_File_Type;
Mode : IO_Modes.File_Mode;
Name : String;
Form : System.Native_Text_IO.Packed_Form);
procedure Open_File (
Open_Proc : Open_Access;
File : in out Non_Controlled_File_Type;
Mode : IO_Modes.File_Mode;
Name : String;
Form : System.Native_Text_IO.Packed_Form)
is
New_File : aliased Non_Controlled_File_Type := new Text_Type'(
Stream => System.Null_Address,
Name => null,
Mode => Mode,
External => <>,
New_Line => <>,
others => <>);
package Holder is
new Exceptions.Finally.Scoped_Holder (Non_Controlled_File_Type, Free);
begin
Holder.Assign (New_File);
-- open
Open_Proc (
File => New_File.File,
Mode => Mode,
Name => Name,
Form => Form.Stream_Form);
-- select encoding
if System.Native_IO.Is_Terminal (
Streams.Naked_Stream_IO.Handle (New_File.File))
then
New_File.External := IO_Modes.Terminal;
New_File.New_Line := System.Native_Text_IO.Default_New_Line;
else
New_File.External := Select_External (Form.External);
New_File.New_Line := Select_New_Line (Form.New_Line);
end if;
-- complete
Holder.Clear;
File := New_File;
end Open_File;
-- Input
-- * Read_Buffer sets (or keeps) Ahead_Col.
-- * Get adds Ahead_Col to current Col.
-- * Take_Buffer clears Ahead_Col.
procedure Read (
File : not null Non_Controlled_File_Type;
Item : out Streams.Stream_Element_Array;
Last : out Streams.Stream_Element_Offset);
procedure Read (
File : not null Non_Controlled_File_Type;
Item : out Streams.Stream_Element_Array;
Last : out Streams.Stream_Element_Offset) is
begin
if not Streams.Naked_Stream_IO.Is_Open (File.File) then
-- external stream mode
Streams.Read (To_Pointer (File.Stream).all, Item, Last);
else
Streams.Naked_Stream_IO.Read (File.File, Item, Last);
end if;
end Read;
procedure Read_Buffer (
File : Non_Controlled_File_Type;
Wanted : Positive := 1;
Wait : Boolean := True);
procedure Take_Buffer (
File : Non_Controlled_File_Type;
Length : Positive := 1);
procedure Take_Sequence (File : Non_Controlled_File_Type);
procedure Take_Page (File : Non_Controlled_File_Type);
procedure Take_Line (File : Non_Controlled_File_Type);
procedure Take_Line_Immediate (File : Non_Controlled_File_Type);
procedure Read_Buffer (
File : Non_Controlled_File_Type;
Wanted : Positive := 1;
Wait : Boolean := True) is
begin
if not File.End_Of_File and then File.Ahead_Last < Wanted then
if File.External = IO_Modes.Terminal then
declare
Read_Length : Streams.Stream_Element_Offset;
begin
if Wait then
System.Native_Text_IO.Terminal_Get (
Streams.Naked_Stream_IO.Handle (File.File),
File.Buffer (File.Last + 1)'Address,
1,
Read_Length);
if Read_Length = 0 then
File.End_Of_File := True;
end if;
else
System.Native_Text_IO.Terminal_Get_Immediate (
Streams.Naked_Stream_IO.Handle (File.File),
File.Buffer (File.Last + 1)'Address,
1,
Read_Length); -- Read_Length can be > 1
end if;
if Read_Length < 0 then
Raise_Exception (Device_Error'Identity);
end if;
File.Last := File.Last + Natural (Read_Length);
end;
else
-- read next single character
declare
Old_Last : constant Natural := File.Last;
Buffer : Streams.Stream_Element_Array (
Streams.Stream_Element_Offset (Old_Last + 1) ..
Streams.Stream_Element_Offset (Old_Last + 1));
for Buffer'Address use File.Buffer (Old_Last + 1)'Address;
Last : Streams.Stream_Element_Offset;
begin
Read (File, Buffer, Last);
File.Last := Natural'Base (Last);
if Wait and then File.Last = Old_Last then
File.End_Of_File := True;
end if;
end;
end if;
end if;
if File.Last > 0 and then File.Ahead_Last = 0 then
if File.External = IO_Modes.Terminal then
File.Ahead_Last := File.Last;
elsif File.External = IO_Modes.Locale
and then File.Buffer (1) >= Character'Val (16#80#)
then
declare
Locale_Support : constant Boolean :=
System.Native_Text_IO.Default_External = IO_Modes.Locale;
begin
if not Locale_Support then
unreachable;
end if;
end;
declare
DBCS_Buffer : aliased System.Native_Text_IO.DBCS_Buffer_Type;
New_Last : Natural;
begin
DBCS_Buffer (1) := File.Buffer (1);
DBCS_Buffer (2) := File.Buffer (2);
System.Native_Text_IO.To_UTF_8 (
DBCS_Buffer,
File.Last,
File.Buffer,
New_Last);
if New_Last > 0 then
-- all elements in buffer are converted
File.Ahead_Last := New_Last;
File.Ahead_Col := File.Last;
File.Last := New_Last;
elsif File.End_Of_File then
-- expected trailing byte is missing
File.Ahead_Last := File.Last;
File.Ahead_Col := File.Last;
end if;
end;
else
File.Ahead_Last := 1;
File.Ahead_Col := 1;
end if;
end if;
end Read_Buffer;
procedure Take_Buffer (
File : Non_Controlled_File_Type;
Length : Positive := 1)
is
New_Last : constant Natural := File.Last - Length;
begin
File.Buffer (1 .. New_Last) := File.Buffer (1 + Length .. File.Last);
File.Last := New_Last;
File.Ahead_Last := File.Ahead_Last - Length;
File.Ahead_Col := 0;
File.Looked_Ahead_Last := 0;
File.Virtual_Mark := None;
end Take_Buffer;
procedure Take_Sequence (File : Non_Controlled_File_Type) is
begin
File.Col := File.Col + File.Ahead_Col;
Take_Buffer (File, Length => File.Looked_Ahead_Last);
if File.Looked_Ahead_Second (1) /= Character'Val (0) then
-- Prepend a second of surrogate pair to the buffer.
declare
New_Last : constant Natural := File.Last + 3;
begin
File.Buffer (4 .. New_Last) := File.Buffer (1 .. File.Last);
File.Buffer (1 .. 3) := File.Looked_Ahead_Second;
File.Last := New_Last;
File.Ahead_Last := File.Ahead_Last + 3;
end;
end if;
end Take_Sequence;
procedure Take_Page (File : Non_Controlled_File_Type) is
begin
Take_Buffer (File);
File.Virtual_Mark := EOP;
File.Line := 1;
File.Page := File.Page + 1;
File.Col := 1;
end Take_Page;
procedure Take_Line (File : Non_Controlled_File_Type) is
C : constant Character := File.Buffer (1);
begin
File.Line := File.Line + 1;
File.Col := 1;
Take_Buffer (File);
if C = Character'Val (16#0d#) then
Read_Buffer (File);
if File.Buffer (1) = Character'Val (16#0a#) then
Take_Buffer (File);
end if;
end if;
end Take_Line;
procedure Take_Line_Immediate (File : Non_Controlled_File_Type) is
C : constant Character := File.Buffer (1);
begin
Take_Buffer (File);
if C = Character'Val (16#0d#) then
Read_Buffer (File);
if File.Buffer (1) = Character'Val (16#0a#) then
File.Col := File.Col + 1; -- do not get LF here
else
File.Line := File.Line + 1; -- CR without LF
File.Col := 1;
end if;
else
File.Line := File.Line + 1; -- LF
File.Col := 1;
end if;
end Take_Line_Immediate;
type Restore_Type is record
Handle : System.Native_IO.Handle_Type;
Old_Settings : aliased System.Native_Text_IO.Setting;
end record;
pragma Suppress_Initialization (Restore_Type);
procedure Finally (X : in out Restore_Type);
procedure Finally (X : in out Restore_Type) is
begin
System.Native_Text_IO.Restore (X.Handle, X.Old_Settings);
end Finally;
procedure Look_Ahead_Immediate (
File : Non_Controlled_File_Type;
Item : out Character;
Available : out Boolean;
Wait : Boolean);
procedure Skip_Ahead_Immediate (File : Non_Controlled_File_Type);
procedure Look_Ahead_Immediate (
File : Non_Controlled_File_Type;
Item : out Character;
Available : out Boolean;
Wait : Boolean) is
begin
loop
Read_Buffer (File, Wait => Wait);
if File.Ahead_Last > 0 then
File.Looked_Ahead_Last := 1; -- implies CR-LF sequence
File.Looked_Ahead_Second (1) := Character'Val (0);
Item := File.Buffer (1);
Available := True;
exit;
elsif File.End_Of_File then
File.Looked_Ahead_Last := 1;
File.Looked_Ahead_Second (1) := Character'Val (0);
Raise_Exception (End_Error'Identity);
elsif not Wait then
Item := Character'Val (0);
Available := False;
exit;
end if;
end loop;
end Look_Ahead_Immediate;
procedure Skip_Ahead_Immediate (File : Non_Controlled_File_Type) is
begin
if File.External = IO_Modes.Terminal then
-- Do not wait CR-LF sequence, nor update Col and Line.
Take_Buffer (File, Length => File.Looked_Ahead_Last);
else
-- Update Col and Line.
declare
C : constant Character := File.Buffer (1);
begin
case C is
when Character'Val (16#0d#) | Character'Val (16#0a#) =>
Take_Line_Immediate (File);
when Character'Val (16#0c#) =>
Take_Page (File);
when others =>
Take_Sequence (File);
end case;
end;
end if;
end Skip_Ahead_Immediate;
procedure Get_Immediate (
File : Non_Controlled_File_Type;
Item : out Character;
Available : out Boolean;
Wait : Boolean);
procedure Get_Immediate (
File : Non_Controlled_File_Type;
Item : out Wide_Character;
Available : out Boolean;
Wait : Boolean);
procedure Get_Immediate (
File : Non_Controlled_File_Type;
Item : out Wide_Wide_Character;
Available : out Boolean;
Wait : Boolean);
procedure Get_Immediate (
File : Non_Controlled_File_Type;
Item : out Character;
Available : out Boolean;
Wait : Boolean)
is
package Holder is
new Exceptions.Finally.Scoped_Holder (Restore_Type, Finally);
X : aliased Restore_Type;
begin
if File.External = IO_Modes.Terminal then
X.Handle := Streams.Naked_Stream_IO.Handle (File.File);
System.Native_Text_IO.Set_Non_Canonical_Mode (
X.Handle,
Wait, -- only POSIX
X.Old_Settings);
Holder.Assign (X);
end if;
Look_Ahead_Immediate (File, Item, Available, Wait);
if Available then
Skip_Ahead_Immediate (File);
end if;
end Get_Immediate;
procedure Get_Immediate (
File : Non_Controlled_File_Type;
Item : out Wide_Character;
Available : out Boolean;
Wait : Boolean)
is
package Holder is
new Exceptions.Finally.Scoped_Holder (Restore_Type, Finally);
X : aliased Restore_Type;
C : Character;
begin
if File.External = IO_Modes.Terminal then
X.Handle := Streams.Naked_Stream_IO.Handle (File.File);
System.Native_Text_IO.Set_Non_Canonical_Mode (
X.Handle,
Wait, -- only POSIX
X.Old_Settings);
Holder.Assign (X);
end if;
Look_Ahead_Immediate (File, C, Available, Wait);
if Available then
declare
End_Of_Line : Boolean;
begin
if Character'Pos (C) < 16#80# then
-- Get_Immediate returns CR, LF, and FF.
Item := Wide_Character'Val (Character'Pos (C));
else
-- Waiting is OK for trailing bytes.
Look_Ahead (File, Item, End_Of_Line); -- Wide
end if;
end;
Skip_Ahead_Immediate (File);
else
Item := Wide_Character'Val (0);
end if;
end Get_Immediate;
procedure Get_Immediate (
File : Non_Controlled_File_Type;
Item : out Wide_Wide_Character;
Available : out Boolean;
Wait : Boolean)
is
package Holder is
new Exceptions.Finally.Scoped_Holder (Restore_Type, Finally);
X : aliased Restore_Type;
C : Character;
begin
if File.External = IO_Modes.Terminal then
X.Handle := Streams.Naked_Stream_IO.Handle (File.File);
System.Native_Text_IO.Set_Non_Canonical_Mode (
X.Handle,
Wait, -- only POSIX
X.Old_Settings);
Holder.Assign (X);
end if;
Look_Ahead_Immediate (File, C, Available, Wait);
if Available then
declare
End_Of_Line : Boolean;
begin
if Character'Pos (C) < 16#80# then
-- Get_Immediate returns CR, LF, and FF.
Item := Wide_Wide_Character'Val (Character'Pos (C));
else
-- Waiting is OK for trailing bytes.
Look_Ahead (File, Item, End_Of_Line); -- Wide_Wide
end if;
end;
Skip_Ahead_Immediate (File);
else
Item := Wide_Wide_Character'Val (0);
end if;
end Get_Immediate;
-- Output
-- * Write_Buffer sets Ahead_Col to written width.
-- * Put adds Ahead_Col to current Col.
procedure Write (
File : not null Non_Controlled_File_Type;
Item : Streams.Stream_Element_Array);
procedure Write (
File : not null Non_Controlled_File_Type;
Item : Streams.Stream_Element_Array) is
begin
if not Streams.Naked_Stream_IO.Is_Open (File.File) then
-- external stream mode
Streams.Write (To_Pointer (File.Stream).all, Item);
else
Streams.Naked_Stream_IO.Write (File.File, Item);
end if;
end Write;
procedure Raw_New_Page (File : Non_Controlled_File_Type);
procedure Raw_New_Line (File : Non_Controlled_File_Type);
procedure Raw_New_Line (
File : Non_Controlled_File_Type;
Spacing : Positive);
procedure Write_Buffer (
File : Non_Controlled_File_Type;
Sequence_Length : Natural);
procedure Raw_New_Page (File : Non_Controlled_File_Type) is
begin
if File.External = IO_Modes.Terminal then
System.Native_Text_IO.Terminal_Clear (
Streams.Naked_Stream_IO.Handle (File.File));
else
declare
Code : constant Streams.Stream_Element_Array := (1 => 16#0c#);
begin
Write (File, Code);
end;
end if;
File.Line := 1;
File.Page := File.Page + 1;
File.Col := 1;
end Raw_New_Page;
procedure Raw_New_Line (File : Non_Controlled_File_Type) is
begin
if File.Page_Length /= 0 and then File.Line >= File.Page_Length then
Raw_New_Page (File);
else
declare
Line_Mark : constant Streams.Stream_Element_Array (0 .. 1) :=
(16#0d#, 16#0a#);
First, Last : Streams.Stream_Element_Offset;
begin
First := Boolean'Pos (File.New_Line = IO_Modes.LF);
Last := Boolean'Pos (File.New_Line /= IO_Modes.CR);
Write (File, Line_Mark (First .. Last));
end;
File.Line := File.Line + 1;
File.Col := 1;
end if;
end Raw_New_Line;
procedure Raw_New_Line (
File : Non_Controlled_File_Type;
Spacing : Positive) is
begin
for I in 1 .. Spacing loop
Raw_New_Line (File);
end loop;
end Raw_New_Line;
procedure Write_Buffer (
File : Non_Controlled_File_Type;
Sequence_Length : Natural)
is
Length : constant Natural := File.Last; -- >= Sequence_Length
begin
if File.External = IO_Modes.Terminal then
declare
Written_Length : Streams.Stream_Element_Offset;
begin
System.Native_Text_IO.Terminal_Put (
Streams.Naked_Stream_IO.Handle (File.File),
File.Buffer'Address,
Streams.Stream_Element_Offset (Sequence_Length),
Written_Length);
if Written_Length < 0 then
Raise_Exception (Device_Error'Identity);
end if;
end;
File.Ahead_Col := Sequence_Length; -- for fallback
elsif File.External = IO_Modes.Locale
and then File.Buffer (1) >= Character'Val (16#80#)
then
declare
Locale_Support : constant Boolean :=
System.Native_Text_IO.Default_External = IO_Modes.Locale;
begin
if not Locale_Support then
unreachable;
end if;
end;
declare
DBCS_Buffer : aliased System.Native_Text_IO.DBCS_Buffer_Type;
DBCS_Last : Natural;
begin
System.Native_Text_IO.To_DBCS (
File.Buffer,
Sequence_Length,
DBCS_Buffer,
DBCS_Last);
if DBCS_Last = 0 then
DBCS_Buffer (1) := '?';
DBCS_Last := 1;
end if;
if File.Line_Length /= 0
and then File.Col + Natural (DBCS_Last - 1) > File.Line_Length
then
Raw_New_Line (File);
end if;
declare
DBCS_Buffer_As_SEA : Streams.Stream_Element_Array (
1 ..
Streams.Stream_Element_Offset (DBCS_Last));
for DBCS_Buffer_As_SEA'Address use DBCS_Buffer'Address;
begin
Write (File, DBCS_Buffer_As_SEA);
end;
File.Ahead_Col := DBCS_Last;
end;
else
if File.Line_Length /= 0
and then File.Col + Sequence_Length - 1 > File.Line_Length
then
Raw_New_Line (File);
end if;
declare
Buffer : Streams.Stream_Element_Array (
1 ..
Streams.Stream_Element_Offset (Sequence_Length));
for Buffer'Address use File.Buffer'Address;
begin
Write (File, Buffer);
end;
File.Ahead_Col := Sequence_Length;
end if;
File.Last := Length - Sequence_Length;
File.Buffer (1 .. File.Last) :=
File.Buffer (Sequence_Length + 1 .. Length);
end Write_Buffer;
-- implementation of non-controlled
procedure Create (
File : in out Non_Controlled_File_Type;
Mode : IO_Modes.File_Mode := IO_Modes.Out_File;
Name : String := "";
Form : System.Native_Text_IO.Packed_Form := Default_Form)
is
pragma Check (Pre,
Check => not Is_Open (File) or else raise Status_Error);
begin
Open_File (
Open_Proc => Streams.Naked_Stream_IO.Create'Access,
File => File,
Mode => Mode,
Name => Name,
Form => Form);
end Create;
procedure Open (
File : in out Non_Controlled_File_Type;
Mode : IO_Modes.File_Mode;
Name : String;
Form : System.Native_Text_IO.Packed_Form := Default_Form)
is
pragma Check (Pre,
Check => not Is_Open (File) or else raise Status_Error);
begin
Open_File (
Open_Proc => Streams.Naked_Stream_IO.Open'Access,
File => File,
Mode => Mode,
Name => Name,
Form => Form);
end Open;
procedure Close (
File : aliased in out Non_Controlled_File_Type;
Raise_On_Error : Boolean := True)
is
pragma Check (Pre,
Check => Is_Open (File) or else raise Status_Error);
Internal : aliased Streams.Naked_Stream_IO.Non_Controlled_File_Type :=
File.File;
begin
if not Streams.Naked_Stream_IO.Is_Open (Internal)
or else not Streams.Naked_Stream_IO.Is_Standard (Internal)
then
Free (File);
end if;
if Streams.Naked_Stream_IO.Is_Open (Internal) then
Streams.Naked_Stream_IO.Close (
Internal,
Raise_On_Error => Raise_On_Error);
end if;
end Close;
procedure Delete (File : aliased in out Non_Controlled_File_Type) is
pragma Check (Pre,
Check =>
(Is_Open (File)
and then Streams.Naked_Stream_IO.Is_Open (File.File)
and then not Streams.Naked_Stream_IO.Is_Standard (File.File))
or else raise Status_Error);
Internal : aliased Streams.Naked_Stream_IO.Non_Controlled_File_Type :=
File.File;
begin
Free (File);
Streams.Naked_Stream_IO.Delete (Internal);
end Delete;
procedure Reset (
File : aliased in out Non_Controlled_File_Type;
Mode : IO_Modes.File_Mode)
is
pragma Check (Pre,
Check => Is_Open (File) or else raise Status_Error);
pragma Check (Pre,
Check =>
not Streams.Naked_Stream_IO.Is_Standard (File.File)
or else Naked_Text_IO.Mode (File) = Mode
or else raise Mode_Error);
pragma Check (Pre,
Check =>
Streams.Naked_Stream_IO.Is_Open (File.File)
or else raise Status_Error); -- external stream mode
Current_Mode : constant IO_Modes.File_Mode := Naked_Text_IO.Mode (File);
begin
if Current_Mode /= IO_Modes.In_File then
Flush (File);
end if;
declare
package Holder is
new Exceptions.Finally.Scoped_Holder (
Non_Controlled_File_Type,
Free);
begin
Holder.Assign (File);
Streams.Naked_Stream_IO.Reset (File.File, Mode);
Holder.Clear;
end;
File.Stream := System.Null_Address;
File.Line := 1;
File.Page := 1;
File.Col := 1;
File.Line_Length := 0;
File.Page_Length := 0;
File.Last := 0;
File.Ahead_Last := 0;
File.Ahead_Col := 0;
File.Looked_Ahead_Last := 0;
File.End_Of_File := False;
File.Virtual_Mark := None;
File.Mode := Mode;
end Reset;
function Mode (File : Non_Controlled_File_Type) return IO_Modes.File_Mode is
begin
if Streams.Naked_Stream_IO.Is_Open (File.File) then
return Streams.Naked_Stream_IO.Mode (File.File);
else
return File.Mode;
end if;
end Mode;
function Name (File : Non_Controlled_File_Type) return String is
begin
if Streams.Naked_Stream_IO.Is_Open (File.File) then
return Streams.Naked_Stream_IO.Name (File.File);
else
return System.Native_IO.Value (File.Name);
end if;
end Name;
function Form (File : Non_Controlled_File_Type)
return System.Native_Text_IO.Packed_Form
is
Stream_Form : System.Native_IO.Packed_Form;
External : IO_Modes.File_External_Spec;
begin
if Streams.Naked_Stream_IO.Is_Open (File.File) then
Stream_Form := Streams.Naked_Stream_IO.Form (File.File);
else
Stream_Form := Streams.Naked_Stream_IO.Default_Form;
end if;
if File.External = IO_Modes.Terminal then
External := IO_Modes.File_External_Spec (
System.Native_Text_IO.Default_External);
else
External := IO_Modes.File_External_Spec (File.External);
end if;
return (
Stream_Form,
External,
IO_Modes.File_New_Line_Spec (File.New_Line));
end Form;
function External (File : Non_Controlled_File_Type)
return IO_Modes.File_External is
begin
return File.External;
end External;
function Is_Open (File : Non_Controlled_File_Type) return Boolean is
begin
return File /= null;
end Is_Open;
procedure Flush (File : Non_Controlled_File_Type) is
begin
if File.Last > 0 then
Write_Buffer (File, File.Last);
File.Col := File.Col + File.Ahead_Col;
end if;
if Streams.Naked_Stream_IO.Is_Open (File.File) then
Streams.Naked_Stream_IO.Flush_Writing_Buffer (File.File);
end if;
end Flush;
procedure Set_Size (
File : Non_Controlled_File_Type;
Line_Length, Page_Length : Natural) is
begin
if File.External = IO_Modes.Terminal then
if Line_Length = 0 or else Page_Length = 0 then
Raise_Exception (Device_Error'Identity);
end if;
System.Native_Text_IO.Set_Terminal_Size (
Streams.Naked_Stream_IO.Handle (File.File),
Line_Length,
Page_Length);
else
File.Line_Length := Line_Length;
File.Page_Length := Page_Length;
end if;
end Set_Size;
procedure Set_Line_Length (File : Non_Controlled_File_Type; To : Natural) is
Current_Line_Length, Current_Page_Length : Natural;
begin
Size (File, Current_Line_Length, Current_Page_Length);
if File.External /= IO_Modes.Terminal or else To > 0 then
Set_Size (File, To, Current_Page_Length);
end if;
end Set_Line_Length;
procedure Set_Page_Length (File : Non_Controlled_File_Type; To : Natural) is
Current_Line_Length, Current_Page_Length : Natural;
begin
Size (File, Current_Line_Length, Current_Page_Length);
if File.External /= IO_Modes.Terminal or else To > 0 then
Set_Size (File, Current_Line_Length, To);
end if;
end Set_Page_Length;
procedure Size (
File : Non_Controlled_File_Type;
Line_Length, Page_Length : out Natural) is
begin
if File.External = IO_Modes.Terminal then
System.Native_Text_IO.Terminal_Size (
Streams.Naked_Stream_IO.Handle (File.File),
Line_Length,
Page_Length);
else
Line_Length := File.Line_Length;
Page_Length := File.Page_Length;
end if;
end Size;
function Line_Length (File : Non_Controlled_File_Type) return Natural is
Line_Length, Page_Length : Natural;
begin
Size (File, Line_Length, Page_Length);
return Line_Length;
end Line_Length;
function Page_Length (File : Non_Controlled_File_Type) return Natural is
Line_Length, Page_Length : Natural;
begin
Size (File, Line_Length, Page_Length);
return Page_Length;
end Page_Length;
procedure New_Line (
File : Non_Controlled_File_Type;
Spacing : Positive := 1) is
begin
if File.Last > 0 then
Write_Buffer (File, File.Last);
end if;
Raw_New_Line (File, Spacing);
end New_Line;
procedure Skip_Line (
File : Non_Controlled_File_Type;
Spacing : Positive := 1) is
begin
for I in 1 .. Spacing loop
loop
declare
C : Character;
End_Of_Line : Boolean;
begin
Look_Ahead (File, C, End_Of_Line);
Skip_Ahead (File);
exit when End_Of_Line;
end;
end loop;
end loop;
end Skip_Line;
function End_Of_Line (File : Non_Controlled_File_Type) return Boolean is
C : Character;
Result : Boolean;
begin
Look_Ahead (File, C, Result);
return Result;
end End_Of_Line;
procedure New_Page (File : Non_Controlled_File_Type) is
begin
if File.Last > 0 then
Write_Buffer (File, File.Last);
end if;
Raw_New_Page (File);
end New_Page;
procedure Skip_Page (File : Non_Controlled_File_Type) is
begin
while not End_Of_Page (File) loop
Skip_Line (File);
end loop;
case File.Virtual_Mark is
when EOF =>
Raise_Exception (End_Error'Identity);
when EOP =>
File.Virtual_Mark := None;
when EOP_EOF =>
File.Virtual_Mark := EOF;
when others =>
if End_Of_File (File) then
File.Virtual_Mark := EOF;
else
Take_Buffer (File);
end if;
File.Line := 1;
File.Page := File.Page + 1;
File.Col := 1;
end case;
end Skip_Page;
function End_Of_Page (File : Non_Controlled_File_Type) return Boolean is
begin
case File.Virtual_Mark is
when EOP | EOP_EOF =>
return True;
when others =>
return End_Of_File (File) -- End_Of_File calls Read_Buffer
or else (
File.Last > 0
and then File.Buffer (1) = Character'Val (16#0c#));
-- page mark is ASCII
end case;
end End_Of_Page;
function End_Of_File (File : Non_Controlled_File_Type) return Boolean is
begin
loop
Read_Buffer (File);
if File.Last > 0 then
return False;
elsif File.End_Of_File then
return True;
end if;
end loop;
end End_Of_File;
procedure Set_Col (File : Non_Controlled_File_Type; To : Positive) is
begin
if File.External = IO_Modes.Terminal
and then System.Native_Text_IO.Use_Terminal_Position (
Streams.Naked_Stream_IO.Handle (File.File))
then
System.Native_Text_IO.Set_Terminal_Col (
Streams.Naked_Stream_IO.Handle (File.File),
To);
else
if Mode (File) = IO_Modes.In_File then
-- In_File
loop
declare
C : Character;
End_Of_Line : Boolean;
begin
Look_Ahead (File, C, End_Of_Line);
exit when not End_Of_Line and then File.Col = To;
Skip_Ahead (File); -- raise End_Error when End_Of_File
end;
end loop;
else
-- Out_File (or Append_File)
if File.Line_Length /= 0 and then To > File.Line_Length then
Raise_Exception (Layout_Error'Identity);
end if;
if File.Col > To then
Raw_New_Line (File);
end if;
while File.Col < To loop
Put (File, Character'Val (16#20#));
end loop;
end if;
end if;
end Set_Col;
procedure Set_Line (File : Non_Controlled_File_Type; To : Positive) is
begin
if File.External = IO_Modes.Terminal
and then System.Native_Text_IO.Use_Terminal_Position (
Streams.Naked_Stream_IO.Handle (File.File))
then
System.Native_Text_IO.Set_Terminal_Position (
Streams.Naked_Stream_IO.Handle (File.File),
Col => 1,
Line => To);
else
if Mode (File) = IO_Modes.In_File then
-- In_File
while To /= File.Line or else End_Of_Page (File) loop
Skip_Line (File);
end loop;
else
-- Out_File (or Append_File)
if File.Page_Length /= 0 and then To > File.Page_Length then
Raise_Exception (Layout_Error'Identity);
end if;
if File.Line > To then
Raw_New_Page (File);
end if;
if File.Line < To then
Raw_New_Line (File, To - File.Line);
end if;
end if;
end if;
end Set_Line;
procedure Position (
File : Non_Controlled_File_Type;
Col, Line : out Positive) is
begin
if File.External = IO_Modes.Terminal
and then System.Native_Text_IO.Use_Terminal_Position (
Streams.Naked_Stream_IO.Handle (File.File))
then
System.Native_Text_IO.Terminal_Position (
Streams.Naked_Stream_IO.Handle (File.File),
Col,
Line);
else
Col := File.Col;
Line := File.Line;
end if;
end Position;
function Col (File : Non_Controlled_File_Type) return Positive is
Col, Line : Positive;
begin
Position (File, Col, Line);
return Col;
end Col;
function Line (File : Non_Controlled_File_Type) return Positive is
Col, Line : Positive;
begin
Position (File, Col, Line);
return Line;
end Line;
function Page (File : Non_Controlled_File_Type) return Positive is
begin
return File.Page;
end Page;
procedure Get (
File : Non_Controlled_File_Type;
Item : out Character) is
begin
loop
declare
End_Of_Line : Boolean;
begin
Look_Ahead (File, Item, End_Of_Line);
Skip_Ahead (File);
exit when not End_Of_Line;
end;
end loop;
end Get;
procedure Get (
File : Non_Controlled_File_Type;
Item : out Wide_Character) is
begin
loop
declare
End_Of_Line : Boolean;
begin
Look_Ahead (File, Item, End_Of_Line);
Skip_Ahead (File);
exit when not End_Of_Line;
end;
end loop;
end Get;
procedure Get (
File : Non_Controlled_File_Type;
Item : out Wide_Wide_Character) is
begin
loop
declare
End_Of_Line : Boolean;
begin
Look_Ahead (File, Item, End_Of_Line);
Skip_Ahead (File);
exit when not End_Of_Line;
end;
end loop;
end Get;
procedure Put (
File : Non_Controlled_File_Type;
Item : Character)
is
Sequence_Length : Natural;
Sequence_Status : System.UTF_Conversions.Sequence_Status_Type; -- ignore
begin
-- if Item is not trailing byte, flush the buffer
if (File.Line_Length /= 0 or else File.External /= IO_Modes.UTF_8)
and then File.Last > 0
and then Character'Pos (Item) not in 2#10000000# .. 2#10111111#
then
Write_Buffer (File, File.Last);
File.Col := File.Col + File.Ahead_Col;
end if;
-- write to the buffer
File.Last := File.Last + 1;
File.Buffer (File.Last) := Item;
if File.Line_Length /= 0 or else File.External /= IO_Modes.UTF_8 then
System.UTF_Conversions.UTF_8_Sequence (
File.Buffer (1),
Sequence_Length,
Sequence_Status);
if File.Last >= Sequence_Length then
Write_Buffer (File, Sequence_Length);
File.Col := File.Col + File.Ahead_Col;
end if;
else
Write_Buffer (File, File.Last);
File.Col := File.Col + File.Ahead_Col;
end if;
end Put;
procedure Put (
File : Non_Controlled_File_Type;
Item : Wide_Character)
is
From_Status : System.UTF_Conversions.From_Status_Type; -- ignore
begin
if File.Last > 0 then
if Item in
Wide_Character'Val (16#dc00#) .. Wide_Character'Val (16#dfff#)
then
declare
First : System.UTF_Conversions.UCS_4;
Code : System.UTF_Conversions.UCS_4;
Last : Natural;
Length : Natural;
Wide_Buffer : Wide_String (1 .. 2);
Wide_Last : Natural;
begin
-- restore first of surrogate pair
System.UTF_Conversions.From_UTF_8 (
File.Buffer (1 .. File.Last),
Last,
First,
From_Status);
System.UTF_Conversions.UTF_16_Sequence (
Wide_Character'Val (First),
Length,
From_Status);
if Length /= 2
or else First >= 16#ffff#
or else Last /= File.Last
then
-- previous data is wrong
Raise_Exception (Data_Error'Identity);
end if;
Wide_Buffer (1) := Wide_Character'Val (First);
Wide_Buffer (2) := Item;
System.UTF_Conversions.From_UTF_16 (
Wide_Buffer,
Wide_Last,
Code,
From_Status);
File.Last := 0;
Put (File, Wide_Wide_Character'Val (Code));
return;
end;
else
Write_Buffer (File, File.Last);
File.Col := File.Col + File.Ahead_Col;
end if;
end if;
declare
Length : Natural;
To_Status : System.UTF_Conversions.To_Status_Type; -- ignore
begin
System.UTF_Conversions.UTF_16_Sequence (Item, Length, From_Status);
if Length = 2 then
-- store first of surrogate pair
System.UTF_Conversions.To_UTF_8 (
Wide_Character'Pos (Item),
File.Buffer,
File.Last,
To_Status);
else
-- single character
Put (File, Wide_Wide_Character'Val (Wide_Character'Pos (Item)));
end if;
end;
end Put;
procedure Put (
File : Non_Controlled_File_Type;
Item : Wide_Wide_Character) is
begin
if File.Last > 0 then
-- previous data is rested
Write_Buffer (File, File.Last);
File.Col := File.Col + File.Ahead_Col;
end if;
declare
Buffer : String (1 .. System.UTF_Conversions.UTF_8_Max_Length);
Last : Natural;
To_Status : System.UTF_Conversions.To_Status_Type; -- ignore
begin
System.UTF_Conversions.To_UTF_8 (
Wide_Wide_Character'Pos (Item),
Buffer,
Last,
To_Status);
for I in 1 .. Last loop
Put (File, Buffer (I));
end loop;
end;
end Put;
procedure Look_Ahead (
File : Non_Controlled_File_Type;
Item : out Character;
End_Of_Line : out Boolean) is
begin
loop
Read_Buffer (File);
if File.Ahead_Last > 0 then
declare
C : constant Character := File.Buffer (1);
begin
case C is
when Character'Val (16#0d#) | Character'Val (16#0a#)
| Character'Val (16#0c#) =>
File.Looked_Ahead_Last := 1; -- implies CR-LF sequence
File.Looked_Ahead_Second (1) := Character'Val (0);
End_Of_Line := True;
Item := Character'Val (0);
exit;
when others =>
File.Looked_Ahead_Last := 1;
File.Looked_Ahead_Second (1) := Character'Val (0);
End_Of_Line := False;
Item := C;
exit;
end case;
end;
elsif File.End_Of_File then
File.Looked_Ahead_Last := 1; -- Look_Ahead is called
File.Looked_Ahead_Second (1) := Character'Val (0);
End_Of_Line := True;
Item := Character'Val (0);
exit;
end if;
end loop;
end Look_Ahead;
procedure Look_Ahead (
File : Non_Controlled_File_Type;
Item : out Wide_Character;
End_Of_Line : out Boolean)
is
C : Wide_Wide_Character;
begin
Look_Ahead (File, C, End_Of_Line); -- Wide_Wide
if End_Of_Line then
Item := Wide_Character'Val (0);
else
declare
Wide_Buffer : Wide_String (1 .. 2);
Wide_Last : Natural;
To_Status : System.UTF_Conversions.To_Status_Type; -- ignore
begin
System.UTF_Conversions.To_UTF_16 (
Wide_Wide_Character'Pos (C),
Wide_Buffer,
Wide_Last,
To_Status);
if Wide_Last > 1 then
declare
Last : Natural;
begin
System.UTF_Conversions.To_UTF_8 (
Wide_Character'Pos (Wide_Buffer (2)),
File.Looked_Ahead_Second,
Last,
To_Status);
end;
end if;
Item := Wide_Buffer (1);
end;
end if;
end Look_Ahead;
procedure Look_Ahead (
File : Non_Controlled_File_Type;
Item : out Wide_Wide_Character;
End_Of_Line : out Boolean)
is
C : Character;
begin
Look_Ahead (File, C, End_Of_Line);
-- File.Buffer is already converted even through File.External = Locale
if End_Of_Line then
Item := Wide_Wide_Character'Val (0);
else
if File.External = IO_Modes.Locale then
declare
Locale_Support : constant Boolean :=
System.Native_Text_IO.Default_External = IO_Modes.Locale;
begin
if not Locale_Support then
unreachable;
end if;
end;
File.Looked_Ahead_Last := File.Ahead_Last; -- shortcut
else
declare
Sequence_Length : Natural;
Buffer_Last : Natural;
From_Status : System.UTF_Conversions.From_Status_Type; -- ignore
begin
System.UTF_Conversions.UTF_8_Sequence (
C,
Sequence_Length,
From_Status);
Buffer_Last := 1;
while Buffer_Last < Sequence_Length loop
if File.Last < Sequence_Length then
Read_Buffer (File, Wanted => Sequence_Length);
end if;
if File.Last > Buffer_Last then
if File.Buffer (Buffer_Last + 1) in
Character'Val (2#10000000#) ..
Character'Val (2#10111111#)
then
Buffer_Last := Buffer_Last + 1;
else
exit;
end if;
elsif File.End_Of_File then
exit;
end if;
end loop;
File.Ahead_Last := Buffer_Last;
if File.Ahead_Col > 0 -- skip second element of UTF-16
and then File.External = IO_Modes.UTF_8
then
File.Ahead_Col := Buffer_Last;
end if;
File.Looked_Ahead_Last := Buffer_Last;
end;
end if;
declare
Conv_Last : Natural;
Code : System.UTF_Conversions.UCS_4;
From_Status : System.UTF_Conversions.From_Status_Type; -- ignore
begin
System.UTF_Conversions.From_UTF_8 (
File.Buffer (1 .. File.Looked_Ahead_Last),
Conv_Last,
Code,
From_Status);
Item := Wide_Wide_Character'Val (Code);
end;
end if;
end Look_Ahead;
procedure Skip_Ahead (File : Non_Controlled_File_Type) is
pragma Check (Pre,
Check =>
File.Looked_Ahead_Last /= 0
or else raise Status_Error); -- Look_Ahead should be called before
begin
if File.Ahead_Last = 0 then -- File.End_Of_File = True
-- Skip_Ahead can be used instead of Skip_Line
if File.Virtual_Mark <= EOP then
File.Virtual_Mark := EOP_EOF;
File.Line := 1;
File.Page := File.Page + 1;
File.Col := 1;
else
Raise_Exception (End_Error'Identity);
end if;
else
declare
C : constant Character := File.Buffer (1);
begin
case C is
when Character'Val (16#0d#) | Character'Val (16#0a#) =>
Take_Line (File);
when Character'Val (16#0c#) =>
Take_Page (File);
when others =>
Take_Sequence (File);
end case;
end;
end if;
end Skip_Ahead;
procedure Get_Immediate (
File : Non_Controlled_File_Type;
Item : out Character)
is
Available : Boolean;
begin
Get_Immediate (File, Item, Available, Wait => True);
end Get_Immediate;
procedure Get_Immediate (
File : Non_Controlled_File_Type;
Item : out Wide_Character)
is
Available : Boolean;
begin
Get_Immediate (File, Item, Available, Wait => True);
end Get_Immediate;
procedure Get_Immediate (
File : Non_Controlled_File_Type;
Item : out Wide_Wide_Character)
is
Available : Boolean;
begin
Get_Immediate (File, Item, Available, Wait => True);
end Get_Immediate;
procedure Get_Immediate (
File : Non_Controlled_File_Type;
Item : out Character;
Available : out Boolean) is
begin
Get_Immediate (File, Item, Available, Wait => False);
end Get_Immediate;
procedure Get_Immediate (
File : Non_Controlled_File_Type;
Item : out Wide_Character;
Available : out Boolean) is
begin
Get_Immediate (File, Item, Available, Wait => False);
end Get_Immediate;
procedure Get_Immediate (
File : Non_Controlled_File_Type;
Item : out Wide_Wide_Character;
Available : out Boolean) is
begin
Get_Immediate (File, Item, Available, Wait => False);
end Get_Immediate;
-- implementation of handle of stream for non-controlled
procedure Open (
File : in out Non_Controlled_File_Type;
Mode : IO_Modes.File_Mode;
Stream : not null access Streams.Root_Stream_Type'Class;
Name : String := "";
Form : System.Native_Text_IO.Packed_Form := Default_Form)
is
pragma Check (Pre,
Check => not Is_Open (File) or else raise Status_Error);
function To_Address (Value : access Streams.Root_Stream_Type'Class)
return System.Address
with Import, Convention => Intrinsic;
package Name_Holder is
new Exceptions.Finally.Scoped_Holder (
System.Native_IO.Name_Pointer,
System.Native_IO.Free);
Full_Name : aliased System.Native_IO.Name_Pointer;
begin
Name_Holder.Assign (Full_Name);
System.Native_IO.New_External_Name (Name, Full_Name); -- '*' & Name & NUL
File := new Text_Type'(
Stream => To_Address (Stream),
Name => Full_Name,
Mode => Mode,
External => Select_External (Form.External),
New_Line => Select_New_Line (Form.New_Line),
others => <>);
-- complete
Name_Holder.Clear;
end Open;
function Stream (File : not null Non_Controlled_File_Type)
return not null access Streams.Root_Stream_Type'Class
is
function To_Address (Value : access Streams.Root_Stream_Type'Class)
return System.Address
with Import, Convention => Intrinsic;
begin
if To_Pointer (File.Stream) = null then
File.Stream :=
To_Address (Streams.Naked_Stream_IO.Stream (File.File));
end if;
return To_Pointer (File.Stream);
end Stream;
function Stream_IO (File : Non_Controlled_File_Type)
return not null
access Streams.Naked_Stream_IO.Non_Controlled_File_Type
is
pragma Check (Pre,
Check =>
Streams.Naked_Stream_IO.Is_Open (File.File)
or else raise Status_Error); -- external stream mode
begin
return File.File'Access;
end Stream_IO;
function Terminal_Handle (File : Non_Controlled_File_Type)
return System.Native_IO.Handle_Type
is
pragma Check (Pre,
Check =>
Streams.Naked_Stream_IO.Is_Open (File.File)
or else raise Status_Error); -- external stream mode
begin
if File.External /= IO_Modes.Terminal then
Raise_Exception (Device_Error'Identity);
end if;
return Streams.Naked_Stream_IO.Handle (File.File);
end Terminal_Handle;
-- initialization
procedure Init_Standard_File (File : not null Non_Controlled_File_Type);
procedure Init_Standard_File (File : not null Non_Controlled_File_Type) is
begin
if System.Native_IO.Is_Terminal (
Streams.Naked_Stream_IO.Handle (File.File))
then
File.External := IO_Modes.Terminal;
end if;
end Init_Standard_File;
begin
Init_Standard_File (Standard_Input_Text'Access);
Init_Standard_File (Standard_Output_Text'Access);
Init_Standard_File (Standard_Error_Text'Access);
end Ada.Naked_Text_IO;
|
persan/spawn-manager | Ada | 1,506 | adb | package body Spawn_Manager is
---------------------
-- Is_Exit_Message --
---------------------
function Is_Exit_Message (Request : Spawn_Request) return Boolean is
begin
return Request.Spawn_Type = Terminate_Server;
end Is_Exit_Message;
function WIFEXITED (Stat_Val : Status_Kind) return Boolean is
begin
return (Stat_Val and 16#FF_FF_FF_00#) = 0;
end WIFEXITED;
function WEXITSTATUS (Stat_Val : Status_Kind) return Integer is
begin
return Integer (Shift_Right (Stat_Val and 16#0000_FF_00#, 8));
end WEXITSTATUS;
-- function WIFSIGNALED (Stat_Val : Status_Kind) return Boolean is
-- pragma Unreferenced (Stat_Val);
-- begin
-- return False ; -- (((Stat_Val and 16#7F#) +1);
-- end WIFSIGNALED;
-- function WTERMSIG (Stat_Val : Status_Kind) return Boolean is
-- pragma Unreferenced (Stat_Val);
-- begin
-- return False;
-- end WTERMSIG;
-- function WIFSTOPPED (Stat_Val : Status_Kind) return Boolean is
-- begin
-- return (Stat_Val and 16#FF#) = 16#7F#;
-- end WIFSTOPPED;
-- pragma Unreferenced (WIFSTOPPED);
-- function WSTOPSIG (Stat_Val : Status_Kind) return Integer is
-- pragma Unreferenced (Stat_Val);
-- begin
-- return 0;
-- end WSTOPSIG;
-- pragma Unreferenced (WSTOPSIG);
function WIFCONTINUED (Stat_Val : Status_Kind) return Boolean is
begin
return Stat_Val = 16#FF_FF#;
end WIFCONTINUED;
end Spawn_Manager;
|
Heziode/lsystem-editor | Ada | 1,961 | ads | -------------------------------------------------------------------------------
-- LSE -- L-System Editor
-- Author: Heziode
--
-- License:
-- MIT License
--
-- Copyright (c) 2018 Quentin Dauprat (Heziode) <[email protected]>
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the "Software"),
-- to deal in the Software without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------------
-- @description
-- This package define a missing save character error.
--
package LSE.Model.L_System.Error.Missing_Save is
type Instance is new LSE.Model.L_System.Error.Instance with private;
-- Rule is not valid
Error : exception;
function Initialize (Line, Column : Positive) return Instance;
overriding
function Get_Error (This : Instance) return String;
private
type Instance is new LSE.Model.L_System.Error.Instance with record
Line, Column : Positive;
end record;
end LSE.Model.L_System.Error.Missing_Save;
|
esbullington/aflex | Ada | 18,507 | adb | -- 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 scanner generation
-- AUTHOR: John Self (UCI)
-- DESCRIPTION
-- NOTES does actual generation (writing) of output aflex scanners
-- $Header: /dc/uc/self/tmp/gnat_aflex/RCS/gen.adb,v 1.1 1995/07/04 20:21:29 self Exp self $
with MISC_DEFS, TEXT_IO, MISC, INT_IO, TSTRING, PARSE_TOKENS;
with SCANNER, SKELETON_MANAGER; use MISC_DEFS, TEXT_IO,
TSTRING, PARSE_TOKENS;
package body GEN is
INDENT_LEVEL : INTEGER := 0; -- each level is 4 spaces
INDENT_BASE : constant NATURAL := 3;
MAX_SHORT : constant INTEGER := 32767;
procedure INDENT_UP is
begin
INDENT_LEVEL := INDENT_LEVEL + 1;
end INDENT_UP;
procedure INDENT_DOWN is
begin
INDENT_LEVEL := INDENT_LEVEL - 1;
end INDENT_DOWN;
procedure SET_INDENT(INDENT_VAL : in INTEGER) is
begin
INDENT_LEVEL := INDENT_VAL;
end SET_INDENT;
-- indent to the current level
procedure DO_INDENT is
I : INTEGER := INDENT_LEVEL * INDENT_BASE;
begin
while I > 0 loop
TEXT_IO.PUT(' ');
I := I - 1;
end loop;
end DO_INDENT;
-- generate the code to keep backtracking information
procedure GEN_BACKTRACKING is
begin
if NUM_BACKTRACKING = 0 then
return;
end if;
INDENT_PUTS("if yy_accept (yy_current_state) /= 0 then");
INDENT_UP;
INDENT_PUTS("yy_last_accepting_state := yy_current_state;");
INDENT_PUTS("yy_last_accepting_cpos := yy_cp;");
INDENT_DOWN;
INDENT_PUTS("end if;");
end GEN_BACKTRACKING;
-- generate the code to perform the backtrack
procedure GEN_BT_ACTION is
begin
if NUM_BACKTRACKING = 0 then
return;
end if;
SET_INDENT(4);
INDENT_PUTS("when 0 => -- must backtrack");
INDENT_PUTS("-- undo the effects of YY_DO_BEFORE_ACTION");
INDENT_PUTS("yy_ch_buf (yy_cp) := yy_hold_char;");
if FULLTBL then
INDENT_PUTS("yy_cp := yy_last_accepting_cpos + 1;");
else
-- backtracking info for compressed tables is taken \after/
-- yy_cp has been incremented for the next state
INDENT_PUTS("yy_cp := yy_last_accepting_cpos;");
end if;
INDENT_PUTS("yy_current_state := yy_last_accepting_state;");
INDENT_PUTS("goto next_action;");
TEXT_IO.NEW_LINE;
SET_INDENT(0);
end GEN_BT_ACTION;
-- generate equivalence-class table
procedure GENECS is
I, NUMROWS : INTEGER;
begin
TEXT_IO.PUT(" yy_ec : constant array (ASCII.NUL .. ");
TEXT_IO.PUT_LINE("Character'Last) of Short := (0,"); -- GdM for >7 bit ch.
-- TEXT_IO.PUT_LINE(" (0, ");
for CHAR_COUNT in 1 .. CSIZE loop
if (CASEINS and ((CHAR_COUNT >= CHARACTER'POS('A')) and (CHAR_COUNT <=
CHARACTER'POS('Z')))) then
ECGROUP(CHAR_COUNT) := ECGROUP(MISC.CLOWER(CHAR_COUNT));
end if;
ECGROUP(CHAR_COUNT) := abs(ECGROUP(CHAR_COUNT));
MISC.MKDATA(ECGROUP(CHAR_COUNT));
end loop;
-- GdM for >7 bit ch.
TEXT_IO.PUT_LINE(", others => 1");
MISC.DATAEND;
if (TRACE) then
TEXT_IO.NEW_LINE(STANDARD_ERROR);
TEXT_IO.NEW_LINE(STANDARD_ERROR);
TEXT_IO.PUT(STANDARD_ERROR, "Equivalence Classes:");
TEXT_IO.NEW_LINE(STANDARD_ERROR);
TEXT_IO.NEW_LINE(STANDARD_ERROR);
NUMROWS := (CSIZE + 1)/8;
for J in 1 .. NUMROWS loop
I := J;
while I <= CSIZE loop
TSTRING.PUT(STANDARD_ERROR, MISC.READABLE_FORM(CHARACTER'VAL(I)));
TEXT_IO.PUT(STANDARD_ERROR, " = ");
INT_IO.PUT(STANDARD_ERROR, ECGROUP(I), 1);
TEXT_IO.PUT(STANDARD_ERROR, " ");
I := I + NUMROWS;
end loop;
TEXT_IO.NEW_LINE(STANDARD_ERROR);
end loop;
end if;
end GENECS;
-- generate the code to find the action number
procedure GEN_FIND_ACTION is
begin
INDENT_PUTS("yy_act := yy_accept (yy_current_state);");
end GEN_FIND_ACTION;
-- genftbl - generates full transition table
procedure GENFTBL is
END_OF_BUFFER_ACTION : constant INTEGER := NUM_RULES + 1;
-- *everything* is done in terms of arrays starting at 1, so provide
-- a null entry for the zero element of all C arrays
begin
TEXT_IO.PUT(" yy_accept : constant array (0 .. ");
INT_IO.PUT(LASTDFA, 1);
TEXT_IO.PUT_LINE(") of Short :=");
TEXT_IO.PUT_LINE(" (0,");
DFAACC(END_OF_BUFFER_STATE).DFAACC_STATE := END_OF_BUFFER_ACTION;
for I in 1 .. LASTDFA loop
declare
ANUM : constant INTEGER := DFAACC(I).DFAACC_STATE;
begin
MISC.MKDATA(ANUM);
if (TRACE and (ANUM /= 0)) then
TEXT_IO.PUT(STANDARD_ERROR, "state # ");
INT_IO.PUT(STANDARD_ERROR, I, 1);
TEXT_IO.PUT(STANDARD_ERROR, " accepts: [");
INT_IO.PUT(STANDARD_ERROR, ANUM, 1);
TEXT_IO.PUT(STANDARD_ERROR, "]");
TEXT_IO.NEW_LINE(STANDARD_ERROR);
end if;
end;
end loop;
MISC.DATAEND;
if (USEECS) then
GENECS;
end if;
-- don't have to dump the actual full table entries - they were created
-- on-the-fly
end GENFTBL;
-- generate the code to find the next compressed-table state
procedure GEN_NEXT_COMPRESSED_STATE is
begin
if (USEECS) then
INDENT_PUTS("yy_c := yy_ec (yy_ch_buf (yy_cp));");
else
INDENT_PUTS("yy_c := yy_ch_buf (yy_cp);");
end if;
-- save the backtracking info \before/ computing the next state
-- because we always compute one more state than needed - we
-- always proceed until we reach a jam state
GEN_BACKTRACKING;
INDENT_PUTS(
"while yy_chk (yy_base (yy_current_state) + yy_c) /= yy_current_state loop"
);
INDENT_UP;
INDENT_PUTS("yy_current_state := yy_def (yy_current_state);");
if (USEMECS) then
-- we've arrange it so that templates are never chained
-- to one another. This means we can afford make a
-- very simple test to see if we need to convert to
-- yy_c's meta-equivalence class without worrying
-- about erroneously looking up the meta-equivalence
-- class twice
DO_INDENT;
-- lastdfa + 2 is the beginning of the templates
TEXT_IO.PUT("if yy_current_state >= ");
INT_IO.PUT(LASTDFA + 2, 1);
TEXT_IO.PUT_LINE(" then");
INDENT_UP;
INDENT_PUTS("yy_c := yy_meta (yy_c);");
INDENT_DOWN;
INDENT_PUTS("end if;");
end if;
INDENT_DOWN;
INDENT_PUTS("end loop;");
INDENT_PUTS("yy_current_state := yy_nxt (yy_base (yy_current_state) + yy_c);")
;
INDENT_DOWN;
end GEN_NEXT_COMPRESSED_STATE;
-- generate the code to find the next match
procedure GEN_NEXT_MATCH is
-- note - changes in here should be reflected in get_next_state
begin
if FULLTBL then
INDENT_PUTS(
"yy_current_state := yy_nxt (yy_current_state, yy_ch_buf (yy_cp));");
INDENT_PUTS("while yy_current_state > 0 loop");
INDENT_UP;
INDENT_PUTS("yy_cp := yy_cp + 1;");
INDENT_PUTS(
"yy_current_state := yy_nxt (yy_current_state, yy_ch_buf (yy_cp));");
INDENT_DOWN;
INDENT_PUTS("end loop;");
if (NUM_BACKTRACKING > 0) then
GEN_BACKTRACKING;
TEXT_IO.NEW_LINE;
end if;
TEXT_IO.NEW_LINE;
INDENT_PUTS("yy_current_state := -yy_current_state;");
else
-- compressed
INDENT_PUTS("loop");
INDENT_UP;
GEN_NEXT_STATE;
INDENT_PUTS("yy_cp := yy_cp + 1;");
if INTERACTIVE then
TEXT_IO.PUT(" if yy_base (yy_current_state) = ");
INT_IO.PUT(JAMBASE, 1);
else
TEXT_IO.PUT(" if yy_current_state = ");
INT_IO.PUT(JAMSTATE, 1);
end if;
TEXT_IO.PUT_LINE(" then");
TEXT_IO.PUT_LINE(" exit;");
TEXT_IO.PUT_LINE(" end if;");
INDENT_DOWN;
DO_INDENT;
TEXT_IO.PUT_LINE("end loop;");
if not INTERACTIVE then
INDENT_PUTS("yy_cp := yy_last_accepting_cpos;");
INDENT_PUTS("yy_current_state := yy_last_accepting_state;");
end if;
end if;
end GEN_NEXT_MATCH;
-- generate the code to find the next state
procedure GEN_NEXT_STATE is
-- note - changes in here should be reflected in get_next_match
begin
INDENT_UP;
if FULLTBL then
INDENT_PUTS("yy_current_state := yy_nxt (yy_current_state,");
INDENT_PUTS(" yy_ch_buf (yy_cp));");
GEN_BACKTRACKING;
else
GEN_NEXT_COMPRESSED_STATE;
end if;
end GEN_NEXT_STATE;
-- generate the code to find the start state
procedure GEN_START_STATE is
begin
INDENT_PUTS("yy_current_state := yy_start;");
if BOL_NEEDED then
INDENT_PUTS("if yy_ch_buf (yy_bp - 1) = ASCII.LF then");
INDENT_UP;
INDENT_PUTS("yy_current_state := yy_current_state + 1;");
INDENT_DOWN;
INDENT_PUTS("end if;");
end if;
end GEN_START_STATE;
-- gentabs - generate data statements for the transition tables
procedure GENTABS is
I, K, TOTAL_STATES : INTEGER;
ACC_ARRAY : INT_PTR;
END_OF_BUFFER_ACTION : constant INTEGER := NUM_RULES + 1;
-- *everything* is done in terms of arrays starting at 1, so provide
-- a null entry for the zero element of all C arrays
-- C_LONG_DECL : STRING(1 .. 44) :=
-- "static const long int %s[%d] =\n { 0,\n";
-- C_SHORT_DECL : STRING(1 .. 45) :=
-- "static const short int %s[%d] =\n { 0,\n";
-- C_CHAR_DECL : STRING(1 .. 40) :=
-- "static const char %s[%d] =\n { 0,\n";
begin
ACC_ARRAY := ALLOCATE_INTEGER_ARRAY(CURRENT_MAX_DFAS);
NUMMT := 0;
-- the compressed table format jams by entering the "jam state",
-- losing information about the previous state in the process.
-- In order to recover the previous state, we effectively need
-- to keep backtracking information.
NUM_BACKTRACKING := NUM_BACKTRACKING + 1;
DFAACC(END_OF_BUFFER_STATE).DFAACC_STATE := END_OF_BUFFER_ACTION;
for CNT in 1 .. LASTDFA loop
ACC_ARRAY(CNT) := DFAACC(CNT).DFAACC_STATE;
end loop;
ACC_ARRAY(LASTDFA + 1) := 0;
-- add accepting number for the jam state
-- spit out ALIST array, dumping the accepting numbers.
-- "lastdfa + 2" is the size of ALIST; includes room for arrays
-- beginning at 0 and for "jam" state
K := LASTDFA + 2;
TEXT_IO.PUT(" yy_accept : constant array (0 .. ");
INT_IO.PUT(K - 1, 1);
TEXT_IO.PUT_LINE(") of Short :=");
TEXT_IO.PUT_LINE(" (0,");
for CNT in 1 .. LASTDFA loop
MISC.MKDATA(ACC_ARRAY(CNT));
if (TRACE and (ACC_ARRAY(CNT) /= 0)) then
TEXT_IO.PUT(STANDARD_ERROR, "state # ");
INT_IO.PUT(STANDARD_ERROR, CNT, 1);
TEXT_IO.PUT(STANDARD_ERROR, " accepts: [");
INT_IO.PUT(STANDARD_ERROR, ACC_ARRAY(CNT), 1);
TEXT_IO.PUT(STANDARD_ERROR, ']');
TEXT_IO.NEW_LINE(STANDARD_ERROR);
end if;
end loop;
-- add entry for "jam" state
MISC.MKDATA(ACC_ARRAY(LASTDFA + 1));
MISC.DATAEND;
if (USEECS) then
GENECS;
end if;
if (USEMECS) then
-- write out meta-equivalence classes (used to index templates with)
if (TRACE) then
TEXT_IO.NEW_LINE(STANDARD_ERROR);
TEXT_IO.NEW_LINE(STANDARD_ERROR);
TEXT_IO.PUT_LINE(STANDARD_ERROR, "Meta-Equivalence Classes:");
end if;
TEXT_IO.PUT(" yy_meta : constant array (0 .. ");
INT_IO.PUT(NUMECS, 1);
TEXT_IO.PUT_LINE(") of Short :=");
TEXT_IO.PUT_LINE(" (0,");
for CNT in 1 .. NUMECS loop
if (TRACE) then
INT_IO.PUT(STANDARD_ERROR, CNT, 1);
TEXT_IO.PUT(STANDARD_ERROR, " = ");
INT_IO.PUT(STANDARD_ERROR, abs(TECBCK(CNT)), 1);
TEXT_IO.NEW_LINE(STANDARD_ERROR);
end if;
MISC.MKDATA(abs(TECBCK(CNT)));
end loop;
MISC.DATAEND;
end if;
TOTAL_STATES := LASTDFA + NUMTEMPS;
TEXT_IO.PUT(" yy_base : constant array (0 .. ");
INT_IO.PUT(TOTAL_STATES, 1);
if TBLEND > MAX_SHORT then
TEXT_IO.PUT_LINE(") of Integer :=");
else
TEXT_IO.PUT_LINE(") of Short :=");
end if;
TEXT_IO.PUT_LINE(" (0,");
for CNT in 1 .. LASTDFA loop
declare
D : constant INTEGER := DEF(CNT);
begin
if BASE(CNT) = JAMSTATE_CONST then
BASE(CNT) := JAMBASE;
end if;
if D = JAMSTATE_CONST then
DEF(CNT) := JAMSTATE;
else
if D < 0 then
-- template reference
TMPUSES := TMPUSES + 1;
DEF(CNT) := LASTDFA - D + 1;
end if;
end if;
MISC.MKDATA(BASE(CNT));
end;
end loop;
-- generate jam state's base index
I := LASTDFA + 1;
MISC.MKDATA(BASE(I));
-- skip jam state
I := I + 1;
for CNT in I .. TOTAL_STATES loop
MISC.MKDATA(BASE(CNT));
DEF(CNT) := JAMSTATE;
end loop;
MISC.DATAEND;
TEXT_IO.PUT(" yy_def : constant array (0 .. ");
INT_IO.PUT(TOTAL_STATES, 1);
if TBLEND > MAX_SHORT then
TEXT_IO.PUT_LINE(") of Integer :=");
else
TEXT_IO.PUT_LINE(") of Short :=");
end if;
TEXT_IO.PUT_LINE(" (0,");
for CNT in 1 .. TOTAL_STATES loop
MISC.MKDATA(DEF(CNT));
end loop;
MISC.DATAEND;
TEXT_IO.PUT(" yy_nxt : constant array (0 .. ");
INT_IO.PUT(TBLEND, 1);
if LASTDFA > MAX_SHORT then
TEXT_IO.PUT_LINE(") of Integer :=");
else
TEXT_IO.PUT_LINE(") of Short :=");
end if;
TEXT_IO.PUT_LINE(" (0,");
for CNT in 1 .. TBLEND loop
if ((NXT(CNT) = 0) or (CHK(CNT) = 0)) then
NXT(CNT) := JAMSTATE;
-- new state is the JAM state
end if;
MISC.MKDATA(NXT(CNT));
end loop;
MISC.DATAEND;
TEXT_IO.PUT(" yy_chk : constant array (0 .. ");
INT_IO.PUT(TBLEND, 1);
if LASTDFA > MAX_SHORT then
TEXT_IO.PUT_LINE(") of Integer :=");
else
TEXT_IO.PUT_LINE(") of Short :=");
end if;
TEXT_IO.PUT_LINE(" (0,");
for CNT in 1 .. TBLEND loop
if CHK(CNT) = 0 then
NUMMT := NUMMT + 1;
end if;
MISC.MKDATA(CHK(CNT));
end loop;
MISC.DATAEND;
exception
when STORAGE_ERROR =>
MISC.AFLEXFATAL("dynamic memory failure in gentabs()");
end GENTABS;
-- write out a string at the current indentation level, adding a final
-- newline
procedure INDENT_PUTS(STR : in STRING) is
begin
DO_INDENT;
TEXT_IO.PUT_LINE(STR);
end INDENT_PUTS;
-- do_sect3_out - dumps section 3.
procedure DO_SECT3_OUT is
GARBAGE : TOKEN;
pragma Unreferenced (GARBAGE);
begin
SCANNER.CALL_YYLEX := TRUE;
GARBAGE := SCANNER.GET_TOKEN;
end DO_SECT3_OUT;
-- make_tables - generate transition tables
--
--
-- Generates transition tables and finishes generating output file
procedure MAKE_TABLES is
DID_EOF_RULE : BOOLEAN := FALSE;
-- TRANS_OFFSET_TYPE : STRING(1 .. 7);
-- TOTAL_TABLE_SIZE : INTEGER := TBLEND + NUMECS + 1;
BUF : VSTRING;
begin
if not FULLTBL then
-- if we used full tables this is already output
DO_SECT3_OUT;
-- intent of this call is to get everything up to ##
SKELETON_MANAGER.SKELOUT;
-- output YYLex code up to part about tables.
end if;
TEXT_IO.PUT(" YY_END_OF_BUFFER : constant := ");
INT_IO.PUT(NUM_RULES + 1, 1);
TEXT_IO.PUT_LINE(";");
INDENT_PUTS(" subtype yy_state_type is Integer;");
INDENT_PUTS(" yy_current_state : yy_state_type;");
-- now output the constants for the various start conditions
RESET(DEF_FILE, IN_FILE);
while (not TEXT_IO.END_OF_FILE(DEF_FILE)) loop
TSTRING.GET_LINE(DEF_FILE, BUF);
TSTRING.PUT_LINE(BUF);
end loop;
if (FULLTBL) then
GENFTBL;
else
GENTABS;
end if;
RESET(TEMP_ACTION_FILE, IN_FILE);
-- generate code for yy_get_previous_state
-- SET_INDENT(3);
SKELETON_MANAGER.SKELOUT;
INDENT_UP;
INDENT_UP;
if (BOL_NEEDED) then
INDENT_UP;
INDENT_PUTS("yy_bp : constant Integer := yytext_ptr;");
INDENT_DOWN;
end if;
SKELETON_MANAGER.SKELOUT;
INDENT_UP;
GEN_START_STATE;
SKELETON_MANAGER.SKELOUT;
GEN_NEXT_STATE;
SKELETON_MANAGER.SKELOUT;
-- SET_INDENT(4);
INDENT_PUTS("yy_bp := yy_cp;");
GEN_START_STATE;
GEN_NEXT_MATCH;
SKELETON_MANAGER.SKELOUT;
-- SET_INDENT(3);
GEN_FIND_ACTION;
-- SET_INDENT(1);
INDENT_DOWN;
SKELETON_MANAGER.SKELOUT;
INDENT_UP;
GEN_BT_ACTION;
MISC.ACTION_OUT;
MISC.ACTION_OUT;
-- generate cases for any missing EOF rules
for I in 1 .. LASTSC loop
if not SCEOF(I) then
DO_INDENT;
if not DID_EOF_RULE then
TEXT_IO.PUT(" when ");
else
TEXT_IO.PUT_LINE("|");
TEXT_IO.PUT(" ");
end if;
TEXT_IO.PUT("YY_END_OF_BUFFER + ");
TSTRING.PUT(SCNAME(I));
TEXT_IO.PUT(" + 1 ");
DID_EOF_RULE := TRUE;
end if;
end loop;
if DID_EOF_RULE then
TEXT_IO.PUT_LINE("=>");
end if;
if DID_EOF_RULE then
INDENT_UP;
INDENT_PUTS(" return End_Of_Input;");
INDENT_DOWN;
end if;
SKELETON_MANAGER.SKELOUT;
-- copy remainder of input to output
MISC.LINE_DIRECTIVE_OUT;
DO_SECT3_OUT;
-- copy remainder of input, after ##, to the scanner file.
end MAKE_TABLES;
end GEN;
|
vikasbidhuri1995/DW1000 | Ada | 10,915 | 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 System;
package NRF52.SPI is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype EVENTS_READY_EVENTS_READY_Field is NRF52.Bit;
-- TXD byte sent and RXD byte received
type EVENTS_READY_Register is record
EVENTS_READY : EVENTS_READY_EVENTS_READY_Field := 16#0#;
-- unspecified
Reserved_1_31 : NRF52.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for EVENTS_READY_Register use record
EVENTS_READY at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- Write '1' to Enable interrupt for READY event
type INTENSET_READY_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_READY_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for READY event
type INTENSET_READY_Field_1 is
(-- Reset value for the field
Intenset_Ready_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_READY_Field_1 use
(Intenset_Ready_Field_Reset => 0,
Set => 1);
-- Enable interrupt
type INTENSET_Register is record
-- unspecified
Reserved_0_1 : NRF52.UInt2 := 16#0#;
-- Write '1' to Enable interrupt for READY event
READY : INTENSET_READY_Field_1 := Intenset_Ready_Field_Reset;
-- unspecified
Reserved_3_31 : NRF52.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for INTENSET_Register use record
Reserved_0_1 at 0 range 0 .. 1;
READY at 0 range 2 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
-- Write '1' to Disable interrupt for READY event
type INTENCLR_READY_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_READY_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for READY event
type INTENCLR_READY_Field_1 is
(-- Reset value for the field
Intenclr_Ready_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_READY_Field_1 use
(Intenclr_Ready_Field_Reset => 0,
Clear => 1);
-- Disable interrupt
type INTENCLR_Register is record
-- unspecified
Reserved_0_1 : NRF52.UInt2 := 16#0#;
-- Write '1' to Disable interrupt for READY event
READY : INTENCLR_READY_Field_1 := Intenclr_Ready_Field_Reset;
-- unspecified
Reserved_3_31 : NRF52.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for INTENCLR_Register use record
Reserved_0_1 at 0 range 0 .. 1;
READY at 0 range 2 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
-- Enable or disable SPI
type ENABLE_ENABLE_Field is
(-- Disable SPI
Disabled,
-- Enable SPI
Enabled)
with Size => 4;
for ENABLE_ENABLE_Field use
(Disabled => 0,
Enabled => 1);
-- Enable SPI
type ENABLE_Register is record
-- Enable or disable SPI
ENABLE : ENABLE_ENABLE_Field := NRF52.SPI.Disabled;
-- unspecified
Reserved_4_31 : NRF52.UInt28 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for ENABLE_Register use record
ENABLE at 0 range 0 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
----------------------------------
-- SPI_PSEL cluster's Registers --
----------------------------------
-- Unspecified
type SPI_PSEL_Cluster is record
-- Pin select for SCK
SCK : aliased NRF52.UInt32;
-- Pin select for MOSI
MOSI : aliased NRF52.UInt32;
-- Pin select for MISO
MISO : aliased NRF52.UInt32;
end record
with Size => 96;
for SPI_PSEL_Cluster use record
SCK at 16#0# range 0 .. 31;
MOSI at 16#4# range 0 .. 31;
MISO at 16#8# range 0 .. 31;
end record;
subtype RXD_RXD_Field is NRF52.Byte;
-- RXD register
type RXD_Register is record
-- Read-only. *** Reading this field has side effects on other resources
-- ***. RX data received. Double buffered
RXD : RXD_RXD_Field;
-- unspecified
Reserved_8_31 : NRF52.UInt24;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for RXD_Register use record
RXD at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype TXD_TXD_Field is NRF52.Byte;
-- TXD register
type TXD_Register is record
-- TX data to send. Double buffered
TXD : TXD_TXD_Field := 16#0#;
-- unspecified
Reserved_8_31 : NRF52.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for TXD_Register use record
TXD at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- Bit order
type CONFIG_ORDER_Field is
(-- Most significant bit shifted out first
Msbfirst,
-- Least significant bit shifted out first
Lsbfirst)
with Size => 1;
for CONFIG_ORDER_Field use
(Msbfirst => 0,
Lsbfirst => 1);
-- Serial clock (SCK) phase
type CONFIG_CPHA_Field is
(-- Sample on leading edge of clock, shift serial data on trailing edge
Leading,
-- Sample on trailing edge of clock, shift serial data on leading edge
Trailing)
with Size => 1;
for CONFIG_CPHA_Field use
(Leading => 0,
Trailing => 1);
-- Serial clock (SCK) polarity
type CONFIG_CPOL_Field is
(-- Active high
Activehigh,
-- Active low
Activelow)
with Size => 1;
for CONFIG_CPOL_Field use
(Activehigh => 0,
Activelow => 1);
-- Configuration register
type CONFIG_Register is record
-- Bit order
ORDER : CONFIG_ORDER_Field := NRF52.SPI.Msbfirst;
-- Serial clock (SCK) phase
CPHA : CONFIG_CPHA_Field := NRF52.SPI.Leading;
-- Serial clock (SCK) polarity
CPOL : CONFIG_CPOL_Field := NRF52.SPI.Activehigh;
-- unspecified
Reserved_3_31 : NRF52.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CONFIG_Register use record
ORDER at 0 range 0 .. 0;
CPHA at 0 range 1 .. 1;
CPOL at 0 range 2 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
----------------------------------
-- SPI_PSEL cluster's Registers --
----------------------------------
----------------------------------
-- SPI_PSEL cluster's Registers --
----------------------------------
-----------------
-- Peripherals --
-----------------
-- Serial Peripheral Interface 0
type SPI_Peripheral is record
-- TXD byte sent and RXD byte received
EVENTS_READY : aliased EVENTS_READY_Register;
-- Enable interrupt
INTENSET : aliased INTENSET_Register;
-- Disable interrupt
INTENCLR : aliased INTENCLR_Register;
-- Enable SPI
ENABLE : aliased ENABLE_Register;
-- Unspecified
PSEL : aliased SPI_PSEL_Cluster;
-- RXD register
RXD : aliased RXD_Register;
-- TXD register
TXD : aliased TXD_Register;
-- SPI frequency
FREQUENCY : aliased NRF52.UInt32;
-- Configuration register
CONFIG : aliased CONFIG_Register;
end record
with Volatile;
for SPI_Peripheral use record
EVENTS_READY at 16#108# range 0 .. 31;
INTENSET at 16#304# range 0 .. 31;
INTENCLR at 16#308# range 0 .. 31;
ENABLE at 16#500# range 0 .. 31;
PSEL at 16#508# range 0 .. 95;
RXD at 16#518# range 0 .. 31;
TXD at 16#51C# range 0 .. 31;
FREQUENCY at 16#524# range 0 .. 31;
CONFIG at 16#554# range 0 .. 31;
end record;
-- Serial Peripheral Interface 0
SPI0_Periph : aliased SPI_Peripheral
with Import, Address => SPI0_Base;
-- Serial Peripheral Interface 1
SPI1_Periph : aliased SPI_Peripheral
with Import, Address => SPI1_Base;
-- Serial Peripheral Interface 2
SPI2_Periph : aliased SPI_Peripheral
with Import, Address => SPI2_Base;
end NRF52.SPI;
|
reznikmm/matreshka | Ada | 3,808 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
package Matreshka.ODF_Attributes.Style.Next_Style_Name is
type Style_Next_Style_Name_Node is
new Matreshka.ODF_Attributes.Style.Style_Node_Base with null record;
type Style_Next_Style_Name_Access is
access all Style_Next_Style_Name_Node'Class;
overriding function Get_Local_Name
(Self : not null access constant Style_Next_Style_Name_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Attributes.Style.Next_Style_Name;
|
AdaCore/libadalang | Ada | 109 | adb | procedure Test is
begin
null;
exception
when Numeric_Error =>
null;
end Test;
pragma Test_Block;
|
AdaCore/Ada_Drivers_Library | Ada | 7,324 | ads | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2017, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- This package provides an interface to the on-board "window watchdog"
-- provided by the STM32F4 family.
-- Important: see Figure 215 in RM0090, the STM32 reference manual,
-- illustrating the watchdog behavior and significant events.
-- Note that time is increasing to the right in the figure.
-- www.st.com/resource/en/reference_manual/DM00031020.pdf
package STM32.WWDG is -- the Window Watchdog
pragma Elaborate_Body;
procedure Enable_Watchdog_Clock;
procedure Reset_Watchdog;
-- Resets the peripheral using the RCC
type Prescalers is
(Divider_1,
Divider_2,
Divider_4,
Divider_8)
with Size => 2;
-- These prescalers are clock frequency dividers, with numeric divisor
-- values corresponding to the digits in the names. The dividers are used
-- to determine the watchdog counter clock frequency driving the countdown
-- timer.
--
-- The frequency is computed as follows:
-- PCLK1 / 4096 / divider-value
-- For example, assuming PCLK1 of 45MHz and Divider_8, we'd get:
-- 45_000_000 / 4096 / 8 => 1373 Hz
--
-- The frequency can be used to calculate the time span values for the
-- refresh window, for example. See the demo program for doing that.
procedure Set_Watchdog_Prescaler (Value : Prescalers);
-- Set the divider used to derive the watchdog counter clock frequency
-- driving the countdown timer.
--
-- Note that the watchdog counter only counts down to 16#40# (64) before
-- triggering the reset, and the upper limit for the counter value is 127,
-- so there is a relatively limited number of counts available for the
-- refresh window to be open. Therefore, the frequency at which the
-- watchdog clock drives the counter is a significant factor in the
-- total possible time span for the refresh window.
subtype Downcounter is UInt7 range 16#40# .. UInt7'Last;
-- 16#40# is the last value of the countdown counter prior to a reset. When
-- the count goes to 16#3F# the high-oder bit being cleared triggers the
-- reset (if the watchdog is activated). Thus we never want to specify a
-- counter value less than 16#40#.
procedure Set_Watchdog_Window (Window_Start_Count : Downcounter);
-- Set the value of the countdown counter for when the refresh window is
-- to open. In figure 215, this is the counter value at the start of the
-- "refresh allowed" interval. It is an arbitrary, user-defined value.
--
-- The last counter value prior to reset is always 64 (16#40#). At 16#3F#
-- the high-order counter bit (T6 in the figure) clears, causing the
-- watchdog to trigger the system reset (when activated).
--
-- To prevent a reset, the watchdog counter must be refreshed by the
-- application but only when the counter is lower than Window_Start_Count
-- and greater than 16#3F#.
procedure Activate_Watchdog (New_Count : Downcounter);
-- Set the watchdog counter to begin counting down from New_Count and
-- activate the watchdog. In the figure, this is the counter value at
-- the start of the "refresh not allowed" interval. It is an arbitrary,
-- user-defined value.
--
-- Once activated there is no way to deactivate the watchdog other
-- than a system reset.
--
-- Note that, as a "window" watchdog, the period in which the counter can
-- be refreshed does not open immediately upon activating the watchdog.
procedure Refresh_Watchdog_Counter (New_Count : Downcounter);
-- Set the counter to begin counting down from New_Count. Used to refresh
-- the watchdog counter in order to prevent the watchdog timeout. In the
-- figure, this is the counter value at the start of the "refresh not
-- allowed" interval. It is an arbitrary, user-defined value, but is likely
-- the same value passed to Activate_Watchdog. The difference between this
-- routine and the activating routine is soley the activation.
procedure Enable_Early_Wakeup_Interrupt;
-- When enabled, an interrupt occurs whenever the counter reaches the value
-- 16#40#, ie one counter decrement period before the counter causes a
-- system reset. Once enabled, this interrupt can only be disabled by
-- hardware after a system reset.
function Early_Wakeup_Interrupt_Indicated return Boolean
with Inline;
-- Set by hardware when the counter has reached the value 16#40#, the
-- counter value just prior to the reset being triggered. Always set,
-- even if the interrupt is not enabled.
procedure Clear_Early_Wakeup_Interrupt
with Inline;
-- Clears the status bit
function WWDG_Reset_Indicated return Boolean;
-- Indicated in the RCC peripheral
procedure Clear_WWDG_Reset_Flag;
-- In the RCC peripheral
procedure Reset_System;
-- an immediate software-driven reset, just as if the count hit 16#3F#
end STM32.WWDG;
|
AdaCore/gpr | Ada | 2,094 | ads | --
-- Copyright (C) 2019-2023, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-Exception
--
-- This package represents an entity source reference with an associated
-- message. This is mostly to report warnings/errors while parsing sources.
with Ada.Strings.Unbounded;
generic
type Text_Type is new String;
package GPR2.Source_Reference.Text_Value is
type Object is new GPR2.Source_Reference.Object with private;
overriding function "<" (Left, Right : Object) return Boolean;
Undefined : constant Object;
-- This constant is equal to any object declared without an explicit
-- initializer.
overriding function Is_Defined (Self : Object) return Boolean;
-- Returns true if Self is defined
function Create
(Filename : Path_Name.Full_Name;
Line, Column : Natural;
Text : Text_Type) return Object'Class
with Post => Create'Result.Is_Defined;
function Create
(Sloc : GPR2.Source_Reference.Object;
Text : Text_Type) return Object'Class
with Pre => Sloc.Is_Defined,
Post => Create'Result.Is_Defined;
function Text (Self : Object) return Text_Type
with Pre => Self.Is_Defined;
-- Returns the message associated with the reference
function Unchecked_Text
(Self : Object) return Ada.Strings.Unbounded.Unbounded_String
with Pre => Self.Is_Defined;
-- Returns the message associated with the reference
private
type Object is new GPR2.Source_Reference.Object with record
Text : Unbounded_String;
end record;
overriding function "<" (Left, Right : Object) return Boolean is
(if GPR2.Source_Reference.Object (Left) /=
GPR2.Source_Reference.Object (Right)
then GPR2.Source_Reference.Object (Left) <
GPR2.Source_Reference.Object (Right)
else Left.Text < Right.Text);
Undefined : constant Object :=
(GPR2.Source_Reference.Undefined with others => <>);
overriding function Is_Defined (Self : Object) return Boolean is
(Self /= Undefined);
end GPR2.Source_Reference.Text_Value;
|
burratoo/Acton | Ada | 15,980 | ads | ------------------------------------------------------------------------------------------
-- --
-- ACTON PROCESSOR SUPPORT PACKAGE --
-- --
-- ATMEL AT91SAM7S --
-- --
-- Copyright (C) 2014-2021, Patrick Bernardi --
-- --
------------------------------------------------------------------------------------------
with Interfaces; use Interfaces;
with System; use System;
package Atmel.AT91SAM7S.TC with Preelaborate is
----------------------------------------
-- Public Hardware Features and Types --
----------------------------------------
type Timer_Counter_Channel_Id is range 0 .. 2;
type External_Clock_Pin is (TCLK, None, TIOA1, TIOA2);
type External_Clock is (XC0, XC1, XC2);
type External_Clock_Pin_Set is array (External_Clock) of
External_Clock_Pin with Pack;
type Block_Mode_Type is record
External_Clock_Signal : External_Clock_Pin_Set;
end record with Size => Standard'Word_Size;
type Counter_Type is (Capture_Mode, Waveform_Mode);
for Counter_Type use (Capture_Mode => 0, Waveform_Mode => 1);
type Clock_Selection_Options is
(Timer_Clock1, Timer_Clock2, Timer_Clock3,
Timer_Clock4, Timer_Clock5, XC0, XC1, XC2);
type Clock_Edge is (Rising, Falling);
type Burst_Signal_Selection_Type is (None, XC0, XC1, XC2);
type Edge_Type is (None, Rising_Edge, Falling_Edge, Each_Edge);
type External_Trigger_Pin is (TIOA, TIOB);
type External_Event_Signal is (TIOB, XC0, XC1, XC2);
type Waveform_Type is
(UP_Mode_Without_Automatic_Tigger_On_Register_C_Compare,
UP_Mode_With_Automatic_Tigger_On_Register_C_Compare,
UPDOWN_Mode_Without_Automatic_Tigger_On_Register_C_Compare,
UPDOWN_Mode_With_Automatic_Tigger_On_Register_C_Compare);
type Event_Effect is (None, Set, Clear, Toggle);
type Channel_Mode_Type
(Counter_Mode : Counter_Type := Capture_Mode) is record
Clock_Selection : Clock_Selection_Options;
Counter_Increment_On_Edge : Clock_Edge;
Burst_Signal_Selection : Burst_Signal_Selection_Type;
case Counter_Mode is
when Capture_Mode =>
Counter_Clock_Stopped_When_RegB_Loading : Boolean;
Counter_Clock_Disabled_When_RegB_Loading : Boolean;
External_Trigger_Edge : Edge_Type;
External_Trigger_Source : External_Trigger_Pin;
Register_C_Compare_Trigger : Enable_Type;
Register_A_Loading_Event : Edge_Type;
Register_B_Loading_Event : Edge_Type;
when Waveform_Mode =>
Counter_Clock_Stopped_When_RegC_Compare : Boolean;
Counter_Clock_Disabled_When_RegC_Compare : Boolean;
External_Event_Edge_Selection : Edge_Type;
External_Event_Signal_Selection : External_Event_Signal;
External_Event_Trigger : Enable_Type;
Waveform_Selection : Waveform_Type;
Register_A_Compare_Effect_On_TIOA : Event_Effect;
Register_C_Compare_Effect_On_TIOA : Event_Effect;
External_Event_Effect_On_TIOA : Event_Effect;
Software_Trigger_Effect_On_TIOA : Event_Effect;
Register_A_Compare_Effect_On_TIOB : Event_Effect;
Register_C_Compare_Effect_On_TIOB : Event_Effect;
External_Event_Effect_On_TIOB : Event_Effect;
Software_Trigger_Effect_On_TIOB : Event_Effect;
end case;
end record with Size => Standard'Word_Size;
----------------------
-- Public Interface --
----------------------
procedure Initialise_Interface (Settings : Block_Mode_Type);
procedure Initialise_Channel (Channel : Timer_Counter_Channel_Id;
Settings : Channel_Mode_Type;
Register_A : Unsigned_16;
Register_B : Unsigned_16;
Register_C : Unsigned_16);
function Interface_Is_Ready return Boolean;
procedure Disable_Channel (Channel : Timer_Counter_Channel_Id) with Inline;
procedure Enable_Channel (Channel : Timer_Counter_Channel_Id) with Inline;
procedure Software_Trigger (Channel : Timer_Counter_Channel_Id) with Inline;
procedure Start_Timer (Channel : Timer_Counter_Channel_Id) with Inline;
-------------------------
-- TC Memory Addresses --
-------------------------
TC_Base_Address : constant := 16#FFFA_0000#;
CCR_Offset_Address : constant := 16#00#;
CMR_Offset_Address : constant := 16#04#;
CV_Offset_Address : constant := 16#10#;
RA_Offset_Address : constant := 16#14#;
RB_Offset_Address : constant := 16#18#;
RC_Offset_Address : constant := 16#1C#;
SR_Offset_Address : constant := 16#20#;
IER_Offset_Address : constant := 16#24#;
IDR_Offset_Address : constant := 16#28#;
IMR_Offset_Address : constant := 16#2C#;
BCR_Offset_Address : constant := 16#C0#;
BMR_Offset_Address : constant := 16#C4#;
-----------------------
-- Hardware Features --
-----------------------
--------------
-- TC Types --
--------------
type Block_Control_Register_Type is record
Send_Synchro_Command : Boolean;
end record with Size => Standard'Word_Size;
type Channel_Control_Type is record
Counter_Clock_Enable : Enable_No_Change_Type;
Counter_Clock_Disable : Disable_No_Change_Type;
Software_Trigger : Boolean;
end record;
type Channel_Status_Type is record
Counter_Overflow : Occured_Type;
Load_Overrun : Occured_Type;
Register_A_Compare : Occured_Type;
Register_B_Compare : Occured_Type;
Register_C_Compare : Occured_Type;
Register_A_Load : Occured_Type;
Register_B_Load : Occured_Type;
External_Trigger : Occured_Type;
Clock : Enabled_Type;
TIOA : Pin_Status;
TIOB : Pin_Status;
end record with Size => Standard'Word_Size;
type Interrupt_Enable_Type is record
Counter_Overflow : Enable_No_Change_Type;
Load_Overrun : Enable_No_Change_Type;
Register_A_Compare : Enable_No_Change_Type;
Register_B_Compare : Enable_No_Change_Type;
Register_C_Compare : Enable_No_Change_Type;
Register_A_Load : Enable_No_Change_Type;
Register_B_Load : Enable_No_Change_Type;
External_Trigger : Enable_No_Change_Type;
end record with Size => Standard'Word_Size;
type Interrupt_Disable_Type is record
Counter_Overflow : Disable_No_Change_Type;
Load_Overrun : Disable_No_Change_Type;
Register_A_Compare : Disable_No_Change_Type;
Register_B_Compare : Disable_No_Change_Type;
Register_C_Compare : Disable_No_Change_Type;
Register_A_Load : Disable_No_Change_Type;
Register_B_Load : Disable_No_Change_Type;
External_Trigger : Disable_No_Change_Type;
end record with Size => Standard'Word_Size;
type Interrupt_Mask_Type is record
Counter_Overflow : Enabled_Type;
Load_Overrun : Enabled_Type;
Register_A_Compare : Enabled_Type;
Register_B_Compare : Enabled_Type;
Register_C_Compare : Enabled_Type;
Register_A_Load : Enabled_Type;
Register_B_Load : Enabled_Type;
External_Trigger : Enabled_Type;
end record with Size => Standard'Word_Size;
pragma Warnings (Off, "*unused*");
type Timer_Channel_Type is record
Channel_Control_Register : Channel_Control_Type;
Channel_Mode_Register : Channel_Mode_Type;
Counter_Value : Unsigned_16;
Register_A : Unsigned_16;
Register_B : Unsigned_16;
Register_C : Unsigned_16;
Status_Register : Channel_Status_Type;
Interrupt_Enable_Register : Interrupt_Enable_Type;
Interrupt_Disable_Register : Interrupt_Disable_Type;
Interrupt_Mask_Register : Interrupt_Mask_Type;
end record with Size => 16#40# * 8;
------------------------------
-- Hardware Representations --
------------------------------
for Block_Control_Register_Type use record
Send_Synchro_Command at 0 range 0 .. 0;
end record;
for Block_Mode_Type use record
External_Clock_Signal at 0 range 0 .. 5;
end record;
for External_Clock_Pin use (TCLK => 0, None => 1, TIOA1 => 2, TIOA2 => 3);
for Channel_Control_Type use record
Counter_Clock_Enable at 0 range 0 .. 0;
Counter_Clock_Disable at 0 range 1 .. 1;
Software_Trigger at 0 range 2 .. 2;
end record;
for Clock_Selection_Options use
(Timer_Clock1 => 0, Timer_Clock2 => 1, Timer_Clock3 => 2,
Timer_Clock4 => 3, Timer_Clock5 => 4, XC0 => 5, XC1 => 6, XC2 => 7);
for Clock_Edge use (Rising => 0, Falling => 1);
for Burst_Signal_Selection_Type use (None => 0,
XC0 => 1,
XC1 => 2,
XC2 => 3);
for Edge_Type use (None => 0,
Rising_Edge => 1,
Falling_Edge => 2,
Each_Edge => 3);
for External_Trigger_Pin use (TIOA => 0, TIOB => 1);
for External_Event_Signal use (TIOB => 0, XC0 => 1, XC1 => 2, XC2 => 3);
for Waveform_Type use
(UP_Mode_Without_Automatic_Tigger_On_Register_C_Compare => 0,
UP_Mode_With_Automatic_Tigger_On_Register_C_Compare => 1,
UPDOWN_Mode_Without_Automatic_Tigger_On_Register_C_Compare => 2,
UPDOWN_Mode_With_Automatic_Tigger_On_Register_C_Compare => 3);
for Event_Effect use (None => 0, Set => 1, Clear => 2, Toggle => 3);
for Channel_Mode_Type use record
Clock_Selection at 0 range 0 .. 2;
Counter_Increment_On_Edge at 0 range 3 .. 3;
Burst_Signal_Selection at 0 range 4 .. 5;
Counter_Mode at 0 range 15 .. 15;
Counter_Clock_Stopped_When_RegB_Loading at 0 range 6 .. 6;
Counter_Clock_Disabled_When_RegB_Loading at 0 range 7 .. 7;
External_Trigger_Edge at 0 range 8 .. 9;
External_Trigger_Source at 0 range 10 .. 10;
Register_C_Compare_Trigger at 0 range 14 .. 14;
Register_A_Loading_Event at 0 range 16 .. 17;
Register_B_Loading_Event at 0 range 18 .. 19;
Counter_Clock_Stopped_When_RegC_Compare at 0 range 6 .. 6;
Counter_Clock_Disabled_When_RegC_Compare at 0 range 7 .. 7;
External_Event_Edge_Selection at 0 range 8 .. 9;
External_Event_Signal_Selection at 0 range 10 .. 11;
External_Event_Trigger at 0 range 12 .. 12;
Waveform_Selection at 0 range 13 .. 14;
Register_A_Compare_Effect_On_TIOA at 0 range 16 .. 17;
Register_C_Compare_Effect_On_TIOA at 0 range 18 .. 19;
External_Event_Effect_On_TIOA at 0 range 20 .. 21;
Software_Trigger_Effect_On_TIOA at 0 range 22 .. 23;
Register_A_Compare_Effect_On_TIOB at 0 range 24 .. 25;
Register_C_Compare_Effect_On_TIOB at 0 range 26 .. 27;
External_Event_Effect_On_TIOB at 0 range 28 .. 29;
Software_Trigger_Effect_On_TIOB at 0 range 30 .. 31;
end record;
for Channel_Status_Type use record
Counter_Overflow at 0 range 0 .. 0;
Load_Overrun at 0 range 1 .. 1;
Register_A_Compare at 0 range 2 .. 2;
Register_B_Compare at 0 range 3 .. 3;
Register_C_Compare at 0 range 4 .. 4;
Register_A_Load at 0 range 5 .. 5;
Register_B_Load at 0 range 6 .. 6;
External_Trigger at 0 range 7 .. 7;
Clock at 0 range 16 .. 16;
TIOA at 0 range 17 .. 17;
TIOB at 0 range 18 .. 18;
end record;
for Interrupt_Enable_Type use record
Counter_Overflow at 0 range 0 .. 0;
Load_Overrun at 0 range 1 .. 1;
Register_A_Compare at 0 range 2 .. 2;
Register_B_Compare at 0 range 3 .. 3;
Register_C_Compare at 0 range 4 .. 4;
Register_A_Load at 0 range 5 .. 5;
Register_B_Load at 0 range 6 .. 6;
External_Trigger at 0 range 7 .. 7;
end record;
for Interrupt_Disable_Type use record
Counter_Overflow at 0 range 0 .. 0;
Load_Overrun at 0 range 1 .. 1;
Register_A_Compare at 0 range 2 .. 2;
Register_B_Compare at 0 range 3 .. 3;
Register_C_Compare at 0 range 4 .. 4;
Register_A_Load at 0 range 5 .. 5;
Register_B_Load at 0 range 6 .. 6;
External_Trigger at 0 range 7 .. 7;
end record;
for Interrupt_Mask_Type use record
Counter_Overflow at 0 range 0 .. 0;
Load_Overrun at 0 range 1 .. 1;
Register_A_Compare at 0 range 2 .. 2;
Register_B_Compare at 0 range 3 .. 3;
Register_C_Compare at 0 range 4 .. 4;
Register_A_Load at 0 range 5 .. 5;
Register_B_Load at 0 range 6 .. 6;
External_Trigger at 0 range 7 .. 7;
end record;
for Timer_Channel_Type use record
Channel_Control_Register at CCR_Offset_Address range 0 .. 31;
Channel_Mode_Register at CMR_Offset_Address range 0 .. 31;
Counter_Value at CV_Offset_Address range 0 .. 15;
Register_A at RA_Offset_Address range 0 .. 15;
Register_B at RB_Offset_Address range 0 .. 15;
Register_C at RC_Offset_Address range 0 .. 15;
Status_Register at SR_Offset_Address range 0 .. 31;
Interrupt_Enable_Register at IER_Offset_Address range 0 .. 31;
Interrupt_Disable_Register at IDR_Offset_Address range 0 .. 31;
Interrupt_Mask_Register at IMR_Offset_Address range 0 .. 31;
end record;
-------------------
-- TC Registers --
-------------------
type Timer_Channel_Set is array (Timer_Counter_Channel_Id) of
Timer_Channel_Type;
Block_Control_Register : Block_Control_Register_Type
with Address => System'To_Address (TC_Base_Address + BCR_Offset_Address);
Block_Mode_Register : Block_Mode_Type
with Address => System'To_Address (TC_Base_Address + BMR_Offset_Address);
Timer_Channel : Timer_Channel_Set
with Address => System'To_Address (TC_Base_Address),
Import, Convention => Ada;
-- Timer_Channel_0 : Timer_Channel_Type
-- with Alignment => 4, Address => System'To_Address (TC_Base_Address),
-- Import, Convention => Ada;
--
-- Timer_Channel_1 : Timer_Channel_Type
-- with Alignment => 4,
-- Address => System'To_Address (TC_Base_Address + 16#40#),
-- Import, Convention => Ada;
--
-- Timer_Channel_2 : Timer_Channel_Type
-- with Alignment => 4,
-- Address => System'To_Address (TC_Base_Address + 2 * 16#40#),
-- Import, Convention => Ada;
-------------------
-- Internal Data --
-------------------
Interface_Ready : Boolean := False;
--------------------------
-- Expression Functions --
--------------------------
function Interface_Is_Ready return Boolean is
(Interface_Ready);
end Atmel.AT91SAM7S.TC;
|
Fabien-Chouteau/shoot-n-loot | Ada | 278 | ads | -- Shoot'n'loot
-- Copyright (c) 2020 Fabien Chouteau
with PyGamer.Time;
package Game is
function Game_Loop (Time_In_Game : in out PyGamer.Time.Time_Ms)
return Boolean;
-- Return True if the player won the game, False for game-over
end Game;
|
reznikmm/matreshka | Ada | 11,855 | 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.CMOF.Classes;
with AMF.CMOF.Constraints.Collections;
with AMF.CMOF.Data_Types;
with AMF.CMOF.Elements.Collections;
with AMF.CMOF.Named_Elements;
with AMF.CMOF.Namespaces;
with AMF.CMOF.Operations.Collections;
with AMF.CMOF.Packageable_Elements.Collections;
with AMF.CMOF.Parameters.Collections;
with AMF.CMOF.Redefinable_Elements;
with AMF.CMOF.Types.Collections;
with AMF.Internals.CMOF_Namespaces;
pragma Elaborate (AMF.Internals.CMOF_Namespaces);
with AMF.Internals.CMOF_Features;
with AMF.String_Collections;
with AMF.Visitors;
package AMF.Internals.CMOF_Operations is
package Namespaces is
new AMF.Internals.CMOF_Namespaces
(AMF.Internals.CMOF_Features.CMOF_Feature_Proxy);
type CMOF_Operation_Proxy is limited
new Namespaces.CMOF_Namespace_Proxy
and AMF.CMOF.Operations.CMOF_Operation
with null record;
-- XXX These subprograms are stubs
overriding function All_Owned_Elements
(Self : not null access constant CMOF_Operation_Proxy)
return AMF.CMOF.Elements.Collections.Set_Of_CMOF_Element;
overriding function Get_Qualified_Name
(Self : not null access constant CMOF_Operation_Proxy)
return Optional_String;
overriding function Is_Distinguishable_From
(Self : not null access constant CMOF_Operation_Proxy;
N : AMF.CMOF.Named_Elements.CMOF_Named_Element_Access;
Ns : AMF.CMOF.Namespaces.CMOF_Namespace_Access)
return Boolean;
overriding function Imported_Member
(Self : not null access constant CMOF_Operation_Proxy)
return AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element;
overriding function Get_Names_Of_Member
(Self : not null access constant CMOF_Operation_Proxy;
Element : AMF.CMOF.Named_Elements.CMOF_Named_Element_Access)
return AMF.String_Collections.Set_Of_String;
overriding function Import_Members
(Self : not null access constant CMOF_Operation_Proxy;
Imps : AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element)
return AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element;
overriding function Exclude_Collisions
(Self : not null access constant CMOF_Operation_Proxy;
Imps : AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element)
return AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element;
overriding function Members_Are_Distinguishable
(Self : not null access constant CMOF_Operation_Proxy)
return Boolean;
overriding procedure Set_Is_Leaf
(Self : not null access CMOF_Operation_Proxy;
To : Boolean);
overriding function Is_Redefinition_Context_Valid
(Self : not null access constant CMOF_Operation_Proxy;
Redefined : AMF.CMOF.Redefinable_Elements.CMOF_Redefinable_Element_Access)
return Boolean;
overriding function Get_Is_Query
(Self : not null access constant CMOF_Operation_Proxy)
return Boolean;
overriding procedure Set_Is_Query
(Self : not null access CMOF_Operation_Proxy;
To : Boolean);
overriding function Get_Is_Ordered
(Self : not null access constant CMOF_Operation_Proxy)
return Boolean;
overriding procedure Set_Is_Ordered
(Self : not null access CMOF_Operation_Proxy;
To : Boolean);
overriding function Get_Is_Unique
(Self : not null access constant CMOF_Operation_Proxy)
return Boolean;
overriding procedure Set_Is_Unique
(Self : not null access CMOF_Operation_Proxy;
To : Boolean);
overriding function Get_Lower
(Self : not null access constant CMOF_Operation_Proxy)
return Optional_Integer;
overriding procedure Set_Lower
(Self : not null access CMOF_Operation_Proxy;
To : Optional_Integer);
overriding function Get_Upper
(Self : not null access constant CMOF_Operation_Proxy)
return Optional_Unlimited_Natural;
overriding procedure Set_Upper
(Self : not null access CMOF_Operation_Proxy;
To : Optional_Unlimited_Natural);
overriding function Get_Class
(Self : not null access constant CMOF_Operation_Proxy)
return AMF.CMOF.Classes.CMOF_Class_Access;
overriding procedure Set_Class
(Self : not null access CMOF_Operation_Proxy;
To : AMF.CMOF.Classes.CMOF_Class_Access);
overriding function Get_Datatype
(Self : not null access constant CMOF_Operation_Proxy)
return AMF.CMOF.Data_Types.CMOF_Data_Type_Access;
-- Getter of Operation::datatype.
--
-- The DataType that owns this Operation.
overriding procedure Set_Datatype
(Self : not null access CMOF_Operation_Proxy;
To : AMF.CMOF.Data_Types.CMOF_Data_Type_Access);
overriding function Get_Raised_Exception
(Self : not null access constant CMOF_Operation_Proxy)
return AMF.CMOF.Types.Collections.Set_Of_CMOF_Type;
-- Getter of Operation::raisedException.
--
-- References the Types representing exceptions that may be raised during
-- an invocation of this operation.
overriding function Get_Redefined_Operation
(Self : not null access constant CMOF_Operation_Proxy)
return AMF.CMOF.Operations.Collections.Set_Of_CMOF_Operation;
overriding function Get_Type
(Self : not null access constant CMOF_Operation_Proxy)
return AMF.CMOF.Types.CMOF_Type_Access;
-- Getter of Operation::type.
--
-- This information is derived from the return result for this Operation.
overriding procedure Set_Type
(Self : not null access CMOF_Operation_Proxy;
To : AMF.CMOF.Types.CMOF_Type_Access);
overriding function Get_Owned_Parameter
(Self : not null access constant CMOF_Operation_Proxy)
return AMF.CMOF.Parameters.Collections.Ordered_Set_Of_CMOF_Parameter;
overriding function Get_Precondition
(Self : not null access constant CMOF_Operation_Proxy)
return AMF.CMOF.Constraints.Collections.Set_Of_CMOF_Constraint;
-- Getter of Operation::precondition.
overriding function Get_Postcondition
(Self : not null access constant CMOF_Operation_Proxy)
return AMF.CMOF.Constraints.Collections.Set_Of_CMOF_Constraint;
-- Getter of Operation::postcondition.
overriding function Get_Body_Condition
(Self : not null access constant CMOF_Operation_Proxy)
return AMF.CMOF.Constraints.CMOF_Constraint_Access;
-- Getter of Operation::bodyCondition.
overriding procedure Set_Body_Condition
(Self : not null access CMOF_Operation_Proxy;
To : AMF.CMOF.Constraints.CMOF_Constraint_Access);
overriding function Is_Ordered
(Self : not null access constant CMOF_Operation_Proxy)
return Boolean;
overriding function Is_Unique
(Self : not null access constant CMOF_Operation_Proxy)
return Boolean;
overriding function Lower
(Self : not null access constant CMOF_Operation_Proxy)
return Integer;
overriding function Upper
(Self : not null access constant CMOF_Operation_Proxy)
return Unlimited_Natural;
overriding function Is_Consistent_With
(Self : not null access constant CMOF_Operation_Proxy;
Redefinee : AMF.CMOF.Redefinable_Elements.CMOF_Redefinable_Element_Access)
return Boolean;
overriding function Return_Result
(Self : not null access constant CMOF_Operation_Proxy)
return AMF.CMOF.Parameters.Collections.Set_Of_CMOF_Parameter;
overriding function Types
(Self : not null access constant CMOF_Operation_Proxy)
return AMF.CMOF.Types.CMOF_Type_Access;
overriding procedure Enter_Element
(Self : not null access constant CMOF_Operation_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 CMOF_Operation_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 CMOF_Operation_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.CMOF_Operations;
|
Letractively/ada-ado | Ada | 10,197 | adb | -----------------------------------------------------------------------
-- ADO Sqlite Database -- SQLite Database connections
-- Copyright (C) 2009, 2010, 2011, 2012 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Sqlite3_H;
with Interfaces.C.Strings;
with Util.Log;
with Util.Log.Loggers;
with ADO.Statements.Sqlite;
package body ADO.Drivers.Connections.Sqlite is
use Util.Log;
use ADO.Statements.Sqlite;
use Interfaces.C;
pragma Linker_Options ("-lsqlite3");
Log : constant Loggers.Logger := Loggers.Create ("ADO.Databases.Sqlite");
Driver_Name : aliased constant String := "sqlite";
Driver : aliased Sqlite_Driver;
No_Callback : constant Sqlite3_H.sqlite3_callback := null;
-- ------------------------------
-- Get the database driver which manages this connection.
-- ------------------------------
overriding
function Get_Driver (Database : in Database_Connection)
return Driver_Access is
pragma Unreferenced (Database);
begin
return Driver'Access;
end Get_Driver;
-- ------------------------------
-- Check for an error after executing a sqlite statement.
-- ------------------------------
procedure Check_Error (Connection : in Sqlite_Access;
Result : in int) is
begin
if Result /= Sqlite3_H.SQLITE_OK and Result /= Sqlite3_H.SQLITE_DONE then
declare
Error : constant Strings.chars_ptr := Sqlite3_H.sqlite3_errmsg (Connection);
Msg : constant String := Strings.Value (Error);
begin
Log.Error ("Error {0}: {1}", int'Image (Result), Msg);
end;
end if;
end Check_Error;
overriding
function Create_Statement (Database : in Database_Connection;
Table : in ADO.Schemas.Class_Mapping_Access)
return Query_Statement_Access is
begin
return Create_Statement (Database => Database.Server, Table => Table);
end Create_Statement;
overriding
function Create_Statement (Database : in Database_Connection;
Query : in String)
return Query_Statement_Access is
begin
return Create_Statement (Database => Database.Server, Query => Query);
end Create_Statement;
-- ------------------------------
-- Create a delete statement.
-- ------------------------------
overriding
function Create_Statement (Database : in Database_Connection;
Table : in ADO.Schemas.Class_Mapping_Access)
return Delete_Statement_Access is
begin
return Create_Statement (Database => Database.Server, Table => Table);
end Create_Statement;
-- ------------------------------
-- Create an insert statement.
-- ------------------------------
overriding
function Create_Statement (Database : in Database_Connection;
Table : in ADO.Schemas.Class_Mapping_Access)
return Insert_Statement_Access is
begin
return Create_Statement (Database => Database.Server, Table => Table);
end Create_Statement;
-- ------------------------------
-- Create an update statement.
-- ------------------------------
overriding
function Create_Statement (Database : in Database_Connection;
Table : in ADO.Schemas.Class_Mapping_Access)
return Update_Statement_Access is
begin
return Create_Statement (Database => Database.Server, Table => Table);
end Create_Statement;
-- ------------------------------
-- Start a transaction.
-- ------------------------------
procedure Begin_Transaction (Database : in out Database_Connection) is
begin
-- Database.Execute ("begin transaction;");
null;
end Begin_Transaction;
-- ------------------------------
-- Commit the current transaction.
-- ------------------------------
procedure Commit (Database : in out Database_Connection) is
begin
-- Database.Execute ("commit transaction;");
null;
end Commit;
-- ------------------------------
-- Rollback the current transaction.
-- ------------------------------
procedure Rollback (Database : in out Database_Connection) is
begin
-- Database.Execute ("rollback transaction;");
null;
end Rollback;
procedure Sqlite3_Free (Arg1 : Strings.chars_ptr);
pragma Import (C, sqlite3_free, "sqlite3_free");
procedure Execute (Database : in out Database_Connection;
SQL : in Query_String) is
use type Strings.chars_ptr;
SQL_Stat : Strings.chars_ptr := Strings.New_String (SQL);
Result : int;
Error_Msg : Strings.chars_ptr;
begin
Log.Debug ("Execute: {0}", SQL);
for Retry in 1 .. 100 loop
Result := Sqlite3_H.sqlite3_exec (Database.Server, SQL_Stat, No_Callback,
System.Null_Address, Error_Msg'Address);
exit when Result /= Sqlite3_H.SQLITE_BUSY;
delay 0.01 * Retry;
end loop;
Check_Error (Database.Server, Result);
if Error_Msg /= Strings.Null_Ptr then
Log.Error ("Error: {0}", Strings.Value (Error_Msg));
Sqlite3_Free (Error_Msg);
end if;
-- Free
Strings.Free (SQL_Stat);
end Execute;
-- ------------------------------
-- Closes the database connection
-- ------------------------------
overriding
procedure Close (Database : in out Database_Connection) is
pragma Unreferenced (Database);
Result : int;
begin
Log.Info ("Close connection");
-- if Database.Count = 1 then
-- Result := Sqlite3_H.sqlite3_close (Database.Server);
-- Database.Server := System.Null_Address;
-- end if;
pragma Unreferenced (Result);
end Close;
-- ------------------------------
-- Releases the sqlite connection if it is open
-- ------------------------------
overriding
procedure Finalize (Database : in out Database_Connection) is
Result : int;
begin
Log.Debug ("Release connection");
Database.Count := Database.Count - 1;
-- if Database.Count <= 1 then
-- Result := Sqlite3_H.Sqlite3_Close (Database.Server);
-- end if;
-- Database.Server := System.Null_Address;
pragma Unreferenced (Result);
end Finalize;
-- ------------------------------
-- Load the database schema definition for the current database.
-- ------------------------------
overriding
procedure Load_Schema (Database : in Database_Connection;
Schema : out ADO.Schemas.Schema_Definition) is
begin
null;
end Load_Schema;
DB : ADO.Drivers.Connections.Database_Connection_Access := null;
-- ------------------------------
-- Initialize the database connection manager.
-- ------------------------------
procedure Create_Connection (D : in out Sqlite_Driver;
Config : in Configuration'Class;
Result : out ADO.Drivers.Connections.Database_Connection_Access) is
pragma Unreferenced (D);
use Strings;
use type System.Address;
Name : constant String := To_String (Config.Database);
Filename : Strings.chars_ptr;
Status : int;
Handle : aliased System.Address;
Flags : constant int := Sqlite3_H.SQLITE_OPEN_FULLMUTEX + Sqlite3_H.SQLITE_OPEN_READWRITE;
begin
Log.Info ("Opening database {0}", Name);
if DB /= null then
Result := DB;
DB.Count := DB.Count + 1;
return;
end if;
Filename := Strings.New_String (Name);
Status := Sqlite3_H.sqlite3_open_v2 (Filename, Handle'Access,
Flags,
Strings.Null_Ptr);
Strings.Free (Filename);
if Status /= Sqlite3_H.SQLITE_OK then
raise DB_Error;
end if;
declare
Database : constant Database_Connection_Access := new Database_Connection;
procedure Configure (Name, Item : in Util.Properties.Value);
procedure Configure (Name, Item : in Util.Properties.Value) is
SQL : constant String := "PRAGMA " & To_String (Name) & "=" & To_String (Item);
begin
Database.Execute (SQL);
end Configure;
begin
Database.Server := Handle;
Database.Count := 2;
Database.Name := Config.Database;
-- Configure the connection by setting up the SQLite 'pragma X=Y' SQL commands.
-- Typical configuration includes:
-- synchronous=OFF
-- temp_store=MEMORY
-- encoding='UTF-8'
Config.Properties.Iterate (Process => Configure'Access);
Result := Database.all'Access;
DB := Result;
end;
end Create_Connection;
-- ------------------------------
-- Initialize the SQLite driver.
-- ------------------------------
procedure Initialize is
use type Util.Strings.Name_Access;
begin
Log.Debug ("Initializing sqlite driver");
if Driver.Name = null then
Driver.Name := Driver_Name'Access;
Register (Driver'Access);
end if;
end Initialize;
end ADO.Drivers.Connections.Sqlite;
|
charlie5/dynamic_distributed_computing | Ada | 2,135 | adb | with
DDC.Boss,
DDC.Worker.local,
Ada.Text_IO,
Ada.Exceptions;
package body Testbed
is
use DDC,
Ada.Exceptions,
Ada.text_io;
-- 'Server' environment task
--
task boss_Environment
is
entry open;
end boss_Environment;
-- 'Worker 1' environment task
--
task Worker_1_Environment
is
entry open;
end Worker_1_Environment;
-- 'Worker 2' environment task
--
task Worker_2_Environment
is
entry open;
end Worker_2_Environment;
--- Simulate the 'Boss' environment task.
--
task body boss_Environment
is
begin
accept open;
DDC.Boss.calculate;
exception
when the_Error : others =>
put_Line ("testbed boss_Environment task *fatal* exception:");
put_Line (exception_Information (the_Error));
put_Line (exception_Message (the_Error));
end boss_Environment;
--- Simulate the 'Worker 1' environment task.
--
Worker_1 : constant DDC.Worker.local.view := new DDC.Worker.local.item;
task body Worker_1_Environment
is
begin
accept open;
Worker_1.define;
-- Worker_1.destroy;
exception
when the_Error : others =>
put_Line ("testbed Worker 1 task *fatal* exception:");
put_Line (exception_Information (the_Error));
put_Line (exception_Message (the_Error));
end Worker_1_Environment;
--- Simulate the 'Worker 2' environment task.
--
Worker_2 : constant DDC.Worker.local.view := new DDC.Worker.local.item;
task body Worker_2_Environment
is
begin
accept open;
Worker_2.define;
-- Worker_2.destroy;
exception
when the_Error : others =>
put_Line ("testbed Worker 2 task *fatal* exception:");
put_Line (exception_Information (the_Error));
put_Line (exception_Message (the_Error));
end Worker_2_Environment;
procedure open
is
begin
boss_Environment.open;
delay 1.0;
Worker_1_Environment.open;
delay 3.0;
Worker_2_Environment.open;
end open;
end Testbed;
|
reznikmm/matreshka | Ada | 4,631 | 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.Organizations_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Text_Organizations_Attribute_Node is
begin
return Self : Text_Organizations_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_Organizations_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Organizations_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Text_URI,
Matreshka.ODF_String_Constants.Organizations_Attribute,
Text_Organizations_Attribute_Node'Tag);
end Matreshka.ODF_Text.Organizations_Attributes;
|
GPUWorks/lumen2 | Ada | 7,837 | adb |
-- Lumen.Events.Key_Translate -- Translate X11 keysym to Lumen symbol
--
-- Chip Richards, NiEstu, Phoenix AZ, Summer 2010
-- This code is covered by the ISC License:
--
-- Copyright © 2010, NiEstu
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- The software is provided "as is" and the author disclaims all warranties
-- with regard to this software including all implied warranties of
-- merchantability and fitness. In no event shall the author be liable for any
-- special, direct, indirect, or consequential damages or any damages
-- whatsoever resulting from loss of use, data or profits, whether in an
-- action of contract, negligence or other tortious action, arising out of or
-- in connection with the use or performance of this software.
-- Environment
with Ada.Characters.Latin_1;
with Lumen.Events.Keys; use Lumen.Events.Keys;
package body Lumen.Events.Key_Translate is
-- Useful range boundaries and other markers
Lo_Char : constant Key_Symbol :=
Key_Symbol (Character'Pos (Character'First));
Hi_Char : constant Key_Symbol :=
Key_Symbol (Character'Pos (Character'Last));
Lo_Graphic : constant Key_Symbol :=
Key_Symbol (Character'Pos (Ada.Characters.Latin_1.Space));
Lo_Spec_1 : constant Key_Symbol := 16#FF08#; -- X11 backspace
Hi_Spec_1 : constant Key_Symbol := 16#FF1B#; -- X11 escape
Lo_Spec_2 : constant Key_Symbol := Home;
Hi_Spec_2 : constant Key_Symbol := KP_Equal;
Lo_Mod : constant Key_Symbol := Shift_L;
Hi_Mod : constant Key_Symbol := Hyper_R;
Lo_Func : constant Key_Symbol := F1;
Hi_Func : constant Key_Symbol := F35;
Unknown_Symbol : constant Key_Symbol := Key_Symbol'Last;
Self_Symbol : constant Key_Symbol := Key_Symbol'Last - 1;
-- Translation array for specials that turn into Latin-1 control
-- characters, or themselves
type Translation_Target is record
Val : Key_Symbol;
Cat : Key_Category;
end record;
type Special_1_Translation is array (Lo_Spec_1 .. Hi_Spec_1) of
Translation_Target;
Specials_1 : constant Special_1_Translation :=
(
16#FF08# => (Key_Symbol (Character'Pos (Ada.Characters.Latin_1.BS)),
Key_Control),
16#FF09# => (Key_Symbol (Character'Pos (Ada.Characters.Latin_1.HT)),
Key_Control),
16#FF0A# => (Key_Symbol (Character'Pos (Ada.Characters.Latin_1.LF)),
Key_Control),
Clear => (Clear,
Key_Special),
16#FF0D# => (Key_Symbol (Character'Pos (Ada.Characters.Latin_1.CR)),
Key_Control),
Pause => (Pause,
Key_Special),
Scroll_Lock => (Scroll_Lock,
Key_Special),
Sys_Req => (Sys_Req,
Key_Special),
16#FF1B# => (Key_Symbol (Character'Pos (Ada.Characters.Latin_1.ESC)),
Key_Control),
others => (Unknown_Symbol,
Key_Unknown)
);
-- Translation array for specials that turn into themselves; needed because
-- the ranges are discontinuous and have holes
type Special_2_Translation is array (Lo_Spec_2 .. Hi_Spec_2) of Key_Symbol;
Specials_2 : constant Special_2_Translation :=
(
Home => Self_Symbol,
Left => Self_Symbol,
Up => Self_Symbol,
Right => Self_Symbol,
Down => Self_Symbol,
Page_Up => Self_Symbol,
Page_Down => Self_Symbol,
End_Key => Self_Symbol,
Begin_Key => Self_Symbol,
Select_Key => Self_Symbol,
Print => Self_Symbol,
Execute => Self_Symbol,
Insert => Self_Symbol,
Undo => Self_Symbol,
Redo => Self_Symbol,
Menu => Self_Symbol,
Find => Self_Symbol,
Cancel => Self_Symbol,
Help => Self_Symbol,
Break => Self_Symbol,
Mode_Switch => Self_Symbol,
Num_Lock => Self_Symbol,
KP_Space => Self_Symbol,
KP_Tab => Self_Symbol,
KP_Enter => Self_Symbol,
KP_F1 => Self_Symbol,
KP_F2 => Self_Symbol,
KP_F3 => Self_Symbol,
KP_F4 => Self_Symbol,
KP_Home => Self_Symbol,
KP_Left => Self_Symbol,
KP_Up => Self_Symbol,
KP_Right => Self_Symbol,
KP_Down => Self_Symbol,
KP_Page_Up => Self_Symbol,
KP_Page_Down => Self_Symbol,
KP_End => Self_Symbol,
KP_Begin => Self_Symbol,
KP_Insert => Self_Symbol,
KP_Delete => Self_Symbol,
KP_Equal => Self_Symbol,
KP_Multiply => Self_Symbol,
KP_Add => Self_Symbol,
KP_Separator => Self_Symbol,
KP_Subtract => Self_Symbol,
KP_Decimal => Self_Symbol,
KP_Divide => Self_Symbol,
KP_0 => Self_Symbol,
KP_1 => Self_Symbol,
KP_2 => Self_Symbol,
KP_3 => Self_Symbol,
KP_4 => Self_Symbol,
KP_5 => Self_Symbol,
KP_6 => Self_Symbol,
KP_7 => Self_Symbol,
KP_8 => Self_Symbol,
KP_9 => Self_Symbol,
others => Unknown_Symbol
);
-- Translate an X11 keysym to a Lumen symbol and a category. The keysym
-- comes in as a Key_Symbol type, but it's not really one just yet
procedure Keysym_To_Symbol (Incoming : in Key_Symbol;
Outgoing : out Key_Symbol;
Category : out Key_Category) is
begin -- Keysym_To_Symbol
-- Modifiers, like shift, ctrl, alt, etc.
case Incoming is
when Lo_Mod .. Hi_Mod =>
Outgoing := Incoming;
Category := Key_Modifier;
-- Function keys
when Lo_Func .. Hi_Func =>
Outgoing := Incoming;
Category := Key_Function;
-- First group of specials; some actually get translated
when Lo_Spec_1 .. Hi_Spec_1 =>
if Specials_1 (Incoming).Val = Unknown_Symbol then
-- just retain its X11 value, whatever it means;
-- maybe the user will know
Outgoing := Incoming;
Category := Key_Unknown;
else
Outgoing := Specials_1 (Incoming).Val;
Category := Specials_1 (Incoming).Cat;
end if;
-- Second group of specials, which all retain their values
when Lo_Spec_2 .. Hi_Spec_2 =>
Outgoing := Incoming;
if Specials_2 (Incoming) = Unknown_Symbol then
Category := Key_Unknown;
else
Category := Key_Special;
end if;
-- Finally, deal with straight Latin-1 characters; shouldn't get here
-- because we catch them in Events, but just in case
when Lo_Char .. Hi_Char =>
Outgoing := Incoming;
if Incoming < Lo_Graphic or
Incoming = Character'Pos (Ada.Characters.Latin_1.DEL)
then
Category := Key_Control;
else
Category := Key_Graphic;
end if;
-- Any keysym that doesn't meet the above specifications
when others =>
Outgoing := Incoming;
Category := Key_Unknown;
end case;
end Keysym_To_Symbol;
end Lumen.Events.Key_Translate;
|
AdaCore/libadalang | Ada | 286 | ads | generic
type Item_T is private;
First_Item : Item_T;
package GP is
type T is private;
function First (Interval : T) return Item_T;
private
type T is record
First : Item_T;
end record;
function First (Interval : T) return Item_T is (Interval.First);
end GP;
|
PThierry/ewok-kernel | Ada | 10,333 | 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 ada.unchecked_conversion;
with m4.layout;
with m4.scb;
package m4.mpu
with spark_mode => on
is
------------
-- Config --
------------
subtype t_region_number is unsigned_8 range 0 .. 7;
subtype t_region_size is bits_5 range 4 .. 31;
subtype t_region_perm is bits_3;
type t_region_config is record
region_number : t_region_number;
addr : system_address;
size : t_region_size;
access_perm : t_region_perm;
xn : boolean;
b : boolean;
s : boolean;
subregion_mask : unsigned_8; -- 0: sub-region enabled, 1: disabled
end record;
REGION_SIZE_32B : constant t_region_size := 4;
REGION_SIZE_64B : constant t_region_size := 5;
REGION_SIZE_128B : constant t_region_size := 6;
REGION_SIZE_256B : constant t_region_size := 7;
REGION_SIZE_512B : constant t_region_size := 8;
REGION_SIZE_1KB : constant t_region_size := 9;
REGION_SIZE_2KB : constant t_region_size := 10;
REGION_SIZE_4KB : constant t_region_size := 11;
REGION_SIZE_8KB : constant t_region_size := 12;
REGION_SIZE_16KB : constant t_region_size := 13;
REGION_SIZE_32KB : constant t_region_size := 14;
REGION_SIZE_64KB : constant t_region_size := 15;
REGION_SIZE_128KB : constant t_region_size := 16;
REGION_SIZE_256KB : constant t_region_size := 17;
REGION_SIZE_512KB : constant t_region_size := 18;
REGION_SIZE_1MB : constant t_region_size := 19;
REGION_SIZE_2MB : constant t_region_size := 20;
REGION_SIZE_4MB : constant t_region_size := 21;
REGION_SIZE_8MB : constant t_region_size := 22;
REGION_SIZE_16MB : constant t_region_size := 23;
REGION_SIZE_32MB : constant t_region_size := 24;
REGION_SIZE_64MB : constant t_region_size := 25;
REGION_SIZE_128MB : constant t_region_size := 26;
REGION_SIZE_256MB : constant t_region_size := 27;
REGION_SIZE_512MB : constant t_region_size := 28;
REGION_SIZE_1GB : constant t_region_size := 29;
REGION_SIZE_2GB : constant t_region_size := 30;
REGION_SIZE_4GB : constant t_region_size := 31;
-- Access Permissions
-- Note: Describes privileged and user access.
-- For example, REGION_PERM_PRIV_RW_USER_NO means
-- - privileged : read/write access
-- - user : no access
REGION_PERM_PRIV_NO_USER_NO : constant t_region_perm := 2#000#;
REGION_PERM_PRIV_RW_USER_NO : constant t_region_perm := 2#001#;
REGION_PERM_PRIV_RW_USER_RO : constant t_region_perm := 2#010#;
REGION_PERM_PRIV_RW_USER_RW : constant t_region_perm := 2#011#;
REGION_PERM_UNUSED : constant t_region_perm := 2#100#;
REGION_PERM_PRIV_RO_USER_NO : constant t_region_perm := 2#101#;
REGION_PERM_PRIV_RO_USER_RO : constant t_region_perm := 2#110#;
REGION_PERM_PRIV_RO_USER_RO2 : constant t_region_perm := 2#111#;
---------------
-- Functions --
---------------
procedure is_mpu_available
(success : out boolean)
with
inline,
Global => (In_Out => MPU);
procedure enable
with
inline,
global => (in_out => (MPU));
procedure disable
with
inline,
global => (in_out => (MPU));
procedure disable_region
(region_number : in t_region_number)
with
inline,
global => (in_out => (MPU));
-- Only used by SPARK prover
function region_not_rwx(region : t_region_config) return boolean
is (region.xn = true or
region.access_perm = REGION_PERM_PRIV_RO_USER_RO or
region.access_perm = REGION_PERM_PRIV_NO_USER_NO)
with ghost;
procedure init
with
global => (in_out => (MPU, m4.scb.SCB));
procedure enable_unrestricted_kernel_access
with
inline,
global => (in_out => (MPU));
procedure disable_unrestricted_kernel_access
with
inline,
global => (in_out => (MPU));
-- That function is only used by SPARK prover
function get_region_size_mask (size : t_region_size) return unsigned_32
is (2**(natural (size) + 1) - 1)
with ghost;
pragma assertion_policy (pre => IGNORE, post => IGNORE, assert => IGNORE);
pragma warnings (off, "explicit membership test may be optimized");
pragma warnings (off, "condition can only be False if invalid values present");
procedure configure_region
(region : in t_region_config)
with
global => (in_out => (MPU)),
pre =>
(region.region_number in 0 .. 7
and
(region.addr and 2#11111#) = 0
and
region.size >= 4
and
(region.addr and get_region_size_mask(region.size)) = 0)
and region_not_rwx (region);
procedure update_subregion_mask
(region_number : in t_region_number;
subregion_mask : in unsigned_8)
with
inline,
global => (in_out => (MPU));
pragma warnings (on);
-----------------------
-- MPU Type Register --
-----------------------
type t_MPU_TYPE is record
SEPARAT : boolean := true; -- Support for separate instruction and date memory maps
DREGION : unsigned_8 := 8; -- Number of supported MPU data regions
IREGION : unsigned_8 := 0; -- Number of supported MPU instruction regions
end record
with size => 32;
for t_MPU_TYPE use
record
SEPARAT at 0 range 0 .. 0;
DREGION at 0 range 8 .. 15;
IREGION at 0 range 16 .. 23;
end record;
function to_unsigned_32 is new ada.unchecked_conversion
(t_MPU_TYPE, unsigned_32);
--------------------------
-- MPU Control Register --
--------------------------
type t_MPU_CTRL is record
ENABLE : boolean; -- Enables the MPU
HFNMIENA : boolean; -- Enables the operation of MPU during hard fault,
-- NMI, and FAULTMASK handlers
PRIVDEFENA : boolean; -- Enables privileged software access to the
-- default memory map
end record
with size => 32;
for t_MPU_CTRL use record
ENABLE at 0 range 0 .. 0;
HFNMIENA at 0 range 1 .. 1;
PRIVDEFENA at 0 range 2 .. 2;
end record;
--------------------------------
-- MPU Region Number Register --
--------------------------------
type t_MPU_RNR is record
REGION : unsigned_8 range 0 .. 7; -- Indicates the region referenced by
-- MPU_RBAR and MPU_RASR
end record
with size => 32;
for t_MPU_RNR use record
REGION at 0 range 0 .. 7;
end record;
--------------------------------------
-- MPU Region Base Address Register --
--------------------------------------
--
-- Defines the base address of the MPU region selected by the MPU_RNR
--
type t_MPU_RBAR is record
REGION : bits_4 range 0 .. 7;
VALID : boolean;
ADDR : bits_27;
end record
with size => 32;
for t_MPU_RBAR use record
REGION at 0 range 0 .. 3;
VALID at 0 range 4 .. 4;
ADDR at 0 range 5 .. 31;
end record;
function address_to_bits_27 (addr : system_address)
return bits_27
with pre => (addr and 2#11111#) = 0;
--------------------------------------------
-- MPU Region Attribute and Size Register --
--------------------------------------------
type t_MPU_RASR is record
ENABLE : boolean; -- Enable region
SIZE : t_region_size;
SRD : unsigned_8; -- Subregion disable bits (0 = enabled, 1 = disabled)
B : boolean;
C : boolean;
S : boolean; -- Shareable
TEX : bits_3; -- Memory attributes
AP : t_region_perm; -- Permissions
XN : boolean; -- Instruction fetches disabled
end record
with size => 32;
for t_MPU_RASR use record
ENABLE at 0 range 0 .. 0;
SIZE at 0 range 1 .. 5;
SRD at 0 range 8 .. 15;
B at 0 range 16 .. 16;
C at 0 range 17 .. 17;
S at 0 range 18 .. 18;
TEX at 0 range 19 .. 21;
AP at 0 range 24 .. 26;
XN at 0 range 28 .. 28;
end record;
function to_MPU_RASR is new ada.unchecked_conversion
(unsigned_32, t_MPU_RASR);
--------------------
-- MPU peripheral --
--------------------
type t_MPU_peripheral is record
TYPER : t_MPU_TYPE;
CTRL : t_MPU_CTRL;
RNR : t_MPU_RNR;
RBAR : t_MPU_RBAR;
RASR : t_MPU_RASR;
RBAR_A1 : t_MPU_RBAR;
RASR_A1 : t_MPU_RASR;
RBAR_A2 : t_MPU_RBAR;
RASR_A2 : t_MPU_RASR;
RBAR_A3 : t_MPU_RBAR;
RASR_A3 : t_MPU_RASR;
end record;
for t_MPU_peripheral use record
TYPER at 16#00# range 0 .. 31;
CTRL at 16#04# range 0 .. 31;
RNR at 16#08# range 0 .. 31;
RBAR at 16#0C# range 0 .. 31;
RASR at 16#10# range 0 .. 31;
RBAR_A1 at 16#14# range 0 .. 31;
RASR_A1 at 16#18# range 0 .. 31;
RBAR_A2 at 16#1C# range 0 .. 31;
RASR_A2 at 16#20# range 0 .. 31;
RBAR_A3 at 16#24# range 0 .. 31;
RASR_A3 at 16#28# range 0 .. 31;
end record;
----------------
-- Peripheral --
----------------
MPU : t_MPU_peripheral
with
import,
volatile,
address => m4.layout.MPU_base;
end m4.mpu;
|
jhumphry/PRNG_Zoo | Ada | 4,442 | adb | --
-- PRNG Zoo
-- Copyright (c) 2014 - 2015, James Humphry
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
-- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
-- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-- PERFORMANCE OF THIS SOFTWARE.
package body PRNG_Zoo.Distributions is
--------------
-- Generate --
--------------
function Generate (D: in out Uniform01; G : in out PRNG'Class) return Float_Type is
pragma Unreferenced (D);
X : constant U64 := Generate_Padded(G);
begin
return Float_Type(X) * scale;
end Generate;
--------------
-- Generate --
--------------
function Generate (D: in out Uniform; G : in out PRNG'Class) return Float_Type is
X : constant U64 := Generate_Padded(G);
begin
return D.a + D.b * Float_Type(X) * scale;
end Generate;
--------------
-- Generate --
--------------
function Generate (D: in out Normal_12_6; G : in out PRNG'Class) return Float_Type is
pragma Unreferenced (D);
Result : Float_Type := 0.0;
X : U64;
begin
for I in 1..12 loop
X := Generate_Padded(G);
Result := Result + Float_Type(X) * scale;
end loop;
return Result - 6.0;
end Generate;
-----------
-- Reset --
-----------
procedure Reset (D: in out Normal_Box_Mueller) is
begin
D.Loaded := False;
end Reset;
--------------
-- Generate --
--------------
function Generate (D: in out Normal_Box_Mueller; G : in out PRNG'Class) return Float_Type is
t1, t2 : Float_Type;
s : Float_Type;
ss : Float_Type;
X, Y : U64;
begin
if D.Loaded then
D.Loaded := False;
return D.r2;
end if;
loop
X := Generate_Padded(G);
Y := Generate_Padded(G);
t1 := 2.0 * Float_Type(X) * scale - 1.0;
t2 := 2.0 * Float_Type(Y) * scale - 1.0;
s := t1*t1 + t2*t2;
exit when s <= 1.0;
end loop;
ss := Sqrt(-2.0 * Log(s + Float_Type'Model_Small) / s);
D.Loaded := True;
D.r2 := t2 * ss;
return t1 * ss;
end Generate;
--------------
-- Generate --
--------------
function Generate (D: in out Normal_Monty_Python; G : in out PRNG'Class) return Float_Type is
pragma Unreferenced (D);
a : constant Float_Type := 1.17741_00225_15474_69101; -- sqrt(log(4))
b : constant Float_Type := 2.50662_82746_31000_50240; -- sqrt(2*pi)
s : constant Float_Type := 0.88579_13443_79721_11687; -- a / (b-a)
b_recip : constant Float_Type := 0.39894_22804_01432_67793; -- 1/b
log_norm_c : constant Float_Type := -0.22579_13526_44727_43236; -- log(2/sqrt(2*pi))
v : constant U64 := Generate_Padded(G);
sign : constant Float_Type := (if (v and 1) = 1 then +1.0 else -1.0);
x : Float_Type := Float_Type(v) * scale * b;
y : Float_Type;
TX, TY : U64;
begin
if x < a then
return x * sign;
end if;
TX := Generate_Padded(G);
y := Float_Type(TX) * scale * b_recip;
if Log(y) < (log_norm_c - 0.5 * x * x) then
return x * sign;
end if;
x := s*(b-x);
y := b_recip + ( b_recip - y) / s;
if Log(y) < (log_norm_c - 0.5 * x * x) then
return x * sign;
end if;
loop
TX:= Generate_Padded(G);
TY:= Generate_Padded(G);
x := -Log(Float_Type(TX) * scale) * b_recip;
y := -Log(Float_Type(TY) * scale);
exit when y+y > x*x;
end loop;
return (b + x) * sign;
end Generate;
--------------
-- Generate --
--------------
function Generate (D: in out Exponential; G : in out PRNG'Class) return Float_Type is
X : constant U64 := Generate_Padded(G);
begin
return -D.theta * Log(Float_Type(X) * scale + Float_Type'Model_Small);
end Generate;
end PRNG_Zoo.Distributions;
|
xeenta/learning-ada | Ada | 260 | adb | with Person;
with Ada.Text_IO; use Ada.Text_IO;
package body A is
procedure Print_Modify is
package I is new Ada.Text_IO.Integer_IO (Integer);
begin
I.Put (Person.Unit_Age); New_Line;
Person.Unit_Age := 10;
end Print_Modify;
end A;
|
reznikmm/matreshka | Ada | 4,131 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Style_Font_Family_Generic_Asian_Attributes;
package Matreshka.ODF_Style.Font_Family_Generic_Asian_Attributes is
type Style_Font_Family_Generic_Asian_Attribute_Node is
new Matreshka.ODF_Style.Abstract_Style_Attribute_Node
and ODF.DOM.Style_Font_Family_Generic_Asian_Attributes.ODF_Style_Font_Family_Generic_Asian_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Style_Font_Family_Generic_Asian_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Style_Font_Family_Generic_Asian_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Style.Font_Family_Generic_Asian_Attributes;
|
burratoo/Acton | Ada | 2,174 | adb | ------------------------------------------------------------------------------------------
-- --
-- OAK PROCESSOR SUPPORT PACKAGE --
-- ATMEL AT91SAM7S --
-- --
-- OAK.PROCESSOR_SUPPORT_PACKAGE.TIME.INTERRUPT --
-- --
-- Copyright (C) 2014-2021, Patrick Bernardi --
-- --
------------------------------------------------------------------------------------------
with Atmel.AT91SAM7S; use Atmel.AT91SAM7S;
with Atmel.AT91SAM7S.AIC; use Atmel.AT91SAM7S.AIC;
with Atmel.AT91SAM7S.PIT; use Atmel.AT91SAM7S.PIT;
with ISA.ARM.ARM7TDMI; use ISA.ARM.ARM7TDMI;
with System; use System;
with System.Machine_Code; use System.Machine_Code;
package body Oak.Processor_Support_Package.Time.Interrupt is
procedure Update_Clock is
Ack : Address with Unreferenced;
PIT_Value : Timer_Value_Type with Unreferenced;
begin
PIT_Value := Periodic_Interval_Timer_Value_Register;
Interrupt_Clear_Command_Register.Clear_Interrupt :=
(P_FIQ => True, P_SYSC => True, others => False);
Internal_Clock := Internal_Clock + 1;
if Alarm_Armed and then Internal_Clock > Alarm_Time
and then not Saved_Program_Status_Register.IRQ_Disable
then
-- Branch via instruction rather than procedure call to ensure
-- bl instruction is not used
Alarm_Armed := False;
Asm ("b oak__core_support_package__interrupts__decrementer_interrupt",
Volatile => True);
end if;
-- Return from interrupt
Asm ("subs pc, r14, #4", Volatile => True);
end Update_Clock;
end Oak.Processor_Support_Package.Time.Interrupt;
|
stcarrez/ada-ado | Ada | 50,823 | adb | -----------------------------------------------------------------------
-- Regtests.Simple.Model -- Regtests.Simple.Model
-----------------------------------------------------------------------
-- File generated by Dynamo DO NOT MODIFY
-- Template used: templates/model/package-body.xhtml
-- Ada Generator: https://github.com/stcarrez/dynamo Version 1.4.0
-----------------------------------------------------------------------
-- Copyright (C) 2022 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
pragma Warnings (Off);
with Ada.Unchecked_Deallocation;
pragma Warnings (On);
package body Regtests.Simple.Model is
pragma Style_Checks ("-mrIu");
pragma Warnings (Off, "formal parameter * is not referenced");
pragma Warnings (Off, "use clause for type *");
pragma Warnings (Off, "use clause for private type *");
use type ADO.Objects.Object_Record_Access;
use type ADO.Objects.Object_Ref;
function Allocate_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => ALLOCATE_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Allocate_Key;
function Allocate_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => ALLOCATE_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Allocate_Key;
function "=" (Left, Right : Allocate_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out Allocate_Ref'Class;
Impl : out Allocate_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := Allocate_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Allocate_Ref) is
Impl : Allocate_Access;
begin
Impl := new Allocate_Impl;
Impl.Version := 0;
Impl.Name.Is_Null := True;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: Allocate
-- ----------------------------------------
procedure Set_Id (Object : in out Allocate_Ref;
Value : in ADO.Identifier) is
Impl : Allocate_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
function Get_Id (Object : in Allocate_Ref)
return ADO.Identifier is
Impl : constant Allocate_Access
:= Allocate_Impl (Object.Get_Object.all)'Access;
begin
return Impl.Get_Key_Value;
end Get_Id;
function Get_Version (Object : in Allocate_Ref)
return Integer is
Impl : constant Allocate_Access
:= Allocate_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Version;
end Get_Version;
procedure Set_Name (Object : in out Allocate_Ref;
Value : in String) is
Impl : Allocate_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 3, Impl.Name, Value);
end Set_Name;
procedure Set_Name (Object : in out Allocate_Ref;
Value : in ADO.Nullable_String) is
Impl : Allocate_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 3, Impl.Name, Value);
end Set_Name;
function Get_Name (Object : in Allocate_Ref)
return String is
Value : constant ADO.Nullable_String := Object.Get_Name;
begin
if Value.Is_Null then
return "";
else
return Ada.Strings.Unbounded.To_String (Value.Value);
end if;
end Get_Name;
function Get_Name (Object : in Allocate_Ref)
return ADO.Nullable_String is
Impl : constant Allocate_Access
:= Allocate_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Name;
end Get_Name;
-- Copy of the object.
procedure Copy (Object : in Allocate_Ref;
Into : in out Allocate_Ref) is
Result : Allocate_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Allocate_Access
:= Allocate_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Allocate_Access
:= new Allocate_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Version := Impl.Version;
Copy.Name := Impl.Name;
end;
end if;
Into := Result;
end Copy;
overriding
procedure Find (Object : in out Allocate_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant Allocate_Access := new Allocate_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out Allocate_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier) is
Impl : constant Allocate_Access := new Allocate_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out Allocate_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean) is
Impl : constant Allocate_Access := new Allocate_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
procedure Reload (Object : in out Allocate_Ref;
Session : in out ADO.Sessions.Session'Class;
Updated : out Boolean) is
Result : ADO.Objects.Object_Record_Access;
Impl : Allocate_Access;
Query : ADO.SQL.Query;
Id : ADO.Identifier;
begin
if Object.Is_Null then
raise ADO.Objects.NULL_ERROR;
end if;
Object.Prepare_Modify (Result);
Impl := Allocate_Impl (Result.all)'Access;
Id := ADO.Objects.Get_Key_Value (Impl.all);
Query.Bind_Param (Position => 1, Value => Id);
Query.Bind_Param (Position => 2, Value => Impl.Version);
Query.Set_Filter ("id = ? AND version != ?");
declare
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, ALLOCATE_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Updated := True;
Impl.Load (Stmt, Session);
else
Updated := False;
end if;
end;
end Reload;
overriding
procedure Save (Object : in out Allocate_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new Allocate_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
overriding
procedure Delete (Object : in out Allocate_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
overriding
procedure Destroy (Object : access Allocate_Impl) is
type Allocate_Impl_Ptr is access all Allocate_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Allocate_Impl, Allocate_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Allocate_Impl_Ptr := Allocate_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
overriding
procedure Find (Object : in out Allocate_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, ALLOCATE_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Allocate_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant ADO.Identifier := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
overriding
procedure Save (Object : in out Allocate_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (ALLOCATE_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_1_NAME, -- ID
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (3) then
Stmt.Save_Field (Name => COL_2_1_NAME, -- NAME
Value => Object.Name);
Object.Clear_Modified (3);
end if;
if Stmt.Has_Save_Fields then
Object.Version := Object.Version + 1;
Stmt.Save_Field (Name => "version",
Value => Object.Version);
Stmt.Set_Filter (Filter => "id = ? and version = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Add_Param (Value => Object.Version - 1);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
else
raise ADO.Objects.LAZY_LOCK;
end if;
end if;
end;
end if;
end Save;
overriding
procedure Create (Object : in out Allocate_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (ALLOCATE_DEF'Access);
Result : Integer;
begin
Object.Version := 1;
Session.Allocate (Id => Object);
Query.Save_Field (Name => COL_0_1_NAME, -- ID
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_1_NAME, -- version
Value => Object.Version);
Query.Save_Field (Name => COL_2_1_NAME, -- NAME
Value => Object.Name);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
end Create;
overriding
procedure Delete (Object : in out Allocate_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (ALLOCATE_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Allocate_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access Allocate_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := Allocate_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "name" then
if Impl.Name.Is_Null then
return Util.Beans.Objects.Null_Object;
else
return Util.Beans.Objects.To_Object (Impl.Name.Value);
end if;
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
procedure List (Object : in out Allocate_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, ALLOCATE_DEF'Access);
begin
Stmt.Execute;
Allocate_Vectors.Clear (Object);
while Stmt.Has_Elements loop
declare
Item : Allocate_Ref;
Impl : constant Allocate_Access := new Allocate_Impl;
begin
Impl.Load (Stmt, Session);
ADO.Objects.Set_Object (Item, Impl.all'Access);
Object.Append (Item);
end;
Stmt.Next;
end loop;
end List;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out Allocate_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
pragma Unreferenced (Session);
begin
Object.Set_Key_Value (Stmt.Get_Identifier (0));
Object.Name := Stmt.Get_Nullable_String (2);
Object.Version := Stmt.Get_Integer (1);
ADO.Objects.Set_Created (Object);
end Load;
function Keys_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_STRING,
Of_Class => KEYS_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Keys_Key;
function Keys_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_STRING,
Of_Class => KEYS_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Keys_Key;
function "=" (Left, Right : Keys_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out Keys_Ref'Class;
Impl : out Keys_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := Keys_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Keys_Ref) is
Impl : Keys_Access;
begin
Impl := new Keys_Impl;
Impl.Version := 0;
Impl.Name.Is_Null := True;
Impl.Cost := 0.0;
Impl.Total := 0.0;
Impl.User := ADO.NO_IDENTIFIER;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: Keys
-- ----------------------------------------
procedure Set_Id (Object : in out Keys_Ref;
Value : in String) is
Impl : Keys_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
procedure Set_Id (Object : in out Keys_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : Keys_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
function Get_Id (Object : in Keys_Ref)
return String is
begin
return Ada.Strings.Unbounded.To_String (Object.Get_Id);
end Get_Id;
function Get_Id (Object : in Keys_Ref)
return Ada.Strings.Unbounded.Unbounded_String is
Impl : constant Keys_Access
:= Keys_Impl (Object.Get_Object.all)'Access;
begin
return Impl.Get_Key_Value;
end Get_Id;
function Get_Version (Object : in Keys_Ref)
return Integer is
Impl : constant Keys_Access
:= Keys_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Version;
end Get_Version;
procedure Set_Name (Object : in out Keys_Ref;
Value : in String) is
Impl : Keys_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 3, Impl.Name, Value);
end Set_Name;
procedure Set_Name (Object : in out Keys_Ref;
Value : in ADO.Nullable_String) is
Impl : Keys_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 3, Impl.Name, Value);
end Set_Name;
function Get_Name (Object : in Keys_Ref)
return String is
Value : constant ADO.Nullable_String := Object.Get_Name;
begin
if Value.Is_Null then
return "";
else
return Ada.Strings.Unbounded.To_String (Value.Value);
end if;
end Get_Name;
function Get_Name (Object : in Keys_Ref)
return ADO.Nullable_String is
Impl : constant Keys_Access
:= Keys_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Name;
end Get_Name;
procedure Set_Cost (Object : in out Keys_Ref;
Value : in Float) is
Impl : Keys_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Float (Impl.all, 4, Impl.Cost, Value);
end Set_Cost;
function Get_Cost (Object : in Keys_Ref)
return Float is
Impl : constant Keys_Access
:= Keys_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Cost;
end Get_Cost;
procedure Set_Total (Object : in out Keys_Ref;
Value : in Long_Float) is
Impl : Keys_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Long_Float (Impl.all, 5, Impl.Total, Value);
end Set_Total;
function Get_Total (Object : in Keys_Ref)
return Long_Float is
Impl : constant Keys_Access
:= Keys_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Total;
end Get_Total;
procedure Set_User (Object : in out Keys_Ref;
Value : in ADO.Identifier) is
Impl : Keys_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Identifier (Impl.all, 6, Impl.User, Value);
end Set_User;
function Get_User (Object : in Keys_Ref)
return ADO.Identifier is
Impl : constant Keys_Access
:= Keys_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.User;
end Get_User;
procedure Set_Second_Key (Object : in out Keys_Ref;
Value : in String) is
Impl : Keys_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 7, Impl.Second_Key, Value);
end Set_Second_Key;
procedure Set_Second_Key (Object : in out Keys_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : Keys_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Unbounded_String (Impl.all, 7, Impl.Second_Key, Value);
end Set_Second_Key;
function Get_Second_Key (Object : in Keys_Ref)
return String is
begin
return Ada.Strings.Unbounded.To_String (Object.Get_Second_Key);
end Get_Second_Key;
function Get_Second_Key (Object : in Keys_Ref)
return Ada.Strings.Unbounded.Unbounded_String is
Impl : constant Keys_Access
:= Keys_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Second_Key;
end Get_Second_Key;
-- Copy of the object.
procedure Copy (Object : in Keys_Ref;
Into : in out Keys_Ref) is
Result : Keys_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Keys_Access
:= Keys_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Keys_Access
:= new Keys_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Version := Impl.Version;
Copy.Name := Impl.Name;
Copy.Cost := Impl.Cost;
Copy.Total := Impl.Total;
Copy.User := Impl.User;
Copy.Second_Key := Impl.Second_Key;
end;
end if;
Into := Result;
end Copy;
overriding
procedure Find (Object : in out Keys_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant Keys_Access := new Keys_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out Keys_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : constant Keys_Access := new Keys_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out Keys_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in Ada.Strings.Unbounded.Unbounded_String;
Found : out Boolean) is
Impl : constant Keys_Access := new Keys_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
procedure Reload (Object : in out Keys_Ref;
Session : in out ADO.Sessions.Session'Class;
Updated : out Boolean) is
Result : ADO.Objects.Object_Record_Access;
Impl : Keys_Access;
Query : ADO.SQL.Query;
Id : Ada.Strings.Unbounded.Unbounded_String;
begin
if Object.Is_Null then
raise ADO.Objects.NULL_ERROR;
end if;
Object.Prepare_Modify (Result);
Impl := Keys_Impl (Result.all)'Access;
Id := ADO.Objects.Get_Key_Value (Impl.all);
Query.Bind_Param (Position => 1, Value => Id);
Query.Bind_Param (Position => 2, Value => Impl.Version);
Query.Set_Filter ("id = ? AND version != ?");
declare
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, KEYS_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Updated := True;
Impl.Load (Stmt, Session);
else
Updated := False;
end if;
end;
end Reload;
overriding
procedure Save (Object : in out Keys_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new Keys_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
overriding
procedure Delete (Object : in out Keys_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
overriding
procedure Destroy (Object : access Keys_Impl) is
type Keys_Impl_Ptr is access all Keys_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Keys_Impl, Keys_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Keys_Impl_Ptr := Keys_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
overriding
procedure Find (Object : in out Keys_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, KEYS_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Keys_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant Ada.Strings.Unbounded.Unbounded_String := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
overriding
procedure Save (Object : in out Keys_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (KEYS_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_2_NAME, -- ID
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (3) then
Stmt.Save_Field (Name => COL_2_2_NAME, -- NAME
Value => Object.Name);
Object.Clear_Modified (3);
end if;
if Object.Is_Modified (4) then
Stmt.Save_Field (Name => COL_3_2_NAME, -- cost
Value => Object.Cost);
Object.Clear_Modified (4);
end if;
if Object.Is_Modified (5) then
Stmt.Save_Field (Name => COL_4_2_NAME, -- total
Value => Object.Total);
Object.Clear_Modified (5);
end if;
if Object.Is_Modified (6) then
Stmt.Save_Field (Name => COL_5_2_NAME, -- user_id
Value => Object.User);
Object.Clear_Modified (6);
end if;
if Object.Is_Modified (7) then
Stmt.Save_Field (Name => COL_6_2_NAME, -- key_id
Value => Object.Second_Key);
Object.Clear_Modified (7);
end if;
if Stmt.Has_Save_Fields then
Object.Version := Object.Version + 1;
Stmt.Save_Field (Name => "version",
Value => Object.Version);
Stmt.Set_Filter (Filter => "id = ? and version = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Add_Param (Value => Object.Version - 1);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
else
raise ADO.Objects.LAZY_LOCK;
end if;
end if;
end;
end if;
end Save;
overriding
procedure Create (Object : in out Keys_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (KEYS_DEF'Access);
Result : Integer;
begin
Object.Version := 1;
Session.Allocate (Id => Object);
Query.Save_Field (Name => COL_0_2_NAME, -- ID
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_2_NAME, -- version
Value => Object.Version);
Query.Save_Field (Name => COL_2_2_NAME, -- NAME
Value => Object.Name);
Query.Save_Field (Name => COL_3_2_NAME, -- cost
Value => Object.Cost);
Query.Save_Field (Name => COL_4_2_NAME, -- total
Value => Object.Total);
Query.Save_Field (Name => COL_5_2_NAME, -- user_id
Value => Object.User);
Query.Save_Field (Name => COL_6_2_NAME, -- key_id
Value => Object.Second_Key);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
end Create;
overriding
procedure Delete (Object : in out Keys_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (KEYS_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Keys_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access Keys_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := Keys_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "name" then
if Impl.Name.Is_Null then
return Util.Beans.Objects.Null_Object;
else
return Util.Beans.Objects.To_Object (Impl.Name.Value);
end if;
elsif Name = "cost" then
return Util.Beans.Objects.To_Object (Impl.Cost);
elsif Name = "total" then
return Util.Beans.Objects.To_Object (Impl.Total);
elsif Name = "user" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.User));
elsif Name = "second_key" then
return Util.Beans.Objects.To_Object (Impl.Second_Key);
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
procedure List (Object : in out Keys_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, KEYS_DEF'Access);
begin
Stmt.Execute;
Keys_Vectors.Clear (Object);
while Stmt.Has_Elements loop
declare
Item : Keys_Ref;
Impl : constant Keys_Access := new Keys_Impl;
begin
Impl.Load (Stmt, Session);
ADO.Objects.Set_Object (Item, Impl.all'Access);
Object.Append (Item);
end;
Stmt.Next;
end loop;
end List;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out Keys_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
begin
Object.Set_Key_Value (Stmt.Get_Unbounded_String (0));
Object.Name := Stmt.Get_Nullable_String (2);
Object.Cost := Stmt.Get_Float (3);
Object.Total := Stmt.Get_Long_Float (4);
Object.User := Stmt.Get_Identifier (5);
Object.Second_Key := Stmt.Get_Unbounded_String (6);
Object.Version := Stmt.Get_Integer (1);
ADO.Objects.Set_Created (Object);
end Load;
function User_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => USER_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end User_Key;
function User_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => USER_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end User_Key;
function "=" (Left, Right : User_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out User_Ref'Class;
Impl : out User_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := User_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out User_Ref) is
Impl : User_Access;
begin
Impl := new User_Impl;
Impl.Version := 0;
Impl.Value := ADO.NO_IDENTIFIER;
Impl.Name.Is_Null := True;
Impl.Select_Name.Is_Null := True;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: User
-- ----------------------------------------
procedure Set_Id (Object : in out User_Ref;
Value : in ADO.Identifier) is
Impl : User_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
function Get_Id (Object : in User_Ref)
return ADO.Identifier is
Impl : constant User_Access
:= User_Impl (Object.Get_Object.all)'Access;
begin
return Impl.Get_Key_Value;
end Get_Id;
function Get_Version (Object : in User_Ref)
return Integer is
Impl : constant User_Access
:= User_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Version;
end Get_Version;
procedure Set_Value (Object : in out User_Ref;
Value : in ADO.Identifier) is
Impl : User_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Identifier (Impl.all, 3, Impl.Value, Value);
end Set_Value;
function Get_Value (Object : in User_Ref)
return ADO.Identifier is
Impl : constant User_Access
:= User_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Value;
end Get_Value;
procedure Set_Name (Object : in out User_Ref;
Value : in String) is
Impl : User_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 4, Impl.Name, Value);
end Set_Name;
procedure Set_Name (Object : in out User_Ref;
Value : in ADO.Nullable_String) is
Impl : User_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 4, Impl.Name, Value);
end Set_Name;
function Get_Name (Object : in User_Ref)
return String is
Value : constant ADO.Nullable_String := Object.Get_Name;
begin
if Value.Is_Null then
return "";
else
return Ada.Strings.Unbounded.To_String (Value.Value);
end if;
end Get_Name;
function Get_Name (Object : in User_Ref)
return ADO.Nullable_String is
Impl : constant User_Access
:= User_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Name;
end Get_Name;
procedure Set_Select_Name (Object : in out User_Ref;
Value : in String) is
Impl : User_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 5, Impl.Select_Name, Value);
end Set_Select_Name;
procedure Set_Select_Name (Object : in out User_Ref;
Value : in ADO.Nullable_String) is
Impl : User_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 5, Impl.Select_Name, Value);
end Set_Select_Name;
function Get_Select_Name (Object : in User_Ref)
return String is
Value : constant ADO.Nullable_String := Object.Get_Select_Name;
begin
if Value.Is_Null then
return "";
else
return Ada.Strings.Unbounded.To_String (Value.Value);
end if;
end Get_Select_Name;
function Get_Select_Name (Object : in User_Ref)
return ADO.Nullable_String is
Impl : constant User_Access
:= User_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Select_Name;
end Get_Select_Name;
-- Copy of the object.
procedure Copy (Object : in User_Ref;
Into : in out User_Ref) is
Result : User_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant User_Access
:= User_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant User_Access
:= new User_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Version := Impl.Version;
Copy.Value := Impl.Value;
Copy.Name := Impl.Name;
Copy.Select_Name := Impl.Select_Name;
end;
end if;
Into := Result;
end Copy;
overriding
procedure Find (Object : in out User_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant User_Access := new User_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out User_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier) is
Impl : constant User_Access := new User_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out User_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean) is
Impl : constant User_Access := new User_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
procedure Reload (Object : in out User_Ref;
Session : in out ADO.Sessions.Session'Class;
Updated : out Boolean) is
Result : ADO.Objects.Object_Record_Access;
Impl : User_Access;
Query : ADO.SQL.Query;
Id : ADO.Identifier;
begin
if Object.Is_Null then
raise ADO.Objects.NULL_ERROR;
end if;
Object.Prepare_Modify (Result);
Impl := User_Impl (Result.all)'Access;
Id := ADO.Objects.Get_Key_Value (Impl.all);
Query.Bind_Param (Position => 1, Value => Id);
Query.Bind_Param (Position => 2, Value => Impl.Version);
Query.Set_Filter ("id = ? AND version != ?");
declare
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, USER_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Updated := True;
Impl.Load (Stmt, Session);
else
Updated := False;
end if;
end;
end Reload;
overriding
procedure Save (Object : in out User_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new User_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
overriding
procedure Delete (Object : in out User_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
overriding
procedure Destroy (Object : access User_Impl) is
type User_Impl_Ptr is access all User_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(User_Impl, User_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : User_Impl_Ptr := User_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
overriding
procedure Find (Object : in out User_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, USER_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out User_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant ADO.Identifier := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
overriding
procedure Save (Object : in out User_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (USER_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_3_NAME, -- ID
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (3) then
Stmt.Save_Field (Name => COL_2_3_NAME, -- VALUE
Value => Object.Value);
Object.Clear_Modified (3);
end if;
if Object.Is_Modified (4) then
Stmt.Save_Field (Name => COL_3_3_NAME, -- NAME
Value => Object.Name);
Object.Clear_Modified (4);
end if;
if Object.Is_Modified (5) then
Stmt.Save_Field (Name => COL_4_3_NAME, -- select
Value => Object.Select_Name);
Object.Clear_Modified (5);
end if;
if Stmt.Has_Save_Fields then
Object.Version := Object.Version + 1;
Stmt.Save_Field (Name => "version",
Value => Object.Version);
Stmt.Set_Filter (Filter => "id = ? and version = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Add_Param (Value => Object.Version - 1);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
else
raise ADO.Objects.LAZY_LOCK;
end if;
end if;
end;
end if;
end Save;
overriding
procedure Create (Object : in out User_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (USER_DEF'Access);
Result : Integer;
begin
Object.Version := 1;
Session.Allocate (Id => Object);
Query.Save_Field (Name => COL_0_3_NAME, -- ID
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_3_NAME, -- version
Value => Object.Version);
Query.Save_Field (Name => COL_2_3_NAME, -- VALUE
Value => Object.Value);
Query.Save_Field (Name => COL_3_3_NAME, -- NAME
Value => Object.Name);
Query.Save_Field (Name => COL_4_3_NAME, -- select
Value => Object.Select_Name);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
end Create;
overriding
procedure Delete (Object : in out User_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (USER_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in User_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access User_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := User_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "value" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Value));
elsif Name = "name" then
if Impl.Name.Is_Null then
return Util.Beans.Objects.Null_Object;
else
return Util.Beans.Objects.To_Object (Impl.Name.Value);
end if;
elsif Name = "select_name" then
if Impl.Select_Name.Is_Null then
return Util.Beans.Objects.Null_Object;
else
return Util.Beans.Objects.To_Object (Impl.Select_Name.Value);
end if;
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
procedure List (Object : in out User_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, USER_DEF'Access);
begin
Stmt.Execute;
User_Vectors.Clear (Object);
while Stmt.Has_Elements loop
declare
Item : User_Ref;
Impl : constant User_Access := new User_Impl;
begin
Impl.Load (Stmt, Session);
ADO.Objects.Set_Object (Item, Impl.all'Access);
Object.Append (Item);
end;
Stmt.Next;
end loop;
end List;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out User_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
pragma Unreferenced (Session);
begin
Object.Set_Key_Value (Stmt.Get_Identifier (0));
Object.Value := Stmt.Get_Identifier (2);
Object.Name := Stmt.Get_Nullable_String (3);
Object.Select_Name := Stmt.Get_Nullable_String (4);
Object.Version := Stmt.Get_Integer (1);
ADO.Objects.Set_Created (Object);
end Load;
end Regtests.Simple.Model;
|
sungyeon/drake | Ada | 36 | adb | ../machine-apple-darwin/s-natcal.adb |
reznikmm/matreshka | Ada | 4,557 | 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_Fo.Height_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Fo_Height_Attribute_Node is
begin
return Self : Fo_Height_Attribute_Node do
Matreshka.ODF_Fo.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Fo_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Fo_Height_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Height_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Fo_URI,
Matreshka.ODF_String_Constants.Height_Attribute,
Fo_Height_Attribute_Node'Tag);
end Matreshka.ODF_Fo.Height_Attributes;
|
francesco-bongiovanni/ewok-kernel | Ada | 4,919 | 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 system;
package soc.exti
with spark_mode => on
is
subtype t_exti_line_index is natural range 0 .. 22;
-- Initialize EXTI by enabling SYSCFG.APB2 clock
procedure init;
function is_line_pending
(line : t_exti_line_index)
return boolean;
procedure clear_pending
(line : in t_exti_line_index);
procedure enable
(line : in t_exti_line_index);
procedure disable
(line : in t_exti_line_index);
function is_enabled
(line : in t_exti_line_index)
return boolean;
type t_mask is (MASKED, NOT_MASKED) with size => 1;
for t_mask use (MASKED => 0, NOT_MASKED => 1);
type t_masks is array (t_exti_line_index) of t_mask
with volatile_components, pack, size => 23;
----------------------------------------
-- Interrupt mask register (EXTI_IMR) --
----------------------------------------
type t_EXTI_IMR is record
line : t_masks;
end record
with volatile_full_access, size => 32;
for t_EXTI_IMR use record
line at 0 range 0 .. 22;
end record;
------------------------------------
-- Event mask register (EXTI_EMR) --
------------------------------------
type t_EXTI_EMR is record
line : t_masks;
end record
with volatile_full_access, size => 32;
for t_EXTI_EMR use record
line at 0 range 0 .. 22;
end record;
---------------------------------------------------
-- Rising trigger selection register (EXTI_RTSR) --
---------------------------------------------------
type t_trigger is (TRIGGER_DISABLED, TRIGGER_ENABLED) with size => 1;
for t_trigger use (TRIGGER_DISABLED => 0, TRIGGER_ENABLED => 1);
type t_triggers is array (t_exti_line_index) of t_trigger
with pack, size => 23;
type t_EXTI_RTSR is record
line : t_triggers;
end record
with volatile_full_access, size => 32;
for t_EXTI_RTSR use record
line at 0 range 0 .. 22;
end record;
----------------------------------------------------
-- Falling trigger selection register (EXTI_FTSR) --
----------------------------------------------------
type t_EXTI_FTSR is record
line : t_triggers;
end record
with volatile_full_access, size => 32;
for t_EXTI_FTSR use record
line at 0 range 0 .. 22;
end record;
----------------------------------------------------
-- Software interrupt event register (EXTI_SWIER) --
----------------------------------------------------
type t_exti_lines is array (t_exti_line_index) of bit
with pack, size => 23;
type t_EXTI_SWIER is record
line : t_exti_lines;
end record
with volatile_full_access, size => 32;
for t_EXTI_SWIER use record
line at 0 range 0 .. 22;
end record;
--------------------------------
-- Pending register (EXTI_PR) --
--------------------------------
type t_request is (NO_REQUEST, PENDING_REQUEST) with size => 1;
for t_request use (NO_REQUEST => 0, PENDING_REQUEST => 1);
-- Set the bit to '1' to clear it!
CLEAR_REQUEST : constant t_request := PENDING_REQUEST;
type t_requests is array (t_exti_line_index) of t_request
with pack, size => 23;
type t_EXTI_PR is record
line : t_requests;
end record
with volatile_full_access, size => 32;
for t_EXTI_PR use record
line at 0 range 0 .. 22;
end record;
---------------------
-- EXTI peripheral --
---------------------
type t_EXTI_periph is record
IMR : t_EXTI_IMR;
EMR : t_EXTI_EMR;
RTSR : t_EXTI_RTSR;
FTSR : t_EXTI_FTSR;
SWIER : t_EXTI_SWIER;
PR : t_EXTI_PR;
end record
with volatile;
for t_EXTI_periph use record
IMR at 16#00# range 0 .. 31;
EMR at 16#04# range 0 .. 31;
RTSR at 16#08# range 0 .. 31;
FTSR at 16#0C# range 0 .. 31;
SWIER at 16#10# range 0 .. 31;
PR at 16#14# range 0 .. 31;
end record;
EXTI : t_EXTI_periph
with
import,
volatile,
address => system'to_address (16#4001_3C00#); -- 0x40013C00
end soc.exti;
|
zhmu/ananas | Ada | 2,757 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T . S O C K E T S . L I N K E R _ O P T I O N S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2001-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 is used to provide target specific linker_options for the
-- support of sockets as required by the package GNAT.Sockets.
-- This is the Windows/NT version of this package
-- This package should not be directly with'ed by an application program
package GNAT.Sockets.Linker_Options is
private
pragma Linker_Options ("-lws2_32");
end GNAT.Sockets.Linker_Options;
|
Rodeo-McCabe/orka | Ada | 2,490 | adb | -- 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 body Orka.SIMD.AVX.Doubles.Swizzle is
Mask_LH : constant Unsigned_32 := 0 or 0 * 16 or 0 * 8 or 0 * 128;
Mask_HL : constant Unsigned_32 := 1 or 1 * 16 or 0 * 8 or 0 * 128;
function Duplicate_LH (Elements : m256d) return m256d is
(Permute_Lanes (Elements, Elements, Mask_LH));
function Duplicate_HL (Elements : m256d) return m256d is
(Permute_Lanes (Elements, Elements, Mask_HL));
Mask_0_2_0_0 : constant Unsigned_32 := 0 or 2 * 16 or 0 * 8 or 0 * 128;
Mask_1_3_0_0 : constant Unsigned_32 := 1 or 3 * 16 or 0 * 8 or 0 * 128;
procedure Transpose (Matrix : in out m256d_Array) is
M0 : constant m256d := Unpack_Low (Matrix (X), Matrix (Y));
M1 : constant m256d := Unpack_High (Matrix (X), Matrix (Y));
M2 : constant m256d := Unpack_Low (Matrix (Z), Matrix (W));
M3 : constant m256d := Unpack_High (Matrix (Z), Matrix (W));
begin
Matrix (X) := Permute_Lanes (M0, M2, Mask_0_2_0_0);
Matrix (Y) := Permute_Lanes (M1, M3, Mask_0_2_0_0);
Matrix (Z) := Permute_Lanes (M0, M2, Mask_1_3_0_0);
Matrix (W) := Permute_Lanes (M1, M3, Mask_1_3_0_0);
end Transpose;
function Transpose (Matrix : m256d_Array) return m256d_Array is
Result : m256d_Array;
M0 : constant m256d := Unpack_Low (Matrix (X), Matrix (Y));
M1 : constant m256d := Unpack_High (Matrix (X), Matrix (Y));
M2 : constant m256d := Unpack_Low (Matrix (Z), Matrix (W));
M3 : constant m256d := Unpack_High (Matrix (Z), Matrix (W));
begin
Result (X) := Permute_Lanes (M0, M2, Mask_0_2_0_0);
Result (Y) := Permute_Lanes (M1, M3, Mask_0_2_0_0);
Result (Z) := Permute_Lanes (M0, M2, Mask_1_3_0_0);
Result (W) := Permute_Lanes (M1, M3, Mask_1_3_0_0);
return Result;
end Transpose;
end Orka.SIMD.AVX.Doubles.Swizzle;
|
reznikmm/matreshka | Ada | 23,472 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2015, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
pragma Restrictions (No_Elaboration_Code);
-- GNAT: enforce generation of preinitialized data section instead of
-- generation of elaboration code.
package Matreshka.Internals.Unicode.Ucd.Core_00FF is
pragma Preelaborate;
Group_00FF : aliased constant Core_Second_Stage
:= (16#00# => -- FF00
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#01# => -- FF01
(Other_Punctuation, Fullwidth,
Other, Other, S_Term, Exclamation,
(STerm
| Terminal_Punctuation
| Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#02# => -- FF02
(Other_Punctuation, Fullwidth,
Other, Other, Other, Ideographic,
(Quotation_Mark
| Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#03# => -- FF03
(Other_Punctuation, Fullwidth,
Other, Other, Other, Ideographic,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#04# => -- FF04
(Currency_Symbol, Fullwidth,
Other, Other, Other, Prefix_Numeric,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#05# => -- FF05
(Other_Punctuation, Fullwidth,
Other, Other, Other, Postfix_Numeric,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#06# => -- FF06
(Other_Punctuation, Fullwidth,
Other, Other, Other, Ideographic,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#07# => -- FF07
(Other_Punctuation, Fullwidth,
Other, Mid_Num_Let, Other, Ideographic,
(Quotation_Mark
| Case_Ignorable
| Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#08# => -- FF08
(Open_Punctuation, Fullwidth,
Other, Other, Close, Open_Punctuation,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#09# => -- FF09
(Close_Punctuation, Fullwidth,
Other, Other, Close, Close_Punctuation,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#0A# => -- FF0A
(Other_Punctuation, Fullwidth,
Other, Other, Other, Ideographic,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#0B# => -- FF0B
(Math_Symbol, Fullwidth,
Other, Other, Other, Ideographic,
(Grapheme_Base
| Math
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#0C# => -- FF0C
(Other_Punctuation, Fullwidth,
Other, Mid_Num, S_Continue, Close_Punctuation,
(Terminal_Punctuation
| Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#0D# => -- FF0D
(Dash_Punctuation, Fullwidth,
Other, Other, S_Continue, Ideographic,
(Dash
| Hyphen
| Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#0E# => -- FF0E
(Other_Punctuation, Fullwidth,
Other, Mid_Num_Let, A_Term, Close_Punctuation,
(STerm
| Terminal_Punctuation
| Case_Ignorable
| Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#0F# => -- FF0F
(Other_Punctuation, Fullwidth,
Other, Other, Other, Ideographic,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#10# .. 16#19# => -- FF10 .. FF19
(Decimal_Number, Fullwidth,
Other, Other, Other, Ideographic,
(Hex_Digit
| Grapheme_Base
| ID_Continue
| XID_Continue
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#1A# => -- FF1A
(Other_Punctuation, Fullwidth,
Other, Mid_Letter, S_Continue, Nonstarter,
(Terminal_Punctuation
| Case_Ignorable
| Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#1B# => -- FF1B
(Other_Punctuation, Fullwidth,
Other, Mid_Num, Other, Nonstarter,
(Terminal_Punctuation
| Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#1C# .. 16#1E# => -- FF1C .. FF1E
(Math_Symbol, Fullwidth,
Other, Other, Other, Ideographic,
(Grapheme_Base
| Math
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#1F# => -- FF1F
(Other_Punctuation, Fullwidth,
Other, Other, S_Term, Exclamation,
(STerm
| Terminal_Punctuation
| Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#20# => -- FF20
(Other_Punctuation, Fullwidth,
Other, Other, Other, Ideographic,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#21# .. 16#26# => -- FF21 .. FF26
(Uppercase_Letter, Fullwidth,
Other, A_Letter, Upper, Ideographic,
(Hex_Digit
| Alphabetic
| Cased
| Changes_When_Lowercased
| Changes_When_Casefolded
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Uppercase
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#27# .. 16#3A# => -- FF27 .. FF3A
(Uppercase_Letter, Fullwidth,
Other, A_Letter, Upper, Ideographic,
(Alphabetic
| Cased
| Changes_When_Lowercased
| Changes_When_Casefolded
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Uppercase
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#3B# => -- FF3B
(Open_Punctuation, Fullwidth,
Other, Other, Close, Open_Punctuation,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#3C# => -- FF3C
(Other_Punctuation, Fullwidth,
Other, Other, Other, Ideographic,
(Other_Math
| Grapheme_Base
| Math
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#3D# => -- FF3D
(Close_Punctuation, Fullwidth,
Other, Other, Close, Close_Punctuation,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#3E# => -- FF3E
(Modifier_Symbol, Fullwidth,
Other, Other, Other, Ideographic,
(Diacritic
| Other_Math
| Case_Ignorable
| Grapheme_Base
| Math
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#3F# => -- FF3F
(Connector_Punctuation, Fullwidth,
Other, Extend_Num_Let, Other, Ideographic,
(Grapheme_Base
| ID_Continue
| XID_Continue
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#40# => -- FF40
(Modifier_Symbol, Fullwidth,
Other, Other, Other, Ideographic,
(Diacritic
| Case_Ignorable
| Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#41# .. 16#46# => -- FF41 .. FF46
(Lowercase_Letter, Fullwidth,
Other, A_Letter, Lower, Ideographic,
(Hex_Digit
| Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#47# .. 16#5A# => -- FF47 .. FF5A
(Lowercase_Letter, Fullwidth,
Other, A_Letter, Lower, Ideographic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#5B# => -- FF5B
(Open_Punctuation, Fullwidth,
Other, Other, Close, Open_Punctuation,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#5C# => -- FF5C
(Math_Symbol, Fullwidth,
Other, Other, Other, Ideographic,
(Grapheme_Base
| Math
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#5D# => -- FF5D
(Close_Punctuation, Fullwidth,
Other, Other, Close, Close_Punctuation,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#5E# => -- FF5E
(Math_Symbol, Fullwidth,
Other, Other, Other, Ideographic,
(Grapheme_Base
| Math
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#5F# => -- FF5F
(Open_Punctuation, Fullwidth,
Other, Other, Close, Open_Punctuation,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#60# => -- FF60
(Close_Punctuation, Fullwidth,
Other, Other, Close, Close_Punctuation,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#61# => -- FF61
(Other_Punctuation, Halfwidth,
Other, Other, S_Term, Close_Punctuation,
(STerm
| Terminal_Punctuation
| Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#62# => -- FF62
(Open_Punctuation, Halfwidth,
Other, Other, Close, Open_Punctuation,
(Quotation_Mark
| Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#63# => -- FF63
(Close_Punctuation, Halfwidth,
Other, Other, Close, Close_Punctuation,
(Quotation_Mark
| Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#64# => -- FF64
(Other_Punctuation, Halfwidth,
Other, Other, S_Continue, Close_Punctuation,
(Terminal_Punctuation
| Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#65# => -- FF65
(Other_Punctuation, Halfwidth,
Other, Other, Other, Nonstarter,
(Hyphen
| Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#66# => -- FF66
(Other_Letter, Halfwidth,
Other, Katakana, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#67# .. 16#6F# => -- FF67 .. FF6F
(Other_Letter, Halfwidth,
Other, Katakana, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#70# => -- FF70
(Modifier_Letter, Halfwidth,
Other, Katakana, O_Letter, Conditional_Japanese_Starter,
(Diacritic
| Extender
| Alphabetic
| Case_Ignorable
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#71# .. 16#9D# => -- FF71 .. FF9D
(Other_Letter, Halfwidth,
Other, Katakana, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#9E# .. 16#9F# => -- FF9E .. FF9F
(Modifier_Letter, Halfwidth,
Extend, Extend, Extend, Nonstarter,
(Diacritic
| Other_Grapheme_Extend
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| ID_Start
| XID_Continue
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#A0# => -- FFA0
(Other_Letter, Halfwidth,
Other, A_Letter, O_Letter, Alphabetic,
(Other_Default_Ignorable_Code_Point
| Alphabetic
| Default_Ignorable_Code_Point
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#BF# .. 16#C1# => -- FFBF .. FFC1
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#C8# .. 16#C9# => -- FFC8 .. FFC9
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#D0# .. 16#D1# => -- FFD0 .. FFD1
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#D8# .. 16#D9# => -- FFD8 .. FFD9
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#DD# .. 16#DF# => -- FFDD .. FFDF
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#E0# => -- FFE0
(Currency_Symbol, Fullwidth,
Other, Other, Other, Postfix_Numeric,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#E1# => -- FFE1
(Currency_Symbol, Fullwidth,
Other, Other, Other, Prefix_Numeric,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#E2# => -- FFE2
(Math_Symbol, Fullwidth,
Other, Other, Other, Ideographic,
(Grapheme_Base
| Math
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#E3# => -- FFE3
(Modifier_Symbol, Fullwidth,
Other, Other, Other, Ideographic,
(Diacritic
| Case_Ignorable
| Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#E4# => -- FFE4
(Other_Symbol, Fullwidth,
Other, Other, Other, Ideographic,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#E5# .. 16#E6# => -- FFE5 .. FFE6
(Currency_Symbol, Fullwidth,
Other, Other, Other, Prefix_Numeric,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#E7# => -- FFE7
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#E8# => -- FFE8
(Other_Symbol, Halfwidth,
Other, Other, Other, Alphabetic,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#E9# .. 16#EC# => -- FFE9 .. FFEC
(Math_Symbol, Halfwidth,
Other, Other, Other, Alphabetic,
(Grapheme_Base
| Math
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#ED# .. 16#EE# => -- FFED .. FFEE
(Other_Symbol, Halfwidth,
Other, Other, Other, Alphabetic,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#EF# => -- FFEF
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#F0# .. 16#F8# => -- FFF0 .. FFF8
(Unassigned, Neutral,
Control, Other, Other, Unknown,
(Other_Default_Ignorable_Code_Point
| Default_Ignorable_Code_Point
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#F9# .. 16#FB# => -- FFF9 .. FFFB
(Format, Neutral,
Control, Format, Format, Combining_Mark,
(Case_Ignorable => True,
others => False)),
16#FC# => -- FFFC
(Other_Symbol, Neutral,
Other, Other, Other, Contingent_Break,
(Grapheme_Base => True,
others => False)),
16#FD# => -- FFFD
(Other_Symbol, Ambiguous,
Other, Other, Other, Ambiguous,
(Grapheme_Base => True,
others => False)),
16#FE# .. 16#FF# => -- FFFE .. FFFF
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(Noncharacter_Code_Point => True,
others => False)),
others =>
(Other_Letter, Halfwidth,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)));
end Matreshka.Internals.Unicode.Ucd.Core_00FF;
|
reznikmm/matreshka | Ada | 4,029 | 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.Fo_Background_Color_Attributes;
package Matreshka.ODF_Fo.Background_Color_Attributes is
type Fo_Background_Color_Attribute_Node is
new Matreshka.ODF_Fo.Abstract_Fo_Attribute_Node
and ODF.DOM.Fo_Background_Color_Attributes.ODF_Fo_Background_Color_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Fo_Background_Color_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Fo_Background_Color_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Fo.Background_Color_Attributes;
|
michael-hardeman/contacts_app | Ada | 4,604 | adb | --- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../../License.txt
with Ada.Calendar.Formatting;
package body AdaBase.Logger.Base is
package ACF renames Ada.Calendar.Formatting;
-----------------------
-- set_information --
-----------------------
procedure set_information
(listener : out Base_Logger;
category : Log_Category;
driver : Driver_Type;
message : CT.Text;
error_msg : CT.Text := CT.blank;
error_code : Driver_Codes := 0;
sqlstate : SQL_State := stateless)
is
prefix : String (1 .. 17);
drv : String (1 .. 11);
timestamp : constant AC.Time := AC.Clock;
TS : constant String := ACF.Image (Date => timestamp);
error : CT.Text := CT.SUS (error_code'Img & " : SQLSTATE[" &
sqlstate & "] : ");
err_label : CT.Text := CT.SUS (" : Driver code :");
composite : CT.Text := CT.blank;
begin
listener.prop_timestamp := timestamp;
listener.prop_category := category;
listener.prop_driver := driver;
listener.prop_message := message;
listener.prop_error_msg := error_msg;
listener.prop_error_code := error_code;
listener.prop_sqlstate := sqlstate;
listener.prop_is_error := not CT.IsBlank (error_msg);
case driver is
when driver_mysql => drv := " mysql :";
when driver_sqlite => drv := " sqlite :";
when driver_postgresql => drv := " pgsql :";
when driver_firebird => drv := " firebird :";
when foundation => drv := " none :";
end case;
case category is
when connecting => prefix := " Connect : ";
when disconnecting => prefix := " Disconnect : ";
when transaction => prefix := " Transaction : ";
when execution => prefix := " Execute : ";
when statement_preparation => prefix := " Prepare Stmt : ";
when statement_execution => prefix := " Execute Stmt : ";
when miscellaneous => prefix := " Miscellaneous : ";
when note => prefix := " Note : ";
end case;
composite := CT.SUS (TS & drv & prefix);
CT.SU.Append (Source => composite, New_Item => message);
if listener.prop_is_error then
CT.SU.Append (Source => composite, New_Item => err_label);
CT.SU.Append (Source => composite, New_Item => error);
CT.SU.Append (Source => composite, New_Item => error_msg);
end if;
listener.prop_composite := composite;
end set_information;
-----------------
-- timestamp --
-----------------
function timestamp (listener : Base_Logger) return AC.Time
is
begin
return listener.prop_timestamp;
end timestamp;
----------------
-- category --
----------------
function category (listener : Base_Logger) return Log_Category
is
begin
return listener.prop_category;
end category;
--------------
-- driver --
--------------
function driver (listener : Base_Logger) return Driver_Type
is
begin
return listener.prop_driver;
end driver;
-----------------
-- composite --
-----------------
function composite (listener : Base_Logger) return CT.Text
is
begin
return listener.prop_composite;
end composite;
---------------
-- message --
---------------
function message (listener : Base_Logger) return CT.Text
is
begin
return listener.prop_message;
end message;
-----------------
-- error_msg --
-----------------
function error_msg (listener : Base_Logger) return CT.Text
is
begin
return listener.prop_error_msg;
end error_msg;
------------------
-- error_code --
------------------
function error_code (listener : Base_Logger) return Driver_Codes
is
begin
return listener.prop_error_code;
end error_code;
----------------
-- sqlstate --
----------------
function sqlstate (listener : Base_Logger) return SQL_State is
begin
return listener.prop_sqlstate;
end sqlstate;
----------------
-- is_error --
----------------
function is_error (listener : Base_Logger) return Boolean is
begin
return listener.prop_is_error;
end is_error;
end AdaBase.Logger.Base;
|
MinimSecure/unum-sdk | Ada | 840 | adb | -- Copyright 2012-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
SA : Simple_Array := (1, 2, 3, 4);
begin
Update_Small (SA (3)); -- STOP
end Foo;
|
onox/dcf-ada | Ada | 6,073 | adb | -- SPDX-License-Identifier: MIT
--
-- Copyright (c) 1999 - 2018 Gautier de Montmollin
-- SWITZERLAND
--
-- 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 Ada.IO_Exceptions;
with DCF.Unzip.Decompress;
with DCF.Zip.Headers;
package body DCF.Unzip.Streams is
overriding procedure Write
(Stream : in out Stream_Writer;
Item : in Ada.Streams.Stream_Element_Array) is
begin
if Stream.Target /= null then
Stream.Target.all.Set_Index (Stream.Index);
Stream.Target.all.Write (Item);
Stream.Index := Stream.Index + Item'Length;
end if;
end Write;
procedure Unzip_File
(Zip_Stream : in out DCF.Streams.Root_Zipstream_Type'Class;
Header_Index : in DCF.Streams.Zs_Index_Type;
Out_Stream_Ptr : P_Stream;
Hint_Comp_Size : in File_Size_Type; -- Added 2007 for .ODS files
Hint_Crc_32 : in Unsigned_32; -- Added 2012 for decryption
Cat_Uncomp_Size : in File_Size_Type;
Verify_Integrity : in Boolean)
is
Work_Index : DCF.Streams.Zs_Index_Type := Header_Index;
Local_Header : Zip.Headers.Local_File_Header;
Data_Descriptor_After_Data : Boolean;
Encrypted : Boolean;
Method : Pkzip_Method;
use Zip;
begin
begin
DCF.Streams.Set_Index (Zip_Stream, Header_Index);
Zip.Headers.Read_And_Check (Zip_Stream, Local_Header);
exception
when Zip.Headers.Bad_Local_Header =>
raise Zip.Archive_Corrupted with "Bad local header";
when others =>
raise Zip.Archive_Corrupted;
end;
Method := Method_From_Code (Local_Header.Zip_Type);
-- Calculate offset of data
Work_Index :=
Work_Index +
DCF.Streams.Zs_Size_Type
(Local_Header.Filename_Length +
Local_Header.Extra_Field_Length +
Zip.Headers.Local_Header_Length);
Data_Descriptor_After_Data :=
(Local_Header.Bit_Flag and Zip.Headers.Descriptor_Flag_Bit) /= 0;
if Data_Descriptor_After_Data then
-- Sizes and CRC are stored after the data
-- We set size to avoid getting a sudden Zip_EOF !
if Method = Store and then Hint_Comp_Size = File_Size_Type'Last then
-- For Stored (Method 0) data we need a correct "compressed" size.
-- If the hint is the bogus fallback value, it is better to trust
-- the local header, since this size is known in advance. Case found
-- in Microsoft's OneDrive cloud storage (in 2018). Zip files,
-- created by the server for downloading more than one file, are
-- using the "Store" format and a postfixed Data Descriptor for
-- writing the CRC value.
null; -- Do not overwrite the compressed size in that case
else
Local_Header.Dd.Compressed_Size := Hint_Comp_Size;
end if;
Local_Header.Dd.Crc_32 := Hint_Crc_32;
Local_Header.Dd.Uncompressed_Size := Cat_Uncomp_Size;
else
-- Sizes and CRC are before the data
if Cat_Uncomp_Size /= Local_Header.Dd.Uncompressed_Size then
raise Uncompressed_Size_Error;
end if;
end if;
Encrypted := (Local_Header.Bit_Flag and Zip.Headers.Encryption_Flag_Bit) /= 0;
if Encrypted then
raise Constraint_Error with "Encryption is not supported";
end if;
begin
DCF.Streams.Set_Index (Zip_Stream, Work_Index); -- eventually skips the file name
exception
when others =>
raise Zip.Archive_Corrupted with
"End of stream reached (location: between local header and archived data)";
end;
-- Unzip correct type
Unzip.Decompress.Decompress_Data
(Zip_File => Zip_Stream,
Format => Method,
Output_Stream_Access => Out_Stream_Ptr,
Data_Descriptor_After_Data => Data_Descriptor_After_Data,
Hint => Local_Header,
Verify_Integrity => Verify_Integrity);
exception
when Ada.IO_Exceptions.End_Error =>
raise Zip.Archive_Corrupted with "End of stream reached";
end Unzip_File;
procedure Extract
(Destination : in out Ada.Streams.Root_Stream_Type'Class;
Archive_Info : in Zip.Zip_Info; -- Archive's Zip_info
File : in Zip.Archived_File;
Verify_Integrity : in Boolean) is
begin
Unzip_File
(Zip_Stream => Archive_Info.Stream.all,
Header_Index => File.File_Index,
Out_Stream_Ptr => Destination'Unchecked_Access,
Hint_Comp_Size => File.Compressed_Size,
Hint_Crc_32 => File.CRC_32,
Cat_Uncomp_Size => File.Uncompressed_Size,
Verify_Integrity => Verify_Integrity);
end Extract;
end DCF.Unzip.Streams;
|
reznikmm/matreshka | Ada | 3,999 | adb | ------------------------------------------------------------------------------
-- --
-- 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$
------------------------------------------------------------------------------
package body WUI.Events is
------------------
-- Accept_Event --
------------------
procedure Accept_Event (Self : in out Abstract_Event'Class) is
begin
Self.Event.Prevent_Default;
end Accept_Event;
------------------
-- Constructors --
------------------
package body Constructors is
----------------
-- Initialize --
----------------
procedure Initialize
(Self : in out Abstract_Event'Class;
Event : not null access WebAPI.UI_Events.UI_Event'Class) is
begin
Self.Event := UI_Event_Access (Event);
end Initialize;
end Constructors;
end WUI.Events;
|
Rodeo-McCabe/orka | Ada | 5,559 | 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.
with GL.Objects.Textures;
with GL.Types.Colors;
package GL.Objects.Samplers is
pragma Preelaborate;
type Sampler is new GL_Object with private;
type Sampler_Array is array (Positive range <>) of Sampler;
procedure Bind (Object : Sampler; Unit : Textures.Texture_Unit);
procedure Bind (Objects : Sampler_Array; First_Unit : Textures.Texture_Unit);
overriding
procedure Initialize_Id (Object : in out Sampler);
overriding
procedure Delete_Id (Object : in out Sampler);
overriding
function Identifier (Object : Sampler) return Types.Debug.Identifier is
(Types.Debug.Sampler);
-----------------------------------------------------------------------------
-- Sampler Parameters --
-----------------------------------------------------------------------------
use GL.Objects.Textures;
procedure Set_Minifying_Filter (Object : Sampler;
Filter : Minifying_Function);
procedure Set_Magnifying_Filter (Object : Sampler;
Filter : Magnifying_Function);
procedure Set_Minimum_LoD (Object : Sampler; Level : Double);
procedure Set_Maximum_LoD (Object : Sampler; Level : Double);
procedure Set_LoD_Bias (Object : Sampler; Level : Double);
-- Adjust the selection of a mipmap image. A positive level will
-- cause larger mipmaps to be selected. A too large bias can
-- result in visual aliasing, but if the bias is small enough it
-- can make the texture look a bit sharper.
procedure Set_Seamless_Filtering (Object : Sampler; Enable : Boolean);
-- Enable seamless cubemap filtering
--
-- Texture must be a Texture_Cube_Map or Texture_Cube_Map_Array.
--
-- Note: this procedure requires the ARB_seamless_cubemap_per_texture
-- extension. If this extension is not available, you can enable seamless
-- filtering globally via GL.Toggles.
procedure Set_Max_Anisotropy (Object : Sampler; Degree : Double)
with Pre => Degree >= 1.0;
-- Set the maximum amount of anisotropy filtering to reduce the blurring
-- of textures (caused by mipmap filtering) that are viewed at an
-- oblique angle.
--
-- For best results, combine the use of anisotropy filtering with
-- a Linear_Mipmap_Linear minification filter and a Linear maxification
-- filter.
-----------------------------------------------------------------------------
function Minifying_Filter (Object : Sampler) return Minifying_Function;
-- Return the minification function (default is Nearest_Mipmap_Linear)
function Magnifying_Filter (Object : Sampler) return Magnifying_Function;
-- Return the magnification function (default is Linear)
function Minimum_LoD (Object : Sampler) return Double;
-- Return the minimum LOD (default is -1000)
function Maximum_LoD (Object : Sampler) return Double;
-- Return the maximum LOD (default is 1000)
function LoD_Bias (Object : Sampler) return Double;
-- Return the LOD bias for the selection of a mipmap (default is 0.0)
function Seamless_Filtering (Object : Sampler) return Boolean;
-- Return whether seamless filtering is enabled for cube map
-- textures (default is False)
function Max_Anisotropy (Object : Sampler) return Double
with Post => Max_Anisotropy'Result >= 1.0;
-----------------------------------------------------------------------------
procedure Set_X_Wrapping (Object : Sampler; Mode : Wrapping_Mode);
procedure Set_Y_Wrapping (Object : Sampler; Mode : Wrapping_Mode);
procedure Set_Z_Wrapping (Object : Sampler; Mode : Wrapping_Mode);
function X_Wrapping (Object : Sampler) return Wrapping_Mode;
-- Return the wrapping mode for the X direction (default is Repeat)
function Y_Wrapping (Object : Sampler) return Wrapping_Mode;
-- Return the wrapping mode for the Y direction (default is Repeat)
function Z_Wrapping (Object : Sampler) return Wrapping_Mode;
-- Return the wrapping mode for the Z direction (default is Repeat)
-----------------------------------------------------------------------------
procedure Set_Border_Color (Object : Sampler; Color : Colors.Border_Color);
procedure Set_Compare_X_To_Texture (Object : Sampler; Enabled : Boolean);
procedure Set_Compare_Function (Object : Sampler;
Func : Compare_Function);
function Border_Color (Object : Sampler) return Colors.Border_Color;
function Compare_X_To_Texture_Enabled (Object : Sampler) return Boolean;
-- Return whether to enable comparing (default is False)
function Current_Compare_Function (Object : Sampler) return Compare_Function;
-- Return the comparison function (default is LEqual)
private
type Sampler is new GL_Object with null record;
end GL.Objects.Samplers;
|
zhmu/ananas | Ada | 2,774 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . I M G _ R E A L --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This obsolete package is preserved for the sake of backward compatibility
with System.Img_LLF;
package System.Img_Real is
pragma Pure;
procedure Set_Image_Real
(V : Long_Long_Float;
S : in out String;
P : in out Natural;
Fore : Natural;
Aft : Natural;
Exp : Natural)
renames System.Img_LLF.Set_Image_Long_Long_Float;
end System.Img_Real;
|
pat-rogers/LmcpGen | Ada | 42 | ads | package AVTAS.LMCP is
end AVTAS.LMCP;
|
optikos/oasis | Ada | 1,116 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Meta.Classes;
with Meta.Read;
package Meta.Writes is
procedure Write_Elements (Vector : Meta.Read.Class_Vectors.Vector);
procedure Write_Elements_Body (Vector : Meta.Read.Class_Vectors.Vector);
procedure Write_Visitors (Vector : Meta.Read.Class_Vectors.Vector);
procedure Write_Iterators (Vector : Meta.Read.Class_Vectors.Vector);
procedure Write_Factories
(Vector : Meta.Read.Class_Vectors.Vector;
Implicit : Boolean := False);
procedure Write_Factories_Body
(Vector : Meta.Read.Class_Vectors.Vector;
Implicit : Boolean := False);
procedure Write_One_Element
(Item : Meta.Classes.Class;
With_List : Boolean);
procedure Write_One_Node
(Vector : Meta.Read.Class_Vectors.Vector;
Item : Meta.Classes.Class);
procedure Write_One_Node_Body
(Vector : Meta.Read.Class_Vectors.Vector;
Item : Meta.Classes.Class);
end Meta.Writes;
|
Asier98/Control_IO_STM32F446 | Ada | 586 | ads | with STM32.GPIO;
use STM32.GPIO;
with HAL.GPIO;
package Analog is
type Analog_Signal_Value is new Integer;
procedure Configure_Pin (Pin : GPIO_Point);
-- Configure a given pin as a analog and establishes his properties
procedure Start_Adquisition (Pin : GPIO_Point);
-- Start the adquisition of the analag pin value
function Get_Value (Pin: GPIO_Point) return Analog_Signal_Value;
-- Obtain the value of the analog pin. A minimum time of 10 microseconds
-- must be given between the procedure Start_Adquisition and this function.
end Analog;
|
charlie5/cBound | Ada | 1,495 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces.C;
with xcb.xcb_setup_failed_t;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_setup_failed_iterator_t is
-- Item
--
type Item is record
data : access xcb.xcb_setup_failed_t.Item;
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_setup_failed_iterator_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_setup_failed_iterator_t.Item,
Element_Array => xcb.xcb_setup_failed_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_setup_failed_iterator_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_setup_failed_iterator_t.Pointer,
Element_Array => xcb.xcb_setup_failed_iterator_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_setup_failed_iterator_t;
|
BrickBot/Bound-T-H8-300 | Ada | 4,783 | adb | -- Flow.Origins.Overall_Invariants (body)
--
-- A component of the Bound-T Worst-Case Execution Time Tool.
--
-------------------------------------------------------------------------------
-- Copyright (c) 1999 .. 2015 Tidorum Ltd
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- 1. Redistributions of source code must retain the above copyright notice, this
-- list of conditions and the following disclaimer.
-- 2. Redistributions in binary form must reproduce the above copyright notice,
-- this list of conditions and the following disclaimer in the documentation
-- and/or other materials provided with the distribution.
--
-- This software is provided by the copyright holders and contributors "as is" and
-- any express or implied warranties, including, but not limited to, the implied
-- warranties of merchantability and fitness for a particular purpose are
-- disclaimed. In no event shall the copyright owner or contributors be liable for
-- any direct, indirect, incidental, special, exemplary, or consequential damages
-- (including, but not limited to, procurement of substitute goods or services;
-- loss of use, data, or profits; or business interruption) however caused and
-- on any theory of liability, whether in contract, strict liability, or tort
-- (including negligence or otherwise) arising in any way out of the use of this
-- software, even if advised of the possibility of such damage.
--
-- Other modules (files) of this software composition should contain their
-- own copyright statements, which may have different copyright and usage
-- conditions. The above conditions apply to this file.
-------------------------------------------------------------------------------
--
-- $Revision: 1.4 $
-- $Date: 2015/10/24 20:05:48 $
--
-- $Log: flow-origins-overall_invariants.adb,v $
-- Revision 1.4 2015/10/24 20:05:48 niklas
-- Moved to free licence.
--
-- Revision 1.3 2013/12/13 17:22:55 niklas
-- BT-CH-0262, addition: Corrections to new value-origin analysis.
--
-- Revision 1.2 2013/12/12 22:26:04 niklas
-- BT-CH-0262: Corrections to new value-origin analysis.
--
-- Revision 1.1 2013/12/08 22:05:57 niklas
-- BT-CH-0259: Storing value-origin analysis results in execution bounds.
--
with Flow.Computation;
with Flow.Origins.Opt;
with Output;
with Storage;
function Flow.Origins.Overall_Invariants (Map : Map_Ref)
return Storage.Cell_List_T
is
use type Storage.Cell_T;
Cells : Storage.Cell_List_T := All_Cells (Under => Map);
-- Initially, all the cells considered in the value-origin analysis.
-- At end, only the overall invariant cells are left, at indices
-- Cells'First .. Last_Invariant.
Last_Invariant : Natural := Cells'First - 1;
-- The index of the last invariant cell in Cells.
Returns : constant Step_List_T :=
Flow.Computation.Final_Steps (Computation (Map).all);
-- All the return steps.
Origin : Origin_T;
-- The origin found for a cell, at a return.
Invariant : Boolean;
-- Whether the cell is invariant: its final value at any return
-- equals its initial value on entry.
begin
if Returns'Length = 0 then
Output.Warning ("Non-returning subprogram.");
end if;
Loop_Over_Cells : for C in Cells'Range loop
Invariant := True;
-- We know nothing to the contrary.
-- Look at the origin of the cell at all return points.
-- If they are all "Initial", the cell is invariant:
Loop_Over_Returns: for R in Returns'Range loop
Origin := Origin_After (
Step => Returns(R),
Cell => Cells(C),
From => Map);
case Origin.Kind is
when Initial =>
Invariant := Origin.Cell = Cells(C);
when Assigned | Merged =>
Invariant := False;
end case;
exit Loop_Over_Returns when not Invariant;
end loop Loop_Over_Returns;
if Invariant then
-- This is an invariant cell (at all return points).
if Opt.Trace_Invariant_Cells then
Output.Trace (
"Invariant cell"
& Output.Field_Separator
& Storage.Image (Cells(C)));
end if;
Last_Invariant := Last_Invariant + 1;
if Last_Invariant < C then
-- Some earlier cells were not invariant.
-- Move this cell to extend the contiguous list of
-- invariant cells at the start of the array.
Cells(Last_Invariant) := Cells(C);
end if;
end if;
end loop Loop_Over_Cells;
return Cells(Cells'First .. Last_Invariant);
end Flow.Origins.Overall_Invariants;
|
AdaCore/libadalang | Ada | 574 | adb | procedure Main is
package My_Package is
type Base_Rec (Disc : Integer) is tagged private;
private
type Base_Rec (Disc : Integer) is tagged record
case Disc is
when 1 =>
A : Integer;
when 2 =>
Z : Integer;
when others =>
B : Integer;
end case;
end record;
end My_Package;
use My_Package;
type Derived_Rec is new Base_Rec with record
D : Integer;
end record;
Obj : Derived_Rec := (
--% node.p_expression_type.p_shapes()
begin
null;
end Main;
|
stcarrez/dynamo | Ada | 5,643 | ads | ------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A 4 G . C U _ I N F O 2 --
-- --
-- S p e c --
-- --
-- Copyright (c) 1995-1999, 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, 59 Temple Place --
-- - Suite 330, Boston, MA 02111-1307, 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 Ada Core Technologies Inc --
-- (http://www.gnat.com). --
-- --
------------------------------------------------------------------------------
with Asis; use Asis;
with A4G.A_Types; use A4G.A_Types;
with Types; use Types;
-- This package contains the routines used to compute the unit attributes
-- during the second pass through the tree files, when ASIS operates in
-- Use_Pre_Created_Trees mode. There is some duplication of the
-- functionalities provided by this package and by A4G.C_U_Info and
-- A4G.S_U_Info; the last two packages were coded before for
-- Compile_On_The_Fly ASIS operation mode. The intent is to get rid of
-- A4G.C_U_Info and A4G.S_U_Info in the final ASIS version, so we do not
-- bother about these duplications for now.
-- ???THIS COMMENT HEADER SHOULD BE REVISED!!!???
package A4G.CU_Info2 is
procedure Set_Kind_and_Class
(C : Context_Id;
U : Unit_Id;
Top : Node_Id);
-- Taking the unit's subtree top node, this procedure computes and sets
-- the Unit Kind and the Unit Class for U. Because of some technical ,
-- reasons, it is more easy to define the Unit Kind and the Unit Class
-- in the same routine
procedure Get_Ada_Name (Top : Node_Id);
-- Computes (by traversing the tree) the fully expanded Ada name
-- of a compilation unit whose subtree contained as having Top as
-- its top node in the full tree currently being accessed. This name
-- then is set in A_Name_Buffer, and A_Name_Len is set as its length
procedure Set_S_F_Name_and_Origin
(Context : Context_Id;
Unit : Unit_Id;
Top : Node_Id);
-- This procedure obtains the source file name from the GNAT tree and
-- stores it in the Unit_Table. By analyzing the file name (this analysis
-- is based on the Fname.Is_Predefined_File_Name GNAt function, the
-- Unit_Origin for the Unit is defined and stored in the Unit table.
function Is_Main (Top : Node_Id; Kind : Unit_Kinds) return Boolean;
-- Defines if the Unit having Top as its N_Compilation_Unit node
-- can be a main subprogram for a partition. Asis Unit Kind is
-- used to optimize this computation
procedure Set_Dependencies
(C : Context_Id;
U : Unit_Id;
Top : Node_Id);
-- Taking the unit's subtree top node, this procedure computes and sets
-- all the dependency information needed for semantic queries from the
-- Asis.Compilation_Units package. This information is stored as unit
-- lists (see A4G.Unit_Rec). For now, we do not compute the lists of
-- *direct* supporters and *direct* dependents, because we think, that
-- these ASIS notions are ill-defined and cannot be mapped onto RM95
-- in a natural way.
end A4G.CU_Info2;
|
reznikmm/matreshka | Ada | 6,801 | 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_Chart.Footer_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Chart_Footer_Element_Node is
begin
return Self : Chart_Footer_Element_Node do
Matreshka.ODF_Chart.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Chart_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Chart_Footer_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Chart_Footer
(ODF.DOM.Chart_Footer_Elements.ODF_Chart_Footer_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Chart_Footer_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Footer_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Chart_Footer_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Chart_Footer
(ODF.DOM.Chart_Footer_Elements.ODF_Chart_Footer_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Chart_Footer_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Chart_Footer
(Visitor,
ODF.DOM.Chart_Footer_Elements.ODF_Chart_Footer_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Chart_URI,
Matreshka.ODF_String_Constants.Footer_Element,
Chart_Footer_Element_Node'Tag);
end Matreshka.ODF_Chart.Footer_Elements;
|
stcarrez/ada-ado | Ada | 5,613 | adb | -----------------------------------------------------------------------
-- ado.schemas -- Database Schemas
-- Copyright (C) 2009, 2010, 2011, 2015, 2018, 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 ADO.Statements;
with ADO.Statements.Create;
with ADO.SQL;
with Ada.Strings.Fixed;
package body ADO.Schemas.Mysql is
use ADO.Statements;
procedure Load_Table_Schema (C : in ADO.Connections.Database_Connection'Class;
Table : in Table_Definition);
function String_To_Type (Value : in String) return Column_Type;
function String_To_Length (Value : in String) return Natural;
function String_To_Type (Value : in String) return Column_Type is
Pos : Natural;
begin
if Value = "date" then
return T_DATE;
elsif Value = "datetime" then
return T_DATE_TIME;
elsif Value = "int(11)" then
return T_INTEGER;
elsif Value = "bigint(20)" then
return T_LONG_INTEGER;
elsif Value = "tinyint(4)" then
return T_TINYINT;
elsif Value = "smallint(6)" then
return T_SMALLINT;
elsif Value = "longblob" then
return T_BLOB;
elsif Value = "float" then
return T_FLOAT;
elsif Value = "double" then
return T_DOUBLE;
end if;
Pos := Ada.Strings.Fixed.Index (Value, "(");
if Pos > 0 then
declare
Name : constant String := Value (Value'First .. Pos - 1);
begin
if Name = "varchar" then
return T_VARCHAR;
elsif Name = "decimal" then
return T_FLOAT;
elsif Name = "int" then
return T_INTEGER;
elsif Name = "bigint" then
return T_LONG_INTEGER;
else
return T_UNKNOWN;
end if;
end;
end if;
return T_UNKNOWN;
end String_To_Type;
function String_To_Length (Value : in String) return Natural is
First : Natural;
Last : Natural;
begin
First := Ada.Strings.Fixed.Index (Value, "(");
if First = 0 then
return 0;
end if;
Last := Ada.Strings.Fixed.Index (Value, ")");
if Last < First then
return 0;
end if;
return Natural'Value (Value (First + 1 .. Last - 1));
exception
when Constraint_Error =>
return 0;
end String_To_Length;
-- ------------------------------
-- Load the table definition
-- ------------------------------
procedure Load_Table_Schema (C : in ADO.Connections.Database_Connection'Class;
Table : in Table_Definition) is
Name : constant String := Get_Name (Table);
Stmt : Query_Statement
:= Create.Create_Statement (C.Create_Statement ("show full columns from "));
Last : Column_Definition := null;
Col : Column_Definition;
Value : Unbounded_String;
Query : constant ADO.SQL.Query_Access := Stmt.Get_Query;
begin
ADO.SQL.Append_Name (Target => Query.SQL, Name => Name);
Stmt.Execute;
while Stmt.Has_Elements loop
Col := new Column;
Col.Name := Stmt.Get_Unbounded_String (0);
if not Stmt.Is_Null (2) then
Col.Collation := Stmt.Get_Unbounded_String (2);
end if;
if not Stmt.Is_Null (5) then
Col.Default := Stmt.Get_Unbounded_String (5);
end if;
if Last /= null then
Last.Next_Column := Col;
else
Table.First_Column := Col;
end if;
Value := Stmt.Get_Unbounded_String (1);
Col.Col_Type := String_To_Type (To_String (Value));
Col.Size := String_To_Length (To_String (Value));
Value := Stmt.Get_Unbounded_String (3);
Col.Is_Null := Value = "YES";
Value := Stmt.Get_Unbounded_String (4);
Col.Is_Primary := Value = "PRI";
Last := Col;
Stmt.Next;
end loop;
end Load_Table_Schema;
-- ------------------------------
-- Load the database schema
-- ------------------------------
procedure Load_Schema (C : in ADO.Connections.Database_Connection'Class;
Schema : out Schema_Definition) is
Stmt : Query_Statement
:= Create.Create_Statement (C.Create_Statement ("show tables"));
Table : Table_Definition;
Last : Table_Definition := null;
begin
Schema.Schema := new ADO.Schemas.Schema;
Stmt.Execute;
while Stmt.Has_Elements loop
Table := new ADO.Schemas.Table;
Table.Name := Stmt.Get_Unbounded_String (0);
if Last /= null then
Last.Next_Table := Table;
else
Schema.Schema.First_Table := Table;
end if;
Load_Table_Schema (C, Table);
Last := Table;
Stmt.Next;
end loop;
end Load_Schema;
end ADO.Schemas.Mysql;
|
AdaCore/langkit | Ada | 1,345 | ads | --
-- Copyright (C) 2020-2022, AdaCore
-- SPDX-License-Identifier: Apache-2.0
--
generic
type Precomputed_Symbol_Index is (<>);
-- Indexes for symbols to pre-compute in each symbol table
with function Precomputed_Symbol
(Index : Precomputed_Symbol_Index) return Text_Type is <>;
-- Return the symbol corresponding to the precomputed symbol Index
package Langkit_Support.Symbols.Precomputed is
type Precomputed_Symbol_Table_Record
is new Symbol_Table_Record with private;
type Precomputed_Symbol_Table
is access all Precomputed_Symbol_Table_Record'Class;
function Precomputed_Symbol
(ST : Precomputed_Symbol_Table;
Index : Precomputed_Symbol_Index) return Thin_Symbol
with Inline;
function Precomputed_Symbol
(ST : Precomputed_Symbol_Table;
Index : Precomputed_Symbol_Index) return Symbol_Type
with Inline;
-- Return the precomputed symbol corresponding to Index
function Create_Symbol_Table return Precomputed_Symbol_Table;
-- Allocate a new symbol table and return it
private
type Precomputed_Symbol_Array is
array (Precomputed_Symbol_Index) of Thin_Symbol;
type Precomputed_Symbol_Table_Record is new Symbol_Table_Record with record
Precomputed : Precomputed_Symbol_Array;
end record;
end Langkit_Support.Symbols.Precomputed;
|
PThierry/ewok-kernel | Ada | 24 | adb | ../stm32f439/soc-dma.adb |
zhmu/ananas | Ada | 4,619 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S W I T C H - M --
-- --
-- S p e c --
-- --
-- Copyright (C) 2001-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 scans make switches. Note that the body of Usage must be
-- coordinated with the switches that are recognized by this package.
-- The Usage package also acts as the official documentation for the
-- switches that are recognized. In addition, package Debug documents
-- the otherwise undocumented debug switches that are also recognized.
pragma Warnings (Off);
-- This package is used also by gnatcoll
with System.OS_Lib; use System.OS_Lib;
pragma Warnings (On);
package Switch.M is
Subdirs : String_Ptr := null;
-- The value after the equal sign in switch --subdirs=...
-- Contains the relative subdirectory.
procedure Scan_Make_Switches
(Switch_Chars : String;
Success : out Boolean);
-- Scan a gnatmake switch and act accordingly. For switches that are
-- recognized, Success is set to True. A switch that is not recognized and
-- consists of one small letter causes a fatal error exit and control does
-- not return. For all other not recognized switches, Success is set to
-- False, so that the switch may be passed to the compiler.
--
-- Project_Node_Tree is used to store tree-specific parameters like the
-- project path.
procedure Normalize_Compiler_Switches
(Switch_Chars : String;
Switches : in out Argument_List_Access;
Last : out Natural);
-- Takes a compiler switch which potentially is equivalent to more
-- that one simple switches and returns the equivalent list of simple
-- switches that are stored in an ALI file. Switches will be extended
-- if initially null or too short. Last indicates the index in Switches
-- of the last simple switch. Last is equal to zero, if it has been
-- determined that Switch_Chars is ill-formed or does not contain any
-- switch that should be stored in an ALI file. Otherwise, the list of
-- simple switches is Switches (Switches'First .. Last).
--
-- Example: if Switch_Chars is equal to "-gnatAwue", then the list of
-- simple switches will have 3 components: -gnatA, -gnatwu, -gnatwe.
--
-- The String_Access components of Switches should not be deallocated:
-- they are shallow copies of components in a table in the body.
function Normalize_Compiler_Switches
(Switch_Chars : String) return Argument_List;
-- Similar to the previous procedure. The return value is the list of
-- simple switches. It may be an empty array if it has been determined
-- that Switch_Chars is ill-formed or does not contain any switch that
-- should be stored in an ALI file. The String_Access components of the
-- returned value should not be deallocated.
end Switch.M;
|
AdaCore/langkit | Ada | 554 | adb | with Ada.Text_IO; use Ada.Text_IO;
package body Support is
--------------
-- Put_Line --
--------------
procedure Put_Line (Elements : Envs.Entity_Array) is
begin
if Elements'Length = 0 then
Put_Line (" <none>");
else
for E of Elements loop
declare
Img : constant Text_Type := Envs.Text_Image (E.Info.Rebindings);
begin
Put_Line (" * '" & E.Node & "' " & Image (Img));
end;
end loop;
end if;
end Put_Line;
end Support;
|
stcarrez/ada-awa | Ada | 5,855 | adb | -----------------------------------------------------------------------
-- awa_test_app -
-- Copyright (C) 2020, 2022 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Log.Loggers;
package body AWA_Test_App is
use AWA.Applications;
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Adafr");
-- ------------------------------
-- Initialize the servlets provided by the application.
-- This procedure is called by <b>Initialize</b>.
-- It should register the application servlets.
-- ------------------------------
overriding
procedure Initialize_Servlets (App : in out Application) is
begin
Log.Info ("Initializing application servlets...");
App.Self := App'Unchecked_Access;
App.Set_Global ("contextPath", CONTEXT_PATH);
AWA.Applications.Application (App).Initialize_Servlets;
App.Add_Servlet (Name => "faces", Server => App.Self.Faces'Access);
App.Add_Servlet (Name => "files", Server => App.Self.Files'Access);
App.Add_Servlet (Name => "ajax", Server => App.Self.Ajax'Access);
App.Add_Servlet (Name => "measures", Server => App.Self.Measures'Access);
App.Add_Servlet (Name => "auth", Server => App.Self.Auth'Access);
App.Add_Servlet (Name => "verify-auth", Server => App.Self.Verify_Auth'Access);
App.Add_Servlet (Name => "verify-access-key", Server => App.Self.Verify_Key'Access);
end Initialize_Servlets;
-- ------------------------------
-- Initialize the filters provided by the application.
-- This procedure is called by <b>Initialize</b>.
-- It should register the application filters.
-- ------------------------------
overriding
procedure Initialize_Filters (App : in out Application) is
begin
Log.Info ("Initializing application filters...");
AWA.Applications.Application (App).Initialize_Filters;
App.Add_Filter (Name => "dump", Filter => App.Self.Dump'Access);
App.Add_Filter (Name => "measures", Filter => App.Self.Measures'Access);
App.Add_Filter (Name => "service", Filter => App.Self.Service_Filter'Access);
App.Add_Filter (Name => "no-cache", Filter => App.Self.No_Cache'Access);
end Initialize_Filters;
-- ------------------------------
-- Initialize the AWA modules provided by the application.
-- This procedure is called by <b>Initialize</b>.
-- It should register the modules used by the application.
-- ------------------------------
overriding
procedure Initialize_Modules (App : in out Application) is
begin
Log.Info ("Initializing application modules...");
App.Add_Converter (Name => "smartDateConverter",
Converter => App.Self.Rel_Date_Converter'Access);
App.Add_Converter (Name => "sizeConverter",
Converter => App.Self.Size_Converter'Access);
Register (App => App.Self.all'Access,
Name => AWA.Users.Modules.NAME,
URI => "user",
Module => App.User_Module'Access);
Register (App => App.Self.all'Access,
Name => AWA.Workspaces.Modules.NAME,
URI => "workspaces",
Module => App.Workspace_Module'Access);
Register (App => App.Self.all'Access,
Name => AWA.Mail.Modules.NAME,
URI => "mail",
Module => App.Mail_Module'Access);
Register (App => App.Self.all'Access,
Name => AWA.Comments.Modules.NAME,
URI => "comments",
Module => App.Comment_Module'Access);
Register (App => App.Self.all'Access,
Name => AWA.Tags.Modules.NAME,
URI => "tags",
Module => App.Tag_Module'Access);
Register (App => App.Self.all'Access,
Name => AWA.Jobs.Modules.NAME,
URI => "jobs",
Module => App.Job_Module'Access);
Register (App => App.Self.all'Access,
Name => AWA.Storages.Modules.NAME,
URI => "storages",
Module => App.Storage_Module'Access);
Register (App => App.Self.all'Access,
Name => AWA.Images.Modules.NAME,
URI => "images",
Module => App.Image_Module'Access);
Register (App => App.Self.all'Access,
Name => AWA.Counters.Modules.NAME,
URI => "counters",
Module => App.Counter_Module'Access);
Register (App => App.Self.all'Access,
Name => AWA.Blogs.Modules.NAME,
URI => "blogs",
Module => App.Blog_Module'Access);
Register (App => App.Self.all'Access,
Name => AWA.Wikis.Modules.NAME,
URI => "wikis",
Module => App.Wiki_Module'Access);
Register (App => App.Self.all'Access,
Name => AWA.Wikis.Previews.NAME,
URI => "wikis-preview",
Module => App.Preview_Module'Access);
end Initialize_Modules;
end AWA_Test_App;
|
DrenfongWong/tkm-rpc | Ada | 1,364 | adb | with Tkmrpc.Servers.Ike;
with Tkmrpc.Results;
with Tkmrpc.Request.Ike.Cc_Add_Certificate.Convert;
with Tkmrpc.Response.Ike.Cc_Add_Certificate.Convert;
package body Tkmrpc.Operation_Handlers.Ike.Cc_Add_Certificate is
-------------------------------------------------------------------------
procedure Handle (Req : Request.Data_Type; Res : out Response.Data_Type) is
Specific_Req : Request.Ike.Cc_Add_Certificate.Request_Type;
Specific_Res : Response.Ike.Cc_Add_Certificate.Response_Type;
begin
Specific_Res := Response.Ike.Cc_Add_Certificate.Null_Response;
Specific_Req :=
Request.Ike.Cc_Add_Certificate.Convert.From_Request (S => Req);
if Specific_Req.Data.Cc_Id'Valid and
Specific_Req.Data.Autha_Id'Valid and
Specific_Req.Data.Certificate.Size'Valid
then
Servers.Ike.Cc_Add_Certificate
(Result => Specific_Res.Header.Result,
Cc_Id => Specific_Req.Data.Cc_Id,
Autha_Id => Specific_Req.Data.Autha_Id,
Certificate => Specific_Req.Data.Certificate);
Res :=
Response.Ike.Cc_Add_Certificate.Convert.To_Response
(S => Specific_Res);
else
Res.Header.Result := Results.Invalid_Parameter;
end if;
end Handle;
end Tkmrpc.Operation_Handlers.Ike.Cc_Add_Certificate;
|
reznikmm/matreshka | Ada | 3,612 | 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.Elements.Generic_Hash;
function AMF.OCL.Message_Types.Hash is
new AMF.Elements.Generic_Hash (OCL_Message_Type, OCL_Message_Type_Access);
|
reznikmm/matreshka | Ada | 4,591 | 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_Dr3d.Min_Edge_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Dr3d_Min_Edge_Attribute_Node is
begin
return Self : Dr3d_Min_Edge_Attribute_Node do
Matreshka.ODF_Dr3d.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Dr3d_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Dr3d_Min_Edge_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Min_Edge_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Dr3d_URI,
Matreshka.ODF_String_Constants.Min_Edge_Attribute,
Dr3d_Min_Edge_Attribute_Node'Tag);
end Matreshka.ODF_Dr3d.Min_Edge_Attributes;
|
burratoo/Acton | Ada | 5,689 | ads | ------------------------------------------------------------------------------------------
-- --
-- OAK PROCESSOR SUPPORT PACKAGE --
-- ST STM32F4 --
-- --
-- ST.STM32F4.GPIO --
-- --
-- Copyright (C) 2014-2021, Patrick Bernardi --
-- --
------------------------------------------------------------------------------------------
with System; use System;
package ST.STM32F4.GPIO with Preelaborate is
---------------------------
-- GPIO Memory Addresses --
---------------------------
GPIO_Base_Address : constant := 16#4002_0000#;
MODER_Offset_Address : constant := 16#00#;
OTYPER_Offset_Address : constant := 16#04#;
OSPEEDR_Offset_Address : constant := 16#08#;
PUPDR_Offset_Address : constant := 16#0C#;
IDR_Offset_Address : constant := 16#10#;
ODR_Offset_Address : constant := 16#14#;
BSRR_Offset_Address : constant := 16#18#;
LCKR_Offset_Address : constant := 16#1C#;
AFR_Offset_Address : constant := 16#20#;
-----------------------
-- Hardware Features --
-----------------------
type GPIO_Ports is (Port_A, Port_B, Port_C, Port_D, Port_E,
Port_F, Port_G, Port_H, Port_I);
type Pins is mod 16;
-----------------
-- GPIO Types --
-----------------
type IO_Mode is (Input, Output, Alternative_Function, Analog);
type IO_Mode_Set is array (Pins) of IO_Mode with Pack;
type IO_Mode_Pins is record
Pin : IO_Mode_Set;
end record;
type Output_Type is (Push_Pull, Open_Drain);
type Output_Type_Set is array (Pins) of Output_Type with Pack;
type Output_Driver_Pins is record
Pin : Output_Type_Set;
end record;
type Speeds is (Low, Medium, Fast, High);
type Speeds_Set is array (Pins) of Speeds with Pack;
type Speeds_Pins is record
Pin : Speeds_Set;
end record;
type Pull_Direction is (No_Pull, Pull_Up, Pull_Down);
type Pull_Direction_Set is array (Pins) of Pull_Direction with Pack;
type Pull_Direction_Pins is record
Pin : Pull_Direction_Set;
end record;
type GPIO_State is (Low, High);
type GPIO_State_Set is array (Pins) of GPIO_State with Pack;
type GPIO_State_Pins is record
Pin : GPIO_State_Set;
end record;
type High_State is (No_Change, High);
type Low_State is (No_Change, Low);
type High_Set is array (Pins) of High_State with Pack;
type Low_Set is array (Pins) of Low_State with Pack;
type GPIO_Set_Clear is record
Pin_To_Set_High : High_Set;
Pin_To_Set_Low : Low_Set;
end record;
type Active_Type is (Inactive, Active);
type Lock_Type is (Unlocked, Locked);
type Lock_Set is array (Pins) of Lock_Type with Pack;
type Configuration_Lock is record
Lock_Key : Active_Type;
Pin : Lock_Set;
end record;
type Alternative_Function_Type is mod 2 ** 4;
type Alternative_Function_Set is array (Pins) of Alternative_Function_Type
with Pack;
type Pin_Alternative_Function is record
Pin : Alternative_Function_Set;
end record;
type GPIO_Port_Registers is record
IO_Mode_Register : IO_Mode_Pins;
Output_Driver_Register : Output_Driver_Pins;
Output_Pin_Speed_Register : Speeds_Set;
Pull_Direction_Register : Pull_Direction_Pins;
Input_State_Register : GPIO_State_Pins;
Output_State_Register : GPIO_State_Pins;
Set_Pin_State_Register : GPIO_Set_Clear;
Configuration_Lock_Register : Configuration_Lock;
Alternative_Function_Register : Pin_Alternative_Function;
end record;
------------------------------
-- Hardware Representations --
------------------------------
for GPIO_Set_Clear use record
Pin_To_Set_High at 0 range 0 .. 15;
Pin_To_Set_Low at 0 range 16 .. 31;
end record;
for Configuration_Lock use record
Lock_Key at 0 range 16 .. 16;
Pin at 0 range 0 .. 15;
end record;
for GPIO_Port_Registers use record
IO_Mode_Register at MODER_Offset_Address range 0 .. 31;
Output_Driver_Register at OTYPER_Offset_Address range 0 .. 15;
Output_Pin_Speed_Register at OSPEEDR_Offset_Address range 0 .. 31;
Pull_Direction_Register at PUPDR_Offset_Address range 0 .. 31;
Input_State_Register at IDR_Offset_Address range 0 .. 15;
Output_State_Register at ODR_Offset_Address range 0 .. 15;
Set_Pin_State_Register at BSRR_Offset_Address range 0 .. 31;
Configuration_Lock_Register at LCKR_Offset_Address range 0 .. 16;
Alternative_Function_Register at AFR_Offset_Address range 0 .. 63;
end record;
--------------------
-- GPIO Registers --
--------------------
pragma Warnings (Off, "*component of*");
type GPIO_Port_Set is array (GPIO_Ports) of GPIO_Port_Registers
with Component_Size => 16#400# * Storage_Unit;
pragma Warnings (On, "*component of*");
GPIO_Port_Register : GPIO_Port_Set
with Address => System'To_Address (GPIO_Base_Address);
end ST.STM32F4.GPIO;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.