repo_name
stringlengths
9
74
language
stringclasses
1 value
length_bytes
int64
11
9.34M
extension
stringclasses
2 values
content
stringlengths
11
9.34M
AdaCore/gpr
Ada
61
ads
package Other_Naming is procedure Dummy; end Other_Naming;
reznikmm/matreshka
Ada
20,310
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ package AMF.Internals.Tables.Utp_Metamodel is pragma Preelaborate; function MM_Utp_Utp return AMF.Internals.CMOF_Element; function MC_Utp_Duration return AMF.Internals.CMOF_Element; function MC_Utp_Time return AMF.Internals.CMOF_Element; function MC_Utp_Timezone return AMF.Internals.CMOF_Element; function MC_Utp_Verdict return AMF.Internals.CMOF_Element; function MC_Utp_Coding_Rule return AMF.Internals.CMOF_Element; function MC_Utp_Data_Partition return AMF.Internals.CMOF_Element; function MC_Utp_Data_Pool return AMF.Internals.CMOF_Element; function MC_Utp_Data_Selector return AMF.Internals.CMOF_Element; function MC_Utp_Default return AMF.Internals.CMOF_Element; function MC_Utp_Default_Application return AMF.Internals.CMOF_Element; function MC_Utp_Determ_Alt return AMF.Internals.CMOF_Element; function MC_Utp_Finish_Action return AMF.Internals.CMOF_Element; function MC_Utp_Get_Timezone_Action return AMF.Internals.CMOF_Element; function MC_Utp_Literal_Any return AMF.Internals.CMOF_Element; function MC_Utp_Literal_Any_Or_Null return AMF.Internals.CMOF_Element; function MC_Utp_Log_Action return AMF.Internals.CMOF_Element; function MC_Utp_Managed_Element return AMF.Internals.CMOF_Element; function MC_Utp_Read_Timer_Action return AMF.Internals.CMOF_Element; function MC_Utp_SUT return AMF.Internals.CMOF_Element; function MC_Utp_Set_Timezone_Action return AMF.Internals.CMOF_Element; function MC_Utp_Start_Timer_Action return AMF.Internals.CMOF_Element; function MC_Utp_Stop_Timer_Action return AMF.Internals.CMOF_Element; function MC_Utp_Test_Case return AMF.Internals.CMOF_Element; function MC_Utp_Test_Component return AMF.Internals.CMOF_Element; function MC_Utp_Test_Context return AMF.Internals.CMOF_Element; function MC_Utp_Test_Log return AMF.Internals.CMOF_Element; function MC_Utp_Test_Log_Application return AMF.Internals.CMOF_Element; function MC_Utp_Test_Objective return AMF.Internals.CMOF_Element; function MC_Utp_Test_Suite return AMF.Internals.CMOF_Element; function MC_Utp_Time_Out return AMF.Internals.CMOF_Element; function MC_Utp_Time_Out_Action return AMF.Internals.CMOF_Element; function MC_Utp_Time_Out_Message return AMF.Internals.CMOF_Element; function MC_Utp_Timer_Running_Action return AMF.Internals.CMOF_Element; function MC_Utp_Validation_Action return AMF.Internals.CMOF_Element; function MP_Utp_Coding_Rule_Base_Namespace_A_Extension_Coding_Rule return AMF.Internals.CMOF_Element; function MP_Utp_Coding_Rule_Base_Property_A_Extension_Coding_Rule return AMF.Internals.CMOF_Element; function MP_Utp_Coding_Rule_Base_Value_Specification_A_Extension_Coding_Rule return AMF.Internals.CMOF_Element; function MP_Utp_Coding_Rule_Coding return AMF.Internals.CMOF_Element; function MP_Utp_Data_Partition_Base_Classifier_A_Extension_Data_Partition return AMF.Internals.CMOF_Element; function MP_Utp_Data_Pool_Base_Classifier_A_Extension_Data_Pool return AMF.Internals.CMOF_Element; function MP_Utp_Data_Pool_Base_Property_A_Extension_Data_Pool return AMF.Internals.CMOF_Element; function MP_Utp_Data_Selector_Base_Operation_A_Extension_Data_Selector return AMF.Internals.CMOF_Element; function MP_Utp_Default_Base_Behavior_A_Extension_Default return AMF.Internals.CMOF_Element; function MP_Utp_Default_Application_Base_Dependency_A_Extension_Default_Application return AMF.Internals.CMOF_Element; function MP_Utp_Default_Application_Repetition return AMF.Internals.CMOF_Element; function MP_Utp_Determ_Alt_Base_Combined_Fragment_A_Extension_Determ_Alt return AMF.Internals.CMOF_Element; function MP_Utp_Finish_Action_Base_Invocation_Action_A_Extension_Finish_Action return AMF.Internals.CMOF_Element; function MP_Utp_Finish_Action_Base_Opaque_Action_A_Extension_Finish_Action return AMF.Internals.CMOF_Element; function MP_Utp_Get_Timezone_Action_Base_Read_Structural_Feature_Action_A_Extension_Get_Timezone_Action return AMF.Internals.CMOF_Element; function MP_Utp_Literal_Any_Base_Literal_Specification_A_Extension_Literal_Any return AMF.Internals.CMOF_Element; function MP_Utp_Literal_Any_Or_Null_Base_Literal_Specification_A_Extension_Literal_Any_Or_Null return AMF.Internals.CMOF_Element; function MP_Utp_Log_Action_Base_Send_Object_Action_A_Extension_Log_Action return AMF.Internals.CMOF_Element; function MP_Utp_Managed_Element_Base_Element_A_Extension_Managed_Element return AMF.Internals.CMOF_Element; function MP_Utp_Managed_Element_Criticality return AMF.Internals.CMOF_Element; function MP_Utp_Managed_Element_Description return AMF.Internals.CMOF_Element; function MP_Utp_Managed_Element_Owner return AMF.Internals.CMOF_Element; function MP_Utp_Managed_Element_Version return AMF.Internals.CMOF_Element; function MP_Utp_Read_Timer_Action_Base_Call_Operation_Action_A_Extension_Read_Timer_Action return AMF.Internals.CMOF_Element; function MP_Utp_SUT_Base_Property_A_Extension_SUT return AMF.Internals.CMOF_Element; function MP_Utp_Set_Timezone_Action_Base_Write_Structural_Feature_Action_A_Extension_Set_Timezone_Action return AMF.Internals.CMOF_Element; function MP_Utp_Start_Timer_Action_Base_Call_Operation_Action_A_Extension_Start_Timer_Action return AMF.Internals.CMOF_Element; function MP_Utp_Stop_Timer_Action_Base_Call_Operation_Action_A_Extension_Stop_Timer_Action return AMF.Internals.CMOF_Element; function MP_Utp_Test_Case_Base_Behavior_A_Extension_Test_Case return AMF.Internals.CMOF_Element; function MP_Utp_Test_Case_Base_Operation_A_Extension_Test_Case return AMF.Internals.CMOF_Element; function MP_Utp_Test_Case_Compatible_SUT_Variant return AMF.Internals.CMOF_Element; function MP_Utp_Test_Case_Compatible_SUT_Version return AMF.Internals.CMOF_Element; function MP_Utp_Test_Case_Priority return AMF.Internals.CMOF_Element; function MP_Utp_Test_Component_Base_Structured_Classifier_A_Extension_Test_Component return AMF.Internals.CMOF_Element; function MP_Utp_Test_Component_Compatible_SUT_Variant return AMF.Internals.CMOF_Element; function MP_Utp_Test_Component_Compatible_SUT_Version return AMF.Internals.CMOF_Element; function MP_Utp_Test_Context_Base_Behaviored_Classifier_A_Extension_Test_Context return AMF.Internals.CMOF_Element; function MP_Utp_Test_Context_Base_Structured_Classifier_A_Extension_Test_Context return AMF.Internals.CMOF_Element; function MP_Utp_Test_Context_Compatible_SUT_Variant return AMF.Internals.CMOF_Element; function MP_Utp_Test_Context_Compatible_SUT_Version return AMF.Internals.CMOF_Element; function MP_Utp_Test_Context_Test_Level return AMF.Internals.CMOF_Element; function MP_Utp_Test_Log_Base_Behavior_A_Extension_Test_Log return AMF.Internals.CMOF_Element; function MP_Utp_Test_Log_Duration return AMF.Internals.CMOF_Element; function MP_Utp_Test_Log_Executed_At return AMF.Internals.CMOF_Element; function MP_Utp_Test_Log_Sut_Version return AMF.Internals.CMOF_Element; function MP_Utp_Test_Log_Tester return AMF.Internals.CMOF_Element; function MP_Utp_Test_Log_Verdict return AMF.Internals.CMOF_Element; function MP_Utp_Test_Log_Verdict_Reason return AMF.Internals.CMOF_Element; function MP_Utp_Test_Log_Application_Base_Dependency_A_Extension_Test_Log_Application return AMF.Internals.CMOF_Element; function MP_Utp_Test_Objective_Base_Dependency_A_Extension_Test_Objective return AMF.Internals.CMOF_Element; function MP_Utp_Test_Objective_Priority return AMF.Internals.CMOF_Element; function MP_Utp_Test_Suite_Base_Behavior_A_Extension_Test_Suite return AMF.Internals.CMOF_Element; function MP_Utp_Test_Suite_Priority return AMF.Internals.CMOF_Element; function MP_Utp_Test_Suite_Test_Case return AMF.Internals.CMOF_Element; function MP_Utp_Time_Out_Base_Time_Event_A_Extension_Time_Out return AMF.Internals.CMOF_Element; function MP_Utp_Time_Out_Action_Base_Accept_Event_Action_A_Extension_Time_Out_Action return AMF.Internals.CMOF_Element; function MP_Utp_Time_Out_Message_Base_Message_A_Extension_Time_Out_Message return AMF.Internals.CMOF_Element; function MP_Utp_Timer_Running_Action_Base_Read_Structural_Feature_Action_A_Extension_Timer_Running_Action return AMF.Internals.CMOF_Element; function MP_Utp_Validation_Action_Base_Call_Operation_Action_A_Extension_Validation_Action return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_SUT_SUT_Base_Property return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Test_Context_Test_Context_Base_Behaviored_Classifier return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Data_Selector_Data_Selector_Base_Operation return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Validation_Action_Validation_Action_Base_Call_Operation_Action return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Time_Out_Time_Out_Base_Time_Event return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Managed_Element_Managed_Element_Base_Element return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Time_Out_Message_Time_Out_Message_Base_Message return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Test_Component_Test_Component_Base_Structured_Classifier return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Time_Out_Action_Time_Out_Action_Base_Accept_Event_Action return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Test_Suite_Test_Suite_Base_Behavior return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Test_Log_Test_Log_Base_Behavior return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Start_Timer_Action_Start_Timer_Action_Base_Call_Operation_Action return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Test_Context_Test_Context_Base_Structured_Classifier return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Test_Log_Application_Test_Log_Application_Base_Dependency return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Stop_Timer_Action_Stop_Timer_Action_Base_Call_Operation_Action return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Read_Timer_Action_Read_Timer_Action_Base_Call_Operation_Action return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Coding_Rule_Coding_Rule_Base_Value_Specification return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Timer_Running_Action_Timer_Running_Action_Base_Read_Structural_Feature_Action return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Coding_Rule_Coding_Rule_Base_Namespace return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Coding_Rule_Coding_Rule_Base_Property return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Get_Timezone_Action_Get_Timezone_Action_Base_Read_Structural_Feature_Action return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Test_Case_Test_Case_Base_Behavior return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Literal_Any_Literal_Any_Base_Literal_Specification return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Test_Case_Test_Case_Base_Operation return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Set_Timezone_Action_Set_Timezone_Action_Base_Write_Structural_Feature_Action return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Finish_Action_Finish_Action_Base_Opaque_Action return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Literal_Any_Or_Null_Literal_Any_Or_Null_Base_Literal_Specification return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Log_Action_Log_Action_Base_Send_Object_Action return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Test_Objective_Test_Objective_Base_Dependency return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Finish_Action_Finish_Action_Base_Invocation_Action return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Data_Pool_Data_Pool_Base_Classifier return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Default_Default_Base_Behavior return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Data_Pool_Data_Pool_Base_Property return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Determ_Alt_Determ_Alt_Base_Combined_Fragment return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Data_Partition_Data_Partition_Base_Classifier return AMF.Internals.CMOF_Element; function MP_Utp_A_Extension_Default_Application_Default_Application_Base_Dependency return AMF.Internals.CMOF_Element; function MA_Utp_SUT_Base_Property_Extension_SUT return AMF.Internals.CMOF_Element; function MA_Utp_Test_Context_Base_Behaviored_Classifier_Extension_Test_Context return AMF.Internals.CMOF_Element; function MA_Utp_Data_Selector_Base_Operation_Extension_Data_Selector return AMF.Internals.CMOF_Element; function MA_Utp_Validation_Action_Base_Call_Operation_Action_Extension_Validation_Action return AMF.Internals.CMOF_Element; function MA_Utp_Time_Out_Base_Time_Event_Extension_Time_Out return AMF.Internals.CMOF_Element; function MA_Utp_Managed_Element_Base_Element_Extension_Managed_Element return AMF.Internals.CMOF_Element; function MA_Utp_Time_Out_Message_Base_Message_Extension_Time_Out_Message return AMF.Internals.CMOF_Element; function MA_Utp_Test_Component_Base_Structured_Classifier_Extension_Test_Component return AMF.Internals.CMOF_Element; function MA_Utp_Time_Out_Action_Base_Accept_Event_Action_Extension_Time_Out_Action return AMF.Internals.CMOF_Element; function MA_Utp_Test_Suite_Base_Behavior_Extension_Test_Suite return AMF.Internals.CMOF_Element; function MA_Utp_Test_Log_Base_Behavior_Extension_Test_Log return AMF.Internals.CMOF_Element; function MA_Utp_Start_Timer_Action_Base_Call_Operation_Action_Extension_Start_Timer_Action return AMF.Internals.CMOF_Element; function MA_Utp_Test_Context_Base_Structured_Classifier_Extension_Test_Context return AMF.Internals.CMOF_Element; function MA_Utp_Test_Log_Application_Base_Dependency_Extension_Test_Log_Application return AMF.Internals.CMOF_Element; function MA_Utp_Stop_Timer_Action_Base_Call_Operation_Action_Extension_Stop_Timer_Action return AMF.Internals.CMOF_Element; function MA_Utp_Read_Timer_Action_Base_Call_Operation_Action_Extension_Read_Timer_Action return AMF.Internals.CMOF_Element; function MA_Utp_Coding_Rule_Base_Value_Specification_Extension_Coding_Rule return AMF.Internals.CMOF_Element; function MA_Utp_Timer_Running_Action_Base_Read_Structural_Feature_Action_Extension_Timer_Running_Action return AMF.Internals.CMOF_Element; function MA_Utp_Coding_Rule_Base_Namespace_Extension_Coding_Rule return AMF.Internals.CMOF_Element; function MA_Utp_Coding_Rule_Base_Property_Extension_Coding_Rule return AMF.Internals.CMOF_Element; function MA_Utp_Get_Timezone_Action_Base_Read_Structural_Feature_Action_Extension_Get_Timezone_Action return AMF.Internals.CMOF_Element; function MA_Utp_Test_Case_Base_Behavior_Extension_Test_Case return AMF.Internals.CMOF_Element; function MA_Utp_Literal_Any_Base_Literal_Specification_Extension_Literal_Any return AMF.Internals.CMOF_Element; function MA_Utp_Test_Case_Base_Operation_Extension_Test_Case return AMF.Internals.CMOF_Element; function MA_Utp_Set_Timezone_Action_Base_Write_Structural_Feature_Action_Extension_Set_Timezone_Action return AMF.Internals.CMOF_Element; function MA_Utp_Finish_Action_Base_Opaque_Action_Extension_Finish_Action return AMF.Internals.CMOF_Element; function MA_Utp_Literal_Any_Or_Null_Base_Literal_Specification_Extension_Literal_Any_Or_Null return AMF.Internals.CMOF_Element; function MA_Utp_Log_Action_Base_Send_Object_Action_Extension_Log_Action return AMF.Internals.CMOF_Element; function MA_Utp_Test_Objective_Base_Dependency_Extension_Test_Objective return AMF.Internals.CMOF_Element; function MA_Utp_Finish_Action_Base_Invocation_Action_Extension_Finish_Action return AMF.Internals.CMOF_Element; function MA_Utp_Data_Pool_Base_Classifier_Extension_Data_Pool return AMF.Internals.CMOF_Element; function MA_Utp_Default_Base_Behavior_Extension_Default return AMF.Internals.CMOF_Element; function MA_Utp_Data_Pool_Base_Property_Extension_Data_Pool return AMF.Internals.CMOF_Element; function MA_Utp_Determ_Alt_Base_Combined_Fragment_Extension_Determ_Alt return AMF.Internals.CMOF_Element; function MA_Utp_Data_Partition_Base_Classifier_Extension_Data_Partition return AMF.Internals.CMOF_Element; function MA_Utp_Default_Application_Base_Dependency_Extension_Default_Application return AMF.Internals.CMOF_Element; function MB_Utp return AMF.Internals.AMF_Element; function ML_Utp return AMF.Internals.AMF_Element; private Base : AMF.Internals.CMOF_Element := 0; end AMF.Internals.Tables.Utp_Metamodel;
godunko/adagl
Ada
14,976
ads
------------------------------------------------------------------------------ -- -- -- Ada binding for OpenGL/WebGL -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2016-2020, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with System.Storage_Elements; with Web.Strings; private with Web.GL.Programs; package OpenGL.Programs is pragma Preelaborate; type OpenGL_Program is tagged limited private; type OpenGL_Program_Access is access all OpenGL_Program'Class; function Add_Shader_From_Source_Code (Self : in out OpenGL_Program'Class; Shader_Type : OpenGL.Shader_Type; Source : Web.Strings.Web_String) return Boolean; -- Compiles source as a shader of the specified type and adds it to this -- shader program. Returns True if compilation was successful, False -- otherwise. The compilation errors and warnings will be made available -- via Log. procedure Add_Shader_From_Source_Code (Self : in out OpenGL_Program'Class; Shader_Type : OpenGL.Shader_Type; Source : Web.Strings.Web_String); -- Compiles source as a shader of the specified type and adds it to this -- shader program. Raise Program_Error if compilation was not successful. -- The compilation errors and warnings will be made available via Log. function Attribute_Location (Self : in out OpenGL_Program'Class; Name : Web.Strings.Web_String) return OpenGL.Attribute_Location; -- Returns the location of the attribute Name within this shader program's -- parameter list. Returns -1 if name is not a valid attribute for this -- shader program. function Bind (Self : in out OpenGL_Program'Class) return Boolean; -- Binds this shader program to the active OpenGL_Context and makes it the -- current shader program. Any previously bound shader program is released. -- This is equivalent to calling glUseProgram(). procedure Bind (Self : in out OpenGL_Program'Class); -- Binds this shader program to the active OpenGL_Context and makes it the -- current shader program. Any previously bound shader program is released. -- This is equivalent to calling glUseProgram(). function Create (Self : in out OpenGL_Program'Class) return Boolean; -- Requests the shader program's id to be created immediately. Returns true -- if successful; false otherwise. procedure Disable_Attribute_Array (Self : in out OpenGL_Program'Class; Location : OpenGL.Attribute_Location); -- Disables the vertex array at Location in this shader program that was -- enabled by a previous call to Enable_Attribute_Array. procedure Disable_Attribute_Array (Self : in out OpenGL_Program'Class; Name : Web.Strings.Web_String); -- Disables the vertex array called name in this shader program that was -- enabled by a previous call to Enable_Attribute_Array. procedure Enable_Attribute_Array (Self : in out OpenGL_Program'Class; Location : OpenGL.Attribute_Location); -- Enables the vertex array at Location in this shader program so that the -- value set by Set_Attribute_Array on Location will be used by the shader -- program. procedure Enable_Attribute_Array (Self : in out OpenGL_Program'Class; Name : Web.Strings.Web_String); -- Enables the vertex array called Name in this shader program so that the -- value set by Set_Attribute_Array on Name will be used by the shader -- program. function Is_Linked (Self : OpenGL_Program'Class) return Boolean; -- Returns true if this shader program has been linked; false otherwise. not overriding function Link (Self : in out OpenGL_Program) return Boolean; -- Links together the shaders that were added to this program with -- Add_Shader. Returns True if the link was successful or False otherwise. -- If the link failed, the error messages can be retrieved with Log. function Log (Self : OpenGL_Program'Class) return Web.Strings.Web_String; -- Returns the errors and warnings that occurred during the last Link or -- Add_Shader_From_Source_Code with explicitly specified source code. procedure Release (Self : OpenGL_Program'Class); -- Releases the active shader program from the current OpenGL_Context. This -- is equivalent to calling glUseProgram(0). procedure Set_Attribute_Buffer (Self : in out OpenGL_Program'Class; Location : OpenGL.Attribute_Location; Data_Type : OpenGL.GLenum; Tuple_Size : Positive; Offset : System.Storage_Elements.Storage_Count := 0; Stride : System.Storage_Elements.Storage_Count := 0; Normalized : Boolean := True); -- Sets an array of vertex values on the attribute at Location in this -- shader program, starting at a specific Offset in the currently bound -- vertex buffer. The Stride indicates the number of bytes between -- vertices. A default Stride value of zero indicates that the vertices are -- densely packed in the value array. -- -- The Data_Type indicates the type of elements in the vertex value array, -- usually GL_FLOAT, GL_UNSIGNED_BYTE, etc. The Tuple_Size indicates the -- number of components per vertex: 1, 2, 3, or 4. -- -- The array will become active when Enable_Attribute_Array is called on -- the Location. Otherwise the value specified with Set_Attribute_Value for -- Location will be used. procedure Set_Attribute_Buffer (Self : in out OpenGL_Program'Class; Name : Web.Strings.Web_String; Data_Type : OpenGL.GLenum; Tuple_Size : Positive; Offset : System.Storage_Elements.Storage_Count := 0; Stride : System.Storage_Elements.Storage_Count := 0; Normalized : Boolean := True); -- Sets an array of vertex values on the attribute called Name in this -- shader program, starting at a specific Offset in the currently bound -- vertex buffer. The Stride indicates the number of bytes between -- vertices. A default stride value of zero indicates that the vertices are -- densely packed in the value array. -- -- The Data_Type indicates the type of elements in the vertex value array, -- usually GL_FLOAT, GL_UNSIGNED_BYTE, etc. The Tuple_Size indicates the -- number of components per vertex: 1, 2, 3, or 4. -- -- The array will become active when Enable_Attribute_Array is called on -- the Name. Otherwise the value specified with Set_Attribute_Value for -- Name will be used. procedure Set_Attribute_Value (Self : in out OpenGL_Program'Class; Location : OpenGL.Attribute_Location; Value : OpenGL.GLfloat); procedure Set_Attribute_Value (Self : in out OpenGL_Program'Class; Location : OpenGL.Attribute_Location; Value : OpenGL.GLfloat_Vector_2); procedure Set_Attribute_Value (Self : in out OpenGL_Program'Class; Location : OpenGL.Attribute_Location; Value : OpenGL.GLfloat_Vector_3); procedure Set_Attribute_Value (Self : in out OpenGL_Program'Class; Location : OpenGL.Attribute_Location; Value : OpenGL.GLfloat_Vector_4); procedure Set_Attribute_Value (Self : in out OpenGL_Program'Class; Location : OpenGL.Attribute_Location; Value : OpenGL.GLfloat_Matrix_2x2); procedure Set_Attribute_Value (Self : in out OpenGL_Program'Class; Location : OpenGL.Attribute_Location; Value : OpenGL.GLfloat_Matrix_3x3); procedure Set_Attribute_Value (Self : in out OpenGL_Program'Class; Location : OpenGL.Attribute_Location; Value : OpenGL.GLfloat_Matrix_4x4); -- Sets the attribute at Location in the current context to Value. procedure Set_Attribute_Value (Self : in out OpenGL_Program'Class; Name : Web.Strings.Web_String; Value : OpenGL.GLfloat); procedure Set_Attribute_Value (Self : in out OpenGL_Program'Class; Name : Web.Strings.Web_String; Value : OpenGL.GLfloat_Vector_2); procedure Set_Attribute_Value (Self : in out OpenGL_Program'Class; Name : Web.Strings.Web_String; Value : OpenGL.GLfloat_Vector_3); procedure Set_Attribute_Value (Self : in out OpenGL_Program'Class; Name : Web.Strings.Web_String; Value : OpenGL.GLfloat_Vector_4); procedure Set_Attribute_Value (Self : in out OpenGL_Program'Class; Name : Web.Strings.Web_String; Value : OpenGL.GLfloat_Matrix_2x2); procedure Set_Attribute_Value (Self : in out OpenGL_Program'Class; Name : Web.Strings.Web_String; Value : OpenGL.GLfloat_Matrix_3x3); procedure Set_Attribute_Value (Self : in out OpenGL_Program'Class; Name : Web.Strings.Web_String; Value : OpenGL.GLfloat_Matrix_4x4); -- Sets the attribute called Name in the current context to Value. procedure Set_Uniform_Value (Self : in out OpenGL_Program'Class; Location : OpenGL.Uniform_Location; Value : OpenGL.GLint); procedure Set_Uniform_Value (Self : in out OpenGL_Program'Class; Location : OpenGL.Uniform_Location; Value : OpenGL.Glfloat); procedure Set_Uniform_Value (Self : in out OpenGL_Program'Class; Location : OpenGL.Uniform_Location; Value : OpenGL.Glfloat_Vector_2); procedure Set_Uniform_Value (Self : in out OpenGL_Program'Class; Location : OpenGL.Uniform_Location; Value : OpenGL.Glfloat_Vector_3); procedure Set_Uniform_Value (Self : in out OpenGL_Program'Class; Location : OpenGL.Uniform_Location; Value : OpenGL.Glfloat_Vector_4); procedure Set_Uniform_Value (Self : in out OpenGL_Program'Class; Location : OpenGL.Uniform_Location; Value : OpenGL.Glfloat_Matrix_2x2); procedure Set_Uniform_Value (Self : in out OpenGL_Program'Class; Location : OpenGL.Uniform_Location; Value : OpenGL.Glfloat_Matrix_3x3); procedure Set_Uniform_Value (Self : in out OpenGL_Program'Class; Location : OpenGL.Uniform_Location; Value : OpenGL.Glfloat_Matrix_4x4); -- Sets the uniform variable at Location in the current context to Value. procedure Set_Uniform_Value (Self : in out OpenGL_Program'Class; Name : Web.Strings.Web_String; Value : OpenGL.GLint); procedure Set_Uniform_Value (Self : in out OpenGL_Program'Class; Name : Web.Strings.Web_String; Value : OpenGL.Glfloat); procedure Set_Uniform_Value (Self : in out OpenGL_Program'Class; Name : Web.Strings.Web_String; Value : OpenGL.Glfloat_Vector_2); procedure Set_Uniform_Value (Self : in out OpenGL_Program'Class; Name : Web.Strings.Web_String; Value : OpenGL.Glfloat_Vector_3); procedure Set_Uniform_Value (Self : in out OpenGL_Program'Class; Name : Web.Strings.Web_String; Value : OpenGL.Glfloat_Vector_4); procedure Set_Uniform_Value (Self : in out OpenGL_Program'Class; Name : Web.Strings.Web_String; Value : OpenGL.Glfloat_Matrix_2x2); procedure Set_Uniform_Value (Self : in out OpenGL_Program'Class; Name : Web.Strings.Web_String; Value : OpenGL.Glfloat_Matrix_3x3); procedure Set_Uniform_Value (Self : in out OpenGL_Program'Class; Name : Web.Strings.Web_String; Value : OpenGL.Glfloat_Matrix_4x4); -- Sets the uniform variable called Name in the current context to Value. function Uniform_Location (Self : in out OpenGL_Program'Class; Name : Web.Strings.Web_String) return OpenGL.Uniform_Location; -- Returns the location of the uniform variable Name within this shader -- program's parameter list. Returns No_Uniform_Location if Name is not a -- valid uniform variable for this shader program. private type OpenGL_Program is tagged limited record Program : Web.GL.Programs.WebGL_Program; Context : Web.GL.Rendering_Contexts.WebGL_Rendering_Context; Log : Web.Strings.Web_String; end record; end OpenGL.Programs;
reznikmm/matreshka
Ada
4,741
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Visitors; with ODF.DOM.Style_Master_Page_Elements; package Matreshka.ODF_Style.Master_Page_Elements is type Style_Master_Page_Element_Node is new Matreshka.ODF_Style.Abstract_Style_Element_Node and ODF.DOM.Style_Master_Page_Elements.ODF_Style_Master_Page with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Style_Master_Page_Element_Node; overriding function Get_Local_Name (Self : not null access constant Style_Master_Page_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Style_Master_Page_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Style_Master_Page_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Style_Master_Page_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Style.Master_Page_Elements;
reznikmm/matreshka
Ada
3,684
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Text_Isbn_Attributes is pragma Preelaborate; type ODF_Text_Isbn_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Text_Isbn_Attribute_Access is access all ODF_Text_Isbn_Attribute'Class with Storage_Size => 0; end ODF.DOM.Text_Isbn_Attributes;
reznikmm/matreshka
Ada
4,615
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Smil.FillDefault_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Smil_FillDefault_Attribute_Node is begin return Self : Smil_FillDefault_Attribute_Node do Matreshka.ODF_Smil.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Smil_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Smil_FillDefault_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.FillDefault_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Smil_URI, Matreshka.ODF_String_Constants.FillDefault_Attribute, Smil_FillDefault_Attribute_Node'Tag); end Matreshka.ODF_Smil.FillDefault_Attributes;
reznikmm/matreshka
Ada
3,674
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Elements; package ODF.DOM.Text_Printed_By_Elements is pragma Preelaborate; type ODF_Text_Printed_By is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Text_Printed_By_Access is access all ODF_Text_Printed_By'Class with Storage_Size => 0; end ODF.DOM.Text_Printed_By_Elements;
ekoeppen/STM32_Generic_Ada_Drivers
Ada
6,646
ads
pragma Style_Checks (Off); -- This spec has been automatically generated from STM32L0x3.svd pragma Restrictions (No_Elaboration_Code); with System; package STM32_SVD.MPU is pragma Preelaborate; --------------- -- Registers -- --------------- subtype MPU_TYPER_SEPARATE_Field is STM32_SVD.Bit; subtype MPU_TYPER_DREGION_Field is STM32_SVD.Byte; subtype MPU_TYPER_IREGION_Field is STM32_SVD.Byte; -- MPU type register type MPU_TYPER_Register is record -- Read-only. Separate flag SEPARATE_k : MPU_TYPER_SEPARATE_Field; -- unspecified Reserved_1_7 : STM32_SVD.UInt7; -- Read-only. Number of MPU data regions DREGION : MPU_TYPER_DREGION_Field; -- Read-only. Number of MPU instruction regions IREGION : MPU_TYPER_IREGION_Field; -- unspecified Reserved_24_31 : STM32_SVD.Byte; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MPU_TYPER_Register use record SEPARATE_k at 0 range 0 .. 0; Reserved_1_7 at 0 range 1 .. 7; DREGION at 0 range 8 .. 15; IREGION at 0 range 16 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype MPU_CTRL_ENABLE_Field is STM32_SVD.Bit; subtype MPU_CTRL_HFNMIENA_Field is STM32_SVD.Bit; subtype MPU_CTRL_PRIVDEFENA_Field is STM32_SVD.Bit; -- MPU control register type MPU_CTRL_Register is record -- Read-only. Enables the MPU ENABLE : MPU_CTRL_ENABLE_Field; -- Read-only. Enables the operation of MPU during hard fault HFNMIENA : MPU_CTRL_HFNMIENA_Field; -- Read-only. Enable priviliged software access to default memory map PRIVDEFENA : MPU_CTRL_PRIVDEFENA_Field; -- unspecified Reserved_3_31 : STM32_SVD.UInt29; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MPU_CTRL_Register use record ENABLE at 0 range 0 .. 0; HFNMIENA at 0 range 1 .. 1; PRIVDEFENA at 0 range 2 .. 2; Reserved_3_31 at 0 range 3 .. 31; end record; subtype MPU_RNR_REGION_Field is STM32_SVD.Byte; -- MPU region number register type MPU_RNR_Register is record -- MPU region REGION : MPU_RNR_REGION_Field := 16#0#; -- unspecified Reserved_8_31 : STM32_SVD.UInt24 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MPU_RNR_Register use record REGION at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype MPU_RBAR_REGION_Field is STM32_SVD.UInt4; subtype MPU_RBAR_VALID_Field is STM32_SVD.Bit; subtype MPU_RBAR_ADDR_Field is STM32_SVD.UInt27; -- MPU region base address register type MPU_RBAR_Register is record -- MPU region field REGION : MPU_RBAR_REGION_Field := 16#0#; -- MPU region number valid VALID : MPU_RBAR_VALID_Field := 16#0#; -- Region base address field ADDR : MPU_RBAR_ADDR_Field := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MPU_RBAR_Register use record REGION at 0 range 0 .. 3; VALID at 0 range 4 .. 4; ADDR at 0 range 5 .. 31; end record; subtype MPU_RASR_ENABLE_Field is STM32_SVD.Bit; subtype MPU_RASR_SIZE_Field is STM32_SVD.UInt5; subtype MPU_RASR_SRD_Field is STM32_SVD.Byte; subtype MPU_RASR_B_Field is STM32_SVD.Bit; subtype MPU_RASR_C_Field is STM32_SVD.Bit; subtype MPU_RASR_S_Field is STM32_SVD.Bit; subtype MPU_RASR_TEX_Field is STM32_SVD.UInt3; subtype MPU_RASR_AP_Field is STM32_SVD.UInt3; subtype MPU_RASR_XN_Field is STM32_SVD.Bit; -- MPU region attribute and size register type MPU_RASR_Register is record -- Region enable bit. ENABLE : MPU_RASR_ENABLE_Field := 16#0#; -- Size of the MPU protection region SIZE : MPU_RASR_SIZE_Field := 16#0#; -- unspecified Reserved_6_7 : STM32_SVD.UInt2 := 16#0#; -- Subregion disable bits SRD : MPU_RASR_SRD_Field := 16#0#; -- memory attribute B : MPU_RASR_B_Field := 16#0#; -- memory attribute C : MPU_RASR_C_Field := 16#0#; -- Shareable memory attribute S : MPU_RASR_S_Field := 16#0#; -- memory attribute TEX : MPU_RASR_TEX_Field := 16#0#; -- unspecified Reserved_22_23 : STM32_SVD.UInt2 := 16#0#; -- Access permission AP : MPU_RASR_AP_Field := 16#0#; -- unspecified Reserved_27_27 : STM32_SVD.Bit := 16#0#; -- Instruction access disable bit XN : MPU_RASR_XN_Field := 16#0#; -- unspecified Reserved_29_31 : STM32_SVD.UInt3 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MPU_RASR_Register use record ENABLE at 0 range 0 .. 0; SIZE at 0 range 1 .. 5; Reserved_6_7 at 0 range 6 .. 7; SRD at 0 range 8 .. 15; B at 0 range 16 .. 16; C at 0 range 17 .. 17; S at 0 range 18 .. 18; TEX at 0 range 19 .. 21; Reserved_22_23 at 0 range 22 .. 23; AP at 0 range 24 .. 26; Reserved_27_27 at 0 range 27 .. 27; XN at 0 range 28 .. 28; Reserved_29_31 at 0 range 29 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Memory protection unit type MPU_Peripheral is record -- MPU type register MPU_TYPER : aliased MPU_TYPER_Register; -- MPU control register MPU_CTRL : aliased MPU_CTRL_Register; -- MPU region number register MPU_RNR : aliased MPU_RNR_Register; -- MPU region base address register MPU_RBAR : aliased MPU_RBAR_Register; -- MPU region attribute and size register MPU_RASR : aliased MPU_RASR_Register; end record with Volatile; for MPU_Peripheral use record MPU_TYPER at 16#0# range 0 .. 31; MPU_CTRL at 16#4# range 0 .. 31; MPU_RNR at 16#8# range 0 .. 31; MPU_RBAR at 16#C# range 0 .. 31; MPU_RASR at 16#10# range 0 .. 31; end record; -- Memory protection unit MPU_Periph : aliased MPU_Peripheral with Import, Address => MPU_Base; end STM32_SVD.MPU;
reznikmm/matreshka
Ada
7,779
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010-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.Unchecked_Deallocation; package body Matreshka.Internals.XML.Attributes is procedure Free is new Ada.Unchecked_Deallocation (Attribute_Array, Attribute_Array_Access); ----------- -- Clear -- ----------- procedure Clear (Self : in out Attribute_Set) is begin for J in Self.Attributes'First .. Self.Last loop Matreshka.Internals.Strings.Dereference (Self.Attributes (J).Value); end loop; Self.Last := 0; end Clear; -------------- -- Finalize -- -------------- procedure Finalize (Self : in out Attribute_Set) is begin Clear (Self); Free (Self.Attributes); end Finalize; ---------------- -- Initialize -- ---------------- procedure Initialize (Self : in out Attribute_Set) is begin Self.Attributes := new Attribute_Array (1 .. 16); Self.Last := 0; end Initialize; ------------ -- Insert -- ------------ procedure Insert (Self : in out Attribute_Set; Qualified_Name : Symbol_Identifier; Value : not null Matreshka.Internals.Strings.Shared_String_Access; Type_Name : Symbol_Identifier; Is_Specified : Boolean; Inserted : out Boolean) is begin for J in Self.Attributes'First .. Self.Last loop if Self.Attributes (J).Qualified_Name = Qualified_Name then Inserted := False; return; end if; end loop; Matreshka.Internals.Strings.Reference (Value); Inserted := True; Self.Last := Self.Last + 1; if Self.Last > Self.Attributes'Last then declare Old : Attribute_Array_Access := Self.Attributes; begin Self.Attributes := new Attribute_Array (1 .. Old'Last + 16); Self.Attributes (Old'Range) := Old.all; Free (Old); end; end if; Self.Attributes (Self.Last) := (Namespace_URI => No_Symbol, Qualified_Name => Qualified_Name, Value => Value, Type_Name => Type_Name, Is_Declared => False, Is_Specified => Is_Specified); end Insert; ----------------- -- Is_Declared -- ----------------- function Is_Declared (Self : Attribute_Set; Index : Positive) return Boolean is begin return Self.Attributes (Index).Is_Declared; end Is_Declared; ------------------ -- Is_Specified -- ------------------ function Is_Specified (Self : Attribute_Set; Index : Positive) return Boolean is begin return Self.Attributes (Index).Is_Specified; end Is_Specified; ------------ -- Length -- ------------ function Length (Self : Attribute_Set) return Natural is begin return Self.Last; end Length; ------------------- -- Namespace_URI -- ------------------- function Namespace_URI (Self : Attribute_Set; Index : Positive) return Symbol_Identifier is begin return Self.Attributes (Index).Namespace_URI; end Namespace_URI; -------------------- -- Qualified_Name -- -------------------- function Qualified_Name (Self : Attribute_Set; Index : Positive) return Symbol_Identifier is begin return Self.Attributes (Index).Qualified_Name; end Qualified_Name; --------------------- -- Set_Is_Declared -- --------------------- procedure Set_Is_Declared (Self : in out Attribute_Set; Index : Positive) is begin Self.Attributes (Index).Is_Declared := True; end Set_Is_Declared; ----------------------- -- Set_Namespace_URI -- ----------------------- procedure Set_Namespace_URI (Self : Attribute_Set; Index : Positive; Namespace_URI : Symbol_Identifier) is begin Self.Attributes (Index).Namespace_URI := Namespace_URI; end Set_Namespace_URI; --------------- -- Type_Name -- --------------- function Type_Name (Self : Attribute_Set; Index : Positive) return Symbol_Identifier is begin return Self.Attributes (Index).Type_Name; end Type_Name; ----------- -- Value -- ----------- function Value (Self : Attribute_Set; Index : Positive) return not null Matreshka.Internals.Strings.Shared_String_Access is begin return Self.Attributes (Index).Value; end Value; end Matreshka.Internals.XML.Attributes;
apsdehal/Programming-Languages-Assignments
Ada
1,593
adb
with Text_IO; use Text_IO; package body AdaptiveQuad is function SimpsonsRule(A, B: in Float) return Float is C: Float := (A + B) / 2.0; H3: Float := (abs (B - A)) / 6.0; begin return H3 * (F(A) + 4.0 * F(C) + F(B)); end SimpsonsRule; function RecAQuad(A, B, Eps, Whole: in Float) return Float is C: Float := (A + B) / 2.0; Left: Float; Right: Float; task type AQuadTask is entry Start(A, B, Eps, Whole: in Float); entry Get(ResultIn: out Float); end AQuadTask; task body AQuadTask is StartP: Float; EndP: Float; Epsilon: Float; Full: Float; Result: Float; begin select accept Start(A, B, Eps, Whole: in Float) do StartP:= A; EndP:= B; Epsilon:= Eps; Full:= Whole; end Start; or terminate; end select; Result:= RecAQuad(StartP, EndP, Epsilon, Full); select accept Get(ResultIn: out Float) do ResultIn:= Result; end Get; or terminate; end select; end AQuadTask; TLeft: AQuadTask; TRight: AQuadTask; LeftResult: Float; RightResult: Float; begin Left:= SimpsonsRule(A, C); Right:= SimpsonsRule(C, B); if (abs (Left + Right - Whole)) <= (15.0 * eps) then return Left + Right + ((Left + Right - Whole) / 15.0); else TLeft.Start(A, C, Eps / 2.0, Left); TRight.Start(C, B, Eps / 2.0, Right); TLeft.Get(LeftResult); TRight.Get(RightResult); return LeftResult + RightResult; end if; end RecAQuad; function AQuad(A, B, Eps: in Float) return Float is begin return RecAQuad(A, B, Eps, SimpsonsRule(A, B)); end AQuad; end AdaptiveQuad;
mirror/ncurses
Ada
5,727
adb
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- Sample.Curses_Demo.Attributes -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright 2020 Thomas E. Dickey -- -- Copyright 1998-2002,2003 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control -- $Revision: 1.14 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels; with Sample.Manifest; use Sample.Manifest; with Sample.Function_Key_Setting; use Sample.Function_Key_Setting; with Sample.Keyboard_Handler; use Sample.Keyboard_Handler; with Sample.Explanation; use Sample.Explanation; package body Sample.Curses_Demo.Attributes is procedure Demo is P : Panel := Create (Standard_Window); K : Real_Key_Code; begin Set_Meta_Mode; Set_KeyPad_Mode; Top (P); Push_Environment ("ATTRIBDEMO"); Default_Labels; Notepad ("ATTRIB-PAD00"); Set_Character_Attributes (Attr => (others => False)); Add (Line => 1, Column => Columns / 2 - 10, Str => "This is NORMAL"); Set_Character_Attributes (Attr => (Stand_Out => True, others => False)); Add (Line => 2, Column => Columns / 2 - 10, Str => "This is Stand_Out"); Set_Character_Attributes (Attr => (Under_Line => True, others => False)); Add (Line => 3, Column => Columns / 2 - 10, Str => "This is Under_Line"); Set_Character_Attributes (Attr => (Reverse_Video => True, others => False)); Add (Line => 4, Column => Columns / 2 - 10, Str => "This is Reverse_Video"); Set_Character_Attributes (Attr => (Blink => True, others => False)); Add (Line => 5, Column => Columns / 2 - 10, Str => "This is Blink"); Set_Character_Attributes (Attr => (Dim_Character => True, others => False)); Add (Line => 6, Column => Columns / 2 - 10, Str => "This is Dim_Character"); Set_Character_Attributes (Attr => (Bold_Character => True, others => False)); Add (Line => 7, Column => Columns / 2 - 10, Str => "This is Bold_Character"); Refresh_Without_Update; Update_Panels; Update_Screen; loop K := Get_Key; if K in Special_Key_Code'Range then case K is when QUIT_CODE => exit; when HELP_CODE => Explain_Context; when EXPLAIN_CODE => Explain ("ATTRIBKEYS"); when others => null; end case; end if; end loop; Pop_Environment; Clear; Refresh_Without_Update; Delete (P); Update_Panels; Update_Screen; end Demo; end Sample.Curses_Demo.Attributes;
reznikmm/matreshka
Ada
8,148
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- SQL Database Access -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ private with Ada.Containers.Hashed_Maps; private with System.Storage_Elements; private with League.Strings.Hash; with Matreshka.Internals.SQL_Drivers.Oracle.Databases; private with Matreshka.Internals.Strings; limited with Matreshka.Internals.SQL_Drivers.Oracle.Plug_In; with Matreshka.Internals.SQL_Drivers.Oracle.Utils; package Matreshka.Internals.SQL_Drivers.Oracle.Queries is type OCI_Database_Access is access all Databases.OCI_Database; type OCI_Query (DB : not null access Databases.OCI_Database) is new Abstract_Query with private; private type Plug_In_Access is access all Matreshka.Internals.SQL_Drivers.Oracle.Plug_In.Abstract_Plug_In'Class; type Bound_Value_Node (Length : System.Storage_Elements.Storage_Count) is limited record Value : League.Holders.Holder; Bind : aliased Oracle.Bind; Is_Null : aliased Sb2; String_Size : aliased Ub4; String : Matreshka.Internals.Strings.Shared_String_Access; Int : aliased League.Holders.Universal_Integer; Float : aliased League.Holders.Universal_Float; Date : aliased Oracle.Utils.OCIDate; Timestamp : aliased Date_Time; Direction : SQL.Parameter_Directions; Plugin : Plug_In_Access; Extra_Type : Data_Type; Extra_Size : System.Storage_Elements.Storage_Count; Extra : System.Storage_Elements.Storage_Array (1 .. Length); end record; type Bound_Value_Access is access Bound_Value_Node; package Parameter_Maps is new Ada.Containers.Hashed_Maps (League.Strings.Universal_String, Bound_Value_Access, League.Strings.Hash, League.Strings."="); -- XXX Database independent parameter mapping must be extended and reused -- here. type Column_Types is (String_Column, Integer_Column, Float_Column, Date_Column, Time_Column); type Storage_Array_Access is access all System.Storage_Elements.Storage_Array; type Defined_Value is limited record Column_Type : Column_Types; Define : aliased Oracle.Define; Is_Null : aliased Sb2; Size : Utf16.Utf16_String_Index; String : Matreshka.Internals.Strings.Shared_String_Access; Int : aliased League.Holders.Universal_Integer; Float : aliased League.Holders.Universal_Float; Date : aliased Oracle.Utils.OCIDate; Timestamp : aliased Date_Time; Plugin : Plug_In_Access; Extra_Type : Data_Type; Extra_Size : System.Storage_Elements.Storage_Count; Extra : Storage_Array_Access; end record; type Defined_Value_Array is array (Positive range <>) of Defined_Value; type Defined_Value_Array_Access is access Defined_Value_Array; type Query_States is (Created, Prepared, Executed, Has_Row, No_More_Rows); subtype Active is Query_States range Executed .. No_More_Rows; subtype Fetching is Query_States range Executed .. Has_Row; subtype Ready is Query_States range Prepared .. No_More_Rows; type OCI_Query (DB : not null access Databases.OCI_Database) is new Abstract_Query with record Handle : aliased Statement_Handle; Column_Count : Natural := 0; State : Query_States := Created; Is_Described : Boolean := False; Is_Select : Boolean := False; Parameters : Parameter_Maps.Map; Columns : Defined_Value_Array_Access; end record; overriding procedure Bind_Value (Self : not null access OCI_Query; Name : League.Strings.Universal_String; Value : League.Holders.Holder; Direction : SQL.Parameter_Directions); overriding function Bound_Value (Self : not null access OCI_Query; Name : League.Strings.Universal_String) return League.Holders.Holder; overriding function Error_Message (Self : not null access OCI_Query) return League.Strings.Universal_String; overriding function Execute (Self : not null access OCI_Query) return Boolean; overriding procedure Finish (Self : not null access OCI_Query); overriding procedure Invalidate (Self : not null access OCI_Query); overriding function Is_Active (Self : not null access OCI_Query) return Boolean; overriding function Is_Valid (Self : not null access OCI_Query) return Boolean; overriding function Next (Self : not null access OCI_Query) return Boolean; overriding function Prepare (Self : not null access OCI_Query; Query : League.Strings.Universal_String) return Boolean; overriding function Value (Self : not null access OCI_Query; Index : Positive) return League.Holders.Holder; end Matreshka.Internals.SQL_Drivers.Oracle.Queries;
tum-ei-rcs/StratoX
Ada
6,782
ads
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015-2016, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of STMicroelectronics nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- -- -- -- This file is based on: -- -- -- -- @file stm32f4xx_hal_i2c.h -- -- @author MCD Application Team -- -- @version V1.1.0 -- -- @date 19-June-2014 -- -- @brief Header file of I2C HAL module. -- -- -- -- COPYRIGHT(c) 2014 STMicroelectronics -- ------------------------------------------------------------------------------ -- This file provides definitions for the STM32F4 (ARM Cortex M4F -- from ST Microelectronics) Inter-Integrated Circuit (I2C) facility. private with STM32_SVD.I2C; with HAL.I2C; package STM32.I2C is type I2C_Device_Mode is (I2C_Mode, SMBusDevice_Mode, SMBusHost_Mode); type I2C_Duty_Cycle is (DutyCycle_16_9, DutyCycle_2); type I2C_Acknowledgement is (Ack_Disable, Ack_Enable); type I2C_Direction is (Transmitter, Receiver); type I2C_Addressing_Mode is (Addressing_Mode_7bit, Addressing_Mode_10bit); type I2C_Configuration is record Clock_Speed : Word; Mode : I2C_Device_Mode := I2C_Mode; Duty_Cycle : I2C_Duty_Cycle := DutyCycle_2; Addressing_Mode : I2C_Addressing_Mode; Own_Address : UInt10; -- an I2C general call dispatches the same data to all connected -- devices. General_Call_Enabled : Boolean := False; -- Clock stretching is a mean for a slave device to slow down the -- i2c clock in order to process the communication. Clock_Stretching_Enabled : Boolean := True; end record; type Internal_I2C_Port is private; type I2C_Port (Periph : not null access Internal_I2C_Port) is limited new HAL.I2C.I2C_Port with private; procedure Configure (Handle : in out I2C_Port; Conf : I2C_Configuration) with Post => Port_Enabled (Handle); procedure Set_State (This : in out I2C_Port; Enabled : Boolean); function Port_Enabled (This : I2C_Port) return Boolean; overriding procedure Master_Transmit (Handle : in out I2C_Port; Addr : HAL.I2C.I2C_Address; Data : HAL.I2C.I2C_Data; Status : out HAL.I2C.I2C_Status; Timeout : Natural := 1000); overriding procedure Master_Receive (Handle : in out I2C_Port; Addr : HAL.I2C.I2C_Address; Data : out HAL.I2C.I2C_Data; Status : out HAL.I2C.I2C_Status; Timeout : Natural := 1000); overriding procedure Mem_Write (Handle : in out I2C_Port; Addr : HAL.I2C.I2C_Address; Mem_Addr : Short; Mem_Addr_Size : HAL.I2C.I2C_Memory_Address_Size; Data : HAL.I2C.I2C_Data; Status : out HAL.I2C.I2C_Status; Timeout : Natural := 1000); overriding procedure Mem_Read (Handle : in out I2C_Port; Addr : HAL.I2C.I2C_Address; Mem_Addr : Short; Mem_Addr_Size : HAL.I2C.I2C_Memory_Address_Size; Data : out HAL.I2C.I2C_Data; Status : out HAL.I2C.I2C_Status; Timeout : Natural := 1000); type I2C_Interrupt is (Error_Interrupt, Event_Interrupt, Buffer_Interrupt); procedure Enable_Interrupt (This : in out I2C_Port; Source : I2C_Interrupt) with Post => Enabled (This, Source); procedure Disable_Interrupt (This : in out I2C_Port; Source : I2C_Interrupt) with Post => not Enabled (This, Source); function Enabled (This : I2C_Port; Source : I2C_Interrupt) return Boolean; private type I2C_State is (Reset, Ready, Master_Busy_Tx, Master_Busy_Rx, Mem_Busy_Tx, Mem_Busy_Rx); type Internal_I2C_Port is new STM32_SVD.I2C.I2C_Peripheral; type I2C_Port (Periph : not null access Internal_I2C_Port) is limited new HAL.I2C.I2C_Port with record Config : I2C_Configuration; State : I2C_State := Reset; end record; end STM32.I2C;
reznikmm/matreshka
Ada
4,169
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Draw_Extrusion_First_Light_Direction_Attributes; package Matreshka.ODF_Draw.Extrusion_First_Light_Direction_Attributes is type Draw_Extrusion_First_Light_Direction_Attribute_Node is new Matreshka.ODF_Draw.Abstract_Draw_Attribute_Node and ODF.DOM.Draw_Extrusion_First_Light_Direction_Attributes.ODF_Draw_Extrusion_First_Light_Direction_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Draw_Extrusion_First_Light_Direction_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Draw_Extrusion_First_Light_Direction_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Draw.Extrusion_First_Light_Direction_Attributes;
ptrebuc/ewok-kernel
Ada
3,385
ads
-- -- Copyright 2018 The wookey project team <[email protected]> -- - Ryad Benadjila -- - Arnauld Michelizza -- - Mathieu Renard -- - Philippe Thierry -- - Philippe Trebuchet -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- with ewok.tasks_shared; with ewok.interrupts; with soc.interrupts; package ewok.exported.interrupts with spark_mode => off is MAX_POSTHOOK_INSTR : constant := 10; type t_posthook_action is (POSTHOOK_NIL, POSTHOOK_READ, POSTHOOK_WRITE, POSTHOOK_WRITE_REG, -- C name "and" POSTHOOK_WRITE_MASK); -- C name "mask" -- value <- register type t_posthook_action_read is record offset : unsigned_32; value : unsigned_32; end record; -- register <- value & mask type t_posthook_action_write is record offset : unsigned_32; value : unsigned_32; mask : unsigned_32; end record; -- register(dest) <- register(src) & mask type t_posthook_action_write_reg is record offset_dest : unsigned_32; offset_src : unsigned_32; mask : unsigned_32; mode : unsigned_8; end record; -- register(dest) <- register(src) & register(mask) type t_posthook_action_write_mask is record offset_dest : unsigned_32; offset_src : unsigned_32; offset_mask : unsigned_32; mode : unsigned_8; end record; MODE_STANDARD : constant := 0; MODE_NOT : constant := 1; type t_posthook_instruction (instr : t_posthook_action := POSTHOOK_NIL) is record case instr is when POSTHOOK_NIL => null; when POSTHOOK_READ => read : t_posthook_action_read; when POSTHOOK_WRITE => write : t_posthook_action_write; when POSTHOOK_WRITE_REG => write_reg : t_posthook_action_write_reg; when POSTHOOK_WRITE_MASK => write_mask : t_posthook_action_write_mask; end case; end record; -- number of posthooks subtype t_posthook_instruction_number is integer range 1 .. MAX_POSTHOOK_INSTR; -- array of posthooks type t_posthook_instruction_list is array (t_posthook_instruction_number'range) of t_posthook_instruction; type t_interrupt_posthook is record action : t_posthook_instruction_list; -- Reading, writing, masking... status : unsigned_32; data : unsigned_32; end record; type t_interrupt_config is record handler : ewok.interrupts.t_interrupt_handler_access; interrupt : soc.interrupts.t_interrupt; mode : ewok.tasks_shared.t_scheduling_post_isr; posthook : t_interrupt_posthook; end record; type t_interrupt_config_access is access all t_interrupt_config; end ewok.exported.interrupts;
reznikmm/matreshka
Ada
4,591
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Dr3d.Max_Edge_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Dr3d_Max_Edge_Attribute_Node is begin return Self : Dr3d_Max_Edge_Attribute_Node do Matreshka.ODF_Dr3d.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Dr3d_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Dr3d_Max_Edge_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Max_Edge_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Dr3d_URI, Matreshka.ODF_String_Constants.Max_Edge_Attribute, Dr3d_Max_Edge_Attribute_Node'Tag); end Matreshka.ODF_Dr3d.Max_Edge_Attributes;
reznikmm/matreshka
Ada
3,452
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2018, 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 WUI.Widgets.Spin_Boxes.Integers; package WUI.Integer_Spin_Boxes renames WUI.Widgets.Spin_Boxes.Integers;
dan76/Amass
Ada
1,026
ads
-- Copyright © by Jeff Foley 2017-2023. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. -- SPDX-License-Identifier: Apache-2.0 name = "360PassiveDNS" type = "api" function start() set_rate_limit(1) end function check() local c local cfg = datasrc_config() if (cfg ~= nil) then c = cfg.credentials end if (c ~= nil and c.key ~= nil and c.key ~= "") then return true end return false end function vertical(ctx, domain) local c local cfg = datasrc_config() if (cfg ~= nil) then c = cfg.credentials end if (c == nil or c.key == nil or c.key == "") then return end scrape(ctx, { ['url']=build_url(domain), ['header']={ ['Accept']="application/json", ['X-Authtoken']=c.key, }, }) end function build_url(domain) return "https://api.passivedns.cn/flint/rrset/*." .. domain .. "/?source=ALL&batch=5000" end
AdaCore/Ada_Drivers_Library
Ada
5,127
adb
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2020, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with STM32.GPIO; use STM32.GPIO; with STM32.SPI; use STM32.SPI; with STM32.Device; use STM32.Device; with STM32_H405; use STM32_H405; with HAL.Bitmap; use HAL.Bitmap; with HAL.SPI; use HAL.SPI; with PCD8544; use PCD8544; with Ravenscar_Time; procedure LCD_Test is procedure Configure_GPIO; procedure Configure_SPI; LCD_SPI : STM32.SPI.SPI_Port renames SPI_2; LCD_CLK : GPIO_Point renames EXT2_16; LCD_DIN : GPIO_Point renames EXT2_19; LCD_RST : GPIO_Point renames EXT2_9; LCD_CS : GPIO_Point renames EXT2_17; LCD_DC : GPIO_Point renames EXT2_2; procedure Configure_GPIO is begin Enable_Clock (LCD_DIN & LCD_CLK & LCD_RST & LCD_DC & LCD_CS); Configure_IO (LCD_RST & LCD_DC & LCD_CS, (Resistors => Pull_Up, Mode => Mode_Out, Output_Type => Push_Pull, Speed => Speed_25MHz)); Configure_IO (LCD_DIN & LCD_CLK, (Resistors => Pull_Up, Mode => Mode_AF, AF_Output_Type => Push_Pull, AF_Speed => Speed_25MHz, AF => GPIO_AF_SPI2_5)); end Configure_GPIO; procedure Configure_SPI is begin Enable_Clock (LCD_SPI); Configure (LCD_SPI, (Direction => D2Lines_FullDuplex, Mode => Master, Data_Size => Data_Size_8b, Clock_Polarity => High, Clock_Phase => P2Edge, Slave_Management => Software_Managed, Baud_Rate_Prescaler => BRP_8, First_Bit => MSB, CRC_Poly => 0)); Enable (LCD_SPI); end Configure_SPI; Display : PCD8544_Device (Port => LCD_SPI'Access, RST => LCD_RST'Access, CS => LCD_CS'Access, DC => LCD_DC'Access, Time => Ravenscar_Time.Delays); Bitmap : Any_Bitmap_Buffer; Cursor : Rect := (Position => (0, 0), Width => 8, Height => 8); begin Configure_GPIO; Configure_SPI; Display.Initialize; Display.Initialize_Layer (Layer => 1, Mode => M_1, X => 0, Y => 0, Width => Display.Width, Height => Display.Height); Bitmap := Display.Hidden_Buffer (1); loop for X in 0 .. ((Display.Width / Cursor.Width) - 1) loop for Y in 0 .. ((Display.Height / Cursor.Height) - 1) loop Bitmap.Set_Source (White); Bitmap.Fill; Cursor.Position := (X * Cursor.Width, Y * Cursor.Height); Bitmap.Set_Source (Black); Bitmap.Fill_Rect (Cursor); Display.Update_Layers; delay 0.250; end loop; end loop; end loop; end LCD_Test;
Anderstask1/Sanntidsprogrammering
Ada
3,998
adb
with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Numerics.Float_Random; use Ada.Text_IO, Ada.Integer_Text_IO, Ada.Numerics.Float_Random; procedure exercise8 is Count_Failed : exception; -- Exception to be raised when counting fails Gen : Generator; -- Random number generator protected type Transaction_Manager (N : Positive) is entry Finished; function Commit return Boolean; procedure Signal_Abort; private Finished_Gate_Open : Boolean := False; Aborted : Boolean := False; Should_Commit : Boolean := True; end Transaction_Manager; protected body Transaction_Manager is entry Finished when Finished_Gate_Open or Finished'Count = N is begin ------------------------------------------ -- PART 3: Modify the Finished entry ------------------------------------------ if Finished'Count = N-1 then Finished_Gate_Open := True; Should_Commit := not Aborted; end if; if Finished'Count = 0 then Finished_Gate_Open := False; Aborted := False; end if; end Finished; procedure Signal_Abort is begin Aborted := True; end Signal_Abort; function Commit return Boolean is begin return Should_Commit; end Commit; ------------------------------------------ -- PART 2: Create the Wait_Until_Aborted entry ------------------------------------------ entry Wait_Until_Aborted entry begin end Wait_Until_Aborted; end Transaction_Manager; function Unreliable_Slow_Add (x : Integer) return Integer is Error_Rate : Constant := 0.15; -- (between 0 and 1) begin if Random(Gen) > Error_Rate then delay Duration(Random(Gen) * 5.0); return X + 10; else delay Duration(Random(Gen) * 1.0); raise Count_Failed; end if; end Unreliable_Slow_Add; task type Transaction_Worker (Initial : Integer; Manager : access Transaction_Manager); task body Transaction_Worker is Num : Integer := Initial; Prev : Integer := Num; Round_Num : Integer := 0; begin Put_Line ("Worker" & Integer'Image(Initial) & " started"); loop Put_Line ("Worker" & Integer'Image(Initial) & " started round" & Integer'Image(Round_Num)); Round_Num := Round_Num + 1; ------------------------------------------ -- PART 1: Select-Then-Abort statement ------------------------------------------ select Manager.Wait_Until_Aborted; -- eg. X.Entry_Call; -- code that is run when the triggering_alternative has triggered -- (forward ER code goes here) Num := Num + 5; Put_Line (" Worker" & Integer'Image(Initial) & " comitting" & Integer'Image(Num)); then abort abortable_part -- code that is run when nothing has triggered -- (main functionality) end select; begin Num := Unreliable_Slow_Add(Num); exception when Count_Failed => Manager.Signal_Abort; end; Manager.Finished; if Manager.Commit = True then Put_Line (" Worker" & Integer'Image(Initial) & " comitting" & Integer'Image(Num)); else Put_Line (" Worker" & Integer'Image(Initial) & " reverting from" & Integer'Image(Num) & " to" & Integer'Image(Prev)); Num := Prev; end if; Prev := Num; delay 0.5; end loop; end Transaction_Worker; Manager : aliased Transaction_Manager (3); Worker_1 : Transaction_Worker (0, Manager'Access); Worker_2 : Transaction_Worker (1, Manager'Access); Worker_3 : Transaction_Worker (2, Manager'Access); begin Reset(Gen); -- Seed the random number generator end exercise8;
reznikmm/matreshka
Ada
4,728
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_Table.Label_Cell_Range_Address_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Table_Label_Cell_Range_Address_Attribute_Node is begin return Self : Table_Label_Cell_Range_Address_Attribute_Node do Matreshka.ODF_Table.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Table_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Table_Label_Cell_Range_Address_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Label_Cell_Range_Address_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Table_URI, Matreshka.ODF_String_Constants.Label_Cell_Range_Address_Attribute, Table_Label_Cell_Range_Address_Attribute_Node'Tag); end Matreshka.ODF_Table.Label_Cell_Range_Address_Attributes;
faelys/ada-syslog
Ada
1,789
ads
------------------------------------------------------------------------------ -- Copyright (c) 2014, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Syslog.RFC_3164 outputs messages formatted according to the legacy -- -- RFC 3164 ("The BSD syslog Protocol"). -- ------------------------------------------------------------------------------ package Syslog.RFC_3164 is procedure Build_Message (Output : out String; Last : out Natural; Pri : in Priority; Message : in String; Hostname : in String := "-"; App_Name : in String := ""; Proc_ID : in String := ""); end Syslog.RFC_3164;
onox/orka
Ada
1,423
ads
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2017 onox <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Interfaces.C.Pointers; package Orka.Types.Pointers is pragma Preelaborate; package Single_Vector4_Pointers is new Interfaces.C.Pointers (Size, Singles.Vector4, Singles.Vector4_Array, Singles.Vector4'(others => 0.0)); package Single_Matrix4_Pointers is new Interfaces.C.Pointers (Size, Singles.Matrix4, Singles.Matrix4_Array, Singles.Matrix4'(others => (others => 0.0))); package Double_Vector4_Pointers is new Interfaces.C.Pointers (Size, Doubles.Vector4, Doubles.Vector4_Array, Doubles.Vector4'(others => 0.0)); package Double_Matrix4_Pointers is new Interfaces.C.Pointers (Size, Doubles.Matrix4, Doubles.Matrix4_Array, Doubles.Matrix4'(others => (others => 0.0))); end Orka.Types.Pointers;
reznikmm/matreshka
Ada
12,723
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_0027 is pragma Preelaborate; Group_0027 : aliased constant Core_Second_Stage := (16#00# .. 16#04# => -- 2700 .. 2704 (Other_Symbol, Neutral, Other, Other, Other, Ideographic, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#08# .. 16#0D# => -- 2708 .. 270D (Other_Symbol, Neutral, Other, Other, Other, Ideographic, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#3D# => -- 273D (Other_Symbol, Ambiguous, Other, Other, Other, Alphabetic, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#57# => -- 2757 (Other_Symbol, Ambiguous, Other, Other, Other, Ambiguous, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#5B# .. 16#60# => -- 275B .. 2760 (Other_Symbol, Neutral, Other, Other, Close, Quotation, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#62# .. 16#63# => -- 2762 .. 2763 (Other_Symbol, Neutral, Other, Other, Other, Exclamation, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#68# => -- 2768 (Open_Punctuation, Neutral, Other, Other, Close, Open_Punctuation, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#69# => -- 2769 (Close_Punctuation, Neutral, Other, Other, Close, Close_Punctuation, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#6A# => -- 276A (Open_Punctuation, Neutral, Other, Other, Close, Open_Punctuation, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#6B# => -- 276B (Close_Punctuation, Neutral, Other, Other, Close, Close_Punctuation, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#6C# => -- 276C (Open_Punctuation, Neutral, Other, Other, Close, Open_Punctuation, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#6D# => -- 276D (Close_Punctuation, Neutral, Other, Other, Close, Close_Punctuation, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#6E# => -- 276E (Open_Punctuation, Neutral, Other, Other, Close, Open_Punctuation, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#6F# => -- 276F (Close_Punctuation, Neutral, Other, Other, Close, Close_Punctuation, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#70# => -- 2770 (Open_Punctuation, Neutral, Other, Other, Close, Open_Punctuation, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#71# => -- 2771 (Close_Punctuation, Neutral, Other, Other, Close, Close_Punctuation, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#72# => -- 2772 (Open_Punctuation, Neutral, Other, Other, Close, Open_Punctuation, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#73# => -- 2773 (Close_Punctuation, Neutral, Other, Other, Close, Close_Punctuation, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#74# => -- 2774 (Open_Punctuation, Neutral, Other, Other, Close, Open_Punctuation, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#75# => -- 2775 (Close_Punctuation, Neutral, Other, Other, Close, Close_Punctuation, (Pattern_Syntax | Grapheme_Base => True, others => False)), 16#76# .. 16#7F# => -- 2776 .. 277F (Other_Number, Ambiguous, Other, Other, Other, Ambiguous, (Grapheme_Base => True, others => False)), 16#80# .. 16#93# => -- 2780 .. 2793 (Other_Number, Neutral, Other, Other, Other, Ambiguous, (Grapheme_Base => True, others => False)), 16#C0# .. 16#C4# => -- 27C0 .. 27C4 (Math_Symbol, Neutral, Other, Other, Other, Alphabetic, (Pattern_Syntax | Grapheme_Base | Math => True, others => False)), 16#C5# => -- 27C5 (Open_Punctuation, Neutral, Other, Other, Close, Open_Punctuation, (Other_Math | Pattern_Syntax | Grapheme_Base | Math => True, others => False)), 16#C6# => -- 27C6 (Close_Punctuation, Neutral, Other, Other, Close, Close_Punctuation, (Other_Math | Pattern_Syntax | Grapheme_Base | Math => True, others => False)), 16#C7# .. 16#E5# => -- 27C7 .. 27E5 (Math_Symbol, Neutral, Other, Other, Other, Alphabetic, (Pattern_Syntax | Grapheme_Base | Math => True, others => False)), 16#E6# => -- 27E6 (Open_Punctuation, Narrow, Other, Other, Close, Open_Punctuation, (Other_Math | Pattern_Syntax | Grapheme_Base | Math => True, others => False)), 16#E7# => -- 27E7 (Close_Punctuation, Narrow, Other, Other, Close, Close_Punctuation, (Other_Math | Pattern_Syntax | Grapheme_Base | Math => True, others => False)), 16#E8# => -- 27E8 (Open_Punctuation, Narrow, Other, Other, Close, Open_Punctuation, (Other_Math | Pattern_Syntax | Grapheme_Base | Math => True, others => False)), 16#E9# => -- 27E9 (Close_Punctuation, Narrow, Other, Other, Close, Close_Punctuation, (Other_Math | Pattern_Syntax | Grapheme_Base | Math => True, others => False)), 16#EA# => -- 27EA (Open_Punctuation, Narrow, Other, Other, Close, Open_Punctuation, (Other_Math | Pattern_Syntax | Grapheme_Base | Math => True, others => False)), 16#EB# => -- 27EB (Close_Punctuation, Narrow, Other, Other, Close, Close_Punctuation, (Other_Math | Pattern_Syntax | Grapheme_Base | Math => True, others => False)), 16#EC# => -- 27EC (Open_Punctuation, Narrow, Other, Other, Close, Open_Punctuation, (Other_Math | Pattern_Syntax | Grapheme_Base | Math => True, others => False)), 16#ED# => -- 27ED (Close_Punctuation, Narrow, Other, Other, Close, Close_Punctuation, (Other_Math | Pattern_Syntax | Grapheme_Base | Math => True, others => False)), 16#EE# => -- 27EE (Open_Punctuation, Neutral, Other, Other, Close, Open_Punctuation, (Other_Math | Pattern_Syntax | Grapheme_Base | Math => True, others => False)), 16#EF# => -- 27EF (Close_Punctuation, Neutral, Other, Other, Close, Close_Punctuation, (Other_Math | Pattern_Syntax | Grapheme_Base | Math => True, others => False)), 16#F0# .. 16#FF# => -- 27F0 .. 27FF (Math_Symbol, Neutral, Other, Other, Other, Alphabetic, (Pattern_Syntax | Grapheme_Base | Math => True, others => False)), others => (Other_Symbol, Neutral, Other, Other, Other, Alphabetic, (Pattern_Syntax | Grapheme_Base => True, others => False))); end Matreshka.Internals.Unicode.Ucd.Core_0027;
sonneveld/adazmq
Ada
27,776
adb
with Ada.Unchecked_Conversion; with Interfaces.C.Strings; with ZMQ_Constants; package body ZMQ is use type System.Address; use type Interfaces.C.int; use type Interfaces.C.size_t; use type Interfaces.C.unsigned; -- Conversion function Convert is new Ada.Unchecked_Conversion (Source => Interfaces.C.size_t, Target => Interfaces.C.unsigned_long); function Convert is new Ada.Unchecked_Conversion (Source => System.Address, Target => Interfaces.C.Strings.chars_ptr); function Convert is new Ada.Unchecked_Conversion (Source => Interfaces.C.Strings.chars_ptr, Target => System.Address); function Convert (Value : Context_Type'Class) return System.Address is (Value.Impl_Ptr); function Convert (Value : Context_Option_Names) return Interfaces.C.int is begin case Value is when ZMQ_IO_THREADS => return ZMQ_Constants.ZMQ_IO_THREADS; when ZMQ_MAX_SOCKETS => return ZMQ_Constants.ZMQ_MAX_SOCKETS; when ZMQ_IPV6 => return ZMQ_Constants.ZMQ_IPV6; end case; end Convert; function Convert (Value : Socket_Type'Class) return System.Address is (Value.Impl_Ptr); function Convert (Value : Socket_Types) return Interfaces.C.int is begin case Value is when ZMQ_PAIR => return ZMQ_Constants.ZMQ_PAIR; when ZMQ_PUB => return ZMQ_Constants.ZMQ_PUB; when ZMQ_SUB => return ZMQ_Constants.ZMQ_SUB; when ZMQ_REQ => return ZMQ_Constants.ZMQ_REQ; when ZMQ_REP => return ZMQ_Constants.ZMQ_REP; when ZMQ_DEALER => return ZMQ_Constants.ZMQ_DEALER; when ZMQ_ROUTER => return ZMQ_Constants.ZMQ_ROUTER; when ZMQ_PULL => return ZMQ_Constants.ZMQ_PULL; when ZMQ_PUSH => return ZMQ_Constants.ZMQ_PUSH; when ZMQ_XPUB => return ZMQ_Constants.ZMQ_XPUB; when ZMQ_XSUB => return ZMQ_Constants.ZMQ_XSUB; when ZMQ_STREAM => return ZMQ_Constants.ZMQ_STREAM; end case; end Convert; function Convert (Value : Socket_Option_Names) return Interfaces.C.int is begin case Value is when ZMQ_AFFINITY => return ZMQ_Constants.ZMQ_AFFINITY; when ZMQ_IDENTITY => return ZMQ_Constants.ZMQ_IDENTITY; when ZMQ_SUBSCRIBE => return ZMQ_Constants.ZMQ_SUBSCRIBE; when ZMQ_UNSUBSCRIBE => return ZMQ_Constants.ZMQ_UNSUBSCRIBE; when ZMQ_RATE => return ZMQ_Constants.ZMQ_RATE; when ZMQ_RECOVERY_IVL => return ZMQ_Constants.ZMQ_RECOVERY_IVL; when ZMQ_SNDBUF => return ZMQ_Constants.ZMQ_SNDBUF; when ZMQ_RCVBUF => return ZMQ_Constants.ZMQ_RCVBUF; when ZMQ_RCVMORE => return ZMQ_Constants.ZMQ_RCVMORE; when ZMQ_FD => return ZMQ_Constants.ZMQ_FD; when ZMQ_EVENTS => return ZMQ_Constants.ZMQ_EVENTS; when ZMQ_TYPE => return ZMQ_Constants.ZMQ_TYPE; when ZMQ_LINGER => return ZMQ_Constants.ZMQ_LINGER; when ZMQ_RECONNECT_IVL => return ZMQ_Constants.ZMQ_RECONNECT_IVL; when ZMQ_BACKLOG => return ZMQ_Constants.ZMQ_BACKLOG; when ZMQ_RECONNECT_IVL_MAX => return ZMQ_Constants.ZMQ_RECONNECT_IVL_MAX; when ZMQ_MAXMSGSIZE => return ZMQ_Constants.ZMQ_MAXMSGSIZE; when ZMQ_SNDHWM => return ZMQ_Constants.ZMQ_SNDHWM; when ZMQ_RCVHWM => return ZMQ_Constants.ZMQ_RCVHWM; when ZMQ_MULTICAST_HOPS => return ZMQ_Constants.ZMQ_MULTICAST_HOPS; when ZMQ_RCVTIMEO => return ZMQ_Constants.ZMQ_RCVTIMEO; when ZMQ_SNDTIMEO => return ZMQ_Constants.ZMQ_SNDTIMEO; when ZMQ_LAST_ENDPOINT => return ZMQ_Constants.ZMQ_LAST_ENDPOINT; when ZMQ_ROUTER_MANDATORY => return ZMQ_Constants.ZMQ_ROUTER_MANDATORY; when ZMQ_TCP_KEEPALIVE => return ZMQ_Constants.ZMQ_TCP_KEEPALIVE; when ZMQ_TCP_KEEPALIVE_CNT => return ZMQ_Constants.ZMQ_TCP_KEEPALIVE_CNT; when ZMQ_TCP_KEEPALIVE_IDLE => return ZMQ_Constants.ZMQ_TCP_KEEPALIVE_IDLE; when ZMQ_TCP_KEEPALIVE_INTVL => return ZMQ_Constants.ZMQ_TCP_KEEPALIVE_INTVL; when ZMQ_TCP_ACCEPT_FILTER => return ZMQ_Constants.ZMQ_TCP_ACCEPT_FILTER; when ZMQ_IMMEDIATE => return ZMQ_Constants.ZMQ_IMMEDIATE; when ZMQ_XPUB_VERBOSE => return ZMQ_Constants.ZMQ_XPUB_VERBOSE; when ZMQ_ROUTER_RAW => return ZMQ_Constants.ZMQ_ROUTER_RAW; when ZMQ_IPV6 => return ZMQ_Constants.ZMQ_IPV6; when ZMQ_MECHANISM => return ZMQ_Constants.ZMQ_MECHANISM; when ZMQ_PLAIN_SERVER => return ZMQ_Constants.ZMQ_PLAIN_SERVER; when ZMQ_PLAIN_USERNAME => return ZMQ_Constants.ZMQ_PLAIN_USERNAME; when ZMQ_PLAIN_PASSWORD => return ZMQ_Constants.ZMQ_PLAIN_PASSWORD; when ZMQ_CURVE_SERVER => return ZMQ_Constants.ZMQ_CURVE_SERVER; when ZMQ_CURVE_PUBLICKEY => return ZMQ_Constants.ZMQ_CURVE_PUBLICKEY; when ZMQ_CURVE_SECRETKEY => return ZMQ_Constants.ZMQ_CURVE_SECRETKEY; when ZMQ_CURVE_SERVERKEY => return ZMQ_Constants.ZMQ_CURVE_SERVERKEY; when ZMQ_PROBE_ROUTER => return ZMQ_Constants.ZMQ_PROBE_ROUTER; when ZMQ_REQ_CORRELATE => return ZMQ_Constants.ZMQ_REQ_CORRELATE; when ZMQ_REQ_RELAXED => return ZMQ_Constants.ZMQ_REQ_RELAXED; when ZMQ_CONFLATE => return ZMQ_Constants.ZMQ_CONFLATE; when ZMQ_ZAP_DOMAIN => return ZMQ_Constants.ZMQ_ZAP_DOMAIN; end case; end Convert; procedure Version (Major : out Natural; Minor : out Natural; Patch : out Natural) is c_major : aliased Interfaces.C.int; c_minor : aliased Interfaces.C.int; c_patch : aliased Interfaces.C.int; begin ZMQ_Thin.zmq_version (c_major'Access, c_minor'Access, c_patch'Access); Major := Natural (c_major); Minor := Natural (c_minor); Patch := Natural (c_patch); end Version; function Errno return Integer is begin return Integer (ZMQ_Thin.zmq_errno); end Errno; function Strerror (Err_Num : Integer) return String is c_errnum : constant Interfaces.C.int := Interfaces.C.int (Err_Num); c_strerror : constant Interfaces.C.Strings.chars_ptr := ZMQ_Thin.zmq_strerror (c_errnum); begin return Interfaces.C.Strings.Value (c_strerror); end Strerror; procedure Raise_Errno is Error_Number : constant Integer := Errno; begin raise ZMQ_Error with "[" & Error_Number'Img & "] " & Strerror (Error_Number); end Raise_Errno; pragma No_Return (Raise_Errno); -- Context -- ------------------------------------------------------------------------ overriding procedure Initialize (Cxt : in out Context_Type) is begin Setup (Cxt); end Initialize; overriding procedure Finalize (Cxt : in out Context_Type) is begin if Cxt.Impl_Ptr /= System.Null_Address then Term (Cxt); end if; end Finalize; procedure Setup (Cxt : in out Context_Type) is c_cxt : constant System.Address := ZMQ_Thin.zmq_ctx_new; begin if c_cxt /= System.Null_Address then Cxt.Impl_Ptr := c_cxt; else Raise_Errno; end if; end Setup; function New_Context return Context_Type is begin return Cxt : Context_Type do Setup (Cxt); end return; end New_Context; procedure Term (Context : in out Context_Type) is c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_ctx_term (Convert (Context)); if c_res = 0 then Context.Impl_Ptr := System.Null_Address; return; else Raise_Errno; end if; end Term; procedure Shutdown (Context : Context_Type) is c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_ctx_shutdown (Convert (Context)); if c_res = 0 then return; else Raise_Errno; end if; end Shutdown; procedure Set (Context : Context_Type; Name : Context_Option_Names; Value : Natural) is c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_ctx_set (Convert (Context), Convert (Name), Interfaces.C.int (Value)); if c_res = 0 then return; else Raise_Errno; end if; end Set; function Get (Context : Context_Type; Name : Context_Option_Names) return Natural is c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_ctx_get (Convert (Context), Convert (Name)); if c_res >= 0 then return Natural (c_res); else Raise_Errno; end if; end Get; function New_Socket (Context : Context_Type; Instance_Type : Socket_Types) return Socket_Type'Class is begin return S : Socket_Type do Setup (S, Context, Instance_Type); end return; end New_Socket; -- Message_Type -- ------------------------------------------------------------------------ overriding procedure Initialize (M : in out Message_Type) is begin M.Msg_Internals.u_u := (others => 0); Setup (M); end Initialize; overriding procedure Finalize (M : in out Message_Type) is begin Close (M); end Finalize; procedure Setup (M : in out Message_Type; Size : Integer := 0) is c_size : constant Interfaces.C.size_t := Interfaces.C.size_t (Size); c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_msg_init_size (M.Msg_Internals'Access, c_size); if c_res = 0 then return; else Raise_Errno; end if; end Setup; function Create_Message (Size : Integer := 0) return Message_Type is begin return M : Message_Type do M.Msg_Internals.u_u := (others => 0); Setup (M, Size); end return; end Create_Message; procedure Setup (M : in out Message_Type; Value : String) is c_size : constant Interfaces.C.size_t := Interfaces.C.size_t (Value'Length); c_res : Interfaces.C.int; c_data : System.Address; begin c_res := ZMQ_Thin.zmq_msg_init_size (M.Msg_Internals'Access, c_size); if c_res /= 0 then Raise_Errno; end if; c_data := ZMQ_Thin.zmq_msg_data (M.Msg_Internals'Access); if c_data = System.Null_Address then Raise_Errno; end if; declare Data_String : String (1 .. Value'Length); for Data_String'Address use c_data; begin Data_String (1 .. Value'Length) := Value (Value'First .. Value'Last); end; end Setup; function Create_Message (Value : String) return Message_Type is begin return M : Message_Type do M.Msg_Internals.u_u := (others => 0); Setup (M, Value); end return; end Create_Message; procedure Send (M : in out Message_Type; S : Socket_Type'Class; Do_Not_Wait : Boolean := False; Send_More : Boolean := False) is Expected_Length : constant Integer := Size (M); c_flags : Interfaces.C.unsigned := 0; c_res : Interfaces.C.int; begin c_flags := 0; if Do_Not_Wait then c_flags := c_flags or ZMQ_Constants.ZMQ_DONTWAIT; end if; if Send_More then c_flags := c_flags or ZMQ_Constants.ZMQ_SNDMORE; end if; c_res := ZMQ_Thin.zmq_msg_send (M.Msg_Internals'Access, Convert (S), c_flags); if c_res >= 0 and then Interfaces.C.int (Expected_Length) = c_res then return; elsif c_res >= 0 then raise ZMQ_Error with "Entire Message_Type wasn't sent."; else Raise_Errno; end if; end Send; procedure Recv (M : in out Message_Type; S : Socket_Type'Class; Do_Not_Wait : Boolean := False) is c_flags : Interfaces.C.unsigned := 0; c_res : Interfaces.C.int; begin c_flags := 0; if Do_Not_Wait then c_flags := c_flags or ZMQ_Constants.ZMQ_DONTWAIT; end if; c_res := ZMQ_Thin.zmq_msg_recv (M.Msg_Internals'Access, Convert (S), c_flags); if c_res >= 0 then return; else Raise_Errno; end if; end Recv; procedure Close (M : in out Message_Type) is c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_msg_close (M.Msg_Internals'Access); if c_res = 0 then return; else Raise_Errno; end if; end Close; procedure Move (Dest : in out Message_Type; Src : in out Message_Type) is c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_msg_move (Dest.Msg_Internals'Access, Src.Msg_Internals'Access); if c_res = 0 then return; else Raise_Errno; end if; end Move; procedure Copy (Dest : in out Message_Type; Src : in out Message_Type) is c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_msg_copy (Dest.Msg_Internals'Access, Src.Msg_Internals'Access); if c_res = 0 then return; else Raise_Errno; end if; end Copy; -- TODO date returning other types.. function Data (M : in out Message_Type) return String is c_data : System.Address; c_size : Interfaces.C.size_t; begin c_data := ZMQ_Thin.zmq_msg_data (M.Msg_Internals'Access); if c_data = System.Null_Address then Raise_Errno; end if; c_size := ZMQ_Thin.zmq_msg_size (M.Msg_Internals'Access); declare Result_Str : String (1 .. Integer (c_size)); for Result_Str'Address use c_data; begin return Result_Str; end; end Data; function Size (M : in out Message_Type) return Natural is c_res : Interfaces.C.size_t; begin c_res := ZMQ_Thin.zmq_msg_size (M.Msg_Internals'Access); return Natural (c_res); end Size; function More (M : in out Message_Type) return Boolean is c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_msg_more (M.Msg_Internals'Access); return c_res /= 0; end More; function Src_FD (M : in out Message_Type) return Integer is c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_msg_get (M.Msg_Internals'Access, ZMQ_Constants.ZMQ_SRCFD); if c_res >= 0 then return Integer (c_res); else Raise_Errno; end if; end Src_FD; function Shared (M : in out Message_Type) return Boolean is c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_msg_get (M.Msg_Internals'Access, ZMQ_Constants.ZMQ_SHARED); if c_res >= 0 then return c_res /= 0; else Raise_Errno; end if; end Shared; -- Socket -- ------------------------------------------------------------------------ overriding procedure Initialize (S : in out Socket_Type) is begin S.Impl_Ptr := System.Null_Address; end Initialize; overriding procedure Finalize (S : in out Socket_Type) is begin if S.Impl_Ptr /= System.Null_Address then Close (S); end if; end Finalize; procedure Setup (S : in out Socket_Type; Context : Context_Type'Class; Instance_Type : Socket_Types) is c_socket : System.Address; begin c_socket := ZMQ_Thin.zmq_socket (Convert (Context), Convert (Instance_Type)); if c_socket /= System.Null_Address then S.Impl_Ptr := c_socket; else Raise_Errno; end if; end Setup; procedure Close (S : in out Socket_Type) is c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_close (Convert (S)); if c_res = 0 then S.Impl_Ptr := System.Null_Address; return; else Raise_Errno; end if; end Close; procedure Set_Sock_Opt (S : Socket_Type; Option : Socket_Option_Names; Option_Value : Integer) is c_optval : constant Interfaces.C.int := Interfaces.C.int (Option_Value); c_optval_ptr : constant System.Address := c_optval'Address; c_optvallen : constant Interfaces.C.size_t := c_optval'Size / 8; c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_setsockopt (Convert (S), Convert (Option), c_optval_ptr, c_optvallen); if c_res = 0 then return; else Raise_Errno; end if; end Set_Sock_Opt; procedure Set_Sock_Opt (S : Socket_Type; Option : Socket_Option_Names; Option_Value : Long_Long_Integer) is c_optval : constant Interfaces.C.long := Interfaces.C.long (Option_Value); c_optval_ptr : constant System.Address := c_optval'Address; c_optvallen : constant Interfaces.C.size_t := c_optval'Size / 8; c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_setsockopt (Convert (S), Convert (Option), c_optval_ptr, c_optvallen); if c_res = 0 then return; else Raise_Errno; end if; end Set_Sock_Opt; procedure Set_Sock_Opt (S : Socket_Type; Option : Socket_Option_Names; Option_Value : String) is c_optval : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.New_String (Option_Value); c_optvallen : constant Interfaces.C.size_t := Option_Value'Length; c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_setsockopt (Convert (S), Convert (Option), Convert (c_optval), c_optvallen); Interfaces.C.Strings.Free (c_optval); if c_res = 0 then return; else Raise_Errno; end if; end Set_Sock_Opt; -- function zmq_getsockopt (s : System.Address; option : Interfaces.C.int; optval : System.Address; optvallen : access Interfaces.C.size_t) return Interfaces.C.int; function Get_Sock_Opt (S : Socket_Type; Option : Socket_Option_Names) return Integer is c_optval : aliased Interfaces.C.int; c_optval_ptr : constant System.Address := c_optval'Address; c_optvallen : aliased Interfaces.C.size_t := c_optval'Size / 8; c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_getsockopt (Convert (S), Convert (Option), c_optval_ptr, c_optvallen'Access); if c_res = 0 then return Integer (c_optval); else Raise_Errno; end if; end Get_Sock_Opt; function Get_Sock_Opt (S : Socket_Type; Option : Socket_Option_Names) return Long_Long_Integer is c_optval : aliased Interfaces.C.long; c_optval_ptr : constant System.Address := c_optval'Address; c_optvallen : aliased Interfaces.C.size_t := c_optval'Size / 8; c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_getsockopt (Convert (S), Convert (Option), c_optval_ptr, c_optvallen'Access); if c_res = 0 then return Long_Long_Integer (c_optval); else Raise_Errno; end if; end Get_Sock_Opt; function Get_Sock_Opt (S : Socket_Type; Option : Socket_Option_Names) return String is Buf_Size : constant Integer := 4096; c_optval : aliased String (1.. Buf_Size); c_optval_ptr : constant System.Address := c_optval'Address; c_optvallen : aliased Interfaces.C.size_t := c_optval'Length; c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_getsockopt (Convert (S), Convert (Option), c_optval_ptr, c_optvallen'Access); if c_optvallen >= Interfaces.C.size_t (Buf_Size) then raise ZMQ_Error with "string option too large."; end if; if c_res = 0 then return c_optval (1 .. Integer (c_optvallen)); else Raise_Errno; end if; end Get_Sock_Opt; procedure Bind (S : Socket_Type; Address : String) is c_addr : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.New_String (Address); c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_bind (Convert (S), c_addr); Interfaces.C.Strings.Free (c_addr); if c_res = 0 then return; else Raise_Errno; end if; end Bind; procedure Connect (S : Socket_Type; Address : String) is c_addr : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.New_String (Address); c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_connect (Convert (S), c_addr); Interfaces.C.Strings.Free (c_addr); if c_res = 0 then return; else Raise_Errno; end if; end Connect; procedure Unbind (S : Socket_Type; Address : String) is c_addr : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.New_String (Address); c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_unbind (Convert (S), c_addr); Interfaces.C.Strings.Free (c_addr); if c_res = 0 then return; else Raise_Errno; end if; end Unbind; procedure Disconnect (S : Socket_Type; Address : String) is c_addr : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.New_String (Address); c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_disconnect (Convert (S), c_addr); Interfaces.C.Strings.Free (c_addr); if c_res = 0 then return; else Raise_Errno; end if; end Disconnect; -- TODO: What about an array of flags? procedure Send (S : Socket_Type; Buf : String; Do_Not_Wait : Boolean := False; Send_More : Boolean := False) is c_buf : constant System.Address := Buf'Address; -- TODO is this okay? or ptr to first item better? c_len : constant Interfaces.C.size_t := Buf'Length; c_flags : Interfaces.C.unsigned := 0; c_res : Interfaces.C.int; begin c_flags := 0; if Do_Not_Wait then c_flags := c_flags or ZMQ_Constants.ZMQ_DONTWAIT; end if; if Send_More then c_flags := c_flags or ZMQ_Constants.ZMQ_SNDMORE; end if; c_res := ZMQ_Thin.zmq_send (Convert (S), c_buf, c_len, c_flags); if c_res >= 0 and then Interfaces.C.size_t (c_res) = c_len then return; elsif c_res >= 0 then raise ZMQ_Error with "Entire Message_Type wasn't sent."; else Raise_Errno; end if; end Send; function Recv (S : Socket_Type; Do_Not_Wait : Boolean := False) return String is Buf_Size : constant Integer := 32*1024; Buf : String (1 .. Buf_Size); c_buf : constant System.Address := Buf (Buf'First)'Address; c_len : constant Interfaces.C.size_t := Buf'Length; c_flags : Interfaces.C.unsigned := 0; c_res : Interfaces.C.int; begin c_flags := 0; if Do_Not_Wait then c_flags := c_flags or ZMQ_Constants.ZMQ_DONTWAIT; end if; c_res := ZMQ_Thin.zmq_recv (Convert (S), c_buf, c_len, c_flags); if c_res >= 0 and then c_res /= Interfaces.C.int (Buf_Size) then return Buf (1 .. Integer (c_res)); elsif c_res >= 0 then raise ZMQ_Error with "Received Message_Type was truncated."; else Raise_Errno; end if; end Recv; -- Polling -- ------------------------------------------------------------------------ procedure Setup (PE : in out Poll_Item_Type; S : Socket_Type'Class; Poll_In : Boolean := False; Poll_Out : Boolean := False) is begin PE.S_Impl_Ptr := S.Impl_Ptr; PE.FD := 0; PE.Poll_In := Poll_In; PE.Poll_Out := Poll_Out; PE.Poll_Error := False; PE.Result_In := False; PE.Result_Out := False; PE.Result_Error := False; end Setup; function New_Poll_Item (S : Socket_Type'Class; Poll_In : Boolean := False; Poll_Out : Boolean := False) return Poll_Item_Type is begin return PE : Poll_Item_Type do Setup (PE, S, Poll_In, Poll_Out); end return; end New_Poll_Item; procedure Setup (PE : in out Poll_Item_Type; FD : Integer; Poll_In : Boolean := False; Poll_Out : Boolean := False; Poll_Error : Boolean := False) is begin PE.S_Impl_Ptr := System.Null_Address; PE.FD := Interfaces.C.int (FD); PE.Poll_In := Poll_In; PE.Poll_Out := Poll_Out; PE.Poll_Error := Poll_Error; PE.Result_In := False; PE.Result_Out := False; PE.Result_Error := False; end Setup; function New_Poll_Item (FD : Integer; Poll_In : Boolean := False; Poll_Out : Boolean := False; Poll_Error : Boolean := False) return Poll_Item_Type is begin return PE : Poll_Item_Type do Setup (PE, FD, Poll_In, Poll_Out, Poll_Error); end return; end New_Poll_Item; function Is_Readable (PE : Poll_Item_Type) return Boolean is (PE.Result_In); function Is_Writable (PE : Poll_Item_Type) return Boolean is (PE.Result_Out); function Has_Error (PE : Poll_Item_Type) return Boolean is (PE.Result_Error); type C_Poll_Item_Array is array (Natural range <>) of aliased ZMQ_Thin.zmq_pollitem_t; pragma Convention (C, C_Poll_Item_Array); function Convert (PE : Poll_Item_Type) return ZMQ_Thin.zmq_pollitem_t is begin return Result : ZMQ_Thin.zmq_pollitem_t do Result.socket := PE.S_Impl_Ptr; Result.fd := PE.FD; Result.events := 0; if PE.Poll_In then Result.events := Interfaces.C.short (Interfaces.C.unsigned (Result.events) or ZMQ_Constants.ZMQ_POLLIN); end if; if PE.Poll_Out then Result.events := Interfaces.C.short (Interfaces.C.unsigned (Result.events) or ZMQ_Constants.ZMQ_POLLOUT); end if; if PE.Poll_Error then Result.events := Interfaces.C.short (Interfaces.C.unsigned (Result.events) or ZMQ_Constants.ZMQ_POLLERR); end if; end return; end Convert; procedure Transfer_Result (Dest : in out Poll_Item_Type; Src : ZMQ_Thin.zmq_pollitem_t) is begin Dest.Result_In := (Interfaces.C.unsigned(Src.revents) and ZMQ_Constants.ZMQ_POLLIN) /= 0; Dest.Result_Out := (Interfaces.C.unsigned(Src.revents) and ZMQ_Constants.ZMQ_POLLOUT) /= 0; end; function Poll (Entries : in out Poll_Item_Array_Type; Timeout : Long_Long_Integer := -1) return Natural is c_items : aliased C_Poll_Item_Array (Entries'First .. Entries'Last); c_items_ptr : constant access ZMQ_Thin.zmq_pollitem_t := c_items (c_items'First)'Access; c_nitems : constant Interfaces.C.int := Interfaces.C.int (Entries'Length); c_timeout : constant Interfaces.C.long := Interfaces.C.long (Timeout); c_res : Interfaces.C.int; begin for I in Entries'Range loop c_items (I) := Convert (Entries (I)); end loop; c_res := ZMQ_Thin.zmq_poll (c_items_ptr, c_nitems, c_timeout); if c_res < 0 then Raise_Errno; end if; for I in Entries'Range loop Transfer_Result (Entries (I), c_items (I)); end loop; return Natural (c_res); end Poll; procedure Poll (Entries : in out Poll_Item_Array_Type; Timeout : Long_Long_Integer := -1) is Dummy : Natural; begin Dummy := Poll (Entries, Timeout); end Poll; -- Proxy -- ------------------------------------------------------------------------ -- TODO, merge these? using the optional parameters? procedure Proxy (Frontend : Socket_Type'Class; Backend : Socket_Type'Class; Capture : Socket_Type'Class := ZMQ.No_Socket) is c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_proxy (Convert (Frontend), Convert (Backend), Convert (Capture)); -- proxy is expected to always return an error. if c_res = 0 then return; else Raise_Errno; end if; end Proxy; 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) is c_res : Interfaces.C.int; begin c_res := ZMQ_Thin.zmq_proxy_steerable (Convert (Frontend), Convert (Backend), Convert (Capture), Convert (Control)); -- proxy_steerable can terminate cleanly if c_res = 0 then return; else Raise_Errno; end if; end Proxy_Steerable; end ZMQ;
leo-brewin/ada-lapack
Ada
36,370
adb
package body Ada_Lapack.Extras is function MatrixDeterm (Source : Real_Matrix) return Real is matrix : Real_Matrix := source; matrix_rows : Integer := Matrix'Length (1); matrix_cols : Integer := Matrix'Length (2); pivots : Integer_Vector (1..matrix_rows); determ : Real; return_code : Integer := 0; begin if matrix_rows /= matrix_cols then raise Constraint_Error with "MatrixDeterm: source matrix must be square"; end if; GETRF ( A => matrix, M => matrix_rows, N => matrix_rows, LDA => matrix_rows, IPIV => pivots, INFO => return_code ); determ := 1.0e0; for i in 1..matrix_rows loop determ := determ * matrix(i,i); if pivots(i) /= i then determ := -determ; end if; end loop; return determ; end MatrixDeterm; function MatrixDeterm (Source : Complex_Matrix) return Complex is matrix : Complex_Matrix := source; matrix_rows : Integer := Matrix'Length (1); matrix_cols : Integer := Matrix'Length (2); pivots : Integer_Vector (1..matrix_rows); determ : Complex; return_code : Integer := 0; begin if matrix_rows /= matrix_cols then raise Constraint_Error with "MatrixDeterm: source matrix must be square"; end if; GETRF ( A => matrix, M => matrix_rows, N => matrix_rows, LDA => matrix_rows, IPIV => pivots, INFO => return_code ); determ := Complex'(1.0e0,0.0e0); for i in 1..matrix_rows loop determ := determ * matrix(i,i); if pivots(i) /= i then determ := -determ; end if; end loop; return determ; end MatrixDeterm; function Eigenvalues (Source : Real_Matrix) return Complex_Vector is matrix : Real_Matrix := Source; matrix_rows : Integer := matrix'Length (1); matrix_cols : Integer := matrix'Length (2); eigenvalues_rows : Integer := matrix_rows; dummy_Matrix_rows : Integer := matrix_rows; dummy_Matrix : Real_Matrix (1 .. dummy_Matrix_rows, 1 .. dummy_Matrix_rows); short_vector : Real_Vector (1 .. 1); real_eigenvalues : Real_Vector (1 .. eigenvalues_rows); imag_eigenvalues : Real_Vector (1 .. eigenvalues_rows); eigenvalues : Complex_Vector (1 .. eigenvalues_rows); return_code : Integer := 0; begin if matrix_rows /= matrix_cols then raise Constraint_Error with "[Eigenvalues] source matrix must be square"; end if; GEEV (JOBVL => 'N', JOBVR => 'N', A => matrix, LDA => matrix_rows, N => matrix_cols, WR => real_eigenvalues, WI => imag_eigenvalues, VL => dummy_Matrix, VR => dummy_Matrix, LDVL => dummy_Matrix_rows, LDVR => dummy_Matrix_rows, WORK => short_vector, LWORK => -1, INFO => return_code); declare work_vector_rows : Integer := Integer (short_vector (1)); work_vector : Real_Vector (1 .. work_vector_rows); begin GEEV (JOBVL => 'N', JOBVR => 'N', A => matrix, N => matrix_cols, LDA => matrix_rows, WR => real_eigenvalues, WI => imag_eigenvalues, VL => dummy_Matrix, VR => dummy_Matrix, LDVL => dummy_Matrix_rows, LDVR => dummy_Matrix_rows, WORK => work_vector, LWORK => work_vector_rows, INFO => return_code); if return_code /= 0 then lapack_return_code := return_code; raise Constraint_Error with "[Eigenvalues] failed to find all eigenvalues"; end if; for i in 1 .. eigenvalues_rows loop eigenvalues (i) := Complex'(real_eigenvalues (i), imag_eigenvalues (i)); end loop; end; return eigenvalues; end Eigenvalues; function Eigenvalues (Source : Complex_Matrix) return Complex_Vector is matrix : Complex_Matrix := Source; matrix_rows : Integer := matrix'Length (1); matrix_cols : Integer := matrix'Length (2); eigenvalues_rows : Integer := matrix_rows; dummy_Matrix_rows : Integer := matrix_rows; dummy_Matrix : Complex_Matrix (1 .. dummy_Matrix_rows, 1 .. dummy_Matrix_rows); short_vector : Complex_Vector (1 .. 1); temp_vector : Real_Vector (1 .. 2 * matrix_rows); eigenvalues : Complex_Vector (1 .. eigenvalues_rows); return_code : Integer := 0; begin if matrix_rows /= matrix_cols then raise Constraint_Error with "[Eigenvalues] source matrix must be square"; end if; GEEV (JOBVL => 'N', JOBVR => 'N', A => matrix, LDA => matrix_rows, N => matrix_cols, W => eigenvalues, VL => dummy_Matrix, VR => dummy_Matrix, LDVL => dummy_Matrix_rows, LDVR => dummy_Matrix_rows, WORK => short_vector, LWORK => -1, RWORK => temp_vector, INFO => return_code); declare work_vector_rows : Integer := Integer (short_vector (1).Re); work_vector : Complex_Vector (1 .. work_vector_rows); begin GEEV (JOBVL => 'N', JOBVR => 'N', A => matrix, N => matrix_cols, LDA => matrix_rows, W => eigenvalues, VL => dummy_Matrix, VR => dummy_Matrix, LDVL => dummy_Matrix_rows, LDVR => dummy_Matrix_rows, WORK => work_vector, LWORK => work_vector_rows, RWORK => temp_vector, INFO => return_code); if return_code /= 0 then lapack_return_code := return_code; raise Constraint_Error with "[Eigenvalues] failed to find all eigenvalues"; end if; end; return eigenvalues; end Eigenvalues; function EigenvaluesRealSymm (Source : Real_Matrix) return Real_Vector is matrix : Real_Matrix := Source; matrix_rows : Integer := matrix'Length (1); matrix_cols : Integer := matrix'Length (2); eigenvalues_rows : Integer := matrix_rows; eigenvalues : Real_Vector (1 .. eigenvalues_rows); short_vector : Real_Vector (1 .. 1); return_code : Integer := 0; begin if matrix_rows /= matrix_cols then raise Constraint_Error with "[EigenvaluesRealSymm] source matrix must be square"; end if; SYEV (JOBZ => 'N', UPLO => 'L', A => matrix, N => matrix_cols, LDA => matrix_rows, W => eigenvalues, WORK => short_vector, LWORK => -1, INFO => return_code); declare work_vector_rows : Integer := Integer (short_vector (1)); work_vector : Real_Vector (1 .. work_vector_rows); begin SYEV (JOBZ => 'N', UPLO => 'L', A => matrix, N => matrix_cols, LDA => matrix_rows, W => eigenvalues, WORK => work_vector, LWORK => work_vector_rows, INFO => return_code); if return_code /= 0 then lapack_return_code := return_code; raise Constraint_Error with "[EigenvaluesRealSymm] failed to find all eigenvalues"; end if; end; return eigenvalues; end EigenvaluesRealSymm; function EigenvaluesHermSymm (Source : Complex_Matrix) return Real_Vector is matrix : Complex_Matrix := Source; matrix_rows : Integer := matrix'Length (1); matrix_cols : Integer := matrix'Length (2); eigenvalues_rows : Integer := matrix_rows; eigenvalues : Real_Vector (1 .. eigenvalues_rows); short_vector : Complex_Vector (1 .. 1); temp_vector : Real_Vector (1 .. 3 * matrix_rows - 2); return_code : Integer := 0; begin if matrix_rows /= matrix_cols then raise Constraint_Error with "[EigenvaluesHermSymm] source matrix must be square"; end if; HEEV (JOBZ => 'N', UPLO => 'L', A => matrix, N => matrix_cols, LDA => matrix_rows, W => eigenvalues, WORK => short_vector, LWORK => -1, RWORK => temp_vector, INFO => return_code); declare work_vector_rows : Integer := Integer (short_vector (1).Re); work_vector : Complex_Vector (1 .. work_vector_rows); begin HEEV (JOBZ => 'N', UPLO => 'L', A => matrix, N => matrix_cols, LDA => matrix_rows, W => eigenvalues, WORK => work_vector, LWORK => work_vector_rows, RWORK => temp_vector, INFO => return_code); if return_code /= 0 then lapack_return_code := return_code; raise Constraint_Error with "[EigenvaluesHermSymm] failed to find all eigenvalues"; end if; end; return eigenvalues; end EigenvaluesHermSymm; procedure Eigensystem (Source : Real_Matrix; Eigenvalues : out Complex_Vector; Eigenvectors : out Complex_Matrix) is i, j : Integer; matrix : Real_Matrix := Source; matrix_rows : Integer := matrix'Length (1); matrix_cols : Integer := matrix'Length (2); eigenvalues_rows : Integer := Eigenvalues'Length; eigenvectors_rows : Integer := Eigenvectors'Length (1); eigenvectors_cols : Integer := Eigenvectors'Length (2); real_eigenvalues : Real_Vector (1 .. eigenvalues_rows); imag_eigenvalues : Real_Vector (1 .. eigenvalues_rows); left_eigenvectors : Real_Matrix (1 .. eigenvectors_rows, 1 .. eigenvectors_cols); right_eigenvectors : Real_Matrix (1 .. eigenvectors_rows, 1 .. eigenvectors_cols); short_vector : Real_Vector (1 .. 1); return_code : Integer := 0; begin if matrix_rows /= matrix_cols then raise Constraint_Error with "[Eigensystem] source matrix must be square"; end if; if eigenvectors_rows /= eigenvectors_cols then raise Constraint_Error with "[Eigensystem] matrix of eigenvectors must be square"; end if; if eigenvalues_rows /= matrix_rows then raise Constraint_Error with "[Eigensystem] matrix and eigenvectors have different no. of rows"; end if; if eigenvectors_rows /= matrix_rows then raise Constraint_Error with "[Eigensystem] matrix and eigenvalues have different no. of rows"; end if; GEEV (JOBVL => 'N', JOBVR => 'V', A => matrix, LDA => matrix_rows, N => matrix_cols, WR => real_eigenvalues, WI => imag_eigenvalues, VL => left_eigenvectors, VR => right_eigenvectors, LDVL => eigenvectors_rows, LDVR => eigenvectors_rows, WORK => short_vector, LWORK => -1, INFO => return_code); declare work_vector_rows : Integer := Integer (short_vector (1)); work_vector : Real_Vector (1 .. work_vector_rows); begin GEEV (JOBVL => 'N', JOBVR => 'V', A => matrix, N => matrix_cols, LDA => matrix_rows, WR => real_eigenvalues, WI => imag_eigenvalues, VL => left_eigenvectors, VR => right_eigenvectors, LDVL => eigenvectors_rows, LDVR => eigenvectors_rows, WORK => work_vector, LWORK => work_vector_rows, INFO => return_code); if return_code /= 0 then lapack_return_code := return_code; raise Constraint_Error with "[Eigensystem] failed to find all eigenvector/value pairs"; end if; for i in 1 .. eigenvalues_rows loop Eigenvalues (i) := Complex'(real_eigenvalues (i), imag_eigenvalues (i)); end loop; i := 1; while i <= eigenvectors_rows loop j := 1; while j <= eigenvectors_rows loop if imag_eigenvalues (j) /= 0.0e0 then Eigenvectors (i, j) := Complex'(right_eigenvectors (i, j), right_eigenvectors (i, j + 1)); Eigenvectors (i, j + 1) := Complex'(right_eigenvectors (i, j), -right_eigenvectors (i, j + 1)); j := j + 2; else Eigenvectors (i, j) := Complex'(right_eigenvectors (i, j), 0.0e0); j := j + 1; end if; end loop; i := i + 1; end loop; end; end Eigensystem; procedure Eigensystem (Source : Complex_Matrix; Eigenvalues : out Complex_Vector; Eigenvectors : out Complex_Matrix) is matrix : Complex_Matrix := Source; matrix_rows : Integer := matrix'Length (1); matrix_cols : Integer := matrix'Length (2); eigenvalues_rows : Integer := Eigenvalues'Length; eigenvectors_rows : Integer := Eigenvectors'Length (1); eigenvectors_cols : Integer := Eigenvectors'Length (2); left_eigenvectors : Complex_Matrix (1 .. eigenvectors_rows, 1 .. eigenvectors_cols); right_eigenvectors : Complex_Matrix (1 .. eigenvectors_rows, 1 .. eigenvectors_cols); short_vector : Complex_Vector (1 .. 1); temp_vector : Real_Vector (1 .. 2 * matrix_rows); return_code : Integer := 0; begin if matrix_rows /= matrix_cols then raise Constraint_Error with "[Eigensystem] source matrix must be square"; end if; if eigenvectors_rows /= eigenvectors_cols then raise Constraint_Error with "[Eigensystem] matrix of eigenvectors must be square"; end if; if eigenvalues_rows /= matrix_rows then raise Constraint_Error with "[Eigensystem] matrix and eigenvectors have different no. of rows"; end if; if eigenvectors_rows /= matrix_rows then raise Constraint_Error with "[Eigensystem] matrix and eigenvalues have different no. of rows"; end if; GEEV (JOBVL => 'N', JOBVR => 'V', A => matrix, LDA => matrix_rows, N => matrix_cols, W => Eigenvalues, VL => left_eigenvectors, VR => right_eigenvectors, LDVL => eigenvectors_rows, LDVR => eigenvectors_rows, WORK => short_vector, LWORK => -1, RWORK => temp_vector, INFO => return_code); declare work_vector_rows : Integer := Integer (short_vector (1).Re); work_vector : Complex_Vector (1 .. work_vector_rows); begin GEEV (JOBVL => 'N', JOBVR => 'V', A => matrix, N => matrix_cols, LDA => matrix_rows, W => Eigenvalues, VL => left_eigenvectors, VR => right_eigenvectors, LDVL => eigenvectors_rows, LDVR => eigenvectors_rows, WORK => work_vector, LWORK => work_vector_rows, RWORK => temp_vector, INFO => return_code); if return_code /= 0 then lapack_return_code := return_code; raise Constraint_Error with "[Eigensystem] failed to find all eigenvectors/values pairs"; end if; Eigenvectors := right_eigenvectors; end; end Eigensystem; procedure EigensystemRealSymm (Source : Real_Matrix; Eigenvalues : out Real_Vector; Eigenvectors : out Real_Matrix) is matrix : Real_Matrix := Source; matrix_rows : Integer := matrix'Length (1); matrix_cols : Integer := matrix'Length (2); eigenvalues_rows : Integer := Eigenvalues'Length; eigenvectors_rows : Integer := Eigenvectors'Length (1); eigenvectors_cols : Integer := Eigenvectors'Length (2); short_vector : Real_Vector (1 .. 1); return_code : Integer := 0; begin if matrix_rows /= matrix_cols then raise Constraint_Error with "[EigensystemRealSymm] source matrix must be square"; end if; if eigenvectors_rows /= eigenvectors_cols then raise Constraint_Error with "[EigensystemRealSymm] matrix of eigenvectors must be square"; end if; if eigenvalues_rows /= matrix_rows then raise Constraint_Error with "[EigensystemRealSymm] matrix and eigenvectors have different no. of rows"; end if; if eigenvectors_rows /= matrix_rows then raise Constraint_Error with "[EigensystemRealSymm] matrix and eigenvalues have different no. of rows"; end if; SYEV (JOBZ => 'V', UPLO => 'L', A => matrix, N => matrix_cols, LDA => matrix_rows, W => Eigenvalues, WORK => short_vector, LWORK => -1, INFO => return_code); declare work_vector_rows : Integer := Integer (short_vector (1)); work_vector : Real_Vector (1 .. work_vector_rows); begin SYEV (JOBZ => 'V', UPLO => 'L', A => matrix, N => matrix_cols, LDA => matrix_rows, W => Eigenvalues, WORK => work_vector, LWORK => work_vector_rows, INFO => return_code); if return_code /= 0 then lapack_return_code := return_code; raise Constraint_Error with "[EigensystemRealSymm] failed to find all eigenvector/value pairs"; end if; for i in 1 .. matrix_rows loop for j in 1 .. matrix_cols loop Eigenvectors (i, j) := matrix (i, j); end loop; end loop; end; end EigensystemRealSymm; procedure EigensystemHermSymm (Source : Complex_Matrix; Eigenvalues : out Real_Vector; Eigenvectors : out Complex_Matrix) is matrix : Complex_Matrix := Source; matrix_rows : Integer := matrix'Length (1); matrix_cols : Integer := matrix'Length (2); eigenvalues_rows : Integer := Eigenvalues'Length; eigenvectors_rows : Integer := Eigenvectors'Length (1); eigenvectors_cols : Integer := Eigenvectors'Length (2); short_vector : Complex_Vector (1 .. 1); temp_vector : Real_Vector (1 .. 3 * matrix_rows - 2); return_code : Integer := 0; begin if matrix_rows /= matrix_cols then raise Constraint_Error with "[EigensystemHermSymm] source matrix must be square"; end if; if eigenvectors_rows /= eigenvectors_cols then raise Constraint_Error with "[EigensystemHermSymm] matrix of eigenvectors must be square"; end if; if eigenvalues_rows /= matrix_rows then raise Constraint_Error with "[EigensystemHermSymm] matrix and eigenvectors have different no. of rows"; end if; if eigenvectors_rows /= matrix_rows then raise Constraint_Error with "[EigensystemHermSymm] matrix and eigenvalues have different no. of rows"; end if; HEEV (JOBZ => 'V', UPLO => 'L', A => matrix, N => matrix_cols, LDA => matrix_rows, W => Eigenvalues, WORK => short_vector, LWORK => -1, RWORK => temp_vector, INFO => return_code); declare work_vector_rows : Integer := Integer (short_vector (1).Re); work_vector : Complex_Vector (1 .. work_vector_rows); begin HEEV (JOBZ => 'V', UPLO => 'L', A => matrix, N => matrix_cols, LDA => matrix_rows, W => Eigenvalues, WORK => work_vector, LWORK => work_vector_rows, RWORK => temp_vector, INFO => return_code); if return_code /= 0 then lapack_return_code := return_code; raise Constraint_Error with "[EigensystemHermSymm] failed to find all eigenvectors/values pairs"; end if; for i in 1 .. matrix_rows loop for j in 1 .. matrix_cols loop Eigenvectors (i, j) := matrix (i, j); end loop; end loop; end; end EigensystemHermSymm; function MatrixInverse (Source : Real_Matrix) return Real_Matrix is matrix : Real_Matrix := source; matrix_rows : Integer := Matrix'Length (1); matrix_cols : Integer := Matrix'Length (2); pivots : Integer_Vector (1..matrix_rows); short_vector : Real_Vector (1..1); return_code : Integer := 0; begin if matrix_rows /= matrix_cols then raise Constraint_Error with "MatrixInverse: source matrix must be square"; end if; GETRF ( A => matrix, M => matrix_rows, N => matrix_rows, LDA => matrix_rows, IPIV => pivots, INFO => return_code ); GETRI ( A => matrix, N => matrix_rows, LDA => matrix_rows, IPIV => pivots, WORK => short_vector, LWORK => -1, INFO => return_code); declare work_vector_rows : Integer := Integer( short_vector(1) ); work_vector : Real_Vector (1 .. work_vector_rows); begin GETRI ( A => matrix, N => matrix_rows, LDA => matrix_rows, IPIV => pivots, WORK => work_vector, LWORK => work_vector_rows, INFO => return_code); if return_code /= 0 then lapack_return_code := return_code; raise Constraint_Error with "MatrixInverse: matrix is singular"; end if; end; return matrix; end MatrixInverse; function MatrixInverse (Source : Complex_Matrix) return Complex_Matrix is matrix : Complex_Matrix := source; matrix_rows : Integer := Matrix'Length (1); matrix_cols : Integer := Matrix'Length (2); pivots : Integer_Vector (1..matrix_rows); short_vector : Complex_Vector (1..1); return_code : Integer := 0; begin if matrix_rows /= matrix_cols then raise Constraint_Error with "MatrixInverse: source matrix must be square"; end if; GETRF ( A => matrix, M => matrix_rows, N => matrix_rows, LDA => matrix_rows, IPIV => pivots, INFO => return_code ); GETRI ( A => matrix, N => matrix_rows, LDA => matrix_rows, IPIV => pivots, WORK => short_vector, LWORK => -1, INFO => return_code); declare work_vector_rows : Integer := Integer( short_vector(1).Re ); work_vector : Complex_Vector (1 .. work_vector_rows); begin GETRI ( A => matrix, N => matrix_rows, LDA => matrix_rows, IPIV => pivots, WORK => work_vector, LWORK => work_vector_rows, INFO => return_code); if return_code /= 0 then lapack_return_code := return_code; raise Constraint_Error with "MatrixInverse: matrix is singular"; end if; end; return matrix; end MatrixInverse; function SolveSystem (Source_mat : Real_Matrix; Source_rhs : Real_Vector) return Real_Vector is matrix : Real_Matrix := Source_mat; rhs : Real_Vector := Source_rhs; matrix_rows : Integer := matrix'Length (1); matrix_cols : Integer := matrix'Length (2); rhs_rows : Integer := rhs'Length (1); rhs_cols : Integer := 1; mixed_sol_rhs : Real_Matrix (1..matrix_rows,1..1); solution : Real_Vector (1..matrix_rows); pivots : Integer_Vector (1..matrix_rows); return_code : Integer := 0; begin if matrix_rows /= matrix_cols then raise Constraint_Error with "[SolveSystem] source matrix must be square"; end if; if rhs_rows /= matrix_rows then raise Constraint_Error with "[SolveSystem] matrix and rhs must have equal no. of rows"; end if; for i in 1..rhs_rows loop mixed_sol_rhs (i,1) := rhs (i); end loop; GESV (A => matrix, LDA => matrix_rows, N => matrix_rows, IPIV => pivots, B => mixed_sol_rhs, LDB => matrix_rows, NRHS => 1, INFO => return_code); if return_code /= 0 then lapack_return_code := return_code; raise Constraint_Error with "[SolveSystem] matrix may be singular"; end if; for i in 1..rhs_rows loop solution (i) := mixed_sol_rhs (i,1); end loop; return solution; end SolveSystem; function SolveSystem (Source_mat : Complex_Matrix; Source_rhs : Complex_Vector) return Complex_Vector is matrix : Complex_Matrix := Source_mat; rhs : Complex_Vector := Source_rhs; matrix_rows : Integer := matrix'Length (1); matrix_cols : Integer := matrix'Length (2); rhs_rows : Integer := rhs'Length (1); rhs_cols : Integer := 1; mixed_sol_rhs : Complex_Matrix (1..matrix_rows,1..1); solution : Complex_Vector (1..matrix_rows); pivots : Integer_Vector (1..matrix_rows); return_code : Integer := 0; begin if matrix_rows /= matrix_cols then raise Constraint_Error with "[SolveSystem] source matrix must be square"; end if; if rhs_rows /= matrix_rows then raise Constraint_Error with "[SolveSystem] matrix and rhs must have equal no. of rows"; end if; for i in 1..rhs_rows loop mixed_sol_rhs (i,1) := rhs (i); end loop; GESV (A => matrix, LDA => matrix_rows, N => matrix_rows, IPIV => pivots, B => mixed_sol_rhs, LDB => matrix_rows, NRHS => 1, INFO => return_code); if return_code /= 0 then lapack_return_code := return_code; raise Constraint_Error with "[SolveSystem] matrix may be singular"; end if; for i in 1..rhs_rows loop solution (i) := mixed_sol_rhs (i,1); end loop; return solution; end SolveSystem; function SolveSystem (Source_mat : Real_Matrix; Source_rhs : Real_Matrix) return Real_Matrix is matrix : Real_Matrix := Source_mat; rhs : Real_Matrix := Source_rhs; matrix_rows : Integer := matrix'Length (1); matrix_cols : Integer := matrix'Length (2); rhs_rows : Integer := rhs'Length (1); rhs_cols : Integer := rhs'Length (2); solution : Real_Matrix := rhs; solution_rows : Integer := rhs_rows; solution_cols : Integer := rhs_cols; pivots : Integer_Vector (1 .. matrix_rows); return_code : Integer := 0; begin if matrix_rows /= matrix_cols then raise Constraint_Error with "[SolveSystem] source matrix must be square"; end if; if rhs_rows /= matrix_rows then raise Constraint_Error with "[SolveSystem] matrix and rhs must have equal no. of rows"; end if; GESV (A => matrix, LDA => matrix_rows, N => matrix_rows, IPIV => pivots, B => solution, LDB => solution_rows, NRHS => solution_cols, INFO => return_code); if return_code /= 0 then lapack_return_code := return_code; raise Constraint_Error with "[SolveSystem] matrix may be singular"; end if; return solution; end SolveSystem; function SolveSystem (Source_mat : Complex_Matrix; Source_rhs : Complex_Matrix) return Complex_Matrix is matrix : Complex_Matrix := Source_mat; rhs : Complex_Matrix := Source_rhs; matrix_rows : Integer := matrix'Length (1); matrix_cols : Integer := matrix'Length (2); rhs_rows : Integer := rhs'Length (1); rhs_cols : Integer := rhs'Length (2); solution : Complex_Matrix := rhs; solution_rows : Integer := rhs_rows; solution_cols : Integer := rhs_cols; pivots : Integer_Vector (1 .. matrix_rows); return_code : Integer := 0; begin if matrix_rows /= matrix_cols then raise Constraint_Error with "[SolveSystem] source matrix must be square"; end if; if rhs_rows /= matrix_rows then raise Constraint_Error with "[SolveSystem] matrix and rhs must have equal no. of rows"; end if; GESV (A => matrix, LDA => matrix_rows, N => matrix_rows, IPIV => pivots, B => solution, LDB => solution_rows, NRHS => solution_cols, INFO => return_code); if return_code /= 0 then lapack_return_code := return_code; raise Constraint_Error with "[SolveSystem] matrix may be singular"; end if; return solution; end SolveSystem; function SolveSystemRealSymm (Source_mat : Real_Matrix; Source_rhs : Real_Matrix) return Real_Matrix is matrix : Real_Matrix := Source_mat; rhs : Real_Matrix := Source_rhs; matrix_rows : Integer := matrix'Length (1); matrix_cols : Integer := matrix'Length (2); rhs_rows : Integer := rhs'Length (1); rhs_cols : Integer := rhs'Length (2); pivots : Integer_Vector (1 .. matrix_rows); short_vector : Real_Vector (1..1); return_code : Integer := 0; begin if matrix_rows /= matrix_cols then raise Constraint_Error with "[SolveSystemRealSymm] source matrix must be square"; end if; if rhs_rows /= matrix_rows then raise Constraint_Error with "[SolveSystemRealSymm] matrix and rhs must have equal no. of rows"; end if; SYSV ( UPLO => 'L', A => matrix, LDA => matrix_rows, N => matrix_cols, B => rhs, LDB => rhs_rows, NRHS => rhs_cols, IPIV => pivots, WORK => short_vector, LWORK => -1, INFO => return_code ); declare work_vector_max : Constant Integer := Integer( short_vector(1) ); work_vector : Real_Vector (1 .. work_vector_max); begin SYSV ( UPLO => 'L', A => matrix, LDA => matrix_rows, N => matrix_cols, B => rhs, LDB => rhs_rows, NRHS => rhs_cols, IPIV => pivots, WORK => work_vector, LWORK => work_vector_max, INFO => return_code ); end; if return_code /= 0 then lapack_return_code := return_code; raise Constraint_Error with "[SolveSystemRealSymm] matrix may be singular"; end if; return rhs; end SolveSystemRealSymm; function SolveSystemHermSymm (Source_mat : Complex_Matrix; Source_rhs : Complex_Matrix) return Complex_Matrix is matrix : Complex_Matrix := Source_mat; rhs : Complex_Matrix := Source_rhs; matrix_rows : Integer := matrix'Length (1); matrix_cols : Integer := matrix'Length (2); rhs_rows : Integer := rhs'Length (1); rhs_cols : Integer := rhs'Length (2); pivots : Integer_Vector (1 .. matrix_rows); short_vector : Complex_Vector (1..1); return_code : Integer := 0; begin if matrix_rows /= matrix_cols then raise Constraint_Error with "[SolveSystemHermSymm] source matrix must be square"; end if; if rhs_rows /= matrix_rows then raise Constraint_Error with "[SolveSystemHermSymm] matrix and rhs must have equal no. of rows"; end if; SYSV ( UPLO => 'L', A => matrix, LDA => matrix_rows, N => matrix_cols, B => rhs, LDB => rhs_rows, NRHS => rhs_cols, IPIV => pivots, WORK => short_vector, LWORK => -1, INFO => return_code ); declare work_vector_max : Constant Integer := Integer( short_vector(1).Re ); work_vector : Complex_Vector (1 .. work_vector_max); begin SYSV ( UPLO => 'L', A => matrix, LDA => matrix_rows, N => matrix_cols, B => rhs, LDB => rhs_rows, NRHS => rhs_cols, IPIV => pivots, WORK => work_vector, LWORK => work_vector_max, INFO => return_code ); end; if return_code /= 0 then lapack_return_code := return_code; raise Constraint_Error with "[SolveSystemHermSymm] matrix may be singular"; end if; return rhs; end SolveSystemHermSymm; procedure SolveSystem (Solution : out Real_Vector; Source_mat : Real_Matrix; Source_rhs : Real_Vector; Size : Integer) is matrix : Real_Matrix (1..size,1..size); mixed_sol_rhs : Real_Matrix (1..size,1..1); pivots : Integer_Vector (1..size); return_code : Integer := 0; begin if size > matrix'length(1) then raise Constraint_Error with "[SolveSystem] no. rows in matrix less than size"; end if; if size > matrix'length(2) then raise Constraint_Error with "[SolveSystem] no. columns in matrix less than size"; end if; for i in 1..size loop mixed_sol_rhs (i,1) := Source_rhs (i); for j in 1..size loop matrix (i,j) := Source_mat (i,j); end loop; end loop; GESV (A => matrix, LDA => size, N => size, IPIV => pivots, B => mixed_sol_rhs, LDB => size, NRHS => 1, INFO => return_code); if return_code /= 0 then lapack_return_code := return_code; raise Constraint_Error with "[SolveSystem] matrix may be singular"; end if; for i in 1..size loop solution (i) := mixed_sol_rhs (i,1); end loop; end SolveSystem; procedure SolveSystem (Solution : out Complex_Vector; Source_mat : Complex_Matrix; Source_rhs : Complex_Vector; Size : Integer) is matrix : Complex_Matrix (1..size,1..size); mixed_sol_rhs : Complex_Matrix (1..size,1..1); pivots : Integer_Vector (1..size); return_code : Integer := 0; begin if size > matrix'length(1) then raise Constraint_Error with "[SolveSystem] no. rows in matrix less than size"; end if; if size > matrix'length(2) then raise Constraint_Error with "[SolveSystem] no. columns in matrix less than size"; end if; for i in 1..size loop mixed_sol_rhs (i,1) := Source_rhs (i); for j in 1..size loop matrix (i,j) := Source_mat (i,j); end loop; end loop; GESV (A => matrix, LDA => size, N => size, IPIV => pivots, B => mixed_sol_rhs, LDB => size, NRHS => 1, INFO => return_code); if return_code /= 0 then lapack_return_code := return_code; raise Constraint_Error with "[SolveSystem] matrix may be singular"; end if; for i in 1..size loop solution (i) := mixed_sol_rhs (i,1); end loop; end SolveSystem; end Ada_Lapack.Extras;
charlie5/cBound
Ada
1,545
ads
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_list_fonts_request_t is -- Item -- type Item is record major_opcode : aliased Interfaces.Unsigned_8; pad0 : aliased Interfaces.Unsigned_8; length : aliased Interfaces.Unsigned_16; max_names : aliased Interfaces.Unsigned_16; pattern_len : aliased Interfaces.Unsigned_16; end record; -- Item_Array -- type Item_Array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_list_fonts_request_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_list_fonts_request_t.Item, Element_Array => xcb.xcb_list_fonts_request_t.Item_Array, Default_Terminator => (others => <>)); subtype Pointer is C_Pointers.Pointer; -- Pointer_Array -- type Pointer_Array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_list_fonts_request_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_list_fonts_request_t.Pointer, Element_Array => xcb.xcb_list_fonts_request_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_list_fonts_request_t;
mgrojo/smk
Ada
2,415
adb
-- ----------------------------------------------------------------------------- -- smk, the smart make -- © 2018 Lionel Draghi <[email protected]> -- SPDX-License-Identifier: APSL-2.0 -- ----------------------------------------------------------------------------- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- http://www.apache.org/licenses/LICENSE-2.0 -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- ----------------------------------------------------------------------------- with Ada.Text_IO; use Ada.Text_IO; separate (Smk.Main) -- ----------------------------------------------------------------------------- procedure Put_Help is begin New_Line; Put_Line ("Usage : smk [Options] make_file"); New_Line; Put_Line ("Options :"); Put_Line (" -a | --always-make : unconditionally make all targets"); Put_Line (" -e | --explain : explain why each target is made"); Put_Line (" -n | --dry-run : print the commands that would" & " be executed, but do not execute them"); Put_Line (" -i | --ignore-errors : ignore all errors in commands" & " executed to remake files"); New_Line; Put_Line (" -lm | --list_makefile : dump Smk understanding of the" & " Makefile"); New_Line; Put_Line (" -ls | --list_saved_run : dump what Smk stored of the previous" & " run of this Makefile"); New_Line; Put_Line (" --clean : remove all local Smk files" & " (equivalent to rm .smk.*)"); New_Line; Put_Line (" -We | --Warnings=error : treat warnings as errors"); Put_Line (" -v | --verbose"); Put_Line (" -q | --quiet : no message unless error."); Put_Line (" Warning are also ignored."); Put_Line (" --version : Smk version"); Put_Line (" -h | --help : this message"); New_Line; Put_Line ("https://github.com/LionelDraghi/smk"); New_Line; end Put_Help;
MinimSecure/unum-sdk
Ada
1,037
adb
-- Copyright 2015-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/>. package body Pck is function Get (N : Integer) return Record_Type is Result : Record_Type (N); begin for I in 1 .. N loop Result.A (I) := 10 * I; end loop; return Result; end Get; procedure Do_Nothing (A : System.Address) is begin null; end Do_Nothing; end Pck;
reznikmm/matreshka
Ada
3,621
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.Elements.Generic_Hash; function AMF.Utp.Managed_Elements.Hash is new AMF.Elements.Generic_Hash (Utp_Managed_Element, Utp_Managed_Element_Access);
rveenker/sdlada
Ada
1,696
adb
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2020, Luke A. Guest -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- with Interfaces.C; with Interfaces.C.Strings; with System; package body SDL.Images.Versions is package C renames Interfaces.C; procedure Linked_With (Info : in out SDL.Versions.Version) is function IMG_Linked_Version return access SDL.Versions.Version with Import => True, Convention => C, External_Name => "IMG_Linked_Version"; Data : access SDL.Versions.Version := IMG_Linked_Version; begin Info := Data.all; end Linked_With; end SDL.Images.Versions;
google-code/ada-security
Ada
5,197
adb
----------------------------------------------------------------------- -- Security-oayth-jwt-tests - Unit tests for JSON Web Token -- Copyright (C) 2013 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Calendar.Formatting; with Util.Test_Caller; package body Security.OAuth.JWT.Tests is package Caller is new Util.Test_Caller (Test, "Security.OAuth.JWT"); -- A JWT token returned by Google+. K : constant String := "eyJhbGciOiJSUzI1NiIsImtpZCI6IjVmOTBlMWExMGE4YzgwZWJhZWNmYzM4NzBjZDl" & "lMGVhMGI3ZDVmZGMifQ.eyJpc3MiOiJhY2NvdW50cy5nb29nbGUuY29tIiwiYXRfaGFzaCI6Im9Ka19EYnFvb1" & "FVc0FhY3k2cnkxeHciLCJhdWQiOiI4NzI2NTU5OTQwMTQuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJz" & "dWIiOiIxMDgzNjA3MDMwOTk3MDg5Nzg4NzAiLCJlbWFpbF92ZXJpZmllZCI6InRydWUiLCJhenAiOiI4NzI2NT" & "U5OTQwMTQuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJlbWFpbCI6InN0ZXBoYW5lLmNhcnJlekBnbWFp" & "bC5jb20iLCJpYXQiOjEzNjg5NjgyMzMsImV4cCI6MTM2ODk3MjEzM30.UL1qp2wmleV-ED2A_hlqgDLIGgJB3f" & "_N7fiz1CgttJcwbmMVwhag3ox2WE9C1KwXhrjwT8eigZ0WkDys5WO1dYs2G1QbDZPnsYYMyHK9XpycaDMEKtVZ" & "C4C6DkB1SrBHbN0Tv6ExWpszzp1JEL8nZnHd3T_AA3paqONnkvQw_yo"; procedure Test_Operation (T : in out Test) is R : Token; begin R := Decode (K); Util.Tests.Assert_Equals (T, Value, Get (R), "Extraction failed"); end Test_Operation; procedure Test_Time_Operation (T : in out Test) is R : Token; begin R := Decode (K); Util.Tests.Assert_Equals (T, Value, Ada.Calendar.Formatting.Image (Get (R)), "Extraction failed"); end Test_Time_Operation; procedure Test_Get_Issuer is new Test_Operation (Get_Issuer, "accounts.google.com"); procedure Test_Get_Audience is new Test_Operation (Get_Audience, "872655994014.apps.googleusercontent.com"); procedure Test_Get_Subject is new Test_Operation (Get_Subject, "108360703099708978870"); procedure Test_Get_Authorized_Presenters is new Test_Operation (Get_Authorized_Presenters, "872655994014.apps.googleusercontent.com"); procedure Test_Get_Expiration is new Test_Time_Operation (Get_Expiration, "2013-05-19 14:02:13"); procedure Test_Get_Issued_At is new Test_Time_Operation (Get_Issued_At, "2013-05-19 12:57:13"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Security.OAuth.JWT.Decode", Test_Get_Issuer'Access); Caller.Add_Test (Suite, "Test Security.OAuth.JWT.Get_Issuer", Test_Get_Issuer'Access); Caller.Add_Test (Suite, "Test Security.OAuth.JWT.Get_Audience", Test_Get_Audience'Access); Caller.Add_Test (Suite, "Test Security.OAuth.JWT.Get_Subject", Test_Get_Subject'Access); Caller.Add_Test (Suite, "Test Security.OAuth.JWT.Get_Authorized_Presenters", Test_Get_Authorized_Presenters'Access); Caller.Add_Test (Suite, "Test Security.OAuth.JWT.Get_Expiration", Test_Get_Expiration'Access); Caller.Add_Test (Suite, "Test Security.OAuth.JWT.Get_Authentication_Time", Test_Get_Issued_At'Access); Caller.Add_Test (Suite, "Test Security.OAuth.JWT.Decode (error)", Test_Decode_Error'Access); end Add_Tests; -- ------------------------------ -- Test Decode operation with errors. -- ------------------------------ procedure Test_Decode_Error (T : in out Test) is K : constant String := "eyJhbxGciOiJSUzI1NiIsImtpZCI6IjVmOTBlMWExMGE4YzgwZWJhZWNmYzM4NzBjZDl" & "lMGVhMGI3ZDVmZGMifQ.eyJpc3xMiOiJhY2NvdW50cy5nb29nbGUuY29tIiwiYXRfaGFzaCI6Im9Ka19EYnFvb1" & "FVc0FhY3k2cnkxeHciLCJhdWQiOiI4NzI2NTU5OTQwMTQuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJz" & "dWIiOiIxMDgzNjA3MDMwOTk3MDg5Nzg4NzAiLCJlbWFpbF92ZXJpZmllZCI6InRydWUiLCJhenAiOiI4NzI2NT" & "U5OTQwMTQuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJlbWFpbCI6InN0ZXBoYW5lLmNhcnJlekBnbWFp" & "bC5jb20iLCJpYXQiOjEzNjg5NjgyMzMsImV4cCI6MTM2ODk3MjEzM30.UL1qp2wmleV-ED2A_hlqgDLIGgJB3f" & "_N7fiz1CgttJcwbmMVwhag3ox2WE9C1KwXhrjwT8eigZ0WkDys5WO1dYs2G1QbDZPnsYYMyHK9XpycaDMEKtVZ" & "C4C6DkB1SrBHbN0Tv6ExWpszzp1JEL8nZnHd3T_AA3paqONnkvQw_yx"; R : Token; begin R := Decode (K); T.Fail ("No exception raised"); T.Assert (False, "Bad"); exception when Invalid_Token => null; end Test_Decode_Error; end Security.OAuth.JWT.Tests;
shinesolutions/swagger-aem
Ada
22,735
ads
-- Adobe Experience Manager (AEM) API -- Swagger AEM is an OpenAPI specification for Adobe Experience Manager (AEM) API -- -- The version of the OpenAPI document: 3.5.0_pre.0 -- Contact: [email protected] -- -- NOTE: This package is auto generated by OpenAPI-Generator 5.2.1. -- https://openapi-generator.tech -- Do not edit the class manually. with .Models; with Swagger.Clients; package .Clients is pragma Style_Checks ("-mr"); type Client_Type is new Swagger.Clients.Client_Type with null record; -- procedure Get_Aem_Product_Info (Client : in out Client_Type; Result : out Swagger.UString_Vectors.Vector); -- procedure Get_Bundle_Info (Client : in out Client_Type; Name : in Swagger.UString; Result : out .Models.BundleInfo_Type); -- procedure Get_Config_Mgr (Client : in out Client_Type; Result : out Swagger.UString); -- procedure Post_Bundle (Client : in out Client_Type; Name : in Swagger.UString; Action : in Swagger.UString); -- procedure Post_Jmx_Repository (Client : in out Client_Type; Action : in Swagger.UString); -- procedure Post_Saml_Configuration (Client : in out Client_Type; Post : in Swagger.Nullable_Boolean; Apply : in Swagger.Nullable_Boolean; Delete : in Swagger.Nullable_Boolean; Action : in Swagger.Nullable_UString; Dollarlocation : in Swagger.Nullable_UString; Path : in Swagger.UString_Vectors.Vector; Service_Periodranking : in Swagger.Nullable_Integer; Idp_Url : in Swagger.Nullable_UString; Idp_Cert_Alias : in Swagger.Nullable_UString; Idp_Http_Redirect : in Swagger.Nullable_Boolean; Service_Provider_Entity_Id : in Swagger.Nullable_UString; Assertion_Consumer_Service_URL : in Swagger.Nullable_UString; Sp_Private_Key_Alias : in Swagger.Nullable_UString; Key_Store_Password : in Swagger.Nullable_UString; Default_Redirect_Url : in Swagger.Nullable_UString; User_IDAttribute : in Swagger.Nullable_UString; Use_Encryption : in Swagger.Nullable_Boolean; Create_User : in Swagger.Nullable_Boolean; Add_Group_Memberships : in Swagger.Nullable_Boolean; Group_Membership_Attribute : in Swagger.Nullable_UString; Default_Groups : in Swagger.UString_Vectors.Vector; Name_Id_Format : in Swagger.Nullable_UString; Synchronize_Attributes : in Swagger.UString_Vectors.Vector; Handle_Logout : in Swagger.Nullable_Boolean; Logout_Url : in Swagger.Nullable_UString; Clock_Tolerance : in Swagger.Nullable_Integer; Digest_Method : in Swagger.Nullable_UString; Signature_Method : in Swagger.Nullable_UString; User_Intermediate_Path : in Swagger.Nullable_UString; Propertylist : in Swagger.UString_Vectors.Vector; Result : out .Models.SamlConfigurationInfo_Type); -- procedure Get_Login_Page (Client : in out Client_Type; Result : out Swagger.UString); -- procedure Post_Cq_Actions (Client : in out Client_Type; Authorizable_Id : in Swagger.UString; Changelog : in Swagger.UString); -- procedure Get_Crxde_Status (Client : in out Client_Type; Result : out Swagger.UString); -- procedure Get_Install_Status (Client : in out Client_Type; Result : out .Models.InstallStatus_Type); -- procedure Get_Package_Manager_Servlet (Client : in out Client_Type); -- procedure Post_Package_Service (Client : in out Client_Type; Cmd : in Swagger.UString; Result : out Swagger.UString); -- procedure Post_Package_Service_Json (Client : in out Client_Type; Path : in Swagger.UString; Cmd : in Swagger.UString; Group_Name : in Swagger.Nullable_UString; Package_Name : in Swagger.Nullable_UString; Package_Version : in Swagger.Nullable_UString; Charset : in Swagger.Nullable_UString; Force : in Swagger.Nullable_Boolean; Recursive : in Swagger.Nullable_Boolean; P_Package : in Swagger.File_Part_Type; Result : out Swagger.UString); -- procedure Post_Package_Update (Client : in out Client_Type; Group_Name : in Swagger.UString; Package_Name : in Swagger.UString; Version : in Swagger.UString; Path : in Swagger.UString; Filter : in Swagger.Nullable_UString; Charset : in Swagger.Nullable_UString; Result : out Swagger.UString); -- procedure Post_Set_Password (Client : in out Client_Type; Old : in Swagger.UString; Plain : in Swagger.UString; Verify : in Swagger.UString; Result : out Swagger.UString); -- procedure Get_Aem_Health_Check (Client : in out Client_Type; Tags : in Swagger.Nullable_UString; Combine_Tags_Or : in Swagger.Nullable_Boolean; Result : out Swagger.UString); -- procedure Post_Config_Aem_Health_Check_Servlet (Client : in out Client_Type; Bundles_Periodignored : in Swagger.UString_Vectors.Vector; Bundles_Periodignored_At_Type_Hint : in Swagger.Nullable_UString); -- procedure Post_Config_Aem_Password_Reset (Client : in out Client_Type; Pwdreset_Periodauthorizables : in Swagger.UString_Vectors.Vector; Pwdreset_Periodauthorizables_At_Type_Hint : in Swagger.Nullable_UString); -- procedure Ssl_Setup (Client : in out Client_Type; Keystore_Password : in Swagger.UString; Keystore_Password_Confirm : in Swagger.UString; Truststore_Password : in Swagger.UString; Truststore_Password_Confirm : in Swagger.UString; Https_Hostname : in Swagger.UString; Https_Port : in Swagger.UString; Privatekey_File : in Swagger.File_Part_Type; Certificate_File : in Swagger.File_Part_Type; Result : out Swagger.UString); -- procedure Delete_Agent (Client : in out Client_Type; Runmode : in Swagger.UString; Name : in Swagger.UString); -- procedure Delete_Node (Client : in out Client_Type; Path : in Swagger.UString; Name : in Swagger.UString); -- procedure Get_Agent (Client : in out Client_Type; Runmode : in Swagger.UString; Name : in Swagger.UString); -- procedure Get_Agents (Client : in out Client_Type; Runmode : in Swagger.UString; Result : out Swagger.UString); -- procedure Get_Authorizable_Keystore (Client : in out Client_Type; Intermediate_Path : in Swagger.UString; Authorizable_Id : in Swagger.UString; Result : out .Models.KeystoreInfo_Type); -- procedure Get_Keystore (Client : in out Client_Type; Intermediate_Path : in Swagger.UString; Authorizable_Id : in Swagger.UString; Result : out Swagger.Http_Content_Type); -- procedure Get_Node (Client : in out Client_Type; Path : in Swagger.UString; Name : in Swagger.UString); -- procedure Get_Package (Client : in out Client_Type; Group : in Swagger.UString; Name : in Swagger.UString; Version : in Swagger.UString; Result : out Swagger.Http_Content_Type); -- procedure Get_Package_Filter (Client : in out Client_Type; Group : in Swagger.UString; Name : in Swagger.UString; Version : in Swagger.UString; Result : out Swagger.UString); -- procedure Get_Query (Client : in out Client_Type; Path : in Swagger.UString; P_Periodlimit : in Swagger.Number; P_1Property : in Swagger.UString; P_1Property_Periodvalue : in Swagger.UString; Result : out Swagger.UString); -- procedure Get_Truststore (Client : in out Client_Type; Result : out Swagger.Http_Content_Type); -- procedure Get_Truststore_Info (Client : in out Client_Type; Result : out .Models.TruststoreInfo_Type); -- procedure Post_Agent (Client : in out Client_Type; Runmode : in Swagger.UString; Name : in Swagger.UString; Jcr_Content_Slashcq_Distribute : in Swagger.Nullable_Boolean; Jcr_Content_Slashcq_Distribute_At_Type_Hint : in Swagger.Nullable_UString; Jcr_Content_Slashcq_Name : in Swagger.Nullable_UString; Jcr_Content_Slashcq_Template : in Swagger.Nullable_UString; Jcr_Content_Slashenabled : in Swagger.Nullable_Boolean; Jcr_Content_Slashjcr_Description : in Swagger.Nullable_UString; Jcr_Content_Slashjcr_Last_Modified : in Swagger.Nullable_UString; Jcr_Content_Slashjcr_Last_Modified_By : in Swagger.Nullable_UString; Jcr_Content_Slashjcr_Mixin_Types : in Swagger.Nullable_UString; Jcr_Content_Slashjcr_Title : in Swagger.Nullable_UString; Jcr_Content_Slashlog_Level : in Swagger.Nullable_UString; Jcr_Content_Slashno_Status_Update : in Swagger.Nullable_Boolean; Jcr_Content_Slashno_Versioning : in Swagger.Nullable_Boolean; Jcr_Content_Slashprotocol_Connect_Timeout : in Swagger.Number; Jcr_Content_Slashprotocol_HTTPConnection_Closed : in Swagger.Nullable_Boolean; Jcr_Content_Slashprotocol_HTTPExpired : in Swagger.Nullable_UString; Jcr_Content_Slashprotocol_HTTPHeaders : in Swagger.UString_Vectors.Vector; Jcr_Content_Slashprotocol_HTTPHeaders_At_Type_Hint : in Swagger.Nullable_UString; Jcr_Content_Slashprotocol_HTTPMethod : in Swagger.Nullable_UString; Jcr_Content_Slashprotocol_HTTPSRelaxed : in Swagger.Nullable_Boolean; Jcr_Content_Slashprotocol_Interface : in Swagger.Nullable_UString; Jcr_Content_Slashprotocol_Socket_Timeout : in Swagger.Number; Jcr_Content_Slashprotocol_Version : in Swagger.Nullable_UString; Jcr_Content_Slashproxy_NTLMDomain : in Swagger.Nullable_UString; Jcr_Content_Slashproxy_NTLMHost : in Swagger.Nullable_UString; Jcr_Content_Slashproxy_Host : in Swagger.Nullable_UString; Jcr_Content_Slashproxy_Password : in Swagger.Nullable_UString; Jcr_Content_Slashproxy_Port : in Swagger.Number; Jcr_Content_Slashproxy_User : in Swagger.Nullable_UString; Jcr_Content_Slashqueue_Batch_Max_Size : in Swagger.Number; Jcr_Content_Slashqueue_Batch_Mode : in Swagger.Nullable_UString; Jcr_Content_Slashqueue_Batch_Wait_Time : in Swagger.Number; Jcr_Content_Slashretry_Delay : in Swagger.Nullable_UString; Jcr_Content_Slashreverse_Replication : in Swagger.Nullable_Boolean; Jcr_Content_Slashserialization_Type : in Swagger.Nullable_UString; Jcr_Content_Slashsling_Resource_Type : in Swagger.Nullable_UString; Jcr_Content_Slashssl : in Swagger.Nullable_UString; Jcr_Content_Slashtransport_NTLMDomain : in Swagger.Nullable_UString; Jcr_Content_Slashtransport_NTLMHost : in Swagger.Nullable_UString; Jcr_Content_Slashtransport_Password : in Swagger.Nullable_UString; Jcr_Content_Slashtransport_Uri : in Swagger.Nullable_UString; Jcr_Content_Slashtransport_User : in Swagger.Nullable_UString; Jcr_Content_Slashtrigger_Distribute : in Swagger.Nullable_Boolean; Jcr_Content_Slashtrigger_Modified : in Swagger.Nullable_Boolean; Jcr_Content_Slashtrigger_On_Off_Time : in Swagger.Nullable_Boolean; Jcr_Content_Slashtrigger_Receive : in Swagger.Nullable_Boolean; Jcr_Content_Slashtrigger_Specific : in Swagger.Nullable_Boolean; Jcr_Content_Slashuser_Id : in Swagger.Nullable_UString; Jcr_Primary_Type : in Swagger.Nullable_UString; Operation : in Swagger.Nullable_UString); -- procedure Post_Authorizable_Keystore (Client : in out Client_Type; Intermediate_Path : in Swagger.UString; Authorizable_Id : in Swagger.UString; Operation : in Swagger.Nullable_UString; Current_Password : in Swagger.Nullable_UString; New_Password : in Swagger.Nullable_UString; Re_Password : in Swagger.Nullable_UString; Key_Password : in Swagger.Nullable_UString; Key_Store_Pass : in Swagger.Nullable_UString; Alias : in Swagger.Nullable_UString; New_Alias : in Swagger.Nullable_UString; Remove_Alias : in Swagger.Nullable_UString; Cert_Chain : in Swagger.File_Part_Type; Pk : in Swagger.File_Part_Type; Key_Store : in Swagger.File_Part_Type; Result : out .Models.KeystoreInfo_Type); -- procedure Post_Authorizables (Client : in out Client_Type; Authorizable_Id : in Swagger.UString; Intermediate_Path : in Swagger.UString; Create_User : in Swagger.Nullable_UString; Create_Group : in Swagger.Nullable_UString; Rep_Password : in Swagger.Nullable_UString; Profile_Slashgiven_Name : in Swagger.Nullable_UString; Result : out Swagger.UString); -- procedure Post_Config_Adobe_Granite_Saml_Authentication_Handler (Client : in out Client_Type; Key_Store_Password : in Swagger.Nullable_UString; Key_Store_Password_At_Type_Hint : in Swagger.Nullable_UString; Service_Periodranking : in Swagger.Nullable_Integer; Service_Periodranking_At_Type_Hint : in Swagger.Nullable_UString; Idp_Http_Redirect : in Swagger.Nullable_Boolean; Idp_Http_Redirect_At_Type_Hint : in Swagger.Nullable_UString; Create_User : in Swagger.Nullable_Boolean; Create_User_At_Type_Hint : in Swagger.Nullable_UString; Default_Redirect_Url : in Swagger.Nullable_UString; Default_Redirect_Url_At_Type_Hint : in Swagger.Nullable_UString; User_IDAttribute : in Swagger.Nullable_UString; User_IDAttribute_At_Type_Hint : in Swagger.Nullable_UString; Default_Groups : in Swagger.UString_Vectors.Vector; Default_Groups_At_Type_Hint : in Swagger.Nullable_UString; Idp_Cert_Alias : in Swagger.Nullable_UString; Idp_Cert_Alias_At_Type_Hint : in Swagger.Nullable_UString; Add_Group_Memberships : in Swagger.Nullable_Boolean; Add_Group_Memberships_At_Type_Hint : in Swagger.Nullable_UString; Path : in Swagger.UString_Vectors.Vector; Path_At_Type_Hint : in Swagger.Nullable_UString; Synchronize_Attributes : in Swagger.UString_Vectors.Vector; Synchronize_Attributes_At_Type_Hint : in Swagger.Nullable_UString; Clock_Tolerance : in Swagger.Nullable_Integer; Clock_Tolerance_At_Type_Hint : in Swagger.Nullable_UString; Group_Membership_Attribute : in Swagger.Nullable_UString; Group_Membership_Attribute_At_Type_Hint : in Swagger.Nullable_UString; Idp_Url : in Swagger.Nullable_UString; Idp_Url_At_Type_Hint : in Swagger.Nullable_UString; Logout_Url : in Swagger.Nullable_UString; Logout_Url_At_Type_Hint : in Swagger.Nullable_UString; Service_Provider_Entity_Id : in Swagger.Nullable_UString; Service_Provider_Entity_Id_At_Type_Hint : in Swagger.Nullable_UString; Assertion_Consumer_Service_URL : in Swagger.Nullable_UString; Assertion_Consumer_Service_URLAt_Type_Hint : in Swagger.Nullable_UString; Handle_Logout : in Swagger.Nullable_Boolean; Handle_Logout_At_Type_Hint : in Swagger.Nullable_UString; Sp_Private_Key_Alias : in Swagger.Nullable_UString; Sp_Private_Key_Alias_At_Type_Hint : in Swagger.Nullable_UString; Use_Encryption : in Swagger.Nullable_Boolean; Use_Encryption_At_Type_Hint : in Swagger.Nullable_UString; Name_Id_Format : in Swagger.Nullable_UString; Name_Id_Format_At_Type_Hint : in Swagger.Nullable_UString; Digest_Method : in Swagger.Nullable_UString; Digest_Method_At_Type_Hint : in Swagger.Nullable_UString; Signature_Method : in Swagger.Nullable_UString; Signature_Method_At_Type_Hint : in Swagger.Nullable_UString; User_Intermediate_Path : in Swagger.Nullable_UString; User_Intermediate_Path_At_Type_Hint : in Swagger.Nullable_UString); -- procedure Post_Config_Apache_Felix_Jetty_Based_Http_Service (Client : in out Client_Type; Org_Periodapache_Periodfelix_Periodhttps_Periodnio : in Swagger.Nullable_Boolean; Org_Periodapache_Periodfelix_Periodhttps_Periodnio_At_Type_Hint : in Swagger.Nullable_UString; Org_Periodapache_Periodfelix_Periodhttps_Periodkeystore : in Swagger.Nullable_UString; Org_Periodapache_Periodfelix_Periodhttps_Periodkeystore_At_Type_Hint : in Swagger.Nullable_UString; Org_Periodapache_Periodfelix_Periodhttps_Periodkeystore_Periodpassword : in Swagger.Nullable_UString; Org_Periodapache_Periodfelix_Periodhttps_Periodkeystore_Periodpassword_At_Type_Hint : in Swagger.Nullable_UString; Org_Periodapache_Periodfelix_Periodhttps_Periodkeystore_Periodkey : in Swagger.Nullable_UString; Org_Periodapache_Periodfelix_Periodhttps_Periodkeystore_Periodkey_At_Type_Hint : in Swagger.Nullable_UString; Org_Periodapache_Periodfelix_Periodhttps_Periodkeystore_Periodkey_Periodpassword : in Swagger.Nullable_UString; Org_Periodapache_Periodfelix_Periodhttps_Periodkeystore_Periodkey_Periodpassword_At_Type_Hint : in Swagger.Nullable_UString; Org_Periodapache_Periodfelix_Periodhttps_Periodtruststore : in Swagger.Nullable_UString; Org_Periodapache_Periodfelix_Periodhttps_Periodtruststore_At_Type_Hint : in Swagger.Nullable_UString; Org_Periodapache_Periodfelix_Periodhttps_Periodtruststore_Periodpassword : in Swagger.Nullable_UString; Org_Periodapache_Periodfelix_Periodhttps_Periodtruststore_Periodpassword_At_Type_Hint : in Swagger.Nullable_UString; Org_Periodapache_Periodfelix_Periodhttps_Periodclientcertificate : in Swagger.Nullable_UString; Org_Periodapache_Periodfelix_Periodhttps_Periodclientcertificate_At_Type_Hint : in Swagger.Nullable_UString; Org_Periodapache_Periodfelix_Periodhttps_Periodenable : in Swagger.Nullable_Boolean; Org_Periodapache_Periodfelix_Periodhttps_Periodenable_At_Type_Hint : in Swagger.Nullable_UString; Org_Periodosgi_Periodservice_Periodhttp_Periodport_Periodsecure : in Swagger.Nullable_UString; Org_Periodosgi_Periodservice_Periodhttp_Periodport_Periodsecure_At_Type_Hint : in Swagger.Nullable_UString); -- procedure Post_Config_Apache_Http_Components_Proxy_Configuration (Client : in out Client_Type; Proxy_Periodhost : in Swagger.Nullable_UString; Proxy_Periodhost_At_Type_Hint : in Swagger.Nullable_UString; Proxy_Periodport : in Swagger.Nullable_Integer; Proxy_Periodport_At_Type_Hint : in Swagger.Nullable_UString; Proxy_Periodexceptions : in Swagger.UString_Vectors.Vector; Proxy_Periodexceptions_At_Type_Hint : in Swagger.Nullable_UString; Proxy_Periodenabled : in Swagger.Nullable_Boolean; Proxy_Periodenabled_At_Type_Hint : in Swagger.Nullable_UString; Proxy_Perioduser : in Swagger.Nullable_UString; Proxy_Perioduser_At_Type_Hint : in Swagger.Nullable_UString; Proxy_Periodpassword : in Swagger.Nullable_UString; Proxy_Periodpassword_At_Type_Hint : in Swagger.Nullable_UString); -- procedure Post_Config_Apache_Sling_Dav_Ex_Servlet (Client : in out Client_Type; Alias : in Swagger.Nullable_UString; Alias_At_Type_Hint : in Swagger.Nullable_UString; Dav_Periodcreate_Absolute_Uri : in Swagger.Nullable_Boolean; Dav_Periodcreate_Absolute_Uri_At_Type_Hint : in Swagger.Nullable_UString); -- procedure Post_Config_Apache_Sling_Get_Servlet (Client : in out Client_Type; Json_Periodmaximumresults : in Swagger.Nullable_UString; Json_Periodmaximumresults_At_Type_Hint : in Swagger.Nullable_UString; Enable_Periodhtml : in Swagger.Nullable_Boolean; Enable_Periodhtml_At_Type_Hint : in Swagger.Nullable_UString; Enable_Periodtxt : in Swagger.Nullable_Boolean; Enable_Periodtxt_At_Type_Hint : in Swagger.Nullable_UString; Enable_Periodxml : in Swagger.Nullable_Boolean; Enable_Periodxml_At_Type_Hint : in Swagger.Nullable_UString); -- procedure Post_Config_Apache_Sling_Referrer_Filter (Client : in out Client_Type; Allow_Periodempty : in Swagger.Nullable_Boolean; Allow_Periodempty_At_Type_Hint : in Swagger.Nullable_UString; Allow_Periodhosts : in Swagger.Nullable_UString; Allow_Periodhosts_At_Type_Hint : in Swagger.Nullable_UString; Allow_Periodhosts_Periodregexp : in Swagger.Nullable_UString; Allow_Periodhosts_Periodregexp_At_Type_Hint : in Swagger.Nullable_UString; Filter_Periodmethods : in Swagger.Nullable_UString; Filter_Periodmethods_At_Type_Hint : in Swagger.Nullable_UString); -- procedure Post_Config_Property (Client : in out Client_Type; Config_Node_Name : in Swagger.UString); -- procedure Post_Node (Client : in out Client_Type; Path : in Swagger.UString; Name : in Swagger.UString; Operation : in Swagger.Nullable_UString; Delete_Authorizable : in Swagger.Nullable_UString; File : in Swagger.File_Part_Type); -- procedure Post_Node_Rw (Client : in out Client_Type; Path : in Swagger.UString; Name : in Swagger.UString; Add_Members : in Swagger.Nullable_UString); -- procedure Post_Path (Client : in out Client_Type; Path : in Swagger.UString; Jcr_Primary_Type : in Swagger.UString; Name : in Swagger.UString); -- procedure Post_Query (Client : in out Client_Type; Path : in Swagger.UString; P_Periodlimit : in Swagger.Number; P_1Property : in Swagger.UString; P_1Property_Periodvalue : in Swagger.UString; Result : out Swagger.UString); -- procedure Post_Tree_Activation (Client : in out Client_Type; Ignoredeactivated : in Boolean; Onlymodified : in Boolean; Path : in Swagger.UString); -- procedure Post_Truststore (Client : in out Client_Type; Operation : in Swagger.Nullable_UString; New_Password : in Swagger.Nullable_UString; Re_Password : in Swagger.Nullable_UString; Key_Store_Type : in Swagger.Nullable_UString; Remove_Alias : in Swagger.Nullable_UString; Certificate : in Swagger.File_Part_Type; Result : out Swagger.UString); -- procedure Post_Truststore_PKCS12 (Client : in out Client_Type; Truststore_Periodp_12 : in Swagger.File_Part_Type; Result : out Swagger.UString); end .Clients;
iyan22/AprendeAda
Ada
360
adb
procedure Contar_Digitos(Num: Integer; Numero_De_Digitos: out Integer) is N: Integer := Num; begin Numero_De_Digitos := 0; while N /= 0 loop N:= N/10; Numero_De_Digitos:= Numero_De_Digitos+1; end loop; -- return Numero_De_Digitos; -- return Integer'Image(Num)'length-1; --Se quita el carácter del signo end Contar_Digitos;
freebsd/freebsd-ports
Ada
1,153
adb
--- gcc/ada/libgnat/s-dorepr.adb.orig 2022-08-19 08:09:52 UTC +++ gcc/ada/libgnat/s-dorepr.adb @@ -61,8 +61,9 @@ package body Product is -- Spill the input into the appropriate (maybe larger) bit container, -- mask out the low bits and reload the modified value. - case Num'Machine_Mantissa is - when 24 => + -- Patch by Stephane Carrez to handle the case of FreeBSD + case Num'Size is + when 32 => declare Rep32 : aliased Interfaces.Unsigned_32; Temp : Num := N with Address => Rep32'Address; @@ -76,7 +77,7 @@ package body Product is X := Temp; end; - when 53 => + when 64 => declare Rep64 : aliased Interfaces.Unsigned_64; Temp : Num := N with Address => Rep64'Address; @@ -90,7 +91,7 @@ package body Product is X := Temp; end; - when 64 => + when 128 => declare Rep80 : aliased array (1 .. 2) of Interfaces.Unsigned_64; Temp : Num := N with Address => Rep80'Address;
AdaCore/libadalang
Ada
274
adb
procedure Test is procedure New_Line is null; procedure New_Line (B : Boolean) is begin New_Line; pragma Test_Statement; if Test.New_Line.B then null; end if; pragma Test_Statement; end New_Line; begin null; end Test;
reznikmm/matreshka
Ada
4,592
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_Table.End_Row_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Table_End_Row_Attribute_Node is begin return Self : Table_End_Row_Attribute_Node do Matreshka.ODF_Table.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Table_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Table_End_Row_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.End_Row_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Table_URI, Matreshka.ODF_String_Constants.End_Row_Attribute, Table_End_Row_Attribute_Node'Tag); end Matreshka.ODF_Table.End_Row_Attributes;
AdaCore/libadalang
Ada
356
ads
package Pkg is protected type Regular is procedure Set (I : Integer); function Get return Integer; private State : Integer; end; protected type P_Rec is entry E (I : in out Integer); procedure P (B : Boolean; I : out Integer); function F return Integer; private State : Integer; end; end Pkg;
davidkristola/vole
Ada
40,983
adb
with Ada.Text_IO; with Ada.Exceptions; use Ada.Exceptions; with Ada.Unchecked_Conversion; with Ada.Unchecked_Deallocation; with Interfaces; with String_Ops; use String_Ops; with kv.avm.references; use kv.avm.references; with kv.avm.Log; use kv.avm.Log; with kv.avm.Methods; use kv.avm.Methods; with kv.avm.File_Reader; package body kv.avm.Assemblers is use kv.avm.Registers; function Convert is new Ada.Unchecked_Conversion (Source => kv.avm.Instructions.Instruction_Type, Target => Interfaces.Unsigned_64); function Convert is new Ada.Unchecked_Conversion (Source => Interfaces.Unsigned_64, Target => kv.avm.Instructions.Instruction_Type); function Convert is new Ada.Unchecked_Conversion (Source => Interfaces.Integer_32, Target => Interfaces.Unsigned_32); procedure Free is new Ada.Unchecked_Deallocation(String, String_Ops.String_Pointer_Type); ---------------------------------------------------------------------------- function Make_Word_Code_Name(Asm_Name : String) return String is New_Name : String := Asm_Name; begin New_Name(New_Name'LAST) := 'c'; return New_Name; end Make_Word_Code_Name; ---------------------------------------------------------------------------- function No_Quotes(Str : String) return String is Index_First : Positive := Str'FIRST; Index_Last : Positive := Str'LAST; begin if Str(Index_First) = '"' then Index_First := Index_First + 1; end if; if Str(Index_Last) = '"' then Index_Last := Index_Last - 1; end if; return Str(Index_First..Index_Last); end No_Quotes; ---------------------------------------------------------------------------- function Build_Constant(Type_Img : String; Value : String) return kv.avm.Registers.Register_Type is Kind : constant String := Down_Case(Type_Img); use kv.avm.Registers; begin if Kind = "uint" or Kind = "unsigned_integer" then return (format => Unsigned_Integer, unsigned_value => Interfaces.Unsigned_64'VALUE(Value)); elsif Kind = "adef" or Kind = "actor_definition" then return (format => Actor_Definition, Actor_Kind => +No_Quotes(Value)); elsif Kind = "mdef" or Kind = "message_definition" then return (format => Message_Definition, Message_Name => +No_Quotes(Value), Send_Count => 0, Reply_Count => 0); elsif Kind = "str" or Kind = "immutable_string" then return (format => Immutable_String, The_String => +No_Quotes(Value)); elsif Kind = "int64_t" or Kind = "signed_integer" then return (format => Signed_Integer, signed_value => Interfaces.Integer_64'VALUE(Value)); elsif Kind = "bit_or_boolean" then return (format => Bit_Or_Boolean, bit => Boolean'VALUE(Value)); elsif Kind = "tuple_map" then return String_To_Tuple_Map(Value); end if; Put_Error("ERROR: Could not parse actor constant <"&Type_Img&"> := <"&Value&">."); raise Unrecognized_Type_Error; end Build_Constant; ----------------------------------------------------------------------------- function Nth_Rest(Str : String; N : Natural) return String is begin if N = 1 then return Rest(Str); else return Nth_Rest(Rest(Str), N-1); end if; end Nth_Rest; ----------------------------------------------------------------------------- function Select_Value (Str : in String) return String is In_Q : Boolean := False; In_B : Boolean := False; begin for I in Str'RANGE loop if Str(I) = '"' then In_Q := not In_Q; elsif Str(I) = '[' then In_B := True; elsif Str(I) = ']' then In_B := False; end if; if not (In_Q or In_B) then if Is_White_Space(Str(I)) then return Str(Str'FIRST..I-1); end if; end if; end loop; return Str; -- no blanks, return the whole string. exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Select_Value('" & Str & "')."); raise; end Select_Value; ---------------------------------------------------------------------------- function Bool(Img : String) return Boolean is First_Letter : Character; begin First_Letter := Img(Img'FIRST); if First_Letter = 'T' or First_Letter = 't' then return True; elsif First_Letter = 'F' or First_Letter = 'f' then return False; end if; return Boolean'VALUE(Img); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Bool('" & Img & "')."); raise; end Bool; ---------------------------------------------------------------------------- procedure Advance_And_Skip_If(Offset : in out Positive; Rest : in String; Expected : in String) is begin Offset := Offset + 1; if Nth(Rest, Offset) = Expected then Offset := Offset + 1; end if; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Advance_And_Skip_If"); raise; end Advance_And_Skip_If; ---------------------------------------------------------------------------- procedure Initialize (Self : access Message_Type; Name : in String; Next : in Message_Access) is begin Self.Name := new String'(Name); Self.Count := 0; Self.Next := Next; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Initialize(Message_Type)"); raise; end Initialize; ---------------------------------------------------------------------------- function Build_Format_0(Op_Code : kv.avm.Instructions.format_0_type) return kv.avm.Instructions.Instruction_Type is use kv.avm.Instructions; begin case Op_Code is when TERMINATE_PROGRAM => return (Op_Code => TERMINATE_PROGRAM); when HALT_ACTOR => return (Op_Code => HALT_ACTOR); when STOP_FRAME => return (Op_Code => STOP_FRAME); when NO_OP => return (Op_Code => NO_OP); end case; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Build_Format_0"); raise; end Build_Format_0; ---------------------------------------------------------------------------- function Build_Format_1(Op_Code : kv.avm.Instructions.format_1_type; Rest : String) return kv.avm.Instructions.Instruction_Type is Value : reference_type; use kv.avm.Instructions; begin Value := Make_Reference(Drop_Vole_Comments(Rest)); case Op_Code is -- EMIT, ASSERT, REPLY, JUMP when EMIT => return (Op_Code => EMIT, value => Value); when ASSERT => return (Op_Code => ASSERT, value => Value); when REPLY => return (Op_Code => REPLY, value => Value); when JUMP => return (Op_Code => JUMP, value => Value); end case; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Build_Format_1"); raise; end Build_Format_1; ---------------------------------------------------------------------------- function Build_Format_1b(Op_Code : kv.avm.Instructions.format_1b_type; Rest : String) return kv.avm.Instructions.Instruction_Type is Offset : Interfaces.Integer_32; use kv.avm.Instructions; begin case Op_Code is -- JUMP_ABS, JUMP_REL when JUMP_ABS => return (Op_Code => JUMP_ABS, jump => Interfaces.Unsigned_32'VALUE(Rest)); when JUMP_REL => Offset := Interfaces.Integer_32'VALUE(Rest); return (Op_Code => JUMP_REL, jump => Convert(Offset)); end case; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Build_Format_1b"); raise; end Build_Format_1b; ---------------------------------------------------------------------------- function Build_Format_2(Op_Code : kv.avm.Instructions.format_2_type; Rest : String) return kv.avm.Instructions.Instruction_Type is Lhs : reference_type; Rhs : reference_type; Rhs_Pos : Positive; use kv.avm.Instructions; begin Lhs := Make_Reference(First(Rest)); -- Nth 2 should be ":=" if Nth(Rest, 2) = ":=" then Rhs_Pos := 3; else Rhs_Pos := 2; end if; Rhs := Make_Reference(Nth(Rest, Rhs_Pos)); case Op_Code is -- SET, SHIFT_LEFT, SHIFT_RIGHT, UNFOLD, OFFSET when SET => return (Op_Code => SET, lhs => Lhs, rhs => Rhs); when FOLD => return (Op_Code => FOLD, lhs => Lhs, rhs => Rhs); end case; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Build_Format_2"); raise; end Build_Format_2; ---------------------------------------------------------------------------- function Build_Format_2b(Op_Code : kv.avm.Instructions.format_2b_type; Rest : String) return kv.avm.Instructions.Instruction_Type is Condition : reference_type; Offset : Interfaces.Integer_32; use kv.avm.Instructions; begin Condition := Make_Reference(First(Rest)); case Op_Code is -- BRANCH_ABS, BRANCH_REL, BRANCH_NEQ when BRANCH_ABS => return (Op_Code => BRANCH_ABS, condition => Condition, target => Interfaces.Unsigned_32'VALUE(Second(Rest))); when BRANCH_REL => Offset := Interfaces.Integer_32'VALUE(Second(Rest)); return (Op_Code => BRANCH_REL, condition => Condition, target => Convert(Offset)); when BRANCH_NEQ => Offset := Interfaces.Integer_32'VALUE(Second(Rest)); return (Op_Code => BRANCH_NEQ, condition => Condition, target => Convert(Offset)); end case; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Build_Format_2b"); raise; end Build_Format_2b; ---------------------------------------------------------------------------- function Build_Format_3(Op_Code : kv.avm.Instructions.format_3_type; Rest : String) return kv.avm.Instructions.Instruction_Type is a : reference_type; x : reference_type; y : reference_type; Offset : Positive := 1; use kv.avm.Instructions; begin a := Make_Reference(Nth(Rest, Offset)); Advance_And_Skip_If(Offset, Rest, ":="); x := Make_Reference(Nth(Rest, Offset)); Advance_And_Skip_If(Offset, Rest, "=>"); y := Make_Reference(Nth(Rest, Offset)); case Op_Code is -- PEEK, TRAP, NEW_ACTOR when PEEK => return (Op_Code => PEEK, a => a, x => x, y => y); when TRAP => return (Op_Code => TRAP, a => a, x => x, y => y); when NEW_ACTOR => return (Op_Code => NEW_ACTOR, a => a, x => x, y => y); end case; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Build_Format_3"); raise; end Build_Format_3; ---------------------------------------------------------------------------- function Build_Format_3b(Op_Code : kv.avm.Instructions.format_3b_type; Rest : String) return kv.avm.Instructions.Instruction_Type is use kv.avm.Instructions; target : Reference_Type; source_tuple : Reference_Type; index : Offset_Type; Offset : Positive := 1; begin target := Make_Reference(Nth(Rest, Offset)); Advance_And_Skip_If(Offset, Rest, ":="); source_tuple := Make_Reference(Nth(Rest, Offset)); Advance_And_Skip_If(Offset, Rest, "["); index := offset_type'VALUE(Nth(Rest, Offset)); return (Op_Code => PEEK_IMMEDIATE, lvalue => target, tuple => source_tuple, index => index); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Build_Format_3b"); raise; end; ---------------------------------------------------------------------------- function Build_Format_4(Op_Code : kv.avm.Instructions.format_4_type; Rest : String) return kv.avm.Instructions.Instruction_Type is a : reference_type; x : reference_type; y : reference_type; op : kv.avm.Instructions.operation_type; Offset : Positive; use kv.avm.Instructions; begin a := Make_Reference(Nth(Rest, 1)); -- Nth 2 should be ":=" if Nth(Rest, 2) = ":=" then Offset := 3; else Offset := 2; end if; x := Make_Reference(Nth(Rest, Offset)); op := Decode_Operation(Nth(Rest, Offset+1)); y := Make_Reference(Nth(Rest, Offset+2)); return (Op_Code => COMPUTE, action => op, result => a, left => x, right => y); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Build_Format_4"); raise; end Build_Format_4; ---------------------------------------------------------------------------- function Build_Format_5a1(Op_Code : kv.avm.Instructions.format_5a1_type; Rest : String) return kv.avm.Instructions.Instruction_Type is use kv.avm.Instructions; reply_register : Reference_Type; argument_tuple : Reference_Type; actor_reference : Reference_Type; message_definition : Reference_Type; Offset : Positive := 1; begin reply_register := Make_Reference(Nth(Rest, Offset)); Advance_And_Skip_If(Offset, Rest, ":="); argument_tuple := Make_Reference(Nth(Rest, Offset)); Advance_And_Skip_If(Offset, Rest, "=>"); actor_reference := Make_Reference(Nth(Rest, Offset)); Advance_And_Skip_If(Offset, Rest, "."); message_definition := Make_Reference(Nth(Rest, Offset)); return (Op_Code => ACTOR_CALL, rply_5a1 => reply_register, args_5a1 => argument_tuple, actr_5a1 => actor_reference, mdef_5a1 => message_definition); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Build_Format_5a1"); raise; end; ---------------------------------------------------------------------------- function Build_Format_5a2(Op_Code : kv.avm.Instructions.format_5a2_type; Rest : String) return kv.avm.Instructions.Instruction_Type is use kv.avm.Instructions; argument_tuple : Reference_Type; actor_reference : Reference_Type; message_definition : Reference_Type; Offset : Positive := 1; begin argument_tuple := Make_Reference(Nth(Rest, Offset)); Advance_And_Skip_If(Offset, Rest, "=>"); actor_reference := Make_Reference(Nth(Rest, Offset)); Advance_And_Skip_If(Offset, Rest, "."); message_definition := Make_Reference(Nth(Rest, Offset)); case Op_Code is -- ACTOR_SEND, ACTOR_TAIL_SEND, ACTOR_TAIL_CALL when ACTOR_SEND => return (Op_Code => ACTOR_SEND , args_5a2 => argument_tuple, actr_5a2 => actor_reference, mdef_5a2 => message_definition); when ACTOR_TAIL_SEND => return (Op_Code => ACTOR_TAIL_SEND, args_5a2 => argument_tuple, actr_5a2 => actor_reference, mdef_5a2 => message_definition); when ACTOR_TAIL_CALL => return (Op_Code => ACTOR_TAIL_CALL, args_5a2 => argument_tuple, actr_5a2 => actor_reference, mdef_5a2 => message_definition); end case; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Build_Format_5a2"); raise; end; ---------------------------------------------------------------------------- function Build_Format_5b1(Op_Code : kv.avm.Instructions.format_5b1_type; Rest : String) return kv.avm.Instructions.Instruction_Type is rpl : reference_type; msg : reference_type; arg : reference_type; Offset : Positive := 1; use kv.avm.Instructions; begin rpl := Make_Reference(Nth(Rest, 1)); Advance_And_Skip_If(Offset, Rest, ":="); arg := Make_Reference(Nth(Rest, Offset)); Advance_And_Skip_If(Offset, Rest, "=>"); msg := Make_Reference(Nth(Rest, Offset)); case Op_Code is -- SELF_CALL, SUPER_CALL when SELF_CALL => return (Op_Code => SELF_CALL, rply_5b1 => rpl, mdef_5b1 => msg, args_5b1 => arg); when SUPER_CALL => return (Op_Code => SUPER_CALL, rply_5b1 => rpl, mdef_5b1 => msg, args_5b1 => arg); end case; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Build_Format_5b1"); raise; end; ---------------------------------------------------------------------------- function Build_Format_5b2(Op_Code : kv.avm.Instructions.format_5b2_type; Rest : String) return kv.avm.Instructions.Instruction_Type is msg : reference_type; arg : reference_type; Offset : Positive := 1; use kv.avm.Instructions; begin arg := Make_Reference(Nth(Rest, Offset)); Advance_And_Skip_If(Offset, Rest, "=>"); msg := Make_Reference(Nth(Rest, Offset)); case Op_Code is -- SELF_SEND, SELF_TAIL_SEND, SELF_TAIL_CALL, SUPER_TAIL_CALL when SELF_SEND => return (Op_Code => SELF_SEND, mdef_5b2 => msg, args_5b2 => arg); when SELF_TAIL_SEND => return (Op_Code => SELF_TAIL_SEND, mdef_5b2 => msg, args_5b2 => arg); when SELF_TAIL_CALL => return (Op_Code => SELF_TAIL_CALL, mdef_5b2 => msg, args_5b2 => arg); when SUPER_TAIL_CALL => return (Op_Code => SUPER_TAIL_CALL, mdef_5b2 => msg, args_5b2 => arg); end case; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Build_Format_5b2"); raise; end; ---------------------------------------------------------------------------- function Decode_Op_Code(Line : String) return kv.avm.Instructions.Instruction_Type is Name : constant String := First(Line); The_Rest : constant String := Rest(Drop_Vole_Comments(Line)); Op_Code : kv.avm.Instructions.op_code_type; Instruction : kv.avm.Instructions.Instruction_Type; begin begin Op_Code := kv.avm.Instructions.op_code_type'VALUE(Name); exception when others => raise Invalid_Op_Code; end; --Put_Line("Op_Code is "&kv.avm.instruction.op_code_type'IMAGE(Op_Code)); case Op_Code is when kv.avm.Instructions.format_0_type => Instruction := Build_Format_0(Op_Code); when kv.avm.Instructions.format_1_type => Instruction := Build_Format_1(Op_Code, The_Rest); when kv.avm.Instructions.format_1b_type => Instruction := Build_Format_1b(Op_Code, The_Rest); when kv.avm.Instructions.format_2_type => Instruction := Build_Format_2(Op_Code, The_Rest); when kv.avm.Instructions.format_2b_type => Instruction := Build_Format_2b(Op_Code, The_Rest); when kv.avm.Instructions.format_3_type => Instruction := Build_Format_3(Op_Code, The_Rest); when kv.avm.Instructions.format_3b_type => Instruction := Build_Format_3b(Op_Code, The_Rest); when kv.avm.Instructions.format_4_type => Instruction := Build_Format_4(Op_Code, The_Rest); when kv.avm.Instructions.format_5a1_type => Instruction := Build_Format_5a1(Op_Code, The_Rest); when kv.avm.Instructions.format_5a2_type => Instruction := Build_Format_5a2(Op_Code, The_Rest); when kv.avm.Instructions.format_5b1_type => Instruction := Build_Format_5b1(Op_Code, The_Rest); when kv.avm.Instructions.format_5b2_type => Instruction := Build_Format_5b2(Op_Code, The_Rest); -- Don't include a "when others" because that could lead to erroneous behavior if instructions are added. end case; return Instruction; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Decode_Op_Code"); raise; end Decode_Op_Code; ---------------------------------------------------------------------------- procedure Parse_Line (Self : in out Message_Type; Line : in String) is begin if First(Line) = "...predicate" then Self.Has_P := True; Self.Pred := kv.avm.References.Offset_Type'VALUE(Second(Line)); else Self.Code(Interfaces.Unsigned_32(Self.Count)) := Decode_Op_Code(Line); Self.Count := Self.Count + 1; end if; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Parse_Line(Message_Type)"); raise; end Parse_Line; ---------------------------------------------------------------------------- function Constructor_Code(Self : Message_Type) return kv.avm.Instructions.Code_Access is begin if Self.Name.all = "CONSTRUCTOR" then return new kv.avm.Instructions.Code_Type'(Self.Code(0 .. Interfaces.Unsigned_32(Self.Count))); else return Self.Next.Constructor_Code; end if; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Constructor_Code(Message_Type)"); raise; end Constructor_Code; ---------------------------------------------------------------------------- procedure Add_Non_Constructors (Self : in out Message_Type; Actor : in kv.avm.Actors.Actor_Access) is Method : kv.avm.Methods.Method_Access; begin if Self.Next /= null then Self.Next.Add_Non_Constructors(Actor); end if; if Self.Name.all /= "CONSTRUCTOR" then Method := New_Method(Self.Name.all, new kv.avm.Instructions.Code_Type'(Self.Code(0 .. Interfaces.Unsigned_32(Self.Count)))); if Self.Has_P then Method.Add_Predicate(Self.Pred); end if; Actor.Add_Method(Method); end if; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Add_Non_Constructors(Message_Type)"); raise; end Add_Non_Constructors; ---------------------------------------------------------------------------- procedure Write_Word_Code (Self : in out Message_Type; File : in Ada.Streams.Stream_IO.Stream_Access) is begin --Put_Line("Write_Word_Code:Message="&Self.Name.all); String'OUTPUT(File, Self.Name.all); Boolean'OUTPUT(File, Self.Has_P); if Self.Has_P then kv.avm.References.Offset_Type'OUTPUT(File, Self.Pred); end if; --Put_Line("Write_Word_Code:instruction count="&Natural'IMAGE(Self.Count)); Natural'WRITE(File, Self.Count); for I in Self.Code'FIRST .. Interfaces.Unsigned_32(Self.Count-1) loop --Put_Line(Interfaces.Unsigned_32'IMAGE(I)); Interfaces.Unsigned_64'WRITE(File, Convert(Self.Code(I))); end loop; if Self.Next /= null then Self.Next.Write_Word_Code(File); end if; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Write_Word_Code(Message_Type)"); raise; end Write_Word_Code; ---------------------------------------------------------------------------- function New_From_Stream(Count : Natural; Stream : Ada.Streams.Stream_IO.Stream_Access) return Message_Access is Self : Message_Access; Uint : Interfaces.Unsigned_64; begin --Put_Line("New_From_Stream return Message_Access, count="&Natural'IMAGE(Count)); Self := new Message_Type; Self.Name := new String'(String'INPUT(Stream)); Boolean'READ(Stream, Self.Has_P); if Self.Has_P then kv.avm.References.Offset_Type'READ(Stream, Self.Pred); end if; --Put_Line("New_From_Stream Name="&Self.Name.all); Natural'READ(Stream, Self.Count); --Put_Line("New_From_Stream instruction count="&Natural'IMAGE(Self.Count)); for I in Self.Code'FIRST .. Interfaces.Unsigned_32(Self.Count-1) loop --Put_Line(Interfaces.Unsigned_32'IMAGE(I)); Interfaces.Unsigned_64'READ(Stream, Uint); Self.Code(I) := Convert(Uint); end loop; if Count > 1 then Self.Next := New_From_Stream(Count-1, Stream); end if; return Self; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.New_From_Stream(Message_Type)"); raise; end New_From_Stream; ---------------------------------------------------------------------------- procedure Initialize (Self : access Actor_Type; Name : in String; Next : in Actor_Pointer) is begin Self.Name := new String'(Name); Self.Section := Constants_Section; Self.Next := Next; Self.F_Max := 0; Self.M_Count := 0; Self.Message := null; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Initialize(Actor_Type)"); raise; end Initialize; Message_Directive : constant String := "..message"; Constants_Directive : constant String := "..constants"; Subclassof_Directive : constant String := "..subclassof"; ---------------------------------------------------------------------------- function Is_Message_Directive(Line : String) return Boolean is begin return First(Line) = Message_Directive; end Is_Message_Directive; ---------------------------------------------------------------------------- function Is_Constants_Directive(Line : String) return Boolean is begin return First(Line) = Constants_Directive; end Is_Constants_Directive; ---------------------------------------------------------------------------- function Is_Subclassof_Directive(Line : String) return Boolean is begin return First(Line) = Subclassof_Directive; end Is_Subclassof_Directive; ---------------------------------------------------------------------------- procedure Parse_Message_Directive (Self : in out Actor_Type; Line : in String) is Next_Message : Message_Access; Message_Name : constant String := Second(Line); begin -- Push a message Self.M_Count := Self.M_Count + 1; Next_Message := Self.Message; Self.Message := new Message_Type; Self.Message.Initialize(Message_Name, Next_Message); Self.Section := Message_Section; end Parse_Message_Directive; ---------------------------------------------------------------------------- procedure Parse_Constants_Directive (Self : in out Actor_Type; Line : in String) is begin Self.Section := Constants_Section; end Parse_Constants_Directive; ---------------------------------------------------------------------------- procedure Parse_Subclassof_Directive (Self : in out Actor_Type; Line : in String) is Parent_Name : constant String := Second(Line); begin Self.Parent := new String'(Parent_Name); end Parse_Subclassof_Directive; ---------------------------------------------------------------------------- procedure Parse_Actor_Constants -- pre-condition: line must be clean (Self : in out Actor_Type; Line : in String) is -- Accepted formats: -- register type value -- register : type value -- register : type := value (prefered) -- register type := value Constant_Ref : reference_type; Type_Offset : Positive := 1; Value_Offset : Positive; Index : Interfaces.Unsigned_32; begin -- Collect the constant Constant_Ref := Make_Reference(First(Line)); Index := Interfaces.Unsigned_32(Constant_Ref.index); Advance_And_Skip_If(Type_Offset, Line, ":"); Value_Offset := Type_Offset; Advance_And_Skip_If(Value_Offset, Line, ":="); declare Type_Image : constant String := Nth(Line, Type_Offset); Value_Image : constant String := Select_Value(Nth_Rest(Line, Value_Offset-1)); begin Self.Fixed(Index) := Build_Constant(Type_Image, Value_Image); end; -- And finally, keep track of the last used constant if Natural(Constant_Ref.index) > Self.F_Max then Self.F_Max := Natural(Constant_Ref.index); end if; end Parse_Actor_Constants; ---------------------------------------------------------------------------- procedure Parse_Actor_Section (Self : in out Actor_Type; Line : in String) is begin case Self.Section is when Constants_Section => Parse_Actor_Constants(Self, Line); when Message_Section => Self.Message.Parse_Line(Line); end case; end Parse_Actor_Section; ---------------------------------------------------------------------------- procedure Parse_Line (Self : in out Actor_Type; Line : in String) is Clean : constant String := Drop_Vole_Comments(Line); begin if Is_Message_Directive(Clean) then Parse_Message_Directive(Self, Clean); elsif Is_Constants_Directive(Clean) then Parse_Constants_Directive(Self, Clean); elsif Is_Subclassof_Directive(Clean) then Parse_Subclassof_Directive(Self, Clean); else Parse_Actor_Section(Self, Clean); end if; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Parse_Line(Actor_Type)"); raise; end Parse_Line; ---------------------------------------------------------------------------- procedure Load (Self : in out Actor_Type) is Actor_Constants : kv.avm.Memories.Register_Array_Type; Parent : kv.avm.Actors.Actor_Access; use type kv.avm.Actors.Actor_Access; begin if Self.Next /= null then Self.Next.Load; end if; Actor_Constants.Initialize(Self.Fixed(0 .. Interfaces.Unsigned_32(Self.F_Max))); if Self.Parent /= null then Parent := kv.avm.Actors.Get_Actor_By_Name(self.Parent.all); end if; Self.Loaded := kv.avm.Actors.New_Actor (Name => Self.Name.all, Constructor => Self.Message.Constructor_Code, Attribute_Count => 64, Fixed_Registers => Actor_Constants, Parent => Parent); Self.Message.Add_Non_Constructors(Self.Loaded); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Load(Actor_Type), actor = " & Self.Name.all); raise; end Load; ---------------------------------------------------------------------------- procedure Link (Self : in out Actor_Type) is Parent : kv.avm.Actors.Actor_Access; use type kv.avm.Actors.Actor_Access; begin if Self.Next /= null then Self.Next.Link; end if; if Self.Parent /= null then Parent := kv.avm.Actors.Get_Actor_By_Name(Self.Parent.all); Self.Loaded.Add_Parent(Parent); end if; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Link(Actor_Type), actor = " & Self.Name.all); raise; end Link; ---------------------------------------------------------------------------- procedure Write_Word_Code (Self : in out Actor_Type; File : in Ada.Streams.Stream_IO.Stream_Access) is begin Put_Line("Write_Word_Code:Actor=" & Self.Name.all); String'OUTPUT(File, Self.Name.all); if Self.Parent /= null then Put_Line("Write_Word_Code:Parent=" & Self.Parent.all); String'OUTPUT(File, Self.Parent.all); else Put_Line("Write_Word_Code:Parent=<none>"); String'OUTPUT(File, "<none>"); end if; Put_Line("Write_Word_Code:fixed max=" & Natural'IMAGE(Self.F_Max)); Natural'WRITE(File, Self.F_Max); for I in Self.Fixed'FIRST .. Interfaces.Unsigned_32(Self.F_Max) loop Put_Line(Interfaces.Unsigned_32'IMAGE(I) & ": " & kv.avm.Registers.Reg_Img(Self.Fixed(I))); kv.avm.Registers.Register_Type'WRITE(File, Self.Fixed(I)); end loop; Put_Line("Write_Word_Code:message count="&Natural'IMAGE(Self.M_Count)); Natural'WRITE(File, Self.M_Count); Self.Message.Write_Word_Code(File); if Self.Next /= null then Self.Next.Write_Word_Code(File); end if; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Write_Word_Code(Actor_Type)"); raise; end Write_Word_Code; ---------------------------------------------------------------------------- function New_From_Stream(Count : Natural; Stream : Ada.Streams.Stream_IO.Stream_Access) return Actor_Pointer is Self : Actor_Pointer; begin Put_Line("New_From_Stream return Actor_Pointer, count=" & Natural'IMAGE(Count)); Self := new Actor_Type; Self.Name := new String'(String'INPUT(Stream)); Put_Line("New_From_Stream Name=" & Self.Name.all); Self.Parent := new String'(String'INPUT(Stream)); Put_Line("New_From_Stream Parent=" & Self.Parent.all); if Self.Parent.all = "<none>" then Free(Self.Parent); end if; Natural'READ(Stream, Self.F_Max); Put_Line("New_From_Stream F_Max=" & Natural'IMAGE(Self.F_Max)); for I in Self.Fixed'FIRST .. Interfaces.Unsigned_32(Self.F_Max) loop Put_Line(Interfaces.Unsigned_32'IMAGE(I)); kv.avm.Registers.Register_Type'READ(Stream, Self.Fixed(I)); end loop; Natural'READ(Stream, Self.M_Count); Put_Line("New_From_Stream M_Count=" & Natural'IMAGE(Self.M_Count)); if Self.M_Count > 0 then Put_Line("New_From_Stream return Actor_Pointer: reading actor " & Self.Name.all & ", M_Count=" & Positive'IMAGE(Positive(Self.M_Count))); Self.Message := New_From_Stream(Self.M_Count, Stream); end if; if Count > 1 then Self.Next := New_From_Stream(Count-1, Stream); end if; return Self; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.New_From_Stream(Actor_Type)"); raise; end New_From_Stream; ---------------------------------------------------------------------------- procedure Initialize (Self : access Assembler_Type) is begin Self.Lines_Parsed := 0; Self.Actor_Count := 0; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Initialize(Assembler_Type)"); raise; end Initialize; Comment_Directive : constant Character := '#'; Control_Directive : constant Character := '.'; Actor_Directive : constant String := ".actor"; ---------------------------------------------------------------------------- function Is_Comment_Line(Stripped : String) return Boolean is begin return Stripped(Stripped'FIRST) = Comment_Directive; end Is_Comment_Line; ---------------------------------------------------------------------------- function Is_Control_Line(Stripped : String) return Boolean is begin return (Stripped(Stripped'FIRST) = Control_Directive) and ((Stripped'LENGTH >= 2) and then (Stripped(Stripped'FIRST+1) /= Control_Directive)); end Is_Control_Line; ---------------------------------------------------------------------------- function Is_Actor_Directive(Line : String) return Boolean is begin return First(Line) = Actor_Directive; end Is_Actor_Directive; ---------------------------------------------------------------------------- procedure Parse_Actor_Directive (Self : in out Assembler_Type; Line : in String) is Next_Actor : Actor_Pointer; Actor_Name : constant String := Second(Line); begin Self.Actor_Count := Self.Actor_Count + 1; Next_Actor := Self.Actor; Self.Actor := new Actor_Type; Self.Actor.Initialize(Actor_Name, Next_Actor); end Parse_Actor_Directive; ---------------------------------------------------------------------------- procedure Parse_Line (Self : in out Assembler_Type; Line : in String) is Stripped : constant String := Trim_Blanks(Line); begin Put_Line("<"&Stripped&">"); Self.Lines_Parsed := Self.Lines_Parsed + 1; if Stripped = "" then null; -- blank elsif Is_Comment_Line(Stripped) then null; -- comment elsif Is_Control_Line(Stripped) then if Is_Actor_Directive(Stripped) then Parse_Actor_Directive(Self, Stripped); else Put_Error("Unrecognized directive on line " & Img(Self.Lines_Parsed)); end if; else Self.Actor.Parse_Line(Stripped); end if; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Parse_Line(Assembler_Type)"); raise; end Parse_Line; ---------------------------------------------------------------------------- package Assembler_Reader is new kv.avm.File_Reader(Assembler_Type); ---------------------------------------------------------------------------- procedure Parse_Input_File (Self : in out Assembler_Type; File_In : in String) renames Assembler_Reader.Parse_Input_File; ---------------------------------------------------------------------------- procedure Transfer_Actors_To_Store (Self : in out Assembler_Type) is begin Self.Actor.Load; Self.Actor.Link; exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Transfer_Actors_To_Store(Assembler_Type)"); raise; end Transfer_Actors_To_Store; ---------------------------------------------------------------------------- procedure Write_Word_Code (Self : in out Assembler_Type; File : in Ada.Streams.Stream_IO.Stream_Access) is begin Integer'WRITE(File, Word_Code_Identifier_Number); String'WRITE(File, Word_Code_Human_Id); -- Fixed length, no dope data saved --Put_Line("Write_Word_Code:assember, Actor_Count="&Natural'IMAGE(Self.Actor_Count)); Natural'WRITE(File, Self.Actor_Count); Self.Actor.Write_Word_Code(File); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Write_Word_Code(Assembler_Type)"); raise; end Write_Word_Code; ---------------------------------------------------------------------------- procedure Read_Word_Code (Self : in out Assembler_Type; File : in Ada.Streams.Stream_IO.Stream_Access) is Id : Integer; Code_Word : String(1..8); Count : Natural; begin Integer'READ(File, Id); String'READ(File, Code_Word); -- Fixed length, no dope data saved if Id /= Word_Code_Identifier_Number or Code_Word /= Word_Code_Human_Id then raise Invalid_Word_Code_Header; end if; Natural'READ(File, Count); --Put_Line("Read_Word_Code:assember, Actor_Count="&Natural'IMAGE(Count)); Self.Actor_Count := Count; Self.Actor := New_From_Stream(Count, File); exception when Error: others => Put_Error("EXCEPTION: " & Exception_Information(Error)); Put_Error("Assemblers.Read_Word_Code(Assembler_Type)"); raise; end Read_Word_Code; end kv.avm.Assemblers;
ohenley/black
Ada
1,496
ads
with Ada.Streams, Ada.Strings.Unbounded; with Black.HTTP; private package Black.Parsing is function Parse (Line : Ada.Strings.Unbounded.Unbounded_String) return HTTP.Statuses; type Header is private; function Get (Stream : not null access Ada.Streams.Root_Stream_Type'Class) return Header; function End_Of_Header (Item : in Header) return Boolean; type Header_Line is tagged private; procedure Read (Stream : not null access Ada.Streams.Root_Stream_Type'Class; From : in out Header; Item : out Header_Line); function Parse (Line : in Ada.Strings.Unbounded.Unbounded_String) return Header_Line; function Key (Item : in Header_Line) return HTTP.Header_Key; function Value (Item : in Header_Line) return String; function Value (Item : in Header_Line) return Ada.Strings.Unbounded.Unbounded_String; function Value (Item : in Header_Line) return Integer; function Value (Item : in Header_Line) return Boolean; function Value (Item : in Header_Line) return Duration; private type Header is record Previous_Line : Ada.Strings.Unbounded.Unbounded_String; Current_Line : Ada.Strings.Unbounded.Unbounded_String; end record; type Header_Line is tagged record Line : Ada.Strings.Unbounded.Unbounded_String; Split_Position : Positive; end record; end Black.Parsing;
reznikmm/matreshka
Ada
3,977
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Draw_Placing_Attributes; package Matreshka.ODF_Draw.Placing_Attributes is type Draw_Placing_Attribute_Node is new Matreshka.ODF_Draw.Abstract_Draw_Attribute_Node and ODF.DOM.Draw_Placing_Attributes.ODF_Draw_Placing_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Draw_Placing_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Draw_Placing_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Draw.Placing_Attributes;
reznikmm/matreshka
Ada
3,739
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.Meta_Paragraph_Count_Attributes is pragma Preelaborate; type ODF_Meta_Paragraph_Count_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Meta_Paragraph_Count_Attribute_Access is access all ODF_Meta_Paragraph_Count_Attribute'Class with Storage_Size => 0; end ODF.DOM.Meta_Paragraph_Count_Attributes;
reznikmm/matreshka
Ada
3,581
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$ ------------------------------------------------------------------------------ -- AMF module for UML Testing Profile metamodel. ------------------------------------------------------------------------------ package AMF.Internals.Modules.Utp_Module is pragma Elaborate_Body; end AMF.Internals.Modules.Utp_Module;
zhmu/ananas
Ada
3,895
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . P A C K _ 5 2 -- -- -- -- 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 = 52 package System.Pack_52 is pragma Preelaborate; Bits : constant := 52; type Bits_52 is mod 2 ** Bits; for Bits_52'Size use Bits; -- In all subprograms below, Rev_SSO is set True if the array has the -- non-default scalar storage order. function Get_52 (Arr : System.Address; N : Natural; Rev_SSO : Boolean) return Bits_52 with Inline; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is extracted and returned. procedure Set_52 (Arr : System.Address; N : Natural; E : Bits_52; 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. function GetU_52 (Arr : System.Address; N : Natural; Rev_SSO : Boolean) return Bits_52 with Inline; -- Arr is the address of the packed array, N is the zero-based -- subscript. This element is extracted and returned. This version -- is used when Arr may represent an unaligned address. procedure SetU_52 (Arr : System.Address; N : Natural; E : Bits_52; 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. This version -- is used when Arr may represent an unaligned address end System.Pack_52;
johnperry-math/hac
Ada
409
ads
with HAC_Sys.Defs; private package HAC_Sys.Parser.Tasking is ------------------------------------------------------------------ -------------------------------------------------Task_Declaration- -- Hathorn procedure Task_Declaration ( CD : in out Compiler_Data; FSys : Defs.Symset; Initial_Level : PCode.Nesting_level ); end HAC_Sys.Parser.Tasking;
reznikmm/matreshka
Ada
4,648
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_Table.Protection_Key_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Table_Protection_Key_Attribute_Node is begin return Self : Table_Protection_Key_Attribute_Node do Matreshka.ODF_Table.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Table_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Table_Protection_Key_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Protection_Key_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Table_URI, Matreshka.ODF_String_Constants.Protection_Key_Attribute, Table_Protection_Key_Attribute_Node'Tag); end Matreshka.ODF_Table.Protection_Key_Attributes;
zhmu/ananas
Ada
5,185
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . A T O M I C _ C O U N T E R S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2011-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides atomic counter on platforms where it is supported: -- - all Alpha platforms -- - all AARCH64 platforms -- - all ARM platforms -- - all ia64 platforms -- - all PowerPC platforms -- - all SPARC V9 platforms -- - all x86 platforms -- - all x86_64 platforms package System.Atomic_Counters is pragma Pure; pragma Preelaborate; type Atomic_Counter is limited private; -- Type for atomic counter objects. Note, initial value of the counter is -- one. This allows using an atomic counter as member of record types when -- object of these types are created at library level in preelaborable -- compilation units. -- -- Atomic_Counter is declared as private limited type to provide highest -- level of protection from unexpected use. All available operations are -- declared below, and this set should be as small as possible. -- Increment/Decrement operations for this type raise Program_Error on -- platforms not supporting the atomic primitives. procedure Increment (Item : in out Atomic_Counter); pragma Inline_Always (Increment); -- Increments value of atomic counter. function Decrement (Item : in out Atomic_Counter) return Boolean; pragma Inline_Always (Decrement); -- Decrements value of atomic counter, returns True when value reach zero function Is_One (Item : Atomic_Counter) return Boolean; pragma Inline_Always (Is_One); -- Returns True when value of the atomic counter is one procedure Initialize (Item : out Atomic_Counter); pragma Inline_Always (Initialize); -- Initialize counter by setting its value to one. This subprogram is -- intended to be used in special cases when the counter object cannot be -- initialized in standard way. type Atomic_Unsigned is mod 2 ** 32 with Default_Value => 0, Atomic; -- Modular compatible atomic unsigned type. -- Increment/Decrement operations for this type are atomic only on -- supported platforms. See top of the file. procedure Increment (Item : aliased in out Atomic_Unsigned) with Inline_Always; -- Increments value of atomic counter function Decrement (Item : aliased in out Atomic_Unsigned) return Boolean with Inline_Always; procedure Decrement (Item : aliased in out Atomic_Unsigned) with Inline_Always; -- Decrements value of atomic counter -- The "+" and "-" abstract routine provided below to disable BT := BT + 1 -- constructions. function "+" (Left, Right : Atomic_Unsigned) return Atomic_Unsigned is abstract; function "-" (Left, Right : Atomic_Unsigned) return Atomic_Unsigned is abstract; private type Atomic_Counter is record Value : aliased Atomic_Unsigned := 1; end record; end System.Atomic_Counters;
flyx/OpenGLAda
Ada
1,077
adb
-- part of OpenGLAda, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "COPYING" with GL.API; -- Fixed function pipeline. Deprecated in OpenGL 3.0. package body GL.Fixed is procedure Set_Vertex_Pointer (Length : Vertex_Length; Stride, Offset : Size) is begin API.Vertex_Pointer (Int (Length), Double_Type, Stride, Offset); Raise_Exception_On_OpenGL_Error; end Set_Vertex_Pointer; procedure Set_Color_Pointer (Stride, Offset : Size) is begin API.Color_Pointer (4, Single_Type, Stride, Int (Offset)); Raise_Exception_On_OpenGL_Error; end Set_Color_Pointer; procedure Enable (Capability : Client_Side_Capability) is begin API.Enable_Client_State (Capability); Raise_Exception_On_OpenGL_Error; end Enable; procedure Disable (Capability : Client_Side_Capability) is begin API.Disable_Client_State (Capability); Raise_Exception_On_OpenGL_Error; end Disable; end GL.Fixed;
reznikmm/matreshka
Ada
3,769
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Table_Use_First_Row_Styles_Attributes is pragma Preelaborate; type ODF_Table_Use_First_Row_Styles_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Table_Use_First_Row_Styles_Attribute_Access is access all ODF_Table_Use_First_Row_Styles_Attribute'Class with Storage_Size => 0; end ODF.DOM.Table_Use_First_Row_Styles_Attributes;
AdaCore/training_material
Ada
411
adb
with Ada.Characters.Handling; use Ada.Characters.Handling; package body Types is function Convert (Category : Category_T) return String is Retval : String := To_Lower (Category'image); begin Retval (1) := To_Upper (Retval (1)); return Retval; end Convert; function Convert (Category : String) return Category_T is (Category_T'value (Category)); end Types;
HeisenbugLtd/cache-sim
Ada
7,121
adb
------------------------------------------------------------------------------ -- Copyright (C) 2012-2020 by Heisenbug Ltd. -- -- This work is free. You can redistribute it and/or modify it under the -- terms of the Do What The Fuck You Want To Public License, Version 2, -- as published by Sam Hocevar. See the LICENSE file for more details. -------------------------------------------------------------------------------- pragma License (Unrestricted); -------------------------------------------------------------------------------- -- Simple test program. -------------------------------------------------------------------------------- with Ada.Characters.Latin_1, Ada.Float_Text_IO, Ada.Text_IO; with Caches.Simple_Caches, Caches.Tests; use type Caches.Count; use type Caches.Unsigned; procedure Main is package Bytes_IO is new Ada.Text_IO.Integer_IO (Num => Caches.Bytes); TAB : Character renames Ada.Characters.Latin_1.HT; ----------------------------------------------------------------------------- -- Put_Dynamic_Info ----------------------------------------------------------------------------- procedure Put_Dynamic_Info (Info : Caches.Event_Info); ----------------------------------------------------------------------------- -- Put_Dynamic_Info ----------------------------------------------------------------------------- procedure Put_Dynamic_Info (Info : Caches.Event_Info) is begin Ada.Text_IO.Put (Caches.Count'Image (Info.Reads) & TAB & Caches.Count'Image (Info.Writes) & TAB & Caches.Count'Image (Info.Lines_Fetched) & TAB & Caches.Count'Image (Info.Lines_Flushed) & TAB & Caches.Count'Image (Info.Hits) & TAB & Caches.Count'Image (Info.Misses) & TAB); if Info.Hits + Info.Misses /= 0 then Ada.Float_Text_IO.Put (Item => 100.0 * Float (Info.Hits) / Float (Info.Hits + Info.Misses), Fore => 3, Aft => 2, Exp => 0); Ada.Text_IO.Put ("%"); else Ada.Text_IO.Put ("N/A"); end if; Ada.Text_IO.New_Line; end Put_Dynamic_Info; ----------------------------------------------------------------------------- -- Put_Static_Info ----------------------------------------------------------------------------- procedure Put_Static_Info (Info : Caches.Configuration); ----------------------------------------------------------------------------- -- Put_Static_Info ----------------------------------------------------------------------------- procedure Put_Static_Info (Info : Caches.Configuration) is begin Ada.Text_IO.Put_Line ("cache line :" & Caches.Unsigned'Image (Info.Cache_Line)); Ada.Text_IO.Put_Line ("associativity:" & Caches.Unsigned'Image (Info.Association)); Ada.Text_IO.Put_Line ("blocks :" & Caches.Unsigned'Image (Info.Num_Blocks)); Ada.Text_IO.Put_Line ("size :" & Caches.Unsigned'Image (Info.Cache_Size)); end Put_Static_Info; First_Level : aliased Caches.Simple_Caches.Simple_Cache (Cache_Line => 64, Association => 8, Num_Blocks => 64, -- 32 KiBytes Level_Id => 1); Second_Level : aliased Caches.Simple_Caches.Simple_Cache (Cache_Line => 64, Association => 8, Num_Blocks => 256, -- 128 KiBytes Level_Id => 2); Third_Level : aliased Caches.Simple_Caches.Simple_Cache (Cache_Line => 64, Association => 32, Num_Blocks => 512, -- 2 MiBytes Level_Id => 3); Cache_Hierarchy : constant array (Positive range <>) of Caches.Simple_Caches.Simple_Cache_Ptr := (1 => First_Level'Unchecked_Access, 2 => Second_Level'Unchecked_Access, 3 => Third_Level'Unchecked_Access); begin for Cache in Cache_Hierarchy'Range loop Caches.Simple_Caches.Initialize (This => Cache_Hierarchy (Cache).all); end loop; for Cache in Cache_Hierarchy'First .. Cache_Hierarchy'Last - 1 loop Caches.Simple_Caches.Connect (This => Cache_Hierarchy (Cache).all, Next => Cache_Hierarchy (Cache + 1), Speed_Factor => 2.0); end loop; for Cache in Cache_Hierarchy'Range loop Ada.Text_IO.Put_Line ("LEVEL" & Integer'Image (Cache)); Put_Static_Info (Caches.Info (This => Cache_Hierarchy (Cache).all)); Ada.Text_IO.New_Line; end loop; declare First : Caches.Simple_Caches.Simple_Cache'Class renames Cache_Hierarchy (Cache_Hierarchy'First).all; subtype Result_Array is Caches.Tests.Result_Array (1 .. 256); type Test_Def is record Length : Caches.Bytes; Result : Result_Array; end record; Result : array (Caches.Bytes range <>) of Test_Def := (1 => Test_Def'(Length => 1 * Caches.KI_BYTE, Result => Result_Array'(others => 0.0)), 2 => Test_Def'(Length => 4 * Caches.KI_BYTE, Result => Result_Array'(others => 0.0)), 3 => Test_Def'(Length => 32 * Caches.KI_BYTE, Result => Result_Array'(others => 0.0)), 4 => Test_Def'(Length => 128 * Caches.KI_BYTE, Result => Result_Array'(others => 0.0))); begin for i in Result'Range loop Bytes_IO.Put (Item => Result (i).Length, Width => 0); Ada.Text_IO.Put (" running..."); Caches.Tests.Linear (The_Cache => First, Length => Result (i).Length, Iterations => 1, Warmup => True, Result => Result (i).Result); Ada.Text_IO.Put_Line ("finished."); for Cache in Cache_Hierarchy'Range loop Ada.Text_IO.Put ("LEVEL" & Integer'Image (Cache)); Put_Dynamic_Info (Caches.Info (Cache_Hierarchy (Cache).all)); end loop; end loop; Ada.Text_IO.Put_Line ("Results:"); Ada.Text_IO.New_Line; Ada.Text_IO.Put ("Steps" & TAB); for i in Result'Range loop Ada.Text_IO.Put ("Test #"); Bytes_IO.Put (Item => i, Width => 3); if i /= Result'Last then Ada.Text_IO.Put (TAB & ""); end if; end loop; Ada.Text_IO.New_Line; for Row in Result_Array'Range loop Bytes_IO.Put (Item => Row, Width => 3); Ada.Text_IO.Put (TAB & ""); for Col in Result'Range loop Ada.Float_Text_IO.Put (Item => Result (Col).Result (Row), Aft => 0, Exp => 0); if Col /= Result'Last then Ada.Text_IO.Put (TAB & ""); end if; end loop; Ada.Text_IO.New_Line; end loop; end; end Main;
zhmu/ananas
Ada
404
ads
package Debug2_Pkg is type String_Ptr is access all String; function To_Heap return String_Ptr; type String_List(Chars_Length: Positive) is private; type String_List_Ptr is access constant String_List; function Singleton return String_List; private type String_List(Chars_Length: Positive) is record Chars: String(1..Chars_Length); end record; end Debug2_Pkg;
afrl-rq/OpenUxAS
Ada
1,272
ads
with Ada.Containers.Formal_Ordered_Sets; with Ada.Containers.Formal_Vectors; with AVTAS.LMCP.Types; use AVTAS.LMCP.Types; package Common_Formal_Containers with SPARK_Mode is package Int64_Vects is new Ada.Containers.Formal_Vectors (Index_Type => Natural, Element_Type => Int64); Int64_Vects_Common_Max_Capacity : constant := 200; -- arbitrary subtype Int64_Vect is Int64_Vects.Vector (Int64_Vects_Common_Max_Capacity); function Int64_Hash (X : Int64) return Ada.Containers.Hash_Type is (Ada.Containers.Hash_Type'Mod (X)); -- pragma Assertion_Policy (Post => Ignore); -- package Int64_Sets is new Ada.Containers.Formal_Hashed_Sets -- (Element_Type => Int64, -- Hash => Int64_Hash); package Int64_Sets is new Ada.Containers.Formal_Ordered_Sets (Element_Type => Int64); -- pragma Assertion_Policy (Post => Suppressible); Int64_Sets_Common_Max_Capacity : constant := 200; -- arbitrary, and shared among all instances but not necessarily -- subtype Int64_Set is Int64_Sets.Set -- (Int64_Sets_Common_Max_Capacity, Int64_Sets.Default_Modulus (Int64_Sets_Common_Max_Capacity)); subtype Int64_Set is Int64_Sets.Set (Int64_Sets_Common_Max_Capacity); end Common_Formal_Containers;
AdaCore/ada-traits-containers
Ada
5,396
ads
pragma Ada_2012; with Conts; use Conts; with Formal_Hashed_Sets; pragma Elaborate_All (Formal_Hashed_Sets); package Use_Sets with SPARK_Mode is type Element_Type is new Natural; package My_Sets is new Formal_Hashed_Sets (Element_Type => Element_Type); use My_Sets.Impl; use My_Sets.Impl.M; use My_Sets.Impl.E; pragma Unevaluated_Use_Of_Old (Allow); function My_Contains (S : My_Sets.Set; E : Element_Type) return Boolean is (Find (S, E) /= No_Element) with Post => My_Contains'Result = Contains (S, E); function My_Find (S : My_Sets.Set; E : Element_Type) return Cursor with Post => My_Find'Result = Find (S, E); -- Iterate through the set to find E. function F (E : Element_Type) return Element_Type is (if E in -100 .. 100 then E * 2 else E); procedure Apply_F (S : My_Sets.Set; R : in out My_Sets.Set) with Pre => Capacity (R) >= Length (S), Post => (for all E of S => Contains (R, F (E))) and (for all G of R => (for some E of S => G = F (E))); -- Store in R the image of every element of S through F. Note that F is not -- injective. function Are_Disjoint (S1, S2 : My_Sets.Set) return Boolean with Post => Are_Disjoint'Result = Is_Empty (Intersection (Model (S1), Model (S2))); -- Check wether two sets are disjoint. function Are_Disjoint_2 (S1, S2 : My_Sets.Set) return Boolean with Post => Are_Disjoint_2'Result = (for all E of Model (S2) => not Mem (Model (S1), E)); -- Same as before except that it is specified it using a quantified -- expression instead of set intersection. function P (E : Element_Type) return Boolean is (E >= 0); procedure Union_P (S1 : in out My_Sets.Set; S2 : My_Sets.Set) with Pre => (for all E of S1 => P (E)) and (for all E of S2 => P (E)) and Capacity (S1) - Length (S1) > Length (S2), Post => (for all E of S1 => P (E)); -- Compute the union of two sets for which P is true. procedure Move (S1, S2 : in out My_Sets.Set) with Pre => Capacity (S2) >= Length (S1), Post => Model (S1)'Old = Model (S2) and Length (S1) = 0; -- Move the content of a set into another set. Already included element are -- excluded from the first set during iteration. procedure Move_2 (S1, S2 : in out My_Sets.Set) with Pre => Capacity (S2) >= Length (S1), Post => Model (S1)'Old = Model (S2) and Length (S1) = 0; -- Same as before except that S1 is cleared at the end. Count : constant := 6; procedure Insert_Count (S : in out My_Sets.Set) -- Include elements 1 .. Count in S. with Pre => Capacity (S) - Count > Length (S), Post => Length (S) <= Length (S)'Old + Count and Model (S)'Old <= Model (S) and (for all E in 1 .. Element_Type'(Count) => Contains (S, E)) and (for all E of S => Mem (Model (S)'Old, E) or E in 1 .. Count); -- Test links between high-level model, lower-level position based model -- and lowest-level, cursor based model of a set. function Q (E : Element_Type) return Boolean; -- Any property Q on an Integer E. procedure From_Elements_To_Model (S : My_Sets.Set) with Ghost, Global => null, Pre => (for all I in 1 .. Length (S) => Q (Get (Elements (S), I))), Post => (for all E of S => Q (E)); -- Test that the link can be done from a property on the elements of a -- low level, position based view of a container and its high level view. procedure From_Model_To_Elements (S : My_Sets.Set) with Ghost, Global => null, Pre => (for all E of S => Q (E)), Post => (for all I in 1 .. Length (S) => Q (Get (Elements (S), I))); -- Test that the link can be done from a property on the elements of a -- high level view of a container and its lower level, position based view. procedure From_Elements_To_Cursors (S : My_Sets.Set) with Ghost, Global => null, Pre => (for all I in 1 .. Length (S) => Q (Get (Elements (S), I))), Post => (for all Cu in S => Q (Element (S, Cu))); -- Test that the link can be done from a property on the elements of a -- position based view of a container and its lowest level, cursor aware -- view. procedure From_Cursors_To_Elements (S : My_Sets.Set) with Ghost, Global => null, Pre => (for all Cu in S => Q (Element (S, Cu))), Post => (for all I in 1 .. Length (S) => Q (Get (Elements (S), I))); -- Test that the link can be done from a property on the elements of a -- cursor aware view of a container and its position based view. procedure From_Model_To_Cursors (S : My_Sets.Set) with Ghost, Global => null, Pre => (for all E of S => Q (E)), Post => (for all Cu in S => Q (Element (S, Cu))); -- Test that the link can be done from a property on the elements of a -- high level view of a container and its lowest level, cursor aware view. procedure From_Cursors_To_Model (S : My_Sets.Set) with Ghost, Global => null, Pre => (for all Cu in S => Q (Element (S, Cu))), Post => (for all E of S => Q (E)); -- Test that the link can be done from a property on the elements of a -- low level, cursor aware view of a container and its high level view. end Use_Sets;
reznikmm/matreshka
Ada
3,949
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Fo_Height_Attributes; package Matreshka.ODF_Fo.Height_Attributes is type Fo_Height_Attribute_Node is new Matreshka.ODF_Fo.Abstract_Fo_Attribute_Node and ODF.DOM.Fo_Height_Attributes.ODF_Fo_Height_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Fo_Height_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Fo_Height_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Fo.Height_Attributes;
AdaCore/libadalang
Ada
202
adb
package body Foo is subtype Int is Types.Int; procedure Bar (I : Int) is begin return 1; end Foo; procedure Bar (I : Types.Byte) is begin return 0; end Foo; end Foo;
DavJo-dotdotdot/Ada_Drivers_Library
Ada
9,259
adb
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2016-2020, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with NRF_SVD.GPIO; use NRF_SVD.GPIO; package body nRF.GPIO is overriding function Mode (This : GPIO_Point) return HAL.GPIO.GPIO_Mode is CNF_P0 : PIN_CNF_Register renames GPIO_Periph.PIN_CNF (This.Pin MOD 32); CNF_P1 : PIN_CNF_Register renames GPIO_Periph1.PIN_CNF (This.Pin MOD 32); begin if This.Pin > 31 then case CNF_P1.DIR is when Input => return HAL.GPIO.Input; when Output => return HAL.GPIO.Output; end case; else case CNF_P0.DIR is when Input => return HAL.GPIO.Input; when Output => return HAL.GPIO.Output; end case; end if; end Mode; -------------- -- Set_Mode -- -------------- overriding procedure Set_Mode (This : in out GPIO_Point; Mode : HAL.GPIO.GPIO_Config_Mode) is CNF_P0 : PIN_CNF_Register renames GPIO_Periph.PIN_CNF (This.Pin MOD 32); CNF_P1 : PIN_CNF_Register renames GPIO_Periph1.PIN_CNF (This.Pin MOD 32); begin if This.Pin > 31 then CNF_P1.DIR := (case Mode is when HAL.GPIO.Input => Input, when HAL.GPIO.Output => Output); CNF_P1.INPUT := (case Mode is when HAL.GPIO.Input => Connect, when HAL.GPIO.Output => Disconnect); else CNF_P0.DIR := (case Mode is when HAL.GPIO.Input => Input, when HAL.GPIO.Output => Output); CNF_P0.INPUT := (case Mode is when HAL.GPIO.Input => Connect, when HAL.GPIO.Output => Disconnect); end if; end Set_Mode; --------- -- Set -- --------- overriding function Set (This : GPIO_Point) return Boolean is begin if This.Pin > 31 then return GPIO_Periph1.IN_k.Arr (This.Pin MOD 32) = High; else return GPIO_Periph.IN_k.Arr (This.Pin MOD 32) = High; end if; end Set; ------------------- -- Pull_Resistor -- ------------------- overriding function Pull_Resistor (This : GPIO_Point) return HAL.GPIO.GPIO_Pull_Resistor is begin if This.Pin > 31 then case GPIO_Periph1.PIN_CNF (This.Pin MOD 32).PULL is when Disabled => return HAL.GPIO.Floating; when Pulldown => return HAL.GPIO.Pull_Down; when Pullup => return HAL.GPIO.Pull_Up; end case; else case GPIO_Periph.PIN_CNF (This.Pin MOD 32).PULL is when Disabled => return HAL.GPIO.Floating; when Pulldown => return HAL.GPIO.Pull_Down; when Pullup => return HAL.GPIO.Pull_Up; end case; end if; end Pull_Resistor; ----------------------- -- Set_Pull_Resistor -- ----------------------- overriding procedure Set_Pull_Resistor (This : in out GPIO_Point; Pull : HAL.GPIO.GPIO_Pull_Resistor) is begin if This.Pin > 31 then GPIO_Periph1.PIN_CNF (This.Pin MOD 32).PULL := (case Pull is when HAL.GPIO.Floating => Disabled, when HAL.GPIO.Pull_Down => Pulldown, when HAL.GPIO.Pull_Up => Pullup); else GPIO_Periph.PIN_CNF (This.Pin MOD 32).PULL := (case Pull is when HAL.GPIO.Floating => Disabled, when HAL.GPIO.Pull_Down => Pulldown, when HAL.GPIO.Pull_Up => Pullup); end if; end Set_Pull_Resistor; --------- -- Set -- --------- overriding procedure Set (This : in out GPIO_Point) is begin if This.Pin > 31 then GPIO_Periph1.OUT_k.Arr (This.Pin MOD 32) := High; else GPIO_Periph.OUT_k.Arr (This.Pin MOD 32) := High; end if; end Set; ----------- -- Clear -- ----------- overriding procedure Clear (This : in out GPIO_Point) is begin if This.Pin > 31 then GPIO_Periph1.OUT_k.Arr (This.Pin MOD 32) := Low; else GPIO_Periph.OUT_k.Arr (This.Pin MOD 32) := Low; end if; end Clear; ------------ -- Toggle -- ------------ overriding procedure Toggle (This : in out GPIO_Point) is begin if This.Set then This.Clear; else This.Set; end if; end Toggle; ------------------ -- Configure_IO -- ------------------ procedure Configure_IO (This : GPIO_Point; Config : GPIO_Configuration) is CNF_P0 : PIN_CNF_Register renames GPIO_Periph.PIN_CNF (This.Pin MOD 32); CNF_P1 : PIN_CNF_Register renames GPIO_Periph1.PIN_CNF (This.Pin MOD 32); begin if This.Pin > 31 then CNF_P1.DIR := (case Config.Mode is when Mode_In => Input, when Mode_Out => Output); CNF_P1.INPUT := (case Config.Input_Buffer is when Input_Buffer_Connect => Connect, when Input_Buffer_Disconnect => Disconnect); CNF_P1.PULL := (case Config.Resistors is when No_Pull => Disabled, when Pull_Up => Pullup, when Pull_Down => Pulldown); CNF_P1.DRIVE := (case Config.Drive is when Drive_S0S1 => S0S1, when Drive_H0S1 => H0S1, when Drive_S0H1 => S0H1, when Drive_H0H1 => H0H1, when Drive_D0S1 => D0S1, when Drive_D0H1 => D0H1, when Drive_S0D1 => S0D1, when Drive_H0D1 => H0D1); CNF_P1.SENSE := (case Config.Sense is when Sense_Disabled => Disabled, when Sense_For_High_Level => High, when Sense_For_Low_Level => Low); else CNF_P0.DIR := (case Config.Mode is when Mode_In => Input, when Mode_Out => Output); CNF_P0.INPUT := (case Config.Input_Buffer is when Input_Buffer_Connect => Connect, when Input_Buffer_Disconnect => Disconnect); CNF_P0.PULL := (case Config.Resistors is when No_Pull => Disabled, when Pull_Up => Pullup, when Pull_Down => Pulldown); CNF_P0.DRIVE := (case Config.Drive is when Drive_S0S1 => S0S1, when Drive_H0S1 => H0S1, when Drive_S0H1 => S0H1, when Drive_H0H1 => H0H1, when Drive_D0S1 => D0S1, when Drive_D0H1 => D0H1, when Drive_S0D1 => S0D1, when Drive_H0D1 => H0D1); CNF_P0.SENSE := (case Config.Sense is when Sense_Disabled => Disabled, when Sense_For_High_Level => High, when Sense_For_Low_Level => Low); end if; end Configure_IO; end nRF.GPIO;
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.Text_Outline_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Style_Text_Outline_Attribute_Node is begin return Self : Style_Text_Outline_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_Text_Outline_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Text_Outline_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Style_URI, Matreshka.ODF_String_Constants.Text_Outline_Attribute, Style_Text_Outline_Attribute_Node'Tag); end Matreshka.ODF_Style.Text_Outline_Attributes;
davidkristola/vole
Ada
14,727
adb
with Ada.Exceptions; use Ada.Exceptions; with Ada.Unchecked_Conversion; with Ada.Unchecked_Deallocation; with kv.avm.Log; use kv.avm.Log; with kv.avm.references; use kv.avm.references; with kv.avm.Actor_References; with kv.avm.actor_pool; with kv.avm.Methods; package body kv.avm.Instances is use kv.avm.Instructions; use kv.avm.Registers; use kv.avm.Frames; type Constant_Access is access constant kv.avm.Memories.Register_Set_Type; function Convert is new Ada.Unchecked_Conversion (Source => Constant_Access, Target => kv.avm.Memories.Register_Set_Access); Fake_Name : aliased constant String := "Subroutine"; ----------------------------------------------------------------------------- function "+"(RHS : Instance_Access) return kv.avm.Executables.Executable_Access is begin return kv.avm.Executables.Executable_Access(RHS); end "+"; ----------------------------------------------------------------------------- procedure Initialize (Self : access Instance_Type; Actor : in kv.avm.Actors.Actor_Access; Memory : in kv.avm.Memories.Memory_Type; Myself : in kv.avm.Actor_References.Actor_Reference_Type) is use kv.avm.control; use kv.avm.Memories; begin Self.Alive := True; Self.Actor := Actor; Self.Memory := Memory; Self.Myself := Myself; if not Memory.Get(Attribute).Is_Set then Self.Attributes.Allocate(64); else Self.Attributes := Register_Array_Type(Memory.Get(Attribute)); -- Use the test set end if; if not Memory.Get(Fixed).Is_Set then Self.Constants := Actor.Get_Constants; else Self.Constants := Register_Array_Type(Memory.Get(Fixed)); -- Use the test set end if; end Initialize; ----------------------------------------------------------------------------- function Get_Frame(Self : Instance_Type) return kv.avm.Frames.Frame_Access is begin return Self.Frame; end Get_Frame; ----------------------------------------------------------------------------- procedure Process_Message (Self : in out Instance_Type; Message : in kv.avm.Messages.Message_Type) is Ref : kv.avm.Actor_References.Actor_Reference_Type; Current_Frame : kv.avm.Frames.Frame_Access; Memories : kv.avm.Memories.Memory_Type; Registers : kv.avm.Memories.Register_Array_Type; function Log_Entry return String is begin return Self.Image&".Process_Message "&Message.Get_Name& ", Invoker="&Message.Get_Source.Image& ", Future="&Interfaces.Unsigned_32'IMAGE(Message.Get_Future); end Log_Entry; use kv.avm.Registers; use kv.avm.Memories; begin Log_If(Log_Entry'ACCESS); Current_Frame := Self.Frame; Self.Frame := new kv.avm.Frames.Frame_Type; Registers := Register_Array_Type(Self.Memory.Get(Local)); --!@#$ copy test set Memories.Set(Local, Registers); Memories.Set(Attribute, Self.Attributes); Memories.Set(Fixed, Self.Constants); Registers.Set(Convert(Constant_Access(Message.Get_Data.Unfolded))); Memories.Set(Input, Registers); if not Memories.Get(Local).Is_Set then Registers.Allocate(64); Memories.Set(Local, Registers); end if; Self.Frame.Initialize (Instance => Self.Myself, Name => +Message.Get_Name, Invoker => Message.Get_Reply_To, -- Replies go back to the invoker Future => Message.Get_Future, Code => Self.Actor.Get_Method(Message.Get_Name).Get_Code, Memory => Memories, Next => Current_Frame); exception when Error: others => Put_Error("EXCEPTION (in Process_Message): " & Exception_Information(Error)); raise; end Process_Message; ----------------------------------------------------------------------------- procedure Process_Gosub (Self : access Instance_Type; Tailcall : in Boolean; Supercall : in Boolean; Reply_To : in kv.avm.Actor_References.Actor_Reference_Type; Method : in kv.avm.Registers.String_Type; Data : access constant kv.avm.Memories.Register_Set_Type; Future : in Interfaces.Unsigned_32) is Current_Frame : kv.avm.Frames.Frame_Access; Memories : kv.avm.Memories.Memory_Type; Registers : kv.avm.Memories.Register_Array_Type; Method_Object : kv.avm.Methods.Method_Access; function Log_Entry return String is Is_Tail : String := " Tail"; Is_Super : String := " Super"; begin if not Tailcall then Is_Tail := " Push"; end if; if not Supercall then Is_Super := " Self "; end if; return Self.Image & ".Process_Gosub " & (+Method) & Is_Tail & Is_Super; end Log_Entry; use kv.avm.Registers; use kv.avm.Memories; begin --Put_Line(Self.Image & ".Process_Gosub " & (+Method)); Log_If(Log_Entry'ACCESS); Registers := Register_Array_Type(Self.Memory.Get(Local)); --!@#$ copy test set Memories.Set(Local, Registers); Memories.Set(Attribute, Self.Attributes); Memories.Set(Fixed, Self.Constants); Registers.Set(Convert(Constant_Access(Data))); Memories.Set(Input, Registers); if not Memories.Get(Local).Is_Set then Registers.Allocate(64); Memories.Set(Local, Registers); end if; if Tailcall then -- Reuse the frame. Current_Frame := Self.Frame.Get_Next; -- Keep the current parent frame. else -- Allocate a new frame. Current_Frame := Self.Frame; Self.Frame := new kv.avm.Frames.Frame_Type; --!@#$ leak end if; if Supercall then Method_Object := Self.Actor.Get_Parent.Get_Method(+Method); else Method_Object := Self.Actor.Get_Method(+Method); end if; Self.Frame.Initialize (Instance => Self.Myself, Name => Method, Invoker => Reply_To, -- Replies go back to the invoker Future => Future, Code => Method_Object.Get_Code, Memory => Memories, Next => Current_Frame); exception when Error: others => Put_Error("EXCEPTION (in Process_Gosub): " & Exception_Information(Error)); raise; end Process_Gosub; ----------------------------------------------------------------------------- function Can_Accept_Message_Now(Self : Instance_Type; Message : kv.avm.Messages.Message_Type) return Boolean is Method : kv.avm.Methods.Method_Access; Predicate : kv.avm.References.Offset_Type; Register : kv.avm.Registers.Register_Type; use kv.avm.Methods; begin if Self.Frame = null then Method := Self.Actor.Get_Method(Message.Get_Name); -- Recurs up inheritance chain if Method = null then Put_Line("Could not find message " & Message.Get_Name); return False; else if Method.Has_Predicate then Predicate := Method.Get_Predicate; Register := Self.Attributes.Read(Predicate); Put_Line("Machine Predicate check for " & Message.Get_Name & ", accapt: " & Boolean'IMAGE(Register.Bit)); return Register.Bit; else return True; end if; end if; end if; Put_Line("Can't accept message " & Message.Get_Name & " because frame " & Self.Frame.Image & " is running."); return False; end Can_Accept_Message_Now; ----------------------------------------------------------------------------- function Program_Counter (Self : in Instance_Type) return Interfaces.Unsigned_32 is begin if Self.Frame = null then return 0; end if; return Self.Frame.Program_Counter; end Program_Counter; ----------------------------------------------------------------------------- function Is_Running (Self : in Instance_Type) return Boolean is begin if not Self.Alive then return False; end if; if Self.Frame = null then return False; end if; --!@#$ what about blocked and deferred? --!@#$ Machine, which is the only thing that checks this, uses it in both senses. :-( return True; -- We are not dead or idle so we are running. end Is_Running; ----------------------------------------------------------------------------- procedure Free is new Ada.Unchecked_Deallocation(kv.avm.Frames.Frame_Type, kv.avm.Frames.Frame_Access); ----------------------------------------------------------------------------- procedure Step (Self : access Instance_Type; Processor : access kv.avm.Processors.Processor_Type; Status : out kv.avm.Control.Status_Type) is Done_Frame : kv.avm.Frames.Frame_Access; Message : kv.avm.Messages.Message_Type; begin --Put_Line("kv.avm.instance.Step "&Self.Image); Processor.Step(Self.Frame, Status); if Self.Frame.Is_Done then --Put_Line("Frame " & Self.Image & "@" & Self.Frame.Image & " has completed processing, removing it from the stack."); Put_Line("Frame " & Self.Frame.Image & " has completed processing, removing it from the stack."); -- This frame is done and needs to be deleted. Done_Frame := Self.Frame; Self.Frame := Self.Frame.Get_Next; -- Free the frame Done_Frame.Prepare_For_Deletion; Free(Done_Frame); if Self.Frame /= null then --Put_Line("Frame " & Self.Image & "@" & Self.Frame.Image & " has resumed."); Put_Line("Frame " & Self.Frame.Image & " has resumed."); end if; --TODO: figure out why this breaks the unit tests --if Self.Frame = null then -- Status := kv.avm.Control.Idle; --end if; end if; exception when Error: others => Put_Error("EXCEPTION (in Step): " & Exception_Information(Error)); raise; end Step; ----------------------------------------------------------------------------- procedure Process_Internal_Response (Self : in out Instance_Type; Answer : in kv.avm.Tuples.Tuple_Type) is Done_Frame : kv.avm.Frames.Frame_Access; begin --Put_Line("kv.avm.instance.Process_Response"); Done_Frame := Self.Frame; Self.Frame := Self.Frame.Get_Next; Free(Done_Frame); -- Call it's Process_Response to fill in the answer Self.Frame.Process_Gosub_Response(Answer); exception when Error: others => Put_Error("EXCEPTION (in Process_Internal_Response): " & Exception_Information(Error)); raise; end Process_Internal_Response; ----------------------------------------------------------------------------- procedure Resolve_Future (Self : in out Instance_Type; Answer : in kv.avm.Tuples.Tuple_Type; Future : in Interfaces.Unsigned_32) is Index : kv.avm.References.Offset_Type; Found : Boolean; begin --!@#$ this future could be in any local register in any frame or in an instance register Self.Attributes.Find_Future(Future, Found, Index); if Found then Self.Attributes.Write(Index, (Format => kv.avm.Registers.Tuple, folded_tuple => Answer)); if Self.Frame /= null then Self.Frame.Set_Blocked(False); end if; return; end if; Put_Line("Future "&Interfaces.Unsigned_32'IMAGE(Future)&" not in an attribute, searching frames."); if Self.Frame = null then raise kv.avm.Executables.Corrupt_Executable_Error; else Self.Frame.Resolve_Future(Answer, Future); end if; exception when Error: others => Put_Error("EXCEPTION (in Resolve_Future): " & Exception_Information(Error)); raise; end Resolve_Future; ----------------------------------------------------------------------------- function Alive(Self : Instance_Type) return Boolean is begin return Self.Alive; end Alive; ----------------------------------------------------------------------------- procedure Halt_Actor (Self : in out Instance_Type) is begin Self.Alive := False; end Halt_Actor; ----------------------------------------------------------------------------- function Reachable(Self : Instance_Type) return kv.avm.Actor_References.Sets.Set is Can_Reach : kv.avm.Actor_References.Sets.Set := kv.avm.Actor_References.Sets.Empty_Set; begin Can_Reach.Include(Self.Myself); Can_Reach.Union(Self.Attributes.Reachable); Can_Reach.Union(Self.Constants.Reachable); if Self.Frame /= null then Can_Reach.Union(Self.Frame.Reachable); end if; return Can_Reach; end Reachable; ----------------------------------------------------------------------------- function Image(Self : Instance_Type) return String is begin return Self.Actor.Image & Self.Myself.Image; end Image; ----------------------------------------------------------------------------- function Debug_Info(Self : Instance_Type) return String is begin if Self.Frame = null then return Self.Actor.Image & Self.Myself.Image & " (no frame)"; else return Self.Actor.Image & Self.Myself.Image & ", Frame:" & Self.Frame.Debug_Info; end if; end Debug_Info; ----------------------------------------------------------------------------- procedure New_Executable (Self : in out Instance_Factory; Actor : in kv.avm.Actors.Actor_Access; Machine : in kv.avm.Control.Control_Access; Executable : out kv.avm.Executables.Executable_Access; Reference : out kv.avm.Actor_References.Actor_Reference_Type) is use kv.avm.Control; Empty : kv.avm.Memories.Memory_Type; Instance : Instance_Access; begin if Machine = null then Put_Error("WARNING: kv.avm.Instances.New_Executable called with Machine = null!"); end if; Instance := new Instance_Type; kv.avm.Actor_Pool.Add(+Instance, Reference); Instance.Initialize(Actor, Empty, Reference); Executable := kv.avm.Executables.Executable_Access(Instance); exception when Error: others => Put_Error("EXCEPTION (in New_Executable): " & Exception_Information(Error)); raise; end New_Executable; end kv.avm.Instances;
AdaCore/gpr
Ada
2,356
adb
-- -- Copyright (C) 2021-2023, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 -- with Ada.Text_IO; with GPR2.Context; with GPR2.Log; with GPR2.Path_Name; with GPR2.Project.Registry.Attribute; with GPR2.Project.Tree; with GPR2.Project.Variable; procedure Main is Tree : GPR2.Project.Tree.Object; Context : GPR2.Context.Object; Project_Name : constant GPR2.Filename_Type := "prj"; use GPR2; procedure Print_Message is begin if Tree.Has_Messages then for C in Tree.Log_Messages.Iterate (False, True, True, True, True) loop Ada.Text_IO.Put_Line (GPR2.Log.Element (C).Format); end loop; end if; end Print_Message; procedure Print_Variable (Variable : GPR2.Project.Variable.Object; Pack : GPR2.Package_Id := GPR2.Project_Level_Scope) is use GPR2.Project.Registry.Attribute; use type GPR2.Package_Id; begin if Pack /= GPR2.Project_Level_Scope then Ada.Text_IO.Put (GPR2.Image (Pack) & '.'); end if; Ada.Text_IO.Put(String (Variable.Name.Text) & ":" & Variable.Kind'Img & "="); if Variable.Kind = GPR2.Project.Registry.Attribute.Single then Ada.Text_IO.Put_Line (Variable.Value.Text); else for V of Variable.Values loop Ada.Text_IO.Put (V.Text & ";"); end loop; Ada.Text_IO.Put_Line (""); end if; end Print_Variable; procedure Test (Project : GPR2.Filename_Type) is begin Ada.Text_IO.Put_Line (String (Project) & ".gpr:"); Tree.Unload; Tree.Load_Autoconf (Filename => GPR2.Path_Name.Create_File (GPR2.Project.Ensure_Extension (Project), GPR2.Path_Name.No_Resolution), Context => Context); Print_Message; for V of Tree.Root_Project.Variables loop Print_Variable (V); end loop; for Pack of Tree.Root_Project.Packages loop for V of Tree.Root_Project.Variables (Pack) loop Print_Variable (V, Pack); end loop; end loop; exception when Project_Error => Print_Message; end Test; begin Test ("prj"); Test ("prj1"); Test ("prj2"); Test ("prj3"); Test ("prj4"); Test ("prj5"); Test ("prj6"); exception when Project_Error => Print_Message; end Main;
io7m/coreland-sqlite3-ada
Ada
420
ads
with SQLite3.API; pragma Elaborate_All (SQLite3.API); package rowdump is type Int_Access_t is access all Integer; package SQLite3_API is new SQLite3.API (User_Data_Type => Integer, User_Data_Access_Type => Int_Access_t); procedure Row_Callback (Column_Names : SQLite3_API.Column_Names_t; Column_Values : SQLite3_API.Column_Values_t; User_Data : Int_Access_t); end rowdump;
fractal-mind/Amass
Ada
1,609
ads
-- Copyright 2021 Jeff Foley. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. local json = require("json") name = "GitLab" type = "api" function start() set_rate_limit(1) end function check() local c local cfg = datasrc_config() if cfg ~= nil then c = cfg.credentials end if (c ~= nil and c.key ~= nil and c.key ~= "") then return true end return false end function vertical(ctx, domain) local c local cfg = datasrc_config() if cfg ~= nil then c = cfg.credentials end if (c == nil or c.key == nil or c.key == "") then return end local resp, err = request(ctx, { ['url']=search_url(domain, scope), ['headers']={['PRIVATE-TOKEN']=c.key}, }) if (err ~= nil and err ~= "") then log(ctx, "vertical request to service failed: " .. err) return end local j = json.decode(resp) if (j == nil or #j == 0) then return end for _, item in pairs(j) do local ok = scrape(ctx, { ['url']=get_file_url(item.project_id, item.path, item.ref), ['headers']={['PRIVATE-TOKEN']=c.key}, }) if not ok then send_names(ctx, item.data) end end end function get_file_url(id, path, ref) return "https://gitlab.com/api/v4/projects/" .. id .. "/repository/files/" .. path:gsub("/", "%%2f") .. "/raw?ref=" .. ref end function search_url(domain) return "https://gitlab.com/api/v4/search?scope=blobs&search=" .. domain end
sungyeon/drake
Ada
331
ads
pragma License (Unrestricted); -- implementation unit required by compiler with System.Exponentiations; package System.Exn_Int is pragma Pure; -- required for "**" without checking by compiler (s-exnint.ads) function Exn_Integer is new Exponentiations.Generic_Exp_Integer_No_Check (Integer); end System.Exn_Int;
reznikmm/matreshka
Ada
5,031
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Generic_Collections; package AMF.OCL.Variable_Exps.Collections is pragma Preelaborate; package OCL_Variable_Exp_Collections is new AMF.Generic_Collections (OCL_Variable_Exp, OCL_Variable_Exp_Access); type Set_Of_OCL_Variable_Exp is new OCL_Variable_Exp_Collections.Set with null record; Empty_Set_Of_OCL_Variable_Exp : constant Set_Of_OCL_Variable_Exp; type Ordered_Set_Of_OCL_Variable_Exp is new OCL_Variable_Exp_Collections.Ordered_Set with null record; Empty_Ordered_Set_Of_OCL_Variable_Exp : constant Ordered_Set_Of_OCL_Variable_Exp; type Bag_Of_OCL_Variable_Exp is new OCL_Variable_Exp_Collections.Bag with null record; Empty_Bag_Of_OCL_Variable_Exp : constant Bag_Of_OCL_Variable_Exp; type Sequence_Of_OCL_Variable_Exp is new OCL_Variable_Exp_Collections.Sequence with null record; Empty_Sequence_Of_OCL_Variable_Exp : constant Sequence_Of_OCL_Variable_Exp; private Empty_Set_Of_OCL_Variable_Exp : constant Set_Of_OCL_Variable_Exp := (OCL_Variable_Exp_Collections.Set with null record); Empty_Ordered_Set_Of_OCL_Variable_Exp : constant Ordered_Set_Of_OCL_Variable_Exp := (OCL_Variable_Exp_Collections.Ordered_Set with null record); Empty_Bag_Of_OCL_Variable_Exp : constant Bag_Of_OCL_Variable_Exp := (OCL_Variable_Exp_Collections.Bag with null record); Empty_Sequence_Of_OCL_Variable_Exp : constant Sequence_Of_OCL_Variable_Exp := (OCL_Variable_Exp_Collections.Sequence with null record); end AMF.OCL.Variable_Exps.Collections;
tum-ei-rcs/StratoX
Ada
44
adb
../../../../software/modules/sdlog-tools.adb
ekoeppen/STM32_Generic_Ada_Drivers
Ada
1,679
adb
with STM32GD.Board; use STM32GD.Board; with STM32GD.GPIO; use STM32GD.GPIO; with STM32GD.GPIO.Pin; with Drivers.Text_IO; with Peripherals; procedure Main is procedure Print_Registers is new Peripherals.Radio.Print_Registers (Put_Line => Text_IO.Put_Line); procedure RX_Test is RX_Address : constant Peripherals.Radio.Address_Type := (16#00#, 16#F0#, 16#F0#, 16#F0#, 16#F0#); begin Text_IO.Put_Line ("Starting RX test"); Peripherals.Radio.Set_RX_Address (RX_Address); Peripherals.Radio.RX_Mode; loop LED.Toggle; if Peripherals.Radio.Wait_For_RX then Text_IO.Put_Line ("Packet received"); end if; Print_Registers; end loop; end RX_Test; procedure TX_Test is Broadcast_Address : constant Peripherals.Radio.Address_Type := (16#00#, 16#F0#, 16#F0#, 16#F0#, 16#F0#); TX_Data : constant Peripherals.Radio.Packet_Type := (16#00#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#55#); Line : String (1 .. 8); Len : Natural; begin Text_IO.Put_Line ("Starting TX test"); Peripherals.Radio.Set_TX_Address (Broadcast_Address); loop Text_IO.Put_Line ("Press <enter>"); Text_IO.Get_Line (Line, Len); LED.Set; Peripherals.Radio.TX_Mode; Peripherals.Radio.TX (TX_Data); Peripherals.Radio.Power_Down; Text_IO.Put_Line ("Packet sent"); Print_Registers; LED.Clear; end loop; end TX_Test; begin Init; Peripherals.Init; Peripherals.Radio.Set_Channel (70); Print_Registers; TX_Test; end Main;
apple-oss-distributions/old_ncurses
Ada
5,554
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 Terminal_Interface.Curses; use Terminal_Interface.Curses; with ncurses2.util; use ncurses2.util; procedure ncurses2.flushinp_test (win : Window) is procedure Continue (win : Window); procedure Continue (win : Window) is begin Set_Echo_Mode (False); Move_Cursor (win, 10, 1); Add (win, 10, 1, " Press any key to continue"); Refresh (win); Getchar (win); end Continue; h, by, sh : Line_Position; w, bx, sw : Column_Position; subWin : Window; begin Clear (win); Get_Size (win, h, w); Get_Window_Position (win, by, bx); sw := w / 3; sh := h / 3; subWin := Sub_Window (win, sh, sw, by + h - sh - 2, bx + w - sw - 2); if Has_Colors then Init_Pair (2, Cyan, Blue); Change_Background (subWin, Attributed_Character'(Ch => ' ', Color => 2, Attr => Normal_Video)); end if; Set_Character_Attributes (subWin, (Bold_Character => True, others => False)); Box (subWin); Add (subWin, 2, 1, "This is a subwindow"); Refresh (win); Set_Cbreak_Mode (True); Add (win, 0, 1, "This is a test of the flushinp() call."); Add (win, 2, 1, "Type random keys for 5 seconds."); Add (win, 3, 1, "These should be discarded (not echoed) after the subwindow " & "goes away."); Refresh (win); for i in 0 .. 4 loop Move_Cursor (subWin, 1, 1); Add (subWin, Str => "Time = "); Add (subWin, Str => Integer'Image (i)); Refresh (subWin); Nap_Milli_Seconds (1000); Flush_Input; end loop; Delete (subWin); Erase (win); Flash_Screen; Refresh (win); Nap_Milli_Seconds (1000); Add (win, 2, 1, Str => "If you were still typing when the window timer expired,"); Add (win, 3, 1, "or else you typed nothing at all while it was running,"); Add (win, 4, 1, "test was invalid. You'll see garbage or nothing at all. "); Add (win, 6, 1, "Press a key"); Move_Cursor (win, 9, 10); Refresh (win); Set_Echo_Mode (True); Getchar (win); Flush_Input; Add (win, 12, 0, "If you see any key other than what you typed, flushinp() is broken."); Continue (win); Move_Cursor (win, 9, 10); Delete_Character (win); Refresh (win); Move_Cursor (win, 12, 0); Clear_To_End_Of_Line; Add (win, "What you typed should now have been deleted; if not, wdelch() " & "failed."); Continue (win); Set_Cbreak_Mode (True); end ncurses2.flushinp_test;
jscparker/math_packages
Ada
36,606
ads
----------------------------------------------------------------------- -- package Runge_Coeffs_PD_8, coefficients for Prince-Dormand Runge Kutta -- Copyright (C) 2008-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. ------------------------------------------------------------------------------- -- package Runge_Coeffs_PD_8 -- -- Package contains coefficients for the Prince-Dormand -- 8th order, 13 stage Runge Kutta method with error control. -- -- You have a choice between the old 17 significant figure coefficients -- and newer ones, given to about 28 significant figures. -- The older ones are entered in rational form. -- -- A test routine is provided to make make sure that they -- have not been corrupted. If the coefficients do not pass -- the tests, then they are given in redundant and alternate -- forms at the end of this package (commented out). -- -- Reference: "High Order Embedded Runge-Kutta Formulae" by P.J. -- Prince and J.R. Dormand, J. Comp. Appl. Math.,7, pp. 67-75, 1981. -- -- -- NOTES ON THE ALGORITHM -- -- Given a differential equ. dY/dt = F(t,Y) and an initial condition -- Y(t), the Runge-Kutta formulas predict a new value of Y at -- Y(t + h) with the formula -- -- max -- Y(t + h) = Y(t) + SUM (K(j) * B(j)) -- j=1 -- -- where max = Stages'Last, (which equals 13 here, since this is a 13 -- stage Runge-Kutta formula) where the quantities K are calculated from -- -- K(1) = h * F(t, Y(t)) -- -- j-1 -- K(j) = h * F (t + C(j)*h, Y(t) + SUM (K(i)*A(j,i)) ) -- i=1 -- -- The Fehberg method, used here, provides two versions of the array -- B, so that Y(t + h) may be calculated to both 7th order and to -- 8th order using the same K(i)'s. This way, the local truncation -- error can be estimated without calculating the K(i)'s twice. -- -- If we apply this formula to a time-independent linear F, then we can -- derive a condition that can be used to test the correctness of the -- initialization values of the arrays A, B and C. To derive such a -- formula we use the fact that the RK prediction of Y(t + h) must equal -- the Taylor series prediction up to the required order. So, -- -- K(1) = h*F*Y (where F now is a matrix, and Y a vector) -- -- K(2) = h*F*(Y + K(1)*A21) -- -- K(3) = h*F*(Y + K(1)*A31 + K(2)*A32) -- -- K(4) = h*F*(Y + K(1)*A41 + K(2)*A42 + K(3)*A43) -- -- The linearity of F implies that F(a*Y + Z) = a*F*Y + F*Z so: -- -- K(1) = h*F*Y -- -- K(2) = h*F*Y + A21*h^2*F^2*Y -- -- K(3) = h*F*Y + (A31 + A32)*h^2*F^2*Y + A32*A21*h^3*F^3*Y -- -- K(4) = h*F*Y + (A41+A42+A43)*h^2*F^2*Y + (A42*A21+A43*A31)h^3*F^3*Y -- + A43*A32*A21*h^4F^4*Y -- -- Now we use the fact that we must have the RK prediction equal that -- of the Taylor's series up to a certain order: -- -- max -- SUM (K(j) * B(j)) = h*F*Y + ... + (1/n!)*h^n*F^n*Y + O(h^n+1) -- j=1 -- -- Here n=8 for the coefficients B = B8 given below. Its n=7 for B7. -- The above formula gives us a relation between 1/n! and B and A. -- This formula is used in the procedure TestRKPD given at the end -- of this package. We see immediately that we must have: -- -- max -- SUM (B(i)) = 1/1! -- i=1 -- -- max i-1 -- SUM (B(i) * SUM(Aij)) = 1/2! -- i=2 j=1 -- --*************************************************************** generic type Real is digits <>; package Runge_Coeffs_PD_8 is subtype RK_Range is Integer range 0..12; subtype Stages is RK_Range range 0..12; -- always 0 .. 12 type Coefficient is array(RK_Range) of Real; type Coefficient_Array is array(RK_Range) of Coefficient; -- At the bottom a renaming is used to choose which -- version of the Coefficients to use: -- -- A_rational are good to about 17 decimal digits. -- A_extended are good to about 28 decimal digits. -- --C : Coefficient renames C_extended; --B7 : Coefficient renames B7_extended; --B8 : Coefficient renames B8_extended; --A : Coefficient_Array renames A_extended; procedure Test_Runge_Coeffs; -- Below the Coefficients A, B, and C are given to -- 18 significant figures, in rational form. -- coefficients C(0..12) for getting Dt C_rational : constant Coefficient := (0.0, 1.0 / 18.0, 1.0 / 12.0, 1.0 / 8.0, 5.0 / 16.0, 3.0 / 8.0, 59.0 / 400.0, 93.0 / 200.0, 5490023248.0 / 9719169821.0, 13.0 / 20.0, 1201146811.0 / 1299019798.0, 1.0, 1.0, others => 0.0); -- eighth order RKPD coefficients B8(0..12) -- so that Y(t + DeltaT) = Y(t) + SUM(B8*K) B8_rational : constant Coefficient := (14005451.0 / 335480064.0, 0.0, 0.0, 0.0, 0.0, -59238493.0 / 1068277825.0, 181606767.0 / 758867731.0, 561292985.0 / 797845732.0, -1041891430.0 / 1371343529.0, 760417239.0 / 1151165299.0, 118820643.0 / 751138087.0, -528747749.0 / 2220607170.0, 0.25, others => 0.0); -- Seventh order RKPD coefficients B7(0..12) -- so that Y(t + DeltaT) = Y(t) + SUM(B7*K) B7_rational : constant Coefficient := (13451932.0 / 455176623.0, 0.0, 0.0, 0.0, 0.0, -808719846.0 / 976000145.0, 1757004468.0 / 5645159321.0, 656045339.0 / 265891186.0, -3867574721.0 / 1518517206.0, 465885868.0 / 322736535.0, 53011238.0 / 667516719.0, 2.0 / 45.0, others => 0.0); -- The Runge-Kutta matrix for calculating K: A_rational : constant Coefficient_Array := ((others => 0.0), -- coefficients A(1)(0..12) for getting K(1), -- so K(1) = DeltaT*F (Time + Dt(1), Y + SUM (A(1), K)) -- A(1): (1.0 / 18.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, others => 0.0), -- coefficients A(2)(0..12) for getting K(2), -- so K(2) = DeltaT*F (Time + Dt(2),Y+SUM(A2,K)) -- A(2): (1.0 / 48.0, 1.0 / 16.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, others => 0.0), -- coefficients A(3)(0..12) for getting K(3) -- so K4 = DeltaT*F (Time + Dt(3), Y + SUM (A(3), K)) (1.0 / 32.0, 0.0, 3.0 / 32.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, others => 0.0), -- coefficients A(4)(0..12) for getting K(4) (5.0 / 16.0, 0.0, -75.0 / 64.0, 75.0 / 64.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, others => 0.0), -- coefficients A(5)(0..12) for getting K(5) (3.0 / 80.0, 0.0, 0.0, 3.0 / 16.0, 3.0 / 20.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, others => 0.0), -- coefficients A(6)(0..12) for getting K(6) (29443841.0 / 614563906.0, 0.0, 0.0, 77736538.0 / 692538347.0, -28693883.0 / 1125000000.0, 23124283.0 / 1800000000.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, others => 0.0), -- coefficients A(7)(0..12) for getting K(7) (16016141.0 / 946692911.0, 0.0, 0.0, 61564180.0 / 158732637.0, 22789713.0 / 633445777.0, 545815736.0 / 2771057229.0, -180193667.0 / 1043307555.0, 0.0, 0.0, 0.0, 0.0, 0.0, others => 0.0), -- coefficients A(8)(0..12) for getting K(9) (39632708.0 / 573591083.0, 0.0, 0.0, -433636366.0 / 683701615.0, -421739975.0 / 2616292301.0, 100302831.0 / 723423059.0, 790204164.0 / 839813087.0, 800635310.0 / 3783071287.0, 0.0, 0.0, 0.0, 0.0, others => 0.0), -- coefficients A(9)(0..12) for getting K(9) (246121993.0 / 1340847787.0, 0.0, 0.0, -37695042795.0 / 15268766246.0, -309121744.0 / 1061227803.0, -12992083.0 / 490766935.0, 6005943493.0 / 2108947869.0, 393006217.0 / 1396673457.0, 123872331.0 / 1001029789.0, 0.0, 0.0, 0.0, others => 0.0), -- coefficients A(10)(0..12) for getting K(10) (-1028468189.0 / 846180014.0, 0.0, 0.0, 8478235783.0 / 508512852.0, 1311729495.0 / 1432422823.0, -10304129995.0 / 1701304382.0, -48777925059.0 / 3047939560.0, 15336726248.0 / 1032824649.0, -45442868181.0 / 3398467696.0, 3065993473.0 / 597172653.0, 0.0, 0.0, others => 0.0), -- coefficients A(11)(0..12) for getting K(11) (185892177.0 / 718116043.0, 0.0, 0.0, -3185094517.0 / 667107341.0, -477755414.0 / 1098053517.0, -703635378.0 / 230739211.0, 5731566787.0 / 1027545527.0, 5232866602.0 / 850066563.0, -4093664535.0 / 808688257.0, 3962137247.0 / 1805957418.0, 65686358.0 / 487910083.0, 0.0, others => 0.0), -- coefficients A(12)(0..12) for getting K(12) (403863854.0 / 491063109.0, 0.0, 0.0, -5068492393.0 / 434740067.0, -411421997.0 / 543043805.0, 652783627.0 / 914296604.0, 11173962825.0 / 925320556.0, -13158990841.0 / 6184727034.0, 3936647629.0 / 1978049680.0, -160528059.0 / 685178525.0, 248638103.0 / 1413531060.0, 0.0, others => 0.0), others => (others => 0.0)); -- Below the Coefficients A, B, and C are given to (usually) -- 28 significant figures. -- coefficients C(0..12) for getting Dt C_extended : constant Coefficient := (0.0, 5.5555555555555555555555555555556E-02, 8.3333333333333333333333333333333E-02, 1.25E-01, 3.125E-01, 3.75E-01, 1.475E-01, 4.65E-01, 5.64865451382259575398358501426E-01, 6.5E-01, 9.24656277640504446745013574318E-01, 1.0, 1.0, others => 0.0); -- eighth order RKPD coefficients B8(0..12) -- so that Y(t + DeltaT) = Y(t) + SUM(B8*K) B8_extended : constant Coefficient := (4.17474911415302462220859284685E-02, 0.0, 0.0, 0.0, 0.0, -5.54523286112393089615218946547E-02, 2.39312807201180097046747354249E-01, 7.0351066940344302305804641089E-01, -7.59759613814460929884487677085E-01, 6.60563030922286341461378594838E-01, 1.58187482510123335529614838601E-01, -2.38109538752862804471863555306E-01, 0.25, others => 0.0); -- Seventh order RKPD coefficients B7(0..12) -- so that Y(t + DeltaT) = Y(t) + SUM(B7*K) B7_extended : constant Coefficient := (2.9553213676353496981964883112E-02, 0.0, 0.0, 0.0, 0.0, -8.28606276487797039766805612689E-01, 3.11240900051118327929913751627E-01, 2.46734519059988698196468570407E+00, -2.54694165184190873912738007542E+00, 1.44354858367677524030187495069E+00, 7.94155958811272872713019541622E-02, 4.4444444444444444444444444444444E-02, 0.0, others => 0.0); -- Here is the Runge-Kutta matrix for calculating K A_extended : constant Coefficient_Array := -- coefficients A(1)(0..12) for getting K(1), -- so K(2) = DeltaT*F (Time + Dt(1), Y + SUM (A(1), K)) -- A(2): ((others => 0.0), (1.0 / 18.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, others => 0.0), -- coefficients A(2)(0..12) for getting K(2), -- so K(3) = DeltaT*F (Time + Dt(2),Y+SUM(A(2),K)) -- A(3): (1.0 / 48.0, 1.0 / 16.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, others => 0.0), -- coefficients A(3)(0..12) for getting K(3) -- so K4 = DeltaT*F (Time + Dt(3), Y + SUM (A(3), K)) (1.0 / 32.0, 0.0, 3.0 / 32.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, others => 0.0), -- coefficients A(4)(0..12) for getting K(4) -- so K(5) = DeltaT*F (Time + Dt(4), Y + SUM (A(4), K)) (5.0 / 16.0, 0.0, -75.0 / 64.0, 75.0 / 64.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, others => 0.0), -- coefficients A(5)(0..12) for getting K(5) -- so K6 = DeltaT*F (Time + Dt(5),Y+SUM(A(5),K)) (3.0 / 80.0, 0.0, 0.0, 3.0 / 16.0, 3.0 / 20.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, others => 0.0), -- coefficients A(6)(0..12) for getting K(6) -- so K7 = DeltaT*F (Time + Dt(6),Y+SUM(A(6),K)) (4.7910137111111111111111111111111E-02, 0.0, 0.0, 1.1224871277777777777777777777778E-01, -2.5505673777777777777777777777778E-02, 1.2846823888888888888888888888889E-02, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, others => 0.0), -- coefficients A(7)(0..12) for getting K(7) -- so K(8) = DeltaT*F (Time + Dt(7), Y + SUM (A(7), K)) (1.6917989787292281181431107136E-02, 0.0, 0.0, 3.87848278486043169526545744159E-01, 3.59773698515003278967008896348E-02, 1.96970214215666060156715256072E-01, -1.72713852340501838761392997002E-01, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, others => 0.0), -- coefficients A(8)(0..12) for getting K(8) -- so K(9) = DeltaT*F (Time + Dt(8),Y + SUM (A(8), K)) (6.90957533591923006485645489846E-02, 0.0, 0.0, -6.34247976728854151882807874972E-01, -1.61197575224604080366876923982E-01, 1.38650309458825255419866950133E-01, 9.4092861403575626972423968413E-01, 2.11636326481943981855372117132E-01, 0.0, 0.0, 0.0, 0.0, 0.0, others => 0.0), -- coefficients A(9)(0..12) for getting K(9) -- so K(10) = DeltaT*F (Time + Dt(9),Y + SUM (A(9), K)) (1.83556996839045385489806023537E-01, 0.0, 0.0, -2.46876808431559245274431575997E+00, -2.91286887816300456388002572804E-01, -2.6473020233117375688439799466E-02, 2.84783876419280044916451825422E+00, 2.81387331469849792539403641827E-01, 1.23744899863314657627030212664E-01, 0.0, 0.0, 0.0, 0.0, others => 0.0), -- coefficients A(10)(0..12) for getting K(10) -- so K(11) = DeltaT*F (Time + Dt(10),Y + SUM (A(10), K)) (-1.21542481739588805916051052503E+00, 0.0, 0.0, 1.66726086659457724322804132886E+01, 9.15741828416817960595718650451E-01, -6.05660580435747094755450554309E+00, -1.60035735941561781118417064101E+01, 1.4849303086297662557545391898E+01, -1.33715757352898493182930413962E+01, 5.13418264817963793317325361166E+00, 0.0, 0.0, 0.0, others => 0.0), -- coefficients A(11)(0..12) for getting K(11) -- so K(12) = DeltaT*F (Time + Dt(11),Y + SUM (A(11), K)) (2.58860916438264283815730932232E-01, 0.0, 0.0, -4.77448578548920511231011750971E+00, -4.3509301377703250944070041181E-01, -3.04948333207224150956051286631E+00, 5.57792003993609911742367663447E+00, 6.15583158986104009733868912669E+00, -5.06210458673693837007740643391E+00, 2.19392617318067906127491429047E+00, 1.34627998659334941535726237887E-01, 0.0, 0.0, others => 0.0), -- coefficients A(12)(0..12) for getting K(12) -- so K(13) = DeltaT*F (Time + Dt(12),Y + SUM (A(12), K)) (8.22427599626507477963168204773E-01, 0.0, 0.0, -1.16586732572776642839765530355E+01, -7.57622116690936195881116154088E-01, 7.13973588159581527978269282765E-01, 1.20757749868900567395661704486E+01, -2.12765911392040265639082085897E+00, 1.99016620704895541832807169835E+00, -2.34286471544040292660294691857E-01, 1.7589857770794226507310510589E-01, 0.0, 0.0, others => 0.0), others => (others => 0.0)); --C : Coefficient renames C_rational; --B7 : Coefficient renames B7_rational; --B8 : Coefficient renames B8_rational; --A : Coefficient_Array renames A_rational; -- These are preferred for any Real'Digits > 15: C : Coefficient renames C_extended; B7 : Coefficient renames B7_extended; B8 : Coefficient renames B8_extended; A : Coefficient_Array renames A_extended; ----------------------------------------------------------------------- -- -- coefficients A(2)(0..12) for getting K(2), -- -- so K(2) = DeltaT*F (Time + Dt(2), Y + SUM (A(2), K)) -- -- A(2): -- ((1.0 / 18.0, -- 0.0, -- 0.0, 0.0, 0.0, 0.0, 0.0, -- 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), -- -- -- -- coefficients A(3)(0..12) for getting K(3), -- -- so K(3) = DeltaT*F (Time + Dt(3),Y+SUM(A3,K)) -- -- A(3): -- (1.0 / 48.0, -- 1.0 / 16.0, -- 0.0, 0.0, 0.0, 0.0, 0.0, -- 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), -- -- -- -- coefficients A(4)(0..12) for getting K(4) -- -- so K4 = DeltaT*F (Time + Dt(4), Y + SUM (A(4), K)) -- (1.0 / 32.0, -- 0.0, -- 3.0 / 32.0, -- 0.0, 0.0, 0.0, 0.0, 0.0, -- 0.0, 0.0, 0.0, 0.0, 0.0), -- -- -- -- coefficients A(5)(0..12) for getting K(5) -- -- so K(5) = DeltaT*F (Time + Dt(5), Y + SUM (A(5), K)) -- (5.0 / 16.0, -- 0.0, -- -75.0 / 64.0, -- 75.0 / 64.0, -- 0.0, 0.0, 0.0, 0.0, -- 0.0, 0.0, 0.0, 0.0, 0.0), -- -- -- -- coefficients A(6)(0..12) for getting K(6) -- -- so K6 = DeltaT*F (Time + Dt(6),Y+SUM(A6,K)) -- (3.0 / 80.0, -- 0.0, -- 0.0, -- 3.0 / 16.0, -- 3.0 / 20.0, -- 0.0, 0.0, 0.0, -- 0.0, 0.0, 0.0, 0.0, 0.0), -- -- -- -- coefficients A(7)(0..12) for getting K(7) -- -- so K7 = DeltaT*F (Time + Dt(7),Y+SUM(A7,K)) -- (29443841.0 / 614563906.0, -- 0.0, -- 0.0, -- 77736538.0 / 692538347.0, -- -28693883.0 / 1125000000.0, -- 23124283.0 / 1800000000.0, -- 0.0, 0.0, 0.0, -- 0.0, 0.0, 0.0, 0.0), -- -- -- -- coefficients A(8)(0..12) for getting K(8) -- -- so K(8) = DeltaT*F (Time + Dt(8), Y + SUM (A(8), K)) -- (16016141.0 / 946692911.0, -- 0.0, -- 0.0, -- 61564180.0 / 158732637.0, -- 22789713.0 / 633445777.0, -- 545815736.0 / 2771057229.0, -- -180193667.0 / 1043307555.0, -- 0.0, -- 0.0, 0.0, 0.0, 0.0, 0.0), -- -- -- -- coefficients A(9)(0..12) for getting K(9) -- -- so K(9) = DeltaT*F (Time + Dt(9),Y + SUM (A(9), K)) -- (39632708.0 / 573591083.0, -- 0.0, -- 0.0, -- -433636366.0 / 683701615.0, -- -421739975.0 / 2616292301.0, -- 100302831.0 / 723423059.0, -- 790204164.0 / 839813087.0, -- 800635310.0 / 3783071287.0, -- 0.0, -- 0.0, 0.0, 0.0, 0.0), -- -- -- -- coefficients A(10)(0..12) for getting K(10) -- -- so K(10) = DeltaT*F (Time + Dt(10),Y + SUM (A(10), K)) -- (246121993.0 / 1340847787.0, -- 0.0, -- 0.0, -- -37695042795.0 / 15268766246.0, -- -309121744.0 / 1061227803.0, -- -12992083.0 / 490766935.0, -- 6005943493.0 / 2108947869.0, -- 393006217.0 / 1396673457.0, -- 123872331.0 / 1001029789.0, -- 0.0, 0.0, 0.0, 0.0), -- -- -- -- coefficients A(11)(0..12) for getting K(11) -- -- so K(11) = DeltaT*F (Time + Dt(11),Y + SUM (A(11), K)) -- (-1028468189.0 / 846180014.0, -- 0.0, -- 0.0, -- 8478235783.0 / 508512852.0, -- 1311729495.0 / 1432422823.0, -- -10304129995.0 / 1701304382.0, -- -48777925059.0 / 3047939560.0, -- 15336726248.0 / 1032824649.0, -- -45442868181.0 / 3398467696.0, -- 3065993473.0 / 597172653.0, -- 0.0, 0.0, 0.0), -- -- -- -- coefficients A(12)(0..12) for getting K(12) -- -- so K(12) = DeltaT*F (Time + Dt(12),Y + SUM (A(12), K)) -- (185892177.0 / 718116043.0, -- 0.0, -- 0.0, -- -3185094517.0 / 667107341.0, -- -477755414.0 / 1098053517.0, -- -703635378.0 / 230739211.0, -- 5731566787.0 / 1027545527.0, -- 5232866602.0 / 850066563.0, -- -4093664535.0 / 808688257.0, -- 3962137247.0 / 1805957418.0, -- 65686358.0 / 487910083.0, -- 0.0, 0.0), -- -- -- -- coefficients A(13)(0..12) for getting K(13) -- -- so K(13) = DeltaT*F (Time + Dt(13),Y + SUM (A(13), K)) -- (403863854.0 / 491063109.0, -- 0.0, -- 0.0, -- -5068492393.0 / 434740067.0, -- -411421997.0 / 543043805.0, -- 652783627.0 / 914296604.0, -- 11173962825.0 / 925320556.0, -- -13158990841.0 / 6184727034.0, -- 3936647629.0 / 1978049680.0, -- -160528059.0 / 685178525.0, -- 248638103.0 / 1413531060.0, -- 0.0, 0.0)); -- -- This pair is from "High Order Embedded Runge-Kutta Formulae" by P.J. -- Prince and J.R. Dormand, J. Comp. Appl. Math.,7, pp. 67-75, 1981. -- These coefficients were taken from a public domain RK Suite written -- R. W. Brankin,I. Gladwell, and L. F. Shampine. They were calculated by -- Prince and Dormand. -- A(2,1) := 5.55555555555555555555555555556E-2 -- A(3,1) := 2.08333333333333333333333333333E-2 -- A(3,2) := 6.25E-2 -- A(4,1) := 3.125E-2 -- A(4,2) := 0.0 -- A(4,3) := 9.375E-2 -- A(5,1) := 3.125E-1 -- A(5,2) := 0.0 -- A(5,3) := -1.171875E0 -- A(5,4) := 1.171875E0 -- A(6,1) := 3.75E-2 -- A(6,2) := 0.0 -- A(6,3) := 0.0 -- A(6,4) := 1.875E-1 -- A(6,5) := 1.5E-1 -- A(7,1) := 4.79101371111111111111111111111E-2 -- A(7,2) := 0.0 -- A(7,3) := 0.0 -- A(7,4) := 1.12248712777777777777777777778E-1 -- A(7,5) := -2.55056737777777777777777777778E-2 -- A(7,6) := 1.28468238888888888888888888889E-2 -- A(8,1) := 1.6917989787292281181431107136E-2 -- A(8,2) := 0.0 -- A(8,3) := 0.0 -- A(8,4) := 3.87848278486043169526545744159E-1 -- A(8,5) := 3.59773698515003278967008896348E-2 -- A(8,6) := 1.96970214215666060156715256072E-1 -- A(8,7) := -1.72713852340501838761392997002E-1 -- A(9,1) := 6.90957533591923006485645489846E-2 -- A(9,2) := 0.0 -- A(9,3) := 0.0 -- A(9,4) := -6.34247976728854151882807874972E-1 -- A(9,5) := -1.61197575224604080366876923982E-1 -- A(9,6) := 1.38650309458825255419866950133E-1 -- A(9,7) := 9.4092861403575626972423968413E-1 -- A(9,8) := 2.11636326481943981855372117132E-1 -- A(10,1) := 1.83556996839045385489806023537E-1 -- A(10,2) := 0.0 -- A(10,3) := 0.0 -- A(10,4) := -2.46876808431559245274431575997E0 -- A(10,5) := -2.91286887816300456388002572804E-1 -- A(10,6) := -2.6473020233117375688439799466E-2 -- A(10,7) := 2.84783876419280044916451825422E0 -- A(10,8) := 2.81387331469849792539403641827E-1 -- A(10,9) := 1.23744899863314657627030212664E-1 -- A(11,1) := -1.21542481739588805916051052503E0 -- A(11,2) := 0.0 -- A(11,3) := 0.0 -- A(11,4) := 1.66726086659457724322804132886E1 -- A(11,5) := 9.15741828416817960595718650451E-1 -- A(11,6) := -6.05660580435747094755450554309E0 -- A(11,7) := -1.60035735941561781118417064101E1 -- A(11,8) := 1.4849303086297662557545391898E1 -- A(11,9) := -1.33715757352898493182930413962E1 -- A(11,10) := 5.13418264817963793317325361166E0 -- A(12,1) := 2.58860916438264283815730932232E-1 -- A(12,2) := 0.0 -- A(12,3) := 0.0 -- A(12,4) := -4.77448578548920511231011750971E0 -- A(12,5) := -4.3509301377703250944070041181E-1 -- A(12,6) := -3.04948333207224150956051286631E0 -- A(12,7) := 5.57792003993609911742367663447E0 -- A(12,8) := 6.15583158986104009733868912669E0 -- A(12,9) := -5.06210458673693837007740643391E0 -- A(12,10) := 2.19392617318067906127491429047E0 -- A(12,11) := 1.34627998659334941535726237887E-1 -- A(13,1) := 8.22427599626507477963168204773E-1 -- A(13,2) := 0.0 -- A(13,3) := 0.0 -- A(13,4) := -1.16586732572776642839765530355E1 -- A(13,5) := -7.57622116690936195881116154088E-1 -- A(13,6) := 7.13973588159581527978269282765E-1 -- A(13,7) := 1.20757749868900567395661704486E1 -- A(13,8) := -2.12765911392040265639082085897E0 -- A(13,9) := 1.99016620704895541832807169835E0 -- A(13,10) := -2.34286471544040292660294691857E-1 -- A(13,11) := 1.7589857770794226507310510589E-1 -- A(13,12) := 0.0 -- -- B8 : constant Coefficient := -- (4.17474911415302462220859284685E-2, -- 0.0, -- 0.0, -- 0.0, -- 0.0, -- -5.54523286112393089615218946547E-2, -- 2.39312807201180097046747354249E-1, -- 7.0351066940344302305804641089E-1, -- -7.59759613814460929884487677085E-1, -- 6.60563030922286341461378594838E-1, -- 1.58187482510123335529614838601E-1, -- -2.38109538752862804471863555306E-1, -- 2.5E-1); -- -- B7 : constant Coefficient := -- (2.9553213676353496981964883112E-2, -- 0.0, -- 0.0, -- 0.0, -- 0.0, -- -8.28606276487797039766805612689E-1, -- 3.11240900051118327929913751627E-1, -- 2.46734519059988698196468570407E0, -- -2.54694165184190873912738007542E0, -- 1.44354858367677524030187495069E0, -- 7.94155958811272872713019541622E-2, -- 4.44444444444444444444444444445E-2, -- 0.0); -- -- C : constant Coefficient := -- (0.0, -- 5.55555555555555555555555555556E-2, -- 8.33333333333333333333333333334E-2, -- 1.25E-1, -- 3.125E-1, -- 3.75E-1, -- 1.475E-1, -- 4.65E-1, -- 5.64865451382259575398358501426E-1, -- 6.5E-1, -- 9.24656277640504446745013574318E-1, -- 1.0, -- 1.0); --**************coefficients C(0..12) for getting Dt******* -- C : constant Coefficient := -- (0.0, -- 5.5555555555555555555555555555556E-02, -- 8.3333333333333333333333333333333E-02, -- 1.25E-01, -- 3.125E-01, -- 3.75E-01, -- 1.475E-01, -- 4.65E-01, -- 5.64865451382259575398358501426E-01, -- 6.5E-01, -- 9.24656277640504446745013574318E-01, -- 1.0, -- 1.0, -- others => 0.0); -- -- --*******eighth order RKPD coefficients B8(0..12)******* -- --******so that Y(t + DeltaT) = Y(t) + SUM(B8*K)***** -- B8 : constant Coefficient := -- (4.17474911415302462220859284685E-02, -- 0.0, -- 0.0, -- 0.0, -- 0.0, -- -5.54523286112393089615218946547E-02, -- 2.39312807201180097046747354249E-01, -- 7.0351066940344302305804641089E-01, -- -7.59759613814460929884487677085E-01, -- 6.60563030922286341461378594838E-01, -- 1.58187482510123335529614838601E-01, -- -2.38109538752862804471863555306E-01, -- 0.25, others => 0.0); -- -- --*******Seventh order RKPD coefficients B7(0..12)******* -- --******so that Y(t + DeltaT) = Y(t) + SUM(B7*K)***** -- B7 : constant Coefficient := -- (2.9553213676353496981964883112E-02, -- 0.0, -- 0.0, -- 0.0, -- 0.0, -- -8.28606276487797039766805612689E-01, -- 3.11240900051118327929913751627E-01, -- 2.46734519059988698196468570407E+00, -- -2.54694165184190873912738007542E+00, -- 1.44354858367677524030187495069E+00, -- 7.94155958811272872713019541622E-02, -- 4.4444444444444444444444444444444E-02, -- others => 0.0); -- -- -- -- Here is the Runge-Kutta matrix for calculating K -- -- A : constant Coefficient_Array := -- -- -- -- coefficients A(2)(0..12) for getting K(2), -- -- so K(2) = DeltaT*F (Time + Dt(2), Y + SUM (A(2), K)) -- -- A(2): -- ((1.0 / 18.0, -- 0.0, -- 0.0, 0.0, 0.0, 0.0, 0.0, -- 0.0, 0.0, 0.0, 0.0, 0.0, others => 0.0), -- -- -- -- coefficients A(3)(0..12) for getting K(3), -- -- so K(3) = DeltaT*F (Time + Dt(3),Y+SUM(A3,K)) -- -- A(3): -- (1.0 / 48.0, -- 1.0 / 16.0, -- 0.0, 0.0, 0.0, 0.0, 0.0, -- 0.0, 0.0, 0.0, 0.0, 0.0, others => 0.0), -- -- -- -- coefficients A(4)(0..12) for getting K(4) -- -- so K4 = DeltaT*F (Time + Dt(4), Y + SUM (A(4), K)) -- (1.0 / 32.0, -- 0.0, -- 3.0 / 32.0, -- 0.0, 0.0, 0.0, 0.0, 0.0, -- 0.0, 0.0, 0.0, 0.0, others => 0.0), -- -- -- -- coefficients A(5)(0..12) for getting K(5) -- -- so K(5) = DeltaT*F (Time + Dt(5), Y + SUM (A(5), K)) -- (5.0 / 16.0, -- 0.0, -- -75.0 / 64.0, -- 75.0 / 64.0, -- 0.0, 0.0, 0.0, 0.0, -- 0.0, 0.0, 0.0, 0.0, others => 0.0), -- -- -- -- coefficients A(6)(0..12) for getting K(6) -- -- so K6 = DeltaT*F (Time + Dt(6),Y+SUM(A6,K)) -- (3.0 / 80.0, -- 0.0, -- 0.0, -- 3.0 / 16.0, -- 3.0 / 20.0, -- 0.0, 0.0, 0.0, -- 0.0, 0.0, 0.0, 0.0, others => 0.0), -- -- -- -- coefficients A(7)(0..12) for getting K(7) -- -- so K7 = DeltaT*F (Time + Dt(7),Y+SUM(A7,K)) -- (4.7910137111111111111111111111111E-02, -- 0.0, -- 0.0, -- 1.1224871277777777777777777777778E-01, -- -2.5505673777777777777777777777778E-02, -- 1.2846823888888888888888888888889E-02, -- 0.0, 0.0, 0.0, -- 0.0, 0.0, 0.0, others => 0.0), -- -- -- -- coefficients A(8)(0..12) for getting K(8) -- -- so K(8) = DeltaT*F (Time + Dt(8), Y + SUM (A(8), K)) -- (1.6917989787292281181431107136E-02, -- 0.0, -- 0.0, -- 3.87848278486043169526545744159E-01, -- 3.59773698515003278967008896348E-02, -- 1.96970214215666060156715256072E-01, -- -1.72713852340501838761392997002E-01, -- 0.0, -- 0.0, 0.0, 0.0, 0.0, others => 0.0), -- -- -- -- coefficients A(9)(0..12) for getting K(9) -- -- so K(9) = DeltaT*F (Time + Dt(9),Y + SUM (A(9), K)) -- (6.90957533591923006485645489846E-02, -- 0.0, -- 0.0, -- -6.34247976728854151882807874972E-01, -- -1.61197575224604080366876923982E-01, -- 1.38650309458825255419866950133E-01, -- 9.4092861403575626972423968413E-01, -- 2.11636326481943981855372117132E-01, -- 0.0, -- 0.0, 0.0, 0.0, others => 0.0), -- -- -- -- coefficients A(10)(0..12) for getting K(10) -- -- so K(10) = DeltaT*F (Time + Dt(10),Y + SUM (A(10), K)) -- (1.83556996839045385489806023537E-01, -- 0.0, -- 0.0, -- -2.46876808431559245274431575997E+00, -- -2.91286887816300456388002572804E-01, -- -2.6473020233117375688439799466E-02, -- 2.84783876419280044916451825422E+00, -- 2.81387331469849792539403641827E-01, -- 1.23744899863314657627030212664E-01, -- 0.0, 0.0, 0.0, others => 0.0), -- -- -- -- coefficients A(11)(0..12) for getting K(11) -- -- so K(11) = DeltaT*F (Time + Dt(11),Y + SUM (A(11), K)) -- (-1.21542481739588805916051052503E+00, -- 0.0, -- 0.0, -- 1.66726086659457724322804132886E+01, -- 9.15741828416817960595718650451E-01, -- -6.05660580435747094755450554309E+00, -- -1.60035735941561781118417064101E+01, -- 1.4849303086297662557545391898E+01, -- -1.33715757352898493182930413962E+01, -- 5.13418264817963793317325361166E+00, -- 0.0, 0.0, others => 0.0), -- -- -- -- coefficients A(12)(0..12) for getting K(12) -- -- so K(12) = DeltaT*F (Time + Dt(12),Y + SUM (A(12), K)) -- (2.58860916438264283815730932232E-01, -- 0.0, -- 0.0, -- -4.77448578548920511231011750971E+00, -- -4.3509301377703250944070041181E-01, -- -3.04948333207224150956051286631E+00, -- 5.57792003993609911742367663447E+00, -- 6.15583158986104009733868912669E+00, -- -5.06210458673693837007740643391E+00, -- 2.19392617318067906127491429047E+00, -- 1.34627998659334941535726237887E-01, -- 0.0, others => 0.0), -- -- -- -- coefficients A(13)(0..12) for getting K(13) -- -- so K(13) = DeltaT*F (Time + Dt(13),Y + SUM (A(13), K)) -- (8.22427599626507477963168204773E-01, -- 0.0, -- 0.0, -- -1.16586732572776642839765530355E+01, -- -7.57622116690936195881116154088E-01, -- 7.13973588159581527978269282765E-01, -- 1.20757749868900567395661704486E+01, -- -2.12765911392040265639082085897E+00, -- 1.99016620704895541832807169835E+00, -- -2.34286471544040292660294691857E-01, -- 1.7589857770794226507310510589E-01, -- 0.0, others => 0.0)); end Runge_Coeffs_PD_8;
pchapin/augusta
Ada
549
ads
--------------------------------------------------------------------------- -- FILE : augusta-wide_wide_characters.ads -- SUBJECT : Specification of top level wide wide characters package. -- AUTHOR : (C) Copyright 2013 by the Augusta Contributors -- -- Please send comments or bug reports to -- -- Peter C. Chapin <[email protected]> --------------------------------------------------------------------------- -- See A.3.1. package Augusta.Wide_Wide_Characters is pragma Pure(Wide_Wide_Characters); end Augusta.Wide_Wide_Characters;
reznikmm/matreshka
Ada
12,277
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.Internals.OCL_Elements; with AMF.OCL.String_Literal_Exps; with AMF.UML.Comments.Collections; with AMF.UML.Dependencies.Collections; with AMF.UML.Elements.Collections; with AMF.UML.Named_Elements; with AMF.UML.Namespaces.Collections; with AMF.UML.Packages.Collections; with AMF.UML.String_Expressions; with AMF.UML.Types; with AMF.Visitors; package AMF.Internals.OCL_String_Literal_Exps is type OCL_String_Literal_Exp_Proxy is limited new AMF.Internals.OCL_Elements.OCL_Element_Proxy and AMF.OCL.String_Literal_Exps.OCL_String_Literal_Exp with null record; overriding function Get_String_Symbol (Self : not null access constant OCL_String_Literal_Exp_Proxy) return League.Strings.Universal_String; -- Getter of StringLiteralExp::stringSymbol. -- overriding procedure Set_String_Symbol (Self : not null access OCL_String_Literal_Exp_Proxy; To : League.Strings.Universal_String); -- Setter of StringLiteralExp::stringSymbol. -- overriding function Get_Type (Self : not null access constant OCL_String_Literal_Exp_Proxy) return AMF.UML.Types.UML_Type_Access; -- Getter of TypedElement::type. -- -- The type of the TypedElement. -- This information is derived from the return result for this Operation. overriding procedure Set_Type (Self : not null access OCL_String_Literal_Exp_Proxy; To : AMF.UML.Types.UML_Type_Access); -- Setter of TypedElement::type. -- -- The type of the TypedElement. -- This information is derived from the return result for this Operation. overriding function Get_Client_Dependency (Self : not null access constant OCL_String_Literal_Exp_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency; -- Getter of NamedElement::clientDependency. -- -- Indicates the dependencies that reference the client. overriding function Get_Name (Self : not null access constant OCL_String_Literal_Exp_Proxy) return AMF.Optional_String; -- Getter of NamedElement::name. -- -- The name of the NamedElement. overriding procedure Set_Name (Self : not null access OCL_String_Literal_Exp_Proxy; To : AMF.Optional_String); -- Setter of NamedElement::name. -- -- The name of the NamedElement. overriding function Get_Name_Expression (Self : not null access constant OCL_String_Literal_Exp_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access; -- Getter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. overriding procedure Set_Name_Expression (Self : not null access OCL_String_Literal_Exp_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access); -- Setter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. overriding function Get_Namespace (Self : not null access constant OCL_String_Literal_Exp_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Getter of NamedElement::namespace. -- -- Specifies the namespace that owns the NamedElement. overriding function Get_Qualified_Name (Self : not null access constant OCL_String_Literal_Exp_Proxy) return AMF.Optional_String; -- Getter of NamedElement::qualifiedName. -- -- A name which allows the NamedElement to be identified within a -- hierarchy of nested Namespaces. It is constructed from the names of the -- containing namespaces starting at the root of the hierarchy and ending -- with the name of the NamedElement itself. overriding function Get_Visibility (Self : not null access constant OCL_String_Literal_Exp_Proxy) return AMF.UML.Optional_UML_Visibility_Kind; -- Getter of NamedElement::visibility. -- -- Determines where the NamedElement appears within different Namespaces -- within the overall model, and its accessibility. overriding procedure Set_Visibility (Self : not null access OCL_String_Literal_Exp_Proxy; To : AMF.UML.Optional_UML_Visibility_Kind); -- Setter of NamedElement::visibility. -- -- Determines where the NamedElement appears within different Namespaces -- within the overall model, and its accessibility. overriding function Get_Owned_Comment (Self : not null access constant OCL_String_Literal_Exp_Proxy) return AMF.UML.Comments.Collections.Set_Of_UML_Comment; -- Getter of Element::ownedComment. -- -- The Comments owned by this element. overriding function Get_Owned_Element (Self : not null access constant OCL_String_Literal_Exp_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Getter of Element::ownedElement. -- -- The Elements owned by this element. overriding function Get_Owner (Self : not null access constant OCL_String_Literal_Exp_Proxy) return AMF.UML.Elements.UML_Element_Access; -- Getter of Element::owner. -- -- The Element that owns this element. overriding function All_Namespaces (Self : not null access constant OCL_String_Literal_Exp_Proxy) return AMF.UML.Namespaces.Collections.Ordered_Set_Of_UML_Namespace; -- Operation NamedElement::allNamespaces. -- -- The query allNamespaces() gives the sequence of namespaces in which the -- NamedElement is nested, working outwards. overriding function All_Owning_Packages (Self : not null access constant OCL_String_Literal_Exp_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package; -- Operation NamedElement::allOwningPackages. -- -- The query allOwningPackages() returns all the directly or indirectly -- owning packages. overriding function Is_Distinguishable_From (Self : not null access constant OCL_String_Literal_Exp_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean; -- Operation NamedElement::isDistinguishableFrom. -- -- The query isDistinguishableFrom() determines whether two NamedElements -- may logically co-exist within a Namespace. By default, two named -- elements are distinguishable if (a) they have unrelated types or (b) -- they have related types but different names. overriding function Namespace (Self : not null access constant OCL_String_Literal_Exp_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Operation NamedElement::namespace. -- -- Missing derivation for NamedElement::/namespace : Namespace overriding function Qualified_Name (Self : not null access constant OCL_String_Literal_Exp_Proxy) return League.Strings.Universal_String; -- Operation NamedElement::qualifiedName. -- -- When there is a name, and all of the containing namespaces have a name, -- the qualified name is constructed from the names of the containing -- namespaces. overriding function Separator (Self : not null access constant OCL_String_Literal_Exp_Proxy) return League.Strings.Universal_String; -- Operation NamedElement::separator. -- -- The query separator() gives the string that is used to separate names -- when constructing a qualified name. overriding function All_Owned_Elements (Self : not null access constant OCL_String_Literal_Exp_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Operation Element::allOwnedElements. -- -- The query allOwnedElements() gives all of the direct and indirect owned -- elements of an element. overriding function Must_Be_Owned (Self : not null access constant OCL_String_Literal_Exp_Proxy) return Boolean; -- Operation Element::mustBeOwned. -- -- The query mustBeOwned() indicates whether elements of this type must -- have an owner. Subclasses of Element that do not require an owner must -- override this operation. overriding procedure Enter_Element (Self : not null access constant OCL_String_Literal_Exp_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Leave_Element (Self : not null access constant OCL_String_Literal_Exp_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Visit_Element (Self : not null access constant OCL_String_Literal_Exp_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); end AMF.Internals.OCL_String_Literal_Exps;
rveenker/sdlada
Ada
7,339
ads
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2020, Luke A. Guest -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- -- SDL.Events.Joysticks -- -- Joystick specific events. -------------------------------------------------------------------------------------------------------------------- package SDL.Events.Joysticks is -- Joystick events. Axis_Motion : constant Event_Types := 16#0000_0600#; Ball_Motion : constant Event_Types := Axis_Motion + 1; Hat_Motion : constant Event_Types := Axis_Motion + 2; Button_Down : constant Event_Types := Axis_Motion + 3; Button_Up : constant Event_Types := Axis_Motion + 4; Device_Added : constant Event_Types := Axis_Motion + 5; Device_Removed : constant Event_Types := Axis_Motion + 6; type IDs is range -2 ** 31 .. 2 ** 31 - 1 with Convention => C, Size => 32; type Axes is range 0 .. 255 with Convention => C, Size => 8; type Axes_Values is range -32768 .. 32767 with Convention => C, Size => 16; type Axis_Events is record Event_Type : Event_Types; -- Will be set to Axis_Motion. Time_Stamp : Time_Stamps; Which : IDs; Axis : Axes; Padding_1 : Padding_8; Padding_2 : Padding_8; Padding_3 : Padding_8; Value : Axes_Values; Padding_4 : Padding_16; end record with Convention => C; type Balls is range 0 .. 255 with Convention => C, Size => 8; type Ball_Values is range -32768 .. 32767 with Convention => C, Size => 16; type Ball_Events is record Event_Type : Event_Types; -- Will be set to Ball_Motion. Time_Stamp : Time_Stamps; Which : IDs; Ball : Balls; Padding_1 : Padding_8; Padding_2 : Padding_8; Padding_3 : Padding_8; X_Relative : Ball_Values; Y_Relative : Ball_Values; end record with Convention => C; type Hats is range 0 .. 255 with Convention => C, Size => 8; type Hat_Positions is mod 2 ** 8 with Convention => C, Size => 8; Hat_Centred : constant Hat_Positions := 0; Hat_Up : constant Hat_Positions := 1; Hat_Right : constant Hat_Positions := 2; Hat_Down : constant Hat_Positions := 4; Hat_Left : constant Hat_Positions := 8; Hat_Right_Up : constant Hat_Positions := Hat_Right or Hat_Up; Hat_Right_Down : constant Hat_Positions := Hat_Right or Hat_Down; Hat_Left_Up : constant Hat_Positions := Hat_Left or Hat_Up; Hat_Left_Down : constant Hat_Positions := Hat_Left or Hat_Down; type Hat_Events is record Event_Type : Event_Types; -- Will be set to Hat_Motion. Time_Stamp : Time_Stamps; Which : IDs; Hat : Hats; Position : Hat_Positions; Padding_1 : Padding_8; Padding_2 : Padding_8; end record with Convention => C; type Buttons is range 0 .. 255 with Convention => C, Size => 8; type Button_Events is record Event_Type : Event_Types; -- Will be set to Button_Down or Button_Up. Time_Stamp : Time_Stamps; Which : IDs; Button : Buttons; State : Button_State; Padding_1 : Padding_8; Padding_2 : Padding_8; end record with Convention => C; type Device_Events is record Event_Type : Event_Types; -- Will be set to Device_Added or Device_Removed. Time_Stamp : Time_Stamps; Which : IDs; end record with Convention => C; -- Update the joystick event data. This is called by the event loop. procedure Update with Import => True, Convention => C, External_Name => "SDL_JoystickUpdate"; function Is_Polling_Enabled return Boolean with Inline => True; procedure Enable_Polling with Inline => True; procedure Disable_Polling with Inline => True; private for Axis_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Which at 2 * SDL.Word range 0 .. 31; Axis at 3 * SDL.Word range 0 .. 7; Padding_1 at 3 * SDL.Word range 8 .. 15; Padding_2 at 3 * SDL.Word range 16 .. 23; Padding_3 at 3 * SDL.Word range 24 .. 31; Value at 4 * SDL.Word range 0 .. 15; Padding_4 at 4 * SDL.Word range 16 .. 31; end record; for Ball_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Which at 2 * SDL.Word range 0 .. 31; Ball at 3 * SDL.Word range 0 .. 7; Padding_1 at 3 * SDL.Word range 8 .. 15; Padding_2 at 3 * SDL.Word range 16 .. 23; Padding_3 at 3 * SDL.Word range 24 .. 31; X_Relative at 4 * SDL.Word range 0 .. 15; Y_Relative at 4 * SDL.Word range 16 .. 31; end record; for Hat_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Which at 2 * SDL.Word range 0 .. 31; Hat at 3 * SDL.Word range 0 .. 7; Position at 3 * SDL.Word range 8 .. 15; Padding_1 at 3 * SDL.Word range 16 .. 23; Padding_2 at 3 * SDL.Word range 24 .. 31; end record; for Button_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Which at 2 * SDL.Word range 0 .. 31; Button at 3 * SDL.Word range 0 .. 7; State at 3 * SDL.Word range 8 .. 15; Padding_1 at 3 * SDL.Word range 16 .. 23; Padding_2 at 3 * SDL.Word range 24 .. 31; end record; for Device_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Which at 2 * SDL.Word range 0 .. 31; end record; end SDL.Events.Joysticks;
reznikmm/matreshka
Ada
57,620
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_Opaque_Behaviors is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant UML_Opaque_Behavior_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_Opaque_Behavior (AMF.UML.Opaque_Behaviors.UML_Opaque_Behavior_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant UML_Opaque_Behavior_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_Opaque_Behavior (AMF.UML.Opaque_Behaviors.UML_Opaque_Behavior_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant UML_Opaque_Behavior_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_Opaque_Behavior (Visitor, AMF.UML.Opaque_Behaviors.UML_Opaque_Behavior_Access (Self), Control); end if; end Visit_Element; -------------- -- Get_Body -- -------------- overriding function Get_Body (Self : not null access constant UML_Opaque_Behavior_Proxy) return AMF.String_Collections.Sequence_Of_String is begin raise Program_Error; return Get_Body (Self); end Get_Body; ------------------ -- Get_Language -- ------------------ overriding function Get_Language (Self : not null access constant UML_Opaque_Behavior_Proxy) return AMF.String_Collections.Ordered_Set_Of_String is begin raise Program_Error; return Get_Language (Self); end Get_Language; ----------------- -- Get_Context -- ----------------- overriding function Get_Context (Self : not null access constant UML_Opaque_Behavior_Proxy) return AMF.UML.Behaviored_Classifiers.UML_Behaviored_Classifier_Access is begin return AMF.UML.Behaviored_Classifiers.UML_Behaviored_Classifier_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Context (Self.Element))); end Get_Context; ---------------------- -- Get_Is_Reentrant -- ---------------------- overriding function Get_Is_Reentrant (Self : not null access constant UML_Opaque_Behavior_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Reentrant (Self.Element); end Get_Is_Reentrant; ---------------------- -- Set_Is_Reentrant -- ---------------------- overriding procedure Set_Is_Reentrant (Self : not null access UML_Opaque_Behavior_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Reentrant (Self.Element, To); end Set_Is_Reentrant; ------------------------- -- Get_Owned_Parameter -- ------------------------- overriding function Get_Owned_Parameter (Self : not null access constant UML_Opaque_Behavior_Proxy) return AMF.UML.Parameters.Collections.Ordered_Set_Of_UML_Parameter is begin return AMF.UML.Parameters.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Parameter (Self.Element))); end Get_Owned_Parameter; ----------------------------- -- Get_Owned_Parameter_Set -- ----------------------------- overriding function Get_Owned_Parameter_Set (Self : not null access constant UML_Opaque_Behavior_Proxy) return AMF.UML.Parameter_Sets.Collections.Set_Of_UML_Parameter_Set is begin return AMF.UML.Parameter_Sets.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Parameter_Set (Self.Element))); end Get_Owned_Parameter_Set; ----------------------- -- Get_Postcondition -- ----------------------- overriding function Get_Postcondition (Self : not null access constant UML_Opaque_Behavior_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_Postcondition (Self.Element))); end Get_Postcondition; ---------------------- -- Get_Precondition -- ---------------------- overriding function Get_Precondition (Self : not null access constant UML_Opaque_Behavior_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_Precondition (Self.Element))); end Get_Precondition; ---------------------------- -- Get_Redefined_Behavior -- ---------------------------- overriding function Get_Redefined_Behavior (Self : not null access constant UML_Opaque_Behavior_Proxy) return AMF.UML.Behaviors.Collections.Set_Of_UML_Behavior is begin return AMF.UML.Behaviors.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Behavior (Self.Element))); end Get_Redefined_Behavior; ----------------------- -- Get_Specification -- ----------------------- overriding function Get_Specification (Self : not null access constant UML_Opaque_Behavior_Proxy) return AMF.UML.Behavioral_Features.UML_Behavioral_Feature_Access is begin return AMF.UML.Behavioral_Features.UML_Behavioral_Feature_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Specification (Self.Element))); end Get_Specification; ----------------------- -- Set_Specification -- ----------------------- overriding procedure Set_Specification (Self : not null access UML_Opaque_Behavior_Proxy; To : AMF.UML.Behavioral_Features.UML_Behavioral_Feature_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Specification (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Specification; ------------------- -- Get_Extension -- ------------------- overriding function Get_Extension (Self : not null access constant UML_Opaque_Behavior_Proxy) return AMF.UML.Extensions.Collections.Set_Of_UML_Extension is begin return AMF.UML.Extensions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Extension (Self.Element))); end Get_Extension; --------------------- -- Get_Is_Abstract -- --------------------- overriding function Get_Is_Abstract (Self : not null access constant UML_Opaque_Behavior_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Abstract (Self.Element); end Get_Is_Abstract; ------------------- -- Get_Is_Active -- ------------------- overriding function Get_Is_Active (Self : not null access constant UML_Opaque_Behavior_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Active (Self.Element); end Get_Is_Active; ------------------- -- Set_Is_Active -- ------------------- overriding procedure Set_Is_Active (Self : not null access UML_Opaque_Behavior_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Active (Self.Element, To); end Set_Is_Active; --------------------------- -- Get_Nested_Classifier -- --------------------------- overriding function Get_Nested_Classifier (Self : not null access constant UML_Opaque_Behavior_Proxy) return AMF.UML.Classifiers.Collections.Ordered_Set_Of_UML_Classifier is begin return AMF.UML.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Nested_Classifier (Self.Element))); end Get_Nested_Classifier; ------------------------- -- Get_Owned_Attribute -- ------------------------- overriding function Get_Owned_Attribute (Self : not null access constant UML_Opaque_Behavior_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_Opaque_Behavior_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_Owned_Reception -- ------------------------- overriding function Get_Owned_Reception (Self : not null access constant UML_Opaque_Behavior_Proxy) return AMF.UML.Receptions.Collections.Set_Of_UML_Reception is begin return AMF.UML.Receptions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Reception (Self.Element))); end Get_Owned_Reception; --------------------- -- Get_Super_Class -- --------------------- overriding function Get_Super_Class (Self : not null access constant UML_Opaque_Behavior_Proxy) return AMF.UML.Classes.Collections.Set_Of_UML_Class is begin return AMF.UML.Classes.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Super_Class (Self.Element))); end Get_Super_Class; ----------------------------- -- Get_Classifier_Behavior -- ----------------------------- overriding function Get_Classifier_Behavior (Self : not null access constant UML_Opaque_Behavior_Proxy) return AMF.UML.Behaviors.UML_Behavior_Access is begin return AMF.UML.Behaviors.UML_Behavior_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Classifier_Behavior (Self.Element))); end Get_Classifier_Behavior; ----------------------------- -- Set_Classifier_Behavior -- ----------------------------- overriding procedure Set_Classifier_Behavior (Self : not null access UML_Opaque_Behavior_Proxy; To : AMF.UML.Behaviors.UML_Behavior_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Classifier_Behavior (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Classifier_Behavior; ------------------------------- -- Get_Interface_Realization -- ------------------------------- overriding function Get_Interface_Realization (Self : not null access constant UML_Opaque_Behavior_Proxy) return AMF.UML.Interface_Realizations.Collections.Set_Of_UML_Interface_Realization is begin return AMF.UML.Interface_Realizations.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Interface_Realization (Self.Element))); end Get_Interface_Realization; ------------------------ -- Get_Owned_Behavior -- ------------------------ overriding function Get_Owned_Behavior (Self : not null access constant UML_Opaque_Behavior_Proxy) return AMF.UML.Behaviors.Collections.Set_Of_UML_Behavior is begin return AMF.UML.Behaviors.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Behavior (Self.Element))); end Get_Owned_Behavior; ------------------- -- Get_Attribute -- ------------------- overriding function Get_Attribute (Self : not null access constant UML_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Final_Specialization -- --------------------------------- overriding function Get_Is_Final_Specialization (Self : not null access constant UML_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin return AMF.UML.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefinition_Context (Self.Element))); end Get_Redefinition_Context; -------------------- -- Get_Owned_Port -- -------------------- overriding function Get_Owned_Port (Self : not null access constant UML_Opaque_Behavior_Proxy) return AMF.UML.Ports.Collections.Set_Of_UML_Port is begin return AMF.UML.Ports.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Port (Self.Element))); end Get_Owned_Port; ------------------------- -- Get_Owned_Connector -- ------------------------- overriding function Get_Owned_Connector (Self : not null access constant UML_Opaque_Behavior_Proxy) return AMF.UML.Connectors.Collections.Set_Of_UML_Connector is begin return AMF.UML.Connectors.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Connector (Self.Element))); end Get_Owned_Connector; -------------- -- Get_Part -- -------------- overriding function Get_Part (Self : not null access constant UML_Opaque_Behavior_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_Part (Self.Element))); end Get_Part; -------------- -- Get_Role -- -------------- overriding function Get_Role (Self : not null access constant UML_Opaque_Behavior_Proxy) return AMF.UML.Connectable_Elements.Collections.Set_Of_UML_Connectable_Element is begin return AMF.UML.Connectable_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Role (Self.Element))); end Get_Role; ------------- -- Context -- ------------- overriding function Context (Self : not null access constant UML_Opaque_Behavior_Proxy) return AMF.UML.Behaviored_Classifiers.UML_Behaviored_Classifier_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Context unimplemented"); raise Program_Error with "Unimplemented procedure UML_Opaque_Behavior_Proxy.Context"; return Context (Self); end Context; --------------- -- Extension -- --------------- overriding function Extension (Self : not null access constant UML_Opaque_Behavior_Proxy) return AMF.UML.Extensions.Collections.Set_Of_UML_Extension is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Extension unimplemented"); raise Program_Error with "Unimplemented procedure UML_Opaque_Behavior_Proxy.Extension"; return Extension (Self); end Extension; ------------- -- Inherit -- ------------- overriding function Inherit (Self : not null access constant UML_Opaque_Behavior_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_Opaque_Behavior_Proxy.Inherit"; return Inherit (Self, Inhs); end Inherit; ----------------- -- Super_Class -- ----------------- overriding function Super_Class (Self : not null access constant UML_Opaque_Behavior_Proxy) return AMF.UML.Classes.Collections.Set_Of_UML_Class is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Super_Class unimplemented"); raise Program_Error with "Unimplemented procedure UML_Opaque_Behavior_Proxy.Super_Class"; return Super_Class (Self); end Super_Class; ------------------ -- All_Features -- ------------------ overriding function All_Features (Self : not null access constant UML_Opaque_Behavior_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_Opaque_Behavior_Proxy.All_Features"; return All_Features (Self); end All_Features; ----------------- -- Conforms_To -- ----------------- overriding function Conforms_To (Self : not null access constant UML_Opaque_Behavior_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_Opaque_Behavior_Proxy.Conforms_To"; return Conforms_To (Self, Other); end Conforms_To; ------------- -- General -- ------------- overriding function General (Self : not null access constant UML_Opaque_Behavior_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_Opaque_Behavior_Proxy.General"; return General (Self); end General; ----------------------- -- Has_Visibility_Of -- ----------------------- overriding function Has_Visibility_Of (Self : not null access constant UML_Opaque_Behavior_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_Opaque_Behavior_Proxy.Has_Visibility_Of"; return Has_Visibility_Of (Self, N); end Has_Visibility_Of; ------------------------- -- Inheritable_Members -- ------------------------- overriding function Inheritable_Members (Self : not null access constant UML_Opaque_Behavior_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_Opaque_Behavior_Proxy.Inheritable_Members"; return Inheritable_Members (Self, C); end Inheritable_Members; ---------------------- -- Inherited_Member -- ---------------------- overriding function Inherited_Member (Self : not null access constant UML_Opaque_Behavior_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_Opaque_Behavior_Proxy.Inherited_Member"; return Inherited_Member (Self); end Inherited_Member; ----------------- -- Is_Template -- ----------------- overriding function Is_Template (Self : not null access constant UML_Opaque_Behavior_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_Opaque_Behavior_Proxy.Is_Template"; return Is_Template (Self); end Is_Template; ------------------------- -- May_Specialize_Type -- ------------------------- overriding function May_Specialize_Type (Self : not null access constant UML_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_Proxy.Import_Members"; return Import_Members (Self, Imps); end Import_Members; --------------------- -- Imported_Member -- --------------------- overriding function Imported_Member (Self : not null access constant UML_Opaque_Behavior_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_Opaque_Behavior_Proxy.Imported_Member"; return Imported_Member (Self); end Imported_Member; --------------------------------- -- Members_Are_Distinguishable -- --------------------------------- overriding function Members_Are_Distinguishable (Self : not null access constant UML_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_Proxy.Owned_Member"; return Owned_Member (Self); end Owned_Member; ------------------------- -- All_Owning_Packages -- ------------------------- overriding function All_Owning_Packages (Self : not null access constant UML_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_Proxy.Namespace"; return Namespace (Self); end Namespace; ----------------- -- Conforms_To -- ----------------- overriding function Conforms_To (Self : not null access constant UML_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_Proxy.Parameterable_Elements"; return Parameterable_Elements (Self); end Parameterable_Elements; ------------------------ -- Is_Consistent_With -- ------------------------ overriding function Is_Consistent_With (Self : not null access constant UML_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_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_Opaque_Behavior_Proxy.Is_Redefinition_Context_Valid"; return Is_Redefinition_Context_Valid (Self, Redefined); end Is_Redefinition_Context_Valid; ---------------- -- Owned_Port -- ---------------- overriding function Owned_Port (Self : not null access constant UML_Opaque_Behavior_Proxy) return AMF.UML.Ports.Collections.Set_Of_UML_Port is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Owned_Port unimplemented"); raise Program_Error with "Unimplemented procedure UML_Opaque_Behavior_Proxy.Owned_Port"; return Owned_Port (Self); end Owned_Port; ---------- -- Part -- ---------- overriding function Part (Self : not null access constant UML_Opaque_Behavior_Proxy) return AMF.UML.Properties.Collections.Set_Of_UML_Property is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Part unimplemented"); raise Program_Error with "Unimplemented procedure UML_Opaque_Behavior_Proxy.Part"; return Part (Self); end Part; end AMF.Internals.UML_Opaque_Behaviors;
taisukef/Geo3x3
Ada
320
ads
package Geo3x3 is function Encode (PLat: in Long_Float; PLng: in Long_Float; Level: in Integer) return String; type WGS84 is record Lat : Long_Float; Lng : Long_Float; Level : Integer; Unit : Long_Float; end record; function Decode (Code: in String) return WGS84; end Geo3x3;
sungyeon/drake
Ada
16,873
adb
with Ada.Exceptions.Finally; with Ada.Unchecked_Conversion; with Ada.Unchecked_Deallocation; -- diff (Ada.Streams) with System; package body Ada.Containers.Limited_Hashed_Sets is use type Hash_Tables.Table_Access; -- diff function Upcast is new Unchecked_Conversion (Cursor, Hash_Tables.Node_Access); function Downcast is new Unchecked_Conversion (Hash_Tables.Node_Access, Cursor); -- diff (Upcast) -- -- diff (Downcast) -- procedure Free is new Unchecked_Deallocation (Element_Type, Element_Access); procedure Free is new Unchecked_Deallocation (Node, Cursor); type Context_Type is limited record Left : not null access Element_Type; end record; pragma Suppress_Initialization (Context_Type); function Equivalent_Element ( Position : not null Hash_Tables.Node_Access; Params : System.Address) return Boolean; function Equivalent_Element ( Position : not null Hash_Tables.Node_Access; Params : System.Address) return Boolean is Context : Context_Type; for Context'Address use Params; begin return Equivalent_Elements ( Context.Left.all, Downcast (Position).Element.all); end Equivalent_Element; function Equivalent_Node (Left, Right : not null Hash_Tables.Node_Access) return Boolean; function Equivalent_Node (Left, Right : not null Hash_Tables.Node_Access) return Boolean is begin return Equivalent_Elements ( Downcast (Left).Element.all, Downcast (Right).Element.all); end Equivalent_Node; -- diff (Allocate_Element) -- -- -- -- -- -- -- -- -- diff (Allocate_Node) -- -- -- -- -- -- -- -- -- -- -- diff (Copy_Node) -- -- -- -- -- -- -- -- -- -- -- procedure Free_Node (Object : in out Hash_Tables.Node_Access); procedure Free_Node (Object : in out Hash_Tables.Node_Access) is X : Cursor := Downcast (Object); begin Free (X.Element); Free (X); Object := null; end Free_Node; -- diff (Allocate_Data) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff (Copy_Data) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff (Free) procedure Free_Data (Data : in out Set); procedure Free_Data (Data : in out Set) is -- diff begin Hash_Tables.Free (Data.Table, Data.Length, Free => Free_Node'Access); -- diff -- diff end Free_Data; procedure Reallocate (Container : in out Set; Capacity : Count_Type); -- diff -- diff -- diff procedure Reallocate (Container : in out Set; Capacity : Count_Type) is -- diff -- diff -- diff begin Hash_Tables.Rebuild (Container.Table, Capacity); -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff end Reallocate; -- diff (Unique) -- -- -- -- -- -- -- -- -- function Equivalent_Sets ( Left, Right : Set; Equivalent : not null access function ( Left, Right : not null Hash_Tables.Node_Access) return Boolean) return Boolean; function Equivalent_Sets ( Left, Right : Set; Equivalent : not null access function ( Left, Right : not null Hash_Tables.Node_Access) return Boolean) return Boolean is begin -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff return Hash_Tables.Equivalent ( Left.Table, Left.Length, Right.Table, Right.Length, Equivalent => Equivalent); -- diff -- diff end Equivalent_Sets; function Find (Container : Set; Hash : Hash_Type; Item : Element_Type) return Cursor; function Find (Container : Set; Hash : Hash_Type; Item : Element_Type) return Cursor is begin if Is_Empty (Container) then return null; else -- diff declare Context : aliased Context_Type := (Left => Item'Unrestricted_Access); begin return Downcast (Hash_Tables.Find ( Container.Table, Hash, Context'Address, Equivalent => Equivalent_Element'Access)); end; end if; end Find; -- implementation function Empty_Set return Set is begin return (Finalization.Limited_Controlled with Table => null, Length => 0); end Empty_Set; function Has_Element (Position : Cursor) return Boolean is begin return Position /= null; end Has_Element; -- diff ("=") -- -- -- -- -- -- -- -- -- -- function Equivalent_Sets (Left, Right : Set) return Boolean is begin return Equivalent_Sets (Left, Right, Equivalent => Equivalent_Node'Access); end Equivalent_Sets; -- diff (To_Set) -- -- -- -- -- -- diff (Generic_Array_To_Set) -- -- -- -- -- -- -- -- function Capacity (Container : Set) return Count_Type is -- diff begin -- diff -- diff -- diff return Hash_Tables.Capacity (Container.Table); -- diff end Capacity; procedure Reserve_Capacity ( Container : in out Set; Capacity : Count_Type) is New_Capacity : constant Count_Type := Count_Type'Max (Capacity, Length (Container)); begin Reallocate (Container, New_Capacity); end Reserve_Capacity; function Length (Container : Set) return Count_Type is -- diff begin -- diff -- diff -- diff return Container.Length; -- diff end Length; function Is_Empty (Container : Set) return Boolean is -- diff begin return Container.Length = 0; end Is_Empty; procedure Clear (Container : in out Set) is begin Free_Data (Container); end Clear; -- diff (Element) -- -- -- -- diff (Replace_Element) -- -- -- -- -- -- -- -- procedure Query_Element ( Position : Cursor; Process : not null access procedure (Element : Element_Type)) is begin Process (Position.Element.all); end Query_Element; function Constant_Reference (Container : aliased Set; Position : Cursor) return Constant_Reference_Type is pragma Unreferenced (Container); begin return (Element => Position.Element.all'Access); end Constant_Reference; -- diff (Assign) -- -- -- -- -- -- -- diff (Copy) -- -- -- -- -- -- -- -- -- -- -- procedure Move (Target : in out Set; Source : in out Set) is begin Clear (Target); Target.Table := Source.Table; Target.Length := Source.Length; Source.Table := null; Source.Length := 0; end Move; procedure Insert ( Container : in out Set'Class; New_Item : not null access function return Element_Type; Position : out Cursor; Inserted : out Boolean) is package Holder is new Exceptions.Finally.Scoped_Holder (Element_Access, Free); New_Element : aliased Element_Access := new Element_Type'(New_Item.all); New_Hash : Hash_Type; begin Holder.Assign (New_Element); New_Hash := Hash (New_Element.all); Position := Find (Set (Container), New_Hash, New_Element.all); Inserted := Position = null; if Inserted then Position := new Node'(Super => <>, Element => New_Element); Holder.Clear; -- diff -- diff -- diff Hash_Tables.Insert ( Container.Table, Container.Length, New_Hash, Upcast (Position)); -- diff end if; end Insert; procedure Insert ( Container : in out Set'Class; New_Item : not null access function return Element_Type) is Position : Cursor; Inserted : Boolean; begin Insert (Container, New_Item, Position, Inserted); if not Inserted then raise Constraint_Error; end if; end Insert; -- diff (Include) -- -- -- -- -- -- -- -- -- diff (Replace) -- -- -- procedure Exclude (Container : in out Set; Item : Element_Type) is Position : Cursor := Find (Container, Item); begin if Position /= null then Delete (Container, Position); end if; end Exclude; procedure Delete (Container : in out Set; Item : Element_Type) is Position : Cursor := Find (Container, Item); begin Delete (Container, Position); end Delete; procedure Delete (Container : in out Set; Position : in out Cursor) is Position_2 : Hash_Tables.Node_Access := Upcast (Position); begin -- diff -- diff -- diff -- diff Hash_Tables.Remove (Container.Table, Container.Length, Position_2); -- diff Free_Node (Position_2); Position := null; end Delete; -- diff (Union) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff (Union) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- procedure Intersection (Target : in out Set; Source : Set) is begin -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff Hash_Tables.Merge ( Target.Table, Target.Length, Source.Table, Source.Length, (Hash_Tables.In_Both => True, others => False), Equivalent => Equivalent_Node'Access, Copy => null, Free => Free_Node'Access); -- diff -- diff end Intersection; -- diff (Intersection) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- procedure Difference (Target : in out Set; Source : Set) is begin -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff Hash_Tables.Merge ( Target.Table, Target.Length, Source.Table, Source.Length, (Hash_Tables.In_Only_Left => True, others => False), Equivalent => Equivalent_Node'Access, Copy => null, Free => Free_Node'Access); -- diff -- diff end Difference; -- diff (Difference) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff (Symmetric_Difference) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff (Symmetric_Difference) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- function Overlap (Left, Right : Set) return Boolean is begin -- diff -- diff -- diff -- diff -- diff -- diff -- diff return Hash_Tables.Overlap ( Left.Table, Right.Table, Equivalent => Equivalent_Node'Access); -- diff end Overlap; function Is_Subset (Subset : Set; Of_Set : Set) return Boolean is begin -- diff -- diff -- diff -- diff -- diff -- diff -- diff return Hash_Tables.Is_Subset ( Subset.Table, Of_Set.Table, Equivalent => Equivalent_Node'Access); -- diff end Is_Subset; function First (Container : Set) return Cursor is begin return Downcast (Hash_Tables.First (Container.Table)); -- diff -- diff -- diff -- diff -- diff -- diff end First; function Next (Position : Cursor) return Cursor is begin return Downcast (Position.Super.Next); end Next; procedure Next (Position : in out Cursor) is begin Position := Downcast (Position.Super.Next); end Next; function Find (Container : Set; Item : Element_Type) return Cursor is begin return Find (Container, Hash (Item), Item); end Find; function Contains (Container : Set; Item : Element_Type) return Boolean is begin return Find (Container, Item) /= null; end Contains; function Equivalent_Elements (Left, Right : Cursor) return Boolean is begin return Equivalent_Elements (Left.Element.all, Right.Element.all); end Equivalent_Elements; function Equivalent_Elements (Left : Cursor; Right : Element_Type) return Boolean is begin return Equivalent_Elements (Left.Element.all, Right); end Equivalent_Elements; procedure Iterate ( Container : Set'Class; Process : not null access procedure (Position : Cursor)) is type P1 is access procedure (Position : Cursor); type P2 is access procedure (Position : Hash_Tables.Node_Access); function Cast is new Unchecked_Conversion (P1, P2); begin -- diff -- diff Hash_Tables.Iterate ( Container.Table, Cast (Process)); -- diff end Iterate; function Iterate (Container : Set'Class) return Set_Iterator_Interfaces.Forward_Iterator'Class is begin return Set_Iterator'(First => First (Set (Container))); end Iterate; -- diff (Adjust) -- -- -- overriding function First (Object : Set_Iterator) return Cursor is begin return Object.First; end First; overriding function Next (Object : Set_Iterator; Position : Cursor) return Cursor is pragma Unreferenced (Object); begin return Next (Position); end Next; package body Generic_Keys is type Context_Type is limited record Left : not null access Key_Type; end record; pragma Suppress_Initialization (Context_Type); function Equivalent_Key ( Position : not null Hash_Tables.Node_Access; Params : System.Address) return Boolean; function Equivalent_Key ( Position : not null Hash_Tables.Node_Access; Params : System.Address) return Boolean is Context : Context_Type; for Context'Address use Params; begin return Equivalent_Keys ( Context.Left.all, Key (Downcast (Position).Element.all)); end Equivalent_Key; function Key (Position : Cursor) return Key_Type is begin return Key (Position.Element.all); end Key; -- diff (Element) -- -- -- -- diff (Replace) -- -- -- -- -- -- procedure Exclude (Container : in out Set; Key : Key_Type) is Position : Cursor := Find (Container, Key); begin if Position /= null then Delete (Container, Position); end if; end Exclude; procedure Delete (Container : in out Set; Key : Key_Type) is Position : Cursor := Find (Container, Key); begin Delete (Container, Position); end Delete; function Find (Container : Set; Key : Key_Type) return Cursor is begin if Is_Empty (Container) then return null; else -- diff declare Context : aliased Context_Type := (Left => Key'Unrestricted_Access); begin return Downcast (Hash_Tables.Find ( Container.Table, Hash (Key), Context'Address, Equivalent => Equivalent_Key'Access)); end; end if; end Find; function Contains (Container : Set; Key : Key_Type) return Boolean is begin return Find (Container, Key) /= null; end Contains; procedure Update_Element_Preserving_Key ( Container : in out Set; Position : Cursor; Process : not null access procedure ( Element : in out Element_Type)) is begin Process (Reference_Preserving_Key (Container, Position).Element.all); end Update_Element_Preserving_Key; function Reference_Preserving_Key ( Container : aliased in out Set; Position : Cursor) return Reference_Type is pragma Unreferenced (Container); begin return (Element => Position.Element.all'Access); end Reference_Preserving_Key; function Constant_Reference (Container : aliased Set; Key : Key_Type) return Constant_Reference_Type is begin return Constant_Reference (Container, Find (Container, Key)); end Constant_Reference; function Reference_Preserving_Key ( Container : aliased in out Set; Key : Key_Type) return Reference_Type is begin return Reference_Preserving_Key (Container, Find (Container, Key)); end Reference_Preserving_Key; end Generic_Keys; package body Equivalents is function "=" (Left, Right : Set) return Boolean is function Equivalent (Left, Right : not null Hash_Tables.Node_Access) return Boolean; function Equivalent (Left, Right : not null Hash_Tables.Node_Access) return Boolean is begin return Downcast (Left).Element.all = Downcast (Right).Element.all; end Equivalent; begin return Hash_Tables.Equivalent ( Left.Table, Left.Length, Right.Table, Right.Length, Equivalent => Equivalent'Access); end "="; end Equivalents; end Ada.Containers.Limited_Hashed_Sets;
twdroeger/ada-awa
Ada
2,803
ads
----------------------------------------------------------------------- -- awa-storages-modules -- Storage management module -- Copyright (C) 2012, 2018 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ASF.Applications; with AWA.Modules; with AWA.Storages.Services; with AWA.Storages.Servlets; -- == Storage Module == -- The `Storage_Module` type represents the storage module. An instance of the storage -- module must be declared and registered when the application is created and initialized. -- The storage module is associated with the storage service which provides and implements -- the storage management operations. -- -- @include-permission storages.xml -- @include-config storages.xml package AWA.Storages.Modules is NAME : constant String := "storages"; type Storage_Module is new AWA.Modules.Module with private; type Storage_Module_Access is access all Storage_Module'Class; -- Initialize the storage module. overriding procedure Initialize (Plugin : in out Storage_Module; App : in AWA.Modules.Application_Access; Props : in ASF.Applications.Config); -- Get the storage manager. function Get_Storage_Manager (Plugin : in Storage_Module) return Services.Storage_Service_Access; -- Create a storage manager. This operation can be overridden to provide another -- storage service implementation. function Create_Storage_Manager (Plugin : in Storage_Module) return Services.Storage_Service_Access; -- Get the storage module instance associated with the current application. function Get_Storage_Module return Storage_Module_Access; -- Get the storage manager instance associated with the current application. function Get_Storage_Manager return Services.Storage_Service_Access; private type Storage_Module is new AWA.Modules.Module with record Manager : Services.Storage_Service_Access := null; Storage_Servlet : aliased AWA.Storages.Servlets.Storage_Servlet; end record; end AWA.Storages.Modules;
xeenta/learning-ada
Ada
47
ads
package A is procedure Print_Modify; end A;
guillaume-lin/tsc
Ada
14,208
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.2 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with ncurses2.util; use ncurses2.util; with Terminal_Interface.Curses; use Terminal_Interface.Curses; with Terminal_Interface.Curses.Terminfo; use Terminal_Interface.Curses.Terminfo; with Ada.Characters.Handling; with Ada.Strings.Fixed; procedure ncurses2.attr_test is function subset (super, sub : Character_Attribute_Set) return Boolean; function intersect (b, a : Character_Attribute_Set) return Boolean; function has_A_COLOR (attr : Attributed_Character) return Boolean; function show_attr (row : Line_Position; skip : Natural; attr : Character_Attribute_Set; name : String; once : Boolean) return Line_Position; procedure attr_getc (skip : out Integer; fg, bg : in out Color_Number; result : out Boolean); function subset (super, sub : Character_Attribute_Set) return Boolean is begin if (super.Stand_Out or not sub.Stand_Out) and (super.Under_Line or not sub.Under_Line) and (super.Reverse_Video or not sub.Reverse_Video) and (super.Blink or not sub.Blink) and (super.Dim_Character or not sub.Dim_Character) and (super.Bold_Character or not sub.Bold_Character) and (super.Alternate_Character_Set or not sub.Alternate_Character_Set) and (super.Invisible_Character or not sub.Invisible_Character) -- and -- (super.Protected_Character or not sub.Protected_Character) and -- (super.Horizontal or not sub.Horizontal) and -- (super.Left or not sub.Left) and -- (super.Low or not sub.Low) and -- (super.Right or not sub.Right) and -- (super.Top or not sub.Top) and -- (super.Vertical or not sub.Vertical) then return True; else return False; end if; end subset; function intersect (b, a : Character_Attribute_Set) return Boolean is begin if (a.Stand_Out and b.Stand_Out) or (a.Under_Line and b.Under_Line) or (a.Reverse_Video and b.Reverse_Video) or (a.Blink and b.Blink) or (a.Dim_Character and b.Dim_Character) or (a.Bold_Character and b.Bold_Character) or (a.Alternate_Character_Set and b.Alternate_Character_Set) or (a.Invisible_Character and b.Invisible_Character) -- or -- (a.Protected_Character and b.Protected_Character) or -- (a.Horizontal and b.Horizontal) or -- (a.Left and b.Left) or -- (a.Low and b.Low) or -- (a.Right and b.Right) or -- (a.Top and b.Top) or -- (a.Vertical and b.Vertical) then return True; else return False; end if; end intersect; function has_A_COLOR (attr : Attributed_Character) return Boolean is begin if attr.Color /= Color_Pair (0) then return True; else return False; end if; end has_A_COLOR; -- Print some text with attributes. function show_attr (row : Line_Position; skip : Natural; attr : Character_Attribute_Set; name : String; once : Boolean) return Line_Position is function make_record (n : Integer) return Character_Attribute_Set; function make_record (n : Integer) return Character_Attribute_Set is -- unsupported means true a : Character_Attribute_Set := (others => False); m : Integer; rest : Integer; begin -- ncv is a bitmap with these fields -- A_STANDOUT, -- A_UNDERLINE, -- A_REVERSE, -- A_BLINK, -- A_DIM, -- A_BOLD, -- A_INVIS, -- A_PROTECT, -- A_ALTCHARSET -- It means no_color_video, -- video attributes that can't be used with colors -- see man terminfo.5 m := n mod 2; rest := n / 2; if 1 = m then a.Stand_Out := True; end if; m := rest mod 2; rest := rest / 2; if 1 = m then a.Under_Line := True; end if; m := rest mod 2; rest := rest / 2; if 1 = m then a.Reverse_Video := True; end if; m := rest mod 2; rest := rest / 2; if 1 = m then a.Blink := True; end if; m := rest mod 2; rest := rest / 2; if 1 = m then a.Bold_Character := True; end if; m := rest mod 2; rest := rest / 2; if 1 = m then a.Invisible_Character := True; end if; m := rest mod 2; rest := rest / 2; -- if 1 = m then -- a.Protected_Character := True; -- end if; m := rest mod 2; rest := rest / 2; if 1 = m then a.Alternate_Character_Set := True; end if; return a; end make_record; ncv : constant Integer := Get_Number ("ncv"); begin Move_Cursor (Line => row, Column => 8); Add (Str => name & " mode:"); Move_Cursor (Line => row, Column => 24); Add (Ch => '|'); if skip /= 0 then -- printw("%*s", skip, " ") Add (Str => Ada.Strings.Fixed."*" (skip, ' ')); end if; if once then Switch_Character_Attribute (Attr => attr); else Set_Character_Attributes (Attr => attr); end if; Add (Str => "abcde fghij klmno pqrst uvwxy z"); if once then Switch_Character_Attribute (Attr => attr, On => False); end if; if skip /= 0 then Add (Str => Ada.Strings.Fixed."*" (skip, ' ')); end if; Add (Ch => '|'); if attr /= Normal_Video then declare begin if not subset (super => Supported_Attributes, sub => attr) then Add (Str => " (N/A)"); elsif ncv > 0 and has_A_COLOR (Get_Background) then declare Color_Supported_Attributes : Character_Attribute_Set := make_record (ncv); begin if intersect (Color_Supported_Attributes, attr) then Add (Str => " (NCV) "); end if; end; end if; end; end if; return row + 2; end show_attr; procedure attr_getc (skip : out Integer; fg, bg : in out Color_Number; result : out Boolean) is ch : Key_Code := Getchar; nc : constant Color_Number := Color_Number (Number_Of_Colors); curscr : Window; pragma Import (C, curscr, "curscr"); -- curscr is not implemented in the Ada binding begin result := True; if Ada.Characters.Handling.Is_Digit (Character'Val (ch)) then skip := ctoi (Code_To_Char (ch)); elsif ch = CTRL ('L') then Touch; Touch (curscr); Refresh; elsif Has_Colors then case ch is -- Note the mathematical elegance compared to the C version. when Character'Pos ('f') => fg := (fg + 1) mod nc; when Character'Pos ('F') => fg := (fg - 1) mod nc; when Character'Pos ('b') => bg := (bg + 1) mod nc; when Character'Pos ('B') => bg := (bg - 1) mod nc; when others => result := False; end case; else result := False; end if; end attr_getc; -- pairs could be defined as array ( Color_Number(0) .. colors - 1) of -- array (Color_Number(0).. colors - 1) of Boolean; pairs : array (Color_Pair'Range) of Boolean := (others => False); fg, bg : Color_Number := Black; -- = 0; xmc : constant Integer := Get_Number ("xmc"); skip : Integer := xmc; n : Integer; use Int_IO; begin pairs (0) := True; if skip < 0 then skip := 0; end if; n := skip; loop declare row : Line_Position := 2; normal : Attributed_Character := Blank2; -- ??? begin -- row := 2; -- weird, row is set to 0 without this. -- TODO delete the above line, it was a gdb quirk that confused me if Has_Colors then declare pair : Color_Pair := Color_Pair (fg * Color_Number (Number_Of_Colors) + bg); begin -- Go though each color pair. Assume that the number of -- Redefinable_Color_Pairs is 8*8 with predefined Colors 0..7 if not pairs (pair) then Init_Pair (pair, fg, bg); pairs (pair) := True; end if; normal.Color := pair; end; end if; Set_Background (Ch => normal); Erase; Add (Line => 0, Column => 20, Str => "Character attribute test display"); row := show_attr (row, n, (Stand_Out => True, others => False), "STANDOUT", True); row := show_attr (row, n, (Reverse_Video => True, others => False), "REVERSE", True); row := show_attr (row, n, (Bold_Character => True, others => False), "BOLD", True); row := show_attr (row, n, (Under_Line => True, others => False), "UNDERLINE", True); row := show_attr (row, n, (Dim_Character => True, others => False), "DIM", True); row := show_attr (row, n, (Blink => True, others => False), "BLINK", True); -- row := show_attr (row, n, (Protected_Character => True, -- others => False), "PROTECT", True); row := show_attr (row, n, (Invisible_Character => True, others => False), "INVISIBLE", True); row := show_attr (row, n, Normal_Video, "NORMAL", False); Move_Cursor (Line => row, Column => 8); if xmc > -1 then Add (Str => "This terminal does have the magic-cookie glitch"); else Add (Str => "This terminal does not have the magic-cookie glitch"); end if; Move_Cursor (Line => row + 1, Column => 8); Add (Str => "Enter a digit to set gaps on each side of " & "displayed attributes"); Move_Cursor (Line => row + 2, Column => 8); Add (Str => "^L = repaint"); if Has_Colors then declare tmp1 : String (1 .. 1); begin Add (Str => ". f/F/b/F toggle colors ("); Put (tmp1, Integer (fg)); Add (Str => tmp1); Add (Ch => '/'); Put (tmp1, Integer (bg)); Add (Str => tmp1); Add (Ch => ')'); end; end if; Refresh; end; declare result : Boolean; begin attr_getc (n, fg, bg, result); exit when not result; end; end loop; Set_Background (Ch => Blank2); Erase; End_Windows; end ncurses2.attr_test;
Rodeo-McCabe/orka
Ada
2,708
adb
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2019 onox <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. package body Orka.Inputs.Joysticks.Sequences is use Ada.Real_Time; function Create_Sequence (Buttons : Button_Index_Array; Max_Time : Duration) return Sequence is DT : constant Time_Span := To_Time_Span (Max_Time); begin return (Button_Count => Buttons'Length, Buttons => Buttons, Index => Buttons'First, Max_Time => DT, Start_Press => Clock - DT); end Create_Sequence; function Detect_Activation (Object : in out Sequence; Joystick : Joystick_Input'Class) return Boolean is Current_Time : constant Time := Clock; On_Time : constant Boolean := Current_Time - Object.Start_Press < Object.Max_Time; Pressed_Buttons : constant Boolean_Button_States := Joystick.Just_Pressed; Expected_Button : Boolean_Button_States := (others => False); begin Expected_Button (Object.Buttons (Object.Index)) := True; declare Unexpected_Buttons : constant Boolean_Button_States := Pressed_Buttons and not Expected_Button; begin -- If the user presses a wrong button, it might actually be -- the correct button of the start of the sequence. Therefore, -- do not stop, but just reset the sequence if (for some Button of Unexpected_Buttons => Button) then Object.Index := 1; end if; if Pressed_Buttons (Object.Buttons (Object.Index)) then if Object.Index = 1 then Object.Start_Press := Current_Time; Object.Index := Object.Index + 1; elsif On_Time then if Object.Index = Object.Button_Count then Object.Index := 1; return True; else Object.Index := Object.Index + 1; end if; else Object.Index := 1; end if; end if; end; return False; end Detect_Activation; end Orka.Inputs.Joysticks.Sequences;
io7m/coreland-openal-ada
Ada
16,276
ads
-- Automatically generated, do not edit. with Interfaces.C; with System; with OpenAL.Types; package OpenAL.Thin is package C renames Interfaces.C; -- Constants AL_BITS : constant := 16#2002#; AL_BUFFER : constant := 16#1009#; AL_BUFFERS_PROCESSED : constant := 16#1016#; AL_BUFFERS_QUEUED : constant := 16#1015#; AL_BYTE_OFFSET : constant := 16#1026#; AL_CHANNELS : constant := 16#2003#; AL_CONE_INNER_ANGLE : constant := 16#1001#; AL_CONE_OUTER_ANGLE : constant := 16#1002#; AL_CONE_OUTER_GAIN : constant := 16#1022#; AL_DIRECTION : constant := 16#1005#; AL_DISTANCE_MODEL : constant := 16#D000#; AL_DOPPLER_FACTOR : constant := 16#C000#; AL_DOPPLER_VELOCITY : constant := 16#C001#; AL_EXPONENT_DISTANCE : constant := 16#D005#; AL_EXPONENT_DISTANCE_CLAMPED : constant := 16#D006#; AL_EXTENSIONS : constant := 16#B004#; AL_FALSE : constant := 16#0#; AL_FORMAT_MONO16 : constant := 16#1101#; AL_FORMAT_MONO8 : constant := 16#1100#; AL_FORMAT_STEREO16 : constant := 16#1103#; AL_FORMAT_STEREO8 : constant := 16#1102#; AL_FREQUENCY : constant := 16#2001#; AL_GAIN : constant := 16#100A#; AL_ILLEGAL_COMMAND : constant := 16#A004#; AL_ILLEGAL_ENUM : constant := 16#A002#; AL_INITIAL : constant := 16#1011#; AL_INVALID : constant := -16#1#; AL_INVALID_ENUM : constant := 16#A002#; AL_INVALID_NAME : constant := 16#A001#; AL_INVALID_OPERATION : constant := 16#A004#; AL_INVALID_VALUE : constant := 16#A003#; AL_INVERSE_DISTANCE : constant := 16#D001#; AL_INVERSE_DISTANCE_CLAMPED : constant := 16#D002#; AL_LINEAR_DISTANCE : constant := 16#D003#; AL_LINEAR_DISTANCE_CLAMPED : constant := 16#D004#; AL_LOOPING : constant := 16#1007#; AL_MAX_DISTANCE : constant := 16#1023#; AL_MAX_GAIN : constant := 16#100E#; AL_MIN_GAIN : constant := 16#100D#; AL_NONE : constant := 16#0#; AL_NO_ERROR : constant := 16#0#; AL_ORIENTATION : constant := 16#100F#; AL_OUT_OF_MEMORY : constant := 16#A005#; AL_PAUSED : constant := 16#1013#; AL_PENDING : constant := 16#2011#; AL_PITCH : constant := 16#1003#; AL_PLAYING : constant := 16#1012#; AL_POSITION : constant := 16#1004#; AL_PROCESSED : constant := 16#2012#; AL_REFERENCE_DISTANCE : constant := 16#1020#; AL_RENDERER : constant := 16#B003#; AL_ROLLOFF_FACTOR : constant := 16#1021#; AL_SAMPLE_OFFSET : constant := 16#1025#; AL_SEC_OFFSET : constant := 16#1024#; AL_SIZE : constant := 16#2004#; AL_SOURCE_RELATIVE : constant := 16#202#; AL_SOURCE_STATE : constant := 16#1010#; AL_SOURCE_TYPE : constant := 16#1027#; AL_SPEED_OF_SOUND : constant := 16#C003#; AL_STATIC : constant := 16#1028#; AL_STOPPED : constant := 16#1014#; AL_STREAMING : constant := 16#1029#; AL_TRUE : constant := 16#1#; AL_UNDETERMINED : constant := 16#1030#; AL_UNUSED : constant := 16#2010#; AL_VELOCITY : constant := 16#1006#; AL_VENDOR : constant := 16#B001#; AL_VERSION : constant := 16#B002#; -- -- OpenAL 1.1 -- procedure Buffer_3f (Buffer_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Value_1 : Types.Float_t; Value_2 : Types.Float_t; Value_3 : Types.Float_t); pragma Import (C, Buffer_3f, "alBuffer3f"); procedure Buffer_3i (Buffer_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Value_1 : Types.Integer_t; Value_2 : Types.Integer_t; Value_3 : Types.Integer_t); pragma Import (C, Buffer_3i, "alBuffer3i"); procedure Buffer_Data (Buffer_ID : Types.Unsigned_Integer_t; Format : Types.Enumeration_t; Data : System.Address; Size : Types.Size_t; Frequency : Types.Size_t); pragma Import (C, Buffer_Data, "alBufferData"); procedure Bufferf (Buffer_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Value : Types.Float_t); pragma Import (C, Bufferf, "alBufferf"); procedure Bufferfv (Buffer_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Values : System.Address); pragma Import (C, Bufferfv, "alBufferfv"); procedure Bufferi (Buffer_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Value : Types.Integer_t); pragma Import (C, Bufferi, "alBufferi"); procedure Bufferiv (Buffer_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Values : System.Address); pragma Import (C, Bufferiv, "alBufferiv"); procedure Delete_Buffers (Size : Types.Size_t; Sources : System.Address); pragma Import (C, Delete_Buffers, "alDeleteBuffers"); procedure Delete_Sources (Size : Types.Size_t; Sources : System.Address); pragma Import (C, Delete_Sources, "alDeleteSources"); procedure Disable (Capability : Types.Enumeration_t); pragma Import (C, Disable, "alDisable"); procedure Distance_Model (Distance_Model : Types.Enumeration_t); pragma Import (C, Distance_Model, "alDistanceModel"); procedure Doppler_Factor (Value : Types.Float_t); pragma Import (C, Doppler_Factor, "alDopplerFactor"); procedure Doppler_Velocity (Value : Types.Float_t); pragma Import (C, Doppler_Velocity, "alDopplerVelocity"); procedure Enable (Capability : Types.Enumeration_t); pragma Import (C, Enable, "alEnable"); procedure Gen_Buffers (Size : Types.Size_t; Buffers : System.Address); pragma Import (C, Gen_Buffers, "alGenBuffers"); procedure Gen_Sources (Size : Types.Size_t; Sources : System.Address); pragma Import (C, Gen_Sources, "alGenSources"); function Get_Boolean (Parameter : Types.Enumeration_t) return Types.Boolean_t; pragma Import (C, Get_Boolean, "alGetBoolean"); procedure Get_Booleanv (Parameter : Types.Enumeration_t; Data : System.Address); pragma Import (C, Get_Booleanv, "alGetBooleanv"); procedure Get_Buffer_3f (Buffer_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Value_1 : System.Address; Value_2 : System.Address; Value_3 : System.Address); pragma Import (C, Get_Buffer_3f, "alGetBuffer3f"); procedure Get_Buffer_3i (Buffer_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Value_1 : System.Address; Value_2 : System.Address; Value_3 : System.Address); pragma Import (C, Get_Buffer_3i, "alGetBuffer3i"); procedure Get_Bufferf (Buffer_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Value : System.Address); pragma Import (C, Get_Bufferf, "alGetBufferf"); procedure Get_Bufferfv (Buffer_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Values : System.Address); pragma Import (C, Get_Bufferfv, "alGetBufferfv"); procedure Get_Bufferi (Buffer_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Value : System.Address); pragma Import (C, Get_Bufferi, "alGetBufferi"); procedure Get_Bufferiv (Buffer_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Values : System.Address); pragma Import (C, Get_Bufferiv, "alGetBufferiv"); function Get_Double (Parameter : Types.Enumeration_t) return Types.Double_t; pragma Import (C, Get_Double, "alGetDouble"); procedure Get_Doublev (Parameter : Types.Enumeration_t; Values : System.Address); pragma Import (C, Get_Doublev, "alGetDoublev"); function Get_Enum_Value (Name : System.Address) return Types.Enumeration_t; pragma Import (C, Get_Enum_Value, "alGetEnumValue"); function Get_Error return Types.Enumeration_t; pragma Import (C, Get_Error, "alGetError"); function Get_Float (Parameter : Types.Enumeration_t) return Types.Float_t; pragma Import (C, Get_Float, "alGetFloat"); procedure Get_Floatv (Parameter : Types.Enumeration_t; Values : System.Address); pragma Import (C, Get_Floatv, "alGetFloatv"); function Get_Integer (Parameter : Types.Enumeration_t) return Types.Integer_t; pragma Import (C, Get_Integer, "alGetInteger"); procedure Get_Integerv (Paremeter : Types.Enumeration_t; Values : System.Address); pragma Import (C, Get_Integerv, "alGetIntegerv"); procedure Get_Listener_3f (Parameter : Types.Enumeration_t; Value_1 : System.Address; Value_2 : System.Address; Value_3 : System.Address); pragma Import (C, Get_Listener_3f, "alGetListener3f"); procedure Get_Listener_3i (Parameter : Types.Enumeration_t; Value_1 : System.Address; Value_2 : System.Address; Value_3 : System.Address); pragma Import (C, Get_Listener_3i, "alGetListener3i"); procedure Get_Listenerf (Parameter : Types.Enumeration_t; Value : System.Address); pragma Import (C, Get_Listenerf, "alGetListenerf"); procedure Get_Listenerfv (Parameter : Types.Enumeration_t; Values : System.Address); pragma Import (C, Get_Listenerfv, "alGetListenerfv"); procedure Get_Listeneri (Parameter : Types.Enumeration_t; Value : System.Address); pragma Import (C, Get_Listeneri, "alGetListeneri"); procedure Get_Listeneriv (Parameter : Types.Enumeration_t; Values : System.Address); pragma Import (C, Get_Listeneriv, "alGetListeneriv"); function Get_Proc_Address (Name : System.Address) return Types.Void_Pointer_t; pragma Import (C, Get_Proc_Address, "alGetProcAddress"); procedure Get_Source_3f (Source_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Value_1 : System.Address; Value_2 : System.Address; Value_3 : System.Address); pragma Import (C, Get_Source_3f, "alGetSource3f"); procedure Get_Source_3i (Source_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Value_1 : System.Address; Value_2 : System.Address; Value_3 : System.Address); pragma Import (C, Get_Source_3i, "alGetSource3i"); procedure Get_Sourcef (Source_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Value : System.Address); pragma Import (C, Get_Sourcef, "alGetSourcef"); procedure Get_Sourcefv (Source_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Values : System.Address); pragma Import (C, Get_Sourcefv, "alGetSourcefv"); procedure Get_Sourcei (Source_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Value : System.Address); pragma Import (C, Get_Sourcei, "alGetSourcei"); procedure Get_Sourceiv (Source_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Values : System.Address); pragma Import (C, Get_Sourceiv, "alGetSourceiv"); function Get_String (Parameter : Types.Enumeration_t) return System.Address; pragma Import (C, Get_String, "alGetString"); function Is_Buffer (Buffer_ID : Types.Unsigned_Integer_t) return Types.Boolean_t; pragma Import (C, Is_Buffer, "alIsBuffer"); function Is_Enabled (Parameter : Types.Enumeration_t) return Types.Boolean_t; pragma Import (C, Is_Enabled, "alIsEnabled"); function Is_Extension_Present (Name : System.Address) return Types.Boolean_t; pragma Import (C, Is_Extension_Present, "alIsExtensionPresent"); function Is_Source (Source_ID : Types.Unsigned_Integer_t) return Types.Boolean_t; pragma Import (C, Is_Source, "alIsSource"); procedure Listener_3f (Parameter : Types.Enumeration_t; Value_1 : Types.Float_t; Value_2 : Types.Float_t; Value_3 : Types.Float_t); pragma Import (C, Listener_3f, "alListener3f"); procedure Listener_3i (Parameter : Types.Enumeration_t; Value_1 : Types.Integer_t; Value_2 : Types.Integer_t; Value_3 : Types.Integer_t); pragma Import (C, Listener_3i, "alListener3i"); procedure Listenerf (Parameter : Types.Enumeration_t; Value : Types.Float_t); pragma Import (C, Listenerf, "alListenerf"); procedure Listenerfv (Parameter : Types.Enumeration_t; Values : System.Address); pragma Import (C, Listenerfv, "alListenerfv"); procedure Listeneri (Parameter : Types.Enumeration_t; Value : Types.Integer_t); pragma Import (C, Listeneri, "alListeneri"); procedure Listeneriv (Parameter : Types.Enumeration_t; Values : System.Address); pragma Import (C, Listeneriv, "alListeneriv"); procedure Source_3f (Source_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Value_1 : Types.Float_t; Value_2 : Types.Float_t; Value_3 : Types.Float_t); pragma Import (C, Source_3f, "alSource3f"); procedure Source_3i (Source_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Value_1 : Types.Integer_t; Value_2 : Types.Integer_t; Value_3 : Types.Integer_t); pragma Import (C, Source_3i, "alSource3i"); procedure Source_Pause (Source_ID : Types.Unsigned_Integer_t); pragma Import (C, Source_Pause, "alSourcePause"); procedure Source_Pausev (Size : Types.Size_t; Source_IDs : System.Address); pragma Import (C, Source_Pausev, "alSourcePausev"); procedure Source_Play (Source_ID : Types.Unsigned_Integer_t); pragma Import (C, Source_Play, "alSourcePlay"); procedure Source_Playv (Size : Types.Size_t; Source_IDs : System.Address); pragma Import (C, Source_Playv, "alSourcePlayv"); procedure Source_Queue_Buffers (Source_ID : Types.Unsigned_Integer_t; Size : Types.Size_t; Buffer_IDs : System.Address); pragma Import (C, Source_Queue_Buffers, "alSourceQueueBuffers"); procedure Source_Rewind (Source_ID : Types.Unsigned_Integer_t); pragma Import (C, Source_Rewind, "alSourceRewind"); procedure Source_Rewindv (Size : Types.Size_t; Source_IDs : System.Address); pragma Import (C, Source_Rewindv, "alSourceRewindv"); procedure Source_Stop (Source_ID : Types.Unsigned_Integer_t); pragma Import (C, Source_Stop, "alSourceStop"); procedure Source_Stopv (Size : Types.Size_t; Source_IDs : System.Address); pragma Import (C, Source_Stopv, "alSourceStopv"); procedure Source_Unqueue_Buffers (Source_ID : Types.Unsigned_Integer_t; Size : Types.Size_t; Buffer_IDs : System.Address); pragma Import (C, Source_Unqueue_Buffers, "alSourceUnqueueBuffers"); procedure Sourcef (Source_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Value : Types.Float_t); pragma Import (C, Sourcef, "alSourcef"); procedure Sourcefv (Source_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Values : System.Address); pragma Import (C, Sourcefv, "alSourcefv"); procedure Sourcei (Source_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Value : Types.Integer_t); pragma Import (C, Sourcei, "alSourcei"); procedure Sourceiv (Source_ID : Types.Unsigned_Integer_t; Parameter : Types.Enumeration_t; Values : System.Address); pragma Import (C, Sourceiv, "alSourceiv"); procedure Speed_Of_Sound (Value : Types.Float_t); pragma Import (C, Speed_Of_Sound, "alSpeedOfSound"); end OpenAL.Thin;
reznikmm/matreshka
Ada
3,400
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$ ------------------------------------------------------------------------------ package AMF.XMI is pragma Preelaborate; end AMF.XMI;
gtraines/ada_word_count
Ada
2,923
adb
-- Pass a filename as a command line parameter -- Parse and print out stats about the file -- - Characters -- - Lines -- - Words -- -- with Ada.Command_Line; with Ada.Integer_Text_IO; with Ada.Strings.Unbounded.Text_IO; with Ada.Strings.Unbounded; with Ada.Text_IO; use Ada.Text_IO; with GNAT.IO_Aux; with GNAT.Array_Split; with GNAT.String_Split; procedure awordcount is -- *** Variable declarations *** begin New_Line; if Ada.Command_Line.Argument_Count = 0 then Put_Line(Item => " ERROR! Filename required."); Put_Line(Item => " USAGE: awordcount file-to-get-counts-for.txt"); else declare -- *** Variable declarations *** FileName : String(1..Ada.Command_Line.Argument(1)'length); FileNameLength : Natural := Ada.Command_Line.Argument(1)'length; SourceFile : Ada.Text_IO.File_Type; begin FileName := Ada.Command_Line.Argument(1); Put(Item => "Parsing file: "); Put_Line(Item => FileName); if GNAT.IO_Aux.File_Exists(FileName) then Open(SourceFile, In_File, FileName); declare package UStrings renames Ada.Strings.Unbounded; package UnboundedIO renames Ada.Strings.Unbounded.Text_IO; CurrentLine : UStrings.Unbounded_String := UStrings.Null_Unbounded_String; CurrentLineLength : Integer := 0; CharacterCount : Integer := 0; LineCount : Integer := 0; LineWordCount : GNAT.String_Split.Slice_Number; SplitArr : GNAT.String_Split.Slice_Set; WordSeparators : String := " "; WordCount : Integer := 0; begin while not End_Of_File(SourceFile) loop CurrentLine := UnboundedIO.Get_Line(File => SourceFile); LineCount := LineCount + 1; CurrentLineLength := UStrings.To_String(CurrentLine)'Length; CharacterCount := CharacterCount + CurrentLineLength; GNAT.String_Split.Create(SplitArr, UStrings.To_String(CurrentLine), WordSeparators, Mode => GNAT.String_Split.Multiple); LineWordCount := GNAT.String_Split.Slice_Count(S => SplitArr); WordCount := WordCount + Integer(LineWordCount); end loop; Put(Item => "Characters: "); Ada.Integer_Text_IO.Put(CharacterCount); New_Line; Put(Item => "Lines: "); Ada.Integer_Text_IO.Put(LineCount); New_Line; Put(Item => "Words: "); Ada.Integer_Text_IO.Put(WordCount); end; Close(SourceFile); else Put(Item => FileName & " not found"); end if; end; end if; New_Line; New_Line; end awordcount;
vpodzime/ada-util
Ada
5,813
adb
----------------------------------------------------------------------- -- streams.buffered.tests -- Unit tests for buffered streams -- Copyright (C) 2010, 2011 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Test_Caller; package body Util.Streams.Buffered.Tests is use Util.Tests; package Caller is new Util.Test_Caller (Test, "Streams.Buffered"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Util.Streams.Buffered.Write, Read", Test_Read_Write'Access); Caller.Add_Test (Suite, "Test Util.Streams.Buffered.Write, Flush (String)", Test_Write'Access); Caller.Add_Test (Suite, "Test Util.Streams.Buffered.Write, Flush (Stream_Array)", Test_Write_Stream'Access); end Add_Tests; -- ------------------------------ -- Write on a buffered stream and read what was written. -- ------------------------------ procedure Test_Read_Write (T : in out Test) is Stream : Buffered_Stream; C : Character; begin Stream.Initialize (Size => 4); Stream.Write ("abcd"); Assert_Equals (T, 4, Integer (Stream.Get_Size), "Invalid size for stream"); Stream.Read (C); Assert_Equals (T, 'a', C, "Invalid character read from the stream"); Stream.Read (C); Assert_Equals (T, 'b', C, "Invalid character read from the stream"); Stream.Read (C); Assert_Equals (T, 'c', C, "Invalid character read from the stream"); Stream.Read (C); Assert_Equals (T, 'd', C, "Invalid character read from the stream"); Assert_Equals (T, 0, Integer (Stream.Get_Size), "Invalid size for stream"); -- Stream.Write ("abc"); end Test_Read_Write; -- ------------------------------ -- Write on a buffer and force regular flush on a larger buffer -- ------------------------------ procedure Test_Write (T : in out Test) is Big_Stream : aliased Buffered_Stream; Stream : Buffered_Stream; Size : Stream_Element_Offset := 0; Count : constant Natural := 1000; Max_Size : constant Natural := (Count * (Count + 1)) / 2; begin Big_Stream.Initialize (Size => Max_Size); Stream.Initialize (Output => Big_Stream'Unchecked_Access, Input => Big_Stream'Unchecked_Access, Size => 13); for I in 1 .. Count loop declare S : String (1 .. I); begin for J in S'Range loop S (J) := Character'Val (J mod 255); end loop; Stream.Write (S); Stream.Flush; Size := Size + Stream_Element_Offset (I); Assert_Equals (T, 1, Integer (Stream.Write_Pos), "Stream must be flushed"); -- Verify that 'Big_Stream' holds the expected number of bytes. Assert_Equals (T, Integer (Size), Integer (Big_Stream.Write_Pos) - 1, "Target stream has an invalid write position at " & Integer'Image (I)); end; end loop; end Test_Write; -- ------------------------------ -- Write on a buffer and force regular flush on a larger buffer -- ------------------------------ procedure Test_Write_Stream (T : in out Test) is Big_Stream : aliased Buffered_Stream; Stream : Buffered_Stream; Size : Stream_Element_Offset := 0; Count : constant Stream_Element_Offset := 200; Max_Size : constant Stream_Element_Offset := 5728500; begin Big_Stream.Initialize (Size => Natural (Max_Size)); for Buf_Size in 1 .. 19 loop Stream.Initialize (Output => Big_Stream'Unchecked_Access, Input => Big_Stream'Unchecked_Access, Size => Buf_Size); for I in 1 .. Count loop for Repeat in 1 .. 5 loop declare S : Stream_Element_Array (1 .. I); begin for J in S'Range loop S (J) := Stream_Element'Val (J mod 255); end loop; for J in 1 .. Repeat loop Stream.Write (S); end loop; Stream.Flush; Size := Size + (I) * Stream_Element_Offset (Repeat); Assert_Equals (T, 1, Integer (Stream.Write_Pos), "Stream must be flushed"); -- Verify that 'Big_Stream' holds the expected number of bytes. Assert_Equals (T, Integer (Size), Integer (Big_Stream.Write_Pos) - 1, "Target stream has an invalid write position at " & Stream_Element_Offset'Image (I) & " with buffer " & Natural'Image (Buf_Size) & " repeat " & Natural'Image (Repeat)); end; end loop; end loop; end loop; Assert_Equals (T, Integer (Max_Size), Integer (Big_Stream.Get_Size), "Invalid final size"); end Test_Write_Stream; end Util.Streams.Buffered.Tests;
persan/a-cups
Ada
6,711
ads
pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with CUPS.bits_types_h; with CUPS.time_h; private package CUPS.bits_stat_h is -- unsupported macro: st_atime st_atim.tv_sec -- unsupported macro: st_mtime st_mtim.tv_sec -- unsupported macro: st_ctime st_ctim.tv_sec UTIME_NOW : constant := ((2 ** 30) - 1); -- bits/stat.h:206 UTIME_OMIT : constant := ((2 ** 30) - 2); -- bits/stat.h:207 -- Copyright (C) 1999-2016 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 -- <http://www.gnu.org/licenses/>. -- Versions of the `struct stat' data structure. -- i386 versions of the `xmknod' interface. -- x86-64 versions of the `xmknod' interface. -- Device. type stat_uu_glibc_reserved_array is array (0 .. 2) of aliased CUPS.bits_types_h.uu_syscall_slong_t; type stat is record st_dev : aliased CUPS.bits_types_h.uu_dev_t; -- bits/stat.h:48 st_ino : aliased CUPS.bits_types_h.uu_ino_t; -- bits/stat.h:53 st_nlink : aliased CUPS.bits_types_h.uu_nlink_t; -- bits/stat.h:61 st_mode : aliased CUPS.bits_types_h.uu_mode_t; -- bits/stat.h:62 st_uid : aliased CUPS.bits_types_h.uu_uid_t; -- bits/stat.h:64 st_gid : aliased CUPS.bits_types_h.uu_gid_t; -- bits/stat.h:65 uu_pad0 : aliased int; -- bits/stat.h:67 st_rdev : aliased CUPS.bits_types_h.uu_dev_t; -- bits/stat.h:69 st_size : aliased CUPS.bits_types_h.uu_off_t; -- bits/stat.h:74 st_blksize : aliased CUPS.bits_types_h.uu_blksize_t; -- bits/stat.h:78 st_blocks : aliased CUPS.bits_types_h.uu_blkcnt_t; -- bits/stat.h:80 st_atim : aliased CUPS.time_h.timespec; -- bits/stat.h:91 st_mtim : aliased CUPS.time_h.timespec; -- bits/stat.h:92 st_ctim : aliased CUPS.time_h.timespec; -- bits/stat.h:93 uu_glibc_reserved : aliased stat_uu_glibc_reserved_array; -- bits/stat.h:106 end record; pragma Convention (C_Pass_By_Copy, stat); -- bits/stat.h:46 -- File serial number. -- 32bit file serial number. -- File mode. -- Link count. -- Link count. -- File mode. -- User ID of the file's owner. -- Group ID of the file's group. -- Device number, if device. -- Size of file, in bytes. -- Size of file, in bytes. -- Optimal block size for I/O. -- Number 512-byte blocks allocated. -- Number 512-byte blocks allocated. -- Nanosecond resolution timestamps are stored in a format -- equivalent to 'struct timespec'. This is the type used -- whenever possible but the Unix namespace rules do not allow the -- identifier 'timespec' to appear in the <sys/stat.h> header. -- Therefore we have to handle the use of this header in strictly -- standard-compliant sources special. -- Time of last access. -- Time of last modification. -- Time of last status change. -- Time of last access. -- Nscecs of last access. -- Time of last modification. -- Nsecs of last modification. -- Time of last status change. -- Nsecs of last status change. -- File serial number. -- Note stat64 has the same shape as stat for x86-64. -- Device. type stat64_uu_glibc_reserved_array is array (0 .. 2) of aliased CUPS.bits_types_h.uu_syscall_slong_t; type stat64 is record st_dev : aliased CUPS.bits_types_h.uu_dev_t; -- bits/stat.h:121 st_ino : aliased CUPS.bits_types_h.uu_ino64_t; -- bits/stat.h:123 st_nlink : aliased CUPS.bits_types_h.uu_nlink_t; -- bits/stat.h:124 st_mode : aliased CUPS.bits_types_h.uu_mode_t; -- bits/stat.h:125 st_uid : aliased CUPS.bits_types_h.uu_uid_t; -- bits/stat.h:132 st_gid : aliased CUPS.bits_types_h.uu_gid_t; -- bits/stat.h:133 uu_pad0 : aliased int; -- bits/stat.h:135 st_rdev : aliased CUPS.bits_types_h.uu_dev_t; -- bits/stat.h:136 st_size : aliased CUPS.bits_types_h.uu_off_t; -- bits/stat.h:137 st_blksize : aliased CUPS.bits_types_h.uu_blksize_t; -- bits/stat.h:143 st_blocks : aliased CUPS.bits_types_h.uu_blkcnt64_t; -- bits/stat.h:144 st_atim : aliased CUPS.time_h.timespec; -- bits/stat.h:152 st_mtim : aliased CUPS.time_h.timespec; -- bits/stat.h:153 st_ctim : aliased CUPS.time_h.timespec; -- bits/stat.h:154 uu_glibc_reserved : aliased stat64_uu_glibc_reserved_array; -- bits/stat.h:164 end record; pragma Convention (C_Pass_By_Copy, stat64); -- bits/stat.h:119 -- File serial number. -- Link count. -- File mode. -- 32bit file serial number. -- File mode. -- Link count. -- User ID of the file's owner. -- Group ID of the file's group. -- Device number, if device. -- Size of file, in bytes. -- Device number, if device. -- Size of file, in bytes. -- Optimal block size for I/O. -- Nr. 512-byte blocks allocated. -- Nanosecond resolution timestamps are stored in a format -- equivalent to 'struct timespec'. This is the type used -- whenever possible but the Unix namespace rules do not allow the -- identifier 'timespec' to appear in the <sys/stat.h> header. -- Therefore we have to handle the use of this header in strictly -- standard-compliant sources special. -- Time of last access. -- Time of last modification. -- Time of last status change. -- Time of last access. -- Nscecs of last access. -- Time of last modification. -- Nsecs of last modification. -- Time of last status change. -- Nsecs of last status change. -- File serial number. -- Tell code we have these members. -- Nanosecond resolution time values are supported. -- Encoding of the file mode. -- File types. -- POSIX.1b objects. Note that these macros always evaluate to zero. But -- they do it by enforcing the correct use of the macros. -- Protection bits. end CUPS.bits_stat_h;
AdaCore/Ada_Drivers_Library
Ada
4,631
adb
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015-2016, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of STMicroelectronics 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. -- -- -- ------------------------------------------------------------------------------ -- Based on ft5336.h from MCD Application Team with Ada.Real_Time; use Ada.Real_Time; with Ada.Unchecked_Conversion; with HAL.Touch_Panel; use HAL.Touch_Panel; with STM32.Board; use STM32.Board; with STM32.Setup; package body Touch_Panel_FT5336 is ---------------- -- Initialize -- ---------------- function Initialize (This : in out Touch_Panel; Orientation : HAL.Framebuffer.Display_Orientation := HAL.Framebuffer.Default) return Boolean is begin -- Wait at least 200ms after power up before accessing the TP registers delay until Clock + Milliseconds (200); STM32.Setup.Setup_I2C_Master (Port => TP_I2C, SDA => TP_I2C_SDA, SCL => TP_I2C_SCL, SDA_AF => TP_I2C_AF, SCL_AF => TP_I2C_AF, Clock_Speed => 100_000); This.TP_Set_Use_Interrupts (False); This.Set_Orientation (Orientation); return This.Check_Id; end Initialize; ---------------- -- Initialize -- ---------------- procedure Initialize (This : in out Touch_Panel; Orientation : HAL.Framebuffer.Display_Orientation := HAL.Framebuffer.Default) is begin if not This.Initialize (Orientation) then raise Constraint_Error with "Cannot initialize the touch panel"; end if; end Initialize; --------------------- -- Set_Orientation -- --------------------- procedure Set_Orientation (This : in out Touch_Panel; Orientation : HAL.Framebuffer.Display_Orientation) is begin case Orientation is when HAL.Framebuffer.Default | HAL.Framebuffer.Landscape => This.Set_Bounds (LCD_Natural_Width, LCD_Natural_Height, 0); when HAL.Framebuffer.Portrait => This.Set_Bounds (LCD_Natural_Width, LCD_Natural_Height, Invert_Y or Swap_XY); end case; end Set_Orientation; end Touch_Panel_FT5336;
yannickmoy/atomic
Ada
19,156
adb
with System; package body Atomic.Generic64 with SPARK_Mode => Off is Size_Suffix : constant String := "8"; -- The value of this constant is the only difference between the package -- bodies for the different data sizes (8, 16, 32, 64). ---------- -- Load -- ---------- function Load (This : aliased Instance; Order : Mem_Order := Seq_Cst) return T is function Intrinsic (Ptr : System.Address; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_load_" & Size_Suffix); begin return Intrinsic (This'Address, Order'Enum_Rep); end Load; ----------- -- Store -- ----------- procedure Store (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) is procedure Intrinsic (Ptr : System.Address; Val : T; Model : Integer); pragma Import (Intrinsic, Intrinsic, "__atomic_store_" & Size_Suffix); begin Intrinsic (This'Address, Val, Order'Enum_Rep); end Store; --------- -- Add -- --------- procedure Add (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) is Unused : T; function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_add_fetch_" & Size_Suffix); begin Unused := Intrinsic (This'Address, Val, Order'Enum_Rep); end Add; --------- -- Sub -- --------- procedure Sub (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) is Unused : T; function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_sub_fetch_" & Size_Suffix); begin Unused := Intrinsic (This'Address, Val, Order'Enum_Rep); end Sub; ------------ -- Op_And -- ------------ procedure Op_And (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) is Unused : T; function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_and_fetch_" & Size_Suffix); begin Unused := Intrinsic (This'Address, Val, Order'Enum_Rep); end Op_And; ------------ -- Op_XOR -- ------------ procedure Op_XOR (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) is Unused : T; function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_xor_fetch_" & Size_Suffix); begin Unused := Intrinsic (This'Address, Val, Order'Enum_Rep); end Op_XOR; ----------- -- Op_OR -- ----------- procedure Op_OR (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) is Unused : T; function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_or_fetch_" & Size_Suffix); begin Unused := Intrinsic (This'Address, Val, Order'Enum_Rep); end Op_OR; ---------- -- NAND -- ---------- procedure NAND (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) is Unused : T; function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_nand_fetch_" & Size_Suffix); begin Unused := Intrinsic (This'Address, Val, Order'Enum_Rep); end NAND; -- SPARK compatible -- -------------- -- Exchange -- -------------- procedure Exchange (This : aliased in out Instance; Val : T; Old : out T; Order : Mem_Order := Seq_Cst) is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_exchange_" & Size_Suffix); begin Old := Intrinsic (This'Address, Val, Order'Enum_Rep); end Exchange; ---------------------- -- Compare_Exchange -- ---------------------- procedure Compare_Exchange (This : aliased in out Instance; Expected : T; Desired : T; Weak : Boolean; Success : out Boolean; Success_Order : Mem_Order := Seq_Cst; Failure_Order : Mem_Order := Seq_Cst) is function Intrinsic (Ptr : System.Address; Expected : System.Address; Desired : T; Weak : Boolean; Success_Order, Failure_Order : Integer) return Boolean; pragma Import (Intrinsic, Intrinsic, "__atomic_compare_exchange_" & Size_Suffix); Exp : T := Expected; begin Success := Intrinsic (This'Address, Exp'Address, Desired, Weak, Success_Order'Enum_Rep, Failure_Order'Enum_Rep); end Compare_Exchange; --------------- -- Add_Fetch -- --------------- procedure Add_Fetch (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_add_fetch_" & Size_Suffix); begin Result := Intrinsic (This'Address, Val, Order'Enum_Rep); end Add_Fetch; --------------- -- Sub_Fetch -- --------------- procedure Sub_Fetch (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_sub_fetch_" & Size_Suffix); begin Result := Intrinsic (This'Address, Val, Order'Enum_Rep); end Sub_Fetch; --------------- -- And_Fetch -- --------------- procedure And_Fetch (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_and_fetch_" & Size_Suffix); begin Result := Intrinsic (This'Address, Val, Order'Enum_Rep); end And_Fetch; --------------- -- XOR_Fetch -- --------------- procedure XOR_Fetch (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_xor_fetch_" & Size_Suffix); begin Result := Intrinsic (This'Address, Val, Order'Enum_Rep); end XOR_Fetch; -------------- -- OR_Fetch -- -------------- procedure OR_Fetch (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_or_fetch_" & Size_Suffix); begin Result := Intrinsic (This'Address, Val, Order'Enum_Rep); end OR_Fetch; ---------------- -- NAND_Fetch -- ---------------- procedure NAND_Fetch (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_and_fetch_" & Size_Suffix); begin Result := Intrinsic (This'Address, Val, Order'Enum_Rep); end NAND_Fetch; --------------- -- Fetch_Add -- --------------- procedure Fetch_Add (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_fetch_add_" & Size_Suffix); begin Result := Intrinsic (This'Address, Val, Order'Enum_Rep); end Fetch_Add; --------------- -- Fetch_Sub -- --------------- procedure Fetch_Sub (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_fetch_sub_" & Size_Suffix); begin Result := Intrinsic (This'Address, Val, Order'Enum_Rep); end Fetch_Sub; --------------- -- Fetch_And -- --------------- procedure Fetch_And (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_fetch_and_" & Size_Suffix); begin Result := Intrinsic (This'Address, Val, Order'Enum_Rep); end Fetch_And; --------------- -- Fetch_XOR -- --------------- procedure Fetch_XOR (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_fetch_xor_" & Size_Suffix); begin Result := Intrinsic (This'Address, Val, Order'Enum_Rep); end Fetch_XOR; -------------- -- Fetch_OR -- -------------- procedure Fetch_OR (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_fetch_or_" & Size_Suffix); begin Result := Intrinsic (This'Address, Val, Order'Enum_Rep); end Fetch_OR; ---------------- -- Fetch_NAND -- ---------------- procedure Fetch_NAND (This : aliased in out Instance; Val : T; Result : out T; Order : Mem_Order := Seq_Cst) is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_fetch_nand_" & Size_Suffix); begin Result := Intrinsic (This'Address, Val, Order'Enum_Rep); end Fetch_NAND; -- NOT SPARK Compatible -- -------------- -- Exchange -- -------------- function Exchange (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_exchange_" & Size_Suffix); begin return Intrinsic (This'Address, Val, Order'Enum_Rep); end Exchange; ---------------------- -- Compare_Exchange -- ---------------------- function Compare_Exchange (This : aliased in out Instance; Expected : T; Desired : T; Weak : Boolean; Success_Order : Mem_Order := Seq_Cst; Failure_Order : Mem_Order := Seq_Cst) return Boolean is function Intrinsic (Ptr : System.Address; Expected : System.Address; Desired : T; Weak : Boolean; Success_Order, Failure_Order : Integer) return Boolean; pragma Import (Intrinsic, Intrinsic, "__atomic_compare_exchange_" & Size_Suffix); Exp : T := Expected; begin return Intrinsic (This'Address, Exp'Address, Desired, Weak, Success_Order'Enum_Rep, Failure_Order'Enum_Rep); end Compare_Exchange; --------------- -- Add_Fetch -- --------------- function Add_Fetch (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_add_fetch_" & Size_Suffix); begin return Intrinsic (This'Address, Val, Order'Enum_Rep); end Add_Fetch; --------------- -- Sub_Fetch -- --------------- function Sub_Fetch (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_sub_fetch_" & Size_Suffix); begin return Intrinsic (This'Address, Val, Order'Enum_Rep); end Sub_Fetch; --------------- -- And_Fetch -- --------------- function And_Fetch (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_and_fetch_" & Size_Suffix); begin return Intrinsic (This'Address, Val, Order'Enum_Rep); end And_Fetch; --------------- -- XOR_Fetch -- --------------- function XOR_Fetch (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_xor_fetch_" & Size_Suffix); begin return Intrinsic (This'Address, Val, Order'Enum_Rep); end XOR_Fetch; -------------- -- OR_Fetch -- -------------- function OR_Fetch (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_or_fetch_" & Size_Suffix); begin return Intrinsic (This'Address, Val, Order'Enum_Rep); end OR_Fetch; ---------------- -- NAND_Fetch -- ---------------- function NAND_Fetch (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_nand_fetch_" & Size_Suffix); begin return Intrinsic (This'Address, Val, Order'Enum_Rep); end NAND_Fetch; --------------- -- Fetch_Add -- --------------- function Fetch_Add (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_fetch_add_" & Size_Suffix); begin return Intrinsic (This'Address, Val, Order'Enum_Rep); end Fetch_Add; --------------- -- Fetch_Sub -- --------------- function Fetch_Sub (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_fetch_sub_" & Size_Suffix); begin return Intrinsic (This'Address, Val, Order'Enum_Rep); end Fetch_Sub; --------------- -- Fetch_And -- --------------- function Fetch_And (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_fetch_and_" & Size_Suffix); begin return Intrinsic (This'Address, Val, Order'Enum_Rep); end Fetch_And; --------------- -- Fetch_XOR -- --------------- function Fetch_XOR (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_fetch_xor_" & Size_Suffix); begin return Intrinsic (This'Address, Val, Order'Enum_Rep); end Fetch_XOR; -------------- -- Fetch_OR -- -------------- function Fetch_OR (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_fetch_or_" & Size_Suffix); begin return Intrinsic (This'Address, Val, Order'Enum_Rep); end Fetch_OR; ---------------- -- Fetch_NAND -- ---------------- function Fetch_NAND (This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst) return T is function Intrinsic (Ptr : System.Address; Val : T; Model : Integer) return T; pragma Import (Intrinsic, Intrinsic, "__atomic_fetch_nand_" & Size_Suffix); begin return Intrinsic (This'Address, Val, Order'Enum_Rep); end Fetch_NAND; end Atomic.Generic64;
reznikmm/matreshka
Ada
4,377
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Tools Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2015, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Asis; with Engines.Contexts; with League.Strings; package Properties.Definitions.Subtype_Indication is function Code (Engine : access Engines.Contexts.Context; Element : Asis.Definition; Name : Engines.Text_Property) return League.Strings.Universal_String; function Bounds (Engine : access Engines.Contexts.Context; Element : Asis.Definition; Name : Engines.Text_Property) return League.Strings.Universal_String; function Initialize (Engine : access Engines.Contexts.Context; Element : Asis.Definition; Name : Engines.Text_Property) return League.Strings.Universal_String; function Is_Simple_Type (Engine : access Engines.Contexts.Context; Element : Asis.Declaration; Name : Engines.Boolean_Property) return Boolean; function Alignment (Engine : access Engines.Contexts.Context; Element : Asis.Definition; Name : Engines.Integer_Property) return Integer; end Properties.Definitions.Subtype_Indication;
zrmyers/VulkanAda
Ada
6,560
adb
-------------------------------------------------------------------------------- -- MIT License -- -- Copyright (c) 2021 Zane Myers -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in all -- copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -- SOFTWARE. -------------------------------------------------------------------------------- with Ada.Text_IO; with Vulkan.Test.Framework; with Vulkan.Math.GenDMatrix; with Vulkan.Math.Dmat3x3; with Vulkan.Math.Dmat2x3; with Vulkan.Math.Dmat3x2; with Vulkan.Math.GenDType; with Vulkan.Math.Dvec3; with Vulkan.Math.Operators; use Ada.Text_IO; use Vulkan.Test.Framework; use Vulkan.Math.Dmat3x3; use Vulkan.Math.Dmat2x3; use Vulkan.Math.Dmat3x2; use Vulkan.Math.GenDType; use Vulkan.Math.Dvec3; use Vulkan.Math.Operators; -------------------------------------------------------------------------------- --< @group Vulkan Math Basic Types -------------------------------------------------------------------------------- --< @summary --< This package provides tests for single precision floating point mat3x3. -------------------------------------------------------------------------------- package body Vulkan.Math.Dmat3x3.Test is -- Test Mat3x3 procedure Test_Dmat3x3 is vec1 : Vkm_Dvec3 := Make_Dvec3(1.0, 2.0, 3.0); mat1 : Vkm_Dmat3x3 := Make_Dmat3x3; mat2 : Vkm_Dmat3x3 := Make_Dmat3x3(diag => 2.0); mat3 : Vkm_Dmat3x3 := Make_Dmat3x3(vec1); mat4 : Vkm_Dmat3x3 := Make_Dmat3x3(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0); mat5 : Vkm_Dmat3x3 := Make_Dmat3x3(vec1, -vec1, vec1 / 2.0); mat6 : Vkm_Dmat3x3 := Make_Dmat3x3(mat4); mat7 : Vkm_Dmat2x3 := Make_Dmat2x3(1.0, 2.0, 3.0, 4.0, 5.0, 6.0); mat8 : Vkm_Dmat3x2 := Make_Dmat3x2(1.0, 2.0, 3.0, 4.0, 5.0, 6.0); begin Put_Line("Testing Mat3x3 Constructors..."); Put_Line("mat1 " & mat1.Image); Assert_Dmat3x3_Equals(mat1, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0); Put_Line("mat2 " & mat2.Image); Assert_Dmat3x3_Equals(mat2, 2.0, 0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 2.0); Put_Line("mat3 " & mat3.Image); Assert_Dmat3x3_Equals(mat3, 1.0, 0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 3.0); Put_Line("mat4 " & mat4.Image); Assert_Dmat3x3_Equals(mat4, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0); Put_Line("mat5 " & mat5.Image); Assert_Dmat3x3_Equals(mat5, 1.0, 2.0, 3.0, -1.0, -2.0, -3.0, 0.5, 1.0, 1.5); Put_Line("mat6 " & mat6.Image); Assert_Dmat3x3_Equals(mat6, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0); Put_Line("Testing '=' operator..."); Put_Line(" mat2 != mat3"); Assert_Vkm_Bool_Equals(mat2 = mat3, False); Put_Line(" mat4 != mat5"); Assert_Vkm_Bool_Equals(mat4 = mat5, False); Put_Line(" mat4 = mat6"); Assert_Vkm_Bool_Equals(mat4 = mat6, True); Put_Line(" Testing unary '+/-' operator"); Put_Line(" + mat4 = " & Image(+ mat4)); Assert_Dmat3x3_Equals(+mat4, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0); Put_Line(" - mat4 = " & Image(- mat4)); Assert_Dmat3x3_Equals(-mat4, -0.0, -1.0, -2.0, -3.0, -4.0, -5.0, -6.0, -7.0, -8.0); Put_Line("+ ( - mat4) = " & Image(+(- mat4))); Assert_Dmat3x3_Equals(-mat4, -0.0, -1.0, -2.0, -3.0, -4.0, -5.0, -6.0, -7.0, -8.0); Put_Line("Testing 'abs' operator..."); Put_Line(" abs( - mat4) = " & Image(abs(-mat4))); Assert_Dmat3x3_Equals(abs(-mat4), 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0); Put_Line("Testing '+' operator..."); Put_Line(" mat4 + mat5 = " & Image(mat4 + mat5)); Assert_Dmat3x3_Equals(mat4 + mat5, 1.0, 3.0, 5.0, 2.0, 2.0, 2.0, 6.5, 8.0, 9.5); Put_Line("Testing '-' operator..."); Put_Line(" mat4 - mat5 = " & Image(mat4 -mat5)); Assert_Dmat3x3_Equals(mat4 - mat5, -1.0, -1.0, -1.0, 4.0, 6.0, 8.0, 5.5, 6.0, 6.5); Put_Line("Testing '*' operator..."); Put_Line(" mat4 * mat8 = " & Image(mat4 * mat8)); Assert_Dmat3x2_Equals(mat4 * mat8, 13.0, 16.0, 40.0, 52.0, 67.0, 88.0); Put_Line(" mat7 * mat4 = " & Image(mat7 * mat4)); Assert_Dmat2x3_Equals(mat7*mat4, 24.0, 30.0, 36.0, 51.0, 66.0, 81.0); Put_Line(" vec1 * mat4 = " & Image(vec1 * mat4)); Assert_Dvec3_Equals(vec1 * mat4, 24.0, 30.0, 36.0); Put_Line(" mat4 * vec1 = " & Image(mat4 * vec1)); Assert_Dvec3_Equals(mat4 * vec1, 8.0, 26.0, 44.0); end Test_Dmat3x3; end Vulkan.Math.Dmat3x3.Test;
AdaCore/libadalang
Ada
108
ads
with Boo; with Test; package Far is pragma Section ("In Far"); use Boo; pragma Test (A); end Far;
leo-brewin/ada-lapack
Ada
3,489
adb
with Ada.Text_IO; with Ada.Text_IO.Complex_IO; with Ada.Numerics.Generic_Real_Arrays; with Ada.Numerics.Generic_Complex_Types; with Ada.Numerics.Generic_Complex_Arrays; with Ada.Numerics.Generic_Elementary_Functions; with Ada.Numerics.Generic_Complex_Elementary_Functions; with Ada_Lapack; use Ada.Text_IO; procedure tzgetri is type Real is digits 18; package Real_Arrays is new Ada.Numerics.Generic_Real_Arrays (Real); package Complex_Types is new Ada.Numerics.Generic_Complex_Types (Real); package Complex_Arrays is new Ada.Numerics.Generic_Complex_Arrays (Real_Arrays, Complex_Types); package Real_Maths is new Ada.Numerics.Generic_Elementary_Functions (Real); package Complex_Maths is new Ada.Numerics.Generic_Complex_Elementary_Functions (Complex_Types); package Real_IO is new Ada.Text_IO.Float_IO (Real); package Integer_IO is new Ada.Text_IO.Integer_IO (Integer); package Complex_IO is new Ada.Text_IO.Complex_IO (Complex_Types); package Lapack is new Ada_Lapack(Real, Complex_Types, Real_Arrays, Complex_Arrays); use Lapack; use Real_Arrays; use Complex_Types; use Complex_Arrays; use Real_IO; use Integer_IO; use Complex_IO; use Real_Maths; use Complex_Maths; matrix : Complex_Matrix (1..4,1..4); matrix_copy : Complex_Matrix (1..4,1..4); matrix_rows : Integer := Matrix'Length (1); matrix_cols : Integer := Matrix'Length (2); pivots : Integer_Vector (1..matrix_rows); short_vector : Complex_Vector (1..1); return_code : Integer; begin matrix :=( (( 1.23, -5.50), ( 7.91, -5.38), ( -9.80, -4.86), ( -7.32, 7.57)), (( -2.14, -1.12), ( -9.92, -0.79), ( -9.18, -1.12), ( 1.37, 0.43)), (( -4.30, -7.10), ( -6.47, 2.52), ( -6.51, -2.67), ( -5.86, 7.38)), (( 1.27, 7.29), ( 8.90, 6.92), ( -8.82, 1.25), ( 5.41, 5.37)) ); matrix_copy := matrix; GETRF ( A => matrix, M => matrix_rows, N => matrix_rows, LDA => matrix_rows, IPIV => pivots, INFO => return_code ); GETRI ( A => matrix, N => matrix_rows, LDA => matrix_rows, IPIV => pivots, WORK => short_vector, LWORK => -1, INFO => return_code); declare work_vector_rows : Integer := Integer( short_vector(1).Re ); work_vector : Complex_Vector (1 .. work_vector_rows); begin GETRI ( A => matrix, N => matrix_rows, LDA => matrix_rows, IPIV => pivots, WORK => work_vector, LWORK => work_vector_rows, INFO => return_code); end; if (return_code /= 0) then Put_line ("The matrix is probably singular."); else Put_line ("Matrix"); for i in matrix_copy'range(1) loop for j in matrix_copy'range(2) loop put(matrix_copy(i,j),3,3,0); put(" "); end loop; new_line; end loop; new_line; Put_line ("Inverse"); for i in matrix'range(1) loop for j in matrix'range(2) loop put(matrix(i,j),3,3,0); put(" "); end loop; new_line; end loop; end if; end tzgetri;
reznikmm/matreshka
Ada
545
ads
with Types.Components; with Types.Variant_Parts; package Types.Component_Lists is pragma Preelaborate; type Component_List is limited interface; type Component_List_Access is access all Component_List'Class with Storage_Size => 0; not overriding function Components (Self : Component_List) return Types.Components.Component_Access_Array is abstract; not overriding function Variant_Part (Self : Component_List) return Types.Variant_Parts.Variant_Part_Access is abstract; end Types.Component_Lists;
reznikmm/increment
Ada
1,711
adb
-- Copyright (c) 2015-2017 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body Incr.Lexers.Batch_Lexers is ------------------------- -- Get_Start_Condition -- ------------------------- function Get_Start_Condition (Self : Batch_Lexer'Class) return State is begin return Self.Start; end Get_Start_Condition; -------------- -- Get_Text -- -------------- function Get_Text (Self : Batch_Lexer'Class) return League.Strings.Universal_String is begin return League.Strings.To_Universal_String (Self.Buffer (1 .. Self.To)); end Get_Text; ---------------------- -- Get_Token_Length -- ---------------------- function Get_Token_Length (Self : Batch_Lexer'Class) return Positive is begin return Self.To; end Get_Token_Length; ------------------------- -- Get_Token_Lookahead -- ------------------------- function Get_Token_Lookahead (Self : Batch_Lexer'Class) return Positive is begin return Self.Next - 1; end Get_Token_Lookahead; ---------------- -- Set_Source -- ---------------- procedure Set_Source (Self : in out Batch_Lexer'Class; Source : not null Source_Access) is begin Self.Source := Source; Self.Next := 1; Self.To := 0; end Set_Source; ------------------------- -- Set_Start_Condition -- ------------------------- procedure Set_Start_Condition (Self : in out Batch_Lexer'Class; Condition : State) is begin Self.Start := Condition; end Set_Start_Condition; end Incr.Lexers.Batch_Lexers;
stcarrez/ada-wiki
Ada
7,430
ads
----------------------------------------------------------------------- -- wiki-filters-collectors -- Wiki word and link collectors -- Copyright (C) 2016, 2020, 2022 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Containers.Indefinite_Ordered_Maps; -- === Collector Filters === -- The `Wiki.Filters.Collectors` package defines three filters that can be used to -- collect words, links or images contained in a Wiki document. The collector filters are -- inserted in the filter chain and they collect the data as the Wiki text is parsed. -- After the parsing, the collector filters have collected either the words or the links -- and they can be queried by using the `Find` or `Iterate` operations. -- The following collectors are defined: -- -- * The `Word_Collector_Type` collects words from text, headers, links, -- * The `Link_Collector_Type` collects links, -- * The `Image_Collector_Type` collects images, -- -- The filter is inserted in the filter chain before parsing the Wiki document. -- -- Words : aliased Wiki.Filters.Collectors.Word_Collector_Type; -- ... -- Engine.Add_Filter (Words'Unchecked_Access); -- -- Once the document is parsed, the collector filters contains the data that was collected. -- The `Iterate` procedure can be used to have a procedure called for each value -- collected by the filter. -- -- Words.Iterate (Print'Access); -- package Wiki.Filters.Collectors is pragma Preelaborate; package WString_Maps is new Ada.Containers.Indefinite_Ordered_Maps (Key_Type => Wiki.Strings.WString, Element_Type => Natural, "<" => "<", "=" => "="); subtype Map is WString_Maps.Map; subtype Cursor is WString_Maps.Cursor; -- ------------------------------ -- General purpose collector type -- ------------------------------ type Collector_Type is new Filter_Type with private; type Collector_Type_Access is access all Collector_Type'Class; function Find (Map : in Collector_Type; Item : in Wiki.Strings.WString) return Cursor; function Contains (Map : in Collector_Type; Item : in Wiki.Strings.WString) return Boolean; procedure Iterate (Map : in Collector_Type; Process : not null access procedure (Pos : in Cursor)); -- ------------------------------ -- Word Collector type -- ------------------------------ type Word_Collector_Type is new Collector_Type with private; type Word_Collector_Type_Access is access all Word_Collector_Type'Class; -- Add a text content with the given format to the document. overriding procedure Add_Text (Filter : in out Word_Collector_Type; Document : in out Wiki.Documents.Document; Text : in Wiki.Strings.WString; Format : in Wiki.Format_Map); -- Add a link. overriding procedure Add_Link (Filter : in out Word_Collector_Type; Document : in out Wiki.Documents.Document; Name : in Wiki.Strings.WString; Attributes : in out Wiki.Attributes.Attribute_List); -- Add an image. overriding procedure Add_Image (Filter : in out Word_Collector_Type; Document : in out Wiki.Documents.Document; Name : in Wiki.Strings.WString; Attributes : in out Wiki.Attributes.Attribute_List); -- Add a quote. overriding procedure Add_Quote (Filter : in out Word_Collector_Type; Document : in out Wiki.Documents.Document; Name : in Wiki.Strings.WString; Attributes : in out Wiki.Attributes.Attribute_List); -- Add a text block that is pre-formatted. overriding procedure Add_Preformatted (Filter : in out Word_Collector_Type; Document : in out Wiki.Documents.Document; Text : in Wiki.Strings.WString; Format : in Wiki.Strings.WString); -- ------------------------------ -- Link Collector type -- ------------------------------ type Link_Collector_Type is new Collector_Type with private; type Link_Collector_Type_Access is access all Link_Collector_Type'Class; -- Add a link. overriding procedure Add_Link (Filter : in out Link_Collector_Type; Document : in out Wiki.Documents.Document; Name : in Wiki.Strings.WString; Attributes : in out Wiki.Attributes.Attribute_List); -- Push a HTML node with the given tag to the document. overriding procedure Push_Node (Filter : in out Link_Collector_Type; Document : in out Wiki.Documents.Document; Tag : in Wiki.Html_Tag; Attributes : in out Wiki.Attributes.Attribute_List); -- ------------------------------ -- Image Collector type -- ------------------------------ type Image_Collector_Type is new Collector_Type with private; type Image_Collector_Type_Access is access all Image_Collector_Type'Class; -- Add an image. overriding procedure Add_Image (Filter : in out Image_Collector_Type; Document : in out Wiki.Documents.Document; Name : in Wiki.Strings.WString; Attributes : in out Wiki.Attributes.Attribute_List); -- Push a HTML node with the given tag to the document. overriding procedure Push_Node (Filter : in out Image_Collector_Type; Document : in out Wiki.Documents.Document; Tag : in Wiki.Html_Tag; Attributes : in out Wiki.Attributes.Attribute_List); private type Collector_Type is new Filter_Type with record Items : WString_Maps.Map; end record; procedure Collect_Attribute (Filter : in out Collector_Type; Attributes : in Wiki.Attributes.Attribute_List; Name : in String); type Word_Collector_Type is new Collector_Type with null record; procedure Collect_Words (Filter : in out Word_Collector_Type; Content : in Wiki.Strings.WString); type Link_Collector_Type is new Collector_Type with null record; type Image_Collector_Type is new Collector_Type with null record; end Wiki.Filters.Collectors;
Maxelweb/concurrency-sandbox
Ada
522
ads
package RCP is -- the amount of resources required by every single request -- can never exceed a predefined maximum quantity Max_Requests : constant Positive := 10; type Request_T is range 0 .. Max_Requests; type Use_T is (Long, Medium, Short); -- a descriptor type to denote the Item_T type and -- the assignment status of individual resources type Resource_T is record Item : Use_T := Long; Granted : Request_T := Request_T'First; end record; end RCP;
PhiTheta/ADLAS_Ada_System
Ada
3,178
adb
------------------------------------------------------------------------------------------------------------------------ --------------------------------------- File Details ------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------ -- Project: Project_System -- File name: <File_Name> -- Description: This is the description of the test file -- -- -- ------------------------------------------------------------------------------------------------------------------------ --------------------------------------- Change History: ---------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------ -- -- Version Date Author Description -- ------- ---- ------ ----------- -- 1.0 22/08/17 S.Crowther Initial version ------------------------------------------------------------------------------------------------------------------------ --------------------------------------- Parameters: -------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------ -- -- Name Direction Description -- ---- --------- ---- -- Input_1 Input Template array -- Output_1 Output Template array -- ------------------------------------------------------------------------------------------------------------------------ --------------------------------------- Function Details: -------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------ -- -- Function name: <Function_Name> -- Description: -- -- -- Equation Logic: If x = 1 then -- If template_variable = 1 then -- Test_Failed -- else -- Test Passed -- end if -- Else -- Test Passed -- End if -- -- Return: -- Boolean Value ------------------------------------------------------------------------------------------------------------------------ --------------------------------------- Code: -------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------ separate(cbit.boost) procedure Disengage_Stage_Check is begin --write_file(Output, file_name); end disabler;
Fabien-Chouteau/GESTE
Ada
1,379
ads
pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with SDL_SDL_stdinc_h; package SDL_SDL_cpuinfo_h is function SDL_HasRDTSC return SDL_SDL_stdinc_h.SDL_bool; -- ../include/SDL/SDL_cpuinfo.h:40 pragma Import (C, SDL_HasRDTSC, "SDL_HasRDTSC"); function SDL_HasMMX return SDL_SDL_stdinc_h.SDL_bool; -- ../include/SDL/SDL_cpuinfo.h:43 pragma Import (C, SDL_HasMMX, "SDL_HasMMX"); function SDL_HasMMXExt return SDL_SDL_stdinc_h.SDL_bool; -- ../include/SDL/SDL_cpuinfo.h:46 pragma Import (C, SDL_HasMMXExt, "SDL_HasMMXExt"); function SDL_Has3DNow return SDL_SDL_stdinc_h.SDL_bool; -- ../include/SDL/SDL_cpuinfo.h:49 pragma Import (C, SDL_Has3DNow, "SDL_Has3DNow"); function SDL_Has3DNowExt return SDL_SDL_stdinc_h.SDL_bool; -- ../include/SDL/SDL_cpuinfo.h:52 pragma Import (C, SDL_Has3DNowExt, "SDL_Has3DNowExt"); function SDL_HasSSE return SDL_SDL_stdinc_h.SDL_bool; -- ../include/SDL/SDL_cpuinfo.h:55 pragma Import (C, SDL_HasSSE, "SDL_HasSSE"); function SDL_HasSSE2 return SDL_SDL_stdinc_h.SDL_bool; -- ../include/SDL/SDL_cpuinfo.h:58 pragma Import (C, SDL_HasSSE2, "SDL_HasSSE2"); function SDL_HasAltiVec return SDL_SDL_stdinc_h.SDL_bool; -- ../include/SDL/SDL_cpuinfo.h:61 pragma Import (C, SDL_HasAltiVec, "SDL_HasAltiVec"); end SDL_SDL_cpuinfo_h;
mirror/ncurses
Ada
7,876
adb
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- ncurses -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright 2018,2020 Thomas E. Dickey -- -- Copyright 2000-2009,2011 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.11 $ -- $Date: 2020/02/02 23:34:34 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with ncurses2.util; use ncurses2.util; with Terminal_Interface.Curses; use Terminal_Interface.Curses; with Ada.Strings.Unbounded; with Interfaces.C; with Terminal_Interface.Curses.Aux; procedure ncurses2.slk_test is procedure myGet (Win : Window := Standard_Window; Str : out Ada.Strings.Unbounded.Unbounded_String; Len : Integer := -1); procedure myGet (Win : Window := Standard_Window; Str : out Ada.Strings.Unbounded.Unbounded_String; Len : Integer := -1) is use Ada.Strings.Unbounded; use Interfaces.C; use Terminal_Interface.Curses.Aux; function Wgetnstr (Win : Window; Str : char_array; Len : int) return int; pragma Import (C, Wgetnstr, "wgetnstr"); -- FIXME: how to construct "(Len > 0) ? Len : 80"? Ask : constant Interfaces.C.size_t := Interfaces.C.size_t'Val (Len + 80); Txt : char_array (0 .. Ask); begin Txt (0) := Interfaces.C.char'First; if Wgetnstr (Win, Txt, Txt'Length) = Curses_Err then raise Curses_Exception; end if; Str := To_Unbounded_String (To_Ada (Txt, True)); end myGet; use Ada.Strings.Unbounded; c : Key_Code; buf : Unbounded_String; c2 : Character; fmt : Label_Justification := Centered; tmp : Integer; begin c := CTRL ('l'); loop Move_Cursor (Line => 0, Column => 0); c2 := Code_To_Char (c); case c2 is when Character'Val (Character'Pos ('l') mod 16#20#) => -- CTRL('l') Erase; Switch_Character_Attribute (Attr => (Bold_Character => True, others => False)); Add (Line => 0, Column => 20, Str => "Soft Key Exerciser"); Switch_Character_Attribute (On => False, Attr => (Bold_Character => True, others => False)); Move_Cursor (Line => 2, Column => 0); P ("Available commands are:"); P (""); P ("^L -- refresh screen"); P ("a -- activate or restore soft keys"); P ("d -- disable soft keys"); P ("c -- set centered format for labels"); P ("l -- set left-justified format for labels"); P ("r -- set right-justified format for labels"); P ("[12345678] -- set label; labels are numbered 1 through 8"); P ("e -- erase stdscr (should not erase labels)"); P ("s -- test scrolling of shortened screen"); P ("x, q -- return to main menu"); P (""); P ("Note: if activating the soft keys causes your terminal to"); P ("scroll up one line, your terminal auto-scrolls when anything"); P ("is written to the last screen position. The ncurses code"); P ("does not yet handle this gracefully."); Refresh; Restore_Soft_Label_Keys; when 'a' => Restore_Soft_Label_Keys; when 'e' => Clear; when 's' => Add (Line => 20, Column => 0, Str => "Press Q to stop the scrolling-test: "); loop c := Getchar; c2 := Code_To_Char (c); exit when c2 = 'Q'; -- c = ERR? -- TODO when c is not a character (arrow key) -- the behavior is different from the C version. Add (Ch => c2); end loop; when 'd' => Clear_Soft_Label_Keys; when 'l' => fmt := Left; when 'c' => fmt := Centered; when 'r' => fmt := Right; when '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' => Add (Line => 20, Column => 0, Str => "Please enter the label value: "); Set_Echo_Mode (SwitchOn => True); myGet (Str => buf); Set_Echo_Mode (SwitchOn => False); tmp := ctoi (c2); Set_Soft_Label_Key (Label_Number (tmp), To_String (buf), fmt); Refresh_Soft_Label_Keys; Move_Cursor (Line => 20, Column => 0); Clear_To_End_Of_Line; when 'x' | 'q' => exit; -- the C version needed a goto, ha ha -- breaks exit the case not the loop because fall-through -- happens in C! when others => Beep; end case; c := Getchar; -- TODO exit when c = EOF end loop; Erase; End_Windows; end ncurses2.slk_test;
aherd2985/Amass
Ada
2,534
ads
-- Copyright 2017 Jeff Foley. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. name = "Brute Forcing" type = "brute" probes = {"www", "online", "webserver", "ns", "ns1", "mail", "smtp", "webmail", "shop", "dev", "prod", "test", "vpn", "ftp", "ssh", "secure", "whm", "admin", "webdisk", "mobile", "remote", "server", "cpanel", "cloud", "autodiscover", "api", "m", "blog"} function vertical(ctx, domain) local cfg = config(ctx) if cfg.mode == "passive" then return end if cfg['brute_forcing'].active then makenames(ctx, domain) end end function resolved(ctx, name, domain, records) local nparts = split(name, ".") local dparts = split(domain, ".") -- Do not process resolved root domain names if #nparts == #dparts then return end -- Do not generate names from CNAMEs or names without A/AAAA records if (#records == 0 or (has_cname(records) or not has_addr(records))) then return end local cfg = config(ctx) if cfg.mode == "passive" then return end local bf = cfg['brute_forcing'] if (bf.active and bf.recursive and (bf['min_for_recursive'] == 0)) then makenames(ctx, name) end end function subdomain(ctx, name, domain, times) local cfg = config(ctx) if cfg.mode == "passive" then return end local bf = cfg['brute_forcing'] if (bf.active and bf.recursive and (bf['min_for_recursive'] == times)) then makenames(ctx, name) end end function makenames(ctx, base) local wordlist = brute_wordlist(ctx) for i, word in pairs(wordlist) do newname(ctx, word .. "." .. base) end end function has_cname(records) if #records == 0 then return false end for i, rec in pairs(records) do if rec.rrtype == 5 then return true end end return false end function has_addr(records) if #records == 0 then return false end for i, rec in pairs(records) do if (rec.rrtype == 1 or rec.rrtype == 28) then return true end end return false end function split(str, delim) local result = {} local pattern = "[^%" .. delim .. "]+" local matches = find(str, pattern) if (matches == nil or #matches == 0) then return result end for i, match in pairs(matches) do table.insert(result, match) end return result end
damaki/SPARKNaCl
Ada
1,745
adb
with SPARKNaCl; use SPARKNaCl; with SPARKNaCl.Core; with SPARKNaCl.Secretbox; use SPARKNaCl.Secretbox; with SPARKNaCl.Cryptobox; with SPARKNaCl.Stream; with Random; use Random; with Ada.Text_IO; use Ada.Text_IO; with Interfaces; use Interfaces; with Ada.Numerics.Discrete_Random; procedure Secretbox8 is RK : Bytes_32; K : Core.Salsa20_Key; N : Stream.HSalsa20_Nonce; S, S2 : Boolean; begin for MLen in N32 range 0 .. 999 loop Random_Bytes (RK); Core.Construct (K, RK); Random_Bytes (Bytes_24 (N)); Put ("Secretbox8 - iteration" & MLen'Img); declare subtype Index is N32 range 0 .. Cryptobox.Plaintext_Zero_Bytes + MLen - 1; subtype CIndex is N32 range Cryptobox.Ciphertext_Zero_Bytes .. Index'Last; subtype Text is Byte_Seq (Index); package RI is new Ada.Numerics.Discrete_Random (CIndex); G : RI.Generator; M, C, M2 : Text := (others => 0); Caught : Integer := 0; begin RI.Reset (G); Random_Bytes (M (Cryptobox.Plaintext_Zero_Bytes .. M'Last)); Create (C, S, M, N, K); if S then while (Caught < 10) loop C (RI.Random (G)) := Random_Byte; Open (M2, S2, C, N, K); if S2 then if not Equal (M, M2) then Put (" forgery!"); exit; end if; else Caught := Caught + 1; end if; end loop; New_Line; else Put_Line ("bad encryption"); end if; end; end loop; end Secretbox8;
AdaCore/libadalang
Ada
703
adb
procedure Test is package P is type T is tagged null record; procedure Proc (X : T); procedure Proc_2 (X : T); private procedure Proc (X : T) is null; --% node.p_canonical_part() procedure Proc_2 (X : T) is null; --% node.p_canonical_part() end P; package Q is type T is new P.T with null record; overriding procedure Proc_2 (X : T); private overriding procedure Proc_2 (X : T) is null; --% node.p_canonical_part() end Q; X : Q.T; begin Q.Proc (X); --% node.f_call.f_name.p_referenced_decl().p_canonical_part() Q.Proc_2 (X); --% node.f_call.f_name.p_referenced_decl().p_canonical_part() end Test;
tum-ei-rcs/StratoX
Ada
6,560
adb
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of STMicroelectronics nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- -- -- -- This file is based on: -- -- -- -- @file stm32f4xx_hal_rng.c -- -- @author MCD Application Team -- -- @version V1.1.0 -- -- @date 19-June-2014 -- -- @brief RNG HAL module driver. -- -- -- -- COPYRIGHT(c) 2014 STMicroelectronics -- ------------------------------------------------------------------------------ with Ada.Interrupts.Names; package body STM32.RNG.Interrupts is type Buffer_Content is array (Integer range <>) of Unsigned_32; type Ring_Buffer is record Content : Buffer_Content (0 .. 9); Head : Integer := 0; Tail : Integer := 0; end record; -------------- -- Receiver -- -------------- protected Receiver is pragma Interrupt_Priority; entry Get_Random_32 (Value : out Unsigned_32); private Last : Unsigned_32 := 0; Buffer : Ring_Buffer; Data_Available : Boolean := False; procedure Interrupt_Handler; pragma Attach_Handler (Interrupt_Handler, Ada.Interrupts.Names.HASH_RNG_Interrupt); end Receiver; -------------- -- Receiver -- -------------- protected body Receiver is ------------------- -- Get_Random_32 -- ------------------- entry Get_Random_32 (Value : out Unsigned_32) when Data_Available is Next : constant Integer := (Buffer.Tail + 1) mod Buffer.Content'Length; begin -- Remove an item from our ring buffer. Value := Buffer.Content (Next); Buffer.Tail := Next; -- If the buffer is empty, make sure we block subsequent callers -- until the buffer has something in it. if Buffer.Tail = Buffer.Head then Data_Available := False; end if; Enable_RNG; end Get_Random_32; ----------------------- -- Interrupt_Handler -- ----------------------- procedure Interrupt_Handler is Current : Unsigned_32; begin if RNG_Seed_Error_Status then Clear_RNG_Seed_Error_Status; -- Clear then set the RNGEN bit to reinitialize and restart -- the RNG. Reset_RNG; end if; if RNG_Clock_Error_Status then -- TODO: reconfigure the clock and make sure it's okay -- Clear the bit. Clear_RNG_Clock_Error_Status; end if; if RNG_Data_Ready then Current := RNG_Data; if Current /= Last then -- This number is good. if (Buffer.Head + 1) mod Buffer.Content'Length = Buffer.Tail then -- But our buffer is full. Turn off the RNG. Disable_RNG; else -- Add this new data to our buffer. Buffer.Head := (Buffer.Head + 1) mod Buffer.Content'Length; Buffer.Content (Buffer.Head) := Current; Data_Available := True; Last := Current; end if; end if; end if; end Interrupt_Handler; end Receiver; -------------------- -- Initialize_RNG -- -------------------- procedure Initialize_RNG is Discard : Unsigned_32; begin Enable_RNG_Clock; Enable_RNG_Interrupt; Enable_RNG; -- Discard the first randomly generated number, according to STM32F4 -- docs. Receiver.Get_Random_32 (Discard); end Initialize_RNG; ------------ -- Random -- ------------ function Random return Unsigned_32 is Result : Unsigned_32; begin Receiver.Get_Random_32 (Result); return Result; end Random; end STM32.RNG.Interrupts;