repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
reznikmm/matreshka | Ada | 5,031 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Generic_Collections;
package AMF.CMOF.Enumerations.Collections is
pragma Preelaborate;
package CMOF_Enumeration_Collections is
new AMF.Generic_Collections
(CMOF_Enumeration,
CMOF_Enumeration_Access);
type Set_Of_CMOF_Enumeration is
new CMOF_Enumeration_Collections.Set with null record;
Empty_Set_Of_CMOF_Enumeration : constant Set_Of_CMOF_Enumeration;
type Ordered_Set_Of_CMOF_Enumeration is
new CMOF_Enumeration_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_CMOF_Enumeration : constant Ordered_Set_Of_CMOF_Enumeration;
type Bag_Of_CMOF_Enumeration is
new CMOF_Enumeration_Collections.Bag with null record;
Empty_Bag_Of_CMOF_Enumeration : constant Bag_Of_CMOF_Enumeration;
type Sequence_Of_CMOF_Enumeration is
new CMOF_Enumeration_Collections.Sequence with null record;
Empty_Sequence_Of_CMOF_Enumeration : constant Sequence_Of_CMOF_Enumeration;
private
Empty_Set_Of_CMOF_Enumeration : constant Set_Of_CMOF_Enumeration
:= (CMOF_Enumeration_Collections.Set with null record);
Empty_Ordered_Set_Of_CMOF_Enumeration : constant Ordered_Set_Of_CMOF_Enumeration
:= (CMOF_Enumeration_Collections.Ordered_Set with null record);
Empty_Bag_Of_CMOF_Enumeration : constant Bag_Of_CMOF_Enumeration
:= (CMOF_Enumeration_Collections.Bag with null record);
Empty_Sequence_Of_CMOF_Enumeration : constant Sequence_Of_CMOF_Enumeration
:= (CMOF_Enumeration_Collections.Sequence with null record);
end AMF.CMOF.Enumerations.Collections;
|
reznikmm/matreshka | Ada | 3,709 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Text_Change_Id_Attributes is
pragma Preelaborate;
type ODF_Text_Change_Id_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Text_Change_Id_Attribute_Access is
access all ODF_Text_Change_Id_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Text_Change_Id_Attributes;
|
clairvoyant/anagram | Ada | 1,533 | ads | -- Copyright (c) 2010-2017 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
-- Rule_Template stores text to evaluate attributes like this:
--
-- ${LHS.Value} := ${Part1.Attr1} + ${Part2.Attr2:1234};
with League.String_Vectors;
package Anagram.Grammars.Rule_Templates is
pragma Preelaborate;
type Rule_Template is tagged private;
function Create
(Text : S.Universal_String)
return Rule_Template;
function Count (Self : Rule_Template) return Natural;
function Text (Self : Rule_Template) return S.Universal_String;
function Part_Name
(Self : Rule_Template;
Index : Positive) return S.Universal_String;
function Attribute_Name
(Self : Rule_Template;
Index : Positive) return S.Universal_String;
function Has_Default
(Self : Rule_Template;
Index : Positive) return Boolean;
function Default
(Self : Rule_Template;
Index : Positive) return S.Universal_String;
function Substitute
(Self : Rule_Template;
Values : League.String_Vectors.Universal_String_Vector)
return S.Universal_String;
private
type Rule_Template is tagged record
Text : S.Universal_String;
Parts : League.String_Vectors.Universal_String_Vector;
Attrs : League.String_Vectors.Universal_String_Vector;
Defs : League.String_Vectors.Universal_String_Vector;
end record;
end Anagram.Grammars.Rule_Templates;
|
godunko/adawebpack | Ada | 9,731 | ads | ------------------------------------------------------------------------------
-- --
-- AdaWebPack --
-- --
------------------------------------------------------------------------------
-- Copyright © 2016-2022, Vadim Godunko --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- 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 Web.HTML.Elements;
limited with Web.HTML.Options;
with Web.Strings;
package Web.HTML.Selects is
pragma Preelaborate;
type HTML_Select_Element is
new Web.HTML.Elements.HTML_Element with null record;
-- interface HTMLSelectElement : HTMLElement {
-- attribute DOMString autocomplete;
-- attribute boolean autofocus;
-- readonly attribute HTMLFormElement? form;
-- attribute boolean multiple;
-- attribute DOMString name;
-- attribute boolean _required;
-- attribute unsigned long size;
--
-- readonly attribute DOMString type;
--
-- [SameObject] readonly attribute HTMLOptionsCollection options;
-- attribute unsigned long length;
-- getter Element? item(unsigned long index
-- );
-- void add((HTMLOptionElement or HTMLOptGroupElement) element
-- , optional (HTMLElement or long)? before
-- = null);
-- void remove(); // ChildNode overload
-- void remove(long index
-- );
-- setter void (unsigned long index
-- , HTMLOptionElement? option
-- );
--
-- [SameObject] readonly attribute HTMLCollection selectedOptions;
--
-- readonly attribute boolean willValidate;
-- readonly attribute ValidityState validity;
-- readonly attribute DOMString validationMessage;
-- boolean checkValidity();
-- boolean reportValidity();
-- void setCustomValidity(DOMString error
-- );
--
-- [SameObject] readonly attribute NodeList labels;
-- };
-- not overriding function Get_Autofocus
-- (Self : not null access constant HTML_Select_Element)
-- return WebAPI.DOM_Boolean is abstract
-- with Import => True,
-- Convention => JavaScript_Property_Getter,
-- Link_Name => "autofocus";
--
-- not overriding procedure Set_Autofocus
-- (Self : not null access constant HTML_Select_Element;
-- To : WebAPI.DOM_Boolean) is abstract
-- with Import => True,
-- Convention => JavaScript_Property_Setter,
-- Link_Name => "autofocus";
function Get_Disabled (Self : HTML_Select_Element'Class) return Boolean;
procedure Set_Disabled
(Self : in out HTML_Select_Element;
To : Boolean);
-- -- readonly attribute HTMLFormElement? form;
--
-- not overriding function Get_Multiple
-- (Self : not null access constant HTML_Select_Element)
-- return WebAPI.DOM_Boolean is abstract
-- with Import => True,
-- Convention => JavaScript_Property_Getter,
-- Link_Name => "multiple";
--
-- not overriding procedure Set_Multiple
-- (Self : not null access constant HTML_Select_Element;
-- To : WebAPI.DOM_Boolean) is abstract
-- with Import => True,
-- Convention => JavaScript_Property_Setter,
-- Link_Name => "multiple";
--
-- not overriding function Get_Name
-- (Self : not null access constant HTML_Select_Element)
-- return WebAPI.DOM_String is abstract
-- with Import => True,
-- Convention => JavaScript_Property_Getter,
-- Link_Name => "name";
--
-- not overriding procedure Set_Name
-- (Self : not null access constant HTML_Select_Element;
-- To : WebAPI.DOM_String) is abstract
-- with Import => True,
-- Convention => JavaScript_Property_Setter,
-- Link_Name => "name";
--
-- not overriding function Get_Required
-- (Self : not null access constant HTML_Select_Element)
-- return WebAPI.DOM_Boolean is abstract
-- with Import => True,
-- Convention => JavaScript_Property_Getter,
-- Link_Name => "required";
--
-- not overriding procedure Set_Required
-- (Self : not null access constant HTML_Select_Element;
-- To : WebAPI.DOM_Boolean) is abstract
-- with Import => True,
-- Convention => JavaScript_Property_Setter,
-- Link_Name => "required";
--
-- -- attribute unsigned long size;
--
-- not overriding function Get_Type
-- (Self : not null access constant HTML_Select_Element)
-- return WebAPI.DOM_String is abstract
-- with Import => True,
-- Convention => JavaScript_Property_Getter,
-- Link_Name => "type";
--
-- -- readonly attribute HTMLOptionsCollection options;
-- -- attribute unsigned long length;
-- -- getter Element? item(unsigned long index);
-- -- HTMLOptionElement? namedItem(DOMString name);
-- -- void add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null);
-- -- void remove(); // ChildNode overload
-- -- void remove(long index);
-- -- setter creator void (unsigned long index, HTMLOptionElement? option);
-- --
-- -- readonly attribute HTMLCollection selectedOptions;
function Get_Selected_Index
(Self : HTML_Select_Element'Class) return Web.DOM_Long;
procedure Set_Selected_Index
(Self : in out HTML_Select_Element'Class;
To : Web.DOM_Long);
function Get_Value
(Self : HTML_Select_Element'Class) return Web.Strings.Web_String;
procedure Set_Value
(Self : in out HTML_Select_Element'Class;
To : Web.Strings.Web_String);
function Named_Item
(Self : HTML_Select_Element'Class;
Name : Web.Strings.Web_String)
return Web.HTML.Options.HTML_Option_Element;
-- not overriding function Get_Will_Validate
-- (Self : not null access constant HTML_Select_Element)
-- return WebAPI.DOM_Boolean is abstract
-- with Import => True,
-- Convention => JavaScript_Property_Getter,
-- Link_Name => "willValidate";
--
-- not overriding procedure Set_Will_Validate
-- (Self : not null access constant HTML_Select_Element;
-- To : WebAPI.DOM_Boolean) is abstract
-- with Import => True,
-- Convention => JavaScript_Property_Setter,
-- Link_Name => "willValidate";
--
-- -- readonly attribute ValidityState validity;
--
-- not overriding function Get_Validation_Message
-- (Self : not null access constant HTML_Select_Element)
-- return WebAPI.DOM_String is abstract
-- with Import => True,
-- Convention => JavaScript_Property_Getter,
-- Link_Name => "validationMessage";
--
-- not overriding function Check_Validity
-- (Self : not null access constant HTML_Select_Element)
-- return Boolean is abstract
-- with Import => True,
-- Convention => JavaScript_Method,
-- Link_Name => "checkValidity";
--
-- not overriding procedure Set_Custom_Validity
-- (Self : not null access constant HTML_Select_Element;
-- Error : WebAPI.DOM_String) is abstract
-- with Import => True,
-- Convention => JavaScript_Method,
-- Link_Name => "setCustomValidity";
--
-- -- readonly attribute NodeList labels;
end Web.HTML.Selects;
|
Fabien-Chouteau/cortex-m | Ada | 6,628 | 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 the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- This package use the ARM semihosting feature to provide a low level driver
-- to access the host file system. It is recommended to _not_ use this
-- interface directly but to access the file system using the File_IO package.
-- For more info, see the file system chapter of the documentation.
with HAL.Filesystem; use HAL.Filesystem;
with HAL; use HAL;
package Semihosting.Filesystem is
pragma Preelaborate;
type SHFS is new HAL.Filesystem.Filesystem_Driver with private;
type Any_SHFS is access all SHFS'Class;
type File_Kind is (Regular_File, Directory);
-------------------------------
-- FS_Driver implementation --
-------------------------------
overriding
function Create_File (This : in out SHFS;
Path : String)
return Status_Code;
function Create_Node (This : in out SHFS;
Path : String;
Kind : File_Kind)
return Status_Code;
function Create_Directory (This : in out SHFS;
Path : String)
return Status_Code;
overriding
function Unlink (This : in out SHFS;
Path : String)
return Status_Code;
overriding
function Remove_Directory (This : in out SHFS;
Path : String)
return Status_Code;
function Rename (This : in out SHFS;
Old_Path : String;
New_Path : String)
return Status_Code;
function Truncate_File (This : in out SHFS;
Path : String;
Length : File_Size)
return Status_Code;
overriding
function Open (This : in out SHFS;
Path : String;
Mode : File_Mode;
Handler : out Any_File_Handle)
return Status_Code;
overriding
function Open (This : in out SHFS;
Path : String;
Handle : out Any_Directory_Handle)
return Status_Code;
overriding
function Root_Node
(This : in out SHFS;
As : String;
Handle : out Any_Node_Handle)
return Status_Code;
overriding
procedure Close (This : in out SHFS);
private
type SHFS_File_Handle;
type SHFS_File_Handle_Access is access all SHFS_File_Handle;
type SHFS_File_Handle is new File_Handle with record
FS : Any_SHFS;
FD : SH_Word;
Absolute_Position : File_Size;
Is_Open : Boolean := False;
Next : SHFS_File_Handle_Access := null;
end record;
overriding
function Get_FS
(This : in out SHFS_File_Handle)
return Any_Filesystem_Driver;
overriding
function Size
(This : SHFS_File_Handle) return File_Size;
overriding
function Mode
(This : SHFS_File_Handle) return File_Mode;
overriding
function Read (This : in out SHFS_File_Handle;
Addr : System.Address;
Length : in out File_Size)
return Status_Code;
overriding
function Write (This : in out SHFS_File_Handle;
Addr : System.Address;
Length : File_Size)
return Status_Code;
overriding
function Offset
(This : SHFS_File_Handle)
return File_Size;
overriding
function Flush
(This : in out SHFS_File_Handle)
return Status_Code;
overriding
function Seek (This : in out SHFS_File_Handle;
Origin : Seek_Mode;
Amount : in out File_Size)
return Status_Code;
overriding
procedure Close (This : in out SHFS_File_Handle);
type SHFS is new HAL.Filesystem.Filesystem_Driver with record
File_Handles : SHFS_File_Handle_Access := null;
end record;
function Get_File_Handle (This : in out SHFS)
return not null SHFS_File_Handle_Access;
-- This function will find an existing free file handle or allocate a new
-- one if necessary.
end Semihosting.Filesystem;
|
PThierry/ewok-kernel | Ada | 1,711 | ads | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with ewok.tasks_shared; use ewok.tasks_shared;
package ewok.sched
with spark_mode => on
is
pragma assertion_policy (pre => IGNORE, post => IGNORE, assert => IGNORE);
-- SPARK/ghost specific function
function current_task_is_valid
return boolean
with ghost;
function get_current
return ewok.tasks_shared.t_task_id
with
inline,
pre => (current_task_is_valid);
procedure request_schedule
with
inline,
spark_mode => off;
function task_elect return t_task_id
with spark_mode => off;
procedure init
with spark_mode => off;
function pendsv_handler
(frame_a : ewok.t_stack_frame_access)
return ewok.t_stack_frame_access
with spark_mode => off;
function do_schedule
(frame_a : ewok.t_stack_frame_access)
return ewok.t_stack_frame_access
renames pendsv_handler;
end ewok.sched;
|
1Crazymoney/LearnAda | Ada | 135 | ads | package Mat is
function Lnko ( A, B : Positive ) return Positive;
function Faktorialis( N: Natural ) return Positive;
end Mat;
|
reznikmm/matreshka | Ada | 3,659 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Elements;
package ODF.DOM.Draw_Ellipse_Elements is
pragma Preelaborate;
type ODF_Draw_Ellipse is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Draw_Ellipse_Access is
access all ODF_Draw_Ellipse'Class
with Storage_Size => 0;
end ODF.DOM.Draw_Ellipse_Elements;
|
stcarrez/ada-awa | Ada | 4,562 | ads | -----------------------------------------------------------------------
-- awa-helpers -- Helpers for AWA applications
-- Copyright (C) 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.Beans.Basic;
with Util.Beans.Objects;
with Util.Properties.Bundles;
with ADO.Sessions;
with ADO.Queries;
with ADO.Statements;
with ASF.Models.Selects;
with ASF.Contexts.Faces;
-- The <b>Selectors</b> package provides several helper operations to create and populate
-- a selector list from an static list (type) or from by using a database SQL query.
package AWA.Helpers.Selectors is
-- Create a selector list from the definition of a discrete type such as an enum.
-- The select item has the enum value as value and the label is created by
-- localizing the string <b>Prefix</b>_<i>enum name</i>.
generic
type T is (<>);
Prefix : String;
function Create_From_Enum (Bundle : in Util.Properties.Bundles.Manager'Class)
return ASF.Models.Selects.Select_Item_List;
-- Create a selector list by using a resource bundle and a create operation that looks for
-- messages in the bundle. The bundle name <b>Bundle</b> gives the name of the resource
-- bundled to load. The locale is determined by the ASF context passed in <b>Context</b>.
-- The <b>Create</b> function is in charge of creating and populating the select list.
function Create_Selector_Bean (Bundle : in String;
Context : in ASF.Contexts.Faces.Faces_Context_Access := null;
Create : access function
(Bundle : in Util.Properties.Bundles.Manager'Class)
return ASF.Models.Selects.Select_Item_List)
return Util.Beans.Basic.Readonly_Bean_Access;
-- Append the selector list from the SQL query. The query will be executed.
-- It should return rows with at least two columns. The first column is the
-- selector value and the second column is the selector label.
procedure Append_From_Query (Into : in out ASF.Models.Selects.Select_Item_List;
Query : in out ADO.Statements.Query_Statement'Class);
-- Create the selector list from the SQL query. The query will be executed.
-- It should return rows with at least two columns. The first column is the
-- selector value and the second column is the selector label.
function Create_From_Query (Session : in ADO.Sessions.Session'Class;
Query : in ADO.Queries.Context'Class)
return ASF.Models.Selects.Select_Item_List;
-- ------------------------------
-- Select list bean
-- ------------------------------
-- The <b>Select_List_Bean</b> type is a bean object that can be declared in XML
-- configuration files and customized by the <b>query</b> property.
type Select_List_Bean is new Util.Beans.Basic.Bean with record
List : ASF.Models.Selects.Select_Item_List;
end record;
type Select_List_Bean_Access is access all Select_List_Bean;
-- Get the value identified by the name.
-- If the name cannot be found, the method should return the Null object.
overriding
function Get_Value (From : in Select_List_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the value identified by the name.
-- If the name cannot be found, the method should raise the No_Value
-- exception.
overriding
procedure Set_Value (From : in out Select_List_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- Create the select list bean instance.
function Create_Select_List_Bean return Util.Beans.Basic.Readonly_Bean_Access;
end AWA.Helpers.Selectors;
|
stcarrez/ada-asf | Ada | 10,589 | adb | -----------------------------------------------------------------------
-- asf-applications-main-tests - Unit tests for Applications
-- Copyright (C) 2011, 2012, 2014, 2019, 2021, 2022 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Test_Caller;
with Util.Beans.Objects;
with Ada.Unchecked_Deallocation;
with EL.Contexts.Default;
with ASF.Applications.Tests;
with ASF.Applications.Main.Configs;
with ASF.Requests.Mockup;
package body ASF.Applications.Main.Tests is
use Util.Tests;
function Create_Form_Bean return Util.Beans.Basic.Readonly_Bean_Access;
package Caller is new Util.Test_Caller (Test, "Applications.Main");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test ASF.Applications.Main.Read_Configuration",
Test_Read_Configuration'Access);
Caller.Add_Test (Suite, "Test ASF.Applications.Main.Create",
Test_Create_Bean'Access);
Caller.Add_Test (Suite, "Test ASF.Applications.Main.Load_Bundle",
Test_Load_Bundle'Access);
Caller.Add_Test (Suite, "Test ASF.Applications.Main.Register,Load_Bundle",
Test_Bundle_Configuration'Access);
Caller.Add_Test (Suite, "Test ASF.Applications.Main.Get_Supported_Locales",
Test_Locales'Access);
end Add_Tests;
-- ------------------------------
-- Initialize the test application
-- ------------------------------
overriding
procedure Set_Up (T : in out Test) is
Fact : ASF.Applications.Main.Application_Factory;
C : ASF.Applications.Config;
begin
T.App := new ASF.Applications.Main.Application;
C.Copy (Util.Tests.Get_Properties);
T.App.Initialize (C, Fact);
T.App.Register ("layoutMsg", "layout");
end Set_Up;
-- ------------------------------
-- Deletes the application object
-- ------------------------------
overriding
procedure Tear_Down (T : in out Test) is
procedure Free is
new Ada.Unchecked_Deallocation (Object => ASF.Applications.Main.Application'Class,
Name => ASF.Applications.Main.Application_Access);
begin
Free (T.App);
end Tear_Down;
function Create_Form_Bean return Util.Beans.Basic.Readonly_Bean_Access is
Result : constant Applications.Tests.Form_Bean_Access := new Applications.Tests.Form_Bean;
begin
return Result.all'Access;
end Create_Form_Bean;
-- ------------------------------
-- Test creation of module
-- ------------------------------
procedure Test_Read_Configuration (T : in out Test) is
Path : constant String := Util.Tests.Get_Path ("config/empty.xml");
begin
ASF.Applications.Main.Configs.Read_Configuration (T.App.all, Path);
end Test_Read_Configuration;
-- ------------------------------
-- Test creation of a module and registration in an application.
-- ------------------------------
procedure Test_Create_Bean (T : in out Test) is
use type Util.Beans.Basic.Readonly_Bean_Access;
procedure Check (Name : in String;
Kind : in ASF.Beans.Scope_Type);
procedure Check (Name : in String;
Kind : in ASF.Beans.Scope_Type) is
Value : Util.Beans.Objects.Object;
Bean : Util.Beans.Basic.Readonly_Bean_Access;
Scope : ASF.Beans.Scope_Type;
Context : EL.Contexts.Default.Default_Context;
begin
T.App.Create (Name => Ada.Strings.Unbounded.To_Unbounded_String (Name),
Context => Context,
Result => Bean,
Scope => Scope);
T.Assert (Kind = Scope, "Invalid scope for " & Name);
T.Assert (Bean /= null, "Invalid bean object");
Value := Util.Beans.Objects.To_Object (Bean);
T.Assert (not Util.Beans.Objects.Is_Null (Value), "Invalid bean");
-- Special test for the sessionForm bean which is initialized by configuration properties
if Name = "sessionForm" then
T.Assert_Equals ("[email protected]",
Util.Beans.Objects.To_String (Bean.Get_Value ("email")),
"Session form not initialized");
end if;
end Check;
Path : constant String := Util.Tests.Get_Path ("regtests/config/test-module.xml");
begin
T.App.Register_Class ("ASF.Applications.Tests.Form_Bean", Create_Form_Bean'Access);
ASF.Applications.Main.Configs.Read_Configuration (T.App.all, Path);
-- Check the 'regtests/config/test-module.xml' managed bean configuration.
Check ("applicationForm", ASF.Beans.APPLICATION_SCOPE);
Check ("sessionForm", ASF.Beans.SESSION_SCOPE);
Check ("requestForm", ASF.Beans.REQUEST_SCOPE);
end Test_Create_Bean;
-- ------------------------------
-- Test loading a resource bundle through the application.
-- ------------------------------
procedure Test_Load_Bundle (T : in out Test) is
Path : constant String := Util.Tests.Get_Path ("regtests/config/test-bundle.xml");
Bundle : ASF.Locales.Bundle;
begin
ASF.Applications.Main.Configs.Read_Configuration (T.App.all, Path);
T.App.Load_Bundle (Name => "samples",
Locale => "en",
Bundle => Bundle);
Util.Tests.Assert_Equals (T, "Help", String '(Bundle.Get ("layout_help_label")),
"Invalid bundle value");
T.App.Load_Bundle (Name => "asf",
Locale => "en",
Bundle => Bundle);
Util.Tests.Assert_Matches (T, ".*greater than.*",
String '(Bundle.Get ("validators.length.maximum")),
"Invalid bundle value");
end Test_Load_Bundle;
-- ------------------------------
-- Test application configuration and registration of resource bundles.
-- ------------------------------
procedure Test_Bundle_Configuration (T : in out Test) is
use type Util.Beans.Basic.Readonly_Bean_Access;
Path : constant String := Util.Tests.Get_Path ("regtests/config/test-bundle.xml");
Result : Util.Beans.Basic.Readonly_Bean_Access;
Context : aliased ASF.Contexts.Faces.Faces_Context;
Ctx : aliased EL.Contexts.Default.Default_Context;
Scope : Scope_Type;
begin
Context.Set_ELContext (Ctx'Unchecked_Access);
ASF.Applications.Main.Configs.Read_Configuration (T.App.all, Path);
T.App.Set_Context (Context'Unchecked_Access);
T.App.Create (Name => Ada.Strings.Unbounded.To_Unbounded_String ("samplesMsg"),
Context => Ctx,
Result => Result,
Scope => Scope);
T.Assert (Result /= null, "The samplesMsg bundle was not created");
T.App.Create (Name => Ada.Strings.Unbounded.To_Unbounded_String ("defaultMsg"),
Context => Ctx,
Result => Result,
Scope => Scope);
T.Assert (Result /= null, "The defaultMsg bundle was not created");
end Test_Bundle_Configuration;
-- ------------------------------
-- Test locales.
-- ------------------------------
procedure Test_Locales (T : in out Test) is
use Util.Locales;
Path : constant String := Util.Tests.Get_Path ("regtests/config/test-locales.xml");
Req : aliased ASF.Requests.Mockup.Request;
View : constant access Applications.Views.View_Handler'Class := T.App.Get_View_Handler;
Context : aliased ASF.Contexts.Faces.Faces_Context;
ELContext : aliased EL.Contexts.Default.Default_Context;
Locale : Util.Locales.Locale;
begin
ASF.Applications.Main.Configs.Read_Configuration (T.App.all, Path);
Util.Tests.Assert_Equals (T, To_String (Util.Locales.FRENCH),
To_String (T.App.Get_Default_Locale),
"Invalid default locale");
Context.Set_ELContext (ELContext'Unchecked_Access);
Context.Set_Request (Req'Unchecked_Access);
Req.Set_Header ("Accept-Language", "da, en-gb;q=0.3, fr;q=0.7");
T.App.Set_Context (Context'Unchecked_Access);
Locale := View.Calculate_Locale (Context);
Util.Tests.Assert_Equals (T, To_String (Util.Locales.FRENCH),
To_String (Locale),
"Invalid calculated locale");
Req.Set_Header ("Accept-Language", "da, en-gb, en;q=0.8, fr;q=0.7");
T.App.Set_Context (Context'Unchecked_Access);
Locale := View.Calculate_Locale (Context);
Util.Tests.Assert_Equals (T, "en_GB",
To_String (Locale),
"Invalid calculated locale");
Req.Set_Header ("Accept-Language", "da, fr;q=0.7, fr-fr;q=0.8");
T.App.Set_Context (Context'Unchecked_Access);
Locale := View.Calculate_Locale (Context);
Util.Tests.Assert_Equals (T, "fr_FR",
To_String (Locale),
"Invalid calculated locale");
Req.Set_Header ("Accept-Language", "da, ru, it;q=0.8, de;q=0.7");
T.App.Set_Context (Context'Unchecked_Access);
Locale := View.Calculate_Locale (Context);
Util.Tests.Assert_Equals (T, To_String (Util.Locales.FRENCH),
To_String (Locale),
"Invalid calculated locale");
end Test_Locales;
end ASF.Applications.Main.Tests;
|
tum-ei-rcs/StratoX | Ada | 30 | adb | ../../../lib/units-vectors.adb |
AdaCore/gpr | Ada | 4,578 | adb | --
-- Copyright (C) 2020-2023, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0
--
with Ada.Exceptions;
with Ada.Text_IO;
with GNAT.Directory_Operations;
with GPR2.Context;
with GPR2.Log;
with GPR2.Path_Name;
with GPR2.Project.Tree;
procedure Main is
Tree : GPR2.Project.Tree.Object;
Context : GPR2.Context.Object;
use GPR2;
procedure Print_Messages is
begin
for C in Tree.Log_Messages.Iterate
(Information => False,
Warning => not Tree.Log_Messages.Has_Error, -- Show warning only when no error
Error => True,
Read => False,
Unread => True)
loop
Ada.Text_IO.Put_Line (GPR2.Log.Element (C).Format);
end loop;
end Print_Messages;
procedure Test (Project_Name : GPR2.Filename_Type;
Implicit : Boolean := False)
is
Old_Cwd : constant GNAT.Directory_Operations.Dir_Name_Str :=
GNAT.Directory_Operations.Get_Current_Dir;
Gpr_Path : constant GPR2.Path_Name.Object :=
(if not Implicit
then GPR2.Path_Name.Create_File (Project_Name)
else GPR2.Path_Name.Create_Directory (Project_Name));
Gpr_Dir : constant GNAT.Directory_Operations.Dir_Name_Str :=
String (Gpr_Path.Dir_Name);
begin
Tree.Unload;
GNAT.Directory_Operations.Change_Dir (Gpr_Dir);
Tree.Load_Autoconf
(Filename => Gpr_Path,
Context => Context);
Tree.Update_Sources;
Print_Messages;
GNAT.Directory_Operations.Change_Dir (Old_Cwd);
exception
when Project_Error =>
Print_Messages;
GNAT.Directory_Operations.Change_Dir (Old_Cwd);
when E : others =>
Ada.Text_IO.Put_Line ("!!! Uncaught exception raised !!!");
Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Information (E));
GNAT.Directory_Operations.Change_Dir (Old_Cwd);
end Test;
begin
Ada.Text_IO.Put_Line ("** builtins: external");
Ada.Text_IO.New_Line;
Test ("builtins/external/empty.gpr");
Test ("builtins/external/non_string.gpr");
Test ("builtins/external/non_string2.gpr");
Test ("builtins/external/empty_string.gpr");
Test ("builtins/external/three_arg.gpr");
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("** builtins: external_as_list");
Ada.Text_IO.New_Line;
Test ("builtins/external_as_list/empty.gpr");
Test ("builtins/external_as_list/non_string.gpr");
Test ("builtins/external_as_list/non_string2.gpr");
Test ("builtins/external_as_list/empty_string.gpr");
Test ("builtins/external_as_list/empty_string2.gpr");
Test ("builtins/external_as_list/one_arg.gpr");
Test ("builtins/external_as_list/three_arg.gpr");
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("** builtins: split");
Ada.Text_IO.New_Line;
Test ("builtins/split/empty.gpr");
Test ("builtins/split/non_string.gpr");
Test ("builtins/split/non_string2.gpr");
Test ("builtins/split/empty_string2.gpr");
Test ("builtins/split/one_arg.gpr");
Test ("builtins/split/three_arg.gpr");
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("** packages:");
Ada.Text_IO.New_Line;
Test ("packages/extends_nonexist.gpr");
Test ("packages/extends_nonexist2.gpr");
Test ("packages/renames_nonexist.gpr");
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("** attributes:");
Ada.Text_IO.New_Line;
Test ("attributes/conf.gpr");
Test ("attributes/builtin.gpr");
Test ("attributes/empty_warning.gpr");
Test ("attributes/empty_error.gpr");
Test ("attributes/no_package.gpr");
Test ("attributes/no_package2.gpr");
Test ("attributes/unexpected_index.gpr");
Test ("attributes/unexpected_index2.gpr");
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("** variables:");
Ada.Text_IO.New_Line;
Test ("variables/undef_project_ref.gpr");
Test ("variables/in_pack.gpr");
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("** projects:");
Ada.Text_IO.New_Line;
Test ("projects/no_lang.gpr");
Test ("projects/agg_lib_shared_libdir.gpr");
Test ("projects/agg_lib_shared_libdir2.gpr");
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("** naming convention:");
Ada.Text_IO.New_Line;
Test ("naming/dot_repl_is_dot.gpr");
Test ("naming/name_except.gpr");
Test ("naming/same_suffix.gpr");
Test ("naming/same_suffix2.gpr");
Test ("naming/same_suffix3.gpr");
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("** configuration:");
Ada.Text_IO.New_Line;
Test ("config", True);
end Main;
|
onox/orka | Ada | 2,539 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2016 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package Orka.SIMD.AVX.Doubles.Math is
pragma Pure;
function Min (Left, Right : m256d) return m256d
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_minpd256";
-- Compare each 64-bit double in Left and Right and take the minimum values.
--
-- Result (I) := Double'Min (Left (I), Right (I)) for I in 1 ..4
function Max (Left, Right : m256d) return m256d
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_maxpd256";
-- Compare each 64-bit double in Left and Right and take the maximum values.
--
-- Result (I) := Double'Max (Left (I), Right (I)) for I in 1 ..4
function Reciprocal_Sqrt (Elements : m256d) return m256d
with Inline_Always;
-- Return the reciprocal of the square root (1/Sqrt(X)) of each element
function Sqrt (Elements : m256d) return m256d
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_sqrtpd256";
-- Return the square root (Sqrt(X)) of each element
function Round (Elements : m256d; Rounding : Integer_32) return m256d
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_roundpd256";
function Round_Nearest_Integer (Elements : m256d) return m256d is
(Round (Elements, 0))
with Inline;
-- Round each element to the nearest integer
function Floor (Elements : m256d) return m256d is
(Round (Elements, 1))
with Inline;
-- Round each element down to an integer value
function Ceil (Elements : m256d) return m256d is
(Round (Elements, 2))
with Inline;
-- Round each element up to an integer value
function Round_Truncate (Elements : m256d) return m256d is
(Round (Elements, 3))
with Inline;
-- Round each element to zero
function Cross_Product (Left, Right : m256d) return m256d
with Inline_Always;
end Orka.SIMD.AVX.Doubles.Math;
|
reznikmm/matreshka | Ada | 3,694 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Draw_Object_Attributes is
pragma Preelaborate;
type ODF_Draw_Object_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Draw_Object_Attribute_Access is
access all ODF_Draw_Object_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Draw_Object_Attributes;
|
stcarrez/ada-awa | Ada | 1,646 | adb | -----------------------------------------------------------------------
-- awa-mail-components -- Mail UI Components
-- Copyright (C) 2012 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ASF.Components.Base;
with AWA.Mail.Components.Messages;
package body AWA.Mail.Components is
-- ------------------------------
-- Get the mail message instance.
-- ------------------------------
function Get_Message (UI : in UIMailComponent) return AWA.Mail.Clients.Mail_Message_Access is
use type ASF.Components.Base.UIComponent_Access;
Parent : ASF.Components.Base.UIComponent_Access := UI.Get_Parent;
begin
while Parent /= null loop
if Parent.all in AWA.Mail.Components.Messages.UIMailMessage'Class then
return AWA.Mail.Components.Messages.UIMailMessage'Class (Parent.all).Get_Message;
end if;
Parent := Parent.Get_Parent;
end loop;
return null;
end Get_Message;
end AWA.Mail.Components;
|
LiberatorUSA/GUCEF | Ada | 1,807 | ads | with Agar.Core.Thin;
with Interfaces;
package Agar.Core.Data_Source is
subtype Data_Source_Access_t is Thin.Data_Source.Data_Source_Access_t;
subtype Data_Source_Not_Null_Access_t is Thin.Data_Source.Data_Source_Not_Null_Access_t;
--
-- Open.
--
procedure Open_File
(Path : in String;
Mode : in String;
Source : out Data_Source_Access_t);
--
-- I/O
--
type IO_Status_t is new Thin.Data_Source.IO_Status_t;
subtype Byte_Offset_t is Interfaces.Unsigned_64;
generic
type Element_Type is private;
type Element_Count_Type is range <>;
type Element_Array_Index_Type is (<>);
type Element_Array_Type is array (Element_Array_Index_Type range <>) of Element_Type;
package IO is
procedure Read
(Source : in Data_Source_Not_Null_Access_t;
Buffer : out Element_Array_Type;
Read : out Element_Count_Type;
Status : out IO_Status_t);
procedure Read_At_Offset
(Source : in Data_Source_Not_Null_Access_t;
Offset : in Byte_Offset_t;
Buffer : out Element_Array_Type;
Read : out Element_Count_Type;
Status : out IO_Status_t);
procedure Write
(Source : in Data_Source_Not_Null_Access_t;
Buffer : in Element_Array_Type;
Wrote : out Element_Count_Type;
Status : out IO_Status_t);
procedure Write_At_Offset
(Source : in Data_Source_Not_Null_Access_t;
Offset : in Byte_Offset_t;
Buffer : in Element_Array_Type;
Wrote : out Element_Count_Type;
Status : out IO_Status_t);
end IO;
--
-- Close.
--
procedure Close_File
(Source : in Data_Source_Not_Null_Access_t);
end Agar.Core.Data_Source;
|
msrLi/portingSources | Ada | 822 | adb | -- Copyright 2012-2014 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package body Classes is
procedure Draw (R : Circle) is
begin
null;
end Draw;
end Classes;
|
Gabriel-Degret/adalib | Ada | 543 | ads | -- Standard Ada library specification
-- Copyright (c) 2003-2018 Maxim Reznik <[email protected]>
-- Copyright (c) 2004-2016 AXE Consultants
-- Copyright (c) 2004, 2005, 2006 Ada-Europe
-- Copyright (c) 2000 The MITRE Corporation, Inc.
-- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
-- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
---------------------------------------------------------------------------
with Ada.Direct_IO;
generic package Direct_IO renames Ada.Direct_IO;
|
tum-ei-rcs/StratoX | Ada | 1,197 | ads | -- Institution: Technische Universität München
-- Department: Realtime Computer Systems (RCS)
-- Project: StratoX
-- Module: Software Configuration
--
-- Authors: Martin Becker ([email protected])
-- @summary
-- Target-specific types for the devices that are exposed
-- in hil-i2c et. al in Pixhawk.
package HIL.Devices with SPARK_Mode is
type Device_Type_I2C is (UNKNOWN, MAGNETOMETER);
type Device_Type_SPI is (Barometer, Magneto, MPU6000, FRAM, Extern);
type Device_Type_UART is (GPS, Console, PX4IO);
type Device_Type_GPIO is (RED_LED,
SPI_CS_BARO,
SPI_CS_MPU6000,
SPI_CS_LSM303D,
SPI_CS_L3GD20H,
SPI_CS_FRAM,
SPI_CS_EXT
);
-- INTERRUPT PRIOS, ALL AT ONE PLACE. Must decide who wins here.
IRQ_PRIO_UART4 : constant := 251; -- must be higher, because too low could result in loss of data
IRQ_PRIO_UART_LOG : constant := 249;
IRQ_PRIO_SDIO : constant := 250; -- sdcard: can be lower. only affects throughput, not data integrity.
end HIL.Devices;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 2,434 | adb | with Interfaces; use Interfaces;
with STM32GD;
with STM32_SVD; use STM32_SVD;
with STM32GD.Board;
with STM32GD.Power;
procedure Main is
package Board renames STM32GD.Board;
package Text_IO renames STM32GD.Board.Text_IO;
package Radio renames STM32GD.Board.Radio;
procedure Print_Registers is new Radio.Print_Registers (Put_Line => Text_IO.Put_Line);
Line : String (1 .. 8);
Len : Natural;
procedure RX_Test is
RX_Address : constant Radio.Address_Type := 0;
Packet: Radio.Packet_Type (1 .. 48);
Length : Byte;
begin
Text_IO.Put_Line ("Starting RX test");
Radio.Set_RX_Address (RX_Address);
Radio.RX_Mode;
Board.IRQ.Configure_Trigger (Rising => True);
STM32GD.Clear_Event;
loop
STM32GD.Board.LED.Toggle;
STM32GD.Wait_For_Event;
if Radio.RX_Available then
Text_IO.Put_Line ("Packet received");
Print_Registers;
Radio.Clear_IRQ;
Radio.RX (Packet, Length);
for I in 1 .. Length loop
Text_IO.Put_Hex (Unsigned_32 (Packet (I)), 2);
end loop;
Text_IO.New_Line;
end if;
end loop;
end RX_Test;
procedure TX_Test is
Broadcast_Address : constant Radio.Address_Type := 0;
TX_Data : constant Radio.Packet_Type := (
-- 16#01#, 16#02#, 16#03#, 16#04#, 16#05#, 16#06#, 16#07#, 16#08#, 16#09#
16#00#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#55#
);
begin
Text_IO.Put_Line ("Starting TX test");
Radio.Set_TX_Address (Broadcast_Address);
Radio.TX_Mode;
loop
Text_IO.Put_Line ("Press <enter>");
Text_IO.Get_Line (Line, Len);
STM32GD.Board.LED.Toggle;
Radio.TX (TX_Data, 9);
Print_Registers;
end loop;
end TX_Test;
procedure Power_Down_Test is
begin
Radio.Power_Down;
Board.Disable_Peripherals;
STM32GD.Power.Enable_Stop;
loop STM32GD.Wait_For_Interrupt; end loop;
end Power_Down_Test;
begin
Board.Init;
Text_IO.Put_Line ("Starting RFM69 Test");
Radio.Init;
Print_Registers;
Text_IO.Put_Line ("r: RX test -- t: TX test -- others: Power down");
Text_IO.Get_Line (Line, Len);
case Line (Line'First) is
when 'r' => RX_Test;
when 't' => TX_Test;
when others => Power_Down_Test;
end case;
end Main;
|
sungyeon/drake | Ada | 4,529 | adb | with Ada.Unchecked_Deallocation;
package body Ada.Containers.Forward_Iterators is
pragma Check_Policy (Validate => Ignore);
procedure Free is new Unchecked_Deallocation (Element_Type, Element_Access);
procedure Free is new Unchecked_Deallocation (Node, Node_Access);
procedure Retain (Node : not null Node_Access);
procedure Retain (Node : not null Node_Access) is
begin
Node.Reference_Count := Node.Reference_Count + 1;
end Retain;
procedure Release (Node : in out Node_Access);
procedure Release (Node : in out Node_Access) is
Item : Node_Access := Node;
begin
while Item /= null loop
Item.Reference_Count := Item.Reference_Count - 1;
exit when Item.Reference_Count > 0;
declare
Next : constant Node_Access := Item.Next;
begin
Free (Item.Item);
Free (Item);
Item := Next;
end;
end loop;
Node := null;
end Release;
procedure Update_Last (Object : in out Iterator);
procedure Update_Last (Object : in out Iterator) is
begin
if not Has_Element (Object.Last_Input_Cursor) then
Object.State := No_Element;
Release (Object.Last);
else
declare
New_Node : constant Node_Access :=
new Node'(
Reference_Count => 1,
Next => null,
Item =>
new Element_Type'(Element (Object.Last_Input_Cursor)));
begin
if Object.Last /= null then
pragma Check (Validate, Object.Last.Next = null);
Object.Last.Next := New_Node;
Retain (New_Node);
Release (Object.Last);
end if;
Object.Last := New_Node;
end;
end if;
end Update_Last;
-- implementation
function Has_Element (Position : Cursor) return Boolean is
begin
return Controlled.Reference (Position) /= null;
end Has_Element;
function Constant_Reference (Position : Cursor)
return Constant_Reference_Type is
begin
return (Element => Controlled.Reference (Position).Item.all'Access);
end Constant_Reference;
function Iterate return Iterator_Interfaces.Forward_Iterator'Class is
begin
return Result : Iterator :=
(Finalization.Limited_Controlled
with
Last_Input_Cursor =>
Input_Iterator_Interfaces.First (Input_Iterator),
Last => null,
State => First)
do
Update_Last (Result);
end return;
end Iterate;
package body Controlled is
function Create (Node : Node_Access) return Cursor is
begin
if Node /= null then
Retain (Node);
end if;
return (Finalization.Controlled with Node => Node);
end Create;
function Reference (Position : Forward_Iterators.Cursor)
return Node_Access is
begin
return Cursor (Position).Node;
end Reference;
overriding procedure Adjust (Object : in out Cursor) is
begin
if Object.Node /= null then
Retain (Object.Node);
end if;
end Adjust;
overriding procedure Finalize (Object : in out Cursor) is
begin
Release (Object.Node);
end Finalize;
end Controlled;
overriding procedure Finalize (Object : in out Iterator) is
begin
Release (Object.Last);
end Finalize;
overriding function First (Object : Iterator) return Cursor is
pragma Check (Pre,
Check => Object.State = First or else raise Status_Error);
begin
return Create (Object.Last);
end First;
overriding function Next (Object : Iterator; Position : Cursor)
return Cursor
is
Mutable_Object : Iterator
renames Object'Unrestricted_Access.all;
Result_Node : Node_Access := Controlled.Reference (Position).Next;
begin
if Result_Node = null then
-- Position is the current last
if Mutable_Object.State /= No_Element then
Mutable_Object.State := Next;
Mutable_Object.Last_Input_Cursor :=
Input_Iterator_Interfaces.Next (
Input_Iterator,
Mutable_Object.Last_Input_Cursor);
Update_Last (Mutable_Object);
end if;
Result_Node := Mutable_Object.Last;
end if;
return Create (Result_Node);
end Next;
end Ada.Containers.Forward_Iterators;
|
docandrew/troodon | Ada | 40,032 | ads | pragma Ada_2012;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with stdarg_h;
with bits_types_h;
with bits_types_u_fpos_t_h;
with bits_types_u_fpos64_t_h;
limited with bits_types_FILE_h;
with Interfaces.C.Strings;
with System;
with bits_types_cookie_io_functions_t_h;
with stddef_h;
package stdio_h is
BUFSIZ : constant := 8192; -- /usr/include/stdio.h:99
EOF : constant := (-1); -- /usr/include/stdio.h:104
SEEK_SET : constant := 0; -- /usr/include/stdio.h:109
SEEK_CUR : constant := 1; -- /usr/include/stdio.h:110
SEEK_END : constant := 2; -- /usr/include/stdio.h:111
SEEK_DATA : constant := 3; -- /usr/include/stdio.h:113
SEEK_HOLE : constant := 4; -- /usr/include/stdio.h:114
P_tmpdir : aliased constant String := "/tmp" & ASCII.NUL; -- /usr/include/stdio.h:120
-- unsupported macro: stdin stdin
-- unsupported macro: stdout stdout
-- unsupported macro: stderr stderr
RENAME_NOREPLACE : constant := (2 ** 0); -- /usr/include/stdio.h:158
RENAME_EXCHANGE : constant := (2 ** 1); -- /usr/include/stdio.h:159
RENAME_WHITEOUT : constant := (2 ** 2); -- /usr/include/stdio.h:160
-- Define ISO C stdio on top of C++ iostreams.
-- Copyright (C) 1991-2021 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
-- The GNU C Library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <https://www.gnu.org/licenses/>.
-- * ISO C99 Standard: 7.19 Input/output <stdio.h>
--
subtype va_list is stdarg_h.uu_gnuc_va_list; -- /usr/include/stdio.h:52
subtype off_t is bits_types_h.uu_off_t; -- /usr/include/stdio.h:63
subtype off64_t is bits_types_h.uu_off64_t; -- /usr/include/stdio.h:70
subtype ssize_t is bits_types_h.uu_ssize_t; -- /usr/include/stdio.h:77
-- The type of the second argument to `fgetpos' and `fsetpos'.
subtype fpos_t is bits_types_u_fpos_t_h.uu_fpos_t; -- /usr/include/stdio.h:84
subtype fpos64_t is bits_types_u_fpos64_t_h.uu_fpos64_t; -- /usr/include/stdio.h:89
-- The possibilities for the third argument to `setvbuf'.
-- Default buffer size.
-- The value returned by fgetc and similar functions to indicate the
-- end of the file.
-- The possibilities for the third argument to `fseek'.
-- These values should not be changed.
-- Default path prefix for `tempnam' and `tmpnam'.
-- Get the values:
-- L_tmpnam How long an array of chars must be to be passed to `tmpnam'.
-- TMP_MAX The minimum number of unique filenames generated by tmpnam
-- (and tempnam when it uses tmpnam's name space),
-- or tempnam (the two are separate).
-- L_ctermid How long an array to pass to `ctermid'.
-- L_cuserid How long an array to pass to `cuserid'.
-- FOPEN_MAX Minimum number of files that can be open at once.
-- FILENAME_MAX Maximum length of a filename.
-- Standard streams.
-- Standard input stream.
stdin : access bits_types_FILE_h.FILE -- /usr/include/stdio.h:137
with Import => True,
Convention => C,
External_Name => "stdin";
-- Standard output stream.
stdout : access bits_types_FILE_h.FILE -- /usr/include/stdio.h:138
with Import => True,
Convention => C,
External_Name => "stdout";
-- Standard error output stream.
stderr : access bits_types_FILE_h.FILE -- /usr/include/stdio.h:139
with Import => True,
Convention => C,
External_Name => "stderr";
-- C89/C99 say they're macros. Make them happy.
-- Remove file FILENAME.
function remove (uu_filename : Interfaces.C.Strings.chars_ptr) return int -- /usr/include/stdio.h:146
with Import => True,
Convention => C,
External_Name => "remove";
-- Rename file OLD to NEW.
function rename (uu_old : Interfaces.C.Strings.chars_ptr; uu_new : Interfaces.C.Strings.chars_ptr) return int -- /usr/include/stdio.h:148
with Import => True,
Convention => C,
External_Name => "rename";
-- Rename file OLD relative to OLDFD to NEW relative to NEWFD.
function renameat
(uu_oldfd : int;
uu_old : Interfaces.C.Strings.chars_ptr;
uu_newfd : int;
uu_new : Interfaces.C.Strings.chars_ptr) return int -- /usr/include/stdio.h:152
with Import => True,
Convention => C,
External_Name => "renameat";
-- Flags for renameat2.
-- Rename file OLD relative to OLDFD to NEW relative to NEWFD, with
-- additional flags.
function renameat2
(uu_oldfd : int;
uu_old : Interfaces.C.Strings.chars_ptr;
uu_newfd : int;
uu_new : Interfaces.C.Strings.chars_ptr;
uu_flags : unsigned) return int -- /usr/include/stdio.h:164
with Import => True,
Convention => C,
External_Name => "renameat2";
-- Create a temporary file and open it read/write.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function tmpfile return access bits_types_FILE_h.FILE -- /usr/include/stdio.h:173
with Import => True,
Convention => C,
External_Name => "tmpfile";
function tmpfile64 return access bits_types_FILE_h.FILE -- /usr/include/stdio.h:183
with Import => True,
Convention => C,
External_Name => "tmpfile64";
-- Generate a temporary filename.
function tmpnam (uu_s : Interfaces.C.Strings.chars_ptr) return Interfaces.C.Strings.chars_ptr -- /usr/include/stdio.h:187
with Import => True,
Convention => C,
External_Name => "tmpnam";
-- This is the reentrant variant of `tmpnam'. The only difference is
-- that it does not allow S to be NULL.
function tmpnam_r (uu_s : Interfaces.C.Strings.chars_ptr) return Interfaces.C.Strings.chars_ptr -- /usr/include/stdio.h:192
with Import => True,
Convention => C,
External_Name => "tmpnam_r";
-- Generate a unique temporary filename using up to five characters of PFX
-- if it is not NULL. The directory to put this file in is searched for
-- as follows: First the environment variable "TMPDIR" is checked.
-- If it contains the name of a writable directory, that directory is used.
-- If not and if DIR is not NULL, that value is checked. If that fails,
-- P_tmpdir is tried and finally "/tmp". The storage for the filename
-- is allocated by `malloc'.
function tempnam (uu_dir : Interfaces.C.Strings.chars_ptr; uu_pfx : Interfaces.C.Strings.chars_ptr) return Interfaces.C.Strings.chars_ptr -- /usr/include/stdio.h:204
with Import => True,
Convention => C,
External_Name => "tempnam";
-- Close STREAM.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function fclose (uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:213
with Import => True,
Convention => C,
External_Name => "fclose";
-- Flush STREAM, or all streams if STREAM is NULL.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function fflush (uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:218
with Import => True,
Convention => C,
External_Name => "fflush";
-- Faster versions when locking is not required.
-- This function is not part of POSIX and therefore no official
-- cancellation point. But due to similarity with an POSIX interface
-- or due to the implementation it is a cancellation point and
-- therefore not marked with __THROW.
function fflush_unlocked (uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:227
with Import => True,
Convention => C,
External_Name => "fflush_unlocked";
-- Close all streams.
-- This function is not part of POSIX and therefore no official
-- cancellation point. But due to similarity with an POSIX interface
-- or due to the implementation it is a cancellation point and
-- therefore not marked with __THROW.
function fcloseall return int -- /usr/include/stdio.h:237
with Import => True,
Convention => C,
External_Name => "fcloseall";
-- Open a file and create a new stream for it.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function fopen (uu_filename : Interfaces.C.Strings.chars_ptr; uu_modes : Interfaces.C.Strings.chars_ptr) return access bits_types_FILE_h.FILE -- /usr/include/stdio.h:246
with Import => True,
Convention => C,
External_Name => "fopen";
-- Open a file, replacing an existing stream with it.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function freopen
(uu_filename : Interfaces.C.Strings.chars_ptr;
uu_modes : Interfaces.C.Strings.chars_ptr;
uu_stream : access bits_types_FILE_h.FILE) return access bits_types_FILE_h.FILE -- /usr/include/stdio.h:252
with Import => True,
Convention => C,
External_Name => "freopen";
function fopen64 (uu_filename : Interfaces.C.Strings.chars_ptr; uu_modes : Interfaces.C.Strings.chars_ptr) return access bits_types_FILE_h.FILE -- /usr/include/stdio.h:270
with Import => True,
Convention => C,
External_Name => "fopen64";
function freopen64
(uu_filename : Interfaces.C.Strings.chars_ptr;
uu_modes : Interfaces.C.Strings.chars_ptr;
uu_stream : access bits_types_FILE_h.FILE) return access bits_types_FILE_h.FILE -- /usr/include/stdio.h:272
with Import => True,
Convention => C,
External_Name => "freopen64";
-- Create a new stream that refers to an existing system file descriptor.
function fdopen (uu_fd : int; uu_modes : Interfaces.C.Strings.chars_ptr) return access bits_types_FILE_h.FILE -- /usr/include/stdio.h:279
with Import => True,
Convention => C,
External_Name => "fdopen";
-- Create a new stream that refers to the given magic cookie,
-- and uses the given functions for input and output.
function fopencookie
(uu_magic_cookie : System.Address;
uu_modes : Interfaces.C.Strings.chars_ptr;
uu_io_funcs : bits_types_cookie_io_functions_t_h.cookie_io_functions_t) return access bits_types_FILE_h.FILE -- /usr/include/stdio.h:285
with Import => True,
Convention => C,
External_Name => "fopencookie";
-- Create a new stream that refers to a memory buffer.
function fmemopen
(uu_s : System.Address;
uu_len : stddef_h.size_t;
uu_modes : Interfaces.C.Strings.chars_ptr) return access bits_types_FILE_h.FILE -- /usr/include/stdio.h:292
with Import => True,
Convention => C,
External_Name => "fmemopen";
-- Open a stream that writes into a malloc'd buffer that is expanded as
-- necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
-- and the number of characters written on fflush or fclose.
function open_memstream (uu_bufloc : System.Address; uu_sizeloc : access stddef_h.size_t) return access bits_types_FILE_h.FILE -- /usr/include/stdio.h:298
with Import => True,
Convention => C,
External_Name => "open_memstream";
-- If BUF is NULL, make STREAM unbuffered.
-- Else make it use buffer BUF, of size BUFSIZ.
procedure setbuf (uu_stream : access bits_types_FILE_h.FILE; uu_buf : Interfaces.C.Strings.chars_ptr) -- /usr/include/stdio.h:304
with Import => True,
Convention => C,
External_Name => "setbuf";
-- Make STREAM use buffering mode MODE.
-- If BUF is not NULL, use N bytes of it for buffering;
-- else allocate an internal buffer N bytes long.
function setvbuf
(uu_stream : access bits_types_FILE_h.FILE;
uu_buf : Interfaces.C.Strings.chars_ptr;
uu_modes : int;
uu_n : stddef_h.size_t) return int -- /usr/include/stdio.h:308
with Import => True,
Convention => C,
External_Name => "setvbuf";
-- If BUF is NULL, make STREAM unbuffered.
-- Else make it use SIZE bytes of BUF for buffering.
procedure setbuffer
(uu_stream : access bits_types_FILE_h.FILE;
uu_buf : Interfaces.C.Strings.chars_ptr;
uu_size : stddef_h.size_t) -- /usr/include/stdio.h:314
with Import => True,
Convention => C,
External_Name => "setbuffer";
-- Make STREAM line-buffered.
procedure setlinebuf (uu_stream : access bits_types_FILE_h.FILE) -- /usr/include/stdio.h:318
with Import => True,
Convention => C,
External_Name => "setlinebuf";
-- Write formatted output to STREAM.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function fprintf (uu_stream : access bits_types_FILE_h.FILE; uu_format : Interfaces.C.Strings.chars_ptr -- , ...
) return int -- /usr/include/stdio.h:326
with Import => True,
Convention => C,
External_Name => "fprintf";
-- Write formatted output to stdout.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function printf (uu_format : Interfaces.C.Strings.chars_ptr -- , ...
) return int -- /usr/include/stdio.h:332
with Import => True,
Convention => C,
External_Name => "printf";
-- Write formatted output to S.
function sprintf (uu_s : Interfaces.C.Strings.chars_ptr; uu_format : Interfaces.C.Strings.chars_ptr -- , ...
) return int -- /usr/include/stdio.h:334
with Import => True,
Convention => C,
External_Name => "sprintf";
-- Write formatted output to S from argument list ARG.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function vfprintf
(uu_s : access bits_types_FILE_h.FILE;
uu_format : Interfaces.C.Strings.chars_ptr;
uu_arg : access System.Address) return int -- /usr/include/stdio.h:341
with Import => True,
Convention => C,
External_Name => "vfprintf";
-- Write formatted output to stdout from argument list ARG.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function vprintf (uu_format : Interfaces.C.Strings.chars_ptr; uu_arg : access System.Address) return int -- /usr/include/stdio.h:347
with Import => True,
Convention => C,
External_Name => "vprintf";
-- Write formatted output to S from argument list ARG.
function vsprintf
(uu_s : Interfaces.C.Strings.chars_ptr;
uu_format : Interfaces.C.Strings.chars_ptr;
uu_arg : access System.Address) return int -- /usr/include/stdio.h:349
with Import => True,
Convention => C,
External_Name => "vsprintf";
-- Maximum chars of output to write in MAXLEN.
function snprintf
(uu_s : Interfaces.C.Strings.chars_ptr;
uu_maxlen : stddef_h.size_t;
uu_format : Interfaces.C.Strings.chars_ptr -- , ...
) return int -- /usr/include/stdio.h:354
with Import => True,
Convention => C,
External_Name => "snprintf";
function vsnprintf
(uu_s : Interfaces.C.Strings.chars_ptr;
uu_maxlen : stddef_h.size_t;
uu_format : Interfaces.C.Strings.chars_ptr;
uu_arg : access System.Address) return int -- /usr/include/stdio.h:358
with Import => True,
Convention => C,
External_Name => "vsnprintf";
-- Write formatted output to a string dynamically allocated with `malloc'.
-- Store the address of the string in *PTR.
function vasprintf
(uu_ptr : System.Address;
uu_f : Interfaces.C.Strings.chars_ptr;
uu_arg : access System.Address) return int -- /usr/include/stdio.h:366
with Import => True,
Convention => C,
External_Name => "vasprintf";
-- skipped func __asprintf
function asprintf (uu_ptr : System.Address; uu_fmt : Interfaces.C.Strings.chars_ptr -- , ...
) return int -- /usr/include/stdio.h:372
with Import => True,
Convention => C,
External_Name => "asprintf";
-- Write formatted output to a file descriptor.
function vdprintf
(uu_fd : int;
uu_fmt : Interfaces.C.Strings.chars_ptr;
uu_arg : access System.Address) return int -- /usr/include/stdio.h:379
with Import => True,
Convention => C,
External_Name => "vdprintf";
function dprintf (uu_fd : int; uu_fmt : Interfaces.C.Strings.chars_ptr -- , ...
) return int -- /usr/include/stdio.h:382
with Import => True,
Convention => C,
External_Name => "dprintf";
-- Read formatted input from STREAM.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
-- Read formatted input from stdin.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
-- Read formatted input from S.
-- For historical reasons, the C99-compliant versions of the scanf
-- functions are at alternative names. When __LDBL_COMPAT or
-- __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in
-- bits/stdio-ldbl.h.
function fscanf (uu_stream : access bits_types_FILE_h.FILE; uu_format : Interfaces.C.Strings.chars_ptr -- , ...
) return int -- /usr/include/stdio.h:410
with Import => True,
Convention => C,
External_Name => "__isoc99_fscanf";
function scanf (uu_format : Interfaces.C.Strings.chars_ptr -- , ...
) return int -- /usr/include/stdio.h:413
with Import => True,
Convention => C,
External_Name => "__isoc99_scanf";
function sscanf (uu_s : Interfaces.C.Strings.chars_ptr; uu_format : Interfaces.C.Strings.chars_ptr -- , ...
) return int -- /usr/include/stdio.h:415
with Import => True,
Convention => C,
External_Name => "__isoc99_sscanf";
-- Read formatted input from S into argument list ARG.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
-- Read formatted input from stdin into argument list ARG.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
-- Read formatted input from S into argument list ARG.
-- Same redirection as above for the v*scanf family.
function vfscanf
(uu_s : access bits_types_FILE_h.FILE;
uu_format : Interfaces.C.Strings.chars_ptr;
uu_arg : access System.Address) return int -- /usr/include/stdio.h:455
with Import => True,
Convention => C,
External_Name => "__isoc99_vfscanf";
function vscanf (uu_format : Interfaces.C.Strings.chars_ptr; uu_arg : access System.Address) return int -- /usr/include/stdio.h:460
with Import => True,
Convention => C,
External_Name => "__isoc99_vscanf";
function vsscanf
(uu_s : Interfaces.C.Strings.chars_ptr;
uu_format : Interfaces.C.Strings.chars_ptr;
uu_arg : access System.Address) return int -- /usr/include/stdio.h:463
with Import => True,
Convention => C,
External_Name => "__isoc99_vsscanf";
-- Read a character from STREAM.
-- These functions are possible cancellation points and therefore not
-- marked with __THROW.
function fgetc (uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:489
with Import => True,
Convention => C,
External_Name => "fgetc";
function getc (uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:490
with Import => True,
Convention => C,
External_Name => "getc";
-- Read a character from stdin.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function getchar return int -- /usr/include/stdio.h:496
with Import => True,
Convention => C,
External_Name => "getchar";
-- These are defined in POSIX.1:1996.
-- These functions are possible cancellation points and therefore not
-- marked with __THROW.
function getc_unlocked (uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:503
with Import => True,
Convention => C,
External_Name => "getc_unlocked";
function getchar_unlocked return int -- /usr/include/stdio.h:504
with Import => True,
Convention => C,
External_Name => "getchar_unlocked";
-- Faster version when locking is not necessary.
-- This function is not part of POSIX and therefore no official
-- cancellation point. But due to similarity with an POSIX interface
-- or due to the implementation it is a cancellation point and
-- therefore not marked with __THROW.
function fgetc_unlocked (uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:514
with Import => True,
Convention => C,
External_Name => "fgetc_unlocked";
-- Write a character to STREAM.
-- These functions are possible cancellation points and therefore not
-- marked with __THROW.
-- These functions is a possible cancellation point and therefore not
-- marked with __THROW.
function fputc (uu_c : int; uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:525
with Import => True,
Convention => C,
External_Name => "fputc";
function putc (uu_c : int; uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:526
with Import => True,
Convention => C,
External_Name => "putc";
-- Write a character to stdout.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function putchar (uu_c : int) return int -- /usr/include/stdio.h:532
with Import => True,
Convention => C,
External_Name => "putchar";
-- Faster version when locking is not necessary.
-- This function is not part of POSIX and therefore no official
-- cancellation point. But due to similarity with an POSIX interface
-- or due to the implementation it is a cancellation point and
-- therefore not marked with __THROW.
function fputc_unlocked (uu_c : int; uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:541
with Import => True,
Convention => C,
External_Name => "fputc_unlocked";
-- These are defined in POSIX.1:1996.
-- These functions are possible cancellation points and therefore not
-- marked with __THROW.
function putc_unlocked (uu_c : int; uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:549
with Import => True,
Convention => C,
External_Name => "putc_unlocked";
function putchar_unlocked (uu_c : int) return int -- /usr/include/stdio.h:550
with Import => True,
Convention => C,
External_Name => "putchar_unlocked";
-- Get a word (int) from STREAM.
function getw (uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:557
with Import => True,
Convention => C,
External_Name => "getw";
-- Write a word (int) to STREAM.
function putw (uu_w : int; uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:560
with Import => True,
Convention => C,
External_Name => "putw";
-- Get a newline-terminated string of finite length from STREAM.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function fgets
(uu_s : Interfaces.C.Strings.chars_ptr;
uu_n : int;
uu_stream : access bits_types_FILE_h.FILE) return Interfaces.C.Strings.chars_ptr -- /usr/include/stdio.h:568
with Import => True,
Convention => C,
External_Name => "fgets";
-- Get a newline-terminated string from stdin, removing the newline.
-- This function is impossible to use safely. It has been officially
-- removed from ISO C11 and ISO C++14, and we have also removed it
-- from the _GNU_SOURCE feature list. It remains available when
-- explicitly using an old ISO C, Unix, or POSIX standard.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
-- This function does the same as `fgets' but does not lock the stream.
-- This function is not part of POSIX and therefore no official
-- cancellation point. But due to similarity with an POSIX interface
-- or due to the implementation it is a cancellation point and
-- therefore not marked with __THROW.
function fgets_unlocked
(uu_s : Interfaces.C.Strings.chars_ptr;
uu_n : int;
uu_stream : access bits_types_FILE_h.FILE) return Interfaces.C.Strings.chars_ptr -- /usr/include/stdio.h:591
with Import => True,
Convention => C,
External_Name => "fgets_unlocked";
-- Read up to (and including) a DELIMITER from STREAM into *LINEPTR
-- (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
-- NULL), pointing to *N characters of space. It is realloc'd as
-- necessary. Returns the number of characters read (not including the
-- null terminator), or -1 on error or EOF.
-- These functions are not part of POSIX and therefore no official
-- cancellation point. But due to similarity with an POSIX interface
-- or due to the implementation they are cancellation points and
-- therefore not marked with __THROW.
-- skipped func __getdelim
function getdelim
(uu_lineptr : System.Address;
uu_n : access stddef_h.size_t;
uu_delimiter : int;
uu_stream : access bits_types_FILE_h.FILE) return bits_types_h.uu_ssize_t -- /usr/include/stdio.h:611
with Import => True,
Convention => C,
External_Name => "getdelim";
-- Like `getdelim', but reads up to a newline.
-- This function is not part of POSIX and therefore no official
-- cancellation point. But due to similarity with an POSIX interface
-- or due to the implementation it is a cancellation point and
-- therefore not marked with __THROW.
function getline
(uu_lineptr : System.Address;
uu_n : access stddef_h.size_t;
uu_stream : access bits_types_FILE_h.FILE) return bits_types_h.uu_ssize_t -- /usr/include/stdio.h:621
with Import => True,
Convention => C,
External_Name => "getline";
-- Write a string to STREAM.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function fputs (uu_s : Interfaces.C.Strings.chars_ptr; uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:631
with Import => True,
Convention => C,
External_Name => "fputs";
-- Write a string, followed by a newline, to stdout.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function puts (uu_s : Interfaces.C.Strings.chars_ptr) return int -- /usr/include/stdio.h:637
with Import => True,
Convention => C,
External_Name => "puts";
-- Push a character back onto the input buffer of STREAM.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function ungetc (uu_c : int; uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:644
with Import => True,
Convention => C,
External_Name => "ungetc";
-- Read chunks of generic data from STREAM.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function fread
(uu_ptr : System.Address;
uu_size : stddef_h.size_t;
uu_n : stddef_h.size_t;
uu_stream : access bits_types_FILE_h.FILE) return stddef_h.size_t -- /usr/include/stdio.h:651
with Import => True,
Convention => C,
External_Name => "fread";
-- Write chunks of generic data to STREAM.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function fwrite
(uu_ptr : System.Address;
uu_size : stddef_h.size_t;
uu_n : stddef_h.size_t;
uu_s : access bits_types_FILE_h.FILE) return stddef_h.size_t -- /usr/include/stdio.h:657
with Import => True,
Convention => C,
External_Name => "fwrite";
-- This function does the same as `fputs' but does not lock the stream.
-- This function is not part of POSIX and therefore no official
-- cancellation point. But due to similarity with an POSIX interface
-- or due to the implementation it is a cancellation point and
-- therefore not marked with __THROW.
function fputs_unlocked (uu_s : Interfaces.C.Strings.chars_ptr; uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:667
with Import => True,
Convention => C,
External_Name => "fputs_unlocked";
-- Faster versions when locking is not necessary.
-- These functions are not part of POSIX and therefore no official
-- cancellation point. But due to similarity with an POSIX interface
-- or due to the implementation they are cancellation points and
-- therefore not marked with __THROW.
function fread_unlocked
(uu_ptr : System.Address;
uu_size : stddef_h.size_t;
uu_n : stddef_h.size_t;
uu_stream : access bits_types_FILE_h.FILE) return stddef_h.size_t -- /usr/include/stdio.h:678
with Import => True,
Convention => C,
External_Name => "fread_unlocked";
function fwrite_unlocked
(uu_ptr : System.Address;
uu_size : stddef_h.size_t;
uu_n : stddef_h.size_t;
uu_stream : access bits_types_FILE_h.FILE) return stddef_h.size_t -- /usr/include/stdio.h:680
with Import => True,
Convention => C,
External_Name => "fwrite_unlocked";
-- Seek to a certain position on STREAM.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function fseek
(uu_stream : access bits_types_FILE_h.FILE;
uu_off : long;
uu_whence : int) return int -- /usr/include/stdio.h:689
with Import => True,
Convention => C,
External_Name => "fseek";
-- Return the current position of STREAM.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function ftell (uu_stream : access bits_types_FILE_h.FILE) return long -- /usr/include/stdio.h:694
with Import => True,
Convention => C,
External_Name => "ftell";
-- Rewind to the beginning of STREAM.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
procedure rewind (uu_stream : access bits_types_FILE_h.FILE) -- /usr/include/stdio.h:699
with Import => True,
Convention => C,
External_Name => "rewind";
-- The Single Unix Specification, Version 2, specifies an alternative,
-- more adequate interface for the two functions above which deal with
-- file offset. `long int' is not the right type. These definitions
-- are originally defined in the Large File Support API.
-- Seek to a certain position on STREAM.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function fseeko
(uu_stream : access bits_types_FILE_h.FILE;
uu_off : bits_types_h.uu_off_t;
uu_whence : int) return int -- /usr/include/stdio.h:712
with Import => True,
Convention => C,
External_Name => "fseeko";
-- Return the current position of STREAM.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function ftello (uu_stream : access bits_types_FILE_h.FILE) return bits_types_h.uu_off_t -- /usr/include/stdio.h:717
with Import => True,
Convention => C,
External_Name => "ftello";
-- Get STREAM's position.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function fgetpos (uu_stream : access bits_types_FILE_h.FILE; uu_pos : access fpos_t) return int -- /usr/include/stdio.h:736
with Import => True,
Convention => C,
External_Name => "fgetpos";
-- Set STREAM's position.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function fsetpos (uu_stream : access bits_types_FILE_h.FILE; uu_pos : access constant fpos_t) return int -- /usr/include/stdio.h:741
with Import => True,
Convention => C,
External_Name => "fsetpos";
function fseeko64
(uu_stream : access bits_types_FILE_h.FILE;
uu_off : bits_types_h.uu_off64_t;
uu_whence : int) return int -- /usr/include/stdio.h:755
with Import => True,
Convention => C,
External_Name => "fseeko64";
function ftello64 (uu_stream : access bits_types_FILE_h.FILE) return bits_types_h.uu_off64_t -- /usr/include/stdio.h:756
with Import => True,
Convention => C,
External_Name => "ftello64";
function fgetpos64 (uu_stream : access bits_types_FILE_h.FILE; uu_pos : access fpos64_t) return int -- /usr/include/stdio.h:757
with Import => True,
Convention => C,
External_Name => "fgetpos64";
function fsetpos64 (uu_stream : access bits_types_FILE_h.FILE; uu_pos : access constant fpos64_t) return int -- /usr/include/stdio.h:758
with Import => True,
Convention => C,
External_Name => "fsetpos64";
-- Clear the error and EOF indicators for STREAM.
procedure clearerr (uu_stream : access bits_types_FILE_h.FILE) -- /usr/include/stdio.h:762
with Import => True,
Convention => C,
External_Name => "clearerr";
-- Return the EOF indicator for STREAM.
function feof (uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:764
with Import => True,
Convention => C,
External_Name => "feof";
-- Return the error indicator for STREAM.
function ferror (uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:766
with Import => True,
Convention => C,
External_Name => "ferror";
-- Faster versions when locking is not required.
procedure clearerr_unlocked (uu_stream : access bits_types_FILE_h.FILE) -- /usr/include/stdio.h:770
with Import => True,
Convention => C,
External_Name => "clearerr_unlocked";
function feof_unlocked (uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:771
with Import => True,
Convention => C,
External_Name => "feof_unlocked";
function ferror_unlocked (uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:772
with Import => True,
Convention => C,
External_Name => "ferror_unlocked";
-- Print a message describing the meaning of the value of errno.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
procedure perror (uu_s : Interfaces.C.Strings.chars_ptr) -- /usr/include/stdio.h:780
with Import => True,
Convention => C,
External_Name => "perror";
-- Return the system file descriptor for STREAM.
function fileno (uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:785
with Import => True,
Convention => C,
External_Name => "fileno";
-- Faster version when locking is not required.
function fileno_unlocked (uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:790
with Import => True,
Convention => C,
External_Name => "fileno_unlocked";
-- Create a new stream connected to a pipe running the given command.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function popen (uu_command : Interfaces.C.Strings.chars_ptr; uu_modes : Interfaces.C.Strings.chars_ptr) return access bits_types_FILE_h.FILE -- /usr/include/stdio.h:799
with Import => True,
Convention => C,
External_Name => "popen";
-- Close a stream opened by popen and return the status of its child.
-- This function is a possible cancellation point and therefore not
-- marked with __THROW.
function pclose (uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:805
with Import => True,
Convention => C,
External_Name => "pclose";
-- Return the name of the controlling terminal.
function ctermid (uu_s : Interfaces.C.Strings.chars_ptr) return Interfaces.C.Strings.chars_ptr -- /usr/include/stdio.h:811
with Import => True,
Convention => C,
External_Name => "ctermid";
-- Return the name of the current user.
function cuserid (uu_s : Interfaces.C.Strings.chars_ptr) return Interfaces.C.Strings.chars_ptr -- /usr/include/stdio.h:817
with Import => True,
Convention => C,
External_Name => "cuserid";
-- See <obstack.h>.
type obstack is null record; -- incomplete struct
-- Write formatted output to an obstack.
function obstack_printf (uu_obstack : access obstack; uu_format : Interfaces.C.Strings.chars_ptr -- , ...
) return int -- /usr/include/stdio.h:825
with Import => True,
Convention => C,
External_Name => "obstack_printf";
function obstack_vprintf
(uu_obstack : access obstack;
uu_format : Interfaces.C.Strings.chars_ptr;
uu_args : access System.Address) return int -- /usr/include/stdio.h:828
with Import => True,
Convention => C,
External_Name => "obstack_vprintf";
-- These are defined in POSIX.1:1996.
-- Acquire ownership of STREAM.
procedure flockfile (uu_stream : access bits_types_FILE_h.FILE) -- /usr/include/stdio.h:839
with Import => True,
Convention => C,
External_Name => "flockfile";
-- Try to acquire ownership of STREAM but do not block if it is not
-- possible.
function ftrylockfile (uu_stream : access bits_types_FILE_h.FILE) return int -- /usr/include/stdio.h:843
with Import => True,
Convention => C,
External_Name => "ftrylockfile";
-- Relinquish the ownership granted for STREAM.
procedure funlockfile (uu_stream : access bits_types_FILE_h.FILE) -- /usr/include/stdio.h:846
with Import => True,
Convention => C,
External_Name => "funlockfile";
-- X/Open Issues 1-5 required getopt to be declared in this
-- header. It was removed in Issue 6. GNU follows Issue 6.
-- Slow-path routines used by the optimized inline functions in
-- bits/stdio.h.
-- skipped func __uflow
-- skipped func __overflow
-- If we are compiling with optimizing read this file. It contains
-- several optimizing inline functions and macros.
end stdio_h;
|
reznikmm/matreshka | Ada | 3,714 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Style_Font_Name_Attributes is
pragma Preelaborate;
type ODF_Style_Font_Name_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Style_Font_Name_Attribute_Access is
access all ODF_Style_Font_Name_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Style_Font_Name_Attributes;
|
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.Buttons_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Table_Buttons_Attribute_Node is
begin
return Self : Table_Buttons_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_Buttons_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Buttons_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Table_URI,
Matreshka.ODF_String_Constants.Buttons_Attribute,
Table_Buttons_Attribute_Node'Tag);
end Matreshka.ODF_Table.Buttons_Attributes;
|
Coder206/learn | Ada | 184 | adb | with Int_To_String;
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
begin
pragma Assert (Int_To_String (12) = "12");
pragma Assert (Int_To_String (-12) = "-12");
end Main;
|
optikos/oasis | Ada | 409 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package Program.Storage_Pools.Instance is
Pool : aliased Storage_Pool;
Pool_Access : constant Storage_Pool_Access := Pool'Access
with Export, External_Name => "pool_access";
end Program.Storage_Pools.Instance;
|
onox/json-ada | Ada | 8,697 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2016 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
private with Ada.Containers.Vectors;
private with Ada.Containers.Indefinite_Vectors;
with Ada.Iterator_Interfaces;
with JSON.Streams;
generic
type Integer_Type is range <>;
type Float_Type is digits <>;
Maximum_Number_Length : Positive := 30;
package JSON.Types is
pragma Preelaborate;
Maximum_String_Length_Numbers : constant Positive := Maximum_Number_Length;
-----------------------------------------------------------------------------
-- Memory allocator --
-----------------------------------------------------------------------------
type Memory_Allocator
(Maximum_Depth : Positive) is private;
type Memory_Allocator_Ptr is not null access all Memory_Allocator;
-----------------------------------------------------------------------------
type Value_Kind is
(Array_Kind,
Object_Kind,
String_Kind,
Integer_Kind,
Float_Kind,
Boolean_Kind,
Null_Kind);
type JSON_Value (Kind : Value_Kind) is tagged private
with Constant_Indexing => Constant_Reference,
Default_Iterator => Iterate,
Iterator_Element => JSON_Value;
function Image (Object : JSON_Value) return String;
-- Value will raise an Invalid_Type_Error exception if
-- the JSON value is of the wrong kind
function Value (Object : JSON_Value) return String;
function Value (Object : JSON_Value) return Integer_Type;
function Value (Object : JSON_Value) return Float_Type;
function Value (Object : JSON_Value) return Boolean;
function Length (Object : JSON_Value) return Natural;
-- Object must be a JSON array or object
function Contains (Object : JSON_Value; Key : String) return Boolean;
-- Return True if the JSON object contains a key-value pair for
-- the given key
--
-- This function has a time complexity of O(n).
--
-- Object must be a JSON object.
function Get (Object : JSON_Value; Index : Positive) return JSON_Value;
-- Return the JSON value at the given index in the JSON array
--
-- Object must be a JSON array.
function Get (Object : JSON_Value; Key : String) return JSON_Value;
-- Return the JSON value for the given key in the JSON object
--
-- This function has a time complexity of O(n).
--
-- Object must be a JSON object.
Invalid_Type_Error : exception;
-----------------------------------------------------------------------------
procedure Append (Object : in out JSON_Value; Value : JSON_Value);
-- Internal procedure
procedure Insert
(Object : in out JSON_Value;
Key : JSON_Value;
Value : JSON_Value;
Check_Duplicate_Keys : Boolean)
with Pre => Key.Kind = String_Kind;
-- Internal procedure
-----------------------------------------------------------------------------
-- Helpers --
-----------------------------------------------------------------------------
function Get_Array_Or_Empty
(Object : JSON_Value; Key : String) return JSON_Value
with Inline;
function Get_Object_Or_Empty
(Object : JSON_Value; Key : String) return JSON_Value
with Inline;
function Get
(Object : JSON_Value;
Key : String;
Default : Integer_Type) return JSON_Value
with Inline;
function Get
(Object : JSON_Value;
Key : String;
Default : Float_Type) return JSON_Value
with Inline;
function Get
(Object : JSON_Value;
Key : String;
Default : Boolean) return JSON_Value
with Inline;
-----------------------------------------------------------------------------
-- Constructors --
-----------------------------------------------------------------------------
function Create_String
(Stream : Streams.Stream_Ptr;
Offset, Length : Streams.AS.Stream_Element_Offset) return JSON_Value;
function Create_Integer (Value : Integer_Type) return JSON_Value;
function Create_Float (Value : Float_Type) return JSON_Value;
function Create_Boolean (Value : Boolean) return JSON_Value;
function Create_Null return JSON_Value;
function Create_Array
(Allocator : Memory_Allocator_Ptr;
Depth : Positive) return JSON_Value;
function Create_Object
(Allocator : Memory_Allocator_Ptr;
Depth : Positive) return JSON_Value;
-----------------------------------------------------------------------------
-- Iterating --
-----------------------------------------------------------------------------
function Constant_Reference (Object : JSON_Value; Index : Positive)
return JSON_Value;
-- For Ada 2012 indexing syntax
function Constant_Reference (Object : JSON_Value; Key : String)
return JSON_Value;
-- For Ada 2012 indexing syntax
type Cursor (<>) is private;
function Constant_Reference (Object : aliased JSON_Value; Position : Cursor)
return JSON_Value;
function Has_Element (Position : Cursor) return Boolean;
package Value_Iterator_Interfaces is
new Ada.Iterator_Interfaces (Cursor, Has_Element);
function Iterate (Object : JSON_Value)
return Value_Iterator_Interfaces.Forward_Iterator'Class;
private
subtype Array_Offset is Natural;
type JSON_Value (Kind : Value_Kind) is tagged record
case Kind is
when Array_Kind | Object_Kind =>
Allocator : Memory_Allocator_Ptr;
Depth : Positive;
Offset : Array_Offset;
Length : Natural;
when String_Kind =>
Stream : Streams.Stream_Ptr;
String_Offset, String_Length : Streams.AS.Stream_Element_Offset;
when Integer_Kind =>
Integer_Value : Integer_Type;
when Float_Kind =>
Float_Value : Float_Type;
when Boolean_Kind =>
Boolean_Value : Boolean;
when Null_Kind =>
null;
end case;
end record;
-----------------------------------------------------------------------------
-- Iterating --
-----------------------------------------------------------------------------
subtype Iterator_Kind is Value_Kind range Array_Kind .. Object_Kind;
type Cursor (Kind : Iterator_Kind) is record
Data : JSON_Value (Kind => Kind);
Index : Natural;
end record;
type Iterator (Kind : Iterator_Kind) is limited
new Value_Iterator_Interfaces.Forward_Iterator with
record
Data : JSON_Value (Kind => Kind);
end record;
overriding function First (Object : Iterator) return Cursor;
overriding function Next
(Object : Iterator;
Position : Cursor) return Cursor;
-----------------------------------------------------------------------------
-- Memory allocator --
-----------------------------------------------------------------------------
type Array_Value (Kind : Value_Kind := Null_Kind) is record
Value : JSON_Value (Kind => Kind);
end record;
type Key_Value_Pair (Kind : Value_Kind := Null_Kind) is record
Key : JSON_Value (Kind => String_Kind);
Element : JSON_Value (Kind => Kind);
end record;
package Array_Vectors is new Ada.Containers.Vectors (Positive, Array_Value);
package Object_Vectors is new Ada.Containers.Indefinite_Vectors (Positive, Key_Value_Pair);
type Array_Level_Array is array (Positive range <>) of Array_Vectors.Vector;
type Object_Level_Array is array (Positive range <>) of Object_Vectors.Vector;
type Memory_Allocator
(Maximum_Depth : Positive) is
record
Array_Levels : Array_Level_Array (1 .. Maximum_Depth);
Object_Levels : Object_Level_Array (1 .. Maximum_Depth);
end record;
end JSON.Types;
|
reznikmm/matreshka | Ada | 4,009 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Text_Select_Page_Attributes;
package Matreshka.ODF_Text.Select_Page_Attributes is
type Text_Select_Page_Attribute_Node is
new Matreshka.ODF_Text.Abstract_Text_Attribute_Node
and ODF.DOM.Text_Select_Page_Attributes.ODF_Text_Select_Page_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Text_Select_Page_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Text_Select_Page_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Text.Select_Page_Attributes;
|
sungyeon/drake | Ada | 1,046 | ads | pragma License (Unrestricted);
-- implementation unit required by compiler
with System.Wid_WChar;
package System.Wwd_WChar is
pragma Pure;
-- required for Wide_Character'Wide_Width by compiler (s-wwwdwch.ads)
function Wide_Width_Wide_Character (Lo, Hi : Wide_Character) return Natural
renames Wid_WChar.Width_Wide_Character;
-- required for Wide_Wide_Character'Wide_Width by compiler (s-wwwdwch.ads)
function Wide_Width_Wide_Wide_Character (Lo, Hi : Wide_Wide_Character)
return Natural
renames Wid_WChar.Width_Wide_Wide_Character;
-- required for Wide_Character'Wide_Wide_Width by compiler (s-wwwdwch.ads)
function Wide_Wide_Width_Wide_Character (Lo, Hi : Wide_Character)
return Natural
renames Wid_WChar.Width_Wide_Character;
-- required for Wide_Wide_Character'Wide_Wide_Width by compiler
-- (s-wwwdwch.ads)
function Wide_Wide_Width_Wide_Wide_Char (Lo, Hi : Wide_Wide_Character)
return Natural
renames Wid_WChar.Width_Wide_Wide_Character;
end System.Wwd_WChar;
|
reznikmm/matreshka | Ada | 7,099 | 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_Comments is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Comment_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_Comment
(AMF.UML.Comments.UML_Comment_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Comment_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_Comment
(AMF.UML.Comments.UML_Comment_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Comment_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_Comment
(Visitor,
AMF.UML.Comments.UML_Comment_Access (Self),
Control);
end if;
end Visit_Element;
---------------------------
-- Get_Annotated_Element --
---------------------------
overriding function Get_Annotated_Element
(Self : not null access constant UML_Comment_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element is
begin
return
AMF.UML.Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Annotated_Element
(Self.Element)));
end Get_Annotated_Element;
--------------
-- Get_Body --
--------------
overriding function Get_Body
(Self : not null access constant UML_Comment_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_Body (Self.Element);
begin
if Aux = null then
return (Is_Empty => True);
else
return (False, League.Strings.Internals.Create (Aux));
end if;
end;
end Get_Body;
--------------
-- Set_Body --
--------------
overriding procedure Set_Body
(Self : not null access UML_Comment_Proxy;
To : AMF.Optional_String) is
begin
if To.Is_Empty then
AMF.Internals.Tables.UML_Attributes.Internal_Set_Body
(Self.Element, null);
else
AMF.Internals.Tables.UML_Attributes.Internal_Set_Body
(Self.Element,
League.Strings.Internals.Internal (To.Value));
end if;
end Set_Body;
end AMF.Internals.UML_Comments;
|
davidkristola/vole | Ada | 782 | ads | with Ada.Finalization;
with kv.avm.Control;
limited with kv.avm.Instances;
package kv.avm.Warrants is
type Warrant_Type is new Ada.Finalization.Controlled with private;
overriding procedure Initialize (Self : in out Warrant_Type);
overriding procedure Adjust (Self : in out Warrant_Type);
overriding procedure Finalize (Self : in out Warrant_Type);
procedure Initialize
(Self : in out Warrant_Type;
Machine : in kv.avm.Control.Control_Access;
Instance : access kv.avm.Instances.Instance_Type);
private
type Warrant_Type is new Ada.Finalization.Controlled with
record
Machine : kv.avm.Control.Control_Access;
Instance : access kv.avm.Instances.Instance_Type;
end record;
end kv.avm.Warrants;
|
godunko/adawebpack | Ada | 1,277 | adb |
with Web.DOM.Event_Listeners;
with Web.DOM.Events;
with Web.HTML.Buttons;
with Web.HTML.Elements;
with Web.Strings;
with Web.Window;
package body Demo is
function "+" (Item : Wide_Wide_String) return Web.Strings.Web_String
renames Web.Strings.To_Web_String;
type Listener is
limited new Web.DOM.Event_Listeners.Event_Listener with null record;
overriding procedure Handle_Event
(Self : in out Listener;
Event : in out Web.DOM.Events.Event'Class);
L : aliased Listener;
------------------
-- Handle_Event --
------------------
overriding procedure Handle_Event
(Self : in out Listener;
Event : in out Web.DOM.Events.Event'Class)
is
X : Web.HTML.Elements.HTML_Element
:= Web.Window.Document.Get_Element_By_Id (+"toggle_label");
begin
X.Set_Hidden (not X.Get_Hidden);
end Handle_Event;
---------------------
-- Initialize_Demo --
---------------------
procedure Initialize_Demo is
B : Web.HTML.Buttons.HTML_Button_Element
:= Web.Window.Document.Get_Element_By_Id
(+"toggle_button").As_HTML_Button;
begin
B.Add_Event_Listener (+"click", L'Access);
B.Set_Disabled (False);
end Initialize_Demo;
begin
Initialize_Demo;
end Demo;
|
charlie5/lace | Ada | 19,089 | adb |
-- Note: This code is derived from the ADAR.CSH public domain Ada 83 versions
-- of the Appendix C string handling packages. One change is to avoid the use
-- of Is_In, so that we are not dependent on inlining. Note that the search
-- function implementations are to be found in the auxiliary package
-- Ada.Strings.Search. Also the Move procedure is directly incorporated (ADAR
-- used a subunit for this procedure). The number of errors having to do with
-- bounds of function return results were also fixed, and use of & removed for
-- efficiency reasons.
with
lace.Strings.search;
package body lace.Strings.fixed
is
use ada.Strings.Maps;
------------------------
-- Search Subprograms --
------------------------
function Index
(Source : String;
Pattern : String;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
renames lace.Strings.Search.Index;
function Index
(Source : String;
Pattern : String;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function) return Natural
renames lace.Strings.Search.Index;
function Index
(Source : String;
Set : Maps.Character_Set;
Test : Membership := Inside;
Going : Direction := Forward) return Natural
renames lace.Strings.Search.Index;
function Index
(Source : String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
renames lace.Strings.Search.Index;
function Index
(Source : String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function) return Natural
renames lace.Strings.Search.Index;
function Index
(Source : String;
Set : Maps.Character_Set;
From : Positive;
Test : Membership := Inside;
Going : Direction := Forward) return Natural
renames lace.Strings.Search.Index;
function Index_Non_Blank
(Source : String;
Going : Direction := Forward) return Natural
renames lace.Strings.Search.Index_Non_Blank;
function Index_Non_Blank
(Source : String;
From : Positive;
Going : Direction := Forward) return Natural
renames lace.Strings.Search.Index_Non_Blank;
function Count
(Source : String;
Pattern : String;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
renames lace.Strings.Search.Count;
function Count
(Source : String;
Pattern : String;
Mapping : Maps.Character_Mapping_Function) return Natural
renames lace.Strings.Search.Count;
function Count
(Source : String;
Set : Maps.Character_Set) return Natural
renames lace.Strings.Search.Count;
procedure Find_Token
(Source : String;
Set : Maps.Character_Set;
From : Positive;
Test : Membership;
First : out Positive;
Last : out Natural)
renames lace.Strings.Search.Find_Token;
procedure Find_Token
(Source : String;
Set : Maps.Character_Set;
Test : Membership;
First : out Positive;
Last : out Natural)
renames lace.Strings.Search.Find_Token;
---------
-- "*" --
---------
function "*"
(Left : Natural;
Right : Character) return String
is
Result : String (1 .. Left);
begin
for J in Result'Range loop
Result (J) := Right;
end loop;
return Result;
end "*";
function "*"
(Left : Natural;
Right : String) return String
is
Result : String (1 .. Left * Right'Length);
Ptr : Integer := 1;
begin
for J in 1 .. Left loop
Result (Ptr .. Ptr + Right'Length - 1) := Right;
Ptr := Ptr + Right'Length;
end loop;
return Result;
end "*";
------------
-- Delete --
------------
function Delete
(Source : String;
From : Positive;
Through : Natural) return String
is
begin
if From > Through then
declare
subtype Result_Type is String (1 .. Source'Length);
begin
return Result_Type (Source);
end;
elsif From not in Source'Range
or else Through > Source'Last
then
-- In most cases this raises an exception, but the case of deleting
-- a null string at the end of the current one is a special-case, and
-- reflects the equivalence with Replace_String (RM A.4.3 (86/3)).
if From = Source'Last + 1 and then From = Through then
return Source;
else
raise Index_Error;
end if;
else
declare
Front : constant Integer := From - Source'First;
Result : String (1 .. Source'Length - (Through - From + 1));
begin
Result (1 .. Front) :=
Source (Source'First .. From - 1);
Result (Front + 1 .. Result'Last) :=
Source (Through + 1 .. Source'Last);
return Result;
end;
end if;
end Delete;
procedure Delete
(Source : in out String;
From : Positive;
Through : Natural;
Justify : Alignment := Left;
Pad : Character := Space)
is
begin
Move (Source => Delete (Source, From, Through),
Target => Source,
Justify => Justify,
Pad => Pad);
end Delete;
----------
-- Head --
----------
function Head
(Source : String;
Count : Natural;
Pad : Character := Space) return String
is
subtype Result_Type is String (1 .. Count);
begin
if Count < Source'Length then
return
Result_Type (Source (Source'First .. Source'First + Count - 1));
else
declare
Result : Result_Type;
begin
Result (1 .. Source'Length) := Source;
for J in Source'Length + 1 .. Count loop
Result (J) := Pad;
end loop;
return Result;
end;
end if;
end Head;
procedure Head
(Source : in out String;
Count : Natural;
Justify : Alignment := Left;
Pad : Character := Space)
is
begin
Move (Source => Head (Source, Count, Pad),
Target => Source,
Drop => Error,
Justify => Justify,
Pad => Pad);
end Head;
------------
-- Insert --
------------
function Insert
(Source : String;
Before : Positive;
New_Item : String) return String
is
Result : String (1 .. Source'Length + New_Item'Length);
Front : constant Integer := Before - Source'First;
begin
if Before not in Source'First .. Source'Last + 1 then
raise Index_Error;
end if;
Result (1 .. Front) :=
Source (Source'First .. Before - 1);
Result (Front + 1 .. Front + New_Item'Length) :=
New_Item;
Result (Front + New_Item'Length + 1 .. Result'Last) :=
Source (Before .. Source'Last);
return Result;
end Insert;
procedure Insert
(Source : in out String;
Before : Positive;
New_Item : String;
Drop : Truncation := Error)
is
begin
Move (Source => Insert (Source, Before, New_Item),
Target => Source,
Drop => Drop);
end Insert;
----------
-- Move --
----------
procedure Move
(Source : String;
Target : out String;
Drop : Truncation := Error;
Justify : Alignment := Left;
Pad : Character := Space)
is
Sfirst : constant Integer := Source'First;
Slast : constant Integer := Source'Last;
Slength : constant Integer := Source'Length;
Tfirst : constant Integer := Target'First;
Tlast : constant Integer := Target'Last;
Tlength : constant Integer := Target'Length;
function Is_Padding (Item : String) return Boolean;
-- Check if Item is all Pad characters, return True if so, False if not
function Is_Padding (Item : String) return Boolean is
begin
for J in Item'Range loop
if Item (J) /= Pad then
return False;
end if;
end loop;
return True;
end Is_Padding;
-- Start of processing for Move
begin
if Slength = Tlength then
Target := Source;
elsif Slength > Tlength then
case Drop is
when Left =>
Target := Source (Slast - Tlength + 1 .. Slast);
when Right =>
Target := Source (Sfirst .. Sfirst + Tlength - 1);
when Error =>
case Justify is
when Left =>
if Is_Padding (Source (Sfirst + Tlength .. Slast)) then
Target :=
Source (Sfirst .. Sfirst + Target'Length - 1);
else
raise Length_Error;
end if;
when Right =>
if Is_Padding (Source (Sfirst .. Slast - Tlength)) then
Target := Source (Slast - Tlength + 1 .. Slast);
else
raise Length_Error;
end if;
when Center =>
raise Length_Error;
end case;
end case;
-- Source'Length < Target'Length
else
case Justify is
when Left =>
Target (Tfirst .. Tfirst + Slength - 1) := Source;
for I in Tfirst + Slength .. Tlast loop
Target (I) := Pad;
end loop;
when Right =>
for I in Tfirst .. Tlast - Slength loop
Target (I) := Pad;
end loop;
Target (Tlast - Slength + 1 .. Tlast) := Source;
when Center =>
declare
Front_Pad : constant Integer := (Tlength - Slength) / 2;
Tfirst_Fpad : constant Integer := Tfirst + Front_Pad;
begin
for I in Tfirst .. Tfirst_Fpad - 1 loop
Target (I) := Pad;
end loop;
Target (Tfirst_Fpad .. Tfirst_Fpad + Slength - 1) := Source;
for I in Tfirst_Fpad + Slength .. Tlast loop
Target (I) := Pad;
end loop;
end;
end case;
end if;
end Move;
---------------
-- Overwrite --
---------------
function Overwrite
(Source : String;
Position : Positive;
New_Item : String) return String
is
begin
if Position not in Source'First .. Source'Last + 1 then
raise Index_Error;
end if;
declare
Result_Length : constant Natural :=
Integer'Max
(Source'Length,
Position - Source'First + New_Item'Length);
Result : String (1 .. Result_Length);
Front : constant Integer := Position - Source'First;
begin
Result (1 .. Front) :=
Source (Source'First .. Position - 1);
Result (Front + 1 .. Front + New_Item'Length) :=
New_Item;
Result (Front + New_Item'Length + 1 .. Result'Length) :=
Source (Position + New_Item'Length .. Source'Last);
return Result;
end;
end Overwrite;
procedure Overwrite
(Source : in out String;
Position : Positive;
New_Item : String;
Drop : Truncation := Right)
is
begin
Move (Source => Overwrite (Source, Position, New_Item),
Target => Source,
Drop => Drop);
end Overwrite;
-------------------
-- Replace_Slice --
-------------------
function Replace_Slice
(Source : String;
Low : Positive;
High : Natural;
By : String) return String
is
begin
if Low > Source'Last + 1 or else High < Source'First - 1 then
raise Index_Error;
end if;
if High >= Low then
declare
Front_Len : constant Integer :=
Integer'Max (0, Low - Source'First);
-- Length of prefix of Source copied to result
Back_Len : constant Integer :=
Integer'Max (0, Source'Last - High);
-- Length of suffix of Source copied to result
Result_Length : constant Integer :=
Front_Len + By'Length + Back_Len;
-- Length of result
Result : String (1 .. Result_Length);
begin
Result (1 .. Front_Len) := Source (Source'First .. Low - 1);
Result (Front_Len + 1 .. Front_Len + By'Length) := By;
Result (Front_Len + By'Length + 1 .. Result'Length) :=
Source (High + 1 .. Source'Last);
return Result;
end;
else
return Insert (Source, Before => Low, New_Item => By);
end if;
end Replace_Slice;
procedure Replace_Slice
(Source : in out String;
Low : Positive;
High : Natural;
By : String;
Drop : Truncation := Error;
Justify : Alignment := Left;
Pad : Character := Space)
is
begin
Move (Replace_Slice (Source, Low, High, By), Source, Drop, Justify, Pad);
end Replace_Slice;
----------
-- Tail --
----------
function Tail
(Source : String;
Count : Natural;
Pad : Character := Space) return String
is
subtype Result_Type is String (1 .. Count);
begin
if Count < Source'Length then
return Result_Type (Source (Source'Last - Count + 1 .. Source'Last));
-- Pad on left
else
declare
Result : Result_Type;
begin
for J in 1 .. Count - Source'Length loop
Result (J) := Pad;
end loop;
Result (Count - Source'Length + 1 .. Count) := Source;
return Result;
end;
end if;
end Tail;
procedure Tail
(Source : in out String;
Count : Natural;
Justify : Alignment := Left;
Pad : Character := Space)
is
begin
Move (Source => Tail (Source, Count, Pad),
Target => Source,
Drop => Error,
Justify => Justify,
Pad => Pad);
end Tail;
---------------
-- Translate --
---------------
function Translate
(Source : String;
Mapping : Maps.Character_Mapping) return String
is
Result : String (1 .. Source'Length);
begin
for J in Source'Range loop
Result (J - (Source'First - 1)) := Value (Mapping, Source (J));
end loop;
return Result;
end Translate;
procedure Translate
(Source : in out String;
Mapping : Maps.Character_Mapping)
is
begin
for J in Source'Range loop
Source (J) := Value (Mapping, Source (J));
end loop;
end Translate;
function Translate
(Source : String;
Mapping : Maps.Character_Mapping_Function) return String
is
Result : String (1 .. Source'Length);
pragma Unsuppress (Access_Check);
begin
for J in Source'Range loop
Result (J - (Source'First - 1)) := Mapping.all (Source (J));
end loop;
return Result;
end Translate;
procedure Translate
(Source : in out String;
Mapping : Maps.Character_Mapping_Function)
is
pragma Unsuppress (Access_Check);
begin
for J in Source'Range loop
Source (J) := Mapping.all (Source (J));
end loop;
end Translate;
----------
-- Trim --
----------
function Trim
(Source : String;
Side : Trim_End) return String
is
begin
case Side is
when ada.Strings.Left =>
declare
Low : constant Natural := Index_Non_Blank (Source, Forward);
begin
-- All blanks case
if Low = 0 then
return "";
end if;
declare
subtype Result_Type is String (1 .. Source'Last - Low + 1);
begin
return Result_Type (Source (Low .. Source'Last));
end;
end;
when ada.Strings.Right =>
declare
High : constant Natural := Index_Non_Blank (Source, Backward);
begin
-- All blanks case
if High = 0 then
return "";
end if;
declare
subtype Result_Type is String (1 .. High - Source'First + 1);
begin
return Result_Type (Source (Source'First .. High));
end;
end;
when ada.Strings.Both =>
declare
Low : constant Natural := Index_Non_Blank (Source, Forward);
begin
-- All blanks case
if Low = 0 then
return "";
end if;
declare
High : constant Natural :=
Index_Non_Blank (Source, Backward);
subtype Result_Type is String (1 .. High - Low + 1);
begin
return Result_Type (Source (Low .. High));
end;
end;
end case;
end Trim;
procedure Trim
(Source : in out String;
Side : Trim_End;
Justify : Alignment := Left;
Pad : Character := Space)
is
begin
Move (Trim (Source, Side),
Source,
Justify => Justify,
Pad => Pad);
end Trim;
function Trim
(Source : String;
Left : Maps.Character_Set;
Right : Maps.Character_Set) return String
is
High, Low : Integer;
begin
Low := Index (Source, Set => Left, Test => Outside, Going => Forward);
-- Case where source comprises only characters in Left
if Low = 0 then
return "";
end if;
High :=
Index (Source, Set => Right, Test => Outside, Going => Backward);
-- Case where source comprises only characters in Right
if High = 0 then
return "";
end if;
declare
subtype Result_Type is String (1 .. High - Low + 1);
begin
return Result_Type (Source (Low .. High));
end;
end Trim;
procedure Trim
(Source : in out String;
Left : Maps.Character_Set;
Right : Maps.Character_Set;
Justify : Alignment := ada.Strings.Left;
Pad : Character := Space)
is
begin
Move (Source => Trim (Source, Left, Right),
Target => Source,
Justify => Justify,
Pad => Pad);
end Trim;
end lace.Strings.fixed;
|
fmqa/simulatedannealing-ada | Ada | 1,697 | adb | with Ada.Numerics.Discrete_Random;
with Bitmaps.RGB;
package body ImageOps is
package Random_Luminance is new Ada.Numerics.Discrete_Random
(Bitmaps.Luminance);
Random_Luminance_G : Random_Luminance.Generator;
function Manhattan_Distance (A, B : in Bitmaps.RGB.Pixel) return Natural is
(abs (Integer (A.R) - Integer (B.R)) +
abs (Integer (A.G) - Integer (B.G)) +
abs (Integer (A.B) - Integer (B.B)));
function Adj_Distance_Sum
(Source : in Bitmaps.RGB.Image) return Long_Integer
is
S : Long_Integer := 0;
begin
for Y in 1 .. Bitmaps.RGB.Max_Y (Source) loop
for X in 1 .. Bitmaps.RGB.Max_X (Source) loop
S :=
S +
Long_Integer
(Manhattan_Distance
(Bitmaps.RGB.Get_Pixel (Source, X, Y),
Bitmaps.RGB.Get_Pixel (Source, X - 1, Y)));
S :=
S +
Long_Integer
(Manhattan_Distance
(Bitmaps.RGB.Get_Pixel (Source, X, Y),
Bitmaps.RGB.Get_Pixel (Source, X, Y - 1)));
end loop;
end loop;
return S;
end Adj_Distance_Sum;
procedure Noise (Target : in out Bitmaps.RGB.Image) is
begin
for Y in 0 .. Bitmaps.RGB.Max_Y (Target) loop
for X in 0 .. Bitmaps.RGB.Max_X (Target) loop
Bitmaps.RGB.Set_Pixel
(Target, X, Y,
(R => Random_Luminance.Random (Random_Luminance_G),
G => Random_Luminance.Random (Random_Luminance_G),
B => Random_Luminance.Random (Random_Luminance_G)));
end loop;
end loop;
end Noise;
end ImageOps;
|
docandrew/YOTROC | Ada | 15,684 | adb | with Gdk.Event;
with Gdk.Types.Keysyms;
with Gtkada.Dialogs;
with Gtkada.File_Selection;
with Gtk.Dialog;
with Gtk.File_Chooser;
with Gtk.File_Chooser_Dialog; use Gtk.File_Chooser_Dialog;
with Gtk.List_Store;
with Gtk.Message_Dialog;
with Gtk.Main;
with Gtk.Status_Bar;
with Gtk.Text_Iter;
with Gtk.Tree_Model;
with Gtk.Widget; use Gtk.Widget;
with Pango.Font;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Text_IO; use Ada.Text_IO;
with Interfaces; use Interfaces;
with assembler;
with gui;
with util;
with vm; use vm;
-- Callback procedures, called from the Gtk GUI.
package body callbacks is
-------------------------
-- Some GUI state vars --
-------------------------
-- this is so we can pop up an "are you sure?" dialog on quit/new/open
unsavedChanges : Boolean := False;
-- current filename we are saving under.
curFileName : Unbounded_String;
-- Output from our assemble procedure. We'll pass this to the VM at boot time.
machinecode : MachineCodeVector.Vector;
-- gives us a chance to catch the signal to delete the main window. If we want
-- to quit, return False.
function tryQuit (Object : access Gtkada_Builder_Record'Class) return Boolean is
pragma Unreferenced (Object);
begin
if unsavedChanges then
return not areYouSure;
end if;
return False;
end tryQuit;
procedure quit (Object : access Gtkada_Builder_Record'Class) is
begin
Gtk.Main.Main_Quit;
end quit;
----------------------------------------------------------------------------
-- assembleCB - callback for GUI "assemble" button.
-- Assemble the source code into an object file that can be loaded into the
-- VM's memory.
----------------------------------------------------------------------------
procedure assembleCB (Object : access Gtkada_Builder_Record'Class) is
pragma Unreferenced (Object);
start : Gtk.Text_Iter.Gtk_Text_Iter;
finish : Gtk.Text_Iter.Gtk_Text_Iter;
assembly : Unbounded_String;
result : Boolean;
errMsg : Unbounded_String;
instructions : assembler.InstructionVector.Vector;
ignore : Gtkada.Dialogs.Message_Dialog_Buttons;
ignore2 : Gtk.Status_Bar.Message_Id;
begin
Ada.Text_IO.Put_Line("Assemble");
ignore2 := Gtk.Status_Bar.Push(gui.statusBar, 1, "Assembling...");
gui.textbuf.Get_Bounds(start, finish);
assembly := To_Unbounded_String(gui.textbuf.Get_Text(
Start => start,
The_End => finish,
Include_Hidden_Chars => True));
-- Assemble the file into a vector of instruction records
result := assembler.parse(source => To_String(assembly),
instructions => instructions,
msg => errMsg);
if not result then
ignore := Gtkada.Dialogs.Message_Dialog(
Msg => To_String(errMsg),
Dialog_Type => Gtkada.Dialogs.Information,
Buttons => Gtkada.Dialogs.Button_OK,
Title => "Parse Error",
Parent => null);
--gui.statusBar.removeAll;
return;
end if;
--gui.statusBar.Push("Code gen...", Context => 0);
-- convert the instruction vector into a vector of machine code insts.
result := assembler.codeGen(instructions => instructions,
objectFile => machinecode,
msg => errMsg);
if not result then
ignore := Gtkada.Dialogs.Message_Dialog(
Msg => To_String(errMsg),
Dialog_Type => Gtkada.Dialogs.Information,
Buttons => Gtkada.Dialogs.Button_OK,
Title => "Code Generation Error",
Parent => null);
--gui.statusBar.Remove_All;
return;
end if;
--gui.statusBar.Push("Loading object file...", Context => 0);
-- Load the opcodes into the machinecode list store.
loadObjectFile : declare
use Gtk.List_Store;
use Gtk.Tree_Model;
machinecodeListIter : Gtk_Tree_Iter;
addr : Unsigned_64 := 0;
inst : Unsigned_64 := 0;
begin
--machinecodeList := Gtk_List_Store(Gtkada.Builder.Get_Object(gui.builder, "machinecodeList"));
gui.machinecodeList.Clear;
Ada.Text_IO.Put_Line(" adding " & Integer(machinecode.Length)'Image & " instructions to liststore");
for i in 0 .. Integer(machinecode.Length)-1 loop
Ada.Text_IO.Put_Line(" adding element " & i'Image);
inst := machinecode.Element(Integer(i));
addr := Unsigned_64(Integer(i));
gui.machinecodeList.Append(Iter => machinecodeListIter);
gui.machinecodeList.Set(Iter => machinecodeListIter,
Column => 0,
Value => util.toHexString(addr));
gui.machinecodeList.Set(Iter => machinecodeListIter,
Column => 1,
Value => util.toHexString(inst));
end loop;
end loadObjectFile;
ignore2 := Gtk.Status_Bar.Push(gui.statusBar, 1, "Assembly Success!");
-- Go ahead and boot the VM
ignore := Gtkada.Dialogs.Message_Dialog(
Msg => "Assembly Finished, click OK to boot the VM.",
Dialog_Type => Gtkada.Dialogs.Information,
Buttons => Gtkada.Dialogs.Button_OK,
Title => "Success",
Parent => null);
vm.boot(machinecode);
gui.updateGUI_VM;
end assembleCB;
----------------------------------------------------------------------------
-- stepCB
-- callback for the "step" button - instruct the VM to single-step an
-- instruction.
----------------------------------------------------------------------------
procedure stepCB (Object : access Gtkada_Builder_Record'Class) is
pragma Unreferenced (Object);
errMsg : Unbounded_String;
healthy : Boolean;
ignore : Gtkada.Dialogs.Message_Dialog_Buttons;
begin
Ada.Text_IO.Put_Line("Step");
healthy := vm.step(errMsg);
if not healthy then
ignore := Gtkada.Dialogs.Message_Dialog(
Msg => To_String(errMsg),
Dialog_Type => Gtkada.Dialogs.Information,
Buttons => Gtkada.Dialogs.Button_OK,
Title => "Exception",
Parent => null);
return;
else
gui.updateGUI_VM;
end if;
end stepCB;
-----------
-- runCB --
-----------
procedure runCB (Object : access Gtkada_Builder_Record'Class) is
pragma Unreferenced (Object);
begin
Ada.Text_IO.Put_Line("Run");
end runCB;
------------
-- stopCB --
------------
procedure stopCB (Object : access Gtkada_Builder_Record'Class) is
pragma Unreferenced (Object);
begin
Ada.Text_IO.Put_Line("Stop");
end stopCB;
-----------
-- newCB --
-----------
procedure newCB (Object : access Gtkada_Builder_Record'Class) is
start : Gtk.Text_Iter.Gtk_Text_Iter;
finish : Gtk.Text_Iter.Gtk_Text_Iter;
begin
if unsavedChanges then
if not areYouSure then
return;
end if;
end if;
gui.textbuf.Get_Bounds(start, finish);
gui.textbuf.Delete(Start => start, The_End => finish);
unsavedChanges := False;
curFileName := To_Unbounded_String("");
gui.setTitle("YOTROC Assembler / Emulator: " & To_String(curFileName));
end newCB;
------------
-- openCB --
------------
procedure openCB (Object : access Gtkada_Builder_Record'Class) is
pragma Unreferenced(Object);
openPath : Unbounded_String;
begin
if unsavedChanges then
if not areYouSure then
return;
end if;
end if;
openPath := To_Unbounded_String(Gtkada.File_Selection.File_Selection_Dialog
(Title => "Open",
Must_Exist => True));
if openPath /= "" then
declare
file : Ada.Text_IO.File_Type;
contents : Unbounded_String;
ignore : Gtkada.Dialogs.Message_Dialog_Buttons;
begin
Ada.Text_IO.Open(File => file,
Mode => Ada.Text_IO.In_File,
Name => To_String(openPath));
-- read in entire file before assigning to text buffer.
while not Ada.Text_IO.End_Of_File(file) loop
declare
use ASCII;
nextChr : Character;
-- lookAhead : Character;
begin
Ada.Text_IO.Get_Immediate(file, nextChr);
Append(contents, nextChr);
end;
end loop;
--Ada.Text_IO.Put_Line("Open: " & To_String(openPath) & " contents: " & To_String(contents));
Ada.Text_IO.Close(file);
gui.textbuf.Set_Text(Text => To_String(contents));
unsavedChanges := False;
curFileName := openPath;
gui.setTitle("YOTROC Assembler / Emulator: " & To_String(curFileName));
exception
when others =>
ignore := Gtkada.Dialogs.Message_Dialog
(Msg => "Error opening file.",
Buttons => Gtkada.Dialogs.Button_OK,
Dialog_Type => Gtkada.Dialogs.Warning,
Title => "Uh oh!");
end;
end if;
end openCB;
-- underlying function for file saves
procedure saveFile(savePath : Unbounded_String) is
ignore : Gtkada.Dialogs.Message_Dialog_Buttons;
file : Ada.Text_IO.File_Type;
bufContents : Unbounded_String;
start, finish : Gtk.Text_Iter.Gtk_Text_Iter;
begin
-- try to open the file
openFile : declare
begin
-- open filepath, write it all out.
Ada.Text_IO.Open(File => file,
Mode => Ada.Text_IO.Out_File,
Name => To_String(savePath));
exception
when Ada.Text_IO.Name_Error =>
Ada.Text_IO.Create(File => file,
Mode => Ada.Text_IO.Out_File,
Name => To_String(savePath));
end openFile;
gui.textbuf.Get_Bounds(start, finish);
bufContents := To_Unbounded_String(gui.textbuf.Get_Text(Start => start, The_End => finish));
Ada.Text_IO.Put_Line("Writing: ");
for i in 1 .. Length(bufContents) loop
Ada.Text_IO.Put(Element(bufContents, i));
Ada.Text_IO.Put(file, Element(bufContents, i));
end loop;
-- if successful, make this the new curFileName
curFileName := savePath;
unsavedChanges := False;
gui.setTitle("YOTROC Assembler / Emulator: " & To_String(curFileName));
Ada.Text_IO.Close(file);
exception
when others =>
ignore := Gtkada.Dialogs.Message_Dialog
(Msg => "Error saving file.",
Buttons => Gtkada.Dialogs.Button_OK,
Dialog_Type => Gtkada.Dialogs.Warning,
Title => "Uh oh!");
end saveFile;
------------
-- saveCB --
------------
procedure saveCB (Object : access Gtkada_Builder_Record'Class) is
savePath : Unbounded_String;
begin
if curFileName = "" then
saveAsCB(Object);
else
saveFile(curFileName);
end if;
end saveCB;
--------------
-- saveAsCB --
--------------
procedure saveAsCB (Object : access Gtkada_Builder_Record'Class) is
pragma Unreferenced(Object);
savePath : Unbounded_String;
begin
savePath := To_Unbounded_String(Gtkada.File_Selection.File_Selection_Dialog
(Title => "Save As",
Default_Dir => "",
Dir_Only => False,
Must_Exist => False));
if savePath /= "" then
saveFile(savePath);
end if;
return;
end saveAsCB;
-------------
-- aboutCB --
-------------
procedure aboutCB (Object : access Gtkada_Builder_Record'Class) is
use Gtk.Dialog;
retButton : Gtkada.Dialogs.Message_Dialog_Buttons;
begin
retButton := Gtkada.Dialogs.Message_Dialog(
Msg => "YOTROC Assembler & Emulator, written by Jon Andrew for Syracuse CIS655. All rights reserved.",
Buttons => Gtkada.Dialogs.Button_OK,
Dialog_Type => Gtkada.Dialogs.Information,
Title => "About");
-- confirmDialog.Destroy;
end aboutCB;
----------------------------------------------------------------------------
-- editCB - called whenever changes are made to the textbuffer
----------------------------------------------------------------------------
procedure editCB (Object : access Gtk.Text_Buffer.Gtk_Text_Buffer_Record'Class) is
begin
--TODO: it would be kind of fun to add syntax highlighting here.
--Ada.Text_IO.Put_Line("textview changed");
unsavedChanges := True;
end editCB;
---------------------------------------------------------------------------
-- confirmUnsaved
-- pop up a dialog confirming that they want to exit/open file, etc.
-- when there are unsaved changes. Return True if they want to proceed.
---------------------------------------------------------------------------
function areYouSure return Boolean is
use Gtk.Dialog;
confirmDialog : Gtk.Message_Dialog.Gtk_Message_Dialog;
confirmYesNo : Gtk.Dialog.Gtk_Response_Type;
confirmFlags : Gtk.Dialog.Gtk_Dialog_Flags;
begin
confirmFlags := Gtk.Dialog.Modal;
confirmDialog := Gtk.Message_Dialog.Gtk_Message_Dialog_New
(Parent => null,
The_Type => Gtk.Message_Dialog.Message_Question,
Flags => confirmFlags,
Buttons => Gtk.Message_Dialog.Buttons_Yes_No,
Message => "You have unsaved changes, are you sure you want to do this?");
confirmYesNo := confirmDialog.Run;
confirmDialog.Destroy;
return confirmYesNo = Gtk.Dialog.Gtk_Response_Yes;
end areYouSure;
end callbacks;
|
faelys/natools | Ada | 3,052 | ads | ------------------------------------------------------------------------------
-- Copyright (c) 2011, 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. --
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- Natools.Getopt_Long_Tests is a test suite for Natools.Getopt_Long --
-- command-line argument processing facilities. --
------------------------------------------------------------------------------
with Natools.Tests;
package Natools.Getopt_Long_Tests is
pragma Preelaborate (Getopt_Long_Tests);
package NT renames Natools.Tests;
procedure All_Tests (Report : in out NT.Reporter'Class);
procedure Test_Arguments (Report : in out NT.Reporter'Class);
procedure Test_Empty (Report : in out NT.Reporter'Class);
procedure Test_Error_Callbacks (Report : in out NT.Reporter'Class);
procedure Test_Everything (Report : in out NT.Reporter'Class);
procedure Test_Long (Report : in out NT.Reporter'Class);
procedure Test_Long_Only (Report : in out NT.Reporter'Class);
procedure Test_Long_Partial (Report : in out NT.Reporter'Class);
procedure Test_Long_Partial_Ambiguous (Report : in out NT.Reporter'Class);
procedure Test_Missing_Argument_Long (Report : in out NT.Reporter'Class);
procedure Test_Missing_Argument_Short (Report : in out NT.Reporter'Class);
procedure Test_Mixed_Arg (Report : in out NT.Reporter'Class);
procedure Test_Mixed_No_Arg (Report : in out NT.Reporter'Class);
procedure Test_Posixly_Correct (Report : in out NT.Reporter'Class);
procedure Test_Short_Argument (Report : in out NT.Reporter'Class);
procedure Test_Short_Compact (Report : in out NT.Reporter'Class);
procedure Test_Short_Expanded (Report : in out NT.Reporter'Class);
procedure Test_Unexpected_Argument (Report : in out NT.Reporter'Class);
procedure Test_Unknown_Long (Report : in out NT.Reporter'Class);
procedure Test_Unknown_Short (Report : in out NT.Reporter'Class);
end Natools.Getopt_Long_Tests;
|
reznikmm/matreshka | Ada | 3,433 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2017, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with League.Strings;
with WebDriver.Drivers;
package WebDriver.Remote is
function Create
(URL : League.Strings.Universal_String)
return WebDriver.Drivers.Driver'Class;
-- Connect to server ("Remote end")
end WebDriver.Remote;
|
stcarrez/ada-awa | Ada | 3,232 | adb | -----------------------------------------------------------------------
-- awa-blogs-servlets -- Serve files saved in the storage service
-- Copyright (C) 2017, 2018, 2019 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with AWA.Images.Modules;
with AWA.Blogs.Modules;
package body AWA.Blogs.Servlets is
-- ------------------------------
-- Load the data content that correspond to the GET request and get the name as well
-- as mime-type and date.
-- ------------------------------
overriding
procedure Load (Server : in Image_Servlet;
Request : in out ASF.Requests.Request'Class;
Name : out Ada.Strings.Unbounded.Unbounded_String;
Mime : out Ada.Strings.Unbounded.Unbounded_String;
Date : out Ada.Calendar.Time;
Data : out ADO.Blob_Ref) is
pragma Unreferenced (Server, Name);
Post : constant String := Request.Get_Path_Parameter (1);
File : constant String := Request.Get_Path_Parameter (2);
Size : constant String := Request.Get_Path_Parameter (3);
Module : constant AWA.Blogs.Modules.Blog_Module_Access := Blogs.Modules.Get_Blog_Module;
Post_Id : ADO.Identifier;
File_Id : ADO.Identifier;
Width : Natural;
Height : Natural;
Img_Width : Natural;
Img_Height : Natural;
begin
Post_Id := ADO.Identifier'Value (Post);
File_Id := ADO.Identifier'Value (File);
AWA.Images.Modules.Get_Sizes (Dimension => Size,
Width => Width,
Height => Height);
Img_Width := Width;
Img_Height := Height;
Module.Load_Image (Post_Id => Post_Id,
Image_Id => File_Id,
Width => Img_Width,
Height => Img_Height,
Mime => Mime,
Date => Date,
Into => Data);
end Load;
-- ------------------------------
-- Get the expected return mode (content disposition for download or inline).
-- ------------------------------
overriding
function Get_Format (Server : in Image_Servlet;
Request : in ASF.Requests.Request'Class)
return AWA.Storages.Servlets.Get_Type is
pragma Unreferenced (Server, Request);
begin
return AWA.Storages.Servlets.DEFAULT;
end Get_Format;
end AWA.Blogs.Servlets;
|
reznikmm/matreshka | Ada | 3,767 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010, 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.Command_Line;
package body Scanner_Utilities is
----------
-- Mode --
----------
function Mode return Modes is
M : constant String := Ada.Command_Line.Argument (1);
begin
if M = "regexp" then
return Regexp;
elsif M = "xml" then
return XML;
end if;
raise Constraint_Error with "invalid value of mode parameter";
end Mode;
end Scanner_Utilities;
|
zhmu/ananas | Ada | 7,395 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T A S K I N G . D E B U G --
-- --
-- S p e c --
-- --
-- Copyright (C) 1997-2022, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
-- This package encapsulates all direct interfaces to task debugging services
-- that are needed by gdb with gnat mode.
with System.OS_Interface;
package System.Tasking.Debug is
pragma Preelaborate;
------------------------------------------
-- Application-level debugging routines --
------------------------------------------
procedure List_Tasks;
-- Print a list of all the known Ada tasks with abbreviated state
-- information, one-per-line, to the standard error file.
procedure Print_Current_Task;
-- Write information about current task, in hexadecimal, as one line, to
-- the standard error file.
procedure Print_Task_Info (T : Task_Id);
-- Similar to Print_Current_Task, for a given task
procedure Set_User_State (Value : Long_Integer);
-- Set user state value in the current task. This state will be displayed
-- when calling List_Tasks or Print_Current_Task. It is useful for setting
-- task specific state.
function Get_User_State return Long_Integer;
-- Return the user state for the current task
-------------------------
-- General GDB support --
-------------------------
Known_Tasks : array (0 .. 999) of Task_Id := [others => null]
with Atomic_Components;
-- Global array of tasks read by gdb, and updated by Create_Task and
-- Finalize_TCB. Ensure access to its components is atomic to allow
-- lock-free concurrent access.
Debug_Event_Activating : constant := 1;
Debug_Event_Run : constant := 2;
Debug_Event_Suspended : constant := 3;
Debug_Event_Preempted : constant := 4;
Debug_Event_Terminated : constant := 5;
Debug_Event_Abort_Terminated : constant := 6;
Debug_Event_Exception_Terminated : constant := 7;
Debug_Event_Rendezvous_Exception : constant := 8;
Debug_Event_Handled : constant := 9;
Debug_Event_Dependents_Exception : constant := 10;
Debug_Event_Handled_Others : constant := 11;
subtype Event_Kind_Type is Positive range 1 .. 11;
-- Event kinds currently defined for debugging, used globally
-- below and on a per task basis.
procedure Signal_Debug_Event
(Event_Kind : Event_Kind_Type;
Task_Value : Task_Id);
----------------------------------
-- VxWorks specific GDB support --
----------------------------------
-- Although the following routines are implemented in a target independent
-- manner, only VxWorks currently uses them.
procedure Task_Creation_Hook (Thread : OS_Interface.Thread_Id);
-- This procedure is used to notify GDB of task's creation. It must be
-- called by the task's creator.
procedure Task_Termination_Hook;
-- This procedure is used to notify GDB of task's termination
procedure Suspend_All_Tasks (Thread_Self : OS_Interface.Thread_Id);
-- Suspend all the tasks except the one whose associated thread is
-- Thread_Self by traversing All_Tasks_List and calling
-- System.Task_Primitives.Operations.Suspend_Task.
procedure Resume_All_Tasks (Thread_Self : OS_Interface.Thread_Id);
-- Resume all the tasks except the one whose associated thread is
-- Thread_Self by traversing All_Tasks_List and calling
-- System.Task_Primitives.Operations.Continue_Task.
procedure Stop_All_Tasks_Handler;
-- Stop all the tasks by traversing All_Tasks_List and calling
-- System.Task_Primitives.Operations.Stop_All_Task. This function
-- can be used in an interrupt handler.
procedure Stop_All_Tasks;
-- Stop all the tasks by traversing All_Tasks_List and calling
-- System.Task_Primitives.Operations.Stop_Task.
procedure Continue_All_Tasks;
-- Continue all the tasks by traversing All_Tasks_List and calling
-- System.Task_Primitives.Operations.Continue_Task.
-------------------------------
-- Run-time tracing routines --
-------------------------------
procedure Trace
(Self_Id : Task_Id;
Msg : String;
Flag : Character;
Other_Id : Task_Id := null);
-- If traces for Flag are enabled, display on Standard_Error a given
-- message for the current task. Other_Id is an optional second task id
-- to display.
procedure Set_Trace
(Flag : Character;
Value : Boolean := True);
-- Enable or disable tracing for Flag. By default, flags in the range
-- 'A' .. 'Z' are disabled, others are enabled.
---------------------------------
-- Hooks for Valgrind/Helgrind --
---------------------------------
procedure Master_Hook
(Dependent : Task_Id;
Parent : Task_Id;
Master_Level : Integer);
-- Indicate to Valgrind/Helgrind that the master of Dependent is
-- Parent + Master_Level.
procedure Master_Completed_Hook
(Self_ID : Task_Id;
Master_Level : Integer);
-- Indicate to Valgrind/Helgrind that Self_ID has completed the master
-- Master_Level.
end System.Tasking.Debug;
|
zertovitch/excel-writer | Ada | 1,659 | adb | with Ada.Text_IO;
with Spreadsheet_References;
procedure Spreadsheet_References_Demo is
ii, jj, n0 : Positive;
use Ada.Text_IO, Spreadsheet_References;
function Display_both_encodings (i, j : Positive) return String is
begin
return Encode_Reference (i, j, A1) & " = " & Encode_Reference (i, j, R1C1);
end Display_both_encodings;
begin
Split ("xfd1234", ii, jj);
Put_Line (Integer'Image (ii) & Integer'Image (jj));
New_Line;
for i in 1 .. 10 loop
Put_Line (Display_both_encodings (i, 1));
end loop;
New_Line;
for j in 1 .. 10 loop
Put_Line (Display_both_encodings (1, j));
end loop;
New_Line;
for i in 1 .. 256 loop
Put_Line (Display_both_encodings (i, i));
end loop;
New_Line;
-- Excel 2007 and later has 16384 = 2**16 instead of 256 = 2**8 columns
for i in 700 .. 710 loop -- ZZ=702, AAA=703
Put_Line (Display_both_encodings (i, i));
end loop;
New_Line;
for i in 16382 .. 16386 loop -- XFD=16384
Put_Line (Display_both_encodings (i, i));
end loop;
New_Line;
for n in 1 .. 5 loop
n0 := (26**n - 1) * 26 / 25;
for i in n0 - 2 .. n0 + 2 loop
Put_Line (Display_both_encodings (i, i));
end loop;
New_Line;
end loop;
--
-- Consistency check on different rows, columns and on both styles
--
for i in 1 .. 123 loop
for j in 1 .. 16389 loop
for style in Reference_Style loop
Split (Encode_Reference (i, j, style), ii, jj);
if i /= ii or j /= jj then
raise Program_Error;
end if;
end loop;
end loop;
end loop;
end Spreadsheet_References_Demo;
|
Heziode/lsystem-editor | Ada | 1,537 | ads | -------------------------------------------------------------------------------
-- LSE -- L-System Editor
-- Author: Heziode
--
-- License:
-- MIT License
--
-- Copyright (c) 2018 Quentin Dauprat (Heziode) <[email protected]>
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the "Software"),
-- to deal in the Software without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------------
-- @description
-- This package encompass all Grammar.
--
package LSE.Model.Grammar is
pragma Pure;
end LSE.Model.Grammar;
|
reznikmm/matreshka | Ada | 3,993 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Form_Printable_Attributes;
package Matreshka.ODF_Form.Printable_Attributes is
type Form_Printable_Attribute_Node is
new Matreshka.ODF_Form.Abstract_Form_Attribute_Node
and ODF.DOM.Form_Printable_Attributes.ODF_Form_Printable_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Form_Printable_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Form_Printable_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Form.Printable_Attributes;
|
reznikmm/matreshka | Ada | 3,646 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web 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$
------------------------------------------------------------------------------
with League.Objects;
package AWF.Layouts is
type AWF_Layout is limited interface and League.Objects.Object;
type AWF_Layout_Access is access all AWF_Layout'Class;
function Create
-- (Parent : access AWF.Widgets.AWF_Widget'Class)
return not null AWF_Layout_Access;
end AWF.Layouts;
|
optikos/oasis | Ada | 6,048 | adb | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Program.Nodes.Protected_Body_Stubs is
function Create
(Protected_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Body_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Separate_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Protected_Body_Stub is
begin
return Result : Protected_Body_Stub :=
(Protected_Token => Protected_Token, Body_Token => Body_Token,
Name => Name, Is_Token => Is_Token, Separate_Token => Separate_Token,
With_Token => With_Token, Aspects => Aspects,
Semicolon_Token => Semicolon_Token, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Protected_Body_Stub is
begin
return Result : Implicit_Protected_Body_Stub :=
(Name => Name, Aspects => Aspects,
Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Name
(Self : Base_Protected_Body_Stub)
return not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access is
begin
return Self.Name;
end Name;
overriding function Aspects
(Self : Base_Protected_Body_Stub)
return Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access is
begin
return Self.Aspects;
end Aspects;
overriding function Protected_Token
(Self : Protected_Body_Stub)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Protected_Token;
end Protected_Token;
overriding function Body_Token
(Self : Protected_Body_Stub)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Body_Token;
end Body_Token;
overriding function Is_Token
(Self : Protected_Body_Stub)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Is_Token;
end Is_Token;
overriding function Separate_Token
(Self : Protected_Body_Stub)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Separate_Token;
end Separate_Token;
overriding function With_Token
(Self : Protected_Body_Stub)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.With_Token;
end With_Token;
overriding function Semicolon_Token
(Self : Protected_Body_Stub)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Semicolon_Token;
end Semicolon_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Protected_Body_Stub)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Protected_Body_Stub)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Protected_Body_Stub)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize
(Self : aliased in out Base_Protected_Body_Stub'Class) is
begin
Set_Enclosing_Element (Self.Name, Self'Unchecked_Access);
for Item in Self.Aspects.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
null;
end Initialize;
overriding function Is_Protected_Body_Stub_Element
(Self : Base_Protected_Body_Stub)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Protected_Body_Stub_Element;
overriding function Is_Declaration_Element
(Self : Base_Protected_Body_Stub)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Declaration_Element;
overriding procedure Visit
(Self : not null access Base_Protected_Body_Stub;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Protected_Body_Stub (Self);
end Visit;
overriding function To_Protected_Body_Stub_Text
(Self : aliased in out Protected_Body_Stub)
return Program.Elements.Protected_Body_Stubs
.Protected_Body_Stub_Text_Access is
begin
return Self'Unchecked_Access;
end To_Protected_Body_Stub_Text;
overriding function To_Protected_Body_Stub_Text
(Self : aliased in out Implicit_Protected_Body_Stub)
return Program.Elements.Protected_Body_Stubs
.Protected_Body_Stub_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Protected_Body_Stub_Text;
end Program.Nodes.Protected_Body_Stubs;
|
zhmu/ananas | Ada | 415 | adb | -- { dg-do compile }
-- { dg-require-effective-target string_merging }
-- { dg-options "-O1 -fmerge-all-constants" }
procedure String_Merge1 is
procedure Process (X : String);
pragma Import (Ada, Process);
begin
Process ("ABCD");
end;
-- We expect something like:
-- .section .rodata.str1.1,"aMS",@progbits,1
-- .LC1:
-- .string "ABCD"
-- { dg-final { scan-assembler-times "\\.rodata\\.str" 1 } }
|
AdaCore/gpr | Ada | 1,763 | ads | ------------------------------------------------------------------------------
-- --
-- GPR2 PROJECT MANAGER --
-- --
-- Copyright (C) 2019-2023, AdaCore --
-- --
-- This is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. This software is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public --
-- License for more details. You should have received a copy of the GNU --
-- General Public License distributed with GNAT; see file COPYING. If not, --
-- see <http://www.gnu.org/licenses/>. --
-- --
------------------------------------------------------------------------------
with Ada.Containers.Indefinite_Vectors;
package GPRname.Source_Dir.Vector is
package Vector is new Ada.Containers.Indefinite_Vectors
(Positive, Source_Dir.Object, "=");
subtype Object is Vector.Vector;
subtype Cursor is Vector.Cursor;
function "=" (Left, Right : Object) return Boolean renames Vector."=";
Empty_Vector : constant Object := Vector.Empty_Vector;
end GPRname.Source_Dir.Vector;
|
zhmu/ananas | Ada | 2,596 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . E X P _ U N S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package does not require a body, since it is an instantiation. We
-- provide a dummy file containing a No_Body pragma so that previous versions
-- of the body (which did exist) will not interfere.
pragma No_Body;
|
reznikmm/matreshka | Ada | 8,767 | adb | with League.Strings;
package body Styx.Reply_Encoders is
subtype Stream_Element_Array_4 is Ada.Streams.Stream_Element_Array (0 .. 3);
procedure Write_32
(Value : Interfaces.Unsigned_32;
Data : out Stream_Element_Array_4);
------------
-- Attach --
------------
overriding procedure Attach
(Self : in out Encoder;
Message : Styx.Messages.Attaches.Attach_Reply) is
begin
Self.Write_32 (0);
Self.Write_8 (Interfaces.Unsigned_8'(105));
Self.Write_16 (Interfaces.Unsigned_16 (Message.Tag));
Self.Write (Message.QID);
end Attach;
----------
-- Auth --
----------
overriding procedure Auth
(Self : in out Encoder;
Message : Styx.Messages.Authes.Auth_Reply)
is
begin
Self.Write_32 (0);
Self.Write_8 (Interfaces.Unsigned_8'(103));
Self.Write_16 (Interfaces.Unsigned_16 (Message.Tag));
Self.Write (Message.Auth_QID);
end Auth;
-----------
-- Clunk --
-----------
overriding procedure Clunk
(Self : in out Encoder;
Message : Styx.Messages.Clunks.Clunk_Reply) is
begin
Self.Write_32 (0);
Self.Write_8 (Interfaces.Unsigned_8'(121));
Self.Write_16 (Interfaces.Unsigned_16 (Message.Tag));
end Clunk;
------------
-- Encode --
------------
procedure Encode
(Self : in out Encoder;
Stream : access Ada.Streams.Root_Stream_Type'Class;
Command : Styx.Messages.Reply'Class)
is
begin
Styx.Messages.Visit (Self, Command);
declare
Data : Ada.Streams.Stream_Element_Array :=
Self.Output.To_Stream_Element_Array;
begin
Write_32 (Data'Length, Data (0 .. 3));
Ada.Streams.Write (Stream.all, Data);
Self.Output.Clear;
end;
end Encode;
----------------
-- Initialize --
----------------
procedure Initialize (Self : in out Encoder) is
begin
Self.UTF_8 := new League.Text_Codecs.Text_Codec'
(League.Text_Codecs.Codec
(League.Strings.To_Universal_String ("utf-8")));
end Initialize;
----------
-- Open --
----------
overriding procedure Open
(Self : in out Encoder;
Message : Styx.Messages.Opens.Open_Reply) is
begin
Self.Write_32 (0);
Self.Write_8 (Interfaces.Unsigned_8'(113));
Self.Write_16 (Interfaces.Unsigned_16 (Message.Tag));
Self.Write (Message.QID);
Self.Write_32 (Interfaces.Unsigned_32 (Message.Unit));
end Open;
----------
-- Read --
----------
overriding procedure Read
(Self : in out Encoder;
Message : Styx.Messages.Reads.Read_Reply) is
begin
Self.Write_32 (0);
Self.Write_8 (Interfaces.Unsigned_8'(117));
Self.Write_16 (Interfaces.Unsigned_16 (Message.Tag));
Self.Write_32 (Interfaces.Unsigned_32 (Message.Data.Length));
Self.Output.Append (Message.Data);
end Read;
overriding procedure Read_Directory
(Self : in out Encoder;
Message : Styx.Messages.Reads.Read_Directory_Reply)
is
Temp : League.Stream_Element_Vectors.Stream_Element_Vector;
begin
for J in 1 .. Message.Count loop
Self.Write (Message.Data (J));
end loop;
Temp := Self.Output;
Self.Output.Clear;
Self.Write_32 (0);
Self.Write_8 (Interfaces.Unsigned_8'(117));
Self.Write_16 (Interfaces.Unsigned_16 (Message.Tag));
Self.Write_32 (Interfaces.Unsigned_32 (Temp.Length));
Self.Output.Append (Temp);
end Read_Directory;
----------
-- Stat --
----------
overriding procedure Stat
(Self : in out Encoder;
Message : Styx.Messages.Stats.Stat_Reply)
is
Temp : League.Stream_Element_Vectors.Stream_Element_Vector;
begin
Self.Write (Message.Value);
Temp := Self.Output;
Self.Output.Clear;
Self.Write_32 (0);
Self.Write_8 (Interfaces.Unsigned_8'(125));
Self.Write_16 (Interfaces.Unsigned_16 (Message.Tag));
Self.Write_16 (Interfaces.Unsigned_16 (Temp.Length));
Self.Output.Append (Temp);
end Stat;
-------------
-- Version --
-------------
overriding procedure Version
(Self : in out Encoder;
Message : Styx.Messages.Versions.Version_Reply)
is
begin
Self.Write_32 (0);
Self.Write_8 (Interfaces.Unsigned_8'(101));
Self.Write_16 (Interfaces.Unsigned_16 (Message.Tag));
Self.Write_32 (Interfaces.Unsigned_32 (Message.MSize));
Self.Write (Message.Version);
end Version;
----------
-- Walk --
----------
overriding procedure Walk
(Self : in out Encoder;
Message : Styx.Messages.Walks.Walk_Reply) is
begin
Self.Write_32 (0);
Self.Write_8 (Interfaces.Unsigned_8'(111));
Self.Write_16 (Interfaces.Unsigned_16 (Message.Tag));
Self.Write_16 (Interfaces.Unsigned_16 (Message.Count));
for J in Message.List'Range loop
Self.Write (Message.List (J));
end loop;
end Walk;
-----------
-- Write --
-----------
not overriding procedure Write_8
(Self : in out Encoder;
Value : Interfaces.Unsigned_8) is
begin
Self.Output.Append (Ada.Streams.Stream_Element (Value));
end Write_8;
--------------
-- Write_16 --
--------------
not overriding procedure Write_16
(Self : in out Encoder;
Value : Interfaces.Unsigned_16)
is
use type Interfaces.Unsigned_16;
Data : Ada.Streams.Stream_Element_Array (1 .. 2);
X : Interfaces.Unsigned_16 := Value;
begin
for J in Data'Range loop
Data (J) := Ada.Streams.Stream_Element (X and 16#FF#);
X := Interfaces.Shift_Right (X, Ada.Streams.Stream_Element'Size);
end loop;
Self.Output.Append (Data);
end Write_16;
-----------
-- Write --
-----------
not overriding procedure Write_32
(Self : in out Encoder;
Value : Interfaces.Unsigned_32)
is
Data : Stream_Element_Array_4;
begin
Write_32 (Value, Data);
Self.Output.Append (Data);
end Write_32;
--------------
-- Write_32 --
--------------
procedure Write_32
(Value : Interfaces.Unsigned_32;
Data : out Stream_Element_Array_4)
is
use type Interfaces.Unsigned_32;
X : Interfaces.Unsigned_32 := Value;
begin
for J in Data'Range loop
Data (J) := Ada.Streams.Stream_Element (X and 16#FF#);
X := Interfaces.Shift_Right (X, Ada.Streams.Stream_Element'Size);
end loop;
end Write_32;
-----------
-- Write --
-----------
not overriding procedure Write_64
(Self : in out Encoder;
Value : Interfaces.Unsigned_64)
is
use type Interfaces.Unsigned_64;
Data : Ada.Streams.Stream_Element_Array (1 .. 8);
X : Interfaces.Unsigned_64 := Value;
begin
for J in Data'Range loop
Data (J) := Ada.Streams.Stream_Element (X and 16#FF#);
X := Interfaces.Shift_Right (X, Ada.Streams.Stream_Element'Size);
end loop;
Self.Output.Append (Data);
end Write_64;
-----------
-- Write --
-----------
not overriding procedure Write
(Self : in out Encoder;
QID : Styx.Messages.QID) is
begin
Self.Write_8 (QID.Kind);
Self.Write_32 (QID.Version);
Self.Write_64 (QID.Path);
end Write;
-----------
-- Write --
-----------
not overriding procedure Write
(Self : in out Encoder;
Value : League.Strings.Universal_String)
is
Data : League.Stream_Element_Vectors.Stream_Element_Vector :=
Self.UTF_8.Encode (Value);
begin
Self.Write_16 (Interfaces.Unsigned_16 (Data.Length));
for J in 1 .. Data.Length loop
Self.Write_8 (Interfaces.Unsigned_8 (Data.Element (J)));
end loop;
end Write;
-----------
-- Write --
-----------
not overriding procedure Write
(Self : in out Encoder;
Value : Styx.Messages.Directory_Entry)
is
use type Ada.Streams.Stream_Element_Count;
Temp : League.Stream_Element_Vectors.Stream_Element_Vector;
Save : League.Stream_Element_Vectors.Stream_Element_Vector :=
Self.Output;
begin
Self.Output.Clear;
Self.Write_16 (Value.Dir_Type);
Self.Write_32 (Value.Dev);
Self.Write (Value.QID);
Self.Write_32 (Value.Mode);
Self.Write_32 (0);
Self.Write_32 (0);
Self.Write_64 (Value.Length);
Self.Write (Value.Name);
Self.Write (Value.Owner);
Self.Write (Value.Group);
Self.Write (Value.Changed);
Temp := Self.Output;
Self.Output := Save;
Self.Write_16 (Interfaces.Unsigned_16 (Temp.Length));
Self.Output.Append (Temp);
end Write;
end Styx.Reply_Encoders;
|
onox/sdlada | Ada | 2,952 | ads | --------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2018 Luke A. Guest
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
-- SDL.Hints
--
-- Access to library configuration variables.
--------------------------------------------------------------------------------------------------------------------
package SDL.Hints is
-- TODO: Make this more robust using more functions and platform specific
-- packages with error checking on returned values?
-- Would be nice to have the compiler only allow that which is allowed on
-- a particular platform.
-- It would be nice to have the binding test the return values as well,
-- raising an exception on values that are just wrong for a particular
-- platform, i.e. direct3d on Linux or Mac? Exception raised!
-- This is raised when something has gone horribly wrong somewhere,
-- i.e. setting the wrong hint on a platform that does not allow it.
Hint_Error : exception;
type Hint is
(Frame_Buffer_Acceleration,
Render_Driver,
Render_OpenGL_Shaders,
Render_Scale_Quality,
Render_VSync,
Video_X11_XVidMode,
Video_X11_Xinerama,
Video_X11_XRandR,
Grab_Keyboard,
Video_Minimise_On_Focus_Loss,
Idle_Timer_Disabled,
IOS_Orientations,
XInput_Enabled, -- win
Game_Controller_Config, -- win, mac, linux
Joystick_Allow_Background_Events,
Allow_Topmost,
Timer_Resolution) with -- win7 and earlier
Discard_Names => True;
type Priorities is (Default, Normal, Override) with
Convention => C;
procedure Clear with
Import => True,
Convention => C,
External_Name => "SDL_ClearHints";
function Get (Name : in Hint) return String;
procedure Set (Name : in Hint; Value : in String);
procedure Set (Name : in Hint; Value : in String; Priority : in Priorities);
end SDL.Hints;
|
reznikmm/matreshka | Ada | 3,729 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Presentation_Class_Attributes is
pragma Preelaborate;
type ODF_Presentation_Class_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Presentation_Class_Attribute_Access is
access all ODF_Presentation_Class_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Presentation_Class_Attributes;
|
dan76/Amass | Ada | 445 | 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 = "DuckDuckGo"
type = "scrape"
function start()
set_rate_limit(2)
end
function vertical(ctx, domain)
local url = "https://html.duckduckgo.com/html/?q=site:" .. domain .. " -site:www." .. domain
scrape(ctx, {['url']=url})
end
|
persan/A-gst | Ada | 22,778 | ads | pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstinfo_h;
-- limited with GStreamer.GST_Low_Level.glib_2_0_glib_glist_h;
-- with GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h;
with Interfaces.C.Strings;
with System;
with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h;
with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h;
-- with GStreamer.GST_Low_Level.glib_2_0_glib_gquark_h;
with glib;
with glib.Values;
with System;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpadtemplate_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h;
-- limited -- with GStreamer.GST_Low_Level.glib_2_0_glib_deprecated_gthread_h;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_check_gstcheck_h is
-- unsupported macro: GST_CAT_DEFAULT check_debug
-- unsupported macro: fail_unless_message_error(msg,domain,code) gst_check_message_error (msg, GST_MESSAGE_ERROR, GST_ ## domain ## _ERROR, GST_ ## domain ## _ERROR_ ## code)
-- arg-macro: procedure assert_message_error (m, d, c)
-- fail_unless_message_error(m, d, c)
-- unsupported macro: GST_START_TEST(__testname) static void __testname (int __i__){ GST_DEBUG ("test start"); tcase_fn_start (""#__testname, __FILE__, __LINE__);
-- unsupported macro: GST_END_TEST GST_LOG ("cleaning up tasks"); gst_task_cleanup_all (); END_TEST
-- unsupported macro: fail_unless_equals_int(a,b) G_STMT_START { int first = a; int second = b; fail_unless(first == second, "'" #a "' (%d) is not equal to '" #b"' (%d)", first, second); } G_STMT_END;
-- arg-macro: procedure assert_equals_int (a, b)
-- fail_unless_equals_int(a, b)
-- unsupported macro: fail_unless_equals_int64(a,b) G_STMT_START { gint64 first = a; gint64 second = b; fail_unless(first == second, "'" #a "' (%" G_GINT64_FORMAT") is not equal to '" #b"' (%" G_GINT64_FORMAT")", first, second); } G_STMT_END;
-- arg-macro: procedure assert_equals_int64 (a, b)
-- fail_unless_equals_int64(a, b)
-- unsupported macro: fail_unless_equals_uint64(a,b) G_STMT_START { guint64 first = a; guint64 second = b; fail_unless(first == second, "'" #a "' (%" G_GUINT64_FORMAT ") is not equal to '" #b"' (%" G_GUINT64_FORMAT ")", first, second); } G_STMT_END;
-- arg-macro: procedure assert_equals_uint64 (a, b)
-- fail_unless_equals_uint64(a, b)
-- unsupported macro: fail_unless_equals_string(a,b) G_STMT_START { const gchar * first = a; const gchar * second = b; fail_unless(g_strcmp0 (first, second) == 0, "'" #a "' (%s) is not equal to '" #b"' (%s)", first, second); } G_STMT_END;
-- arg-macro: procedure assert_equals_string (a, b)
-- fail_unless_equals_string(a, b)
-- unsupported macro: fail_unless_equals_float(a,b) G_STMT_START { double first = a; double second = b; fail_unless(fabs (first - second) < 0.0000001, "'" #a "' (%g) is not equal to '" #b "' (%g)", first, second);} G_STMT_END;
-- arg-macro: procedure assert_equals_float (a, b)
-- fail_unless_equals_float(a, b)
-- arg-macro: procedure MAIN_START_THREADS (count, function, data)
-- MAIN_INIT(); MAIN_START_THREAD_FUNCTIONS(count, function, data); MAIN_SYNCHRONIZE();
-- unsupported macro: g_thread_create gst_g_thread_create
-- unsupported macro: g_mutex_new gst_g_mutex_new
-- unsupported macro: g_mutex_free gst_g_mutex_free
-- unsupported macro: g_static_rec_mutex_init gst_g_static_rec_mutex_init
-- unsupported macro: g_cond_new gst_g_cond_new
-- unsupported macro: g_cond_free gst_g_cond_free
-- unsupported macro: g_cond_timed_wait gst_g_cond_timed_wait
-- arg-macro: procedure MAIN_INIT ()
-- G_STMT_START { _gst_check_threads_running := TRUE; if (mutex = NULL) { mutex := g_mutex_new (); start_cond := g_cond_new (); sync_cond := g_cond_new (); } } G_STMT_END;
-- arg-macro: procedure MAIN_START_THREAD_FUNCTIONS (count, function, data)
-- G_STMT_START { int i; for (i := 0; i < count; ++i) { MAIN_START_THREAD_FUNCTION (i, function, data); } } G_STMT_END;
-- arg-macro: procedure MAIN_START_THREAD_FUNCTION (i, function, data)
-- G_STMT_START { GThread *thread := NULL; GST_DEBUG ("MAIN: creating thread %d", i); g_mutex_lock (mutex); thread := g_thread_create ((GThreadFunc) function, data, TRUE, NULL); GST_DEBUG ("MAIN: waiting for thread %d", i); g_cond_wait (start_cond, mutex); g_mutex_unlock (mutex); thread_list := g_list_append (thread_list, thread); } G_STMT_END;
-- arg-macro: procedure MAIN_SYNCHRONIZE ()
-- G_STMT_START { GST_DEBUG ("MAIN: synchronizing"); g_cond_broadcast (sync_cond); GST_DEBUG ("MAIN: synchronized"); } G_STMT_END;
-- arg-macro: procedure MAIN_STOP_THREADS ()
-- G_STMT_START { _gst_check_threads_running := FALSE; GST_DEBUG ("MAIN: joining"); g_list_foreach (thread_list, (GFunc) g_thread_join, NULL); g_list_free (thread_list); thread_list := NULL; GST_DEBUG ("MAIN: joined"); } G_STMT_END;
-- arg-macro: procedure THREAD_START ()
-- THREAD_STARTED(); THREAD_SYNCHRONIZE();
-- arg-macro: procedure THREAD_STARTED ()
-- G_STMT_START { GST_DEBUG ("THREAD %p: started", g_thread_self ()); g_mutex_lock (mutex); g_cond_signal (start_cond); } G_STMT_END;
-- arg-macro: procedure THREAD_SYNCHRONIZE ()
-- G_STMT_START { GST_DEBUG ("THREAD %p: syncing", g_thread_self ()); g_cond_wait (sync_cond, mutex); GST_DEBUG ("THREAD %p: synced", g_thread_self ()); g_mutex_unlock (mutex); } G_STMT_END;
-- arg-macro: procedure THREAD_SWITCH ()
-- G_STMT_START { g_usleep (1); } G_STMT_END;
-- arg-macro: function THREAD_TEST_RUNNING ()
-- return _gst_check_threads_running = TRUE;
-- arg-macro: procedure ASSERT_CRITICAL (code)
-- G_STMT_START { _gst_check_expecting_log := TRUE; _gst_check_raised_critical := FALSE; code; _fail_unless (_gst_check_raised_critical, __FILE__, __LINE__, "Expected g_critical, got nothing", NULL); _gst_check_expecting_log := FALSE; } G_STMT_END
-- arg-macro: procedure ASSERT_WARNING (code)
-- G_STMT_START { _gst_check_expecting_log := TRUE; _gst_check_raised_warning := FALSE; code; _fail_unless (_gst_check_raised_warning, __FILE__, __LINE__, "Expected g_warning, got nothing", NULL); _gst_check_expecting_log := FALSE; } G_STMT_END
-- arg-macro: procedure ASSERT_OBJECT_REFCOUNT (object, name, value)
-- G_STMT_START { int rc; rc := GST_OBJECT_REFCOUNT_VALUE (object); fail_unless (rc = value, "%s (%p) refcount is %d instead of %d", name, object, rc, value); } G_STMT_END
-- arg-macro: procedure ASSERT_OBJECT_REFCOUNT_BETWEEN (object, name, lower, upper)
-- G_STMT_START { int rc := GST_OBJECT_REFCOUNT_VALUE (object); int lo := lower; int hi := upper; fail_unless (rc >= lo, "%s (%p) refcount %d is smaller than %d", name, object, rc, lo); fail_unless (rc <= hi, "%s (%p) refcount %d is bigger than %d", name, object, rc, hi); } G_STMT_END
-- arg-macro: procedure ASSERT_CAPS_REFCOUNT (caps, name, value)
-- ASSERT_MINI_OBJECT_REFCOUNT(caps, name, value)
-- arg-macro: procedure ASSERT_BUFFER_REFCOUNT (buffer, name, value)
-- ASSERT_MINI_OBJECT_REFCOUNT(buffer, name, value)
-- arg-macro: procedure ASSERT_MINI_OBJECT_REFCOUNT (caps, name, value)
-- G_STMT_START { int rc; rc := GST_MINI_OBJECT_REFCOUNT_VALUE (caps); fail_unless (rc = value, name " refcount is %d instead of %d", rc, value);} G_STMT_END
-- unsupported macro: ASSERT_SET_STATE(element,state,ret) fail_unless (gst_element_set_state (element, state) == ret, "could not change state to " #state);
-- unsupported macro: GST_CHECK_MAIN(name) int main (int argc, char **argv) { Suite *s; gst_check_init (&argc, &argv); s = name ## _suite (); return gst_check_run_suite (s, #name, __FILE__); }
-- GStreamer
-- *
-- * Common code for GStreamer unittests
-- *
-- * Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org>
-- * Copyright (C) <2008> Thijs Vermeir <[email protected]>
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public
-- * License along with this library; if not, write to the
-- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-- * Boston, MA 02111-1307, USA.
--
check_debug : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstinfo_h.GstDebugCategory; -- gst/check/gstcheck.h:38
pragma Import (C, check_debug, "check_debug");
-- logging function for tests
-- * a test uses g_message() to log a debug line
-- * a gst unit test can be run with GST_TEST_DEBUG env var set to see the
-- * messages
--
-- global variables used in test methods
buffers : access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/check/gstcheck.h:52
pragma Import (C, buffers, "buffers");
check_mutex : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GMutex; -- gst/check/gstcheck.h:54
pragma Import (C, check_mutex, "check_mutex");
check_cond : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GCond; -- gst/check/gstcheck.h:55
pragma Import (C, check_cond, "check_cond");
type GstCheckABIStruct is record
name : Interfaces.C.Strings.chars_ptr; -- gst/check/gstcheck.h:59
size : aliased int; -- gst/check/gstcheck.h:60
abi_size : aliased int; -- gst/check/gstcheck.h:61
end record;
pragma Convention (C_Pass_By_Copy, GstCheckABIStruct); -- gst/check/gstcheck.h:63
-- skipped anonymous struct anon_458
procedure gst_check_init (argc : access int; argv : System.Address); -- gst/check/gstcheck.h:65
pragma Import (C, gst_check_init, "gst_check_init");
function gst_check_chain_func (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; buffer : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/check/gstcheck.h:67
pragma Import (C, gst_check_chain_func, "gst_check_chain_func");
procedure gst_check_message_error
(message : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage;
c_type : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessageType;
domain : Glib.GQuark;
code : GLIB.gint); -- gst/check/gstcheck.h:69
pragma Import (C, gst_check_message_error, "gst_check_message_error");
function gst_check_setup_element (factory : access GLIB.gchar) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; -- gst/check/gstcheck.h:72
pragma Import (C, gst_check_setup_element, "gst_check_setup_element");
procedure gst_check_teardown_element (element : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement); -- gst/check/gstcheck.h:73
pragma Import (C, gst_check_teardown_element, "gst_check_teardown_element");
function gst_check_setup_src_pad
(element : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement;
tmpl : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpadtemplate_h.GstStaticPadTemplate;
caps : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/check/gstcheck.h:74
pragma Import (C, gst_check_setup_src_pad, "gst_check_setup_src_pad");
function gst_check_setup_src_pad_by_name
(element : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement;
tmpl : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpadtemplate_h.GstStaticPadTemplate;
name : access GLIB.gchar) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/check/gstcheck.h:76
pragma Import (C, gst_check_setup_src_pad_by_name, "gst_check_setup_src_pad_by_name");
function gst_check_setup_sink_pad_by_name
(element : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement;
tmpl : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpadtemplate_h.GstStaticPadTemplate;
name : access GLIB.gchar) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/check/gstcheck.h:78
pragma Import (C, gst_check_setup_sink_pad_by_name, "gst_check_setup_sink_pad_by_name");
procedure gst_check_teardown_pad_by_name (element : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; name : access GLIB.gchar); -- gst/check/gstcheck.h:80
pragma Import (C, gst_check_teardown_pad_by_name, "gst_check_teardown_pad_by_name");
procedure gst_check_teardown_src_pad (element : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement); -- gst/check/gstcheck.h:81
pragma Import (C, gst_check_teardown_src_pad, "gst_check_teardown_src_pad");
procedure gst_check_drop_buffers; -- gst/check/gstcheck.h:82
pragma Import (C, gst_check_drop_buffers, "gst_check_drop_buffers");
procedure gst_check_caps_equal (caps1 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; caps2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps); -- gst/check/gstcheck.h:83
pragma Import (C, gst_check_caps_equal, "gst_check_caps_equal");
procedure gst_check_element_push_buffer_list
(element_name : access GLIB.gchar;
buffer_in : access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList;
buffer_out : access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList;
last_flow_return : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn); -- gst/check/gstcheck.h:84
pragma Import (C, gst_check_element_push_buffer_list, "gst_check_element_push_buffer_list");
procedure gst_check_element_push_buffer
(element_name : access GLIB.gchar;
buffer_in : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer;
buffer_out : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer); -- gst/check/gstcheck.h:86
pragma Import (C, gst_check_element_push_buffer, "gst_check_element_push_buffer");
function gst_check_setup_sink_pad
(element : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement;
tmpl : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpadtemplate_h.GstStaticPadTemplate;
caps : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/check/gstcheck.h:88
pragma Import (C, gst_check_setup_sink_pad, "gst_check_setup_sink_pad");
procedure gst_check_teardown_sink_pad (element : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement); -- gst/check/gstcheck.h:90
pragma Import (C, gst_check_teardown_sink_pad, "gst_check_teardown_sink_pad");
procedure gst_check_abi_list (list : access GstCheckABIStruct; have_abi_sizes : GLIB.gboolean); -- gst/check/gstcheck.h:91
pragma Import (C, gst_check_abi_list, "gst_check_abi_list");
function gst_check_run_suite
(the_suite : System.Address;
name : access GLIB.gchar;
fname : access GLIB.gchar) return GLIB.gint; -- gst/check/gstcheck.h:92
pragma Import (C, gst_check_run_suite, "gst_check_run_suite");
--*
-- * GST_START_TEST:
-- * @__testname: test function name
-- *
-- * wrapper for checks START_TEST
--
--*
-- * GST_END_TEST:
-- *
-- * wrapper for checks END_TEST
--
-- additional fail macros
--*
-- * fail_unless_equals_int:
-- * @a: a #gint value or expression
-- * @b: a #gint value or expression
-- *
-- * This macro checks that @a and @b are equal and aborts if this is not the
-- * case, printing both expressions and the values they evaluated to. This
-- * macro is for use in unit tests.
--
--*
-- * assert_equals_int:
-- * @a: a #gint value or expression
-- * @b: a #gint value or expression
-- *
-- * This macro checks that @a and @b are equal and aborts if this is not the
-- * case, printing both expressions and the values they evaluated to. This
-- * macro is for use in unit tests.
--
--*
-- * fail_unless_equals_int64:
-- * @a: a #gint64 value or expression
-- * @b: a #gint64 value or expression
-- *
-- * This macro checks that @a and @b are equal and aborts if this is not the
-- * case, printing both expressions and the values they evaluated to. This
-- * macro is for use in unit tests.
--
--*
-- * assert_equals_int64:
-- * @a: a #gint64 value or expression
-- * @b: a #gint64 value or expression
-- *
-- * This macro checks that @a and @b are equal and aborts if this is not the
-- * case, printing both expressions and the values they evaluated to. This
-- * macro is for use in unit tests.
--
--*
-- * fail_unless_equals_uint64:
-- * @a: a #guint64 value or expression
-- * @b: a #guint64 value or expression
-- *
-- * This macro checks that @a and @b are equal and aborts if this is not the
-- * case, printing both expressions and the values they evaluated to. This
-- * macro is for use in unit tests.
--
--*
-- * assert_equals_uint64:
-- * @a: a #guint64 value or expression
-- * @b: a #guint64 value or expression
-- *
-- * This macro checks that @a and @b are equal and aborts if this is not the
-- * case, printing both expressions and the values they evaluated to. This
-- * macro is for use in unit tests.
--
--*
-- * fail_unless_equals_string:
-- * @a: a string literal or expression
-- * @b: a string literal or expression
-- *
-- * This macro checks that @a and @b are equal (as per strcmp) and aborts if
-- * this is not the case, printing both expressions and the values they
-- * evaluated to. This macro is for use in unit tests.
--
--*
-- * assert_equals_string:
-- * @a: a string literal or expression
-- * @b: a string literal or expression
-- *
-- * This macro checks that @a and @b are equal (as per strcmp) and aborts if
-- * this is not the case, printing both expressions and the values they
-- * evaluated to. This macro is for use in unit tests.
--
--*
-- * fail_unless_equals_float:
-- * @a: a #gdouble or #gfloat value or expression
-- * @b: a #gdouble or #gfloat value or expression
-- *
-- * This macro checks that @a and @b are (almost) equal and aborts if this
-- * is not the case, printing both expressions and the values they evaluated
-- * to. This macro is for use in unit tests.
-- *
-- * Since: 0.10.14
--
--*
-- * assert_equals_float:
-- * @a: a #gdouble or #gfloat value or expression
-- * @b: a #gdouble or #gfloat value or expression
-- *
-- * This macro checks that @a and @b are (almost) equal and aborts if this
-- * is not the case, printing both expressions and the values they evaluated
-- * to. This macro is for use in unit tests.
-- *
-- * Since: 0.10.14
--
--**
-- * thread test macros and variables
--
thread_list : access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/check/gstcheck.h:270
pragma Import (C, thread_list, "thread_list");
mutex : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GMutex; -- gst/check/gstcheck.h:271
pragma Import (C, mutex, "mutex");
-- used to notify main thread of thread startups
start_cond : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GCond; -- gst/check/gstcheck.h:272
pragma Import (C, start_cond, "start_cond");
-- used to synchronize all threads and main thread
sync_cond : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GCond; -- gst/check/gstcheck.h:273
pragma Import (C, sync_cond, "sync_cond");
function gst_g_thread_create
(func : GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GThreadFunc;
data : System.Address;
joinable : GLIB.gboolean;
error : System.Address) return access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GThread; -- gst/check/gstcheck.h:283
pragma Import (C, gst_g_thread_create, "gst_g_thread_create");
function gst_g_mutex_new return access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GMutex; -- gst/check/gstcheck.h:293
pragma Import (C, gst_g_mutex_new, "gst_g_mutex_new");
procedure gst_g_mutex_free (mutex : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GMutex); -- gst/check/gstcheck.h:301
pragma Import (C, gst_g_mutex_free, "gst_g_mutex_free");
procedure gst_g_static_rec_mutex_init (mutex : access GStreamer.GST_Low_Level.glib_2_0_glib_deprecated_gthread_h.GStaticRecMutex); -- gst/check/gstcheck.h:308
pragma Import (C, gst_g_static_rec_mutex_init, "gst_g_static_rec_mutex_init");
function gst_g_cond_new return access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GCond; -- gst/check/gstcheck.h:316
pragma Import (C, gst_g_cond_new, "gst_g_cond_new");
procedure gst_g_cond_free (cond : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GCond); -- gst/check/gstcheck.h:324
pragma Import (C, gst_g_cond_free, "gst_g_cond_free");
function gst_g_cond_timed_wait
(cond : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GCond;
mutex : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GMutex;
abs_time : access GStreamer.GST_Low_Level.glib_2_0_glib_gtypes_h.GTimeVal) return GLIB.gboolean; -- gst/check/gstcheck.h:331
pragma Import (C, gst_g_cond_timed_wait, "gst_g_cond_timed_wait");
-- would be nice if we had clock_rtoffset, but that didn't seem to
-- * make it into the kernel yet...
--
-- if CLOCK_MONOTONIC is not defined then g_get_montonic_time() and
-- * g_get_real_time() are returning the same clock and we'd add ~0
--
-- additional assertions
-- Hack to allow run-time selection of unit tests to run via the
-- * GST_CHECKS environment variable (test function names, comma-separated)
-- skipped func _gst_check_run_test_func
-- skipped func __gst_tcase_add_test
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_check_gstcheck_h;
|
micahwelf/FLTK-Ada | Ada | 855 | ads |
package FLTK.Widgets.Valuators.Sliders.Nice is
type Nice_Slider is new Slider with private;
type Nice_Slider_Reference (Data : not null access Nice_Slider'Class) is
limited null record with Implicit_Dereference => Data;
package Forge is
function Create
(X, Y, W, H : in Integer;
Text : in String)
return Nice_Slider;
end Forge;
procedure Draw
(This : in out Nice_Slider);
function Handle
(This : in out Nice_Slider;
Event : in Event_Kind)
return Event_Outcome;
private
type Nice_Slider is new Slider with null record;
overriding procedure Finalize
(This : in out Nice_Slider);
pragma Inline (Draw);
pragma Inline (Handle);
end FLTK.Widgets.Valuators.Sliders.Nice;
|
jamiepg1/sdlada | Ada | 4,127 | adb | --------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2014 Luke A. Guest
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
with Ada.Unchecked_Conversion;
with SDL.Error;
with System;
package body SDL.Video.Rectangles is
use type C.int;
function To_Address is new Ada.Unchecked_Conversion (Source => Rectangle_Access, Target => System.Address);
function Enclose (Points : in Point_Arrays; Clip : in Rectangle; Enclosed : out Rectangle) return Boolean is
function SDL_Enclose_Points (P : in Point_Arrays; L : in C.int; Clip : in Rectangle; R : out Rectangle) return C.int with
Import => True,
Convention => C,
External_Name => "SDL_EnclosePoints";
Result : C.int := SDL_Enclose_Points (Points, C.int (Points'Length), Clip, Enclosed);
begin
return (Result = SDL_True);
end Enclose;
procedure Enclose (Points : in Point_Arrays; Enclosed : out Rectangle) is
function SDL_Enclose_Points (P : in Point_Arrays; L : in C.int; Clip : in System.Address; R : out Rectangle) return C.int with
Import => True,
Convention => C,
External_Name => "SDL_EnclosePoints";
Result : C.int := SDL_Enclose_Points (Points, C.int (Points'Length), System.Null_Address, Enclosed);
begin
if Result /= SDL_True then
raise Rectangle_Error with SDL.Error.Get;
end if;
end Enclose;
function Has_Intersected (A, B : in Rectangle) return Boolean is
function SDL_Has_Intersection (A, B : in Rectangle) return C.int with
Import => True,
Convention => C,
External_Name => "SDL_HasIntersection";
Result : C.int := SDL_Has_Intersection (A, B);
begin
return (Result = SDL_True);
end Has_Intersected;
function Intersects (A, B : in Rectangle; Intersection : out Rectangle) return Boolean is
function SDL_Intersect_Rect (A, B : in Rectangle; R : out Rectangle) return C.int with
Import => True,
Convention => C,
External_Name => "SDL_IntersectRect";
Result : C.int := SDL_Intersect_Rect (A, B, R => Intersection);
begin
return (Result = SDL_True);
end Intersects;
function Clip_To (Clip_Area : in Rectangle; Line : in out Line_Segment) return Boolean is
function SDL_Intersect_Rect_And_Line (R : in Rectangle; X1, Y1, X2, Y2 : in out C.int) return C.int with
Import => True,
Convention => C,
External_Name => "SDL_IntersectRectAndLine";
Result : C.int := SDL_Intersect_Rect_And_Line (Clip_Area, Line.Start.X, Line.Start.Y, Line.Finish.X, Line.Finish.Y);
begin
return (Result = SDL_True);
end Clip_To;
function Union (A, B : in Rectangle) return Rectangle is
procedure SDL_Union_Rect (A, B : in Rectangle; R : out Rectangle) with
Import => True,
Convention => C,
External_Name => "SDL_IntersectRectAndLine";
Result : Rectangle;
begin
SDL_Union_Rect (A, B, Result);
return Result;
end Union;
end SDL.Video.Rectangles;
|
MinimSecure/unum-sdk | Ada | 1,149 | ads | -- Copyright 2014-2019 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package Pack is
type Interactive_Command is abstract tagged null record;
type Interactive_Command_Access is access all Interactive_Command'Class;
type String_Access is access all String;
type My_Command is new Interactive_Command with record
menu_name : String_Access;
end record;
function New_Command return Interactive_Command_Access;
procedure Id (C : in out Interactive_Command_Access);
end Pack;
|
XMoose25X/Advanced-Dungeon-Assault | Ada | 29,622 | adb | With Ada.Text_IO, Ada.Integer_Text_IO, Ada.Float_Text_IO, stats, display, player, inventory_list, Ada.Unchecked_Deallocation, System.Address_Image;
Use Ada.Text_IO, Ada.Integer_Text_IO, Ada.Float_Text_IO, stats, display, player, inventory_list;
---------------------------------------------------------------------------------------------------
Package Body game_map is
---------------------------------------------------------------------------------------------------
-- Mathew Moose, Mark Bambino, Ryan Bost
-- Map Package
---------------------------------------------------------------------------------------------------
Map_File : File_Type;
Type Item_Set is Array (1..30) of Integer;
Function Empty (Position : in Room_Ptr) Return Boolean is
Begin
If (Position = NULL) then
Return False;
Else
Return True;
End If;
End Empty;
---------------------------------------------------------------------------------------------------
Procedure Action(Pos : in out Room_Ptr; Map : in out Map_Type; My_Player : in out Player_Type; RoomID : out Integer) is
User : Character := 'o';
Chance : Integer;
begin
If (Pos.Boss = True) then
-- Start Battle
RoomID := 99;
pos.Boss := false;
Elsif (Pos.Statue = True) then -- Statue Location Handling
Map(Pos.Y_Axis, Pos.X_Axis).Color := 's';
--Put(ASCII.ESC & "[H");
Put(ASCII.ESC & "[39;4H");
Put_Line("Found Statue! Y/N ");
Loop
Get_Immediate(User);
If (User = 'n') OR (User ='N') then
RoomID := 49;
New_Line(20);
Exit;
Elsif (User = 'y') OR (User = 'Y') then
RoomID := 50;
Pos.Statue := False;
Map(Pos.Y_Axis, Pos.X_Axis).Color := 't';
New_Line(20);
Exit;
Else
Put(ASCII.ESC & "[39;40H");
Put_Line("Enter a valid character.");
End If;
End Loop;
Elsif (Pos.Item >= 0) then -- Item Location Handling
Map(Pos.Y_Axis, Pos.X_Axis).Color := 's';
Put(ASCII.ESC & "[39;4H");
Put_Line("Found Item Chest! Open it? Y/N ");
Loop
Get_Immediate(User);
If (User = 'n') OR (User ='N') then
RoomID := 31;
New_Line(20);
Exit;
Elsif (User = 'y') OR (User = 'Y') then
RoomID := (Pos.Item); -- Display in Main
Insert(Pos.Item, My_Player.Backpack); -- Add Item
Pos.Item := -1;
Map(Pos.Y_Axis, Pos.X_Axis).Color := 't';
New_Line(20);
Exit;
Else
Put(ASCII.ESC & "[39;40H");
Put_Line("Enter a valid character.");
End If;
End Loop;
Else -- Regular Room
Chance := RandomZero(100);
If (Chance <= 20) then
RoomID := 0;
End If;
End If;
If (Pos.Item = -1) AND (Pos.Statue = False) then -- Set Map Colors
Map(Pos.Y_Axis, Pos.X_Axis).Color := 't';
Else
Map(Pos.Y_Axis, Pos.X_Axis).Color := 's';
End If;
End Action;
---------------------------------------------------------------------------------------------------
Procedure Move_North(Pos : in out Room_Ptr; Map : in out Map_Type; My_Player : in out Player_Type; RoomID : out Integer) is
Item : Integer := -1;
begin
If (Pos.North = NULL) then
RoomID:= 77;
Else
Pos := Pos.North;
Action(Pos, Map, My_Player, Item);
RoomID := Item;
End If;
end Move_North;
---------------------------------------------------------------------------------------------------
Procedure Move_East(Pos : in out Room_Ptr; Map : in out Map_Type; My_Player : in out Player_Type; RoomID : out Integer) is
Item : Integer := -1;
begin
If (Pos.East = NULL) then
RoomID:= 77;
Else
Pos := Pos.East;
Action(Pos, Map, My_Player, Item);
RoomID := Item;
End If;
end Move_East;
---------------------------------------------------------------------------------------------------
Procedure Move_South(Pos : in out Room_Ptr; Map : in out Map_Type; My_Player : in out Player_Type; RoomID : out Integer) is
Item : Integer := -1;
begin
If (Pos.South = NULL) then
RoomID:= 77;
Else
Pos := Pos.South;
Action(Pos, Map, My_Player, Item);
RoomID := Item;
End If;
end Move_South;
---------------------------------------------------------------------------------------------------
Procedure Move_West(Pos : in out Room_Ptr; Map : in out Map_Type; My_Player : in out Player_Type; RoomID : out Integer) is
Item : Integer := -1;
begin
If (Pos.West = NULL) then
RoomID:= 77;
Else
Pos := Pos.West;
Action(Pos, Map, My_Player, Item);
RoomID := Item;
End If;
end Move_West;
---------------------------------------------------------------------------------------------------
Function "=" (A,B : Room) Return Boolean is
Begin
If ((A.X_Axis = B.X_Axis) AND (A.Y_Axis = B.Y_Axis)) Then
Return True;
Else
Return False;
End If;
End "=";
---------------------------------------------------------------------------------------------------
Function "=" (A : Room_Ptr; B : Room) Return Boolean is
Begin
If ((A.X_Axis = B.X_Axis) AND (A.Y_Axis = B.Y_Axis)) Then
Return True;
Else
Return False;
End If;
End "=";
---------------------------------------------------------------------------------------------------
Procedure Print(Current : in Room_Ptr; Map : in Map_Type) is
Begin
Put("Location: (");
Put(Current.X_Axis, Width => 0);
Put(",");
Put(Current.Y_Axis, Width => 0);
Put_Line(")");
Put("North: (");
If Current.North = NULL then
Put("Wall");
Else
Put(Current.North.X_Axis, Width => 0);
Put(",");
Put(Current.North.Y_Axis, Width => 0);
End If;
Put_Line(")");
Put("East: (");
If Current.East = NULL then
Put("Wall");
Else
Put(Current.East.X_Axis, Width => 0);
Put(",");
Put(Current.East.Y_Axis, Width => 0);
End If;
Put_Line(")");
Put("South: (");
If Current.South = NULL then
Put("Wall");
Else
Put(Current.South.X_Axis, Width => 0);
Put(",");
Put(Current.South.Y_Axis, Width => 0);
End If;
Put_Line(")");
Put("West: (");
If Current.West = NULL then
Put("Wall");
Else
Put(Current.West.X_Axis, Width => 0);
Put(",");
Put(Current.West.Y_Axis, Width => 0);
End If;
Put_Line(")");
Put("Item: ");
Put(Item => Current.Item, Width => 0);
New_Line;
Put("Boss: ");
If (Current.Boss = True) Then
Put_Line("True");
Else
Put_Line("False");
End If;
Put("Statue: ");
If (Current.Statue = True) Then
Put_Line("True");
Else
Put_Line("False");
End If;
Put("Color:");
Put(Map(Current.Y_Axis, Current.X_Axis).Color);
End Print;
---------------------------------------------------------------------------------------------------
Procedure Search (Position : in Room_Ptr; Key : in Room; Location : out Room_Ptr; Found : out Boolean) is
Temp : Room_Ptr;
Begin
If (Position = Key) then
Location := Position; -- Saves Location of Room with Key Coordinates
Found := True; -- Used to Break Recursive Calls
Return;
Else
If (Position.North /= NULL) AND Then (Position.North.Traversed = False) then
Temp := Position.North;
Temp.Traversed := True;
Search(Temp, Key, Location, Found);
If (Found = True) then -- Break out of the Recursive Calls
Return;
End If;
End If;
If (Position.East /= NULL) AND Then (Position.East.Traversed = False) then
Temp := Position.East;
Temp.Traversed := True;
Search(Temp, Key, Location, Found);
If (Found = True) then -- Break out of the Recursive Calls
Return;
End If;
End If;
If (Position.South /= NULL) AND Then (Position.South.Traversed = False) then
Temp := Position.South;
Temp.Traversed := True;
Search(Temp, Key, Location, Found);
If (Found = True) then -- Break out of the Recursive Calls
Return;
End If;
End If;
If (Position.West /= NULL) AND Then(Position.West.Traversed = False) then
Temp := Position.West;
Temp.Traversed := True;
Search(Temp, Key, Location, Found);
If (Found = True) then -- Break out of the Recursive Calls
Return;
End If;
End If;
End If;
End Search;
---------------------------------------------------------------------------------------------------
Procedure Reset (Location : in Room_Ptr) is
Temp : Room_Ptr;
Begin
Temp := Location;
Temp.Traversed := False;
If (Location.North /= NULL) AND Then (Location.North.Traversed = True) then
Temp := Location.North;
Temp.Traversed := False;
Reset(Temp);
End If;
If (Location.East /= NULL) AND Then (Location.East.Traversed = True) then
Temp := Location.East;
Temp.Traversed := False;
Reset(Temp);
End If;
If (Location.South /= NULL) AND Then (Location.South.Traversed = True) then
Temp := Location.South;
Temp.Traversed := False;
Reset(Temp);
End If;
If (Location.West /= NULL) AND Then(Location.West.Traversed = True) then
Temp := Location.West;
Temp.Traversed := False;
Reset(Temp);
End If;
End Reset;
---------------------------------------------------------------------------------------------------
Procedure Traverse (Location : in Room_Ptr; Floor_Map : in out Map_Type; Show_North : in Boolean := True;
Show_East : in Boolean := True; Show_South : in Boolean := True; Show_West : in Boolean := True) is
Temp : Room_Ptr;
Begin
Temp := Location;
If (Temp.Boss = True) then
NULL; -- Don't Change Character when Discovered
Elsif (Temp.Statue = True) then
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Chars := Statue_Icon;
Elsif (Temp.Item >= 0) then
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Chars := Chest_Icon; -- ∞
Else
If (Temp.North /= NULL) then
If (Temp.South /= NULL) then
If (Temp.East /= NULL) then
If (Temp.West /= NULL) then
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Chars := Character'Val(206); -- ╬
If (Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 't') OR
(Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 's')then
NULL;
Else
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color := 'd';
End If;
Elsif (Temp.West = NULL) then
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Chars := Character'Val(204); -- ╠
If (Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 't') OR
(Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 's')then
NULL;
Else
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color := 'd';
End If;
End If;
Elsif (Temp.East = NULL) then
If (Temp.West /= NULL) then
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Chars := Character'Val(185); -- ╣
If (Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 't') OR
(Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 's')then
NULL;
Else
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color := 'd';
End If;
Elsif (Temp.West = NULL) then
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Chars := Character'Val(186); -- ║
If (Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 't') OR
(Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 's')then
NULL;
Else
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color := 'd';
End If;
End If;
End If;
Elsif (Temp.South = NULL) then
If (Temp.East /= NULL) then
If (Temp.West /= NULL) then
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Chars := Character'Val(202); -- ╩
If (Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 't') OR
(Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 's')then
NULL;
Else
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color := 'd';
End If;
Elsif (Temp.West = NULL) then
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Chars := Character'Val(200); -- ╚
If (Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 't') OR
(Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 's')then
NULL;
Else
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color := 'd';
End If;
End If;
Elsif (Temp.East = NULL) then
If (Temp.West /= NULL) then
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Chars := Character'Val(188); -- ╝
If (Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 't') OR
(Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 's')then
NULL;
Else
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color := 'd';
End If;
Elsif (Temp.West = NULL) then
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Chars := Character'Val(186); -- ║
If (Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 't') OR
(Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 's')then
NULL;
Else
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color := 'd';
End If;
End If;
End If;
End If;
Elsif (Temp.North = NULL) then
If (Temp.South /= NULL) then
If (Temp.East /= NULL) then
If (Temp.West /= NULL) then
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Chars := Character'Val(203); -- ╦
If (Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 't') OR
(Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 's')then
NULL;
Else
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color := 'd';
End If;
Elsif (Temp.West = NULL) then
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Chars := Character'Val(201); -- ╔
If (Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 't') OR
(Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 's')then
NULL;
Else
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color := 'd';
End If;
End If;
Elsif (Temp.East = NULL) then
If (Temp.West /= NULL) then
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Chars := Character'Val(187); -- ╗
If (Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 't') OR
(Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 's')then
NULL;
Else
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color := 'd';
End If;
Elsif (Temp.West = NULL) then
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Chars := Character'Val(186); -- ║
If (Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 't') OR
(Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 's')then
NULL;
Else
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color := 'd';
End If;
End If;
End If;
Elsif (Temp.South = NULL) then
If (Temp.East /= NULL) then
If (Temp.West /= NULL) then
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Chars := Character'Val(205); -- ═
If (Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 't') OR
(Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 's')then
NULL;
Else
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color := 'd';
End If;
Elsif (Temp.West = NULL) then
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Chars := Character'Val(205); -- ═
If (Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 't') OR
(Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 's')then
NULL;
Else
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color := 'd';
End If;
End If;
Elsif (Temp.East = NULL) then
If (Temp.West /= NULL) then
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Chars := Character'Val(205); -- ═
If (Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 't') OR
(Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 's')then
NULL;
Else
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color := 'd';
End If;
Elsif (Temp.West = NULL) then
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Chars := Character'Val(219); -- █
If (Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 't') OR
(Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color = 's')then
NULL;
Else
Floor_Map(Temp.Y_Axis, Temp.X_Axis).Color := 'd';
End If;
End If;
End If;
End If;
End If;
End If;
-- After this point, all adjacent rooms will become visible
If (Show_North = True) Then
If (Location.North /= NULL) then
Temp := Location.North;
Traverse(Temp, Floor_Map, False, False, False, False); -- Calls to assign value
Temp := Location;
Else
If (Temp.Y_Axis = 1) then NULL;
Else
Floor_Map(Temp.Y_Axis - 1, Temp.X_Axis).Chars := Character'Val(219); -- █
End If;
End If;
End If;
If (Show_East = True) Then
If (Location.East /= NULL) then
Temp := Location.East;
Traverse(Temp, Floor_Map, False, False, False, False); -- Calls to assign value
Temp := Location;
Else
If (Temp.X_Axis = Floor_Map'Length(2)) then NULL;
Else
Floor_Map(Temp.Y_Axis, Temp.X_Axis + 1).Chars := Character'Val(219); -- █
End If;
End If;
End If;
If (Show_South = True) Then
If (Location.South /= NULL) then
Temp := Location.South;
Traverse(Temp, Floor_Map, False, False, False, False); -- Calls to assign value
Temp := Location;
Else
If (Temp.Y_Axis = Floor_Map'Length(1)) then NULL;
Else
Floor_Map(Temp.Y_Axis + 1, Temp.X_Axis).Chars := Character'Val(219); -- █
End If;
End If;
End If;
If (Show_West = True) Then
If (Location.West /= NULL) then
Temp := Location.West;
Traverse(Temp, Floor_Map, False, False, False, False); -- Calls to assign value
Temp := Location;
Else
If (Temp.X_Axis = 1) then NULL;
Else
Floor_Map(Temp.Y_Axis, Temp.X_Axis - 1).Chars := Character'Val(219); -- █
End If;
End If;
End If;
End Traverse;
---------------------------------------------------------------------------------------------------
Procedure Show_Screen (Location : in out Room_Ptr; Floor_Map : in out Map_Type) is
Temp : Room_Ptr;
X_Offset : Integer := 0;
Y_Offset : Integer := 0;
Level : Integer := 1;
begin
clearDisplay;
Temp := Location;
If (Floor_Map'Length(2) = 5) then
Level := 4;
Else
Level := Floor_Map'Length(1) / 10;
End If;
if (Level = 1) then
X_Offset := 67;
Y_Offset := 11;
elsif (Level = 2) then
X_Offset := 57;
Y_Offset := 6;
elsif (Level = 3) then
X_Offset := 50;
Y_Offset := 0;
elsif (Level = 4) then
X_Offset := 69;
Y_Offset := 11;
End if;
setText(1,1, "-----World Map Actions-----", colorWhiteL);
setText(1,2, "Press 'w' to Move North", colorWhiteL);
setText(1,3, "Press 'a' to Move West", colorWhiteL);
setText(1,4, "Press 's' to Move South", colorWhiteL);
setText(1,5, "Press 'd' to Move East", colorWhiteL);
setText(1,6, "Press 'i' to Open Inventory", colorWhiteL);
setText(1,7, "Press 'q' to Quit Game", colorWhiteL);
setText(123,1, "-------Map Key-------", colorWhiteL);
setText(136,2, "O", colorMag);
setText(137,2, " is you", colorWhiteL);
setText(131,3, Boss_Icon, colorRed); -- Ω
setText(132,3, " is the boss", colorWhiteL);
setText(124,4, Statue_Icon, colorYellow);
setText(125,4, " is an angel statue", colorWhiteL);
setText(132,5, Chest_Icon, colorYellow);
setText(133,5, " is a chest", colorWhiteL);
Traverse(Location, Floor_Map);
for i in 1..Floor_Map'Length(1) loop
for j in 1..Floor_Map'Length(2) loop
if (Temp.X_Axis = j) and (Temp.Y_Axis = i) then -- Position Color
setPixel(j + X_Offset, i + Y_Offset,'O', colorMag);
else
if (Floor_Map(i,j).Chars = Boss_Icon) then -- Boss Room Color
setPixel(j + X_Offset, i + Y_Offset,Floor_Map(i,j).Chars, colorRed);
elsif (Floor_Map(i,j).Chars = Character'Val(219)) then -- Wall Color
setPixel(j + X_Offset, i + Y_Offset,Floor_Map(i,j).Chars, colorBlue);
Elsif (Floor_Map(i,j).Chars = Character'Val(178)) then -- Unknown Color
setPixel(j + X_Offset, i + Y_Offset,Floor_Map(i,j).Chars, colorBlackL);
Else -- Path Color
If (Floor_Map(i,j).Color = 'd') then
setPixel(j + X_Offset, i + Y_Offset,Floor_Map(i,j).Chars, colorBlackL);
Elsif (Floor_Map(i,j).Color = 't') then
setPixel(j + X_Offset, i + Y_Offset,Floor_Map(i,j).Chars, colorGreen);
Elsif (Floor_Map(i,j).Color = 's') then
setPixel(j + X_Offset, i + Y_Offset,Floor_Map(i,j).Chars, colorYellow);
End If;
End If;
end if;
end loop;
new_Line;
end loop;
--Refresh;
end Show_Screen;
---------------------------------------------------------------------------------------------------
Procedure Generate (Level : in Integer) is
Random : Integer;
begin
Random := RandomRange(3);
If (Level = 1) Then
If (Random = 1) then
Open(File => Map_File, Mode => In_File, Name => "Maps/Level_1/Lvl_1_a.txt");
Elsif (Random = 2) then
Open(File => Map_File, Mode => In_File, Name => "Maps/Level_1/Lvl_1_b.txt");
Elsif (Random = 3) then
Open(File => Map_File, Mode => In_File, Name => "Maps/Level_1/Lvl_1_c.txt");
End If;
End If;
If (Level = 2) Then
If (Random = 1) then
Open(File => Map_File, Mode => In_File, Name => "Maps/Level_2/Lvl_2_a.txt");
Elsif (Random = 2) then
Open(File => Map_File, Mode => In_File, Name => "Maps/Level_2/Lvl_2_b.txt");
Elsif (Random = 3) then
Open(File => Map_File, Mode => In_File, Name => "Maps/Level_2/Lvl_2_c.txt");
End If;
End If;
If (Level = 3) Then
If (Random = 1) then
Open(File => Map_File, Mode => In_File, Name => "Maps/Level_3/Lvl_3_a.txt");
Elsif (Random = 2) then
Open(File => Map_File, Mode => In_File, Name => "Maps/Level_3/Lvl_3_b.txt");
Elsif (Random = 3) then
Open(File => Map_File, Mode => In_File, Name => "Maps/Level_3/Lvl_3_c.txt");
End If;
End If;
If (Level = 4) Then
Open(File => Map_File, Mode => In_File, Name => "Maps/Level_4/Lvl_4.txt");
End If;
End Generate;
---------------------------------------------------------------------------------------------------
Procedure Initialize (Level : in out Coords; Start : Out Room_Ptr) is
Floor : Integer;
begin
If (Level'Length(2) = 5) then
Floor := 4;
Else
Floor := Level'Length(1) / 10; -- Determine Level by Size of Map
End If;
Generate(Floor);
For i in 1..Level'Length(1) Loop -- Outer Loop for Y-Axis
For j in 1..Level'Length(2) Loop -- Inner Loop for X-Axis
Get(File => Map_File, Item => Level(i,j)); -- Row Dominant, (y,x)
--Put(Level(i,j), Width => 0);
End Loop;
If Not End_of_File (Map_File) then -- Checks for End of File
Skip_Line(Map_File); -- Moves to Next Line
end If;
New_Line;
End Loop;
Close(Map_File);
Start := new Room'(North => NULL, East => NULL, South => NULL, West => NULL,
Y_Axis => Level'Length(1), X_Axis => (Level'Length(2) / 2 + 1),
Item => -1, Statue => False, Boss => False, Traversed => False, Set => False);
end Initialize;
---------------------------------------------------------------------------------------------------
Procedure Alter (Layout : in Coords; Area : in out Room_Ptr; Map : in out Map_Type) is
Level : Integer;
Items_1 : Item_Set := (14, 15, 16, 17, 18, 19, 20, 07, 06, 21, Others => 0); -- 11
Items_2 : Item_Set := (14, 15, 16, 17, 18, 19, 20, 07, 01, 02, 03, 04, 05, 06, 21, 08, 09, 10, 11, 12, 13, 22, 23, 30, Others => 0); -- 24
Items_3 : Item_Set := (14, 15, 16, 17, 18, 19, 20, 07, 01, 02, 03, 04, 05, 06, 21, 08, 09, 10, 11, 12, 13, 22, 23, 30, 24, 25, 26, 27, 28, 29); -- 30
begin
If (Map'Length(2) = 5) then
Level := 4;
Else
Level := Map'Length(1) / 10; -- Determine Level by Size of Map
End If;
If (Layout((Area.Y_Axis),(Area.X_Axis)) = 2) Then -- Item
If (Level = 1) then -- Only Get Level 1 Items
Area.Item := Items_1(RandomRange(11));
Elsif (Level = 2) then -- Only Get Level 2 Items
Area.Item := Items_2(RandomRange(24));
Elsif (Level = 3) then -- Only Get Level 3 Items
Area.Item := Items_3(RandomRange(30));
Else -- Level 4 Items
Area.Item := Items_3(RandomRange(30));
End If;
Map((Area.Y_Axis),(Area.X_Axis)).Color := 'd';
Elsif (Layout((Area.Y_Axis),(Area.X_Axis)) = 9) Then -- Boss
Area.Boss := True;
Map((Area.Y_Axis),(Area.X_Axis)).Chars := Boss_Icon; -- Ω
Map((Area.Y_Axis),(Area.X_Axis)).Color := 'b';
Elsif (Layout((Area.Y_Axis),(Area.X_Axis)) = 3) Then -- Statue
Area.Statue := True;
Map((Area.Y_Axis),(Area.X_Axis)).Color := 'd';
End If;
End Alter;
---------------------------------------------------------------------------------------------------
Procedure Link(Level : in out Coords; Current : in out Room_Ptr; Map : in out Map_Type) is
Key : Room; -- Used for Finding if a Room Exists at a Specific Coordinate
Temp : Room_Ptr; -- Will Point to Key
Found : Boolean := False; -- Triggers if Key is Found
Begin
Begin -- Checking for Rooms North
If ((Level(Current.Y_Axis - 1, Current.X_Axis) /= 0) AND (Current.North = NULL)) Then -- Room Should Exist to North
Key.Y_Axis := Current.Y_Axis - 1; -- Declaring the Map Coordinates
Key.X_Axis := Current.X_Axis; -- Declaring the Map Coordinates
Search(Current, Key, Temp, Found); -- Sees if the Key Has Already Been Made
Reset(Current); -- Resets Traversed Flags
If (Found = False) then -- Making New Room to North
Current.North := New Room'(North => NULL, East => NULL, South => Current, West => NULL, Y_Axis => Current.Y_Axis - 1,
X_Axis => Current.X_Axis, Item => -1, Statue => False, Boss => False, Traversed => False, Set => False);
Alter(Level, Current.North, Map);
Elsif (Found = True) then -- Linking to Room North
Current.North := Temp;
Current.North.South := Current;
Found := False; -- Reset Flag
End If;
End If;
Exception
When Constraint_Error => NULL;
End;
Begin -- Checking for Rooms South
If ((Level(Current.Y_Axis + 1, Current.X_Axis) /= 0) AND (Current.South = NULL)) then -- Room Should Exist to South
-- Put_Line("South Shows 1");
Key.Y_Axis := Current.Y_Axis + 1; -- Declaring the Map Coordinates
Key.X_Axis := Current.X_Axis; -- Declaring the Map Coordinates
Search(Current, Key, Temp, Found); -- Sees if the Key Has Already Been Made
Reset(Current); -- Resets Traversed Flags
If (Found = False) then -- Making New Room to South
Current.South := New Room'(North => Current, East => NULL, South => NULL, West => NULL, Y_Axis => Current.Y_Axis + 1,
X_Axis => Current.X_Axis, Item => -1, Statue => False, Boss => False, Traversed => False, Set => False);
Alter(Level, Current.South, Map);
Elsif (Found = True) then -- Linking to Room South
Current.South := Temp;
Current.South.North := Current;
Found := False; -- Reset Flag
End If;
End If;
Exception
When Constraint_Error => NULL;
End;
Begin -- Checking for Rooms East
If ((Level(Current.Y_Axis, Current.X_Axis + 1) /= 0) AND (Current.East = NULL)) then -- Room Should Exist to East
--Put_Line("East Shows 1");
Key.Y_Axis := Current.Y_Axis; -- Declaring the Map Coordinates
Key.X_Axis := Current.X_Axis + 1; -- Declaring the Map Coordinates
Search(Current, Key, Temp, Found); -- Sees if the Key Has Already Been Made
Reset(Current); -- Resets Traversed Flags
If (Found = False) then -- Making New Room to East
Current.East := New Room'(North => NULL, East => NULL, South => NULL, West => Current, Y_Axis => Current.Y_Axis,
X_Axis => Current.X_Axis + 1, Item => -1, Statue => False, Boss => False, Traversed => False, Set => False);
Alter(Level, Current.East, Map);
Elsif (Found = True) then -- Linking to Room East
Current.East := Temp;
Current.East.West := Current;
Found := False; -- Reset Flag
End If;
End If;
Exception
When Constraint_Error => NULL;
End;
Begin -- Checking for Rooms West
If ((Level(Current.Y_Axis, Current.X_Axis - 1) /= 0) AND (Current.West = NULL)) then -- Room Should Exist to West
--Put_Line("West Shows 1");
Key.Y_Axis := Current.Y_Axis; -- Declaring the Map Coordinates
Key.X_Axis := Current.X_Axis - 1; -- Declaring the Map Coordinates
Search(Current, Key, Temp, Found); -- Sees if the Key Has Already Been Made
Reset(Current); -- Resets Traversed Flags
If (Found = False) then -- Making New Room West
Current.West := New Room'(North => NULL, East => Current, South => NULL, West => NULL, Y_Axis => Current.Y_Axis,
X_Axis => Current.X_Axis - 1, Item => -1, Statue => False, Boss => False, Traversed => False, Set => False);
Alter(Level, Current.West, Map);
Elsif (Found = True) then -- Linking Room West
Current.West := Temp;
Current.West.East := Current;
Found := False; -- Reset Flag
End If;
End If;
Exception
When Constraint_Error => NULL;
End;
Current.Set := True; -- Makes sure no room is visited twice
If (Current.North /= NULL) AND then (Current.North.Set = False) then -- Recursive Call North
Link(Level,Current.North, Map);
End If;
If (Current.East /= NULL) AND then (Current.East.Set = False) then -- Recursive Call East
Link(Level,Current.East, Map);
End If;
If (Current.South /= NULL) AND then (Current.South.Set = False) then -- Recursive Call South
Link(Level,Current.South, Map);
End If;
If (Current.West /= NULL) AND then (Current.West.Set = False) then -- Recursive Call West
Link(Level,Current.West, Map);
End If;
End Link;
---------------------------------------------------------------------------------------------------
procedure Free is new Ada.Unchecked_Deallocation(Object => Room, Name => Room_Ptr);
-- Grabage Collection
---------------------------------------------------------------------------------------------------
Procedure Delete_Map (Location : in out Room_Ptr) is
Temp : Room_Ptr;
Begin
Temp := Location;
Temp.Traversed := True;
If (Location.North /= NULL) AND Then (Location.North.Traversed = False) then
Temp := Location.North;
Temp.Traversed := True;
Delete_Map(Temp);
End If;
If (Location.East /= NULL) AND Then (Location.East.Traversed = False) then
Temp := Location.East;
Temp.Traversed := True;
Delete_Map(Temp);
End If;
If (Location.South /= NULL) AND Then (Location.South.Traversed = False) then
Temp := Location.South;
Temp.Traversed := True;
Delete_Map(Temp);
End If;
If (Location.West /= NULL) AND Then(Location.West.Traversed = False) then
Temp := Location.West;
Temp.Traversed := True;
Delete_Map(Temp);
End If;
Free(Location);
End Delete_Map;
---------------------------------------------------------------------------------------------------
End game_map;
|
zhmu/ananas | Ada | 2,598 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . I M G _ R E A L --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package does not require a body, since it is a package renaming. We
-- provide a dummy file containing a No_Body pragma so that previous versions
-- of the body (which did exist) will not interfere.
pragma No_Body;
|
msrLi/portingSources | Ada | 3,033 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- Sample.Curses_Demo.Mouse --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control
-- $Revision: 1.9 $
-- Binding Version 01.00
------------------------------------------------------------------------------
package Sample.Curses_Demo.Mouse is
procedure Demo;
end Sample.Curses_Demo.Mouse;
|
MinimSecure/unum-sdk | Ada | 811 | adb | -- Copyright 2012-2016 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package body Pck is
procedure Do_Nothing is
begin
null;
end Do_Nothing;
end Pck;
|
Blady-Com/AARM_Examples | Ada | 13,279 | adb | procedure AARM_2012_CH06 is
package Needed_To_Compile is
-- Needed to compile, sometimes dummy
-- K : constant := 99;
-- G : constant Character := '@';
-- type Coordinate is (X, Y);
type Real is digits 8;
type Matrix is array (Integer range <>, Integer range <>) of Real;
type Vector is array (Integer range <>) of Real;
subtype Month_Name is String (1 .. 3);
type Gender is (MM, FF);
type Date is record
Day : Integer range 1 .. 31;
Month : Month_Name;
Year : Integer range 0 .. 4000;
end record;
type Person (<>); -- incomplete type declaration
type Car is tagged; -- incomplete type declaration
type Person_Name is access Person;
type Car_Name is access all Car'Class;
type Car is tagged record
Number : Integer;
Owner : Person_Name;
end record;
type Person (Sex : Gender) is record
Name : String (1 .. 20);
Birth : Date;
Age : Integer range 0 .. 130;
Vehicle : Car_Name;
case Sex is
when MM =>
Wife : Person_Name (FF); --@@ gnatpp error (Sex => FF);
when FF =>
Husband : Person_Name (MM); --@@ gnatpp error (Sex => MM);
end case;
end record;
-- type Binop_Ptr is access all Integer;
type Bit_Vector is array (Integer range <>) of Boolean;
type Table is array (1 .. 10) of Integer;
N : constant := 199;
M : constant := 99;
PI : constant := 3.14;
type Day is (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
-- package Key_Manager is
-- subtype Key is Integer;
-- end Key_Manager;
-- Max : constant := 500; -- an integer number
-- Page_Size : constant := 100;
-- subtype Cylinder_Index is Natural;
-- subtype Track_Number is Natural;
-- function Dispersion (X : Real) return Real;
Max_Value : constant := 99;
type Color is (White, Red, Yellow, Green, Blue, Brown, Black);
type Frame is access Matrix;
function Next_Frame (K : Positive) return Frame; -- see 3.10
function Dot_Product (Left, Right : Vector) return Real; -- see 3.6
type Device is (Printer, Disk, Drum);
type State is (Open, Closed);
Page_Size : constant := 100;
subtype Cylinder_Index is Natural;
subtype Track_Number is Natural;
type Peripheral (Unit : Device := Disk) is record
Status : State;
case Unit is
when Printer =>
Line_Count : Integer range 1 .. Page_Size;
when others =>
Cylinder : Cylinder_Index;
Track : Track_Number;
end case;
end record;
Writer : Peripheral (Unit => Printer);
procedure Check (V : Boolean) is null;
end Needed_To_Compile;
package body Needed_To_Compile is
function Next_Frame (K : Positive) return Frame is
begin
return null;
end Next_Frame;
function Dot_Product (Left, Right : Vector) return Real is
begin
return 0.0;
end Dot_Product;
end Needed_To_Compile;
-- 6.1 Subprogram Declarations
package Parapraph_6_1_37 is
use Needed_To_Compile;
type Cell; -- incomplete type declaration
type Link is access Cell;
type Cell is record
Value : Integer;
Succ : Link;
Pred : Link;
end record;
type Line is array (1 .. 99) of Character;
type Line_Size is range 1 .. 99;
subtype Probability is Real range 0.0 .. 1.0; -- a subtype with a smaller range
procedure Traverse_Tree is null;
procedure Increment (X : in out Integer) is null;
procedure Right_Indent (Margin : out Line_Size) is null; -- see 3.5.4
procedure Switch (From, To : in out Link) is null; -- see 3.10.1
function Random return Probability is (0.0); -- see 3.5.7
function Min_Cell (X : Link) return Cell is ((0, null, null)); -- see 3.10.1
function Next_Frame (K : Positive) return Frame is (null); -- see 3.10
function Dot_Product (Left, Right : Vector) return Real is (0.0); -- see 3.6
function "*" (Left, Right : Matrix) return Matrix is ((1 => (1 => 0.0))); -- see 3.6
procedure Print_Header
(Pages : in Natural;
Header : in Line := (1 .. Line'Last => ' '); -- see 3.6
Center : in Boolean := True) is null;
end Parapraph_6_1_37;
package Parapraph_6_1_1_27 is
Tab : array (1 .. 10) of Integer := (others => 0);
procedure Bar (I : in out Natural);--with Post => I > 0 and then Tab(I)'Old = 1; -- Illegal
end Parapraph_6_1_1_27;
package body Parapraph_6_1_1_27 is
procedure Bar (I : in out Natural) is
begin
null;
end Bar;
end Parapraph_6_1_1_27;
-- 6.2 Formal Parameter Modes
--12.l
procedure Copy (X : in out String; Y : String) is
begin
X := Y;
end Copy;
-- 6.3 Subprogram Bodies
procedure Parapraph_6_3_9 is
use Needed_To_Compile;
type Element_Type is new Integer;
type Table is array (Positive range <>) of Element_Type;
type Stack (Size : Positive) is record
Space : Table (1 .. Size);
Index : Natural := 0;
end record;
Stack_Overflow : exception;
procedure Push (E : in Element_Type; S : in out Stack) is
begin
if S.Index = S.Size then
raise Stack_Overflow;
else
S.Index := S.Index + 1;
S.Space (S.Index) := E;
end if;
end Push;
function Dot_Product (Left, Right : Vector) return Real is
Sum : Real := 0.0;
begin
Check (Left'First = Right'First and Left'Last = Right'Last);
for J in Left'Range loop
Sum := Sum + Left (J) * Right (J);
end loop;
return Sum;
end Dot_Product;
begin
null;
end Parapraph_6_3_9;
-- 6.3.1 Conformance Rules
procedure Parapraph_6_3_1_8_21 is
package P is
type Root is tagged null record;
procedure Proc (X : Root) is null;
end P;
use P;
generic
type Formal (<>) is new Root with private;
Value : Formal; --@@
package G is
-- ...
end G;
package body G is
-- ...
X : Formal := Value; --@@
-- ...
procedure Test (P : access procedure (X : Formal)) is null;
begin
Proc (X); -- This is a dispatching call in Instance, because
-- the actual type for Formal is class-wide.
-- ...
-- Proc'Access would be illegal here, because it is of
-- convention Intrinsic, by the above rule.
-- Test(Proc'Access); --@@ no GNAT error, yes with compile file not wit check sementic
end G;
type Actual is new Root with null record;
procedure Proc (X : Actual) is null;
package Instance is new G (Formal => Actual'Class, Value => Actual'(Root with null record)); --@@
-- It is legal to pass in a class-wide actual, because Formal
-- has unknown discriminants.
package A is
function F (X : Integer := 1) return Boolean is (X = 1);
end A;
use A;
package B is
package A_View renames A;
function F_View (X : Integer := 9999) return Boolean renames A.F;
end B;
use A, B;
procedure Main is
B1 : Boolean := F;
B2 : Boolean := A.F;
B3 : Boolean := B.A_View.F;
B4 : Boolean := A_View.F;
B5 : Boolean := F_View; -- not fully conformant to the previous ones
begin
null;
end Main;
begin
null;
end Parapraph_6_3_1_8_21;
-- 6.4 Subprogram Calls
procedure Parapraph_6_4_Section_22 is
use Needed_To_Compile;
type Process_Name is (No_Process, P1, P2);
procedure Activate
(Process : in Process_Name;
After : in Process_Name := No_Process;
Wait : in Duration := 0.0;
Prior : in Boolean := False) is null;
procedure Pair (Left, Right : in Person_Name := new Person (MM)) is null; -- see 3.10.1 --@@ MODIF PP
X, Y : Process_Name;
begin
Activate (X);
Activate (X, After => Y);
Activate (X, Wait => 60.0, Prior => True);
Activate (X, Y, 10.0, False);
Pair;
Pair (Left => new Person (FF), Right => new Person (MM)); --@@ MODIF PP
end Parapraph_6_4_Section_22;
procedure Parapraph_6_4_Section_26 is
use Needed_To_Compile;
type Light is (Red, Green, Orange);
procedure Put (X : in Integer) is null;
procedure Put (X : in String) is null;
procedure Set (Tint : in Color) is null;
procedure Set (Signal : in Light) is null;
begin
Put (28);
Put ("no possible ambiguity here");
Set (Tint => Red);
Set (Signal => Red);
Set (Color'(Red));
end Parapraph_6_4_Section_26;
-- 6.4.1 Parameter Associations
procedure Parapraph_6_4_1_Section_5c is
procedure Print (X : in Integer; Y : in Boolean := True) is null;
procedure Print (Z : in out Integer) is null;
W : Integer;
begin
-- Print(3); -- Ambiguous!
Print (X => 3); -- Not ambigous
end Parapraph_6_4_1_Section_5c;
procedure Parapraph_6_4_1_Section_6i_6l is
type Tagged_Type is tagged record
C : Integer;
end record;
type Element is new Integer;
procedure Swap (L, R : in out Element) is null;
Some_Global_Array : array (1 .. 10) of Element;
Global : Tagged_Type;
procedure Foo (Param : in Tagged_Type := Global) is
X : Element renames Some_Global_Array (Param.C);
begin
Global.C := Global.C + 1;
Swap (X, Some_Global_Array (Param.C)); --illegal but no GNAT error!
-- swap (x, x); GNAT error
end Foo;
type Some_Type is new Integer;
function Func_With_Out_Params (V : out Some_Type) return Some_Type is (0);
procedure P (L, R : Some_Type) is null;
type Ref is access Some_Type;
Ptr : Ref := new Some_Type'(10);
X : Some_Type renames Ptr.all;
begin
Ptr := new Some_Type'(20);
P (Func_With_Out_Params (Ptr.all), X);
end Parapraph_6_4_1_Section_6i_6l;
-- 6.5 Return Statements
procedure Parapraph_6_5_Section_21g is
type T is tagged null record;
type Global is access T'Class;
function F (Ptr : Global) return T'Class is
begin
return Ptr.all;
end F;
function F return T'Class is
Local : T'Class := T'(null record);
begin
return Local;
end F;
X : aliased Integer;
procedure Foo is null;
type Component_Type (Discrim : access Integer := X'Access) is limited null record;
type Undiscriminated is record
Fld : Component_Type;
end record;
function F return Undiscriminated is
Local : aliased Integer;
begin
return X : Undiscriminated := (Fld => (Discrim => Local'Access)) do
Foo;
end return;
-- raises Program_Error after calling Foo.
end F;
begin
null;
end Parapraph_6_5_Section_21g;
-- 25 Examples of return statements:
--
-- 26/2 {AI95-00318-02}
-- return; -- in a procedure body, entry_body,
-- -- accept_statement
-- , or extended_return_statement
--
-- 27 return Key_Value(Last_Index); -- in a function body
--
-- 28/2 {AI95-00318-02}
-- return Node : Cell do -- in a function body, see 3.10.1
-- for Cell
-- Node.Value := Result;
-- Node.Succ := Next_Node;
-- end return;
-- 6.5.1 Nonreturning Procedures
procedure Fail (Msg : String) -- raises Fatal_Error exception
with
No_Return;
procedure Fail (Msg : String) is
Fatal_Error : exception;
begin
raise Fatal_Error;
end Fail;
-- 6.6 Overloading of Operators
-- 9 function "+" (Left, Right : Matrix) return Matrix;
-- function "+" (Left, Right : Vector) return Vector;
--
-- -- assuming that A, B, and C are of the type Vector
-- -- the following two statements are equivalent:
--
-- A := B + C;
-- A := "+"(B, C);
package Parapraph_6_7_Section_6 is
type Expression is tagged null record;
procedure Simplify (Expr : in out Expression) is null; -- see 3.9
-- By default, Simplify does nothing, but it may be overridden in extensions of Expression
end Parapraph_6_7_Section_6;
-- 6.8 Expression Functions
package Parapraph_6_8_Section_9 is
type Real is digits 8;
type Point is tagged record
X, Y : Real := 0.0;
end record;
function Is_Origin (P : in Point) return Boolean is -- see 3.9
(P.X = 0.0 and P.Y = 0.0);
end Parapraph_6_8_Section_9;
begin
null;
end AARM_2012_CH06;
|
strenkml/EE368 | Ada | 2,268 | adb |
with Device;
with Memory.Container; use Memory.Container;
package body Memory.Transform.EOR is
function Create_EOR return EOR_Pointer is
result : constant EOR_Pointer := new EOR_Type;
begin
return result;
end Create_EOR;
function Random_EOR(next : access Memory_Type'Class;
generator : Distribution_Type;
max_cost : Cost_Type) return Memory_Pointer is
result : constant EOR_Pointer := Create_EOR;
abits : constant Positive := Device.Get_Address_Bits - 1;
rand : constant Positive := Random(generator);
bit : constant Long_Integer := Long_Integer(2) ** (rand mod abits);
begin
Set_Memory(result.all, next);
result.value := bit;
return Memory_Pointer(result);
end Random_EOR;
function Clone(mem : EOR_Type) return Memory_Pointer is
result : constant EOR_Pointer := new EOR_Type'(mem);
begin
return Memory_Pointer(result);
end Clone;
procedure Permute(mem : in out EOR_Type;
generator : in Distribution_Type;
max_cost : in Cost_Type) is
abits : constant Positive := Device.Get_Address_Bits - 1;
rand : constant Positive := Random(generator);
bit : constant Long_Integer := Long_Integer(2) ** (rand mod abits);
begin
mem.value := bit;
end Permute;
function Get_Name(mem : EOR_Type) return String is
begin
return "eor";
end Get_Name;
function Is_Empty(mem : EOR_Type) return Boolean is
begin
return mem.value = 0;
end Is_Empty;
function Apply(mem : EOR_Type;
address : Address_Type;
dir : Boolean) return Address_Type is
begin
return address xor Address_Type'Mod(mem.value);
end Apply;
function Get_Alignment(mem : EOR_Type) return Positive is
begin
for i in 0 .. 16 loop
if (Address_Type'Mod(mem.value) and (2 ** i)) /= 0 then
return Positive(2 ** i);
end if;
end loop;
return 2 ** 16;
end Get_Alignment;
function Get_Transform_Length(mem : EOR_Type) return Natural is
begin
return 1;
end Get_Transform_Length;
end Memory.Transform.EOR;
|
reznikmm/matreshka | Ada | 3,689 | 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.Svg_Origin_Attributes is
pragma Preelaborate;
type ODF_Svg_Origin_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Svg_Origin_Attribute_Access is
access all ODF_Svg_Origin_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Svg_Origin_Attributes;
|
zhmu/ananas | Ada | 445 | ads | package Warn21 is
type Set is new Integer;
function "<=" (Left : Set; Right : Set) return Boolean;
function "=" (Left : Set; Right : Set) return Boolean with
Post => "="'Result = (Left <= Right and Right <= Left);
procedure Foo;
private
function "<=" (Left : Set; Right : Set) return Boolean is (True);
function "=" (Left : Set; Right : Set) return Boolean is
(Left <= Right and Right <= Left);
end Warn21;
|
persan/A-gst | Ada | 33 | ads | package gstreamer.tests is
end;
|
faelys/natools | Ada | 1,660 | ads | ------------------------------------------------------------------------------
-- Copyright (c) 2013, 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. --
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- Natools.Chunked_Strings.Tests.Memory contains extra test cases to ensure --
-- memory usage works as expected. --
------------------------------------------------------------------------------
with Natools.Tests;
generic procedure Natools.Chunked_Strings.Tests.Memory
(Report : in out Natools.Tests.Reporter'Class);
pragma Preelaborate (Memory);
|
zhmu/ananas | Ada | 4,507 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . W C H _ J I S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains routines used for converting between internal
-- JIS codes and the two external forms we support (EUC and Shift-JIS)
package System.WCh_JIS is
pragma Pure;
function EUC_To_JIS (EUC1, EUC2 : Character) return Wide_Character;
-- Given the two bytes of a EUC representation, return the
-- corresponding JIS code wide character. Raises Constraint_Error
-- if the two characters are not a valid EUC encoding.
procedure JIS_To_EUC
(J : Wide_Character;
EUC1 : out Character;
EUC2 : out Character);
-- Given a wide character in JIS form, produce the corresponding
-- two bytes of the EUC representation of this character. This is
-- only used if J is not in the normal ASCII range, i.e. on entry
-- we know that Wide_Character'Pos (J) >= 16#0080# and that we
-- thus require a two byte EUC representation (ASCII codes appear
-- unchanged as a single byte in EUC). No error checking is performed,
-- the input code is assumed to be in an appropriate range.
procedure JIS_To_Shift_JIS
(J : Wide_Character;
SJ1 : out Character;
SJ2 : out Character);
-- Given a wide character code in JIS form, produce the corresponding
-- two bytes of the Shift-JIS representation of this character. This
-- is only used if J is not in the normal ASCII range, i.e. on entry
-- we know that Wide_Character'Pos (J) >= 16#0080# and that we
-- thus require a two byte EUC representation (ASCII codes appear
-- unchanged as a single byte in EUC). No error checking is performed,
-- the input code is assumed to be in an appropriate range (note in
-- particular that input codes in the range 16#0080#-16#00FF#, i.e.
-- Hankaku Kana, do not appear, since Shift JIS has no representation
-- for such codes.
function Shift_JIS_To_JIS (SJ1, SJ2 : Character) return Wide_Character;
-- Given the two bytes of a Shift-JIS representation, return the
-- corresponding JIS code wide character. Raises Constraint_Error if
-- the two characters are not a valid shift-JIS encoding.
end System.WCh_JIS;
|
reznikmm/matreshka | Ada | 4,816 | 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.Text_Object_Index_Source_Elements;
package Matreshka.ODF_Text.Object_Index_Source_Elements is
type Text_Object_Index_Source_Element_Node is
new Matreshka.ODF_Text.Abstract_Text_Element_Node
and ODF.DOM.Text_Object_Index_Source_Elements.ODF_Text_Object_Index_Source
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Text_Object_Index_Source_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Text_Object_Index_Source_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Text_Object_Index_Source_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 Text_Object_Index_Source_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 Text_Object_Index_Source_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_Text.Object_Index_Source_Elements;
|
AdaCore/gpr | Ada | 3,467 | adb | --
-- Copyright (C) 2019-2023, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0
--
with Ada.Text_IO;
with GPR2.Context;
with GPR2.Project.View;
with GPR2.Project.Tree;
with GPR2.Project.Attribute.Set;
with GPR2.Project.Variable.Set;
procedure Main is
use Ada;
use GPR2;
use GPR2.Project;
Indent : Natural := 0;
procedure Put_Indent;
procedure Display (Prj : Project.View.Object);
procedure Display (Att : Project.Attribute.Object);
procedure Display (Var : Project.Variable.Object);
procedure Changed_Callback (Prj : Project.View.Object);
----------------
-- Put_Indent --
----------------
procedure Put_Indent is
Space : constant String (1 .. Indent) := (others => ' ');
begin
Text_IO.Put (Space);
end Put_Indent;
----------------------
-- Changed_Callback --
----------------------
procedure Changed_Callback (Prj : Project.View.Object) is
begin
Text_IO.Put_Line (">>> Changed_Callback for " & String (Prj.Name));
end Changed_Callback;
-------------
-- Display --
-------------
procedure Display (Att : Project.Attribute.Object) is
begin
Put_Indent;
Text_IO.Put (Image (Att.Name.Id.Attr));
if Att.Has_Index then
Text_IO.Put (" (" & Att.Index.Text & ")");
end if;
Text_IO.Put (" ->");
for V of Att.Values loop
Text_IO.Put (" " & V.Text);
end loop;
Text_IO.New_Line;
end Display;
procedure Display (Var : Project.Variable.Object) is
begin
Put_Indent;
Text_IO.Put (String (Var.Name.Text) & " =");
for V of Var.Values loop
Text_IO.Put (" " & V.Text);
end loop;
Text_IO.New_Line;
end Display;
procedure Display (Prj : Project.View.Object) is
use GPR2.Project.Attribute.Set;
use GPR2.Project.Variable.Set.Set;
begin
Text_IO.Put_Line ('[' & String (Prj.Name) & "] " & Prj.Qualifier'Img);
Indent := Indent + 3;
for I of Prj.Imports loop
Put_Indent;
Text_IO.Put ("with ");
Indent := Indent + 3;
Display (I);
Indent := Indent - 3;
end loop;
if Prj.Is_Extending then
Put_Indent;
Text_IO.Put ("extends ");
Indent := Indent + 3;
Display (Prj.Extended_Root);
Indent := Indent - 3;
end if;
for A of Prj.Attributes (With_Defaults => False) loop
Display (A);
end loop;
for V of Prj.Variables loop
Display (V);
end loop;
for Pck of Prj.Packages (With_Defaults => False) loop
Put_Indent;
Text_IO.Put_Line ("Pck: " & Image (Pck));
Indent := Indent + 3;
for A of Prj.Attributes (Pack => Pck, With_Defaults => False) loop
Display (A);
end loop;
for Var of Prj.Variables (Pck) loop
Display (Var);
end loop;
Indent := Indent - 3;
end loop;
if Prj.Kind in Aggregate_Kind then
for Agg of Prj.Aggregated loop
Put_Indent;
Text_IO.Put ("aggregates ");
Indent := Indent + 3;
Display (Agg);
Indent := Indent - 3;
end loop;
end if;
Text_IO.New_Line;
Indent := Indent - 3;
end Display;
Prj : Project.Tree.Object;
Ctx : Context.Object;
begin
Project.Tree.Load (Prj, Create ("agg.gpr"), Ctx);
Display (Prj.Root_Project);
end Main;
|
Gabriel-Degret/adalib | Ada | 5,895 | ads | -- Standard Ada library specification
-- Copyright (c) 2003-2018 Maxim Reznik <[email protected]>
-- Copyright (c) 2004-2016 AXE Consultants
-- Copyright (c) 2004, 2005, 2006 Ada-Europe
-- Copyright (c) 2000 The MITRE Corporation, Inc.
-- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
-- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
---------------------------------------------------------------------------
with Ada.Iterator_Interfaces;
generic
type Key_Type is private;
type Element_Type is private;
with function Hash (Key : Key_Type) return Hash_Type;
with function Equivalent_Keys (Left, Right : Key_Type)
return Boolean;
with function "=" (Left, Right : Element_Type)
return Boolean is <>;
package Ada.Containers.Hashed_Maps is
pragma Preelaborate(Hashed_Maps);
pragma Remote_Types(Hashed_Maps);
type Map is tagged private
with Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type;
pragma Preelaborable_Initialization(Map);
type Cursor is private;
pragma Preelaborable_Initialization(Cursor);
Empty_Map : constant Map;
No_Element : constant Cursor;
function Has_Element (Position : Cursor) return Boolean;
package Map_Iterator_Interfaces is new
Ada.Iterator_Interfaces (Cursor, Has_Element);
function "=" (Left, Right : Map) return Boolean;
function Capacity (Container : Map) return Count_Type;
procedure Reserve_Capacity (Container : in out Map;
Capacity : in Count_Type);
function Length (Container : Map) return Count_Type;
function Is_Empty (Container : Map) return Boolean;
procedure Clear (Container : in out Map);
function Key (Position : Cursor) return Key_Type;
function Element (Position : Cursor) return Element_Type;
procedure Replace_Element (Container : in out Map;
Position : in Cursor;
New_Item : in Element_Type);
procedure Query_Element
(Position : in Cursor;
Process : not null access procedure (Key : in Key_Type;
Element : in Element_Type));
procedure Update_Element
(Container : in out Map;
Position : in Cursor;
Process : not null access procedure
(Key : in Key_Type;
Element : in out Element_Type));
type Constant_Reference_Type
(Element : not null access constant Element_Type) is private
with Implicit_Dereference => Element;
type Reference_Type (Element : not null access Element_Type) is private
with Implicit_Dereference => Element;
function Constant_Reference (Container : aliased in Map;
Position : in Cursor)
return Constant_Reference_Type;
function Reference (Container : aliased in out Map;
Position : in Cursor)
return Reference_Type;
function Constant_Reference (Container : aliased in Map;
Key : in Key_Type)
return Constant_Reference_Type;
function Reference (Container : aliased in out Map;
Key : in Key_Type)
return Reference_Type;
procedure Assign (Target : in out Map; Source : in Map);
function Copy (Source : Map; Capacity : Count_Type := 0) return Map;
procedure Move (Target : in out Map;
Source : in out Map);
procedure Insert (Container : in out Map;
Key : in Key_Type;
New_Item : in Element_Type;
Position : out Cursor;
Inserted : out Boolean);
procedure Insert (Container : in out Map;
Key : in Key_Type;
Position : out Cursor;
Inserted : out Boolean);
procedure Insert (Container : in out Map;
Key : in Key_Type;
New_Item : in Element_Type);
procedure Include (Container : in out Map;
Key : in Key_Type;
New_Item : in Element_Type);
procedure Replace (Container : in out Map;
Key : in Key_Type;
New_Item : in Element_Type);
procedure Exclude (Container : in out Map;
Key : in Key_Type);
procedure Delete (Container : in out Map;
Key : in Key_Type);
procedure Delete (Container : in out Map;
Position : in out Cursor);
function First (Container : Map)
return Cursor;
function Next (Position : Cursor) return Cursor;
procedure Next (Position : in out Cursor);
function Find (Container : Map;
Key : Key_Type)
return Cursor;
function Element (Container : Map;
Key : Key_Type)
return Element_Type;
function Contains (Container : Map;
Key : Key_Type) return Boolean;
function Equivalent_Keys (Left, Right : Cursor)
return Boolean;
function Equivalent_Keys (Left : Cursor;
Right : Key_Type)
return Boolean;
function Equivalent_Keys (Left : Key_Type;
Right : Cursor)
return Boolean;
procedure Iterate
(Container : in Map;
Process : not null access procedure (Position : in Cursor));
function Iterate (Container : in Map)
return Map_Iterator_Interfaces.Forward_Iterator'Class;
private
-- not specified by the language
end Ada.Containers.Hashed_Maps;
|
onox/orka | Ada | 737 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2021 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package Orka.Numerics.Singles is
pragma Pure;
end Orka.Numerics.Singles;
|
rveenker/sdlada | Ada | 1,527 | 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.Inputs.Joysticks.Makers
--------------------------------------------------------------------------------------------------------------------
package SDL.Inputs.Joysticks.Makers is
function Create (Device : in Devices) return Joystick;
procedure Create (Device : in Devices; Actual_Stick : out Joystick);
end SDL.Inputs.Joysticks.Makers;
|
reznikmm/matreshka | Ada | 7,120 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Text.List_Level_Style_Bullet_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Text_List_Level_Style_Bullet_Element_Node is
begin
return Self : Text_List_Level_Style_Bullet_Element_Node do
Matreshka.ODF_Text.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Text_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Text_List_Level_Style_Bullet_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Text_List_Level_Style_Bullet
(ODF.DOM.Text_List_Level_Style_Bullet_Elements.ODF_Text_List_Level_Style_Bullet_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Text_List_Level_Style_Bullet_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.List_Level_Style_Bullet_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Text_List_Level_Style_Bullet_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Text_List_Level_Style_Bullet
(ODF.DOM.Text_List_Level_Style_Bullet_Elements.ODF_Text_List_Level_Style_Bullet_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Text_List_Level_Style_Bullet_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Text_List_Level_Style_Bullet
(Visitor,
ODF.DOM.Text_List_Level_Style_Bullet_Elements.ODF_Text_List_Level_Style_Bullet_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Text_URI,
Matreshka.ODF_String_Constants.List_Level_Style_Bullet_Element,
Text_List_Level_Style_Bullet_Element_Node'Tag);
end Matreshka.ODF_Text.List_Level_Style_Bullet_Elements;
|
RREE/ada-util | Ada | 9,992 | ads | -----------------------------------------------------------------------
-- util-serialize-io -- IO Drivers for serialization
-- Copyright (C) 2010, 2011, 2016, 2017 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings.Unbounded;
with Ada.Calendar;
with Util.Beans.Objects;
with Util.Streams;
with Util.Streams.Buffered;
with Util.Log.Loggers;
with Util.Nullables;
package Util.Serialize.IO is
Parse_Error : exception;
-- ------------------------------
-- Output stream for serialization
-- ------------------------------
-- The <b>Output_Stream</b> interface defines the abstract operations for
-- the serialization framework to write objects on the stream according to
-- a target format such as XML or JSON.
type Output_Stream is limited interface and Util.Streams.Output_Stream;
-- Start a document.
procedure Start_Document (Stream : in out Output_Stream) is null;
-- Finish a document.
procedure End_Document (Stream : in out Output_Stream) is null;
procedure Start_Entity (Stream : in out Output_Stream;
Name : in String) is null;
procedure End_Entity (Stream : in out Output_Stream;
Name : in String) is null;
-- Write the attribute name/value pair.
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in String) is abstract;
procedure Write_Wide_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Wide_Wide_String) is abstract;
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Integer) is abstract;
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Boolean) is abstract;
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Util.Beans.Objects.Object) is abstract;
-- Write the attribute with a null value.
procedure Write_Null_Attribute (Stream : in out Output_Stream;
Name : in String) is abstract;
procedure Write_Attribute (Stream : in out Output_Stream'Class;
Name : in String;
Value : in Ada.Strings.Unbounded.Unbounded_String);
-- Write the entity value.
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in String) is abstract;
procedure Write_Wide_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Wide_Wide_String) is abstract;
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Boolean) is abstract;
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Integer) is abstract;
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Ada.Calendar.Time) is abstract;
procedure Write_Long_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Long_Long_Integer) is abstract;
procedure Write_Enum_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in String) is abstract;
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Util.Beans.Objects.Object) is abstract;
procedure Write_Entity (Stream : in out Output_Stream'Class;
Name : in String;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Write_Entity (Stream : in out Output_Stream'Class;
Name : in String;
Value : in Util.Nullables.Nullable_String);
procedure Write_Entity (Stream : in out Output_Stream'Class;
Name : in String;
Value : in Util.Nullables.Nullable_Time);
procedure Write_Entity (Stream : in out Output_Stream'Class;
Name : in String;
Value : in Util.Nullables.Nullable_Boolean);
procedure Write_Entity (Stream : in out Output_Stream'Class;
Name : in String;
Value : in Util.Nullables.Nullable_Integer);
procedure Write_Entity (Stream : in out Output_Stream'Class;
Name : in String;
Value : in Util.Nullables.Nullable_Long);
-- Write an entity with a null value.
procedure Write_Null_Entity (Stream : in out Output_Stream;
Name : in String) is abstract;
procedure Start_Array (Stream : in out Output_Stream;
Name : in String) is null;
procedure End_Array (Stream : in out Output_Stream;
Name : in String) is null;
type Reader is limited interface;
-- Start a document.
procedure Start_Document (Stream : in out Reader) is null;
-- Finish a document.
procedure End_Document (Stream : in out Reader) is null;
-- Start a new object associated with the given name. This is called when
-- the '{' is reached. The reader must be updated so that the next
-- <b>Set_Member</b> procedure will associate the name/value pair on the
-- new object.
procedure Start_Object (Handler : in out Reader;
Name : in String;
Logger : in out Util.Log.Logging'Class) is abstract;
-- Finish an object associated with the given name. The reader must be
-- updated to be associated with the previous object.
procedure Finish_Object (Handler : in out Reader;
Name : in String;
Logger : in out Util.Log.Logging'Class) is abstract;
procedure Start_Array (Handler : in out Reader;
Name : in String;
Logger : in out Util.Log.Logging'Class) is abstract;
procedure Finish_Array (Handler : in out Reader;
Name : in String;
Count : in Natural;
Logger : in out Util.Log.Logging'Class) is abstract;
-- Set the name/value pair on the current object. For each active mapping,
-- find whether a rule matches our name and execute it.
procedure Set_Member (Handler : in out Reader;
Name : in String;
Value : in Util.Beans.Objects.Object;
Logger : in out Util.Log.Logging'Class;
Attribute : in Boolean := False) is abstract;
type Parser is abstract new Util.Log.Logging with private;
-- Parse the stream using the JSON parser.
procedure Parse (Handler : in out Parser;
Stream : in out Util.Streams.Buffered.Input_Buffer_Stream'Class;
Sink : in out Reader'Class) is abstract;
-- Read the file and parse it using the parser.
procedure Parse (Handler : in out Parser;
File : in String;
Sink : in out Reader'Class);
-- Parse the content string.
procedure Parse_String (Handler : in out Parser;
Content : in String;
Sink : in out Reader'Class);
-- Returns true if the <b>Parse</b> operation detected at least one error.
function Has_Error (Handler : in Parser) return Boolean;
-- Set the error logger to report messages while parsing and reading the input file.
procedure Set_Logger (Handler : in out Parser;
Logger : in Util.Log.Loggers.Logger_Access);
-- Get the current location (file and line) to report an error message.
function Get_Location (Handler : in Parser) return String;
-- Report an error while parsing the input stream. The error message will be reported
-- on the logger associated with the parser. The parser will be set as in error so that
-- the <b>Has_Error</b> function will return True after parsing the whole file.
procedure Error (Handler : in out Parser;
Message : in String);
private
type Parser is abstract new Util.Log.Logging with record
Error_Flag : Boolean := False;
-- The file name to use when reporting errors.
File : Ada.Strings.Unbounded.Unbounded_String;
-- The logger which is used to report error messages when parsing an input file.
Error_Logger : Util.Log.Loggers.Logger_Access := null;
end record;
end Util.Serialize.IO;
|
AaronC98/PlaneSystem | Ada | 2,402 | ads | ------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2000-2013, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- 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/>. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
------------------------------------------------------------------------------
pragma Ada_2012;
package AWS.Services with Pure is
-- You'll find here some high level ready to use callback routines.
-- Be sure to check the whole hierarchy.
end AWS.Services;
|
reznikmm/matreshka | Ada | 23,701 | 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_Raise_Exception_Actions is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Raise_Exception_Action_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Enter_Raise_Exception_Action
(AMF.UML.Raise_Exception_Actions.UML_Raise_Exception_Action_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Raise_Exception_Action_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Leave_Raise_Exception_Action
(AMF.UML.Raise_Exception_Actions.UML_Raise_Exception_Action_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Raise_Exception_Action_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then
AMF.Visitors.UML_Iterators.UML_Iterator'Class
(Iterator).Visit_Raise_Exception_Action
(Visitor,
AMF.UML.Raise_Exception_Actions.UML_Raise_Exception_Action_Access (Self),
Control);
end if;
end Visit_Element;
-------------------
-- Get_Exception --
-------------------
overriding function Get_Exception
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.Input_Pins.UML_Input_Pin_Access is
begin
return
AMF.UML.Input_Pins.UML_Input_Pin_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Exception
(Self.Element)));
end Get_Exception;
-------------------
-- Set_Exception --
-------------------
overriding procedure Set_Exception
(Self : not null access UML_Raise_Exception_Action_Proxy;
To : AMF.UML.Input_Pins.UML_Input_Pin_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Exception
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Exception;
-----------------
-- Get_Context --
-----------------
overriding function Get_Context
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.Classifiers.UML_Classifier_Access is
begin
return
AMF.UML.Classifiers.UML_Classifier_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Context
(Self.Element)));
end Get_Context;
---------------
-- Get_Input --
---------------
overriding function Get_Input
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.Input_Pins.Collections.Ordered_Set_Of_UML_Input_Pin is
begin
return
AMF.UML.Input_Pins.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Input
(Self.Element)));
end Get_Input;
------------------------------
-- Get_Is_Locally_Reentrant --
------------------------------
overriding function Get_Is_Locally_Reentrant
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Locally_Reentrant
(Self.Element);
end Get_Is_Locally_Reentrant;
------------------------------
-- Set_Is_Locally_Reentrant --
------------------------------
overriding procedure Set_Is_Locally_Reentrant
(Self : not null access UML_Raise_Exception_Action_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Locally_Reentrant
(Self.Element, To);
end Set_Is_Locally_Reentrant;
-----------------------------
-- Get_Local_Postcondition --
-----------------------------
overriding function Get_Local_Postcondition
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is
begin
return
AMF.UML.Constraints.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Postcondition
(Self.Element)));
end Get_Local_Postcondition;
----------------------------
-- Get_Local_Precondition --
----------------------------
overriding function Get_Local_Precondition
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is
begin
return
AMF.UML.Constraints.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Precondition
(Self.Element)));
end Get_Local_Precondition;
----------------
-- Get_Output --
----------------
overriding function Get_Output
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.Output_Pins.Collections.Ordered_Set_Of_UML_Output_Pin is
begin
return
AMF.UML.Output_Pins.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Output
(Self.Element)));
end Get_Output;
-----------------
-- Get_Handler --
-----------------
overriding function Get_Handler
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.Exception_Handlers.Collections.Set_Of_UML_Exception_Handler is
begin
return
AMF.UML.Exception_Handlers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Handler
(Self.Element)));
end Get_Handler;
------------------
-- Get_Activity --
------------------
overriding function Get_Activity
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.Activities.UML_Activity_Access is
begin
return
AMF.UML.Activities.UML_Activity_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Activity
(Self.Element)));
end Get_Activity;
------------------
-- Set_Activity --
------------------
overriding procedure Set_Activity
(Self : not null access UML_Raise_Exception_Action_Proxy;
To : AMF.UML.Activities.UML_Activity_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Activity
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Activity;
------------------
-- Get_In_Group --
------------------
overriding function Get_In_Group
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.Activity_Groups.Collections.Set_Of_UML_Activity_Group is
begin
return
AMF.UML.Activity_Groups.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Group
(Self.Element)));
end Get_In_Group;
---------------------------------
-- Get_In_Interruptible_Region --
---------------------------------
overriding function Get_In_Interruptible_Region
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.Interruptible_Activity_Regions.Collections.Set_Of_UML_Interruptible_Activity_Region is
begin
return
AMF.UML.Interruptible_Activity_Regions.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Interruptible_Region
(Self.Element)));
end Get_In_Interruptible_Region;
----------------------
-- Get_In_Partition --
----------------------
overriding function Get_In_Partition
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.Activity_Partitions.Collections.Set_Of_UML_Activity_Partition is
begin
return
AMF.UML.Activity_Partitions.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Partition
(Self.Element)));
end Get_In_Partition;
----------------------------
-- Get_In_Structured_Node --
----------------------------
overriding function Get_In_Structured_Node
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access is
begin
return
AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Structured_Node
(Self.Element)));
end Get_In_Structured_Node;
----------------------------
-- Set_In_Structured_Node --
----------------------------
overriding procedure Set_In_Structured_Node
(Self : not null access UML_Raise_Exception_Action_Proxy;
To : AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_In_Structured_Node
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_In_Structured_Node;
------------------
-- Get_Incoming --
------------------
overriding function Get_Incoming
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is
begin
return
AMF.UML.Activity_Edges.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Incoming
(Self.Element)));
end Get_Incoming;
------------------
-- Get_Outgoing --
------------------
overriding function Get_Outgoing
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is
begin
return
AMF.UML.Activity_Edges.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Outgoing
(Self.Element)));
end Get_Outgoing;
------------------------
-- Get_Redefined_Node --
------------------------
overriding function Get_Redefined_Node
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.Activity_Nodes.Collections.Set_Of_UML_Activity_Node is
begin
return
AMF.UML.Activity_Nodes.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Node
(Self.Element)));
end Get_Redefined_Node;
-----------------
-- Get_Is_Leaf --
-----------------
overriding function Get_Is_Leaf
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf
(Self.Element);
end Get_Is_Leaf;
-----------------
-- Set_Is_Leaf --
-----------------
overriding procedure Set_Is_Leaf
(Self : not null access UML_Raise_Exception_Action_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Leaf
(Self.Element, To);
end Set_Is_Leaf;
---------------------------
-- Get_Redefined_Element --
---------------------------
overriding function Get_Redefined_Element
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is
begin
return
AMF.UML.Redefinable_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Element
(Self.Element)));
end Get_Redefined_Element;
------------------------------
-- Get_Redefinition_Context --
------------------------------
overriding function Get_Redefinition_Context
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
begin
return
AMF.UML.Classifiers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefinition_Context
(Self.Element)));
end Get_Redefinition_Context;
---------------------------
-- Get_Client_Dependency --
---------------------------
overriding function Get_Client_Dependency
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
begin
return
AMF.UML.Dependencies.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency
(Self.Element)));
end Get_Client_Dependency;
-------------------------
-- Get_Name_Expression --
-------------------------
overriding function Get_Name_Expression
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access is
begin
return
AMF.UML.String_Expressions.UML_String_Expression_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression
(Self.Element)));
end Get_Name_Expression;
-------------------------
-- Set_Name_Expression --
-------------------------
overriding procedure Set_Name_Expression
(Self : not null access UML_Raise_Exception_Action_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Name_Expression;
-------------------
-- Get_Namespace --
-------------------
overriding function Get_Namespace
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
return
AMF.UML.Namespaces.UML_Namespace_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace
(Self.Element)));
end Get_Namespace;
------------------------
-- Get_Qualified_Name --
------------------------
overriding function Get_Qualified_Name
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.Optional_String is
begin
declare
use type Matreshka.Internals.Strings.Shared_String_Access;
Aux : constant Matreshka.Internals.Strings.Shared_String_Access
:= AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
begin
if Aux = null then
return (Is_Empty => True);
else
return (False, League.Strings.Internals.Create (Aux));
end if;
end;
end Get_Qualified_Name;
-------------
-- Context --
-------------
overriding function Context
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.Classifiers.UML_Classifier_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Context unimplemented");
raise Program_Error with "Unimplemented procedure UML_Raise_Exception_Action_Proxy.Context";
return Context (Self);
end Context;
------------------------
-- Is_Consistent_With --
------------------------
overriding function Is_Consistent_With
(Self : not null access constant UML_Raise_Exception_Action_Proxy;
Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented");
raise Program_Error with "Unimplemented procedure UML_Raise_Exception_Action_Proxy.Is_Consistent_With";
return Is_Consistent_With (Self, Redefinee);
end Is_Consistent_With;
-----------------------------------
-- Is_Redefinition_Context_Valid --
-----------------------------------
overriding function Is_Redefinition_Context_Valid
(Self : not null access constant UML_Raise_Exception_Action_Proxy;
Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented");
raise Program_Error with "Unimplemented procedure UML_Raise_Exception_Action_Proxy.Is_Redefinition_Context_Valid";
return Is_Redefinition_Context_Valid (Self, Redefined);
end Is_Redefinition_Context_Valid;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
raise Program_Error with "Unimplemented procedure UML_Raise_Exception_Action_Proxy.All_Owning_Packages";
return All_Owning_Packages (Self);
end All_Owning_Packages;
-----------------------------
-- Is_Distinguishable_From --
-----------------------------
overriding function Is_Distinguishable_From
(Self : not null access constant UML_Raise_Exception_Action_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
raise Program_Error with "Unimplemented procedure UML_Raise_Exception_Action_Proxy.Is_Distinguishable_From";
return Is_Distinguishable_From (Self, N, Ns);
end Is_Distinguishable_From;
---------------
-- Namespace --
---------------
overriding function Namespace
(Self : not null access constant UML_Raise_Exception_Action_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
raise Program_Error with "Unimplemented procedure UML_Raise_Exception_Action_Proxy.Namespace";
return Namespace (Self);
end Namespace;
end AMF.Internals.UML_Raise_Exception_Actions;
|
zhmu/ananas | Ada | 217 | ads | package Slice2 is
type R1 is record
Text : String (1 .. 30);
end record;
type R2 is record
Text : String (1 .. 8);
B : Boolean := True;
end record;
function F (I : R1) return R2;
end Slice2;
|
AdaCore/gpr | Ada | 88 | adb | with Hi.Printer;
package body Hi is
procedure Put renames Hi.Printer.Put;
end Hi;
|
reznikmm/matreshka | Ada | 3,724 | 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.Table_Data_Pilot_Subtotal_Elements is
pragma Preelaborate;
type ODF_Table_Data_Pilot_Subtotal is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Table_Data_Pilot_Subtotal_Access is
access all ODF_Table_Data_Pilot_Subtotal'Class
with Storage_Size => 0;
end ODF.DOM.Table_Data_Pilot_Subtotal_Elements;
|
PThierry/ewok-kernel | Ada | 8,486 | adb | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with system.machine_code;
with m4.scb;
with m4.systick;
with soc.interrupts; use soc.interrupts;
with ewok.debug;
with ewok.tasks; use ewok.tasks;
with ewok.tasks.debug;
with ewok.sched;
with ewok.tasks_shared; use ewok.tasks_shared;
with ewok.devices_shared; use type ewok.devices_shared.t_device_id;
with ewok.isr;
package body ewok.interrupts.handler
with spark_mode => off
is
function usagefault_handler
(frame_a : ewok.t_stack_frame_access) return ewok.t_stack_frame_access
is
begin
pragma DEBUG (debug.log (debug.ERROR, "UsageFault"));
return hardfault_handler (frame_a);
end usagefault_handler;
function hardfault_handler
(frame_a : ewok.t_stack_frame_access) return ewok.t_stack_frame_access
is
cfsr : constant m4.scb.t_SCB_CFSR := m4.scb.SCB.CFSR;
begin
if cfsr.MMFSR.IACCVIOL then pragma DEBUG (debug.log (debug.ERROR, "+cfsr.MMFSR.IACCVIOL")); end if;
if cfsr.MMFSR.DACCVIOL then pragma DEBUG (debug.log (debug.ERROR, "+cfsr.MMFSR.DACCVIOL")); end if;
if cfsr.MMFSR.MUNSTKERR then pragma DEBUG (debug.log (debug.ERROR, "+cfsr.MMFSR.MUNSTKERR")); end if;
if cfsr.MMFSR.MSTKERR then pragma DEBUG (debug.log (debug.ERROR, "+cfsr.MMFSR.MSTKERR")); end if;
if cfsr.MMFSR.MLSPERR then pragma DEBUG (debug.log (debug.ERROR, "+cfsr.MMFSR.MLSPERR")); end if;
if cfsr.MMFSR.MMARVALID then pragma DEBUG (debug.log (debug.ERROR, "+cfsr.MMFSR.MMARVALID")); end if;
if cfsr.BFSR.IBUSERR then pragma DEBUG (debug.log (debug.ERROR, "+cfsr.BFSR.IBUSERR")); end if;
if cfsr.BFSR.PRECISERR then pragma DEBUG (debug.log (debug.ERROR, "+cfsr.BFSR.PRECISERR")); end if;
if cfsr.BFSR.IMPRECISERR then pragma DEBUG (debug.log (debug.ERROR, "+cfsr.BFSR.IMPRECISERR")); end if;
if cfsr.BFSR.UNSTKERR then pragma DEBUG (debug.log (debug.ERROR, "+cfsr.BFSR.UNSTKERR")); end if;
if cfsr.BFSR.STKERR then pragma DEBUG (debug.log (debug.ERROR, "+cfsr.BFSR.STKERR")); end if;
if cfsr.BFSR.LSPERR then pragma DEBUG (debug.log (debug.ERROR, "+cfsr.BFSR.LSPERR")); end if;
if cfsr.BFSR.BFARVALID then pragma DEBUG (debug.log (debug.ERROR, "+cfsr.BFSR.BFARVALID")); end if;
if cfsr.UFSR.UNDEFINSTR then pragma DEBUG (debug.log (debug.ERROR, "+cfsr.UFSR.UNDEFINSTR")); end if;
if cfsr.UFSR.INVSTATE then pragma DEBUG (debug.log (debug.ERROR, "+cfsr.UFSR.INVSTATE")); end if;
if cfsr.UFSR.INVPC then pragma DEBUG (debug.log (debug.ERROR, "+cfsr.UFSR.INVPC")); end if;
if cfsr.UFSR.NOCP then pragma DEBUG (debug.log (debug.ERROR, "+cfsr.UFSR.NOCP")); end if;
if cfsr.UFSR.UNALIGNED then pragma DEBUG (debug.log (debug.ERROR, "+cfsr.UFSR.UNALIGNED")); end if;
if cfsr.UFSR.DIVBYZERO then pragma DEBUG (debug.log (debug.ERROR, "+cfsr.UFSR.DIVBYZERO")); end if;
pragma DEBUG (ewok.tasks.debug.crashdump (frame_a));
debug.panic ("Hard fault!");
return frame_a;
end hardfault_handler;
function systick_default_handler
(frame_a : ewok.t_stack_frame_access)
return ewok.t_stack_frame_access
is
begin
m4.systick.increment;
return frame_a;
end systick_default_handler;
function default_sub_handler
(frame_a : t_stack_frame_access)
return t_stack_frame_access
is
it : t_interrupt;
current_id : ewok.tasks_shared.t_task_id;
new_frame_a : t_stack_frame_access;
ttype : t_task_type;
begin
it := soc.interrupts.get_interrupt;
--
-- Exceptions and interrupts (not nested)
--
if frame_a.all.exc_return = 16#FFFF_FFFD# then
-- System exceptions
if it < INT_WWDG then
if interrupt_table(it).task_id = ewok.tasks_shared.ID_KERNEL then
new_frame_a := interrupt_table(it).task_switch_handler (frame_a);
else
debug.panic ("Unhandled exception " & t_interrupt'image (it));
end if;
else
-- External interrupts
-- Execute kernel ISR
if interrupt_table(it).task_id = ewok.tasks_shared.ID_KERNEL then
interrupt_table(it).handler (frame_a);
new_frame_a := frame_a;
-- User ISR are postponed (asynchronous execution)
elsif interrupt_table(it).task_id /= ewok.tasks_shared.ID_UNUSED then
ewok.isr.postpone_isr
(it,
interrupt_table(it).handler,
interrupt_table(it).task_id);
new_frame_a := ewok.sched.do_schedule (frame_a);
else
pragma DEBUG (debug.log (debug.ALERT,
"Unhandled interrupt " & t_interrupt'image (it)));
end if;
end if;
-- Task's execution mode must be transmitted to the Default_Handler
-- to run it with the proper privilege (set in the CONTROL register).
-- The current function uses R0 and R1 registers to return the
-- following values:
-- R0 - address of the task frame
-- R1 - execution mode
current_id := ewok.sched.get_current;
if current_id /= ID_UNUSED then
ttype := ewok.tasks.tasks_list(current_id).ttype;
else
ttype := TASK_TYPE_KERNEL;
end if;
system.machine_code.asm
("mov r1, %0",
inputs => t_task_type'asm_input ("r", ttype),
clobber => "r1",
volatile => true);
return new_frame_a;
--
-- Nested exceptions
--
elsif frame_a.all.exc_return = 16#FFFF_FFF1# then
-- System exceptions
if it < INT_WWDG then
case it is
when INT_PENDSV => debug.panic ("Nested PendSV not handled.");
when INT_SYSTICK => null;
when others =>
if interrupt_table(it).task_id = ewok.tasks_shared.ID_KERNEL then
new_frame_a :=
interrupt_table(it).task_switch_handler (frame_a);
else
debug.panic
("Unhandled exception " & t_interrupt'image (it));
end if;
end case;
else
-- External interrupts
-- Execute kernel ISR
if interrupt_table(it).task_id = ewok.tasks_shared.ID_KERNEL then
interrupt_table(it).handler (frame_a);
-- User ISR are postponed (asynchronous execution)
elsif interrupt_table(it).task_id /= ewok.tasks_shared.ID_UNUSED then
ewok.isr.postpone_isr
(it,
interrupt_table(it).handler,
interrupt_table(it).task_id);
else
pragma DEBUG (debug.log (debug.ALERT,
"Unhandled interrupt " & t_interrupt'image (it)));
end if;
end if;
return frame_a;
--
-- Privileged exceptions
--
elsif frame_a.all.exc_return = 16#FFFF_FFF9# then
-- Note: should never happen as threads use the process stack
-- (they never use the main stack)
if interrupt_table(it).task_id = ewok.tasks_shared.ID_KERNEL then
new_frame_a := interrupt_table(it).task_switch_handler (frame_a);
end if;
debug.panic ("Privileged exception " & t_interrupt'image (it));
return new_frame_a;
--
-- Unsupported EXC_RETURN
--
else
debug.panic ("EXC_RETURN not supported");
return frame_a;
end if;
end default_sub_handler;
end ewok.interrupts.handler;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 941 | ads | package STM32GD.Clock is
pragma Preelaborate;
type Clock_Type is (SYSCLK, PCLK, HSI, LSI, LSE, HCLK, PLLCLK, RTCCLK);
type PLL_Source_Type is (HSI, HSE);
type RTC_Source_Type is (LSE, HSE, LSI);
type SYSCLK_Source_Type is (PLL, HSI, HSE);
subtype HSE_Range is Integer range 4_000_000 .. 32_000_000;
subtype PLL_Prediv_Range is Integer range 1 .. 16;
subtype PLL_Mul_Range is Integer range 1 .. 16;
subtype PLL_Range is Integer range 16_000_000 .. 48_000_000;
subtype PLL_Input_Range is Integer range 4_000_000 .. 32_000_000;
subtype SYSCLK_Speed is Integer range 4_000_000 .. 48_000_000;
type AHB_Prescaler_Type is (DIV1, DIV2, DIV4, DIV8, DIV16,
DIV64, DIV128, DIV256, DIV512);
type APB_Prescaler_Type is (DIV1, DIV2, DIV4, DIV8, DIV16);
HSI_Value : constant Integer := 8_000_000;
LSI_Value : constant Integer := 40_000;
LSE_Value : constant Integer := 32_768;
end STM32GD.Clock;
|
stcarrez/atlas | Ada | 889 | ads | -----------------------------------------------------------------------
-- atlas-reviews -- Module reviews
-- Copyright (C) 2014 Stephane.Carrez
-- Written by Stephane.Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package Atlas.Reviews is
end Atlas.Reviews;
|
reznikmm/matreshka | Ada | 4,448 | adb | ------------------------------------------------------------------------------
-- --
-- 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$
------------------------------------------------------------------------------
with AMF.Elements.Collections;
package body AMF.Visitors.Containment is
-----------
-- Visit --
-----------
procedure Visit
(Self : in out Containment_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Extent : not null access AMF.Extents.Extent'Class)
is
use type AMF.Elements.Element_Access;
Elements : constant AMF.Elements.Collections.Set_Of_Element
:= Extent.Elements;
Control : Traverse_Control := Continue;
begin
for J in 1 .. Elements.Length loop
if Elements.Element (J).Container = null then
Self.Visit (Visitor, Elements.Element (J), Control);
case Control is
when Continue =>
null;
when Abandon_Children =>
Control := Continue;
when Abandon_Sibling =>
Control := Continue;
exit;
when Terminate_Immediately =>
exit;
end case;
end if;
end loop;
end Visit;
end AMF.Visitors.Containment;
|
ohenley/ada-util | Ada | 1,178 | ads | -----------------------------------------------------------------------
-- util-streams-buffered-encoders-tests -- Unit tests for encoding buffered streams
-- Copyright (C) 2017 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
package Util.Streams.Buffered.Encoders.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
procedure Test_Base64_Stream (T : in out Test);
end Util.Streams.Buffered.Encoders.Tests;
|
charlie5/aIDE | Ada | 729 | ads |
package AdaM.Assist
is
function Tail_of (the_full_Name : in Identifier) return Identifier;
function strip_Tail_of (the_full_Name : in Identifier) return Identifier;
function type_button_Name_of (the_full_Name : in Identifier) return String;
-- function Split (the_Text : in String) return text_Lines;
function identifier_Suffix (Id : in Identifier; Count : in Positive) return Identifier;
function strip_standard_Prefix (Id : in Identifier) return Identifier;
function parent_Name (Id : in Identifier) return Identifier;
function simple_Name (Id : in Identifier) return Identifier;
function Split (Id : in Identifier) return text_Lines;
end AdaM.Assist;
|
Rodeo-McCabe/orka | Ada | 1,547 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2013 Felix Krause <[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;
package Glfw is
pragma Preelaborate;
subtype Seconds is Interfaces.C.double;
subtype Size is Interfaces.C.int range 0 .. Interfaces.C.int'Last;
Initialization_Exception : exception;
Operation_Exception : exception;
procedure Init;
-- Initialize the GLFW library
--
-- Task safety: Must only be called from the environment task.
procedure Shutdown;
-- Destroy all windows and resources
--
-- Task safety: Must only be called from the environment task.
procedure Version (Major, Minor, Rev : out Natural);
function Version_String return String;
function Extension_Supported (Name : String) return Boolean;
private
package C renames Interfaces.C;
type Bool is new Boolean;
for Bool use (False => 0, True => 1);
for Bool'Size use C.int'Size;
pragma Convention (C, Bool);
end Glfw;
|
Fabien-Chouteau/Ada_Drivers_Library | Ada | 1,010 | ads | -- This package was generated by the Ada_Drivers_Library project wizard script
package ADL_Config is
Max_Mount_Points : constant := 2; -- From default value
Max_Mount_Name_Length : constant := 128; -- From default value
Has_Ravenscar_Full_Runtime : constant String := "False"; -- From default value
Board : constant String := "Native"; -- From command line
Has_ZFP_Runtime : constant String := "False"; -- From default value
Has_Ravenscar_SFP_Runtime : constant String := "False"; -- From default value
Use_Startup_Gen : constant Boolean := False; -- From command line
Max_Path_Length : constant := 1024; -- From default value
Architecture : constant String := "Native"; -- From board definition
end ADL_Config;
|
jklmnn/ash | Ada | 2,323 | adb | with Ada.Text_IO; use Ada.Text_IO;
with Ada.Exceptions; use Ada.Exceptions;
with Ada.IO_Exceptions; use Ada.IO_Exceptions;
with File_Utils;
with Common_Utils;
with HTTP_Status; use HTTP_Status;
with Request_Helpers, Response_Helpers;
use Request_Helpers, Response_Helpers;
package body Transaction_Handlers is
function Handle_Request (R : String; Context : String) return String is
R_Type : constant Request_Method := Parse_Request_Type (R);
URI : constant String := Parse_Request_URI (R);
First, Last : Positive;
begin
case R_Type is
when GET =>
Common_Utils.Empty_String_Range (Context, First, Last);
-- TODO Sanitize URLs
declare
CFirst : constant Positive := Context'First;
Path : constant String := Context (CFirst .. First) & URI;
begin
if File_Utils.Is_Dir (Path) then
return Make_Response (OK, File_Utils.Read (Path & "/index.html"));
else
return Make_Response (OK, File_Utils.Read (Path));
end if;
end;
when POST | PUT | DELETE | HEAD | OPTIONS | TRACE =>
return Make_Response (
NOT_IMPLEMENTED,
"<h1>Got Request - Haven't been implemented yet though</h1>"
);
end case;
exception
when E : Ada.IO_Exceptions.Device_Error
| Ada.IO_Exceptions.Name_Error =>
Put_Line (
Standard_Error,
Exception_Name (E) & " " & Exception_Message (E)
);
return Make_Response (
NOT_FOUND,
"Resource not found"
);
when E : Request_Helpers.Request_Type_Error =>
Put_Line (
Standard_Error,
Exception_Name (E) & " " & Exception_Message (E)
);
return Make_Response (
Bad_Request,
Exception_Name (E) & " " & Exception_Message (E)
);
when E : others =>
Put_Line (
Standard_Error,
Exception_Name (E) & " " & Exception_Message (E)
);
return Make_Response (
INTERNAL_ERROR,
"Something really bad happened."
);
end Handle_Request;
end Transaction_Handlers;
|
onox/orka | Ada | 2,633 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2022 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Orka.SIMD.SSE2.Integers;
package Orka.SIMD.AVX.Integers.Swizzle is
pragma Pure;
use SIMD.SSE2.Integers;
function Cast (Elements : m256i) return m128i
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_si_si256";
function Cast (Elements : m128i) return m256i
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_si256_si";
function Extract (Elements : m256i; Mask : Integer_32) return m128i
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_vextractf128_si256";
-- Extract 128-bit from either the lower half (Mask = 0) or upper
-- half (Mask = 1)
function Insert (Left : m256i; Right : m128i; Mask : Integer_32) return m256i
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_vinsertf128_si256";
-- Insert Right into the lower half (Mask = 0) or upper half (Mask = 1)
function Pack (High, Low : m128i) return m256i is (Insert (Cast (Low), High, 1))
with Inline_Always;
function Permute_Lanes (Left, Right : m256i; Mask : Integer_32) return m256i
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_vperm2f128_si256";
-- Shuffle 128-bit lanes.
--
-- Bits 1-2 of Mask are used to control which of the four 128-bit lanes
-- to use for the lower half (128-bit) of the result. Bits 5-6 to select
-- a lane for the upper half of the result:
--
-- 0 => Left (1 .. 4)
-- 1 => Left (5 .. 8)
-- 2 => Right (1 .. 4)
-- 3 => Right (5 .. 8)
--
-- Bits 4 and 8 are used to zero the corresponding half (lower or upper).
--
-- The compiler needs access to the Mask at compile-time, thus construct it
-- as follows:
--
-- Mask_zu_zl_u_l : constant Unsigned_32 := zu * 128 or zl * 8 or u * 16 or l;
--
-- u and l are numbers between 0 and 3 (see above). zu and zl are either 0 or 1
-- to zero a lane.
end Orka.SIMD.AVX.Integers.Swizzle;
|
zrmyers/VulkanAda | Ada | 10,735 | ads | --------------------------------------------------------------------------------
-- MIT License
--
-- Copyright (c) 2020 Zane Myers
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
--------------------------------------------------------------------------------
-- This package describes a Floating Point Vector with 4 components.
--------------------------------------------------------------------------------
with Vulkan.Math.GenBType;
with Vulkan.Math.Bvec3;
with Vulkan.Math.Bvec2;
use Vulkan.Math.GenBType;
use Vulkan.Math.Bvec3;
use Vulkan.Math.Bvec2;
--------------------------------------------------------------------------------
--< @group Vulkan Math Basic Types
--------------------------------------------------------------------------------
--< @summary
--< This package defines a boolean vector type with 4 components.
--------------------------------------------------------------------------------
package Vulkan.Math.Bvec4 is
pragma Preelaborate;
pragma Pure;
--< A 4-compoent vector of boolean values.
subtype Vkm_Bvec4 is Vkm_GenBType(Last_Index => 3);
----------------------------------------------------------------------------
-- Ada does not have the concept of constructors in the sense that they exist
-- in C++. For this reason, we will instead define multiple methods for
-- instantiating a Bvec4 here.
----------------------------------------------------------------------------
-- The following are explicit constructors for Bvec4:
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Bvec4 type.
--<
--< @description
--< Produce a default vector with all components set to false.
--<
--< @return
--< A 4D boolean vector with all components set to false.
----------------------------------------------------------------------------
function Make_Bvec4 return Vkm_Bvec4 is
(GBT.Make_GenType(Last_Index => 3, value => false)) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Bvec4 type.
--<
--< @description
--< Produce a vector with all components set to the same value.
--<
--< @param scalar_value
--< The value to set all components to.
--<
--< @return
--< A 4D boolean vector with all components set to scalar_value.
----------------------------------------------------------------------------
function Make_Bvec4 (scalar_value : in Vkm_Bool) return Vkm_Bvec4 is
(GBT.Make_GenType(Last_Index => 3, value => scalar_value)) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Bvec4 type.
--<
--< @description
--< Produce a vector by copying components from an existing vector.
--<
--< @param vec4_value
--< The Bvec4 to copy components from.
--<
--< @return
--< A 4D boolean vector with all of its components set equal to the corresponding
--< components of vec4_value.
----------------------------------------------------------------------------
function Make_Bvec4 (vec4_value : in Vkm_Bvec4) return Vkm_Bvec4 is
(GBT.Make_GenType(vec4_value.data(0),vec4_value.data(1),
vec4_value.data(2),vec4_value.data(3))) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Bvec4 type.
--<
--< @description
--< Produce a vector by specifying the values for each of its components.
--<
--< @param value1
--< Value for component 1.
--<
--< @param value2
--< Value for component 2.
--<
--< @param value3
--< Value for component 3.
--<
--< @param value4
--< Value for component 4.
--<
--< @return
--< A 4D boolean vector with all components set as specified.
----------------------------------------------------------------------------
function Make_Bvec4 (value1, value2, value3, value4 : in Vkm_Bool) return Vkm_Bvec4
renames GBT.Make_GenType;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Bvec4 type.
--<
--< @description
--< Produce a vector by concatenating a scalar value with a Bvec3.
--<
--< Bvec4 = [scalar_value, vec3_value ]
--<
--< @param scalar_value
--< The scalar value to concatenate with the Bvec3.
--<
--< @param vec3_value
--< The Bvec3 to concatenate to the scalar value.
--<
--< @return The instance of Bvec4.
----------------------------------------------------------------------------
function Make_Bvec4 (scalar_value : in Vkm_Bool;
vec3_value : in Vkm_Bvec3) return Vkm_Bvec3 is
(Make_Bvec4(scalar_value,
vec3_value.data(0),
vec3_value.data(1),
vec3_value.data(2))) with Inline;
----------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Bvec4 type.
--<
--< @description
--< Produce a vector by concatenating a Bvec3 with a scalar value.
--<
--< Bvec4 = [vec3_value, scalar_value]
--<
--< @param vec3_value
--< The Bvec3 to concatenate to the scalar value.
--<
--< @param scalar_value
--< The scalar value to concatenate to the Bvec3.
--<
--< @return
--< The instance of Bvec4.
----------------------------------------------------------------------------
function Make_Bvec4 (vec3_value : in Vkm_Bvec3;
scalar_value : in Vkm_Bool) return Vkm_Bvec4 is
(Make_Bvec4(vec3_value.data(0),
vec3_value.data(1),
vec3_value.data(2),
scalar_value )) with Inline;
---------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Bvec4 type.
--<
--< @description
--< Produce a vector by concatenating a Bvec2 with a Bvec2.
--<
--< Bvec4 = [vec2_value1, vec2_value2]
--<
--< @param vec2_value1
--< The first Bvec2.
--<
--< @param vec2_value2
--< The second Bvec2.
--<
--< @return
--< The instance of Bvec4.
---------------------------------------------------------------------------
function Make_Bvec4 (vec2_value1, vec2_value2 : in Vkm_Bvec2) return Vkm_Bvec4 is
(Make_Bvec4(vec2_value1.data(0),vec2_value1.data(1),
vec2_value2.data(0),vec2_value2.data(1)));
---------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Bvec4 type.
--<
--< @description
--< Produce a vector by concatenating two scalar values with a Bvec2.
--<
--< Bvec4 = [scalar1, scalar2, vec2_value]
--<
--< @param scalar1
--< First scalar value.
--<
--< @param scalar2
--< Second scalar value.
--<
--< @param vec2_value
--< The Bvec2 value.
--<
--< @return
--< The instance of Bvec4.
---------------------------------------------------------------------------
function Make_Bvec4 (scalar1, scalar2 : in Vkm_Bool;
vec2_value : in Vkm_Bvec2) return Vkm_Bvec4 is
(Make_Bvec4(scalar1, scalar2, vec2_value.data(0),vec2_value.data(1)));
---------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Bvec4 type.
--<
--< @description
--< Produce a vector by concatenating two scalar values with a Bvec2.
--<
--< Bvec4 = [scalar1, vec2_value, scalar2]
--<
--< @param scalar1
--< First scalar value.
--<
--< @param vec2_value
--< The Bvec2 value.
--<
--< @param scalar2
--< Second scalar value.
--<
--< @return
--< The instance of Bvec4.
---------------------------------------------------------------------------
function Make_Bvec4 (scalar1 : in Vkm_Bool;
vec2_value : in Vkm_Bvec2 ;
scalar2 : in Vkm_Bool) return Vkm_Bvec4 is
(Make_Bvec4(scalar1, vec2_value.data(0),vec2_value.data(1), scalar2));
---------------------------------------------------------------------------
--< @summary
--< Constructor for Vkm_Bvec4 type.
--<
--< @description
--< Produce a vector by concatenating two scalar values with a Bvec2.
--<
--< Bvec4 = [vec2_value, scalar1, scalar2]
--<
--< @param vec2_value
--< The Bvec2 value.
--<
--< @param scalar1
--< First scalar value.
--<
--< @param scalar2
--< Second scalar value.
--<
--< @return
--< The instance of Bvec4.
---------------------------------------------------------------------------
function Make_Bvec4 (vec2_value : in Vkm_Bvec2 ;
scalar1 : in Vkm_Bool;
scalar2 : in Vkm_Bool) return Vkm_Bvec4 is
(Make_Bvec4(vec2_value.data(0),vec2_value.data(1), scalar1, scalar2));
end Vulkan.Math.Bvec4;
|
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_Table.Show_Details_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Table_Show_Details_Attribute_Node is
begin
return Self : Table_Show_Details_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_Show_Details_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Show_Details_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Table_URI,
Matreshka.ODF_String_Constants.Show_Details_Attribute,
Table_Show_Details_Attribute_Node'Tag);
end Matreshka.ODF_Table.Show_Details_Attributes;
|
AaronC98/PlaneSystem | Ada | 2,886 | adb | ------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2002-2012, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- 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/>. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
------------------------------------------------------------------------------
package body AWS.Resources.Streams is
------------
-- Create --
------------
procedure Create
(Resource : out File_Type;
Stream : Stream_Access) is
begin
Resource := File_Type (Stream);
end Create;
----------
-- Name --
----------
function Name (Resource : Stream_Type) return String is
pragma Unreferenced (Resource);
begin
return "";
end Name;
----------
-- Size --
----------
overriding function Size
(Resource : Stream_Type) return Stream_Element_Offset
is
pragma Unreferenced (Resource);
begin
return Undefined_Length;
end Size;
end AWS.Resources.Streams;
|
AdaCore/training_material | Ada | 733 | adb | package body Employee_Data is
function Create
(Name : Name_T;
Rate : Hourly_Rate_T)
return Employee_T is
begin
-- Return an employee object with appropriate data
return Employee_T'(others => <>);
end Create;
function Id
(Employee : Employee_T)
return Id_T is
begin
-- return ID member of record
return Id_T'first;
end Id;
function Name
(Employee : Employee_T)
return Name_T is
begin
-- return Name member of record
return "";
end Name;
function Rate
(Employee : Employee_T)
return Hourly_Rate_T is
begin
-- return Rate member of record;
return Hourly_Rate_T'first;
end Rate;
end Employee_Data;
|
stcarrez/dynamo | Ada | 1,824 | adb | -----------------------------------------------------------------------
-- gen-testsuite -- Testsuite for gen
-- Copyright (C) 2012, 2018, 2021 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Directories;
with Gen.Artifacts.XMI.Tests;
with Gen.Artifacts.Yaml.Tests;
with Gen.Integration.Tests;
package body Gen.Testsuite is
Tests : aliased Util.Tests.Test_Suite;
Dir : UString;
function Suite return Util.Tests.Access_Test_Suite is
Result : constant Util.Tests.Access_Test_Suite := Tests'Access;
begin
Gen.Artifacts.XMI.Tests.Add_Tests (Result);
Gen.Artifacts.Yaml.Tests.Add_Tests (Result);
Gen.Integration.Tests.Add_Tests (Result);
return Result;
end Suite;
-- ------------------------------
-- Get the test root directory.
-- ------------------------------
function Get_Test_Directory return String is
begin
return To_String (Dir);
end Get_Test_Directory;
procedure Initialize (Props : in Util.Properties.Manager) is
pragma Unreferenced (Props);
begin
Dir := To_UString (Ada.Directories.Current_Directory);
end Initialize;
end Gen.Testsuite;
|
stcarrez/stm32-ui | Ada | 3,057 | adb | -----------------------------------------------------------------------
-- ui -- User Interface Framework
-- Copyright (C) 2016 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
-- with Ada.Text_IO;
with UI.Images.Decoding_GIF;
package body UI.Images is
-- ------------------------------
-- Draw the image at the given position in the bitmap.
-- ------------------------------
procedure Draw_Image (Buffer : in out HAL.Bitmap.Bitmap_Buffer'Class;
Start : in HAL.Bitmap.Point;
Image : in Image_Descriptor) is
use type HAL.UInt8;
procedure Feedback (Percents : Natural) is null;
Width : constant Natural := Buffer.Width;
Height : constant Natural := Buffer.Height;
Cur_X, Cur_Y : Natural;
procedure Set_X_Y (X, Y : Natural) is
begin
Cur_X := X;
Cur_Y := Y;
end Set_X_Y;
procedure Put_Pixel (Red, Green, Blue : HAL.UInt8;
Alpha : HAL.UInt8) is
Color : HAL.Bitmap.Bitmap_Color;
X : constant Integer := Start.X + Cur_X;
Y : constant Integer := Start.Y + Image.Height - Cur_Y;
begin
if Alpha > 0 and X >= 0 and X < Width and Y >= 0 and Y < Height then
Color.Red := Red;
Color.Green := Green;
Color.Blue := Blue;
Color.Alpha := Alpha;
Buffer.Set_Source (Color);
Buffer.Set_Pixel ((X, Y));
-- Ada.Text_IO.Put_Line (Natural'Image (Cur_X) & "," & Natural'Image (Cur_Y)
-- & " -> [" & HAL.UInt8'Image (Red)
-- & ", " & HAL.UInt8'Image (Green)
-- & ", " & HAL.UInt8'Image (Blue)
-- & "] Alpha " & HAL.UInt8'Image (Alpha));
end if;
Cur_X := Cur_X + 1;
end Put_Pixel;
procedure Load_Image is
new UI.Images.Decoding_GIF.Load (Primary_color_range => HAL.UInt8,
Set_X_Y => Set_X_Y,
Put_Pixel => Put_Pixel,
Feedback => Feedback,
mode => fast);
begin
Load_Image (Image);
end Draw_Image;
end UI.Images;
|
reznikmm/matreshka | Ada | 7,081 | 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.Data_Pilot_Sort_Info_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Table_Data_Pilot_Sort_Info_Element_Node is
begin
return Self : Table_Data_Pilot_Sort_Info_Element_Node do
Matreshka.ODF_Table.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Table_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Table_Data_Pilot_Sort_Info_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Table_Data_Pilot_Sort_Info
(ODF.DOM.Table_Data_Pilot_Sort_Info_Elements.ODF_Table_Data_Pilot_Sort_Info_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Table_Data_Pilot_Sort_Info_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Data_Pilot_Sort_Info_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Table_Data_Pilot_Sort_Info_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Table_Data_Pilot_Sort_Info
(ODF.DOM.Table_Data_Pilot_Sort_Info_Elements.ODF_Table_Data_Pilot_Sort_Info_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Table_Data_Pilot_Sort_Info_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Table_Data_Pilot_Sort_Info
(Visitor,
ODF.DOM.Table_Data_Pilot_Sort_Info_Elements.ODF_Table_Data_Pilot_Sort_Info_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Table_URI,
Matreshka.ODF_String_Constants.Data_Pilot_Sort_Info_Element,
Table_Data_Pilot_Sort_Info_Element_Node'Tag);
end Matreshka.ODF_Table.Data_Pilot_Sort_Info_Elements;
|
stcarrez/mat | Ada | 1,716 | adb | -----------------------------------------------------------------------
-- mat-readers-files -- Reader for files
-- Copyright (C) 2014, 2019 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Streams.Stream_IO;
with Util.Log.Loggers;
package body MAT.Readers.Streams.Files is
-- The logger
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("MAT.Readers.Files");
BUFFER_SIZE : constant Natural := 100 * 1024;
-- ------------------------------
-- Open the file.
-- ------------------------------
procedure Open (Reader : in out File_Reader_Type;
Path : in String) is
Stream : constant access Util.Streams.Input_Stream'Class := Reader.File'Unchecked_Access;
begin
Log.Info ("Reading data stream {0}", Path);
Reader.Stream.Initialize (Size => BUFFER_SIZE,
Input => Stream);
Reader.File.Open (Mode => Ada.Streams.Stream_IO.In_File,
Name => Path);
end Open;
end MAT.Readers.Streams.Files;
|
AdaCore/gpr | Ada | 182 | ads | package p3_1 is
function p3_1_0 (Item : Integer) return Integer;
function p3_1_1 (Item : Integer) return Integer;
function p3_1_2 (Item : Integer) return Integer;
end p3_1;
|
Rodeo-McCabe/orka | Ada | 4,770 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2016 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with GL.Barriers;
with GL.Types;
with Orka.Transforms.Doubles.Vectors;
with Orka.Transforms.Doubles.Vector_Conversions;
with Orka.Rendering.Drawing;
package body Orka.Resources.Models is
function Create_Group
(Object : aliased in out Model;
Culler : Culling.Culler_Ptr;
Capacity : Positive) return Group_Access
is
Shapes_Count : constant Natural := Object.Scene.Shapes.Element'Length;
begin
return new Model_Group'
(Model => Object'Access,
Instances => Model_Instances.Create_Manager
(Capacity => Capacity, Parts => Shapes_Count),
Cull_Instance => Culling.Create_Instance
(Culler, Transforms => Capacity * Shapes_Count, Commands => Shapes_Count),
others => <>);
end Create_Group;
procedure Add_Instance
(Object : access Model_Group;
Instance : in out Model_Instance_Ptr) is
begin
if Instance.Group /= null then
raise Program_Error;
end if;
Instance.Group := Object;
Instance.Scene := Object.Model.Scene.Scene;
Instance.Instance := Object.Instances.Add_Instance;
end Add_Instance;
procedure Remove_Instance
(Object : in out Model_Group;
Instance : in out Model_Instance_Ptr) is
begin
if Instance.Group = null then
raise Program_Error;
end if;
Instance.Group := null;
Object.Instances.Remove_Instance (Instance.Instance);
end Remove_Instance;
-----------------------------------------------------------------------------
procedure Cull (Object : in out Model_Group) is
begin
Object.Cull_Instance.Cull
(Transforms => Object.Instances.Transforms,
Bounds => Object.Model.Bounds,
Commands => Object.Model.Batch.Commands.Buffer,
Compacted_Transforms => Object.Compacted_Transforms,
Compacted_Commands => Object.Compacted_Commands,
Instances => Object.Instances.Length);
end Cull;
procedure Render (Object : in out Model_Group) is
use all type Rendering.Buffers.Indexed_Buffer_Target;
begin
Object.Model.Batch.Data.Bind (Shader_Storage, 1);
Object.Compacted_Transforms.Bind (Shader_Storage, 0);
GL.Barriers.Memory_Barrier
((By_Region => False, Shader_Storage | Command => True, others => False));
Rendering.Drawing.Draw_Indexed_Indirect
(GL.Types.Triangles, Object.Model.Batch.Indices.Buffer, Object.Compacted_Commands);
end Render;
procedure After_Render (Object : in out Model_Group) is
begin
Object.Instances.Complete_Frame;
end After_Render;
-----------------------------------------------------------------------------
procedure Update_Transforms
(Object : in out Model_Instance;
View_Position : Behaviors.Vector4)
is
use Transforms;
use Orka.Transforms.Doubles.Vectors;
use Orka.Transforms.Doubles.Vector_Conversions;
pragma Assert (Object.Group /= null);
Position : Behaviors.Vector4
renames Behaviors.Behavior'Class (Object).Position;
procedure Write_Transforms (Cursors : Cursor_Array) is
begin
for Index in Cursors'Range loop
Object.Group.Instances.Set_Transform
(Value => Object.Scene.World_Transform (Cursors (Index)),
Instance => Object.Instance,
Part => Index - Cursors'First);
end loop;
end Write_Transforms;
begin
-- Compute the world transforms by multiplying the local transform
-- of each node with the world transform of its parent. Also updates
-- the visibility of each node.
Object.Scene.Update_Tree (T (Convert (Position - View_Position)));
-- Write the world transform of the leaf nodes to the persistent mapped buffer
Object.Group.Model.Scene.Shapes.Query_Element (Write_Transforms'Access);
-- Note: This requires that the structure of the model's scene tree is
-- identical to the instance's scene so that we can re-use the cursors
end Update_Transforms;
end Orka.Resources.Models;
|
reznikmm/matreshka | Ada | 5,992 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- 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$
------------------------------------------------------------------------------
with Ada.IO_Exceptions;
with Ada.Wide_Wide_Text_IO;
with Ada.Unchecked_Deallocation;
with League.IRIs;
with XML.SAX.Input_Sources.Streams.Files;
with AMF.Internals.XMI_URI_Rewriter;
package body AMF.Internals.XMI_Document_Resolvers is
------------------
-- Error_String --
------------------
overriding function Error_String
(Self : Default_Document_Resolver)
return League.Strings.Universal_String is
begin
return Self.Error_String;
end Error_String;
----------------------
-- Resolve_Document --
----------------------
overriding procedure Resolve_Document
(Self : in out Default_Document_Resolver;
URI : League.Strings.Universal_String;
Source : out XML.SAX.Input_Sources.SAX_Input_Source_Access;
Success : in out Boolean)
is
use type League.Strings.Universal_String;
procedure Free is
new Ada.Unchecked_Deallocation
(XML.SAX.Input_Sources.SAX_Input_Source'Class,
XML.SAX.Input_Sources.SAX_Input_Source_Access);
New_URI : constant League.Strings.Universal_String
:= AMF.Internals.XMI_URI_Rewriter.Rewrite_Model_URI (URI);
Parsed_URI : constant League.IRIs.IRI
:= League.IRIs.From_Universal_String (New_URI);
begin
Self.Error_String.Clear;
Source :=
new XML.SAX.Input_Sources.Streams.Files.File_Input_Source;
-- Open input source.
Ada.Wide_Wide_Text_IO.Put_Line
(Ada.Wide_Wide_Text_IO.Standard_Error,
"Opening '"
& URI.To_Wide_Wide_String
& "' (use '"
& New_URI.To_Wide_Wide_String
& "')");
begin
if not Parsed_URI.Get_Scheme.Is_Empty then
XML.SAX.Input_Sources.Streams.Files.File_Input_Source'Class
(Source.all).Open_By_URI (New_URI);
else
XML.SAX.Input_Sources.Streams.Files.File_Input_Source'Class
(Source.all).Open_By_File_Name (New_URI);
end if;
-- Set system identifier when is was rewritten.
if URI /= New_URI then
Source.Set_System_Id (URI);
end if;
exception
when Ada.IO_Exceptions.Name_Error =>
-- Set error string and error flag.
Self.Error_String := "Unable to open '" & New_URI & ''';
Success := False;
-- Free input source.
Free (Source);
Ada.Wide_Wide_Text_IO.Put_Line
(Ada.Wide_Wide_Text_IO.Standard_Error,
Self.Error_String.To_Wide_Wide_String);
end;
end Resolve_Document;
end AMF.Internals.XMI_Document_Resolvers;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.