repo_name
stringlengths
9
74
language
stringclasses
1 value
length_bytes
int64
11
9.34M
extension
stringclasses
2 values
content
stringlengths
11
9.34M
reznikmm/matreshka
Ada
3,774
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Table_Group_By_Field_Number_Attributes is pragma Preelaborate; type ODF_Table_Group_By_Field_Number_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Table_Group_By_Field_Number_Attribute_Access is access all ODF_Table_Group_By_Field_Number_Attribute'Class with Storage_Size => 0; end ODF.DOM.Table_Group_By_Field_Number_Attributes;
reznikmm/matreshka
Ada
6,780
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.Number_Elements is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Text_Number_Element_Node is begin return Self : Text_Number_Element_Node do Matreshka.ODF_Text.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Text_Prefix); end return; end Create; ---------------- -- Enter_Node -- ---------------- overriding procedure Enter_Node (Self : not null access Text_Number_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_Text_Number (ODF.DOM.Text_Number_Elements.ODF_Text_Number_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 Text_Number_Element_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Number_Element; end Get_Local_Name; ---------------- -- Leave_Node -- ---------------- overriding procedure Leave_Node (Self : not null access Text_Number_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_Text_Number (ODF.DOM.Text_Number_Elements.ODF_Text_Number_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 Text_Number_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_Text_Number (Visitor, ODF.DOM.Text_Number_Elements.ODF_Text_Number_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.Text_URI, Matreshka.ODF_String_Constants.Number_Element, Text_Number_Element_Node'Tag); end Matreshka.ODF_Text.Number_Elements;
NCommander/dnscatcher
Ada
3,820
ads
-- Copyright 2019 Michael Casadevall <[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. with DNSCatcher.Network; -- @summary -- -- Implements the receiving front-end for UDP packets sent to the DNSCatcher -- server -- -- @description -- -- This package implements one half of the UDP implementation for DNSCatcher, -- and defacto handles requests from client receivers. -- package DNSCatcher.Network.UDP.Receiver is -- Packet receiving task task type Receive_Packet_Task is -- Initializes the receiver task -- -- @value Config -- Pointer to configuration object -- -- @value Socket -- GNAT.Sockets socket -- -- @value Transaction_Manager -- Pointer to Transaction Manager Task entry Initialize (Config : Configuration; Socket : Socket_Type; Transaction_Manager : DNS_Transaction_Manager_Task_Ptr); -- Start UDP receiver entry Start; -- Stop UDP receiver entry Stop; end Receive_Packet_Task; type Receive_Packet_Task_Ptr is access Receive_Packet_Task; --- Implementation of Network Receiver Interface -- -- @value Config -- Holds pointer to configuration object -- -- @value Receiver_Socket -- Holds GNAT.Socket pre-initialized -- -- @value Transaction_Manager -- Pointer to Transaction Manager Task -- -- @value Receiver_Task -- Receiver task held by the class object type UDP_Receiver_Interface is new DNSCatcher.Network .Receiver_Interface with record Config : Configuration; Receiver_Socket : Socket_Type; Transaction_Manager : DNS_Transaction_Manager_Task_Ptr; Receiver_Task : Receive_Packet_Task_Ptr; end record; type IPv4_UDP_Receiver_Interface_Ptr is access UDP_Receiver_Interface; -- Constructor for UDP receiver interface -- -- @value This -- Class object -- -- @value Config -- Holds pointer to configuration object -- -- @value Transaction_Manager -- Pointer to Transaction Manager Task -- -- @value Socket -- Holds GNAT.Socket pre-initialized -- procedure Initialize (This : in out UDP_Receiver_Interface; Config : Configuration; Transaction_Manager : DNS_Transaction_Manager_Task_Ptr; Socket : Socket_Type); -- Start the internal receiver task -- -- @value This -- Class object -- procedure Start (This : in out UDP_Receiver_Interface); -- Shutdown the internal receiver task -- -- @value This -- Class object -- procedure Shutdown (This : in out UDP_Receiver_Interface); end DNSCatcher.Network.UDP.Receiver;
1Crazymoney/LearnAda
Ada
14,061
ads
pragma Ada_95; with System; package ada_main is pragma Warnings (Off); gnat_argc : Integer; gnat_argv : System.Address; gnat_envp : System.Address; pragma Import (C, gnat_argc); pragma Import (C, gnat_argv); pragma Import (C, gnat_envp); gnat_exit_status : Integer; pragma Import (C, gnat_exit_status); GNAT_Version : constant String := "GNAT Version: GPL 2015 (20150428-49)" & ASCII.NUL; pragma Export (C, GNAT_Version, "__gnat_version"); Ada_Main_Program_Name : constant String := "_ada_tokeletes" & ASCII.NUL; pragma Export (C, Ada_Main_Program_Name, "__gnat_ada_main_program_name"); procedure adainit; pragma Export (C, adainit, "adainit"); procedure adafinal; pragma Export (C, adafinal, "adafinal"); function main (argc : Integer; argv : System.Address; envp : System.Address) return Integer; pragma Export (C, main, "main"); type Version_32 is mod 2 ** 32; u00001 : constant Version_32 := 16#f57573eb#; pragma Export (C, u00001, "tokeletesB"); u00002 : constant Version_32 := 16#fbff4c67#; pragma Export (C, u00002, "system__standard_libraryB"); u00003 : constant Version_32 := 16#f72f352b#; pragma Export (C, u00003, "system__standard_libraryS"); u00004 : constant Version_32 := 16#3ffc8e18#; pragma Export (C, u00004, "adaS"); u00005 : constant Version_32 := 16#f64b89a4#; pragma Export (C, u00005, "ada__integer_text_ioB"); u00006 : constant Version_32 := 16#f1daf268#; pragma Export (C, u00006, "ada__integer_text_ioS"); u00007 : constant Version_32 := 16#b612ca65#; pragma Export (C, u00007, "ada__exceptionsB"); u00008 : constant Version_32 := 16#1d190453#; pragma Export (C, u00008, "ada__exceptionsS"); u00009 : constant Version_32 := 16#a46739c0#; pragma Export (C, u00009, "ada__exceptions__last_chance_handlerB"); u00010 : constant Version_32 := 16#3aac8c92#; pragma Export (C, u00010, "ada__exceptions__last_chance_handlerS"); u00011 : constant Version_32 := 16#f4ce8c3a#; pragma Export (C, u00011, "systemS"); u00012 : constant Version_32 := 16#a207fefe#; pragma Export (C, u00012, "system__soft_linksB"); u00013 : constant Version_32 := 16#af945ded#; pragma Export (C, u00013, "system__soft_linksS"); u00014 : constant Version_32 := 16#b01dad17#; pragma Export (C, u00014, "system__parametersB"); u00015 : constant Version_32 := 16#8ae48145#; pragma Export (C, u00015, "system__parametersS"); u00016 : constant Version_32 := 16#b19b6653#; pragma Export (C, u00016, "system__secondary_stackB"); u00017 : constant Version_32 := 16#5faf4353#; pragma Export (C, u00017, "system__secondary_stackS"); u00018 : constant Version_32 := 16#39a03df9#; pragma Export (C, u00018, "system__storage_elementsB"); u00019 : constant Version_32 := 16#d90dc63e#; pragma Export (C, u00019, "system__storage_elementsS"); u00020 : constant Version_32 := 16#41837d1e#; pragma Export (C, u00020, "system__stack_checkingB"); u00021 : constant Version_32 := 16#7a71e7d2#; pragma Export (C, u00021, "system__stack_checkingS"); u00022 : constant Version_32 := 16#393398c1#; pragma Export (C, u00022, "system__exception_tableB"); u00023 : constant Version_32 := 16#5ad7ea2f#; pragma Export (C, u00023, "system__exception_tableS"); u00024 : constant Version_32 := 16#ce4af020#; pragma Export (C, u00024, "system__exceptionsB"); u00025 : constant Version_32 := 16#9cade1cc#; pragma Export (C, u00025, "system__exceptionsS"); u00026 : constant Version_32 := 16#37d758f1#; pragma Export (C, u00026, "system__exceptions__machineS"); u00027 : constant Version_32 := 16#b895431d#; pragma Export (C, u00027, "system__exceptions_debugB"); u00028 : constant Version_32 := 16#472c9584#; pragma Export (C, u00028, "system__exceptions_debugS"); u00029 : constant Version_32 := 16#570325c8#; pragma Export (C, u00029, "system__img_intB"); u00030 : constant Version_32 := 16#f6156cf8#; pragma Export (C, u00030, "system__img_intS"); u00031 : constant Version_32 := 16#b98c3e16#; pragma Export (C, u00031, "system__tracebackB"); u00032 : constant Version_32 := 16#6af355e1#; pragma Export (C, u00032, "system__tracebackS"); u00033 : constant Version_32 := 16#9ed49525#; pragma Export (C, u00033, "system__traceback_entriesB"); u00034 : constant Version_32 := 16#f4957a4a#; pragma Export (C, u00034, "system__traceback_entriesS"); u00035 : constant Version_32 := 16#8c33a517#; pragma Export (C, u00035, "system__wch_conB"); u00036 : constant Version_32 := 16#efb3aee8#; pragma Export (C, u00036, "system__wch_conS"); u00037 : constant Version_32 := 16#9721e840#; pragma Export (C, u00037, "system__wch_stwB"); u00038 : constant Version_32 := 16#c2a282e9#; pragma Export (C, u00038, "system__wch_stwS"); u00039 : constant Version_32 := 16#92b797cb#; pragma Export (C, u00039, "system__wch_cnvB"); u00040 : constant Version_32 := 16#e004141b#; pragma Export (C, u00040, "system__wch_cnvS"); u00041 : constant Version_32 := 16#6033a23f#; pragma Export (C, u00041, "interfacesS"); u00042 : constant Version_32 := 16#ece6fdb6#; pragma Export (C, u00042, "system__wch_jisB"); u00043 : constant Version_32 := 16#60740d3a#; pragma Export (C, u00043, "system__wch_jisS"); u00044 : constant Version_32 := 16#28f088c2#; pragma Export (C, u00044, "ada__text_ioB"); u00045 : constant Version_32 := 16#1a9b0017#; pragma Export (C, u00045, "ada__text_ioS"); u00046 : constant Version_32 := 16#10558b11#; pragma Export (C, u00046, "ada__streamsB"); u00047 : constant Version_32 := 16#2e6701ab#; pragma Export (C, u00047, "ada__streamsS"); u00048 : constant Version_32 := 16#db5c917c#; pragma Export (C, u00048, "ada__io_exceptionsS"); u00049 : constant Version_32 := 16#12c8cd7d#; pragma Export (C, u00049, "ada__tagsB"); u00050 : constant Version_32 := 16#ce72c228#; pragma Export (C, u00050, "ada__tagsS"); u00051 : constant Version_32 := 16#c3335bfd#; pragma Export (C, u00051, "system__htableB"); u00052 : constant Version_32 := 16#700c3fd0#; pragma Export (C, u00052, "system__htableS"); u00053 : constant Version_32 := 16#089f5cd0#; pragma Export (C, u00053, "system__string_hashB"); u00054 : constant Version_32 := 16#d25254ae#; pragma Export (C, u00054, "system__string_hashS"); u00055 : constant Version_32 := 16#699628fa#; pragma Export (C, u00055, "system__unsigned_typesS"); u00056 : constant Version_32 := 16#b44f9ae7#; pragma Export (C, u00056, "system__val_unsB"); u00057 : constant Version_32 := 16#793ec5c1#; pragma Export (C, u00057, "system__val_unsS"); u00058 : constant Version_32 := 16#27b600b2#; pragma Export (C, u00058, "system__val_utilB"); u00059 : constant Version_32 := 16#586e3ac4#; pragma Export (C, u00059, "system__val_utilS"); u00060 : constant Version_32 := 16#d1060688#; pragma Export (C, u00060, "system__case_utilB"); u00061 : constant Version_32 := 16#d0c7e5ed#; pragma Export (C, u00061, "system__case_utilS"); u00062 : constant Version_32 := 16#84a27f0d#; pragma Export (C, u00062, "interfaces__c_streamsB"); u00063 : constant Version_32 := 16#8bb5f2c0#; pragma Export (C, u00063, "interfaces__c_streamsS"); u00064 : constant Version_32 := 16#845f5a34#; pragma Export (C, u00064, "system__crtlS"); u00065 : constant Version_32 := 16#431faf3c#; pragma Export (C, u00065, "system__file_ioB"); u00066 : constant Version_32 := 16#53bf6d5f#; pragma Export (C, u00066, "system__file_ioS"); u00067 : constant Version_32 := 16#b7ab275c#; pragma Export (C, u00067, "ada__finalizationB"); u00068 : constant Version_32 := 16#19f764ca#; pragma Export (C, u00068, "ada__finalizationS"); u00069 : constant Version_32 := 16#95817ed8#; pragma Export (C, u00069, "system__finalization_rootB"); u00070 : constant Version_32 := 16#bb3cffaa#; pragma Export (C, u00070, "system__finalization_rootS"); u00071 : constant Version_32 := 16#769e25e6#; pragma Export (C, u00071, "interfaces__cB"); u00072 : constant Version_32 := 16#4a38bedb#; pragma Export (C, u00072, "interfaces__cS"); u00073 : constant Version_32 := 16#ee0f26dd#; pragma Export (C, u00073, "system__os_libB"); u00074 : constant Version_32 := 16#d7b69782#; pragma Export (C, u00074, "system__os_libS"); u00075 : constant Version_32 := 16#1a817b8e#; pragma Export (C, u00075, "system__stringsB"); u00076 : constant Version_32 := 16#8a719d5c#; pragma Export (C, u00076, "system__stringsS"); u00077 : constant Version_32 := 16#09511692#; pragma Export (C, u00077, "system__file_control_blockS"); u00078 : constant Version_32 := 16#f6fdca1c#; pragma Export (C, u00078, "ada__text_io__integer_auxB"); u00079 : constant Version_32 := 16#b9793d30#; pragma Export (C, u00079, "ada__text_io__integer_auxS"); u00080 : constant Version_32 := 16#181dc502#; pragma Export (C, u00080, "ada__text_io__generic_auxB"); u00081 : constant Version_32 := 16#a6c327d3#; pragma Export (C, u00081, "ada__text_io__generic_auxS"); u00082 : constant Version_32 := 16#18d57884#; pragma Export (C, u00082, "system__img_biuB"); u00083 : constant Version_32 := 16#afb4a0b7#; pragma Export (C, u00083, "system__img_biuS"); u00084 : constant Version_32 := 16#e7d8734f#; pragma Export (C, u00084, "system__img_llbB"); u00085 : constant Version_32 := 16#ee73b049#; pragma Export (C, u00085, "system__img_llbS"); u00086 : constant Version_32 := 16#9777733a#; pragma Export (C, u00086, "system__img_lliB"); u00087 : constant Version_32 := 16#e581d9eb#; pragma Export (C, u00087, "system__img_lliS"); u00088 : constant Version_32 := 16#0e8808d4#; pragma Export (C, u00088, "system__img_llwB"); u00089 : constant Version_32 := 16#471f93df#; pragma Export (C, u00089, "system__img_llwS"); u00090 : constant Version_32 := 16#428b07f8#; pragma Export (C, u00090, "system__img_wiuB"); u00091 : constant Version_32 := 16#c1f52725#; pragma Export (C, u00091, "system__img_wiuS"); u00092 : constant Version_32 := 16#7ebd8839#; pragma Export (C, u00092, "system__val_intB"); u00093 : constant Version_32 := 16#bc6ba605#; pragma Export (C, u00093, "system__val_intS"); u00094 : constant Version_32 := 16#b3aa7b17#; pragma Export (C, u00094, "system__val_lliB"); u00095 : constant Version_32 := 16#6eea6a9a#; pragma Export (C, u00095, "system__val_lliS"); u00096 : constant Version_32 := 16#06052bd0#; pragma Export (C, u00096, "system__val_lluB"); u00097 : constant Version_32 := 16#13647f88#; pragma Export (C, u00097, "system__val_lluS"); u00098 : constant Version_32 := 16#2bce1226#; pragma Export (C, u00098, "system__memoryB"); u00099 : constant Version_32 := 16#adb3ea0e#; pragma Export (C, u00099, "system__memoryS"); -- BEGIN ELABORATION ORDER -- ada%s -- interfaces%s -- system%s -- system.case_util%s -- system.case_util%b -- system.htable%s -- system.img_int%s -- system.img_int%b -- system.img_lli%s -- system.img_lli%b -- system.parameters%s -- system.parameters%b -- system.crtl%s -- interfaces.c_streams%s -- interfaces.c_streams%b -- system.standard_library%s -- system.exceptions_debug%s -- system.exceptions_debug%b -- system.storage_elements%s -- system.storage_elements%b -- system.stack_checking%s -- system.stack_checking%b -- system.string_hash%s -- system.string_hash%b -- system.htable%b -- system.strings%s -- system.strings%b -- system.os_lib%s -- system.traceback_entries%s -- system.traceback_entries%b -- ada.exceptions%s -- system.soft_links%s -- system.unsigned_types%s -- system.img_biu%s -- system.img_biu%b -- system.img_llb%s -- system.img_llb%b -- system.img_llw%s -- system.img_llw%b -- system.img_wiu%s -- system.img_wiu%b -- system.val_int%s -- system.val_lli%s -- system.val_llu%s -- system.val_uns%s -- system.val_util%s -- system.val_util%b -- system.val_uns%b -- system.val_llu%b -- system.val_lli%b -- system.val_int%b -- system.wch_con%s -- system.wch_con%b -- system.wch_cnv%s -- system.wch_jis%s -- system.wch_jis%b -- system.wch_cnv%b -- system.wch_stw%s -- system.wch_stw%b -- ada.exceptions.last_chance_handler%s -- ada.exceptions.last_chance_handler%b -- system.exception_table%s -- system.exception_table%b -- ada.io_exceptions%s -- ada.tags%s -- ada.streams%s -- ada.streams%b -- interfaces.c%s -- system.exceptions%s -- system.exceptions%b -- system.exceptions.machine%s -- system.file_control_block%s -- system.file_io%s -- system.finalization_root%s -- system.finalization_root%b -- ada.finalization%s -- ada.finalization%b -- system.memory%s -- system.memory%b -- system.standard_library%b -- system.secondary_stack%s -- system.file_io%b -- interfaces.c%b -- ada.tags%b -- system.soft_links%b -- system.os_lib%b -- system.secondary_stack%b -- system.traceback%s -- ada.exceptions%b -- system.traceback%b -- ada.text_io%s -- ada.text_io%b -- ada.text_io.generic_aux%s -- ada.text_io.generic_aux%b -- ada.text_io.integer_aux%s -- ada.text_io.integer_aux%b -- ada.integer_text_io%s -- ada.integer_text_io%b -- tokeletes%b -- END ELABORATION ORDER end ada_main;
jscparker/math_packages
Ada
10,504
adb
--------------------------------------------------------------------------- -- package body Givens_QR_Method -- Copyright (C) 2011-2018 Jonathan S. Parker -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --------------------------------------------------------------------------- with Ada.Numerics; with Ada.Numerics.Generic_Elementary_Functions; with Givens_Rotation; package body Givens_QR_Method is package math is new Ada.Numerics.Generic_Elementary_Functions (Real); use math; package Rotate is new Givens_Rotation (Real); use Rotate; Zero : constant Real := +0.0; One : constant Real := +1.0; Two : constant Real := +2.0; function Identity return A_Matrix is Q : A_Matrix; begin Q := (others => (others => Zero)); for c in C_Index loop Q(c, c) := One; end loop; return Q; end Identity; type Rotation is record sn : Real := Zero; cn : Real := One; cn_minus_1 : Real := Zero; sn_minus_1 : Real := Zero; P_bigger_than_L : Boolean := True; Skip_Rotation : Boolean := True; Pivot_Col : C_Index := C_Index'First; Hi_Row : R_Index := R_Index'First; Lo_Row : R_Index := R_Index'First; end record; --------------------------------- -- Lower_Diagonal_QR_Iteration -- --------------------------------- -- Operates only on square real blocks. procedure Lower_Diagonal_QR_Iteration (A : in out A_Matrix; Q : in out A_Matrix; Shift : in Real; Starting_Col : in C_Index := C_Index'First; Final_Col : in C_Index := C_Index'Last) is Hi_Row, Lo_Row : R_Index; P, L : Real; Rotations : array (C_Index) of Rotation; sn, cn : Real; cn_minus_1 : Real; sn_minus_1 : Real; P_bigger_than_L : Boolean; Skip_Rotation : Boolean; ------------------------------------------- -- e_Multiply_A_on_RHS_with_Transpose_of -- ------------------------------------------- -- multiply A on the right by R_transpose: -- A = A * R_transpose -- -- Use enhanced precision rotations here. procedure e_Multiply_A_on_RHS_with_Transpose_of (R : in Rotation) is sn : constant Real := R.sn; cn : constant Real := R.cn; cn_minus_1 : constant Real := R.cn_minus_1; sn_minus_1 : constant Real := R.sn_minus_1; P_bigger_than_L : constant Boolean := R.P_bigger_than_L; Skip_Rotation : constant Boolean := R.Skip_Rotation; Pivot_Row : constant R_Index := R.Hi_Row; Low_Row : constant R_Index := R.Lo_Row; A_pvt, A_low : Real; begin if Skip_Rotation then return; end if; -- Rotate corresponding columns. Multiply on RHS by transpose -- of above givens matrix (second step of similarity transformation). -- (Low_Row is Lo visually, but its index is higher than Pivot's.) if P_bigger_than_L then -- |s| < |c| for r in Starting_Col .. Final_Col loop A_pvt := A(r, Pivot_Row); A_low := A(r, Low_Row); A(r, Pivot_Row) := A_pvt + (cn_minus_1*A_pvt + sn * A_low); A(r, Low_Row) := A_low + (-sn * A_pvt + cn_minus_1*A_low); end loop; else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1 for r in Starting_Col .. Final_Col loop A_pvt := A(r, Pivot_Row); A_low := A(r, Low_Row); A(r, Pivot_Row) := A_low + (cn * A_pvt + sn_minus_1*A_low); A(r, Low_Row) :=-A_pvt + (-sn_minus_1*A_pvt + cn * A_low); end loop; end if; end e_Multiply_A_on_RHS_with_Transpose_of; ----------------------------------------- -- Rotate_to_Kill_Element_Lo_of_pCol -- ----------------------------------------- -- Try to zero out A(Lo_Row, Pivot_Col) with a similarity transformation. -- In other words, multiply A on left by R: -- -- A = R * A -- -- and multiply Q on right by R_transpose: -- -- Q = Q * R_transpose procedure Rotate_to_Kill_Element_Lo_of_pCol (R : in Rotation) is sn : constant Real := R.sn; cn : constant Real := R.cn; cn_minus_1 : constant Real := R.cn_minus_1; sn_minus_1 : constant Real := R.sn_minus_1; P_bigger_than_L : constant Boolean := R.P_bigger_than_L; Skip_Rotation : constant Boolean := R.Skip_Rotation; Pivot_Col : constant C_Index := R.Pivot_Col; Pivot_Row : constant R_Index := R.Hi_Row; Low_Row : constant R_Index := R.Lo_Row; A_pvt, A_low, Q_pvt, Q_low : Real; begin if Skip_Rotation then return; end if; if P_bigger_than_L then -- |s| < |c| --for c in Starting_Col .. Final_Col loop for c in Pivot_Col .. Final_Col loop -- works only for upper hessenbergs A_pvt := A(Pivot_Row, c); A_low := A(Low_Row, c); A(Pivot_Row, c) := A_pvt + (cn_minus_1*A_pvt + sn * A_low); A(Low_Row, c) := A_low + (-sn * A_pvt + cn_minus_1*A_low); end loop; else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1 --for c in Starting_Col .. Final_Col loop for c in Pivot_Col .. Final_Col loop -- works only for upper hessenbergs A_pvt := A(Pivot_Row, c); A_low := A(Low_Row, c); A(Pivot_Row, c) := A_low + (cn * A_pvt + sn_minus_1*A_low); A(Low_Row, c) :=-A_pvt + (-sn_minus_1*A_pvt + cn * A_low); end loop; end if; -- Rotate corresponding columns of Q. (Multiply on RHS by transpose -- of above givens matrix to accumulate full Q.) if P_bigger_than_L then -- |s| < |c| for r in Starting_Col .. Final_Col loop Q_pvt := Q(r, Pivot_Row); Q_low := Q(r, Low_Row); Q(r, Pivot_Row) := Q_pvt + (cn_minus_1*Q_pvt + sn * Q_low); Q(r, Low_Row) := Q_low + (-sn * Q_pvt + cn_minus_1*Q_low); end loop; else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1 for r in Starting_Col .. Final_Col loop Q_pvt := Q(r, Pivot_Row); Q_low := Q(r, Low_Row); Q(r, Pivot_Row) := Q_low + (cn * Q_pvt + sn_minus_1*Q_low); Q(r, Low_Row) :=-Q_pvt + (-sn_minus_1*Q_pvt + cn * Q_low); end loop; end if; end Rotate_to_Kill_Element_Lo_of_pCol; -- Sum = Small + Large. Lost_Bits = Small - (Sum - Large) procedure Sum_with_Dropped_Bits (A, B : in Real; Sum : out Real; Dropped_Bits : out Real) is begin Sum := A + B; if Abs A > Abs B then Dropped_Bits := B - (Sum - A); else Dropped_Bits := A - (Sum - B); end if; end Sum_with_Dropped_Bits; type Diag_Storage is array(C_Index) of Real; Lost_Bits : Diag_Storage; hypot : Real := Zero; begin if (Final_Col - Starting_Col) < 2 then return; end if; Lost_Bits := (others => 0.0); -- Subtract 'Shift' from each diagonal element of A. -- Sum = A(c, c) + (-Shift) -- Sum = Small + Large. Lost_Bits = Small - (Sum - Large) declare Sum, Dropped_Bits : Real; begin if Abs Shift > Zero then for c in Starting_Col .. Final_Col loop Sum_with_Dropped_Bits (A(c,c), -Shift, Sum, Dropped_Bits); A(c, c) := Sum; Lost_Bits(c) := Dropped_Bits; end loop; else Lost_Bits := (others => 0.0); end if; end; for Pivot_Col in Starting_Col .. Final_Col-1 loop Hi_Row := Pivot_Col; Lo_Row := Hi_Row + 1; P := A(Hi_Row, Pivot_Col); L := A(Lo_Row, Pivot_Col); Get_Rotation_That_Zeros_Out_Low (P, L, sn, cn, cn_minus_1, sn_minus_1, hypot, P_bigger_than_L, Skip_Rotation); Rotations(Pivot_Col).sn := sn; Rotations(Pivot_Col).cn := cn; Rotations(Pivot_Col).cn_minus_1 := cn_minus_1; Rotations(Pivot_Col).sn_minus_1 := sn_minus_1; Rotations(Pivot_Col).P_bigger_than_L := P_bigger_than_L; Rotations(Pivot_Col).Skip_Rotation := Skip_Rotation; Rotations(Pivot_Col).Pivot_Col := Pivot_Col; Rotations(Pivot_Col).Hi_Row := Hi_Row; Rotations(Pivot_Col).Lo_Row := Lo_Row; --Rotations(Pivot_Col).Skip_Rotation := false; -- for testing Rotate_to_Kill_Element_Lo_of_pCol (Rotations(Pivot_Col)); -- Zeroes out A(Lo_Row, Pivot_Col) -- Updates A and Q as global memory. -- Applies rotation by multiplying Givens Matrix on LHS of A. -- Then multiplies transpose of Givens Matrix on RHS of Q. A(Lo_Row, Pivot_Col) := Zero; A(Hi_Row, Pivot_Col) := Real'Copy_Sign(hypot, A(Hi_Row, Pivot_Col)); end loop; -- over Pivot_Col -- These can be done inside the above loop (after a delay of 1 step): for Pivot_Col in Starting_Col .. Final_Col-1 loop e_Multiply_A_on_RHS_with_Transpose_of (Rotations(Pivot_Col)); end loop; -- Add Shift back to A: for c in Starting_Col .. Final_Col loop A(c, c) := (A(c, c) + Shift) + Lost_Bits(c); -- best default end loop; end Lower_Diagonal_QR_Iteration; end Givens_QR_Method;
jquorning/iNow
Ada
1,031
adb
-- -- The author disclaims copyright to this source code. In place of -- a legal notice, here is a blessing: -- -- May you do good and not evil. -- May you find forgiveness for yourself and forgive others. -- May you share freely, not taking more than you give. -- with Ada.Calendar; with Database.Events; with Database.Jobs; with Navigate; package body Commands is procedure Create_Job (Job : in Types.Job_Id; Title : in String; Parent : in Types.Job_Id) is Id : Database.Events.Event_Id; pragma Unreferenced (Id); begin Database.Jobs.Add_Job (Job, Title, Parent, "jquorning"); Database.Events.Add_Event (Job, Ada.Calendar.Clock, Database.Events.Created, Id); end Create_Job; procedure Set_Current_Job (Job : in Types.Job_Id) is begin Database.Jobs.Set_Current_Job (Job); Navigate.List.Current := Job; Navigate.Refresh_List; end Set_Current_Job; end Commands;
reznikmm/matreshka
Ada
4,489
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Nodes; with XML.DOM.Attributes.Internals; package body ODF.DOM.Attributes.Text.List_Level_Position_And_Space_Mode.Internals is ------------ -- Create -- ------------ function Create (Node : Matreshka.ODF_Attributes.Text.List_Level_Position_And_Space_Mode.Text_List_Level_Position_And_Space_Mode_Access) return ODF.DOM.Attributes.Text.List_Level_Position_And_Space_Mode.ODF_Text_List_Level_Position_And_Space_Mode is begin return (XML.DOM.Attributes.Internals.Create (Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record); end Create; ---------- -- Wrap -- ---------- function Wrap (Node : Matreshka.ODF_Attributes.Text.List_Level_Position_And_Space_Mode.Text_List_Level_Position_And_Space_Mode_Access) return ODF.DOM.Attributes.Text.List_Level_Position_And_Space_Mode.ODF_Text_List_Level_Position_And_Space_Mode is begin return (XML.DOM.Attributes.Internals.Wrap (Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record); end Wrap; end ODF.DOM.Attributes.Text.List_Level_Position_And_Space_Mode.Internals;
AdaCore/libadalang
Ada
85
ads
with A; package B is function Make_Rec_1 (X : Integer) return A.Rec_Type; end B;
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.Elements; package ODF.DOM.Presentation_Show_Elements is pragma Preelaborate; type ODF_Presentation_Show is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Presentation_Show_Access is access all ODF_Presentation_Show'Class with Storage_Size => 0; end ODF.DOM.Presentation_Show_Elements;
apple-oss-distributions/old_ncurses
Ada
6,543
adb
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- ncurses -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 2000 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: Eugene V. Melaragno <[email protected]> 2000 -- Version Control -- $Revision: 1.1.1.1 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with ncurses2.util; use ncurses2.util; with Terminal_Interface.Curses; use Terminal_Interface.Curses; with Ada.Strings.Fixed; procedure ncurses2.color_test is use Int_IO; procedure show_color_name (y, x : Integer; color : Integer); color_names : constant array (0 .. 15) of String (1 .. 7) := ( "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "BLACK", "RED", "GREEN", "YELLOW", "BLUE", "MAGENTA", "CYAN", "WHITE" ); procedure show_color_name (y, x : Integer; color : Integer) is tmp5 : String (1 .. 5); begin if Number_Of_Colors > 8 then Put (tmp5, color); Add (Line => Line_Position (y), Column => Column_Position (x), Str => tmp5); else Add (Line => Line_Position (y), Column => Column_Position (x), Str => color_names (color)); end if; end show_color_name; top, width : Integer; hello : String (1 .. 5); -- tmp3 : String (1 .. 3); -- tmp2 : String (1 .. 2); begin Refresh; Add (Str => "There are "); -- Put(tmp3, Number_Of_Colors*Number_Of_Colors); Add (Str => Ada.Strings.Fixed.Trim (Integer'Image (Number_Of_Colors * Number_Of_Colors), Ada.Strings.Left)); Add (Str => " color pairs"); Add (Ch => newl); if Number_Of_Colors > 8 then width := 4; else width := 8; end if; if Number_Of_Colors > 8 then hello := "Test"; else hello := "Hello"; end if; for Bright in Boolean loop if Number_Of_Colors > 8 then top := 0; else top := Boolean'Pos (Bright) * (Number_Of_Colors + 3); end if; Clear_To_End_Of_Screen; Move_Cursor (Line => Line_Position (top) + 1, Column => 0); -- Put(tmp2, Number_Of_Colors); Add (Str => Ada.Strings.Fixed.Trim (Integer'Image (Number_Of_Colors), Ada.Strings.Left)); Add (Ch => 'x'); Add (Str => Ada.Strings.Fixed.Trim (Integer'Image (Number_Of_Colors), Ada.Strings.Left)); Add (Str => " matrix of foreground/background colors, bright *"); if Bright then Add (Str => "on"); else Add (Str => "off"); end if; Add (Ch => '*'); for i in 0 .. Number_Of_Colors - 1 loop show_color_name (top + 2, (i + 1) * width, i); end loop; for i in 0 .. Number_Of_Colors - 1 loop show_color_name (top + 3 + i, 0, i); end loop; for i in 1 .. Number_Of_Color_Pairs - 1 loop Init_Pair (Color_Pair (i), Color_Number (i mod Number_Of_Colors), Color_Number (i / Number_Of_Colors)); -- attron((attr_t) COLOR_PAIR(i)) -- Huh? Set_Color (Pair => Color_Pair (i)); if Bright then Switch_Character_Attribute (Attr => (Bold_Character => True, others => False)); end if; Add (Line => Line_Position (top + 3 + (i / Number_Of_Colors)), Column => Column_Position ((i mod Number_Of_Colors + 1) * width), Str => hello); Set_Character_Attributes; end loop; if Number_Of_Colors > 8 or Bright then Pause; end if; end loop; Erase; End_Windows; end ncurses2.color_test;
jhumphry/SPARK_SipHash
Ada
4,030
adb
-- Example_Hashed_Maps -- An example of using SipHash with the Ada.Containers.Indefinite_Hashed_Maps -- Copyright (c) 2015, James Humphry - see LICENSE file for details with Ada.Containers, Ada.Containers.Indefinite_Hashed_Maps; with Ada.Text_IO; use Ada.Text_IO; with Ada.Wide_Wide_Characters.Handling; with Ada.Strings.UTF_Encoding, Ada.Strings.UTF_Encoding.Wide_Wide_Strings; use Ada.Strings.UTF_Encoding; with SipHash24, SipHash24_String_Hashing, SipHash24.System_Entropy; procedure Example_Hashed_Maps is package String_Maps is new Ada.Containers.Indefinite_Hashed_Maps(Key_Type => String, Element_Type => String, Hash => SipHash24_String_Hashing.String_Hash, Equivalent_Keys => "=", "=" => "="); -- This function should really be in the standard library function UTF_8_CI_Equal (Left, Right : UTF_8_String) return Boolean is function To_Lower (Item : Wide_Wide_String) return Wide_Wide_String renames Ada.Wide_Wide_Characters.Handling.To_Lower; function UTF_8_Decode (Item : UTF_8_String) return Wide_Wide_String renames Ada.Strings.UTF_Encoding.Wide_Wide_Strings.Decode; Left_LC: constant Wide_Wide_String := To_Lower(UTF_8_Decode(Left)); Right_LC: constant Wide_Wide_String := To_Lower(UTF_8_Decode(Right)); begin return Left_LC = Right_LC; end UTF_8_CI_Equal; package UTF8_CI_Maps is new Ada.Containers.Indefinite_Hashed_Maps(Key_Type => UTF_8_String, Element_Type => UTF_8_String, Hash => SipHash24_String_Hashing.UTF_8_String_Hash_Case_Insensitive, Equivalent_Keys => UTF_8_CI_Equal, "=" => UTF_8_CI_Equal); subtype Count_Type is Ada.Containers.Count_Type; Example_Map : String_Maps.Map; Example_UTF8_CI_Map : UTF8_CI_Maps.Map; begin Put_Line("An example of using SipHash with Ada.Containers.Indefinite_Hashed_Maps"); New_Line; declare Seeded : Boolean; begin SipHash24.System_Entropy.Set_Key_From_System_Entropy(Seeded); if Seeded then Put_Line("SipHash key set from system entropy source."); else Put_Line("No system entropy was available to set SipHash key. Note " & "that this undermines the hash flooding protection "& "supposed to be provided by SipHash."); end if; end; New_Line; Put_Line("Using regular string maps."); Put_Line("Adding keys foo -> bar, cat -> dog, alice -> bob, UK -> London."); Example_Map.Insert("foo", "bar"); Example_Map.Insert("cat", "dog"); Example_Map.Insert("alice", "bob"); Example_Map.Insert("UK", "London"); New_Line; Put_Line("Length of map : " & Count_Type'Image(Example_Map.Length)); New_Line; Put_Line("Now reading out key-element pairs:"); for I in Example_Map.Iterate loop Put_Line(String_Maps.Key(I) & " -> " & String_Maps.Element(I)); end loop; New_Line; Put_Line("Using UTF_8 case insensitive string maps."); Put_Line("Adding keys Türkiye Cumhuriyeti -> Ankara, 中国 -> 北京, UK -> London."); Example_UTF8_CI_Map.Insert("Türkiye Cumhuriyeti", "Ankara"); Example_UTF8_CI_Map.Insert("中国", "北京"); Example_UTF8_CI_Map.Insert("UK", "London"); New_Line; Put_Line("Retrieving the value for key 'uK' using wrong casing: " & Example_UTF8_CI_Map("uK")); New_Line; Put_Line("Now reading out key-element pairs:"); for I in Example_UTF8_CI_Map.Iterate loop Put_Line(UTF8_CI_Maps.Key(I) & " -> " & UTF8_CI_Maps.Element(I)); end loop; New_Line; end Example_Hashed_Maps;
reznikmm/matreshka
Ada
4,043
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-2015, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ pragma Restrictions (No_Elaboration_Code); -- GNAT: enforce generation of preinitialized data section instead of -- generation of elaboration code. package Matreshka.Internals.Unicode.Ucd.Core_0034 is pragma Preelaborate; Group_0034 : aliased constant Core_Second_Stage := (others => (Other_Letter, Wide, Other, Other, O_Letter, Ideographic, (Ideographic | Unified_Ideograph | Alphabetic | Grapheme_Base | ID_Continue | ID_Start | XID_Continue | XID_Start => True, others => False))); end Matreshka.Internals.Unicode.Ucd.Core_0034;
zhmu/ananas
Ada
5,011
adb
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . T E X T _ I O . E N U M E R A T I O N _ 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.Text_IO.Enumeration_Aux; package body Ada.Text_IO.Enumeration_IO is package Aux renames Ada.Text_IO.Enumeration_Aux; --------- -- Get -- --------- procedure Get (File : File_Type; Item : out Enum) is Buf : String (1 .. Enum'Width + 1); Buflen : Natural; begin Aux.Get_Enum_Lit (File, Buf, Buflen); declare Buf_Str : String renames Buf (1 .. Buflen); pragma Unsuppress (Range_Check); begin Item := Enum'Value (Buf_Str); end; exception when Constraint_Error => raise Data_Error; end Get; procedure Get (Item : out Enum) is pragma Unsuppress (Range_Check); begin Get (Current_In, Item); end Get; procedure Get (From : String; Item : out Enum; Last : out Positive) is Start : Natural; begin Aux.Scan_Enum_Lit (From, Start, Last); declare From_Str : String renames From (Start .. Last); pragma Unsuppress (Range_Check); begin Item := Enum'Value (From_Str); end; exception when Constraint_Error => raise Data_Error; end Get; --------- -- Put -- --------- procedure Put (File : File_Type; Item : Enum; Width : Field := Default_Width; Set : Type_Set := Default_Setting) is begin -- Ensure that Item is valid before attempting to retrieve the Image, to -- prevent the possibility of out-of-bounds addressing of index or image -- tables. Units in the run-time library are normally compiled with -- checks suppressed, which includes instantiated generics. if not Item'Valid then raise Constraint_Error with "invalid enumeration value"; end if; Aux.Put (File, Enum'Image (Item), Width, Set); end Put; procedure Put (Item : Enum; Width : Field := Default_Width; Set : Type_Set := Default_Setting) is begin Put (Current_Out, Item, Width, Set); end Put; procedure Put (To : out String; Item : Enum; Set : Type_Set := Default_Setting) is begin -- Ensure that Item is valid before attempting to retrieve the Image, to -- prevent the possibility of out-of-bounds addressing of index or image -- tables. Units in the run-time library are normally compiled with -- checks suppressed, which includes instantiated generics. if not Item'Valid then raise Constraint_Error with "invalid enumeration value"; end if; Aux.Puts (To, Enum'Image (Item), Set); end Put; end Ada.Text_IO.Enumeration_IO;
reznikmm/matreshka
Ada
3,933
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Db_Type_Attributes; package Matreshka.ODF_Db.Type_Attributes is type Db_Type_Attribute_Node is new Matreshka.ODF_Db.Abstract_Db_Attribute_Node and ODF.DOM.Db_Type_Attributes.ODF_Db_Type_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Db_Type_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Db_Type_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Db.Type_Attributes;
zhmu/ananas
Ada
11,719
adb
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- G N A T X R E F -- -- -- -- B o d y -- -- -- -- Copyright (C) 1998-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Opt; with Osint; use Osint; with Types; use Types; with Switch; use Switch; with Xr_Tabls; with Xref_Lib; use Xref_Lib; with Ada.Command_Line; use Ada.Command_Line; with Ada.Strings.Fixed; with Ada.Text_IO; use Ada.Text_IO; with GNAT.Command_Line; use GNAT.Command_Line; with System.Strings; use System.Strings; procedure Gnatxref is Search_Unused : Boolean := False; Local_Symbols : Boolean := True; Prj_File : File_Name_String; Prj_File_Length : Natural := 0; Usage_Error : exception; Full_Path_Name : Boolean := False; Vi_Mode : Boolean := False; Read_Only : Boolean := False; Have_File : Boolean := False; Der_Info : Boolean := False; RTS_Specified : String_Access := null; -- Used to detect multiple use of --RTS= switch EXT_Specified : String_Access := null; -- Used to detect multiple use of --ext= switch procedure Parse_Cmd_Line; -- Parse every switch on the command line procedure Usage; -- Display the usage procedure Write_Usage; pragma No_Return (Write_Usage); -- Print a small help page for program usage -------------------- -- Parse_Cmd_Line -- -------------------- procedure Parse_Cmd_Line is procedure Check_Version_And_Help is new Check_Version_And_Help_G (Usage); -- Start of processing for Parse_Cmd_Line begin -- First check for --version or --help Check_Version_And_Help ("GNATXREF", "1998"); loop case GNAT.Command_Line.Getopt ("a aI: aO: d f g h I: nostdinc nostdlib p: u v -RTS= -ext=") is when ASCII.NUL => exit; when 'a' => if GNAT.Command_Line.Full_Switch = "a" then Read_Only := True; elsif GNAT.Command_Line.Full_Switch = "aI" then Osint.Add_Src_Search_Dir (GNAT.Command_Line.Parameter); else Osint.Add_Lib_Search_Dir (GNAT.Command_Line.Parameter); end if; when 'd' => Der_Info := True; when 'f' => Full_Path_Name := True; when 'g' => Local_Symbols := False; when 'h' => Write_Usage; when 'I' => Osint.Add_Src_Search_Dir (GNAT.Command_Line.Parameter); Osint.Add_Lib_Search_Dir (GNAT.Command_Line.Parameter); when 'n' => if GNAT.Command_Line.Full_Switch = "nostdinc" then Opt.No_Stdinc := True; elsif GNAT.Command_Line.Full_Switch = "nostdlib" then Opt.No_Stdlib := True; end if; when 'p' => declare S : constant String := GNAT.Command_Line.Parameter; begin Prj_File_Length := S'Length; Prj_File (1 .. Prj_File_Length) := S; end; when 'u' => Search_Unused := True; Vi_Mode := False; when 'v' => Vi_Mode := True; Search_Unused := False; -- The only switch starting with -- recognized is --RTS when '-' => -- Check that it is the first time we see this switch if Full_Switch = "-RTS" then if RTS_Specified = null then RTS_Specified := new String'(GNAT.Command_Line.Parameter); elsif RTS_Specified.all /= GNAT.Command_Line.Parameter then Osint.Fail ("--RTS cannot be specified multiple times"); end if; Opt.No_Stdinc := True; Opt.RTS_Switch := True; declare Src_Path_Name : constant String_Ptr := Get_RTS_Search_Dir (GNAT.Command_Line.Parameter, Include); Lib_Path_Name : constant String_Ptr := Get_RTS_Search_Dir (GNAT.Command_Line.Parameter, Objects); begin if Src_Path_Name /= null and then Lib_Path_Name /= null then Add_Search_Dirs (Src_Path_Name, Include); Add_Search_Dirs (Lib_Path_Name, Objects); elsif Src_Path_Name = null and then Lib_Path_Name = null then Osint.Fail ("RTS path not valid: missing adainclude and " & "adalib directories"); elsif Src_Path_Name = null then Osint.Fail ("RTS path not valid: missing adainclude directory"); elsif Lib_Path_Name = null then Osint.Fail ("RTS path not valid: missing adalib directory"); end if; end; elsif GNAT.Command_Line.Full_Switch = "-ext" then -- Check that it is the first time we see this switch if EXT_Specified = null then EXT_Specified := new String'(GNAT.Command_Line.Parameter); elsif EXT_Specified.all /= GNAT.Command_Line.Parameter then Osint.Fail ("--ext cannot be specified multiple times"); end if; if EXT_Specified'Length = Osint.ALI_Default_Suffix'Length then Osint.ALI_Suffix := EXT_Specified.all'Access; else Osint.Fail ("--ext argument must have 3 characters"); end if; end if; when others => Try_Help; raise Usage_Error; end case; end loop; -- Get the other arguments loop declare S : constant String := GNAT.Command_Line.Get_Argument; begin exit when S'Length = 0; if Ada.Strings.Fixed.Index (S, ":") /= 0 then Ada.Text_IO.Put_Line ("Only file names are allowed on the command line"); Try_Help; raise Usage_Error; end if; Add_Xref_File (S); Have_File := True; end; end loop; exception when GNAT.Command_Line.Invalid_Switch => Ada.Text_IO.Put_Line ("Invalid switch : " & GNAT.Command_Line.Full_Switch); Try_Help; raise Usage_Error; when GNAT.Command_Line.Invalid_Parameter => Ada.Text_IO.Put_Line ("Parameter missing for : " & GNAT.Command_Line.Full_Switch); Try_Help; raise Usage_Error; end Parse_Cmd_Line; ----------- -- Usage -- ----------- procedure Usage is begin Put_Line ("Usage: gnatxref [switches] file1 file2 ..."); New_Line; Put_Line (" file ... list of source files to xref, " & "including with'ed units"); New_Line; Put_Line ("gnatxref switches:"); Display_Usage_Version_And_Help; Put_Line (" -a Consider all files, even when the ali file is" & " readonly"); Put_Line (" -aIdir Specify source files search path"); Put_Line (" -aOdir Specify library/object files search path"); Put_Line (" -d Output derived type information"); Put_Line (" -f Output full path name"); Put_Line (" -g Output information only for global symbols"); Put_Line (" -Idir Like -aIdir -aOdir"); Put_Line (" -nostdinc Don't look for sources in the system default" & " directory"); Put_Line (" -nostdlib Don't look for library files in the system" & " default directory"); Put_Line (" --ext=xxx Specify alternate ali file extension"); Put_Line (" --RTS=dir specify the default source and object search" & " path"); Put_Line (" -p file Use file as the configuration file"); Put_Line (" -u List unused entities"); Put_Line (" -v Print a 'tags' file for vi"); New_Line; end Usage; ----------------- -- Write_Usage -- ----------------- procedure Write_Usage is begin Display_Version ("GNATXREF", "1998"); New_Line; Usage; raise Usage_Error; end Write_Usage; begin Put_Line ("WARNING: gnatxref is obsolete and will be removed in the next release"); Put_Line ("Consider using Libadalang or GNAT Studio python scripting instead"); Parse_Cmd_Line; if not Have_File then if Argument_Count = 0 then Write_Usage; else Try_Help; raise Usage_Error; end if; end if; Xr_Tabls.Set_Default_Match (True); -- Find the project file if Prj_File_Length = 0 then Xr_Tabls.Create_Project_File (Default_Project_File (Osint.To_Host_Dir_Spec (".", False).all)); else Xr_Tabls.Create_Project_File (Prj_File (1 .. Prj_File_Length)); end if; -- Fill up the table Search_Xref (Local_Symbols, Read_Only, Der_Info); if Search_Unused then Print_Unused (Full_Path_Name); elsif Vi_Mode then Print_Vi (Full_Path_Name); else Print_Xref (Full_Path_Name); end if; exception when Usage_Error => null; end Gnatxref;
msrLi/portingSources
Ada
855
adb
-- Copyright 2008-2014 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with Ident; procedure Assign is Q: array (1..5) of Integer := (2, 3, 5, 7, 11); begin Q(1) := Ident (Q(3)); -- START end Assign;
reznikmm/matreshka
Ada
4,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.Db_Is_Autoincrement_Attributes; package Matreshka.ODF_Db.Is_Autoincrement_Attributes is type Db_Is_Autoincrement_Attribute_Node is new Matreshka.ODF_Db.Abstract_Db_Attribute_Node and ODF.DOM.Db_Is_Autoincrement_Attributes.ODF_Db_Is_Autoincrement_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Db_Is_Autoincrement_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Db_Is_Autoincrement_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Db.Is_Autoincrement_Attributes;
MinimSecure/unum-sdk
Ada
797
ads
-- 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 System; package Pck is procedure Do_Nothing (A : System.Address); end Pck;
reznikmm/matreshka
Ada
3,749
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Presentation_Play_Full_Attributes is pragma Preelaborate; type ODF_Presentation_Play_Full_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Presentation_Play_Full_Attribute_Access is access all ODF_Presentation_Play_Full_Attribute'Class with Storage_Size => 0; end ODF.DOM.Presentation_Play_Full_Attributes;
zhmu/ananas
Ada
310
ads
package No_Caching with SPARK_Mode is type Mult_Bit_Boolean is (NV_FALSE, NV_TRUE); for Mult_Bit_Boolean use (NV_FALSE => 16#55_AA#, NV_TRUE => 16#AA_55#); procedure Handle (V : Mult_Bit_Boolean); procedure Do_Something; procedure Do_Something_Else; end No_Caching;
reznikmm/matreshka
Ada
27,849
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Tools Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with System.Address_To_Access_Conversions; with AMF.CMOF.Properties.Collections; with AMF.URI_Extents; with AMF.UML.Comments; with AMF.UML.Multiplicity_Elements; with AMF.UML.Named_Elements; with AMF.UML.Operations.Collections; with AMF.UML.Parameters.Collections; with AMF.UML.Properties.Collections; with AMF.UML.Types; with Modeler.Containment_Tree_Models.Moc; pragma Unreferenced (Modeler.Containment_Tree_Models.Moc); package body Modeler.Containment_Tree_Models is use type AMF.UML.Types.UML_Type_Access; use type League.Strings.Universal_String; package Node_Conversions is new System.Address_To_Access_Conversions (Node); function To_Node (Self : not null access constant Containment_Tree_Model'Class; Index : Qt4.Model_Indices.Q_Model_Index) return Node_Access; function To_Index (Self : not null access constant Containment_Tree_Model'Class; Node : Node_Access) return Qt4.Model_Indices.Q_Model_Index; function Get_UML_Operation_Image (Element : not null AMF.UML.Operations.UML_Operation_Access) return League.Strings.Universal_String; function Get_UML_Property_Image (Element : not null AMF.UML.Properties.UML_Property_Access) return League.Strings.Universal_String; function Image (Item : AMF.UML.Optional_UML_Visibility_Kind) return League.Strings.Universal_String; -- Returns image of visibility kind -- - empty string when no visibility kind specified -- - '+' for 'public' -- - '-' for 'private' -- - '#' for 'protected' -- - '~' for 'package' function Multiplicity_Image (Element : not null access AMF.UML.Multiplicity_Elements.UML_Multiplicity_Element'Class) return League.Strings.Universal_String; -- Returns textual representation of multiplicity of -- UML::MultiplicityElement. ------------------ -- Column_Count -- ------------------ overriding function Column_Count (Self : not null access constant Containment_Tree_Model; Parent : Qt4.Model_Indices.Q_Model_Index) return Qt4.Q_Integer is pragma Unreferenced (Self); pragma Unreferenced (Parent); begin -- All rows has exactly one column. return 1; end Column_Count; ------------------ -- Constructors -- ------------------ package body Constructors is procedure Initialize (Self : not null access Containment_Tree_Model'Class; Parent : access Qt4.Objects.Q_Object'Class); ------------ -- Create -- ------------ function Create (Parent : access Qt4.Objects.Q_Object'Class := null) return not null Containment_Tree_Model_Access is begin return Self : constant not null Containment_Tree_Model_Access := new Containment_Tree_Model do Initialize (Self, Parent); end return; end Create; ---------------- -- Initialize -- ---------------- procedure Initialize (Self : not null access Containment_Tree_Model'Class; Parent : access Qt4.Objects.Q_Object'Class) is begin Qt4.Abstract_Item_Models.Directors.Constructors.Initialize (Self, Parent); -- Create root node. Self.Root := new Node (N_Root); -- Register self as AMF listener. AMF.Listeners.Register_Listener (AMF.Listeners.Listener_Access (Self)); -- GNAT Pro 7.1w (20120405): explicit type conversion is needed to -- workaround compiler's bug. end Initialize; end Constructors; ---------- -- Data -- ---------- overriding function Data (Self : not null access Containment_Tree_Model; Index : Qt4.Model_Indices.Q_Model_Index; Role : Qt4.Item_Data_Role) return Qt4.Variants.Q_Variant is Node : constant Node_Access := Self.To_Node (Index); begin case Role is when Qt4.Display_Role => case Node.Kind is when N_Root => return Qt4.Variants.Create; when N_Extent => return Qt4.Variants.Create (+AMF.URI_Extents.URI_Extent'Class (Node.Extent.all).Context_URI.To_Wide_Wide_String); when N_Element => if Node.Element.all in AMF.UML.Operations.UML_Operation'Class then return Qt4.Variants.Create (+Get_UML_Operation_Image (AMF.UML.Operations.UML_Operation_Access (Node.Element)).To_Wide_Wide_String); elsif Node.Element.all in AMF.UML.Properties.UML_Property'Class then return Qt4.Variants.Create (+Get_UML_Property_Image (AMF.UML.Properties.UML_Property_Access (Node.Element)).To_Wide_Wide_String); elsif Node.Element.all in AMF.UML.Named_Elements.UML_Named_Element'Class then declare Name : constant AMF.Optional_String := AMF.UML.Named_Elements.UML_Named_Element'Class (Node.Element.all).Get_Name; begin if Name.Is_Empty then return Qt4.Variants.Create; else return Qt4.Variants.Create (+Name.Value.To_Wide_Wide_String); end if; end; elsif Node.Element.all in AMF.UML.Comments.UML_Comment'Class then return Qt4.Variants.Create (+AMF.UML.Comments.UML_Comment'Class (Node.Element.all).Get_Body.Value.To_Wide_Wide_String); else return Qt4.Variants.Create; end if; end case; when others => return Qt4.Variants.Create; end case; end Data; ------------------- -- Extent_Create -- ------------------- overriding procedure Extent_Create (Self : not null access Containment_Tree_Model; Extent : not null AMF.Extents.Extent_Access) is Position : constant Natural := Natural (Self.Root.Children.Length); Child : Node_Access := new Node'(N_Extent, Self.Root, Node_Vectors.Empty_Vector, Extent); begin Self.Begin_Insert_Rows (Qt4.Model_Indices.Create, Qt4.Q_Integer (Self.Root.Children.Length), Qt4.Q_Integer (Self.Root.Children.Length)); Self.Root.Children.Append (Child); Self.Extents.Insert (Extent, Child); Self.End_Insert_Rows; end Extent_Create; ------------------- -- Extent_Remove -- ------------------- overriding procedure Extent_Remove (Self : not null access Containment_Tree_Model; Extent : not null AMF.Extents.Extent_Access) is begin null; end Extent_Remove; ----------------------------- -- Get_UML_Operation_Image -- ----------------------------- function Get_UML_Operation_Image (Element : not null AMF.UML.Operations.UML_Operation_Access) return League.Strings.Universal_String is use type AMF.UML.UML_Parameter_Direction_Kind; Name : AMF.Optional_String := Element.Get_Name; Default : AMF.Optional_String; Owned_Parameters : constant AMF.UML.Parameters.Collections.Ordered_Set_Of_UML_Parameter := Element.Get_Owned_Parameter; Returns : constant AMF.UML.Parameters.Collections.Set_Of_UML_Parameter := Element.Return_Result; Redefined_Operations : constant AMF.UML.Operations.Collections.Set_Of_UML_Operation := Element.Get_Redefined_Operation; The_Operation : AMF.UML.Operations.UML_Operation_Access; The_Parameter : AMF.UML.Parameters.UML_Parameter_Access; The_Type : AMF.UML.Types.UML_Type_Access; Result : League.Strings.Universal_String; Modifiers : League.Strings.Universal_String; First : Boolean; begin -- visibility Result.Append (Image (Element.Get_Visibility)); -- name if not Name.Is_Empty then Result.Append (Name.Value); end if; -- parameter list Result.Append ('('); First := True; for J in 1 .. Owned_Parameters.Length loop The_Parameter := Owned_Parameters.Element (J); if The_Parameter.Get_Direction /= AMF.UML.Return_Parameter then if First then First := False; else Result.Append (", "); end if; The_Type := The_Parameter.Get_Type; -- name Name := The_Parameter.Get_Name; if not Name.Is_Empty then Result.Append (Name.Value); end if; Result.Append (+" : "); -- direction case The_Parameter.Get_Direction is when AMF.UML.In_Parameter => Result.Append (" in "); when AMF.UML.In_Out_Parameter => Result.Append (" in out "); when AMF.UML.Out_Parameter => Result.Append (" out "); when AMF.UML.Return_Parameter => raise Program_Error; end case; -- type if The_Type /= null then Name := The_Type.Get_Name; if not Name.Is_Empty then Result.Append (Name.Value); end if; end if; -- multiplicty Result.Append (Multiplicity_Image (The_Parameter)); -- default Default := The_Parameter.Get_Default; end if; end loop; Result.Append (')'); -- result if not Returns.Is_Empty then The_Parameter := Returns.Element (1); The_Type := The_Parameter.Get_Type; -- type Result.Append (" : "); if The_Type /= null then Name := The_Type.Get_Name; if not Name.Is_Empty then Result.Append (Name.Value); end if; end if; -- multiplicty Result.Append (Multiplicity_Image (The_Parameter)); end if; -- redefines for J in 1 .. Redefined_Operations.Length loop if not Modifiers.Is_Empty then Modifiers.Append (+", "); end if; The_Operation := Redefined_Operations.Element (J); -- Name := The_Operation.Get_Name; Modifiers.Append (+"redefines "); Modifiers.Append (The_Operation.Qualified_Name); -- if not Name.Is_Empty then -- Modifiers.Append (Name.Value); -- end if; end loop; -- Append operation properties. if not Modifiers.Is_Empty then Result.Append ('{'); Result.Append (Modifiers); Result.Append ('}'); end if; return Result; end Get_UML_Operation_Image; ---------------------------- -- Get_UML_Property_Image -- ---------------------------- function Get_UML_Property_Image (Element : not null AMF.UML.Properties.UML_Property_Access) return League.Strings.Universal_String is Name : constant AMF.Optional_String := Element.Get_Name; Default : constant AMF.Optional_String := Element.Get_Default; Visibility : constant AMF.UML.Optional_UML_Visibility_Kind := Element.Get_Visibility; The_Type : constant AMF.UML.Types.UML_Type_Access := Element.Get_Type; Lower : constant AMF.Optional_Integer := Element.Lower_Bound; Upper : constant AMF.Optional_Unlimited_Natural := Element.Upper_Bound; Properties : AMF.UML.Properties.Collections.Set_Of_UML_Property; Has_Modifier : Boolean := False; Result : League.Strings.Universal_String; procedure Add (Item : League.Strings.Universal_String); procedure Add_Modifier (Item : League.Strings.Universal_String); --------- -- Add -- --------- procedure Add (Item : League.Strings.Universal_String) is begin if not Result.Is_Empty and not Item.Is_Empty then Result.Append (' '); end if; Result.Append (Item); end Add; ------------------ -- Add_Modifier -- ------------------ procedure Add_Modifier (Item : League.Strings.Universal_String) is begin if not Has_Modifier then Add (+"{"); Has_Modifier := True; else Result.Append (", "); end if; Result.Append (Item); end Add_Modifier; begin -- visibility Result.Append (Image (Visibility)); -- isDerived if Element.Get_Is_Derived then Result.Append (+"/"); end if; -- name if not Name.Is_Empty then Result.Append (Name.Value); end if; -- type if The_Type /= null then Add (": " & The_Type.Get_Name.Value); end if; -- multiplicity Add (Multiplicity_Image (Element)); -- default if not Default.Is_Empty then Add ("= " & Default.Value); end if; -- readOnly if Element.Get_Is_Read_Only then Add_Modifier (+"readOnly"); end if; -- isDerivedUnion if Element.Get_Is_Derived_Union then Add_Modifier (+"union"); end if; -- subsettedProperty Properties := Element.Get_Subsetted_Property; for J in 1 .. Properties.Length loop Add_Modifier ("subsets " & Properties.Element (J).Get_Name.Value); end loop; -- redefinedProperty Properties := Element.Get_Redefined_Property; for J in 1 .. Properties.Length loop Add_Modifier ("redefines " & Properties.Element (J).Get_Name.Value); end loop; -- isOrdered if Element.Get_Is_Ordered then Add_Modifier (+"ordered"); end if; -- isUnique if Element.Get_Is_Unique then Add_Modifier (+"unique"); end if; -- isID if Element.Get_Is_Id then Add_Modifier (+"id"); end if; -- constraints is not implemented -- Close modifiers if any. if Has_Modifier then Result.Append (+"}"); end if; return Result; end Get_UML_Property_Image; ----------------- -- Header_Data -- ----------------- overriding function Header_Data (Self : not null access Containment_Tree_Model; Section : Qt4.Q_Integer; Orientation : Qt4.Orientations; Role : Qt4.Item_Data_Role) return Qt4.Variants.Q_Variant is begin return Qt4.Variants.Create; end Header_Data; ----------- -- Image -- ----------- function Image (Item : AMF.UML.Optional_UML_Visibility_Kind) return League.Strings.Universal_String is begin if Item.Is_Empty then return League.Strings.Empty_Universal_String; else case Item.Value is when AMF.UML.Public_Visibility => return +"+"; when AMF.UML.Private_Visibility => return +"-"; when AMF.UML.Protected_Visibility => return +"#"; when AMF.UML.Package_Visibility => return +"~"; end case; end if; end Image; ----------- -- Index -- ----------- overriding function Index (Self : not null access constant Containment_Tree_Model; Row : Qt4.Q_Integer; Column : Qt4.Q_Integer; Parent : Qt4.Model_Indices.Q_Model_Index) return Qt4.Model_Indices.Q_Model_Index is use type Qt4.Q_Integer; Parent_Node : constant Node_Access := Self.To_Node (Parent); begin if Column /= 0 or else Row >= Qt4.Q_Integer (Parent_Node.Children.Length) then return Qt4.Model_Indices.Create; else return Self.To_Index (Parent_Node.Children.Element (Natural (Row))); end if; end Index; --------------------- -- Instance_Create -- --------------------- overriding procedure Instance_Create (Self : not null access Containment_Tree_Model; Element : not null AMF.Elements.Element_Access) is Parent : constant Node_Access := Self.Extents.Element (Element.Extent); Position : constant Natural := Natural (Parent.Children.Length); Child : Node_Access := new Node'(N_Element, Parent, Node_Vectors.Empty_Vector, Element); begin Self.Begin_Insert_Rows (Qt4.Model_Indices.Create, Qt4.Q_Integer (Parent.Children.Length), Qt4.Q_Integer (Parent.Children.Length)); Parent.Children.Append (Child); Self.Elements.Insert (Element, Child); Self.End_Insert_Rows; end Instance_Create; --------------------- -- Instance_Remove -- --------------------- overriding procedure Instance_Remove (Self : not null access Containment_Tree_Model; Element : not null AMF.Elements.Element_Access) is begin null; end Instance_Remove; -------------- -- Link_Add -- -------------- overriding procedure Link_Add (Self : not null access Containment_Tree_Model; Association : not null AMF.CMOF.Associations.CMOF_Association_Access; First_Element : not null AMF.Elements.Element_Access; Second_Element : not null AMF.Elements.Element_Access) is use type AMF.Elements.Element_Access; Member_End : constant AMF.CMOF.Properties.Collections.Ordered_Set_Of_CMOF_Property := Association.Get_Member_End; Owner : AMF.Elements.Element_Access; Owned : AMF.Elements.Element_Access; Owner_Node : Node_Access; Owned_Node : Node_Access; Source_First : Natural; Aux : Boolean; begin -- Check whether one of the ends is composite. Determine owner and owned -- elements. -- -- XXX For profiles, it is needed to check navigability too. if Member_End.Element (1).Get_Is_Composite then Owner := First_Element; Owned := Second_Element; elsif Member_End.Element (2).Get_Is_Composite then Owner := Second_Element; Owned := First_Element; end if; if Owner /= null and Owned /= null then Owner_Node := Self.Elements.Element (Owner); Owned_Node := Self.Elements.Element (Owned); -- Check whether ownership is changed and move rows when necessary. if Owned_Node.Parent /= Owner_Node then Source_First := Owned_Node.Parent.Children.Find_Index (Owned_Node); Aux := Self.Begin_Move_Rows (Self.To_Index (Owned_Node.Parent), Qt4.Q_Integer (Source_First), Qt4.Q_Integer (Source_First), Self.To_Index (Owner_Node), Qt4.Q_Integer (Owner_Node.Children.Length)); Owned_Node.Parent.Children.Delete (Source_First); Owned_Node.Parent := Owner_Node; Owner_Node.Children.Append (Owned_Node); Self.End_Move_Rows; end if; end if; end Link_Add; ----------------- -- Link_Remove -- ----------------- overriding procedure Link_Remove (Self : not null access Containment_Tree_Model) is begin null; end Link_Remove; ------------------------ -- Multiplicity_Image -- ------------------------ function Multiplicity_Image (Element : not null access AMF.UML.Multiplicity_Elements.UML_Multiplicity_Element'Class) return League.Strings.Universal_String is use type AMF.Optional_Integer; use type AMF.Optional_Unlimited_Natural; function Image (Item : AMF.Optional_Integer) return League.Strings.Universal_String; function Image (Item : AMF.Optional_Unlimited_Natural) return League.Strings.Universal_String; ----------- -- Image -- ----------- function Image (Item : AMF.Optional_Integer) return League.Strings.Universal_String is begin if Item.Is_Empty then return League.Strings.Empty_Universal_String; else declare Image : constant Wide_Wide_String := Integer'Wide_Wide_Image (Item.Value); begin if Image (Image'First) = ' ' then return +Image (Image'First + 1 .. Image'Last); else return +Image; end if; end; end if; end Image; ----------- -- Image -- ----------- function Image (Item : AMF.Optional_Unlimited_Natural) return League.Strings.Universal_String is begin if Item.Is_Empty then return League.Strings.Empty_Universal_String; elsif Item.Value.Unlimited then return +"*"; else declare Image : constant Wide_Wide_String := Integer'Wide_Wide_Image (Item.Value.Value); begin if Image (Image'First) = ' ' then return +Image (Image'First + 1 .. Image'Last); else return +Image; end if; end; end if; end Image; Lower : constant AMF.Optional_Integer := Element.Lower_Bound; Upper : constant AMF.Optional_Unlimited_Natural := Element.Upper_Bound; begin if not Lower.Is_Empty and not Upper.Is_Empty then if Lower = 1 and Upper = 1 then return League.Strings.Empty_Universal_String; elsif Lower = 0 and Upper = AMF.Unlimited then return +"[*]"; elsif Lower = Upper then return +"[" & Image (Lower) & "]"; else return +"[" & Image (Lower) & ".." & Image (Upper) & "]"; end if; else return League.Strings.Empty_Universal_String; end if; end Multiplicity_Image; ------------ -- Parent -- ------------ overriding function Parent (Self : not null access constant Containment_Tree_Model; Child : Qt4.Model_Indices.Q_Model_Index) return Qt4.Model_Indices.Q_Model_Index is begin return Self.To_Index (Self.To_Node (Child).Parent); end Parent; --------------- -- Row_Count -- --------------- overriding function Row_Count (Self : not null access constant Containment_Tree_Model; Parent : Qt4.Model_Indices.Q_Model_Index) return Qt4.Q_Integer is Parent_Node : constant not null Node_Access := Self.To_Node (Parent); begin return Qt4.Q_Integer (Parent_Node.Children.Length); end Row_Count; ------------- -- To_Node -- ------------- function To_Node (Self : not null access constant Containment_Tree_Model'Class; Index : Qt4.Model_Indices.Q_Model_Index) return Node_Access is begin if not Index.Is_Valid then return Self.Root; else return Node_Access (Node_Conversions.To_Pointer (Index.Internal_Pointer)); end if; end To_Node; -------------- -- To_Index -- -------------- function To_Index (Self : not null access constant Containment_Tree_Model'Class; Node : Node_Access) return Qt4.Model_Indices.Q_Model_Index is begin if Node = null or else Node.Parent = null then return Qt4.Model_Indices.Create; else return Self.Create_Index (Qt4.Q_Integer (Node.Parent.Children.Find_Index (Node)), 0, Node_Conversions.To_Address (Node_Conversions.Object_Pointer (Node))); end if; end To_Index; end Modeler.Containment_Tree_Models;
persan/protobuf-ada
Ada
361
adb
pragma Ada_2012; with Tutorial.IO; use Tutorial.IO; with Ada.Text_IO; use Ada.Text_IO; function Tutorial.Get_Generic (Prompt : String) return Enum is begin loop begin return Enum'Value (Tutorial.Io.Get (Prompt)); exception when others => Put_Line ("Invalid value"); end; end loop; end Tutorial.Get_Generic;
reznikmm/matreshka
Ada
4,632
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Style.Vertical_Pos_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Style_Vertical_Pos_Attribute_Node is begin return Self : Style_Vertical_Pos_Attribute_Node do Matreshka.ODF_Style.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Style_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Style_Vertical_Pos_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Vertical_Pos_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Style_URI, Matreshka.ODF_String_Constants.Vertical_Pos_Attribute, Style_Vertical_Pos_Attribute_Node'Tag); end Matreshka.ODF_Style.Vertical_Pos_Attributes;
reznikmm/matreshka
Ada
6,726
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ -- A read is classified object action is an action that determines whether a -- runtime object is classified by a given classifier. ------------------------------------------------------------------------------ with AMF.UML.Actions; limited with AMF.UML.Classifiers; limited with AMF.UML.Input_Pins; limited with AMF.UML.Output_Pins; package AMF.UML.Read_Is_Classified_Object_Actions is pragma Preelaborate; type UML_Read_Is_Classified_Object_Action is limited interface and AMF.UML.Actions.UML_Action; type UML_Read_Is_Classified_Object_Action_Access is access all UML_Read_Is_Classified_Object_Action'Class; for UML_Read_Is_Classified_Object_Action_Access'Storage_Size use 0; not overriding function Get_Classifier (Self : not null access constant UML_Read_Is_Classified_Object_Action) return AMF.UML.Classifiers.UML_Classifier_Access is abstract; -- Getter of ReadIsClassifiedObjectAction::classifier. -- -- The classifier against which the classification of the input object is -- tested. not overriding procedure Set_Classifier (Self : not null access UML_Read_Is_Classified_Object_Action; To : AMF.UML.Classifiers.UML_Classifier_Access) is abstract; -- Setter of ReadIsClassifiedObjectAction::classifier. -- -- The classifier against which the classification of the input object is -- tested. not overriding function Get_Is_Direct (Self : not null access constant UML_Read_Is_Classified_Object_Action) return Boolean is abstract; -- Getter of ReadIsClassifiedObjectAction::isDirect. -- -- Indicates whether the classifier must directly classify the input -- object. not overriding procedure Set_Is_Direct (Self : not null access UML_Read_Is_Classified_Object_Action; To : Boolean) is abstract; -- Setter of ReadIsClassifiedObjectAction::isDirect. -- -- Indicates whether the classifier must directly classify the input -- object. not overriding function Get_Object (Self : not null access constant UML_Read_Is_Classified_Object_Action) return AMF.UML.Input_Pins.UML_Input_Pin_Access is abstract; -- Getter of ReadIsClassifiedObjectAction::object. -- -- Holds the object whose classification is to be tested. not overriding procedure Set_Object (Self : not null access UML_Read_Is_Classified_Object_Action; To : AMF.UML.Input_Pins.UML_Input_Pin_Access) is abstract; -- Setter of ReadIsClassifiedObjectAction::object. -- -- Holds the object whose classification is to be tested. not overriding function Get_Result (Self : not null access constant UML_Read_Is_Classified_Object_Action) return AMF.UML.Output_Pins.UML_Output_Pin_Access is abstract; -- Getter of ReadIsClassifiedObjectAction::result. -- -- After termination of the action, will hold the result of the test. not overriding procedure Set_Result (Self : not null access UML_Read_Is_Classified_Object_Action; To : AMF.UML.Output_Pins.UML_Output_Pin_Access) is abstract; -- Setter of ReadIsClassifiedObjectAction::result. -- -- After termination of the action, will hold the result of the test. end AMF.UML.Read_Is_Classified_Object_Actions;
reznikmm/matreshka
Ada
4,049
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Form_Delay_For_Repeat_Attributes; package Matreshka.ODF_Form.Delay_For_Repeat_Attributes is type Form_Delay_For_Repeat_Attribute_Node is new Matreshka.ODF_Form.Abstract_Form_Attribute_Node and ODF.DOM.Form_Delay_For_Repeat_Attributes.ODF_Form_Delay_For_Repeat_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Form_Delay_For_Repeat_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Form_Delay_For_Repeat_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Form.Delay_For_Repeat_Attributes;
onox/sdlada
Ada
2,759
ads
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2018 Luke A. Guest -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- -- SDL.Video.Displays -- -- Access to display information including video displays and resolutions. -------------------------------------------------------------------------------------------------------------------- with Interfaces.C; with SDL.Video.Pixel_Formats; with SDL.Video.Rectangles; with System; package SDL.Video.Displays is package C renames Interfaces.C; type Refresh_Rates is range 0 .. 400 with Convention => C; type Mode is record Format : SDL.Video.Pixel_Formats.Pixel_Format_Names; Width : C.int; Height : C.int; Refresh_Rate : Refresh_Rates; Driver_Data : System.Address; -- TODO: Somehow make this a real type. end record with Convention => C; type Access_Mode is access all Mode with Convention => C; -- Video displays. type Display_Indices is new Positive; function Total return Display_Indices; function Closest_Mode (Display : in Display_Indices; Wanted : in Mode; Target : out Mode) return Boolean; function Current_Mode (Display : in Display_Indices; Target : out Mode) return Boolean; function Desktop_Mode (Display : in Display_Indices; Target : out Mode) return Boolean; function Display_Mode (Display : in Display_Indices; Index : in Natural; Target : out Mode) return Boolean; function Total_Display_Modes (Display : in Display_Indices; Total : out Positive) return Boolean; function Display_Bounds (Display : in Display_Indices; Bounds : out Rectangles.Rectangle) return Boolean; end SDL.Video.Displays;
AdaCore/libadalang
Ada
528
adb
-- Check that the output of p_parent_basic_decl is correct for synthetic types with Ada.Unchecked_Deallocation; procedure Test is type T is tagged null record; function Foo return T'Class with Import; --% node[1][3].p_designated_type_decl.p_parent_basic_decl function Bar return Integer'Base with Import; --% node[1][3].p_designated_type_decl.p_parent_basic_decl A : aliased Integer; begin A := A'Unrestricted_Access.all; --% node[1][0].p_expression_type.p_parent_basic_decl end Test;
sonneveld/adazmq
Ada
8,438
ads
with System; with Ada.Finalization; with Interfaces.C; private with ZMQ_Thin; package ZMQ is ZMQ_Error : exception; type Context_Type is new Ada.Finalization.Limited_Controlled with private; type Message_Type is new Ada.Finalization.Limited_Controlled with private; type Socket_Type is new Ada.Finalization.Limited_Controlled with private; type Socket_Type_Access is access all Socket_Type'Class; type Poll_Item_Type is private; type Poll_Item_Array_Type is array (Natural range <>) of Poll_Item_Type; No_Socket : constant Socket_Type; type Socket_Types is (ZMQ_PAIR, ZMQ_PUB, ZMQ_SUB, ZMQ_REQ, ZMQ_REP, ZMQ_DEALER, ZMQ_ROUTER, ZMQ_PULL, ZMQ_PUSH, ZMQ_XPUB, ZMQ_XSUB, ZMQ_STREAM); type Socket_Option_Names is (ZMQ_AFFINITY, ZMQ_IDENTITY, ZMQ_SUBSCRIBE, ZMQ_UNSUBSCRIBE, ZMQ_RATE, ZMQ_RECOVERY_IVL, ZMQ_SNDBUF, ZMQ_RCVBUF, ZMQ_RCVMORE, ZMQ_FD, ZMQ_EVENTS, ZMQ_TYPE, ZMQ_LINGER, ZMQ_RECONNECT_IVL, ZMQ_BACKLOG, ZMQ_RECONNECT_IVL_MAX, ZMQ_MAXMSGSIZE, ZMQ_SNDHWM, ZMQ_RCVHWM, ZMQ_MULTICAST_HOPS, ZMQ_RCVTIMEO, ZMQ_SNDTIMEO, ZMQ_LAST_ENDPOINT, ZMQ_ROUTER_MANDATORY, ZMQ_TCP_KEEPALIVE, ZMQ_TCP_KEEPALIVE_CNT, ZMQ_TCP_KEEPALIVE_IDLE, ZMQ_TCP_KEEPALIVE_INTVL, ZMQ_TCP_ACCEPT_FILTER, ZMQ_IMMEDIATE, ZMQ_XPUB_VERBOSE, ZMQ_ROUTER_RAW, ZMQ_IPV6, ZMQ_MECHANISM, ZMQ_PLAIN_SERVER, ZMQ_PLAIN_USERNAME, ZMQ_PLAIN_PASSWORD, ZMQ_CURVE_SERVER, ZMQ_CURVE_PUBLICKEY, ZMQ_CURVE_SECRETKEY, ZMQ_CURVE_SERVERKEY, ZMQ_PROBE_ROUTER, ZMQ_REQ_CORRELATE, ZMQ_REQ_RELAXED, ZMQ_CONFLATE, ZMQ_ZAP_DOMAIN); -- Version -- ------------------------------------------------------------------------ procedure Version (Major : out Natural; Minor : out Natural; Patch : out Natural); -- Error Handling -- ------------------------------------------------------------------------ function Errno return Integer; function Strerror (Err_Num : Integer) return String; procedure Raise_Errno; pragma No_Return (Raise_Errno); -- Context -- ------------------------------------------------------------------------ type Context_Option_Names is (ZMQ_IO_THREADS, ZMQ_MAX_SOCKETS, ZMQ_IPV6); overriding procedure Initialize (Cxt : in out Context_Type); overriding procedure Finalize (Cxt : in out Context_Type); procedure Setup (Cxt : in out Context_Type); function New_Context return Context_Type; procedure Term (Context : in out Context_Type); procedure Shutdown (Context : Context_Type); procedure Set (Context : Context_Type; Name : Context_Option_Names; Value : Natural); function Get (Context : Context_Type; Name : Context_Option_Names) return Natural; function New_Socket (Context : Context_Type; Instance_Type : Socket_Types) return Socket_Type'Class; -- Message_Type -- ------------------------------------------------------------------------ overriding procedure Initialize (M : in out Message_Type); overriding procedure Finalize (M : in out Message_Type); procedure Setup (M : in out Message_Type; Size : Integer := 0); function Create_Message (Size : Integer := 0) return Message_Type; procedure Setup (M : in out Message_Type; Value : String); function Create_Message (Value : String) return Message_Type; procedure Send (M : in out Message_Type; S : Socket_Type'Class; Do_Not_Wait : Boolean := False; Send_More : Boolean := False); procedure Recv (M : in out Message_Type; S : Socket_Type'Class; Do_Not_Wait : Boolean := False); procedure Close (M : in out Message_Type); procedure Move (Dest : in out Message_Type; Src : in out Message_Type); procedure Copy (Dest : in out Message_Type; Src : in out Message_Type); function Data (M : in out Message_Type) return String; -- TODO data returning other types.. function Size (M : in out Message_Type) return Natural; function More (M : in out Message_Type) return Boolean; function Src_FD (M : in out Message_Type) return Integer; function Shared (M : in out Message_Type) return Boolean; -- Socket -- ------------------------------------------------------------------------ overriding procedure Initialize (S : in out Socket_Type); overriding procedure Finalize (S : in out Socket_Type); procedure Setup (S : in out Socket_Type; Context : Context_Type'Class; Instance_Type : Socket_Types); procedure Close (S : in out Socket_Type); procedure Set_Sock_Opt (S : Socket_Type; Option : Socket_Option_Names; Option_Value : Integer); procedure Set_Sock_Opt (S : Socket_Type; Option : Socket_Option_Names; Option_Value : Long_Long_Integer); procedure Set_Sock_Opt (S : Socket_Type; Option : Socket_Option_Names; Option_Value : String); function Get_Sock_Opt (S : Socket_Type; Option : Socket_Option_Names) return Integer; function Get_Sock_Opt (S : Socket_Type; Option : Socket_Option_Names) return Long_Long_Integer; function Get_Sock_Opt (S : Socket_Type; Option : Socket_Option_Names) return String; procedure Bind (S : Socket_Type; Address : String); procedure Connect (S : Socket_Type; Address : String); procedure Unbind (S : Socket_Type; Address : String); procedure Disconnect (S : Socket_Type; Address : String); -- TODO: What about an array of flags? procedure Send (S : Socket_Type; Buf : String; Do_Not_Wait : Boolean := False; Send_More : Boolean := False); -- TODO: Recv could have a version that out's an error.. and another that out's MORE function Recv (S : Socket_Type; Do_Not_Wait : Boolean := False) return String; -- Polling -- ------------------------------------------------------------------------ -- Create an array of Poll Items and call Poll on it. The array will be modified. -- No good way to get sockets or FDs back from poll item yet. Right now, remember the index in the array. procedure Setup (PE : in out Poll_Item_Type; S : Socket_Type'Class; Poll_In : Boolean := False; Poll_Out : Boolean := False); function New_Poll_Item (S : Socket_Type'Class; Poll_In : Boolean := False; Poll_Out : Boolean := False) return Poll_Item_Type; procedure Setup (PE : in out Poll_Item_Type; FD : Integer; Poll_In : Boolean := False; Poll_Out : Boolean := False; Poll_Error : Boolean := False); function New_Poll_Item (FD : Integer; Poll_In : Boolean := False; Poll_Out : Boolean := False; Poll_Error : Boolean := False) return Poll_Item_Type; function Is_Readable (PE : Poll_Item_Type) return Boolean; function Is_Writable (PE : Poll_Item_Type) return Boolean; function Has_Error (PE : Poll_Item_Type) return Boolean; function Poll (Entries : in out Poll_Item_Array_Type; Timeout : Long_Long_Integer := -1) return Natural; procedure Poll (Entries : in out Poll_Item_Array_Type; Timeout : Long_Long_Integer := -1); -- Proxy -- ------------------------------------------------------------------------ procedure Proxy (Frontend : Socket_Type'Class; Backend : Socket_Type'Class; Capture : Socket_Type'Class := ZMQ.No_Socket); procedure Proxy_Steerable (Frontend : Socket_Type'Class; Backend : Socket_Type'Class; Capture : Socket_Type'Class := ZMQ.No_Socket; Control : Socket_Type'Class := ZMQ.No_Socket); private type Context_Type is new Ada.Finalization.Limited_Controlled with record Impl_Ptr : System.Address := System.Null_Address; end record; type Message_Type is new Ada.Finalization.Limited_Controlled with record Msg_Internals : aliased ZMQ_Thin.zmq_msg_t; end record; type Socket_Type is new Ada.Finalization.Limited_Controlled with record Impl_Ptr : System.Address := System.Null_Address; end record; No_Socket : constant Socket_Type := Socket_Type'(Ada.Finalization.Limited_Controlled with Impl_Ptr => System.Null_Address); type Poll_Item_Type is record S_Impl_Ptr : System.Address := System.Null_Address; FD : Interfaces.C.int := 0; Poll_In : Boolean := False; Poll_Out : Boolean := False; Poll_Error : Boolean := False; Result_In : Boolean := False; Result_Out : Boolean := False; Result_Error : Boolean := False; end record; end ZMQ;
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_Draw.Text_Areas_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Draw_Text_Areas_Attribute_Node is begin return Self : Draw_Text_Areas_Attribute_Node do Matreshka.ODF_Draw.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Draw_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Draw_Text_Areas_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Text_Areas_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Draw_URI, Matreshka.ODF_String_Constants.Text_Areas_Attribute, Draw_Text_Areas_Attribute_Node'Tag); end Matreshka.ODF_Draw.Text_Areas_Attributes;
stcarrez/jason
Ada
1,600
adb
----------------------------------------------------------------------- -- jason-testsuite -- Testsuite for jason -- Copyright (C) 2016 Stephane.Carrez -- Written by Stephane.Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with AWA.Tests; with Jason.Applications; with Jason.Projects.Tests; with Jason.Tickets.Tests; package body Jason.Testsuite is Tests : aliased Util.Tests.Test_Suite; function Suite return Util.Tests.Access_Test_Suite is begin Jason.Projects.Tests.Add_Tests (Tests'Access); Jason.Tickets.Tests.Add_Tests (Tests'Access); return Tests'Access; end Suite; procedure Initialize (Props : in Util.Properties.Manager) is App : constant Jason.Applications.Application_Access := Jason.Applications.Create; begin -- Jason.Applications.Initialize (App); -- ASF.Server.Tests.Set_Context (App.all'Access); AWA.Tests.Initialize (App.all'Access, Props, True); end Initialize; end Jason.Testsuite;
reznikmm/matreshka
Ada
4,788
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Testsuite 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 test checks implementation of 'Read and 'Write attributes for -- Universal_String type. ------------------------------------------------------------------------------ with Ada.Directories; with Ada.Streams.Stream_IO; with League.Strings; procedure Test_106 is S1 : constant League.Strings.Universal_String := League.Strings.Empty_Universal_String; S2 : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("test"); procedure Do_Test (Item : League.Strings.Universal_String); ------------- -- Do_Test -- ------------- procedure Do_Test (Item : League.Strings.Universal_String) is use type League.Strings.Universal_String; File : Ada.Streams.Stream_IO.File_Type; Aux : League.Strings.Universal_String; begin Ada.Streams.Stream_IO.Create (File, Ada.Streams.Stream_IO.Out_File); League.Strings.Universal_String'Write (Ada.Streams.Stream_IO.Stream (File), Item); Ada.Streams.Stream_IO.Reset (File, Ada.Streams.Stream_IO.In_File); League.Strings.Universal_String'Read (Ada.Streams.Stream_IO.Stream (File), Aux); Ada.Streams.Stream_IO.Close (File); if Aux /= Item then raise Program_Error; end if; end Do_Test; begin -- Check whether empty string is handled properly. Do_Test (S1); -- Check whether non-empty string is handled properly. Do_Test (S2); end Test_106;
PThierry/ewok-kernel
Ada
3,327
adb
-- -- Copyright 2018 The wookey project team <[email protected]> -- - Ryad Benadjila -- - Arnauld Michelizza -- - Mathieu Renard -- - Philippe Thierry -- - Philippe Trebuchet -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- with ada.unchecked_conversion; with ewok.tasks; use ewok.tasks; with ewok.tasks.debug; with ewok.tasks_shared; use ewok.tasks_shared; with ewok.devices_shared; use ewok.devices_shared; with ewok.sched; with ewok.debug; with ewok.interrupts; with soc.interrupts; with m4.scb; package body ewok.mpu.handler with spark_mode => off is function memory_fault_handler (frame_a : t_stack_frame_access) return t_stack_frame_access is #if not CONFIG_KERNEL_PANIC_FREEZE new_frame_a : t_stack_frame_access #end if; begin if m4.scb.SCB.CFSR.MMFSR.MMARVALID then pragma DEBUG (debug.log (debug.ERROR, "MPU: MMFAR.ADDRESS = " & system_address'image (m4.scb.SCB.MMFAR.ADDRESS))); end if; if m4.scb.SCB.CFSR.MMFSR.MLSPERR then pragma DEBUG (debug.log (debug.ERROR, "MPU: MemManage fault during floating-point lazy state preservation")); end if; if m4.scb.SCB.CFSR.MMFSR.MSTKERR then pragma DEBUG (debug.log (debug.ERROR, "MPU: stacking for an exception entry has caused access violation")); end if; if m4.scb.SCB.CFSR.MMFSR.MUNSTKERR then pragma DEBUG (debug.log (debug.ERROR, "MPU: unstack for an exception return has caused access violation")); end if; if m4.scb.SCB.CFSR.MMFSR.DACCVIOL then pragma DEBUG (debug.log (debug.ERROR, "MPU: the processor attempted a load or store at a location that does not permit the operation")); end if; if m4.scb.SCB.CFSR.MMFSR.IACCVIOL then pragma DEBUG (debug.log (debug.ERROR, "MPU: the processor attempted an instruction fetch from a location that does not permit execution")); end if; pragma DEBUG (ewok.tasks.debug.crashdump (frame_a)); -- On memory fault, the task is not scheduled anymore ewok.tasks.set_state (ewok.sched.get_current, TASK_MODE_MAINTHREAD, ewok.tasks.TASK_STATE_FAULT); #if CONFIG_KERNEL_PANIC_FREEZE debug.panic ("Memory fault!"); return frame_a; #else new_frame_a := ewok.sched.do_schedule (frame_a); return new_frame_a; #end if; end memory_fault_handler; procedure init is ok : boolean; begin ewok.interrupts.set_task_switching_handler (soc.interrupts.INT_MEMMANAGE, memory_fault_handler'access, ID_KERNEL, ID_DEV_UNUSED, ok); if not ok then raise program_error; end if; end init; end ewok.mpu.handler;
charlie5/lace
Ada
87
adb
procedure launch_mouse_Motion -- -- Todo -- is begin null; end launch_mouse_Motion;
flyx/OpenGLAda
Ada
22,914
adb
-- Autogenerated by Generate, do not edit with System; with Ada.Unchecked_Conversion; private with GL.API.Subprogram_Reference; private with GL.API.Doubles; private with GL.API.Ints; private with GL.API.Shorts; private with GL.API.Singles; private with GL.API.UInts; private with GL.API; procedure GL.Load_Function_Pointers is use GL.API; generic type Function_Reference is private; function Load (Function_Name : String) return Function_Reference; pragma Inline (Load); function Load (Function_Name : String) return Function_Reference is function As_Function_Reference is new Ada.Unchecked_Conversion ( Source => System.Address, Target => Function_Reference); use type System.Address; Raw : System.Address := Subprogram_Reference (Function_Name); begin if Raw = System.Null_Address then Raw := Subprogram_Reference (Function_Name & "ARB"); if Raw = System.Null_Address then Raw := Subprogram_Reference (Function_Name & "EXT"); end if; end if; return As_Function_Reference (Raw); end Load; function Load_T1 is new Load (T1); function Load_T2 is new Load (T2); function Load_T3 is new Load (T3); function Load_T4 is new Load (T4); function Load_T5 is new Load (T5); function Load_T6 is new Load (T6); function Load_T7 is new Load (T7); function Load_T8 is new Load (T8); function Load_T9 is new Load (T9); function Load_T10 is new Load (T10); function Load_T11 is new Load (T11); function Load_T12 is new Load (T12); function Load_T13 is new Load (T13); function Load_T14 is new Load (T14); function Load_T15 is new Load (T15); function Load_T16 is new Load (T16); function Load_T17 is new Load (T17); function Load_T18 is new Load (T18); function Load_T19 is new Load (T19); function Load_T20 is new Load (T20); function Load_T21 is new Load (T21); function Load_T22 is new Load (T22); function Load_T23 is new Load (T23); function Load_T24 is new Load (T24); function Load_T25 is new Load (T25); function Load_T26 is new Load (T26); function Load_T27 is new Load (T27); function Load_T28 is new Load (T28); function Load_T29 is new Load (T29); function Load_T30 is new Load (T30); function Load_T31 is new Load (T31); function Load_T32 is new Load (T32); function Load_T33 is new Load (T33); function Load_T34 is new Load (T34); function Load_T35 is new Load (T35); function Load_T36 is new Load (T36); function Load_T37 is new Load (T37); function Load_T38 is new Load (T38); function Load_T39 is new Load (T39); function Load_T40 is new Load (T40); function Load_T41 is new Load (T41); function Load_T42 is new Load (T42); function Load_T43 is new Load (T43); function Load_T44 is new Load (T44); function Load_T45 is new Load (T45); function Load_T46 is new Load (T46); function Load_T47 is new Load (T47); function Load_T48 is new Load (T48); function Load_T49 is new Load (T49); function Load_T50 is new Load (T50); function Load_T51 is new Load (T51); function Load_T52 is new Load (T52); function Load_T53 is new Load (T53); function Load_T54 is new Load (T54); function Load_T55 is new Load (T55); function Load_T56 is new Load (T56); function Load_T57 is new Load (T57); function Load_T58 is new Load (T58); function Load_T59 is new Load (T59); function Load_T60 is new Load (T60); function Load_T61 is new Load (T61); function Load_T62 is new Load (T62); function Load_T63 is new Load (T63); function Load_T64 is new Load (T64); function Load_T65 is new Load (T65); function Load_T66 is new Load (T66); function Load_T67 is new Load (T67); function Load_T68 is new Load (T68); function Load_T69 is new Load (T69); function Load_T70 is new Load (T70); function Load_T71 is new Load (T71); function Load_T72 is new Load (T72); function Load_T73 is new Load (T73); function Load_T74 is new Load (T74); function Load_T75 is new Load (T75); function Load_T76 is new Load (T76); function Load_T77 is new Load (T77); function Load_T78 is new Load (T78); function Load_T79 is new Load (T79); function Load_T80 is new Load (T80); function Load_T81 is new Load (T81); function Load_T82 is new Load (T82); function Load_T83 is new Load (T83); function Load_T84 is new Load (T84); function Load_T85 is new Load (T85); function Load_T86 is new Load (T86); function Load_T87 is new Load (T87); function Load_T88 is new Load (T88); function Load_T89 is new Load (T89); function Load_T90 is new Load (T90); function Load_T91 is new Load (T91); function Load_T92 is new Load (T92); function Load_T93 is new Load (T93); function Load_T94 is new Load (T94); function Load_T95 is new Load (T95); function Load_T96 is new Load (T96); function Load_T97 is new Load (T97); function Load_T98 is new Load (T98); function Load_T99 is new Load (T99); function Load_T100 is new Load (T100); function Load_T101 is new Load (T101); function Load_T102 is new Load (T102); function Load_T103 is new Load (T103); function Load_T104 is new Load (T104); function Load_T105 is new Load (T105); function Load_T106 is new Load (T106); function Load_T107 is new Load (T107); function Load_T108 is new Load (T108); function Load_T109 is new Load (T109); function Load_T110 is new Load (T110); function Load_T111 is new Load (T111); function Load_T112 is new Load (T112); function Load_T113 is new Load (T113); function Load_T114 is new Load (T114); function Load_T115 is new Load (T115); function Load_T116 is new Load (T116); function Load_T117 is new Load (T117); function Load_T118 is new Load (T118); function Load_T119 is new Load (T119); function Load_T120 is new Load (T120); function Load_T121 is new Load (T121); function Load_T122 is new Load (T122); function Load_T123 is new Load (T123); function Load_T124 is new Load (T124); function Load_T125 is new Load (T125); function Load_T126 is new Load (T126); function Load_T127 is new Load (T127); function Load_T128 is new Load (T128); function Load_T129 is new Load (T129); function Load_T130 is new Load (T130); function Load_T131 is new Load (T131); function Load_T132 is new Load (T132); function Load_T133 is new Load (T133); function Load_T134 is new Load (T134); function Load_T135 is new Load (T135); function Load_T136 is new Load (T136); function Load_T137 is new Load (T137); function Load_T138 is new Load (T138); function Load_T139 is new Load (T139); function Load_T140 is new Load (T140); function Load_T141 is new Load (T141); function Load_T142 is new Load (T142); function Load_T143 is new Load (T143); function Load_T144 is new Load (T144); function Load_T145 is new Load (T145); function Load_T146 is new Load (T146); function Load_T147 is new Load (T147); function Load_T148 is new Load (T148); function Load_T149 is new Load (T149); function Load_T150 is new Load (T150); function Load_T151 is new Load (T151); function Load_T152 is new Load (T152); function Load_T153 is new Load (T153); function Load_T154 is new Load (T154); function Load_T155 is new Load (T155); function Load_T156 is new Load (T156); function Load_T157 is new Load (T157); function Load_T158 is new Load (T158); function Load_T159 is new Load (T159); function Load_T160 is new Load (T160); function Load_T161 is new Load (T161); function Load_T162 is new Load (T162); function Load_T163 is new Load (T163); function Load_T164 is new Load (T164); function Load_T165 is new Load (T165); function Load_T166 is new Load (T166); function Load_T167 is new Load (T167); function Load_T168 is new Load (T168); function Load_T169 is new Load (T169); function Load_T170 is new Load (T170); function Load_T171 is new Load (T171); function Load_T172 is new Load (T172); function Load_T173 is new Load (T173); function Load_T174 is new Load (T174); function Load_T175 is new Load (T175); function Load_T176 is new Load (T176); function Load_T177 is new Load (T177); function Load_T178 is new Load (T178); function Load_T179 is new Load (T179); function Load_T180 is new Load (T180); function Load_T181 is new Load (T181); function Load_T182 is new Load (T182); function Load_T183 is new Load (T183); function Load_T184 is new Load (T184); function Load_T185 is new Load (T185); function Load_T186 is new Load (T186); function Load_T187 is new Load (T187); function Load_T188 is new Load (T188); function Load_T189 is new Load (T189); function Load_T190 is new Load (T190); function Load_T191 is new Load (T191); function Load_T192 is new Load (T192); function Load_T193 is new Load (T193); function Load_T194 is new Load (T194); begin GL.API.Doubles.Vertex_Attrib1 := Load_T1 ("glVertexAttribL1d"); GL.API.Doubles.Vertex_Attrib2 := Load_T2 ("glVertexAttribL2d"); GL.API.Doubles.Vertex_Attrib2v := Load_T3 ("glVertexAttribL2dv"); GL.API.Doubles.Vertex_Attrib3 := Load_T4 ("glVertexAttribL3d"); GL.API.Doubles.Vertex_Attrib3v := Load_T5 ("glVertexAttribL3dv"); GL.API.Doubles.Vertex_Attrib4 := Load_T6 ("glVertexAttribL4d"); GL.API.Doubles.Vertex_Attrib4v := Load_T7 ("glVertexAttribL4dv"); GL.API.Ints.Uniform1 := Load_T8 ("glUniform1i"); GL.API.Ints.Uniform1v := Load_T9 ("glUniform1iv"); GL.API.Ints.Uniform2 := Load_T10 ("glUniform2i"); GL.API.Ints.Uniform2v := Load_T11 ("glUniform2iv"); GL.API.Ints.Uniform3 := Load_T12 ("glUniform3i"); GL.API.Ints.Uniform3v := Load_T13 ("glUniform3iv"); GL.API.Ints.Uniform4 := Load_T14 ("glUniform4i"); GL.API.Ints.Uniform4v := Load_T15 ("glUniform4iv"); GL.API.Ints.Uniform_Matrix2 := Load_T16 ("glUniformMatrix2iv"); GL.API.Ints.Uniform_Matrix3 := Load_T17 ("glUniformMatrix3iv"); GL.API.Ints.Uniform_Matrix4 := Load_T18 ("glUniformMatrix4iv"); GL.API.Ints.Vertex_Attrib1 := Load_T19 ("glVertexAttribI1i"); GL.API.Ints.Vertex_Attrib2 := Load_T20 ("glVertexAttribI2i"); GL.API.Ints.Vertex_Attrib2v := Load_T21 ("glVertexAttribI2iv"); GL.API.Ints.Vertex_Attrib3 := Load_T22 ("glVertexAttribI3i"); GL.API.Ints.Vertex_Attrib3v := Load_T23 ("glVertexAttribI3iv"); GL.API.Ints.Vertex_Attrib4 := Load_T24 ("glVertexAttribI4i"); GL.API.Ints.Vertex_Attrib4v := Load_T25 ("glVertexAttrib4Iiv"); GL.API.Shorts.Vertex_Attrib1 := Load_T26 ("glVertexAttrib1s"); GL.API.Shorts.Vertex_Attrib2 := Load_T27 ("glVertexAttrib2s"); GL.API.Shorts.Vertex_Attrib2v := Load_T28 ("glVertexAttrib2sv"); GL.API.Shorts.Vertex_Attrib3 := Load_T29 ("glVertexAttrib3s"); GL.API.Shorts.Vertex_Attrib3v := Load_T30 ("glVertexAttrib3sv"); GL.API.Shorts.Vertex_Attrib4 := Load_T31 ("glVertexAttrib4s"); GL.API.Shorts.Vertex_Attrib4v := Load_T32 ("glVertexAttrib4sv"); GL.API.Singles.Uniform1 := Load_T33 ("glUniform1f"); GL.API.Singles.Uniform1v := Load_T34 ("glUniform1fv"); GL.API.Singles.Uniform2 := Load_T35 ("glUniform2f"); GL.API.Singles.Uniform2v := Load_T36 ("glUniform2fv"); GL.API.Singles.Uniform3 := Load_T37 ("glUniform3f"); GL.API.Singles.Uniform3v := Load_T38 ("glUniform3fv"); GL.API.Singles.Uniform4 := Load_T39 ("glUniform4f"); GL.API.Singles.Uniform4v := Load_T40 ("glUniform4fv"); GL.API.Singles.Uniform_Matrix2 := Load_T41 ("glUniformMatrix2fv"); GL.API.Singles.Uniform_Matrix3 := Load_T42 ("glUniformMatrix3fv"); GL.API.Singles.Uniform_Matrix4 := Load_T43 ("glUniformMatrix4fv"); GL.API.Singles.Vertex_Attrib1 := Load_T44 ("glVertexAttrib1f"); GL.API.Singles.Vertex_Attrib2 := Load_T45 ("glVertexAttrib2f"); GL.API.Singles.Vertex_Attrib2v := Load_T46 ("glVertexAttrib2fv"); GL.API.Singles.Vertex_Attrib3 := Load_T47 ("glVertexAttrib3f"); GL.API.Singles.Vertex_Attrib3v := Load_T48 ("glVertexAttrib3fv"); GL.API.Singles.Vertex_Attrib4 := Load_T49 ("glVertexAttrib4f"); GL.API.Singles.Vertex_Attrib4v := Load_T50 ("glVertexAttrib4fv"); GL.API.UInts.Uniform1 := Load_T51 ("glUniform1ui"); GL.API.UInts.Uniform1v := Load_T52 ("glUniform1uiv"); GL.API.UInts.Uniform2 := Load_T53 ("glUniform2ui"); GL.API.UInts.Uniform2v := Load_T54 ("glUniform2uiv"); GL.API.UInts.Uniform3 := Load_T55 ("glUniform3ui"); GL.API.UInts.Uniform3v := Load_T56 ("glUniform3uiv"); GL.API.UInts.Uniform4 := Load_T57 ("glUniform4ui"); GL.API.UInts.Uniform4v := Load_T58 ("glUniform4uiv"); GL.API.UInts.Uniform_Matrix2 := Load_T59 ("glUniformMatrix2uiv"); GL.API.UInts.Uniform_Matrix3 := Load_T60 ("glUniformMatrix3uiv"); GL.API.UInts.Uniform_Matrix4 := Load_T61 ("glUniformMatrix4uiv"); GL.API.UInts.Vertex_Attrib1 := Load_T62 ("glVertexAttribI1ui"); GL.API.UInts.Vertex_Attrib2 := Load_T63 ("glVertexAttribI2ui"); GL.API.UInts.Vertex_Attrib2v := Load_T64 ("glVertexAttribI2uiv"); GL.API.UInts.Vertex_Attrib3 := Load_T65 ("glVertexAttribI3ui"); GL.API.UInts.Vertex_Attrib3v := Load_T66 ("glVertexAttribI3uiv"); GL.API.UInts.Vertex_Attrib4 := Load_T67 ("glVertexAttribI4ui"); GL.API.UInts.Vertex_Attrib4v := Load_T68 ("glVertexAttrib4Iuiv"); GL.API.Debug_Message_Insert := Load_T69 ("glDebugMessageInsert"); GL.API.Push_Debug_Group := Load_T70 ("glPushDebugGroup"); GL.API.Pop_Debug_Group := Load_T71 ("glPopDebugGroup"); GL.API.Debug_Message_Control := Load_T72 ("glDebugMessageControl"); GL.API.Get_Debug_Message_Log := Load_T73 ("glGetDebugMessageLog"); GL.API.Debug_Message_Callback := Load_T74 ("glDebugMessageCallback"); GL.API.Get_String_I := Load_T75 ("glGetStringi"); GL.API.Secondary_Color := Load_T76 ("glSecondaryColor3dv"); GL.API.Fog_Coord := Load_T77 ("glFogCoordd"); GL.API.Draw_Arrays_Instanced := Load_T78 ("glDrawArraysInstanced"); GL.API.Draw_Elements_Instanced := Load_T79 ("glDrawElementsInstanced"); GL.API.Draw_Elements_Base_Vertex := Load_T80 ("glDrawElementsBaseVertex"); GL.API.Draw_Transform_Feedback := Load_T81 ("glDrawTransformFeedback"); GL.API.Draw_Transform_Feedback_Stream := Load_T82 ("glDrawTransformFeedbackStream"); GL.API.Primitive_Restart_Index := Load_T83 ("glPrimitiveRestartIndex"); GL.API.Vertex_Attrib_Divisor := Load_T84 ("glVertexAttribDivisor"); GL.API.Blend_Func_I := Load_T85 ("glBlendFunci"); GL.API.Blend_Func_Separate := Load_T86 ("glBlendFuncSeparate"); GL.API.Blend_Func_Separate_I := Load_T87 ("glBlendFuncSeparate"); GL.API.Blend_Color := Load_T88 ("glBlendColor"); GL.API.Blend_Equation := Load_T89 ("glBlendEquation"); GL.API.Blend_Equation_I := Load_T90 ("glBlendEquationi"); GL.API.Blend_Equation_Separate := Load_T91 ("glBlendEquationSeparate"); GL.API.Blend_Equation_Separate_I := Load_T92 ("glBlendEquationi"); GL.API.Set_Point_Parameter_Single := Load_T93 ("glPointParameterf"); GL.API.Draw_Buffers := Load_T94 ("glDrawBuffers"); GL.API.Clear_Accum := Load_T88 ("glClearAccum"); GL.API.Clear_Buffer := Load_T95 ("glClearBufferfv"); GL.API.Clear_Draw_Buffer := Load_T96 ("glClearBufferfv"); GL.API.Clear_Buffer_Depth := Load_T97 ("glClearBufferfv"); GL.API.Clear_Buffer_Stencil := Load_T98 ("glClearBufferiv"); GL.API.Clear_Buffer_Depth_Stencil := Load_T99 ("glClearBufferfi"); GL.API.Stencil_Func_Separate := Load_T100 ("glStencilFuncSeparate"); GL.API.Stencil_Op_Separate := Load_T101 ("glStencilOpSeparate"); GL.API.Stencil_Mask_Separate := Load_T102 ("glStencilMaskSeparate"); GL.API.Compressed_Tex_Image_1D := Load_T103 ("glCompressedTexImage1D"); GL.API.Tex_Sub_Image_1D := Load_T104 ("glTexSubImage1D"); GL.API.Tex_Storage_1D := Load_T105 ("glTexStorage1D"); GL.API.Compressed_Tex_Image_2D := Load_T106 ("glCompressedTexImage2D"); GL.API.Tex_Storage_2D := Load_T107 ("glTexStorage2D"); GL.API.Tex_Image_3D := Load_T108 ("glTexImage3D"); GL.API.Compressed_Tex_Image_3D := Load_T109 ("glCompressedTexImage3D"); GL.API.Tex_Sub_Image_3D := Load_T104 ("glTexSubImage3D"); GL.API.Tex_Storage_3D := Load_T110 ("glTexStorage3D"); GL.API.Active_Texture := Load_T111 ("glActiveTexture"); GL.API.Generate_Mipmap := Load_T112 ("glGenerateMipmap"); GL.API.Invalidate_Tex_Image := Load_T113 ("glInvalidateTexImage"); GL.API.Invalidate_Tex_Sub_Image := Load_T114 ("glInvalidateTexSubImage"); GL.API.Gen_Buffers := Load_T115 ("glGenBuffers"); GL.API.Gen_Transform_Feedbacks := Load_T115 ("glGenTransformFeedbacks"); GL.API.Delete_Buffers := Load_T116 ("glDeleteBuffers"); GL.API.Delete_Transform_Feedbacks := Load_T116 ("glDeleteTransformFeedbacks"); GL.API.Bind_Buffer := Load_T117 ("glBindBuffer"); GL.API.Bind_Transform_Feedback := Load_T117 ("glBindTransformFeedback"); GL.API.Bind_Buffer_Base := Load_T118 ("glBindBufferBase"); GL.API.Buffer_Data := Load_T119 ("glBufferData"); GL.API.Texture_Buffer_Data := Load_T120 ("glTexBuffer"); GL.API.Map_Buffer := Load_T121 ("glMapBuffer"); GL.API.Map_Buffer_Range := Load_T122 ("glMapBufferRange"); GL.API.Buffer_Pointer := Load_T123 ("glGetBufferPointerv"); GL.API.Buffer_Sub_Data := Load_T124 ("glBufferSubData"); GL.API.Get_Buffer_Sub_Data := Load_T124 ("glGetBufferSubData"); GL.API.Unmap_Buffer := Load_T125 ("glUnmapBuffer"); GL.API.Get_Buffer_Parameter_Access_Kind := Load_T126 ("glGetBufferParameteriv"); GL.API.Get_Buffer_Parameter_Bool := Load_T127 ("glGetBufferParameteriv"); GL.API.Get_Buffer_Parameter_Size := Load_T128 ("glGetBufferParameteriv"); GL.API.Get_Buffer_Parameter_Usage := Load_T129 ("glGetBufferParameteriv"); GL.API.Invalidate_Buffer_Data := Load_T130 ("glInvalidateBufferData"); GL.API.Invalidate_Buffer_Sub_Data := Load_T131 ("glInvalidateBufferSubData"); GL.API.Flush_Mapped_Buffer_Range := Load_T132 ("glFlushMappedBufferRange"); GL.API.Gen_Vertex_Arrays := Load_T133 ("glGenVertexArrays"); GL.API.Delete_Vertex_Arrays := Load_T134 ("glDeleteVertexArrays"); GL.API.Bind_Vertex_Array := Load_T135 ("glBindVertexArray"); GL.API.Gen_Renderbuffers := Load_T136 ("glGenRenderbuffers"); GL.API.Delete_Renderbuffers := Load_T137 ("glDeleteBuffers"); GL.API.Renderbuffer_Storage := Load_T138 ("glRenderbufferStorage"); GL.API.Renderbuffer_Storage_Multisample := Load_T139 ("glRenderbufferStorageMultisample"); GL.API.Bind_Renderbuffer := Load_T140 ("glBindRenderbuffer"); GL.API.Get_Renderbuffer_Parameter_Int := Load_T141 ("glGetRenderbufferParameteriv"); GL.API.Get_Renderbuffer_Parameter_Internal_Format := Load_T142 ("glGetRenderbufferParameteriv"); GL.API.Clamp_Color := Load_T143 ("glClampColor"); GL.API.Gen_Framebuffers := Load_T144 ("glGenFramebuffers"); GL.API.Delete_Framebuffers := Load_T145 ("glDeleteFramebuffers"); GL.API.Bind_Framebuffer := Load_T146 ("glBindFramebuffer"); GL.API.Check_Framebuffer_Status := Load_T147 ("glCheckFramebufferStatus"); GL.API.Framebuffer_Renderbuffer := Load_T148 ("glFramebufferRenderbuffer"); GL.API.Framebuffer_Texture := Load_T149 ("glFramebufferTexture"); GL.API.Framebuffer_Texture_Layer := Load_T150 ("glFramebufferTextureLayer"); GL.API.Blit_Framebuffer := Load_T151 ("glBlitFramebuffer"); GL.API.Invalidate_Framebuffer := Load_T152 ("glInvalidateFramebuffer"); GL.API.Invalidate_Sub_Framebuffer := Load_T153 ("glInvalidateSubFramebuffer"); GL.API.Framebuffer_Parameter_Size := Load_T154 ("glFramebufferParameteri"); GL.API.Framebuffer_Parameter_Bool := Load_T155 ("glFramebufferParameteri"); GL.API.Get_Framebuffer_Parameter_Size := Load_T156 ("glGetFramebufferParameteriv"); GL.API.Get_Framebuffer_Parameter_Bool := Load_T157 ("glGetFramebufferParameteriv"); GL.API.Gen_Queries := Load_T158 ("glGenQueries"); GL.API.Delete_Queries := Load_T159 ("glDeleteQueries"); GL.API.Is_Query := Load_T160 ("glIsQuery"); GL.API.Get_Query_Object := Load_T161 ("glGetQueryObjectuiv"); GL.API.Begin_Query := Load_T162 ("glBeginQuery"); GL.API.End_Query := Load_T163 ("glEndQuery"); GL.API.Begin_Query_Indexed := Load_T164 ("glBeginQueryIndexed"); GL.API.End_Query_Indexed := Load_T165 ("glEndQueryIndexed"); GL.API.Query_Counter := Load_T166 ("glQueryCounter"); GL.API.Get_Shader_Param := Load_T167 ("glGetShaderiv"); GL.API.Get_Shader_Type := Load_T168 ("glGetShaderiv"); GL.API.Create_Shader := Load_T169 ("glCreateShader"); GL.API.Delete_Shader := Load_T170 ("glDeleteShader"); GL.API.Shader_Source := Load_T171 ("glShaderSource"); GL.API.Get_Shader_Source := Load_T172 ("glGetShaderSource"); GL.API.Compile_Shader := Load_T170 ("glCompileShader"); GL.API.Release_Shader_Compiler := Load_T71 ("glReleaseShaderCompiler"); GL.API.Get_Shader_Info_Log := Load_T172 ("glGetShaderInfoLog"); GL.API.Create_Program := Load_T173 ("glCreateProgram"); GL.API.Delete_Program := Load_T174 ("glDeleteProgram"); GL.API.Get_Program_Param := Load_T175 ("glGetProgramiv"); GL.API.Attach_Shader := Load_T176 ("glAttachShader"); GL.API.Link_Program := Load_T174 ("glLinkProgram"); GL.API.Get_Program_Info_Log := Load_T177 ("glGetProgramInfoLog"); GL.API.Get_Program_Stage := Load_T178 ("glGetProgramStageiv"); GL.API.Get_Subroutine_Index := Load_T179 ("glGetSubroutineIndex"); GL.API.Get_Subroutine_Uniform_Location := Load_T180 ("glGetSubroutineUniformLocation"); GL.API.Use_Program := Load_T174 ("glUseProgram"); GL.API.Validate_Program := Load_T174 ("glValidateProgram"); GL.API.Get_Uniform_Location := Load_T181 ("glGetUniformLocation"); GL.API.Bind_Attrib_Location := Load_T182 ("glBindAttribLocation"); GL.API.Get_Attrib_Location := Load_T183 ("glGetAttribLocation"); GL.API.Vertex_Attrib_Pointer := Load_T184 ("glVertexAttribPointer"); GL.API.Vertex_AttribI_Pointer := Load_T185 ("glVertexAttribIPointer"); GL.API.Vertex_AttribL_Pointer := Load_T185 ("glVertexAttribLPointer"); GL.API.Enable_Vertex_Attrib_Array := Load_T186 ("glEnableVertexAttribArray"); GL.API.Disable_Vertex_Attrib_Array := Load_T186 ("glDisableVertexAttribArray"); GL.API.Get_Attached_Shaders := Load_T187 ("glGetAttachedShaders"); GL.API.Bind_Frag_Data_Location := Load_T188 ("glBindFragDataLocation"); GL.API.Get_Frag_Data_Location := Load_T189 ("glGetFragDataLocation"); GL.API.Begin_Transform_Feedback := Load_T190 ("glBeginTransformFeedback"); GL.API.End_Transform_Feedback := Load_T71 ("glEndTransformFeedback"); GL.API.Get_Transform_Feedback_Varying := Load_T191 ("glGetTransformFeedbackVarying"); GL.API.Transform_Feedback_Varyings := Load_T192 ("glTransformFeedbackVaryings"); GL.API.Set_Patch_Parameter_Int := Load_T193 ("glPatchParameteri"); GL.API.Set_Patch_Parameter_Float_Array := Load_T194 ("glPatchParameterfv"); end GL.Load_Function_Pointers;
sungyeon/drake
Ada
2,564
ads
pragma License (Unrestricted); -- implementation unit with System.Storage_Elements; package System.Reference_Counting is pragma Pure; type Counter is mod 2 ** 32; for Counter'Size use 32; pragma Atomic (Counter); Static : constant := 2 ** 32 - 1; -- This should be untyped. -- A typed atomic constant disables static elaboration. type Data_Access is access all Counter; for Data_Access'Storage_Size use 0; function Shared (Data : not null Data_Access) return Boolean with Convention => Intrinsic; pragma Inline_Always (Shared); subtype Container is not null Data_Access; -- should be initialized with a sentinel procedure Adjust ( Target : not null access Container); procedure Assign ( Target : not null access Container; Source : not null access constant Container; Free : not null access procedure (Object : in out Data_Access)); procedure Clear ( Target : not null access Container; Free : not null access procedure (Object : in out Data_Access)); procedure Move ( Target : not null access Container; Source : not null access Container; Sentinel : not null Data_Access; Free : not null access procedure (Object : in out Data_Access)); subtype Length_Type is Storage_Elements.Storage_Count; procedure Unique ( Target : not null access Container; Target_Length : Length_Type; Target_Capacity : Length_Type; New_Length : Length_Type; New_Capacity : Length_Type; Sentinel : not null Data_Access; Reallocate : not null access procedure ( Target : aliased in out not null Data_Access; Length : Length_Type; -- copying length Max_Length : Length_Type; -- new length Capacity : Length_Type); Copy : not null access procedure ( Target : out not null Data_Access; Source : not null Data_Access; Length : Length_Type; -- copying length Max_Length : Length_Type; -- new length Capacity : Length_Type); Free : not null access procedure (Object : in out Data_Access)); procedure In_Place_Set_Length ( Target_Data : not null Data_Access; Target_Length : Length_Type; Target_Max_Length : aliased in out Length_Type; -- may be updated Target_Capacity : Length_Type; New_Length : Length_Type; Failure : out Boolean) -- reallocation is needed with Convention => Intrinsic; pragma Inline_Always (In_Place_Set_Length); end System.Reference_Counting;
AdaCore/libadalang
Ada
2,037
adb
-- This testcase tries to make sure that the lifecycle of env rebindings is -- properly done when reparsing the various analysis units involved. with Ada.Text_IO; use Ada.Text_IO; with Langkit_Support.Diagnostics; with Libadalang.Analysis; use Libadalang.Analysis; with Libadalang.Common; use Libadalang.Common; with Libadalang.Iterators; use Libadalang.Iterators; procedure Main is Ctx : constant Analysis_Context := Create_Context; Foo : constant Analysis_Unit := Get_From_File (Ctx, "foo.adb"); Options : constant Analysis_Unit := Get_From_File (Ctx, "options.ads"); Vectors : constant Analysis_Unit := Get_From_File (Ctx, "vectors.ads"); ------------ -- Reload -- ------------ procedure Reload (Unit : Analysis_Unit) is begin Reparse (Unit); if Has_Diagnostics (Unit) then for D of Diagnostics (Unit) loop Put_Line ("error " & Get_Filename (Unit) & ": " & Langkit_Support.Diagnostics.To_Pretty_String (D)); end loop; raise Program_Error; end if; end Reload; ------------- -- Process -- ------------- procedure Process (Title : String) is Call : constant Call_Expr := Find_First (Foo.Root, Kind_Is (Ada_Call_Expr)).As_Call_Expr; begin Put_Line ("== " & Title & " =="); declare Ref : constant Refd_Decl := Call.P_Failsafe_Referenced_Decl; begin if Kind (Ref) = Error then Put_Line ("Name resolution failed"); New_Line; return; else Put_Line (Call.Image); Put_Line (" resolves to: " & Decl (Ref).Image); end if; end; New_Line; end Process; begin Reload (Foo); Reload (Options); Reload (Vectors); Process ("Initial"); Reload (Foo); Process ("Reloading foo.adb"); Reload (Options); Process ("Reloading options.ads"); Reload (Vectors); Process ("Reloading vectors.ads"); Put_Line ("Done."); end Main;
reznikmm/matreshka
Ada
4,408
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ -- A stateless, functional component (computes a value). ------------------------------------------------------------------------------ limited with AMF.UML.Components; package AMF.Standard_Profile_L2.Services is pragma Preelaborate; type Standard_Profile_L2_Service is limited interface; type Standard_Profile_L2_Service_Access is access all Standard_Profile_L2_Service'Class; for Standard_Profile_L2_Service_Access'Storage_Size use 0; not overriding function Get_Base_Component (Self : not null access constant Standard_Profile_L2_Service) return AMF.UML.Components.UML_Component_Access is abstract; -- Getter of Service::base_Component. -- not overriding procedure Set_Base_Component (Self : not null access Standard_Profile_L2_Service; To : AMF.UML.Components.UML_Component_Access) is abstract; -- Setter of Service::base_Component. -- end AMF.Standard_Profile_L2.Services;
reznikmm/matreshka
Ada
4,089
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Presentation_Start_Scale_Attributes; package Matreshka.ODF_Presentation.Start_Scale_Attributes is type Presentation_Start_Scale_Attribute_Node is new Matreshka.ODF_Presentation.Abstract_Presentation_Attribute_Node and ODF.DOM.Presentation_Start_Scale_Attributes.ODF_Presentation_Start_Scale_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Presentation_Start_Scale_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Presentation_Start_Scale_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Presentation.Start_Scale_Attributes;
reznikmm/matreshka
Ada
4,623
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.Number_Lines_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Text_Number_Lines_Attribute_Node is begin return Self : Text_Number_Lines_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_Number_Lines_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Number_Lines_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Text_URI, Matreshka.ODF_String_Constants.Number_Lines_Attribute, Text_Number_Lines_Attribute_Node'Tag); end Matreshka.ODF_Text.Number_Lines_Attributes;
DrenfongWong/tkm-rpc
Ada
284
ads
with Tkmrpc.Request; with Tkmrpc.Response; package Tkmrpc.Operation_Handlers.Ike.Isa_Create_Child is procedure Handle (Req : Request.Data_Type; Res : out Response.Data_Type); -- Handler for the isa_create_child operation. end Tkmrpc.Operation_Handlers.Ike.Isa_Create_Child;
AdaCore/langkit
Ada
2,590
adb
with Ada.Exceptions; use Ada.Exceptions; with Ada.Text_IO; use Ada.Text_IO; with Langkit_Support.Errors; with Langkit_Support.Generic_API; use Langkit_Support.Generic_API; with Langkit_Support.Generic_API.Introspection; use Langkit_Support.Generic_API.Introspection; with Libfoolang.Generic_API; use Libfoolang.Generic_API; with Libfoolang.Generic_API.Introspection; use Libfoolang.Generic_API.Introspection; procedure Main is procedure Put_Error (Exc : Exception_Occurrence); -- Print a description on the given exception occurrence --------------- -- Put_Error -- --------------- procedure Put_Error (Exc : Exception_Occurrence) is begin Put_Line (Exception_Name (Exc) & ":"); Put_Line (" " & Exception_Message (Exc)); end Put_Error; All_Nodes : constant Type_Ref_Array := All_Node_Types (Self_Id); Members : constant Struct_Member_Ref_Array := (Member_Refs.Foo_Node_F_Fld_1, Member_Refs.Foo_Node_F_Fld_2, Member_Refs.Foo_Node_F_Fld_3); Dummy : Boolean; begin Put_Line ("Is_Null_For truth table:"); for M of Members loop declare Empty : Boolean := True; begin Put (Debug_Name (M) & ":"); for N of All_Nodes loop if Is_Null_For (M, N) then Empty := False; Put (" " & Debug_Name (N)); end if; end loop; if Empty then Put_Line (" <none>"); else New_Line; end if; end; end loop; New_Line; Put_Line ("Calling on a null member:"); begin Dummy := Is_Null_For (No_Struct_Member_Ref, Type_Refs.Foo_Node); exception when Exc : Langkit_Support.Errors.Precondition_Failure => Put_Error (Exc); end; New_Line; Put_Line ("Calling on a null type:"); begin Dummy := Is_Null_For (Member_Refs.Parent, No_Type_Ref); exception when Exc : Langkit_Support.Errors.Precondition_Failure => Put_Error (Exc); end; New_Line; Put_Line ("Calling on a non-node type ref:"); begin Dummy := Is_Null_For (Member_Refs.Parent, Type_Refs.Analysis_Unit); exception when Exc : Langkit_Support.Errors.Precondition_Failure => Put_Error (Exc); end; New_Line; Put_Line ("Calling on a member not owned by the node"); begin Dummy := Is_Null_For (Member_Refs.A1_F_Only_On_A1, Type_Refs.A2); exception when Exc : Langkit_Support.Errors.Precondition_Failure => Put_Error (Exc); end; New_Line; Put_Line ("main.adb: Done."); end Main;
sungyeon/drake
Ada
36
adb
../machine-apple-darwin/s-multip.adb
reznikmm/matreshka
Ada
4,907
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ -- A class that specifies a domain of objects together with the operations -- applicable to the objects, without defining the physical implementation of -- those objects. However, it may have attributes and associations. -- Behavioral specifications for type operations may be expressed using, for -- example, activity diagrams. An object may have at most one implementation -- class, however it may conform to multiple different types. See also: -- «ImplementationClass». ------------------------------------------------------------------------------ limited with AMF.UML.Classifiers; package AMF.Standard_Profile_L2.Specifications is pragma Preelaborate; type Standard_Profile_L2_Specification is limited interface; type Standard_Profile_L2_Specification_Access is access all Standard_Profile_L2_Specification'Class; for Standard_Profile_L2_Specification_Access'Storage_Size use 0; not overriding function Get_Base_Classifier (Self : not null access constant Standard_Profile_L2_Specification) return AMF.UML.Classifiers.UML_Classifier_Access is abstract; -- Getter of Specification::base_Classifier. -- not overriding procedure Set_Base_Classifier (Self : not null access Standard_Profile_L2_Specification; To : AMF.UML.Classifiers.UML_Classifier_Access) is abstract; -- Setter of Specification::base_Classifier. -- end AMF.Standard_Profile_L2.Specifications;
io7m/coreland-opengl-ada
Ada
7,567
adb
with OpenGL.Thin; package body OpenGL.State is function Capability_To_Constant (Capability : in Capability_t) return Thin.Enumeration_t is begin case Capability is when Alpha_Test => return Thin.GL_ALPHA_TEST; when Auto_Normal => return Thin.GL_AUTO_NORMAL; when Blend => return Thin.GL_BLEND; when Color_Array => return Thin.GL_COLOR_ARRAY; when Color_Logic_Op => return Thin.GL_COLOR_LOGIC_OP; when Color_Material => return Thin.GL_COLOR_MATERIAL; when Color_Sum => return Thin.GL_COLOR_SUM; when Color_Table => return Thin.GL_COLOR_TABLE; when Convolution_1D => return Thin.GL_CONVOLUTION_1D; when Convolution_2D => return Thin.GL_CONVOLUTION_2D; when Cull_Face => return Thin.GL_CULL_FACE; when Depth_Test => return Thin.GL_DEPTH_TEST; when Dither => return Thin.GL_DITHER; when Edge_Flag_Array => return Thin.GL_EDGE_FLAG_ARRAY; when Fog => return Thin.GL_FOG; when Fog_Coord_Array => return Thin.GL_FOG_COORD_ARRAY; when Histogram => return Thin.GL_HISTOGRAM; when Index_Array => return Thin.GL_INDEX_ARRAY; when Index_Logic_Op => return Thin.GL_INDEX_LOGIC_OP; when Lighting => return Thin.GL_LIGHTING; when Line_Smooth => return Thin.GL_LINE_SMOOTH; when Line_Stipple => return Thin.GL_LINE_STIPPLE; when Map1_Color_4 => return Thin.GL_MAP1_COLOR_4; when Map1_Index => return Thin.GL_MAP1_INDEX; when Map1_Normal => return Thin.GL_MAP1_NORMAL; when Map1_Texture_Coord_1 => return Thin.GL_MAP1_TEXTURE_COORD_1; when Map1_Texture_Coord_2 => return Thin.GL_MAP1_TEXTURE_COORD_2; when Map1_Texture_Coord_3 => return Thin.GL_MAP1_TEXTURE_COORD_3; when Map1_Texture_Coord_4 => return Thin.GL_MAP1_TEXTURE_COORD_4; when Map2_Color_4 => return Thin.GL_MAP2_COLOR_4; when Map2_Index => return Thin.GL_MAP2_INDEX; when Map2_Normal => return Thin.GL_MAP2_NORMAL; when Map2_Texture_Coord_1 => return Thin.GL_MAP2_TEXTURE_COORD_1; when Map2_Texture_Coord_2 => return Thin.GL_MAP2_TEXTURE_COORD_2; when Map2_Texture_Coord_3 => return Thin.GL_MAP2_TEXTURE_COORD_3; when Map2_Texture_Coord_4 => return Thin.GL_MAP2_TEXTURE_COORD_4; when Map2_Vertex_3 => return Thin.GL_MAP2_VERTEX_3; when Map2_Vertex_4 => return Thin.GL_MAP2_VERTEX_4; when Minmax => return Thin.GL_MINMAX; when Multisample => return Thin.GL_MULTISAMPLE; when Normal_Array => return Thin.GL_NORMAL_ARRAY; when Normalize => return Thin.GL_NORMALIZE; when Point_Smooth => return Thin.GL_POINT_SMOOTH; when Point_Sprite => return Thin.GL_POINT_SPRITE; when Polygon_Smooth => return Thin.GL_POLYGON_SMOOTH; when Polygon_Offset_Fill => return Thin.GL_POLYGON_OFFSET_FILL; when Polygon_Offset_Line => return Thin.GL_POLYGON_OFFSET_LINE; when Polygon_Offset_Point => return Thin.GL_POLYGON_OFFSET_POINT; when Polygon_Stipple => return Thin.GL_POLYGON_STIPPLE; when Post_Color_Matrix_Color_Table => return Thin.GL_POST_COLOR_MATRIX_COLOR_TABLE; when Post_Convolution_Color_Table => return Thin.GL_POST_CONVOLUTION_COLOR_TABLE; when Rescale_Normal => return Thin.GL_RESCALE_NORMAL; when Sample_Alpha_To_Coverage => return Thin.GL_SAMPLE_ALPHA_TO_COVERAGE; when Sample_Alpha_To_One => return Thin.GL_SAMPLE_ALPHA_TO_ONE; when Sample_Coverage => return Thin.GL_SAMPLE_COVERAGE; when Scissor_Test => return Thin.GL_SCISSOR_TEST; when Secondary_Color_Array => return Thin.GL_SECONDARY_COLOR_ARRAY; when Separable_2D => return Thin.GL_SEPARABLE_2D; when Stencil_Test => return Thin.GL_STENCIL_TEST; when Texture_1D => return Thin.GL_TEXTURE_1D; when Texture_2D => return Thin.GL_TEXTURE_2D; when Texture_3D => return Thin.GL_TEXTURE_3D; when Texture_Coord_Array => return Thin.GL_TEXTURE_COORD_ARRAY; when Texture_Cube_Map => return Thin.GL_TEXTURE_CUBE_MAP; when Texture_Gen_Q => return Thin.GL_TEXTURE_GEN_Q; when Texture_Gen_R => return Thin.GL_TEXTURE_GEN_R; when Texture_Gen_S => return Thin.GL_TEXTURE_GEN_S; when Texture_Gen_T => return Thin.GL_TEXTURE_GEN_T; when Texture_Rectangle_ARB => return Thin.GL_TEXTURE_RECTANGLE_ARB; when Vertex_Array => return Thin.GL_VERTEX_ARRAY; when Vertex_Program_Point_Size => return Thin.GL_VERTEX_PROGRAM_POINT_SIZE; when Vertex_Program_Two_Side => return Thin.GL_VERTEX_PROGRAM_TWO_SIDE; end case; end Capability_To_Constant; function Client_Capability_To_Constant (Capability : in Client_Capability_t) return Thin.Enumeration_t is begin case Capability is when Color_Array => return Thin.GL_COLOR_ARRAY; when Edge_Flag_Array => return Thin.GL_EDGE_FLAG_ARRAY; when Fog_Coord_Array => return Thin.GL_FOG_COORD_ARRAY; when Index_Array => return Thin.GL_INDEX_ARRAY; when Normal_Array => return Thin.GL_NORMAL_ARRAY; when Secondary_Color_Array => return Thin.GL_SECONDARY_COLOR_ARRAY; when Texture_Coord_Array => return Thin.GL_TEXTURE_COORD_ARRAY; when Vertex_Array => return Thin.GL_VERTEX_ARRAY; end case; end Client_Capability_To_Constant; procedure Enable (Capability : in Capability_t) is begin Thin.Enable (Capability_To_Constant (Capability)); end Enable; procedure Disable (Capability : in Capability_t) is begin Thin.Disable (Capability_To_Constant (Capability)); end Disable; function Is_Enabled (Capability : in Capability_t) return Boolean is use type Thin.Boolean_t; On : constant Thin.Boolean_t := Thin.Is_Enabled (Capability_To_Constant (Capability)); begin if On = Thin.Boolean_t'Val (1) then return True; else return False; end if; end Is_Enabled; procedure Enable_Client_State (Capability : in Client_Capability_t) is begin Thin.Enable_Client_State (Client_Capability_To_Constant (Capability)); end Enable_Client_State; procedure Disable_Client_State (Capability : in Client_Capability_t) is begin Thin.Disable_Client_State (Client_Capability_To_Constant (Capability)); end Disable_Client_State; end OpenGL.State;
AdaCore/libadalang
Ada
202
adb
package body P is procedure X (F : Integer) is separate; package Nested is procedure Boo; --% node.p_next_part_for_decl() end Nested; package body Nested is separate; end P;
marcello-s/AeonFlux
Ada
391
adb
-- Copyright (c) 2015-2019 Marcel Schneider -- for details see License.txt with TokenValue; use TokenValue; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; package body Lexer is function ReadToken (O : Object) return TokenValue.Object is TO : TokenValue.Object; begin TO.Message := To_Unbounded_String ("Testing"); return TO; end ReadToken; end Lexer;
ekoeppen/STM32_Generic_Ada_Drivers
Ada
883
ads
with System; package STM32GD.Vectors is pragma Preelaborate; procedure Default_Handler; type IRQ_Vectors is record HardFault_Handler : System.Address; MemManage_Handler : System.Address; BusFault_Handler : System.Address; UsageFault_Handler : System.Address; Reserved_1C : System.Address; Reserved_20 : System.Address; Reserved_24 : System.Address; Reserved_28 : System.Address; SVCall_Handler : System.Address; DebugMonitor_Handler : System.Address; Reserved_34 : System.Address; PendSV_Handler : System.Address; SysTick_Handler : System.Address; WWDG_Handler : System.Address; PVD_Handler : System.Address; FLASH_Handler : System.Address; RTC_Handler : System.Address; end record; end STM32GD.Vectors;
AdaCore/libadalang
Ada
61
adb
procedure Installed_Dep is begin null; end Installed_Dep;
AdaCore/langkit
Ada
424
adb
with Langkit_Support.Adalog.Main_Support; use Langkit_Support.Adalog.Main_Support; -- Test that Unify works correctly, specially that variable aliasing is well -- reset after evaluating a solution. procedure Main is use T_Solver; use Refs; X : constant Refs.Logic_Var := Create ("X"); R : constant Relation := Domain (X, (1, 2, 3, 4, 5, 6)) and Domain (X, (3, 4, 5)); begin Solve_All (R); end Main;
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_Presentation.Delay_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Presentation_Delay_Attribute_Node is begin return Self : Presentation_Delay_Attribute_Node do Matreshka.ODF_Presentation.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Presentation_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Presentation_Delay_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Delay_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Presentation_URI, Matreshka.ODF_String_Constants.Delay_Attribute, Presentation_Delay_Attribute_Node'Tag); end Matreshka.ODF_Presentation.Delay_Attributes;
reznikmm/gela
Ada
2,395
ads
------------------------------------------------------------------------------ -- 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.Containers.Hashed_Sets; with League.String_Vectors; with Anagram.Grammars.Ordered; with AG_Tools.Visit_Generators; with AG_Tools.Writers; package AG_Tools.Contexts is type Partition_Array_Access is access all Anagram.Grammars.Ordered.Partition_Array; type Part_Map is array (Anagram.Grammars.Part_Index range <>) of Boolean; type Part_Map_Access is access all Part_Map; type Attr is record Origin : League.Strings.Universal_String; Decl : Anagram.Grammars.Attribute_Declaration_Index; end record; function Hash (Self : Attr) return Ada.Containers.Hash_Type; package Attr_Sets is new Ada.Containers.Hashed_Sets (Element_Type => Attr, Hash => Hash, Equivalent_Elements => "="); type Unit_Kinds is (Spec_Unit, Body_Unit); type With_Records is array (Unit_Kinds) of League.String_Vectors.Universal_String_Vector; type Context is tagged record Factory : AG_Tools.Visit_Generators.Factory_Access; Grammar : Anagram.Grammars.Grammar_Access; Partition : Partition_Array_Access; Part_Map : Part_Map_Access; Attr_Map : Attr_Sets.Set; Withs : With_Records; Spec : AG_Tools.Writers.Writer; Impl : AG_Tools.Writers.Writer; Code : AG_Tools.Writers.Writer; end record; type Context_Access is access all Context; procedure Add_With (Self : access Context; Name : League.Strings.Universal_String; Kind : Unit_Kinds := Body_Unit); procedure Add_With (Self : access Context; Name : Wide_Wide_String; Kind : Unit_Kinds := Body_Unit); procedure Print_Withes (Self : access Context; Kind : Unit_Kinds); end AG_Tools.Contexts;
reznikmm/matreshka
Ada
4,673
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Visitors; with ODF.DOM.Draw_Object_Elements; package Matreshka.ODF_Draw.Object_Elements is type Draw_Object_Element_Node is new Matreshka.ODF_Draw.Abstract_Draw_Element_Node and ODF.DOM.Draw_Object_Elements.ODF_Draw_Object with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Draw_Object_Element_Node; overriding function Get_Local_Name (Self : not null access constant Draw_Object_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Draw_Object_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 Draw_Object_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 Draw_Object_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_Draw.Object_Elements;
charlie5/lace
Ada
3,919
adb
with lace.event.Logger, lace.event_Conversions, gnat.task_Lock; package body lace.make_Observer.deferred is procedure receive (Self : access Item; the_Event : in Event.item'Class := event.null_Event; from_Subject : in String) is use event_Vectors; begin gnat.task_Lock.lock; if not Self.pending_Events.contains (from_Subject) then Self.pending_Events.insert (from_Subject, new event_Vector); end if; Self.pending_Events.Element (from_Subject).append (the_Event); gnat.task_Lock.unlock; end receive; procedure respond (Self : access Item) is use event_Vectors; my_Name : String := Observer.Item'Class (Self.all).Name; --- actuate -- procedure actuate (the_Responses : in event_response_Map; for_Events : in out event_Vector; from_Subject_Name : in String) is the_Events : event_Vector renames for_Events; Cursor : event_Vectors.Cursor; begin Cursor := the_Events.First; while has_Element (Cursor) loop declare use event_response_Maps, event_Conversions, ada.Containers; use type Observer.view; the_Event : Event.item'Class := Element (Cursor); Response : event_response_Maps.Cursor := the_Responses.find (to_event_Kind (the_Event'tag)); begin if has_Element (Response) then Element (Response).respond (the_Event); if Observer.Logger /= null then Observer.Logger.log_Response (Element (Response), Observer.view (Self), the_Event, from_Subject_Name); end if; elsif Self.relay_Target /= null then -- Self.relay_Target.notify (the_Event, from_Subject_Name); if Observer.Logger /= null then Observer.Logger.log ("[Warning] ~ Relayed events are currently disabled."); else raise program_Error with "Event relaying is currently disabled"; end if; else if Observer.Logger /= null then Observer.Logger.log ("[Warning] ~ Observer " & my_Name & " has no response !"); Observer.Logger.log (" count of responses =>" & Count_type'Image (the_Responses.Length)); else raise program_Error with "Observer " & my_Name & " has no response !"; end if; end if; end; next (Cursor); end loop; end actuate; use subject_Maps_of_safe_events; subject_Cursor : subject_Maps_of_safe_events.Cursor := Self.pending_Events.First; begin while has_Element (subject_Cursor) loop declare use subject_Maps_of_event_responses; subject_Name : String := Key (subject_Cursor); begin actuate (Self.subject_Responses.Element (subject_Name).all, Self.pending_Events .Element (subject_Name).all, subject_Name); Self.pending_Events.Element (subject_Name).clear; exception when constraint_Error => if Observer.Logger /= null then Observer.Logger.log (my_Name & " has no responses for events from " & subject_Name); else raise program_Error with my_Name & " has no responses for events from " & subject_Name; end if; end; next (subject_Cursor); end loop; end respond; end lace.make_Observer.deferred;
stcarrez/ada-awa
Ada
11,659
ads
----------------------------------------------------------------------- -- awa-tags-beans -- Beans for the tags module -- Copyright (C) 2013, 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 Ada.Strings.Unbounded; with Ada.Containers.Hashed_Maps; with Ada.Containers.Ordered_Sets; with Ada.Finalization; with Util.Beans.Basic; with Util.Beans.Objects.Lists; with Util.Beans.Lists.Strings; with Util.Strings.Vectors; with ADO; with ADO.Utils; with ADO.Schemas; with ADO.Sessions; with AWA.Tags.Models; with AWA.Tags.Modules; -- == Ada Beans == -- Several bean types are provided to represent and manage a list of tags. -- The tag module registers the bean constructors when it is initialized. -- To use them, one must declare a bean definition in the application XML configuration. -- -- === Tag_List_Bean === -- The `Tag_List_Bean` holds a list of tags and provides operations used by the -- `awa:tagList` component to add or remove tags within a `h:form` component. -- A bean can be declared and configured as follows in the XML application configuration file: -- -- <managed-bean> -- <managed-bean-name>questionTags</managed-bean-name> -- <managed-bean-class>AWA.Tags.Beans.Tag_List_Bean</managed-bean-class> -- <managed-bean-scope>request</managed-bean-scope> -- <managed-property> -- <property-name>entity_type</property-name> -- <property-class>String</property-class> -- <value>awa_question</value> -- </managed-property> -- <managed-property> -- <property-name>permission</property-name> -- <property-class>String</property-class> -- <value>question-edit</value> -- </managed-property> -- </managed-bean> -- -- The `entity_type` property defines the name of the database table to which the tags -- are assigned. The `permission` property defines the permission name that must be used -- to verify that the user has the permission do add or remove the tag. Such permission is -- verified only when the `awa:tagList` component is used within a form. -- -- === Tag_Search_Bean === -- The `Tag_Search_Bean` is dedicated to searching for tags that start with a given -- pattern. The auto complete feature of the `awa:tagList` component can use this -- bean type to look in the database for tags matching a start pattern. The declaration of the -- bean should define the database table to search for tags associated with a given database -- table. This is done in the XML configuration with the `entity_type` property. -- -- <managed-bean> -- <managed-bean-name>questionTagSearch</managed-bean-name> -- <managed-bean-class>AWA.Tags.Beans.Tag_Search_Bean</managed-bean-class> -- <managed-bean-scope>request</managed-bean-scope> -- <managed-property> -- <property-name>entity_type</property-name> -- <property-class>String</property-class> -- <value>awa_question</value> -- </managed-property> -- </managed-bean> -- -- === Tag_Info_List_Bean === -- The <tt>Tag_Info_List_Bean</tt> holds a collection of tags with their weight. It is used -- by the <tt>awa:tagCloud</tt> component. -- -- <managed-bean> -- <managed-bean-name>questionTagList</managed-bean-name> -- <managed-bean-class>AWA.Tags.Beans.Tag_Info_List_Bean</managed-bean-class> -- <managed-bean-scope>request</managed-bean-scope> -- <managed-property> -- <property-name>entity_type</property-name> -- <property-class>String</property-class> -- <value>awa_question</value> -- </managed-property> -- </managed-bean> -- -- @include-bean tag-queries.xml package AWA.Tags.Beans is -- Compare two tags on their count and name. function "<" (Left, Right : in AWA.Tags.Models.Tag_Info) return Boolean; package Tag_Ordered_Sets is new Ada.Containers.Ordered_Sets (Element_Type => AWA.Tags.Models.Tag_Info, "=" => AWA.Tags.Models."="); type Tag_List_Bean is new Util.Beans.Objects.Lists.List_Bean and Util.Beans.Basic.Bean with private; type Tag_List_Bean_Access is access all Tag_List_Bean'Class; -- Set the value identified by the name. -- If the name cannot be found, the method should raise the No_Value -- exception. overriding procedure Set_Value (From : in out Tag_List_Bean; Name : in String; Value : in Util.Beans.Objects.Object); -- Set the entity type (database table) onto which the tags are associated. procedure Set_Entity_Type (Into : in out Tag_List_Bean; Table : in ADO.Schemas.Class_Mapping_Access); -- Set the permission to check before removing or adding a tag on the entity. procedure Set_Permission (Into : in out Tag_List_Bean; Permission : in String); -- Load the tags associated with the given database identifier. procedure Load_Tags (Into : in out Tag_List_Bean; Session : in ADO.Sessions.Session; For_Entity_Id : in ADO.Identifier); -- Set the list of tags to add. procedure Set_Added (Into : in out Tag_List_Bean; Tags : in Util.Strings.Vectors.Vector); -- Set the list of tags to remove. procedure Set_Deleted (Into : in out Tag_List_Bean; Tags : in Util.Strings.Vectors.Vector); -- Update the tags associated with the tag entity represented by <tt>For_Entity_Id</tt>. -- The list of tags defined by <tt>Set_Deleted</tt> are removed first and the list of -- tags defined by <tt>Set_Added</tt> are associated with the database entity. procedure Update_Tags (From : in Tag_List_Bean; For_Entity_Id : in ADO.Identifier); -- Create the tag list bean instance. function Create_Tag_List_Bean (Module : in AWA.Tags.Modules.Tag_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access; type Tag_Search_Bean is new Util.Beans.Objects.Lists.List_Bean and Util.Beans.Basic.Bean with private; type Tag_Search_Bean_Access is access all Tag_Search_Bean'Class; -- Set the value identified by the name. -- If the name cannot be found, the method should raise the No_Value -- exception. overriding procedure Set_Value (From : in out Tag_Search_Bean; Name : in String; Value : in Util.Beans.Objects.Object); -- Search the tags that match the search string. procedure Search_Tags (Into : in out Tag_Search_Bean; Session : in ADO.Sessions.Session; Search : in String); -- Set the entity type (database table) onto which the tags are associated. procedure Set_Entity_Type (Into : in out Tag_Search_Bean; Table : in ADO.Schemas.Class_Mapping_Access); -- Create the tag search bean instance. function Create_Tag_Search_Bean (Module : in AWA.Tags.Modules.Tag_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access; type Tag_Info_List_Bean is new AWA.Tags.Models.Tag_Info_List_Bean and Util.Beans.Basic.Bean with private; type Tag_Info_List_Bean_Access is access all Tag_Info_List_Bean'Class; -- Set the value identified by the name. -- If the name cannot be found, the method should raise the No_Value -- exception. overriding procedure Set_Value (From : in out Tag_Info_List_Bean; Name : in String; Value : in Util.Beans.Objects.Object); -- Load the list of tags. procedure Load_Tags (Into : in out Tag_Info_List_Bean; Session : in out ADO.Sessions.Session); -- Create the tag info list bean instance. function Create_Tag_Info_List_Bean (Module : in AWA.Tags.Modules.Tag_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access; -- The <tt>Entity_Tag_Map</tt> contains a list of tags associated with some entities. -- It allows to retrieve from the database all the tags associated with several entities -- and get the list of tags for a given entity. type Entity_Tag_Map is new Ada.Finalization.Limited_Controlled with private; -- Get the list of tags associated with the given entity. -- Returns null if the entity does not have any tag. function Get_Tags (From : in Entity_Tag_Map; For_Entity : in ADO.Identifier) return Util.Beans.Lists.Strings.List_Bean_Access; -- Get the list of tags associated with the given entity. -- Returns a null object if the entity does not have any tag. function Get_Tags (From : in Entity_Tag_Map; For_Entity : in ADO.Identifier) return Util.Beans.Objects.Object; -- Release the list of tags. procedure Clear (List : in out Entity_Tag_Map); -- Load the list of tags associated with a list of entities. procedure Load_Tags (Into : in out Entity_Tag_Map; Session : in out ADO.Sessions.Session'Class; Entity_Type : in String; List : in ADO.Utils.Identifier_Vector); -- Release the list of tags. overriding procedure Finalize (List : in out Entity_Tag_Map); private type Tag_List_Bean is new Util.Beans.Objects.Lists.List_Bean and Util.Beans.Basic.Bean with record Module : AWA.Tags.Modules.Tag_Module_Access; Entity_Type : Ada.Strings.Unbounded.Unbounded_String; Permission : Ada.Strings.Unbounded.Unbounded_String; Current : Natural := 0; Added : Util.Strings.Vectors.Vector; Deleted : Util.Strings.Vectors.Vector; end record; type Tag_Search_Bean is new Util.Beans.Objects.Lists.List_Bean and Util.Beans.Basic.Bean with record Module : AWA.Tags.Modules.Tag_Module_Access; Entity_Type : Ada.Strings.Unbounded.Unbounded_String; end record; type Tag_Info_List_Bean is new AWA.Tags.Models.Tag_Info_List_Bean and Util.Beans.Basic.Bean with record Module : AWA.Tags.Modules.Tag_Module_Access; Entity_Type : Ada.Strings.Unbounded.Unbounded_String; end record; package Entity_Tag_Maps is new Ada.Containers.Hashed_Maps (Key_Type => ADO.Identifier, Element_Type => Util.Beans.Lists.Strings.List_Bean_Access, Hash => ADO.Utils.Hash, Equivalent_Keys => ADO."=", "=" => Util.Beans.Lists.Strings."="); type Entity_Tag_Map is new Ada.Finalization.Limited_Controlled with record Tags : Entity_Tag_Maps.Map; end record; end AWA.Tags.Beans;
jhumphry/Ada_BinToAsc
Ada
14,539
adb
-- BinToAsc_Suite.Utils -- Unit test utilities for BinToAsc -- Copyright (c) 2015, James Humphry - see LICENSE file for details with System.Storage_Elements; with AUnit.Assertions; use AUnit.Assertions; with String_To_Storage_Array, Storage_Array_To_String; package body BinToAsc_Suite.Utils is use RFC4648; use type RFC4648.Codec_State; use System.Storage_Elements; function STSA (X : String) return Storage_Array renames String_To_Storage_Array; function SATS (X : Storage_Array) return String renames Storage_Array_To_String; -------------------- -- Check_Symmetry -- -------------------- procedure Check_Symmetry (T : in out Test_Cases.Test_Case'Class) is pragma Unreferenced(T); use type BToA.Bin; use type BToA.Bin_Array_Index; function Bin_To_String is new BToA.To_String(Codec => Codec_To_String); function String_To_Bin is new BToA.To_Bin(Codec => Codec_To_Bin); Binary_Input : BToA.Bin_Array(0..255); begin for I in Binary_Input'Range loop Binary_Input(I) := BToA.Bin(I - Binary_Input'First); end loop; declare Encoded_Data : constant String := Bin_To_String(Binary_Input); Decoded_Data : constant BToA.Bin_Array := String_To_Bin(Encoded_Data); begin Assert(Decoded_Data'Length = 256, "Encoder / Decoder pair changes the length of the data"); Assert((for all I in Decoded_Data'Range => Decoded_Data(I) = BToA.Bin(I-Decoded_Data'First)), "Encoder / Decoder are not a symmetric pair"); end; end Check_Symmetry; ------------------ -- Check_Length -- ------------------ procedure Check_Length (T : in out Test_Cases.Test_Case'Class) is pragma Unreferenced(T); use type BToA.Bin; use type BToA.Bin_Array_Index; function Bin_To_String is new BToA.To_String(Codec => Codec_To_String); function String_To_Bin is new BToA.To_Bin(Codec => Codec_To_Bin); All_One : constant BToA.Bin_Array(0..31) := (others => BToA.Bin'Last); All_Zero : constant BToA.Bin_Array(0..31) := (others => 0); begin for I in 1..32 loop declare Encoded_One : constant String := Bin_To_String(All_One(0..BToA.Bin_Array_Index(I-1))); Decoded_One : constant BToA.Bin_Array := String_To_Bin(Encoded_One); Encoded_Zero : constant String := Bin_To_String(All_Zero(0..BToA.Bin_Array_Index(I-1))); Decoded_Zero : constant BToA.Bin_Array := String_To_Bin(Encoded_Zero); begin Assert(Decoded_One'Length = I, "Encoder / Decoder pair changes the length " & Integer'Image(I) & " of the data for 'all ones' input"); Assert((for all I in Decoded_One'Range => Decoded_One(I) = BToA.Bin'Last), "Encoder / Decoder are not a symmetric pair for length " & Integer'Image(I) & " for 'all ones' input"); Assert(Decoded_Zero'Length = I, "Encoder / Decoder pair changes the length " & Integer'Image(I) & " of the data for 'all zeros' input"); Assert((for all I in Decoded_Zero'Range => Decoded_Zero(I) = 0), "Encoder / Decoder are not a symmetric pair for length " & Integer'Image(I) & " for 'all zeros' input"); end; end loop; end Check_Length; ---------------------------------- -- Check_Test_Vectors_To_String -- ---------------------------------- procedure Check_Test_Vectors_To_String (T : in out Test_Cases.Test_Case'Class) is pragma Unreferenced (T); function Bin_To_String is new RFC4648.BToA.To_String(Codec => Codec_To_String); begin for T of Test_Vectors loop declare Unencoded : constant String := To_String(T.Unencoded); Encoded : constant String := To_String(T.Encoded); begin Assert( Bin_To_String(STSA(Unencoded)) = Encoded, "BinToAsc encoder not generating correct string output " & "for binary test vectors."); end; end loop; end Check_Test_Vectors_To_String; ------------------------------- -- Check_Test_Vectors_To_Bin -- ------------------------------- procedure Check_Test_Vectors_To_Bin (T : in out Test_Cases.Test_Case'Class) is pragma Unreferenced (T); function String_To_Bin is new RFC4648.BToA.To_Bin(Codec => Codec_To_Bin); begin for T of Test_Vectors loop declare Unencoded : constant String := To_String(T.Unencoded); Encoded : constant String := To_String(T.Encoded); begin Assert( SATS(String_To_Bin(Encoded)) = Unencoded, "BinToAsc decoder not generating correct binary output " & "for string test vectors."); end; end loop; end Check_Test_Vectors_To_Bin; ------------------------------------ -- Check_Test_Vectors_Incremental -- ------------------------------------ procedure Check_Test_Vectors_Incremental_To_String (T : in out Test_Cases.Test_Case'Class) is pragma Unreferenced (T); BinToAsc_Encoder : Codec_To_String; Result_String : String(1..Max_Buffer_Length); Result_String_Length : Integer; begin for T of Test_Vectors loop declare Unencoded : constant String := To_String(T.Unencoded); Encoded : constant String := To_String(T.Encoded); Buffer_String : String(1..Max_Buffer_Length); Buffer_String_Used : Integer; begin BinToAsc_Encoder.Reset; Result_String := (others => 'z'); Result_String_Length := 0; for C of Unencoded loop BinToAsc_Encoder.Process(Input => STSA(C & ""), Output => Buffer_String, Output_Length => Buffer_String_Used); if Buffer_String_Used > 0 then Result_String(Result_String_Length + 1 .. Result_String_Length + Buffer_String_Used) := Buffer_String(1..Buffer_String_Used); Result_String_Length := Result_String_Length + Buffer_String_Used; end if; end loop; BinToAsc_Encoder.Complete(Output => Buffer_String, Output_Length => Buffer_String_Used); if Buffer_String_Used > 0 then Result_String(Result_String_Length + 1 .. Result_String_Length + Buffer_String_Used) := Buffer_String(1..Buffer_String_Used); Result_String_Length := Result_String_Length + Buffer_String_Used; end if; Assert(BinToAsc_Encoder.State = Complete, "BinToAsc encoder not terminating correctly."); Assert(Result_String(1..Result_String_Length) = Encoded, "BinToAsc encoder on: " & Unencoded & " gives wrong result: " & Result_String(1..Result_String_Length) & " instead of: " & Encoded); end; end loop; end Check_Test_Vectors_Incremental_To_String; ------------------------------------------- -- Check_Test_Vectors_Incremental_To_Bin -- ------------------------------------------- procedure Check_Test_Vectors_Incremental_To_Bin (T : in out Test_Cases.Test_Case'Class) is pragma Unreferenced (T); BinToAsc_Decoder : Codec_To_Bin; Result_Bin : Storage_Array(1..Storage_Offset(Max_Buffer_Length)); Result_Bin_Length : Storage_Offset; begin for T of Test_Vectors loop declare Unencoded : constant String := To_String(T.Unencoded); Encoded : constant String := To_String(T.Encoded); Buffer_Bin : Storage_Array(1..Storage_Offset(Max_Buffer_Length)); Buffer_Bin_Used : Storage_Offset; begin BinToAsc_Decoder.Reset; Result_Bin := (others => 0); Result_Bin_Length := 0; for C of Encoded loop BinToAsc_Decoder.Process(Input => C & "", Output => Buffer_Bin, Output_Length => Buffer_Bin_Used); if Buffer_Bin_Used > 0 then Result_Bin(Result_Bin_Length + 1 .. Result_Bin_Length + Buffer_Bin_Used) := Buffer_Bin(1..Buffer_Bin_Used); Result_Bin_Length := Result_Bin_Length + Buffer_Bin_Used; end if; end loop; BinToAsc_Decoder.Complete(Output => Buffer_Bin, Output_Length => Buffer_Bin_Used); Assert (Buffer_Bin_Used = 0, "BinToAsc decoder should not generate output on " & "completion as the binary output can never be padded."); Assert(BinToAsc_Decoder.State = Complete, "BinToAsc decoder not terminating correctly."); Assert(SATS(Result_Bin(1..Result_Bin_Length)) = Unencoded, "BinToAsc decoder on: " & Encoded & " gives wrong result: " & SATS(Result_Bin(1..Result_Bin_Length)) & " instead of: " & Unencoded); end; end loop; end Check_Test_Vectors_Incremental_To_Bin; ------------------------------------------ -- Check_Test_Vectors_By_Char_To_String -- ------------------------------------------ procedure Check_Test_Vectors_By_Char_To_String (T : in out Test_Cases.Test_Case'Class) is pragma Unreferenced (T); BinToAsc_Encoder : Codec_To_String; Result_String : String(1..Max_Buffer_Length); Result_String_Length : Integer; begin for T of Test_Vectors loop declare Unencoded : constant String := To_String(T.Unencoded); Encoded : constant String := To_String(T.Encoded); Buffer_String : String(1..Max_Buffer_Length); Buffer_String_Used : Integer; begin BinToAsc_Encoder.Reset; Result_String := (others => 'z'); Result_String_Length := 0; for C of Unencoded loop BinToAsc_Encoder.Process(Input => Storage_Element'Val(Character'Pos(C)), Output => Buffer_String, Output_Length => Buffer_String_Used); if Buffer_String_Used > 0 then Result_String(Result_String_Length + 1 .. Result_String_Length + Buffer_String_Used) := Buffer_String(1..Buffer_String_Used); Result_String_Length := Result_String_Length + Buffer_String_Used; end if; end loop; BinToAsc_Encoder.Complete(Output => Buffer_String, Output_Length => Buffer_String_Used); if Buffer_String_Used > 0 then Result_String(Result_String_Length + 1 .. Result_String_Length + Buffer_String_Used) := Buffer_String(1..Buffer_String_Used); Result_String_Length := Result_String_Length + Buffer_String_Used; end if; Assert(BinToAsc_Encoder.State = Complete, "BinToAsc encoder not terminating correctly."); Assert(Result_String(1..Result_String_Length) = Encoded, "BinToAsc encoder on: " & Unencoded & " gives wrong result: " & Result_String(1..Result_String_Length) & " instead of: " & Encoded); end; end loop; end Check_Test_Vectors_By_Char_To_String; --------------------------------------- -- Check_Test_Vectors_By_Char_To_Bin -- --------------------------------------- procedure Check_Test_Vectors_By_Char_To_Bin (T : in out Test_Cases.Test_Case'Class) is pragma Unreferenced (T); BinToAsc_Decoder : Codec_To_Bin; Result_Bin : Storage_Array(1..Storage_Offset(Max_Buffer_Length)); Result_Bin_Length : Storage_Offset; begin for T of Test_Vectors loop declare Unencoded : constant String := To_String(T.Unencoded); Encoded : constant String := To_String(T.Encoded); Buffer_Bin : Storage_Array(1..Storage_Offset(Max_Buffer_Length)); Buffer_Bin_Used : Storage_Offset; begin BinToAsc_Decoder.Reset; Result_Bin := (others => 0); Result_Bin_Length := 0; for C of Encoded loop BinToAsc_Decoder.Process(Input => C, Output => Buffer_Bin, Output_Length => Buffer_Bin_Used); if Buffer_Bin_Used > 0 then Result_Bin(Result_Bin_Length + 1 .. Result_Bin_Length + Buffer_Bin_Used) := Buffer_Bin(1..Buffer_Bin_Used); Result_Bin_Length := Result_Bin_Length + Buffer_Bin_Used; end if; end loop; BinToAsc_Decoder.Complete(Output => Buffer_Bin, Output_Length => Buffer_Bin_Used); Assert (Buffer_Bin_Used = 0, "BinToAsc decoder should not generate output on " & "completion as the binary output can never be padded."); Assert(BinToAsc_Decoder.State = Complete, "BinToAsc decoder not terminating correctly."); Assert(SATS(Result_Bin(1..Result_Bin_Length)) = Unencoded, "BinToAsc decoder on: " & Encoded & " gives wrong result: " & SATS(Result_Bin(1..Result_Bin_Length)) & " instead of: " & Unencoded); end; end loop; end Check_Test_Vectors_By_Char_To_Bin; end BinToAsc_Suite.Utils;
sungyeon/drake
Ada
341
ads
pragma License (Unrestricted); -- implementation unit package System.Formatting.Literals.Float is pragma Pure; -- parsing Ada-form literals of real types procedure Get_Literal ( Item : String; Last : out Natural; Result : out Long_Long_Float; Error : out Boolean); end System.Formatting.Literals.Float;
reznikmm/matreshka
Ada
3,709
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.Form_Min_Value_Attributes is pragma Preelaborate; type ODF_Form_Min_Value_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Form_Min_Value_Attribute_Access is access all ODF_Form_Min_Value_Attribute'Class with Storage_Size => 0; end ODF.DOM.Form_Min_Value_Attributes;
reznikmm/matreshka
Ada
24,056
adb
------------------------------------------------------------------------------ -- -- -- 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$ ------------------------------------------------------------------------------ with Ada.Directories; with Ada.Streams.Stream_IO; with League.Stream_Element_Vectors.Internals; with League.Text_Codecs; with Matreshka.Internals.Stream_Element_Vectors; with Matreshka.Internals.Unicode.Characters.Latin; package body Matreshka.Internals.Settings.Ini_Files is use Ada.Streams; use League.Stream_Element_Vectors; use League.Strings; use Matreshka.Internals.Unicode; use Matreshka.Internals.Unicode.Characters.Latin; package Section_Maps is new Ada.Containers.Hashed_Maps (League.Strings.Universal_String, Maps.Map, League.Strings.Hash, League.Strings."=", Maps."="); -- This map is used to group key/value pairs in sections for serialization. Line_Delimiter : constant Stream_Element_Array := (0 => Line_Feed); -- Line_Delimiter : constant Stream_Element_Array -- := (0 => Carriage_Return, 1 => Line_Feed); -- Operating system dependent delimiter of lines in the text file. function To_Locale_String (Item : League.Strings.Universal_String) return String; -- Converts Universal_String to locale 8-bit string to use as file name for -- standard Ada library subprograms. procedure Load (Self : in out Ini_File_Settings'Class); -- Loads data from the file. procedure Parse (Self : in out Ini_File_Settings'Class; Data : League.Stream_Element_Vectors.Stream_Element_Vector); -- Parses data. function Serialize (Self : Ini_File_Settings) return League.Stream_Element_Vectors.Stream_Element_Vector; -- Serializes data. function Decode_Key (Data : Ada.Streams.Stream_Element_Array) return League.Strings.Universal_String; -- Decodes key representation in the file into Universal_String. function Decode_Value (Data : Ada.Streams.Stream_Element_Array) return League.Strings.Universal_String renames Decode_Key; -- Decodes value representation in the file into Universal_String. function Encode_Key (Key : League.Strings.Universal_String) return League.Stream_Element_Vectors.Stream_Element_Vector; -- Encodes key to representation in the file. function Encode_Value (Key : League.Strings.Universal_String) return League.Stream_Element_Vectors.Stream_Element_Vector renames Encode_Key; -- Encodes value to representation in the file. function From_Hex (Image : Ada.Streams.Stream_Element_Array) return Matreshka.Internals.Unicode.Code_Unit_32; -- Constructs Unicode code point from hexadecimal image. Returns -- Code_Unit_32'Last when conversion failed. -------------- -- Contains -- -------------- overriding function Contains (Self : Ini_File_Settings; Key : League.Strings.Universal_String) return Boolean is begin return Self.Values.Contains (Key); end Contains; ------------ -- Create -- ------------ function Create (Manager : not null access Abstract_Manager'Class; File_Name : League.Strings.Universal_String) return not null Settings_Access is begin return Aux : constant not null Settings_Access := new Ini_File_Settings' (Counter => <>, Manager => Manager, File_Name => File_Name, Modified => False, Values => Maps.Empty_Map) do declare Self : Ini_File_Settings'Class renames Ini_File_Settings'Class (Aux.all); begin Self.Load; end; end return; end Create; ---------------- -- Decode_Key -- ---------------- function Decode_Key (Data : Ada.Streams.Stream_Element_Array) return League.Strings.Universal_String is Key : League.Strings.Universal_String; Index : Stream_Element_Offset := Data'First; Code : Code_Unit_32; begin while Index <= Data'Last loop Code := Code_Unit_32'Last; if Data (Index) = Percent_Sign then if Data (Index + 1) = Latin_Capital_Letter_U then -- Unicode long format. if Index + 7 <= Data'Last then Code := From_Hex (Data (Index + 2 .. Index + 7)); end if; Index := Index + 8; elsif Data (Index + 1) = Latin_Small_Letter_U then -- Unicode short format. if Index + 5 <= Data'Last then Code := From_Hex (Data (Index + 2 .. Index + 5)); end if; Index := Index + 6; else -- Two digits format. if Index + 2 <= Data'Last then Code := From_Hex (Data (Index + 1 .. Index + 2)); end if; Index := Index + 3; end if; else Code := Code_Unit_32 (Data (Index)); Index := Index + 1; end if; if Is_Valid (Code) then Key.Append (Wide_Wide_Character'Val (Code)); end if; end loop; return Key; end Decode_Key; ---------------- -- Encode_Key -- ---------------- function Encode_Key (Key : League.Strings.Universal_String) return League.Stream_Element_Vectors.Stream_Element_Vector is Aux : Stream_Element_Vector; Code : Code_Point; To_Hex : constant array (Code_Unit_32 range 0 .. 15) of Stream_Element := (Digit_Zero, Digit_One, Digit_Two, Digit_Three, Digit_Four, Digit_Five, Digit_Six, Digit_Seven, Digit_Eight, Digit_Nine, Latin_Capital_Letter_A, Latin_Capital_Letter_B, Latin_Capital_Letter_C, Latin_Capital_Letter_D, Latin_Capital_Letter_E, Latin_Capital_Letter_F); begin for J in 1 .. Key.Length loop Code := Wide_Wide_Character'Pos (Key.Element (J).To_Wide_Wide_Character); if Code in Space .. Tilde then Aux.Append (Stream_Element (Code)); elsif Code <= 16#FF# then -- Two digits format. Aux.Append (Percent_Sign); Aux.Append (To_Hex ((Code / 16) mod 16)); Aux.Append (To_Hex (Code mod 16)); elsif Code <= 16#FFFF# then -- Short Unicode form. Aux.Append (Percent_Sign); Aux.Append (Latin_Small_Letter_U); Aux.Append (To_Hex ((Code / 4096) mod 16)); Aux.Append (To_Hex ((Code / 256) mod 16)); Aux.Append (To_Hex ((Code / 16) mod 16)); Aux.Append (To_Hex (Code mod 16)); else -- Long Unicode form. Aux.Append (Percent_Sign); Aux.Append (Latin_Capital_Letter_U); Aux.Append (To_Hex ((Code / 1048576) mod 16)); Aux.Append (To_Hex ((Code / 65536) mod 16)); Aux.Append (To_Hex ((Code / 4096) mod 16)); Aux.Append (To_Hex ((Code / 256) mod 16)); Aux.Append (To_Hex ((Code / 16) mod 16)); Aux.Append (To_Hex (Code mod 16)); end if; end loop; return Aux; end Encode_Key; -------------- -- Finalize -- -------------- overriding procedure Finalize (Self : not null access Ini_File_Settings) is begin Self.Sync; end Finalize; -------------- -- From_Hex -- -------------- function From_Hex (Image : Ada.Streams.Stream_Element_Array) return Matreshka.Internals.Unicode.Code_Unit_32 is Code : Code_Unit_32 := 0; Index : Stream_Element_Offset := Image'First; begin while Index <= Image'Last loop Code := Code * 16; if Image (Index) in Digit_Zero .. Digit_Nine then Code := Code + Code_Unit_32 (Image (Index)) - Digit_Zero; elsif Image (Index) in Latin_Capital_Letter_A .. Latin_Capital_Letter_F then Code := Code + Code_Unit_32 (Image (Index)) - Latin_Capital_Letter_A + 10; elsif Image (Index) in Latin_Small_Letter_A .. Latin_Small_Letter_F then Code := Code + Code_Unit_32 (Image (Index)) - Latin_Small_Letter_A + 10; else return Code_Unit_32'Last; end if; if Code not in Code_Point then return Code_Unit_32'Last; end if; Index := Index + 1; end loop; return Code; end From_Hex; ---------- -- Load -- ---------- procedure Load (Self : in out Ini_File_Settings'Class) is use Ada.Streams.Stream_IO; File : File_Type; Buffer : Stream_Element_Array (1 .. 1024); Data : Stream_Element_Vector; Last : Stream_Element_Offset; begin if Ada.Directories.Exists (To_Locale_String (Self.File_Name)) then -- Load content of the file. Open (File, In_File, To_Locale_String (Self.File_Name)); loop Read (File, Buffer, Last); exit when Last < Buffer'First; Data.Append (Buffer (Buffer'First .. Last)); end loop; Close (File); -- Parse. Self.Parse (Data); end if; end Load; ---------- -- Name -- ---------- overriding function Name (Self : not null access Ini_File_Settings) return League.Strings.Universal_String is begin return Self.File_Name; end Name; ----------- -- Parse -- ----------- procedure Parse (Self : in out Ini_File_Settings'Class; Data : League.Stream_Element_Vectors.Stream_Element_Vector) is use Matreshka.Internals.Stream_Element_Vectors; procedure Parse_Line; -- Determine boundary of the next line. Buffer : constant Shared_Stream_Element_Vector_Access := League.Stream_Element_Vectors.Internals.Internal (Data); Line_First : Stream_Element_Offset; Line_Last : Stream_Element_Offset; Equal_Index : Stream_Element_Offset; Key_Last : Stream_Element_Offset; Value_First : Stream_Element_Offset; Current_Section : Universal_String; Key : Universal_String; ---------------- -- Parse_Line -- ---------------- procedure Parse_Line is begin Line_First := Line_Last + 1; -- Skip leading whitespaces. while Line_First < Buffer.Length loop exit when Buffer.Value (Line_First) /= Space and Buffer.Value (Line_First) /= Character_Tabulation and Buffer.Value (Line_First) /= Carriage_Return and Buffer.Value (Line_First) /= Line_Feed; Line_First := Line_First + 1; end loop; Line_Last := Line_First; Equal_Index := Line_First - 1; -- Scan line. while Line_Last < Buffer.Length loop -- Exit when end of line is reached. exit when Buffer.Value (Line_Last) = Carriage_Return or Buffer.Value (Line_Last) = Line_Feed; -- Save position of first occurrence of equal sign. if Buffer.Value (Line_Last) = Equals_Sign and Equal_Index < Line_First then Equal_Index := Line_Last; end if; Line_Last := Line_Last + 1; end loop; Line_Last := Line_Last - 1; -- Remove trailing whitespaces. loop exit when Buffer.Value (Line_Last) /= Character_Tabulation and Buffer.Value (Line_Last) /= Space; Line_Last := Line_Last - 1; end loop; -- Determine key and value boundary. if Equal_Index >= Line_First then Key_Last := Equal_Index - 1; while Key_Last >= Line_First loop exit when Buffer.Value (Key_Last) /= Character_Tabulation and Buffer.Value (Key_Last) /= Space; Key_Last := Key_Last - 1; end loop; Value_First := Equal_Index + 1; while Value_First <= Line_Last loop exit when Buffer.Value (Value_First) /= Character_Tabulation and Buffer.Value (Value_First) /= Space; Value_First := Value_First + 1; end loop; end if; end Parse_Line; begin Line_Last := -1; loop Parse_Line; exit when Line_Last < Line_First; if Buffer.Value (Line_First) = Semicolon then -- This is a comment line. null; elsif Buffer.Value (Line_First) = Left_Square_Bracket then -- Section. Line_First := Line_First + 1; if Buffer.Value (Line_Last) = Right_Square_Bracket then Key_Last := Line_Last - 1; else Key_Last := Line_Last; end if; -- Strip leading whitespaces. while Line_First <= Key_Last loop exit when Buffer.Value (Line_First) /= Character_Tabulation and Buffer.Value (Line_First) /= Space; Line_First := Line_First + 1; end loop; -- Strip trailing whitespaces. while Key_Last >= Line_First loop exit when Buffer.Value (Key_Last) /= Character_Tabulation and Buffer.Value (Key_Last) /= Space; Key_Last := Key_Last - 1; end loop; Current_Section := Decode_Key (Buffer.Value (Line_First .. Key_Last)); elsif Equal_Index >= Line_First then -- Key/value pair. Key := Current_Section; if not Key.Is_Empty then Key.Append ('/'); end if; Key.Append (Decode_Key (Buffer.Value (Line_First .. Key_Last))); if not Self.Values.Contains (Key) then Self.Values.Insert (Key, To_Stream_Element_Vector (Buffer.Value (Value_First .. Line_Last))); end if; else -- Incorrect line. null; end if; end loop; end Parse; ------------ -- Remove -- ------------ overriding procedure Remove (Self : in out Ini_File_Settings; Key : League.Strings.Universal_String) is begin if Self.Values.Contains (Key) then Self.Values.Delete (Key); Self.Modified := True; end if; end Remove; --------------- -- Serialize -- --------------- function Serialize (Self : Ini_File_Settings) return League.Stream_Element_Vectors.Stream_Element_Vector is procedure Group_Pair (Position : Maps.Cursor); -- Add pair into sections map. procedure Serialize_Section (Position : Section_Maps.Cursor); -- Serialize specified section and its key/value pairs. procedure Serialize_Pair (Position : Maps.Cursor); -- Serialize specified key/value pair. Aux : League.Stream_Element_Vectors.Stream_Element_Vector; Sections : Section_Maps.Map; ---------------- -- Group_Pair -- ---------------- procedure Group_Pair (Position : Maps.Cursor) is procedure Insert_Pair (Section_Key : Universal_String; Section_Values : in out Maps.Map); -- Insert current key/value pair into the specified section. It -- removes first component of key name. Key : constant Universal_String := Maps.Key (Position); Value : constant Stream_Element_Vector := Maps.Element (Position); Index : constant Natural := Key.Index ('/'); Section_Position : Section_Maps.Cursor; ----------------- -- Insert_Pair -- ----------------- procedure Insert_Pair (Section_Key : Universal_String; Section_Values : in out Maps.Map) is begin if Index = 0 then Section_Values.Insert (Key, Value); else Section_Values.Insert (Key.Slice (Index + 1, Key.Length), Value); end if; end Insert_Pair; begin if Index = 0 then Section_Position := Sections.Find (Empty_Universal_String); if not Section_Maps.Has_Element (Section_Position) then Sections.Insert (Empty_Universal_String, Maps.Empty_Map); Section_Position := Sections.Find (Empty_Universal_String); end if; else Section_Position := Sections.Find (Key.Slice (1, Index - 1)); if not Section_Maps.Has_Element (Section_Position) then Sections.Insert (Key.Slice (1, Index - 1), Maps.Empty_Map); Section_Position := Sections.Find (Key.Slice (1, Index - 1)); end if; end if; Sections.Update_Element (Section_Position, Insert_Pair'Access); end Group_Pair; -------------------- -- Serialize_Pair -- -------------------- procedure Serialize_Pair (Position : Maps.Cursor) is Key : constant Universal_String := Maps.Key (Position); Value : constant Stream_Element_Vector := Maps.Element (Position); begin Aux.Append (Encode_Key (Key)); Aux.Append (Equals_Sign); Aux.Append (Value); Aux.Append (Line_Delimiter); end Serialize_Pair; ----------------------- -- Serialize_Section -- ----------------------- procedure Serialize_Section (Position : Section_Maps.Cursor) is Section : constant Universal_String := Section_Maps.Key (Position); Values : constant Maps.Map := Section_Maps.Element (Position); begin Aux.Append (Left_Square_Bracket); Aux.Append (Encode_Key (Section)); Aux.Append (Right_Square_Bracket); Aux.Append (Line_Delimiter); Values.Iterate (Serialize_Pair'Access); Aux.Append (Line_Delimiter); end Serialize_Section; begin -- Group key/value pair into sections. Self.Values.Iterate (Group_Pair'Access); -- Serialize sections and their key/value pairs. Sections.Iterate (Serialize_Section'Access); return Aux; end Serialize; --------------- -- Set_Value -- --------------- overriding procedure Set_Value (Self : in out Ini_File_Settings; Key : League.Strings.Universal_String; Value : League.Holders.Holder) is begin Self.Modified := True; Self.Values.Include (Key, Encode_Value (League.Holders.Element (Value))); end Set_Value; ---------- -- Sync -- ---------- overriding procedure Sync (Self : in out Ini_File_Settings) is use Ada.Streams.Stream_IO; use League.Stream_Element_Vectors.Internals; Name : constant String := To_Locale_String (Self.File_Name); File : File_Type; Data : Stream_Element_Vector; begin if Self.Modified then -- Serialize data. Data := Serialize (Self); -- Creates directory when necessary. Ada.Directories.Create_Path (Ada.Directories.Containing_Directory (Name)); -- Writes data into file. Create (File, Out_File, Name); Write (File, Internal (Data).Value (0 .. Internal (Data).Length - 1)); Close (File); Self.Modified := False; end if; end Sync; ---------------------- -- To_Locale_String -- ---------------------- function To_Locale_String (Item : League.Strings.Universal_String) return String is Aux : constant Stream_Element_Array := League.Text_Codecs.Codec_For_Application_Locale.Encode (Item).To_Stream_Element_Array; Str : String (1 .. Aux'Length); for Str'Address use Aux'Address; pragma Import (Ada, Str); begin return Str; end To_Locale_String; ----------- -- Value -- ----------- overriding function Value (Self : Ini_File_Settings; Key : League.Strings.Universal_String) return League.Holders.Holder is begin if Self.Values.Contains (Key) then return League.Holders.To_Holder (Decode_Value (Self.Values.Element (Key).To_Stream_Element_Array)); else return League.Holders.Empty_Holder; end if; end Value; end Matreshka.Internals.Settings.Ini_Files;
Fabien-Chouteau/GESTE
Ada
3,447
ads
pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with System; with SDL_SDL_stdinc_h; package SDL_SDL_mutex_h is SDL_MUTEX_TIMEDOUT : constant := 1; -- ../include/SDL/SDL_mutex.h:44 -- unsupported macro: SDL_MUTEX_MAXWAIT (~(Uint32)0) -- arg-macro: procedure SDL_LockMutex (m) -- SDL_mutexP(m) -- arg-macro: procedure SDL_UnlockMutex (m) -- SDL_mutexV(m) -- skipped empty struct SDL_mutex function SDL_CreateMutex return System.Address; -- ../include/SDL/SDL_mutex.h:59 pragma Import (C, SDL_CreateMutex, "SDL_CreateMutex"); function SDL_mutexP (mutex : System.Address) return int; -- ../include/SDL/SDL_mutex.h:65 pragma Import (C, SDL_mutexP, "SDL_mutexP"); function SDL_mutexV (mutex : System.Address) return int; -- ../include/SDL/SDL_mutex.h:74 pragma Import (C, SDL_mutexV, "SDL_mutexV"); procedure SDL_DestroyMutex (mutex : System.Address); -- ../include/SDL/SDL_mutex.h:77 pragma Import (C, SDL_DestroyMutex, "SDL_DestroyMutex"); -- skipped empty struct SDL_semaphore -- skipped empty struct SDL_sem function SDL_CreateSemaphore (initial_value : SDL_SDL_stdinc_h.Uint32) return System.Address; -- ../include/SDL/SDL_mutex.h:90 pragma Import (C, SDL_CreateSemaphore, "SDL_CreateSemaphore"); procedure SDL_DestroySemaphore (sem : System.Address); -- ../include/SDL/SDL_mutex.h:93 pragma Import (C, SDL_DestroySemaphore, "SDL_DestroySemaphore"); function SDL_SemWait (sem : System.Address) return int; -- ../include/SDL/SDL_mutex.h:100 pragma Import (C, SDL_SemWait, "SDL_SemWait"); function SDL_SemTryWait (sem : System.Address) return int; -- ../include/SDL/SDL_mutex.h:106 pragma Import (C, SDL_SemTryWait, "SDL_SemTryWait"); function SDL_SemWaitTimeout (sem : System.Address; ms : SDL_SDL_stdinc_h.Uint32) return int; -- ../include/SDL/SDL_mutex.h:115 pragma Import (C, SDL_SemWaitTimeout, "SDL_SemWaitTimeout"); function SDL_SemPost (sem : System.Address) return int; -- ../include/SDL/SDL_mutex.h:120 pragma Import (C, SDL_SemPost, "SDL_SemPost"); function SDL_SemValue (sem : System.Address) return SDL_SDL_stdinc_h.Uint32; -- ../include/SDL/SDL_mutex.h:123 pragma Import (C, SDL_SemValue, "SDL_SemValue"); -- skipped empty struct SDL_cond function SDL_CreateCond return System.Address; -- ../include/SDL/SDL_mutex.h:138 pragma Import (C, SDL_CreateCond, "SDL_CreateCond"); procedure SDL_DestroyCond (cond : System.Address); -- ../include/SDL/SDL_mutex.h:141 pragma Import (C, SDL_DestroyCond, "SDL_DestroyCond"); function SDL_CondSignal (cond : System.Address) return int; -- ../include/SDL/SDL_mutex.h:146 pragma Import (C, SDL_CondSignal, "SDL_CondSignal"); function SDL_CondBroadcast (cond : System.Address) return int; -- ../include/SDL/SDL_mutex.h:151 pragma Import (C, SDL_CondBroadcast, "SDL_CondBroadcast"); function SDL_CondWait (cond : System.Address; mut : System.Address) return int; -- ../include/SDL/SDL_mutex.h:158 pragma Import (C, SDL_CondWait, "SDL_CondWait"); function SDL_CondWaitTimeout (cond : System.Address; mutex : System.Address; ms : SDL_SDL_stdinc_h.Uint32) return int; -- ../include/SDL/SDL_mutex.h:166 pragma Import (C, SDL_CondWaitTimeout, "SDL_CondWaitTimeout"); end SDL_SDL_mutex_h;
zhmu/ananas
Ada
428
adb
-- { dg-do run } procedure Array36 is subtype Str is String (1 .. 3); type Rec is record S : Str; end record; type T is record B : Boolean; R : Rec; end record; for T use record B at 0 range 0 .. 0; R at 0 range 1 .. 24; end record; X : T := (B => True, R => (S => "123")); begin X.B := False; if X.R.S /= "123" then raise Program_Error; end if; end;
MinimSecure/unum-sdk
Ada
1,202
adb
-- Copyright 2009-2016 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with Pck; use Pck; procedure Foo is 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;
OneWingedShark/Risi
Ada
891
adb
Package Body Risi_Script.Types.Internals is Default_Hash_Key : Constant String := "0"; ---------------------- -- GENERIC BODIES -- ---------------------- Function To_Array(Value : X) return Risi_Script.Types.Internals.List.Vector is Package List renames Risi_Script.Types.Internals.List; Begin return Result : List.Vector do Internals.List.Append( Container => Result, New_Item => Create(Value) ); end return; End To_Array; Function To_Hash( Value : X ) return Hash_Type is Begin return Result : Hash_Type do Result.Include( Key => Default_Hash_Key, New_Item => Create(Value) ); end return; End To_Hash; End Risi_Script.Types.Internals;
docandrew/troodon
Ada
3,654
ads
pragma Ada_2012; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with Interfaces.C.Strings; limited with bits_types_struct_statx_h; package bits_statx_generic_h is STATX_TYPE : constant := 16#0001#; -- /usr/include/bits/statx-generic.h:29 STATX_MODE : constant := 16#0002#; -- /usr/include/bits/statx-generic.h:30 STATX_NLINK : constant := 16#0004#; -- /usr/include/bits/statx-generic.h:31 STATX_UID : constant := 16#0008#; -- /usr/include/bits/statx-generic.h:32 STATX_GID : constant := 16#0010#; -- /usr/include/bits/statx-generic.h:33 STATX_ATIME : constant := 16#0020#; -- /usr/include/bits/statx-generic.h:34 STATX_MTIME : constant := 16#0040#; -- /usr/include/bits/statx-generic.h:35 STATX_CTIME : constant := 16#0080#; -- /usr/include/bits/statx-generic.h:36 STATX_INO : constant := 16#0100#; -- /usr/include/bits/statx-generic.h:37 STATX_SIZE : constant := 16#0200#; -- /usr/include/bits/statx-generic.h:38 STATX_BLOCKS : constant := 16#0400#; -- /usr/include/bits/statx-generic.h:39 STATX_BASIC_STATS : constant := 16#07ff#; -- /usr/include/bits/statx-generic.h:40 STATX_ALL : constant := 16#0fff#; -- /usr/include/bits/statx-generic.h:41 STATX_BTIME : constant := 16#0800#; -- /usr/include/bits/statx-generic.h:42 STATX_MNT_ID : constant := 16#1000#; -- /usr/include/bits/statx-generic.h:43 STATX_u_RESERVED : constant := 16#80000000#; -- /usr/include/bits/statx-generic.h:44 STATX_ATTR_COMPRESSED : constant := 16#0004#; -- /usr/include/bits/statx-generic.h:46 STATX_ATTR_IMMUTABLE : constant := 16#0010#; -- /usr/include/bits/statx-generic.h:47 STATX_ATTR_APPEND : constant := 16#0020#; -- /usr/include/bits/statx-generic.h:48 STATX_ATTR_NODUMP : constant := 16#0040#; -- /usr/include/bits/statx-generic.h:49 STATX_ATTR_ENCRYPTED : constant := 16#0800#; -- /usr/include/bits/statx-generic.h:50 STATX_ATTR_AUTOMOUNT : constant := 16#1000#; -- /usr/include/bits/statx-generic.h:51 STATX_ATTR_MOUNT_ROOT : constant := 16#2000#; -- /usr/include/bits/statx-generic.h:52 STATX_ATTR_VERITY : constant := 16#100000#; -- /usr/include/bits/statx-generic.h:53 STATX_ATTR_DAX : constant := 16#200000#; -- /usr/include/bits/statx-generic.h:54 -- Generic statx-related definitions and declarations. -- Copyright (C) 2018-2021 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- The GNU C 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 -- Lesser General Public License for more details. -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, see -- <https://www.gnu.org/licenses/>. -- This interface is based on <linux/stat.h> in Linux. -- Fill *BUF with information about PATH in DIRFD. function statx (uu_dirfd : int; uu_path : Interfaces.C.Strings.chars_ptr; uu_flags : int; uu_mask : unsigned; uu_buf : access bits_types_struct_statx_h.statx) return int -- /usr/include/bits/statx-generic.h:60 with Import => True, Convention => C, External_Name => "statx"; end bits_statx_generic_h;
AdaCore/gpr
Ada
35
adb
with Tst; procedure Call is null;
annexi-strayline/AURA
Ada
9,451
adb
------------------------------------------------------------------------------ -- -- -- Ada User Repository Annex (AURA) -- -- Reference Implementation -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2020-2023, 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.Text_IO; with Ada.Directories; with Ada.Characters.Handling; with User_Queries; with Platform_Info; with Registrar.Registration; with Unicode.Case_Folding.Simple; separate (Repositories) package body AURA_Spec_Handling is --------------------- -- Check_AURA_Spec -- --------------------- procedure Check_AURA_Spec (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Correct : out Boolean) is separate; ------------------------ -- Generate_AURA_Spec -- ------------------------ procedure Generate_AURA_Spec (Stream: not null access Ada.Streams.Root_Stream_Type'Class) is use type Ada.Directories.File_Kind; procedure Put (Item: in Repository_Format) with Inline is begin String'Write (Stream, Ada.Characters.Handling.To_Lower (Repository_Format'Image (Item))); end; procedure Put (Item: in String) with Inline is begin String'Write (Stream, Item); end; procedure Put_Line (Item: in String) with Inline is begin String'Write (Stream, Item & New_Line); end; procedure New_Line with Inline is begin Character'Write (Stream, Repositories.New_Line); end; Tab: constant String := (1 .. 4 => ' '); begin Put_Line ("-- This specification was automatically generated by the AURA CLI"); Put_Line ("-- DO NOT MODIFY"); New_Line; Put_Line ("package AURA with Pure is"); -- Repository format New_Line; Put (Tab & "type Repository_Format is ("); for Format in Repository_Format loop if Format /= Repository_Format'First then Put (", "); end if; Put (Format); end loop; Put_Line (");"); New_Line; -- Platform info declare package PI renames Platform_Info; procedure CS (Name, Value: in String) with Inline is begin Put_Line (Tab & Name & ": constant String := """ & Value & """;"); end CS; begin CS (Name => "Platform_Family", Value => PI.Platform_Family); CS (Name => "Platform_Flavor", Value => PI.Platform_Flavor); CS (Name => "Platform_Version", Value => PI.Platform_Version); CS (Name => "Platform_Architecture", Value => PI.Platform_Architecture); end; New_Line; Put_Line ("end AURA;"); end Generate_AURA_Spec; ----------------------------------- -- Check_Or_Regenerate_AURA_Spec -- ----------------------------------- procedure Check_Or_Regenerate_AURA_Spec (AURA_Spec_Unit: in Registrar.Library_Units.Library_Unit) is use Registrar.Source_Files; AURA_Spec_Correct: Boolean := False; Go_For_Regen : Boolean := False; begin declare AURA_Spec_Stream: aliased Source_Stream := Checkout_Read_Stream (AURA_Spec_Unit.Spec_File); begin Check_AURA_Spec (Stream => AURA_Spec_Stream'Access, Correct => AURA_Spec_Correct); end; if not AURA_Spec_Correct then declare use User_Queries; Query_Response: String (1 .. 1); Last: Natural; begin loop Query_Manager.Start_Query; -- Note that validation info messages should be output -- before this query, so the user will have some context Query_Manager.Post_Query (Prompt => " AURA root specification is not currently valid, " & "regenerate? (y/n)", Default => "y", Response_Size => 1); Query_Manager.Wait_Response (Response => Query_Response, Last => Last); Query_Manager.End_Query; if Last = 1 then if Query_Response in "Y" | "y" then Go_For_Regen := True; exit; elsif Query_Response in "N" | "n" then Assert (False, "AURA root specification is not valid. " & "Delete and re-run to auto-generate. " & "or answer 'y' to the query. Aborting."); end if; end if; end loop; exception when others => if Query_Manager.Query_Active then Query_Manager.End_Query; end if; raise; end; end if; if Go_For_Regen then declare AURA_Rewrite: aliased Source_Stream := Checkout_Write_Stream (Source => AURA_Spec_Unit.Spec_File, Rewrite => True); begin Generate_AURA_Spec (AURA_Rewrite'Access); end; end if; end Check_Or_Regenerate_AURA_Spec; ------------------------ -- Register_AURA_Spec -- ------------------------ procedure Register_AURA_Spec is use Ada.Directories; Spec_Directory: constant String := Compose (Containing_Directory => Current_Directory, Name => "aura"); Search: Search_Type; Spec : Directory_Entry_Type; begin Start_Search (Search => Search, Directory => Spec_Directory, Pattern => "aura.ads"); Assert (Check => More_Entries (Search), Message => "Error generating AURA spec - cannot find " & "generated file!"); Get_Next_Entry (Search => Search, Directory_Entry => Spec); Registrar.Registration.Enter_Unit (Spec); End_Search (Search); end Register_AURA_Spec; end AURA_Spec_Handling;
reznikmm/matreshka
Ada
4,767
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Generic_Collections; package AMF.DG.Images.Collections is pragma Preelaborate; package DG_Image_Collections is new AMF.Generic_Collections (DG_Image, DG_Image_Access); type Set_Of_DG_Image is new DG_Image_Collections.Set with null record; Empty_Set_Of_DG_Image : constant Set_Of_DG_Image; type Ordered_Set_Of_DG_Image is new DG_Image_Collections.Ordered_Set with null record; Empty_Ordered_Set_Of_DG_Image : constant Ordered_Set_Of_DG_Image; type Bag_Of_DG_Image is new DG_Image_Collections.Bag with null record; Empty_Bag_Of_DG_Image : constant Bag_Of_DG_Image; type Sequence_Of_DG_Image is new DG_Image_Collections.Sequence with null record; Empty_Sequence_Of_DG_Image : constant Sequence_Of_DG_Image; private Empty_Set_Of_DG_Image : constant Set_Of_DG_Image := (DG_Image_Collections.Set with null record); Empty_Ordered_Set_Of_DG_Image : constant Ordered_Set_Of_DG_Image := (DG_Image_Collections.Ordered_Set with null record); Empty_Bag_Of_DG_Image : constant Bag_Of_DG_Image := (DG_Image_Collections.Bag with null record); Empty_Sequence_Of_DG_Image : constant Sequence_Of_DG_Image := (DG_Image_Collections.Sequence with null record); end AMF.DG.Images.Collections;
reznikmm/matreshka
Ada
49,925
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_Deployment_Specifications is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant UML_Deployment_Specification_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Enter_Deployment_Specification (AMF.UML.Deployment_Specifications.UML_Deployment_Specification_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant UML_Deployment_Specification_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Leave_Deployment_Specification (AMF.UML.Deployment_Specifications.UML_Deployment_Specification_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant UML_Deployment_Specification_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then AMF.Visitors.UML_Iterators.UML_Iterator'Class (Iterator).Visit_Deployment_Specification (Visitor, AMF.UML.Deployment_Specifications.UML_Deployment_Specification_Access (Self), Control); end if; end Visit_Element; -------------------- -- Get_Deployment -- -------------------- overriding function Get_Deployment (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Deployments.UML_Deployment_Access is begin return AMF.UML.Deployments.UML_Deployment_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Deployment (Self.Element))); end Get_Deployment; -------------------- -- Set_Deployment -- -------------------- overriding procedure Set_Deployment (Self : not null access UML_Deployment_Specification_Proxy; To : AMF.UML.Deployments.UML_Deployment_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Deployment (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Deployment; ----------------------------- -- Get_Deployment_Location -- ----------------------------- overriding function Get_Deployment_Location (Self : not null access constant UML_Deployment_Specification_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_Deployment_Location (Self.Element); begin if Aux = null then return (Is_Empty => True); else return (False, League.Strings.Internals.Create (Aux)); end if; end; end Get_Deployment_Location; ----------------------------- -- Set_Deployment_Location -- ----------------------------- overriding procedure Set_Deployment_Location (Self : not null access UML_Deployment_Specification_Proxy; To : AMF.Optional_String) is begin if To.Is_Empty then AMF.Internals.Tables.UML_Attributes.Internal_Set_Deployment_Location (Self.Element, null); else AMF.Internals.Tables.UML_Attributes.Internal_Set_Deployment_Location (Self.Element, League.Strings.Internals.Internal (To.Value)); end if; end Set_Deployment_Location; ---------------------------- -- Get_Execution_Location -- ---------------------------- overriding function Get_Execution_Location (Self : not null access constant UML_Deployment_Specification_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_Execution_Location (Self.Element); begin if Aux = null then return (Is_Empty => True); else return (False, League.Strings.Internals.Create (Aux)); end if; end; end Get_Execution_Location; ---------------------------- -- Set_Execution_Location -- ---------------------------- overriding procedure Set_Execution_Location (Self : not null access UML_Deployment_Specification_Proxy; To : AMF.Optional_String) is begin if To.Is_Empty then AMF.Internals.Tables.UML_Attributes.Internal_Set_Execution_Location (Self.Element, null); else AMF.Internals.Tables.UML_Attributes.Internal_Set_Execution_Location (Self.Element, League.Strings.Internals.Internal (To.Value)); end if; end Set_Execution_Location; ------------------- -- Get_File_Name -- ------------------- overriding function Get_File_Name (Self : not null access constant UML_Deployment_Specification_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_File_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_File_Name; ------------------- -- Set_File_Name -- ------------------- overriding procedure Set_File_Name (Self : not null access UML_Deployment_Specification_Proxy; To : AMF.Optional_String) is begin if To.Is_Empty then AMF.Internals.Tables.UML_Attributes.Internal_Set_File_Name (Self.Element, null); else AMF.Internals.Tables.UML_Attributes.Internal_Set_File_Name (Self.Element, League.Strings.Internals.Internal (To.Value)); end if; end Set_File_Name; ----------------------- -- Get_Manifestation -- ----------------------- overriding function Get_Manifestation (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Manifestations.Collections.Set_Of_UML_Manifestation is begin return AMF.UML.Manifestations.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Manifestation (Self.Element))); end Get_Manifestation; ------------------------- -- Get_Nested_Artifact -- ------------------------- overriding function Get_Nested_Artifact (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Artifacts.Collections.Set_Of_UML_Artifact is begin return AMF.UML.Artifacts.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Nested_Artifact (Self.Element))); end Get_Nested_Artifact; ------------------------- -- Get_Owned_Attribute -- ------------------------- overriding function Get_Owned_Attribute (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property is begin return AMF.UML.Properties.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Attribute (Self.Element))); end Get_Owned_Attribute; ------------------------- -- Get_Owned_Operation -- ------------------------- overriding function Get_Owned_Operation (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Operations.Collections.Ordered_Set_Of_UML_Operation is begin return AMF.UML.Operations.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Operation (Self.Element))); end Get_Owned_Operation; ------------------- -- Get_Attribute -- ------------------- overriding function Get_Attribute (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Properties.Collections.Set_Of_UML_Property is begin return AMF.UML.Properties.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Attribute (Self.Element))); end Get_Attribute; --------------------------- -- Get_Collaboration_Use -- --------------------------- overriding function Get_Collaboration_Use (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Collaboration_Uses.Collections.Set_Of_UML_Collaboration_Use is begin return AMF.UML.Collaboration_Uses.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Collaboration_Use (Self.Element))); end Get_Collaboration_Use; ----------------- -- Get_Feature -- ----------------- overriding function Get_Feature (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Features.Collections.Set_Of_UML_Feature is begin return AMF.UML.Features.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Feature (Self.Element))); end Get_Feature; ----------------- -- Get_General -- ----------------- overriding function Get_General (Self : not null access constant UML_Deployment_Specification_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_General (Self.Element))); end Get_General; ------------------------ -- Get_Generalization -- ------------------------ overriding function Get_Generalization (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Generalizations.Collections.Set_Of_UML_Generalization is begin return AMF.UML.Generalizations.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Generalization (Self.Element))); end Get_Generalization; -------------------------- -- Get_Inherited_Member -- -------------------------- overriding function Get_Inherited_Member (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin return AMF.UML.Named_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Inherited_Member (Self.Element))); end Get_Inherited_Member; --------------------- -- Get_Is_Abstract -- --------------------- overriding function Get_Is_Abstract (Self : not null access constant UML_Deployment_Specification_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Abstract (Self.Element); end Get_Is_Abstract; --------------------------------- -- Get_Is_Final_Specialization -- --------------------------------- overriding function Get_Is_Final_Specialization (Self : not null access constant UML_Deployment_Specification_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Final_Specialization (Self.Element); end Get_Is_Final_Specialization; --------------------------------- -- Set_Is_Final_Specialization -- --------------------------------- overriding procedure Set_Is_Final_Specialization (Self : not null access UML_Deployment_Specification_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Final_Specialization (Self.Element, To); end Set_Is_Final_Specialization; ---------------------------------- -- Get_Owned_Template_Signature -- ---------------------------------- overriding function Get_Owned_Template_Signature (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access is begin return AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Template_Signature (Self.Element))); end Get_Owned_Template_Signature; ---------------------------------- -- Set_Owned_Template_Signature -- ---------------------------------- overriding procedure Set_Owned_Template_Signature (Self : not null access UML_Deployment_Specification_Proxy; To : AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Owned_Template_Signature (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Owned_Template_Signature; ------------------------ -- Get_Owned_Use_Case -- ------------------------ overriding function Get_Owned_Use_Case (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case is begin return AMF.UML.Use_Cases.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Use_Case (Self.Element))); end Get_Owned_Use_Case; -------------------------- -- Get_Powertype_Extent -- -------------------------- overriding function Get_Powertype_Extent (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Generalization_Sets.Collections.Set_Of_UML_Generalization_Set is begin return AMF.UML.Generalization_Sets.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Powertype_Extent (Self.Element))); end Get_Powertype_Extent; ------------------------------ -- Get_Redefined_Classifier -- ------------------------------ overriding function Get_Redefined_Classifier (Self : not null access constant UML_Deployment_Specification_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_Redefined_Classifier (Self.Element))); end Get_Redefined_Classifier; ------------------------ -- Get_Representation -- ------------------------ overriding function Get_Representation (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access is begin return AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Representation (Self.Element))); end Get_Representation; ------------------------ -- Set_Representation -- ------------------------ overriding procedure Set_Representation (Self : not null access UML_Deployment_Specification_Proxy; To : AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Representation (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Representation; ---------------------- -- Get_Substitution -- ---------------------- overriding function Get_Substitution (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Substitutions.Collections.Set_Of_UML_Substitution is begin return AMF.UML.Substitutions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Substitution (Self.Element))); end Get_Substitution; ---------------------------- -- Get_Template_Parameter -- ---------------------------- overriding function Get_Template_Parameter (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access is begin return AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter (Self.Element))); end Get_Template_Parameter; ---------------------------- -- Set_Template_Parameter -- ---------------------------- overriding procedure Set_Template_Parameter (Self : not null access UML_Deployment_Specification_Proxy; To : AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Template_Parameter; ------------------ -- Get_Use_Case -- ------------------ overriding function Get_Use_Case (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case is begin return AMF.UML.Use_Cases.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Use_Case (Self.Element))); end Get_Use_Case; ------------------------ -- Get_Element_Import -- ------------------------ overriding function Get_Element_Import (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import 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_Deployment_Specification_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_Deployment_Specification_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_Deployment_Specification_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_Deployment_Specification_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_Deployment_Specification_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_Deployment_Specification_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_Deployment_Specification_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_Deployment_Specification_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_Deployment_Specification_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_Deployment_Specification_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_Package -- ----------------- overriding function Get_Package (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Packages.UML_Package_Access is begin return AMF.UML.Packages.UML_Package_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Package (Self.Element))); end Get_Package; ----------------- -- Set_Package -- ----------------- overriding procedure Set_Package (Self : not null access UML_Deployment_Specification_Proxy; To : AMF.UML.Packages.UML_Package_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Package (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Package; ----------------------------------- -- Get_Owning_Template_Parameter -- ----------------------------------- overriding function Get_Owning_Template_Parameter (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is begin return AMF.UML.Template_Parameters.UML_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Template_Parameter (Self.Element))); end Get_Owning_Template_Parameter; ----------------------------------- -- Set_Owning_Template_Parameter -- ----------------------------------- overriding procedure Set_Owning_Template_Parameter (Self : not null access UML_Deployment_Specification_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Owning_Template_Parameter; ---------------------------- -- Get_Template_Parameter -- ---------------------------- overriding function Get_Template_Parameter (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is begin return AMF.UML.Template_Parameters.UML_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter (Self.Element))); end Get_Template_Parameter; ---------------------------- -- Set_Template_Parameter -- ---------------------------- overriding procedure Set_Template_Parameter (Self : not null access UML_Deployment_Specification_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Template_Parameter; ---------------------------------- -- Get_Owned_Template_Signature -- ---------------------------------- overriding function Get_Owned_Template_Signature (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Template_Signatures.UML_Template_Signature_Access is begin return AMF.UML.Template_Signatures.UML_Template_Signature_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Template_Signature (Self.Element))); end Get_Owned_Template_Signature; ---------------------------------- -- Set_Owned_Template_Signature -- ---------------------------------- overriding procedure Set_Owned_Template_Signature (Self : not null access UML_Deployment_Specification_Proxy; To : AMF.UML.Template_Signatures.UML_Template_Signature_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Owned_Template_Signature (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Owned_Template_Signature; -------------------------- -- Get_Template_Binding -- -------------------------- overriding function Get_Template_Binding (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Template_Bindings.Collections.Set_Of_UML_Template_Binding is begin return AMF.UML.Template_Bindings.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Binding (Self.Element))); end Get_Template_Binding; ----------------- -- Get_Is_Leaf -- ----------------- overriding function Get_Is_Leaf (Self : not null access constant UML_Deployment_Specification_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_Deployment_Specification_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_Deployment_Specification_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_Deployment_Specification_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; ------------------ -- All_Features -- ------------------ overriding function All_Features (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Features.Collections.Set_Of_UML_Feature is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Features unimplemented"); raise Program_Error with "Unimplemented procedure UML_Deployment_Specification_Proxy.All_Features"; return All_Features (Self); end All_Features; ----------------- -- Conforms_To -- ----------------- overriding function Conforms_To (Self : not null access constant UML_Deployment_Specification_Proxy; Other : AMF.UML.Classifiers.UML_Classifier_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Conforms_To unimplemented"); raise Program_Error with "Unimplemented procedure UML_Deployment_Specification_Proxy.Conforms_To"; return Conforms_To (Self, Other); end Conforms_To; ------------- -- General -- ------------- overriding function General (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "General unimplemented"); raise Program_Error with "Unimplemented procedure UML_Deployment_Specification_Proxy.General"; return General (Self); end General; ----------------------- -- Has_Visibility_Of -- ----------------------- overriding function Has_Visibility_Of (Self : not null access constant UML_Deployment_Specification_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Has_Visibility_Of unimplemented"); raise Program_Error with "Unimplemented procedure UML_Deployment_Specification_Proxy.Has_Visibility_Of"; return Has_Visibility_Of (Self, N); end Has_Visibility_Of; ------------- -- Inherit -- ------------- overriding function Inherit (Self : not null access constant UML_Deployment_Specification_Proxy; Inhs : AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Inherit unimplemented"); raise Program_Error with "Unimplemented procedure UML_Deployment_Specification_Proxy.Inherit"; return Inherit (Self, Inhs); end Inherit; ------------------------- -- Inheritable_Members -- ------------------------- overriding function Inheritable_Members (Self : not null access constant UML_Deployment_Specification_Proxy; C : AMF.UML.Classifiers.UML_Classifier_Access) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Inheritable_Members unimplemented"); raise Program_Error with "Unimplemented procedure UML_Deployment_Specification_Proxy.Inheritable_Members"; return Inheritable_Members (Self, C); end Inheritable_Members; ---------------------- -- Inherited_Member -- ---------------------- overriding function Inherited_Member (Self : not null access constant UML_Deployment_Specification_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, "Inherited_Member unimplemented"); raise Program_Error with "Unimplemented procedure UML_Deployment_Specification_Proxy.Inherited_Member"; return Inherited_Member (Self); end Inherited_Member; ----------------- -- Is_Template -- ----------------- overriding function Is_Template (Self : not null access constant UML_Deployment_Specification_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Template unimplemented"); raise Program_Error with "Unimplemented procedure UML_Deployment_Specification_Proxy.Is_Template"; return Is_Template (Self); end Is_Template; ------------------------- -- May_Specialize_Type -- ------------------------- overriding function May_Specialize_Type (Self : not null access constant UML_Deployment_Specification_Proxy; C : AMF.UML.Classifiers.UML_Classifier_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "May_Specialize_Type unimplemented"); raise Program_Error with "Unimplemented procedure UML_Deployment_Specification_Proxy.May_Specialize_Type"; return May_Specialize_Type (Self, C); end May_Specialize_Type; ------------------------ -- Exclude_Collisions -- ------------------------ overriding function Exclude_Collisions (Self : not null access constant UML_Deployment_Specification_Proxy; Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Exclude_Collisions unimplemented"); raise Program_Error with "Unimplemented procedure UML_Deployment_Specification_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_Deployment_Specification_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_Deployment_Specification_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_Deployment_Specification_Proxy; Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Import_Members unimplemented"); raise Program_Error with "Unimplemented procedure UML_Deployment_Specification_Proxy.Import_Members"; return Import_Members (Self, Imps); end Import_Members; --------------------- -- Imported_Member -- --------------------- overriding function Imported_Member (Self : not null access constant UML_Deployment_Specification_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_Deployment_Specification_Proxy.Imported_Member"; return Imported_Member (Self); end Imported_Member; --------------------------------- -- Members_Are_Distinguishable -- --------------------------------- overriding function Members_Are_Distinguishable (Self : not null access constant UML_Deployment_Specification_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_Deployment_Specification_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_Deployment_Specification_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_Deployment_Specification_Proxy.Owned_Member"; return Owned_Member (Self); end Owned_Member; ------------------------- -- All_Owning_Packages -- ------------------------- overriding function All_Owning_Packages (Self : not null access constant UML_Deployment_Specification_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_Deployment_Specification_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_Deployment_Specification_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_Deployment_Specification_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_Deployment_Specification_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_Deployment_Specification_Proxy.Namespace"; return Namespace (Self); end Namespace; ----------------- -- Conforms_To -- ----------------- overriding function Conforms_To (Self : not null access constant UML_Deployment_Specification_Proxy; Other : AMF.UML.Types.UML_Type_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Conforms_To unimplemented"); raise Program_Error with "Unimplemented procedure UML_Deployment_Specification_Proxy.Conforms_To"; return Conforms_To (Self, Other); end Conforms_To; ------------------------ -- Is_Compatible_With -- ------------------------ overriding function Is_Compatible_With (Self : not null access constant UML_Deployment_Specification_Proxy; P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented"); raise Program_Error with "Unimplemented procedure UML_Deployment_Specification_Proxy.Is_Compatible_With"; return Is_Compatible_With (Self, P); end Is_Compatible_With; --------------------------- -- Is_Template_Parameter -- --------------------------- overriding function Is_Template_Parameter (Self : not null access constant UML_Deployment_Specification_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented"); raise Program_Error with "Unimplemented procedure UML_Deployment_Specification_Proxy.Is_Template_Parameter"; return Is_Template_Parameter (Self); end Is_Template_Parameter; ---------------------------- -- Parameterable_Elements -- ---------------------------- overriding function Parameterable_Elements (Self : not null access constant UML_Deployment_Specification_Proxy) return AMF.UML.Parameterable_Elements.Collections.Set_Of_UML_Parameterable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Parameterable_Elements unimplemented"); raise Program_Error with "Unimplemented procedure UML_Deployment_Specification_Proxy.Parameterable_Elements"; return Parameterable_Elements (Self); end Parameterable_Elements; ------------------------ -- Is_Consistent_With -- ------------------------ overriding function Is_Consistent_With (Self : not null access constant UML_Deployment_Specification_Proxy; Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean 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_Deployment_Specification_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_Deployment_Specification_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_Deployment_Specification_Proxy.Is_Redefinition_Context_Valid"; return Is_Redefinition_Context_Valid (Self, Redefined); end Is_Redefinition_Context_Valid; end AMF.Internals.UML_Deployment_Specifications;
persan/AdaYaml
Ada
1,454
ads
-- part of ParserTools, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "copying.txt" with Text.Pool; package Text.Builder is type Reference is new Ada.Finalization.Controlled with private; procedure Init (Object : in out Reference; Pool : Text.Pool.Reference; Initial_Size : Positive := 255); function Create (Pool : Text.Pool.Reference; Initial_Size : Positive := 255) return Reference; function Initialized (Object : Reference) return Boolean; procedure Append (Object : in out Reference; Value : String) with Pre => Object.Initialized; procedure Append (Object : in out Reference; Value : Character) with Pre => Object.Initialized; procedure Append (Object : in out Reference; Value : Text.Reference) with Pre => Object.Initialized; function Lock (Object : in out Reference) return Text.Reference; function Length (Object : Reference) return Natural; private type Reference is new Ada.Finalization.Controlled with record Pool : Text.Pool.Reference; Buffer : UTF_8_String_Access; Next : System.Storage_Elements.Storage_Offset := 1; end record; overriding procedure Adjust (Object : in out Reference); overriding procedure Finalize (Object : in out Reference); procedure Grow (Object : in out Reference; Size : System.Storage_Elements.Storage_Offset); end Text.Builder;
zhmu/ananas
Ada
37,141
adb
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . I N T E R R U P T S -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- This is reasonably generic version of this package, supporting vectored -- hardware interrupts using non-RTOS specific adapter routines which should -- easily implemented on any RTOS capable of supporting GNAT. -- Invariants: -- There is no more than one interrupt per Interrupt_Server_Task and no more -- than one Interrupt_Server_Task per interrupt. If an interrupt handler is -- detached, the corresponding Interrupt_Server_Task is terminated. -- Within this package, the lock L is used to protect the various status -- tables. If there is a Server_Task associated with a signal or interrupt, -- we use the per-task lock of the Server_Task instead so that we protect the -- status between Interrupt_Manager and Server_Task. Protection among service -- requests are ensured via user calls to the Interrupt_Manager entries. with Ada.Unchecked_Conversion; with Ada.Task_Identification; with Interfaces.C; use Interfaces.C; with System.OS_Interface; use System.OS_Interface; with System.Interrupt_Management; with System.Task_Primitives.Operations; with System.Storage_Elements; with System.Tasking.Utilities; with System.Tasking.Rendezvous; pragma Elaborate_All (System.Tasking.Rendezvous); package body System.Interrupts is use Tasking; package POP renames System.Task_Primitives.Operations; function To_Ada is new Ada.Unchecked_Conversion (System.Tasking.Task_Id, Ada.Task_Identification.Task_Id); function To_System is new Ada.Unchecked_Conversion (Ada.Task_Identification.Task_Id, Task_Id); ----------------- -- Local Tasks -- ----------------- -- WARNING: System.Tasking.Stages performs calls to this task with low- -- level constructs. Do not change this spec without synchronizing it. task Interrupt_Manager is entry Detach_Interrupt_Entries (T : Task_Id); entry Attach_Handler (New_Handler : Parameterless_Handler; Interrupt : Interrupt_ID; Static : Boolean; Restoration : Boolean := False); entry Exchange_Handler (Old_Handler : out Parameterless_Handler; New_Handler : Parameterless_Handler; Interrupt : Interrupt_ID; Static : Boolean); entry Detach_Handler (Interrupt : Interrupt_ID; Static : Boolean); entry Bind_Interrupt_To_Entry (T : Task_Id; E : Task_Entry_Index; Interrupt : Interrupt_ID); pragma Interrupt_Priority (System.Interrupt_Priority'First); end Interrupt_Manager; task type Interrupt_Server_Task (Interrupt : Interrupt_ID; Int_Sema : Binary_Semaphore_Id) is -- Server task for vectored hardware interrupt handling pragma Interrupt_Priority (System.Interrupt_Priority'First + 2); end Interrupt_Server_Task; type Interrupt_Task_Access is access Interrupt_Server_Task; ------------------------------- -- Local Types and Variables -- ------------------------------- type Entry_Assoc is record T : Task_Id; E : Task_Entry_Index; end record; type Handler_Assoc is record H : Parameterless_Handler; Static : Boolean; -- Indicates static binding; end record; User_Handler : array (Interrupt_ID) of Handler_Assoc := (others => (null, Static => False)); pragma Volatile_Components (User_Handler); -- Holds the protected procedure handler (if any) and its Static -- information for each interrupt. A handler is static if and only if it -- is specified through the pragma Attach_Handler. User_Entry : array (Interrupt_ID) of Entry_Assoc := (others => (T => Null_Task, E => Null_Task_Entry)); pragma Volatile_Components (User_Entry); -- Holds the task and entry index (if any) for each interrupt -- Type and Head, Tail of the list containing Registered Interrupt -- Handlers. These definitions are used to register the handlers -- specified by the pragma Interrupt_Handler. type Registered_Handler; type R_Link is access all Registered_Handler; type Registered_Handler is record H : System.Address := System.Null_Address; Next : R_Link := null; end record; Registered_Handler_Head : R_Link := null; Registered_Handler_Tail : R_Link := null; Server_ID : array (Interrupt_ID) of System.Tasking.Task_Id := (others => System.Tasking.Null_Task); pragma Atomic_Components (Server_ID); -- Holds the Task_Id of the Server_Task for each interrupt / signal. -- Task_Id is needed to accomplish locking per interrupt base. Also -- is needed to determine whether to create a new Server_Task. Semaphore_ID_Map : array (Interrupt_ID range 0 .. System.OS_Interface.Max_HW_Interrupt) of Binary_Semaphore_Id := (others => 0); -- Array of binary semaphores associated with vectored interrupts. Note -- that the last bound should be Max_HW_Interrupt, but this will raise -- Storage_Error if Num_HW_Interrupts is null so use extra 4 bytes instead. Interrupt_Access_Hold : Interrupt_Task_Access; -- Variable for allocating an Interrupt_Server_Task Handler_Installed : array (HW_Interrupt) of Boolean := (others => False); -- True if Notify_Interrupt was connected to the interrupt. Handlers can -- be connected but disconnection is not possible on VxWorks. Therefore -- we ensure Notify_Installed is connected at most once. ----------------------- -- Local Subprograms -- ----------------------- procedure Check_Reserved_Interrupt (Interrupt : Interrupt_ID); -- Check if Id is a reserved interrupt, and if so raise Program_Error -- with an appropriate message, otherwise return. procedure Finalize_Interrupt_Servers; -- Unbind the handlers for hardware interrupt server tasks at program -- termination. function Is_Registered (Handler : Parameterless_Handler) return Boolean; -- See if Handler has been "pragma"ed using Interrupt_Handler. -- Always consider a null handler as registered. procedure Notify_Interrupt (Param : System.Address); pragma Convention (C, Notify_Interrupt); -- Umbrella handler for vectored interrupts (not signals) procedure Install_Umbrella_Handler (Interrupt : HW_Interrupt; Handler : System.OS_Interface.Interrupt_Handler); -- Install the runtime umbrella handler for a vectored hardware -- interrupt procedure Unimplemented (Feature : String); pragma No_Return (Unimplemented); -- Used to mark a call to an unimplemented function. Raises Program_Error -- with an appropriate message noting that Feature is unimplemented. -------------------- -- Attach_Handler -- -------------------- -- Calling this procedure with New_Handler = null and Static = True -- means we want to detach the current handler regardless of the previous -- handler's binding status (i.e. do not care if it is a dynamic or static -- handler). -- This option is needed so that during the finalization of a PO, we can -- detach handlers attached through pragma Attach_Handler. procedure Attach_Handler (New_Handler : Parameterless_Handler; Interrupt : Interrupt_ID; Static : Boolean := False) is begin Check_Reserved_Interrupt (Interrupt); Interrupt_Manager.Attach_Handler (New_Handler, Interrupt, Static); end Attach_Handler; ----------------------------- -- Bind_Interrupt_To_Entry -- ----------------------------- -- This procedure raises a Program_Error if it tries to -- bind an interrupt to which an Entry or a Procedure is -- already bound. procedure Bind_Interrupt_To_Entry (T : Task_Id; E : Task_Entry_Index; Int_Ref : System.Address) is Interrupt : constant Interrupt_ID := Interrupt_ID (Storage_Elements.To_Integer (Int_Ref)); begin Check_Reserved_Interrupt (Interrupt); Interrupt_Manager.Bind_Interrupt_To_Entry (T, E, Interrupt); end Bind_Interrupt_To_Entry; --------------------- -- Block_Interrupt -- --------------------- procedure Block_Interrupt (Interrupt : Interrupt_ID) is begin Unimplemented ("Block_Interrupt"); end Block_Interrupt; ------------------------------ -- Check_Reserved_Interrupt -- ------------------------------ procedure Check_Reserved_Interrupt (Interrupt : Interrupt_ID) is begin if Is_Reserved (Interrupt) then raise Program_Error with "interrupt" & Interrupt_ID'Image (Interrupt) & " is reserved"; else return; end if; end Check_Reserved_Interrupt; --------------------- -- Current_Handler -- --------------------- function Current_Handler (Interrupt : Interrupt_ID) return Parameterless_Handler is begin Check_Reserved_Interrupt (Interrupt); -- ??? Since Parameterless_Handler is not Atomic, the current -- implementation is wrong. We need a new service in Interrupt_Manager -- to ensure atomicity. return User_Handler (Interrupt).H; end Current_Handler; -------------------- -- Detach_Handler -- -------------------- -- Calling this procedure with Static = True means we want to Detach the -- current handler regardless of the previous handler's binding status -- (i.e. do not care if it is a dynamic or static handler). -- This option is needed so that during the finalization of a PO, we can -- detach handlers attached through pragma Attach_Handler. procedure Detach_Handler (Interrupt : Interrupt_ID; Static : Boolean := False) is begin Check_Reserved_Interrupt (Interrupt); Interrupt_Manager.Detach_Handler (Interrupt, Static); end Detach_Handler; ------------------------------ -- Detach_Interrupt_Entries -- ------------------------------ procedure Detach_Interrupt_Entries (T : Task_Id) is begin Interrupt_Manager.Detach_Interrupt_Entries (T); end Detach_Interrupt_Entries; ---------------------- -- Exchange_Handler -- ---------------------- -- Calling this procedure with New_Handler = null and Static = True -- means we want to detach the current handler regardless of the previous -- handler's binding status (i.e. we do not care if it is a dynamic or -- static handler). -- This option is needed so that during the finalization of a PO, we can -- detach handlers attached through pragma Attach_Handler. procedure Exchange_Handler (Old_Handler : out Parameterless_Handler; New_Handler : Parameterless_Handler; Interrupt : Interrupt_ID; Static : Boolean := False) is begin Check_Reserved_Interrupt (Interrupt); Interrupt_Manager.Exchange_Handler (Old_Handler, New_Handler, Interrupt, Static); end Exchange_Handler; -------------- -- Finalize -- -------------- procedure Finalize (Object : in out Static_Interrupt_Protection) is begin -- ??? loop to be executed only when we're not doing library level -- finalization, since in this case all interrupt / signal tasks are -- gone. if not Interrupt_Manager'Terminated then for N in reverse Object.Previous_Handlers'Range loop Interrupt_Manager.Attach_Handler (New_Handler => Object.Previous_Handlers (N).Handler, Interrupt => Object.Previous_Handlers (N).Interrupt, Static => Object.Previous_Handlers (N).Static, Restoration => True); end loop; end if; Tasking.Protected_Objects.Entries.Finalize (Tasking.Protected_Objects.Entries.Protection_Entries (Object)); end Finalize; -------------------------------- -- Finalize_Interrupt_Servers -- -------------------------------- -- Restore default handlers for interrupt servers -- This is called by the Interrupt_Manager task when it receives the abort -- signal during program finalization. procedure Finalize_Interrupt_Servers is HW_Interrupts : constant Boolean := HW_Interrupt'Last >= 0; begin if HW_Interrupts then for Int in HW_Interrupt loop if Server_ID (Interrupt_ID (Int)) /= null and then not Ada.Task_Identification.Is_Terminated (To_Ada (Server_ID (Interrupt_ID (Int)))) then Interrupt_Manager.Attach_Handler (New_Handler => null, Interrupt => Interrupt_ID (Int), Static => True, Restoration => True); end if; end loop; end if; end Finalize_Interrupt_Servers; ------------------------------------- -- Has_Interrupt_Or_Attach_Handler -- ------------------------------------- function Has_Interrupt_Or_Attach_Handler (Object : access Dynamic_Interrupt_Protection) return Boolean is pragma Unreferenced (Object); begin return True; end Has_Interrupt_Or_Attach_Handler; function Has_Interrupt_Or_Attach_Handler (Object : access Static_Interrupt_Protection) return Boolean is pragma Unreferenced (Object); begin return True; end Has_Interrupt_Or_Attach_Handler; ---------------------- -- Ignore_Interrupt -- ---------------------- procedure Ignore_Interrupt (Interrupt : Interrupt_ID) is begin Unimplemented ("Ignore_Interrupt"); end Ignore_Interrupt; ---------------------- -- Install_Handlers -- ---------------------- procedure Install_Handlers (Object : access Static_Interrupt_Protection; New_Handlers : New_Handler_Array) is begin for N in New_Handlers'Range loop -- We need a lock around this ??? Object.Previous_Handlers (N).Interrupt := New_Handlers (N).Interrupt; Object.Previous_Handlers (N).Static := User_Handler (New_Handlers (N).Interrupt).Static; -- We call Exchange_Handler and not directly Interrupt_Manager. -- Exchange_Handler so we get the Is_Reserved check. Exchange_Handler (Old_Handler => Object.Previous_Handlers (N).Handler, New_Handler => New_Handlers (N).Handler, Interrupt => New_Handlers (N).Interrupt, Static => True); end loop; end Install_Handlers; --------------------------------- -- Install_Restricted_Handlers -- --------------------------------- procedure Install_Restricted_Handlers (Prio : Interrupt_Priority; Handlers : New_Handler_Array) is pragma Unreferenced (Prio); begin for N in Handlers'Range loop Attach_Handler (Handlers (N).Handler, Handlers (N).Interrupt, True); end loop; end Install_Restricted_Handlers; ------------------------------ -- Install_Umbrella_Handler -- ------------------------------ procedure Install_Umbrella_Handler (Interrupt : HW_Interrupt; Handler : System.OS_Interface.Interrupt_Handler) is Vec : constant Interrupt_Vector := Interrupt_Number_To_Vector (int (Interrupt)); Status : int; begin -- Only install umbrella handler when no Ada handler has already been -- installed. Note that the interrupt number is passed as a parameter -- when an interrupt occurs, so the umbrella handler has a different -- wrapper generated by intConnect for each interrupt number. if not Handler_Installed (Interrupt) then Status := Interrupt_Connect (Vec, Handler, System.Address (Interrupt)); pragma Assert (Status = 0); Handler_Installed (Interrupt) := True; end if; end Install_Umbrella_Handler; ---------------- -- Is_Blocked -- ---------------- function Is_Blocked (Interrupt : Interrupt_ID) return Boolean is begin Unimplemented ("Is_Blocked"); return False; end Is_Blocked; ----------------------- -- Is_Entry_Attached -- ----------------------- function Is_Entry_Attached (Interrupt : Interrupt_ID) return Boolean is begin Check_Reserved_Interrupt (Interrupt); return User_Entry (Interrupt).T /= Null_Task; end Is_Entry_Attached; ------------------------- -- Is_Handler_Attached -- ------------------------- function Is_Handler_Attached (Interrupt : Interrupt_ID) return Boolean is begin Check_Reserved_Interrupt (Interrupt); return User_Handler (Interrupt).H /= null; end Is_Handler_Attached; ---------------- -- Is_Ignored -- ---------------- function Is_Ignored (Interrupt : Interrupt_ID) return Boolean is begin Unimplemented ("Is_Ignored"); return False; end Is_Ignored; ------------------- -- Is_Registered -- ------------------- function Is_Registered (Handler : Parameterless_Handler) return Boolean is type Acc_Proc is access procedure; type Fat_Ptr is record Object_Addr : System.Address; Handler_Addr : Acc_Proc; end record; function To_Fat_Ptr is new Ada.Unchecked_Conversion (Parameterless_Handler, Fat_Ptr); Ptr : R_Link; Fat : Fat_Ptr; begin if Handler = null then return True; end if; Fat := To_Fat_Ptr (Handler); Ptr := Registered_Handler_Head; while Ptr /= null loop if Ptr.H = Fat.Handler_Addr.all'Address then return True; end if; Ptr := Ptr.Next; end loop; return False; end Is_Registered; ----------------- -- Is_Reserved -- ----------------- function Is_Reserved (Interrupt : Interrupt_ID) return Boolean is use System.Interrupt_Management; begin return Reserve (System.Interrupt_Management.Interrupt_ID (Interrupt)); end Is_Reserved; ---------------------- -- Notify_Interrupt -- ---------------------- -- Umbrella handler for vectored hardware interrupts (as opposed to signals -- and exceptions). As opposed to the signal implementation, this handler -- is installed in the vector table when the first Ada handler is attached -- to the interrupt. However because VxWorks don't support disconnecting -- handlers, this subprogram always test whether or not an Ada handler is -- effectively attached. -- Otherwise, the handler that existed prior to program startup is in the -- vector table. This ensures that handlers installed by the BSP are active -- unless explicitly replaced in the program text. -- Each Interrupt_Server_Task has an associated binary semaphore on which -- it pends once it's been started. This routine determines The appropriate -- semaphore and issues a semGive call, waking the server task. When -- a handler is unbound, System.Interrupts.Unbind_Handler issues a -- Binary_Semaphore_Flush, and the server task deletes its semaphore -- and terminates. procedure Notify_Interrupt (Param : System.Address) is Interrupt : constant Interrupt_ID := Interrupt_ID (Param); Id : constant Binary_Semaphore_Id := Semaphore_ID_Map (Interrupt); Status : int; begin if Id /= 0 then Status := Binary_Semaphore_Release (Id); pragma Assert (Status = 0); end if; end Notify_Interrupt; --------------- -- Reference -- --------------- function Reference (Interrupt : Interrupt_ID) return System.Address is begin Check_Reserved_Interrupt (Interrupt); return Storage_Elements.To_Address (Storage_Elements.Integer_Address (Interrupt)); end Reference; -------------------------------- -- Register_Interrupt_Handler -- -------------------------------- procedure Register_Interrupt_Handler (Handler_Addr : System.Address) is New_Node_Ptr : R_Link; begin -- This routine registers a handler as usable for dynamic interrupt -- handler association. Routines attaching and detaching handlers -- dynamically should determine whether the handler is registered. -- Program_Error should be raised if it is not registered. -- Pragma Interrupt_Handler can only appear in a library level PO -- definition and instantiation. Therefore, we do not need to implement -- an unregister operation. Nor do we need to protect the queue -- structure with a lock. pragma Assert (Handler_Addr /= System.Null_Address); New_Node_Ptr := new Registered_Handler; New_Node_Ptr.H := Handler_Addr; if Registered_Handler_Head = null then Registered_Handler_Head := New_Node_Ptr; Registered_Handler_Tail := New_Node_Ptr; else Registered_Handler_Tail.Next := New_Node_Ptr; Registered_Handler_Tail := New_Node_Ptr; end if; end Register_Interrupt_Handler; ----------------------- -- Unblock_Interrupt -- ----------------------- procedure Unblock_Interrupt (Interrupt : Interrupt_ID) is begin Unimplemented ("Unblock_Interrupt"); end Unblock_Interrupt; ------------------ -- Unblocked_By -- ------------------ function Unblocked_By (Interrupt : Interrupt_ID) return System.Tasking.Task_Id is begin Unimplemented ("Unblocked_By"); return Null_Task; end Unblocked_By; ------------------------ -- Unignore_Interrupt -- ------------------------ procedure Unignore_Interrupt (Interrupt : Interrupt_ID) is begin Unimplemented ("Unignore_Interrupt"); end Unignore_Interrupt; ------------------- -- Unimplemented -- ------------------- procedure Unimplemented (Feature : String) is begin raise Program_Error with Feature & " not implemented on VxWorks"; end Unimplemented; ----------------------- -- Interrupt_Manager -- ----------------------- task body Interrupt_Manager is -- By making this task independent of any master, when the process goes -- away, the Interrupt_Manager will terminate gracefully. Ignore : constant Boolean := System.Tasking.Utilities.Make_Independent; pragma Unreferenced (Ignore); -------------------- -- Local Routines -- -------------------- procedure Bind_Handler (Interrupt : Interrupt_ID); -- This procedure does not do anything if a signal is blocked. -- Otherwise, we have to interrupt Server_Task for status change -- through a wakeup signal. procedure Unbind_Handler (Interrupt : Interrupt_ID); -- This procedure does not do anything if a signal is blocked. -- Otherwise, we have to interrupt Server_Task for status change -- through an abort signal. procedure Unprotected_Exchange_Handler (Old_Handler : out Parameterless_Handler; New_Handler : Parameterless_Handler; Interrupt : Interrupt_ID; Static : Boolean; Restoration : Boolean := False); procedure Unprotected_Detach_Handler (Interrupt : Interrupt_ID; Static : Boolean); ------------------ -- Bind_Handler -- ------------------ procedure Bind_Handler (Interrupt : Interrupt_ID) is begin Install_Umbrella_Handler (HW_Interrupt (Interrupt), Notify_Interrupt'Access); end Bind_Handler; -------------------- -- Unbind_Handler -- -------------------- procedure Unbind_Handler (Interrupt : Interrupt_ID) is Status : int; begin -- Flush server task off semaphore, allowing it to terminate Status := Binary_Semaphore_Flush (Semaphore_ID_Map (Interrupt)); pragma Assert (Status = 0); end Unbind_Handler; -------------------------------- -- Unprotected_Detach_Handler -- -------------------------------- procedure Unprotected_Detach_Handler (Interrupt : Interrupt_ID; Static : Boolean) is Old_Handler : Parameterless_Handler; begin if User_Entry (Interrupt).T /= Null_Task then -- If an interrupt entry is installed raise Program_Error -- (propagate it to the caller). raise Program_Error with "an interrupt entry is already installed"; end if; -- Note : Static = True will pass the following check. This is the -- case when we want to detach a handler regardless of the static -- status of the Current_Handler. if not Static and then User_Handler (Interrupt).Static then -- Trying to detach a static Interrupt Handler, raise -- Program_Error. raise Program_Error with "trying to detach a static Interrupt Handler"; end if; Old_Handler := User_Handler (Interrupt).H; -- The new handler User_Handler (Interrupt).H := null; User_Handler (Interrupt).Static := False; if Old_Handler /= null then Unbind_Handler (Interrupt); end if; end Unprotected_Detach_Handler; ---------------------------------- -- Unprotected_Exchange_Handler -- ---------------------------------- procedure Unprotected_Exchange_Handler (Old_Handler : out Parameterless_Handler; New_Handler : Parameterless_Handler; Interrupt : Interrupt_ID; Static : Boolean; Restoration : Boolean := False) is begin if User_Entry (Interrupt).T /= Null_Task then -- If an interrupt entry is already installed, raise -- Program_Error (propagate it to the caller). raise Program_Error with "an interrupt is already installed"; end if; -- Note : A null handler with Static = True will pass the following -- check. This is the case when we want to detach a handler -- regardless of the Static status of Current_Handler. -- We don't check anything if Restoration is True, since we may be -- detaching a static handler to restore a dynamic one. if not Restoration and then not Static and then (User_Handler (Interrupt).Static -- Trying to overwrite a static Interrupt Handler with a dynamic -- Handler -- The new handler is not specified as an Interrupt Handler by a -- pragma. or else not Is_Registered (New_Handler)) then raise Program_Error with "trying to overwrite a static interrupt handler with a " & "dynamic handler"; end if; -- Save the old handler Old_Handler := User_Handler (Interrupt).H; -- The new handler User_Handler (Interrupt).H := New_Handler; if New_Handler = null then -- The null handler means we are detaching the handler User_Handler (Interrupt).Static := False; else User_Handler (Interrupt).Static := Static; end if; -- Invoke a corresponding Server_Task if not yet created. Place -- Task_Id info in Server_ID array. if New_Handler /= null and then (Server_ID (Interrupt) = Null_Task or else Ada.Task_Identification.Is_Terminated (To_Ada (Server_ID (Interrupt)))) then Interrupt_Access_Hold := new Interrupt_Server_Task (Interrupt, Binary_Semaphore_Create); Server_ID (Interrupt) := To_System (Interrupt_Access_Hold.all'Identity); end if; if (New_Handler = null) and then Old_Handler /= null then -- Restore default handler Unbind_Handler (Interrupt); elsif Old_Handler = null then -- Save default handler Bind_Handler (Interrupt); end if; end Unprotected_Exchange_Handler; -- Start of processing for Interrupt_Manager begin loop -- A block is needed to absorb Program_Error exception declare Old_Handler : Parameterless_Handler; begin select accept Attach_Handler (New_Handler : Parameterless_Handler; Interrupt : Interrupt_ID; Static : Boolean; Restoration : Boolean := False) do Unprotected_Exchange_Handler (Old_Handler, New_Handler, Interrupt, Static, Restoration); end Attach_Handler; or accept Exchange_Handler (Old_Handler : out Parameterless_Handler; New_Handler : Parameterless_Handler; Interrupt : Interrupt_ID; Static : Boolean) do Unprotected_Exchange_Handler (Old_Handler, New_Handler, Interrupt, Static); end Exchange_Handler; or accept Detach_Handler (Interrupt : Interrupt_ID; Static : Boolean) do Unprotected_Detach_Handler (Interrupt, Static); end Detach_Handler; or accept Bind_Interrupt_To_Entry (T : Task_Id; E : Task_Entry_Index; Interrupt : Interrupt_ID) do -- If there is a binding already (either a procedure or an -- entry), raise Program_Error (propagate it to the caller). if User_Handler (Interrupt).H /= null or else User_Entry (Interrupt).T /= Null_Task then raise Program_Error with "a binding for this interrupt is already present"; end if; User_Entry (Interrupt) := Entry_Assoc'(T => T, E => E); -- Indicate the attachment of interrupt entry in the ATCB. -- This is needed so when an interrupt entry task terminates -- the binding can be cleaned. The call to unbinding must be -- make by the task before it terminates. T.Interrupt_Entry := True; -- Invoke a corresponding Server_Task if not yet created. -- Place Task_Id info in Server_ID array. if Server_ID (Interrupt) = Null_Task or else Ada.Task_Identification.Is_Terminated (To_Ada (Server_ID (Interrupt))) then Interrupt_Access_Hold := new Interrupt_Server_Task (Interrupt, Binary_Semaphore_Create); Server_ID (Interrupt) := To_System (Interrupt_Access_Hold.all'Identity); end if; Bind_Handler (Interrupt); end Bind_Interrupt_To_Entry; or accept Detach_Interrupt_Entries (T : Task_Id) do for Int in Interrupt_ID'Range loop if not Is_Reserved (Int) then if User_Entry (Int).T = T then User_Entry (Int) := Entry_Assoc' (T => Null_Task, E => Null_Task_Entry); Unbind_Handler (Int); end if; end if; end loop; -- Indicate in ATCB that no interrupt entries are attached T.Interrupt_Entry := False; end Detach_Interrupt_Entries; end select; exception -- If there is a Program_Error we just want to propagate it to -- the caller and do not want to stop this task. when Program_Error => null; when others => pragma Assert (Standard.False); null; end; end loop; exception when Standard'Abort_Signal => -- Flush interrupt server semaphores, so they can terminate Finalize_Interrupt_Servers; raise; end Interrupt_Manager; --------------------------- -- Interrupt_Server_Task -- --------------------------- -- Server task for vectored hardware interrupt handling task body Interrupt_Server_Task is Ignore : constant Boolean := System.Tasking.Utilities.Make_Independent; Self_Id : constant Task_Id := Self; Tmp_Handler : Parameterless_Handler; Tmp_ID : Task_Id; Tmp_Entry_Index : Task_Entry_Index; Status : int; begin Semaphore_ID_Map (Interrupt) := Int_Sema; loop -- Pend on semaphore that will be triggered by the umbrella handler -- when the associated interrupt comes in. Status := Binary_Semaphore_Obtain (Int_Sema); pragma Assert (Status = 0); if User_Handler (Interrupt).H /= null then -- Protected procedure handler Tmp_Handler := User_Handler (Interrupt).H; Tmp_Handler.all; elsif User_Entry (Interrupt).T /= Null_Task then -- Interrupt entry handler Tmp_ID := User_Entry (Interrupt).T; Tmp_Entry_Index := User_Entry (Interrupt).E; System.Tasking.Rendezvous.Call_Simple (Tmp_ID, Tmp_Entry_Index, System.Null_Address); else -- Semaphore has been flushed by an unbind operation in the -- Interrupt_Manager. Terminate the server task. -- Wait for the Interrupt_Manager to complete its work POP.Write_Lock (Self_Id); -- Unassociate the interrupt handler Semaphore_ID_Map (Interrupt) := 0; -- Delete the associated semaphore Status := Binary_Semaphore_Delete (Int_Sema); pragma Assert (Status = 0); -- Set status for the Interrupt_Manager Server_ID (Interrupt) := Null_Task; POP.Unlock (Self_Id); exit; end if; end loop; end Interrupt_Server_Task; begin -- Get Interrupt_Manager's ID so that Abort_Interrupt can be sent Interrupt_Manager_ID := To_System (Interrupt_Manager'Identity); end System.Interrupts;
zhmu/ananas
Ada
6,659
ads
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E X P _ C O D E -- -- -- -- S p e c -- -- -- -- Copyright (C) 1996-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Processing for handling code statements with Types; use Types; with System; use System; package Exp_Code is procedure Expand_Asm_Call (N : Node_Id); -- Expands a call to Asm into an equivalent N_Code_Statement node -- The following routines provide an abstract interface to analyze -- code statements, for use by Gigi processing for code statements. -- Note that the implementations of these routines must not attempt -- to expand tables that are frozen on entry to Gigi. -- WARNING: There is a matching C declaration of these subprograms in fe.h function Is_Asm_Volatile (N : Node_Id) return Boolean; -- Given an N_Code_Statement node N, return True if Volatile=True is -- specified, and False if Volatile=False is specified (or set by default). function Asm_Template (N : Node_Id) return Node_Id; -- Given an N_Code_Statement node N, returns string literal node for -- template in call procedure Clobber_Setup (N : Node_Id); -- Given an N_Code_Statement node N, setup to process the clobber list -- with subsequent calls to Clobber_Get_Next. function Clobber_Get_Next return System.Address; pragma Convention (C, Clobber_Get_Next); -- Can only be called after a previous call to Clobber_Setup. The -- returned value is a pointer to a null terminated (C format) string -- for the next register argument. Null_Address is returned when there -- are no more arguments. procedure Setup_Asm_Inputs (N : Node_Id); -- Given an N_Code_Statement node N, setup to read list of Asm_Input -- arguments. The protocol is to construct a loop as follows: -- -- Setup_Asm_Inputs (N); -- while Present (Asm_Input_Value) -- body -- Next_Asm_Input; -- end loop; -- -- where the loop body calls Asm_Input_Constraint or Asm_Input_Value to -- obtain the constraint string or input value expression from the current -- Asm_Input argument. function Asm_Input_Constraint return Node_Id; -- Called within a loop initialized by Setup_Asm_Inputs and controlled -- by Next_Asm_Input as described above. Returns a string literal node -- for the constraint component of the current Asm_Input_Parameter, or -- Empty if there are no more Asm_Input parameters. function Asm_Input_Value return Node_Id; -- Called within a loop initialized by Setup_Asm_Inputs and controlled -- by Next_Asm_Input as described above. Returns the expression node for -- the value component of the current Asm_Input parameter, or Empty if -- there are no more Asm_Input parameters, or Error if an error was -- previously detected in the input parameters (note that the backend -- need not worry about this case, since it won't be called if there -- were any such serious errors detected). procedure Next_Asm_Input; -- Step to next Asm_Input parameter. It is an error to call this procedure -- if there are no more available parameters (which is impossible if the -- call appears in a loop as in the above example). procedure Setup_Asm_Outputs (N : Node_Id); -- Given an N_Code_Statement node N, setup to read list of Asm_Output -- arguments. The protocol is to construct a loop as follows: -- -- Setup_Asm_Outputs (N); -- while Present (Asm_Output_Variable) -- body -- Next_Asm_Output; -- end loop; -- -- where the loop body calls Asm_Output_Constraint or Asm_Output_Variable -- to obtain the constraint string or output variable name from the current -- Asm_Output argument. function Asm_Output_Constraint return Node_Id; -- Called within a loop initialized by Setup_Asm_Outputs and controlled -- by Next_Asm_Output as described above. Returns a string literal node -- for the constraint component of the current Asm_Output_Parameter, or -- Empty if there are no more Asm_Output parameters. function Asm_Output_Variable return Node_Id; -- Called within a loop initialized by Setup_Asm_Outputs and controlled by -- Next_Asm_Output as described above. Returns the expression node for the -- output variable component of the current Asm_Output parameter, or Empty -- if there are no more Asm_Output parameters, or Error if an error was -- previously detected in the input parameters (note that the backend need -- not worry about this case, since it won't be called if there were any -- such serious errors detected). procedure Next_Asm_Output; -- Step to next Asm_Output parameter. It is an error to call this procedure -- if there are no more available parameters (which is impossible if the -- call appears in a loop as in the above example). end Exp_Code;
reznikmm/matreshka
Ada
3,813
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.Constants; package body Matreshka.ODF_Attributes.Table.Number_Columns_Spanned is -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Table_Number_Columns_Spanned_Node) return League.Strings.Universal_String is begin return ODF.Constants.Number_Columns_Spanned_Name; end Get_Local_Name; end Matreshka.ODF_Attributes.Table.Number_Columns_Spanned;
reznikmm/matreshka
Ada
3,774
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.Form_Control_Implementation_Attributes is pragma Preelaborate; type ODF_Form_Control_Implementation_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Form_Control_Implementation_Attribute_Access is access all ODF_Form_Control_Implementation_Attribute'Class with Storage_Size => 0; end ODF.DOM.Form_Control_Implementation_Attributes;
BrickBot/Bound-T-H8-300
Ada
11,067
ads
-- Calculator.Opt (decl) -- -- Command-line options that control the calculator use -- -- A component of the Bound-T Worst-Case Execution Time Tool. -- ------------------------------------------------------------------------------- -- Copyright (c) 1999 .. 2015 Tidorum Ltd -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- 1. Redistributions of source code must retain the above copyright notice, this -- list of conditions and the following disclaimer. -- 2. Redistributions in binary form must reproduce the above copyright notice, -- this list of conditions and the following disclaimer in the documentation -- and/or other materials provided with the distribution. -- -- This software is provided by the copyright holders and contributors "as is" and -- any express or implied warranties, including, but not limited to, the implied -- warranties of merchantability and fitness for a particular purpose are -- disclaimed. In no event shall the copyright owner or contributors be liable for -- any direct, indirect, incidental, special, exemplary, or consequential damages -- (including, but not limited to, procurement of substitute goods or services; -- loss of use, data, or profits; or business interruption) however caused and -- on any theory of liability, whether in contract, strict liability, or tort -- (including negligence or otherwise) arising in any way out of the use of this -- software, even if advised of the possibility of such damage. -- -- Other modules (files) of this software composition should contain their -- own copyright statements, which may have different copyright and usage -- conditions. The above conditions apply to this file. ------------------------------------------------------------------------------- -- -- $Revision: 1.14 $ -- $Date: 2015/10/24 19:36:47 $ -- -- $Log: calculator-opt.ads,v $ -- Revision 1.14 2015/10/24 19:36:47 niklas -- Moved to free licence. -- -- Revision 1.13 2011-09-08 09:04:40 niklas -- Increased Max_Int_Calc_Opt.Default from 40_000_000 to 5_000_000_000, -- to cover all 32-bit values. -- -- Revision 1.12 2011-08-31 04:23:34 niklas -- BT-CH-0222: Option registry. Option -dump. External help files. -- -- Revision 1.11 2009-11-27 11:28:07 niklas -- BT-CH-0184: Bit-widths, Word_T, failed modular analysis. -- -- Revision 1.10 2008/04/26 19:19:44 niklas -- BT-CH-0124: Joint loop counters and induction variables. -- -- Revision 1.9 2008/04/22 12:43:52 niklas -- Added option Find_Null_Flow. -- -- Revision 1.8 2006/04/10 08:15:09 niklas -- Moved the options for maximum calculator value from -- Arithmetic.Opt to Calculator.Opt. -- -- Revision 1.7 2005/09/12 19:02:58 niklas -- BT-CH-0008. -- -- Revision 1.6 2004/05/01 20:14:00 niklas -- First Tidorum version. -- Added option Keep_Files. -- -- Revision 1.5 2001/09/28 09:15:05 holsti -- Platform-dependent parts moved to Calculator.Platform. -- -- Revision 1.4 2001/01/07 22:00:22 holsti -- Trace_Comments added. -- -- Revision 1.3 2000/08/20 21:00:31 holsti -- Trace_IO added. -- -- Revision 1.2 2000/06/16 09:23:53 saarinen -- Added calculator input and output filenames for debugging -- -- Revision 1.1 2000/05/17 14:32:30 saarinen -- Initial implementation -- with Arithmetic; with Calculator.Platform; with Options; with Options.Bool; with Options.Strings; with Options.Width; package Calculator.Opt is Prog_Calculator : aliased Options.Strings.Option_T := Options.Strings.Set (Calculator.Platform.Program); -- -- The name of (path to) the calculator program. -- It can be an absolute path, or just a name. In the latter -- case, the user's command-lookup path is used to find the -- program. package Numeric is new Options.Integer_Valued (Arithmetic.Value_T); -- -- Options with values of type Arithmetic.Value_T. Max_Int_Calc_Opt : aliased Numeric.Option_T (Default => 5_000_000_000); -- -- The range of literal values that is generated in the arithmetic -- model for resolution by the Calculator. The Calculator has certain -- limits on its internal computations. Since the internal computations -- may transform input literals to larger values, the input bounds may -- have to be smaller than the internal limits, in a way that depends -- on the calculations performed by the subprogram. -- Max_Int_Calc : Arithmetic.Value_T renames Max_Int_Calc_Opt.Value; function Min_Int_Calc return Arithmetic.Value_T; -- -- The lower bound of the calculable value range. -- Currently equals -Max_Int_Calc. Warn_Large_Literal_Opt : aliased Options.Bool.Option_T (Default => False); -- -- Whether to emit a warning when a literal value exceeds the range -- Min_Int_Calc .. Max_Int_Calc and is therefore translated to an -- unknown value for the calculator. -- Warn_Large_Literal : Boolean renames Warn_Large_Literal_Opt.Value; Max_Modular_Width_Opt : aliased Options.Width.Option_T (Default => 0); -- -- The maximum number width (number of bits) for which comparison -- relations (<, <=, =, >=, >) are modelled with modular arithmetic. -- For wider numbers comparisons are modelled with the unbounded -- (un-modular) integer comparisons. -- -- If the value is zero, modular arithmetic is not used at all. -- Max_Modular_Width : Arithmetic.Width_T renames Max_Modular_Width_Opt.Value; Warn_Large_Width_Opt : aliased Options.Bool.Option_T (Default => False); -- -- Whether to emit a warning when a comparison relation is applied -- to operands of width larger than Max_Modular_Width, and is -- therefore modelled as a comparison of unbounded integers rather -- than modular integers bounded by this width. -- Warn_Large_Width : Boolean renames Warn_Large_Width_Opt.Value; Use_Convex_Hull_Opt : aliased Options.Bool.Option_T (Default => False); -- -- Whether to use the (true) ConvexHull function to compute -- the hull of a one-dimensional set (Hull_Bound). -- -- The alternative is to use the rough-but-quick Hull function, -- which may give an over-approximation (a loose hull). -- Use_Convex_Hull : Boolean renames Use_Convex_Hull_Opt.Value; type Limit_Method_T is (Hull, Search); -- -- The available methods for computing the limits of a one-dimensional -- pool of values. -- -- Hull -- Use the Hull_Bound of the pool. -- Search -- Use a binary search and null-set test. -- This is useful if the current Omega Calculator has bugs -- in the Hull function. package Limit_Method_Valued is new Options.Discrete_Valued ( Value_Type => Limit_Method_T, Value_Image => Limit_Method_T'Image); -- -- Options with values of type Limit_Method_T. Limit_Method : aliased Limit_Method_Valued.Option_T (Default => Search); -- -- How to compute the Smallest_Value/Largest_Value of a -- one-dimensional pool. Initial_Limit_Sill_Opt : aliased Numeric.Option_T (Default => 5_000); -- -- The initial value for the upper (lower) bound in the binary search -- for the Smallest (Largest) Value that is a member of a given -- one-dimensional pool. The search starts by a halving/doubling -- phase, to avoid using very large numbers in the calculator when -- not necessary. The specified Min (Max) is added to this Sill -- to give the actual upper (lower) bound. -- Initial_Limit_Sill : Arithmetic.Value_T := Initial_Limit_Sill_Opt.Value; Check_Hull_Limit_Opt : aliased Options.Bool.Option_T (Default => True); -- -- Whether to check that a limit (upper or lower bound) on a set, -- computed using the "hull" or "convex hull" functions, is really -- a member of the set. The check may well fail for "hull", which is -- defined as a possibly over-estimated hull, while the check may -- fail for "convex hull" if the function meets with numerical -- overflow. If the check fails, the true limit is found by the -- binary search method. -- Check_Hull_Limit : Boolean renames Check_Hull_Limit_Opt.Value; Warn_Hull_Loose_Opt : aliased Options.Bool.Option_T (Default => True); -- -- Whether to warn if the hull or convex-hull of a set if found to -- be "loose" in the sense that a limit of the hull is not a member -- of the set. -- Warn_Hull_Loose : Boolean renames Warn_Hull_Loose_Opt.Value; Trace_IO_Opt : aliased Options.Bool.Option_T (Default => False); -- -- Whether to trace input commands to the calculator engine -- and outputs from the engine in real time, interactively. -- The inputs and outputs are always logged (see below), -- but the real-time trace is optional. -- Trace_IO : Boolean renames Trace_IO_Opt.Value; Trace_Comments_Opt : aliased Options.Bool.Option_T (Default => False); -- -- Whether to trace, on standard output, comments supplied to annotate -- the calculation. These comments are always included in the input -- and output, which are always logged (see below), but the real-time -- trace on standard output is optional. -- Trace_Comments : Boolean renames Trace_Comments_Opt.Value; Keep_Files_Opt : aliased Options.Bool.Option_T (Default => False); -- -- Whether the calculator-engine input and output files should -- be kept as permanent disk files at the end of the run. -- Keep_Files : Boolean renames Keep_Files_Opt.Value; Calc_Input_File : aliased Options.Strings.Option_T := Options.Strings.Set ("omega_in"); -- -- The prefix of the name for the file that will be created to -- hold a log of all inputs to the calculator-engine. -- Significant if Keep_Files = True. Calc_Output_File : aliased Options.Strings.Option_T := Options.Strings.Set ("omega_out"); -- -- The prefix of the name for the file that will be created to -- hold a log of all outputs from the calculator-engine. -- Significant if Keep_Files = True. -- The actual log files consist of the above file-name prefixes -- extended with a sequential numbering of the calculator-engine -- instances started during the Bound-T run. Join_Steps_Opt : aliased Options.Bool.Option_T (Default => True); -- -- Whether to join consecutive steps in a node, into a joint -- data-flow-relation (joint arithmetic effect), covering as -- many steps as possible. The aim is to simplify the Omega -- expression of the data-flow by reducing the number of "copy" -- constraints and the number of joined relations. -- Join_Steps : Boolean renames Join_Steps_Opt.Value; Find_Null_Flow_Opt : aliased Options.Bool.Option_T (Default => False); -- -- Whether to inspect each "flow" set, for each flow-graph edge, -- to see if it is the null set, and if so to mark that edge -- as infeasible. -- Find_Null_Flow : Boolean renames Find_Null_Flow_Opt.Value; end Calculator.Opt;
AdaCore/libadalang
Ada
67
adb
separate (Foo) procedure Do_Stuff is begin null; end Do_Stuff;
tum-ei-rcs/StratoX
Ada
2,784
ads
-- Institution: Technische Universitaet Muenchen -- Department: Realtime Computer Systems (RCS) -- Project: StratoX -- XXX! Nothing here is thread-safe! -- -- Authors: Martin Becker ([email protected]) with FAT_Filesystem; with FAT_Filesystem.Directories; use FAT_Filesystem.Directories; -- @summary File handling for FAT FS package FAT_Filesystem.Directories.Files with SPARK_Mode => Off is type File_Handle is private; type File_Mode is (Read_Mode, Write_Mode); subtype File_Data is Media_Reader.Block; function File_Create (Parent : in out Directory_Handle; newname : String; Overwrite : Boolean := False; File : out File_Handle) return Status_Code; -- create a new file in the given directory, and return -- handle for write access function File_Write (File : in out File_Handle; Data : File_Data; Status : out Status_Code) return Integer; -- @return number of bytes written (at most Data'Length), or -1 on error. function File_Flush (File : in out File_Handle) return Status_Code; -- force writing file to disk at this very moment (slow!) function File_Size (File : File_Handle) return Unsigned_32; function File_Open_Readonly (Ent : in out Directory_Entry; File : in out File_Data) return Status_Code with Pre => Is_System_File (Ent); -- open the file given by the directory entry and return -- handle for read access; function File_Read (File : in out File_Handle; Data : out File_Data) return Integer; -- @return number of bytes read (at most Data'Length), or -1 on error. procedure File_Close (File : in out File_Handle); -- invalidates the handle, and ensures that -- everything is flushed to the disk private pragma SPARK_Mode (Off); type File_Handle is record Is_Open : Boolean := False; FS : FAT_Filesystem_Access; Mode : File_Mode := Read_Mode; Start_Cluster : Unsigned_32 := INVALID_CLUSTER; -- first cluster; file begin Current_Cluster : Unsigned_32 := 0; -- where we are currently reading/writing Current_Block : Unsigned_32 := 0; -- same, but block Buffer : File_Data (1 .. 512); -- size of one block in FAT/SD card Buffer_Level : Natural := 0; -- how much data in Buffer is meaningful Bytes_Total : Unsigned_32 := 0; -- how many bytes were read/written D_Entry : Directory_Entry; -- the associated directory entry end record; -- used to access files function Update_Entry (File : in out File_Handle) return Status_Code; -- maintain the directory entry (file size) end FAT_Filesystem.Directories.Files;
zhmu/ananas
Ada
3,227
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . P A C K _ 7 1 -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Handling of packed arrays with Component_Size = 71 package System.Pack_71 is pragma Preelaborate; Bits : constant := 71; type Bits_71 is mod 2 ** Bits; for Bits_71'Size use Bits; -- In all subprograms below, Rev_SSO is set True if the array has the -- non-default scalar storage order. function Get_71 (Arr : System.Address; N : Natural; Rev_SSO : Boolean) return Bits_71 with Inline; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is extracted and returned. procedure Set_71 (Arr : System.Address; N : Natural; E : Bits_71; Rev_SSO : Boolean) with Inline; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is set to the given value. end System.Pack_71;
charlie5/aIDE
Ada
171
ads
with Gtk.Widget; package aIDE.Style is procedure define; procedure apply_CSS (Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class); end aIDE.Style;
adamduracz/polypaver
Ada
5,854
adb
with Ada.Exceptions; with Ada.Wide_Text_IO; use Ada.Wide_Text_IO; with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Command_Line; with Ada.Directories; with Asis; with Asis.Ada_Environments; with Asis.Implementation; with Asis.Exceptions; with Asis.Errors; with Context_Processing; procedure PP_FPops is My_Context : Asis.Context; My_Context_Name : Wide_String := Asis.Ada_Environments.Default_Name; -- The default name in case of the GNAT ASIS implementation is empty. -- In the GNAT ASIS implementation the name of a Context does not have any -- special meaning or semantics associated with particular names. My_Context_Parameters : Wide_String := Asis.Ada_Environments.Default_Parameters; -- The default Context parameters in case of the GNAT ASIS implementation -- are an empty string. This corresponds to the following Context -- definition: "-CA -FT -SA", and has the following meaning: -- -CA - a Context is made up by all the tree files in the tree search -- path; the tree search path is not set, so the default is used, -- and the default is the current directory; -- -FT - only pre-created trees are used, no tree file can be created by -- ASIS; -- -SA - source files for all the Compilation Units belonging to the -- Context (except the predefined Standard package) are considered -- in the consistency check when opening the Context; Initialization_Parameters : Wide_String := ""; Finalization_Parameters : Wide_String := ""; -- If you would like to use some specific initialization or finalization -- parameters, you may set them here as initialization expressions in -- the declarations above. -- Function that processes the mandatory argument and outputs an error message -- if the argument is not there or is not appropriate. function Get_Output_Path return String is package C renames Ada.Command_Line; package D renames Ada.Directories; begin if C.Argument_Count = 1 then declare Argument : String := C.Argument(1); Full_Path : String := D.Full_Name(Argument); begin case D.Kind(Full_Path) is when D.Directory => if Full_Path /= D.Full_Name(D.Current_Directory) then -- success! return Full_Path; else Put("The argument directory must be distinct from the current directory."); New_Line; end if; when others => Put("The argument "); Put(To_Wide_String(Argument)); Put(" is not a directory."); New_Line; end case; exception when D.Name_Error => Put("The argument "); Put(To_Wide_String(Argument)); Put(" is not an existing directory."); New_Line; end; else Put("There has to be exactly one command-line argument: <Output_Directory>"); New_Line; end if; -- if we got here, we failed: return ""; end Get_Output_Path; Output_Path : String := Get_Output_Path; begin -- Check that there is one argument and check it is an existing file path: if Output_Path /= "" then -- Initialise ASIS context: Asis.Implementation.Initialize (Initialization_Parameters); Asis.Ada_Environments.Associate (The_Context => My_Context, Name => My_Context_Name, Parameters => My_Context_Parameters); Asis.Ada_Environments.Open (My_Context); -- Do the translation: Context_Processing.Process_Context (The_Context => My_Context, Trace => True, Output_Path => Output_Path); -- Finalise ASIS context: Asis.Ada_Environments.Close (My_Context); Asis.Ada_Environments.Dissociate (My_Context); Asis.Implementation.Finalize (Finalization_Parameters); end if; exception -- The exception handling in this driver is somewhat redundant and may -- need some reconsidering when using this driver in real ASIS tools when Ex : Asis.Exceptions.ASIS_Inappropriate_Context | Asis.Exceptions.ASIS_Inappropriate_Container | Asis.Exceptions.ASIS_Inappropriate_Compilation_Unit | Asis.Exceptions.ASIS_Inappropriate_Element | Asis.Exceptions.ASIS_Inappropriate_Line | Asis.Exceptions.ASIS_Inappropriate_Line_Number | Asis.Exceptions.ASIS_Failed => Ada.Wide_Text_IO.Put ("ASIS exception ("); Ada.Wide_Text_IO.Put (Ada.Characters.Handling.To_Wide_String ( Ada.Exceptions.Exception_Name (Ex))); Ada.Wide_Text_IO.Put (") is raised"); Ada.Wide_Text_IO.New_Line; Ada.Wide_Text_IO.Put ("ASIS Error Status is "); Ada.Wide_Text_IO.Put (Asis.Errors.Error_Kinds'Wide_Image (Asis.Implementation.Status)); Ada.Wide_Text_IO.New_Line; Ada.Wide_Text_IO.Put ("ASIS Diagnosis is "); Ada.Wide_Text_IO.New_Line; Ada.Wide_Text_IO.Put (Asis.Implementation.Diagnosis); Ada.Wide_Text_IO.New_Line; Asis.Implementation.Set_Status; when Ex : others => Ada.Wide_Text_IO.Put (Ada.Characters.Handling.To_Wide_String ( Ada.Exceptions.Exception_Name (Ex))); Ada.Wide_Text_IO.Put (" is raised ("); Ada.Wide_Text_IO.Put (Ada.Characters.Handling.To_Wide_String ( Ada.Exceptions.Exception_Information (Ex))); Ada.Wide_Text_IO.Put (")"); Ada.Wide_Text_IO.New_Line; end PP_FPops;
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.Elements; package ODF.DOM.Style_Header_Left_Elements is pragma Preelaborate; type ODF_Style_Header_Left is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Style_Header_Left_Access is access all ODF_Style_Header_Left'Class with Storage_Size => 0; end ODF.DOM.Style_Header_Left_Elements;
stcarrez/ada-util
Ada
17,081
adb
-- -- Copyright (c) 2007-2009 Tero Koskinen <[email protected]> -- -- Permission to use, copy, modify, and distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- with Ada.Text_IO; with Ada.Strings; with Ada.Strings.Fixed; with Ada.Strings.Maps; with Ada.IO_Exceptions; with Ahven.Runner; with Ahven_Compat; with Ahven.AStrings; package body Ahven.XML_Runner is use Ada.Text_IO; use Ada.Strings.Fixed; use Ada.Strings.Maps; use Ahven.Results; use Ahven.Framework; use Ahven.AStrings; function Filter_String (Str : String) return String; function Filter_String (Str : String; Map : Character_Mapping) return String; procedure Print_Test_Pass (File : File_Type; Parent_Test : String; Info : Result_Info); procedure Print_Test_Failure (File : File_Type; Parent_Test : String; Info : Result_Info); procedure Print_Test_Error (File : File_Type; Parent_Test : String; Info : Result_Info); procedure Print_Test_Case (Collection : Result_Collection; Dir : String); procedure Print_Log_File (File : File_Type; Filename : String); procedure Print_Attribute (File : File_Type; Attr : String; Value : String); procedure Start_Testcase_Tag (File : File_Type; Parent : String; Name : String; Execution_Time : String); procedure End_Testcase_Tag (File : File_Type); function Create_Name (Dir : String; Name : String) return String; function Filter_String (Str : String) return String is Result : String (Str'First .. Str'First + 6 * Str'Length); Pos : Natural := Str'First; begin for I in Str'Range loop if Str (I) = ''' then Result (Pos .. Pos + 6 - 1) := "&apos;"; Pos := Pos + 6; elsif Str (I) = '<' then Result (Pos .. Pos + 4 - 1) := "&lt;"; Pos := Pos + 4; elsif Str (I) = '>' then Result (Pos .. Pos + 4 - 1) := "&gt;"; Pos := Pos + 4; elsif Str (I) = '&' then Result (Pos .. Pos + 5 - 1) := "&amp;"; Pos := Pos + 5; elsif Str (I) = '"' then Result (Pos) := '''; Pos := Pos + 1; else Result (Pos) := Str (I); Pos := Pos + 1; end if; end loop; return Result (Result'First .. Pos - 1); end Filter_String; function Filter_String (Str : String; Map : Character_Mapping) return String is begin return Translate (Source => Str, Mapping => Map); end Filter_String; procedure Print_Attribute (File : File_Type; Attr : String; Value : String) is begin Put (File, Attr & "=" & '"' & Value & '"'); end Print_Attribute; procedure Start_Testcase_Tag (File : File_Type; Parent : String; Name : String; Execution_Time : String) is begin Put (File, "<testcase "); Print_Attribute (File, "classname", Filter_String (Parent)); Put (File, " "); Print_Attribute (File, "name", Filter_String (Name)); Put (File, " "); Print_Attribute (File, "time", Filter_String (Execution_Time)); Put_Line (File, ">"); end Start_Testcase_Tag; procedure End_Testcase_Tag (File : File_Type) is begin Put_Line (File, "</testcase>"); end End_Testcase_Tag; function Create_Name (Dir : String; Name : String) return String is function Filename (Test : String) return String is Map : Ada.Strings.Maps.Character_Mapping; begin Map := To_Mapping (From => " '/\<>:|?*()" & '"', To => "-___________" & '_'); return "TEST-" & Filter_String (Test, Map) & ".xml"; end Filename; begin if Dir'Length > 0 then return Dir & Ahven_Compat.Directory_Separator & Filename (Name); else return Filename (Name); end if; end Create_Name; procedure Print_Test_Pass (File : File_Type; Parent_Test : String; Info : Result_Info) is Exec_Time : constant String := Trim (Duration'Image (Get_Execution_Time (Info)), Ada.Strings.Both); begin Start_Testcase_Tag (File => File, Parent => Parent_Test, Name => Get_Routine_Name (Info), Execution_Time => Exec_Time); if Length (Get_Output_File (Info)) > 0 then Put (File, "<system-out>"); Print_Log_File (File, To_String (Get_Output_File (Info))); Put_Line (File, "</system-out>"); end if; End_Testcase_Tag (File); end Print_Test_Pass; procedure Print_Test_Skipped (File : File_Type; Parent_Test : String; Info : Result_Info) is Exec_Time : constant String := Trim (Duration'Image (Get_Execution_Time (Info)), Ada.Strings.Both); begin Start_Testcase_Tag (File => File, Parent => Parent_Test, Name => Get_Routine_Name (Info), Execution_Time => Exec_Time); Put (File, "<skipped "); Print_Attribute (File, "message", Filter_String (Trim (Get_Message (Info), Ada.Strings.Both))); Put (File, ">"); Put_Line (File, Filter_String (Get_Message (Info))); Put_Line (File, "</skipped>"); End_Testcase_Tag (File); end Print_Test_Skipped; procedure Print_Test_Failure (File : File_Type; Parent_Test : String; Info : Result_Info) is Exec_Time : constant String := Trim (Duration'Image (Get_Execution_Time (Info)), Ada.Strings.Both); begin Start_Testcase_Tag (File => File, Parent => Parent_Test, Name => Get_Routine_Name (Info), Execution_Time => Exec_Time); Put (File, "<failure "); Print_Attribute (File, "type", Filter_String (Trim (Get_Message (Info), Ada.Strings.Both))); Put (File, ">"); Put_Line (File, Filter_String (Get_Message (Info))); Put_Line (File, "</failure>"); if Length (Get_Output_File (Info)) > 0 then Put (File, "<system-out>"); Print_Log_File (File, To_String (Get_Output_File (Info))); Put_Line (File, "</system-out>"); end if; End_Testcase_Tag (File); end Print_Test_Failure; procedure Print_Test_Error (File : File_Type; Parent_Test : String; Info : Result_Info) is Exec_Time : constant String := Trim (Duration'Image (Get_Execution_Time (Info)), Ada.Strings.Both); begin Start_Testcase_Tag (File => File, Parent => Parent_Test, Name => Get_Routine_Name (Info), Execution_Time => Exec_Time); Put (File, "<error "); Print_Attribute (File, "type", Filter_String (Trim (Get_Message (Info), Ada.Strings.Both))); Put (File, ">"); Put_Line (File, Filter_String (Get_Message (Info))); Put_Line (File, "</error>"); if Length (Get_Output_File (Info)) > 0 then Put (File, "<system-out>"); Print_Log_File (File, To_String (Get_Output_File (Info))); Put_Line (File, "</system-out>"); end if; End_Testcase_Tag (File); end Print_Test_Error; procedure Print_Test_Case (Collection : Result_Collection; Dir : String) is procedure Print (Output : File_Type; Result : Result_Collection); -- Internal procedure to print the testcase into given file. function Img (Value : Natural) return String is begin return Trim (Natural'Image (Value), Ada.Strings.Both); end Img; procedure Print (Output : File_Type; Result : Result_Collection) is Position : Result_Info_Cursor; begin Put_Line (Output, "<?xml version=" & '"' & "1.0" & '"' & " encoding=" & '"' & "iso-8859-1" & '"' & "?>"); Put (Output, "<testsuite "); Print_Attribute (Output, "errors", Img (Error_Count (Result))); Put (Output, " "); Print_Attribute (Output, "failures", Img (Failure_Count (Result))); Put (Output, " "); Print_Attribute (Output, "skips", Img (Skipped_Count (Result))); Put (Output, " "); Print_Attribute (Output, "tests", Img (Test_Count (Result))); Put (Output, " "); Print_Attribute (Output, "time", Trim (Duration'Image (Get_Execution_Time (Result)), Ada.Strings.Both)); Put (Output, " "); Print_Attribute (Output, "name", To_String (Get_Test_Name (Result))); Put_Line (Output, ">"); Position := First_Error (Result); Error_Loop : loop exit Error_Loop when not Is_Valid (Position); Print_Test_Error (Output, To_String (Get_Test_Name (Result)), Data (Position)); Position := Next (Position); end loop Error_Loop; Position := First_Failure (Result); Failure_Loop : loop exit Failure_Loop when not Is_Valid (Position); Print_Test_Failure (Output, To_String (Get_Test_Name (Result)), Data (Position)); Position := Next (Position); end loop Failure_Loop; Position := First_Pass (Result); Pass_Loop : loop exit Pass_Loop when not Is_Valid (Position); Print_Test_Pass (Output, To_String (Get_Test_Name (Result)), Data (Position)); Position := Next (Position); end loop Pass_Loop; Position := First_Skipped (Result); Skip_Loop : loop exit Skip_Loop when not Is_Valid (Position); Print_Test_Skipped (Output, To_String (Get_Test_Name (Result)), Data (Position)); Position := Next (Position); end loop Skip_Loop; Put_Line (Output, "</testsuite>"); end Print; File : File_Type; begin if Dir = "-" then Print (Standard_Output, Collection); else Create (File => File, Mode => Ada.Text_IO.Out_File, Name => Create_Name (Dir, To_String (Get_Test_Name (Collection)))); Print (File, Collection); Ada.Text_IO.Close (File); end if; end Print_Test_Case; procedure Report_Results (Result : Result_Collection; Dir : String) is Position : Result_Collection_Cursor; begin Position := First_Child (Result); loop exit when not Is_Valid (Position); if Child_Depth (Data (Position).all) = 0 then Print_Test_Case (Data (Position).all, Dir); else Report_Results (Data (Position).all, Dir); -- Handle the test cases in this collection if Direct_Test_Count (Result) > 0 then Print_Test_Case (Result, Dir); end if; end if; Position := Next (Position); end loop; end Report_Results; -- Print the log by placing the data inside CDATA block. procedure Print_Log_File (File : File_Type; Filename : String) is type CData_End_State is (NONE, FIRST_BRACKET, SECOND_BRACKET); function State_Change (Old_State : CData_End_State) return CData_End_State; Handle : File_Type; Char : Character := ' '; First : Boolean := True; -- We need to escape ]]>, this variable tracks -- the characters, so we know when to do the escaping. CData_Ending : CData_End_State := NONE; function State_Change (Old_State : CData_End_State) return CData_End_State is New_State : CData_End_State := NONE; -- By default New_State will be NONE, so there is -- no need to set it inside when blocks. begin case Old_State is when NONE => if Char = ']' then New_State := FIRST_BRACKET; end if; when FIRST_BRACKET => if Char = ']' then New_State := SECOND_BRACKET; end if; when SECOND_BRACKET => if Char = '>' then Put (File, " "); end if; end case; return New_State; end State_Change; begin Open (Handle, In_File, Filename); begin loop exit when End_Of_File (Handle); Get (Handle, Char); if First then Put (File, "<![CDATA["); First := False; end if; CData_Ending := State_Change (CData_Ending); case Char is when ASCII.NUL => Put (File, "&#0;"); when ASCII.SOH => Put (File, "&#1;"); when ASCII.STX => Put (File, "&#2;"); when ASCII.ETX => Put (File, "&#3;"); when ASCII.EOT => Put (File, "&#4;"); when ASCII.ENQ => Put (File, "&#5;"); when ASCII.ACK => Put (File, "&#6;"); when ASCII.BEL => Put (File, "&#7;"); when ASCII.BS => Put (File, "&#8;"); when ASCII.VT => Put (File, "&#xB;"); when ASCII.FF => Put (File, "&#xC;"); when ASCII.SO => Put (File, "&#xE;"); when ASCII.SI => Put (File, "&#xF;"); when ASCII.DLE => Put (File, "&#x10;"); when ASCII.DC1 => Put (File, "&#x11;"); when ASCII.DC2 => Put (File, "&#x12;"); when ASCII.DC3 => Put (File, "&#x13;"); when ASCII.DC4 => Put (File, "&#x14;"); when ASCII.NAK => Put (File, "&#x15;"); when ASCII.SYN => Put (File, "&#x16;"); when ASCII.ETB => Put (File, "&#x17;"); when ASCII.CAN => Put (File, "&#x18;"); when ASCII.EM => Put (File, "&#x19;"); when ASCII.SUB => Put (File, "&#x1A;"); when ASCII.ESC => Put (File, "&#x1B;"); when ASCII.FS => Put (File, "&#x1C;"); when ASCII.GS => Put (File, "&#x1D;"); when ASCII.RS => Put (File, "&#x1E;"); when ASCII.US => Put (File, "&#x1F;"); when others => Put (File, Char); end case; if End_Of_Line (Handle) then New_Line (File); end if; end loop; -- The End_Error exception is sometimes raised. exception when Ada.IO_Exceptions.End_Error => null; end; Close (Handle); if not First then Put_Line (File, "]]>"); end if; end Print_Log_File; procedure Do_Report (Test_Results : Results.Result_Collection; Args : Parameters.Parameter_Info) is begin Report_Results (Test_Results, Parameters.Result_Dir (Args)); end Do_Report; procedure Run (Suite : in out Framework.Test_Suite'Class) is begin Runner.Run_Suite (Suite, Do_Report'Access); end Run; procedure Run (Suite : Framework.Test_Suite_Access) is begin Run (Suite.all); end Run; end Ahven.XML_Runner;
jwarwick/aoc_2019_ada
Ada
272
adb
-- with Day.Test; with FMS.Test; package body AOC_Test_Suite is function Suite return Access_Test_Suite is Ret : constant Access_Test_Suite := new Test_Suite; begin Ret.Add_Test (new FMS.Test.Test); return Ret; end Suite; end AOC_Test_Suite;
reznikmm/matreshka
Ada
3,714
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Office_Dde_Item_Attributes is pragma Preelaborate; type ODF_Office_Dde_Item_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Office_Dde_Item_Attribute_Access is access all ODF_Office_Dde_Item_Attribute'Class with Storage_Size => 0; end ODF.DOM.Office_Dde_Item_Attributes;
AdaCore/training_material
Ada
825
adb
with Ada.Text_IO; use Ada.Text_IO; procedure Main is type Name_T is array (1 .. 6) of Character; type Index_T is range 0 .. 1_000; type Queue_T is array (Index_T range 1 .. 1_000) of Name_T; -- type Fifo_Queue_T is ? -- Queue : Fifo_Queue_T; Choice : Integer; begin loop Put ("1 = add to queue | 2 = remove from queue | others => done: "); Choice := Integer'value (Get_Line); if Choice = 1 then Put ("Enter name: "); -- Use Ada.Text_IO.Get_Line to help put a name on the queue elsif Choice = 2 then -- Remove the appropriate item from the queue and print it Put_Line ("TBD"); else exit; end if; New_Line; end loop; Put_Line ("Remaining in line: "); -- Print the remaining items in the queue end Main;
AdaCore/gpr
Ada
78
adb
separate (A) function Foo2 return String is begin return "foo2"; end Foo2;
reznikmm/matreshka
Ada
7,175
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2015, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AWFC.Accounts.Users.Stores; package body AWFC.Accounts.Users is ------------- -- Disable -- ------------- overriding procedure Disable (Self : not null access Anonymous_User_Type) is begin raise Program_Error with "Anonymous user can't be disabled"; end Disable; ------------- -- Disable -- ------------- overriding procedure Disable (Self : not null access Non_Anonymous_User_Type) is begin if Self.Enabled then Self.Enabled := False; Self.Store.Update_Enabled (Self); end if; end Disable; ------------ -- Enable -- ------------ overriding procedure Enable (Self : not null access Anonymous_User_Type) is begin raise Program_Error with "Anonymous user is enabled always"; end Enable; ------------ -- Enable -- ------------ overriding procedure Enable (Self : not null access Non_Anonymous_User_Type) is begin if not Self.Enabled then Self.Enabled := True; Self.Store.Update_Enabled (Self); end if; end Enable; --------------- -- Get_Email -- --------------- overriding function Get_Email (Self : not null access constant Anonymous_User_Type) return League.Strings.Universal_String is begin return League.Strings.Empty_Universal_String; end Get_Email; --------------- -- Get_Email -- --------------- overriding function Get_Email (Self : not null access constant Non_Anonymous_User_Type) return League.Strings.Universal_String is begin return Self.Email; end Get_Email; ------------------------- -- Get_User_Identifier -- ------------------------- overriding function Get_User_Identifier (Self : not null access constant Anonymous_User_Type) return User_Identifier is begin return Anonymous_User_Identifier; end Get_User_Identifier; ------------------------- -- Get_User_Identifier -- ------------------------- overriding function Get_User_Identifier (Self : not null access constant Non_Anonymous_User_Type) return User_Identifier is begin return Self.Identifier; end Get_User_Identifier; ---------- -- Hash -- ---------- function Hash (Item : User_Identifier) return Ada.Containers.Hash_Type is begin return Ada.Containers.Hash_Type (Item mod Ada.Containers.Hash_Type'Modulus); end Hash; ---------------- -- Initialize -- ---------------- not overriding function Initialize (Store : not null access AWFC.Accounts.Users.Stores.User_Store'Class) return Non_Anonymous_User_Type is begin return Non_Anonymous_User_Type' (Store => Store, Identifier => Store.Get_User_Identifier, Email => Store.Get_Email, Enabled => Store.Get_Enabled); end Initialize; ------------------ -- Is_Anonymous -- ------------------ overriding function Is_Anonymous (Self : not null access constant Anonymous_User_Type) return Boolean is begin return True; end Is_Anonymous; ------------------ -- Is_Anonymous -- ------------------ overriding function Is_Anonymous (Self : not null access constant Non_Anonymous_User_Type) return Boolean is begin return False; end Is_Anonymous; ---------------- -- Is_Enabled -- ---------------- overriding function Is_Enabled (Self : not null access constant Anonymous_User_Type) return Boolean is begin return True; end Is_Enabled; ---------------- -- Is_Enabled -- ---------------- overriding function Is_Enabled (Self : not null access constant Non_Anonymous_User_Type) return Boolean is begin return Self.Enabled; end Is_Enabled; end AWFC.Accounts.Users;
reznikmm/matreshka
Ada
5,217
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ -- A create object action is an action that creates an object that conforms -- to a statically specified classifier and puts it on an output pin at -- runtime. ------------------------------------------------------------------------------ with AMF.UML.Actions; limited with AMF.UML.Classifiers; limited with AMF.UML.Output_Pins; package AMF.UML.Create_Object_Actions is pragma Preelaborate; type UML_Create_Object_Action is limited interface and AMF.UML.Actions.UML_Action; type UML_Create_Object_Action_Access is access all UML_Create_Object_Action'Class; for UML_Create_Object_Action_Access'Storage_Size use 0; not overriding function Get_Classifier (Self : not null access constant UML_Create_Object_Action) return AMF.UML.Classifiers.UML_Classifier_Access is abstract; -- Getter of CreateObjectAction::classifier. -- -- Classifier to be instantiated. not overriding procedure Set_Classifier (Self : not null access UML_Create_Object_Action; To : AMF.UML.Classifiers.UML_Classifier_Access) is abstract; -- Setter of CreateObjectAction::classifier. -- -- Classifier to be instantiated. not overriding function Get_Result (Self : not null access constant UML_Create_Object_Action) return AMF.UML.Output_Pins.UML_Output_Pin_Access is abstract; -- Getter of CreateObjectAction::result. -- -- Gives the output pin on which the result is put. not overriding procedure Set_Result (Self : not null access UML_Create_Object_Action; To : AMF.UML.Output_Pins.UML_Output_Pin_Access) is abstract; -- Setter of CreateObjectAction::result. -- -- Gives the output pin on which the result is put. end AMF.UML.Create_Object_Actions;
reznikmm/matreshka
Ada
5,130
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Generic_Collections; package AMF.UML.Data_Store_Nodes.Collections is pragma Preelaborate; package UML_Data_Store_Node_Collections is new AMF.Generic_Collections (UML_Data_Store_Node, UML_Data_Store_Node_Access); type Set_Of_UML_Data_Store_Node is new UML_Data_Store_Node_Collections.Set with null record; Empty_Set_Of_UML_Data_Store_Node : constant Set_Of_UML_Data_Store_Node; type Ordered_Set_Of_UML_Data_Store_Node is new UML_Data_Store_Node_Collections.Ordered_Set with null record; Empty_Ordered_Set_Of_UML_Data_Store_Node : constant Ordered_Set_Of_UML_Data_Store_Node; type Bag_Of_UML_Data_Store_Node is new UML_Data_Store_Node_Collections.Bag with null record; Empty_Bag_Of_UML_Data_Store_Node : constant Bag_Of_UML_Data_Store_Node; type Sequence_Of_UML_Data_Store_Node is new UML_Data_Store_Node_Collections.Sequence with null record; Empty_Sequence_Of_UML_Data_Store_Node : constant Sequence_Of_UML_Data_Store_Node; private Empty_Set_Of_UML_Data_Store_Node : constant Set_Of_UML_Data_Store_Node := (UML_Data_Store_Node_Collections.Set with null record); Empty_Ordered_Set_Of_UML_Data_Store_Node : constant Ordered_Set_Of_UML_Data_Store_Node := (UML_Data_Store_Node_Collections.Ordered_Set with null record); Empty_Bag_Of_UML_Data_Store_Node : constant Bag_Of_UML_Data_Store_Node := (UML_Data_Store_Node_Collections.Bag with null record); Empty_Sequence_Of_UML_Data_Store_Node : constant Sequence_Of_UML_Data_Store_Node := (UML_Data_Store_Node_Collections.Sequence with null record); end AMF.UML.Data_Store_Nodes.Collections;
afrl-rq/OpenUxAS
Ada
1,730
ads
package UxAS.Comms.Transport.Receiver is type Transport_Receiver_Base is abstract new Transport_Base with private; type Transport_Receiver_Base_Ref is access all Transport_Receiver_Base; type Any_Transport_Receiver_Base is access Transport_Receiver_Base'Class; Any_Address_Accepted : constant String := ""; -- no filtering applied -- bool -- addSubscriptionAddress(const std::string& address); procedure Add_Subscription_Address (This : in out Transport_Receiver_Base; Address : String; Result : out Boolean); -- bool -- removeSubscriptionAddress(const std::string& address); procedure Remove_Subscription_Address (This : in out Transport_Receiver_Base; Address : String; Result : out Boolean); -- bool -- removeAllSubscriptionAddresses(); procedure Remove_All_Subscription_Addresses (This : in out Transport_Receiver_Base; Result : out Boolean); -- bool -- addSubscriptionAddressToSocket(const std::string& address) override; procedure Add_Subscription_Address_To_Socket (This : in out Transport_Receiver_Base; Address : String; Result : out Boolean) is abstract; -- bool -- removeSubscriptionAddressFromSocket(const std::string& address) override; procedure Remove_Subscription_Address_From_Socket (This : in out Transport_Receiver_Base; Address : String; Result : out Boolean) is abstract; private type Transport_Receiver_Base is abstract new Transport_Base with record -- std::unordered_set<std::string> m_subscriptionAddresses; Subscriptions : Subscription_Address_Set; end record; end UxAS.Comms.Transport.Receiver;
gitter-badger/libAnne
Ada
59
ads
package Generics.Testing with Pure is end Generics.Testing;
reznikmm/matreshka
Ada
3,744
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.Db_Enable_Sql92_Check_Attributes is pragma Preelaborate; type ODF_Db_Enable_Sql92_Check_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Db_Enable_Sql92_Check_Attribute_Access is access all ODF_Db_Enable_Sql92_Check_Attribute'Class with Storage_Size => 0; end ODF.DOM.Db_Enable_Sql92_Check_Attributes;
burratoo/Acton
Ada
1,133
ads
------------------------------------------------------------------------------------------ -- -- -- OAK VIEWER -- -- -- -- CORTEX_TRACES.OVERFLOW -- -- -- -- Copyright (C) 2014-2021, Patrick Bernardi -- -- -- ------------------------------------------------------------------------------------------ package Cortex_Traces.Overflow is type Overflow_Event is new Cortex_Event with null record; function Event_Constructor (Params : not null access Constructor_Parameters) return Overflow_Event; overriding function Image (Event : Overflow_Event) return String; end Cortex_Traces.Overflow;
zhmu/ananas
Ada
5,536
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- G N A T . T R A C E B A C K -- -- -- -- S p e c -- -- -- -- Copyright (C) 1999-2022, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Run-time non-symbolic traceback support -- This package provides a method for generating a traceback of the -- current execution location. The traceback shows the locations of -- calls in the call chain, up to either the top or a designated -- number of levels. -- The traceback information is in the form of absolute code locations. -- These code locations may be converted to corresponding source locations -- using the external addr2line utility, or from within GDB. -- In order to use this facility, in some cases the binder must be invoked -- with -E switch (store the backtrace with exception occurrence). Please -- refer to gnatbind documentation for more information. -- To analyze the code locations later using addr2line or gdb, the necessary -- units must be compiled with the debugging switch -g in the usual manner. -- Note that it is not necessary to compile with -g to use Call_Chain. In -- other words, the following sequence of steps can be used: -- Compile without -g -- Run the program, and call Call_Chain -- Recompile with -g -- Use addr2line to interpret the absolute call locations (note that -- addr2line expects addresses in hexadecimal format). -- This capability is currently supported on the following targets: -- AiX PowerPC -- GNU/Linux x86 -- GNU/Linux PowerPC -- LynxOS x86 -- LynxOS 178 xcoff PowerPC -- LynxOS 178 elf PowerPC -- Solaris x86 -- Solaris sparc -- VxWorks ARM -- VxWorks7 ARM -- VxWorks PowerPC -- VxWorks x86 -- Windows XP -- Note: see also GNAT.Traceback.Symbolic, a child unit in file g-trasym.ads -- providing symbolic trace back capability for a subset of the above targets. with System; with Ada.Exceptions.Traceback; package GNAT.Traceback is pragma Elaborate_Body; subtype Code_Loc is System.Address; -- Code location used in building tracebacks subtype Tracebacks_Array is Ada.Exceptions.Traceback.Tracebacks_Array; -- Traceback array used to hold a generated traceback list ---------------- -- Call_Chain -- ---------------- procedure Call_Chain (Traceback : out Tracebacks_Array; Len : out Natural); -- Store up to Traceback'Length tracebacks corresponding to the current -- call chain. The first entry stored corresponds to the deepest level -- of subprogram calls. Len shows the number of traceback entries stored. -- It will be equal to Traceback'Length unless the entire traceback is -- shorter, in which case positions in Traceback past the Len position -- are undefined on return. function Call_Chain (Max_Len : Positive; Skip_Frames : Natural := 1) return Tracebacks_Array; -- Returns up to Max_Len tracebacks corresponding to the current call -- chain. Result array order is the same as in above procedure Call_Chain -- except that Skip_Frames says how many of the most recent calls should be -- excluded from the result, starting with this procedure itself: 1 means -- exclude the frame for this procedure, 2 means 1 + exclude the frame for -- this procedure's caller, ... end GNAT.Traceback;
tum-ei-rcs/StratoX
Ada
19,024
ads
-- Project: MART - Modular Airborne Real-Time Testbed -- System: Emergency Recovery System -- Authors: Markus Neumair (Original C-Code) -- Emanuel Regnath ([email protected]) (Ada Port) -- -- Module Description: -- Driver for the IMU MPU6000 -- with HIL; use HIL; private package MPU6000.Register with SPARK_Mode is type Address_Type is new HIL.Byte; -- MPU6000 register adresses and other defines MPU6000_REV_C4_ES : constant := 16#14#; MPU6000_REV_C5_ES : constant := 16#15#; MPU6000_REV_D6_ES : constant := 16#16#; MPU6000_REV_D7_ES : constant := 16#17#; MPU6000_REV_D8_ES : constant := 16#18#; MPU6000_REV_C4 : constant := 16#54#; MPU6000_REV_C5 : constant := 16#55#; MPU6000_REV_D6 : constant := 16#56#; MPU6000_REV_D7 : constant := 16#57#; MPU6000_REV_D8 : constant := 16#58#; MPU6000_REV_D9 : constant := 16#59#; -- MPU6000_RA_ST_X_GYRO : constant := 16#00#; -- MPU6000_RA_ST_Y_GYRO : constant := 16#01#; -- MPU6000_RA_ST_Z_GYRO : constant := 16#02#; MPU6000_RA_SELF_TEST_X : constant := 16#0D#; MPU6000_RA_SELF_TEST_Y : constant := 16#0E#; MPU6000_RA_SELF_TEST_Z : constant := 16#0F#; MPU6000_RA_SELF_TEST_A : constant := 16#10#; -- MPU6000_RA_XG_OFFS_USRH : constant := 16#13#; -- MPU6000_RA_XG_OFFS_USRL : constant := 16#14#; -- MPU6000_RA_YG_OFFS_USRH : constant := 16#15#; -- MPU6000_RA_YG_OFFS_USRL : constant := 16#16#; -- MPU6000_RA_ZG_OFFS_USRH : constant := 16#17#; -- MPU6000_RA_ZG_OFFS_USRL : constant := 16#18#; MPU6000_RA_SMPLRT_DIV : constant := 16#19#; MPU6000_RA_CONFIG : constant := 16#1A#; MPU6000_RA_GYRO_CONFIG : constant := 16#1B#; MPU6000_RA_ACCEL_CONFIG : constant := 16#1C#; -- MPU6000_RA_ACCEL_CONFIG_2 : constant := 16#1D#; -- MPU6000_RA_LP_ACCEL_ODR : constant := 16#1E#; MPU6000_RA_WOM_THR : constant := 16#1F#; MPU6000_RA_FIFO_EN : constant := 16#23#; MPU6000_RA_I2C_MST_CTRL : constant := 16#24#; MPU6000_RA_I2C_SLV0_ADDR : constant := 16#25#; MPU6000_RA_I2C_SLV0_REG : constant := 16#26#; MPU6000_RA_I2C_SLV0_CTRL : constant := 16#27#; MPU6000_RA_I2C_SLV1_ADDR : constant := 16#28#; MPU6000_RA_I2C_SLV1_REG : constant := 16#29#; MPU6000_RA_I2C_SLV1_CTRL : constant := 16#2A#; MPU6000_RA_I2C_SLV2_ADDR : constant := 16#2B#; MPU6000_RA_I2C_SLV2_REG : constant := 16#2C#; MPU6000_RA_I2C_SLV2_CTRL : constant := 16#2D#; MPU6000_RA_I2C_SLV3_ADDR : constant := 16#2E#; MPU6000_RA_I2C_SLV3_REG : constant := 16#2F#; MPU6000_RA_I2C_SLV3_CTRL : constant := 16#30#; MPU6000_RA_I2C_SLV4_ADDR : constant := 16#31#; MPU6000_RA_I2C_SLV4_REG : constant := 16#32#; MPU6000_RA_I2C_SLV4_DO : constant := 16#33#; MPU6000_RA_I2C_SLV4_CTRL : constant := 16#34#; MPU6000_RA_I2C_SLV4_DI : constant := 16#35#; MPU6000_RA_I2C_MST_STATUS : constant := 16#36#; MPU6000_RA_INT_PIN_CFG : constant := 16#37#; MPU6000_RA_INT_ENABLE : constant := 16#38#; -- MPU6000_RA_DMP_INT_STATUS : constant := 16#39#; MPU6000_RA_INT_STATUS : constant := 16#3A#; MPU6000_RA_ACCEL_XOUT_H : constant := 16#3B#; MPU6000_RA_ACCEL_XOUT_L : constant := 16#3C#; MPU6000_RA_ACCEL_YOUT_H : constant := 16#3D#; MPU6000_RA_ACCEL_YOUT_L : constant := 16#3E#; MPU6000_RA_ACCEL_ZOUT_H : constant := 16#3F#; MPU6000_RA_ACCEL_ZOUT_L : constant := 16#40#; MPU6000_RA_TEMP_OUT_H : constant := 16#41#; MPU6000_RA_TEMP_OUT_L : constant := 16#42#; MPU6000_RA_GYRO_XOUT_H : constant := 16#43#; MPU6000_RA_GYRO_XOUT_L : constant := 16#44#; MPU6000_RA_GYRO_YOUT_H : constant := 16#45#; MPU6000_RA_GYRO_YOUT_L : constant := 16#46#; MPU6000_RA_GYRO_ZOUT_H : constant := 16#47#; MPU6000_RA_GYRO_ZOUT_L : constant := 16#48#; MPU6000_RA_EXT_SENS_DATA_00 : constant := 16#49#; MPU6000_RA_EXT_SENS_DATA_01 : constant := 16#4A#; MPU6000_RA_EXT_SENS_DATA_02 : constant := 16#4B#; MPU6000_RA_EXT_SENS_DATA_03 : constant := 16#4C#; MPU6000_RA_EXT_SENS_DATA_04 : constant := 16#4D#; MPU6000_RA_EXT_SENS_DATA_05 : constant := 16#4E#; MPU6000_RA_EXT_SENS_DATA_06 : constant := 16#4F#; MPU6000_RA_EXT_SENS_DATA_07 : constant := 16#50#; MPU6000_RA_EXT_SENS_DATA_08 : constant := 16#51#; MPU6000_RA_EXT_SENS_DATA_09 : constant := 16#52#; MPU6000_RA_EXT_SENS_DATA_10 : constant := 16#53#; MPU6000_RA_EXT_SENS_DATA_11 : constant := 16#54#; MPU6000_RA_EXT_SENS_DATA_12 : constant := 16#55#; MPU6000_RA_EXT_SENS_DATA_13 : constant := 16#56#; MPU6000_RA_EXT_SENS_DATA_14 : constant := 16#57#; MPU6000_RA_EXT_SENS_DATA_15 : constant := 16#58#; MPU6000_RA_EXT_SENS_DATA_16 : constant := 16#59#; MPU6000_RA_EXT_SENS_DATA_17 : constant := 16#5A#; MPU6000_RA_EXT_SENS_DATA_18 : constant := 16#5B#; MPU6000_RA_EXT_SENS_DATA_19 : constant := 16#5C#; MPU6000_RA_EXT_SENS_DATA_20 : constant := 16#5D#; MPU6000_RA_EXT_SENS_DATA_21 : constant := 16#5E#; MPU6000_RA_EXT_SENS_DATA_22 : constant := 16#5F#; MPU6000_RA_EXT_SENS_DATA_23 : constant := 16#60#; MPU6000_RA_MOT_DETECT_STATUS : constant := 16#61#; MPU6000_RA_I2C_SLV0_DO : constant := 16#63#; MPU6000_RA_I2C_SLV1_DO : constant := 16#64#; MPU6000_RA_I2C_SLV2_DO : constant := 16#65#; MPU6000_RA_I2C_SLV3_DO : constant := 16#66#; MPU6000_RA_I2C_MST_DELAY_CTRL : constant := 16#67#; MPU6000_RA_SIGNAL_PATH_RESET : constant := 16#68#; MPU6000_RA_MOT_DETECT_CTRL : constant := 16#69#; MPU6000_RA_USER_CTRL : constant := 16#6A#; MPU6000_RA_PWR_MGMT_1 : constant := 16#6B#; MPU6000_RA_PWR_MGMT_2 : constant := 16#6C#; -- MPU6000_RA_BANK_SEL : constant := 16#6D#; -- MPU6000_RA_MEM_START_ADDR : constant := 16#6E#; -- MPU6000_RA_MEM_R_W : constant := 16#6F#; -- MPU6000_RA_DMP_CFG_1 : constant := 16#70#; -- MPU6000_RA_DMP_CFG_2 : constant := 16#71#; MPU6000_RA_FIFO_COUNTH : constant := 16#72#; MPU6000_RA_FIFO_COUNTL : constant := 16#73#; MPU6000_RA_FIFO_R_W : constant := 16#74#; MPU6000_RA_WHO_AM_I : constant := 16#75#; MPU6000_RA_XA_OFFSET_H : constant := 16#77#; MPU6000_RA_XA_OFFSET_L : constant := 16#78#; MPU6000_RA_YA_OFFSET_H : constant := 16#7A#; MPU6000_RA_YA_OFFSET_L : constant := 16#7B#; MPU6000_RA_ZA_OFFSET_H : constant := 16#7D#; MPU6000_RA_ZA_OFFSET_L : constant := 16#7E#; MPU6000_TC_PWR_MODE_BIT : constant := 7; MPU6000_TC_OFFSET_BIT : constant := 6; MPU6000_TC_OFFSET_LENGTH : constant := 6; MPU6000_TC_OTP_BNK_VLD_BIT : constant := 0; MPU6000_VDDIO_LEVEL_VLOGIC : constant := 0; MPU6000_VDDIO_LEVEL_VDD : constant := 1; MPU6000_CFG_EXT_SYNC_SET_BIT : constant := 5; MPU6000_CFG_EXT_SYNC_SET_LENGTH : constant := 3; MPU6000_CFG_DLPF_CFG_BIT : constant := 2; MPU6000_CFG_DLPF_CFG_LENGTH : constant := 3; MPU6000_EXT_SYNC_DISABLED : constant := 16#0#; MPU6000_EXT_SYNC_TEMP_OUT_L : constant := 16#1#; MPU6000_EXT_SYNC_GYRO_XOUT_L : constant := 16#2#; MPU6000_EXT_SYNC_GYRO_YOUT_L : constant := 16#3#; MPU6000_EXT_SYNC_GYRO_ZOUT_L : constant := 16#4#; MPU6000_EXT_SYNC_ACCEL_XOUT_L : constant := 16#5#; MPU6000_EXT_SYNC_ACCEL_YOUT_L : constant := 16#6#; MPU6000_EXT_SYNC_ACCEL_ZOUT_L : constant := 16#7#; MPU6000_GCONFIG_XG_ST_BIT : constant := 7; MPU6000_GCONFIG_YG_ST_BIT : constant := 6; MPU6000_GCONFIG_ZG_ST_BIT : constant := 5; MPU6000_GCONFIG_FS_SEL_BIT : constant := 4; MPU6000_GCONFIG_FS_SEL_LENGTH : constant := 2; MPU6000_ACONFIG_XA_ST_BIT : constant := 7; MPU6000_ACONFIG_YA_ST_BIT : constant := 6; MPU6000_ACONFIG_ZA_ST_BIT : constant := 5; MPU6000_ACONFIG_AFS_SEL_BIT : constant := 4; MPU6000_ACONFIG_AFS_SEL_LENGTH : constant := 2; MPU6000_ACONFIG_ACCEL_HPF_BIT : constant := 2; MPU6000_ACONFIG_ACCEL_HPF_LENGTH : constant := 3; MPU6000_DHPF_RESET : constant := 16#00#; MPU6000_DHPF_5 : constant := 16#01#; MPU6000_DHPF_2P5 : constant := 16#02#; MPU6000_DHPF_1P25 : constant := 16#03#; MPU6000_DHPF_0P63 : constant := 16#04#; MPU6000_DHPF_HOLD : constant := 16#07#; MPU6000_TEMP_FIFO_EN_BIT : constant := 7; MPU6000_XG_FIFO_EN_BIT : constant := 6; MPU6000_YG_FIFO_EN_BIT : constant := 5; MPU6000_ZG_FIFO_EN_BIT : constant := 4; MPU6000_ACCEL_FIFO_EN_BIT : constant := 3; MPU6000_SLV2_FIFO_EN_BIT : constant := 2; MPU6000_SLV1_FIFO_EN_BIT : constant := 1; MPU6000_SLV0_FIFO_EN_BIT : constant := 0; MPU6000_MULT_MST_EN_BIT : constant := 7; MPU6000_WAIT_FOR_ES_BIT : constant := 6; MPU6000_SLV_3_FIFO_EN_BIT : constant := 5; MPU6000_I2C_MST_P_NSR_BIT : constant := 4; MPU6000_I2C_MST_CLK_BIT : constant := 3; MPU6000_I2C_MST_CLK_LENGTH : constant := 4; MPU6000_CLOCK_DIV_348 : constant := 16#0#; MPU6000_CLOCK_DIV_333 : constant := 16#1#; MPU6000_CLOCK_DIV_320 : constant := 16#2#; MPU6000_CLOCK_DIV_308 : constant := 16#3#; MPU6000_CLOCK_DIV_296 : constant := 16#4#; MPU6000_CLOCK_DIV_286 : constant := 16#5#; MPU6000_CLOCK_DIV_276 : constant := 16#6#; MPU6000_CLOCK_DIV_267 : constant := 16#7#; MPU6000_CLOCK_DIV_258 : constant := 16#8#; MPU6000_CLOCK_DIV_500 : constant := 16#9#; MPU6000_CLOCK_DIV_471 : constant := 16#A#; MPU6000_CLOCK_DIV_444 : constant := 16#B#; MPU6000_CLOCK_DIV_421 : constant := 16#C#; MPU6000_CLOCK_DIV_400 : constant := 16#D#; MPU6000_CLOCK_DIV_381 : constant := 16#E#; MPU6000_CLOCK_DIV_364 : constant := 16#F#; MPU6000_I2C_SLV_RW_BIT : constant := 7; MPU6000_I2C_SLV_ADDR_BIT : constant := 6; MPU6000_I2C_SLV_ADDR_LENGTH : constant := 7; MPU6000_I2C_SLV_EN_BIT : constant := 7; MPU6000_I2C_SLV_BYTE_SW_BIT : constant := 6; MPU6000_I2C_SLV_REG_DIS_BIT : constant := 5; MPU6000_I2C_SLV_GRP_BIT : constant := 4; MPU6000_I2C_SLV_LEN_BIT : constant := 3; MPU6000_I2C_SLV_LEN_LENGTH : constant := 4; MPU6000_I2C_SLV4_RW_BIT : constant := 7; MPU6000_I2C_SLV4_ADDR_BIT : constant := 6; MPU6000_I2C_SLV4_ADDR_LENGTH : constant := 7; MPU6000_I2C_SLV4_EN_BIT : constant := 7; MPU6000_I2C_SLV4_INT_EN_BIT : constant := 6; MPU6000_I2C_SLV4_REG_DIS_BIT : constant := 5; MPU6000_I2C_SLV4_MST_DLY_BIT : constant := 4; MPU6000_I2C_SLV4_MST_DLY_LENGTH : constant := 5; MPU6000_MST_PASS_THROUGH_BIT : constant := 7; MPU6000_MST_I2C_SLV4_DONE_BIT : constant := 6; MPU6000_MST_I2C_LOST_ARB_BIT : constant := 5; MPU6000_MST_I2C_SLV4_NACK_BIT : constant := 4; MPU6000_MST_I2C_SLV3_NACK_BIT : constant := 3; MPU6000_MST_I2C_SLV2_NACK_BIT : constant := 2; MPU6000_MST_I2C_SLV1_NACK_BIT : constant := 1; MPU6000_MST_I2C_SLV0_NACK_BIT : constant := 0; MPU6000_INTCFG_INT_LEVEL_BIT : constant := 7; MPU6000_INTCFG_INT_OPEN_BIT : constant := 6; MPU6000_INTCFG_LATCH_INT_EN_BIT : constant := 5; MPU6000_INTCFG_INT_RD_CLEAR_BIT : constant := 4; MPU6000_INTCFG_FSYNC_INT_LEVEL_BIT : constant := 3; MPU6000_INTCFG_FSYNC_INT_EN_BIT : constant := 2; MPU6000_INTCFG_I2C_BYPASS_EN_BIT : constant := 1; MPU6000_INTCFG_CLKOUT_EN_BIT : constant := 0; MPU6000_INTMODE_ACTIVEHIGH : constant := 16#00#; MPU6000_INTMODE_ACTIVELOW : constant := 16#01#; MPU6000_INTDRV_PUSHPULL : constant := 16#00#; MPU6000_INTDRV_OPENDRAIN : constant := 16#01#; MPU6000_INTLATCH_50USPULSE : constant := 16#00#; MPU6000_INTLATCH_WAITCLEAR : constant := 16#01#; MPU6000_INTCLEAR_STATUSREAD : constant := 16#00#; MPU6000_INTCLEAR_ANYREAD : constant := 16#01#; MPU6000_INTERRUPT_FF_BIT : constant := 7; MPU6000_INTERRUPT_MOT_BIT : constant := 6; MPU6000_INTERRUPT_ZMOT_BIT : constant := 5; MPU6000_INTERRUPT_FIFO_OFLOW_BIT : constant := 4; MPU6000_INTERRUPT_I2C_MST_INT_BIT : constant := 3; MPU6000_INTERRUPT_PLL_RDY_INT_BIT : constant := 2; MPU6000_INTERRUPT_DMP_INT_BIT : constant := 1; MPU6000_INTERRUPT_DATA_RDY_BIT : constant := 0; MPU6000_DMPINT_5_BIT : constant := 5; MPU6000_DMPINT_4_BIT : constant := 4; MPU6000_DMPINT_3_BIT : constant := 3; MPU6000_DMPINT_2_BIT : constant := 2; MPU6000_DMPINT_1_BIT : constant := 1; MPU6000_DMPINT_0_BIT : constant := 0; MPU6000_MOTION_MOT_XNEG_BIT : constant := 7; MPU6000_MOTION_MOT_XPOS_BIT : constant := 6; MPU6000_MOTION_MOT_YNEG_BIT : constant := 5; MPU6000_MOTION_MOT_YPOS_BIT : constant := 4; MPU6000_MOTION_MOT_ZNEG_BIT : constant := 3; MPU6000_MOTION_MOT_ZPOS_BIT : constant := 2; MPU6000_MOTION_MOT_ZRMOT_BIT : constant := 0; MPU6000_DELAYCTRL_DELAY_ES_SHADOW_BIT : constant := 7; MPU6000_DELAYCTRL_I2C_SLV4_DLY_EN_BIT : constant := 4; MPU6000_DELAYCTRL_I2C_SLV3_DLY_EN_BIT : constant := 3; MPU6000_DELAYCTRL_I2C_SLV2_DLY_EN_BIT : constant := 2; MPU6000_DELAYCTRL_I2C_SLV1_DLY_EN_BIT : constant := 1; MPU6000_DELAYCTRL_I2C_SLV0_DLY_EN_BIT : constant := 0; MPU6000_PATHRESET_GYRO_RESET_BIT : constant := 2; MPU6000_PATHRESET_ACCEL_RESET_BIT : constant := 1; MPU6000_PATHRESET_TEMP_RESET_BIT : constant := 0; MPU6000_DETECT_ACCEL_ON_DELAY_BIT : constant := 5; MPU6000_DETECT_ACCEL_ON_DELAY_LENGTH : constant := 2; MPU6000_DETECT_FF_COUNT_BIT : constant := 3; MPU6000_DETECT_FF_COUNT_LENGTH : constant := 2; MPU6000_DETECT_MOT_COUNT_BIT : constant := 1; MPU6000_DETECT_MOT_COUNT_LENGTH : constant := 2; MPU6000_DETECT_DECREMENT_RESET : constant := 16#0#; MPU6000_DETECT_DECREMENT_1 : constant := 16#1#; MPU6000_DETECT_DECREMENT_2 : constant := 16#2#; MPU6000_DETECT_DECREMENT_4 : constant := 16#3#; MPU6000_USERCTRL_DMP_EN_BIT : constant := 7; MPU6000_USERCTRL_FIFO_EN_BIT : constant := 6; MPU6000_USERCTRL_I2C_MST_EN_BIT : constant := 5; MPU6000_USERCTRL_I2C_IF_DIS_BIT : constant := 4; MPU6000_USERCTRL_DMP_RESET_BIT : constant := 3; MPU6000_USERCTRL_FIFO_RESET_BIT : constant := 2; MPU6000_USERCTRL_I2C_MST_RESET_BIT : constant := 1; MPU6000_USERCTRL_SIG_COND_RESET_BIT : constant := 0; MPU6000_PWR1_DEVICE_RESET_BIT : constant := 7; MPU6000_PWR1_SLEEP_BIT : constant := 6; MPU6000_PWR1_CYCLE_BIT : constant := 5; MPU6000_PWR1_TEMP_DIS_BIT : constant := 3; MPU6000_PWR1_CLKSEL_BIT : constant := 2; MPU6000_PWR1_CLKSEL_LENGTH : constant := 3; MPU6000_CLOCK_INTERNAL : constant := 16#00#; MPU6000_CLOCK_PLL_XGYRO : constant := 16#01#; MPU6000_CLOCK_PLL_YGYRO : constant := 16#02#; MPU6000_CLOCK_PLL_ZGYRO : constant := 16#03#; MPU6000_CLOCK_PLL_EXT32K : constant := 16#04#; MPU6000_CLOCK_PLL_EXT19M : constant := 16#05#; MPU6000_CLOCK_KEEP_RESET : constant := 16#07#; MPU6000_PWR2_LP_WAKE_CTRL_BIT : constant := 7; MPU6000_PWR2_LP_WAKE_CTRL_LENGTH : constant := 2; MPU6000_PWR2_STBY_XA_BIT : constant := 5; MPU6000_PWR2_STBY_YA_BIT : constant := 4; MPU6000_PWR2_STBY_ZA_BIT : constant := 3; MPU6000_PWR2_STBY_XG_BIT : constant := 2; MPU6000_PWR2_STBY_YG_BIT : constant := 1; MPU6000_PWR2_STBY_ZG_BIT : constant := 0; MPU6000_WAKE_FREQ_1P25 : constant := 16#0#; MPU6000_WAKE_FREQ_2P5 : constant := 16#1#; MPU6000_WAKE_FREQ_5 : constant := 16#2#; MPU6000_WAKE_FREQ_10 : constant := 16#3#; MPU6000_BANKSEL_PRFTCH_EN_BIT : constant := 6; MPU6000_BANKSEL_CFG_USER_BANK_BIT : constant := 5; MPU6000_BANKSEL_MEM_SEL_BIT : constant := 4; MPU6000_BANKSEL_MEM_SEL_LENGTH : constant := 5; MPU6000_WHO_AM_I_BIT : constant := 6; MPU6000_WHO_AM_I_LENGTH : constant := 6; MPU6000_DMP_MEMORY_BANKS : constant := 8; MPU6000_DMP_MEMORY_BANK_SIZE : constant := 256; MPU6000_DMP_MEMORY_CHUNK_SIZE : constant := 16; MPU6000_ST_GYRO_LOW : constant := (-14.0); MPU6000_ST_GYRO_HIGH : constant := 14.0; MPU6000_ST_ACCEL_LOW : constant := (-14.0); MPU6000_ST_ACCEL_HIGH : constant := 14.0; MPU6000_ST_TB : constant Unsigned_16_Array (1 .. 256) := ( 2620, 2646, 2672, 2699, 2726, 2753, 2781, 2808, 2837, 2865, 2894, 2923, 2952, 2981, 3011, 3041, 3072, 3102, 3133, 3165, 3196, 3228, 3261, 3293, 3326, 3359, 3393, 3427, 3461, 3496, 3531, 3566, 3602, 3638, 3674, 3711, 3748, 3786, 3823, 3862, 3900, 3939, 3979, 4019, 4059, 4099, 4140, 4182, 4224, 4266, 4308, 4352, 4395, 4439, 4483, 4528, 4574, 4619, 4665, 4712, 4759, 4807, 4855, 4903, 4953, 5002, 5052, 5103, 5154, 5205, 5257, 5310, 5363, 5417, 5471, 5525, 5581, 5636, 5693, 5750, 5807, 5865, 5924, 5983, 6043, 6104, 6165, 6226, 6289, 6351, 6415, 6479, 6544, 6609, 6675, 6742, 6810, 6878, 6946, 7016, 7086, 7157, 7229, 7301, 7374, 7448, 7522, 7597, 7673, 7750, 7828, 7906, 7985, 8065, 8145, 8227, 8309, 8392, 8476, 8561, 8647, 8733, 8820, 8909, 8998, 9088, 9178, 9270, 9363, 9457, 9551, 9647, 9743, 9841, 9939, 10038, 10139, 10240, 10343, 10446, 10550, 10656, 10763, 10870, 10979, 11089, 11200, 11312, 11425, 11539, 11654, 11771, 11889, 12008, 12128, 12249, 12371, 12495, 12620, 12746, 12874, 13002, 13132, 13264, 13396, 13530, 13666, 13802, 13940, 14080, 14221, 14363, 14506, 14652, 14798, 14946, 15096, 15247, 15399, 15553, 15709, 15866, 16024, 16184, 16346, 16510, 16675, 16842, 17010, 17180, 17352, 17526, 17701, 17878, 18057, 18237, 18420, 18604, 18790, 18978, 19167, 19359, 19553, 19748, 19946, 20145, 20347, 20550, 20756, 20963, 21173, 21385, 21598, 21814, 22033, 22253, 22475, 22700, 22927, 23156, 23388, 23622, 23858, 24097, 24338, 24581, 24827, 25075, 25326, 25579, 25835, 26093, 26354, 26618, 26884, 27153, 27424, 27699, 27976, 28255, 28538, 28823, 29112, 29403, 29697, 29994, 30294, 30597, 30903, 31212, 31524, 31839, 32157, 32479, 32804, 33132 ); end MPU6000.Register;
optikos/oasis
Ada
625
ads
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Elements.Definitions; package Program.Elements.Anonymous_Access_Definitions is pragma Pure (Program.Elements.Anonymous_Access_Definitions); type Anonymous_Access_Definition is limited interface and Program.Elements.Definitions.Definition; type Anonymous_Access_Definition_Access is access all Anonymous_Access_Definition'Class with Storage_Size => 0; end Program.Elements.Anonymous_Access_Definitions;
AdaCore/libadalang
Ada
40
ads
package Foo is I : Integer; end Foo;
charlie5/lace
Ada
917
ads
with glx.BufferSwapComplete, glx.PbufferClobberEvent; package glx.Event is type long_Array is array (C.size_t range <>) of aliased C.Long; type Kind is (pBufferClobber, BufferSwapComplete, Pad); type Item (Kind : Event.Kind := Event.Kind'First) is record case Kind is when pBufferClobber => pBufferClobber : aliased glx.PBufferClobberEvent.item; when BufferSwapComplete => BufferSwapComplete : aliased glx.BufferSwapComplete .item; when Pad => Pad : aliased long_Array (0 .. 23); end case; end record with unchecked_Union; type Pointer is access all Item; type Pointer_Pointer is access all Pointer; type Items is array (C.size_t range <>) of aliased Item; type Pointers is array (C.size_t range <>) of aliased Pointer; end glx.Event;
AdaCore/libadalang
Ada
330
adb
-- Test that symbol lookups in some lexical environments do not "leak" in -- their parents's lexical environment when they should not, as it is the -- case when resolving qualified names. package Foo is package Bar is type T1 is new Integer; end; type T2 is new Integer; pragma Test (Bar.T2); end Foo;
AdaCore/ada-traits-containers
Ada
2,694
ads
-- -- Copyright (C) 2015-2016, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- -- This package describes the underlying storage strategy for a bounded vector pragma Ada_2012; with Conts.Elements; generic with package Elements is new Conts.Elements.Traits (<>); type Container_Base_Type is abstract tagged limited private; -- The base type for the container of nodes. -- Since this type is eventually also used as the base type for the list -- itself, this is a way to make lists either controlled or limited. package Conts.Vectors.Storage.Bounded with SPARK_Mode is package Impl is type Container (Capacity : Count_Type) is abstract new Container_Base_Type with private; function Max_Capacity (Self : Container'Class) return Count_Type is (Self.Capacity) with Inline; function Capacity (Self : Container'Class) return Count_Type is (Self.Capacity) with Inline; procedure Release_Element (Self : in out Container'Class; Index : Count_Type) with Inline; procedure Set_Element (Self : in out Container'Class; Index : Count_Type; Element : Elements.Stored_Type) with Inline; function Get_Element (Self : Container'Class; Index : Count_Type) return Elements.Stored_Type with Inline; procedure Assign (Self : in out Container'Class; Source : Container'Class; Last : Count_Type); procedure Copy (Self : in out Container'Class; Source : Container'Class; Source_From, Source_To : Count_Type; Self_From : Count_Type) with Inline; private pragma SPARK_Mode (Off); type Elem_Array is array (Count_Type range <>) of Elements.Stored_Type; type Container (Capacity : Count_Type) is abstract new Container_Base_Type with record Nodes : Elem_Array (Min_Index .. Capacity); end record; function Get_Element (Self : Container'Class; Index : Count_Type) return Elements.Stored_Type is (Self.Nodes (Index)); end Impl; package Traits is new Conts.Vectors.Storage.Traits (Elements => Elements, Container => Impl.Container, Max_Capacity => Impl.Max_Capacity, Capacity => Impl.Capacity, Release_Element => Impl.Release_Element, Set_Element => Impl.Set_Element, Get_Element => Impl.Get_Element, Assign => Impl.Assign, Copy => Impl.Copy); end Conts.Vectors.Storage.Bounded;
KissmyAsthma99/opp
Ada
3,961
adb
with Ada.Integer_Text_IO, Ada.Text_IO; use Ada.Integer_Text_IO, Ada.Text_IO; package body data is function Sum_Vector(A,B: in Vector) return Vector is S: Vector; begin for i in 1..N loop S(i):=A(i)+B(i); end loop; return S; end Sum_Vector; function Matrix_Multiplication(A,B: in Matrix) return Matrix is M: Matrix; s: Integer; begin for k in 1..N loop for i in 1..N loop s:=0; for j in 1..N loop s:=A(k)(j)*B(j)(i); M(k)(i):=s; end loop; end loop; end loop; return M; end Matrix_Multiplication; function Vector_Matrix_Multiplication(A: in Vector; B: in Matrix) return Vector is P: Vector; s: Integer; begin for i in 1..N loop s:=0; for j in 1..N loop s:=S+A(i)*B(j)(i); end loop; P(i):=S; end loop; return P; end Vector_Matrix_Multiplication; procedure Vector_Sort(A: in out Vector) is e: Integer; begin for i in 1..N loop for j in 1..N loop if A(i)>A(j) then E:=A(j); A(j):=A(i); A(i):=e; end if; end loop; end loop; end Vector_Sort; procedure Matrix_Sort(A: in out Matrix) is m: Integer; begin for i in 1..n loop for j in 1..n loop A(i)(j):=A(i)(j); end loop; end loop; for k in 1..n loop for i in reverse 1..n loop for j in 1..(i-1) loop if A(k)(j) <A(k)(j+1) then m :=A(k)(j); A(k)(j):=A(k)(j+1); A(k)(j+1):=m; end if; end loop; end loop; end loop; end Matrix_Sort; function Matrix_Add(A,B: in Matrix) return Matrix is S: Matrix; begin for i in 1..N loop for j in 1..N loop S(i)(j):=A(i)(j) + B(i)(j); end loop; end loop; return S; end Matrix_Add; procedure Matrix_Fill_Ones (A: out Matrix) is begin for i in 1..N loop for j in 1..N loop A(i)(j):=i; end loop; end loop; end Matrix_Fill_Ones; procedure Vector_Fill_Ones (A: out Vector) is begin for i in 1..N loop A(i):=1; end loop; end Vector_Fill_Ones; procedure Vector_Input (A: out Vector) is begin for i in 1..N loop Get(A(i)); end loop; end Vector_Input; procedure Vector_Output (A: in Vector) is begin for i in 1..N loop Put(A(i)); end loop; New_Line; end Vector_Output; procedure Matrix_Input(A: out Matrix) is begin for i in 1..N loop for j in 1..N loop Get(A(i)(j)); end loop; end loop; end Matrix_Input; procedure Matrix_Output(A: in Matrix) is begin for i in 1..N loop for j in 1..N loop Put(A(i)(j)); end loop; New_Line; end loop; New_Line; end Matrix_Output; function Func1(A,B,C: in Vector; MA,ME: in Matrix) return Vector is Z_Sum, O_Sum, D: Vector; MK: Matrix; begin O_Sum:= Sum_Vector(A,B); Vector_Sort(O_Sum); Z_Sum:= Sum_Vector(O_Sum,C); MK:= Matrix_Multiplication(MA,ME); D:= Vector_Matrix_Multiplication(Z_Sum,MK); return D; end Func1; function Func2(MF,MG,MH: in Matrix) return Matrix is MJ: Matrix; MQ: Matrix; begin MJ:= Matrix_Multiplication(MG,MH); MQ:= Matrix_Add(MJ, MF); Matrix_Sort(MQ); return MQ; end Func2; function Func3(O,P: in Vector; MP,MS: in Matrix) return Vector is T,S: Vector; MG: Matrix; begin S:= Sum_Vector(O,P); MG:= Matrix_Multiplication(MP,MS); T:= Vector_Matrix_Multiplication(P,MG); return T; end Func3; end data;
damaki/libkeccak
Ada
2,917
ads
------------------------------------------------------------------------------- -- Copyright (c) 2019, Daniel King -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- * Redistributions of source code must retain the above copyright -- notice, this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- * The name of the copyright holder may not be used to endorse or promote -- Products derived from this software without specific prior written -- permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY -- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------- with Interfaces; with Keccak.Generic_KeccakF; with Keccak.Generic_KeccakF.Byte_Lanes; with Keccak.Generic_KeccakF.Lane_Complementing_Permutation; with Keccak.Padding; pragma Elaborate_All (Keccak.Generic_KeccakF); pragma Elaborate_All (Keccak.Generic_KeccakF.Byte_Lanes); pragma Elaborate_All (Keccak.Generic_KeccakF.Lane_Complementing_Permutation); -- @summary -- Instantiation of Keccak with a state size of 400 bits (16-bit lanes). package Keccak.Keccak_400 with SPARK_Mode => On is package KeccakF_400 is new Keccak.Generic_KeccakF (Lane_Size_Log => 4, Lane_Type => Interfaces.Unsigned_16); subtype State is KeccakF_400.Lane_Complemented_State; package KeccakF_400_Permutation is new KeccakF_400.Lane_Complementing_Permutation (Rotate_Left => Interfaces.Rotate_Left); package KeccakF_400_Lanes is new KeccakF_400.Byte_Lanes (Shift_Left => Interfaces.Shift_Left, Shift_Right => Interfaces.Shift_Right); procedure XOR_Pad101_Into_State is new Keccak.Padding.XOR_Pad101_Into_State (State_Size_Bits => 400, State_Type => State, XOR_Byte_Into_State => KeccakF_400_Lanes.XOR_Byte_Into_State); end Keccak.Keccak_400;