repo_name
stringlengths
9
74
language
stringclasses
1 value
length_bytes
int64
11
9.34M
extension
stringclasses
2 values
content
stringlengths
11
9.34M
zhmu/ananas
Ada
2,727
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- SYSTEM.TASKING.ASYNC_DELAYS.ENQUEUE_CALENDAR -- -- -- -- S p e c -- -- -- -- Copyright (C) 1998-2022, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- Note: the compiler generates direct calls to this interface, via Rtsfind. -- Any changes to this interface may require corresponding compiler changes. -- See comments in package System.Tasking.Async_Delays with Ada.Calendar; function System.Tasking.Async_Delays.Enqueue_Calendar (T : Ada.Calendar.Time; D : Delay_Block_Access) return Boolean;
gitter-badger/libAnne
Ada
1,267
adb
package body Generics.Text is ------------------------ -- Fixed String / Any -- ------------------------ function String_Any_Concatenate(Left : String; Right : Any_Type) return String is begin return Left & Image(Right); end String_Any_Concatenate; function Wide_String_Any_Concatenate(Left : Wide_String; Right : Any_type) return Wide_String is begin return Left & Wide_Image(Right); end Wide_String_Any_Concatenate; function Wide_Wide_String_Any_Concatenate(Left : Wide_Wide_String; Right : Any_Type) return Wide_Wide_String is begin return Left & Wide_Wide_Image(Right); end Wide_Wide_String_Any_Concatenate; ------------------------ -- Any / Fixed String -- ------------------------ function Any_String_Concatenate(Left : Any_Type; Right : String) return String is begin return Image(Left) & Right; end Any_String_Concatenate; function Any_Wide_String_Concatenate(Left : Any_Type; Right : Wide_String) return Wide_String is begin return Wide_Image(Left) & Right; end Any_Wide_String_Concatenate; function Any_Wide_Wide_String_Concatenate(Left : Any_Type; Right : Wide_Wide_String) return Wide_Wide_String is begin return Wide_Wide_Image(Left) & Right; end Any_Wide_Wide_String_Concatenate; end Generics.Text;
stcarrez/hyperion
Ada
1,933
ads
----------------------------------------------------------------------- -- hyperion-agents-modules -- Module agents -- Copyright (C) 2018 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ASF.Applications; with ADO; with AWA.Modules; with Hyperion.Agents.Models; package Hyperion.Agents.Modules is -- The name under which the module is registered. NAME : constant String := "agents"; -- ------------------------------ -- Module agents -- ------------------------------ type Agent_Module is new AWA.Modules.Module with private; type Agent_Module_Access is access all Agent_Module'Class; -- Initialize the agents module. overriding procedure Initialize (Plugin : in out Agent_Module; App : in AWA.Modules.Application_Access; Props : in ASF.Applications.Config); -- Register a new agent under the name, ip and key. -- Return the agent identifier. procedure Register_Agent (Plugin : in out Agent_Module; Agent : in out Models.Agent_Ref); -- Get the agents module. function Get_Agent_Module return Agent_Module_Access; private type Agent_Module is new AWA.Modules.Module with null record; end Hyperion.Agents.Modules;
burratoo/Acton
Ada
7,595
adb
------------------------------------------------------------------------------------------ -- -- -- ACTON PROCESSOR SUPPORT PACKAGE -- -- -- -- ATMEL.AT91SAM7S.SPI -- -- -- -- Copyright (C) 2014-2021, Patrick Bernardi -- -- -- ------------------------------------------------------------------------------------------ with Atmel.AT91SAM7S.AIC; with Atmel.AT91SAM7S.PIO; with Atmel.AT91SAM7S.PMC; package body Atmel.AT91SAM7S.SPI is procedure Transmit_Data (To_Device : in Peripheral_Chip_Select_Id; Send_Message : in Address; Send_Message_Length : in Unsigned_16; Recieve_Message : in Address; Recieve_Message_Length : in Unsigned_16) is begin Serial_Peripheral_Interface.Exchange_Data (With_Device => To_Device, Send_Message => Send_Message, Send_Message_Length => Send_Message_Length, Recieve_Message => Recieve_Message, Recieve_Message_Length => Recieve_Message_Length); Serial_Peripheral_Interface.Wait_For_Transmission; end Transmit_Data; procedure Initialise_Interface (SPI_Settings : Mode_Type; Chip_Select_Pin_Assignments : in Chip_Select_Pins) is begin Serial_Peripheral_Interface.Initialise_Interface (SPI_Settings => SPI_Settings, Chip_Select_Pin_Assignments => Chip_Select_Pin_Assignments); end Initialise_Interface; procedure Setup_Chip_Select_Pin (For_Pin : in Peripheral_Chip_Select_Pin; Chip_Select_Settings : in Chip_Select_Type) is begin Serial_Peripheral_Interface.Setup_Chip_Select_Pin (For_Pin, Chip_Select_Settings); end Setup_Chip_Select_Pin; protected body Serial_Peripheral_Interface is procedure Initialise_Interface (SPI_Settings : Mode_Type; Chip_Select_Pin_Assignments : in Chip_Select_Pins) is begin -- Turn on SPI clock PMC.Peripheral_Clock_Enable_Register := (P_SPI => Enable, others => No_Change); -- Setup Pins PIO.PIO_Disable_Register := (IO_Line_A_SPI_Clock => Disable, IO_Line_A_SPI_MOSI => Disable, IO_Line_A_SPI_MISO => Disable, others => No_Change); PIO.Peripheral_A_Select_Register := (IO_Line_A_SPI_Clock => PIO.Use_Peripheral, IO_Line_A_SPI_MOSI => PIO.Use_Peripheral, IO_Line_A_SPI_MISO => PIO.Use_Peripheral, others => PIO.No_Change); for P of Chip_Select_Pin_Assignments loop declare Disable_Reg : PIO.Disable_Set := (others => No_Change); Peripheral_Set : PIO.Select_Set := (others => PIO.No_Change); begin case P.Pin_Function is when A => Disable_Reg (P.Pin) := Disable; PIO.PIO_Disable_Register := Disable_Reg; Peripheral_Set (P.Pin) := PIO.Use_Peripheral; PIO.Peripheral_A_Select_Register := Peripheral_Set; when B => Disable_Reg (P.Pin) := Disable; PIO.PIO_Disable_Register := Disable_Reg; Peripheral_Set (P.Pin) := PIO.Use_Peripheral; PIO.Peripheral_B_Select_Register := Peripheral_Set; when PIO_Function => null; end case; end; end loop; -- Setup SPI unit Control_Register := (SPI_Enable => Enable, SPI_Disable => No_Change, Software_Reset => No_Change, Last_Transfer => False); Mode_Register := SPI_Settings; Transfer_Control_Register := (Receiver_Transfer => Enable, Transmitter_Transfer => Enable); AIC.Interrupt_Enable_Command_Register.Interrupt := (P_SPI => Enable, others => No_Change); end Initialise_Interface; procedure Exchange_Data (With_Device : in Peripheral_Chip_Select_Id; Send_Message : in Address; Send_Message_Length : in Unsigned_16; Recieve_Message : in Address; Recieve_Message_Length : in Unsigned_16) is MR : Mode_Type := Mode_Register; begin Transfer_Completed := False; if Mode_Register.Peripheral_Select = Variable then raise Program_Error with "Variable peripheral selection not supported"; end if; MR.Peripheral_Chip_Select := With_Device; Mode_Register := MR; if Send_Message /= Null_Address and then Send_Message_Length > 0 then Transmit_Pointer_Register := Send_Message; Transmit_Counter_Register := Send_Message_Length; end if; if Recieve_Message /= Null_Address and then Recieve_Message_Length > 0 then Receive_Pointer_Register := Recieve_Message; Receive_Counter_Register := Recieve_Message_Length; end if; if Send_Message_Length >= Recieve_Message_Length then Interrupt_Enable_Register := (End_Of_Transmit_Buffer => Enable, others => No_Change); else Interrupt_Enable_Register := (End_Of_Receive_Buffer => Enable, others => No_Change); end if; end Exchange_Data; procedure Setup_Chip_Select_Pin (For_Pin : in Peripheral_Chip_Select_Pin; Chip_Select_Settings : in Chip_Select_Type) is begin Chip_Select_Register (For_Pin) := Chip_Select_Settings; end Setup_Chip_Select_Pin; entry Wait_For_Transmission when Transfer_Completed is begin null; end Wait_For_Transmission; procedure Interface_Handler is begin -- We wait for the transmission buffers to become empty and then -- wait for the last transmission to complete. if Status_Register.End_Of_Receive_Buffer or Status_Register.End_Of_Transmit_Buffer then -- Interrupt_Enable_Register := -- (Transmission_Registers_Empty => Enable, -- others => No_Change); Interrupt_Disable_Register := (End_Of_Receive_Buffer => Disable, End_Of_Transmit_Buffer => Disable, others => No_Change); Transfer_Completed := True; -- elsif Status_Register.Transmission_Registers_Empty then -- Transfer_Completed := True; -- Interrupt_Disable_Register := -- (Transmission_Registers_Empty => Disable, -- others => No_Change); end if; end Interface_Handler; end Serial_Peripheral_Interface; end Atmel.AT91SAM7S.SPI;
zhmu/ananas
Ada
284
ads
package Opt50_Pkg is type Enum is (One, Two, Three); for Enum'Size use 16; type Enum_Boolean_Array is array (Enum range <>) of Boolean; procedure Get (Kind : String; Result : out Enum; Success : out Boolean); procedure Set (A : Enum_Boolean_Array); end Opt50_Pkg;
AdaCore/libadalang
Ada
94
ads
package P.A.B is procedure Foo (X : access T'Class) is null; end P.A.B; pragma Test_Block;
persan/A-gst
Ada
10,323
ads
pragma Ada_2005; pragma Style_Checks (Off); pragma Warnings (Off); with Interfaces.C; use Interfaces.C; with glib; with glib.Values; with System; with glib; with System; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspmessage_h; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspdefs_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_sdp_gstsdpmessage_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gststructure_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtsptransport_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspurl_h; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspextension_h is -- unsupported macro: GST_TYPE_RTSP_EXTENSION (gst_rtsp_extension_get_type ()) -- arg-macro: function GST_RTSP_EXTENSION (obj) -- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_EXTENSION, GstRTSPExtension); -- arg-macro: function GST_IS_RTSP_EXTENSION (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_EXTENSION); -- arg-macro: function GST_RTSP_EXTENSION_GET_IFACE (inst) -- return G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_RTSP_EXTENSION, GstRTSPExtensionInterface); -- GStreamer RTSP Extension -- * Copyright (C) 2007 Wim Taymans <[email protected]> -- * -- * gstrtspextension.h: RTSP Extension interface. -- * -- * This library is free software; you can redistribute it and/or -- * modify it under the terms of the GNU Library General Public -- * License as published by the Free Software Foundation; either -- * version 2 of the License, or (at your option) any later version. -- * -- * This library is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- * Library General Public License for more details. -- * -- * You should have received a copy of the GNU Library General Public -- * License along with this library; if not, write to the -- * Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- * Boston, MA 02111-1307, USA. -- -- skipped empty struct u_GstRTSPExtension -- skipped empty struct GstRTSPExtension type GstRTSPExtensionInterface; type u_GstRTSPExtensionInterface_u_gst_reserved_array is array (0 .. 2) of System.Address; --subtype GstRTSPExtensionInterface is u_GstRTSPExtensionInterface; -- gst/rtsp/gstrtspextension.h:44 type GstRTSPExtensionInterface is record parent : aliased GStreamer.GST_Low_Level.glib_2_0_gobject_gtype_h.GTypeInterface; -- gst/rtsp/gstrtspextension.h:47 detect_server : access function (arg1 : System.Address; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspmessage_h.GstRTSPMessage) return GLIB.gboolean; -- gst/rtsp/gstrtspextension.h:50 before_send : access function (arg1 : System.Address; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspmessage_h.GstRTSPMessage) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspdefs_h.GstRTSPResult; -- gst/rtsp/gstrtspextension.h:52 after_send : access function (arg1 : System.Address; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspmessage_h.GstRTSPMessage; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspmessage_h.GstRTSPMessage) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspdefs_h.GstRTSPResult; -- gst/rtsp/gstrtspextension.h:53 parse_sdp : access function (arg1 : System.Address; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_sdp_gstsdpmessage_h.GstSDPMessage; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gststructure_h.GstStructure) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspdefs_h.GstRTSPResult; -- gst/rtsp/gstrtspextension.h:55 setup_media : access function (arg1 : System.Address; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_sdp_gstsdpmessage_h.GstSDPMedia) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspdefs_h.GstRTSPResult; -- gst/rtsp/gstrtspextension.h:56 configure_stream : access function (arg1 : System.Address; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return GLIB.gboolean; -- gst/rtsp/gstrtspextension.h:58 get_transports : access function (arg1 : System.Address; arg2 : GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtsptransport_h.GstRTSPLowerTrans; arg3 : System.Address) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspdefs_h.GstRTSPResult; -- gst/rtsp/gstrtspextension.h:60 stream_select : access function (arg1 : System.Address; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspurl_h.GstRTSPUrl) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspdefs_h.GstRTSPResult; -- gst/rtsp/gstrtspextension.h:62 send : access function (arg1 : System.Address; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspmessage_h.GstRTSPMessage; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspmessage_h.GstRTSPMessage) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspdefs_h.GstRTSPResult; -- gst/rtsp/gstrtspextension.h:65 receive_request : access function (arg1 : System.Address; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspmessage_h.GstRTSPMessage) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspdefs_h.GstRTSPResult; -- gst/rtsp/gstrtspextension.h:68 u_gst_reserved : u_GstRTSPExtensionInterface_u_gst_reserved_array; -- gst/rtsp/gstrtspextension.h:71 end record; pragma Convention (C_Pass_By_Copy, GstRTSPExtensionInterface); -- gst/rtsp/gstrtspextension.h:46 -- vfunctions -- signals -- ABI: more vfunctions added later --< private > function gst_rtsp_extension_get_type return GLIB.GType; -- gst/rtsp/gstrtspextension.h:74 pragma Import (C, gst_rtsp_extension_get_type, "gst_rtsp_extension_get_type"); -- invoke vfunction on interface function gst_rtsp_extension_detect_server (ext : System.Address; resp : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspmessage_h.GstRTSPMessage) return GLIB.gboolean; -- gst/rtsp/gstrtspextension.h:77 pragma Import (C, gst_rtsp_extension_detect_server, "gst_rtsp_extension_detect_server"); function gst_rtsp_extension_before_send (ext : System.Address; req : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspmessage_h.GstRTSPMessage) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspdefs_h.GstRTSPResult; -- gst/rtsp/gstrtspextension.h:79 pragma Import (C, gst_rtsp_extension_before_send, "gst_rtsp_extension_before_send"); function gst_rtsp_extension_after_send (ext : System.Address; req : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspmessage_h.GstRTSPMessage; resp : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspmessage_h.GstRTSPMessage) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspdefs_h.GstRTSPResult; -- gst/rtsp/gstrtspextension.h:80 pragma Import (C, gst_rtsp_extension_after_send, "gst_rtsp_extension_after_send"); function gst_rtsp_extension_parse_sdp (ext : System.Address; sdp : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_sdp_gstsdpmessage_h.GstSDPMessage; s : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gststructure_h.GstStructure) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspdefs_h.GstRTSPResult; -- gst/rtsp/gstrtspextension.h:82 pragma Import (C, gst_rtsp_extension_parse_sdp, "gst_rtsp_extension_parse_sdp"); function gst_rtsp_extension_setup_media (ext : System.Address; media : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_sdp_gstsdpmessage_h.GstSDPMedia) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspdefs_h.GstRTSPResult; -- gst/rtsp/gstrtspextension.h:84 pragma Import (C, gst_rtsp_extension_setup_media, "gst_rtsp_extension_setup_media"); function gst_rtsp_extension_configure_stream (ext : System.Address; caps : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return GLIB.gboolean; -- gst/rtsp/gstrtspextension.h:85 pragma Import (C, gst_rtsp_extension_configure_stream, "gst_rtsp_extension_configure_stream"); function gst_rtsp_extension_get_transports (ext : System.Address; protocols : GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtsptransport_h.GstRTSPLowerTrans; transport : System.Address) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspdefs_h.GstRTSPResult; -- gst/rtsp/gstrtspextension.h:86 pragma Import (C, gst_rtsp_extension_get_transports, "gst_rtsp_extension_get_transports"); function gst_rtsp_extension_stream_select (ext : System.Address; url : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspurl_h.GstRTSPUrl) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspdefs_h.GstRTSPResult; -- gst/rtsp/gstrtspextension.h:88 pragma Import (C, gst_rtsp_extension_stream_select, "gst_rtsp_extension_stream_select"); function gst_rtsp_extension_receive_request (ext : System.Address; req : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspmessage_h.GstRTSPMessage) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspdefs_h.GstRTSPResult; -- gst/rtsp/gstrtspextension.h:89 pragma Import (C, gst_rtsp_extension_receive_request, "gst_rtsp_extension_receive_request"); -- signal emision function gst_rtsp_extension_send (ext : System.Address; req : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspmessage_h.GstRTSPMessage; resp : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspmessage_h.GstRTSPMessage) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspdefs_h.GstRTSPResult; -- gst/rtsp/gstrtspextension.h:92 pragma Import (C, gst_rtsp_extension_send, "gst_rtsp_extension_send"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtsp_gstrtspextension_h;
reznikmm/matreshka
Ada
4,583
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.Custom4_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Text_Custom4_Attribute_Node is begin return Self : Text_Custom4_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_Custom4_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Custom4_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Text_URI, Matreshka.ODF_String_Constants.Custom4_Attribute, Text_Custom4_Attribute_Node'Tag); end Matreshka.ODF_Text.Custom4_Attributes;
RREE/ada-util
Ada
97,637
adb
----------------------------------------------------------------------- -- util-encoders-aes -- AES encryption and decryption -- Copyright (C) 2017, 2019, 2020, 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. ----------------------------------------------------------------------- package body Util.Encoders.AES is type Sbox is array (Unsigned_32 range 0 .. 255) of Unsigned_32; type Final_Sbox is array (Unsigned_32 range 0 .. 255) of Unsigned_8; type Key_Sbox is array (Natural range 0 .. 9) of Unsigned_32; function To_Unsigned_32 (Data : in Stream_Element_Array; Offset : in Stream_Element_Offset) return Unsigned_32; pragma Inline_Always (To_Unsigned_32); procedure Put_Unsigned_32 (Data : in out Stream_Element_Array; Value : in Unsigned_32; Offset : in Stream_Element_Offset); Te0 : constant Sbox := ( 16#c66363a5#, 16#f87c7c84#, 16#ee777799#, 16#f67b7b8d#, 16#fff2f20d#, 16#d66b6bbd#, 16#de6f6fb1#, 16#91c5c554#, 16#60303050#, 16#02010103#, 16#ce6767a9#, 16#562b2b7d#, 16#e7fefe19#, 16#b5d7d762#, 16#4dababe6#, 16#ec76769a#, 16#8fcaca45#, 16#1f82829d#, 16#89c9c940#, 16#fa7d7d87#, 16#effafa15#, 16#b25959eb#, 16#8e4747c9#, 16#fbf0f00b#, 16#41adadec#, 16#b3d4d467#, 16#5fa2a2fd#, 16#45afafea#, 16#239c9cbf#, 16#53a4a4f7#, 16#e4727296#, 16#9bc0c05b#, 16#75b7b7c2#, 16#e1fdfd1c#, 16#3d9393ae#, 16#4c26266a#, 16#6c36365a#, 16#7e3f3f41#, 16#f5f7f702#, 16#83cccc4f#, 16#6834345c#, 16#51a5a5f4#, 16#d1e5e534#, 16#f9f1f108#, 16#e2717193#, 16#abd8d873#, 16#62313153#, 16#2a15153f#, 16#0804040c#, 16#95c7c752#, 16#46232365#, 16#9dc3c35e#, 16#30181828#, 16#379696a1#, 16#0a05050f#, 16#2f9a9ab5#, 16#0e070709#, 16#24121236#, 16#1b80809b#, 16#dfe2e23d#, 16#cdebeb26#, 16#4e272769#, 16#7fb2b2cd#, 16#ea75759f#, 16#1209091b#, 16#1d83839e#, 16#582c2c74#, 16#341a1a2e#, 16#361b1b2d#, 16#dc6e6eb2#, 16#b45a5aee#, 16#5ba0a0fb#, 16#a45252f6#, 16#763b3b4d#, 16#b7d6d661#, 16#7db3b3ce#, 16#5229297b#, 16#dde3e33e#, 16#5e2f2f71#, 16#13848497#, 16#a65353f5#, 16#b9d1d168#, 16#00000000#, 16#c1eded2c#, 16#40202060#, 16#e3fcfc1f#, 16#79b1b1c8#, 16#b65b5bed#, 16#d46a6abe#, 16#8dcbcb46#, 16#67bebed9#, 16#7239394b#, 16#944a4ade#, 16#984c4cd4#, 16#b05858e8#, 16#85cfcf4a#, 16#bbd0d06b#, 16#c5efef2a#, 16#4faaaae5#, 16#edfbfb16#, 16#864343c5#, 16#9a4d4dd7#, 16#66333355#, 16#11858594#, 16#8a4545cf#, 16#e9f9f910#, 16#04020206#, 16#fe7f7f81#, 16#a05050f0#, 16#783c3c44#, 16#259f9fba#, 16#4ba8a8e3#, 16#a25151f3#, 16#5da3a3fe#, 16#804040c0#, 16#058f8f8a#, 16#3f9292ad#, 16#219d9dbc#, 16#70383848#, 16#f1f5f504#, 16#63bcbcdf#, 16#77b6b6c1#, 16#afdada75#, 16#42212163#, 16#20101030#, 16#e5ffff1a#, 16#fdf3f30e#, 16#bfd2d26d#, 16#81cdcd4c#, 16#180c0c14#, 16#26131335#, 16#c3ecec2f#, 16#be5f5fe1#, 16#359797a2#, 16#884444cc#, 16#2e171739#, 16#93c4c457#, 16#55a7a7f2#, 16#fc7e7e82#, 16#7a3d3d47#, 16#c86464ac#, 16#ba5d5de7#, 16#3219192b#, 16#e6737395#, 16#c06060a0#, 16#19818198#, 16#9e4f4fd1#, 16#a3dcdc7f#, 16#44222266#, 16#542a2a7e#, 16#3b9090ab#, 16#0b888883#, 16#8c4646ca#, 16#c7eeee29#, 16#6bb8b8d3#, 16#2814143c#, 16#a7dede79#, 16#bc5e5ee2#, 16#160b0b1d#, 16#addbdb76#, 16#dbe0e03b#, 16#64323256#, 16#743a3a4e#, 16#140a0a1e#, 16#924949db#, 16#0c06060a#, 16#4824246c#, 16#b85c5ce4#, 16#9fc2c25d#, 16#bdd3d36e#, 16#43acacef#, 16#c46262a6#, 16#399191a8#, 16#319595a4#, 16#d3e4e437#, 16#f279798b#, 16#d5e7e732#, 16#8bc8c843#, 16#6e373759#, 16#da6d6db7#, 16#018d8d8c#, 16#b1d5d564#, 16#9c4e4ed2#, 16#49a9a9e0#, 16#d86c6cb4#, 16#ac5656fa#, 16#f3f4f407#, 16#cfeaea25#, 16#ca6565af#, 16#f47a7a8e#, 16#47aeaee9#, 16#10080818#, 16#6fbabad5#, 16#f0787888#, 16#4a25256f#, 16#5c2e2e72#, 16#381c1c24#, 16#57a6a6f1#, 16#73b4b4c7#, 16#97c6c651#, 16#cbe8e823#, 16#a1dddd7c#, 16#e874749c#, 16#3e1f1f21#, 16#964b4bdd#, 16#61bdbddc#, 16#0d8b8b86#, 16#0f8a8a85#, 16#e0707090#, 16#7c3e3e42#, 16#71b5b5c4#, 16#cc6666aa#, 16#904848d8#, 16#06030305#, 16#f7f6f601#, 16#1c0e0e12#, 16#c26161a3#, 16#6a35355f#, 16#ae5757f9#, 16#69b9b9d0#, 16#17868691#, 16#99c1c158#, 16#3a1d1d27#, 16#279e9eb9#, 16#d9e1e138#, 16#ebf8f813#, 16#2b9898b3#, 16#22111133#, 16#d26969bb#, 16#a9d9d970#, 16#078e8e89#, 16#339494a7#, 16#2d9b9bb6#, 16#3c1e1e22#, 16#15878792#, 16#c9e9e920#, 16#87cece49#, 16#aa5555ff#, 16#50282878#, 16#a5dfdf7a#, 16#038c8c8f#, 16#59a1a1f8#, 16#09898980#, 16#1a0d0d17#, 16#65bfbfda#, 16#d7e6e631#, 16#844242c6#, 16#d06868b8#, 16#824141c3#, 16#299999b0#, 16#5a2d2d77#, 16#1e0f0f11#, 16#7bb0b0cb#, 16#a85454fc#, 16#6dbbbbd6#, 16#2c16163a#); Te1 : constant Sbox := ( 16#a5c66363#, 16#84f87c7c#, 16#99ee7777#, 16#8df67b7b#, 16#0dfff2f2#, 16#bdd66b6b#, 16#b1de6f6f#, 16#5491c5c5#, 16#50603030#, 16#03020101#, 16#a9ce6767#, 16#7d562b2b#, 16#19e7fefe#, 16#62b5d7d7#, 16#e64dabab#, 16#9aec7676#, 16#458fcaca#, 16#9d1f8282#, 16#4089c9c9#, 16#87fa7d7d#, 16#15effafa#, 16#ebb25959#, 16#c98e4747#, 16#0bfbf0f0#, 16#ec41adad#, 16#67b3d4d4#, 16#fd5fa2a2#, 16#ea45afaf#, 16#bf239c9c#, 16#f753a4a4#, 16#96e47272#, 16#5b9bc0c0#, 16#c275b7b7#, 16#1ce1fdfd#, 16#ae3d9393#, 16#6a4c2626#, 16#5a6c3636#, 16#417e3f3f#, 16#02f5f7f7#, 16#4f83cccc#, 16#5c683434#, 16#f451a5a5#, 16#34d1e5e5#, 16#08f9f1f1#, 16#93e27171#, 16#73abd8d8#, 16#53623131#, 16#3f2a1515#, 16#0c080404#, 16#5295c7c7#, 16#65462323#, 16#5e9dc3c3#, 16#28301818#, 16#a1379696#, 16#0f0a0505#, 16#b52f9a9a#, 16#090e0707#, 16#36241212#, 16#9b1b8080#, 16#3ddfe2e2#, 16#26cdebeb#, 16#694e2727#, 16#cd7fb2b2#, 16#9fea7575#, 16#1b120909#, 16#9e1d8383#, 16#74582c2c#, 16#2e341a1a#, 16#2d361b1b#, 16#b2dc6e6e#, 16#eeb45a5a#, 16#fb5ba0a0#, 16#f6a45252#, 16#4d763b3b#, 16#61b7d6d6#, 16#ce7db3b3#, 16#7b522929#, 16#3edde3e3#, 16#715e2f2f#, 16#97138484#, 16#f5a65353#, 16#68b9d1d1#, 16#00000000#, 16#2cc1eded#, 16#60402020#, 16#1fe3fcfc#, 16#c879b1b1#, 16#edb65b5b#, 16#bed46a6a#, 16#468dcbcb#, 16#d967bebe#, 16#4b723939#, 16#de944a4a#, 16#d4984c4c#, 16#e8b05858#, 16#4a85cfcf#, 16#6bbbd0d0#, 16#2ac5efef#, 16#e54faaaa#, 16#16edfbfb#, 16#c5864343#, 16#d79a4d4d#, 16#55663333#, 16#94118585#, 16#cf8a4545#, 16#10e9f9f9#, 16#06040202#, 16#81fe7f7f#, 16#f0a05050#, 16#44783c3c#, 16#ba259f9f#, 16#e34ba8a8#, 16#f3a25151#, 16#fe5da3a3#, 16#c0804040#, 16#8a058f8f#, 16#ad3f9292#, 16#bc219d9d#, 16#48703838#, 16#04f1f5f5#, 16#df63bcbc#, 16#c177b6b6#, 16#75afdada#, 16#63422121#, 16#30201010#, 16#1ae5ffff#, 16#0efdf3f3#, 16#6dbfd2d2#, 16#4c81cdcd#, 16#14180c0c#, 16#35261313#, 16#2fc3ecec#, 16#e1be5f5f#, 16#a2359797#, 16#cc884444#, 16#392e1717#, 16#5793c4c4#, 16#f255a7a7#, 16#82fc7e7e#, 16#477a3d3d#, 16#acc86464#, 16#e7ba5d5d#, 16#2b321919#, 16#95e67373#, 16#a0c06060#, 16#98198181#, 16#d19e4f4f#, 16#7fa3dcdc#, 16#66442222#, 16#7e542a2a#, 16#ab3b9090#, 16#830b8888#, 16#ca8c4646#, 16#29c7eeee#, 16#d36bb8b8#, 16#3c281414#, 16#79a7dede#, 16#e2bc5e5e#, 16#1d160b0b#, 16#76addbdb#, 16#3bdbe0e0#, 16#56643232#, 16#4e743a3a#, 16#1e140a0a#, 16#db924949#, 16#0a0c0606#, 16#6c482424#, 16#e4b85c5c#, 16#5d9fc2c2#, 16#6ebdd3d3#, 16#ef43acac#, 16#a6c46262#, 16#a8399191#, 16#a4319595#, 16#37d3e4e4#, 16#8bf27979#, 16#32d5e7e7#, 16#438bc8c8#, 16#596e3737#, 16#b7da6d6d#, 16#8c018d8d#, 16#64b1d5d5#, 16#d29c4e4e#, 16#e049a9a9#, 16#b4d86c6c#, 16#faac5656#, 16#07f3f4f4#, 16#25cfeaea#, 16#afca6565#, 16#8ef47a7a#, 16#e947aeae#, 16#18100808#, 16#d56fbaba#, 16#88f07878#, 16#6f4a2525#, 16#725c2e2e#, 16#24381c1c#, 16#f157a6a6#, 16#c773b4b4#, 16#5197c6c6#, 16#23cbe8e8#, 16#7ca1dddd#, 16#9ce87474#, 16#213e1f1f#, 16#dd964b4b#, 16#dc61bdbd#, 16#860d8b8b#, 16#850f8a8a#, 16#90e07070#, 16#427c3e3e#, 16#c471b5b5#, 16#aacc6666#, 16#d8904848#, 16#05060303#, 16#01f7f6f6#, 16#121c0e0e#, 16#a3c26161#, 16#5f6a3535#, 16#f9ae5757#, 16#d069b9b9#, 16#91178686#, 16#5899c1c1#, 16#273a1d1d#, 16#b9279e9e#, 16#38d9e1e1#, 16#13ebf8f8#, 16#b32b9898#, 16#33221111#, 16#bbd26969#, 16#70a9d9d9#, 16#89078e8e#, 16#a7339494#, 16#b62d9b9b#, 16#223c1e1e#, 16#92158787#, 16#20c9e9e9#, 16#4987cece#, 16#ffaa5555#, 16#78502828#, 16#7aa5dfdf#, 16#8f038c8c#, 16#f859a1a1#, 16#80098989#, 16#171a0d0d#, 16#da65bfbf#, 16#31d7e6e6#, 16#c6844242#, 16#b8d06868#, 16#c3824141#, 16#b0299999#, 16#775a2d2d#, 16#111e0f0f#, 16#cb7bb0b0#, 16#fca85454#, 16#d66dbbbb#, 16#3a2c1616#); Te2 : constant Sbox := ( 16#63a5c663#, 16#7c84f87c#, 16#7799ee77#, 16#7b8df67b#, 16#f20dfff2#, 16#6bbdd66b#, 16#6fb1de6f#, 16#c55491c5#, 16#30506030#, 16#01030201#, 16#67a9ce67#, 16#2b7d562b#, 16#fe19e7fe#, 16#d762b5d7#, 16#abe64dab#, 16#769aec76#, 16#ca458fca#, 16#829d1f82#, 16#c94089c9#, 16#7d87fa7d#, 16#fa15effa#, 16#59ebb259#, 16#47c98e47#, 16#f00bfbf0#, 16#adec41ad#, 16#d467b3d4#, 16#a2fd5fa2#, 16#afea45af#, 16#9cbf239c#, 16#a4f753a4#, 16#7296e472#, 16#c05b9bc0#, 16#b7c275b7#, 16#fd1ce1fd#, 16#93ae3d93#, 16#266a4c26#, 16#365a6c36#, 16#3f417e3f#, 16#f702f5f7#, 16#cc4f83cc#, 16#345c6834#, 16#a5f451a5#, 16#e534d1e5#, 16#f108f9f1#, 16#7193e271#, 16#d873abd8#, 16#31536231#, 16#153f2a15#, 16#040c0804#, 16#c75295c7#, 16#23654623#, 16#c35e9dc3#, 16#18283018#, 16#96a13796#, 16#050f0a05#, 16#9ab52f9a#, 16#07090e07#, 16#12362412#, 16#809b1b80#, 16#e23ddfe2#, 16#eb26cdeb#, 16#27694e27#, 16#b2cd7fb2#, 16#759fea75#, 16#091b1209#, 16#839e1d83#, 16#2c74582c#, 16#1a2e341a#, 16#1b2d361b#, 16#6eb2dc6e#, 16#5aeeb45a#, 16#a0fb5ba0#, 16#52f6a452#, 16#3b4d763b#, 16#d661b7d6#, 16#b3ce7db3#, 16#297b5229#, 16#e33edde3#, 16#2f715e2f#, 16#84971384#, 16#53f5a653#, 16#d168b9d1#, 16#00000000#, 16#ed2cc1ed#, 16#20604020#, 16#fc1fe3fc#, 16#b1c879b1#, 16#5bedb65b#, 16#6abed46a#, 16#cb468dcb#, 16#bed967be#, 16#394b7239#, 16#4ade944a#, 16#4cd4984c#, 16#58e8b058#, 16#cf4a85cf#, 16#d06bbbd0#, 16#ef2ac5ef#, 16#aae54faa#, 16#fb16edfb#, 16#43c58643#, 16#4dd79a4d#, 16#33556633#, 16#85941185#, 16#45cf8a45#, 16#f910e9f9#, 16#02060402#, 16#7f81fe7f#, 16#50f0a050#, 16#3c44783c#, 16#9fba259f#, 16#a8e34ba8#, 16#51f3a251#, 16#a3fe5da3#, 16#40c08040#, 16#8f8a058f#, 16#92ad3f92#, 16#9dbc219d#, 16#38487038#, 16#f504f1f5#, 16#bcdf63bc#, 16#b6c177b6#, 16#da75afda#, 16#21634221#, 16#10302010#, 16#ff1ae5ff#, 16#f30efdf3#, 16#d26dbfd2#, 16#cd4c81cd#, 16#0c14180c#, 16#13352613#, 16#ec2fc3ec#, 16#5fe1be5f#, 16#97a23597#, 16#44cc8844#, 16#17392e17#, 16#c45793c4#, 16#a7f255a7#, 16#7e82fc7e#, 16#3d477a3d#, 16#64acc864#, 16#5de7ba5d#, 16#192b3219#, 16#7395e673#, 16#60a0c060#, 16#81981981#, 16#4fd19e4f#, 16#dc7fa3dc#, 16#22664422#, 16#2a7e542a#, 16#90ab3b90#, 16#88830b88#, 16#46ca8c46#, 16#ee29c7ee#, 16#b8d36bb8#, 16#143c2814#, 16#de79a7de#, 16#5ee2bc5e#, 16#0b1d160b#, 16#db76addb#, 16#e03bdbe0#, 16#32566432#, 16#3a4e743a#, 16#0a1e140a#, 16#49db9249#, 16#060a0c06#, 16#246c4824#, 16#5ce4b85c#, 16#c25d9fc2#, 16#d36ebdd3#, 16#acef43ac#, 16#62a6c462#, 16#91a83991#, 16#95a43195#, 16#e437d3e4#, 16#798bf279#, 16#e732d5e7#, 16#c8438bc8#, 16#37596e37#, 16#6db7da6d#, 16#8d8c018d#, 16#d564b1d5#, 16#4ed29c4e#, 16#a9e049a9#, 16#6cb4d86c#, 16#56faac56#, 16#f407f3f4#, 16#ea25cfea#, 16#65afca65#, 16#7a8ef47a#, 16#aee947ae#, 16#08181008#, 16#bad56fba#, 16#7888f078#, 16#256f4a25#, 16#2e725c2e#, 16#1c24381c#, 16#a6f157a6#, 16#b4c773b4#, 16#c65197c6#, 16#e823cbe8#, 16#dd7ca1dd#, 16#749ce874#, 16#1f213e1f#, 16#4bdd964b#, 16#bddc61bd#, 16#8b860d8b#, 16#8a850f8a#, 16#7090e070#, 16#3e427c3e#, 16#b5c471b5#, 16#66aacc66#, 16#48d89048#, 16#03050603#, 16#f601f7f6#, 16#0e121c0e#, 16#61a3c261#, 16#355f6a35#, 16#57f9ae57#, 16#b9d069b9#, 16#86911786#, 16#c15899c1#, 16#1d273a1d#, 16#9eb9279e#, 16#e138d9e1#, 16#f813ebf8#, 16#98b32b98#, 16#11332211#, 16#69bbd269#, 16#d970a9d9#, 16#8e89078e#, 16#94a73394#, 16#9bb62d9b#, 16#1e223c1e#, 16#87921587#, 16#e920c9e9#, 16#ce4987ce#, 16#55ffaa55#, 16#28785028#, 16#df7aa5df#, 16#8c8f038c#, 16#a1f859a1#, 16#89800989#, 16#0d171a0d#, 16#bfda65bf#, 16#e631d7e6#, 16#42c68442#, 16#68b8d068#, 16#41c38241#, 16#99b02999#, 16#2d775a2d#, 16#0f111e0f#, 16#b0cb7bb0#, 16#54fca854#, 16#bbd66dbb#, 16#163a2c16#); Te3 : constant Sbox := ( 16#6363a5c6#, 16#7c7c84f8#, 16#777799ee#, 16#7b7b8df6#, 16#f2f20dff#, 16#6b6bbdd6#, 16#6f6fb1de#, 16#c5c55491#, 16#30305060#, 16#01010302#, 16#6767a9ce#, 16#2b2b7d56#, 16#fefe19e7#, 16#d7d762b5#, 16#ababe64d#, 16#76769aec#, 16#caca458f#, 16#82829d1f#, 16#c9c94089#, 16#7d7d87fa#, 16#fafa15ef#, 16#5959ebb2#, 16#4747c98e#, 16#f0f00bfb#, 16#adadec41#, 16#d4d467b3#, 16#a2a2fd5f#, 16#afafea45#, 16#9c9cbf23#, 16#a4a4f753#, 16#727296e4#, 16#c0c05b9b#, 16#b7b7c275#, 16#fdfd1ce1#, 16#9393ae3d#, 16#26266a4c#, 16#36365a6c#, 16#3f3f417e#, 16#f7f702f5#, 16#cccc4f83#, 16#34345c68#, 16#a5a5f451#, 16#e5e534d1#, 16#f1f108f9#, 16#717193e2#, 16#d8d873ab#, 16#31315362#, 16#15153f2a#, 16#04040c08#, 16#c7c75295#, 16#23236546#, 16#c3c35e9d#, 16#18182830#, 16#9696a137#, 16#05050f0a#, 16#9a9ab52f#, 16#0707090e#, 16#12123624#, 16#80809b1b#, 16#e2e23ddf#, 16#ebeb26cd#, 16#2727694e#, 16#b2b2cd7f#, 16#75759fea#, 16#09091b12#, 16#83839e1d#, 16#2c2c7458#, 16#1a1a2e34#, 16#1b1b2d36#, 16#6e6eb2dc#, 16#5a5aeeb4#, 16#a0a0fb5b#, 16#5252f6a4#, 16#3b3b4d76#, 16#d6d661b7#, 16#b3b3ce7d#, 16#29297b52#, 16#e3e33edd#, 16#2f2f715e#, 16#84849713#, 16#5353f5a6#, 16#d1d168b9#, 16#00000000#, 16#eded2cc1#, 16#20206040#, 16#fcfc1fe3#, 16#b1b1c879#, 16#5b5bedb6#, 16#6a6abed4#, 16#cbcb468d#, 16#bebed967#, 16#39394b72#, 16#4a4ade94#, 16#4c4cd498#, 16#5858e8b0#, 16#cfcf4a85#, 16#d0d06bbb#, 16#efef2ac5#, 16#aaaae54f#, 16#fbfb16ed#, 16#4343c586#, 16#4d4dd79a#, 16#33335566#, 16#85859411#, 16#4545cf8a#, 16#f9f910e9#, 16#02020604#, 16#7f7f81fe#, 16#5050f0a0#, 16#3c3c4478#, 16#9f9fba25#, 16#a8a8e34b#, 16#5151f3a2#, 16#a3a3fe5d#, 16#4040c080#, 16#8f8f8a05#, 16#9292ad3f#, 16#9d9dbc21#, 16#38384870#, 16#f5f504f1#, 16#bcbcdf63#, 16#b6b6c177#, 16#dada75af#, 16#21216342#, 16#10103020#, 16#ffff1ae5#, 16#f3f30efd#, 16#d2d26dbf#, 16#cdcd4c81#, 16#0c0c1418#, 16#13133526#, 16#ecec2fc3#, 16#5f5fe1be#, 16#9797a235#, 16#4444cc88#, 16#1717392e#, 16#c4c45793#, 16#a7a7f255#, 16#7e7e82fc#, 16#3d3d477a#, 16#6464acc8#, 16#5d5de7ba#, 16#19192b32#, 16#737395e6#, 16#6060a0c0#, 16#81819819#, 16#4f4fd19e#, 16#dcdc7fa3#, 16#22226644#, 16#2a2a7e54#, 16#9090ab3b#, 16#8888830b#, 16#4646ca8c#, 16#eeee29c7#, 16#b8b8d36b#, 16#14143c28#, 16#dede79a7#, 16#5e5ee2bc#, 16#0b0b1d16#, 16#dbdb76ad#, 16#e0e03bdb#, 16#32325664#, 16#3a3a4e74#, 16#0a0a1e14#, 16#4949db92#, 16#06060a0c#, 16#24246c48#, 16#5c5ce4b8#, 16#c2c25d9f#, 16#d3d36ebd#, 16#acacef43#, 16#6262a6c4#, 16#9191a839#, 16#9595a431#, 16#e4e437d3#, 16#79798bf2#, 16#e7e732d5#, 16#c8c8438b#, 16#3737596e#, 16#6d6db7da#, 16#8d8d8c01#, 16#d5d564b1#, 16#4e4ed29c#, 16#a9a9e049#, 16#6c6cb4d8#, 16#5656faac#, 16#f4f407f3#, 16#eaea25cf#, 16#6565afca#, 16#7a7a8ef4#, 16#aeaee947#, 16#08081810#, 16#babad56f#, 16#787888f0#, 16#25256f4a#, 16#2e2e725c#, 16#1c1c2438#, 16#a6a6f157#, 16#b4b4c773#, 16#c6c65197#, 16#e8e823cb#, 16#dddd7ca1#, 16#74749ce8#, 16#1f1f213e#, 16#4b4bdd96#, 16#bdbddc61#, 16#8b8b860d#, 16#8a8a850f#, 16#707090e0#, 16#3e3e427c#, 16#b5b5c471#, 16#6666aacc#, 16#4848d890#, 16#03030506#, 16#f6f601f7#, 16#0e0e121c#, 16#6161a3c2#, 16#35355f6a#, 16#5757f9ae#, 16#b9b9d069#, 16#86869117#, 16#c1c15899#, 16#1d1d273a#, 16#9e9eb927#, 16#e1e138d9#, 16#f8f813eb#, 16#9898b32b#, 16#11113322#, 16#6969bbd2#, 16#d9d970a9#, 16#8e8e8907#, 16#9494a733#, 16#9b9bb62d#, 16#1e1e223c#, 16#87879215#, 16#e9e920c9#, 16#cece4987#, 16#5555ffaa#, 16#28287850#, 16#dfdf7aa5#, 16#8c8c8f03#, 16#a1a1f859#, 16#89898009#, 16#0d0d171a#, 16#bfbfda65#, 16#e6e631d7#, 16#4242c684#, 16#6868b8d0#, 16#4141c382#, 16#9999b029#, 16#2d2d775a#, 16#0f0f111e#, 16#b0b0cb7b#, 16#5454fca8#, 16#bbbbd66d#, 16#16163a2c#); Te4 : constant Sbox := ( 16#63636363#, 16#7c7c7c7c#, 16#77777777#, 16#7b7b7b7b#, 16#f2f2f2f2#, 16#6b6b6b6b#, 16#6f6f6f6f#, 16#c5c5c5c5#, 16#30303030#, 16#01010101#, 16#67676767#, 16#2b2b2b2b#, 16#fefefefe#, 16#d7d7d7d7#, 16#abababab#, 16#76767676#, 16#cacacaca#, 16#82828282#, 16#c9c9c9c9#, 16#7d7d7d7d#, 16#fafafafa#, 16#59595959#, 16#47474747#, 16#f0f0f0f0#, 16#adadadad#, 16#d4d4d4d4#, 16#a2a2a2a2#, 16#afafafaf#, 16#9c9c9c9c#, 16#a4a4a4a4#, 16#72727272#, 16#c0c0c0c0#, 16#b7b7b7b7#, 16#fdfdfdfd#, 16#93939393#, 16#26262626#, 16#36363636#, 16#3f3f3f3f#, 16#f7f7f7f7#, 16#cccccccc#, 16#34343434#, 16#a5a5a5a5#, 16#e5e5e5e5#, 16#f1f1f1f1#, 16#71717171#, 16#d8d8d8d8#, 16#31313131#, 16#15151515#, 16#04040404#, 16#c7c7c7c7#, 16#23232323#, 16#c3c3c3c3#, 16#18181818#, 16#96969696#, 16#05050505#, 16#9a9a9a9a#, 16#07070707#, 16#12121212#, 16#80808080#, 16#e2e2e2e2#, 16#ebebebeb#, 16#27272727#, 16#b2b2b2b2#, 16#75757575#, 16#09090909#, 16#83838383#, 16#2c2c2c2c#, 16#1a1a1a1a#, 16#1b1b1b1b#, 16#6e6e6e6e#, 16#5a5a5a5a#, 16#a0a0a0a0#, 16#52525252#, 16#3b3b3b3b#, 16#d6d6d6d6#, 16#b3b3b3b3#, 16#29292929#, 16#e3e3e3e3#, 16#2f2f2f2f#, 16#84848484#, 16#53535353#, 16#d1d1d1d1#, 16#00000000#, 16#edededed#, 16#20202020#, 16#fcfcfcfc#, 16#b1b1b1b1#, 16#5b5b5b5b#, 16#6a6a6a6a#, 16#cbcbcbcb#, 16#bebebebe#, 16#39393939#, 16#4a4a4a4a#, 16#4c4c4c4c#, 16#58585858#, 16#cfcfcfcf#, 16#d0d0d0d0#, 16#efefefef#, 16#aaaaaaaa#, 16#fbfbfbfb#, 16#43434343#, 16#4d4d4d4d#, 16#33333333#, 16#85858585#, 16#45454545#, 16#f9f9f9f9#, 16#02020202#, 16#7f7f7f7f#, 16#50505050#, 16#3c3c3c3c#, 16#9f9f9f9f#, 16#a8a8a8a8#, 16#51515151#, 16#a3a3a3a3#, 16#40404040#, 16#8f8f8f8f#, 16#92929292#, 16#9d9d9d9d#, 16#38383838#, 16#f5f5f5f5#, 16#bcbcbcbc#, 16#b6b6b6b6#, 16#dadadada#, 16#21212121#, 16#10101010#, 16#ffffffff#, 16#f3f3f3f3#, 16#d2d2d2d2#, 16#cdcdcdcd#, 16#0c0c0c0c#, 16#13131313#, 16#ecececec#, 16#5f5f5f5f#, 16#97979797#, 16#44444444#, 16#17171717#, 16#c4c4c4c4#, 16#a7a7a7a7#, 16#7e7e7e7e#, 16#3d3d3d3d#, 16#64646464#, 16#5d5d5d5d#, 16#19191919#, 16#73737373#, 16#60606060#, 16#81818181#, 16#4f4f4f4f#, 16#dcdcdcdc#, 16#22222222#, 16#2a2a2a2a#, 16#90909090#, 16#88888888#, 16#46464646#, 16#eeeeeeee#, 16#b8b8b8b8#, 16#14141414#, 16#dededede#, 16#5e5e5e5e#, 16#0b0b0b0b#, 16#dbdbdbdb#, 16#e0e0e0e0#, 16#32323232#, 16#3a3a3a3a#, 16#0a0a0a0a#, 16#49494949#, 16#06060606#, 16#24242424#, 16#5c5c5c5c#, 16#c2c2c2c2#, 16#d3d3d3d3#, 16#acacacac#, 16#62626262#, 16#91919191#, 16#95959595#, 16#e4e4e4e4#, 16#79797979#, 16#e7e7e7e7#, 16#c8c8c8c8#, 16#37373737#, 16#6d6d6d6d#, 16#8d8d8d8d#, 16#d5d5d5d5#, 16#4e4e4e4e#, 16#a9a9a9a9#, 16#6c6c6c6c#, 16#56565656#, 16#f4f4f4f4#, 16#eaeaeaea#, 16#65656565#, 16#7a7a7a7a#, 16#aeaeaeae#, 16#08080808#, 16#babababa#, 16#78787878#, 16#25252525#, 16#2e2e2e2e#, 16#1c1c1c1c#, 16#a6a6a6a6#, 16#b4b4b4b4#, 16#c6c6c6c6#, 16#e8e8e8e8#, 16#dddddddd#, 16#74747474#, 16#1f1f1f1f#, 16#4b4b4b4b#, 16#bdbdbdbd#, 16#8b8b8b8b#, 16#8a8a8a8a#, 16#70707070#, 16#3e3e3e3e#, 16#b5b5b5b5#, 16#66666666#, 16#48484848#, 16#03030303#, 16#f6f6f6f6#, 16#0e0e0e0e#, 16#61616161#, 16#35353535#, 16#57575757#, 16#b9b9b9b9#, 16#86868686#, 16#c1c1c1c1#, 16#1d1d1d1d#, 16#9e9e9e9e#, 16#e1e1e1e1#, 16#f8f8f8f8#, 16#98989898#, 16#11111111#, 16#69696969#, 16#d9d9d9d9#, 16#8e8e8e8e#, 16#94949494#, 16#9b9b9b9b#, 16#1e1e1e1e#, 16#87878787#, 16#e9e9e9e9#, 16#cececece#, 16#55555555#, 16#28282828#, 16#dfdfdfdf#, 16#8c8c8c8c#, 16#a1a1a1a1#, 16#89898989#, 16#0d0d0d0d#, 16#bfbfbfbf#, 16#e6e6e6e6#, 16#42424242#, 16#68686868#, 16#41414141#, 16#99999999#, 16#2d2d2d2d#, 16#0f0f0f0f#, 16#b0b0b0b0#, 16#54545454#, 16#bbbbbbbb#, 16#16161616#); Td0 : constant Sbox := ( 16#51f4a750#, 16#7e416553#, 16#1a17a4c3#, 16#3a275e96#, 16#3bab6bcb#, 16#1f9d45f1#, 16#acfa58ab#, 16#4be30393#, 16#2030fa55#, 16#ad766df6#, 16#88cc7691#, 16#f5024c25#, 16#4fe5d7fc#, 16#c52acbd7#, 16#26354480#, 16#b562a38f#, 16#deb15a49#, 16#25ba1b67#, 16#45ea0e98#, 16#5dfec0e1#, 16#c32f7502#, 16#814cf012#, 16#8d4697a3#, 16#6bd3f9c6#, 16#038f5fe7#, 16#15929c95#, 16#bf6d7aeb#, 16#955259da#, 16#d4be832d#, 16#587421d3#, 16#49e06929#, 16#8ec9c844#, 16#75c2896a#, 16#f48e7978#, 16#99583e6b#, 16#27b971dd#, 16#bee14fb6#, 16#f088ad17#, 16#c920ac66#, 16#7dce3ab4#, 16#63df4a18#, 16#e51a3182#, 16#97513360#, 16#62537f45#, 16#b16477e0#, 16#bb6bae84#, 16#fe81a01c#, 16#f9082b94#, 16#70486858#, 16#8f45fd19#, 16#94de6c87#, 16#527bf8b7#, 16#ab73d323#, 16#724b02e2#, 16#e31f8f57#, 16#6655ab2a#, 16#b2eb2807#, 16#2fb5c203#, 16#86c57b9a#, 16#d33708a5#, 16#302887f2#, 16#23bfa5b2#, 16#02036aba#, 16#ed16825c#, 16#8acf1c2b#, 16#a779b492#, 16#f307f2f0#, 16#4e69e2a1#, 16#65daf4cd#, 16#0605bed5#, 16#d134621f#, 16#c4a6fe8a#, 16#342e539d#, 16#a2f355a0#, 16#058ae132#, 16#a4f6eb75#, 16#0b83ec39#, 16#4060efaa#, 16#5e719f06#, 16#bd6e1051#, 16#3e218af9#, 16#96dd063d#, 16#dd3e05ae#, 16#4de6bd46#, 16#91548db5#, 16#71c45d05#, 16#0406d46f#, 16#605015ff#, 16#1998fb24#, 16#d6bde997#, 16#894043cc#, 16#67d99e77#, 16#b0e842bd#, 16#07898b88#, 16#e7195b38#, 16#79c8eedb#, 16#a17c0a47#, 16#7c420fe9#, 16#f8841ec9#, 16#00000000#, 16#09808683#, 16#322bed48#, 16#1e1170ac#, 16#6c5a724e#, 16#fd0efffb#, 16#0f853856#, 16#3daed51e#, 16#362d3927#, 16#0a0fd964#, 16#685ca621#, 16#9b5b54d1#, 16#24362e3a#, 16#0c0a67b1#, 16#9357e70f#, 16#b4ee96d2#, 16#1b9b919e#, 16#80c0c54f#, 16#61dc20a2#, 16#5a774b69#, 16#1c121a16#, 16#e293ba0a#, 16#c0a02ae5#, 16#3c22e043#, 16#121b171d#, 16#0e090d0b#, 16#f28bc7ad#, 16#2db6a8b9#, 16#141ea9c8#, 16#57f11985#, 16#af75074c#, 16#ee99ddbb#, 16#a37f60fd#, 16#f701269f#, 16#5c72f5bc#, 16#44663bc5#, 16#5bfb7e34#, 16#8b432976#, 16#cb23c6dc#, 16#b6edfc68#, 16#b8e4f163#, 16#d731dcca#, 16#42638510#, 16#13972240#, 16#84c61120#, 16#854a247d#, 16#d2bb3df8#, 16#aef93211#, 16#c729a16d#, 16#1d9e2f4b#, 16#dcb230f3#, 16#0d8652ec#, 16#77c1e3d0#, 16#2bb3166c#, 16#a970b999#, 16#119448fa#, 16#47e96422#, 16#a8fc8cc4#, 16#a0f03f1a#, 16#567d2cd8#, 16#223390ef#, 16#87494ec7#, 16#d938d1c1#, 16#8ccaa2fe#, 16#98d40b36#, 16#a6f581cf#, 16#a57ade28#, 16#dab78e26#, 16#3fadbfa4#, 16#2c3a9de4#, 16#5078920d#, 16#6a5fcc9b#, 16#547e4662#, 16#f68d13c2#, 16#90d8b8e8#, 16#2e39f75e#, 16#82c3aff5#, 16#9f5d80be#, 16#69d0937c#, 16#6fd52da9#, 16#cf2512b3#, 16#c8ac993b#, 16#10187da7#, 16#e89c636e#, 16#db3bbb7b#, 16#cd267809#, 16#6e5918f4#, 16#ec9ab701#, 16#834f9aa8#, 16#e6956e65#, 16#aaffe67e#, 16#21bccf08#, 16#ef15e8e6#, 16#bae79bd9#, 16#4a6f36ce#, 16#ea9f09d4#, 16#29b07cd6#, 16#31a4b2af#, 16#2a3f2331#, 16#c6a59430#, 16#35a266c0#, 16#744ebc37#, 16#fc82caa6#, 16#e090d0b0#, 16#33a7d815#, 16#f104984a#, 16#41ecdaf7#, 16#7fcd500e#, 16#1791f62f#, 16#764dd68d#, 16#43efb04d#, 16#ccaa4d54#, 16#e49604df#, 16#9ed1b5e3#, 16#4c6a881b#, 16#c12c1fb8#, 16#4665517f#, 16#9d5eea04#, 16#018c355d#, 16#fa877473#, 16#fb0b412e#, 16#b3671d5a#, 16#92dbd252#, 16#e9105633#, 16#6dd64713#, 16#9ad7618c#, 16#37a10c7a#, 16#59f8148e#, 16#eb133c89#, 16#cea927ee#, 16#b761c935#, 16#e11ce5ed#, 16#7a47b13c#, 16#9cd2df59#, 16#55f2733f#, 16#1814ce79#, 16#73c737bf#, 16#53f7cdea#, 16#5ffdaa5b#, 16#df3d6f14#, 16#7844db86#, 16#caaff381#, 16#b968c43e#, 16#3824342c#, 16#c2a3405f#, 16#161dc372#, 16#bce2250c#, 16#283c498b#, 16#ff0d9541#, 16#39a80171#, 16#080cb3de#, 16#d8b4e49c#, 16#6456c190#, 16#7bcb8461#, 16#d532b670#, 16#486c5c74#, 16#d0b85742#); Td1 : constant Sbox := ( 16#5051f4a7#, 16#537e4165#, 16#c31a17a4#, 16#963a275e#, 16#cb3bab6b#, 16#f11f9d45#, 16#abacfa58#, 16#934be303#, 16#552030fa#, 16#f6ad766d#, 16#9188cc76#, 16#25f5024c#, 16#fc4fe5d7#, 16#d7c52acb#, 16#80263544#, 16#8fb562a3#, 16#49deb15a#, 16#6725ba1b#, 16#9845ea0e#, 16#e15dfec0#, 16#02c32f75#, 16#12814cf0#, 16#a38d4697#, 16#c66bd3f9#, 16#e7038f5f#, 16#9515929c#, 16#ebbf6d7a#, 16#da955259#, 16#2dd4be83#, 16#d3587421#, 16#2949e069#, 16#448ec9c8#, 16#6a75c289#, 16#78f48e79#, 16#6b99583e#, 16#dd27b971#, 16#b6bee14f#, 16#17f088ad#, 16#66c920ac#, 16#b47dce3a#, 16#1863df4a#, 16#82e51a31#, 16#60975133#, 16#4562537f#, 16#e0b16477#, 16#84bb6bae#, 16#1cfe81a0#, 16#94f9082b#, 16#58704868#, 16#198f45fd#, 16#8794de6c#, 16#b7527bf8#, 16#23ab73d3#, 16#e2724b02#, 16#57e31f8f#, 16#2a6655ab#, 16#07b2eb28#, 16#032fb5c2#, 16#9a86c57b#, 16#a5d33708#, 16#f2302887#, 16#b223bfa5#, 16#ba02036a#, 16#5ced1682#, 16#2b8acf1c#, 16#92a779b4#, 16#f0f307f2#, 16#a14e69e2#, 16#cd65daf4#, 16#d50605be#, 16#1fd13462#, 16#8ac4a6fe#, 16#9d342e53#, 16#a0a2f355#, 16#32058ae1#, 16#75a4f6eb#, 16#390b83ec#, 16#aa4060ef#, 16#065e719f#, 16#51bd6e10#, 16#f93e218a#, 16#3d96dd06#, 16#aedd3e05#, 16#464de6bd#, 16#b591548d#, 16#0571c45d#, 16#6f0406d4#, 16#ff605015#, 16#241998fb#, 16#97d6bde9#, 16#cc894043#, 16#7767d99e#, 16#bdb0e842#, 16#8807898b#, 16#38e7195b#, 16#db79c8ee#, 16#47a17c0a#, 16#e97c420f#, 16#c9f8841e#, 16#00000000#, 16#83098086#, 16#48322bed#, 16#ac1e1170#, 16#4e6c5a72#, 16#fbfd0eff#, 16#560f8538#, 16#1e3daed5#, 16#27362d39#, 16#640a0fd9#, 16#21685ca6#, 16#d19b5b54#, 16#3a24362e#, 16#b10c0a67#, 16#0f9357e7#, 16#d2b4ee96#, 16#9e1b9b91#, 16#4f80c0c5#, 16#a261dc20#, 16#695a774b#, 16#161c121a#, 16#0ae293ba#, 16#e5c0a02a#, 16#433c22e0#, 16#1d121b17#, 16#0b0e090d#, 16#adf28bc7#, 16#b92db6a8#, 16#c8141ea9#, 16#8557f119#, 16#4caf7507#, 16#bbee99dd#, 16#fda37f60#, 16#9ff70126#, 16#bc5c72f5#, 16#c544663b#, 16#345bfb7e#, 16#768b4329#, 16#dccb23c6#, 16#68b6edfc#, 16#63b8e4f1#, 16#cad731dc#, 16#10426385#, 16#40139722#, 16#2084c611#, 16#7d854a24#, 16#f8d2bb3d#, 16#11aef932#, 16#6dc729a1#, 16#4b1d9e2f#, 16#f3dcb230#, 16#ec0d8652#, 16#d077c1e3#, 16#6c2bb316#, 16#99a970b9#, 16#fa119448#, 16#2247e964#, 16#c4a8fc8c#, 16#1aa0f03f#, 16#d8567d2c#, 16#ef223390#, 16#c787494e#, 16#c1d938d1#, 16#fe8ccaa2#, 16#3698d40b#, 16#cfa6f581#, 16#28a57ade#, 16#26dab78e#, 16#a43fadbf#, 16#e42c3a9d#, 16#0d507892#, 16#9b6a5fcc#, 16#62547e46#, 16#c2f68d13#, 16#e890d8b8#, 16#5e2e39f7#, 16#f582c3af#, 16#be9f5d80#, 16#7c69d093#, 16#a96fd52d#, 16#b3cf2512#, 16#3bc8ac99#, 16#a710187d#, 16#6ee89c63#, 16#7bdb3bbb#, 16#09cd2678#, 16#f46e5918#, 16#01ec9ab7#, 16#a8834f9a#, 16#65e6956e#, 16#7eaaffe6#, 16#0821bccf#, 16#e6ef15e8#, 16#d9bae79b#, 16#ce4a6f36#, 16#d4ea9f09#, 16#d629b07c#, 16#af31a4b2#, 16#312a3f23#, 16#30c6a594#, 16#c035a266#, 16#37744ebc#, 16#a6fc82ca#, 16#b0e090d0#, 16#1533a7d8#, 16#4af10498#, 16#f741ecda#, 16#0e7fcd50#, 16#2f1791f6#, 16#8d764dd6#, 16#4d43efb0#, 16#54ccaa4d#, 16#dfe49604#, 16#e39ed1b5#, 16#1b4c6a88#, 16#b8c12c1f#, 16#7f466551#, 16#049d5eea#, 16#5d018c35#, 16#73fa8774#, 16#2efb0b41#, 16#5ab3671d#, 16#5292dbd2#, 16#33e91056#, 16#136dd647#, 16#8c9ad761#, 16#7a37a10c#, 16#8e59f814#, 16#89eb133c#, 16#eecea927#, 16#35b761c9#, 16#ede11ce5#, 16#3c7a47b1#, 16#599cd2df#, 16#3f55f273#, 16#791814ce#, 16#bf73c737#, 16#ea53f7cd#, 16#5b5ffdaa#, 16#14df3d6f#, 16#867844db#, 16#81caaff3#, 16#3eb968c4#, 16#2c382434#, 16#5fc2a340#, 16#72161dc3#, 16#0cbce225#, 16#8b283c49#, 16#41ff0d95#, 16#7139a801#, 16#de080cb3#, 16#9cd8b4e4#, 16#906456c1#, 16#617bcb84#, 16#70d532b6#, 16#74486c5c#, 16#42d0b857#); Td2 : constant Sbox := ( 16#a75051f4#, 16#65537e41#, 16#a4c31a17#, 16#5e963a27#, 16#6bcb3bab#, 16#45f11f9d#, 16#58abacfa#, 16#03934be3#, 16#fa552030#, 16#6df6ad76#, 16#769188cc#, 16#4c25f502#, 16#d7fc4fe5#, 16#cbd7c52a#, 16#44802635#, 16#a38fb562#, 16#5a49deb1#, 16#1b6725ba#, 16#0e9845ea#, 16#c0e15dfe#, 16#7502c32f#, 16#f012814c#, 16#97a38d46#, 16#f9c66bd3#, 16#5fe7038f#, 16#9c951592#, 16#7aebbf6d#, 16#59da9552#, 16#832dd4be#, 16#21d35874#, 16#692949e0#, 16#c8448ec9#, 16#896a75c2#, 16#7978f48e#, 16#3e6b9958#, 16#71dd27b9#, 16#4fb6bee1#, 16#ad17f088#, 16#ac66c920#, 16#3ab47dce#, 16#4a1863df#, 16#3182e51a#, 16#33609751#, 16#7f456253#, 16#77e0b164#, 16#ae84bb6b#, 16#a01cfe81#, 16#2b94f908#, 16#68587048#, 16#fd198f45#, 16#6c8794de#, 16#f8b7527b#, 16#d323ab73#, 16#02e2724b#, 16#8f57e31f#, 16#ab2a6655#, 16#2807b2eb#, 16#c2032fb5#, 16#7b9a86c5#, 16#08a5d337#, 16#87f23028#, 16#a5b223bf#, 16#6aba0203#, 16#825ced16#, 16#1c2b8acf#, 16#b492a779#, 16#f2f0f307#, 16#e2a14e69#, 16#f4cd65da#, 16#bed50605#, 16#621fd134#, 16#fe8ac4a6#, 16#539d342e#, 16#55a0a2f3#, 16#e132058a#, 16#eb75a4f6#, 16#ec390b83#, 16#efaa4060#, 16#9f065e71#, 16#1051bd6e#, 16#8af93e21#, 16#063d96dd#, 16#05aedd3e#, 16#bd464de6#, 16#8db59154#, 16#5d0571c4#, 16#d46f0406#, 16#15ff6050#, 16#fb241998#, 16#e997d6bd#, 16#43cc8940#, 16#9e7767d9#, 16#42bdb0e8#, 16#8b880789#, 16#5b38e719#, 16#eedb79c8#, 16#0a47a17c#, 16#0fe97c42#, 16#1ec9f884#, 16#00000000#, 16#86830980#, 16#ed48322b#, 16#70ac1e11#, 16#724e6c5a#, 16#fffbfd0e#, 16#38560f85#, 16#d51e3dae#, 16#3927362d#, 16#d9640a0f#, 16#a621685c#, 16#54d19b5b#, 16#2e3a2436#, 16#67b10c0a#, 16#e70f9357#, 16#96d2b4ee#, 16#919e1b9b#, 16#c54f80c0#, 16#20a261dc#, 16#4b695a77#, 16#1a161c12#, 16#ba0ae293#, 16#2ae5c0a0#, 16#e0433c22#, 16#171d121b#, 16#0d0b0e09#, 16#c7adf28b#, 16#a8b92db6#, 16#a9c8141e#, 16#198557f1#, 16#074caf75#, 16#ddbbee99#, 16#60fda37f#, 16#269ff701#, 16#f5bc5c72#, 16#3bc54466#, 16#7e345bfb#, 16#29768b43#, 16#c6dccb23#, 16#fc68b6ed#, 16#f163b8e4#, 16#dccad731#, 16#85104263#, 16#22401397#, 16#112084c6#, 16#247d854a#, 16#3df8d2bb#, 16#3211aef9#, 16#a16dc729#, 16#2f4b1d9e#, 16#30f3dcb2#, 16#52ec0d86#, 16#e3d077c1#, 16#166c2bb3#, 16#b999a970#, 16#48fa1194#, 16#642247e9#, 16#8cc4a8fc#, 16#3f1aa0f0#, 16#2cd8567d#, 16#90ef2233#, 16#4ec78749#, 16#d1c1d938#, 16#a2fe8cca#, 16#0b3698d4#, 16#81cfa6f5#, 16#de28a57a#, 16#8e26dab7#, 16#bfa43fad#, 16#9de42c3a#, 16#920d5078#, 16#cc9b6a5f#, 16#4662547e#, 16#13c2f68d#, 16#b8e890d8#, 16#f75e2e39#, 16#aff582c3#, 16#80be9f5d#, 16#937c69d0#, 16#2da96fd5#, 16#12b3cf25#, 16#993bc8ac#, 16#7da71018#, 16#636ee89c#, 16#bb7bdb3b#, 16#7809cd26#, 16#18f46e59#, 16#b701ec9a#, 16#9aa8834f#, 16#6e65e695#, 16#e67eaaff#, 16#cf0821bc#, 16#e8e6ef15#, 16#9bd9bae7#, 16#36ce4a6f#, 16#09d4ea9f#, 16#7cd629b0#, 16#b2af31a4#, 16#23312a3f#, 16#9430c6a5#, 16#66c035a2#, 16#bc37744e#, 16#caa6fc82#, 16#d0b0e090#, 16#d81533a7#, 16#984af104#, 16#daf741ec#, 16#500e7fcd#, 16#f62f1791#, 16#d68d764d#, 16#b04d43ef#, 16#4d54ccaa#, 16#04dfe496#, 16#b5e39ed1#, 16#881b4c6a#, 16#1fb8c12c#, 16#517f4665#, 16#ea049d5e#, 16#355d018c#, 16#7473fa87#, 16#412efb0b#, 16#1d5ab367#, 16#d25292db#, 16#5633e910#, 16#47136dd6#, 16#618c9ad7#, 16#0c7a37a1#, 16#148e59f8#, 16#3c89eb13#, 16#27eecea9#, 16#c935b761#, 16#e5ede11c#, 16#b13c7a47#, 16#df599cd2#, 16#733f55f2#, 16#ce791814#, 16#37bf73c7#, 16#cdea53f7#, 16#aa5b5ffd#, 16#6f14df3d#, 16#db867844#, 16#f381caaf#, 16#c43eb968#, 16#342c3824#, 16#405fc2a3#, 16#c372161d#, 16#250cbce2#, 16#498b283c#, 16#9541ff0d#, 16#017139a8#, 16#b3de080c#, 16#e49cd8b4#, 16#c1906456#, 16#84617bcb#, 16#b670d532#, 16#5c74486c#, 16#5742d0b8#); Td3 : constant Sbox := ( 16#f4a75051#, 16#4165537e#, 16#17a4c31a#, 16#275e963a#, 16#ab6bcb3b#, 16#9d45f11f#, 16#fa58abac#, 16#e303934b#, 16#30fa5520#, 16#766df6ad#, 16#cc769188#, 16#024c25f5#, 16#e5d7fc4f#, 16#2acbd7c5#, 16#35448026#, 16#62a38fb5#, 16#b15a49de#, 16#ba1b6725#, 16#ea0e9845#, 16#fec0e15d#, 16#2f7502c3#, 16#4cf01281#, 16#4697a38d#, 16#d3f9c66b#, 16#8f5fe703#, 16#929c9515#, 16#6d7aebbf#, 16#5259da95#, 16#be832dd4#, 16#7421d358#, 16#e0692949#, 16#c9c8448e#, 16#c2896a75#, 16#8e7978f4#, 16#583e6b99#, 16#b971dd27#, 16#e14fb6be#, 16#88ad17f0#, 16#20ac66c9#, 16#ce3ab47d#, 16#df4a1863#, 16#1a3182e5#, 16#51336097#, 16#537f4562#, 16#6477e0b1#, 16#6bae84bb#, 16#81a01cfe#, 16#082b94f9#, 16#48685870#, 16#45fd198f#, 16#de6c8794#, 16#7bf8b752#, 16#73d323ab#, 16#4b02e272#, 16#1f8f57e3#, 16#55ab2a66#, 16#eb2807b2#, 16#b5c2032f#, 16#c57b9a86#, 16#3708a5d3#, 16#2887f230#, 16#bfa5b223#, 16#036aba02#, 16#16825ced#, 16#cf1c2b8a#, 16#79b492a7#, 16#07f2f0f3#, 16#69e2a14e#, 16#daf4cd65#, 16#05bed506#, 16#34621fd1#, 16#a6fe8ac4#, 16#2e539d34#, 16#f355a0a2#, 16#8ae13205#, 16#f6eb75a4#, 16#83ec390b#, 16#60efaa40#, 16#719f065e#, 16#6e1051bd#, 16#218af93e#, 16#dd063d96#, 16#3e05aedd#, 16#e6bd464d#, 16#548db591#, 16#c45d0571#, 16#06d46f04#, 16#5015ff60#, 16#98fb2419#, 16#bde997d6#, 16#4043cc89#, 16#d99e7767#, 16#e842bdb0#, 16#898b8807#, 16#195b38e7#, 16#c8eedb79#, 16#7c0a47a1#, 16#420fe97c#, 16#841ec9f8#, 16#00000000#, 16#80868309#, 16#2bed4832#, 16#1170ac1e#, 16#5a724e6c#, 16#0efffbfd#, 16#8538560f#, 16#aed51e3d#, 16#2d392736#, 16#0fd9640a#, 16#5ca62168#, 16#5b54d19b#, 16#362e3a24#, 16#0a67b10c#, 16#57e70f93#, 16#ee96d2b4#, 16#9b919e1b#, 16#c0c54f80#, 16#dc20a261#, 16#774b695a#, 16#121a161c#, 16#93ba0ae2#, 16#a02ae5c0#, 16#22e0433c#, 16#1b171d12#, 16#090d0b0e#, 16#8bc7adf2#, 16#b6a8b92d#, 16#1ea9c814#, 16#f1198557#, 16#75074caf#, 16#99ddbbee#, 16#7f60fda3#, 16#01269ff7#, 16#72f5bc5c#, 16#663bc544#, 16#fb7e345b#, 16#4329768b#, 16#23c6dccb#, 16#edfc68b6#, 16#e4f163b8#, 16#31dccad7#, 16#63851042#, 16#97224013#, 16#c6112084#, 16#4a247d85#, 16#bb3df8d2#, 16#f93211ae#, 16#29a16dc7#, 16#9e2f4b1d#, 16#b230f3dc#, 16#8652ec0d#, 16#c1e3d077#, 16#b3166c2b#, 16#70b999a9#, 16#9448fa11#, 16#e9642247#, 16#fc8cc4a8#, 16#f03f1aa0#, 16#7d2cd856#, 16#3390ef22#, 16#494ec787#, 16#38d1c1d9#, 16#caa2fe8c#, 16#d40b3698#, 16#f581cfa6#, 16#7ade28a5#, 16#b78e26da#, 16#adbfa43f#, 16#3a9de42c#, 16#78920d50#, 16#5fcc9b6a#, 16#7e466254#, 16#8d13c2f6#, 16#d8b8e890#, 16#39f75e2e#, 16#c3aff582#, 16#5d80be9f#, 16#d0937c69#, 16#d52da96f#, 16#2512b3cf#, 16#ac993bc8#, 16#187da710#, 16#9c636ee8#, 16#3bbb7bdb#, 16#267809cd#, 16#5918f46e#, 16#9ab701ec#, 16#4f9aa883#, 16#956e65e6#, 16#ffe67eaa#, 16#bccf0821#, 16#15e8e6ef#, 16#e79bd9ba#, 16#6f36ce4a#, 16#9f09d4ea#, 16#b07cd629#, 16#a4b2af31#, 16#3f23312a#, 16#a59430c6#, 16#a266c035#, 16#4ebc3774#, 16#82caa6fc#, 16#90d0b0e0#, 16#a7d81533#, 16#04984af1#, 16#ecdaf741#, 16#cd500e7f#, 16#91f62f17#, 16#4dd68d76#, 16#efb04d43#, 16#aa4d54cc#, 16#9604dfe4#, 16#d1b5e39e#, 16#6a881b4c#, 16#2c1fb8c1#, 16#65517f46#, 16#5eea049d#, 16#8c355d01#, 16#877473fa#, 16#0b412efb#, 16#671d5ab3#, 16#dbd25292#, 16#105633e9#, 16#d647136d#, 16#d7618c9a#, 16#a10c7a37#, 16#f8148e59#, 16#133c89eb#, 16#a927eece#, 16#61c935b7#, 16#1ce5ede1#, 16#47b13c7a#, 16#d2df599c#, 16#f2733f55#, 16#14ce7918#, 16#c737bf73#, 16#f7cdea53#, 16#fdaa5b5f#, 16#3d6f14df#, 16#44db8678#, 16#aff381ca#, 16#68c43eb9#, 16#24342c38#, 16#a3405fc2#, 16#1dc37216#, 16#e2250cbc#, 16#3c498b28#, 16#0d9541ff#, 16#a8017139#, 16#0cb3de08#, 16#b4e49cd8#, 16#56c19064#, 16#cb84617b#, 16#32b670d5#, 16#6c5c7448#, 16#b85742d0#); Td4 : constant Final_Sbox := ( 16#52#, 16#09#, 16#6a#, 16#d5#, 16#30#, 16#36#, 16#a5#, 16#38#, 16#bf#, 16#40#, 16#a3#, 16#9e#, 16#81#, 16#f3#, 16#d7#, 16#fb#, 16#7c#, 16#e3#, 16#39#, 16#82#, 16#9b#, 16#2f#, 16#ff#, 16#87#, 16#34#, 16#8e#, 16#43#, 16#44#, 16#c4#, 16#de#, 16#e9#, 16#cb#, 16#54#, 16#7b#, 16#94#, 16#32#, 16#a6#, 16#c2#, 16#23#, 16#3d#, 16#ee#, 16#4c#, 16#95#, 16#0b#, 16#42#, 16#fa#, 16#c3#, 16#4e#, 16#08#, 16#2e#, 16#a1#, 16#66#, 16#28#, 16#d9#, 16#24#, 16#b2#, 16#76#, 16#5b#, 16#a2#, 16#49#, 16#6d#, 16#8b#, 16#d1#, 16#25#, 16#72#, 16#f8#, 16#f6#, 16#64#, 16#86#, 16#68#, 16#98#, 16#16#, 16#d4#, 16#a4#, 16#5c#, 16#cc#, 16#5d#, 16#65#, 16#b6#, 16#92#, 16#6c#, 16#70#, 16#48#, 16#50#, 16#fd#, 16#ed#, 16#b9#, 16#da#, 16#5e#, 16#15#, 16#46#, 16#57#, 16#a7#, 16#8d#, 16#9d#, 16#84#, 16#90#, 16#d8#, 16#ab#, 16#00#, 16#8c#, 16#bc#, 16#d3#, 16#0a#, 16#f7#, 16#e4#, 16#58#, 16#05#, 16#b8#, 16#b3#, 16#45#, 16#06#, 16#d0#, 16#2c#, 16#1e#, 16#8f#, 16#ca#, 16#3f#, 16#0f#, 16#02#, 16#c1#, 16#af#, 16#bd#, 16#03#, 16#01#, 16#13#, 16#8a#, 16#6b#, 16#3a#, 16#91#, 16#11#, 16#41#, 16#4f#, 16#67#, 16#dc#, 16#ea#, 16#97#, 16#f2#, 16#cf#, 16#ce#, 16#f0#, 16#b4#, 16#e6#, 16#73#, 16#96#, 16#ac#, 16#74#, 16#22#, 16#e7#, 16#ad#, 16#35#, 16#85#, 16#e2#, 16#f9#, 16#37#, 16#e8#, 16#1c#, 16#75#, 16#df#, 16#6e#, 16#47#, 16#f1#, 16#1a#, 16#71#, 16#1d#, 16#29#, 16#c5#, 16#89#, 16#6f#, 16#b7#, 16#62#, 16#0e#, 16#aa#, 16#18#, 16#be#, 16#1b#, 16#fc#, 16#56#, 16#3e#, 16#4b#, 16#c6#, 16#d2#, 16#79#, 16#20#, 16#9a#, 16#db#, 16#c0#, 16#fe#, 16#78#, 16#cd#, 16#5a#, 16#f4#, 16#1f#, 16#dd#, 16#a8#, 16#33#, 16#88#, 16#07#, 16#c7#, 16#31#, 16#b1#, 16#12#, 16#10#, 16#59#, 16#27#, 16#80#, 16#ec#, 16#5f#, 16#60#, 16#51#, 16#7f#, 16#a9#, 16#19#, 16#b5#, 16#4a#, 16#0d#, 16#2d#, 16#e5#, 16#7a#, 16#9f#, 16#93#, 16#c9#, 16#9c#, 16#ef#, 16#a0#, 16#e0#, 16#3b#, 16#4d#, 16#ae#, 16#2a#, 16#f5#, 16#b0#, 16#c8#, 16#eb#, 16#bb#, 16#3c#, 16#83#, 16#53#, 16#99#, 16#61#, 16#17#, 16#2b#, 16#04#, 16#7e#, 16#ba#, 16#77#, 16#d6#, 16#26#, 16#e1#, 16#69#, 16#14#, 16#63#, 16#55#, 16#21#, 16#0c#, 16#7d#); -- for 128-bit blocks, Rijndael never uses more than 10 rcon values Rcon : constant Key_Sbox := ( 16#01000000#, 16#02000000#, 16#04000000#, 16#08000000#, 16#10000000#, 16#20000000#, 16#40000000#, 16#80000000#, 16#1B000000#, 16#36000000#); function To_Unsigned_32 (Data : in Stream_Element_Array; Offset : in Stream_Element_Offset) return Unsigned_32 is begin return Shift_Left (Unsigned_32 (Data (Offset)), 24) or Shift_Left (Unsigned_32 (Data (Offset + 1)), 16) or Shift_Left (Unsigned_32 (Data (Offset + 2)), 8) or Unsigned_32 (Data (Offset + 3)); end To_Unsigned_32; procedure Put_Unsigned_32 (Data : in out Stream_Element_Array; Value : in Unsigned_32; Offset : in Stream_Element_Offset) is begin Data (Offset) := Stream_Element (Shift_Right (Value, 24)); Data (Offset + 1) := Stream_Element (Shift_Right (Value, 16) and 16#0ff#); Data (Offset + 2) := Stream_Element (Shift_Right (Value, 8) and 16#0ff#); Data (Offset + 3) := Stream_Element (Value and 16#0ff#); end Put_Unsigned_32; procedure Set_Encrypt_Key (Key : out Key_Type; Data : in Secret_Key) is Temp : Unsigned_32; N : Natural := 0; I : Natural := 0; pragma Style_Checks ("-mr"); begin Key.Key (0) := To_Unsigned_32 (Data.Secret, Data.Secret'First + 0); Key.Key (1) := To_Unsigned_32 (Data.Secret, Data.Secret'First + 4); Key.Key (2) := To_Unsigned_32 (Data.Secret, Data.Secret'First + 8); Key.Key (3) := To_Unsigned_32 (Data.Secret, Data.Secret'First + 12); if Data.Length = 128 / 8 then Key.Rounds := 10; loop Temp := Key.Key (N + 3); Key.Key (N + 4) := Key.Key (N + 0) xor (Te4 (Shift_Right (Temp, 16) and 16#0ff#) and 16#ff000000#) xor (Te4 (Shift_Right (Temp, 8) and 16#0ff#) and 16#00ff0000#) xor (Te4 (Temp and 16#0ff#) and 16#0000ff00#) xor (Te4 (Shift_Right (Temp, 24) and 16#0ff#) and 16#00ff#) xor Rcon (I); Key.Key (N + 5) := Key.Key (N + 1) xor Key.Key (N + 4); Key.Key (N + 6) := Key.Key (N + 2) xor Key.Key (N + 5); Key.Key (N + 7) := Key.Key (N + 3) xor Key.Key (N + 6); I := I + 1; exit when I = 10; N := N + 4; end loop; return; end if; Key.Key (4) := To_Unsigned_32 (Data.Secret, Data.Secret'First + 16); Key.Key (5) := To_Unsigned_32 (Data.Secret, Data.Secret'First + 20); if Data.Length = 192 / 8 then Key.Rounds := 12; loop Temp := Key.Key (N + 5); Key.Key (N + 6) := Key.Key (N + 0) xor (Te4 (Shift_Right (Temp, 16) and 16#0ff#) and 16#ff000000#) xor (Te4 (Shift_Right (Temp, 8) and 16#0ff#) and 16#00ff0000#) xor (Te4 (Temp and 16#0ff#) and 16#0000ff00#) xor (Te4 (Shift_Right (Temp, 24) and 16#0ff#) and 16#00ff#) xor Rcon (I); Key.Key (N + 7) := Key.Key (N + 1) xor Key.Key (N + 6); Key.Key (N + 8) := Key.Key (N + 2) xor Key.Key (N + 7); Key.Key (N + 9) := Key.Key (N + 3) xor Key.Key (N + 8); I := I + 1; exit when I = 8; Key.Key (N + 10) := Key.Key (N + 4) xor Key.Key (N + 9); Key.Key (N + 11) := Key.Key (N + 5) xor Key.Key (N + 10); N := N + 6; end loop; return; end if; Key.Key (6) := To_Unsigned_32 (Data.Secret, Data.Secret'First + 24); Key.Key (7) := To_Unsigned_32 (Data.Secret, Data.Secret'First + 28); if Data.Length = 256 / 8 then Key.Rounds := 14; loop Temp := Key.Key (N + 7); Key.Key (N + 8) := Key.Key (N + 0) xor (Te4 (Shift_Right (Temp, 16) and 16#0ff#) and 16#ff000000#) xor (Te4 (Shift_Right (Temp, 8) and 16#0ff#) and 16#00ff0000#) xor (Te4 (Temp and 16#0ff#) and 16#0000ff00#) xor (Te4 (Shift_Right (Temp, 24) and 16#0ff#) and 16#00ff#) xor Rcon (I); Key.Key (N + 8) := Key.Key (N + 0); Key.Key (N + 8) := Key.Key (N + 8) xor (Te4 (Shift_Right (Temp, 16) and 16#0ff#) and 16#ff000000#); Key.Key (N + 8) := Key.Key (N + 8) xor (Te4 (Shift_Right (Temp, 8) and 16#0ff#) and 16#00ff0000#); Key.Key (N + 8) := Key.Key (N + 8) xor (Te4 (Temp and 16#0ff#) and 16#0000ff00#); Key.Key (N + 8) := Key.Key (N + 8) xor (Te4 (Shift_Right (Temp, 24) and 16#0ff#) and 16#00ff#); Key.Key (N + 8) := Key.Key (N + 8) xor Rcon (I); Key.Key (N + 9) := Key.Key (N + 1) xor Key.Key (N + 8); Key.Key (N + 10) := Key.Key (N + 2) xor Key.Key (N + 9); Key.Key (N + 11) := Key.Key (N + 3) xor Key.Key (N + 10); I := I + 1; exit when I = 7; Temp := Key.Key (N + 11); Key.Key (N + 12) := Key.Key (N + 4) xor (Te4 (Shift_Right (Temp, 24) and 16#0ff#) and 16#ff000000#) xor (Te4 (Shift_Right (Temp, 16) and 16#0ff#) and 16#00ff0000#) xor (Te4 (Shift_Right (Temp, 8) and 16#0ff#) and 16#0000ff00#) xor (Te4 (Temp and 16#0ff#) and 16#00ff#); Key.Key (N + 13) := Key.Key (N + 5) xor Key.Key (N + 12); Key.Key (N + 14) := Key.Key (N + 6) xor Key.Key (N + 13); Key.Key (N + 15) := Key.Key (N + 7) xor Key.Key (N + 14); N := N + 8; end loop; return; end if; end Set_Encrypt_Key; procedure Swap (A, B : in out Unsigned_32); procedure Swap (A, B : in out Unsigned_32) is Temp : constant Unsigned_32 := A; begin A := B; B := Temp; end Swap; procedure Set_Decrypt_Key (Key : out Key_Type; Data : in Secret_Key) is I : Natural := 0; J : Natural := 0; Last : Natural; begin Set_Encrypt_Key (Key, Data); Last := 4 * Key.Rounds; J := Last; while I < J loop Swap (Key.Key (I), Key.Key (J)); Swap (Key.Key (I + 1), Key.Key (J + 1)); Swap (Key.Key (I + 2), Key.Key (J + 2)); Swap (Key.Key (I + 3), Key.Key (J + 3)); I := I + 4; J := J - 4; end loop; I := 4; while I <= Last - 4 loop Key.Key (I) := Td0 (Te4 (Shift_Right (Key.Key (I), 24) and 16#0ff#) and 16#0ff#) xor Td1 (Te4 (Shift_Right (Key.Key (I), 16) and 16#0ff#) and 16#0ff#) xor Td2 (Te4 (Shift_Right (Key.Key (I), 8) and 16#0ff#) and 16#0ff#) xor Td3 (Te4 (Key.Key (I) and 16#0ff#) and 16#0ff#); Key.Key (I + 1) := Td0 (Te4 (Shift_Right (Key.Key (I + 1), 24) and 16#0ff#) and 16#0ff#) xor Td1 (Te4 (Shift_Right (Key.Key (I + 1), 16) and 16#0ff#) and 16#0ff#) xor Td2 (Te4 (Shift_Right (Key.Key (I + 1), 8) and 16#0ff#) and 16#0ff#) xor Td3 (Te4 (Key.Key (I + 1) and 16#0ff#) and 16#0ff#); Key.Key (I + 2) := Td0 (Te4 (Shift_Right (Key.Key (I + 2), 24) and 16#0ff#) and 16#0ff#) xor Td1 (Te4 (Shift_Right (Key.Key (I + 2), 16) and 16#0ff#) and 16#0ff#) xor Td2 (Te4 (Shift_Right (Key.Key (I + 2), 8) and 16#0ff#) and 16#0ff#) xor Td3 (Te4 (Key.Key (I + 2) and 16#0ff#) and 16#0ff#); Key.Key (I + 3) := Td0 (Te4 (Shift_Right (Key.Key (I + 3), 24) and 16#0ff#) and 16#0ff#) xor Td1 (Te4 (Shift_Right (Key.Key (I + 3), 16) and 16#0ff#) and 16#0ff#) xor Td2 (Te4 (Shift_Right (Key.Key (I + 3), 8) and 16#0ff#) and 16#0ff#) xor Td3 (Te4 (Key.Key (I + 3) and 16#0ff#) and 16#0ff#); I := I + 4; end loop; end Set_Decrypt_Key; -- ------------------------------ -- Set the encryption initialization vector before starting the encryption. -- ------------------------------ procedure Set_IV (E : in out Cipher; IV : in Word_Block_Type) is begin E.IV := IV; end Set_IV; procedure Set_IV (E : in out Cipher; Key : in Secret_Key) is Pos : Stream_Element_Offset := Key.Secret'First; begin for I in E.IV'Range loop E.IV (I) := To_Unsigned_32 (Key.Secret, Pos); Pos := Pos + 4; end loop; end Set_IV; procedure Set_IV (E : in out Cipher; Key : in Secret_Key; IV : in Word_Block_Type) is Pos : Stream_Element_Offset := Key.Secret'First; begin E.IV := IV; for I in E.IV'Range loop exit when Pos + 3 > Key.Secret'Last; E.IV (I) := E.IV (I) xor To_Unsigned_32 (Key.Secret, Pos); Pos := Pos + 4; end loop; end Set_IV; -- ------------------------------ -- Set the padding. -- ------------------------------ procedure Set_Padding (E : in out Cipher; Padding : in AES_Padding) is begin E.Padding := Padding; end Set_Padding; -- ------------------------------ -- Get the padding used. -- ------------------------------ function Padding (E : in Cipher) return AES_Padding is begin return E.Padding; end Padding; -- ------------------------------ -- Return true if the cipher has a encryption/decryption key configured. -- ------------------------------ function Has_Key (E : in Cipher) return Boolean is begin return E.Key.Rounds > 0; end Has_Key; overriding procedure Finalize (Object : in out Cipher) is begin Object.Key.Key := (others => 0); Object.IV := (others => 0); Object.Data := (others => 0); end Finalize; -- ------------------------------ -- Set the encryption key to use. -- ------------------------------ procedure Set_Key (E : in out Encoder; Data : in Secret_Key; Mode : in AES_Mode := CBC) is begin Set_Encrypt_Key (E.Key, Data); E.Mode := Mode; end Set_Key; -- ------------------------------ -- Encodes the binary input stream represented by <b>Data</b> into -- an SHA-1 hash output stream <b>Into</b>. -- -- If the transformer does not have enough room to write the result, -- it must return in <b>Encoded</b> the index of the last encoded -- position in the <b>Data</b> stream. -- -- The transformer returns in <b>Last</b> the last valid position -- in the output stream <b>Into</b>. -- -- The <b>Encoding_Error</b> exception is raised if the input -- stream cannot be transformed. -- ------------------------------ overriding procedure Transform (E : in out Encoder; Data : in Ada.Streams.Stream_Element_Array; Into : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset; Encoded : out Ada.Streams.Stream_Element_Offset) is Pos : Ada.Streams.Stream_Element_Offset := Data'First; R : Word_Block_Type; Pos_Limit : Ada.Streams.Stream_Element_Offset; Last_Limit : Ada.Streams.Stream_Element_Offset; begin Last := Into'First; if E.Data_Count > 0 then while E.Data_Count < E.Data'Last loop E.Data_Count := E.Data_Count + 1; E.Data (E.Data_Count) := Data (Pos); Pos := Pos + 1; exit when E.Data_Count = E.Data'Last; if Pos > Data'Last then Encoded := Data'Last; return; end if; end loop; -- Encrypt current block. case E.Mode is when ECB => Encrypt (E.Data, Into (Last .. Last + Block_Type'Length - 1), E.Key); when CBC => E.IV (1) := E.IV (1) xor To_Unsigned_32 (E.Data, E.Data'First); E.IV (2) := E.IV (2) xor To_Unsigned_32 (E.Data, E.Data'First + 4); E.IV (3) := E.IV (3) xor To_Unsigned_32 (E.Data, E.Data'First + 8); E.IV (4) := E.IV (4) xor To_Unsigned_32 (E.Data, E.Data'First + 12); Encrypt (E.IV, E.Key); Put_Unsigned_32 (Into, E.IV (1), Last); Put_Unsigned_32 (Into, E.IV (2), Last + 4); Put_Unsigned_32 (Into, E.IV (3), Last + 8); Put_Unsigned_32 (Into, E.IV (4), Last + 12); when PCBC => E.IV (1) := E.IV (1) xor To_Unsigned_32 (E.Data, E.Data'First); E.IV (2) := E.IV (2) xor To_Unsigned_32 (E.Data, E.Data'First + 4); E.IV (3) := E.IV (3) xor To_Unsigned_32 (E.Data, E.Data'First + 8); E.IV (4) := E.IV (4) xor To_Unsigned_32 (E.Data, E.Data'First + 12); Encrypt (E.IV, E.Key); Put_Unsigned_32 (Into, E.IV (1), Last); Put_Unsigned_32 (Into, E.IV (2), Last + 4); Put_Unsigned_32 (Into, E.IV (3), Last + 8); Put_Unsigned_32 (Into, E.IV (4), Last + 12); E.IV (1) := E.IV (1) xor To_Unsigned_32 (E.Data, E.Data'First); E.IV (2) := E.IV (2) xor To_Unsigned_32 (E.Data, E.Data'First + 4); E.IV (3) := E.IV (3) xor To_Unsigned_32 (E.Data, E.Data'First + 8); E.IV (4) := E.IV (4) xor To_Unsigned_32 (E.Data, E.Data'First + 12); when CFB => Encrypt (E.IV, E.Key); E.IV (1) := E.IV (1) xor To_Unsigned_32 (E.Data, Pos); E.IV (2) := E.IV (2) xor To_Unsigned_32 (E.Data, Pos + 4); E.IV (3) := E.IV (3) xor To_Unsigned_32 (E.Data, Pos + 8); E.IV (4) := E.IV (4) xor To_Unsigned_32 (E.Data, Pos + 12); Put_Unsigned_32 (Into, E.IV (1), Last); Put_Unsigned_32 (Into, E.IV (2), Last + 4); Put_Unsigned_32 (Into, E.IV (3), Last + 8); Put_Unsigned_32 (Into, E.IV (4), Last + 12); when OFB => Encrypt (E.IV, E.Key); Put_Unsigned_32 (Into, E.IV (1) xor To_Unsigned_32 (E.Data, Pos), Last); Put_Unsigned_32 (Into, E.IV (2) xor To_Unsigned_32 (E.Data, Pos + 4), Last + 4); Put_Unsigned_32 (Into, E.IV (3) xor To_Unsigned_32 (E.Data, Pos + 8), Last + 8); Put_Unsigned_32 (Into, E.IV (4) xor To_Unsigned_32 (E.Data, Pos + 12), Last + 12); when CTR => Encrypt (E.IV, R, E.Key); Put_Unsigned_32 (Into, R (1) xor To_Unsigned_32 (E.Data, Pos), Last); Put_Unsigned_32 (Into, R (2) xor To_Unsigned_32 (E.Data, Pos + 4), Last + 4); Put_Unsigned_32 (Into, R (3) xor To_Unsigned_32 (E.Data, Pos + 8), Last + 8); Put_Unsigned_32 (Into, R (4) xor To_Unsigned_32 (E.Data, Pos + 12), Last + 12); E.IV (4) := E.IV (4) + 1; if E.IV (4) = 0 then E.IV (3) := E.IV (3) + 1; end if; end case; Last := Last + Block_Type'Length; E.Data_Count := 0; end if; Pos_Limit := Data'Last - Block_Type'Length + 1; Last_Limit := Into'Last - Block_Type'Length + 1; case E.Mode is when ECB => while Pos <= Pos_Limit and Last <= Last_Limit loop Encrypt (Data (Pos .. Pos + Block_Type'Length - 1), Into (Last .. Last + Block_Type'Length - 1), E.Key); Last := Last + Block_Type'Length; Pos := Pos + Block_Type'Length; end loop; when CBC => while Pos <= Pos_Limit and Last <= Last_Limit loop E.IV (1) := E.IV (1) xor To_Unsigned_32 (Data, Pos); E.IV (2) := E.IV (2) xor To_Unsigned_32 (Data, Pos + 4); E.IV (3) := E.IV (3) xor To_Unsigned_32 (Data, Pos + 8); E.IV (4) := E.IV (4) xor To_Unsigned_32 (Data, Pos + 12); Encrypt (E.IV, E.Key); Put_Unsigned_32 (Into, E.IV (1), Last); Put_Unsigned_32 (Into, E.IV (2), Last + 4); Put_Unsigned_32 (Into, E.IV (3), Last + 8); Put_Unsigned_32 (Into, E.IV (4), Last + 12); Last := Last + Block_Type'Length; Pos := Pos + Block_Type'Length; end loop; when PCBC => while Pos <= Pos_Limit and Last <= Last_Limit loop E.IV (1) := E.IV (1) xor To_Unsigned_32 (Data, Pos); E.IV (2) := E.IV (2) xor To_Unsigned_32 (Data, Pos + 4); E.IV (3) := E.IV (3) xor To_Unsigned_32 (Data, Pos + 8); E.IV (4) := E.IV (4) xor To_Unsigned_32 (Data, Pos + 12); Encrypt (E.IV, E.Key); Put_Unsigned_32 (Into, E.IV (1), Last); Put_Unsigned_32 (Into, E.IV (2), Last + 4); Put_Unsigned_32 (Into, E.IV (3), Last + 8); Put_Unsigned_32 (Into, E.IV (4), Last + 12); E.IV (1) := E.IV (1) xor To_Unsigned_32 (Data, Pos); E.IV (2) := E.IV (2) xor To_Unsigned_32 (Data, Pos + 4); E.IV (3) := E.IV (3) xor To_Unsigned_32 (Data, Pos + 8); E.IV (4) := E.IV (4) xor To_Unsigned_32 (Data, Pos + 12); Last := Last + Block_Type'Length; Pos := Pos + Block_Type'Length; end loop; when CFB => while Pos <= Pos_Limit and Last <= Last_Limit loop Encrypt (E.IV, E.Key); E.IV (1) := E.IV (1) xor To_Unsigned_32 (Data, Pos); E.IV (2) := E.IV (2) xor To_Unsigned_32 (Data, Pos + 4); E.IV (3) := E.IV (3) xor To_Unsigned_32 (Data, Pos + 8); E.IV (4) := E.IV (4) xor To_Unsigned_32 (Data, Pos + 12); Put_Unsigned_32 (Into, E.IV (1), Last); Put_Unsigned_32 (Into, E.IV (2), Last + 4); Put_Unsigned_32 (Into, E.IV (3), Last + 8); Put_Unsigned_32 (Into, E.IV (4), Last + 12); Last := Last + Block_Type'Length; Pos := Pos + Block_Type'Length; end loop; when OFB => while Pos <= Pos_Limit and Last <= Last_Limit loop Encrypt (E.IV, E.Key); Put_Unsigned_32 (Into, E.IV (1) xor To_Unsigned_32 (Data, Pos), Last); Put_Unsigned_32 (Into, E.IV (2) xor To_Unsigned_32 (Data, Pos + 4), Last + 4); Put_Unsigned_32 (Into, E.IV (3) xor To_Unsigned_32 (Data, Pos + 8), Last + 8); Put_Unsigned_32 (Into, E.IV (4) xor To_Unsigned_32 (Data, Pos + 12), Last + 12); Last := Last + Block_Type'Length; Pos := Pos + Block_Type'Length; end loop; when CTR => while Pos <= Pos_Limit and Last <= Last_Limit loop Encrypt (E.IV, R, E.Key); Put_Unsigned_32 (Into, R (1) xor To_Unsigned_32 (Data, Pos), Last); Put_Unsigned_32 (Into, R (2) xor To_Unsigned_32 (Data, Pos + 4), Last + 4); Put_Unsigned_32 (Into, R (3) xor To_Unsigned_32 (Data, Pos + 8), Last + 8); Put_Unsigned_32 (Into, R (4) xor To_Unsigned_32 (Data, Pos + 12), Last + 12); E.IV (4) := E.IV (4) + 1; if E.IV (4) = 0 then E.IV (3) := E.IV (3) + 1; end if; Last := Last + Block_Type'Length; Pos := Pos + Block_Type'Length; end loop; end case; -- Save data that must be encoded in the next 16-byte AES block. while Pos <= Data'Last loop E.Data_Count := E.Data_Count + 1; E.Data (E.Data_Count) := Data (Pos); Pos := Pos + 1; exit when E.Data_Count = Count_Type'Last; end loop; Last := Last - 1; Encoded := Pos - 1; end Transform; -- Finish encoding the input array. overriding procedure Finish (E : in out Encoder; Into : in out Ada.Streams.Stream_Element_Array; Last : in out Ada.Streams.Stream_Element_Offset) is Padding : constant Ada.Streams.Stream_Element_Offset := 16 - E.Data_Count; Pad_Value : constant Stream_Element := (if E.Padding = ZERO_PADDING then 0 else Stream_Element (Padding mod 16)); Pad : constant Ada.Streams.Stream_Element_Array (1 .. Padding) := (others => Pad_Value); Encoded : Ada.Streams.Stream_Element_Offset; begin E.Transform (Pad, Into, Last, Encoded); pragma Assert (Encoded = Pad'Last); pragma Assert (E.Data_Count = 0); end Finish; -- ------------------------------ -- Encrypt the secret using the encoder and return the encrypted value in the buffer. -- The target buffer must be a multiple of 16-bytes block. -- ------------------------------ procedure Encrypt_Secret (E : in out Encoder; Secret : in Secret_Key; Into : out Ada.Streams.Stream_Element_Array) is Last : Ada.Streams.Stream_Element_Offset; Encoded : Ada.Streams.Stream_Element_Offset; begin E.Transform (Data => Secret.Secret, Into => Into (Into'First .. Into'Last - 16), Last => Last, Encoded => Encoded); E.Finish (Into => Into (Last + 1 .. Into'Last), Last => Last); end Encrypt_Secret; -- ------------------------------ -- Set the encryption key to use. -- ------------------------------ procedure Set_Key (E : in out Decoder; Data : in Secret_Key; Mode : in AES_Mode := CBC) is begin if Mode = OFB or MODE = CFB or MODE = CTR then Set_Encrypt_Key (E.Key, Data); else Set_Decrypt_Key (E.Key, Data); end if; E.Mode := Mode; end Set_Key; -- ------------------------------ -- Encodes the binary input stream represented by <b>Data</b> into -- an SHA-1 hash output stream <b>Into</b>. -- -- If the transformer does not have enough room to write the result, -- it must return in <b>Encoded</b> the index of the last encoded -- position in the <b>Data</b> stream. -- -- The transformer returns in <b>Last</b> the last valid position -- in the output stream <b>Into</b>. -- -- The <b>Encoding_Error</b> exception is raised if the input -- stream cannot be transformed. -- ------------------------------ overriding procedure Transform (E : in out Decoder; Data : in Ada.Streams.Stream_Element_Array; Into : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset; Encoded : out Ada.Streams.Stream_Element_Offset) is Pos : Ada.Streams.Stream_Element_Offset := Data'First; R : Word_Block_Type; Pos_Limit : Ada.Streams.Stream_Element_Offset; Last_Limit : Ada.Streams.Stream_Element_Offset; begin Last := Into'First; if E.Data_Count > 0 then while E.Data_Count /= 16 loop E.Data_Count := E.Data_Count + 1; E.Data (E.Data_Count) := Data (Pos); Pos := Pos + 1; if Pos > Data'Last then Encoded := Data'Last; return; end if; end loop; -- Decrypt current block. case E.Mode is when ECB => Decrypt (E.Data, Into (Last .. Last + Block_Type'Length - 1), E.Key); when CBC => Decrypt (E.Data, E.Data2, E.Key); Put_Unsigned_32 (Into, E.IV (1) xor To_Unsigned_32 (E.Data2, E.Data2'First), Last); Put_Unsigned_32 (Into, E.IV (2) xor To_Unsigned_32 (E.Data2, E.Data2'First + 4), Last + 4); Put_Unsigned_32 (Into, E.IV (3) xor To_Unsigned_32 (E.Data2, E.Data2'First + 8), Last + 8); Put_Unsigned_32 (Into, E.IV (4) xor To_Unsigned_32 (E.Data2, E.Data2'First + 12), Last + 12); E.IV (1) := To_Unsigned_32 (E.Data, E.Data'First); E.IV (2) := To_Unsigned_32 (E.Data, E.Data'First + 4); E.IV (3) := To_Unsigned_32 (E.Data, E.Data'First + 8); E.IV (4) := To_Unsigned_32 (E.Data, E.Data'First + 12); when PCBC => Decrypt (E.Data, E.Data2, E.Key); E.IV (1) := E.IV (1) xor To_Unsigned_32 (E.Data2, E.Data2'First); E.IV (2) := E.IV (2) xor To_Unsigned_32 (E.Data2, E.Data2'First + 4); E.IV (3) := E.IV (3) xor To_Unsigned_32 (E.Data2, E.Data2'First + 8); E.IV (4) := E.IV (4) xor To_Unsigned_32 (E.Data2, E.Data2'First + 12); Put_Unsigned_32 (Into, E.IV (1), Last); Put_Unsigned_32 (Into, E.IV (2), Last + 4); Put_Unsigned_32 (Into, E.IV (3), Last + 8); Put_Unsigned_32 (Into, E.IV (4), Last + 12); E.IV (1) := E.IV (1) xor To_Unsigned_32 (E.Data, E.Data'First); E.IV (2) := E.IV (2) xor To_Unsigned_32 (E.Data, E.Data'First + 4); E.IV (3) := E.IV (3) xor To_Unsigned_32 (E.Data, E.Data'First + 8); E.IV (4) := E.IV (4) xor To_Unsigned_32 (E.Data, E.Data'First + 12); when CFB => Encrypt (E.IV, E.Key); E.IV (1) := E.IV (1) xor To_Unsigned_32 (E.Data, E.Data'First); E.IV (2) := E.IV (2) xor To_Unsigned_32 (E.Data, E.Data'First + 4); E.IV (3) := E.IV (3) xor To_Unsigned_32 (E.Data, E.Data'First + 8); E.IV (4) := E.IV (4) xor To_Unsigned_32 (E.Data, E.Data'First + 12); Put_Unsigned_32 (Into, E.IV (1), Last); Put_Unsigned_32 (Into, E.IV (2), Last + 4); Put_Unsigned_32 (Into, E.IV (3), Last + 8); Put_Unsigned_32 (Into, E.IV (4), Last + 12); when OFB => Encrypt (E.IV, E.Key); Put_Unsigned_32 (Into, E.IV (1) xor To_Unsigned_32 (E.Data, E.Data'First), Last); Put_Unsigned_32 (Into, E.IV (2) xor To_Unsigned_32 (E.Data, E.Data'First + 4), Last + 4); Put_Unsigned_32 (Into, E.IV (3) xor To_Unsigned_32 (E.Data, E.Data'First + 8), Last + 8); Put_Unsigned_32 (Into, E.IV (4) xor To_Unsigned_32 (E.Data, E.Data'First + 12), Last + 12); when CTR => Encrypt (E.IV, R, E.Key); Put_Unsigned_32 (Into, R (1) xor To_Unsigned_32 (E.Data, E.Data'First), Last); Put_Unsigned_32 (Into, R (2) xor To_Unsigned_32 (E.Data, E.Data'First + 4), Last + 4); Put_Unsigned_32 (Into, R (3) xor To_Unsigned_32 (E.Data, E.Data'First + 8), Last + 8); Put_Unsigned_32 (Into, R (4) xor To_Unsigned_32 (E.Data, E.Data'First + 12), Last + 12); E.IV (4) := E.IV (4) + 1; if E.IV (4) = 0 then E.IV (3) := E.IV (3) + 1; end if; end case; Last := Last + Block_Type'Length; E.Data_Count := 0; end if; -- Exclude the last 16 bytes Pos_Limit := Data'Last - Block_Type'Length; Last_Limit := Into'Last - Block_Type'Length; case E.Mode is when ECB => while Pos <= Pos_Limit and Last <= Last_Limit loop Decrypt (Data (Pos .. Pos + Block_Type'Length - 1), Into (Last .. Last + Block_Type'Length - 1), E.Key); Last := Last + Block_Type'Length; Pos := Pos + Block_Type'Length; end loop; when CBC => while Pos <= Pos_Limit and Last <= Last_Limit loop Decrypt (Data (Pos .. Pos + Block_Type'Length - 1), E.Data, E.Key); Put_Unsigned_32 (Into, E.IV (1) xor To_Unsigned_32 (E.Data, E.Data'First), Last); Put_Unsigned_32 (Into, E.IV (2) xor To_Unsigned_32 (E.Data, E.Data'First + 4), Last + 4); Put_Unsigned_32 (Into, E.IV (3) xor To_Unsigned_32 (E.Data, E.Data'First + 8), Last + 8); Put_Unsigned_32 (Into, E.IV (4) xor To_Unsigned_32 (E.Data, E.Data'First + 12), Last + 12); E.IV (1) := To_Unsigned_32 (Data, Pos); E.IV (2) := To_Unsigned_32 (Data, Pos + 4); E.IV (3) := To_Unsigned_32 (Data, Pos + 8); E.IV (4) := To_Unsigned_32 (Data, Pos + 12); Last := Last + Block_Type'Length; Pos := Pos + Block_Type'Length; end loop; when PCBC => while Pos <= Pos_Limit and Last <= Last_Limit loop Decrypt (Data (Pos .. Pos + Block_Type'Length - 1), E.Data, E.Key); E.IV (1) := E.IV (1) xor To_Unsigned_32 (E.Data, E.Data'First); E.IV (2) := E.IV (2) xor To_Unsigned_32 (E.Data, E.Data'First + 4); E.IV (3) := E.IV (3) xor To_Unsigned_32 (E.Data, E.Data'First + 8); E.IV (4) := E.IV (4) xor To_Unsigned_32 (E.Data, E.Data'First + 12); Put_Unsigned_32 (Into, E.IV (1), Last); Put_Unsigned_32 (Into, E.IV (2), Last + 4); Put_Unsigned_32 (Into, E.IV (3), Last + 8); Put_Unsigned_32 (Into, E.IV (4), Last + 12); E.IV (1) := E.IV (1) xor To_Unsigned_32 (Data, Pos); E.IV (2) := E.IV (2) xor To_Unsigned_32 (Data, Pos + 4); E.IV (3) := E.IV (3) xor To_Unsigned_32 (Data, Pos + 8); E.IV (4) := E.IV (4) xor To_Unsigned_32 (Data, Pos + 12); Last := Last + Block_Type'Length; Pos := Pos + Block_Type'Length; end loop; when CFB => while Pos <= Pos_Limit and Last <= Last_Limit loop Encrypt (E.IV, E.Key); declare Val : Unsigned_32; begin Val := To_Unsigned_32 (Data, Pos); Put_Unsigned_32 (Into, E.IV (1) xor Val, Last); E.IV (1) := Val; Val := To_Unsigned_32 (Data, Pos + 4); Put_Unsigned_32 (Into, E.IV (2) xor Val, Last + 4); E.IV (2) := Val; Val := To_Unsigned_32 (Data, Pos + 8); Put_Unsigned_32 (Into, E.IV (3) xor val, Last + 8); E.IV (3) := Val; Val := To_Unsigned_32 (Data, Pos + 12); Put_Unsigned_32 (Into, E.IV (4) xor Val, Last + 12); E.IV (4) := Val; end; Last := Last + Block_Type'Length; Pos := Pos + Block_Type'Length; end loop; when OFB => while Pos <= Pos_Limit and Last <= Last_Limit loop Encrypt (E.IV, E.Key); Put_Unsigned_32 (Into, E.IV (1) xor To_Unsigned_32 (Data, Pos), Last); Put_Unsigned_32 (Into, E.IV (2) xor To_Unsigned_32 (Data, Pos + 4), Last + 4); Put_Unsigned_32 (Into, E.IV (3) xor To_Unsigned_32 (Data, Pos + 8), Last + 8); Put_Unsigned_32 (Into, E.IV (4) xor To_Unsigned_32 (Data, Pos + 12), Last + 12); Last := Last + Block_Type'Length; Pos := Pos + Block_Type'Length; end loop; when CTR => while Pos <= Pos_Limit and Last <= Last_Limit loop Encrypt (E.IV, R, E.Key); Put_Unsigned_32 (Into, R (1) xor To_Unsigned_32 (Data, Pos), Last); Put_Unsigned_32 (Into, R (2) xor To_Unsigned_32 (Data, Pos + 4), Last + 4); Put_Unsigned_32 (Into, R (3) xor To_Unsigned_32 (Data, Pos + 8), Last + 8); Put_Unsigned_32 (Into, R (4) xor To_Unsigned_32 (Data, Pos + 12), Last + 12); E.IV (4) := E.IV (4) + 1; if E.IV (4) = 0 then E.IV (3) := E.IV (3) + 1; end if; Last := Last + Block_Type'Length; Pos := Pos + Block_Type'Length; end loop; end case; -- Save data that must be encoded in the next 16-byte AES block. if Data'Last - Pos < E.Data'Length then while Pos <= Data'Last loop E.Data_Count := E.Data_Count + 1; E.Data (E.Data_Count) := Data (Pos); Pos := Pos + 1; exit when E.Data_Count = Count_Type'Last; end loop; end if; Last := Last - 1; Encoded := Pos - 1; end Transform; -- Finish encoding the input array. overriding procedure Finish (E : in out Decoder; Into : in out Ada.Streams.Stream_Element_Array; Last : in out Ada.Streams.Stream_Element_Offset) is Data : Block_Type; Count : Ada.Streams.Stream_Element_Offset; begin case E.Mode is when ECB => Decrypt (E.Data, Data, E.Key); when CBC => Decrypt (E.Data, Data, E.Key); Put_Unsigned_32 (Data, E.IV (1) xor To_Unsigned_32 (Data, Data'First), Data'First); Put_Unsigned_32 (Data, E.IV (2) xor To_Unsigned_32 (Data, Data'First + 4), Data'First + 4); Put_Unsigned_32 (Data, E.IV (3) xor To_Unsigned_32 (Data, Data'First + 8), Data'First + 8); Put_Unsigned_32 (Data, E.IV (4) xor To_Unsigned_32 (Data, Data'First + 12), Data'First + 12); E.IV (1) := To_Unsigned_32 (E.Data, E.Data'First); E.IV (2) := To_Unsigned_32 (E.Data, E.Data'First + 4); E.IV (3) := To_Unsigned_32 (E.Data, E.Data'First + 8); E.IV (4) := To_Unsigned_32 (E.Data, E.Data'First + 12); when PCBC => Decrypt (E.Data, Data, E.Key); E.IV (1) := E.IV (1) xor To_Unsigned_32 (Data, Data'First); E.IV (2) := E.IV (2) xor To_Unsigned_32 (Data, Data'First + 4); E.IV (3) := E.IV (3) xor To_Unsigned_32 (Data, Data'First + 8); E.IV (4) := E.IV (4) xor To_Unsigned_32 (Data, Data'First + 12); Put_Unsigned_32 (Data, E.IV (1), Data'First); Put_Unsigned_32 (Data, E.IV (2), Data'First + 4); Put_Unsigned_32 (Data, E.IV (3), Data'First + 8); Put_Unsigned_32 (Data, E.IV (4), Data'First + 12); when OFB => Encrypt (E.IV, E.Key); Put_Unsigned_32 (Data, E.IV (1) xor To_Unsigned_32 (E.Data, E.Data'First), Data'First); Put_Unsigned_32 (Data, E.IV (2) xor To_Unsigned_32 (E.Data, E.Data'First + 4), Data'First + 4); Put_Unsigned_32 (Data, E.IV (3) xor To_Unsigned_32 (E.Data, E.Data'First + 8), Data'First + 8); Put_Unsigned_32 (Data, E.IV (4) xor To_Unsigned_32 (E.Data, E.Data'First + 12), Data'First + 12); when CFB => Encrypt (E.IV, E.Key); E.IV (1) := E.IV (1) xor To_Unsigned_32 (E.Data, E.Data'First); E.IV (2) := E.IV (2) xor To_Unsigned_32 (E.Data, E.Data'First + 4); E.IV (3) := E.IV (3) xor To_Unsigned_32 (E.Data, E.Data'First + 8); E.IV (4) := E.IV (4) xor To_Unsigned_32 (E.Data, E.Data'First + 12); Put_Unsigned_32 (Data, E.IV (1), Data'First); Put_Unsigned_32 (Data, E.IV (2), Data'First + 4); Put_Unsigned_32 (Data, E.IV (3), Data'First + 8); Put_Unsigned_32 (Data, E.IV (4), Data'First + 12); when CTR => declare R : Word_Block_Type; begin Encrypt (E.IV, R, E.Key); Put_Unsigned_32 (Data, R (1) xor To_Unsigned_32 (E.Data, E.Data'First), Data'First); Put_Unsigned_32 (Data, R (2) xor To_Unsigned_32 (E.Data, E.Data'First + 4), Data'First + 4); Put_Unsigned_32 (Data, R (3) xor To_Unsigned_32 (E.Data, E.Data'First + 8), Data'First + 8); Put_Unsigned_32 (Data, R (4) xor To_Unsigned_32 (E.Data, E.Data'First + 12), Data'First + 12); end; end case; if E.Padding = NO_PADDING then Last := Into'First + 16 - 1; Into (Into'First .. Last) := Data (Data'First .. Data'Last); elsif E.Padding = ZERO_PADDING then Last := Into'Last; Into (Into'First .. Last) := Data (Data'First .. Data'First + Into'Length - 1); elsif Data (Data'Last) = 0 then Last := Into'First - 1; elsif Data (Data'Last) <= 15 then Count := Data'Length - Ada.Streams.Stream_Element_Offset (Data (Data'Last)); Last := Into'First + Count - 1; Into (Into'First .. Last) := Data (Data'First .. Data'First + Count - 1); end if; E.Data_Count := 0; end Finish; -- Decrypt the content of data using the decoder and build the secret key. procedure Decrypt_Secret (E : in out Decoder; Data : in Ada.Streams.Stream_Element_Array; Secret : in out Secret_Key) is Last : Ada.Streams.Stream_Element_Offset; Encoded : Ada.Streams.Stream_Element_Offset; begin if E.Padding = NO_PADDING then E.Transform (Data => Data, Into => Secret.Secret (Secret.Secret'First .. Secret.Secret'Last), Last => Last, Encoded => Encoded); E.Finish (Into => Secret.Secret (Last + 1 .. Secret.Secret'Last), Last => Last); else E.Transform (Data => Data, Into => Secret.Secret (Secret.Secret'First .. Secret.Secret'Last - 16), Last => Last, Encoded => Encoded); E.Finish (Into => Secret.Secret (Last + 1 .. Secret.Secret'Last), Last => Last); end if; end Decrypt_Secret; procedure Encrypt (Input : in Ada.Streams.Stream_Element_Array; Output : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset; Key : in Key_Type) is First : Ada.Streams.Stream_Element_Offset := Input'First; Pad : Ada.Streams.Stream_Element_Offset; Remain : Ada.Streams.Stream_Element_Offset; begin Last := Output'First; while First + 16 <= Input'Last loop Encrypt (Input (First .. First + 15), Output (Last .. Last + 15), Key); First := First + 16; Last := Last + 16; end loop; Remain := Input'Last - First; if Remain > 0 then declare B : Block_Type; begin Pad := B'Length - Remain; B (B'First .. B'First + Remain - 1) := Input (First .. Input'Last); B (B'First + Remain .. B'Last) := (others => Stream_Element (Pad)); Encrypt (B, Output (Last .. Last + 16), Key); Last := Last + 16; end; end if; end Encrypt; procedure Encrypt (Data : in out Word_Block_Type; Key : in Key_Type) is S0, S1, S2, S3 : Unsigned_32; T0, T1, T2, T3 : Unsigned_32; N : Natural := 0; R : Natural := Key.Rounds / 2; begin S0 := Data (1) xor Key.Key (0); S1 := Data (2) xor Key.Key (1); S2 := Data (3) xor Key.Key (2); S3 := Data (4) xor Key.Key (3); loop T0 := Te0 (Shift_Right (S0, 24) and 16#0ff#) xor Te1 (Shift_Right (S1, 16) and 16#0ff#) xor Te2 (Shift_Right (S2, 8) and 16#0ff#) xor Te3 (S3 and 16#0ff#) xor Key.Key (N + 4); T1 := Te0 (Shift_Right (S1, 24) and 16#0ff#) xor Te1 (Shift_Right (S2, 16) and 16#0ff#) xor Te2 (Shift_Right (S3, 8) and 16#0ff#) xor Te3 (S0 and 16#0ff#) xor Key.Key (N + 5); T2 := Te0 (Shift_Right (S2, 24) and 16#0ff#) xor Te1 (Shift_Right (S3, 16) and 16#0ff#) xor Te2 (Shift_Right (S0, 8) and 16#0ff#) xor Te3 (S1 and 16#0ff#) xor Key.Key (N + 6); T3 := Te0 (Shift_Right (S3, 24) and 16#0ff#) xor Te1 (Shift_Right (S0, 16) and 16#0ff#) xor Te2 (Shift_Right (S1, 8) and 16#0ff#) xor Te3 (S2 and 16#0ff#) xor Key.Key (N + 7); N := N + 8; R := R - 1; exit when R = 0; S0 := Te0 (Shift_Right (T0, 24) and 16#0ff#) xor Te1 (Shift_Right (T1, 16) and 16#0ff#) xor Te2 (Shift_Right (T2, 8) and 16#0ff#) xor Te3 (T3 and 16#0ff#) xor Key.Key (N + 0); S1 := Te0 (Shift_Right (T1, 24) and 16#0ff#) xor Te1 (Shift_Right (T2, 16) and 16#0ff#) xor Te2 (Shift_Right (T3, 8) and 16#0ff#) xor Te3 (T0 and 16#0ff#) xor Key.Key (N + 1); S2 := Te0 (Shift_Right (T2, 24) and 16#0ff#) xor Te1 (Shift_Right (T3, 16) and 16#0ff#) xor Te2 (Shift_Right (T0, 8) and 16#0ff#) xor Te3 (T1 and 16#0ff#) xor Key.Key (N + 2); S3 := Te0 (Shift_Right (T3, 24) and 16#0ff#) xor Te1 (Shift_Right (T0, 16) and 16#0ff#) xor Te2 (Shift_Right (T1, 8) and 16#0ff#) xor Te3 (T2 and 16#0ff#) xor Key.Key (N + 3); end loop; S0 := (Te2 (Shift_Right (T0, 24) and 16#0ff#) and 16#ff000000#) xor (Te3 (Shift_Right (T1, 16) and 16#0ff#) and 16#00ff0000#) xor (Te0 (Shift_Right (T2, 8) and 16#0ff#) and 16#0ff00#) xor (Te1 (T3 and 16#0ff#) and 16#0ff#) xor Key.Key (N); Data (1) := S0; S1 := (Te2 (Shift_Right (T1, 24) and 16#0ff#) and 16#ff000000#) xor (Te3 (Shift_Right (T2, 16) and 16#0ff#) and 16#00ff0000#) xor (Te0 (Shift_Right (T3, 8) and 16#0ff#) and 16#0ff00#) xor (Te1 (T0 and 16#0ff#) and 16#0ff#) xor Key.Key (N + 1); Data (2) := S1; S2 := (Te2 (Shift_Right (T2, 24) and 16#0ff#) and 16#ff000000#) xor (Te3 (Shift_Right (T3, 16) and 16#0ff#) and 16#00ff0000#) xor (Te0 (Shift_Right (T0, 8) and 16#0ff#) and 16#0ff00#) xor (Te1 (T1 and 16#0ff#) and 16#0ff#) xor Key.Key (N + 2); Data (3) := S2; S3 := (Te2 (Shift_Right (T3, 24) and 16#0ff#) and 16#ff000000#) xor (Te3 (Shift_Right (T0, 16) and 16#0ff#) and 16#00ff0000#) xor (Te0 (Shift_Right (T1, 8) and 16#0ff#) and 16#0ff00#) xor (Te1 (T2 and 16#0ff#) and 16#0ff#) xor Key.Key (N + 3); Data (4) := S3; end Encrypt; procedure Encrypt (Input : in Word_Block_Type; Output : out Word_Block_Type; Key : in Key_Type) is S0, S1, S2, S3 : Unsigned_32; T0, T1, T2, T3 : Unsigned_32; N : Natural := 0; R : Natural := Key.Rounds / 2; begin S0 := Input (1) xor Key.Key (0); S1 := Input (2) xor Key.Key (1); S2 := Input (3) xor Key.Key (2); S3 := Input (4) xor Key.Key (3); loop T0 := Te0 (Shift_Right (S0, 24) and 16#0ff#) xor Te1 (Shift_Right (S1, 16) and 16#0ff#) xor Te2 (Shift_Right (S2, 8) and 16#0ff#) xor Te3 (S3 and 16#0ff#) xor Key.Key (N + 4); T1 := Te0 (Shift_Right (S1, 24) and 16#0ff#) xor Te1 (Shift_Right (S2, 16) and 16#0ff#) xor Te2 (Shift_Right (S3, 8) and 16#0ff#) xor Te3 (S0 and 16#0ff#) xor Key.Key (N + 5); T2 := Te0 (Shift_Right (S2, 24) and 16#0ff#) xor Te1 (Shift_Right (S3, 16) and 16#0ff#) xor Te2 (Shift_Right (S0, 8) and 16#0ff#) xor Te3 (S1 and 16#0ff#) xor Key.Key (N + 6); T3 := Te0 (Shift_Right (S3, 24) and 16#0ff#) xor Te1 (Shift_Right (S0, 16) and 16#0ff#) xor Te2 (Shift_Right (S1, 8) and 16#0ff#) xor Te3 (S2 and 16#0ff#) xor Key.Key (N + 7); N := N + 8; R := R - 1; exit when R = 0; S0 := Te0 (Shift_Right (T0, 24) and 16#0ff#) xor Te1 (Shift_Right (T1, 16) and 16#0ff#) xor Te2 (Shift_Right (T2, 8) and 16#0ff#) xor Te3 (T3 and 16#0ff#) xor Key.Key (N + 0); S1 := Te0 (Shift_Right (T1, 24) and 16#0ff#) xor Te1 (Shift_Right (T2, 16) and 16#0ff#) xor Te2 (Shift_Right (T3, 8) and 16#0ff#) xor Te3 (T0 and 16#0ff#) xor Key.Key (N + 1); S2 := Te0 (Shift_Right (T2, 24) and 16#0ff#) xor Te1 (Shift_Right (T3, 16) and 16#0ff#) xor Te2 (Shift_Right (T0, 8) and 16#0ff#) xor Te3 (T1 and 16#0ff#) xor Key.Key (N + 2); S3 := Te0 (Shift_Right (T3, 24) and 16#0ff#) xor Te1 (Shift_Right (T0, 16) and 16#0ff#) xor Te2 (Shift_Right (T1, 8) and 16#0ff#) xor Te3 (T2 and 16#0ff#) xor Key.Key (N + 3); end loop; S0 := (Te2 (Shift_Right (T0, 24) and 16#0ff#) and 16#ff000000#) xor (Te3 (Shift_Right (T1, 16) and 16#0ff#) and 16#00ff0000#) xor (Te0 (Shift_Right (T2, 8) and 16#0ff#) and 16#0ff00#) xor (Te1 (T3 and 16#0ff#) and 16#0ff#) xor Key.Key (N); Output (1) := S0; S1 := (Te2 (Shift_Right (T1, 24) and 16#0ff#) and 16#ff000000#) xor (Te3 (Shift_Right (T2, 16) and 16#0ff#) and 16#00ff0000#) xor (Te0 (Shift_Right (T3, 8) and 16#0ff#) and 16#0ff00#) xor (Te1 (T0 and 16#0ff#) and 16#0ff#) xor Key.Key (N + 1); Output (2) := S1; S2 := (Te2 (Shift_Right (T2, 24) and 16#0ff#) and 16#ff000000#) xor (Te3 (Shift_Right (T3, 16) and 16#0ff#) and 16#00ff0000#) xor (Te0 (Shift_Right (T0, 8) and 16#0ff#) and 16#0ff00#) xor (Te1 (T1 and 16#0ff#) and 16#0ff#) xor Key.Key (N + 2); Output (3) := S2; S3 := (Te2 (Shift_Right (T3, 24) and 16#0ff#) and 16#ff000000#) xor (Te3 (Shift_Right (T0, 16) and 16#0ff#) and 16#00ff0000#) xor (Te0 (Shift_Right (T1, 8) and 16#0ff#) and 16#0ff00#) xor (Te1 (T2 and 16#0ff#) and 16#0ff#) xor Key.Key (N + 3); Output (4) := S3; end Encrypt; procedure Encrypt (Input : in Block_Type; Output : out Block_Type; Key : in Key_Type) is S0, S1, S2, S3 : Unsigned_32; T0, T1, T2, T3 : Unsigned_32; N : Natural := 0; R : Natural := Key.Rounds / 2; begin S0 := To_Unsigned_32 (Input, Input'First + 0) xor Key.Key (0); S1 := To_Unsigned_32 (Input, Input'First + 4) xor Key.Key (1); S2 := To_Unsigned_32 (Input, Input'First + 8) xor Key.Key (2); S3 := To_Unsigned_32 (Input, Input'First + 12) xor Key.Key (3); loop T0 := Te0 (Shift_Right (S0, 24) and 16#0ff#) xor Te1 (Shift_Right (S1, 16) and 16#0ff#) xor Te2 (Shift_Right (S2, 8) and 16#0ff#) xor Te3 (S3 and 16#0ff#) xor Key.Key (N + 4); T1 := Te0 (Shift_Right (S1, 24) and 16#0ff#) xor Te1 (Shift_Right (S2, 16) and 16#0ff#) xor Te2 (Shift_Right (S3, 8) and 16#0ff#) xor Te3 (S0 and 16#0ff#) xor Key.Key (N + 5); T2 := Te0 (Shift_Right (S2, 24) and 16#0ff#) xor Te1 (Shift_Right (S3, 16) and 16#0ff#) xor Te2 (Shift_Right (S0, 8) and 16#0ff#) xor Te3 (S1 and 16#0ff#) xor Key.Key (N + 6); T3 := Te0 (Shift_Right (S3, 24) and 16#0ff#) xor Te1 (Shift_Right (S0, 16) and 16#0ff#) xor Te2 (Shift_Right (S1, 8) and 16#0ff#) xor Te3 (S2 and 16#0ff#) xor Key.Key (N + 7); N := N + 8; R := R - 1; exit when R = 0; S0 := Te0 (Shift_Right (T0, 24) and 16#0ff#) xor Te1 (Shift_Right (T1, 16) and 16#0ff#) xor Te2 (Shift_Right (T2, 8) and 16#0ff#) xor Te3 (T3 and 16#0ff#) xor Key.Key (N + 0); S1 := Te0 (Shift_Right (T1, 24) and 16#0ff#) xor Te1 (Shift_Right (T2, 16) and 16#0ff#) xor Te2 (Shift_Right (T3, 8) and 16#0ff#) xor Te3 (T0 and 16#0ff#) xor Key.Key (N + 1); S2 := Te0 (Shift_Right (T2, 24) and 16#0ff#) xor Te1 (Shift_Right (T3, 16) and 16#0ff#) xor Te2 (Shift_Right (T0, 8) and 16#0ff#) xor Te3 (T1 and 16#0ff#) xor Key.Key (N + 2); S3 := Te0 (Shift_Right (T3, 24) and 16#0ff#) xor Te1 (Shift_Right (T0, 16) and 16#0ff#) xor Te2 (Shift_Right (T1, 8) and 16#0ff#) xor Te3 (T2 and 16#0ff#) xor Key.Key (N + 3); end loop; S0 := (Te2 (Shift_Right (T0, 24) and 16#0ff#) and 16#ff000000#) xor (Te3 (Shift_Right (T1, 16) and 16#0ff#) and 16#00ff0000#) xor (Te0 (Shift_Right (T2, 8) and 16#0ff#) and 16#0ff00#) xor (Te1 (T3 and 16#0ff#) and 16#0ff#) xor Key.Key (N); Put_Unsigned_32 (Output, S0, Output'First + 0); S1 := (Te2 (Shift_Right (T1, 24) and 16#0ff#) and 16#ff000000#) xor (Te3 (Shift_Right (T2, 16) and 16#0ff#) and 16#00ff0000#) xor (Te0 (Shift_Right (T3, 8) and 16#0ff#) and 16#0ff00#) xor (Te1 (T0 and 16#0ff#) and 16#0ff#) xor Key.Key (N + 1); Put_Unsigned_32 (Output, S1, Output'First + 4); S2 := (Te2 (Shift_Right (T2, 24) and 16#0ff#) and 16#ff000000#) xor (Te3 (Shift_Right (T3, 16) and 16#0ff#) and 16#00ff0000#) xor (Te0 (Shift_Right (T0, 8) and 16#0ff#) and 16#0ff00#) xor (Te1 (T1 and 16#0ff#) and 16#0ff#) xor Key.Key (N + 2); Put_Unsigned_32 (Output, S2, Output'First + 8); S3 := (Te2 (Shift_Right (T3, 24) and 16#0ff#) and 16#ff000000#) xor (Te3 (Shift_Right (T0, 16) and 16#0ff#) and 16#00ff0000#) xor (Te0 (Shift_Right (T1, 8) and 16#0ff#) and 16#0ff00#) xor (Te1 (T2 and 16#0ff#) and 16#0ff#) xor Key.Key (N + 3); Put_Unsigned_32 (Output, S3, Output'First + 12); end Encrypt; procedure Decrypt (Input : in Block_Type; Output : out Block_Type; Key : in Key_Type) is S0, S1, S2, S3 : Unsigned_32; T0, T1, T2, T3 : Unsigned_32; N : Natural := 0; R : Natural := Key.Rounds / 2; begin S0 := To_Unsigned_32 (Input, Input'First + 0) xor Key.Key (0); S1 := To_Unsigned_32 (Input, Input'First + 4) xor Key.Key (1); S2 := To_Unsigned_32 (Input, Input'First + 8) xor Key.Key (2); S3 := To_Unsigned_32 (Input, Input'First + 12) xor Key.Key (3); loop T0 := Td0 (Shift_Right (S0, 24) and 16#0ff#) xor Td1 (Shift_Right (S3, 16) and 16#0ff#) xor Td2 (Shift_Right (S2, 8) and 16#0ff#) xor Td3 (S1 and 16#0ff#) xor Key.Key (N + 4); T1 := Td0 (Shift_Right (S1, 24) and 16#0ff#) xor Td1 (Shift_Right (S0, 16) and 16#0ff#) xor Td2 (Shift_Right (S3, 8) and 16#0ff#) xor Td3 (S2 and 16#0ff#) xor Key.Key (N + 5); T2 := Td0 (Shift_Right (S2, 24) and 16#0ff#) xor Td1 (Shift_Right (S1, 16) and 16#0ff#) xor Td2 (Shift_Right (S0, 8) and 16#0ff#) xor Td3 (S3 and 16#0ff#) xor Key.Key (N + 6); T3 := Td0 (Shift_Right (S3, 24) and 16#0ff#) xor Td1 (Shift_Right (S2, 16) and 16#0ff#) xor Td2 (Shift_Right (S1, 8) and 16#0ff#) xor Td3 (S0 and 16#0ff#) xor Key.Key (N + 7); N := N + 8; R := R - 1; exit when R = 0; S0 := Td0 (Shift_Right (T0, 24) and 16#0ff#) xor Td1 (Shift_Right (T3, 16) and 16#0ff#) xor Td2 (Shift_Right (T2, 8) and 16#0ff#) xor Td3 (T1 and 16#0ff#) xor Key.Key (N + 0); S1 := Td0 (Shift_Right (T1, 24) and 16#0ff#) xor Td1 (Shift_Right (T0, 16) and 16#0ff#) xor Td2 (Shift_Right (T3, 8) and 16#0ff#) xor Td3 (T2 and 16#0ff#) xor Key.Key (N + 1); S2 := Td0 (Shift_Right (T2, 24) and 16#0ff#) xor Td1 (Shift_Right (T1, 16) and 16#0ff#) xor Td2 (Shift_Right (T0, 8) and 16#0ff#) xor Td3 (T3 and 16#0ff#) xor Key.Key (N + 2); S3 := Td0 (Shift_Right (T3, 24) and 16#0ff#) xor Td1 (Shift_Right (T2, 16) and 16#0ff#) xor Td2 (Shift_Right (T1, 8) and 16#0ff#) xor Td3 (T0 and 16#0ff#) xor Key.Key (N + 3); end loop; S0 := Shift_Left (Unsigned_32 (Td4 (Shift_Right (T0, 24) and 16#0ff#)), 24) xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T3, 16) and 16#0ff#)), 16) xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T2, 8) and 16#0ff#)), 8) xor Unsigned_32 (Td4 (T1 and 16#0ff#)) xor Key.Key (N); Put_Unsigned_32 (Output, S0, Output'First + 0); S1 := Shift_Left (Unsigned_32 (Td4 (Shift_Right (T1, 24) and 16#0ff#)), 24) xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T0, 16) and 16#0ff#)), 16) xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T3, 8) and 16#0ff#)), 8) xor Unsigned_32 (Td4 (T2 and 16#0ff#)) xor Key.Key (N + 1); Put_Unsigned_32 (Output, S1, Output'First + 4); S2 := Shift_Left (Unsigned_32 (Td4 (Shift_Right (T2, 24) and 16#0ff#)), 24) xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T1, 16) and 16#0ff#)), 16) xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T0, 8) and 16#0ff#)), 8) xor Unsigned_32 (Td4 (T3 and 16#0ff#)) xor Key.Key (N + 2); Put_Unsigned_32 (Output, S2, Output'First + 8); S3 := Shift_Left (Unsigned_32 (Td4 (Shift_Right (T3, 24) and 16#0ff#)), 24) xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T2, 16) and 16#0ff#)), 16) xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T1, 8) and 16#0ff#)), 8) xor Unsigned_32 (Td4 (T0 and 16#0ff#)) xor Key.Key (N + 3); Put_Unsigned_32 (Output, S3, Output'First + 12); end Decrypt; procedure Decrypt (Input : in Word_Block_Type; Output : out Word_Block_Type; Key : in Key_Type) is S0, S1, S2, S3 : Unsigned_32; T0, T1, T2, T3 : Unsigned_32; N : Natural := 0; R : Natural := Key.Rounds / 2; begin S0 := Input (1) xor Key.Key (0); S1 := Input (2) xor Key.Key (1); S2 := Input (3) xor Key.Key (2); S3 := Input (4) xor Key.Key (3); loop T0 := Td0 (Shift_Right (S0, 24) and 16#0ff#) xor Td1 (Shift_Right (S3, 16) and 16#0ff#) xor Td2 (Shift_Right (S2, 8) and 16#0ff#) xor Td3 (S1 and 16#0ff#) xor Key.Key (N + 4); T1 := Td0 (Shift_Right (S1, 24) and 16#0ff#) xor Td1 (Shift_Right (S0, 16) and 16#0ff#) xor Td2 (Shift_Right (S3, 8) and 16#0ff#) xor Td3 (S2 and 16#0ff#) xor Key.Key (N + 5); T2 := Td0 (Shift_Right (S2, 24) and 16#0ff#) xor Td1 (Shift_Right (S1, 16) and 16#0ff#) xor Td2 (Shift_Right (S0, 8) and 16#0ff#) xor Td3 (S3 and 16#0ff#) xor Key.Key (N + 6); T3 := Td0 (Shift_Right (S3, 24) and 16#0ff#) xor Td1 (Shift_Right (S2, 16) and 16#0ff#) xor Td2 (Shift_Right (S1, 8) and 16#0ff#) xor Td3 (S0 and 16#0ff#) xor Key.Key (N + 7); N := N + 8; R := R - 1; exit when R = 0; S0 := Td0 (Shift_Right (T0, 24) and 16#0ff#) xor Td1 (Shift_Right (T3, 16) and 16#0ff#) xor Td2 (Shift_Right (T2, 8) and 16#0ff#) xor Td3 (T1 and 16#0ff#) xor Key.Key (N + 0); S1 := Td0 (Shift_Right (T1, 24) and 16#0ff#) xor Td1 (Shift_Right (T0, 16) and 16#0ff#) xor Td2 (Shift_Right (T3, 8) and 16#0ff#) xor Td3 (T2 and 16#0ff#) xor Key.Key (N + 1); S2 := Td0 (Shift_Right (T2, 24) and 16#0ff#) xor Td1 (Shift_Right (T1, 16) and 16#0ff#) xor Td2 (Shift_Right (T0, 8) and 16#0ff#) xor Td3 (T3 and 16#0ff#) xor Key.Key (N + 2); S3 := Td0 (Shift_Right (T3, 24) and 16#0ff#) xor Td1 (Shift_Right (T2, 16) and 16#0ff#) xor Td2 (Shift_Right (T1, 8) and 16#0ff#) xor Td3 (T0 and 16#0ff#) xor Key.Key (N + 3); end loop; S0 := Shift_Left (Unsigned_32 (Td4 (Shift_Right (T0, 24) and 16#0ff#)), 24) xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T3, 16) and 16#0ff#)), 16) xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T2, 8) and 16#0ff#)), 8) xor Unsigned_32 (Td4 (T1 and 16#0ff#)) xor Key.Key (N); Output (1) := S0; S1 := Shift_Left (Unsigned_32 (Td4 (Shift_Right (T1, 24) and 16#0ff#)), 24) xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T0, 16) and 16#0ff#)), 16) xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T3, 8) and 16#0ff#)), 8) xor Unsigned_32 (Td4 (T2 and 16#0ff#)) xor Key.Key (N + 1); Output (2) := S1; S2 := Shift_Left (Unsigned_32 (Td4 (Shift_Right (T2, 24) and 16#0ff#)), 24) xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T1, 16) and 16#0ff#)), 16) xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T0, 8) and 16#0ff#)), 8) xor Unsigned_32 (Td4 (T3 and 16#0ff#)) xor Key.Key (N + 2); Output (3) := S2; S3 := Shift_Left (Unsigned_32 (Td4 (Shift_Right (T3, 24) and 16#0ff#)), 24) xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T2, 16) and 16#0ff#)), 16) xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T1, 8) and 16#0ff#)), 8) xor Unsigned_32 (Td4 (T0 and 16#0ff#)) xor Key.Key (N + 3); Output (4) := S3; end Decrypt; end Util.Encoders.AES;
reznikmm/matreshka
Ada
4,672
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.Treat_Empty_Cells_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Chart_Treat_Empty_Cells_Attribute_Node is begin return Self : Chart_Treat_Empty_Cells_Attribute_Node do Matreshka.ODF_Chart.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Chart_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Chart_Treat_Empty_Cells_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Treat_Empty_Cells_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Chart_URI, Matreshka.ODF_String_Constants.Treat_Empty_Cells_Attribute, Chart_Treat_Empty_Cells_Attribute_Node'Tag); end Matreshka.ODF_Chart.Treat_Empty_Cells_Attributes;
godunko/adawebui
Ada
5,152
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2017-2020, 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: 5704 $ $Date: 2017-01-20 23:11:33 +0300 (Fri, 20 Jan 2017) $ ------------------------------------------------------------------------------ generic package Web.Core.Connectables.Slots_0.Slots_1.Slots_2.Generic_Emitters is pragma Preelaborate; type Emitter (Owner : not null access Connectable_Object'Class) is limited new Slots_2.Signal with private; procedure Emit (Self : in out Emitter'Class; Parameter_1 : Parameter_1_Type; Parameter_2 : Parameter_2_Type); private type Signal_End is abstract new Signal_End_Base with null record; not overriding procedure Invoke (Self : in out Signal_End; Parameter_1 : Parameter_1_Type; Parameter_2 : Parameter_2_Type) is abstract; type Signal_End_0 is new Signal_End with null record; overriding procedure Invoke (Self : in out Signal_End_0; Parameter_1 : Parameter_1_Type; Parameter_2 : Parameter_2_Type); type Signal_End_1 is new Signal_End with null record; overriding procedure Invoke (Self : in out Signal_End_1; Parameter_1 : Parameter_1_Type; Parameter_2 : Parameter_2_Type); type Signal_End_2 is new Signal_End with null record; overriding procedure Invoke (Self : in out Signal_End_2; Parameter_1 : Parameter_1_Type; Parameter_2 : Parameter_2_Type); ------------- -- Emitter -- ------------- type Emitter (Owner : not null access Connectable_Object'Class) is limited new Emitter_Base and Slots_2.Signal with null record; overriding procedure Connect (Self : in out Emitter; Slot : Slots_0.Slot'Class); overriding procedure Connect (Self : in out Emitter; Slot : Slots_1.Slot'Class); overriding procedure Connect (Self : in out Emitter; Slot : Slots_2.Slot'Class); end Web.Core.Connectables.Slots_0.Slots_1.Slots_2.Generic_Emitters;
aogrcs/StratoX
Ada
13,959
ads
-- Institution: Technische Universitaet Muenchen -- Department: Realtime Computer Systems (RCS) -- Project: StratoX -- Module: Units -- -- Authors: Emanuel Regnath ([email protected]) -- -- Description: Checked dimension system for physical calculations -- Based on package System.Dim.MKS -- -- ToDo: -- [ ] Define all required types with Ada.Real_Time; use Ada.Real_Time; with Ada.Numerics; with Types; pragma Elaborate_All (Types); -- TODO: is this required? package Units with Spark_Mode is --------------------- -- The unit system --------------------- type Base_Unit_Type is new Float; type Unit_Type is new Base_Unit_Type with -- As tagged Type? -> Generics with Unit_Type'Class Dimension_System => ((Unit_Name => Meter, Unit_Symbol => 'm', Dim_Symbol => 'L'), (Unit_Name => Kilogram, Unit_Symbol => "kg", Dim_Symbol => 'M'), (Unit_Name => Second, Unit_Symbol => 's', Dim_Symbol => 'T'), (Unit_Name => Ampere, Unit_Symbol => 'A', Dim_Symbol => 'I'), (Unit_Name => Kelvin, Unit_Symbol => 'K', Dim_Symbol => "Theta"), (Unit_Name => Radian, Unit_Symbol => "Rad", Dim_Symbol => "A")), Default_Value => 0.0; -- required for matrices function Ignore_Unit (X : Unit_Type) return Unit_Type is (Unit_Type (Base_Unit_Type (X))); type Unit_Array is array (Natural range <>) of Unit_Type; -- Base Units subtype Length_Type is Unit_Type with Dimension => (Symbol => 'm', Meter => 1, others => 0); subtype Mass_Type is Unit_Type with Dimension => (Symbol => "kg", Kilogram => 1, others => 0); subtype Time_Type is Unit_Type with Dimension => (Symbol => 's', Second => 1, others => 0); subtype Current_Type is Unit_Type with Dimension => (Symbol => 'A', Ampere => 1, others => 0); subtype Temperature_Type is Unit_Type with Dimension => (Symbol => 'K', Kelvin => 1, others => 0); subtype Angle_Type is Unit_Type with Dimension => (Symbol => "Rad", Radian => 1, others => 0); -- Derived Units subtype Length_Angle_Ratio_Type is Unit_Type with Dimension => (Meter => 1, Radian => -1, others => 0); -- mechanical subtype Frequency_Type is Unit_Type with Dimension => (Symbol => "Hz", Second => -1, others => 0); subtype Force_Type is Unit_Type with Dimension => (Symbol => "N", Kilogram => 1, Meter => 1, Second => -2, others => 0); subtype Energy_Type is Unit_Type with Dimension => (Symbol => "J", Kilogram => 1, Meter => 2, Second => -2, others => 0); subtype Power_Type is Unit_Type with Dimension => (Symbol => "W", Kilogram => 1, Meter => 2, Second => -3, others => 0); subtype Pressure_Type is Unit_Type with Dimension => (Symbol => "Pa", Kilogram => 1, Meter => -1, Second => -2, others => 0); -- electromagnetic subtype Voltage_Type is Unit_Type with Dimension => (Symbol => 'V', Meter => 2, Kilogram => 1, Second => -3, Ampere => -1, others => 0); subtype Charge_Type is Unit_Type with Dimension => (Symbol => 'C', Second => 1, Ampere => 1, others => 0); subtype Capacity_Type is Unit_Type with Dimension => (Symbol => 'F', Kilogram => -1, Meter => -2, Second => 4, Ampere => 2, others => 0); subtype Resistivity_Type is Unit_Type with Dimension => (Symbol => "Ω", Kilogram => 1, Meter => 2, Second => -2, Ampere => -3, others => 0); subtype Inductivity_Type is Unit_Type with Dimension => (Symbol => 'H', Kilogram => 1, Meter => 2, Second => -2, Ampere => -2, others => 0); subtype Electric_Field_Type is Unit_Type with Dimension => (Meter => 1, Kilogram => 1, Second => -3, Ampere => -1, others => 0); subtype Magnetic_Flux_Type is Unit_Type with Dimension => (Symbol => "Wb", Kilogram => 1, Meter => 2, Second => -2, Ampere => -1, others => 0); subtype Magnetic_Flux_Density_Type is Unit_Type with Dimension => (Symbol => 'T', Kilogram => 1, Second => -2, Ampere => -1, others => 0); -- further important dimensions subtype Area_Type is Unit_Type with Dimension => (Symbol => "m^2", Meter => 2, others => 0); subtype Volume_Type is Unit_Type with Dimension => (Symbol => "m^3", Meter => 3, others => 0); subtype Linear_Velocity_Type is Unit_Type with Dimension => (Meter => 1, Second => -1, others => 0); subtype Angular_Velocity_Type is Unit_Type with Dimension => (Radian => 1, Second => -1, others => 0); subtype Linear_Acceleration_Type is Unit_Type with Dimension => (Meter => 1, Second => -2, others => 0); subtype Angular_Acceleration_Type is Unit_Type with Dimension => (Radian => 1, Second => -2, others => 0); -------------------------- -- Prefixes for units -------------------------- subtype Prefix_Type is Unit_Type; --type Prefix_Type is digits 2 range 1.0e-24 .. 1.0e+24; Yocto : constant Prefix_Type := Prefix_Type (1.0e-24); Zepto : constant Prefix_Type := Prefix_Type (1.0e-21); Atto : constant Prefix_Type := Prefix_Type (1.0e-18); Femto : constant Prefix_Type := Prefix_Type (1.0e-15); Pico : constant Prefix_Type := Prefix_Type (1.0e-12); Nano : constant Prefix_Type := Prefix_Type (1.0e-9); Micro : constant Prefix_Type := Prefix_Type (1.0e-6); Milli : constant Prefix_Type := Prefix_Type (1.0e-3); Centi : constant Prefix_Type := Prefix_Type (1.0e-2); Deci : constant Prefix_Type := Prefix_Type (1.0e-1); Deca : constant Prefix_Type := Prefix_Type (1.0e+1); Hecto : constant Prefix_Type := Prefix_Type (1.0e+2); Kilo : constant Prefix_Type := Prefix_Type (1.0e+3); Mega : constant Prefix_Type := Prefix_Type (1.0e+6); Giga : constant Prefix_Type := Prefix_Type (1.0e+9); Tera : constant Prefix_Type := Prefix_Type (1.0e+12); Peta : constant Prefix_Type := Prefix_Type (1.0e+15); Exa : constant Prefix_Type := Prefix_Type (1.0e+18); Zetta : constant Prefix_Type := Prefix_Type (1.0e+21); Yotta : constant Prefix_Type := Prefix_Type (1.0e+24); -------------------------- -- The units -------------------------- -- Base units Meter : constant Length_Type := Length_Type (1.0); Kilogram : constant Mass_Type := Mass_Type (1.0); Gram : constant Mass_Type := Mass_Type (1.0e-3); Second : constant Time_Type := Time_Type (1.0); Ampere : constant Current_Type := Current_Type (1.0); Kelvin : constant Temperature_Type := Temperature_Type (1.0); -- Angular Units Radian : constant Angle_Type := Angle_Type (1.0); Degree : constant Angle_Type := Angle_Type (2.0 * Ada.Numerics.Pi / 360.0); Evolution : constant Angle_Type := Angle_Type (2.0 * Ada.Numerics.Pi); -- Derived Units Newton : constant Force_Type := Force_Type (1.0); Joule : constant Energy_Type := Energy_Type (1.0); Watt : constant Power_Type := Power_Type (1.0); Ohm : constant Resistivity_Type := Resistivity_Type (1.0); Pascal : constant Pressure_Type := Pressure_Type (1.0); Volt : constant Voltage_Type := Voltage_Type (1.0); Coulomb : constant Charge_Type := Charge_Type(1.0); Farad : constant Capacity_Type := Capacity_Type(1.0); Weber : constant Magnetic_Flux_Type := Magnetic_Flux_Type(1.0); Tesla : constant Magnetic_Flux_Density_Type := Magnetic_Flux_Density_Type(1.0); Henry : constant Inductivity_Type := Inductivity_Type(1.0); Hertz : constant Frequency_Type := Frequency_Type (1.0); -- Non SI but metric Minute : constant Time_Type := 60.0 * Second; Hour : constant Time_Type := 60.0 * Minute; Day : constant Time_Type := 24.0 * Hour; Tonne : constant Mass_Type := 1_000.0 * Kilogram; Angstrom : constant Length_Type := 1.0 * Nano * Meter; Litre : constant Volume_Type := 1.0 * (1.0 * Deci * Meter)**3; Bar : constant Pressure_Type := 1_000.0 * Hecto * Pascal; Gauss : constant Magnetic_Flux_Density_Type := 0.1 * Tesla; -------------------------- -- Physical constants -------------------------- -- Approximate gravity on the earth's surface GRAVITY : constant Linear_Acceleration_Type := 9.81 * Meter / (Second**2); CELSIUS_0 : constant Temperature_Type := 273.15 * Kelvin; DEGREE_360 : constant Angle_Type := 360.0 * Degree; RADIAN_2PI : constant Angle_Type := 2.0 * Radian; -- Physical constants SPEED_OF_LIGHT : constant Linear_Velocity_Type := 299_792_458.0 * Meter / Second; PLANCK_CONSTANT : constant Unit_Type := 6.626_070_040 * Joule * Second; GRAVITY_CONSTANT : constant Linear_Acceleration_Type := 127_137.6 * Kilo * Meter / (Hour**2); -------------------------- -- Conversion functions -------------------------- function To_Time (rtime : Ada.Real_Time.Time) return Time_Type is (Time_Type (Float ((rtime - Ada.Real_Time.Time_First) / Ada.Real_Time.Microseconds (1)) * Float(1.0e-6))); -- converts Real_Time to Time_Type, precision is Nanosecond function To_Time (rtime : Ada.Real_Time.Time_Span) return Time_Type is (Time_Type (Float ((rtime) / Ada.Real_Time.Microseconds (1)) * Float(1.0e-6))); function To_Time_Span(time : Time_Type) return Ada.Real_Time.Time_Span is ( Ada.Real_Time.Microseconds (Types.Sat_Cast_Int (Float (time) / Float(1.0e-6)))); function To_Degree(angle : Angle_Type) return Float is (Float (angle / Degree)); ------------------------------------------------------------- -- Elementary math functions handling overflow/range checks ------------------------------------------------------------- function "+"( Left : Ada.Real_Time.Time; Right : Time_Type ) return Ada.Real_Time.Time is ( Left + Ada.Real_Time.Microseconds (Types.Sat_Cast_Int (Float (Right) / Float(1.0e-6)))); function wrap_Angle( angle : Angle_Type; min : Angle_Type; max : Angle_Type) return Angle_Type with Pre => min <= Angle_Type(0.0) and then max >= 0.0 * Radian and then angle <= Angle_Type'Last / 4.0 and then angle >= Angle_Type'First / 4.0 and then max <= Angle_Type'Last / 4.0 and then min >= Angle_Type'First / 4.0 and then max - min > 1.0e-3 * Radian, Post => Float (wrap_angle'Result) >= Float (min) and Float (wrap_angle'Result) <= Float (max); -- wrap angle between two values -- Must make no assumptions on input 'angle' here, otherwise caller might fail if it isn't SPARK. -- FIXME: the float casts in Post are a workaround for gcc function mirror_Angle( angle : Angle_Type; min : Angle_Type; max : Angle_Type) return Angle_Type with Pre => min <= 0.0 * Radian and then max >= 0.0 * Radian and then max > min and then max < Angle_Type'Last / 4.0 and then min > Angle_Type'First / 4.0, Post => Float (mirror_Angle'Result) >= Float (min) and Float (mirror_Angle'Result) <= Float (max); -- mirror angle at min/max boundaries -- FIXME: the float casts in Post are a workaround for gcc function delta_Angle(From : Angle_Type; To : Angle_Type) return Angle_Type; function integrate(x : Unit_Type'Base; dt : Time_Type) return Unit_Type'Base is ( x * dt ); -- Experimental generic integration (return value looses its units) pragma Inline_Always( integrate ); generic type T is digits <>; -- any floating point type function Saturated_Addition (left, right : T) return T with Inline, Pre => 0.0 in T'Range; -- add two Floats of same Unit type and limit to the type's bounds generic type T is digits <>; -- any floating point type function Saturate (val, min, max : T) return T with Inline; -- limit to given range generic type T is digits <>; -- any floating point type function Saturated_Subtraction (left, right : T) return T with Inline, Pre => 0.0 in T'Range; -- that is required in addition to Saturated_Addition, if the ranges are -- not symmetric generic type T is digits <>; -- any floating point type function Wrapped_Addition (left, right : T) return T with Inline, Pre => 0.0 in T'Range; -- add two Floats of same Unit type and wrap ("modulo") to the type's bounds -- Must make no assumptions on inputs otherwise caller might fail if it isn't SPARK. generic type T is digits <>; function Saturated_Cast (val : Float) return T with Inline; -- convert a float into a more specific float type, and trim to the value range function sgn( x : Unit_Type'Base ) return Unit_Type is ( if x = 0.0 then 0.0 elsif x > 0.0 then 1.0 else -1.0 ); -- get the sign as unit multiplier -- subtype Sign_Type is Float range -1.0 .. 1.0; -- function "*" (Left : Float; Right : Prefix_Type) return Unit_Type is -- ( Unit_Type( Left * Float(Right) ) ); -------------------------- -- functions on signals -------------------------- -- function Radian( degree : Float ) return Float function average( signal : Unit_Array ) return Unit_Type; ------------------ -- I/O helpers ------------------ function Image (unit : Unit_Type) return String with Post => Image'Result'Length in 1 .. 36 and Image'Result'First = 1; function AImage (unit : Angle_Type) return String with Post => AImage'Result'Length in 1 .. 36 and AImage'Result'First = 1; function RImage (unit : Angle_Type) return String with Post => RImage'Result'Length in 1 .. 40 and RImage'Result'First = 1; end Units;
stcarrez/ada-security
Ada
1,920
ads
----------------------------------------------------------------------- -- security-controllers-urls -- URL permission controller -- Copyright (C) 2012 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Security.Contexts; with Security.Permissions; with Security.Policies.URLs; package Security.Controllers.URLs is -- ------------------------------ -- Security Controller -- ------------------------------ -- The <b>URL_Controller</b> implements the permission check for URL permissions. -- It uses the URL policy manager to verify the permission. type URL_Controller is limited new Controller with record Manager : Security.Policies.URLs.URL_Policy_Access; end record; type URL_Controller_Access is access all URL_Controller'Class; -- Returns true if the user associated with the security context <b>Context</b> has -- the permission to access the URL defined in <b>Permission</b>. overriding function Has_Permission (Handler : in URL_Controller; Context : in Security.Contexts.Security_Context'Class; Permission : in Security.Permissions.Permission'Class) return Boolean; end Security.Controllers.URLs;
octonion/examples
Ada
170
adb
-- Unit.adb with Interfaces.C; use Interfaces; package body Unit is function Add (A, B : Integer) return Integer is begin return A + B; end Add; end Unit;
AdaCore/Ada_Drivers_Library
Ada
4,624
ads
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2016, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ package HAL.Real_Time_Clock is pragma Preelaborate; type RTC_Hour is mod 24; type RTC_Minute is mod 60; type RTC_Second is mod 60; type RTC_Time is record Hour : RTC_Hour; Min : RTC_Minute; Sec : RTC_Second; end record; type RTC_Month is (January, February, March, April, May, June, July, August, September, October, November, December); type RTC_Day_Of_Week is (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday); type RTC_Day is range 1 .. 31; type RTC_Year is range 00 .. 99; type RTC_Date is record Day_Of_Week : RTC_Day_Of_Week; Day : RTC_Day; Month : RTC_Month; Year : RTC_Year; end record; for RTC_Day_Of_Week use (Monday => 1, Tuesday => 2, Wednesday => 3, Thursday => 4, Friday => 5, Saturday => 6, Sunday => 7); for RTC_Month use (January => 1, February => 2, March => 3, April => 4, May => 5, June => 6, July => 7, August => 8, September => 9, October => 10, November => 11, December => 12); type RTC_Device is limited interface; type Any_RTC_Device is access all RTC_Device'Class; procedure Set (This : in out RTC_Device; Time : RTC_Time; Date : RTC_Date) is abstract; procedure Get (This : in out RTC_Device; Time : out RTC_Time; Date : out RTC_Date) is abstract; -- This procedure ensures coherent time and date values function Get_Time (This : RTC_Device) return HAL.Real_Time_Clock.RTC_Time is abstract; function Get_Date (This : RTC_Device) return HAL.Real_Time_Clock.RTC_Date is abstract; end HAL.Real_Time_Clock;
reznikmm/matreshka
Ada
4,681
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- 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$ ------------------------------------------------------------------------------ -- This generic package allows to store value of arbitrary float type in -- the Value. ------------------------------------------------------------------------------ generic type Num is digits <>; package League.Holders.Generic_Floats is pragma Preelaborate; Value_Tag : constant Tag; function Element (Self : Holder) return Num; -- Returns internal value. procedure Replace_Element (Self : in out Holder; To : Num); -- Set value. Tag of the value must be set before this call. function To_Holder (Item : Num) return Holder; -- Creates new Value from specified value. private type Float_Container is new Abstract_Float_Container with record Value : Num; end record; overriding function Constructor (Is_Empty : not null access Boolean) return Float_Container; overriding function Get (Self : not null access constant Float_Container) return Universal_Float; overriding procedure Set (Self : not null access Float_Container; To : Universal_Float); overriding function First (Self : not null access constant Float_Container) return Universal_Float; overriding function Last (Self : not null access constant Float_Container) return Universal_Float; Value_Tag : constant Tag := Tag (Float_Container'Tag); end League.Holders.Generic_Floats;
rveenker/sdlada
Ada
3,564
adb
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2020, Luke A. Guest -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- with Interfaces.C; private with SDL.C_Pointers; with SDL.Error; package body SDL.Video.Renderers.Makers is package C renames Interfaces.C; use type C.int; use type SDL.C_Pointers.Texture_Pointer; function Get_Internal_Window (Self : in SDL.Video.Windows.Window) return SDL.C_Pointers.Windows_Pointer with Convention => Ada, Import => True; function Get_Internal_Surface (Self : in SDL.Video.Surfaces.Surface) return SDL.Video.Surfaces.Internal_Surface_Pointer with Import => True, Convention => Ada; procedure Create (Rend : in out Renderer; Window : in out SDL.Video.Windows.Window; Driver : in Positive; Flags : in Renderer_Flags := Default_Renderer_Flags) is function SDL_Create_Renderer (W : in SDL.C_Pointers.Windows_Pointer; Index : in C.int; Flags : in Renderer_Flags) return SDL.C_Pointers.Renderer_Pointer with Import => True, Convention => C, External_Name => "SDL_CreateRenderer"; begin Rend.Internal := SDL_Create_Renderer (Get_Internal_Window (Window), C.int (Driver), Flags); end Create; procedure Create (Rend : in out Renderer; Window : in out SDL.Video.Windows.Window; Flags : in Renderer_Flags := Default_Renderer_Flags) is function SDL_Create_Renderer (W : in SDL.C_Pointers.Windows_Pointer; Index : in C.int; Flags : in Renderer_Flags) return SDL.C_Pointers.Renderer_Pointer with Import => True, Convention => C, External_Name => "SDL_CreateRenderer"; begin Rend.Internal := SDL_Create_Renderer (Get_Internal_Window (Window), -1, Flags); Rend.Owns := True; end Create; procedure Create (Rend : in out Renderer; Surface : in SDL.Video.Surfaces.Surface) is function SDL_Create_Software_Renderer (S : in SDL.Video.Surfaces.Internal_Surface_Pointer) return SDL.C_Pointers.Renderer_Pointer with Import => True, Convention => C, External_Name => "SDL_CreateSoftwareRenderer"; begin Rend.Internal := SDL_Create_Software_Renderer (Get_Internal_Surface (Surface)); Rend.Owns := True; end Create; end SDL.Video.Renderers.Makers;
stcarrez/ada-asf
Ada
23,340
adb
----------------------------------------------------------------------- -- asf-views-nodes -- Facelet node tree representation -- Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2018, 2022 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with EL.Contexts.Default; with ASF.Components.Core; with ASF.Contexts.Writer; with Ada.Unchecked_Deallocation; with Ada.Exceptions; with Util.Log.Loggers; package body ASF.Views.Nodes is use EL.Expressions; procedure Free is new Ada.Unchecked_Deallocation (Tag_Node'Class, Tag_Node_Access); procedure Free is new Ada.Unchecked_Deallocation (Tag_Attribute_Array, Tag_Attribute_Array_Access); procedure Free is new Ada.Unchecked_Deallocation (Tag_Content, Tag_Content_Access); procedure Free is new Ada.Unchecked_Deallocation (EL.Expressions.Expression'Class, EL.Expressions.Expression_Access); use Util.Log; -- The logger Log : constant Loggers.Logger := Loggers.Create ("ASF.Views.Nodes"); -- ------------------------------ -- Attribute of a node. -- ------------------------------ -- ------------------------------ -- Report an error message for the attribute. -- ------------------------------ procedure Error (Attribute : in Tag_Attribute; Message : in String; Param1 : in String; Param2 : in String := "") is begin if Attribute.Tag /= null then Attribute.Tag.Error (Message, Param1, Param2); else Log.Error (Message, Param1, Param2); end if; end Error; -- ------------------------------ -- Compare the attribute name. -- ------------------------------ function "=" (Left : in Tag_Attribute; Right : in String) return Boolean is begin return Left.Name = Right; end "="; overriding function "=" (Left, Right : in Tag_Attribute) return Boolean is begin return Left.Name = Right.Name; end "="; -- ------------------------------ -- Get the attribute name. -- ------------------------------ function Get_Name (Attribute : Tag_Attribute) return String is begin return To_String (Attribute.Name); end Get_Name; -- ------------------------------ -- Returns True if the attribute is static (not an EL expression). -- ------------------------------ function Is_Static (Attribute : Tag_Attribute) return Boolean is begin return Attribute.Binding = null; end Is_Static; -- ------------------------------ -- Get the attribute value. If the attribute is an EL expression -- evaluate that expression in the context of the given UI component. -- ------------------------------ function Get_Value (Attribute : Tag_Attribute; UI : UIComponent'Class) return EL.Objects.Object is procedure Handle_Exception (E : in Ada.Exceptions.Exception_Occurrence); procedure Handle_Exception (E : in Ada.Exceptions.Exception_Occurrence) is begin Error (Attribute, "Evaluation error: {0}", Ada.Exceptions.Exception_Message (E)); end Handle_Exception; begin if Attribute.Binding /= null then declare Ctx : constant EL.Contexts.ELContext_Access := UI.Get_Context.Get_ELContext; Context : EL.Contexts.Default.Guarded_Context (Handle_Exception'Access, Ctx); begin return Attribute.Binding.Get_Value (Context); end; else return EL.Objects.To_Object (Attribute.Value); end if; end Get_Value; -- ------------------------------ -- Get the attribute value. If the attribute is an EL expression -- evaluate that expression in the context of the given UI component. -- ------------------------------ function Get_Value (Attribute : Tag_Attribute; Context : Faces_Context'Class) return EL.Objects.Object is procedure Handle_Exception (E : in Ada.Exceptions.Exception_Occurrence); procedure Handle_Exception (E : in Ada.Exceptions.Exception_Occurrence) is begin Error (Attribute, "Evaluation error: {0}", Ada.Exceptions.Exception_Message (E)); end Handle_Exception; begin if Attribute.Binding /= null then declare Ctx : constant EL.Contexts.ELContext_Access := Context.Get_ELContext; Context : EL.Contexts.Default.Guarded_Context (Handle_Exception'Access, Ctx); begin return Attribute.Binding.Get_Value (Context); end; else return EL.Objects.To_Object (Attribute.Value); end if; end Get_Value; function Get_Value (Attribute : Tag_Attribute; Context : Facelet_Context'Class) return EL.Objects.Object is procedure Handle_Exception (E : in Ada.Exceptions.Exception_Occurrence); procedure Handle_Exception (E : in Ada.Exceptions.Exception_Occurrence) is begin Error (Attribute, "Evaluation error: {0}", Ada.Exceptions.Exception_Message (E)); end Handle_Exception; begin if Attribute.Binding /= null then declare Ctx : constant EL.Contexts.ELContext_Access := Context.Get_ELContext; Context : EL.Contexts.Default.Guarded_Context (Handle_Exception'Access, Ctx); begin return Attribute.Binding.Get_Value (Context); end; else return EL.Objects.To_Object (Attribute.Value); end if; end Get_Value; -- ------------------------------ -- Get the value from the attribute. If the attribute is null or evaluates to -- a NULL object, returns the default value. Convert the value into a string. -- ------------------------------ function Get_Value (Attribute : in Tag_Attribute_Access; Context : in Facelet_Context'Class; Default : in String) return String is begin if Attribute = null then return Default; else declare Value : constant EL.Objects.Object := Get_Value (Attribute.all, Context); begin if EL.Objects.Is_Null (Value) then return Default; else return EL.Objects.To_String (Value); end if; end; end if; end Get_Value; -- ------------------------------ -- Get the EL expression associated with the given tag attribute. -- ------------------------------ function Get_Expression (Attribute : in Tag_Attribute) return EL.Expressions.Expression is begin if Attribute.Binding /= null then return EL.Expressions.Expression (Attribute.Binding.all); else return EL.Expressions.Create_Expression (EL.Objects.To_Object (Attribute.Value)); end if; end Get_Expression; function Get_Value_Expression (Attribute : Tag_Attribute) return EL.Expressions.Value_Expression is begin if Attribute.Binding /= null then return EL.Expressions.Create_Expression (Attribute.Binding.all); else return EL.Expressions.Create_ValueExpression (EL.Objects.To_Object (Attribute.Value)); end if; end Get_Value_Expression; function Get_Method_Expression (Attribute : Tag_Attribute) return EL.Expressions.Method_Expression is begin if Attribute.Binding /= null then return EL.Expressions.Create_Expression (Attribute.Binding.all); else Error (Attribute, "Invalid method expression", ""); raise Constraint_Error with "Invalid method expression"; end if; end Get_Method_Expression; -- ------------------------------ -- Reduce the expression by eliminating known variables and computing -- constant expressions. The result expression is either another -- expression or a computed constant value. -- ------------------------------ function Reduce_Expression (Attribute : Tag_Attribute; Context : Facelet_Context'Class) return EL.Expressions.Expression is E : constant EL.Expressions.Expression := EL.Expressions.Expression (Attribute.Binding.all); begin return E.Reduce_Expression (Context.Get_ELContext.all); end Reduce_Expression; -- ------------------------------ -- Find the tag attribute having the given name. -- Returns an access to the attribute cell within the array or null -- if the no attribute matches the name. -- ------------------------------ function Find_Attribute (Attributes : Tag_Attribute_Array_Access; Name : String) return Tag_Attribute_Access is begin for I in Attributes'Range loop declare Attr : constant Tag_Attribute_Access := Attributes (I)'Access; begin if Attr.Name = Name then return Attr; end if; end; end loop; return null; end Find_Attribute; -- ------------------------------ -- XHTML node -- ------------------------------ -- ------------------------------ -- Get the line information where the tag node is defined. -- ------------------------------ function Get_Line_Info (Node : Tag_Node) return Line_Info is begin return Node.Line; end Get_Line_Info; -- ------------------------------ -- Get the line information as a string. -- ------------------------------ function Get_Line_Info (Node : Tag_Node) return String is L : constant String := Natural'Image (Node.Line.Line); C : constant String := Natural'Image (Node.Line.Column); begin if Node.Line.File = null then return "?:" & L (L'First + 1 .. L'Last) & ':' & C (C'First + 1 .. C'Last); else return Node.Line.File.Path & ':' & L (L'First + 1 .. L'Last) & ':' & C (C'First + 1 .. C'Last); end if; end Get_Line_Info; -- ------------------------------ -- Get the relative path name of the XHTML file in which this tag is defined. -- ------------------------------ function Get_File_Name (Node : in Tag_Node) return String is File : constant File_Info_Access := Node.Line.File; begin return File.Path (File.Relative_Pos .. File.Path'Last); end Get_File_Name; -- ------------------------------ -- Get the node attribute with the given name. -- Returns null if the node does not have such attribute. -- ------------------------------ function Get_Attribute (Node : Tag_Node; Name : String) return Tag_Attribute_Access is begin if Node.Attributes = null then return null; end if; return Find_Attribute (Node.Attributes, Name); end Get_Attribute; -- ------------------------------ -- Initialize the node -- ------------------------------ procedure Initialize (Node : in Tag_Node_Access; Binding : in Binding_Type; Line : in Line_Info; Parent : in Tag_Node_Access; Attributes : in Tag_Attribute_Array_Access) is begin Node.Factory := Binding.Component; Node.Line := Line; Node.Parent := Parent; Node.Attributes := Attributes; if Node.Attributes /= null then for I in Attributes.all'Range loop Attributes (I).Tag := Node; end loop; end if; Append_Tag (Parent, Node); end Initialize; -- ------------------------------ -- Append a child tag node. -- ------------------------------ procedure Append_Tag (Node : in Tag_Node_Access; Child : in Tag_Node_Access) is begin if Node.First_Child = null then Node.First_Child := Child; else Node.Last_Child.Next := Child; end if; Node.Last_Child := Child; Child.Parent := Node; Child.Next := null; end Append_Tag; -- ------------------------------ -- Freeze the tag node tree and perform any initialization steps -- necessary to build the components efficiently. After this call -- the tag node tree should not be modified and it represents a read-only -- tree. -- ------------------------------ procedure Freeze (Node : access Tag_Node) is begin null; end Freeze; -- ------------------------------ -- Delete the node and its children freeing the memory as necessary -- ------------------------------ procedure Delete (Node : access Tag_Node) is Child : Tag_Node_Access := Node.First_Child; Next : Tag_Node_Access; begin while Child /= null loop Next := Child.Next; Child.Delete; Free (Child); Child := Next; end loop; if Node.Attributes /= null then for I in Node.Attributes'Range loop declare Expr : EL.Expressions.Expression_Access := Node.Attributes (I).Binding; begin Free (Expr); end; end loop; Free (Node.Attributes); end if; end Delete; procedure Destroy (Node : in out Tag_Node_Access) is begin Node.Delete; Free (Node); end Destroy; -- ------------------------------ -- Report an error message -- ------------------------------ procedure Error (Node : in Tag_Node'Class; Message : in String; Param1 : in String := ""; Param2 : in String := "") is L : constant String := Node.Get_Line_Info; begin Log.Error (L & ":" & Message, Param1, Param2); end Error; -- ------------------------------ -- Build the component attributes from the facelet tag node and the facelet context. -- ------------------------------ procedure Build_Attributes (UI : in out UIComponent'Class; Node : in Tag_Node'Class; Context : in out Facelet_Context'Class) is procedure Process_Attribute (Attr : in Tag_Attribute_Access); procedure Process_Attribute (Attr : in Tag_Attribute_Access) is begin if Attr.Binding /= null then -- Reduce the expression by eliminating variables which are defined in -- the Facelet context. We can obtain another expression or a constant value. declare Ctx : constant EL.Contexts.ELContext_Access := Context.Get_ELContext; Expr : constant EL.Expressions.Expression := EL.Expressions.Expression (Attr.Binding.all).Reduce_Expression (Ctx.all); begin if Expr.Is_Constant then UI.Set_Attribute (Def => Attr, Value => Expr.Get_Value (Ctx.all)); else UI.Set_Attribute (Def => Attr, Value => Expr); end if; end; end if; end Process_Attribute; -- Iterate over the attributes to resolve some value expressions. procedure Iterate_Attributes is new ASF.Views.Nodes.Iterate_Attributes (Process_Attribute); begin Iterate_Attributes (Node); end Build_Attributes; -- ------------------------------ -- Build the component tree from the tag node and attach it as -- the last child of the given parent. Calls recursively the -- method to create children. -- ------------------------------ procedure Build_Components (Node : access Tag_Node; Parent : in UIComponent_Access; Context : in out Facelet_Context'Class) is UI : constant UIComponent_Access := Node.Factory.all; begin Append (Parent, UI, Node); Build_Attributes (UI.all, Node.all, Context); UI.Initialize (UI.Get_Context.all); Node.Build_Children (UI, Context); end Build_Components; procedure Build_Children (Node : access Tag_Node; Parent : in UIComponent_Access; Context : in out Facelet_Context'Class) is Child : Tag_Node_Access; begin Child := Node.First_Child; while Child /= null loop Child.Build_Components (Parent, Context); Child := Child.Next; end loop; end Build_Children; -- ------------------------------ -- Iterate over the attributes defined on the node and -- execute the <b>Process</b> procedure. -- ------------------------------ procedure Iterate_Attributes (Node : in Tag_Node'Class) is begin for I in Node.Attributes'Range loop declare Attr : constant Tag_Attribute_Access := Node.Attributes (I)'Access; begin Process (Attr); end; end loop; end Iterate_Attributes; -- ------------------------------ -- Freeze the tag node tree. -- Count the number of Tag_Content represented by this node. -- ------------------------------ overriding procedure Freeze (Node : access Text_Tag_Node) is Content : access constant Tag_Content := Node.Content'Access; Count : Natural := 0; begin loop Content := Content.Next; Count := Count + 1; exit when Content = null; end loop; Node.Count := Count; end Freeze; overriding procedure Build_Components (Node : access Text_Tag_Node; Parent : in UIComponent_Access; Context : in out Facelet_Context'Class) is UI : constant ASF.Components.Core.UIText_Access := ASF.Components.Core.Create_UIText (Node.all'Access); Expr_Table : Expression_Access_Array_Access := null; Ctx : constant EL.Contexts.ELContext_Access := Context.Get_ELContext; Content : access constant Tag_Content := Node.Content'Access; Pos : Natural := 1; begin Append (Parent, UI.all'Access, Node); loop if not Content.Expr.Is_Null then -- Reduce the expression by eliminating variables which are defined in -- the Facelet context. We can obtain another expression or a constant value. declare Expr : constant EL.Expressions.Expression := Content.Expr.Reduce_Expression (Ctx.all); begin if Expr /= Content.Expr then if Expr_Table = null then Expr_Table := new Expression_Access_Array (1 .. Node.Count); UI.Set_Expression_Table (Expr_Table); end if; Expr_Table (Pos) := new EL.Expressions.Expression '(Expr); end if; end; end if; Content := Content.Next; Pos := Pos + 1; exit when Content = null; end loop; end Build_Components; -- ------------------------------ -- Delete the node and its children freeing the memory as necessary -- ------------------------------ overriding procedure Delete (Node : access Text_Tag_Node) is Content : Tag_Content_Access := Node.Content.Next; begin while Content /= null loop declare Next : constant Tag_Content_Access := Content.Next; begin Free (Content); Content := Next; end; end loop; Node.Content.Next := null; Node.Last := null; end Delete; -- ------------------------------ -- Encode the content represented by this text node. -- The expressions are evaluated if necessary. -- ------------------------------ procedure Encode_All (Node : in Text_Tag_Node; Expr : in Expression_Access_Array_Access; Context : in Faces_Context'Class) is Writer : constant ASF.Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer; Content : access constant Tag_Content := Node.Content'Access; Pos : Natural := 1; begin loop Writer.Write (Content.Text); begin if Expr /= null and then Expr (Pos) /= null then declare Value : constant EL.Objects.Object := Expr (Pos).Get_Value (Context.Get_ELContext.all); begin if not EL.Objects.Is_Null (Value) then Writer.Write_Text (Value); end if; end; else declare Value : constant EL.Objects.Object := Content.Expr.Get_Value (Context.Get_ELContext.all); begin if not EL.Objects.Is_Null (Value) then Writer.Write_Text (Value); end if; end; end if; exception when E : others => Node.Error ("Evaluation error: {0}", Ada.Exceptions.Exception_Message (E)); end; Content := Content.Next; Pos := Pos + 1; exit when Content = null; end loop; end Encode_All; function First (Node : in Tag_Node_Access) return Cursor is Result : Cursor; begin Result.Node := Node.First_Child; return Result; end First; function Has_Element (C : Cursor) return Boolean is begin return C.Node /= null; end Has_Element; function Element (Position : Cursor) return Tag_Node_Access is begin return Position.Node; end Element; procedure Next (Position : in out Cursor) is begin Position.Node := Position.Node.Next; end Next; -- Create a tag node -- Create the text Tag function Create_Component_Node (Binding : in Binding_Type; Line : in Line_Info; Parent : in Tag_Node_Access; Attributes : in Tag_Attribute_Array_Access) return Tag_Node_Access is Node : constant Tag_Node_Access := new Tag_Node; begin Initialize (Node.all'Access, Binding, Line, Parent, Attributes); return Node.all'Access; end Create_Component_Node; end ASF.Views.Nodes;
reznikmm/matreshka
Ada
37,081
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.Elements; with AMF.Internals.Element_Collections; with AMF.Internals.Helpers; with AMF.Internals.Tables.UML_Attributes; with AMF.Visitors.UML_Iterators; with AMF.Visitors.UML_Visitors; with League.Strings.Internals; with Matreshka.Internals.Strings; package body AMF.Internals.UML_Expansion_Regions is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant UML_Expansion_Region_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Enter_Expansion_Region (AMF.UML.Expansion_Regions.UML_Expansion_Region_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant UML_Expansion_Region_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Leave_Expansion_Region (AMF.UML.Expansion_Regions.UML_Expansion_Region_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant UML_Expansion_Region_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then AMF.Visitors.UML_Iterators.UML_Iterator'Class (Iterator).Visit_Expansion_Region (Visitor, AMF.UML.Expansion_Regions.UML_Expansion_Region_Access (Self), Control); end if; end Visit_Element; ----------------------- -- Get_Input_Element -- ----------------------- overriding function Get_Input_Element (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Expansion_Nodes.Collections.Set_Of_UML_Expansion_Node is begin return AMF.UML.Expansion_Nodes.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Input_Element (Self.Element))); end Get_Input_Element; -------------- -- Get_Mode -- -------------- overriding function Get_Mode (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.UML_Expansion_Kind is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Mode (Self.Element); end Get_Mode; -------------- -- Set_Mode -- -------------- overriding procedure Set_Mode (Self : not null access UML_Expansion_Region_Proxy; To : AMF.UML.UML_Expansion_Kind) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Mode (Self.Element, To); end Set_Mode; ------------------------ -- Get_Output_Element -- ------------------------ overriding function Get_Output_Element (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Expansion_Nodes.Collections.Set_Of_UML_Expansion_Node is begin return AMF.UML.Expansion_Nodes.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Output_Element (Self.Element))); end Get_Output_Element; ------------------ -- Get_Activity -- ------------------ overriding function Get_Activity (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Activities.UML_Activity_Access is begin return AMF.UML.Activities.UML_Activity_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Activity (Self.Element))); end Get_Activity; ------------------ -- Set_Activity -- ------------------ overriding procedure Set_Activity (Self : not null access UML_Expansion_Region_Proxy; To : AMF.UML.Activities.UML_Activity_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Activity (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Activity; -------------- -- Get_Edge -- -------------- overriding function Get_Edge (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is begin return AMF.UML.Activity_Edges.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Edge (Self.Element))); end Get_Edge; ---------------------- -- Get_Must_Isolate -- ---------------------- overriding function Get_Must_Isolate (Self : not null access constant UML_Expansion_Region_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Must_Isolate (Self.Element); end Get_Must_Isolate; ---------------------- -- Set_Must_Isolate -- ---------------------- overriding procedure Set_Must_Isolate (Self : not null access UML_Expansion_Region_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Must_Isolate (Self.Element, To); end Set_Must_Isolate; -------------- -- Get_Node -- -------------- overriding function Get_Node (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Activity_Nodes.Collections.Set_Of_UML_Activity_Node is begin return AMF.UML.Activity_Nodes.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Node (Self.Element))); end Get_Node; ------------------------------- -- Get_Structured_Node_Input -- ------------------------------- overriding function Get_Structured_Node_Input (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Input_Pins.Collections.Set_Of_UML_Input_Pin is begin return AMF.UML.Input_Pins.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Structured_Node_Input (Self.Element))); end Get_Structured_Node_Input; -------------------------------- -- Get_Structured_Node_Output -- -------------------------------- overriding function Get_Structured_Node_Output (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Output_Pins.Collections.Set_Of_UML_Output_Pin is begin return AMF.UML.Output_Pins.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Structured_Node_Output (Self.Element))); end Get_Structured_Node_Output; ------------------ -- Get_Variable -- ------------------ overriding function Get_Variable (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Variables.Collections.Set_Of_UML_Variable is begin return AMF.UML.Variables.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Variable (Self.Element))); end Get_Variable; ------------------------ -- Get_Element_Import -- ------------------------ overriding function Get_Element_Import (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import is begin return AMF.UML.Element_Imports.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Element_Import (Self.Element))); end Get_Element_Import; ------------------------- -- Get_Imported_Member -- ------------------------- overriding function Get_Imported_Member (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin return AMF.UML.Packageable_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Imported_Member (Self.Element))); end Get_Imported_Member; ---------------- -- Get_Member -- ---------------- overriding function Get_Member (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin return AMF.UML.Named_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Member (Self.Element))); end Get_Member; ---------------------- -- Get_Owned_Member -- ---------------------- overriding function Get_Owned_Member (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin return AMF.UML.Named_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Member (Self.Element))); end Get_Owned_Member; -------------------- -- Get_Owned_Rule -- -------------------- overriding function Get_Owned_Rule (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is begin return AMF.UML.Constraints.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Rule (Self.Element))); end Get_Owned_Rule; ------------------------ -- Get_Package_Import -- ------------------------ overriding function Get_Package_Import (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import is begin return AMF.UML.Package_Imports.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Package_Import (Self.Element))); end Get_Package_Import; --------------------------- -- Get_Client_Dependency -- --------------------------- overriding function Get_Client_Dependency (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is begin return AMF.UML.Dependencies.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency (Self.Element))); end Get_Client_Dependency; ------------------------- -- Get_Name_Expression -- ------------------------- overriding function Get_Name_Expression (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access is begin return AMF.UML.String_Expressions.UML_String_Expression_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression (Self.Element))); end Get_Name_Expression; ------------------------- -- Set_Name_Expression -- ------------------------- overriding procedure Set_Name_Expression (Self : not null access UML_Expansion_Region_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Name_Expression; ------------------- -- Get_Namespace -- ------------------- overriding function Get_Namespace (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin return AMF.UML.Namespaces.UML_Namespace_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace (Self.Element))); end Get_Namespace; ------------------------ -- Get_Qualified_Name -- ------------------------ overriding function Get_Qualified_Name (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.Optional_String is begin declare use type Matreshka.Internals.Strings.Shared_String_Access; Aux : constant Matreshka.Internals.Strings.Shared_String_Access := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element); begin if Aux = null then return (Is_Empty => True); else return (False, League.Strings.Internals.Create (Aux)); end if; end; end Get_Qualified_Name; ------------------------ -- Get_Contained_Edge -- ------------------------ overriding function Get_Contained_Edge (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is begin return AMF.UML.Activity_Edges.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Contained_Edge (Self.Element))); end Get_Contained_Edge; ------------------------ -- Get_Contained_Node -- ------------------------ overriding function Get_Contained_Node (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Activity_Nodes.Collections.Set_Of_UML_Activity_Node is begin return AMF.UML.Activity_Nodes.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Contained_Node (Self.Element))); end Get_Contained_Node; --------------------- -- Get_In_Activity -- --------------------- overriding function Get_In_Activity (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Activities.UML_Activity_Access is begin return AMF.UML.Activities.UML_Activity_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Activity (Self.Element))); end Get_In_Activity; --------------------- -- Set_In_Activity -- --------------------- overriding procedure Set_In_Activity (Self : not null access UML_Expansion_Region_Proxy; To : AMF.UML.Activities.UML_Activity_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_In_Activity (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_In_Activity; ------------------ -- Get_Subgroup -- ------------------ overriding function Get_Subgroup (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Activity_Groups.Collections.Set_Of_UML_Activity_Group is begin return AMF.UML.Activity_Groups.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Subgroup (Self.Element))); end Get_Subgroup; --------------------- -- Get_Super_Group -- --------------------- overriding function Get_Super_Group (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Activity_Groups.UML_Activity_Group_Access is begin return AMF.UML.Activity_Groups.UML_Activity_Group_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Super_Group (Self.Element))); end Get_Super_Group; ----------------- -- Get_Context -- ----------------- overriding function Get_Context (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Classifiers.UML_Classifier_Access is begin return AMF.UML.Classifiers.UML_Classifier_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Context (Self.Element))); end Get_Context; --------------- -- Get_Input -- --------------- overriding function Get_Input (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Input_Pins.Collections.Ordered_Set_Of_UML_Input_Pin is begin return AMF.UML.Input_Pins.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Input (Self.Element))); end Get_Input; ------------------------------ -- Get_Is_Locally_Reentrant -- ------------------------------ overriding function Get_Is_Locally_Reentrant (Self : not null access constant UML_Expansion_Region_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Locally_Reentrant (Self.Element); end Get_Is_Locally_Reentrant; ------------------------------ -- Set_Is_Locally_Reentrant -- ------------------------------ overriding procedure Set_Is_Locally_Reentrant (Self : not null access UML_Expansion_Region_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Locally_Reentrant (Self.Element, To); end Set_Is_Locally_Reentrant; ----------------------------- -- Get_Local_Postcondition -- ----------------------------- overriding function Get_Local_Postcondition (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is begin return AMF.UML.Constraints.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Postcondition (Self.Element))); end Get_Local_Postcondition; ---------------------------- -- Get_Local_Precondition -- ---------------------------- overriding function Get_Local_Precondition (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is begin return AMF.UML.Constraints.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Precondition (Self.Element))); end Get_Local_Precondition; ---------------- -- Get_Output -- ---------------- overriding function Get_Output (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Output_Pins.Collections.Ordered_Set_Of_UML_Output_Pin is begin return AMF.UML.Output_Pins.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Output (Self.Element))); end Get_Output; ----------------- -- Get_Handler -- ----------------- overriding function Get_Handler (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Exception_Handlers.Collections.Set_Of_UML_Exception_Handler is begin return AMF.UML.Exception_Handlers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Handler (Self.Element))); end Get_Handler; ------------------ -- Get_In_Group -- ------------------ overriding function Get_In_Group (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Activity_Groups.Collections.Set_Of_UML_Activity_Group is begin return AMF.UML.Activity_Groups.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Group (Self.Element))); end Get_In_Group; --------------------------------- -- Get_In_Interruptible_Region -- --------------------------------- overriding function Get_In_Interruptible_Region (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Interruptible_Activity_Regions.Collections.Set_Of_UML_Interruptible_Activity_Region is begin return AMF.UML.Interruptible_Activity_Regions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Interruptible_Region (Self.Element))); end Get_In_Interruptible_Region; ---------------------- -- Get_In_Partition -- ---------------------- overriding function Get_In_Partition (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Activity_Partitions.Collections.Set_Of_UML_Activity_Partition is begin return AMF.UML.Activity_Partitions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Partition (Self.Element))); end Get_In_Partition; ---------------------------- -- Get_In_Structured_Node -- ---------------------------- overriding function Get_In_Structured_Node (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access is begin return AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Structured_Node (Self.Element))); end Get_In_Structured_Node; ---------------------------- -- Set_In_Structured_Node -- ---------------------------- overriding procedure Set_In_Structured_Node (Self : not null access UML_Expansion_Region_Proxy; To : AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_In_Structured_Node (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_In_Structured_Node; ------------------ -- Get_Incoming -- ------------------ overriding function Get_Incoming (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is begin return AMF.UML.Activity_Edges.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Incoming (Self.Element))); end Get_Incoming; ------------------ -- Get_Outgoing -- ------------------ overriding function Get_Outgoing (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is begin return AMF.UML.Activity_Edges.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Outgoing (Self.Element))); end Get_Outgoing; ------------------------ -- Get_Redefined_Node -- ------------------------ overriding function Get_Redefined_Node (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Activity_Nodes.Collections.Set_Of_UML_Activity_Node is begin return AMF.UML.Activity_Nodes.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Node (Self.Element))); end Get_Redefined_Node; ----------------- -- Get_Is_Leaf -- ----------------- overriding function Get_Is_Leaf (Self : not null access constant UML_Expansion_Region_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf (Self.Element); end Get_Is_Leaf; ----------------- -- Set_Is_Leaf -- ----------------- overriding procedure Set_Is_Leaf (Self : not null access UML_Expansion_Region_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Leaf (Self.Element, To); end Set_Is_Leaf; --------------------------- -- Get_Redefined_Element -- --------------------------- overriding function Get_Redefined_Element (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is begin return AMF.UML.Redefinable_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Element (Self.Element))); end Get_Redefined_Element; ------------------------------ -- Get_Redefinition_Context -- ------------------------------ overriding function Get_Redefinition_Context (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin return AMF.UML.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefinition_Context (Self.Element))); end Get_Redefinition_Context; ------------------------ -- Exclude_Collisions -- ------------------------ overriding function Exclude_Collisions (Self : not null access constant UML_Expansion_Region_Proxy; Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Exclude_Collisions unimplemented"); raise Program_Error with "Unimplemented procedure UML_Expansion_Region_Proxy.Exclude_Collisions"; return Exclude_Collisions (Self, Imps); end Exclude_Collisions; ------------------------- -- Get_Names_Of_Member -- ------------------------- overriding function Get_Names_Of_Member (Self : not null access constant UML_Expansion_Region_Proxy; Element : AMF.UML.Named_Elements.UML_Named_Element_Access) return AMF.String_Collections.Set_Of_String is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Get_Names_Of_Member unimplemented"); raise Program_Error with "Unimplemented procedure UML_Expansion_Region_Proxy.Get_Names_Of_Member"; return Get_Names_Of_Member (Self, Element); end Get_Names_Of_Member; -------------------- -- Import_Members -- -------------------- overriding function Import_Members (Self : not null access constant UML_Expansion_Region_Proxy; Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Import_Members unimplemented"); raise Program_Error with "Unimplemented procedure UML_Expansion_Region_Proxy.Import_Members"; return Import_Members (Self, Imps); end Import_Members; --------------------- -- Imported_Member -- --------------------- overriding function Imported_Member (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Imported_Member unimplemented"); raise Program_Error with "Unimplemented procedure UML_Expansion_Region_Proxy.Imported_Member"; return Imported_Member (Self); end Imported_Member; --------------------------------- -- Members_Are_Distinguishable -- --------------------------------- overriding function Members_Are_Distinguishable (Self : not null access constant UML_Expansion_Region_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Members_Are_Distinguishable unimplemented"); raise Program_Error with "Unimplemented procedure UML_Expansion_Region_Proxy.Members_Are_Distinguishable"; return Members_Are_Distinguishable (Self); end Members_Are_Distinguishable; ------------------ -- Owned_Member -- ------------------ overriding function Owned_Member (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Owned_Member unimplemented"); raise Program_Error with "Unimplemented procedure UML_Expansion_Region_Proxy.Owned_Member"; return Owned_Member (Self); end Owned_Member; ------------------------- -- All_Owning_Packages -- ------------------------- overriding function All_Owning_Packages (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented"); raise Program_Error with "Unimplemented procedure UML_Expansion_Region_Proxy.All_Owning_Packages"; return All_Owning_Packages (Self); end All_Owning_Packages; ----------------------------- -- Is_Distinguishable_From -- ----------------------------- overriding function Is_Distinguishable_From (Self : not null access constant UML_Expansion_Region_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented"); raise Program_Error with "Unimplemented procedure UML_Expansion_Region_Proxy.Is_Distinguishable_From"; return Is_Distinguishable_From (Self, N, Ns); end Is_Distinguishable_From; --------------- -- Namespace -- --------------- overriding function Namespace (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented"); raise Program_Error with "Unimplemented procedure UML_Expansion_Region_Proxy.Namespace"; return Namespace (Self); end Namespace; ------------- -- Context -- ------------- overriding function Context (Self : not null access constant UML_Expansion_Region_Proxy) return AMF.UML.Classifiers.UML_Classifier_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Context unimplemented"); raise Program_Error with "Unimplemented procedure UML_Expansion_Region_Proxy.Context"; return Context (Self); end Context; ------------------------ -- Is_Consistent_With -- ------------------------ overriding function Is_Consistent_With (Self : not null access constant UML_Expansion_Region_Proxy; Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented"); raise Program_Error with "Unimplemented procedure UML_Expansion_Region_Proxy.Is_Consistent_With"; return Is_Consistent_With (Self, Redefinee); end Is_Consistent_With; ----------------------------------- -- Is_Redefinition_Context_Valid -- ----------------------------------- overriding function Is_Redefinition_Context_Valid (Self : not null access constant UML_Expansion_Region_Proxy; Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented"); raise Program_Error with "Unimplemented procedure UML_Expansion_Region_Proxy.Is_Redefinition_Context_Valid"; return Is_Redefinition_Context_Valid (Self, Redefined); end Is_Redefinition_Context_Valid; end AMF.Internals.UML_Expansion_Regions;
ekoeppen/STM32_Generic_Ada_Drivers
Ada
5,108
ads
-- This spec has been automatically generated from STM32L0x1.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with Interfaces; use Interfaces; with System; -- STM32L0x1 package STM32_SVD is pragma Preelaborate; --------------- -- Base type -- --------------- type UInt32 is new Interfaces.Unsigned_32; type UInt16 is new Interfaces.Unsigned_16; type Byte is new Interfaces.Unsigned_8; type Bit is mod 2**1 with Size => 1; type UInt2 is mod 2**2 with Size => 2; type UInt3 is mod 2**3 with Size => 3; type UInt4 is mod 2**4 with Size => 4; type UInt5 is mod 2**5 with Size => 5; type UInt6 is mod 2**6 with Size => 6; type UInt7 is mod 2**7 with Size => 7; type UInt9 is mod 2**9 with Size => 9; type UInt10 is mod 2**10 with Size => 10; type UInt11 is mod 2**11 with Size => 11; type UInt12 is mod 2**12 with Size => 12; type UInt13 is mod 2**13 with Size => 13; type UInt14 is mod 2**14 with Size => 14; type UInt15 is mod 2**15 with Size => 15; type UInt17 is mod 2**17 with Size => 17; type UInt18 is mod 2**18 with Size => 18; type UInt19 is mod 2**19 with Size => 19; type UInt20 is mod 2**20 with Size => 20; type UInt21 is mod 2**21 with Size => 21; type UInt22 is mod 2**22 with Size => 22; type UInt23 is mod 2**23 with Size => 23; type UInt24 is mod 2**24 with Size => 24; type UInt25 is mod 2**25 with Size => 25; type UInt26 is mod 2**26 with Size => 26; type UInt27 is mod 2**27 with Size => 27; type UInt28 is mod 2**28 with Size => 28; type UInt29 is mod 2**29 with Size => 29; type UInt30 is mod 2**30 with Size => 30; type UInt31 is mod 2**31 with Size => 31; -------------------- -- Base addresses -- -------------------- AES_Base : constant System.Address := System'To_Address (16#40026000#); DMA1_Base : constant System.Address := System'To_Address (16#40020000#); CRC_Base : constant System.Address := System'To_Address (16#40023000#); GPIOA_Base : constant System.Address := System'To_Address (16#50000000#); GPIOB_Base : constant System.Address := System'To_Address (16#50000400#); GPIOC_Base : constant System.Address := System'To_Address (16#50000800#); GPIOD_Base : constant System.Address := System'To_Address (16#50000C00#); GPIOH_Base : constant System.Address := System'To_Address (16#50001C00#); GPIOE_Base : constant System.Address := System'To_Address (16#50001000#); LPTIM_Base : constant System.Address := System'To_Address (16#40007C00#); RTC_Base : constant System.Address := System'To_Address (16#40002800#); USART1_Base : constant System.Address := System'To_Address (16#40013800#); USART2_Base : constant System.Address := System'To_Address (16#40004400#); USART4_Base : constant System.Address := System'To_Address (16#40004C00#); USART5_Base : constant System.Address := System'To_Address (16#40005000#); IWDG_Base : constant System.Address := System'To_Address (16#40003000#); WWDG_Base : constant System.Address := System'To_Address (16#40002C00#); Firewall_Base : constant System.Address := System'To_Address (16#40011C00#); RCC_Base : constant System.Address := System'To_Address (16#40021000#); SYSCFG_COMP_Base : constant System.Address := System'To_Address (16#40010000#); SPI1_Base : constant System.Address := System'To_Address (16#40013000#); SPI2_Base : constant System.Address := System'To_Address (16#40003800#); I2C1_Base : constant System.Address := System'To_Address (16#40005400#); I2C2_Base : constant System.Address := System'To_Address (16#40005800#); I2C3_Base : constant System.Address := System'To_Address (16#40007800#); PWR_Base : constant System.Address := System'To_Address (16#40007000#); Flash_Base : constant System.Address := System'To_Address (16#40022000#); EXTI_Base : constant System.Address := System'To_Address (16#40010400#); ADC_Base : constant System.Address := System'To_Address (16#40012400#); DBG_Base : constant System.Address := System'To_Address (16#40015800#); TIM2_Base : constant System.Address := System'To_Address (16#40000000#); TIM3_Base : constant System.Address := System'To_Address (16#40000400#); TIM6_Base : constant System.Address := System'To_Address (16#40001000#); TIM7_Base : constant System.Address := System'To_Address (16#40001400#); TIM21_Base : constant System.Address := System'To_Address (16#40010800#); TIM22_Base : constant System.Address := System'To_Address (16#40011400#); LPUART1_Base : constant System.Address := System'To_Address (16#40004800#); NVIC_Base : constant System.Address := System'To_Address (16#E000E100#); MPU_Base : constant System.Address := System'To_Address (16#E000ED90#); STK_Base : constant System.Address := System'To_Address (16#E000E010#); SCB_Base : constant System.Address := System'To_Address (16#E000ED00#); end STM32_SVD;
Heziode/lsystem-editor
Ada
1,812
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 angle error. -- package LSE.Model.L_System.Error.Missing_Angle is type Instance is new LSE.Model.L_System.Error.Instance with null record; -- Angle not found in input Error : exception; function Initialize return Instance; overriding function Get_Error (This : Instance) return String; end LSE.Model.L_System.Error.Missing_Angle;
afrl-rq/OpenUxAS
Ada
848
ads
package AVTAS.LMCP.object.SPARK_Boundary with SPARK_Mode is pragma Annotate (GNATprove, Terminating, SPARK_Boundary); type My_Object_Any is private; function Deref (X : My_Object_Any) return Object'Class with Global => null, Inline; function Wrap (X : Object_Any) return My_Object_Any with Global => null, Inline, SPARK_Mode => Off; function Unwrap (X : My_Object_Any) return Object_Any with Global => null, Inline, SPARK_Mode => Off; private pragma SPARK_Mode (Off); type My_Object_Any is new Object_Any; function Deref (X : My_Object_Any) return Object'Class is (X.all); function Wrap (X : Object_Any) return My_Object_Any is (My_Object_Any (X)); function Unwrap (X : My_Object_Any) return Object_Any is (Object_Any (X)); end AVTAS.LMCP.Object.SPARK_Boundary;
reznikmm/matreshka
Ada
5,116
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-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.XML_Catalogs.Handlers; with XML.SAX.Input_Sources.Streams.Files; with XML.SAX.Simple_Readers; package body Matreshka.XML_Catalogs.Loader is ---------- -- Load -- ---------- function Load (URI : League.Strings.Universal_String; Prefer : Matreshka.XML_Catalogs.Entry_Files.Prefer_Mode) return Matreshka.XML_Catalogs.Entry_Files.Catalog_Entry_File_Access is Source : aliased XML.SAX.Input_Sources.Streams.Files.File_Input_Source; Handler : aliased Matreshka.XML_Catalogs.Handlers.XML_Catalog_Handler; Reader : aliased XML.SAX.Simple_Readers.Simple_Reader; begin Handler.Set_Default_Prefer_Mode (Prefer); Reader.Set_Content_Handler (Handler'Unchecked_Access); Source.Open_By_URI (URI); Reader.Parse (Source'Unchecked_Access); return Handler.Get_Catalog_Entry_File; end Load; ----------------------- -- Load_By_File_Name -- ----------------------- function Load_By_File_Name (Name : League.Strings.Universal_String; Prefer : Matreshka.XML_Catalogs.Entry_Files.Prefer_Mode) return Matreshka.XML_Catalogs.Entry_Files.Catalog_Entry_File_Access is Source : aliased XML.SAX.Input_Sources.Streams.Files.File_Input_Source; Handler : aliased Matreshka.XML_Catalogs.Handlers.XML_Catalog_Handler; Reader : aliased XML.SAX.Simple_Readers.Simple_Reader; begin Handler.Set_Default_Prefer_Mode (Prefer); Reader.Set_Content_Handler (Handler'Unchecked_Access); Reader.Set_Error_Handler (Handler'Unchecked_Access); Source.Open_By_File_Name (Name); Reader.Parse (Source'Unchecked_Access); return Handler.Get_Catalog_Entry_File; end Load_By_File_Name; end Matreshka.XML_Catalogs.Loader;
veyselharun/ABench2020
Ada
2,188
adb
-- -- ABench2020 Benchmark Suite -- -- Binary Search Tree Program -- -- Licensed under the MIT License. See LICENSE file in the ABench root -- directory for license information. -- -- Uncomment the line below to print the result. -- with Ada.Text_IO; use Ada.Text_IO; procedure Binary_Search_Tree is type Vector is array (Positive range<>) of Integer; type Node; type Node_Pointer is access Node; type Node is record Value : Integer; Left : Node_Pointer := null; Right : Node_Pointer := null; end record; Root_Node : Node_Pointer := null; function Insert_Node (Parent_Node : in Node_Pointer; Node_Value : in Integer) return Node_Pointer is New_Node : Node_Pointer; begin if Parent_Node = null then New_Node := new Node; New_Node.Value := Node_Value; return New_Node; elsif Node_Value < Parent_Node.Value then Parent_Node.Left := Insert_Node (Parent_Node.Left, Node_Value); elsif Node_Value > Parent_Node.Value then Parent_Node.Right := Insert_Node (Parent_Node.Right, Node_Value); end if; return Parent_Node; end; procedure Insert (Node_Value : in Integer) is Temp_Node : Node_Pointer; begin if Root_Node = null then Root_Node := new Node; Root_Node.Value := Node_Value; else Temp_Node := Insert_Node (Root_Node, Node_Value); end if; end; procedure Traverse (Current_Node : in Node_Pointer) is begin if Current_Node /= null then Traverse (Current_Node.Right); -- Uncomment the lines below to print the result. -- Put (Integer'Image (Current_Node.Value) & " "); Traverse (Current_Node.Left); end if; end; Node_Array : Vector := (3, 4, 7, 8, 9, 10, 11, 24, 25, 55, 56, 78, 90, 98, 120, 134, 152, 155, 165, 167, 168, 198, 250, 287, 298, 300, 310, 333, 338, 350, 399, 442, 475, 567); begin for I in Node_Array'Range loop Insert (Node_Array (I)); end loop; Traverse (Root_Node); end;
JeremyGrosser/clock3
Ada
9,510
ads
pragma Style_Checks (Off); -- Copyright (c) 2018 Microchip Technology Inc. -- -- SPDX-License-Identifier: Apache-2.0 -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- This spec has been automatically generated from ATSAMD21G18A.svd pragma Restrictions (No_Elaboration_Code); with HAL; with System; package SAMD21_SVD.GCLK is pragma Preelaborate; --------------- -- Registers -- --------------- -- Control type GCLK_CTRL_Register is record -- Software Reset SWRST : Boolean := False; -- unspecified Reserved_1_7 : HAL.UInt7 := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for GCLK_CTRL_Register use record SWRST at 0 range 0 .. 0; Reserved_1_7 at 0 range 1 .. 7; end record; -- Status type GCLK_STATUS_Register is record -- unspecified Reserved_0_6 : HAL.UInt7; -- Read-only. Synchronization Busy Status SYNCBUSY : Boolean; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for GCLK_STATUS_Register use record Reserved_0_6 at 0 range 0 .. 6; SYNCBUSY at 0 range 7 .. 7; end record; -- Generic Clock Selection ID type CLKCTRL_IDSelect is (-- DFLL48 DFLL48, -- FDPLL FDPLL, -- FDPLL32K FDPLL32K, -- WDT WDT, -- RTC RTC, -- EIC EIC, -- USB USB, -- EVSYS_0 EVSYS_0, -- EVSYS_1 EVSYS_1, -- EVSYS_2 EVSYS_2, -- EVSYS_3 EVSYS_3, -- EVSYS_4 EVSYS_4, -- EVSYS_5 EVSYS_5, -- EVSYS_6 EVSYS_6, -- EVSYS_7 EVSYS_7, -- EVSYS_8 EVSYS_8, -- EVSYS_9 EVSYS_9, -- EVSYS_10 EVSYS_10, -- EVSYS_11 EVSYS_11, -- SERCOMX_SLOW SERCOMX_SLOW, -- SERCOM0_CORE SERCOM0_CORE, -- SERCOM1_CORE SERCOM1_CORE, -- SERCOM2_CORE SERCOM2_CORE, -- SERCOM3_CORE SERCOM3_CORE, -- SERCOM4_CORE SERCOM4_CORE, -- SERCOM5_CORE SERCOM5_CORE, -- TCC0_TCC1 TCC0_TCC1, -- TCC2_TC3 TCC2_TC3, -- TC4_TC5 TC4_TC5, -- TC6_TC7 TC6_TC7, -- ADC ADC, -- AC_DIG AC_DIG, -- AC_ANA AC_ANA, -- DAC DAC, -- I2S_0 I2S_0, -- I2S_1 I2S_1) with Size => 6; for CLKCTRL_IDSelect use (DFLL48 => 0, FDPLL => 1, FDPLL32K => 2, WDT => 3, RTC => 4, EIC => 5, USB => 6, EVSYS_0 => 7, EVSYS_1 => 8, EVSYS_2 => 9, EVSYS_3 => 10, EVSYS_4 => 11, EVSYS_5 => 12, EVSYS_6 => 13, EVSYS_7 => 14, EVSYS_8 => 15, EVSYS_9 => 16, EVSYS_10 => 17, EVSYS_11 => 18, SERCOMX_SLOW => 19, SERCOM0_CORE => 20, SERCOM1_CORE => 21, SERCOM2_CORE => 22, SERCOM3_CORE => 23, SERCOM4_CORE => 24, SERCOM5_CORE => 25, TCC0_TCC1 => 26, TCC2_TC3 => 27, TC4_TC5 => 28, TC6_TC7 => 29, ADC => 30, AC_DIG => 31, AC_ANA => 32, DAC => 33, I2S_0 => 35, I2S_1 => 36); -- Generic Clock Generator type CLKCTRL_GENSelect is (-- Generic clock generator 0 GCLK0, -- Generic clock generator 1 GCLK1, -- Generic clock generator 2 GCLK2, -- Generic clock generator 3 GCLK3, -- Generic clock generator 4 GCLK4, -- Generic clock generator 5 GCLK5, -- Generic clock generator 6 GCLK6, -- Generic clock generator 7 GCLK7, -- Generic clock generator 8 GCLK8) with Size => 4; for CLKCTRL_GENSelect use (GCLK0 => 0, GCLK1 => 1, GCLK2 => 2, GCLK3 => 3, GCLK4 => 4, GCLK5 => 5, GCLK6 => 6, GCLK7 => 7, GCLK8 => 8); -- Generic Clock Control type GCLK_CLKCTRL_Register is record -- Generic Clock Selection ID ID : CLKCTRL_IDSelect := SAMD21_SVD.GCLK.DFLL48; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; -- Generic Clock Generator GEN : CLKCTRL_GENSelect := SAMD21_SVD.GCLK.GCLK0; -- unspecified Reserved_12_13 : HAL.UInt2 := 16#0#; -- Clock Enable CLKEN : Boolean := False; -- Write Lock WRTLOCK : Boolean := False; end record with Volatile_Full_Access, Object_Size => 16, Bit_Order => System.Low_Order_First; for GCLK_CLKCTRL_Register use record ID at 0 range 0 .. 5; Reserved_6_7 at 0 range 6 .. 7; GEN at 0 range 8 .. 11; Reserved_12_13 at 0 range 12 .. 13; CLKEN at 0 range 14 .. 14; WRTLOCK at 0 range 15 .. 15; end record; subtype GCLK_GENCTRL_ID_Field is HAL.UInt4; -- Source Select type GENCTRL_SRCSelect is (-- XOSC oscillator output XOSC, -- Generator input pad GCLKIN, -- Generic clock generator 1 output GCLKGEN1, -- OSCULP32K oscillator output OSCULP32K, -- OSC32K oscillator output OSC32K, -- XOSC32K oscillator output XOSC32K, -- OSC8M oscillator output OSC8M, -- DFLL48M output DFLL48M, -- DPLL96M output DPLL96M) with Size => 5; for GENCTRL_SRCSelect use (XOSC => 0, GCLKIN => 1, GCLKGEN1 => 2, OSCULP32K => 3, OSC32K => 4, XOSC32K => 5, OSC8M => 6, DFLL48M => 7, DPLL96M => 8); -- Generic Clock Generator Control type GCLK_GENCTRL_Register is record -- Generic Clock Generator Selection ID : GCLK_GENCTRL_ID_Field := 16#0#; -- unspecified Reserved_4_7 : HAL.UInt4 := 16#0#; -- Source Select SRC : GENCTRL_SRCSelect := SAMD21_SVD.GCLK.XOSC; -- unspecified Reserved_13_15 : HAL.UInt3 := 16#0#; -- Generic Clock Generator Enable GENEN : Boolean := False; -- Improve Duty Cycle IDC : Boolean := False; -- Output Off Value OOV : Boolean := False; -- Output Enable OE : Boolean := False; -- Divide Selection DIVSEL : Boolean := False; -- Run in Standby RUNSTDBY : Boolean := False; -- unspecified Reserved_22_31 : HAL.UInt10 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for GCLK_GENCTRL_Register use record ID at 0 range 0 .. 3; Reserved_4_7 at 0 range 4 .. 7; SRC at 0 range 8 .. 12; Reserved_13_15 at 0 range 13 .. 15; GENEN at 0 range 16 .. 16; IDC at 0 range 17 .. 17; OOV at 0 range 18 .. 18; OE at 0 range 19 .. 19; DIVSEL at 0 range 20 .. 20; RUNSTDBY at 0 range 21 .. 21; Reserved_22_31 at 0 range 22 .. 31; end record; subtype GCLK_GENDIV_ID_Field is HAL.UInt4; subtype GCLK_GENDIV_DIV_Field is HAL.UInt16; -- Generic Clock Generator Division type GCLK_GENDIV_Register is record -- Generic Clock Generator Selection ID : GCLK_GENDIV_ID_Field := 16#0#; -- unspecified Reserved_4_7 : HAL.UInt4 := 16#0#; -- Division Factor DIV : GCLK_GENDIV_DIV_Field := 16#0#; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for GCLK_GENDIV_Register use record ID at 0 range 0 .. 3; Reserved_4_7 at 0 range 4 .. 7; DIV at 0 range 8 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Generic Clock Generator type GCLK_Peripheral is record -- Control CTRL : aliased GCLK_CTRL_Register; -- Status STATUS : aliased GCLK_STATUS_Register; -- Generic Clock Control CLKCTRL : aliased GCLK_CLKCTRL_Register; -- Generic Clock Generator Control GENCTRL : aliased GCLK_GENCTRL_Register; -- Generic Clock Generator Division GENDIV : aliased GCLK_GENDIV_Register; end record with Volatile; for GCLK_Peripheral use record CTRL at 16#0# range 0 .. 7; STATUS at 16#1# range 0 .. 7; CLKCTRL at 16#2# range 0 .. 15; GENCTRL at 16#4# range 0 .. 31; GENDIV at 16#8# range 0 .. 31; end record; -- Generic Clock Generator GCLK_Periph : aliased GCLK_Peripheral with Import, Address => GCLK_Base; end SAMD21_SVD.GCLK;
zhmu/ananas
Ada
147
adb
-- { dg-do run } with access3; use access3; procedure access4 is Obj_IT : aliased T; Obj_T2 : T2; begin Obj_T2.Op (Obj_IT'Access); end;
sparre/aYAML
Ada
2,530
adb
package body YAML.Vector is overriding function Get (Item : in Instance; Name : in String) return Parent_Class is pragma Unreferenced (Item, Name); begin return raise Constraint_Error with "YAML.Object uses index-based look-up."; end Get; overriding function Get (Item : in Instance; Index : in Positive) return Parent_Class is pragma Unreferenced (Item, Index); begin return raise Program_Error with "Not implemented yet."; end Get; overriding function Get (Item : in Instance; Name : in String) return String is pragma Unreferenced (Item, Name); begin return raise Constraint_Error with "YAML.Object uses index-based look-up."; end Get; overriding function Get (Item : in Instance; Index : in Positive) return String is pragma Unreferenced (Item, Index); begin return raise Program_Error with "Not implemented yet."; end Get; overriding function Get (Item : in Instance; Name : in String; Default : in String) return String is pragma Unreferenced (Item, Name, Default); begin return raise Constraint_Error with "YAML.Object uses index-based look-up."; end Get; overriding function Get (Item : in Instance; Index : in Positive; Default : in String) return String is pragma Unreferenced (Item, Index, Default); begin return raise Program_Error with "Not implemented yet."; end Get; overriding function Has (Item : in Instance; Name : in String) return Boolean is pragma Unreferenced (Item, Name); begin return False; end Has; overriding function Has (Item : in Instance; Index : in Positive) return Boolean is pragma Unreferenced (Item, Index); begin return raise Program_Error with "Not implemented yet."; end Has; package body Parse is function Get (Item : in Instance; Name : in String) return Element_Type is begin return Value (Item.Get (Name => Name)); end Get; function Get (Item : in Instance; Name : in String; Default : in Element_Type) return Element_Type is begin return Value (Item.Get (Name => Name, Default => Image (Default))); end Get; end Parse; end YAML.Vector;
reznikmm/matreshka
Ada
3,686
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 League.Holders.Generic_Enumerations; package AMF.UML.Holders.Visibility_Kinds is new League.Holders.Generic_Enumerations (AMF.UML.UML_Visibility_Kind); pragma Preelaborate (AMF.UML.Holders.Visibility_Kinds);
AdaCore/libadalang
Ada
318
adb
with Ada.Text_IO; use Ada.Text_IO; with Pkg1, Pkg2; procedure Foo is I1 : constant Integer := Pkg1.Fact (5); pragma Test_Statement; I2 : constant Integer := Pkg2.Id (6); pragma Test_Statement; begin Put_Line ("Fact (5) =" & Integer'Image (I1)); Put_Line ("Id (6) =" & Integer'Image (I2)); end Foo;
AdaCore/libadalang
Ada
60
ads
package Lib is procedure Put_Line (S : String); end Lib;
reznikmm/matreshka
Ada
3,729
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Style_Vertical_Rel_Attributes is pragma Preelaborate; type ODF_Style_Vertical_Rel_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Style_Vertical_Rel_Attribute_Access is access all ODF_Style_Vertical_Rel_Attribute'Class with Storage_Size => 0; end ODF.DOM.Style_Vertical_Rel_Attributes;
AdaCore/libadalang
Ada
88
ads
with PK3_Bis; use PK3_Bis; package PK4_Bis is R : PK3_Bis.Record_Type; end PK4_Bis;
ohenley/ada-util
Ada
2,100
adb
----------------------------------------------------------------------- -- encodes -- Encodes strings -- Copyright (C) 2010, 2011 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Text_IO; with Ada.Command_Line; with Util.Encoders; procedure Encodes is use Util.Encoders; Encode : Boolean := True; Count : constant Natural := Ada.Command_Line.Argument_Count; begin if Count <= 1 then Ada.Text_IO.Put_Line ("Usage: encodes {encoder} [-d|-e] string..."); Ada.Text_IO.Put_Line ("Encoders: " & Util.Encoders.BASE_64 & ", " & Util.Encoders.BASE_64_URL & ", " & Util.Encoders.BASE_16 & ", " & Util.Encoders.HASH_SHA1); return; end if; declare Name : constant String := Ada.Command_Line.Argument (1); C : constant Encoder := Util.Encoders.Create (Name); begin for I in 2 .. Count loop declare S : constant String := Ada.Command_Line.Argument (I); begin if S = "-d" then Encode := False; elsif S = "-e" then Encode := True; elsif Encode then Ada.Text_IO.Put_Line ("Encodes " & Name & ": " & C.Encode (S)); else Ada.Text_IO.Put_Line ("Decodes " & Name & ": " & C.Decode (S)); end if; end; end loop; end; end Encodes;
reznikmm/matreshka
Ada
6,940
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Draw.Area_Rectangle_Elements is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Draw_Area_Rectangle_Element_Node is begin return Self : Draw_Area_Rectangle_Element_Node do Matreshka.ODF_Draw.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Draw_Prefix); end return; end Create; ---------------- -- Enter_Node -- ---------------- overriding procedure Enter_Node (Self : not null access Draw_Area_Rectangle_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_Draw_Area_Rectangle (ODF.DOM.Draw_Area_Rectangle_Elements.ODF_Draw_Area_Rectangle_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 Draw_Area_Rectangle_Element_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Area_Rectangle_Element; end Get_Local_Name; ---------------- -- Leave_Node -- ---------------- overriding procedure Leave_Node (Self : not null access Draw_Area_Rectangle_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_Draw_Area_Rectangle (ODF.DOM.Draw_Area_Rectangle_Elements.ODF_Draw_Area_Rectangle_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 Draw_Area_Rectangle_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_Draw_Area_Rectangle (Visitor, ODF.DOM.Draw_Area_Rectangle_Elements.ODF_Draw_Area_Rectangle_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.Draw_URI, Matreshka.ODF_String_Constants.Area_Rectangle_Element, Draw_Area_Rectangle_Element_Node'Tag); end Matreshka.ODF_Draw.Area_Rectangle_Elements;
reznikmm/matreshka
Ada
3,684
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.Smil_From_Attributes is pragma Preelaborate; type ODF_Smil_From_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Smil_From_Attribute_Access is access all ODF_Smil_From_Attribute'Class with Storage_Size => 0; end ODF.DOM.Smil_From_Attributes;
stcarrez/ada-wiki
Ada
36,958
adb
----------------------------------------------------------------------- -- wiki-render-html -- Wiki HTML renderer -- Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2018, 2019, 2020, 2021, 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.Strings; with Wiki.Attributes; with Wiki.Helpers; with Wiki.Nodes.Lists; package body Wiki.Render.Html is procedure Close_Paragraph (Engine : in out Html_Renderer); procedure Open_Paragraph (Engine : in out Html_Renderer); procedure Render_Tag (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Node : in Wiki.Nodes.Node_Type); -- Render a section header in the document. procedure Render_Header (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Node : in Wiki.Nodes.Node_Type); -- Render the table of content. procedure Render_TOC (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Level : in Natural); -- Render a link. procedure Render_Link (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Title : in Wiki.Strings.WString; Attr : in Wiki.Attributes.Attribute_List); procedure Render_Link_Ref (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Label : in Wiki.Strings.WString); -- Render an image. procedure Render_Image (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Title : in Wiki.Strings.WString; Attr : in Wiki.Attributes.Attribute_List); -- Render a quote. procedure Render_Quote (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Title : in Wiki.Strings.WString; Attr : in Wiki.Attributes.Attribute_List); -- Returns true if the HTML element being included is already contained in a paragraph. -- This include: a, em, strong, small, b, i, u, s, span, ins, del, sub, sup. function Has_Html_Paragraph (Engine : in Html_Renderer) return Boolean; procedure Newline (Engine : in out Html_Renderer); -- ------------------------------ -- Set the output stream. -- ------------------------------ procedure Set_Output_Stream (Engine : in out Html_Renderer; Stream : in Wiki.Streams.Html.Html_Output_Stream_Access) is begin Engine.Output := Stream; end Set_Output_Stream; -- ------------------------------ -- Set the link renderer. -- ------------------------------ procedure Set_Link_Renderer (Engine : in out Html_Renderer; Links : in Wiki.Render.Links.Link_Renderer_Access) is begin Engine.Links := Links; end Set_Link_Renderer; -- ------------------------------ -- Set the render TOC flag that controls the TOC rendering. -- ------------------------------ procedure Set_Render_TOC (Engine : in out Html_Renderer; State : in Boolean) is begin Engine.Enable_Render_TOC := State; end Set_Render_TOC; -- ------------------------------ -- Set the no-newline mode to avoid emitting newlines (disabled by default). -- ------------------------------ procedure Set_No_Newline (Engine : in out Html_Renderer; Enable : in Boolean) is begin Engine.No_Newline := Enable; end Set_No_Newline; -- ------------------------------ -- Get the current section number. -- ------------------------------ function Get_Section_Number (Engine : in Html_Renderer; Prefix : in Wiki.Strings.WString; Separator : in Wiki.Strings.WChar) return Wiki.Strings.WString is Result : Wiki.Strings.UString; Value : Natural; Empty : Boolean := True; begin if Engine.Section_Level = 0 then return ""; end if; Wiki.Strings.Append (Result, Prefix); for I in 1 .. Engine.Section_Level loop Value := Engine.Current_Section (I); if Value > 0 or else not Empty then declare N : constant Strings.WString := Positive'Wide_Wide_Image (Value); begin if not Empty then Wiki.Strings.Append (Result, Separator); end if; Empty := False; Wiki.Strings.Append (Result, N (N'First + 1 .. N'Last)); end; end if; end loop; return Wiki.Strings.To_WString (Result); end Get_Section_Number; -- ------------------------------ -- Returns true if the HTML element being included is already contained in a paragraph. -- This include: a, em, strong, small, b, i, u, s, span, ins, del, sub, sup. -- ------------------------------ function Has_Html_Paragraph (Engine : in Html_Renderer) return Boolean is begin return Engine.Html_Tag in Wiki.SPAN_TAG | Wiki.A_TAG | Wiki.EM_TAG | Wiki.STRONG_TAG | Wiki.SMALL_TAG | Wiki.B_TAG | Wiki.I_TAG | Wiki.U_TAG | Wiki.S_TAG | Wiki.SUB_TAG | Wiki.SUP_TAG | Wiki.INS_TAG | Wiki.DEL_TAG; end Has_Html_Paragraph; -- ------------------------------ -- Render the node instance from the document. -- ------------------------------ overriding procedure Render (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Node : in Wiki.Nodes.Node_Type) is begin case Node.Kind is when Wiki.Nodes.N_NONE => null; when Wiki.Nodes.N_HEADER => Engine.Render_Header (Doc => Doc, Node => Node); when Wiki.Nodes.N_LINE_BREAK => Engine.Output.Write ("<br>"); Engine.Output.Newline; when Wiki.Nodes.N_NEWLINE => Engine.Newline; when Wiki.Nodes.N_DEFINITION => if not Engine.In_Definition then Engine.Close_Paragraph; Engine.In_Definition := True; Engine.Output.Start_Element ("dl"); else Engine.Output.End_Element ("dd"); end if; Engine.Output.Start_Element ("dt"); Engine.Render (Doc, Node.Content); -- Engine.Output.Write_Wide_Text (Node.Header); Engine.Output.End_Element ("dt"); Engine.Output.Start_Element ("dd"); Engine.Has_Paragraph := True; Engine.Need_Paragraph := False; when Wiki.Nodes.N_END_DEFINITION => if Engine.In_Definition then Engine.In_Definition := False; Engine.Output.End_Element ("dd"); Engine.Output.End_Element ("dl"); Engine.Has_Paragraph := False; Engine.Need_Paragraph := True; end if; when Wiki.Nodes.N_HORIZONTAL_RULE => if Engine.Html_Level = 0 or else not Engine.Has_Html_Paragraph then Engine.Close_Paragraph; Engine.Add_Blockquote (0); end if; Engine.Output.Write ("<hr>"); when Wiki.Nodes.N_PARAGRAPH => -- Close the paragraph and start a new one except if the current HTML -- element is within a paragraph (ex: a, b, i, u, span, ...). if Engine.Html_Level = 0 or else not Engine.Has_Html_Paragraph then Engine.Close_Paragraph; Engine.Need_Paragraph := True; end if; when Wiki.Nodes.N_PREFORMAT => Engine.Render_Preformatted (Node.Preformatted, Strings.To_WString (Node.Language)); when Wiki.Nodes.N_INDENT => null; when Wiki.Nodes.N_LIST_END => Engine.Render_List_End ("ul"); when Wiki.Nodes.N_NUM_LIST_END => Engine.Render_List_End ("ol"); when Wiki.Nodes.N_LIST_ITEM_END => Engine.Render_List_End ("li"); when Wiki.Nodes.N_LIST_START => Engine.Render_List_Start ("ul", Node.Level); when Wiki.Nodes.N_NUM_LIST_START => Engine.Render_List_Start ("ol", Node.Level); when Wiki.Nodes.N_LIST_ITEM => Engine.Render_List_Item; when Wiki.Nodes.N_TEXT => Engine.Add_Text (Text => Node.Text, Format => Node.Format); when Wiki.Nodes.N_QUOTE => Engine.Render_Quote (Doc, Node.Title, Node.Link_Attr); when Wiki.Nodes.N_LINK => Engine.Render_Link (Doc, Node.Title, Node.Link_Attr); when Wiki.Nodes.N_LINK_REF => Engine.Render_Link_Ref (Doc, Node.Title); when Wiki.Nodes.N_LINK_REF_END => Engine.Output.End_Element ("a"); when Wiki.Nodes.N_IMAGE => Engine.Render_Image (Doc, Node.Title, Node.Link_Attr); when Wiki.Nodes.N_BLOCKQUOTE => Engine.Add_Blockquote (Node.Level); when Wiki.Nodes.N_TAG_START => Engine.Render_Tag (Doc, Node); when Wiki.Nodes.N_TOC => Engine.Render_TOC (Doc, Node.Level); when Wiki.Nodes.N_TOC_ENTRY => null; when Wiki.Nodes.N_TOC_DISPLAY => Engine.Render_TOC (Doc, 3); when Wiki.Nodes.N_TABLE => Engine.Render_Table (Doc, Node, "table"); when Wiki.Nodes.N_ROW => Engine.Render_Table (Doc, Node, "tr"); when Wiki.Nodes.N_COLUMN => Engine.Render_Table (Doc, Node, "td"); end case; end Render; procedure Render_Tag (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Node : in Wiki.Nodes.Node_Type) is Name : constant Wiki.String_Access := Wiki.Get_Tag_Name (Node.Tag_Start); Iter : Wiki.Attributes.Cursor := Wiki.Attributes.First (Node.Attributes); Previous_Tag : constant Wiki.Html_Tag := Engine.Html_Tag; Prev_Para : Boolean := Engine.Has_Paragraph; begin if Node.Tag_Start = Wiki.P_TAG then Engine.Has_Paragraph := True; Engine.Need_Paragraph := False; elsif Node.Tag_Start in Wiki.UL_TAG | Wiki.OL_TAG | Wiki.DL_TAG | Wiki.DT_TAG | Wiki.DD_TAG | Wiki.LI_TAG | Wiki.H1_TAG | Wiki.H2_TAG | Wiki.H3_TAG | Wiki.H4_TAG | Wiki.H5_TAG | Wiki.H6_TAG | Wiki.DIV_TAG | Wiki.TABLE_TAG then Engine.Close_Paragraph; Engine.Need_Paragraph := False; Engine.Has_Paragraph := False; Engine.Open_Paragraph; elsif Node.Tag_Start in Wiki.B_TAG | Wiki.I_TAG | Wiki.SPAN_TAG | Wiki.INS_TAG | Wiki.DEL_TAG | Wiki.A_TAG then Engine.Open_Paragraph; Prev_Para := Engine.Has_Paragraph; elsif Node.Tag_Start = Wiki.BR_TAG then Engine.Output.Write ("<br>"); return; elsif Node.Tag_Start = Wiki.HR_TAG then Engine.Output.Write ("<hr>"); return; else Engine.Has_Paragraph := False; Engine.Need_Paragraph := False; Engine.Open_Paragraph; end if; Engine.Output.Start_Element (Name.all); while Wiki.Attributes.Has_Element (Iter) loop Engine.Output.Write_Wide_Attribute (Name => Wiki.Attributes.Get_Name (Iter), Content => Wiki.Attributes.Get_Wide_Value (Iter)); Wiki.Attributes.Next (Iter); end loop; Engine.Html_Tag := Node.Tag_Start; Engine.Html_Level := Engine.Html_Level + 1; Engine.Render (Doc, Node.Children); Engine.Html_Tag := Previous_Tag; Engine.Html_Level := Engine.Html_Level - 1; if Node.Tag_Start = Wiki.P_TAG then Engine.Has_Paragraph := False; Engine.Need_Paragraph := True; elsif Node.Tag_Start in Wiki.UL_TAG | Wiki.OL_TAG | Wiki.DL_TAG | Wiki.DT_TAG | Wiki.DD_TAG | Wiki.LI_TAG | Wiki.H1_TAG | Wiki.H2_TAG | Wiki.H3_TAG | Wiki.H4_TAG | Wiki.H5_TAG | Wiki.H6_TAG | Wiki.DIV_TAG | Wiki.TABLE_TAG then Engine.Close_Paragraph; Engine.Has_Paragraph := False; Engine.Need_Paragraph := True; elsif not Engine.Has_Html_Paragraph then -- Leaving the HTML text-element, restore the previous paragraph state. Engine.Has_Paragraph := Prev_Para; end if; Engine.Output.End_Element (Name.all); end Render_Tag; -- ------------------------------ -- Render a section header in the document. -- ------------------------------ procedure Render_Header (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Node : in Wiki.Nodes.Node_Type) is Level : constant Natural := Node.Level; Tag : String_Access; begin if Engine.Enable_Render_TOC and then not Engine.TOC_Rendered and then not Doc.Is_Using_TOC and then Doc.Is_Visible_TOC then Engine.Render_TOC (Doc, 3); end if; Engine.Close_Paragraph; Engine.Current_Section (Level) := Engine.Current_Section (Level) + 1; for I in Level + 1 .. Engine.Current_Section'Last loop Engine.Current_Section (I) := 0; end loop; Engine.Section_Level := Level; case Level is when 1 => Tag := Get_Tag_Name (H1_TAG); when 2 => Tag := Get_Tag_Name (H2_TAG); when 3 => Tag := Get_Tag_Name (H3_TAG); when 4 => Tag := Get_Tag_Name (H4_TAG); when 5 => Tag := Get_Tag_Name (H5_TAG); when others => Tag := Get_Tag_Name (H6_TAG); end case; Engine.Output.Start_Element (Tag.all); if Engine.Enable_Render_TOC then Engine.Output.Write_Wide_Attribute ("id", Engine.Get_Section_Number ("section_", '_')); end if; Engine.Need_Paragraph := False; Engine.Render (Doc, Node.Content); Engine.Output.End_Element (Tag.all); Engine.Newline; end Render_Header; -- ------------------------------ -- Render the table of content. -- ------------------------------ procedure Render_TOC (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Level : in Natural) is procedure Render_Entry (Node : in Wiki.Nodes.Node_Type); procedure Set_Current_Level (New_Level : in Natural); use Wiki.Nodes; procedure Set_Current_Level (New_Level : in Natural) is begin if New_Level = Engine.Section_Level and then New_Level /= 0 then Engine.Output.End_Element ("li"); Engine.Output.Start_Element ("li"); Engine.Output.Write_Attribute ("class", "wiki-toc-entry"); end if; -- Close the ul/li lists up to the expected level. while New_Level < Engine.Section_Level loop Engine.Output.End_Element ("li"); Engine.Output.End_Element ("ul"); Engine.Section_Level := Engine.Section_Level - 1; end loop; while New_Level > Engine.Section_Level loop Engine.Output.Start_Element ("ul"); Engine.Output.Write_Attribute ("class", "wiki-toc-entry"); Engine.Output.Start_Element ("li"); Engine.Output.Write_Attribute ("class", "wiki-toc-entry"); Engine.Section_Level := Engine.Section_Level + 1; Engine.Current_Section (Engine.Section_Level) := 0; end loop; end Set_Current_Level; procedure Render_Entry (Node : in Wiki.Nodes.Node_Type) is begin if Node.Kind /= Wiki.Nodes.N_TOC_ENTRY or else Node.Toc_Level > Level then return; end if; Set_Current_Level (Node.Toc_Level); Engine.Current_Section (Engine.Section_Level) := Engine.Current_Section (Engine.Section_Level) + 1; Engine.Output.Start_Element ("a"); Engine.Output.Write_Attribute ("class", "wiki-toc-ref"); Engine.Output.Write_Wide_Attribute ("href", Engine.Get_Section_Number ("#section_", '_')); Engine.Output.Start_Element ("span"); Engine.Output.Write_Attribute ("class", "wiki-toc-level"); Engine.Output.Write_Wide_Text (Engine.Get_Section_Number ("", '.')); Engine.Output.End_Element ("span"); Engine.Output.Start_Element ("span"); Engine.Output.Write_Attribute ("class", "wiki-toc-title"); Engine.Output.Write_Wide_Text (Node.Header); Engine.Output.End_Element ("span"); Engine.Output.End_Element ("a"); end Render_Entry; Toc : constant Wiki.Nodes.Lists.Node_List_Ref := Doc.Get_TOC; begin if Wiki.Nodes.Lists.Length (Toc) <= 3 then Engine.Enable_Render_TOC := False; elsif not Engine.TOC_Rendered then Engine.Section_Level := 0; Engine.Current_Section := (others => 0); Engine.Output.Start_Element ("div"); Engine.Output.Write_Attribute ("class", "wiki-toc"); Wiki.Nodes.Lists.Iterate (Toc, Render_Entry'Access); Set_Current_Level (0); Engine.Output.End_Element ("div"); Engine.TOC_Rendered := True; Engine.Current_Section := (others => 0); end if; end Render_TOC; -- ------------------------------ -- Add a blockquote (<blockquote>). The level indicates the blockquote nested level. -- The blockquote must be closed at the next header. -- ------------------------------ procedure Add_Blockquote (Engine : in out Html_Renderer; Level : in Natural) is begin if Engine.Quote_Level /= Level then Engine.Close_Paragraph; Engine.Need_Paragraph := True; end if; while Engine.Quote_Level < Level loop Engine.Output.Start_Element ("blockquote"); Engine.Quote_Level := Engine.Quote_Level + 1; end loop; while Engine.Quote_Level > Level loop Engine.Output.End_Element ("blockquote"); Engine.Quote_Level := Engine.Quote_Level - 1; end loop; end Add_Blockquote; -- ------------------------------ -- Render a list item end (</ul> or </ol>). -- Close the previous paragraph and list item if any. -- ------------------------------ procedure Render_List_End (Engine : in out Html_Renderer; Tag : in String) is begin if Engine.Has_Paragraph then Engine.Output.End_Element ("p"); Engine.Has_Paragraph := False; end if; Engine.Has_Item := False; Engine.Need_Paragraph := False; Engine.Output.End_Element (Tag); Engine.Has_Item := False; end Render_List_End; -- ------------------------------ -- Render a list item (<li>). Close the previous paragraph and list item if any. -- The list item will be closed at the next list item, next paragraph or next header. -- ------------------------------ procedure Render_List_Start (Engine : in out Html_Renderer; Tag : in String; Level : in Natural) is begin if Engine.Has_Paragraph then Engine.Output.End_Element ("p"); Engine.Has_Paragraph := False; end if; Engine.Need_Paragraph := False; Engine.Output.Start_Element (Tag); if Tag = "ol" and then Level /= 1 then Engine.Output.Write_Attribute ("start", Util.Strings.Image (Level)); end if; Engine.Has_Item := False; end Render_List_Start; -- ------------------------------ -- Render a list item (<li>). Close the previous paragraph and list item if any. -- The list item will be closed at the next list item, next paragraph or next header. -- ------------------------------ procedure Render_List_Item (Engine : in out Html_Renderer) is begin if Engine.Has_Paragraph then Engine.Output.End_Element ("p"); Engine.Has_Paragraph := False; end if; Engine.Output.Start_Element ("li"); Engine.Has_Item := False; end Render_List_Item; procedure Newline (Engine : in out Html_Renderer) is begin -- if not Engine.No_Newline then -- Engine.Output.Write_Wide_Text (Wiki.Helpers.LF & ""); -- end if; null; end Newline; procedure Close_Paragraph (Engine : in out Html_Renderer) is begin -- Don't close a paragraph if we are within a HTML text-level element. if Engine.Has_Html_Paragraph then return; end if; if Engine.Has_Paragraph then Engine.Output.End_Element ("p"); if not Engine.No_Newline then Engine.Output.Newline; end if; end if; if Engine.Has_Item then Engine.Output.End_Element ("li"); Engine.Newline; end if; while Engine.Current_Level > 0 loop if Engine.List_Styles (Engine.Current_Level) then Engine.Output.End_Element ("ol"); else Engine.Output.End_Element ("ul"); end if; Engine.Current_Level := Engine.Current_Level - 1; Engine.Newline; end loop; Engine.Has_Paragraph := False; Engine.Has_Item := False; end Close_Paragraph; procedure Open_Paragraph (Engine : in out Html_Renderer) is begin if Engine.Need_Paragraph then Engine.Output.Start_Element ("p"); Engine.Has_Paragraph := True; Engine.Need_Paragraph := False; end if; if Engine.Current_Level > 0 and then not Engine.Has_Item then Engine.Output.Start_Element ("li"); Engine.Has_Item := True; end if; end Open_Paragraph; -- ------------------------------ -- Render a link. -- ------------------------------ procedure Render_Link (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Title : in Wiki.Strings.WString; Attr : in Wiki.Attributes.Attribute_List) is procedure Render_Attribute (Name : in String; Value : in Wiki.Strings.WString); procedure Render_Attribute (Name : in String; Value : in Wiki.Strings.WString) is begin if Name = "href" then declare URI : Wiki.Strings.UString; Exists : Boolean; begin Engine.Links.Make_Page_Link (Value, URI, Exists); Engine.Output.Write_Wide_Attribute ("href", URI); end; elsif Name = "label" then return; elsif Value'Length = 0 then return; elsif Name in "lang" | "title" | "rel" | "target" | "style" | "class" then Engine.Output.Write_Wide_Attribute (Name, Value); end if; end Render_Attribute; Label : constant Wiki.Strings.WString := Wiki.Attributes.Get_Attribute (Attr, "label"); begin Engine.Open_Paragraph; if Label'Length = 0 then Engine.Output.Start_Element ("a"); Wiki.Attributes.Iterate (Attr, Render_Attribute'Access); Engine.Output.Write_Wide_Text (Title); Engine.Output.End_Element ("a"); else declare Link : constant Wiki.Strings.WString := Doc.Get_Link (Label); begin if Link'Length = 0 then Engine.Output.Write_Wide_Text ("["); Engine.Output.Write_Wide_Text (Label); Engine.Output.Write_Wide_Text ("]"); else Engine.Output.Start_Element ("a"); declare URI : Wiki.Strings.UString; Exists : Boolean; Title : constant Wiki.Strings.WString := Doc.Get_Link_Title (Label); begin Engine.Links.Make_Page_Link (Link, URI, Exists); Engine.Output.Write_Wide_Attribute ("href", URI); if Title'Length > 0 then Engine.Output.Write_Wide_Attribute ("title", Title); end if; end; Engine.Output.Write_Wide_Text (Title); Engine.Output.End_Element ("a"); end if; end; end if; end Render_Link; -- ------------------------------ -- Render a link. -- ------------------------------ procedure Render_Link_Ref (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Label : in Wiki.Strings.WString) is Link : constant Wiki.Strings.WString := Doc.Get_Link (Label); begin Engine.Open_Paragraph; if Link'Length = 0 then Engine.Output.Write_Wide_Text ("["); Engine.Output.Write_Wide_Text (Label); Engine.Output.Write_Wide_Text ("]"); else Engine.Output.Start_Element ("a"); declare URI : Wiki.Strings.UString; Exists : Boolean; Title : constant Wiki.Strings.WString := Doc.Get_Link_Title (Label); begin Engine.Links.Make_Page_Link (Link, URI, Exists); Engine.Output.Write_Wide_Attribute ("href", URI); if Title'Length > 0 then Engine.Output.Write_Wide_Attribute ("title", Title); end if; end; Engine.Output.Write_Wide_Text (Label); Engine.Output.End_Element ("a"); end if; end Render_Link_Ref; -- ------------------------------ -- Render an image. -- ------------------------------ procedure Render_Image (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Title : in Wiki.Strings.WString; Attr : in Wiki.Attributes.Attribute_List) is pragma Unreferenced (Doc); Src : constant Strings.WString := Attributes.Get_Attribute (Attr, "src"); Alt : constant Strings.WString := Attributes.Get_Attribute (Attr, "alt"); Desc : constant Strings.WString := Attributes.Get_Attribute (Attr, "longdesc"); Title_Attr : constant Strings.WString := Attributes.Get_Attribute (Attr, "title"); Class : constant Strings.WString := Attributes.Get_Attribute (Attr, "class"); Style : constant Strings.WString := Attributes.Get_Attribute (Attr, "style"); Size : constant Strings.WString := Attributes.Get_Attribute (Attr, "size"); Frame : constant Strings.WString := Attributes.Get_Attribute (Attr, "frame"); Align : constant Strings.WString := Attributes.Get_Attribute (Attr, "align"); Valign : constant Strings.WString := Attributes.Get_Attribute (Attr, "valign"); URI : Wiki.Strings.UString; Frame_Attr : Wiki.Strings.UString; Width : Natural := 0; Height : Natural := 0; begin if Frame'Length > 0 then Strings.Append (Frame_Attr, "wiki-img-"); Strings.Append (Frame_Attr, Frame); end if; if Align'Length > 0 then if Strings.Length (Frame_Attr) > 0 then Strings.Append (Frame_Attr, " "); end if; Strings.Append (Frame_Attr, "wiki-img-"); Strings.Append (Frame_Attr, Align); end if; if Valign'Length > 0 then if Strings.Length (Frame_Attr) > 0 then Strings.Append (Frame_Attr, " "); end if; Strings.Append (Frame_Attr, "wiki-img-"); Strings.Append (Frame_Attr, Valign); end if; Engine.Open_Paragraph; if Strings.Length (Frame_Attr) > 0 then Engine.Output.Start_Element ("div"); Engine.Output.Write_Wide_Attribute ("class", Frame_Attr); Engine.Output.Start_Element ("div"); Engine.Output.Write_Wide_Attribute ("class", "wiki-img-inner"); end if; if Size'Length > 0 then Wiki.Helpers.Get_Sizes (Size, Width, Height); end if; Engine.Output.Start_Element ("img"); Engine.Links.Make_Image_Link (Src, URI, Width, Height); Engine.Output.Write_Wide_Attribute ("src", URI); if Width > 0 then Engine.Output.Write_Attribute ("width", Util.Strings.Image (Width)); end if; if Height > 0 then Engine.Output.Write_Attribute ("height", Util.Strings.Image (Height)); end if; if Desc'Length > 0 then Engine.Output.Write_Wide_Attribute ("longdesc", Desc); end if; if Class'Length > 0 then Engine.Output.Write_Wide_Attribute ("class", Class); end if; if Style'Length > 0 then Engine.Output.Write_Wide_Attribute ("style", Style); end if; if Title'Length > 0 and then Alt'Length = 0 then Engine.Output.Write_Wide_Attribute ("alt", Title); elsif Alt'Length > 0 then Engine.Output.Write_Wide_Attribute ("alt", Alt); end if; if Title_Attr'Length > 0 then Engine.Output.Write_Wide_Attribute ("title", Title_Attr); end if; Engine.Output.End_Element ("img"); if Strings.Length (Frame_Attr) > 0 then Engine.Output.End_Element ("div"); if Title'Length > 0 and then Frame /= "border" and then Frame /= "frameless" and then Frame /= "" then Engine.Output.Start_Element ("div"); Engine.Output.Write_Wide_Attribute ("class", "wiki-img-caption"); Engine.Output.Write_Wide_Text (Title); Engine.Output.End_Element ("div"); end if; Engine.Output.End_Element ("div"); end if; end Render_Image; -- ------------------------------ -- Render a quote. -- ------------------------------ procedure Render_Quote (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Title : in Wiki.Strings.WString; Attr : in Wiki.Attributes.Attribute_List) is pragma Unreferenced (Doc); procedure Render_Attribute (Name : in String; Value : in Wiki.Strings.WString); procedure Render_Attribute (Name : in String; Value : in Wiki.Strings.WString) is begin if Value'Length = 0 then return; elsif Name in "cite" | "title" | "lang" | "style" | "class" then Engine.Output.Write_Wide_Attribute (Name, Value); end if; end Render_Attribute; begin Engine.Open_Paragraph; Engine.Output.Start_Element ("q"); Wiki.Attributes.Iterate (Attr, Render_Attribute'Access); Engine.Output.Write_Wide_Text (Title); Engine.Output.End_Element ("q"); end Render_Quote; HTML_STRONG : aliased constant String := "strong"; HTML_BOLD : aliased constant String := "b"; HTML_ITALIC : aliased constant String := "i"; HTML_EM : aliased constant String := "em"; HTML_CODE : aliased constant String := "code"; HTML_SUPERSCRIPT : aliased constant String := "sup"; HTML_SUBSCRIPT : aliased constant String := "sub"; HTML_STRIKEOUT : aliased constant String := "del"; HTML_INS : aliased constant String := "ins"; HTML_PREFORMAT : aliased constant String := "pre"; HTML_UNDERLINE : aliased constant String := "u"; HTML_CITE : aliased constant String := "cite"; type String_Array_Access is array (Format_Type) of Wiki.String_Access; HTML_ELEMENT : constant String_Array_Access := (STRONG => HTML_STRONG'Access, BOLD => HTML_BOLD'Access, ITALIC => HTML_ITALIC'Access, EMPHASIS => HTML_EM'Access, CODE => HTML_CODE'Access, SUPERSCRIPT => HTML_SUPERSCRIPT'Access, SUBSCRIPT => HTML_SUBSCRIPT'Access, STRIKEOUT => HTML_STRIKEOUT'Access, PREFORMAT => HTML_PREFORMAT'Access, INS => HTML_INS'Access, CITE => HTML_CITE'Access, UNDERLINE => HTML_UNDERLINE'Access); -- ------------------------------ -- Add a text block with the given format. -- ------------------------------ procedure Add_Text (Engine : in out Html_Renderer; Text : in Wiki.Strings.WString; Format : in Wiki.Format_Map) is begin if not Engine.Has_Html_Paragraph or else Engine.Html_Tag = Wiki.P_TAG then Engine.Open_Paragraph; elsif Engine.Need_Paragraph then Engine.Output.Write (' '); Engine.Need_Paragraph := False; end if; for I in Format'Range loop if Format (I) then Engine.Output.Start_Element (HTML_ELEMENT (I).all); end if; end loop; Engine.Output.Write_Wide_Text (Text); for I in reverse Format'Range loop if Format (I) then Engine.Output.End_Element (HTML_ELEMENT (I).all); end if; end loop; end Add_Text; -- ------------------------------ -- Render a text block that is pre-formatted. -- ------------------------------ procedure Render_Preformatted (Engine : in out Html_Renderer; Text : in Wiki.Strings.WString; Format : in Wiki.Strings.WString) is begin Engine.Close_Paragraph; if Format = "html" then Engine.Output.Write (Text); else Engine.Output.Start_Element ("pre"); if Format'Length > 0 then Engine.Output.Start_Element ("code"); Engine.Output.Write_Attribute ("class", "lang-" & Strings.To_String (Format)); Engine.Output.Write_Wide_Text (Text); Engine.Output.End_Element ("code"); else Engine.Output.Start_Element ("code"); Engine.Output.Write_Wide_Text (Text); Engine.Output.End_Element ("code"); end if; Engine.Output.End_Element ("pre"); end if; end Render_Preformatted; -- ------------------------------ -- Render a table component such as N_TABLE, N_ROW or N_COLUMN. -- ------------------------------ procedure Render_Table (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document; Node : in Wiki.Nodes.Node_Type; Tag : in String) is Iter : Wiki.Attributes.Cursor := Wiki.Attributes.First (Node.Attributes); begin Engine.Close_Paragraph; Engine.Need_Paragraph := False; Engine.Has_Paragraph := False; Engine.Open_Paragraph; Engine.Output.Start_Element (Tag); while Wiki.Attributes.Has_Element (Iter) loop Engine.Output.Write_Wide_Attribute (Name => Wiki.Attributes.Get_Name (Iter), Content => Wiki.Attributes.Get_Wide_Value (Iter)); Wiki.Attributes.Next (Iter); end loop; Engine.Render (Doc, Node.Children); Engine.Close_Paragraph; Engine.Has_Paragraph := False; Engine.Need_Paragraph := True; Engine.Output.End_Element (Tag); end Render_Table; -- ------------------------------ -- Finish the document after complete wiki text has been parsed. -- ------------------------------ overriding procedure Finish (Engine : in out Html_Renderer; Doc : in Wiki.Documents.Document) is begin if Engine.Enable_Render_TOC and then Doc.Is_Visible_TOC then Engine.Render_TOC (Doc, 4); end if; Engine.Close_Paragraph; Engine.Add_Blockquote (0); end Finish; end Wiki.Render.Html;
tum-ei-rcs/StratoX
Ada
2,136
adb
with Ada.Text_IO; use Ada.Text_IO; with Interfaces; use Interfaces; package body units with SPARK_Mode is function wrap_angle2 (angle : Angle_Type; min : Angle_Type; max : Angle_Type) return Angle_Type is span : constant Angle_Type := max - min; d_flt : Float; d_int : Float; frac : Float; less : Angle_Type; wr : Angle_Type; off : Angle_Type; f64 : Interfaces.IEEE_Float_64; begin if span = Angle_Type (0.0) then -- this might happen due to float cancellation, despite precondition wr := min; else pragma Assert (span > Angle_Type (0.0)); if angle >= min and angle <= max then wr := angle; elsif angle < min then off := (min - angle); d_flt := Float (off / span); -- overflow check might fail d_int := Float'Floor (d_flt); frac := Float (d_flt - d_int); f64 := Interfaces.IEEE_Float_64 (frac) * Interfaces.IEEE_Float_64 (span); --pragma Assert (f64 >= 0.0); if f64 < Interfaces.IEEE_Float_64 (Angle_Type'Last) and f64 >= Interfaces.IEEE_Float_64 (Angle_Type'First) then less := Angle_Type (f64); -- overflow check might fail wr := max - less; else wr := min; end if; else -- angle > max off := angle - max; d_flt := Float (off / span); -- overflow check might fail d_int := Float'Floor (d_flt); frac := Float (d_flt - d_int); pragma Assert (frac >= 0.0); f64 := Interfaces.IEEE_Float_64 (frac) * Interfaces.IEEE_Float_64 (span); --pragma Assert (f64 >= 0.0); -- this fails. why? both span and frac are positive if f64 > Interfaces.IEEE_Float_64 (Angle_Type'First) and f64 < Interfaces.IEEE_Float_64 (Angle_Type'Last) then less := Angle_Type (f64); wr := min + less; else wr := max; end if; end if; end if; return wr; end wrap_angle2; end units;
dan76/Amass
Ada
1,262
ads
-- Copyright © by Jeff Foley 2017-2023. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. -- SPDX-License-Identifier: Apache-2.0 local url = require("url") local json = require("json") name = "Arquivo" type = "archive" function start() set_rate_limit(5) end function vertical(ctx, domain) local resp, err = request(ctx, {['url']=build_url(domain)}) if (err ~= nil and err ~= "") then log(ctx, "vertical request to service failed: " .. err) return elseif (resp.status_code < 200 or resp.status_code >= 400) then log(ctx, "vertical request to service returned with status code: " .. resp.status) return end local d = json.decode(resp.body) if (d == nil) then log(ctx, "failed to decode the JSON response") return elseif (d.response_items == nil or #(d.response_items) == 0) then return end for _, r in pairs(d.response_items) do send_names(ctx, r.originalURL) end end function build_url(domain) local params = { ['q']=domain, ['offset']="0", ['maxItems']="500", } return "https://arquivo.pt/textsearch?" .. url.build_query_string(params) end
reznikmm/matreshka
Ada
54,632
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010-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$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with Matreshka.Internals.Strings; package AMF.Internals.Tables.OCL_String_Data_00 is -- "referredAssociationClass" MS_0000 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 31, Unused => 24, Length => 24, Value => (16#0072#, 16#0065#, 16#0066#, 16#0065#, 16#0072#, 16#0072#, 16#0065#, 16#0064#, 16#0041#, 16#0073#, 16#0073#, 16#006F#, 16#0063#, 16#0069#, 16#0061#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, 16#0043#, 16#006C#, 16#0061#, 16#0073#, 16#0073#, others => 16#0000#), others => <>); -- "BooleanLiteralExp" MS_0001 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 17, Length => 17, Value => (16#0042#, 16#006F#, 16#006F#, 16#006C#, 16#0065#, 16#0061#, 16#006E#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "OCL" MS_0002 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 3, Length => 3, Value => (16#004F#, 16#0043#, 16#004C#, others => 16#0000#), others => <>); -- "calledOperation" MS_0003 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 15, Length => 15, Value => (16#0063#, 16#0061#, 16#006C#, 16#006C#, 16#0065#, 16#0064#, 16#004F#, 16#0070#, 16#0065#, 16#0072#, 16#0061#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, others => 16#0000#), others => <>); -- "resultOwner" MS_0004 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 11, Length => 11, Value => (16#0072#, 16#0065#, 16#0073#, 16#0075#, 16#006C#, 16#0074#, 16#004F#, 16#0077#, 16#006E#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "parentCall" MS_0005 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 10, Length => 10, Value => (16#0070#, 16#0061#, 16#0072#, 16#0065#, 16#006E#, 16#0074#, 16#0043#, 16#0061#, 16#006C#, 16#006C#, others => 16#0000#), others => <>); -- "LiteralExp" MS_0006 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 10, Length => 10, Value => (16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "TypeExp" MS_0007 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 7, Length => 7, Value => (16#0054#, 16#0079#, 16#0070#, 16#0065#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "literalExp" MS_0008 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 10, Length => 10, Value => (16#006C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "exp1" MS_0009 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0065#, 16#0078#, 16#0070#, 16#0031#, others => 16#0000#), others => <>); -- "InvalidType" MS_000A : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 11, Length => 11, Value => (16#0049#, 16#006E#, 16#0076#, 16#0061#, 16#006C#, 16#0069#, 16#0064#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "exp9" MS_000B : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0065#, 16#0078#, 16#0070#, 16#0039#, others => 16#0000#), others => <>); -- "VariableExp" MS_000C : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 11, Length => 11, Value => (16#0056#, 16#0061#, 16#0072#, 16#0069#, 16#0061#, 16#0062#, 16#006C#, 16#0065#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "referringExp" MS_000D : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 12, Length => 12, Value => (16#0072#, 16#0065#, 16#0066#, 16#0065#, 16#0072#, 16#0072#, 16#0069#, 16#006E#, 16#0067#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "PropertyCallExp" MS_000E : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 15, Length => 15, Value => (16#0050#, 16#0072#, 16#006F#, 16#0070#, 16#0065#, 16#0072#, 16#0074#, 16#0079#, 16#0043#, 16#0061#, 16#006C#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "representedParameter" MS_000F : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 20, Length => 20, Value => (16#0072#, 16#0065#, 16#0070#, 16#0072#, 16#0065#, 16#0073#, 16#0065#, 16#006E#, 16#0074#, 16#0065#, 16#0064#, 16#0050#, 16#0061#, 16#0072#, 16#0061#, 16#006D#, 16#0065#, 16#0074#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "realSymbol" MS_0010 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 10, Length => 10, Value => (16#0072#, 16#0065#, 16#0061#, 16#006C#, 16#0053#, 16#0079#, 16#006D#, 16#0062#, 16#006F#, 16#006C#, others => 16#0000#), others => <>); -- "Variable" MS_0011 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 8, Length => 8, Value => (16#0056#, 16#0061#, 16#0072#, 16#0069#, 16#0061#, 16#0062#, 16#006C#, 16#0065#, others => 16#0000#), others => <>); -- "referredSignal" MS_0012 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0072#, 16#0065#, 16#0066#, 16#0065#, 16#0072#, 16#0072#, 16#0065#, 16#0064#, 16#0053#, 16#0069#, 16#0067#, 16#006E#, 16#0061#, 16#006C#, others => 16#0000#), others => <>); -- "argument" MS_0013 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 8, Length => 8, Value => (16#0061#, 16#0072#, 16#0067#, 16#0075#, 16#006D#, 16#0065#, 16#006E#, 16#0074#, others => 16#0000#), others => <>); -- "thenOwner" MS_0014 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 9, Length => 9, Value => (16#0074#, 16#0068#, 16#0065#, 16#006E#, 16#004F#, 16#0077#, 16#006E#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "owningClassifier" MS_0015 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 16, Length => 16, Value => (16#006F#, 16#0077#, 16#006E#, 16#0069#, 16#006E#, 16#0067#, 16#0043#, 16#006C#, 16#0061#, 16#0073#, 16#0073#, 16#0069#, 16#0066#, 16#0069#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "item" MS_0016 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0069#, 16#0074#, 16#0065#, 16#006D#, others => 16#0000#), others => <>); -- "referredProperty" MS_0017 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 16, Length => 16, Value => (16#0072#, 16#0065#, 16#0066#, 16#0065#, 16#0072#, 16#0072#, 16#0065#, 16#0064#, 16#0050#, 16#0072#, 16#006F#, 16#0070#, 16#0065#, 16#0072#, 16#0074#, 16#0079#, others => 16#0000#), others => <>); -- "exp11" MS_0018 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 5, Length => 5, Value => (16#0065#, 16#0078#, 16#0070#, 16#0031#, 16#0031#, others => 16#0000#), others => <>); -- "TupleLiteralPart" MS_0019 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 16, Length => 16, Value => (16#0054#, 16#0075#, 16#0070#, 16#006C#, 16#0065#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0050#, 16#0061#, 16#0072#, 16#0074#, others => 16#0000#), others => <>); -- "CollectionRange" MS_001A : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 15, Length => 15, Value => (16#0043#, 16#006F#, 16#006C#, 16#006C#, 16#0065#, 16#0063#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, 16#0052#, 16#0061#, 16#006E#, 16#0067#, 16#0065#, others => 16#0000#), others => <>); -- "integerSymbol" MS_001B : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 13, Length => 13, Value => (16#0069#, 16#006E#, 16#0074#, 16#0065#, 16#0067#, 16#0065#, 16#0072#, 16#0053#, 16#0079#, 16#006D#, 16#0062#, 16#006F#, 16#006C#, others => 16#0000#), others => <>); -- "referredOperation" MS_001C : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 17, Length => 17, Value => (16#0072#, 16#0065#, 16#0066#, 16#0065#, 16#0072#, 16#0072#, 16#0065#, 16#0064#, 16#004F#, 16#0070#, 16#0065#, 16#0072#, 16#0061#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, others => 16#0000#), others => <>); -- "EnumLiteralExp" MS_001D : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0045#, 16#006E#, 16#0075#, 16#006D#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "stringSymbol" MS_001E : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 12, Length => 12, Value => (16#0073#, 16#0074#, 16#0072#, 16#0069#, 16#006E#, 16#0067#, 16#0053#, 16#0079#, 16#006D#, 16#0062#, 16#006F#, 16#006C#, others => 16#0000#), others => <>); -- "AnyType" MS_001F : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 7, Length => 7, Value => (16#0041#, 16#006E#, 16#0079#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "InvalidLiteralExp" MS_0020 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 17, Length => 17, Value => (16#0049#, 16#006E#, 16#0076#, 16#0061#, 16#006C#, 16#0069#, 16#0064#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "Bag" MS_0021 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 3, Length => 3, Value => (16#0042#, 16#0061#, 16#0067#, others => 16#0000#), others => <>); -- "bodyExpression" MS_0022 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0062#, 16#006F#, 16#0064#, 16#0079#, 16#0045#, 16#0078#, 16#0070#, 16#0072#, 16#0065#, 16#0073#, 16#0073#, 16#0069#, 16#006F#, 16#006E#, others => 16#0000#), others => <>); -- "ExpressionInOcl" MS_0023 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 15, Length => 15, Value => (16#0045#, 16#0078#, 16#0070#, 16#0072#, 16#0065#, 16#0073#, 16#0073#, 16#0069#, 16#006F#, 16#006E#, 16#0049#, 16#006E#, 16#004F#, 16#0063#, 16#006C#, others => 16#0000#), others => <>); -- "CollectionKind" MS_0024 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0043#, 16#006F#, 16#006C#, 16#006C#, 16#0065#, 16#0063#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, 16#004B#, 16#0069#, 16#006E#, 16#0064#, others => 16#0000#), others => <>); -- "resultVariable" MS_0025 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0072#, 16#0065#, 16#0073#, 16#0075#, 16#006C#, 16#0074#, 16#0056#, 16#0061#, 16#0072#, 16#0069#, 16#0061#, 16#0062#, 16#006C#, 16#0065#, others => 16#0000#), others => <>); -- "result" MS_0026 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 6, Length => 6, Value => (16#0072#, 16#0065#, 16#0073#, 16#0075#, 16#006C#, 16#0074#, others => 16#0000#), others => <>); -- "initExpression" MS_0027 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0069#, 16#006E#, 16#0069#, 16#0074#, 16#0045#, 16#0078#, 16#0070#, 16#0072#, 16#0065#, 16#0073#, 16#0073#, 16#0069#, 16#006F#, 16#006E#, others => 16#0000#), others => <>); -- "thenExpression" MS_0028 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0074#, 16#0068#, 16#0065#, 16#006E#, 16#0045#, 16#0078#, 16#0070#, 16#0072#, 16#0065#, 16#0073#, 16#0073#, 16#0069#, 16#006F#, 16#006E#, others => 16#0000#), others => <>); -- "NullLiteralExp" MS_0029 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#004E#, 16#0075#, 16#006C#, 16#006C#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "attribute" MS_002A : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 9, Length => 9, Value => (16#0061#, 16#0074#, 16#0074#, 16#0072#, 16#0069#, 16#0062#, 16#0075#, 16#0074#, 16#0065#, others => 16#0000#), others => <>); -- "varOwner" MS_002B : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 8, Length => 8, Value => (16#0076#, 16#0061#, 16#0072#, 16#004F#, 16#0077#, 16#006E#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "MessageType" MS_002C : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 11, Length => 11, Value => (16#004D#, 16#0065#, 16#0073#, 16#0073#, 16#0061#, 16#0067#, 16#0065#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "generatedType" MS_002D : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 13, Length => 13, Value => (16#0067#, 16#0065#, 16#006E#, 16#0065#, 16#0072#, 16#0061#, 16#0074#, 16#0065#, 16#0064#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "appliedElement" MS_002E : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0061#, 16#0070#, 16#0070#, 16#006C#, 16#0069#, 16#0065#, 16#0064#, 16#0045#, 16#006C#, 16#0065#, 16#006D#, 16#0065#, 16#006E#, 16#0074#, others => 16#0000#), others => <>); -- "booleanSymbol" MS_002F : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 13, Length => 13, Value => (16#0062#, 16#006F#, 16#006F#, 16#006C#, 16#0065#, 16#0061#, 16#006E#, 16#0053#, 16#0079#, 16#006D#, 16#0062#, 16#006F#, 16#006C#, others => 16#0000#), others => <>); -- "CollectionLiteralPart" MS_0030 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 21, Length => 21, Value => (16#0043#, 16#006F#, 16#006C#, 16#006C#, 16#0065#, 16#0063#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0050#, 16#0061#, 16#0072#, 16#0074#, others => 16#0000#), others => <>); -- "navigationSource" MS_0031 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 16, Length => 16, Value => (16#006E#, 16#0061#, 16#0076#, 16#0069#, 16#0067#, 16#0061#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, 16#0053#, 16#006F#, 16#0075#, 16#0072#, 16#0063#, 16#0065#, others => 16#0000#), others => <>); -- "IterateExp" MS_0032 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 10, Length => 10, Value => (16#0049#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#0074#, 16#0065#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "type1" MS_0033 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 5, Length => 5, Value => (16#0074#, 16#0079#, 16#0070#, 16#0065#, 16#0031#, others => 16#0000#), others => <>); -- "condition" MS_0034 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 9, Length => 9, Value => (16#0063#, 16#006F#, 16#006E#, 16#0064#, 16#0069#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, others => 16#0000#), others => <>); -- "firstOwner" MS_0035 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 10, Length => 10, Value => (16#0066#, 16#0069#, 16#0072#, 16#0073#, 16#0074#, 16#004F#, 16#0077#, 16#006E#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "parameterVariable" MS_0036 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 17, Length => 17, Value => (16#0070#, 16#0061#, 16#0072#, 16#0061#, 16#006D#, 16#0065#, 16#0074#, 16#0065#, 16#0072#, 16#0056#, 16#0061#, 16#0072#, 16#0069#, 16#0061#, 16#0062#, 16#006C#, 16#0065#, others => 16#0000#), others => <>); -- "exp2" MS_0037 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0065#, 16#0078#, 16#0070#, 16#0032#, others => 16#0000#), others => <>); -- "specification" MS_0038 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 13, Length => 13, Value => (16#0073#, 16#0070#, 16#0065#, 16#0063#, 16#0069#, 16#0066#, 16#0069#, 16#0063#, 16#0061#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, others => 16#0000#), others => <>); -- "VoidType" MS_0039 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 8, Length => 8, Value => (16#0056#, 16#006F#, 16#0069#, 16#0064#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "BagType" MS_003A : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 7, Length => 7, Value => (16#0042#, 16#0061#, 16#0067#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "IntegerLiteralExp" MS_003B : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 17, Length => 17, Value => (16#0049#, 16#006E#, 16#0074#, 16#0065#, 16#0067#, 16#0065#, 16#0072#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "elseExpression" MS_003C : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0065#, 16#006C#, 16#0073#, 16#0065#, 16#0045#, 16#0078#, 16#0070#, 16#0072#, 16#0065#, 16#0073#, 16#0073#, 16#0069#, 16#006F#, 16#006E#, others => 16#0000#), others => <>); -- "target" MS_003D : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 6, Length => 6, Value => (16#0074#, 16#0061#, 16#0072#, 16#0067#, 16#0065#, 16#0074#, others => 16#0000#), others => <>); -- "CollectionLiteralExp" MS_003E : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 20, Length => 20, Value => (16#0043#, 16#006F#, 16#006C#, 16#006C#, 16#0065#, 16#0063#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "exp3" MS_003F : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0065#, 16#0078#, 16#0070#, 16#0033#, others => 16#0000#), others => <>); -- "FeatureCallExp" MS_0040 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0046#, 16#0065#, 16#0061#, 16#0074#, 16#0075#, 16#0072#, 16#0065#, 16#0043#, 16#0061#, 16#006C#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "OrderedSetType" MS_0041 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#004F#, 16#0072#, 16#0064#, 16#0065#, 16#0072#, 16#0065#, 16#0064#, 16#0053#, 16#0065#, 16#0074#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "item1" MS_0042 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 5, Length => 5, Value => (16#0069#, 16#0074#, 16#0065#, 16#006D#, 16#0031#, others => 16#0000#), others => <>); -- "exp4" MS_0043 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0065#, 16#0078#, 16#0070#, 16#0034#, others => 16#0000#), others => <>); -- "contextVariable" MS_0044 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 15, Length => 15, Value => (16#0063#, 16#006F#, 16#006E#, 16#0074#, 16#0065#, 16#0078#, 16#0074#, 16#0056#, 16#0061#, 16#0072#, 16#0069#, 16#0061#, 16#0062#, 16#006C#, 16#0065#, others => 16#0000#), others => <>); -- "unlimitedNaturalSymbol" MS_0045 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 22, Length => 22, Value => (16#0075#, 16#006E#, 16#006C#, 16#0069#, 16#006D#, 16#0069#, 16#0074#, 16#0065#, 16#0064#, 16#004E#, 16#0061#, 16#0074#, 16#0075#, 16#0072#, 16#0061#, 16#006C#, 16#0053#, 16#0079#, 16#006D#, 16#0062#, 16#006F#, 16#006C#, others => 16#0000#), others => <>); -- "AssociationClassCallExp" MS_0046 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 31, Unused => 23, Length => 23, Value => (16#0041#, 16#0073#, 16#0073#, 16#006F#, 16#0063#, 16#0069#, 16#0061#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, 16#0043#, 16#006C#, 16#0061#, 16#0073#, 16#0073#, 16#0043#, 16#0061#, 16#006C#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "http://www.omg.org/spec/OCL/20090501" MS_0047 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 39, Unused => 36, Length => 36, Value => (16#0068#, 16#0074#, 16#0074#, 16#0070#, 16#003A#, 16#002F#, 16#002F#, 16#0077#, 16#0077#, 16#0077#, 16#002E#, 16#006F#, 16#006D#, 16#0067#, 16#002E#, 16#006F#, 16#0072#, 16#0067#, 16#002F#, 16#0073#, 16#0070#, 16#0065#, 16#0063#, 16#002F#, 16#004F#, 16#0043#, 16#004C#, 16#002F#, 16#0032#, 16#0030#, 16#0030#, 16#0039#, 16#0030#, 16#0035#, 16#0030#, 16#0031#, others => 16#0000#), others => <>); -- "IfExp" MS_0048 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 5, Length => 5, Value => (16#0049#, 16#0066#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "OclExpression" MS_0049 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 13, Length => 13, Value => (16#004F#, 16#0063#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, 16#0072#, 16#0065#, 16#0073#, 16#0073#, 16#0069#, 16#006F#, 16#006E#, others => 16#0000#), others => <>); -- "loopExp" MS_004A : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 7, Length => 7, Value => (16#006C#, 16#006F#, 16#006F#, 16#0070#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "NavigationCallExp" MS_004B : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 17, Length => 17, Value => (16#004E#, 16#0061#, 16#0076#, 16#0069#, 16#0067#, 16#0061#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, 16#0043#, 16#0061#, 16#006C#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "CollectionItem" MS_004C : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0043#, 16#006F#, 16#006C#, 16#006C#, 16#0065#, 16#0063#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, 16#0049#, 16#0074#, 16#0065#, 16#006D#, others => 16#0000#), others => <>); -- "CollectionType" MS_004D : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0043#, 16#006F#, 16#006C#, 16#006C#, 16#0065#, 16#0063#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "OrderedSet" MS_004E : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 10, Length => 10, Value => (16#004F#, 16#0072#, 16#0064#, 16#0065#, 16#0072#, 16#0065#, 16#0064#, 16#0053#, 16#0065#, 16#0074#, others => 16#0000#), others => <>); -- "in" MS_004F : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 2, Length => 2, Value => (16#0069#, 16#006E#, others => 16#0000#), others => <>); -- "topExpression" MS_0050 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 13, Length => 13, Value => (16#0074#, 16#006F#, 16#0070#, 16#0045#, 16#0078#, 16#0070#, 16#0072#, 16#0065#, 16#0073#, 16#0073#, 16#0069#, 16#006F#, 16#006E#, others => 16#0000#), others => <>); -- "StateExp" MS_0051 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 8, Length => 8, Value => (16#0053#, 16#0074#, 16#0061#, 16#0074#, 16#0065#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "TupleType" MS_0052 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 9, Length => 9, Value => (16#0054#, 16#0075#, 16#0070#, 16#006C#, 16#0065#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "sentSignal" MS_0053 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 10, Length => 10, Value => (16#0073#, 16#0065#, 16#006E#, 16#0074#, 16#0053#, 16#0069#, 16#0067#, 16#006E#, 16#0061#, 16#006C#, others => 16#0000#), others => <>); -- "OperationCallExp" MS_0054 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 16, Length => 16, Value => (16#004F#, 16#0070#, 16#0065#, 16#0072#, 16#0061#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, 16#0043#, 16#0061#, 16#006C#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "referredType" MS_0055 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 12, Length => 12, Value => (16#0072#, 16#0065#, 16#0066#, 16#0065#, 16#0072#, 16#0072#, 16#0065#, 16#0064#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "body" MS_0056 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0062#, 16#006F#, 16#0064#, 16#0079#, others => 16#0000#), others => <>); -- "kind" MS_0057 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#006B#, 16#0069#, 16#006E#, 16#0064#, others => 16#0000#), others => <>); -- "RealLiteralExp" MS_0058 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0052#, 16#0065#, 16#0061#, 16#006C#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "loopBodyOwner" MS_0059 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 13, Length => 13, Value => (16#006C#, 16#006F#, 16#006F#, 16#0070#, 16#0042#, 16#006F#, 16#0064#, 16#0079#, 16#004F#, 16#0077#, 16#006E#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "Sequence" MS_005A : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 8, Length => 8, Value => (16#0053#, 16#0065#, 16#0071#, 16#0075#, 16#0065#, 16#006E#, 16#0063#, 16#0065#, others => 16#0000#), others => <>); -- "variable" MS_005B : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 8, Length => 8, Value => (16#0076#, 16#0061#, 16#0072#, 16#0069#, 16#0061#, 16#0062#, 16#006C#, 16#0065#, others => 16#0000#), others => <>); -- "TupleLiteralExp" MS_005C : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 15, Length => 15, Value => (16#0054#, 16#0075#, 16#0070#, 16#006C#, 16#0065#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "PrimitiveLiteralExp" MS_005D : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 19, Length => 19, Value => (16#0050#, 16#0072#, 16#0069#, 16#006D#, 16#0069#, 16#0074#, 16#0069#, 16#0076#, 16#0065#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "UnspecifiedValueExp" MS_005E : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 19, Length => 19, Value => (16#0055#, 16#006E#, 16#0073#, 16#0070#, 16#0065#, 16#0063#, 16#0069#, 16#0066#, 16#0069#, 16#0065#, 16#0064#, 16#0056#, 16#0061#, 16#006C#, 16#0075#, 16#0065#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "iterator" MS_005F : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 8, Length => 8, Value => (16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#0074#, 16#006F#, 16#0072#, others => 16#0000#), others => <>); -- "StringLiteralExp" MS_0060 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 16, Length => 16, Value => (16#0053#, 16#0074#, 16#0072#, 16#0069#, 16#006E#, 16#0067#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "TemplateParameterType" MS_0061 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 21, Length => 21, Value => (16#0054#, 16#0065#, 16#006D#, 16#0070#, 16#006C#, 16#0061#, 16#0074#, 16#0065#, 16#0050#, 16#0061#, 16#0072#, 16#0061#, 16#006D#, 16#0065#, 16#0074#, 16#0065#, 16#0072#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "LetExp" MS_0062 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 6, Length => 6, Value => (16#004C#, 16#0065#, 16#0074#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "exp6" MS_0063 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0065#, 16#0078#, 16#0070#, 16#0036#, others => 16#0000#), others => <>); -- "elementType" MS_0064 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 11, Length => 11, Value => (16#0065#, 16#006C#, 16#0065#, 16#006D#, 16#0065#, 16#006E#, 16#0074#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "part" MS_0065 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0070#, 16#0061#, 16#0072#, 16#0074#, others => 16#0000#), others => <>); -- "Collection" MS_0066 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 10, Length => 10, Value => (16#0043#, 16#006F#, 16#006C#, 16#006C#, 16#0065#, 16#0063#, 16#0074#, 16#0069#, 16#006F#, 16#006E#, others => 16#0000#), others => <>); -- "type2" MS_0067 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 5, Length => 5, Value => (16#0074#, 16#0079#, 16#0070#, 16#0065#, 16#0032#, others => 16#0000#), others => <>); -- "referredState" MS_0068 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 13, Length => 13, Value => (16#0072#, 16#0065#, 16#0066#, 16#0065#, 16#0072#, 16#0072#, 16#0065#, 16#0064#, 16#0053#, 16#0074#, 16#0061#, 16#0074#, 16#0065#, others => 16#0000#), others => <>); -- "elseOwner" MS_0069 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 9, Length => 9, Value => (16#0065#, 16#006C#, 16#0073#, 16#0065#, 16#004F#, 16#0077#, 16#006E#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "parentNav" MS_006A : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 9, Length => 9, Value => (16#0070#, 16#0061#, 16#0072#, 16#0065#, 16#006E#, 16#0074#, 16#004E#, 16#0061#, 16#0076#, others => 16#0000#), others => <>); -- "qualifier" MS_006B : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 9, Length => 9, Value => (16#0071#, 16#0075#, 16#0061#, 16#006C#, 16#0069#, 16#0066#, 16#0069#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "ifOwner" MS_006C : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 7, Length => 7, Value => (16#0069#, 16#0066#, 16#004F#, 16#0077#, 16#006E#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "last" MS_006D : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#006C#, 16#0061#, 16#0073#, 16#0074#, others => 16#0000#), others => <>); -- "first" MS_006E : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 5, Length => 5, Value => (16#0066#, 16#0069#, 16#0072#, 16#0073#, 16#0074#, others => 16#0000#), others => <>); -- "NumericLiteralExp" MS_006F : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 17, Length => 17, Value => (16#004E#, 16#0075#, 16#006D#, 16#0065#, 16#0072#, 16#0069#, 16#0063#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "baseExp" MS_0070 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 7, Length => 7, Value => (16#0062#, 16#0061#, 16#0073#, 16#0065#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "part2" MS_0071 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 5, Length => 5, Value => (16#0070#, 16#0061#, 16#0072#, 16#0074#, 16#0032#, others => 16#0000#), others => <>); -- "lastOwner" MS_0072 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 9, Length => 9, Value => (16#006C#, 16#0061#, 16#0073#, 16#0074#, 16#004F#, 16#0077#, 16#006E#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "SequenceType" MS_0073 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 12, Length => 12, Value => (16#0053#, 16#0065#, 16#0071#, 16#0075#, 16#0065#, 16#006E#, 16#0063#, 16#0065#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "IteratorExp" MS_0074 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 11, Length => 11, Value => (16#0049#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#0074#, 16#006F#, 16#0072#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "UnlimitedNaturalLiteralExp" MS_0075 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 31, Unused => 26, Length => 26, Value => (16#0055#, 16#006E#, 16#006C#, 16#0069#, 16#006D#, 16#0069#, 16#0074#, 16#0065#, 16#0064#, 16#004E#, 16#0061#, 16#0074#, 16#0075#, 16#0072#, 16#0061#, 16#006C#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "exp7" MS_0076 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0065#, 16#0078#, 16#0070#, 16#0037#, others => 16#0000#), others => <>); -- "type3" MS_0077 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 5, Length => 5, Value => (16#0074#, 16#0079#, 16#0070#, 16#0065#, 16#0033#, others => 16#0000#), others => <>); -- "selfOwner" MS_0078 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 9, Length => 9, Value => (16#0073#, 16#0065#, 16#006C#, 16#0066#, 16#004F#, 16#0077#, 16#006E#, 16#0065#, 16#0072#, others => 16#0000#), others => <>); -- "LoopExp" MS_0079 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 7, Length => 7, Value => (16#004C#, 16#006F#, 16#006F#, 16#0070#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "referredVariable" MS_007A : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 16, Length => 16, Value => (16#0072#, 16#0065#, 16#0066#, 16#0065#, 16#0072#, 16#0072#, 16#0065#, 16#0064#, 16#0056#, 16#0061#, 16#0072#, 16#0069#, 16#0061#, 16#0062#, 16#006C#, 16#0065#, others => 16#0000#), others => <>); -- "initializedElement" MS_007B : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 18, Length => 18, Value => (16#0069#, 16#006E#, 16#0069#, 16#0074#, 16#0069#, 16#0061#, 16#006C#, 16#0069#, 16#007A#, 16#0065#, 16#0064#, 16#0045#, 16#006C#, 16#0065#, 16#006D#, 16#0065#, 16#006E#, 16#0074#, others => 16#0000#), others => <>); -- "exp8" MS_007C : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0065#, 16#0078#, 16#0070#, 16#0038#, others => 16#0000#), others => <>); -- "MessageExp" MS_007D : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 10, Length => 10, Value => (16#004D#, 16#0065#, 16#0073#, 16#0073#, 16#0061#, 16#0067#, 16#0065#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "source" MS_007E : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 6, Length => 6, Value => (16#0073#, 16#006F#, 16#0075#, 16#0072#, 16#0063#, 16#0065#, others => 16#0000#), others => <>); -- "referingExp" MS_007F : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 11, Length => 11, Value => (16#0072#, 16#0065#, 16#0066#, 16#0065#, 16#0072#, 16#0069#, 16#006E#, 16#0067#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "CallExp" MS_0080 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 7, Length => 7, Value => (16#0043#, 16#0061#, 16#006C#, 16#006C#, 16#0045#, 16#0078#, 16#0070#, others => 16#0000#), others => <>); -- "SetType" MS_0081 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 7, Length => 7, Value => (16#0053#, 16#0065#, 16#0074#, 16#0054#, 16#0079#, 16#0070#, 16#0065#, others => 16#0000#), others => <>); -- "exp5" MS_0082 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 4, Length => 4, Value => (16#0065#, 16#0078#, 16#0070#, 16#0035#, others => 16#0000#), others => <>); -- "referredEnumLiteral" MS_0083 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 19, Length => 19, Value => (16#0072#, 16#0065#, 16#0066#, 16#0065#, 16#0072#, 16#0072#, 16#0065#, 16#0064#, 16#0045#, 16#006E#, 16#0075#, 16#006D#, 16#004C#, 16#0069#, 16#0074#, 16#0065#, 16#0072#, 16#0061#, 16#006C#, others => 16#0000#), others => <>); -- "Set" MS_0084 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 7, Unused => 3, Length => 3, Value => (16#0053#, 16#0065#, 16#0074#, others => 16#0000#), others => <>); end AMF.Internals.Tables.OCL_String_Data_00;
stcarrez/ada-util
Ada
2,215
ads
-- Generated by utildgen.c from system includes with Interfaces.C; package Util.Systems.Types is subtype dev_t is Long_Long_Integer; subtype ino_t is Long_Long_Integer; subtype off_t is Long_Long_Integer; subtype blksize_t is Long_Long_Integer; subtype blkcnt_t is Long_Long_Integer; subtype uid_t is Interfaces.C.unsigned; subtype gid_t is Interfaces.C.unsigned; subtype nlink_t is Long_Long_Integer; subtype mode_t is Interfaces.C.unsigned; S_IFMT : constant mode_t := 8#00170000#; S_IFDIR : constant mode_t := 8#00040000#; S_IFCHR : constant mode_t := 8#00020000#; S_IFBLK : constant mode_t := 8#00060000#; S_IFREG : constant mode_t := 8#00100000#; S_IFIFO : constant mode_t := 8#00010000#; S_IFLNK : constant mode_t := 8#00120000#; S_IFSOCK : constant mode_t := 8#00140000#; S_ISUID : constant mode_t := 8#00004000#; S_ISGID : constant mode_t := 8#00002000#; S_IREAD : constant mode_t := 8#00000400#; S_IWRITE : constant mode_t := 8#00000200#; S_IEXEC : constant mode_t := 8#00000100#; type File_Type is new Interfaces.C.int; subtype Time_Type is Long_Long_Integer; type Timespec is record tv_sec : Time_Type; tv_nsec : Long_Long_Integer; end record; pragma Convention (C_Pass_By_Copy, Timespec); type Seek_Mode is (SEEK_SET, SEEK_CUR, SEEK_END); for Seek_Mode use (SEEK_SET => 0, SEEK_CUR => 1, SEEK_END => 2); STAT_NAME : constant String := "stat"; FSTAT_NAME : constant String := "fstat"; LSTAT_NAME : constant String := "lstat"; type Stat_Type is record st_dev : dev_t; st_ino : ino_t; st_nlink : nlink_t; st_mode : mode_t; st_uid : uid_t; st_gid : gid_t; pad1_0 : Interfaces.C.unsigned; st_rdev : dev_t; st_size : off_t; st_blksize : blksize_t; st_blocks : blkcnt_t; st_atim : Timespec; st_mtim : Timespec; st_ctim : Timespec; pad5 : Interfaces.C.unsigned_long; pad6 : Interfaces.C.unsigned_long; pad7 : Interfaces.C.unsigned_long; end record; pragma Convention (C_Pass_By_Copy, Stat_Type); end Util.Systems.Types;
AdaCore/libadalang
Ada
71
ads
generic type Value_T is private; package Data_Pkg is end Data_Pkg;
Componolit/libsparkcrypto
Ada
3,893
ads
------------------------------------------------------------------------------- -- This file is part of libsparkcrypto. -- -- Copyright (C) 2011, Adrian-Ken Rueegsegger -- 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 nor the names of its contributors may be used -- to endorse or promote products derived from this software without -- specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS -- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------- with LSC.Internal.SHA1, LSC.Internal.Types; use type LSC.Internal.Types.Word32; use type LSC.Internal.Types.Word64; ------------------------------------------------------------------------------- -- The HMAC-SHA-1 message authentication -- -- <ul> -- <li> -- <a href="http://www.faqs.org/rfcs/rfc2202.html"> -- P. Cheng, Test Cases for HMAC-MD5 and HMAC-SHA-1, RFC 2202, -- September 1997. </a> -- </li> -- </ul> ------------------------------------------------------------------------------- package LSC.Internal.HMAC_SHA1 is pragma Pure; -- HMAC-SHA-1 context type Context_Type is private; -- Initialize HMAC-SHA-1 context using @Key@. function Context_Init (Key : SHA1.Block_Type) return Context_Type; -- Update HMAC-SHA-1 @Context@ with message block @Block@. procedure Context_Update (Context : in out Context_Type; Block : in SHA1.Block_Type) with Depends => (Context =>+ Block); pragma Inline (Context_Update); -- Finalize HMAC-SHA-1 @Context@ using @Length@ bits of final message -- block @Block@. procedure Context_Finalize (Context : in out Context_Type; Block : in SHA1.Block_Type; Length : in SHA1.Block_Length_Type) with Depends => (Context =>+ (Block, Length)); pragma Inline (Context_Finalize); -- Get authentication value from @Context@ function Get_Auth (Context : in Context_Type) return SHA1.Hash_Type; -- Perform authentication of @Length@ bits of @Message@ using @Key@ and -- return the authentication value. function Authenticate (Key : SHA1.Block_Type; Message : SHA1.Message_Type; Length : Types.Word64) return SHA1.Hash_Type with Pre => Message'First <= Message'Last and Length / SHA1.Block_Size + (if Length mod SHA1.Block_Size = 0 then 0 else 1) <= Message'Length; private type Context_Type is record SHA1_Context : SHA1.Context_Type; Key : SHA1.Block_Type; end record; end LSC.Internal.HMAC_SHA1;
annexi-strayline/AURA
Ada
4,498
ads
------------------------------------------------------------------------------ -- -- -- Ada User Repository Annex (AURA) -- -- ANNEXI-STRAYLINE Reference Implementation -- -- -- -- Core -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2019-2020, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * Richard Wai (ANNEXI-STRAYLINE) -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- -- -- * Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with Ada.Strings.Unbounded; with Workers; with Registrar.Subsystems; package Registrar.Executive.Unit_Entry is Invalid_Unit: exception; -- Riased if an entered unit has unexpected content ---------------------- -- Unit_Entry_Order -- ---------------------- -- The Unit_Entry_Order executes the actual actions required for entry of a -- library unit, including parsing Ada units for dependencies package UBS renames Ada.Strings.Unbounded; type Unit_Entry_Order (AURA: Boolean) is new Workers.Work_Order with record File_Full_Name: UBS.Unbounded_String; case AURA is when True => AURA_Subsystem: Registrar.Subsystems.Subsystem; when False => null; end case; end record; overriding procedure Execute (Order: in out Unit_Entry_Order); overriding function Image (Order: Unit_Entry_Order) return String; end Registrar.Executive.Unit_Entry;
reznikmm/matreshka
Ada
3,639
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.Structured_Classifiers.Hash is new AMF.Elements.Generic_Hash (UML_Structured_Classifier, UML_Structured_Classifier_Access);
sungyeon/drake
Ada
396
ads
pragma License (Unrestricted); -- extended unit package Ada.Streams.Block_Transmission.Strings is -- There are efficient streaming operations for String. pragma Pure; procedure Read is new Block_Transmission.Read (Positive, Character, String); procedure Write is new Block_Transmission.Write (Positive, Character, String); end Ada.Streams.Block_Transmission.Strings;
onox/orka
Ada
784
ads
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2023 onox <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Orka.Numerics.Tensors.CS_GPU; package Orka.Numerics.Doubles.Tensors.GPU is new Orka.Numerics.Doubles.Tensors.CS_GPU;
AdaCore/langkit
Ada
4,011
adb
-- Test that the Equivalence function for lexical envs works properly with Langkit_Support.Lexical_Envs; use Langkit_Support.Lexical_Envs; with Support; use Support; procedure Main is use Envs; Old_Env_1 : Lexical_Env := Wrap (new Lexical_Env_Record' (Kind => Static_Primary, Node => 'O', others => <>)); New_Env_1 : Lexical_Env := Wrap (new Lexical_Env_Record' (Kind => Static_Primary, Node => 'N', others => <>)); Old_Env_2 : Lexical_Env := Wrap (new Lexical_Env_Record' (Kind => Static_Primary, Node => 'o', others => <>)); New_Env_2 : Lexical_Env := Wrap (new Lexical_Env_Record' (Kind => Static_Primary, Node => 'n', others => <>)); Prim_A : Lexical_Env := Wrap (new Lexical_Env_Record' (Kind => Static_Primary, Node => 'A', others => <>)); Prim_B : Lexical_Env := Wrap (new Lexical_Env_Record' (Kind => Static_Primary, Node => 'B', others => <>)); Orphaned_A1 : Lexical_Env := Orphan (Prim_A); Orphaned_A2 : Lexical_Env := Orphan (Prim_A); Orphaned_B : Lexical_Env := Orphan (Prim_B); Grouped_1 : Lexical_Env := Group ((Orphaned_A1, Orphaned_B)); Grouped_2 : Lexical_Env := Group ((Orphaned_A1, Orphaned_B)); Grouped_3 : Lexical_Env := Group ((Orphaned_B, Orphaned_A1)); Grouped_4 : Lexical_Env := Group ((Orphaned_A1, Orphaned_B, Orphaned_A1)); Grouped_5 : Lexical_Env := Group ((Orphaned_A1, Orphaned_B), (I => 1)); R1 : Env_Rebindings := Append (null, Old_Env_1, New_Env_1); R2 : Env_Rebindings := Append (null, Old_Env_2, New_Env_2); pragma Assert (R1 /= R2); Rebound_A1X : Lexical_Env := Rebind_Env (Prim_A, R1); Rebound_A1Y : Lexical_Env := Rebind_Env (Prim_A, R1); Rebound_A2 : Lexical_Env := Rebind_Env (Prim_A, R2); Rebound_B : Lexical_Env := Rebind_Env (Prim_B, R1); begin -- Two primary environments are considered different unless it's actually -- the same. pragma Assert (not Equivalent (Prim_A, Prim_B)); pragma Assert (Equivalent (Prim_A, Prim_A)); -- Two environments that have different kinds can never be equivalent pragma Assert (not Equivalent (Prim_A, Orphaned_A1)); -- Two orphaned environments are equivalent iff they have the same -- referenced environment. pragma Assert (Orphaned_A1 /= Orphaned_A2); pragma Assert (Orphaned_A1 /= Orphaned_B); pragma Assert (Equivalent (Orphaned_A1, Orphaned_A2)); pragma Assert (not Equivalent (Orphaned_A1, Orphaned_B)); -- Two grouped environments are equivalent iff: -- * they contain the same number of environment; -- * these environments are equivalent two by two; -- * the attached metadata is the same. -- Additionally the Group primitive performs flattening and only keeps one -- of each env. pragma Assert (Grouped_1 /= Grouped_2); pragma Assert (Grouped_1 /= Grouped_3); pragma Assert (Grouped_1 /= Grouped_4); pragma Assert (Grouped_1 /= Grouped_5); pragma Assert (Equivalent (Grouped_1, Grouped_2)); pragma Assert (not Equivalent (Grouped_1, Grouped_3)); pragma Assert (Equivalent (Grouped_1, Grouped_4)); pragma Assert (not Equivalent (Grouped_1, Grouped_5)); -- Two rebound environments are equivalent iff: -- * they point to equivalent environments; -- * they contain equivalent rebindings. pragma Assert (Rebound_A1X /= Rebound_A1Y); pragma Assert (Equivalent (Rebound_A1X, Rebound_A1Y)); pragma Assert (not Equivalent (Rebound_A1X, Rebound_A2)); pragma Assert (not Equivalent (Rebound_A1X, Rebound_B)); Dec_Ref (Orphaned_A1); Dec_Ref (Orphaned_A2); Dec_Ref (Orphaned_B); Dec_Ref (Grouped_1); Dec_Ref (Grouped_2); Dec_Ref (Grouped_3); Dec_Ref (Grouped_4); Dec_Ref (Grouped_5); Dec_Ref (Rebound_A1X); Dec_Ref (Rebound_A1Y); Dec_Ref (Rebound_A2); Dec_Ref (Rebound_B); Destroy (Old_Env_1); Destroy (New_Env_1); Destroy (Old_Env_2); Destroy (New_Env_2); Destroy (Prim_A); Destroy (Prim_B); Destroy (R1); Destroy (R2); end Main;
AdaCore/training_material
Ada
211
ads
generic package Solar_System.Graphics is procedure Draw_All (Bodies : Bodies_Array_T; Canvas : Canvas_ID); private procedure Draw_Body (Object : Body_T; Canvas : Canvas_ID); end Solar_System.Graphics;
BrickBot/Bound-T-H8-300
Ada
4,134
ads
-- Devices (decl) -- -- Support for selecting the processor device (chip, target system) -- on which the target program is meant to run. -- -- The implementations are defined as a tagged-type hierarchy rooted at -- an abstract device type. Implementation-specific attributes are defined -- by overriding primitive operations of the standard implementation. -- -- The general attributes and properties of the Device_T are: -- -- > A name, used (on the general level) purely for documentation. -- -- An application of Bound-T to a particular target processor family -- can use these services, or can ignore them, perhaps substituting -- its own design of a device hierarchy. -- -- The child package Devices.Catalog can also be used, or not. It helps -- to define mappings from device names to specific devices; these -- device objects may already exist, or they may be created on the fly -- depending on the device names given. -- -- Author: Niklas Holsti, Tidorum Ltd. -- -- A component of the Bound-T Timing Analysis 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 19:36:48 $ -- -- $Log: devices.ads,v $ -- Revision 1.4 2015/10/24 19:36:48 niklas -- Moved to free licence. -- -- Revision 1.3 2014/06/01 10:29:23 niklas -- Made Device_T limited so that derived types can add -- limited components. -- -- Revision 1.2 2012-01-19 20:13:56 niklas -- BT-CH-0224: Device.Catalog added. Device options updated. -- -- Revision 1.1 2008-06-11 08:18:15 niklas -- BT-CH-0129: Devices and the -device option. -- package Devices is type Privates_T is private; -- -- The private parts of the root class. type Device_T is abstract tagged limited record Privates : Privates_T; end record; -- -- The root of the device hierarchy. type Device_Ref is access all Device_T'Class; -- -- A reference to a device of some class. function Name (Device : Device_T) return String; -- -- The name of the device (implementation, model). -- The default implementation returns the name that -- was given in Set_Name (see below). procedure Set_Name ( Device : in out Device_T'Class; To : in String); -- -- Changes the name of the Device, To the given string. private type Name_Ref is access String; -- -- A heap-allocated string. type Privates_T is record Name : Name_Ref; end record; end Devices;
optikos/oasis
Ada
16,498
adb
-- G E L A G R A M M A R S -- -- Library for dealing with grammars for Gela project, -- -- a portable Ada compiler -- -- http://gela.ada-ru.org/ -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license in gela.ads file -- ------------------------------------------------------------------------------ with Ada.Command_Line; with Ada.Text_IO; with Anagram.Grammars; with Anagram.Grammars.Reader; with Anagram.Grammars_Convertors; with Anagram.Grammars.Rule_Templates; with Anagram.Grammars_Debug; with Anagram.Grammars.LR_Tables; with Anagram.Grammars.LR.LALR; with Anagram.Grammars.Constructors; with Anagram.Grammars.Conflicts; with Writers; use Writers; with League.String_Vectors; with League.Strings; procedure Ada_LARL is use type Anagram.Grammars.Rule_Count; use type Anagram.Grammars.LR.State_Count; procedure Put_Proc_Decl (Output : in out Writer; Suffix : Wide_Wide_String); procedure Put_Piece (Piece : in out Writer; From : Anagram.Grammars.Production_Index; To : Anagram.Grammars.Production_Index); procedure Put_Rule (Output : in out Writer; Prod : Anagram.Grammars.Production; Rule : Anagram.Grammars.Rule); function Image (X : Integer) return Wide_Wide_String; procedure Print_Go_To; procedure Print_Action; File : constant String := Ada.Command_Line.Argument (1); G : constant Anagram.Grammars.Grammar := Anagram.Grammars.Reader.Read (File); Plain : constant Anagram.Grammars.Grammar := Anagram.Grammars_Convertors.Convert (G, Left => False); AG : constant Anagram.Grammars.Grammar := Anagram.Grammars.Constructors.To_Augmented (Plain); Table : constant Anagram.Grammars.LR_Tables.Table_Access := Anagram.Grammars.LR.LALR.Build (Input => AG, Right_Nulled => False); Resolver : Anagram.Grammars.Conflicts.Resolver; Output : Writer; ----------- -- Image -- ----------- function Image (X : Integer) return Wide_Wide_String is Img : constant Wide_Wide_String := Integer'Wide_Wide_Image (X); begin return Img (2 .. Img'Last); end Image; ------------------ -- Print_Action -- ------------------ procedure Print_Action is use type Anagram.Grammars.Production_Count; use type Anagram.Grammars.Part_Count; type Action_Code is mod 2 ** 16; Count : Natural; Code : Action_Code; begin Output.P (" type Action_Code is mod 2 ** 16;"); Output.P (" for Action_Code'Size use 16;"); Output.P; Output.P (" Action_Table : constant array"); Output.N (" (State_Index range 1 .. "); Output.N (Natural (Anagram.Grammars.LR_Tables.Last_State (Table.all))); Output.P (","); Output.N (" Anagram.Grammars.Terminal_Count range 0 .. "); Output.N (Natural (Plain.Last_Terminal)); Output.P (") of Action_Code :="); for State in 1 .. Anagram.Grammars.LR_Tables.Last_State (Table.all) loop if State = 1 then Output.N (" ("); else Output.P (","); Output.N (" "); end if; Output.N (Natural (State)); Output.P (" =>"); Output.N (" ("); Count := 0; for T in 0 .. Plain.Last_Terminal loop declare use Anagram.Grammars.LR_Tables; S : constant Anagram.Grammars.LR.State_Count := Shift (Table.all, State, T); R : constant Reduce_Iterator := Reduce (Table.all, State, T); begin if S /= 0 then Code := Action_Code (S) + 16#80_00#; elsif not Is_Empty (R) then Code := Action_Code (Production (R)); else Code := 0; end if; if Code /= 0 then Output.N (Natural (T)); Output.N (" => "); Output.N (Natural (Code)); Count := Count + 1; if Count < 4 then Output.N (", "); else Count := 0; Output.P (","); Output.N (" "); end if; end if; end; end loop; Output.N ("others => 0)"); end loop; Output.P (");"); Output.P; Output.P (" type Production_Record is record"); Output.P (" NT : Anagram.Grammars.Non_Terminal_Index;"); Output.P (" Parts : Natural;"); Output.P (" end record;"); Output.P; Output.N (" Prods : constant array (Action_Code range 1 .. "); Output.N (Natural (Plain.Last_Production)); Output.P (") of"); Output.P (" Production_Record :="); Count := 0; for J in 1 .. Plain.Last_Production loop if J = 1 then Output.N (" ("); elsif Count > 5 then Count := 0; Output.P (","); Output.N (" "); else Output.N (", "); end if; Output.N ("("); Output.N (Natural (Plain.Production (J).Parent)); Output.N (", "); Output.N (Natural (Plain.Production (J).Last - Plain.Production (J).First + 1)); Output.N (")"); Count := Count + 1; end loop; Output.P (");"); Output.P; Output.P (" procedure Next_Action"); Output.P (" (State : Anagram.Grammars.LR_Parsers.State_Index;"); Output.P (" Token : Anagram.Grammars.Terminal_Count;"); Output.P (" Value : out Anagram.Grammars.LR_Parsers.Action)"); Output.P (" is"); Output.P (" Code : constant Action_Code := " & "Action_Table (State, Token);"); Output.P (" begin"); Output.P (" if (Code and 16#80_00#) /= 0 then"); Output.P (" Value := (Kind => Shift, " & "State => State_Index (Code and 16#7F_FF#));"); Output.P (" elsif Code /= 0 then"); Output.P (" Value := (Kind => Reduce,"); Output.P (" Prod => " & "Anagram.Grammars.Production_Index (Code),"); Output.P (" NT => Prods (Code).NT,"); Output.P (" Parts => Prods (Code).Parts);"); for State in 1 .. Anagram.Grammars.LR_Tables.Last_State (Table.all) loop if Anagram.Grammars.LR_Tables.Finish (Table.all, State) then Output.N (" elsif State = "); Output.N (Natural (State)); Output.P (" then"); Output.P (" Value := (Kind => Finish);"); end if; end loop; Output.P (" else"); Output.P (" Value := (Kind => Error);"); Output.P (" end if;"); Output.P (" end Next_Action;"); Output.P; end Print_Action; ----------------- -- Print_Go_To -- ----------------- procedure Print_Go_To is Count : Natural; begin Output.P (" Go_To_Table : constant array"); Output.N (" (Anagram.Grammars.LR_Parsers.State_Index range 1 .. "); Output.N (Natural (Anagram.Grammars.LR_Tables.Last_State (Table.all))); Output.P (","); Output.N (" Anagram.Grammars.Non_Terminal_Index range 1 .. "); Output.N (Natural (Plain.Last_Non_Terminal)); Output.P (") of State_Index :="); for State in 1 .. Anagram.Grammars.LR_Tables.Last_State (Table.all) loop if State = 1 then Output.N (" ("); else Output.P (","); Output.N (" "); end if; Output.N (Natural (State)); Output.P (" =>"); Output.N (" ("); Count := 0; for NT in 1 .. Plain.Last_Non_Terminal loop declare use Anagram.Grammars.LR; Next : constant State_Count := Anagram.Grammars.LR_Tables.Shift (Table.all, State, NT); begin if Next /= 0 then Output.N (Natural (NT)); Output.N (" => "); Output.N (Natural (Next)); Count := Count + 1; if Count < 4 then Output.N (", "); else Count := 0; Output.P (","); Output.N (" "); end if; end if; end; end loop; Output.N ("others => 0)"); end loop; Output.P (");"); Output.P; Output.P (" function Go_To"); Output.P (" (State : Anagram.Grammars.LR_Parsers.State_Index;"); Output.P (" NT : Anagram.Grammars.Non_Terminal_Index)"); Output.P (" return Anagram.Grammars.LR_Parsers.State_Index"); Output.P (" is"); Output.P (" begin"); Output.P (" return Go_To_Table (State, NT);"); Output.P (" end Go_To;"); Output.P; end Print_Go_To; -------------- -- Put_Rule -- -------------- procedure Put_Rule (Output : in out Writer; Prod : Anagram.Grammars.Production; Rule : Anagram.Grammars.Rule) is use Anagram.Grammars.Rule_Templates; use type League.Strings.Universal_String; Template : constant Rule_Template := Create (Rule.Text); Args : League.String_Vectors.Universal_String_Vector; Value : League.Strings.Universal_String; begin for J in 1 .. Template.Count loop Value.Clear; if Plain.Non_Terminal (Prod.Parent).Name = Template.Part_Name (J) then Value.Append ("Nodes (1)"); else declare Index : Positive := 1; begin for Part of Plain.Part (Prod.First .. Prod.Last) loop if Part.Name = Template.Part_Name (J) then Value.Append ("Nodes ("); Value.Append (Image (Index)); Value.Append (")"); end if; Index := Index + 1; end loop; if Value.Is_Empty then if Template.Has_Default (J) then Value := Template.Default (J); else Ada.Text_IO.Put_Line ("Wrong part " & Template.Part_Name (J).To_UTF_8_String & " in rule for production " & Plain.Non_Terminal (Prod.Parent).Name.To_UTF_8_String & "." & Prod.Name.To_UTF_8_String); Ada.Text_IO.Put_Line (Rule.Text.To_UTF_8_String); raise Constraint_Error; end if; end if; end; end if; Args.Append (Value); end loop; Output.P (Template.Substitute (Args)); end Put_Rule; procedure Put_Proc_Decl (Output : in out Writer; Suffix : Wide_Wide_String) is begin Output.N ("procedure Program.Parsers.On_Reduce"); Output.P (Suffix); Output.P (" (Self : access Parse_Context;"); Output.P (" Prod : Anagram.Grammars.Production_Index;"); Output.N (" Nodes : in out " & "Program.Parsers.Nodes.Node_Array)"); end Put_Proc_Decl; procedure Put_Piece (Piece : in out Writer; From : Anagram.Grammars.Production_Index; To : Anagram.Grammars.Production_Index) is Suffix : Wide_Wide_String := Anagram.Grammars.Production_Index'Wide_Wide_Image (From); begin Suffix (1) := '_'; Piece.P ("with Anagram.Grammars;"); Piece.P ("with Program.Parsers.Nodes;"); Piece.N ("private "); Put_Proc_Decl (Piece, Suffix); Piece.P (";"); Piece.N ("pragma Preelaborate (Program.Parsers.On_Reduce"); Piece.N (Suffix); Piece.P (");"); Piece.P; -- Piece.P ("pragma Warnings (""U"");"); Piece.P ("with Program.Parsers.Nodes;"); Piece.P ("use Program.Parsers.Nodes;"); Piece.P ("pragma Style_Checks (""N"");"); Put_Proc_Decl (Piece, Suffix); Piece.P (" is"); Piece.P ("begin"); Piece.P (" case Prod is"); for Prod of Plain.Production (From .. To) loop Piece.N (" when"); Piece.N (Anagram.Grammars.Production_Index'Wide_Wide_Image (Prod.Index)); Piece.P (" =>"); for Rule of Plain.Rule (Prod.First_Rule .. Prod.Last_Rule) loop Put_Rule (Piece, Prod, Rule); end loop; if Prod.First_Rule > Prod.Last_Rule then Piece.P (" null;"); end if; end loop; Piece.P (" when others =>"); Piece.P (" raise Constraint_Error;"); Piece.P (" end case;"); Piece.N ("end Program.Parsers.On_Reduce"); Piece.N (Suffix); Piece.P (";"); end Put_Piece; use type Anagram.Grammars.Production_Count; Piece_Length : constant Anagram.Grammars.Production_Count := 500; Piece : Writer; begin Resolver.Resolve (AG, Table.all); Output.P ("with Anagram.Grammars;"); Output.P ("with Anagram.Grammars.LR_Parsers;"); Output.P; Output.P ("package Program.Parsers.Data is"); Output.P (" pragma Preelaborate;"); Output.P; Output.P (" procedure Next_Action"); Output.P (" (State : Anagram.Grammars.LR_Parsers.State_Index;"); Output.P (" Token : Anagram.Grammars.Terminal_Count;"); Output.P (" Value : out Anagram.Grammars.LR_Parsers.Action);"); Output.P; Output.P (" function Go_To"); Output.P (" (State : Anagram.Grammars.LR_Parsers.State_Index;"); Output.P (" NT : Anagram.Grammars.Non_Terminal_Index)"); Output.P (" return Anagram.Grammars.LR_Parsers.State_Index;"); Output.P; Output.P ("end Program.Parsers.Data;"); Output.P; Output.P ("package body Program.Parsers.Data is"); Output.P (" use Anagram.Grammars.LR_Parsers;"); Output.P; Print_Go_To; Print_Action; Output.P ("end Program.Parsers.Data;"); Output.P; Output.P ("with Anagram.Grammars;"); Output.P ("with Program.Parsers.Nodes;"); Output.N ("private "); Put_Proc_Decl (Output, ""); Output.P (";"); Output.P ("pragma Preelaborate (Program.Parsers.On_Reduce);"); Output.P; for Piece_Index in 0 .. (Plain.Last_Production - 1) / Piece_Length loop declare From : constant Anagram.Grammars.Production_Index := Piece_Index * Piece_Length + 1; begin Output.N ("with Program.Parsers.On_Reduce_"); Output.N (Natural (From)); Output.P (";"); end; end loop; Put_Proc_Decl (Output, ""); Output.P (" is"); Output.P ("begin"); Output.P (" case Prod is"); for Piece_Index in 0 .. (Plain.Last_Production - 1) / Piece_Length loop declare From : constant Anagram.Grammars.Production_Index := Piece_Index * Piece_Length + 1; To : constant Anagram.Grammars.Production_Index := Anagram.Grammars.Production_Index'Min (Plain.Last_Production, (Piece_Index + 1) * Piece_Length); begin Output.N (" when "); Output.N (Natural (From)); Output.N (" .. "); Output.N (Natural (To)); Output.P (" =>"); Output.N (" On_Reduce_"); Output.N (Natural (From)); Output.P (" (Self, Prod, Nodes);"); Put_Piece (Piece => Piece, From => From, To => To); end; end loop; Output.P (" when others =>"); Output.P (" raise Constraint_Error;"); Output.P (" end case;"); Output.P ("end Program.Parsers.On_Reduce;"); Ada.Text_IO.Put_Line (Output.Text.To_UTF_8_String); Ada.Text_IO.Put_Line (Piece.Text.To_UTF_8_String); Anagram.Grammars_Debug.Print_Conflicts (AG, Table.all); if Ada.Command_Line.Argument_Count > 1 then Anagram.Grammars_Debug.Print (G); end if; end Ada_LARL;
reznikmm/matreshka
Ada
4,131
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- 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$ ------------------------------------------------------------------------------ -- This is Windows specific version of the package specification. ------------------------------------------------------------------------------ with League.Settings; private with Matreshka.Internals.Settings.Registry_Managers; private with Matreshka.Internals.Settings.Ini_Managers; package Matreshka.Internals.Settings.Configuration is type Managers is array (League.Settings.Formats) of Manager_Access; Manager : constant Managers; private Native_Manager : aliased Matreshka.Internals.Settings.Registry_Managers.Registry_Manager; Ini_Manager : aliased Matreshka.Internals.Settings.Ini_Managers.Ini_File_Manager (False); Manager : constant Managers := (Native_Manager'Access, Ini_Manager'Access); end Matreshka.Internals.Settings.Configuration;
fractal-mind/Amass
Ada
3,676
ads
-- Copyright © by Jeff Foley 2017-2022. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. -- SPDX-License-Identifier: Apache-2.0 name = "ShadowServer" type = "misc" local shadowServerWhoisAddress = "" -- shadowServerWhoisURL is the URL for the ShadowServer whois server. local shadowServerWhoisURL = "asn.shadowserver.org" function start() set_rate_limit(2) end function asn(ctx, addr, asn) if (shadowServerWhoisAddress == "") then shadowServerWhoisAddress = get_whois_addr(ctx) if (shadowServerWhoisAddress == "") then return end end local result if (asn == 0) then if (addr == "") then return end result = origin(ctx, addr) if (result == nil) then return end local cidrs = netblocks(ctx, result.asn) if (cidrs == nil or #cidrs == 0) then return end result['netblocks'] = cidrs else local cidrs = netblocks(ctx, asn) if (cidrs == nil or #cidrs == 0) then return end if (addr == "") then local parts = split(cidrs[1], "/") if (#parts < 2) then return end addr = parts[1] end result = origin(ctx, addr) if (result == nil) then return end result['netblocks'] = cidrs end new_asn(ctx, result) end function origin(ctx, addr) if not is_ipv4(addr) then return nil end local name = reverse_ip(addr) .. ".origin.asn.shadowserver.org" local resp, err = resolve(ctx, name, "TXT", false) if ((err ~= nil and err ~= "") or #resp == 0) then return nil end local fields = split(resp[1].rrdata, "|") return { ['addr']=addr, ['asn']=tonumber(trim_space(fields[1])), ['prefix']=trim_space(fields[2]), ['cc']=trim_space(fields[4]), ['desc']=trim_space(fields[3]) .. " - " .. trim_space(fields[5]), } end function netblocks(ctx, asn) local conn, err = socket.connect(ctx, shadowServerWhoisAddress, 43, "tcp") if (err ~= nil and err ~= "") then return nil end _, err = conn:send("prefix " .. tostring(asn) .. "\n") if (err ~= nil and err ~= "") then conn:close() return nil end local data data, err = conn:recv_all() if (err ~= nil and err ~= "") then conn:close() return nil end local netblocks = {} for _, block in pairs(split(data, "\n")) do table.insert(netblocks, trim_space(block)) end conn:close() return netblocks end function split(str, delim) local result = {} local pattern = "[^%" .. delim .. "]+" local matches = find(str, pattern) if (matches == nil or #matches == 0) then return result end for _, match in pairs(matches) do table.insert(result, match) end return result end function get_whois_addr(ctx) local resp, err = resolve(ctx, shadowServerWhoisURL, "A", false) if ((err ~= nil and err ~= "") or #resp == 0) then return "" end return resp[1].rrdata end function is_ipv4(addr) local octets = { addr:match("^(%d+)%.(%d+)%.(%d+)%.(%d+)$") } if (#octets == 4) then for _, v in pairs(octets) do if tonumber(v) > 255 then return false end end return true end return false end function reverse_ip(addr) local octets = { addr:match("^(%d+)%.(%d+)%.(%d+)%.(%d+)$") } local ip = "" for i, o in pairs(octets) do local n = o if (i ~= 1) then n = n .. "." end ip = n .. ip end return ip end function trim_space(s) if (s == nil) then return "" end return s:match( "^%s*(.-)%s*$" ) end
AdaCore/libadalang
Ada
571
adb
procedure Test is pragma Compile_Time_Error (not Test'Library_Level, "Error"); pragma Test_Statement; package P is Library_Level : Boolean := P'Library_Level; pragma Test_Statement; end P; package body P is end P; generic type T is private; package Q is pragma Compile_Time_Error (not Q'Library_Level, "Q can only be instantiated at library level"); pragma Test_Statement; procedure P (X : T); end Q; package body Q is procedure P (X : T) is null; end Q; begin null; end Test;
persan/A-gst
Ada
4,940
ads
pragma Ada_2005; pragma Style_Checks (Off); pragma Warnings (Off); with Interfaces.C; use Interfaces.C; with System; with glib; with glib.Values; with System; with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstdatetime_h is -- GStreamer -- * Copyright (C) 2010 Thiago Santos <[email protected]> -- * -- * This library is free software; you can redistribute it and/or -- * modify it under the terms of the GNU Library General Public -- * License as published by the Free Software Foundation; either -- * version 2 of the License, or (at your option) any later version. -- * -- * This library is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- * Library General Public License for more details. -- * -- * You should have received a copy of the GNU Library General Public -- * License along with this library; if not, write to the -- * Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- * Boston, MA 02111-1307, USA. -- --* -- * GstDateTime: -- * -- * Opaque, immutable, refcounted struct that stores date, time and timezone -- * information. It currently supports ranges from 0001-01-01 to -- * 9999-12-31 in the Gregorian proleptic calendar. -- * -- * Use the acessor functions to get the stored values. -- -- skipped empty struct u_GstDateTime -- skipped empty struct GstDateTime function gst_date_time_get_year (datetime : System.Address) return GLIB.gint; -- gst/gstdatetime.h:39 pragma Import (C, gst_date_time_get_year, "gst_date_time_get_year"); function gst_date_time_get_month (datetime : System.Address) return GLIB.gint; -- gst/gstdatetime.h:40 pragma Import (C, gst_date_time_get_month, "gst_date_time_get_month"); function gst_date_time_get_day (datetime : System.Address) return GLIB.gint; -- gst/gstdatetime.h:41 pragma Import (C, gst_date_time_get_day, "gst_date_time_get_day"); function gst_date_time_get_hour (datetime : System.Address) return GLIB.gint; -- gst/gstdatetime.h:42 pragma Import (C, gst_date_time_get_hour, "gst_date_time_get_hour"); function gst_date_time_get_minute (datetime : System.Address) return GLIB.gint; -- gst/gstdatetime.h:43 pragma Import (C, gst_date_time_get_minute, "gst_date_time_get_minute"); function gst_date_time_get_second (datetime : System.Address) return GLIB.gint; -- gst/gstdatetime.h:44 pragma Import (C, gst_date_time_get_second, "gst_date_time_get_second"); function gst_date_time_get_microsecond (datetime : System.Address) return GLIB.gint; -- gst/gstdatetime.h:45 pragma Import (C, gst_date_time_get_microsecond, "gst_date_time_get_microsecond"); function gst_date_time_get_time_zone_offset (datetime : System.Address) return GLIB.gfloat; -- gst/gstdatetime.h:46 pragma Import (C, gst_date_time_get_time_zone_offset, "gst_date_time_get_time_zone_offset"); function gst_date_time_new_from_unix_epoch_local_time (secs : GLIB.gint64) return System.Address; -- gst/gstdatetime.h:48 pragma Import (C, gst_date_time_new_from_unix_epoch_local_time, "gst_date_time_new_from_unix_epoch_local_time"); function gst_date_time_new_from_unix_epoch_utc (secs : GLIB.gint64) return System.Address; -- gst/gstdatetime.h:49 pragma Import (C, gst_date_time_new_from_unix_epoch_utc, "gst_date_time_new_from_unix_epoch_utc"); function gst_date_time_new_local_time (year : GLIB.gint; month : GLIB.gint; day : GLIB.gint; hour : GLIB.gint; minute : GLIB.gint; seconds : GLIB.gdouble) return System.Address; -- gst/gstdatetime.h:50 pragma Import (C, gst_date_time_new_local_time, "gst_date_time_new_local_time"); function gst_date_time_new (tzoffset : GLIB.gfloat; year : GLIB.gint; month : GLIB.gint; day : GLIB.gint; hour : GLIB.gint; minute : GLIB.gint; seconds : GLIB.gdouble) return System.Address; -- gst/gstdatetime.h:54 pragma Import (C, gst_date_time_new, "gst_date_time_new"); function gst_date_time_new_now_local_time return System.Address; -- gst/gstdatetime.h:59 pragma Import (C, gst_date_time_new_now_local_time, "gst_date_time_new_now_local_time"); function gst_date_time_new_now_utc return System.Address; -- gst/gstdatetime.h:60 pragma Import (C, gst_date_time_new_now_utc, "gst_date_time_new_now_utc"); function gst_date_time_ref (datetime : System.Address) return System.Address; -- gst/gstdatetime.h:62 pragma Import (C, gst_date_time_ref, "gst_date_time_ref"); procedure gst_date_time_unref (datetime : System.Address); -- gst/gstdatetime.h:63 pragma Import (C, gst_date_time_unref, "gst_date_time_unref"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstdatetime_h;
hannawaage/TTK4145_Exercises
Ada
3,641
adb
with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Numerics.Float_Random; use Ada.Text_IO, Ada.Integer_Text_IO, Ada.Numerics.Float_Random; procedure exercise7 is Count_Failed : exception; -- Exception to be raised when counting fails Gen : Generator; -- Random number generator protected type Transaction_Manager (N : Positive) is entry Finished; function Commit return Boolean; procedure Signal_Abort; private Finished_Gate_Open : Boolean := False; Aborted : Boolean := False; Should_Commit : Boolean := True; end Transaction_Manager; protected body Transaction_Manager is entry Finished when Finished_Gate_Open or Finished'Count = N is begin Should_Commit := not Aborted; if Finished'Count > 0 then Finished_Gate_Open := True; else Finished_Gate_Open := False; end if; if Finished'Count = 0 then Aborted := False; end if; ------------------------------------------ -- PART 3: Complete the exit protocol here ------------------------------------------ end Finished; procedure Signal_Abort is begin Aborted := True; end Signal_Abort; function Commit return Boolean is begin return Should_Commit; end Commit; end Transaction_Manager; function Unreliable_Slow_Add (x : Integer) return Integer is Error_Rate : Constant := 0.15; -- (between 0 and 1) rand_num : Standard.Float := Random(Gen); c : Float := 2.5; d : Float := c*rand_num; a : Integer := x; begin if Error_Rate < rand_num then delay Duration(d); a := x + 10; return a; else raise Count_Failed; end if; end Unreliable_Slow_Add; task type Transaction_Worker (Initial : Integer; Manager : access Transaction_Manager); task body Transaction_Worker is Num : Integer := Initial; Prev : Integer := Num; Round_Num : Integer := 0; begin Put_Line ("Worker" & Integer'Image(Initial) & " started"); loop Put_Line ("Worker" & Integer'Image(Initial) & " started round" & Integer'Image(Round_Num)); Round_Num := Round_Num + 1; begin Prev := Num; Num := Unreliable_Slow_Add(Num); exception when Count_Failed => Manager.Signal_Abort; end; Manager.Finished; if Manager.Commit = True then Put_Line (" Worker" & Integer'Image(Initial) & " comitting" & Integer'Image(Num)); else Put_Line (" Worker" & Integer'Image(Initial) & " reverting from" & Integer'Image(Num) & " to" & Integer'Image(Prev)); Num := Prev; ------------------------------------------- -- PART 2: Roll back to previous value here ------------------------------------------- end if; Prev := Num; delay 0.5; end loop; end Transaction_Worker; Manager : aliased Transaction_Manager (3); Worker_1 : Transaction_Worker (0, Manager'Access); Worker_2 : Transaction_Worker (1, Manager'Access); Worker_3 : Transaction_Worker (2, Manager'Access); begin Reset(Gen); -- Seed the random number generator end exercise7;
reznikmm/matreshka
Ada
3,429
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ package Generator.Constructors is procedure Generate_Constructors_Specification; procedure Generate_Constructors_Implementation; end Generator.Constructors;
burratoo/Acton
Ada
1,357
ads
------------------------------------------------------------------------------------------ -- -- -- OAK VIEWER -- -- -- -- CORTEX_TRACES.EXCEPTIONS -- -- -- -- Copyright (C) 2014-2021, Patrick Bernardi -- -- -- ------------------------------------------------------------------------------------------ with ISA.ARM.Cortex_M4.Exceptions; use ISA.ARM.Cortex_M4.Exceptions; with DWT_ITM_Packets; use DWT_ITM_Packets; package Cortex_Traces.Exceptions is type Exception_Event is new Cortex_Event with record Exception_Number : Exception_Id; Action : Exception_Action; end record; function Event_Constructor (Params : not null access Constructor_Parameters) return Exception_Event; overriding function Image (Event : Exception_Event) return String; end Cortex_Traces.Exceptions;
iyan22/AprendeAda
Ada
174
adb
with Datos; use Datos; procedure crear_lista_vacia( L : in out Lista) is -- pre: -- post: se ha creado una lista vacia begin L := null; end crear_lista_vacia;
gabrielhesposito/mlh-localhost-adacore
Ada
614
adb
package body Stack with SPARK_Mode => On is ----------- -- Clear -- ----------- procedure Clear is begin -- Last := Tab'First; Last := 0; end Clear; ---------- -- Push -- ---------- procedure Push (V : Character) is begin Last := Last + 1; Tab (Last) := V; end Push; --------- -- Pop -- --------- procedure Pop (V : out Character) is begin V := Tab (Last); Last := Last - 1; end Pop; --------- -- Top -- --------- function Top return Character is begin return Tab (Last); end Top; end Stack;
reznikmm/matreshka
Ada
3,828
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$ ------------------------------------------------------------------------------ with Matreshka.ODF_Attributes.Text.Style_Name; package ODF.DOM.Attributes.Text.Style_Name.Internals is function Create (Node : Matreshka.ODF_Attributes.Text.Style_Name.Text_Style_Name_Access) return ODF.DOM.Attributes.Text.Style_Name.ODF_Text_Style_Name; function Wrap (Node : Matreshka.ODF_Attributes.Text.Style_Name.Text_Style_Name_Access) return ODF.DOM.Attributes.Text.Style_Name.ODF_Text_Style_Name; end ODF.DOM.Attributes.Text.Style_Name.Internals;
Fabien-Chouteau/motherlode
Ada
2,329
adb
-- Motherlode -- Copyright (c) 2020 Fabien Chouteau with HAL; use HAL; with Pygamer; use Pygamer; with Pygamer.Screen; with Render; use Render; package body HUD is ---------------- -- Draw_Gauge -- ---------------- procedure Draw_Gauge (FB : in out HAL.UInt16_Array; Y : Natural; C : Character; Color : UInt16; Value, Max : Natural) is begin Draw_Char (FB, C, 0, Y); Draw_H_Line(FB, 9, Y + 1, Max + 1, Color); -- Top Draw_H_Line(FB, 9, Y + 6, Max + 1, Color); -- Bottom for H in Y + 2 .. Y + 5 loop Draw_H_Line(FB, 9, H, Value, Color); -- Content FB (9 + Max + 1 + H * Screen.Width) := Color; -- Right border of the box end loop; end Draw_Gauge; ---------- -- Draw -- ---------- procedure Draw (FB : in out Render.Frame_Buffer; Money, Fuel, Fuel_Max, Cargo, Cargo_Max : Natural; Depth, Cash_In : Integer) is Fuel_Color : constant UInt16 := RGB565 (204, 102, 0); Cargo_Color : constant UInt16 := RGB565 (0, 102, 204); begin Draw_Gauge (FB, 0, 'F', Fuel_Color, Fuel, Fuel_Max); Draw_Gauge (FB, 9, 'C', Cargo_Color, Cargo, Cargo_Max); if Cargo = Cargo_Max then Draw_String_Center (FB, "CARGO FULL", Screen.Width / 2, 90); end if; if Fuel = 0 then Draw_String_Center (FB, "LOW FUEL", Screen.Width / 2, 100); end if; declare Str : String := Money'Img; begin Str (Str'First) := '$'; Draw_String (FB, Str, Screen.Width - Str'Length * 8, 1); end; if Cash_In /= 0 then declare Str : String := Cash_In'Img; begin if Cash_In > 0 then Str (Str'First) := '+'; end if; Draw_String (FB, Str, Screen.Width - Str'Length * 8, 9); end; end if; declare Str : constant String := Depth'Img; begin Draw_String (FB, Str, Screen.Width - Str'Length * 8, Screen.Height - 9); end; end Draw; end HUD;
micahwelf/FLTK-Ada
Ada
895
ads
package FLTK.Widgets.Valuators.Sliders.Hor_Nice is type Hor_Nice_Slider is new Slider with private; type Hor_Nice_Slider_Reference (Data : not null access Hor_Nice_Slider'Class) is limited null record with Implicit_Dereference => Data; package Forge is function Create (X, Y, W, H : in Integer; Text : in String) return Hor_Nice_Slider; end Forge; procedure Draw (This : in out Hor_Nice_Slider); function Handle (This : in out Hor_Nice_Slider; Event : in Event_Kind) return Event_Outcome; private type Hor_Nice_Slider is new Slider with null record; overriding procedure Finalize (This : in out Hor_Nice_Slider); pragma Inline (Draw); pragma Inline (Handle); end FLTK.Widgets.Valuators.Sliders.Hor_Nice;
charlie5/cBound
Ada
1,485
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_ungrab_server_request_t is -- Item -- type Item is record major_opcode : aliased Interfaces.Unsigned_8; pad0 : aliased Interfaces.Unsigned_8; length : aliased Interfaces.Unsigned_16; end record; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_ungrab_server_request_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_ungrab_server_request_t.Item, Element_Array => xcb.xcb_ungrab_server_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_ungrab_server_request_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_ungrab_server_request_t.Pointer, Element_Array => xcb.xcb_ungrab_server_request_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_ungrab_server_request_t;
reznikmm/matreshka
Ada
3,794
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.Chart_Link_Data_Style_To_Source_Attributes is pragma Preelaborate; type ODF_Chart_Link_Data_Style_To_Source_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Chart_Link_Data_Style_To_Source_Attribute_Access is access all ODF_Chart_Link_Data_Style_To_Source_Attribute'Class with Storage_Size => 0; end ODF.DOM.Chart_Link_Data_Style_To_Source_Attributes;
egustafson/sandbox
Ada
608
adb
with TEXT_IO; use TEXT_IO; procedure HW is task HELLO; task WORLD is entry PRINT_NOW; end WORLD; -- -- -- End of type declairations. -- -- -- task body HELLO is begin PUT("Hello, "); WORLD.PRINT_NOW; end HELLO; task body WORLD is begin accept PRINT_NOW; PUT("World"); NEW_LINE; end WORLD; -- The tasks become active as soon as the procedure under which -- their scope falls becomes active. (i.e. when procedure HW -- becomes active then it's tasks are started. begin -- HW (Hello World) null; end HW;
ekoeppen/STM32_Generic_Ada_Drivers
Ada
42,419
ads
pragma Style_Checks (Off); -- This spec has been automatically generated from STM32L0x3.svd pragma Restrictions (No_Elaboration_Code); with System; package STM32_SVD.TSC is pragma Preelaborate; --------------- -- Registers -- --------------- subtype CR_TSCE_Field is STM32_SVD.Bit; subtype CR_START_Field is STM32_SVD.Bit; subtype CR_AM_Field is STM32_SVD.Bit; subtype CR_SYNCPOL_Field is STM32_SVD.Bit; subtype CR_IODEF_Field is STM32_SVD.Bit; subtype CR_MCV_Field is STM32_SVD.UInt3; subtype CR_PGPSC_Field is STM32_SVD.UInt3; subtype CR_SSPSC_Field is STM32_SVD.Bit; subtype CR_SSE_Field is STM32_SVD.Bit; subtype CR_SSD_Field is STM32_SVD.UInt7; subtype CR_CTPL_Field is STM32_SVD.UInt4; subtype CR_CTPH_Field is STM32_SVD.UInt4; -- control register type CR_Register is record -- Touch sensing controller enable TSCE : CR_TSCE_Field := 16#0#; -- Start a new acquisition START : CR_START_Field := 16#0#; -- Acquisition mode AM : CR_AM_Field := 16#0#; -- Synchronization pin polarity SYNCPOL : CR_SYNCPOL_Field := 16#0#; -- I/O Default mode IODEF : CR_IODEF_Field := 16#0#; -- Max count value MCV : CR_MCV_Field := 16#0#; -- unspecified Reserved_8_11 : STM32_SVD.UInt4 := 16#0#; -- pulse generator prescaler PGPSC : CR_PGPSC_Field := 16#0#; -- Spread spectrum prescaler SSPSC : CR_SSPSC_Field := 16#0#; -- Spread spectrum enable SSE : CR_SSE_Field := 16#0#; -- Spread spectrum deviation SSD : CR_SSD_Field := 16#0#; -- Charge transfer pulse low CTPL : CR_CTPL_Field := 16#0#; -- Charge transfer pulse high CTPH : CR_CTPH_Field := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CR_Register use record TSCE at 0 range 0 .. 0; START at 0 range 1 .. 1; AM at 0 range 2 .. 2; SYNCPOL at 0 range 3 .. 3; IODEF at 0 range 4 .. 4; MCV at 0 range 5 .. 7; Reserved_8_11 at 0 range 8 .. 11; PGPSC at 0 range 12 .. 14; SSPSC at 0 range 15 .. 15; SSE at 0 range 16 .. 16; SSD at 0 range 17 .. 23; CTPL at 0 range 24 .. 27; CTPH at 0 range 28 .. 31; end record; subtype IER_EOAIE_Field is STM32_SVD.Bit; subtype IER_MCEIE_Field is STM32_SVD.Bit; -- interrupt enable register type IER_Register is record -- End of acquisition interrupt enable EOAIE : IER_EOAIE_Field := 16#0#; -- Max count error interrupt enable MCEIE : IER_MCEIE_Field := 16#0#; -- unspecified Reserved_2_31 : STM32_SVD.UInt30 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for IER_Register use record EOAIE at 0 range 0 .. 0; MCEIE at 0 range 1 .. 1; Reserved_2_31 at 0 range 2 .. 31; end record; subtype ICR_EOAIC_Field is STM32_SVD.Bit; subtype ICR_MCEIC_Field is STM32_SVD.Bit; -- interrupt clear register type ICR_Register is record -- End of acquisition interrupt clear EOAIC : ICR_EOAIC_Field := 16#0#; -- Max count error interrupt clear MCEIC : ICR_MCEIC_Field := 16#0#; -- unspecified Reserved_2_31 : STM32_SVD.UInt30 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for ICR_Register use record EOAIC at 0 range 0 .. 0; MCEIC at 0 range 1 .. 1; Reserved_2_31 at 0 range 2 .. 31; end record; subtype ISR_EOAF_Field is STM32_SVD.Bit; subtype ISR_MCEF_Field is STM32_SVD.Bit; -- interrupt status register type ISR_Register is record -- End of acquisition flag EOAF : ISR_EOAF_Field := 16#0#; -- Max count error flag MCEF : ISR_MCEF_Field := 16#0#; -- unspecified Reserved_2_31 : STM32_SVD.UInt30 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for ISR_Register use record EOAF at 0 range 0 .. 0; MCEF at 0 range 1 .. 1; Reserved_2_31 at 0 range 2 .. 31; end record; -- IOHCR_G1_IO array element subtype IOHCR_G1_IO_Element is STM32_SVD.Bit; -- IOHCR_G1_IO array type IOHCR_G1_IO_Field_Array is array (1 .. 4) of IOHCR_G1_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOHCR_G1_IO type IOHCR_G1_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G1_IO as a value Val : STM32_SVD.UInt4; when True => -- G1_IO as an array Arr : IOHCR_G1_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOHCR_G1_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOHCR_G2_IO array element subtype IOHCR_G2_IO_Element is STM32_SVD.Bit; -- IOHCR_G2_IO array type IOHCR_G2_IO_Field_Array is array (1 .. 4) of IOHCR_G2_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOHCR_G2_IO type IOHCR_G2_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G2_IO as a value Val : STM32_SVD.UInt4; when True => -- G2_IO as an array Arr : IOHCR_G2_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOHCR_G2_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOHCR_G3_IO array element subtype IOHCR_G3_IO_Element is STM32_SVD.Bit; -- IOHCR_G3_IO array type IOHCR_G3_IO_Field_Array is array (1 .. 4) of IOHCR_G3_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOHCR_G3_IO type IOHCR_G3_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G3_IO as a value Val : STM32_SVD.UInt4; when True => -- G3_IO as an array Arr : IOHCR_G3_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOHCR_G3_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOHCR_G4_IO array element subtype IOHCR_G4_IO_Element is STM32_SVD.Bit; -- IOHCR_G4_IO array type IOHCR_G4_IO_Field_Array is array (1 .. 4) of IOHCR_G4_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOHCR_G4_IO type IOHCR_G4_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G4_IO as a value Val : STM32_SVD.UInt4; when True => -- G4_IO as an array Arr : IOHCR_G4_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOHCR_G4_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOHCR_G5_IO array element subtype IOHCR_G5_IO_Element is STM32_SVD.Bit; -- IOHCR_G5_IO array type IOHCR_G5_IO_Field_Array is array (1 .. 4) of IOHCR_G5_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOHCR_G5_IO type IOHCR_G5_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G5_IO as a value Val : STM32_SVD.UInt4; when True => -- G5_IO as an array Arr : IOHCR_G5_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOHCR_G5_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOHCR_G6_IO array element subtype IOHCR_G6_IO_Element is STM32_SVD.Bit; -- IOHCR_G6_IO array type IOHCR_G6_IO_Field_Array is array (1 .. 4) of IOHCR_G6_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOHCR_G6_IO type IOHCR_G6_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G6_IO as a value Val : STM32_SVD.UInt4; when True => -- G6_IO as an array Arr : IOHCR_G6_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOHCR_G6_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOHCR_G7_IO array element subtype IOHCR_G7_IO_Element is STM32_SVD.Bit; -- IOHCR_G7_IO array type IOHCR_G7_IO_Field_Array is array (1 .. 4) of IOHCR_G7_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOHCR_G7_IO type IOHCR_G7_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G7_IO as a value Val : STM32_SVD.UInt4; when True => -- G7_IO as an array Arr : IOHCR_G7_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOHCR_G7_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOHCR_G8_IO array element subtype IOHCR_G8_IO_Element is STM32_SVD.Bit; -- IOHCR_G8_IO array type IOHCR_G8_IO_Field_Array is array (1 .. 4) of IOHCR_G8_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOHCR_G8_IO type IOHCR_G8_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G8_IO as a value Val : STM32_SVD.UInt4; when True => -- G8_IO as an array Arr : IOHCR_G8_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOHCR_G8_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- I/O hysteresis control register type IOHCR_Register is record -- G1_IO1 G1_IO : IOHCR_G1_IO_Field := (As_Array => False, Val => 16#1#); -- G2_IO1 G2_IO : IOHCR_G2_IO_Field := (As_Array => False, Val => 16#1#); -- G3_IO1 G3_IO : IOHCR_G3_IO_Field := (As_Array => False, Val => 16#1#); -- G4_IO1 G4_IO : IOHCR_G4_IO_Field := (As_Array => False, Val => 16#1#); -- G5_IO1 G5_IO : IOHCR_G5_IO_Field := (As_Array => False, Val => 16#1#); -- G6_IO1 G6_IO : IOHCR_G6_IO_Field := (As_Array => False, Val => 16#1#); -- G7_IO1 G7_IO : IOHCR_G7_IO_Field := (As_Array => False, Val => 16#1#); -- G8_IO1 G8_IO : IOHCR_G8_IO_Field := (As_Array => False, Val => 16#1#); end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for IOHCR_Register use record G1_IO at 0 range 0 .. 3; G2_IO at 0 range 4 .. 7; G3_IO at 0 range 8 .. 11; G4_IO at 0 range 12 .. 15; G5_IO at 0 range 16 .. 19; G6_IO at 0 range 20 .. 23; G7_IO at 0 range 24 .. 27; G8_IO at 0 range 28 .. 31; end record; -- IOASCR_G1_IO array element subtype IOASCR_G1_IO_Element is STM32_SVD.Bit; -- IOASCR_G1_IO array type IOASCR_G1_IO_Field_Array is array (1 .. 4) of IOASCR_G1_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOASCR_G1_IO type IOASCR_G1_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G1_IO as a value Val : STM32_SVD.UInt4; when True => -- G1_IO as an array Arr : IOASCR_G1_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOASCR_G1_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOASCR_G2_IO array element subtype IOASCR_G2_IO_Element is STM32_SVD.Bit; -- IOASCR_G2_IO array type IOASCR_G2_IO_Field_Array is array (1 .. 4) of IOASCR_G2_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOASCR_G2_IO type IOASCR_G2_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G2_IO as a value Val : STM32_SVD.UInt4; when True => -- G2_IO as an array Arr : IOASCR_G2_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOASCR_G2_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOASCR_G3_IO array element subtype IOASCR_G3_IO_Element is STM32_SVD.Bit; -- IOASCR_G3_IO array type IOASCR_G3_IO_Field_Array is array (1 .. 4) of IOASCR_G3_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOASCR_G3_IO type IOASCR_G3_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G3_IO as a value Val : STM32_SVD.UInt4; when True => -- G3_IO as an array Arr : IOASCR_G3_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOASCR_G3_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOASCR_G4_IO array element subtype IOASCR_G4_IO_Element is STM32_SVD.Bit; -- IOASCR_G4_IO array type IOASCR_G4_IO_Field_Array is array (1 .. 4) of IOASCR_G4_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOASCR_G4_IO type IOASCR_G4_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G4_IO as a value Val : STM32_SVD.UInt4; when True => -- G4_IO as an array Arr : IOASCR_G4_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOASCR_G4_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOASCR_G5_IO array element subtype IOASCR_G5_IO_Element is STM32_SVD.Bit; -- IOASCR_G5_IO array type IOASCR_G5_IO_Field_Array is array (1 .. 4) of IOASCR_G5_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOASCR_G5_IO type IOASCR_G5_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G5_IO as a value Val : STM32_SVD.UInt4; when True => -- G5_IO as an array Arr : IOASCR_G5_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOASCR_G5_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOASCR_G6_IO array element subtype IOASCR_G6_IO_Element is STM32_SVD.Bit; -- IOASCR_G6_IO array type IOASCR_G6_IO_Field_Array is array (1 .. 4) of IOASCR_G6_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOASCR_G6_IO type IOASCR_G6_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G6_IO as a value Val : STM32_SVD.UInt4; when True => -- G6_IO as an array Arr : IOASCR_G6_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOASCR_G6_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOASCR_G7_IO array element subtype IOASCR_G7_IO_Element is STM32_SVD.Bit; -- IOASCR_G7_IO array type IOASCR_G7_IO_Field_Array is array (1 .. 4) of IOASCR_G7_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOASCR_G7_IO type IOASCR_G7_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G7_IO as a value Val : STM32_SVD.UInt4; when True => -- G7_IO as an array Arr : IOASCR_G7_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOASCR_G7_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOASCR_G8_IO array element subtype IOASCR_G8_IO_Element is STM32_SVD.Bit; -- IOASCR_G8_IO array type IOASCR_G8_IO_Field_Array is array (1 .. 4) of IOASCR_G8_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOASCR_G8_IO type IOASCR_G8_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G8_IO as a value Val : STM32_SVD.UInt4; when True => -- G8_IO as an array Arr : IOASCR_G8_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOASCR_G8_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- I/O analog switch control register type IOASCR_Register is record -- G1_IO1 G1_IO : IOASCR_G1_IO_Field := (As_Array => False, Val => 16#0#); -- G2_IO1 G2_IO : IOASCR_G2_IO_Field := (As_Array => False, Val => 16#0#); -- G3_IO1 G3_IO : IOASCR_G3_IO_Field := (As_Array => False, Val => 16#0#); -- G4_IO1 G4_IO : IOASCR_G4_IO_Field := (As_Array => False, Val => 16#0#); -- G5_IO1 G5_IO : IOASCR_G5_IO_Field := (As_Array => False, Val => 16#0#); -- G6_IO1 G6_IO : IOASCR_G6_IO_Field := (As_Array => False, Val => 16#0#); -- G7_IO1 G7_IO : IOASCR_G7_IO_Field := (As_Array => False, Val => 16#0#); -- G8_IO1 G8_IO : IOASCR_G8_IO_Field := (As_Array => False, Val => 16#0#); end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for IOASCR_Register use record G1_IO at 0 range 0 .. 3; G2_IO at 0 range 4 .. 7; G3_IO at 0 range 8 .. 11; G4_IO at 0 range 12 .. 15; G5_IO at 0 range 16 .. 19; G6_IO at 0 range 20 .. 23; G7_IO at 0 range 24 .. 27; G8_IO at 0 range 28 .. 31; end record; -- IOSCR_G1_IO array element subtype IOSCR_G1_IO_Element is STM32_SVD.Bit; -- IOSCR_G1_IO array type IOSCR_G1_IO_Field_Array is array (1 .. 4) of IOSCR_G1_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOSCR_G1_IO type IOSCR_G1_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G1_IO as a value Val : STM32_SVD.UInt4; when True => -- G1_IO as an array Arr : IOSCR_G1_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOSCR_G1_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOSCR_G2_IO array element subtype IOSCR_G2_IO_Element is STM32_SVD.Bit; -- IOSCR_G2_IO array type IOSCR_G2_IO_Field_Array is array (1 .. 4) of IOSCR_G2_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOSCR_G2_IO type IOSCR_G2_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G2_IO as a value Val : STM32_SVD.UInt4; when True => -- G2_IO as an array Arr : IOSCR_G2_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOSCR_G2_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOSCR_G3_IO array element subtype IOSCR_G3_IO_Element is STM32_SVD.Bit; -- IOSCR_G3_IO array type IOSCR_G3_IO_Field_Array is array (1 .. 4) of IOSCR_G3_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOSCR_G3_IO type IOSCR_G3_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G3_IO as a value Val : STM32_SVD.UInt4; when True => -- G3_IO as an array Arr : IOSCR_G3_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOSCR_G3_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOSCR_G4_IO array element subtype IOSCR_G4_IO_Element is STM32_SVD.Bit; -- IOSCR_G4_IO array type IOSCR_G4_IO_Field_Array is array (1 .. 4) of IOSCR_G4_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOSCR_G4_IO type IOSCR_G4_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G4_IO as a value Val : STM32_SVD.UInt4; when True => -- G4_IO as an array Arr : IOSCR_G4_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOSCR_G4_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOSCR_G5_IO array element subtype IOSCR_G5_IO_Element is STM32_SVD.Bit; -- IOSCR_G5_IO array type IOSCR_G5_IO_Field_Array is array (1 .. 4) of IOSCR_G5_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOSCR_G5_IO type IOSCR_G5_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G5_IO as a value Val : STM32_SVD.UInt4; when True => -- G5_IO as an array Arr : IOSCR_G5_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOSCR_G5_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOSCR_G6_IO array element subtype IOSCR_G6_IO_Element is STM32_SVD.Bit; -- IOSCR_G6_IO array type IOSCR_G6_IO_Field_Array is array (1 .. 4) of IOSCR_G6_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOSCR_G6_IO type IOSCR_G6_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G6_IO as a value Val : STM32_SVD.UInt4; when True => -- G6_IO as an array Arr : IOSCR_G6_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOSCR_G6_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOSCR_G7_IO array element subtype IOSCR_G7_IO_Element is STM32_SVD.Bit; -- IOSCR_G7_IO array type IOSCR_G7_IO_Field_Array is array (1 .. 4) of IOSCR_G7_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOSCR_G7_IO type IOSCR_G7_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G7_IO as a value Val : STM32_SVD.UInt4; when True => -- G7_IO as an array Arr : IOSCR_G7_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOSCR_G7_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOSCR_G8_IO array element subtype IOSCR_G8_IO_Element is STM32_SVD.Bit; -- IOSCR_G8_IO array type IOSCR_G8_IO_Field_Array is array (1 .. 4) of IOSCR_G8_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOSCR_G8_IO type IOSCR_G8_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G8_IO as a value Val : STM32_SVD.UInt4; when True => -- G8_IO as an array Arr : IOSCR_G8_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOSCR_G8_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- I/O sampling control register type IOSCR_Register is record -- G1_IO1 G1_IO : IOSCR_G1_IO_Field := (As_Array => False, Val => 16#0#); -- G2_IO1 G2_IO : IOSCR_G2_IO_Field := (As_Array => False, Val => 16#0#); -- G3_IO1 G3_IO : IOSCR_G3_IO_Field := (As_Array => False, Val => 16#0#); -- G4_IO1 G4_IO : IOSCR_G4_IO_Field := (As_Array => False, Val => 16#0#); -- G5_IO1 G5_IO : IOSCR_G5_IO_Field := (As_Array => False, Val => 16#0#); -- G6_IO1 G6_IO : IOSCR_G6_IO_Field := (As_Array => False, Val => 16#0#); -- G7_IO1 G7_IO : IOSCR_G7_IO_Field := (As_Array => False, Val => 16#0#); -- G8_IO1 G8_IO : IOSCR_G8_IO_Field := (As_Array => False, Val => 16#0#); end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for IOSCR_Register use record G1_IO at 0 range 0 .. 3; G2_IO at 0 range 4 .. 7; G3_IO at 0 range 8 .. 11; G4_IO at 0 range 12 .. 15; G5_IO at 0 range 16 .. 19; G6_IO at 0 range 20 .. 23; G7_IO at 0 range 24 .. 27; G8_IO at 0 range 28 .. 31; end record; -- IOCCR_G1_IO array element subtype IOCCR_G1_IO_Element is STM32_SVD.Bit; -- IOCCR_G1_IO array type IOCCR_G1_IO_Field_Array is array (1 .. 4) of IOCCR_G1_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOCCR_G1_IO type IOCCR_G1_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G1_IO as a value Val : STM32_SVD.UInt4; when True => -- G1_IO as an array Arr : IOCCR_G1_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOCCR_G1_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOCCR_G2_IO array element subtype IOCCR_G2_IO_Element is STM32_SVD.Bit; -- IOCCR_G2_IO array type IOCCR_G2_IO_Field_Array is array (1 .. 4) of IOCCR_G2_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOCCR_G2_IO type IOCCR_G2_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G2_IO as a value Val : STM32_SVD.UInt4; when True => -- G2_IO as an array Arr : IOCCR_G2_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOCCR_G2_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOCCR_G3_IO array element subtype IOCCR_G3_IO_Element is STM32_SVD.Bit; -- IOCCR_G3_IO array type IOCCR_G3_IO_Field_Array is array (1 .. 4) of IOCCR_G3_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOCCR_G3_IO type IOCCR_G3_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G3_IO as a value Val : STM32_SVD.UInt4; when True => -- G3_IO as an array Arr : IOCCR_G3_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOCCR_G3_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOCCR_G4_IO array element subtype IOCCR_G4_IO_Element is STM32_SVD.Bit; -- IOCCR_G4_IO array type IOCCR_G4_IO_Field_Array is array (1 .. 4) of IOCCR_G4_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOCCR_G4_IO type IOCCR_G4_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G4_IO as a value Val : STM32_SVD.UInt4; when True => -- G4_IO as an array Arr : IOCCR_G4_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOCCR_G4_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOCCR_G5_IO array element subtype IOCCR_G5_IO_Element is STM32_SVD.Bit; -- IOCCR_G5_IO array type IOCCR_G5_IO_Field_Array is array (1 .. 4) of IOCCR_G5_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOCCR_G5_IO type IOCCR_G5_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G5_IO as a value Val : STM32_SVD.UInt4; when True => -- G5_IO as an array Arr : IOCCR_G5_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOCCR_G5_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOCCR_G6_IO array element subtype IOCCR_G6_IO_Element is STM32_SVD.Bit; -- IOCCR_G6_IO array type IOCCR_G6_IO_Field_Array is array (1 .. 4) of IOCCR_G6_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOCCR_G6_IO type IOCCR_G6_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G6_IO as a value Val : STM32_SVD.UInt4; when True => -- G6_IO as an array Arr : IOCCR_G6_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOCCR_G6_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOCCR_G7_IO array element subtype IOCCR_G7_IO_Element is STM32_SVD.Bit; -- IOCCR_G7_IO array type IOCCR_G7_IO_Field_Array is array (1 .. 4) of IOCCR_G7_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOCCR_G7_IO type IOCCR_G7_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G7_IO as a value Val : STM32_SVD.UInt4; when True => -- G7_IO as an array Arr : IOCCR_G7_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOCCR_G7_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- IOCCR_G8_IO array element subtype IOCCR_G8_IO_Element is STM32_SVD.Bit; -- IOCCR_G8_IO array type IOCCR_G8_IO_Field_Array is array (1 .. 4) of IOCCR_G8_IO_Element with Component_Size => 1, Size => 4; -- Type definition for IOCCR_G8_IO type IOCCR_G8_IO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- G8_IO as a value Val : STM32_SVD.UInt4; when True => -- G8_IO as an array Arr : IOCCR_G8_IO_Field_Array; end case; end record with Unchecked_Union, Size => 4; for IOCCR_G8_IO_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- I/O channel control register type IOCCR_Register is record -- G1_IO1 G1_IO : IOCCR_G1_IO_Field := (As_Array => False, Val => 16#0#); -- G2_IO1 G2_IO : IOCCR_G2_IO_Field := (As_Array => False, Val => 16#0#); -- G3_IO1 G3_IO : IOCCR_G3_IO_Field := (As_Array => False, Val => 16#0#); -- G4_IO1 G4_IO : IOCCR_G4_IO_Field := (As_Array => False, Val => 16#0#); -- G5_IO1 G5_IO : IOCCR_G5_IO_Field := (As_Array => False, Val => 16#0#); -- G6_IO1 G6_IO : IOCCR_G6_IO_Field := (As_Array => False, Val => 16#0#); -- G7_IO1 G7_IO : IOCCR_G7_IO_Field := (As_Array => False, Val => 16#0#); -- G8_IO1 G8_IO : IOCCR_G8_IO_Field := (As_Array => False, Val => 16#0#); end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for IOCCR_Register use record G1_IO at 0 range 0 .. 3; G2_IO at 0 range 4 .. 7; G3_IO at 0 range 8 .. 11; G4_IO at 0 range 12 .. 15; G5_IO at 0 range 16 .. 19; G6_IO at 0 range 20 .. 23; G7_IO at 0 range 24 .. 27; G8_IO at 0 range 28 .. 31; end record; subtype IOGCSR_G1E_Field is STM32_SVD.Bit; subtype IOGCSR_G2E_Field is STM32_SVD.Bit; subtype IOGCSR_G3E_Field is STM32_SVD.Bit; subtype IOGCSR_G4E_Field is STM32_SVD.Bit; subtype IOGCSR_G5E_Field is STM32_SVD.Bit; subtype IOGCSR_G6E_Field is STM32_SVD.Bit; subtype IOGCSR_G7E_Field is STM32_SVD.Bit; subtype IOGCSR_G8E_Field is STM32_SVD.Bit; subtype IOGCSR_G1S_Field is STM32_SVD.Bit; subtype IOGCSR_G2S_Field is STM32_SVD.Bit; subtype IOGCSR_G3S_Field is STM32_SVD.Bit; subtype IOGCSR_G4S_Field is STM32_SVD.Bit; subtype IOGCSR_G5S_Field is STM32_SVD.Bit; subtype IOGCSR_G6S_Field is STM32_SVD.Bit; subtype IOGCSR_G7S_Field is STM32_SVD.Bit; subtype IOGCSR_G8S_Field is STM32_SVD.Bit; -- I/O group control status register type IOGCSR_Register is record -- Analog I/O group x enable G1E : IOGCSR_G1E_Field := 16#0#; -- Analog I/O group x enable G2E : IOGCSR_G2E_Field := 16#0#; -- Analog I/O group x enable G3E : IOGCSR_G3E_Field := 16#0#; -- Analog I/O group x enable G4E : IOGCSR_G4E_Field := 16#0#; -- Analog I/O group x enable G5E : IOGCSR_G5E_Field := 16#0#; -- Analog I/O group x enable G6E : IOGCSR_G6E_Field := 16#0#; -- Analog I/O group x enable G7E : IOGCSR_G7E_Field := 16#0#; -- Analog I/O group x enable G8E : IOGCSR_G8E_Field := 16#0#; -- unspecified Reserved_8_15 : STM32_SVD.Byte := 16#0#; -- Read-only. Analog I/O group x status G1S : IOGCSR_G1S_Field := 16#0#; -- Read-only. Analog I/O group x status G2S : IOGCSR_G2S_Field := 16#0#; -- Read-only. Analog I/O group x status G3S : IOGCSR_G3S_Field := 16#0#; -- Read-only. Analog I/O group x status G4S : IOGCSR_G4S_Field := 16#0#; -- Read-only. Analog I/O group x status G5S : IOGCSR_G5S_Field := 16#0#; -- Read-only. Analog I/O group x status G6S : IOGCSR_G6S_Field := 16#0#; -- Read-only. Analog I/O group x status G7S : IOGCSR_G7S_Field := 16#0#; -- Read-only. Analog I/O group x status G8S : IOGCSR_G8S_Field := 16#0#; -- unspecified Reserved_24_31 : STM32_SVD.Byte := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for IOGCSR_Register use record G1E at 0 range 0 .. 0; G2E at 0 range 1 .. 1; G3E at 0 range 2 .. 2; G4E at 0 range 3 .. 3; G5E at 0 range 4 .. 4; G6E at 0 range 5 .. 5; G7E at 0 range 6 .. 6; G8E at 0 range 7 .. 7; Reserved_8_15 at 0 range 8 .. 15; G1S at 0 range 16 .. 16; G2S at 0 range 17 .. 17; G3S at 0 range 18 .. 18; G4S at 0 range 19 .. 19; G5S at 0 range 20 .. 20; G6S at 0 range 21 .. 21; G7S at 0 range 22 .. 22; G8S at 0 range 23 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype IOG1CR_CNT_Field is STM32_SVD.UInt14; -- I/O group x counter register type IOG1CR_Register is record -- Read-only. Counter value CNT : IOG1CR_CNT_Field; -- unspecified Reserved_14_31 : STM32_SVD.UInt18; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for IOG1CR_Register use record CNT at 0 range 0 .. 13; Reserved_14_31 at 0 range 14 .. 31; end record; subtype IOG2CR_CNT_Field is STM32_SVD.UInt14; -- I/O group x counter register type IOG2CR_Register is record -- Read-only. Counter value CNT : IOG2CR_CNT_Field; -- unspecified Reserved_14_31 : STM32_SVD.UInt18; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for IOG2CR_Register use record CNT at 0 range 0 .. 13; Reserved_14_31 at 0 range 14 .. 31; end record; subtype IOG3CR_CNT_Field is STM32_SVD.UInt14; -- I/O group x counter register type IOG3CR_Register is record -- Read-only. Counter value CNT : IOG3CR_CNT_Field; -- unspecified Reserved_14_31 : STM32_SVD.UInt18; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for IOG3CR_Register use record CNT at 0 range 0 .. 13; Reserved_14_31 at 0 range 14 .. 31; end record; subtype IOG4CR_CNT_Field is STM32_SVD.UInt14; -- I/O group x counter register type IOG4CR_Register is record -- Read-only. Counter value CNT : IOG4CR_CNT_Field; -- unspecified Reserved_14_31 : STM32_SVD.UInt18; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for IOG4CR_Register use record CNT at 0 range 0 .. 13; Reserved_14_31 at 0 range 14 .. 31; end record; subtype IOG5CR_CNT_Field is STM32_SVD.UInt14; -- I/O group x counter register type IOG5CR_Register is record -- Read-only. Counter value CNT : IOG5CR_CNT_Field; -- unspecified Reserved_14_31 : STM32_SVD.UInt18; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for IOG5CR_Register use record CNT at 0 range 0 .. 13; Reserved_14_31 at 0 range 14 .. 31; end record; subtype IOG6CR_CNT_Field is STM32_SVD.UInt14; -- I/O group x counter register type IOG6CR_Register is record -- Read-only. Counter value CNT : IOG6CR_CNT_Field; -- unspecified Reserved_14_31 : STM32_SVD.UInt18; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for IOG6CR_Register use record CNT at 0 range 0 .. 13; Reserved_14_31 at 0 range 14 .. 31; end record; subtype IOG7CR_CNT_Field is STM32_SVD.UInt14; -- I/O group x counter register type IOG7CR_Register is record -- Read-only. Counter value CNT : IOG7CR_CNT_Field; -- unspecified Reserved_14_31 : STM32_SVD.UInt18; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for IOG7CR_Register use record CNT at 0 range 0 .. 13; Reserved_14_31 at 0 range 14 .. 31; end record; subtype IOG8CR_CNT_Field is STM32_SVD.UInt14; -- I/O group x counter register type IOG8CR_Register is record -- Read-only. Counter value CNT : IOG8CR_CNT_Field; -- unspecified Reserved_14_31 : STM32_SVD.UInt18; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for IOG8CR_Register use record CNT at 0 range 0 .. 13; Reserved_14_31 at 0 range 14 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Touch sensing controller type TSC_Peripheral is record -- control register CR : aliased CR_Register; -- interrupt enable register IER : aliased IER_Register; -- interrupt clear register ICR : aliased ICR_Register; -- interrupt status register ISR : aliased ISR_Register; -- I/O hysteresis control register IOHCR : aliased IOHCR_Register; -- I/O analog switch control register IOASCR : aliased IOASCR_Register; -- I/O sampling control register IOSCR : aliased IOSCR_Register; -- I/O channel control register IOCCR : aliased IOCCR_Register; -- I/O group control status register IOGCSR : aliased IOGCSR_Register; -- I/O group x counter register IOG1CR : aliased IOG1CR_Register; -- I/O group x counter register IOG2CR : aliased IOG2CR_Register; -- I/O group x counter register IOG3CR : aliased IOG3CR_Register; -- I/O group x counter register IOG4CR : aliased IOG4CR_Register; -- I/O group x counter register IOG5CR : aliased IOG5CR_Register; -- I/O group x counter register IOG6CR : aliased IOG6CR_Register; -- I/O group x counter register IOG7CR : aliased IOG7CR_Register; -- I/O group x counter register IOG8CR : aliased IOG8CR_Register; end record with Volatile; for TSC_Peripheral use record CR at 16#0# range 0 .. 31; IER at 16#4# range 0 .. 31; ICR at 16#8# range 0 .. 31; ISR at 16#C# range 0 .. 31; IOHCR at 16#10# range 0 .. 31; IOASCR at 16#18# range 0 .. 31; IOSCR at 16#20# range 0 .. 31; IOCCR at 16#28# range 0 .. 31; IOGCSR at 16#30# range 0 .. 31; IOG1CR at 16#34# range 0 .. 31; IOG2CR at 16#38# range 0 .. 31; IOG3CR at 16#3C# range 0 .. 31; IOG4CR at 16#40# range 0 .. 31; IOG5CR at 16#44# range 0 .. 31; IOG6CR at 16#48# range 0 .. 31; IOG7CR at 16#4C# range 0 .. 31; IOG8CR at 16#50# range 0 .. 31; end record; -- Touch sensing controller TSC_Periph : aliased TSC_Peripheral with Import, Address => TSC_Base; end STM32_SVD.TSC;
reznikmm/matreshka
Ada
4,639
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_Smil.RestartDefault_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Smil_RestartDefault_Attribute_Node is begin return Self : Smil_RestartDefault_Attribute_Node do Matreshka.ODF_Smil.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Smil_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Smil_RestartDefault_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.RestartDefault_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Smil_URI, Matreshka.ODF_String_Constants.RestartDefault_Attribute, Smil_RestartDefault_Attribute_Node'Tag); end Matreshka.ODF_Smil.RestartDefault_Attributes;
zhmu/ananas
Ada
322
adb
-- { dg-do run } -- { dg-options "-gnatws" } procedure fixce is type D is delta 128.0 / (2 ** 15) range 0.0 .. 256.0; type R is range 0 .. 200; dd : D; RA : constant array (1 .. 3) of R := (127, 128, 200); begin dd := D (RA (2)); for i in RA'range loop dd := D (RA (i)); end loop; end fixce;
AdaCore/training_material
Ada
3,103
ads
----------------------------------------------------------------------- -- Ada Labs -- -- -- -- Copyright (C) 2008-2009, AdaCore -- -- -- -- Labs is free software; you can redistribute it and/or modify it -- -- under the terms of the GNU General Public License as published by -- -- the Free Software Foundation; either version 2 of the License, or -- -- (at your option) any later version. -- -- -- -- This 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, write to the Free Software Foundation, Inc., 59 Temple -- -- Place - Suite 330, Boston, MA 02111-1307, USA. -- ----------------------------------------------------------------------- with Display; use Display; with Display.Basic; use Display.Basic; package Solar_System is -- define type Bodies_Enum as an enumeration of Sun, Earth, Moon, Satellite type Bodies_Enum is (Sun, Earth, Moon, Satellite, Comet, Black_Hole, Asteroid_1, Asteroid_2); procedure Init_Body (B : Bodies_Enum; Radius : Float; Color : RGBA_T; Distance : Float; Speed : Float; Turns_Around : Bodies_Enum; Angle : Float := 0.0; Tail : Boolean := False; Visible : Boolean := True); private type Position is record X : Float := 0.0; Y : Float := 0.0; end record; type Tail_Length is new Integer range 1 .. 10; type T_Tail is array (Tail_Length) of Position; type Body_Type is record Pos : Position; Distance : Float; Speed : Float; Angle : Float; Radius : Float; Color : RGBA_T; Visible : Boolean := True; Turns_Around : Bodies_Enum; With_Tail : Boolean := False; Tail : T_Tail := (others => (0.0, 0.0)); end record; protected Dispatch_Tasks is procedure Get_Next_Body (B : out Bodies_Enum); private Current : Bodies_Enum := Bodies_Enum'First; end Dispatch_Tasks; task type T_Move_Body; type Task_Array is array (Bodies_Enum) of T_Move_Body; Tasks : Task_Array; protected type P_Body is function Get_Data return Body_Type; procedure Set_Data (B : Body_Type); private Data : Body_Type; end P_Body; type Bodies_Array is array (Bodies_Enum) of P_Body; Bodies : Bodies_Array; procedure Move (Body_To_Move : in out Body_Type; Turns_Around : Body_Type); end Solar_System;
AdaCore/libadalang
Ada
88
adb
package body Aaa.Aaa.Ccc is procedure P is null; end Aaa.Aaa.Ccc; pragma Test_Block;
reznikmm/matreshka
Ada
3,719
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.Draw_Draw_Aspect_Attributes is pragma Preelaborate; type ODF_Draw_Draw_Aspect_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Draw_Draw_Aspect_Attribute_Access is access all ODF_Draw_Draw_Aspect_Attribute'Class with Storage_Size => 0; end ODF.DOM.Draw_Draw_Aspect_Attributes;
AdaCore/gpr
Ada
35
adb
procedure Repl is begin null; end;
pat-rogers/LmcpGen
Ada
568
adb
with avtas.lmcp.factory; use avtas.lmcp.factory; with Ada.Characters.Latin_1; package body -<full_series_name_dots>-.-<datatype_name>- is -<get_and_set_methods_body>- -<calculate_packed_size_body>- -<pack_body>- -<unpack_body>- -<xml_write_body>- function -<datatype_name>-_Descendants return String_Vectors.Vector is Descendants : String_Vectors.Vector; use String_Vectors; begin -<all_descendants>- return Descendants; end -<datatype_name>-_Descendants; end -<full_series_name_dots>-.-<datatype_name>-;
reznikmm/matreshka
Ada
4,829
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Visitors; with ODF.DOM.Table_Database_Source_Sql_Elements; package Matreshka.ODF_Table.Database_Source_Sql_Elements is type Table_Database_Source_Sql_Element_Node is new Matreshka.ODF_Table.Abstract_Table_Element_Node and ODF.DOM.Table_Database_Source_Sql_Elements.ODF_Table_Database_Source_Sql with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Table_Database_Source_Sql_Element_Node; overriding function Get_Local_Name (Self : not null access constant Table_Database_Source_Sql_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Table_Database_Source_Sql_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Table_Database_Source_Sql_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Table_Database_Source_Sql_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Table.Database_Source_Sql_Elements;
onox/orka
Ada
1,935
ads
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2019 onox <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Orka.Rendering.Buffers; with Orka.Resources.Locations; with Orka.Transforms.Singles.Matrices; private with GL.Low_Level.Enums; private with Orka.Rendering.Programs.Uniforms; package Orka.Rendering.Debug.Bounding_Boxes is pragma Preelaborate; package Transforms renames Orka.Transforms.Singles.Matrices; type Bounding_Box is tagged private; function Create_Bounding_Box (Location : Resources.Locations.Location_Ptr; Color : Transforms.Vector4 := (1.0, 1.0, 1.0, 1.0)) return Bounding_Box; procedure Render (Object : in out Bounding_Box; View, Proj : Transforms.Matrix4; Transforms, Bounds : Rendering.Buffers.Bindable_Buffer'Class) with Pre => 2 * Transforms.Length = Bounds.Length; -- Render a bounding box for each transform and bounds -- -- The bounds of a bounding box consists of two vectors. private package LE renames GL.Low_Level.Enums; type Bounding_Box is tagged record Program : Rendering.Programs.Program; Uniform_Visible : Programs.Uniforms.Uniform (LE.Bool_Type); Uniform_View : Programs.Uniforms.Uniform (LE.Single_Matrix4); Uniform_Proj : Programs.Uniforms.Uniform (LE.Single_Matrix4); end record; end Orka.Rendering.Debug.Bounding_Boxes;
reznikmm/matreshka
Ada
11,968
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.Internals.UML_Named_Elements; with AMF.UML.Action_Execution_Specifications; with AMF.UML.Actions; with AMF.UML.Dependencies.Collections; with AMF.UML.General_Orderings.Collections; with AMF.UML.Interaction_Operands; with AMF.UML.Interactions; with AMF.UML.Lifelines.Collections; with AMF.UML.Named_Elements; with AMF.UML.Namespaces; with AMF.UML.Occurrence_Specifications; with AMF.UML.Packages.Collections; with AMF.UML.String_Expressions; with AMF.Visitors; package AMF.Internals.UML_Action_Execution_Specifications is type UML_Action_Execution_Specification_Proxy is limited new AMF.Internals.UML_Named_Elements.UML_Named_Element_Proxy and AMF.UML.Action_Execution_Specifications.UML_Action_Execution_Specification with null record; overriding function Get_Action (Self : not null access constant UML_Action_Execution_Specification_Proxy) return AMF.UML.Actions.UML_Action_Access; -- Getter of ActionExecutionSpecification::action. -- -- Action whose execution is occurring. overriding procedure Set_Action (Self : not null access UML_Action_Execution_Specification_Proxy; To : AMF.UML.Actions.UML_Action_Access); -- Setter of ActionExecutionSpecification::action. -- -- Action whose execution is occurring. overriding function Get_Finish (Self : not null access constant UML_Action_Execution_Specification_Proxy) return AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access; -- Getter of ExecutionSpecification::finish. -- -- References the OccurrenceSpecification that designates the finish of -- the Action or Behavior. overriding procedure Set_Finish (Self : not null access UML_Action_Execution_Specification_Proxy; To : AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access); -- Setter of ExecutionSpecification::finish. -- -- References the OccurrenceSpecification that designates the finish of -- the Action or Behavior. overriding function Get_Start (Self : not null access constant UML_Action_Execution_Specification_Proxy) return AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access; -- Getter of ExecutionSpecification::start. -- -- References the OccurrenceSpecification that designates the start of the -- Action or Behavior overriding procedure Set_Start (Self : not null access UML_Action_Execution_Specification_Proxy; To : AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access); -- Setter of ExecutionSpecification::start. -- -- References the OccurrenceSpecification that designates the start of the -- Action or Behavior overriding function Get_Covered (Self : not null access constant UML_Action_Execution_Specification_Proxy) return AMF.UML.Lifelines.Collections.Set_Of_UML_Lifeline; -- Getter of InteractionFragment::covered. -- -- References the Lifelines that the InteractionFragment involves. overriding function Get_Enclosing_Interaction (Self : not null access constant UML_Action_Execution_Specification_Proxy) return AMF.UML.Interactions.UML_Interaction_Access; -- Getter of InteractionFragment::enclosingInteraction. -- -- The Interaction enclosing this InteractionFragment. overriding procedure Set_Enclosing_Interaction (Self : not null access UML_Action_Execution_Specification_Proxy; To : AMF.UML.Interactions.UML_Interaction_Access); -- Setter of InteractionFragment::enclosingInteraction. -- -- The Interaction enclosing this InteractionFragment. overriding function Get_Enclosing_Operand (Self : not null access constant UML_Action_Execution_Specification_Proxy) return AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access; -- Getter of InteractionFragment::enclosingOperand. -- -- The operand enclosing this InteractionFragment (they may nest -- recursively) overriding procedure Set_Enclosing_Operand (Self : not null access UML_Action_Execution_Specification_Proxy; To : AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access); -- Setter of InteractionFragment::enclosingOperand. -- -- The operand enclosing this InteractionFragment (they may nest -- recursively) overriding function Get_General_Ordering (Self : not null access constant UML_Action_Execution_Specification_Proxy) return AMF.UML.General_Orderings.Collections.Set_Of_UML_General_Ordering; -- Getter of InteractionFragment::generalOrdering. -- -- The general ordering relationships contained in this fragment. overriding function Get_Client_Dependency (Self : not null access constant UML_Action_Execution_Specification_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency; -- Getter of NamedElement::clientDependency. -- -- Indicates the dependencies that reference the client. overriding function Get_Name_Expression (Self : not null access constant UML_Action_Execution_Specification_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access; -- Getter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. overriding procedure Set_Name_Expression (Self : not null access UML_Action_Execution_Specification_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access); -- Setter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. overriding function Get_Namespace (Self : not null access constant UML_Action_Execution_Specification_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Getter of NamedElement::namespace. -- -- Specifies the namespace that owns the NamedElement. overriding function Get_Qualified_Name (Self : not null access constant UML_Action_Execution_Specification_Proxy) return AMF.Optional_String; -- Getter of NamedElement::qualifiedName. -- -- A name which allows the NamedElement to be identified within a -- hierarchy of nested Namespaces. It is constructed from the names of the -- containing namespaces starting at the root of the hierarchy and ending -- with the name of the NamedElement itself. overriding function All_Owning_Packages (Self : not null access constant UML_Action_Execution_Specification_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package; -- Operation NamedElement::allOwningPackages. -- -- The query allOwningPackages() returns all the directly or indirectly -- owning packages. overriding function Is_Distinguishable_From (Self : not null access constant UML_Action_Execution_Specification_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean; -- Operation NamedElement::isDistinguishableFrom. -- -- The query isDistinguishableFrom() determines whether two NamedElements -- may logically co-exist within a Namespace. By default, two named -- elements are distinguishable if (a) they have unrelated types or (b) -- they have related types but different names. overriding function Namespace (Self : not null access constant UML_Action_Execution_Specification_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Operation NamedElement::namespace. -- -- Missing derivation for NamedElement::/namespace : Namespace overriding procedure Enter_Element (Self : not null access constant UML_Action_Execution_Specification_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Leave_Element (Self : not null access constant UML_Action_Execution_Specification_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Visit_Element (Self : not null access constant UML_Action_Execution_Specification_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of iterator interface. end AMF.Internals.UML_Action_Execution_Specifications;
pdaxrom/Kino2
Ada
3,920
adb
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding -- -- -- -- Terminal_Interface.Curses.Forms.Field_Types.Alpha -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 1998 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Contact: http://www.familiepfeifer.de/Contact.aspx?Lang=en -- Version Control: -- $Revision: 1.7 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Interfaces.C; with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; package body Terminal_Interface.Curses.Forms.Field_Types.Alpha is use type Interfaces.C.int; procedure Set_Field_Type (Fld : in Field; Typ : in Alpha_Field) is C_Alpha_Field_Type : C_Field_Type; pragma Import (C, C_Alpha_Field_Type, "TYPE_ALPHA"); function Set_Fld_Type (F : Field := Fld; Cft : C_Field_Type := C_Alpha_Field_Type; Arg1 : C_Int) return C_Int; pragma Import (C, Set_Fld_Type, "set_field_type"); Res : Eti_Error; begin Res := Set_Fld_Type (Arg1 => C_Int (Typ.Minimum_Field_Width)); if Res /= E_Ok then Eti_Exception (Res); end if; Wrap_Builtin (Fld, Typ); end Set_Field_Type; end Terminal_Interface.Curses.Forms.Field_Types.Alpha;
Letractively/ada-ado
Ada
5,850
ads
----------------------------------------------------------------------- -- ADO Sequences -- Database sequence generator -- 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 Ada.Finalization; with Ada.Strings.Unbounded.Hash; with Ada.Containers.Hashed_Maps; with ADO.Sessions; with ADO.Objects; limited with ADO.Sessions.Factory; -- The sequence generator is responsible for creating unique ID's -- across all database objects. -- -- Each table can be associated with a sequence generator. -- The sequence factory is shared by several sessions and the -- implementation is thread-safe. -- -- The HiLoGenerator implements a simple High Low sequence generator -- by using sequences that avoid to access the database. -- -- Example: -- -- F : Factory; -- Id : Identifier; -- -- Allocate (Manager => F, Name => "user", Id => Id); -- package ADO.Sequences is type Session_Factory_Access is access all ADO.Sessions.Factory.Session_Factory'Class; -- ------------------------------ -- Abstract sequence generator -- ------------------------------ type Generator is abstract new Ada.Finalization.Limited_Controlled with private; type Generator_Access is access all Generator'Class; -- Get the name of the sequence. function Get_Sequence_Name (Gen : in Generator'Class) return String; -- Allocate an identifier using the generator. procedure Allocate (Gen : in out Generator; Id : in out Objects.Object_Record'Class) is abstract; -- Get a session to connect to the database. function Get_Session (Gen : in Generator) return ADO.Sessions.Master_Session'Class; type Generator_Factory is access function (Sess_Factory : in Session_Factory_Access) return Generator_Access; -- ------------------------------ -- Sequence factory -- ------------------------------ -- The sequence <b>Factory</b> allocates unique ids for new objects. -- The factory is shared by all connections to the same database. type Factory is limited private; type Factory_Access is access all Factory; -- Allocate a unique identifier for the given sequence. procedure Allocate (Manager : in out Factory; Id : in out Objects.Object_Record'Class); -- Set a generator to be used for the given sequence. procedure Set_Generator (Manager : in out Factory; Name : in String; Gen : in Generator_Access); -- Set the default factory for creating generators. -- The default factory is the HiLo generator. procedure Set_Default_Generator (Manager : in out Factory; Factory : in Generator_Factory; Sess_Factory : in Session_Factory_Access); private use Ada.Strings.Unbounded; type Generator is abstract new Ada.Finalization.Limited_Controlled with record Name : Unbounded_String; Factory : Session_Factory_Access; end record; -- Each sequence generator is accessed through a protected type -- to make sure the allocation is unique and works in multi-threaded -- environments. protected type Sequence_Generator is -- Allocate a unique identifier for the given sequence. procedure Allocate (Id : in out Objects.Object_Record'Class); procedure Set_Generator (Name : in Unbounded_String; Gen : in Generator_Access); -- Free the generator procedure Clear; private Generator : Generator_Access; end Sequence_Generator; type Sequence_Generator_Access is access all Sequence_Generator; -- Map to keep track of allocation generators for each sequence. package Sequence_Maps is new Ada.Containers.Hashed_Maps (Key_Type => Unbounded_String, Element_Type => Sequence_Generator_Access, Hash => Ada.Strings.Unbounded.Hash, Equivalent_Keys => "=", "=" => "="); -- The sequence factory map is also accessed through a protected type. protected type Factory_Map is -- Get the sequence generator associated with the name. -- If there is no such generator, an entry is created by using -- the default generator. procedure Get_Generator (Name : in Unbounded_String; Gen : out Sequence_Generator_Access); -- Set the sequence generator associated with the name. procedure Set_Generator (Name : in Unbounded_String; Gen : in Sequence_Generator_Access); -- Set the default sequence generator. procedure Set_Default_Generator (Gen : in Generator_Factory; Factory : in Session_Factory_Access); -- Clear the factory map. procedure Clear; private Map : Sequence_Maps.Map; Create_Generator : Generator_Factory; Sess_Factory : Session_Factory_Access; end Factory_Map; type Factory is new Ada.Finalization.Limited_Controlled with record Map : Factory_Map; end record; overriding procedure Finalize (Manager : in out Factory); end ADO.Sequences;
persan/AdaYaml
Ada
3,919
adb
-- part of AdaYaml, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "copying.txt" with Ada.Strings.Hash; with Ada.Unchecked_Deallocation; package body Yaml.Text_Set is use type Ada.Containers.Hash_Type; function Non_Zero_Hash (S : Standard.String) return Ada.Containers.Hash_Type is Hash : constant Ada.Containers.Hash_Type := Ada.Strings.Hash (S); begin if Hash = 0 then return 1; else return Hash; end if; end Non_Zero_Hash; function Raw_Set (Object : in out Reference; Hash : Ada.Containers.Hash_Type; S : Standard.String) return not null access Holder is Pos : Natural := Natural (Hash mod Ada.Containers.Hash_Type (Object.Elements'Length)); Cur : not null access Holder := Object.Elements (Pos)'Access; begin while Cur.Hash /= 0 and then (Cur.Hash /= Hash or else Cur.Key.Value /= S) loop Pos := Pos + 1; if Pos = Object.Elements'Length then Pos := 0; end if; Cur := Object.Elements (Pos)'Access; end loop; return Cur; end Raw_Set; procedure Free is new Ada.Unchecked_Deallocation (Holder_Array, Holder_Array_Access); function Grow_If_Needed (Object : in out Reference) return Boolean is Old_Elements : Holder_Array_Access := Object.Elements; begin if Object.Count = Object.Elements'Length / 2 then Object.Elements := new Holder_Array (0 .. Object.Count * 4 - 1); Object.Elements.all := (others => (Hash => 0, others => <>)); for E of Old_Elements.all loop if E.Hash /= 0 then Raw_Set (Object, E.Hash, E.Key.Value).all := E; end if; end loop; Free (Old_Elements); return True; else return False; end if; end Grow_If_Needed; function Get (Object : in out Reference; S : Standard.String; Create : Boolean) return not null access Holder is Hash : constant Ada.Containers.Hash_Type := Non_Zero_Hash (S); begin <<Start>> declare Cur : constant not null Holder_Access := Raw_Set (Object, Hash, S); begin if Cur.Hash = 0 then if Grow_If_Needed (Object) then goto Start; end if; if Create then Object.Count := Object.Count + 1; Cur.Hash := Hash; Cur.Key := Object.Pool.From_String (S); end if; end if; return Cur; end; end Get; function Set (Object : in out Reference; S : Standard.String; Value : Value_Type) return Boolean is Hash : constant Ada.Containers.Hash_Type := Non_Zero_Hash (S); begin if Grow_If_Needed (Object) then null; end if; declare Cur : constant not null access Holder := Raw_Set (Object, Hash, S); begin if Cur.Hash = 0 then Object.Count := Object.Count + 1; Cur.Hash := Hash; Cur.Key := Object.Pool.From_String (S); Cur.Value := Value; return True; else return False; end if; end; end Set; procedure Clear (Object : in out Reference) is begin Object.Elements.all := (others => (Hash => 0, others => <>)); Object.Count := 0; end Clear; procedure Init (Object : in out Reference; Pool : Text.Pool.Reference; Initial_Size : Positive) is begin Object.Pool := Pool; Object.Elements := new Holder_Array (0 .. Initial_Size - 1); Clear (Object); end Init; procedure Finalize (Object : in out Reference) is begin if Object.Elements /= null then Free (Object.Elements); end if; end Finalize; end Yaml.Text_Set;
Fabien-Chouteau/shoot-n-loot
Ada
470
ads
-- Shoot'n'loot -- Copyright (c) 2020 Fabien Chouteau with GESTE; package Levels is type Level_Id is (Lvl_0, Lvl_1, Lvl_2, Lvl_3, Lvl_4, Lvl_5, Lvl_6, Lvl_7, Lvl_8); procedure Enter (Id : Level_Id); -- Setup a level procedure Open_Exit; -- Open the exit tile of the current level function Test_Exit (Pt : GESTE.Pix_Point) return Boolean; -- Return True if Pt is within the exit tile of the current level end Levels;
AdaCore/Ada_Drivers_Library
Ada
19,359
adb
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015-2016, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with Ada.Unchecked_Conversion; package body FT5336 is pragma Warnings (Off, "* is not referenced"); --------------------------------------%---------------------- -- Definitions for FT5336 I2C register addresses on 8 bit -- ------------------------------------------------------------ -- Current mode register of the FT5336 (R/W) FT5336_DEV_MODE_REG : constant UInt8 := 16#00#; -- Possible values of FT5336_DEV_MODE_REG FT5336_DEV_MODE_WORKING : constant UInt8 := 16#00#; FT5336_DEV_MODE_FACTORY : constant UInt8 := 16#04#; FT5336_DEV_MODE_MASK : constant UInt8 := 16#07#; FT5336_DEV_MODE_SHIFT : constant UInt8 := 16#04#; -- Gesture ID register FT5336_GEST_ID_REG : constant UInt8 := 16#01#; -- Possible values of FT5336_GEST_ID_REG FT5336_GEST_ID_NO_GESTURE : constant UInt8 := 16#00#; FT5336_GEST_ID_MOVE_UP : constant UInt8 := 16#10#; FT5336_GEST_ID_MOVE_RIGHT : constant UInt8 := 16#14#; FT5336_GEST_ID_MOVE_DOWN : constant UInt8 := 16#18#; FT5336_GEST_ID_MOVE_LEFT : constant UInt8 := 16#1C#; FT5336_GEST_ID_SINGLE_CLICK : constant UInt8 := 16#20#; FT5336_GEST_ID_DOUBLE_CLICK : constant UInt8 := 16#22#; FT5336_GEST_ID_ROTATE_CLOCKWISE : constant UInt8 := 16#28#; FT5336_GEST_ID_ROTATE_C_CLOCKWISE : constant UInt8 := 16#29#; FT5336_GEST_ID_ZOOM_IN : constant UInt8 := 16#40#; FT5336_GEST_ID_ZOOM_OUT : constant UInt8 := 16#49#; -- Touch Data Status register : gives number of active touch points (0..5) FT5336_TD_STAT_REG : constant UInt8 := 16#02#; -- Values related to FT5336_TD_STAT_REG FT5336_TD_STAT_MASK : constant UInt8 := 16#0F#; FT5336_TD_STAT_SHIFT : constant UInt8 := 16#00#; -- Values Pn_XH and Pn_YH related FT5336_TOUCH_EVT_FLAG_PRESS_DOWN : constant UInt8 := 16#00#; FT5336_TOUCH_EVT_FLAG_LIFT_UP : constant UInt8 := 16#01#; FT5336_TOUCH_EVT_FLAG_CONTACT : constant UInt8 := 16#02#; FT5336_TOUCH_EVT_FLAG_NO_EVENT : constant UInt8 := 16#03#; FT5336_TOUCH_EVT_FLAG_SHIFT : constant UInt8 := 16#06#; FT5336_TOUCH_EVT_FLAG_MASK : constant UInt8 := 2#1100_0000#; FT5336_TOUCH_POS_MSB_MASK : constant UInt8 := 16#0F#; FT5336_TOUCH_POS_MSB_SHIFT : constant UInt8 := 16#00#; -- Values Pn_XL and Pn_YL related FT5336_TOUCH_POS_LSB_MASK : constant UInt8 := 16#FF#; FT5336_TOUCH_POS_LSB_SHIFT : constant UInt8 := 16#00#; -- Values Pn_WEIGHT related FT5336_TOUCH_WEIGHT_MASK : constant UInt8 := 16#FF#; FT5336_TOUCH_WEIGHT_SHIFT : constant UInt8 := 16#00#; -- Values related to FT5336_Pn_MISC_REG FT5336_TOUCH_AREA_MASK : constant UInt8 := 2#0100_0000#; FT5336_TOUCH_AREA_SHIFT : constant UInt8 := 16#04#; type FT5336_Pressure_Registers is record XH_Reg : UInt8; XL_Reg : UInt8; YH_Reg : UInt8; YL_Reg : UInt8; -- Touch Pressure register value (R) Weight_Reg : UInt8; -- Touch area register Misc_Reg : UInt8; end record; FT5336_Px_Regs : constant array (Positive range <>) of FT5336_Pressure_Registers := (1 => (XH_Reg => 16#03#, XL_Reg => 16#04#, YH_Reg => 16#05#, YL_Reg => 16#06#, Weight_Reg => 16#07#, Misc_Reg => 16#08#), 2 => (XH_Reg => 16#09#, XL_Reg => 16#0A#, YH_Reg => 16#0B#, YL_Reg => 16#0C#, Weight_Reg => 16#0D#, Misc_Reg => 16#0E#), 3 => (XH_Reg => 16#0F#, XL_Reg => 16#10#, YH_Reg => 16#11#, YL_Reg => 16#12#, Weight_Reg => 16#13#, Misc_Reg => 16#14#), 4 => (XH_Reg => 16#15#, XL_Reg => 16#16#, YH_Reg => 16#17#, YL_Reg => 16#18#, Weight_Reg => 16#19#, Misc_Reg => 16#1A#), 5 => (XH_Reg => 16#1B#, XL_Reg => 16#1C#, YH_Reg => 16#1D#, YL_Reg => 16#1E#, Weight_Reg => 16#1F#, Misc_Reg => 16#20#), 6 => (XH_Reg => 16#21#, XL_Reg => 16#22#, YH_Reg => 16#23#, YL_Reg => 16#24#, Weight_Reg => 16#25#, Misc_Reg => 16#26#), 7 => (XH_Reg => 16#27#, XL_Reg => 16#28#, YH_Reg => 16#29#, YL_Reg => 16#2A#, Weight_Reg => 16#2B#, Misc_Reg => 16#2C#), 8 => (XH_Reg => 16#2D#, XL_Reg => 16#2E#, YH_Reg => 16#2F#, YL_Reg => 16#30#, Weight_Reg => 16#31#, Misc_Reg => 16#32#), 9 => (XH_Reg => 16#33#, XL_Reg => 16#34#, YH_Reg => 16#35#, YL_Reg => 16#36#, Weight_Reg => 16#37#, Misc_Reg => 16#38#), 10 => (XH_Reg => 16#39#, XL_Reg => 16#3A#, YH_Reg => 16#3B#, YL_Reg => 16#3C#, Weight_Reg => 16#3D#, Misc_Reg => 16#3E#)); -- Threshold for touch detection FT5336_TH_GROUP_REG : constant UInt8 := 16#80#; -- Values FT5336_TH_GROUP_REG : threshold related FT5336_THRESHOLD_MASK : constant UInt8 := 16#FF#; FT5336_THRESHOLD_SHIFT : constant UInt8 := 16#00#; -- Filter function coefficients FT5336_TH_DIFF_REG : constant UInt8 := 16#85#; -- Control register FT5336_CTRL_REG : constant UInt8 := 16#86#; -- Values related to FT5336_CTRL_REG -- Will keep the Active mode when there is no touching FT5336_CTRL_KEEP_ACTIVE_MODE : constant UInt8 := 16#00#; -- Switching from Active mode to Monitor mode automatically when there -- is no touching FT5336_CTRL_KEEP_AUTO_SWITCH_MONITOR_MODE : constant UInt8 := 16#01#; -- The time period of switching from Active mode to Monitor mode when -- there is no touching FT5336_TIMEENTERMONITOR_REG : constant UInt8 := 16#87#; -- Report rate in Active mode FT5336_PERIODACTIVE_REG : constant UInt8 := 16#88#; -- Report rate in Monitor mode FT5336_PERIODMONITOR_REG : constant UInt8 := 16#89#; -- The value of the minimum allowed angle while Rotating gesture mode FT5336_RADIAN_VALUE_REG : constant UInt8 := 16#91#; -- Maximum offset while Moving Left and Moving Right gesture FT5336_OFFSET_LEFT_RIGHT_REG : constant UInt8 := 16#92#; -- Maximum offset while Moving Up and Moving Down gesture FT5336_OFFSET_UP_DOWN_REG : constant UInt8 := 16#93#; -- Minimum distance while Moving Left and Moving Right gesture FT5336_DISTANCE_LEFT_RIGHT_REG : constant UInt8 := 16#94#; -- Minimum distance while Moving Up and Moving Down gesture FT5336_DISTANCE_UP_DOWN_REG : constant UInt8 := 16#95#; -- Maximum distance while Zoom In and Zoom Out gesture FT5336_DISTANCE_ZOOM_REG : constant UInt8 := 16#96#; -- High 8-bit of LIB Version info FT5336_LIB_VER_H_REG : constant UInt8 := 16#A1#; -- Low 8-bit of LIB Version info FT5336_LIB_VER_L_REG : constant UInt8 := 16#A2#; -- Chip Selecting FT5336_CIPHER_REG : constant UInt8 := 16#A3#; -- Interrupt mode register (used when in interrupt mode) FT5336_GMODE_REG : constant UInt8 := 16#A4#; FT5336_G_MODE_INTERRUPT_MASK : constant UInt8 := 16#03#; -- Possible values of FT5336_GMODE_REG FT5336_G_MODE_INTERRUPT_POLLING : constant UInt8 := 16#00#; FT5336_G_MODE_INTERRUPT_TRIGGER : constant UInt8 := 16#01#; -- Current power mode the FT5336 system is in (R) FT5336_PWR_MODE_REG : constant UInt8 := 16#A5#; -- FT5336 firmware version FT5336_FIRMID_REG : constant UInt8 := 16#A6#; -- FT5336 Chip identification register FT5336_CHIP_ID_REG : constant UInt8 := 16#A8#; -- Possible values of FT5336_CHIP_ID_REG FT5336_ID_VALUE : constant UInt8 := 16#51#; -- Release code version FT5336_RELEASE_CODE_ID_REG : constant UInt8 := 16#AF#; -- Current operating mode the FT5336 system is in (R) FT5336_STATE_REG : constant UInt8 := 16#BC#; pragma Warnings (On, "* is not referenced"); -------------- -- I2C_Read -- -------------- function I2C_Read (This : in out FT5336_Device; Reg : UInt8; Status : out Boolean) return UInt8 is Ret : I2C_Data (1 .. 1); Tmp_Status : I2C_Status; begin This.Port.Mem_Read (This.I2C_Addr, UInt16 (Reg), Memory_Size_8b, Ret, Tmp_Status, 1000); Status := Tmp_Status = Ok; return Ret (1); end I2C_Read; --------------- -- I2C_Write -- --------------- procedure I2C_Write (This : in out FT5336_Device; Reg : UInt8; Data : UInt8; Status : out Boolean) is Tmp_Status : I2C_Status; begin This.Port.Mem_Write (This.I2C_Addr, UInt16 (Reg), Memory_Size_8b, (1 => Data), Tmp_Status, 1000); Status := Tmp_Status = Ok; end I2C_Write; ------------- -- Read_Id -- ------------- function Check_Id (This : in out FT5336_Device) return Boolean is Id : UInt8; Status : Boolean; begin for J in 1 .. 3 loop Id := This.I2C_Read (FT5336_CHIP_ID_REG, Status); if Id = FT5336_ID_VALUE then return True; end if; if not Status then return False; end if; end loop; return False; end Check_Id; --------------------------- -- TP_Set_Use_Interrupts -- --------------------------- procedure TP_Set_Use_Interrupts (This : in out FT5336_Device; Enabled : Boolean) is Reg_Value : UInt8 := 0; Status : Boolean; begin if Enabled then Reg_Value := FT5336_G_MODE_INTERRUPT_TRIGGER; else Reg_Value := FT5336_G_MODE_INTERRUPT_POLLING; end if; This.I2C_Write (FT5336_GMODE_REG, Reg_Value, Status); end TP_Set_Use_Interrupts; ---------------- -- Set_Bounds -- ---------------- overriding procedure Set_Bounds (This : in out FT5336_Device; Width : Natural; Height : Natural; Swap : HAL.Touch_Panel.Swap_State) is begin This.LCD_Natural_Width := Width; This.LCD_Natural_Height := Height; This.Swap := Swap; end Set_Bounds; ------------------------- -- Active_Touch_Points -- ------------------------- overriding function Active_Touch_Points (This : in out FT5336_Device) return Touch_Identifier is Status : Boolean; Nb_Touch : UInt8 := 0; begin Nb_Touch := This.I2C_Read (FT5336_TD_STAT_REG, Status); if not Status then return 0; end if; Nb_Touch := Nb_Touch and FT5336_TD_STAT_MASK; if Natural (Nb_Touch) > FT5336_Px_Regs'Last then -- Overflow: set to 0 Nb_Touch := 0; end if; return Natural (Nb_Touch); end Active_Touch_Points; --------------------- -- Get_Touch_Point -- --------------------- overriding function Get_Touch_Point (This : in out FT5336_Device; Touch_Id : Touch_Identifier) return TP_Touch_State is type UInt16_HL_Type is record High, Low : UInt8; end record with Size => 16; for UInt16_HL_Type use record High at 1 range 0 .. 7; Low at 0 range 0 .. 7; end record; function To_UInt16 is new Ada.Unchecked_Conversion (UInt16_HL_Type, UInt16); Ret : TP_Touch_State; Regs : FT5336_Pressure_Registers; Tmp : UInt16_HL_Type; Status : Boolean; begin -- X/Y are swaped from the screen coordinates if Touch_Id not in FT5336_Px_Regs'Range or else Touch_Id > This.Active_Touch_Points then return (0, 0, 0); end if; Regs := FT5336_Px_Regs (Touch_Id); Tmp.Low := This.I2C_Read (Regs.XL_Reg, Status); if not Status then return (0, 0, 0); end if; Tmp.High := This.I2C_Read (Regs.XH_Reg, Status) and FT5336_TOUCH_POS_MSB_MASK; if not Status then return (0, 0, 0); end if; Ret.Y := Natural (To_UInt16 (Tmp)); Tmp.Low := This.I2C_Read (Regs.YL_Reg, Status); if not Status then return (0, 0, 0); end if; Tmp.High := This.I2C_Read (Regs.YH_Reg, Status) and FT5336_TOUCH_POS_MSB_MASK; if not Status then return (0, 0, 0); end if; Ret.X := Natural (To_UInt16 (Tmp)); Ret.Weight := Natural (This.I2C_Read (Regs.Weight_Reg, Status)); if not Status then Ret.Weight := 0; end if; Ret.X := Natural'Min (Natural'Max (0, Ret.X), This.LCD_Natural_Width - 1); Ret.Y := Natural'Min (Natural'Max (0, Ret.Y), This.LCD_Natural_Height - 1); if (This.Swap and Invert_X) /= 0 then Ret.X := This.LCD_Natural_Width - Ret.X - 1; end if; if (This.Swap and Invert_Y) /= 0 then Ret.Y := This.LCD_Natural_Height - Ret.Y - 1; end if; if (This.Swap and Swap_XY) /= 0 then declare Tmp_X : constant Integer := Ret.X; begin Ret.X := Ret.Y; Ret.Y := Tmp_X; end; end if; return Ret; end Get_Touch_Point; -------------------------- -- Get_All_Touch_Points -- -------------------------- overriding function Get_All_Touch_Points (This : in out FT5336_Device) return HAL.Touch_Panel.TP_State is N_Touch : constant Natural := This.Active_Touch_Points; State : TP_State (1 .. N_Touch); begin if N_Touch = 0 then return (1 .. 0 => <>); end if; for J in State'Range loop State (J) := This.Get_Touch_Point (J); end loop; return State; end Get_All_Touch_Points; end FT5336;
reznikmm/matreshka
Ada
3,659
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.Db_Delimiter_Elements is pragma Preelaborate; type ODF_Db_Delimiter is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Db_Delimiter_Access is access all ODF_Db_Delimiter'Class with Storage_Size => 0; end ODF.DOM.Db_Delimiter_Elements;
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_Layout_Grid_Standard_Mode_Attributes; package Matreshka.ODF_Style.Layout_Grid_Standard_Mode_Attributes is type Style_Layout_Grid_Standard_Mode_Attribute_Node is new Matreshka.ODF_Style.Abstract_Style_Attribute_Node and ODF.DOM.Style_Layout_Grid_Standard_Mode_Attributes.ODF_Style_Layout_Grid_Standard_Mode_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Style_Layout_Grid_Standard_Mode_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Style_Layout_Grid_Standard_Mode_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Style.Layout_Grid_Standard_Mode_Attributes;
ecofast/asphyre-cpp
Ada
16,276
ads
---------------------------------------------------------------- -- ZLib for Ada thick binding. -- -- -- -- Copyright (C) 2002-2003 Dmitriy Anisimkov -- -- -- -- Open source license information is in the zlib.ads file. -- ---------------------------------------------------------------- -- $Id: zlib-thin.ads,v 1.1 2010/08/18 14:11:29 Administrator Exp $ with Interfaces.C.Strings; with System; private package ZLib.Thin is -- From zconf.h MAX_MEM_LEVEL : constant := 9; -- zconf.h:105 -- zconf.h:105 MAX_WBITS : constant := 15; -- zconf.h:115 -- 32K LZ77 window -- zconf.h:115 SEEK_SET : constant := 8#0000#; -- zconf.h:244 -- Seek from beginning of file. -- zconf.h:244 SEEK_CUR : constant := 1; -- zconf.h:245 -- Seek from current position. -- zconf.h:245 SEEK_END : constant := 2; -- zconf.h:246 -- Set file pointer to EOF plus "offset" -- zconf.h:246 type Byte is new Interfaces.C.unsigned_char; -- 8 bits -- zconf.h:214 type UInt is new Interfaces.C.unsigned; -- 16 bits or more -- zconf.h:216 type Int is new Interfaces.C.int; type ULong is new Interfaces.C.unsigned_long; -- 32 bits or more -- zconf.h:217 subtype Chars_Ptr is Interfaces.C.Strings.chars_ptr; type ULong_Access is access ULong; type Int_Access is access Int; subtype Voidp is System.Address; -- zconf.h:232 subtype Byte_Access is Voidp; Nul : constant Voidp := System.Null_Address; -- end from zconf Z_NO_FLUSH : constant := 8#0000#; -- zlib.h:125 -- zlib.h:125 Z_PARTIAL_FLUSH : constant := 1; -- zlib.h:126 -- will be removed, use -- Z_SYNC_FLUSH instead -- zlib.h:126 Z_SYNC_FLUSH : constant := 2; -- zlib.h:127 -- zlib.h:127 Z_FULL_FLUSH : constant := 3; -- zlib.h:128 -- zlib.h:128 Z_FINISH : constant := 4; -- zlib.h:129 -- zlib.h:129 Z_OK : constant := 8#0000#; -- zlib.h:132 -- zlib.h:132 Z_STREAM_END : constant := 1; -- zlib.h:133 -- zlib.h:133 Z_NEED_DICT : constant := 2; -- zlib.h:134 -- zlib.h:134 Z_ERRNO : constant := -1; -- zlib.h:135 -- zlib.h:135 Z_STREAM_ERROR : constant := -2; -- zlib.h:136 -- zlib.h:136 Z_DATA_ERROR : constant := -3; -- zlib.h:137 -- zlib.h:137 Z_MEM_ERROR : constant := -4; -- zlib.h:138 -- zlib.h:138 Z_BUF_ERROR : constant := -5; -- zlib.h:139 -- zlib.h:139 Z_VERSION_ERROR : constant := -6; -- zlib.h:140 -- zlib.h:140 Z_NO_COMPRESSION : constant := 8#0000#; -- zlib.h:145 -- zlib.h:145 Z_BEST_SPEED : constant := 1; -- zlib.h:146 -- zlib.h:146 Z_BEST_COMPRESSION : constant := 9; -- zlib.h:147 -- zlib.h:147 Z_DEFAULT_COMPRESSION : constant := -1; -- zlib.h:148 -- zlib.h:148 Z_FILTERED : constant := 1; -- zlib.h:151 -- zlib.h:151 Z_HUFFMAN_ONLY : constant := 2; -- zlib.h:152 -- zlib.h:152 Z_DEFAULT_STRATEGY : constant := 8#0000#; -- zlib.h:153 -- zlib.h:153 Z_BINARY : constant := 8#0000#; -- zlib.h:156 -- zlib.h:156 Z_ASCII : constant := 1; -- zlib.h:157 -- zlib.h:157 Z_UNKNOWN : constant := 2; -- zlib.h:158 -- zlib.h:158 Z_DEFLATED : constant := 8; -- zlib.h:161 -- zlib.h:161 Z_NULL : constant := 8#0000#; -- zlib.h:164 -- for initializing zalloc, zfree, opaque -- zlib.h:164 type gzFile is new Voidp; -- zlib.h:646 type Z_Stream is private; type Z_Streamp is access all Z_Stream; -- zlib.h:89 type alloc_func is access function (Opaque : Voidp; Items : UInt; Size : UInt) return Voidp; -- zlib.h:63 type free_func is access procedure (opaque : Voidp; address : Voidp); function zlibVersion return Chars_Ptr; function Deflate (strm : Z_Streamp; flush : Int) return Int; function DeflateEnd (strm : Z_Streamp) return Int; function Inflate (strm : Z_Streamp; flush : Int) return Int; function InflateEnd (strm : Z_Streamp) return Int; function deflateSetDictionary (strm : Z_Streamp; dictionary : Byte_Access; dictLength : UInt) return Int; function deflateCopy (dest : Z_Streamp; source : Z_Streamp) return Int; -- zlib.h:478 function deflateReset (strm : Z_Streamp) return Int; -- zlib.h:495 function deflateParams (strm : Z_Streamp; level : Int; strategy : Int) return Int; -- zlib.h:506 function inflateSetDictionary (strm : Z_Streamp; dictionary : Byte_Access; dictLength : UInt) return Int; -- zlib.h:548 function inflateSync (strm : Z_Streamp) return Int; -- zlib.h:565 function inflateReset (strm : Z_Streamp) return Int; -- zlib.h:580 function compress (dest : Byte_Access; destLen : ULong_Access; source : Byte_Access; sourceLen : ULong) return Int; -- zlib.h:601 function compress2 (dest : Byte_Access; destLen : ULong_Access; source : Byte_Access; sourceLen : ULong; level : Int) return Int; -- zlib.h:615 function uncompress (dest : Byte_Access; destLen : ULong_Access; source : Byte_Access; sourceLen : ULong) return Int; function gzopen (path : Chars_Ptr; mode : Chars_Ptr) return gzFile; function gzdopen (fd : Int; mode : Chars_Ptr) return gzFile; function gzsetparams (file : gzFile; level : Int; strategy : Int) return Int; function gzread (file : gzFile; buf : Voidp; len : UInt) return Int; function gzwrite (file : in gzFile; buf : in Voidp; len : in UInt) return Int; function gzprintf (file : in gzFile; format : in Chars_Ptr) return Int; function gzputs (file : in gzFile; s : in Chars_Ptr) return Int; function gzgets (file : gzFile; buf : Chars_Ptr; len : Int) return Chars_Ptr; function gzputc (file : gzFile; char : Int) return Int; function gzgetc (file : gzFile) return Int; function gzflush (file : gzFile; flush : Int) return Int; function gzseek (file : gzFile; offset : Int; whence : Int) return Int; function gzrewind (file : gzFile) return Int; function gztell (file : gzFile) return Int; function gzeof (file : gzFile) return Int; function gzclose (file : gzFile) return Int; function gzerror (file : gzFile; errnum : Int_Access) return Chars_Ptr; function adler32 (adler : ULong; buf : Byte_Access; len : UInt) return ULong; function crc32 (crc : ULong; buf : Byte_Access; len : UInt) return ULong; function deflateInit (strm : Z_Streamp; level : Int; version : Chars_Ptr; stream_size : Int) return Int; function deflateInit2 (strm : Z_Streamp; level : Int; method : Int; windowBits : Int; memLevel : Int; strategy : Int; version : Chars_Ptr; stream_size : Int) return Int; function Deflate_Init (strm : Z_Streamp; level : Int; method : Int; windowBits : Int; memLevel : Int; strategy : Int) return Int; pragma Inline (Deflate_Init); function inflateInit (strm : Z_Streamp; version : Chars_Ptr; stream_size : Int) return Int; function inflateInit2 (strm : in Z_Streamp; windowBits : in Int; version : in Chars_Ptr; stream_size : in Int) return Int; function inflateBackInit (strm : in Z_Streamp; windowBits : in Int; window : in Byte_Access; version : in Chars_Ptr; stream_size : in Int) return Int; -- Size of window have to be 2**windowBits. function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int; pragma Inline (Inflate_Init); function zError (err : Int) return Chars_Ptr; function inflateSyncPoint (z : Z_Streamp) return Int; function get_crc_table return ULong_Access; -- Interface to the available fields of the z_stream structure. -- The application must update next_in and avail_in when avail_in has -- dropped to zero. It must update next_out and avail_out when avail_out -- has dropped to zero. The application must initialize zalloc, zfree and -- opaque before calling the init function. procedure Set_In (Strm : in out Z_Stream; Buffer : in Voidp; Size : in UInt); pragma Inline (Set_In); procedure Set_Out (Strm : in out Z_Stream; Buffer : in Voidp; Size : in UInt); pragma Inline (Set_Out); procedure Set_Mem_Func (Strm : in out Z_Stream; Opaque : in Voidp; Alloc : in alloc_func; Free : in free_func); pragma Inline (Set_Mem_Func); function Last_Error_Message (Strm : in Z_Stream) return String; pragma Inline (Last_Error_Message); function Avail_Out (Strm : in Z_Stream) return UInt; pragma Inline (Avail_Out); function Avail_In (Strm : in Z_Stream) return UInt; pragma Inline (Avail_In); function Total_In (Strm : in Z_Stream) return ULong; pragma Inline (Total_In); function Total_Out (Strm : in Z_Stream) return ULong; pragma Inline (Total_Out); function inflateCopy (dest : in Z_Streamp; Source : in Z_Streamp) return Int; function compressBound (Source_Len : in ULong) return ULong; function deflateBound (Strm : in Z_Streamp; Source_Len : in ULong) return ULong; function gzungetc (C : in Int; File : in gzFile) return Int; function zlibCompileFlags return ULong; private type Z_Stream is record -- zlib.h:68 Next_In : Voidp := Nul; -- next input byte Avail_In : UInt := 0; -- number of bytes available at next_in Total_In : ULong := 0; -- total nb of input bytes read so far Next_Out : Voidp := Nul; -- next output byte should be put there Avail_Out : UInt := 0; -- remaining free space at next_out Total_Out : ULong := 0; -- total nb of bytes output so far msg : Chars_Ptr; -- last error message, NULL if no error state : Voidp; -- not visible by applications zalloc : alloc_func := null; -- used to allocate the internal state zfree : free_func := null; -- used to free the internal state opaque : Voidp; -- private data object passed to -- zalloc and zfree data_type : Int; -- best guess about the data type: -- ascii or binary adler : ULong; -- adler32 value of the uncompressed -- data reserved : ULong; -- reserved for future use end record; pragma Convention (C, Z_Stream); pragma Import (C, zlibVersion, "zlibVersion"); pragma Import (C, Deflate, "deflate"); pragma Import (C, DeflateEnd, "deflateEnd"); pragma Import (C, Inflate, "inflate"); pragma Import (C, InflateEnd, "inflateEnd"); pragma Import (C, deflateSetDictionary, "deflateSetDictionary"); pragma Import (C, deflateCopy, "deflateCopy"); pragma Import (C, deflateReset, "deflateReset"); pragma Import (C, deflateParams, "deflateParams"); pragma Import (C, inflateSetDictionary, "inflateSetDictionary"); pragma Import (C, inflateSync, "inflateSync"); pragma Import (C, inflateReset, "inflateReset"); pragma Import (C, compress, "compress"); pragma Import (C, compress2, "compress2"); pragma Import (C, uncompress, "uncompress"); pragma Import (C, gzopen, "gzopen"); pragma Import (C, gzdopen, "gzdopen"); pragma Import (C, gzsetparams, "gzsetparams"); pragma Import (C, gzread, "gzread"); pragma Import (C, gzwrite, "gzwrite"); pragma Import (C, gzprintf, "gzprintf"); pragma Import (C, gzputs, "gzputs"); pragma Import (C, gzgets, "gzgets"); pragma Import (C, gzputc, "gzputc"); pragma Import (C, gzgetc, "gzgetc"); pragma Import (C, gzflush, "gzflush"); pragma Import (C, gzseek, "gzseek"); pragma Import (C, gzrewind, "gzrewind"); pragma Import (C, gztell, "gztell"); pragma Import (C, gzeof, "gzeof"); pragma Import (C, gzclose, "gzclose"); pragma Import (C, gzerror, "gzerror"); pragma Import (C, adler32, "adler32"); pragma Import (C, crc32, "crc32"); pragma Import (C, deflateInit, "deflateInit_"); pragma Import (C, inflateInit, "inflateInit_"); pragma Import (C, deflateInit2, "deflateInit2_"); pragma Import (C, inflateInit2, "inflateInit2_"); pragma Import (C, zError, "zError"); pragma Import (C, inflateSyncPoint, "inflateSyncPoint"); pragma Import (C, get_crc_table, "get_crc_table"); -- since zlib 1.2.0: pragma Import (C, inflateCopy, "inflateCopy"); pragma Import (C, compressBound, "compressBound"); pragma Import (C, deflateBound, "deflateBound"); pragma Import (C, gzungetc, "gzungetc"); pragma Import (C, zlibCompileFlags, "zlibCompileFlags"); pragma Import (C, inflateBackInit, "inflateBackInit_"); -- I stopped binding the inflateBack routines, becouse realize that -- it does not support zlib and gzip headers for now, and have no -- symmetric deflateBack routines. -- ZLib-Ada is symmetric regarding deflate/inflate data transformation -- and has a similar generic callback interface for the -- deflate/inflate transformation based on the regular Deflate/Inflate -- routines. -- pragma Import (C, inflateBack, "inflateBack"); -- pragma Import (C, inflateBackEnd, "inflateBackEnd"); end ZLib.Thin;
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_Hyphenation_Keep_Attributes; package Matreshka.ODF_Fo.Hyphenation_Keep_Attributes is type Fo_Hyphenation_Keep_Attribute_Node is new Matreshka.ODF_Fo.Abstract_Fo_Attribute_Node and ODF.DOM.Fo_Hyphenation_Keep_Attributes.ODF_Fo_Hyphenation_Keep_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Fo_Hyphenation_Keep_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Fo_Hyphenation_Keep_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Fo.Hyphenation_Keep_Attributes;
jrmarino/zstd-ada
Ada
3,227
adb
with Zstandard.Functions.Streaming_Compression; use Zstandard.Functions; with Ada.Command_line; use Ada.Command_Line; with Ada.Directories; use Ada.Directories; with Ada.Text_IO; use Ada.Text_IO; with Ada.Exceptions; use Ada.Exceptions; with Ada.Streams.Stream_IO; use Ada.Streams; procedure Demo_Ada is level : Compression_Level := Fastest_Compression; BUFSIZE : constant Stream_Element_Offset := 1024; begin if Argument_Count = 0 or else Argument_Count > 2 then Put_Line ("Zstandard version: " & Zstd_Version); Put_Line ("usage:"); Put_Line (Command_Name & " <path/to/file> [compression level=1]"); return; end if; if not Exists (Argument (1)) then Put_Line ("File '" & Argument (1) & "' does not exist, aborting."); return; end if; if Argument_Count = 2 then declare complevel : String renames Argument (2); myint : Integer; begin myint := Integer'Value (complevel); if myint >= 1 and then myint <= 22 then level := Compression_Level (myint); end if; exception when others => null; end; end if; declare path2file : String renames Argument (1); compfile : String := path2file & ".zst"; srcsize : Natural := 0; dstsize : Natural; srcbuffer : Stream_Element_Array (1 .. BUFSIZE); src_file : Stream_IO.File_Type; dst_file : Stream_IO.File_Type; Last : Stream_Element_Offset; units : Natural; tenths : Natural; tenthstr : String (1 .. 2); mech : Streaming_Compression.Compressor; begin Stream_IO.Open (File => src_file, Mode => Stream_IO.In_File, Name => path2file); Stream_IO.Create (File => dst_file, Mode => Stream_IO.Out_File, Name => compfile); mech.Initialize (output_stream => Stream_IO.Stream (dst_file), quality => level); loop exit when Stream_IO.End_Of_File (src_file); Stream_IO.Read (File => src_file, Item => srcbuffer, Last => Last); mech.Compress_Data (srcbuffer (1 .. Last)); srcsize := srcsize + Natural (Last); end loop; mech.Finalize_Compression_Frame; Stream_IO.Close (src_file); Stream_IO.Close (dst_file); dstsize := Natural (Size (compfile)); units := Natural (100 * dstsize / srcsize); tenths := (Natural (10 * dstsize / srcsize)) mod 10; tenthstr := tenths'Img; Put_Line (" original file size:" & srcsize'Img); Put_Line (" compressed file size:" & dstsize'Img); Put_Line ("percentage compressed:" & units'Img & "." & tenthstr (2 ..2)); Put_Line (" new file: " & compfile); exception when Error : others => Put_Line (Exception_Information(Error)); if Stream_IO.Is_Open (src_file) then Stream_IO.Close (src_file); end if; if Stream_IO.Is_Open (dst_file) then Stream_IO.Close (dst_file); end if; end; end Demo_Ada;
sungyeon/drake
Ada
3,926
adb
package body Ada.Containers.Binary_Trees.Simple is procedure Insert ( Container : in out Node_Access; Length : in out Count_Type; Before : Node_Access; New_Item : not null Node_Access) is begin Length := Length + 1; if Container = null then New_Item.Parent := null; New_Item.Left := null; New_Item.Right := null; Container := New_Item; elsif Before = null then New_Item.Parent := Last (Container); New_Item.Left := null; New_Item.Right := null; New_Item.Parent.Right := New_Item; elsif Before.Left = null then New_Item.Parent := Before; New_Item.Left := null; New_Item.Right := null; New_Item.Parent.Left := New_Item; else New_Item.Parent := Last (Before.Left); New_Item.Left := null; New_Item.Right := null; New_Item.Parent.Right := New_Item; end if; end Insert; procedure Remove ( Container : in out Node_Access; Length : in out Count_Type; Position : not null Node_Access) is Alt : Node_Access; begin Length := Length - 1; if Position.Left = null then Alt := Position.Right; elsif Position.Right = null then Alt := Position.Left; else Alt := Position.Right; declare Left_Of_Alt : constant not null Node_Access := First (Alt); begin Left_Of_Alt.Left := Position.Left; Position.Left.Parent := Left_Of_Alt; end; end if; if Alt /= null then Alt.Parent := Position.Parent; end if; if Position.Parent /= null then if Position.Parent.Left = Position then Position.Parent.Left := Alt; else pragma Assert (Position.Parent.Right = Position); Position.Parent.Right := Alt; end if; else pragma Assert (Container = Position); Container := Alt; end if; end Remove; procedure Copy ( Target : out Node_Access; Length : out Count_Type; Source : Node_Access; Copy : not null access procedure ( Target : out Node_Access; Source : not null Node_Access)) is begin Length := 0; if Source /= null then Length := Length + 1; Copy (Target, Source); Target.Parent := null; declare Source_Item : Node_Access := Source; Target_Item : Node_Access := Target; begin loop declare Source_Parent_Item : Node_Access; Target_Parent_Item : Node_Access; Index : Index_Type; begin Root_To_Leaf_Next ( Previous_Source_Item => Source_Item, Source_Parent_Item => Source_Parent_Item, Previous_Target_Item => Target_Item, Target_Parent_Item => Target_Parent_Item, Index => Index); exit when Source_Parent_Item = null; case Index is when Left => Source_Item := Source_Parent_Item.Left; when Right => Source_Item := Source_Parent_Item.Right; end case; Length := Length + 1; Copy (Target_Item, Source_Item); Target_Item.Parent := Target_Parent_Item; case Index is when Left => Target_Parent_Item.Left := Target_Item; when Right => Target_Parent_Item.Right := Target_Item; end case; end; end loop; end; end if; end Copy; end Ada.Containers.Binary_Trees.Simple;
MinimSecure/unum-sdk
Ada
1,202
adb
-- Copyright 2009-2019 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with Pck; use Pck; procedure Foo is type Octal is new Integer range 0 .. 7; type Octal_Array is array (Positive range <>) of Octal; pragma Pack (Octal_Array); type Octal_Buffer (Size : Positive) is record Buffer : Octal_Array (1 .. Size); Length : Integer; end record; My_Buffer : Octal_Buffer (Size => 8); begin My_Buffer.Buffer := (1, 2, 3, 4, 5, 6, 7, 0); My_Buffer.Length := My_Buffer.Size; Do_Nothing (My_Buffer'Address); -- START end Foo;
albinjal/ada_basic
Ada
2,084
adb
with Date_Package; use Date_Package; with Ada.Text_IO; use Ada.Text_IO; procedure Lab4fg is type Dates is array (1..10) of Date_Type; procedure Sort(Arrayen_Med_Talen: in out Dates) is procedure Swap(Tal_1,Tal_2: in out Date_Type) is Tal_B : Date_Type; -- Temporary buffer begin Tal_B := Tal_1; Tal_1 := Tal_2; Tal_2 := Tal_B; end Swap; Minsta_Talet: Date_Type; Minsta_Talet_Index: Integer; begin -- Loopa antalet gånger som arrayens längd for IOuter in Arrayen_Med_Talen'Range loop -- Loopa arrayen med start från yttra loopens värde varje gång. 1..20, 2..20, ... , 20..20 for I in IOuter..Arrayen_Med_Talen'Last loop if I = IOuter or Arrayen_Med_Talen(I) < Minsta_Talet then Minsta_Talet := Arrayen_Med_Talen(I); Minsta_Talet_Index := I; end if; end loop; Swap(Arrayen_Med_Talen(IOuter), Arrayen_Med_Talen(Minsta_Talet_Index)); end loop; end Sort; procedure Test_Get(Date: out Date_Type) is begin loop begin Get(Date); exit; exception when YEAR_ERROR => Put_Line("FEL: YEAR_ERROR"); when MONTH_ERROR => Put_Line("FEL: MONTH_ERROR"); when DAY_ERROR => Put_Line("FEL: DAY_ERROR"); when FORMAT_ERROR => Put_Line("FEL: FORMAT_ERROR"); end; end loop; end Test_Get; Date: Date_Type; Date2: Date_Type; begin Test_Get(Date); Test_Get(Date2); Put(Date); New_Line; Put(Date2); New_Line; if Date = Date2 then Put("Lika"); New_Line; else Put("Olika"); New_Line; end if; if Date > Date2 then Put(Date); Put(" > "); Put(Date2); New_Line; else Put(Date); Put(" !!> "); Put(Date2); New_Line; end if; if Date < Date2 then Put(Date); Put(" < "); Put(Date2); New_Line; else Put(Date); Put(" !!< "); Put(Date2); New_Line; end if; -- Date := Previous_Date(Date); -- Put(Date); New_Line; -- Date := Next_Date(Date); -- Put(Date); New_Line; --for I in 1..368 loop -- Date := Previous_Date(Date); -- Put(Date); New_Line; --end loop; --Test_Leap_Years; end Lab4fg;
Fabien-Chouteau/coffee-clock
Ada
4,932
adb
------------------------------------------------------------------------------- -- -- -- Coffee Clock -- -- -- -- Copyright (C) 2016-2017 Fabien Chouteau -- -- -- -- Coffee Clock 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. -- -- -- -- Coffee Clock 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 We Noise Maker. If not, see <http://www.gnu.org/licenses/>. -- -- -- ------------------------------------------------------------------------------- with LCD_Graphic_Backend; with Giza.GUI; with Giza.Context; with Giza.Bitmap_Fonts.FreeSerifItalic18pt7b; with Ada.Synchronous_Task_Control; with STM32.RNG.Polling; with System; with Giza.Events; use Giza.Events; with Ada.Real_Time; use Ada.Real_Time; with STM32.Board; with HAL.Touch_Panel; use HAL.Touch_Panel; with Clock_Window; package body GUI is Backend : aliased LCD_Graphic_Backend.Instance; Context : aliased Giza.Context.Instance; Main_W : aliased Clock_Window.Instance; Sync : Ada.Synchronous_Task_Control.Suspension_Object; type Touch_State is record Touch_Detected : Boolean; X : Natural; Y : Natural; end record; function Current_Touch_State return Touch_State; ------------------------- -- Current_Touch_State -- ------------------------- function Current_Touch_State return Touch_State is TS : Touch_State; ST_TS : constant HAL.Touch_Panel.TP_State := STM32.Board.Touch_Panel.Get_All_Touch_Points; begin TS.Touch_Detected := ST_TS'Length > 0; if TS.Touch_Detected then TS.X := ST_TS (1).X; TS.Y := ST_TS (1).Y; else TS.X := 0; TS.Y := 0; end if; return TS; end Current_Touch_State; task Touch_Screen is pragma Priority (System.Default_Priority - 1); end Touch_Screen; task body Touch_Screen is TS, Prev : Touch_State; Click_Evt : constant Click_Event_Ref := new Click_Event; Release_Evt : constant Click_Released_Event_Ref := new Click_Released_Event; begin Ada.Synchronous_Task_Control.Suspend_Until_True (Sync); Prev.Touch_Detected := False; loop -- STM32F4.Touch_Panel.Wait_For_Touch_Detected; TS := Current_Touch_State; if TS.Touch_Detected /= Prev.Touch_Detected then if TS.Touch_Detected then Click_Evt.Pos.X := TS.X; Click_Evt.Pos.Y := TS.Y; Giza.GUI.Emit (Event_Not_Null_Ref (Click_Evt)); else Giza.GUI.Emit (Event_Not_Null_Ref (Release_Evt)); end if; end if; Prev := TS; delay until Clock + Milliseconds (10); end loop; end Touch_Screen; ---------------- -- Initialize -- ---------------- procedure Initialize is begin LCD_Graphic_Backend.Initialize; Giza.GUI.Set_Backend (Backend'Access); STM32.Board.Touch_Panel.Initialize; Context.Set_Font (Giza.Bitmap_Fonts.FreeSerifItalic18pt7b.Font); Giza.GUI.Set_Context (Context'Access); end Initialize; ----------- -- Start -- ----------- procedure Start is begin STM32.Board.Configure_User_Button_GPIO; Giza.GUI.Push (Main_W'Access); Ada.Synchronous_Task_Control.Set_True (Sync); Giza.GUI.Event_Loop; end Start; ------------ -- Random -- ------------ function Random (Modulo : Unsigned_32) return Unsigned_32 is Rand_Exess : constant Unsigned_32 := (Unsigned_32'Last mod Modulo) + 1; Rand_Linit : constant Unsigned_32 := Unsigned_32'Last - Rand_Exess; Ret : Unsigned_32; begin loop Ret := STM32.RNG.Polling.Random; exit when Ret <= Rand_Linit; end loop; return Ret mod Modulo; end Random; end GUI;
reznikmm/matreshka
Ada
4,875
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Tools Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Ada.Characters.Latin_1; with Ada.Strings.Fixed; with Ada.Text_IO; with Configure.Internals; package body Configure.Abstract_Tests is use Ada.Text_IO; use Configure.Internals; ------------------ -- Report_Check -- ------------------ procedure Report_Check (Self : in out Abstract_Test'Class; Message : String) is Name : constant String := Self.Name; Last : constant Natural := Integer'Min (Name'Length, 10); Msg : String := "[ ] " & Message & "..."; begin Msg (2 .. Last + 1) := Name (1 .. Last); Self.Test_Log_Prefix := To_Unbounded_String (Msg (Msg'First .. Msg'Last - 3)); Put (Standard_Error, Msg); Flush (Standard_Error); Put_Line (Log_Output, Msg); Flush (Log_Output); end Report_Check; ---------------- -- Report_Log -- ---------------- procedure Report_Log (Self : Abstract_Test'Class; Message : String) is begin Put_Line (Log_Output, Message); Flush (Log_Output); end Report_Log; ------------------- -- Report_Status -- ------------------- procedure Report_Status (Self : Abstract_Test'Class; Message : String) is use Ada.Characters.Latin_1; use Ada.Strings.Fixed; Msg : constant String := ": " & Message; begin Put_Line (Standard_Error, (3 * BS) & Msg); Flush (Standard_Error); Put_Line (Log_Output, To_String (Self.Test_Log_Prefix) & Msg); Flush (Log_Output); end Report_Status; end Configure.Abstract_Tests;
reznikmm/matreshka
Ada
4,606
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ private package Matreshka.Internals.Text_Codecs.ISO88595 is pragma Preelaborate; ------------------------- -- ISO88595_Decoder -- ------------------------- type ISO88595_Decoder is new Abstract_Decoder with private; overriding function Is_Error (Self : ISO88595_Decoder) return Boolean; overriding function Is_Mailformed (Self : ISO88595_Decoder) return Boolean; overriding procedure Decode_Append (Self : in out ISO88595_Decoder; Data : Ada.Streams.Stream_Element_Array; String : in out Matreshka.Internals.Strings.Shared_String_Access); function Decoder (Mode : Decoder_Mode) return Abstract_Decoder'Class; ------------------------- -- ISO88595_Encoder -- ------------------------- type ISO88595_Encoder is new Abstract_Encoder with private; overriding procedure Encode (Self : in out ISO88595_Encoder; String : not null Matreshka.Internals.Strings.Shared_String_Access; Buffer : out MISEV.Shared_Stream_Element_Vector_Access); function Encoder return Abstract_Encoder'Class; private type ISO88595_Decoder is new Abstract_Decoder with null record; type ISO88595_Encoder is new Abstract_Encoder with null record; end Matreshka.Internals.Text_Codecs.ISO88595;
reznikmm/matreshka
Ada
4,161
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_Non_Whitespace_Character_Count_Attributes; package Matreshka.ODF_Meta.Non_Whitespace_Character_Count_Attributes is type Meta_Non_Whitespace_Character_Count_Attribute_Node is new Matreshka.ODF_Meta.Abstract_Meta_Attribute_Node and ODF.DOM.Meta_Non_Whitespace_Character_Count_Attributes.ODF_Meta_Non_Whitespace_Character_Count_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Meta_Non_Whitespace_Character_Count_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Meta_Non_Whitespace_Character_Count_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Meta.Non_Whitespace_Character_Count_Attributes;
charlie5/lace
Ada
14,374
ads
-- This file is generated by SWIG. Please do *not* modify by hand. -- with bullet_c.Pointers; with bullet_c.ray_Collision; with c_math_c; with c_math_c.Matrix_3x3; with c_math_c.Matrix_4x4; with c_math_c.Pointers; with c_math_c.Triangle; with c_math_c.Vector_2; with c_math_c.Vector_3; with Interfaces.C; with Swig; package bullet_c.Binding is function b3d_new_Box (half_Extents : in c_math_c.Vector_3.Pointer) return bullet_c.Pointers.Shape_Pointer; function b3d_new_Capsule (Radii : in c_math_c.Vector_2.Pointer; Height : in c_math_c.Real) return bullet_c.Pointers.Shape_Pointer; function b3d_new_Cone (Radius : in c_math_c.Real; Height : in c_math_c.Real) return bullet_c.Pointers.Shape_Pointer; function b3d_new_convex_Hull (Points : in c_math_c.Vector_3.Pointer; point_Count : in Interfaces.C.int) return bullet_c.Pointers.Shape_Pointer; function b3d_new_Mesh (Points : in c_math_c.Vector_3.Pointer; point_Count : in Interfaces.C.int; Triangles : in c_math_c.Triangle.Pointer; triangle_Count : in Interfaces.C.int) return bullet_c.Pointers.Shape_Pointer; function b3d_new_Cylinder (half_Extents : in c_math_c.Vector_3.Pointer) return bullet_c.Pointers.Shape_Pointer; function b3d_new_Heightfield (Width : in Interfaces.C.int; Depth : in Interfaces.C.int; Heights : in c_math_c.Pointers.Real_Pointer; min_Height : in c_math_c.Real; max_Height : in c_math_c.Real; Scale : in c_math_c.Vector_3.Pointer) return bullet_c.Pointers.Shape_Pointer; function b3d_new_multiSphere (Positions : in c_math_c.Vector_3.Pointer; Radii : in c_math_c.Pointers.Real_Pointer; sphere_Count : in Interfaces.C.int) return bullet_c.Pointers.Shape_Pointer; function b3d_new_Plane (Normal : in c_math_c.Vector_3.Pointer; Offset : in c_math_c.Real) return bullet_c.Pointers.Shape_Pointer; function b3d_new_Sphere (Radius : in c_math_c.Real) return bullet_c.Pointers.Shape_Pointer; function b3d_Shape_user_Data (Self : in bullet_c.Pointers.Shape_Pointer) return Swig.void_ptr; procedure b3d_Shape_user_Data_is (Self : in bullet_c.Pointers.Shape_Pointer; Now : in Swig.void_ptr); function b3d_new_Object (Mass : in c_math_c.Real; the_Shape : in bullet_c.Pointers.Shape_Pointer; is_Kinematic : in Interfaces.C.int) return bullet_c.Pointers.Object_Pointer; function b3d_Object_Shape (Self : in bullet_c.Pointers.Object_Pointer) return bullet_c.Pointers.Shape_Pointer; function b3d_Object_user_Data (Self : in bullet_c.Pointers.Object_Pointer) return Swig.void_ptr; procedure b3d_Object_user_Data_is (Self : in bullet_c.Pointers.Object_Pointer; Now : in Swig.void_ptr); function b3d_Object_Mass (Self : in bullet_c.Pointers.Object_Pointer) return c_math_c.Real; procedure b3d_Object_Friction_is (Self : in bullet_c.Pointers.Object_Pointer; Now : in c_math_c.Real); procedure b3d_Object_Restitution_is (Self : in bullet_c.Pointers.Object_Pointer; Now : in c_math_c.Real); function b3d_Object_Site (Self : in bullet_c.Pointers.Object_Pointer) return c_math_c.Vector_3.Item; procedure b3d_Object_Site_is (Self : in bullet_c.Pointers.Object_Pointer; Now : in c_math_c.Vector_3.Pointer); function b3d_Object_Spin (Self : in bullet_c.Pointers.Object_Pointer) return c_math_c.Matrix_3x3.Item; procedure b3d_Object_Spin_is (Self : in bullet_c.Pointers.Object_Pointer; Now : in c_math_c.Matrix_3x3.Pointer); function b3d_Object_Transform (Self : in bullet_c.Pointers.Object_Pointer) return c_math_c.Matrix_4x4.Item; procedure b3d_Object_Transform_is (Self : in bullet_c.Pointers.Object_Pointer; Now : in c_math_c.Matrix_4x4.Pointer); function b3d_Object_Speed (Self : in bullet_c.Pointers.Object_Pointer) return c_math_c.Vector_3.Item; procedure b3d_Object_Speed_is (Self : in bullet_c.Pointers.Object_Pointer; Now : in c_math_c.Vector_3.Pointer); function b3d_Object_Gyre (Self : in bullet_c.Pointers.Object_Pointer) return c_math_c.Vector_3.Item; procedure b3d_Object_Gyre_is (Self : in bullet_c.Pointers.Object_Pointer; Now : in c_math_c.Vector_3.Pointer); procedure b3d_Object_apply_Force (Self : in bullet_c.Pointers.Object_Pointer; Force : in c_math_c.Vector_3.Pointer); procedure b3d_Object_apply_Torque (Self : in bullet_c.Pointers.Object_Pointer; Torque : in c_math_c.Vector_3.Pointer); procedure b3d_Object_apply_Torque_impulse (Self : in bullet_c.Pointers.Object_Pointer; Torque : in c_math_c.Vector_3.Pointer); function b3d_new_hinge_Joint (Object_A : in bullet_c.Pointers.Object_Pointer; Object_B : in bullet_c.Pointers.Object_Pointer; Frame_A : in c_math_c.Matrix_4x4.Pointer; Frame_B : in c_math_c.Matrix_4x4.Pointer) return bullet_c.Pointers.Joint_Pointer; function b3d_new_space_hinge_Joint (Object_A : in bullet_c.Pointers.Object_Pointer; Frame_A : in c_math_c.Matrix_4x4.Pointer) return bullet_c.Pointers.Joint_Pointer; function b3d_new_DoF6_Joint (Object_A : in bullet_c.Pointers.Object_Pointer; Object_B : in bullet_c.Pointers.Object_Pointer; Frame_A : in c_math_c.Matrix_4x4.Pointer; Frame_B : in c_math_c.Matrix_4x4.Pointer) return bullet_c.Pointers.Joint_Pointer; function b3d_new_cone_twist_Joint (Object_A : in bullet_c.Pointers.Object_Pointer; Object_B : in bullet_c.Pointers.Object_Pointer; Frame_A : in c_math_c.Matrix_4x4.Pointer; Frame_B : in c_math_c.Matrix_4x4.Pointer) return bullet_c.Pointers.Joint_Pointer; function b3d_new_slider_Joint (Object_A : in bullet_c.Pointers.Object_Pointer; Object_B : in bullet_c.Pointers.Object_Pointer; Frame_A : in c_math_c.Matrix_4x4.Pointer; Frame_B : in c_math_c.Matrix_4x4.Pointer) return bullet_c.Pointers.Joint_Pointer; function b3d_new_ball_Joint (Object_A : in bullet_c.Pointers.Object_Pointer; Object_B : in bullet_c.Pointers.Object_Pointer; Pivot_in_A : in c_math_c.Vector_3.Pointer; Pivot_in_B : in c_math_c.Vector_3.Pointer) return bullet_c.Pointers.Joint_Pointer; function b3d_Joint_user_Data (Self : in bullet_c.Pointers.Joint_Pointer) return Swig.void_ptr; procedure b3d_Joint_user_Data_is (Self : in bullet_c.Pointers.Joint_Pointer; Now : in Swig.void_ptr); function b3d_Joint_Object_A (Self : in bullet_c.Pointers.Joint_Pointer) return bullet_c.Pointers.Object_Pointer; function b3d_Joint_Object_B (Self : in bullet_c.Pointers.Joint_Pointer) return bullet_c.Pointers.Object_Pointer; function b3d_Joint_Frame_A (Self : in bullet_c.Pointers.Joint_Pointer) return c_math_c.Matrix_4x4.Item; function b3d_Joint_Frame_B (Self : in bullet_c.Pointers.Joint_Pointer) return c_math_c.Matrix_4x4.Item; procedure b3d_Joint_Frame_A_is (Self : in bullet_c.Pointers.Joint_Pointer; Now : in c_math_c.Matrix_4x4.Pointer); procedure b3d_Joint_Frame_B_is (Self : in bullet_c.Pointers.Joint_Pointer; Now : in c_math_c.Matrix_4x4.Pointer); function b3d_Joint_is_Limited (Self : in bullet_c.Pointers.Joint_Pointer; DoF : in Interfaces.C.int) return Swig.bool; function b3d_Joint_Extent (Self : in bullet_c.Pointers.Joint_Pointer; DoF : in Interfaces.C.int) return Swig.bool; procedure b3d_Joint_Velocity_is (Self : in bullet_c.Pointers.Joint_Pointer; DoF : in Interfaces.C.int; Now : in c_math_c.Real); procedure b3d_Joint_hinge_Limits_are (Self : in bullet_c.Pointers.Joint_Pointer; Lower : in c_math_c.Real; Upper : in c_math_c.Real; Softeness : in c_math_c.Real; bias_Factor : in c_math_c.Real; relaxation_Factor : in c_math_c.Real); procedure b3d_Joint_6DoF_lower_Limit_is (Self : in bullet_c.Pointers.Joint_Pointer; DoF : in Interfaces.C.int; Now : in c_math_c.Real); procedure b3d_Joint_6DoF_upper_Limit_is (Self : in bullet_c.Pointers.Joint_Pointer; DoF : in Interfaces.C.int; Now : in c_math_c.Real); function b3d_Joint_6DoF_lower_Limit (Self : in bullet_c.Pointers.Joint_Pointer; DoF : in Interfaces.C.int) return c_math_c.Real; function b3d_Joint_6DoF_upper_Limit (Self : in bullet_c.Pointers.Joint_Pointer; DoF : in Interfaces.C.int) return c_math_c.Real; function b3d_new_Space return bullet_c.Pointers.Space_Pointer; procedure b3d_free_Space (Self : in bullet_c.Pointers.Space_Pointer); procedure b3d_Space_add_Object (Self : in bullet_c.Pointers.Space_Pointer; the_Object : in bullet_c.Pointers.Object_Pointer); procedure b3d_Space_rid_Object (Self : in bullet_c.Pointers.Space_Pointer; the_Object : in bullet_c.Pointers.Object_Pointer); procedure b3d_Space_add_Joint (Self : in bullet_c.Pointers.Space_Pointer; the_Joint : in bullet_c.Pointers.Joint_Pointer); procedure b3d_Space_Gravity_is (Self : in bullet_c.Pointers.Space_Pointer; Now : in c_math_c.Vector_3.Pointer); procedure b3d_Space_evolve (Self : in bullet_c.Pointers.Space_Pointer; By : in Interfaces.C.C_float); function b3d_Space_cast_Ray (Self : in bullet_c.Pointers.Space_Pointer; From : in c_math_c.Vector_3.Pointer; To : in c_math_c.Vector_3.Pointer) return bullet_c.ray_Collision.Item; private pragma Import (C, b3d_new_Box, "Ada_b3d_new_Box"); pragma Import (C, b3d_new_Capsule, "Ada_b3d_new_Capsule"); pragma Import (C, b3d_new_Cone, "Ada_b3d_new_Cone"); pragma Import (C, b3d_new_convex_Hull, "Ada_b3d_new_convex_Hull"); pragma Import (C, b3d_new_Mesh, "Ada_b3d_new_Mesh"); pragma Import (C, b3d_new_Cylinder, "Ada_b3d_new_Cylinder"); pragma Import (C, b3d_new_Heightfield, "Ada_b3d_new_Heightfield"); pragma Import (C, b3d_new_multiSphere, "Ada_b3d_new_multiSphere"); pragma Import (C, b3d_new_Plane, "Ada_b3d_new_Plane"); pragma Import (C, b3d_new_Sphere, "Ada_b3d_new_Sphere"); pragma Import (C, b3d_Shape_user_Data, "Ada_b3d_Shape_user_Data"); pragma Import (C, b3d_Shape_user_Data_is, "Ada_b3d_Shape_user_Data_is"); pragma Import (C, b3d_new_Object, "Ada_b3d_new_Object"); pragma Import (C, b3d_Object_Shape, "Ada_b3d_Object_Shape"); pragma Import (C, b3d_Object_user_Data, "Ada_b3d_Object_user_Data"); pragma Import (C, b3d_Object_user_Data_is, "Ada_b3d_Object_user_Data_is"); pragma Import (C, b3d_Object_Mass, "Ada_b3d_Object_Mass"); pragma Import (C, b3d_Object_Friction_is, "Ada_b3d_Object_Friction_is"); pragma Import (C, b3d_Object_Restitution_is, "Ada_b3d_Object_Restitution_is"); pragma Import (C, b3d_Object_Site, "Ada_b3d_Object_Site"); pragma Import (C, b3d_Object_Site_is, "Ada_b3d_Object_Site_is"); pragma Import (C, b3d_Object_Spin, "Ada_b3d_Object_Spin"); pragma Import (C, b3d_Object_Spin_is, "Ada_b3d_Object_Spin_is"); pragma Import (C, b3d_Object_Transform, "Ada_b3d_Object_Transform"); pragma Import (C, b3d_Object_Transform_is, "Ada_b3d_Object_Transform_is"); pragma Import (C, b3d_Object_Speed, "Ada_b3d_Object_Speed"); pragma Import (C, b3d_Object_Speed_is, "Ada_b3d_Object_Speed_is"); pragma Import (C, b3d_Object_Gyre, "Ada_b3d_Object_Gyre"); pragma Import (C, b3d_Object_Gyre_is, "Ada_b3d_Object_Gyre_is"); pragma Import (C, b3d_Object_apply_Force, "Ada_b3d_Object_apply_Force"); pragma Import (C, b3d_Object_apply_Torque, "Ada_b3d_Object_apply_Torque"); pragma Import (C, b3d_Object_apply_Torque_impulse, "Ada_b3d_Object_apply_Torque_impulse"); pragma Import (C, b3d_new_hinge_Joint, "Ada_b3d_new_hinge_Joint"); pragma Import (C, b3d_new_space_hinge_Joint, "Ada_b3d_new_space_hinge_Joint"); pragma Import (C, b3d_new_DoF6_Joint, "Ada_b3d_new_DoF6_Joint"); pragma Import (C, b3d_new_cone_twist_Joint, "Ada_b3d_new_cone_twist_Joint"); pragma Import (C, b3d_new_slider_Joint, "Ada_b3d_new_slider_Joint"); pragma Import (C, b3d_new_ball_Joint, "Ada_b3d_new_ball_Joint"); pragma Import (C, b3d_Joint_user_Data, "Ada_b3d_Joint_user_Data"); pragma Import (C, b3d_Joint_user_Data_is, "Ada_b3d_Joint_user_Data_is"); pragma Import (C, b3d_Joint_Object_A, "Ada_b3d_Joint_Object_A"); pragma Import (C, b3d_Joint_Object_B, "Ada_b3d_Joint_Object_B"); pragma Import (C, b3d_Joint_Frame_A, "Ada_b3d_Joint_Frame_A"); pragma Import (C, b3d_Joint_Frame_B, "Ada_b3d_Joint_Frame_B"); pragma Import (C, b3d_Joint_Frame_A_is, "Ada_b3d_Joint_Frame_A_is"); pragma Import (C, b3d_Joint_Frame_B_is, "Ada_b3d_Joint_Frame_B_is"); pragma Import (C, b3d_Joint_is_Limited, "Ada_b3d_Joint_is_Limited"); pragma Import (C, b3d_Joint_Extent, "Ada_b3d_Joint_Extent"); pragma Import (C, b3d_Joint_Velocity_is, "Ada_b3d_Joint_Velocity_is"); pragma Import (C, b3d_Joint_hinge_Limits_are, "Ada_b3d_Joint_hinge_Limits_are"); pragma Import (C, b3d_Joint_6DoF_lower_Limit_is, "Ada_b3d_Joint_6DoF_lower_Limit_is"); pragma Import (C, b3d_Joint_6DoF_upper_Limit_is, "Ada_b3d_Joint_6DoF_upper_Limit_is"); pragma Import (C, b3d_Joint_6DoF_lower_Limit, "Ada_b3d_Joint_6DoF_lower_Limit"); pragma Import (C, b3d_Joint_6DoF_upper_Limit, "Ada_b3d_Joint_6DoF_upper_Limit"); pragma Import (C, b3d_new_Space, "Ada_b3d_new_Space"); pragma Import (C, b3d_free_Space, "Ada_b3d_free_Space"); pragma Import (C, b3d_Space_add_Object, "Ada_b3d_Space_add_Object"); pragma Import (C, b3d_Space_rid_Object, "Ada_b3d_Space_rid_Object"); pragma Import (C, b3d_Space_add_Joint, "Ada_b3d_Space_add_Joint"); pragma Import (C, b3d_Space_Gravity_is, "Ada_b3d_Space_Gravity_is"); pragma Import (C, b3d_Space_evolve, "Ada_b3d_Space_evolve"); pragma Import (C, b3d_Space_cast_Ray, "Ada_b3d_Space_cast_Ray"); end bullet_c.Binding;
reznikmm/matreshka
Ada
4,607
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_Smil.Accumulate_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Smil_Accumulate_Attribute_Node is begin return Self : Smil_Accumulate_Attribute_Node do Matreshka.ODF_Smil.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Smil_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Smil_Accumulate_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Accumulate_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Smil_URI, Matreshka.ODF_String_Constants.Accumulate_Attribute, Smil_Accumulate_Attribute_Node'Tag); end Matreshka.ODF_Smil.Accumulate_Attributes;
stcarrez/ada-enet
Ada
2,408
ads
----------------------------------------------------------------------- -- net -- Network stack -- Copyright (C) 2016, 2017 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Interfaces; with System; -- == Embedded Network Stack == -- The <b>Embedded Network Stack</b> is a small IPv4 network stack intended to be -- used by small embedded Ada applications. -- -- @include net-buffers.ads -- @include net-interfaces.ads -- @include net-protos-arp.ads package Net is pragma Pure; -- The network stack interrupt priority. It is used to configure the Ethernet driver -- interrupt priority as well as the protected objects that could depend on it. Network_Priority : constant System.Interrupt_Priority := System.Interrupt_Priority'First; subtype Uint8 is Interfaces.Unsigned_8; subtype Uint16 is Interfaces.Unsigned_16; subtype Uint32 is Interfaces.Unsigned_32; subtype Uint64 is Interfaces.Unsigned_64; -- Length of an IPv4 packet. type Ip_Length is new Uint16; -- IPv4 address representation. type Ip_Addr is array (1 .. 4) of Uint8; -- Ethernet address representation. type Ether_Addr is array (1 .. 6) of Uint8; -- The error code returned by some opeartions. type Error_Code is (EOK, -- No error. ENOBUFS, -- No buffer for the operation. ENETUNREACH, -- Network unreachable. EINPROGRESS -- Operation is in progress. ); use type Interfaces.Unsigned_8; use type Interfaces.Unsigned_16; use type Interfaces.Unsigned_32; -- Returns true if the IPv4 address is a multicast address. function Is_Multicast (IP : in Ip_Addr) return Boolean; end Net;
jwarwick/aoc_2020
Ada
2,238
adb
-- AoC 2020, Day X with Ada.Text_IO; -- with Ada.Containers.Indefinite_Hashed_Maps; -- with Ada.Containers.Ordered_Sets; -- with Ada.Strings.Hash; -- with Ada.Strings.Fixed; use Ada.Strings.Fixed; -- with GNAT.String_Split; -- with Ada.Characters.Latin_1; package body Day is package TIO renames Ada.Text_IO; -- package Orbit_Element_Set is new Ada.Containers.Ordered_Sets -- (Element_Type => Unbounded_String); -- type Orbit is record -- Name : Unbounded_String := Null_Unbounded_String; -- Parent : Unbounded_String := Null_Unbounded_String; -- Children : Orbit_Element_Set.Set := Orbit_Element_Set.Empty_Set; -- Depth : Natural := 0; -- end record; -- pragma Warnings (Off, "procedure ""Put"" is not referenced"); -- procedure Put(value : in Orbit) is -- pragma Warnings (On, "procedure ""Put"" is not referenced"); -- begin -- TIO.Put("Orbit: " & to_string(value.Name) & ", Parent: " & to_string(value.Parent) & ", Depth: " & Natural'IMAGE(value.Depth)); -- TIO.New_Line; -- TIO.Put(" Children: "); -- for c of value.Children loop -- TIO.Put(to_string(c) & " "); -- end loop; -- end Put; -- package Orbit_Hashed_Maps is new Ada.Containers.Indefinite_Hashed_Maps -- (Key_Type => String, -- Element_Type => Orbit, -- Hash => Ada.Strings.Hash, -- Equivalent_Keys => "="); -- procedure parse_line(line : in String; orbits : in out Orbit_List.Vector) is -- idx : constant Natural := index(line, ")"); -- left : constant String := line(line'first .. idx-1); -- right : constant String := line(idx+1 .. line'last); -- curr : constant Orbit_Entry := Orbit_Entry'(left => to_unbounded_string(left), right => to_unbounded_string(right)); -- begin -- orbits.append(curr); -- end parse_line; -- function load_orbits(filename : in String) return Orbit_List.Vector is -- file : TIO.File_Type; -- orbits : Orbit_List.Vector; -- begin -- TIO.open(File => file, Mode => TIO.In_File, Name => filename); -- while not TIO.end_of_file(file) loop -- parse_line(TIO.get_line(file), orbits); -- end loop; -- TIO.close(file); -- return orbits; -- end load_orbits; end Day;
reznikmm/matreshka
Ada
4,025
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.Form_Allow_Updates_Attributes; package Matreshka.ODF_Form.Allow_Updates_Attributes is type Form_Allow_Updates_Attribute_Node is new Matreshka.ODF_Form.Abstract_Form_Attribute_Node and ODF.DOM.Form_Allow_Updates_Attributes.ODF_Form_Allow_Updates_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Form_Allow_Updates_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Form_Allow_Updates_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Form.Allow_Updates_Attributes;
zhmu/ananas
Ada
7,173
adb
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . W I D E _ W I D E _ T E X T _ I O . M O D U L A R _ I O -- -- -- -- 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.Wide_Wide_Text_IO.Integer_Aux; with System.Img_BIU; use System.Img_BIU; with System.Img_Uns; use System.Img_Uns; with System.Img_LLB; use System.Img_LLB; with System.Img_LLU; use System.Img_LLU; with System.Img_LLW; use System.Img_LLW; with System.Img_LLLB; use System.Img_LLLB; with System.Img_LLLU; use System.Img_LLLU; with System.Img_LLLW; use System.Img_LLLW; with System.Img_WIU; use System.Img_WIU; with System.Val_Uns; use System.Val_Uns; with System.Val_LLU; use System.Val_LLU; with System.Val_LLLU; use System.Val_LLLU; with System.WCh_Con; use System.WCh_Con; with System.WCh_WtS; use System.WCh_WtS; package body Ada.Wide_Wide_Text_IO.Modular_IO is package Aux_Uns is new Ada.Wide_Wide_Text_IO.Integer_Aux (Unsigned, Scan_Unsigned, Set_Image_Unsigned, Set_Image_Width_Unsigned, Set_Image_Based_Unsigned); package Aux_LLU is new Ada.Wide_Wide_Text_IO.Integer_Aux (Long_Long_Unsigned, Scan_Long_Long_Unsigned, Set_Image_Long_Long_Unsigned, Set_Image_Width_Long_Long_Unsigned, Set_Image_Based_Long_Long_Unsigned); package Aux_LLLU is new Ada.Wide_Wide_Text_IO.Integer_Aux (Long_Long_Long_Unsigned, Scan_Long_Long_Long_Unsigned, Set_Image_Long_Long_Long_Unsigned, Set_Image_Width_Long_Long_Long_Unsigned, Set_Image_Based_Long_Long_Long_Unsigned); Need_LLU : constant Boolean := Num'Base'Size > Unsigned'Size; Need_LLLU : constant Boolean := Num'Base'Size > Long_Long_Unsigned'Size; -- Throughout this generic body, we distinguish between cases where type -- Unsigned is acceptable, where type Long_Long_Unsigned is acceptable and -- where type Long_Long_Long_Unsigned is needed. These boolean constants -- are used to test for these cases and since they are constant, only code -- for the relevant case will be included in the instance. --------- -- Get -- --------- procedure Get (File : File_Type; Item : out Num; Width : Field := 0) is -- We depend on a range check to get Data_Error pragma Unsuppress (Range_Check); begin if Need_LLLU then Aux_LLLU.Get (File, Long_Long_Long_Unsigned (Item), Width); elsif Need_LLU then Aux_LLU.Get (File, Long_Long_Unsigned (Item), Width); else Aux_Uns.Get (File, Unsigned (Item), Width); end if; exception when Constraint_Error => raise Data_Error; end Get; procedure Get (Item : out Num; Width : Field := 0) is begin Get (Current_In, Item, Width); end Get; procedure Get (From : Wide_Wide_String; Item : out Num; Last : out Positive) is -- We depend on a range check to get Data_Error pragma Unsuppress (Range_Check); S : constant String := Wide_Wide_String_To_String (From, WCEM_Upper); -- String on which we do the actual conversion. Note that the method -- used for wide character encoding is irrelevant, since if there is -- a character outside the Standard.Character range then the call to -- Aux.Gets will raise Data_Error in any case. begin if Need_LLLU then Aux_LLLU.Gets (S, Long_Long_Long_Unsigned (Item), Last); elsif Need_LLU then Aux_LLU.Gets (S, Long_Long_Unsigned (Item), Last); else Aux_Uns.Gets (S, Unsigned (Item), Last); end if; exception when Constraint_Error => raise Data_Error; end Get; --------- -- Put -- --------- procedure Put (File : File_Type; Item : Num; Width : Field := Default_Width; Base : Number_Base := Default_Base) is begin if Need_LLLU then Aux_LLLU.Put (File, Long_Long_Long_Unsigned (Item), Width, Base); elsif Need_LLU then Aux_LLU.Put (File, Long_Long_Unsigned (Item), Width, Base); else Aux_Uns.Put (File, Unsigned (Item), Width, Base); end if; end Put; procedure Put (Item : Num; Width : Field := Default_Width; Base : Number_Base := Default_Base) is begin Put (Current_Out, Item, Width, Base); end Put; procedure Put (To : out Wide_Wide_String; Item : Num; Base : Number_Base := Default_Base) is S : String (To'First .. To'Last); begin if Need_LLLU then Aux_LLLU.Puts (S, Long_Long_Long_Unsigned (Item), Base); elsif Need_LLU then Aux_LLU.Puts (S, Long_Long_Unsigned (Item), Base); else Aux_Uns.Puts (S, Unsigned (Item), Base); end if; for J in S'Range loop To (J) := Wide_Wide_Character'Val (Character'Pos (S (J))); end loop; end Put; end Ada.Wide_Wide_Text_IO.Modular_IO;
reznikmm/lace
Ada
3,776
adb
-- SPDX-FileCopyrightText: 2021 Max Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- package body Lace.Generic_Engines is ------------------ -- Get_Property -- ------------------ function Get_Property (Self : access Engine; Element : Program.Elements.Element_Access; Name : Property_Name) return Property_Value is Key : constant Property_Key := (Lace.Element_Flat_Kinds.Flat_Kind (Element), Name); Descriptor : constant Property_Descriptor := Self.Descriptor (Key); Variant : Variant_Kind; Formula : Formula_Access; begin if Descriptor.Selector = null then return Descriptor.Formula (Self.Context, Element, Name); else Variant := Descriptor.Selector (Self.Context, Element, Name); Formula := Self.Varian.Element ((Key, Variant)); return Formula.all (Self.Context, Element, Name); end if; end Get_Property; ------------------ -- Get_Property -- ------------------ function Get_Property (Self : access Engine; List : Program.Element_Vectors.Element_Vector_Access; Name : Property_Name; Empty : Property_Value; Sum : access function (Left, Right : Property_Value) return Property_Value) return Property_Value is Result : Property_Value := Empty; begin for Cursor in List.Each_Element loop declare Next : constant Property_Value := Self.Get_Property (Cursor.Element, Name); begin Result := Sum (Result, Next); end; end loop; return Result; end Get_Property; ---------- -- Hash -- ---------- function Hash (Value : Property_Key) return Ada.Containers.Hash_Type is use type Ada.Containers.Hash_Type; begin return 997 * Ada.Containers.Hash_Type'Mod (Lace.Element_Flat_Kinds.Element_Flat_Kind'Pos (Value.Kind)) + Ada.Containers.Hash_Type'Mod (Property_Name'Pos (Value.Name)); end Hash; ---------- -- Hash -- ---------- function Hash (Value : Varian_Key) return Ada.Containers.Hash_Type is use type Ada.Containers.Hash_Type; begin return 7901 * Hash (Value.Variant) + Hash (Value.Property); end Hash; ---------------------- -- Register_Formula -- ---------------------- procedure Register_Formula (Self : in out Engine; Kind : Lace.Element_Flat_Kinds.Element_Flat_Kind; Name : Property_Name; Formula : not null Formula_Access) is begin Self.Descriptor.Insert ((Kind, Name), (Formula, null)); end Register_Formula; ----------------------- -- Register_Selector -- ----------------------- procedure Register_Selector (Self : in out Engine; Kind : Lace.Element_Flat_Kinds.Element_Flat_Kind; Name : Property_Name; Selector : not null Selector_Access) is begin Self.Descriptor.Insert ((Kind, Name), (null, Selector)); end Register_Selector; ---------------------- -- Register_Variant -- ---------------------- procedure Register_Variant (Self : in out Engine; Kind : Lace.Element_Flat_Kinds.Element_Flat_Kind; Name : Property_Name; Variant : Variant_Kind; Formula : access function (Engine : access Abstract_Context; Element : Program.Elements.Element_Access; Name : Property_Name) return Property_Value) is begin pragma Assert (Self.Descriptor.Element ((Kind, Name)).Selector /= null); Self.Varian.Insert (((Kind, Name), Variant), Formula); end Register_Variant; end Lace.Generic_Engines;