repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
landgraf/nanomsg-ada | Ada | 1,954 | adb | -- The MIT License (MIT)
-- Copyright (c) 2015 Pavel Zhukov <[email protected]>
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
with Interfaces.C.Strings;
package body Nanomsg.Errors is
package C renames Interfaces.C;
function Errno return Integer
is
function C_Errno return C.Int with Import, Convention => C, External_Name => "nn_errno";
begin
return Integer (C_Errno);
end Errno;
function Errno_Text return String is
function Strerror (Err : in C.Int) return C.Strings.Chars_Ptr
with Import, Convention => C, External_Name => "nn_strerror";
Err : constant Integer := Errno;
begin
return "Errno = " & Integer'Image (Err) & " : " & C.Strings.Value (Strerror (C.Int (Err)));
end Errno_Text;
function Errno_Id return String is
begin
raise Not_Implemented_Exception;
return "";
end Errno_Id;
end Nanomsg.Errors;
|
dan76/Amass | Ada | 442 | 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 = "HyperStat"
type = "scrape"
function start()
set_rate_limit(2)
end
function vertical(ctx, domain)
scrape(ctx, {['url']=build_url(domain)})
end
function build_url(domain)
return "https://hypestat.com/info/" .. domain
end
|
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.Draw_Corner_Radius_Attributes is
pragma Preelaborate;
type ODF_Draw_Corner_Radius_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Draw_Corner_Radius_Attribute_Access is
access all ODF_Draw_Corner_Radius_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Draw_Corner_Radius_Attributes;
|
Lyanf/pok | Ada | 52 | ads | package User is
procedure Hello_Part1;
end User;
|
zhmu/ananas | Ada | 1,857 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . T E X T _ I O . B O U N D E D _ I O --
-- --
-- S p e c --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- --
------------------------------------------------------------------------------
with Ada.Strings.Bounded;
generic
with package Bounded is
new Ada.Strings.Bounded.Generic_Bounded_Length (<>);
package Ada.Text_IO.Bounded_IO is
function Get_Line return Bounded.Bounded_String;
function Get_Line
(File : File_Type) return Bounded.Bounded_String;
procedure Get_Line
(Item : out Bounded.Bounded_String);
procedure Get_Line
(File : File_Type;
Item : out Bounded.Bounded_String);
procedure Put
(Item : Bounded.Bounded_String);
procedure Put
(File : File_Type;
Item : Bounded.Bounded_String);
procedure Put_Line
(Item : Bounded.Bounded_String);
procedure Put_Line
(File : File_Type;
Item : Bounded.Bounded_String);
end Ada.Text_IO.Bounded_IO;
|
davidkristola/vole | Ada | 1,351 | adb | with Ada.Text_IO;
with Ada.Strings.Unbounded;
package body kv.avm.Log is
Last_Log_Line : Ada.Strings.Unbounded.Unbounded_String;
Last_Error_Line : Ada.Strings.Unbounded.Unbounded_String;
procedure Put(Str : String) is
begin
if Verbose then
Ada.Text_IO.Put(Str);
end if;
end Put;
procedure Put_Line(Str : String) is
begin
Last_Log_Line := Ada.Strings.Unbounded.To_Unbounded_String(Str);
if Verbose then
Ada.Text_IO.Put_Line(Str);
end if;
end Put_Line;
procedure Log_If(Callback : access function return String) is
begin
if Verbose then
Ada.Text_IO.Put_Line(Callback.all);
end if;
end Log_If;
procedure Put_Error(Str : String) is
begin
Last_Error_Line := Ada.Strings.Unbounded.To_Unbounded_String(Str);
Ada.Text_IO.Put_Line(Str);
end Put_Error;
procedure New_Line(Count : Positive := 1) is
begin
if Verbose then
Ada.Text_IO.New_Line(Ada.Text_Io.Count(Count));
end if;
end New_Line;
function Get_Last_Log_Line return String is
begin
return Ada.Strings.Unbounded.To_String(Last_Log_Line);
end Get_Last_Log_Line;
function Get_Last_Error_Line return String is
begin
return Ada.Strings.Unbounded.To_String(Last_Error_Line);
end Get_Last_Error_Line;
end kv.avm.Log;
|
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.Attributes;
package ODF.DOM.Style_Leader_Char_Attributes is
pragma Preelaborate;
type ODF_Style_Leader_Char_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Style_Leader_Char_Attribute_Access is
access all ODF_Style_Leader_Char_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Style_Leader_Char_Attributes;
|
PThierry/ewok-kernel | Ada | 36 | ads | ../stm32f439/soc-gpio-interfaces.ads |
reznikmm/matreshka | Ada | 4,759 | 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_Anim.Color_Interpolation_Direction_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Anim_Color_Interpolation_Direction_Attribute_Node is
begin
return Self : Anim_Color_Interpolation_Direction_Attribute_Node do
Matreshka.ODF_Anim.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Anim_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Anim_Color_Interpolation_Direction_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Color_Interpolation_Direction_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Anim_URI,
Matreshka.ODF_String_Constants.Color_Interpolation_Direction_Attribute,
Anim_Color_Interpolation_Direction_Attribute_Node'Tag);
end Matreshka.ODF_Anim.Color_Interpolation_Direction_Attributes;
|
charlie5/lace | Ada | 9,407 | adb | with
gel.Events,
physics.Forge,
openGL.Renderer.lean,
lace.Event.utility,
ada.Text_IO,
ada.unchecked_Deallocation;
package body gel.World.server
is
use gel.Sprite,
linear_Algebra_3D,
lace.Event.utility,
lace.Event;
procedure log (Message : in String)
renames ada.text_IO.put_Line;
pragma Unreferenced (log);
---------
--- Forge
--
procedure free (Self : in out View)
is
procedure deallocate is new ada.unchecked_Deallocation (Item'Class, View);
begin
deallocate (Self);
end free;
procedure define (Self : in out Item'Class; Name : in String;
Id : in world_Id;
space_Kind : in physics.space_Kind;
Renderer : access openGL.Renderer.lean.item'Class);
overriding
procedure destroy (Self : in out Item)
is
begin
physics.Space.free (Self.physics_Space);
lace.Subject_and_deferred_Observer.item (Self).destroy; -- Destroy base class.
lace.Subject_and_deferred_Observer.free (Self.local_Subject_and_deferred_Observer);
end destroy;
package body Forge
is
function to_World (Name : in String;
Id : in world_Id;
space_Kind : in physics.space_Kind;
Renderer : access openGL.Renderer.lean.item'Class) return gel.World.server.item
is
use lace.Subject_and_deferred_Observer.Forge;
begin
return Self : gel.World.server.item := (to_Subject_and_Observer (Name => Name & " world" & Id'Image)
with others => <>)
do
Self.define (Name, Id, space_Kind, Renderer);
end return;
end to_World;
function new_World (Name : in String;
Id : in world_Id;
space_Kind : in physics.space_Kind;
Renderer : access openGL.Renderer.lean.item'Class) return gel.World.server.view
is
use lace.Subject_and_deferred_Observer.Forge;
Self : constant gel.World.server.view
:= new gel.World.server.item' (to_Subject_and_Observer (name => Name & " world" & Id'Image)
with others => <>);
begin
Self.define (Name, Id, space_Kind, Renderer);
return Self;
end new_World;
end Forge;
function to_Sprite (the_Pair : in remote.World.sprite_model_Pair;
the_Models : in Id_Maps_of_Model .Map;
the_physics_Models : in Id_Maps_of_physics_Model.Map;
the_World : in gel.World.view) return gel.Sprite.view
is
the_graphics_Model : access openGL .Model.item'Class;
the_physics_Model : access physics.Model.item'Class;
the_Sprite : gel.Sprite.view;
use openGL;
begin
the_graphics_Model := openGL .Model.view (the_Models .Element (the_Pair.graphics_Model_Id));
the_physics_Model := physics.Model.view (the_physics_Models.Element (the_Pair. physics_Model_Id));
the_Sprite := gel.Sprite.forge.new_Sprite ("Sprite" & the_Pair.sprite_Id'Image,
sprite.World_view (the_World),
get_Translation (the_Pair.Transform),
the_graphics_Model,
the_physics_Model,
owns_Graphics => False,
owns_Physics => False,
is_Kinematic => the_Pair.Mass /= 0.0);
the_Sprite.Id_is (Now => the_Pair.sprite_Id);
the_Sprite.is_Visible (Now => the_Pair.is_Visible);
the_Sprite.Site_is (get_Translation (the_Pair.Transform));
the_Sprite.Spin_is (get_Rotation (the_Pair.Transform));
the_Sprite.desired_Dynamics_are (Site => the_Sprite.Site,
Spin => to_Quaternion (get_Rotation (the_Sprite.Transform)));
-- the_Sprite.desired_Site_is (the_Sprite.Site);
-- the_Sprite.desired_Spin_is (to_Quaternion (get_Rotation (the_Sprite.Transform)));
return the_Sprite;
end to_Sprite;
pragma Unreferenced (to_Sprite);
----------
--- Define
--
procedure define (Self : in out Item'Class; Name : in String;
Id : in world_Id;
space_Kind : in physics.space_Kind;
Renderer : access openGL.Renderer.lean.Item'Class)
is
use lace.Subject_and_deferred_Observer.Forge;
begin
Self.local_Subject_and_deferred_Observer := new_Subject_and_Observer (name => Name & " world" & Id'Image);
Self.Id := Id;
Self.space_Kind := space_Kind;
Self.Renderer := Renderer;
Self.physics_Space := physics.Forge.new_Space (space_Kind);
end define;
--------------
--- Operations
--
overriding
procedure evolve (Self : in out Item)
is
begin
gel.World.item (Self).evolve; -- Evolve the base class.
-- Update dynamics in client worlds.
--
declare
use id_Maps_of_sprite,
remote.World;
all_Sprites : constant id_Maps_of_sprite.Map := Self.all_Sprites.fetch;
Cursor : id_Maps_of_sprite.Cursor := all_Sprites.First;
the_Sprite : gel.Sprite.view;
is_a_mirrored_World : constant Boolean := not Self.Clients.Is_Empty;
mirror_Updates_are_due : constant Boolean := Self.Age >= Self.Age_at_last_Clients_update + client_update_Period;
updates_Count : Natural := 0;
the_motion_Updates : remote.World.motion_Updates (1 .. Integer (all_Sprites.Length));
begin
if is_a_mirrored_World
and mirror_Updates_are_due
then
while has_Element (Cursor)
loop
the_Sprite := Sprite.view (Element (Cursor));
updates_Count := updates_Count + 1;
the_motion_Updates (updates_Count) := (Id => the_Sprite.Id,
Site => coarsen (the_Sprite.Site),
Spin => coarsen (to_Quaternion (the_Sprite.Spin)));
-- Spin => the_Sprite.Spin);
-- log (Image (Quaternion' (refined (the_motion_Updates (updates_Count).Spin))));
next (Cursor);
end loop;
-- Send updated sprite motions to all registered client worlds.
--
Self.Age_at_last_clients_update := Self.Age;
if updates_Count > 0
then
declare
use World.server.world_Vectors;
Cursor : world_Vectors.Cursor := Self.Clients.First;
the_Mirror : remote.World.view;
begin
while has_Element (Cursor)
loop
the_Mirror := Element (Cursor);
the_Mirror.motion_Updates_are (the_motion_Updates (1 .. updates_Count));
next (Cursor);
end loop;
end;
end if;
end if;
end;
end evolve;
overriding
function fetch (From : in sprite_Map) return id_Maps_of_sprite.Map
is
begin
return From.Map;
end fetch;
overriding
procedure add (To : in out sprite_Map; the_Sprite : in Sprite.view)
is
begin
To.Map.insert (the_Sprite.Id, the_Sprite);
end add;
overriding
procedure rid (From : in out sprite_Map; the_Sprite : in Sprite.view)
is
begin
From.Map.delete (the_Sprite.Id);
end rid;
overriding
function all_Sprites (Self : access Item) return access World.sprite_Map'Class
is
begin
return Self.all_Sprites'Access;
end all_Sprites;
-----------------------
--- Client Registration
--
overriding
procedure register (Self : access Item; the_Mirror : in remote.World.view;
Mirror_as_observer : in lace.Observer.view)
is
begin
Self.Clients.append (the_Mirror);
Self.register (Mirror_as_observer, to_Kind (remote.World. new_model_Event'Tag));
Self.register (Mirror_as_observer, to_Kind (gel.events. new_sprite_Event'Tag));
Self.register (Mirror_as_observer, to_Kind (gel.events.my_new_sprite_added_to_world_Event'Tag));
end register;
overriding
procedure deregister (Self : access Item; the_Mirror : in remote.World.view)
is
begin
Self.Clients.delete (Self.Clients.find_Index (the_Mirror));
end deregister;
end gel.World.server;
|
mirror/ncurses | Ada | 6,684 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- ncurses --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright 2020 Thomas E. Dickey --
-- Copyright 2000-2006,2008 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Eugene V. Melaragno <[email protected]> 2000
-- Version Control
-- $Revision: 1.4 $
-- $Date: 2020/02/02 23:34:34 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with ncurses2.util; use ncurses2.util;
with Terminal_Interface.Curses; use Terminal_Interface.Curses;
with Ada.Strings.Fixed;
procedure ncurses2.color_test is
use Int_IO;
procedure show_color_name (y, x : Integer; color : Integer);
color_names : constant array (0 .. 15) of String (1 .. 7) :=
(
"black ",
"red ",
"green ",
"yellow ",
"blue ",
"magenta",
"cyan ",
"white ",
"BLACK ",
"RED ",
"GREEN ",
"YELLOW ",
"BLUE ",
"MAGENTA",
"CYAN ",
"WHITE "
);
procedure show_color_name (y, x : Integer; color : Integer) is
tmp5 : String (1 .. 5);
begin
if Number_Of_Colors > 8 then
Put (tmp5, color);
Add (Line => Line_Position (y), Column => Column_Position (x),
Str => tmp5);
else
Add (Line => Line_Position (y), Column => Column_Position (x),
Str => color_names (color));
end if;
end show_color_name;
top, width : Integer;
hello : String (1 .. 5);
-- tmp3 : String (1 .. 3);
-- tmp2 : String (1 .. 2);
begin
Refresh;
Add (Str => "There are ");
-- Put(tmp3, Number_Of_Colors*Number_Of_Colors);
Add (Str => Ada.Strings.Fixed.Trim (Integer'Image (Number_Of_Colors *
Number_Of_Colors),
Ada.Strings.Left));
Add (Str => " color pairs");
Add (Ch => newl);
if Number_Of_Colors > 8 then
width := 4;
else
width := 8;
end if;
if Number_Of_Colors > 8 then
hello := "Test ";
else
hello := "Hello";
end if;
for Bright in Boolean loop
if Number_Of_Colors > 8 then
top := 0;
else
top := Boolean'Pos (Bright) * (Number_Of_Colors + 3);
end if;
Clear_To_End_Of_Screen;
Move_Cursor (Line => Line_Position (top) + 1, Column => 0);
-- Put(tmp2, Number_Of_Colors);
Add (Str => Ada.Strings.Fixed.Trim (Integer'Image (Number_Of_Colors),
Ada.Strings.Left));
Add (Ch => 'x');
Add (Str => Ada.Strings.Fixed.Trim (Integer'Image (Number_Of_Colors),
Ada.Strings.Left));
Add (Str => " matrix of foreground/background colors, bright *");
if Bright then
Add (Str => "on");
else
Add (Str => "off");
end if;
Add (Ch => '*');
for i in 0 .. Number_Of_Colors - 1 loop
show_color_name (top + 2, (i + 1) * width, i);
end loop;
for i in 0 .. Number_Of_Colors - 1 loop
show_color_name (top + 3 + i, 0, i);
end loop;
for i in 1 .. Number_Of_Color_Pairs - 1 loop
Init_Pair (Color_Pair (i), Color_Number (i mod Number_Of_Colors),
Color_Number (i / Number_Of_Colors));
-- attron((attr_t) COLOR_PAIR(i)) -- Huh?
Set_Color (Pair => Color_Pair (i));
if Bright then
Switch_Character_Attribute (Attr => (Bold_Character => True,
others => False));
end if;
Add (Line => Line_Position (top + 3 + (i / Number_Of_Colors)),
Column => Column_Position ((i mod Number_Of_Colors + 1) *
width),
Str => hello);
Set_Character_Attributes;
end loop;
if Number_Of_Colors > 8 or Bright then
Pause;
end if;
end loop;
Erase;
End_Windows;
end ncurses2.color_test;
|
davidkristola/vole | Ada | 3,063 | ads |
with kv.avm.Control;
with kv.avm.Executables;
with kv.avm.Actor_References;
package kv.avm.Executable_Lists is
type Cursor_Type is new Natural;
subtype Index_Type is Cursor_Type range 1 .. Cursor_Type'LAST;
type Executable_Handle_Type is tagged private;
type Executable_Handle_Access is access Executable_Handle_Type;
function Get_List(Self : Executable_Handle_Type) return kv.avm.Control.Status_Type;
function Get_Cursor(Self : Executable_Handle_Type) return Cursor_Type;
function Get_Reference(Self : Executable_Handle_Type) return kv.avm.Actor_References.Actor_Reference_Type;
function Get_Executable(Self : Executable_Handle_Type) return kv.avm.Executables.Executable_Access;
type Executable_Holder_Type is tagged private;
procedure Initialize
(Self : in out Executable_Holder_Type;
Kind : in kv.avm.Control.Status_Type);
procedure Add
(Self : in out Executable_Holder_Type;
This : in kv.avm.Executables.Executable_Access;
Ref : in kv.avm.Actor_References.Actor_Reference_Type);
function Find(Self : Executable_Holder_Type; Executable : kv.avm.Executables.Executable_Access) return Cursor_Type;
function Is_In(Self : Executable_Holder_Type; Executable : kv.avm.Executables.Executable_Access) return Boolean;
function Get(Self : Executable_Holder_Type; Position : Cursor_Type) return kv.avm.Executables.Executable_Access;
procedure Delete -- deallocate the handle
(Self : in out Executable_Holder_Type;
This : in Cursor_Type);
procedure Drop -- just remove the handle from the list
(Self : in out Executable_Holder_Type;
This : in Cursor_Type);
procedure Drop
(Self : in out Executable_Holder_Type;
This : in kv.avm.Executables.Executable_Access);
procedure Acquire_From
(Self : in out Executable_Holder_Type;
Place : in Cursor_Type;
From : in out Executable_Holder_Type);
function Get_Handle
(Self : Executable_Holder_Type;
Position : Cursor_Type) return Executable_Handle_Access;
function Get_Last
(Self : Executable_Holder_Type) return Cursor_Type;
private
type Executable_Handle_Type is tagged
record
Executable : kv.avm.Executables.Executable_Access;
Reference : kv.avm.Actor_References.Actor_Reference_Type;
Status : kv.avm.Control.Status_Type; -- This is also the list that holds the executable
Position : Cursor_Type; -- Zero means that this executable isn't in a list
end record;
type Executable_Array_Type is array (Index_Type range <>) of Executable_Handle_Access;
type Executable_Array_Access is access Executable_Array_Type;
type Executable_Holder_Type is tagged
record
List : Executable_Array_Access;
Count : Cursor_Type;
Kind : kv.avm.Control.Status_Type;
end record;
procedure Add
(Self : in out Executable_Holder_Type;
This : in Executable_Handle_Access);
end kv.avm.Executable_Lists;
|
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.Fo_Orphans_Attributes is
pragma Preelaborate;
type ODF_Fo_Orphans_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Fo_Orphans_Attribute_Access is
access all ODF_Fo_Orphans_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Fo_Orphans_Attributes;
|
reznikmm/matreshka | Ada | 4,717 | 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_List_Style_Elements;
package Matreshka.ODF_Text.List_Style_Elements is
type Text_List_Style_Element_Node is
new Matreshka.ODF_Text.Abstract_Text_Element_Node
and ODF.DOM.Text_List_Style_Elements.ODF_Text_List_Style
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Text_List_Style_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Text_List_Style_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Text_List_Style_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_List_Style_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_List_Style_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.List_Style_Elements;
|
reznikmm/matreshka | Ada | 4,609 | 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_Number.Language_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Number_Language_Attribute_Node is
begin
return Self : Number_Language_Attribute_Node do
Matreshka.ODF_Number.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Number_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Number_Language_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Language_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Number_URI,
Matreshka.ODF_String_Constants.Language_Attribute,
Number_Language_Attribute_Node'Tag);
end Matreshka.ODF_Number.Language_Attributes;
|
AdaCore/ada-traits-containers | Ada | 20,553 | ads | --
-- Copyright (C) 2015-2016, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
--
-- Implementation details for the vector container.
-- This package takes the same formal arguments as Conts.Vectors.Generics
-- and provides the internal implementation as well as annotations for
-- all the primitive operations.
pragma Ada_2012;
with Conts.Vectors.Storage;
with Conts.Functional.Sequences;
generic
type Index_Type is (<>);
with package Storage is new Conts.Vectors.Storage.Traits (<>);
package Conts.Vectors.Impl with SPARK_Mode is
pragma Assertion_Policy
(Pre => Suppressible, Ghost => Suppressible, Post => Ignore);
subtype Extended_Index is Index_Type'Base range
Index_Type'Pred (Index_Type'First) .. Index_Type'Last;
No_Index : constant Extended_Index := Extended_Index'First;
-- Index_Type with one more element to the left, used to represent
-- invalid indexes
subtype Element_Type is Storage.Elements.Element_Type;
subtype Returned_Type is Storage.Elements.Returned_Type;
subtype Constant_Returned_Type is Storage.Elements.Constant_Returned_Type;
subtype Stored_Type is Storage.Elements.Stored_Type;
use type Storage.Elements.Element_Type;
use type Storage.Elements.Constant_Returned_Type;
use type Storage.Elements.Returned_Type;
type Base_Vector is new Storage.Container with private with
Default_Initial_Condition => Length (Base_Vector) = 0;
-- Define the iterable aspect later, since this is not allowed when the
-- parent type is a generic formal.
subtype Cursor is Extended_Index;
No_Element : constant Cursor := No_Index;
Last_Count : constant Count_Type :=
(if Index_Type'Pos (Index_Type'Last) < Index_Type'Pos (Index_Type'First)
then 0
elsif Index_Type'Pos (Index_Type'Last) < -1
or else Index_Type'Pos (Index_Type'First) >
Index_Type'Pos (Index_Type'Last) - Count_Type'Last
then Index_Type'Pos (Index_Type'Last) -
Index_Type'Pos (Index_Type'First) + 1
else Count_Type'Last);
-- Maximal capacity of any vector. It is the minimum of the size of the
-- index range and the last possible Count_Type.
function Max_Capacity (Self : Base_Vector'Class) return Count_Type
is (Count_Type'Min (Last_Count, Storage.Max_Capacity (Self)));
-- Maximal capacity of Self. It cannot be modified. It is the maximal
-- number of elements a vector may contain.
function Length (Self : Base_Vector'Class) return Count_Type
-- The length of a vector is always smaller than Max_Capacity.
with
Inline,
Global => null,
Post => Length'Result <= Max_Capacity (Self);
function Last (Self : Base_Vector'Class) return Extended_Index
-- On an empty vector, Last returns Extended_Index'First.
with
Inline,
Global => null,
Post => Last'Result =
Index_Type'Val ((Index_Type'Pos (Index_Type'First) - 1)
+ Length (Self));
function To_Index (Position : Count_Type) return Extended_Index
-- Converts from index into the actual array back to the index type
with
Global => null,
Pre => Position in 0 .. Last_Count,
Post => To_Index'Result = Index_Type'Val
(Position - Conts.Vectors.Storage.Min_Index
+ Count_Type'Base (Index_Type'Pos (Index_Type'First)));
function To_Count (Idx : Index_Type) return Count_Type
-- Converts from an index type to an index into the actual underlying
-- array.
with
Inline,
Global => null,
Pre => Idx in Index_Type'First .. To_Index (Last_Count),
Post => To_Count'Result = Count_Type
(Conts.Vectors.Storage.Min_Index
+ Count_Type'Base (Index_Type'Pos (Idx))
- Count_Type'Base (Index_Type'Pos (Index_Type'First)));
------------------
-- Formal Model --
------------------
pragma Unevaluated_Use_Of_Old (Allow);
package M is new Conts.Functional.Sequences
(Index_Type => Index_Type,
Element_Type => Element_Type);
-- This instance should be ghost but it is not currently allowed by the RM.
-- See P523-006
function Model (Self : Base_Vector'Class) return M.Sequence
with
Ghost,
Global => null,
Post => M.Length (Model'Result) = Length (Self);
use type M.Sequence;
function Element
(S : M.Sequence; I : Index_Type) return Element_Type
renames M.Get;
-- ??? Do we need this subprogram, could we use M.Get everywhere instead ?
-----------------
-- Subprograms --
-----------------
function Element
(Self : Base_Vector'Class; Position : Index_Type)
return Constant_Returned_Type
-- See documentation in conts-vectors-generics.ads
with
Inline,
Global => null,
Pre => Position <= Last (Self),
Post => Storage.Elements.To_Element (Element'Result) =
Element (Model (Self), Position);
function Reference
(Self : Base_Vector'Class; Position : Index_Type)
return Returned_Type
-- See documentation in conts-vectors-generics.ads
with
Inline,
Global => null,
Pre => Position <= Last (Self);
function Last_Element
(Self : Base_Vector'Class) return Constant_Returned_Type
-- See documentation in conts-vectors-generics.ads
with
Global => null,
Pre => Length (Self) > 0,
Post => Last_Element'Result = Element (Self, Last (Self));
function First (Self : Base_Vector'Class) return Cursor
-- See documentation in conts-vectors-generics.ads
with
Inline,
Global => null,
Contract_Cases =>
(Length (Self) = 0 => First'Result = No_Element,
others => First'Result = Index_Type'First
and then Has_Element (Self, First'Result));
function Has_Element
(Self : Base_Vector'Class; Position : Cursor) return Boolean
is (Position >= Index_Type'First and then Position <= Self.Last)
-- See documentation in conts-vectors-generics.ads
with
Inline,
Global => null,
Post => Has_Element'Result =
(Position in Index_Type'First .. Self.Last);
pragma Annotate (GNATprove, Inline_For_Proof, Entity => Has_Element);
function Next
(Self : Base_Vector'Class; Position : Cursor) return Cursor
-- See documentation in conts-vectors-generics.ads
with
Inline,
Global => null,
Pre => Has_Element (Self, Position),
Contract_Cases =>
(Position < Last (Self) => Next'Result = Index_Type'Succ (Position)
and then Has_Element (Self, Next'Result),
others => Next'Result = No_Element);
procedure Next (Self : Base_Vector'Class; Position : in out Cursor)
-- See documentation in conts-vectors-generics.ads
with
Inline,
Global => null,
Pre => Has_Element (Self, Position),
Contract_Cases =>
(Position < Last (Self) => Position = Index_Type'Succ (Position'Old)
and then Has_Element (Self, Position),
others => Position = No_Element);
function Previous
(Self : Base_Vector'Class; Position : Cursor) return Cursor
-- See documentation in conts-vectors-generics.ads
with
Inline,
Global => null,
Pre => Has_Element (Self, Position),
Contract_Cases =>
(Position > Index_Type'First =>
Previous'Result = Index_Type'Pred (Position)
and then Has_Element (Self, Previous'Result),
others => Previous'Result = No_Element);
procedure Reserve_Capacity
(Self : in out Base_Vector'Class; Capacity : Count_Type)
-- Make sure there is enough space for at least Count_Type elements in
-- Self.
with
Global => null,
Pre => Capacity <= Max_Capacity (Self),
Post => Length (Self) = Length (Self)'Old
and then Model (Self) = Model (Self)'Old;
procedure Shrink_To_Fit (Self : in out Base_Vector'Class)
-- Resize the vector to fit its number of elements.
-- This has no effect on models.
with
Global => null,
Post => Length (Self) = Length (Self)'Old
and then Model (Self) = Model (Self)'Old;
function M_Elements_Equal
(S1, S2 : M.Sequence;
Fst : Index_Type;
Lst : Extended_Index)
return Boolean
-- The slice from Fst to Lst contains the same values in S1 and S2.
with Ghost,
Pre => Lst <= M.Last (S1) and Lst <= M.Last (S2),
Post => M_Elements_Equal'Result =
(for all I in Fst .. Lst => Element (S1, I) = Element (S2, I));
pragma Annotate (GNATprove, Inline_For_Proof, M_Elements_Equal);
function M_Elements_Consts
(S : M.Sequence;
Fst : Index_Type;
Lst : Extended_Index;
E : Storage.Elements.Element_Type)
return Boolean
-- The slice from Fst to Lst contains only the value E.
with Ghost,
Pre => Lst <= M.Last (S),
Post => M_Elements_Consts'Result =
(for all I in Fst .. Lst => Element (S, I) = E);
pragma Annotate (GNATprove, Inline_For_Proof, M_Elements_Consts);
procedure Resize
(Self : in out Base_Vector'Class;
Length : Count_Type;
Element : Storage.Elements.Element_Type)
-- See documentation in conts-vectors-generics.ads
with
Global => null,
Pre => Length <= Max_Capacity (Self),
Post =>
Impl.Length (Self) = Length
-- Elements of Self that were located before the index Length are
-- preserved.
and then M_Elements_Equal
(S1 => Model (Self),
S2 => Model (Self)'Old,
Fst => Index_Type'First,
Lst => Index_Type'Min
(To_Index (Length),
Last (Self)'Old))
-- If elements were appended to Self then they are equal to Element.
and then
(if To_Index (Length) > Last (Self)'Old then
M_Elements_Consts (S => Model (Self),
Fst => Index_Type'Succ (Last (Self)'Old),
Lst => Last (Self),
E => Element));
procedure Clear (Self : in out Base_Vector'Class)
-- See documentation in conts-vectors-generics.ads
with
Global => null,
Post => Length (Self) = 0;
procedure Append
(Self : in out Base_Vector'Class;
Element : Element_Type;
Count : Count_Type := 1)
-- See documentation in conts-vectors-generics.ads
with
Global => null,
Pre => Length (Self) <= Max_Capacity (Self) - Count,
Post => Length (Self) = Length (Self)'Old + Count
-- Elements that were already in Self are preserved.
and then M_Elements_Equal
(S1 => Model (Self),
S2 => Model (Self)'Old,
Fst => Index_Type'First,
Lst => Last (Self)'Old)
-- Appended elements are equal to Element.
and then M_Elements_Consts (S => Model (Self),
Fst => Index_Type'Succ (Last (Self)'Old),
Lst => Last (Self),
E => Element);
procedure Insert
(Self : in out Base_Vector'Class;
Before : Extended_Index;
Element : Element_Type;
Count : Count_Type := 1)
-- See documentation in conts-vectors-generics.ads
with
Global => null,
Pre => Length (Self) <= Max_Capacity (Self) - Count
and then (Before = No_Element or else Has_Element (Self, Before)),
Post =>
Length (Self) = Length (Self)'Old + Count
-- Elements before Before have not been modified
and M_Elements_Equal
(S1 => Model (Self),
S2 => Model (Self)'Old,
Fst => Index_Type'First,
Lst => Index_Type'Pred (Before))
-- Then the new elements
and M_Elements_Consts
(Model (Self),
Fst => Before,
Lst => Index_Type'Val (Index_Type'Pos (Before) + Count - 1),
E => Element)
-- Elements after are unchanged
and M_Elements_Shifted
(S1 => Model (Self)'Old,
S2 => Model (Self),
Fst => Before,
Lst => Last (Self)'Old,
Offset => Count);
procedure Assign
(Self : in out Base_Vector'Class; Source : Base_Vector'Class)
-- See documentation in conts-vectors-generics.ads
with
Global => null,
Post => Model (Self) = Model (Source);
function Is_Empty (Self : Base_Vector'Class) return Boolean
is (Length (Self) = 0)
with Inline;
-- See documentation in conts-vectors-generics.ads
procedure Replace_Element
(Self : in out Base_Vector'Class;
Index : Index_Type;
New_Item : Element_Type)
-- Replace the element at the given position.
-- Nothing is done if Index is not a valid index in the container.
with
Global => null,
Pre => Index <= Last (Self),
Post => Length (Self) = Length (Self)'Old
and then
(if Index <= Last (Self)
then M.Is_Set (Model (Self)'Old, Index, New_Item, Model (Self))
else Model (Self) = Model (Self)'Old);
function M_Elements_Shifted
(S1, S2 : M.Sequence;
Fst, Lst : Index_Type;
Offset : Count_Type := 1)
return Boolean
-- The slice from Fst to Lst of S1 has been shifted by Offset in S2.
with Ghost,
Pre => Lst <= M.Last (S1) and Lst < M.Last (S2),
Post =>
M_Elements_Shifted'Result =
(for all I in Fst .. Lst => Element (S1, I) =
Element (S2, Index_Type'Val (Index_Type'Pos (I) + Offset)));
pragma Annotate (GNATprove, Inline_For_Proof, M_Elements_Shifted);
procedure Delete
(Self : in out Base_Vector'Class;
Index : Index_Type;
Count : Count_Type := 1)
-- See documentation in conts-vectors-generics.ads
with
Global => null,
Pre => Index <= Last (Self),
Post =>
-- Elements located before Index are preserved.
M_Elements_Equal
(S1 => Model (Self),
S2 => Model (Self)'Old,
Fst => Index_Type'First,
Lst => Index_Type'Pred (Index)),
-- If there are less than Count elements after Index, they are all
-- erased.
Contract_Cases =>
(Count - 1 >= Index_Type'Pos (Last (Self)) - Index_Type'Pos (Index) =>
Length (Self) =
Index_Type'Pos (Index) - Index_Type'Pos (Index_Type'First),
-- Otherwise, Count elements are removed
others =>
Length (Self) = Length (Self)'Old - Count
-- Elements located after Index are shifted.
and M_Elements_Shifted
(S1 => Model (Self),
S2 => Model (Self)'Old,
Fst => Index,
Lst => Last (Self),
Offset => Count));
procedure Delete_Last (Self : in out Base_Vector'Class)
-- See documentation in conts-vectors-generics.ads
with
Global => null,
Pre => Length (Self) > 0,
Post => Length (Self) = Length (Self)'Old - 1
and then M_Elements_Equal
(S1 => Model (Self),
S2 => Model (Self)'Old,
Fst => Index_Type'First,
Lst => Last (Self));
function M_Elements_Equal_Except
(S1, S2 : M.Sequence;
X, Y : Index_Type)
return Boolean
-- Whether S1 and S2 coincide except on X and Y.
with
Ghost,
Pre => M.Last (S1) = M.Last (S2),
Post =>
M_Elements_Equal_Except'Result =
(for all I in Index_Type'First .. M.Last (S1) =>
(if I /= X and I /= Y then
Element (S1, I) = Element (S2, I)));
pragma Annotate (GNATprove, Inline_For_Proof, M_Elements_Equal_Except);
procedure Swap
(Self : in out Base_Vector'Class;
Left, Right : Index_Type)
-- See documentation in conts-vectors-generics.ads
with
Global => null,
Pre => Left <= Last (Self) and then Right <= Last (Self),
Post => Length (Self) = Length (Self)'Old
and then Element (Model (Self), Left) =
Element (Model (Self)'Old, Right)
and then Element (Model (Self), Right) =
Element (Model (Self)'Old, Left)
-- Elements that have not been swapped are preserved.
and then M_Elements_Equal_Except
(S1 => Model (Self),
S2 => Model (Self)'Old,
X => Left,
Y => Right);
function First_Primitive (Self : Base_Vector) return Cursor
-- See documentation in conts-vectors-generics.ads
is (First (Self))
with Inline;
function Element_Primitive
(Self : Base_Vector; Position : Cursor) return Constant_Returned_Type
-- See documentation in conts-vectors-generics.ads
is (Element (Self, Position))
with
Inline,
Pre'Class => Has_Element (Self, Position),
Post => Storage.Elements.To_Element (Element_Primitive'Result) =
Element (Model (Self), Position);
function Has_Element_Primitive
(Self : Base_Vector; Position : Cursor) return Boolean
-- See documentation in conts-vectors-generics.ads
is (Has_Element (Self, Position))
with
Inline,
Post => Has_Element_Primitive'Result =
(Position in Index_Type'First .. Self.Last);
pragma Annotate (GNATprove, Inline_For_Proof, Has_Element_Primitive);
function Next_Primitive
(Self : Base_Vector; Position : Cursor) return Cursor
-- These are only needed because the Iterable aspect expects a parameter
-- of type List instead of List'Class. But then it means that the loop
-- is doing a lot of dynamic dispatching, and is twice as slow as a loop
-- using an explicit cursor.
is (Next (Self, Position))
with
Inline,
Pre'Class => Has_Element (Self, Position);
private
pragma SPARK_Mode (Off);
procedure Adjust (Self : in out Base_Vector);
procedure Finalize (Self : in out Base_Vector);
-- In case the list is a controlled type, but irrelevant when Self
-- is not controlled.
No_Last : constant Count_Type := Conts.Vectors.Storage.Min_Index - 1;
-- Indicates that the vector is empty, when its Last index is No_Last
type Base_Vector is new Storage.Container with record
Last : Count_Type := No_Last;
-- Last assigned element
end record;
function Last (Self : Base_Vector'Class) return Extended_Index
is (To_Index (Self.Last));
function To_Index (Position : Count_Type) return Extended_Index
is (Index_Type'Val
(Position - Conts.Vectors.Storage.Min_Index
+ Count_Type'Base (Index_Type'Pos (Index_Type'First))));
function To_Count (Idx : Index_Type) return Count_Type
is (Count_Type
(Conts.Vectors.Storage.Min_Index
+ Count_Type'Base (Index_Type'Pos (Idx))
- Count_Type'Base (Index_Type'Pos (Index_Type'First))));
------------------
-- Formal Model --
------------------
function M_Elements_Consts
(S : M.Sequence;
Fst : Index_Type;
Lst : Extended_Index;
E : Storage.Elements.Element_Type)
return Boolean
is (for all I in Fst .. Lst => Element (S, I) = E);
function M_Elements_Equal
(S1, S2 : M.Sequence;
Fst : Index_Type;
Lst : Extended_Index)
return Boolean
is (for all I in Fst .. Lst => Element (S1, I) = Element (S2, I));
function M_Elements_Equal_Except
(S1, S2 : M.Sequence;
X, Y : Index_Type)
return Boolean
is (for all I in Index_Type'First .. M.Last (S1) =>
(if I /= X and I /= Y then Element (S1, I) = Element (S2, I)));
function M_Elements_Shifted
(S1, S2 : M.Sequence;
Fst, Lst : Index_Type;
Offset : Count_Type := 1)
return Boolean
is (for all I in Fst .. Lst => Element (S1, I) =
Element (S2, Index_Type'Val (Index_Type'Pos (I) + Offset)));
end Conts.Vectors.Impl;
|
reznikmm/matreshka | Ada | 4,607 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Draw.Fill_Color_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Draw_Fill_Color_Attribute_Node is
begin
return Self : Draw_Fill_Color_Attribute_Node do
Matreshka.ODF_Draw.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Draw_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Draw_Fill_Color_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Fill_Color_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Draw_URI,
Matreshka.ODF_String_Constants.Fill_Color_Attribute,
Draw_Fill_Color_Attribute_Node'Tag);
end Matreshka.ODF_Draw.Fill_Color_Attributes;
|
charlie5/aShell | Ada | 8,796 | ads | with
Ada.Strings.Unbounded,
Ada.Streams;
private
with
POSIX.IO,
POSIX.Process_Identification,
POSIX.Process_Primitives,
Ada.Containers.Vectors;
package Shell
--
-- Provides processes and pipes.
--
is
--------
--- Data
--
use Ada.Streams;
subtype Data is Stream_Element_Array;
subtype Data_Offset is Stream_Element_Offset;
No_Data : constant Data;
-----------
--- Strings
--
type Unbounded_String is new Ada.Strings.Unbounded.Unbounded_String;
function "+" (Item : in String) return Unbounded_String;
function "+" (Item : in Unbounded_String) return String;
type String_Array is array (Positive range <>) of Unbounded_String;
Nil_Strings : constant String_Array;
-------------
-- Conversion
--
function To_String (From : in Data) return String;
function To_Data (From : in String) return Data;
function "+" (From : in Data) return String renames To_String;
function "+" (From : in String) return Data renames To_Data;
---------
--- Pipes
--
type Pipe is private;
Too_Many_Pipes_Error : exception;
Null_Pipe_Error : exception;
function To_Pipe (Blocking : in Boolean := True) return Pipe;
function Image (Pipe : in Shell.Pipe) return String;
function Is_Readable (Pipe : in Shell.Pipe) return Boolean;
function Is_Writeable (Pipe : in Shell.Pipe) return Boolean;
function Is_Empty (Pipe : in Shell.Pipe;
Timeout : in Duration := 0.0) return Boolean; -- A timeout of '0.0' will block until the pipe is not empty.
No_Output_Error : exception;
Pipe_Not_Readable : exception;
procedure Write_To (Pipe : in Shell.Pipe; Input : in Data);
function Output_Of (Pipe : in Shell.Pipe) return Data; -- Returns available output from the 'read end'.
Pipe_Error : exception;
procedure Close (Pipe : in Shell.Pipe;
Only_Write_End : in Boolean := False;
Only_Read_End : in Boolean := False);
--
-- Only_Write_End and Only_Read_End are mutually exclusive.
-- Pipe_Error is raised when both are set to True.
procedure Close_Write_End (Pipe : in Shell.Pipe);
function Close_Write_End (Pipe : in Shell.Pipe) return Boolean;
Standard_Input : constant Pipe;
Standard_Output : constant Pipe;
Standard_Error : constant Pipe;
Null_Pipe : constant Pipe;
type Pipe_Stream is new Ada.Streams.Root_Stream_Type with private;
function Stream (Pipe : in Shell.Pipe) return Pipe_Stream;
-------------
--- Processes
--
type Process is private;
type Process_Array is array (Positive range <>) of Process;
type Process_State is (Not_Started,
Running,
Paused,
Normal_Exit,
Failed_Exit,
Interrupted,
Killed);
subtype Terminated is Process_State range Normal_Exit .. Killed;
function Status (Process : in out Shell.Process) return Process_State;
-- For 'Start', when pipeline is true, closing the write ends of any
-- non-standard 'Output' and 'Errors' pipes becomes the callers responsibility.
-- A 'Process_Error' is raised if 'Start' fails.
Process_Error : exception;
Process_Already_Started : exception;
Process_Already_Paused : exception;
Process_Not_Started : exception;
Process_Has_Terminated : exception;
Too_Many_Processes_Error : exception;
function Start (Program : in String;
Arguments : in String_Array;
Working_Directory : in String := ".";
Input : in Pipe := Standard_Input;
Output : in Pipe := Standard_Output;
Errors : in Pipe := Standard_Error;
Pipeline : in Boolean := False) return Process;
function Start (Command : in String;
Working_Directory : in String := ".";
Input : in Pipe := Standard_Input;
Output : in Pipe := Standard_Output;
Errors : in Pipe := Standard_Error;
Pipeline : in Boolean := False) return Process;
procedure Start (Process : in out Shell.Process;
Program : in String;
Arguments : in String_Array;
Working_Directory : in String := ".";
Input : in Pipe := Standard_Input;
Output : in Pipe := Standard_Output;
Errors : in Pipe := Standard_Error;
Pipeline : in Boolean := False);
procedure Start (Process : in out Shell.Process;
Command : in String;
Working_Directory : in String := ".";
Input : in Pipe := Standard_Input;
Output : in Pipe := Standard_Output;
Errors : in Pipe := Standard_Error;
Pipeline : in Boolean := False);
procedure Wait_On (Process : in out Shell.Process);
function Has_Terminated (Process : in out Shell.Process) return Boolean;
function Normal_Exit (Process : in Shell.Process) return Boolean;
function Image (Process : in Shell.Process) return String;
procedure Kill (Process : in out Shell.Process);
procedure Interrupt (Process : in out Shell.Process);
procedure Pause (Process : in out Shell.Process);
procedure Resume (Process : in out Shell.Process);
-----------
--- Logging
--
procedure Open_Log (Name : in String);
procedure Close_Log;
private
subtype Process_Template is POSIX.Process_Primitives.Process_Template;
subtype Process_ID is POSIX.Process_Identification.Process_ID;
subtype File_Descriptor is POSIX.IO.File_Descriptor;
Null_Process_ID : constant Process_ID := POSIX.Process_Identification.Null_Process_ID;
Null_File_Descriptor : constant File_Descriptor := File_Descriptor'Last;
No_Data : constant Data (1 .. 0) := (others => <>);
Nil_Strings : constant String_Array := (1 .. 0 => <>);
package String_Vectors is new Ada.Containers.Vectors (Positive, Unbounded_String);
subtype String_Vector is String_Vectors.Vector;
---------
--- Pipes
--
type Pipe is
record
Write_End,
Read_End : File_Descriptor := Null_File_Descriptor;
end record;
Standard_Input : constant Pipe := (Write_End => Null_File_Descriptor,
Read_End => POSIX.IO.Standard_Input);
Standard_Output : constant Pipe := (Write_End => POSIX.IO.Standard_Output,
Read_End => Null_File_Descriptor);
Standard_Error : constant Pipe := (Write_End => POSIX.IO.Standard_Error,
Read_End => Null_File_Descriptor);
Null_Pipe : constant Pipe := (Write_End => Null_File_Descriptor,
Read_End => Null_File_Descriptor);
protected Safe_Pipes
is
procedure Open (Pipe : out Shell.Pipe);
procedure Close (Pipe : in Shell.Pipe;
Only_Write_End : in Boolean := False;
Only_Read_End : in Boolean := False);
end Safe_Pipes;
type Pipe_Stream is new Ada.Streams.Root_Stream_Type with
record
Pipe : Shell.Pipe;
end record;
overriding
procedure Read (Stream : in out Pipe_Stream;
Item : out Stream_Element_Array;
Last : out Stream_Element_Offset);
overriding
procedure Write (Stream : in out Pipe_Stream;
Item : in Stream_Element_Array);
-------------
--- Processes
--
type Process is
record
Id : Process_ID := Null_Process_ID;
Status : POSIX.Process_Primitives.Termination_Status;
State : Process_State := Not_Started;
end record;
-------------
--- Debugging
--
procedure Log (Message : in String);
function Log (Message : in String) return Boolean; -- Allow for logging in a declarative region.
-- Always returns 'True'.
end Shell;
|
godunko/cga | Ada | 1,601 | ads | --
-- Copyright (C) 2023, Vadim Godunko <[email protected]>
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
--
-- Implementation of the MT19937-64 pseudorandom number generator. It is
-- based on work:
--
-- A C-program for MT19937-64 (2004/9/29 version).
-- Coded by Takuji Nishimura and Makoto Matsumoto.
--
-- http://www.math.sci.hiroshima-u.ac.jp/m-mat/MT/VERSIONS/C-LANG/mt19937-64.c
with Interfaces;
package CGK.Internals.Mersenne_Twister_64 is
pragma Pure;
type Generator is private;
procedure Initialize
(Self : in out Generator;
Seed : Interfaces.Unsigned_64);
function Generate (Self : in out Generator) return Interfaces.Unsigned_64;
-- Generates a random number on [0, 2^64-1] interval.
function Generate (Self : in out Generator) return Interfaces.Integer_64;
-- Generates a random number on [0, 2^63-1] interval.
function Generate_II
(Self : in out Generator) return Interfaces.IEEE_Float_64;
-- Generates a random number on [0,1] interval.
function Generate_IE
(Self : in out Generator) return Interfaces.IEEE_Float_64;
-- Generates a random number on [0,1) interval.
function Generate_EE
(Self : in out Generator) return Interfaces.IEEE_Float_64;
-- Generates a random number on (0,1) interval.
private
use Interfaces;
NN : constant := 312;
type Unsigned_64_Array is array (Natural range 0 .. NN - 1) of Unsigned_64;
type Generator is record
MT : Unsigned_64_Array;
MTI : Natural := NN + 1;
end record;
end CGK.Internals.Mersenne_Twister_64;
|
twdroeger/ada-awa | Ada | 27,289 | ads | -----------------------------------------------------------------------
-- AWA.OAuth.Models -- AWA.OAuth.Models
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-spec.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095
-----------------------------------------------------------------------
-- Copyright (C) 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.
-----------------------------------------------------------------------
pragma Warnings (Off);
with ADO.Sessions;
with ADO.Objects;
with ADO.Statements;
with ADO.SQL;
with ADO.Schemas;
with Ada.Calendar;
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded;
with Util.Beans.Objects;
with Util.Beans.Basic.Lists;
with AWA.Users.Models;
pragma Warnings (On);
package AWA.OAuth.Models is
pragma Style_Checks ("-mr");
type Application_Ref is new ADO.Objects.Object_Ref with null record;
type Callback_Ref is new ADO.Objects.Object_Ref with null record;
type Session_Ref is new ADO.Objects.Object_Ref with null record;
-- --------------------
-- The application that is granted access to the database.
-- --------------------
-- Create an object key for Application.
function Application_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Application from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Application_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Application : constant Application_Ref;
function "=" (Left, Right : Application_Ref'Class) return Boolean;
-- Set the application identifier.
procedure Set_Id (Object : in out Application_Ref;
Value : in ADO.Identifier);
-- Get the application identifier.
function Get_Id (Object : in Application_Ref)
return ADO.Identifier;
-- Set the application name.
procedure Set_Name (Object : in out Application_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Name (Object : in out Application_Ref;
Value : in String);
-- Get the application name.
function Get_Name (Object : in Application_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Name (Object : in Application_Ref)
return String;
-- Set the application secret key.
procedure Set_Secret_Key (Object : in out Application_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Secret_Key (Object : in out Application_Ref;
Value : in String);
-- Get the application secret key.
function Get_Secret_Key (Object : in Application_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Secret_Key (Object : in Application_Ref)
return String;
-- Set the application public identifier.
procedure Set_Client_Id (Object : in out Application_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Client_Id (Object : in out Application_Ref;
Value : in String);
-- Get the application public identifier.
function Get_Client_Id (Object : in Application_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Client_Id (Object : in Application_Ref)
return String;
-- Get the optimistic lock version.
function Get_Version (Object : in Application_Ref)
return Integer;
-- Set the application create date.
procedure Set_Create_Date (Object : in out Application_Ref;
Value : in Ada.Calendar.Time);
-- Get the application create date.
function Get_Create_Date (Object : in Application_Ref)
return Ada.Calendar.Time;
-- Set the application update date.
procedure Set_Update_Date (Object : in out Application_Ref;
Value : in Ada.Calendar.Time);
-- Get the application update date.
function Get_Update_Date (Object : in Application_Ref)
return Ada.Calendar.Time;
-- Set the application title displayed in the OAuth login form.
procedure Set_Title (Object : in out Application_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Title (Object : in out Application_Ref;
Value : in String);
-- Get the application title displayed in the OAuth login form.
function Get_Title (Object : in Application_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Title (Object : in Application_Ref)
return String;
-- Set the application description.
procedure Set_Description (Object : in out Application_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Description (Object : in out Application_Ref;
Value : in String);
-- Get the application description.
function Get_Description (Object : in Application_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Description (Object : in Application_Ref)
return String;
-- Set the optional login URL.
procedure Set_App_Login_Url (Object : in out Application_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_App_Login_Url (Object : in out Application_Ref;
Value : in String);
-- Get the optional login URL.
function Get_App_Login_Url (Object : in Application_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_App_Login_Url (Object : in Application_Ref)
return String;
-- Set the application logo URL.
procedure Set_App_Logo_Url (Object : in out Application_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_App_Logo_Url (Object : in out Application_Ref;
Value : in String);
-- Get the application logo URL.
function Get_App_Logo_Url (Object : in Application_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_App_Logo_Url (Object : in Application_Ref)
return String;
--
procedure Set_User (Object : in out Application_Ref;
Value : in AWA.Users.Models.User_Ref'Class);
--
function Get_User (Object : in Application_Ref)
return AWA.Users.Models.User_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Application_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Application_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Application_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Application_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Application_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Application_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
APPLICATION_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Application_Ref);
-- Copy of the object.
procedure Copy (Object : in Application_Ref;
Into : in out Application_Ref);
package Application_Vectors is
new Ada.Containers.Vectors (Index_Type => Natural,
Element_Type => Application_Ref,
"=" => "=");
subtype Application_Vector is Application_Vectors.Vector;
procedure List (Object : in out Application_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class);
-- Create an object key for Callback.
function Callback_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Callback from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Callback_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Callback : constant Callback_Ref;
function "=" (Left, Right : Callback_Ref'Class) return Boolean;
--
procedure Set_Id (Object : in out Callback_Ref;
Value : in ADO.Identifier);
--
function Get_Id (Object : in Callback_Ref)
return ADO.Identifier;
--
procedure Set_Url (Object : in out Callback_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Url (Object : in out Callback_Ref;
Value : in String);
--
function Get_Url (Object : in Callback_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Url (Object : in Callback_Ref)
return String;
-- Get the optimistic lock version.
function Get_Version (Object : in Callback_Ref)
return Integer;
--
procedure Set_Application (Object : in out Callback_Ref;
Value : in AWA.OAuth.Models.Application_Ref'Class);
--
function Get_Application (Object : in Callback_Ref)
return AWA.OAuth.Models.Application_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Callback_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Callback_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Callback_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Callback_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Callback_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Callback_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
CALLBACK_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Callback_Ref);
-- Copy of the object.
procedure Copy (Object : in Callback_Ref;
Into : in out Callback_Ref);
package Callback_Vectors is
new Ada.Containers.Vectors (Index_Type => Natural,
Element_Type => Callback_Ref,
"=" => "=");
subtype Callback_Vector is Callback_Vectors.Vector;
procedure List (Object : in out Callback_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class);
-- --------------------
-- The session is created when the user has granted an access to an application
-- or when the application has refreshed its access token.
-- --------------------
-- Create an object key for Session.
function Session_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Session from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Session_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Session : constant Session_Ref;
function "=" (Left, Right : Session_Ref'Class) return Boolean;
-- Set the session identifier.
procedure Set_Id (Object : in out Session_Ref;
Value : in ADO.Identifier);
-- Get the session identifier.
function Get_Id (Object : in Session_Ref)
return ADO.Identifier;
-- Set the session creation date.
procedure Set_Create_Date (Object : in out Session_Ref;
Value : in Ada.Calendar.Time);
-- Get the session creation date.
function Get_Create_Date (Object : in Session_Ref)
return Ada.Calendar.Time;
-- Set a random salt string to access/request token generation.
procedure Set_Salt (Object : in out Session_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Salt (Object : in out Session_Ref;
Value : in String);
-- Get a random salt string to access/request token generation.
function Get_Salt (Object : in Session_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Salt (Object : in Session_Ref)
return String;
-- Set the expiration date.
procedure Set_Expire_Date (Object : in out Session_Ref;
Value : in Ada.Calendar.Time);
-- Get the expiration date.
function Get_Expire_Date (Object : in Session_Ref)
return Ada.Calendar.Time;
-- Set the application that is granted access.
procedure Set_Application (Object : in out Session_Ref;
Value : in AWA.OAuth.Models.Application_Ref'Class);
-- Get the application that is granted access.
function Get_Application (Object : in Session_Ref)
return AWA.OAuth.Models.Application_Ref'Class;
--
procedure Set_User (Object : in out Session_Ref;
Value : in AWA.Users.Models.User_Ref'Class);
--
function Get_User (Object : in Session_Ref)
return AWA.Users.Models.User_Ref'Class;
--
procedure Set_Session (Object : in out Session_Ref;
Value : in AWA.Users.Models.Session_Ref'Class);
--
function Get_Session (Object : in Session_Ref)
return AWA.Users.Models.Session_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Session_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Session_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Session_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Session_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Session_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Session_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
SESSION_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Session_Ref);
-- Copy of the object.
procedure Copy (Object : in Session_Ref;
Into : in out Session_Ref);
package Session_Vectors is
new Ada.Containers.Vectors (Index_Type => Natural,
Element_Type => Session_Ref,
"=" => "=");
subtype Session_Vector is Session_Vectors.Vector;
procedure List (Object : in out Session_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class);
private
APPLICATION_NAME : aliased constant String := "awa_application";
COL_0_1_NAME : aliased constant String := "id";
COL_1_1_NAME : aliased constant String := "name";
COL_2_1_NAME : aliased constant String := "secret_key";
COL_3_1_NAME : aliased constant String := "client_id";
COL_4_1_NAME : aliased constant String := "version";
COL_5_1_NAME : aliased constant String := "create_date";
COL_6_1_NAME : aliased constant String := "update_date";
COL_7_1_NAME : aliased constant String := "title";
COL_8_1_NAME : aliased constant String := "description";
COL_9_1_NAME : aliased constant String := "app_login_url";
COL_10_1_NAME : aliased constant String := "app_logo_url";
COL_11_1_NAME : aliased constant String := "user_id";
APPLICATION_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 12,
Table => APPLICATION_NAME'Access,
Members => (
1 => COL_0_1_NAME'Access,
2 => COL_1_1_NAME'Access,
3 => COL_2_1_NAME'Access,
4 => COL_3_1_NAME'Access,
5 => COL_4_1_NAME'Access,
6 => COL_5_1_NAME'Access,
7 => COL_6_1_NAME'Access,
8 => COL_7_1_NAME'Access,
9 => COL_8_1_NAME'Access,
10 => COL_9_1_NAME'Access,
11 => COL_10_1_NAME'Access,
12 => COL_11_1_NAME'Access)
);
APPLICATION_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= APPLICATION_DEF'Access;
Null_Application : constant Application_Ref
:= Application_Ref'(ADO.Objects.Object_Ref with null record);
type Application_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => APPLICATION_DEF'Access)
with record
Name : Ada.Strings.Unbounded.Unbounded_String;
Secret_Key : Ada.Strings.Unbounded.Unbounded_String;
Client_Id : Ada.Strings.Unbounded.Unbounded_String;
Version : Integer;
Create_Date : Ada.Calendar.Time;
Update_Date : Ada.Calendar.Time;
Title : Ada.Strings.Unbounded.Unbounded_String;
Description : Ada.Strings.Unbounded.Unbounded_String;
App_Login_Url : Ada.Strings.Unbounded.Unbounded_String;
App_Logo_Url : Ada.Strings.Unbounded.Unbounded_String;
User : AWA.Users.Models.User_Ref;
end record;
type Application_Access is access all Application_Impl;
overriding
procedure Destroy (Object : access Application_Impl);
overriding
procedure Find (Object : in out Application_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Application_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Application_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Application_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Application_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Application_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Application_Ref'Class;
Impl : out Application_Access);
CALLBACK_NAME : aliased constant String := "awa_callback";
COL_0_2_NAME : aliased constant String := "id";
COL_1_2_NAME : aliased constant String := "url";
COL_2_2_NAME : aliased constant String := "version";
COL_3_2_NAME : aliased constant String := "application_id";
CALLBACK_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 4,
Table => CALLBACK_NAME'Access,
Members => (
1 => COL_0_2_NAME'Access,
2 => COL_1_2_NAME'Access,
3 => COL_2_2_NAME'Access,
4 => COL_3_2_NAME'Access)
);
CALLBACK_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= CALLBACK_DEF'Access;
Null_Callback : constant Callback_Ref
:= Callback_Ref'(ADO.Objects.Object_Ref with null record);
type Callback_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => CALLBACK_DEF'Access)
with record
Url : Ada.Strings.Unbounded.Unbounded_String;
Version : Integer;
Application : AWA.OAuth.Models.Application_Ref;
end record;
type Callback_Access is access all Callback_Impl;
overriding
procedure Destroy (Object : access Callback_Impl);
overriding
procedure Find (Object : in out Callback_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Callback_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Callback_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Callback_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Callback_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Callback_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Callback_Ref'Class;
Impl : out Callback_Access);
SESSION_NAME : aliased constant String := "awa_oauth_session";
COL_0_3_NAME : aliased constant String := "id";
COL_1_3_NAME : aliased constant String := "create_date";
COL_2_3_NAME : aliased constant String := "salt";
COL_3_3_NAME : aliased constant String := "expire_date";
COL_4_3_NAME : aliased constant String := "application_id";
COL_5_3_NAME : aliased constant String := "user_id";
COL_6_3_NAME : aliased constant String := "session_id";
SESSION_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 7,
Table => SESSION_NAME'Access,
Members => (
1 => COL_0_3_NAME'Access,
2 => COL_1_3_NAME'Access,
3 => COL_2_3_NAME'Access,
4 => COL_3_3_NAME'Access,
5 => COL_4_3_NAME'Access,
6 => COL_5_3_NAME'Access,
7 => COL_6_3_NAME'Access)
);
SESSION_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= SESSION_DEF'Access;
Null_Session : constant Session_Ref
:= Session_Ref'(ADO.Objects.Object_Ref with null record);
type Session_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => SESSION_DEF'Access)
with record
Create_Date : Ada.Calendar.Time;
Salt : Ada.Strings.Unbounded.Unbounded_String;
Expire_Date : Ada.Calendar.Time;
Application : AWA.OAuth.Models.Application_Ref;
User : AWA.Users.Models.User_Ref;
Session : AWA.Users.Models.Session_Ref;
end record;
type Session_Access is access all Session_Impl;
overriding
procedure Destroy (Object : access Session_Impl);
overriding
procedure Find (Object : in out Session_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Session_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Session_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Session_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Session_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Session_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Session_Ref'Class;
Impl : out Session_Access);
end AWA.OAuth.Models;
|
zhmu/ananas | Ada | 2,773 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . L O C A L E S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2010-2022, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- --
------------------------------------------------------------------------------
package Ada.Locales is
pragma Preelaborate (Locales);
pragma Remote_Types (Locales);
-- A locale identifies a geopolitical place or region and its associated
-- language, which can be used to determine other internationalization-
-- related characteristics. The active locale is the locale associated with
-- the partition of the current task.
type Language_Code is new String (1 .. 3)
with Dynamic_Predicate =>
(for all E of Language_Code => E in 'a' .. 'z');
-- Lower-case string representation of an ISO 639-3 alpha-3 code that
-- identifies a language.
type Country_Code is new String (1 .. 2)
with Dynamic_Predicate =>
(for all E of Country_Code => E in 'A' .. 'Z');
-- Upper-case string representation of an ISO 3166-1 alpha-2 code that
-- identifies a country.
Language_Unknown : constant Language_Code := "und";
Country_Unknown : constant Country_Code := "ZZ";
function Language return Language_Code;
-- Returns the code of the language associated with the active locale. If
-- the Language_Code associated with the active locale cannot be determined
-- from the environment, then Language returns Language_Unknown.
function Country return Country_Code;
-- Returns the code of the country associated with the active locale. If
-- the Country_Code associated with the active locale cannot be determined
-- from the environment, then Country returns Country_Unknown.
end Ada.Locales;
|
reznikmm/matreshka | Ada | 3,704 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Fo_Text_Align_Attributes is
pragma Preelaborate;
type ODF_Fo_Text_Align_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Fo_Text_Align_Attribute_Access is
access all ODF_Fo_Text_Align_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Fo_Text_Align_Attributes;
|
flyx/OpenGLAda | Ada | 10,364 | adb | -- part of OpenGLAda, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "COPYING"
with Ada.Unchecked_Conversion;
with GL.API;
with GL.Enums.Getter;
with GL.Low_Level.Enums;
package body GL.Buffers is
use type Culling.Face_Selector;
procedure Clear (Bits : Buffer_Bits) is
use type Low_Level.Bitfield;
function Convert is new Ada.Unchecked_Conversion
(Source => Buffer_Bits, Target => Low_Level.Bitfield);
Raw_Bits : constant Low_Level.Bitfield :=
Convert (Bits) and 2#0100011100000000#;
begin
API.Clear (Raw_Bits);
Raise_Exception_On_OpenGL_Error;
end Clear;
procedure Set_Active_Buffer (Selector : Explicit_Color_Buffer_Selector) is
begin
API.Draw_Buffer (Selector);
Raise_Exception_On_OpenGL_Error;
end Set_Active_Buffer;
procedure Set_Active_Buffers (List : Explicit_Color_Buffer_List) is
begin
API.Draw_Buffers (List'Length, List);
Raise_Exception_On_OpenGL_Error;
end Set_Active_Buffers;
procedure Set_Color_Clear_Value (Value : Colors.Color) is
begin
API.Clear_Color (Value (Colors.R), Value (Colors.G), Value (Colors.B),
Value (Colors.A));
Raise_Exception_On_OpenGL_Error;
end Set_Color_Clear_Value;
function Color_Clear_Value return Colors.Color is
Value : Colors.Color;
begin
API.Get_Color (Enums.Getter.Color_Clear_Value, Value);
Raise_Exception_On_OpenGL_Error;
return Value;
end Color_Clear_Value;
procedure Set_Depth_Clear_Value (Value : Depth) is
begin
API.Clear_Depth (Value);
Raise_Exception_On_OpenGL_Error;
end Set_Depth_Clear_Value;
function Depth_Clear_Value return Depth is
Value : aliased Double;
begin
API.Get_Double (Enums.Getter.Depth_Clear_Value, Value'Access);
Raise_Exception_On_OpenGL_Error;
return Value;
end Depth_Clear_Value;
procedure Set_Stencil_Clear_Value (Value : Stencil_Index) is
begin
API.Clear_Stencil (Value);
Raise_Exception_On_OpenGL_Error;
end Set_Stencil_Clear_Value;
function Stencil_Clear_Value return Stencil_Index is
Value : aliased Stencil_Index;
begin
API.Get_Integer (Enums.Getter.Stencil_Clear_Value, Value'Access);
Raise_Exception_On_OpenGL_Error;
return Value;
end Stencil_Clear_Value;
procedure Set_Accum_Clear_Value (Value : Colors.Color) is
begin
API.Clear_Accum (Value (Colors.R), Value (Colors.G), Value (Colors.B),
Value (Colors.A));
Raise_Exception_On_OpenGL_Error;
end Set_Accum_Clear_Value;
function Accum_Clear_Value return Colors.Color is
Value : Colors.Color;
begin
API.Get_Color (Enums.Getter.Accum_Clear_Value, Value);
Raise_Exception_On_OpenGL_Error;
return Value;
end Accum_Clear_Value;
procedure Set_Depth_Function (Func : Compare_Function) is
begin
API.Depth_Func (Func);
Raise_Exception_On_OpenGL_Error;
end Set_Depth_Function;
function Depth_Function return Compare_Function is
Value : aliased Compare_Function;
begin
API.Get_Compare_Function (Enums.Getter.Depth_Func, Value'Access);
Raise_Exception_On_OpenGL_Error;
return Value;
end Depth_Function;
procedure Depth_Mask (Enabled : Boolean) is
begin
API.Depth_Mask (Low_Level.Bool (Enabled));
Raise_Exception_On_OpenGL_Error;
end Depth_Mask;
function Depth_Mask return Boolean is
Value : aliased Low_Level.Bool;
begin
API.Get_Boolean (Enums.Getter.Depth_Writemask, Value'Access);
Raise_Exception_On_OpenGL_Error;
return Boolean (Value);
end Depth_Mask;
procedure Set_Stencil_Function (Func : Compare_Function;
Ref : Int;
Mask : UInt) is
Face : constant Culling.Face_Selector := Culling.Front_And_Back;
begin
Set_Stencil_Function (Face, Func, Ref, Mask);
end Set_Stencil_Function;
procedure Set_Stencil_Function (Face : Culling.Face_Selector;
Func : Compare_Function;
Ref : Int;
Mask : UInt) is
begin
API.Stencil_Func_Separate (Face, Func, Ref, Mask);
Raise_Exception_On_OpenGL_Error;
end Set_Stencil_Function;
function Stencil_Function (Face : Single_Face_Selector) return Compare_Function is
Value : aliased Compare_Function;
begin
if Face = Culling.Front then
API.Get_Compare_Function (Enums.Getter.Stencil_Func, Value'Access);
else
API.Get_Compare_Function (Enums.Getter.Stencil_Back_Func, Value'Access);
end if;
Raise_Exception_On_OpenGL_Error;
return Value;
end Stencil_Function;
function Stencil_Reference_Value (Face : Single_Face_Selector) return Int is
Value : aliased Int;
begin
if Face = Culling.Front then
API.Get_Integer (Enums.Getter.Stencil_Ref, Value'Access);
else
API.Get_Integer (Enums.Getter.Stencil_Back_Ref, Value'Access);
end if;
Raise_Exception_On_OpenGL_Error;
return Value;
end Stencil_Reference_Value;
function Stencil_Value_Mask (Face : Single_Face_Selector) return UInt is
Value : aliased UInt;
begin
if Face = Culling.Front then
API.Get_Unsigned_Integer (Enums.Getter.Stencil_Value_Mask, Value'Access);
else
API.Get_Unsigned_Integer (Enums.Getter.Stencil_Back_Value_Mask, Value'Access);
end if;
Raise_Exception_On_OpenGL_Error;
return Value;
end Stencil_Value_Mask;
procedure Set_Stencil_Operation (Stencil_Fail : Buffers.Stencil_Action;
Depth_Fail : Buffers.Stencil_Action;
Depth_Pass : Buffers.Stencil_Action) is
Face : constant Culling.Face_Selector := Culling.Front_And_Back;
begin
Set_Stencil_Operation (Face, Stencil_Fail, Depth_Fail, Depth_Pass);
end Set_Stencil_Operation;
procedure Set_Stencil_Operation (Face : Culling.Face_Selector;
Stencil_Fail : Buffers.Stencil_Action;
Depth_Fail : Buffers.Stencil_Action;
Depth_Pass : Buffers.Stencil_Action) is
begin
API.Stencil_Op_Separate (Face, Stencil_Fail, Depth_Fail, Depth_Pass);
Raise_Exception_On_OpenGL_Error;
end Set_Stencil_Operation;
function Stencil_Operation_Stencil_Fail (Face : Single_Face_Selector) return Buffers.Stencil_Action is
Value : aliased Buffers.Stencil_Action;
begin
if Face = Culling.Front then
API.Get_Stencil_Action (Enums.Getter.Stencil_Fail, Value'Access);
else
API.Get_Stencil_Action (Enums.Getter.Stencil_Back_Fail, Value'Access);
end if;
Raise_Exception_On_OpenGL_Error;
return Value;
end Stencil_Operation_Stencil_Fail;
function Stencil_Operation_Depth_Fail (Face : Single_Face_Selector) return Buffers.Stencil_Action is
Value : aliased Buffers.Stencil_Action;
begin
if Face = Culling.Front then
API.Get_Stencil_Action (Enums.Getter.Stencil_Pass_Depth_Fail, Value'Access);
else
API.Get_Stencil_Action (Enums.Getter.Stencil_Back_Pass_Depth_Fail, Value'Access);
end if;
Raise_Exception_On_OpenGL_Error;
return Value;
end Stencil_Operation_Depth_Fail;
function Stencil_Operation_Depth_Pass (Face : Single_Face_Selector) return Buffers.Stencil_Action is
Value : aliased Buffers.Stencil_Action;
begin
if Face = Culling.Front then
API.Get_Stencil_Action (Enums.Getter.Stencil_Pass_Depth_Pass, Value'Access);
else
API.Get_Stencil_Action (Enums.Getter.Stencil_Back_Pass_Depth_Pass, Value'Access);
end if;
Raise_Exception_On_OpenGL_Error;
return Value;
end Stencil_Operation_Depth_Pass;
procedure Set_Stencil_Mask (Value : UInt) is
Face : constant Culling.Face_Selector := Culling.Front_And_Back;
begin
Set_Stencil_Mask (Face, Value);
end Set_Stencil_Mask;
procedure Set_Stencil_Mask (Face : Culling.Face_Selector;
Value : UInt) is
begin
API.Stencil_Mask_Separate (Face, Value);
Raise_Exception_On_OpenGL_Error;
end Set_Stencil_Mask;
function Stencil_Mask (Face : Single_Face_Selector) return UInt is
Value : aliased UInt;
begin
if Face = Culling.Front then
API.Get_Unsigned_Integer (Enums.Getter.Stencil_Writemask, Value'Access);
else
API.Get_Unsigned_Integer (Enums.Getter.Stencil_Back_Writemask, Value'Access);
end if;
Raise_Exception_On_OpenGL_Error;
return Value;
end Stencil_Mask;
procedure Clear_Color_Buffers (Selector : Base_Color_Buffer_Selector;
Value : Colors.Color) is
begin
API.Clear_Buffer (Selector, 0, Value);
Raise_Exception_On_OpenGL_Error;
end Clear_Color_Buffers;
procedure Clear_Draw_Buffer (Index : Draw_Buffer_Index;
Value : Colors.Color) is
begin
API.Clear_Draw_Buffer (Low_Level.Enums.Color, Index, Value);
Raise_Exception_On_OpenGL_Error;
end Clear_Draw_Buffer;
procedure Clear_Depth_Buffer (Value : Depth) is
Aliased_Value : aliased constant Depth := Value;
begin
API.Clear_Buffer_Depth (Low_Level.Enums.Depth_Buffer, 0,
Aliased_Value'Unchecked_Access);
Raise_Exception_On_OpenGL_Error;
end Clear_Depth_Buffer;
procedure Clear_Stencil_Buffer (Value : Stencil_Index) is
Aliased_Value : aliased constant Stencil_Index := Value;
begin
API.Clear_Buffer_Stencil (Low_Level.Enums.Stencil, 0,
Aliased_Value'Unchecked_Access);
Raise_Exception_On_OpenGL_Error;
end Clear_Stencil_Buffer;
procedure Clear_Depth_And_Stencil_Buffer (Depth_Value : Depth;
Stencil_Value : Stencil_Index) is
begin
API.Clear_Buffer_Depth_Stencil (Low_Level.Enums.Depth_Stencil, 0,
Depth_Value, Stencil_Value);
Raise_Exception_On_OpenGL_Error;
end Clear_Depth_And_Stencil_Buffer;
end GL.Buffers;
|
reznikmm/matreshka | Ada | 4,864 | 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.Config_Config_Item_Map_Entry_Elements;
package Matreshka.ODF_Config.Config_Item_Map_Entry_Elements is
type Config_Config_Item_Map_Entry_Element_Node is
new Matreshka.ODF_Config.Abstract_Config_Element_Node
and ODF.DOM.Config_Config_Item_Map_Entry_Elements.ODF_Config_Config_Item_Map_Entry
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Config_Config_Item_Map_Entry_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Config_Config_Item_Map_Entry_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Config_Config_Item_Map_Entry_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 Config_Config_Item_Map_Entry_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 Config_Config_Item_Map_Entry_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_Config.Config_Item_Map_Entry_Elements;
|
AdaCore/libadalang | Ada | 645 | ads | pragma Ada_2012;
-- In this instance, we exercise variable user indexing
-- yielding Integer values.
package FUAND is
type Op_Name is (Op_A, Op_B);
type Operands is tagged record
A, B : aliased Integer;
end record
with Variable_Indexing => V_Indexing;
type Integer_Ref (Ref : access Integer) is
null record with Implicit_Dereference => Ref;
function V_Indexing
(X : aliased in out Operands; Op : Op_Name)
return integer_Ref is
(Ref =>
(case Op is
when OP_A => X.A'Access,
when Op_B => X.B'Access));
function Andthen (Ops : Operands) return Boolean;
end;
|
onox/orka | Ada | 1,493 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2016 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with AUnit.Test_Suites;
with AUnit.Test_Fixtures;
package Test_SIMD_SSE_Arithmetic is
function Suite return AUnit.Test_Suites.Access_Test_Suite;
private
type Test is new AUnit.Test_Fixtures.Test_Fixture with null record;
procedure Test_Multiply (Object : in out Test);
procedure Test_Divide (Object : in out Test);
procedure Test_Divide_By_Zero (Object : in out Test);
procedure Test_Divide_Or_Zero (Object : in out Test);
procedure Test_Add (Object : in out Test);
procedure Test_Subtract (Object : in out Test);
procedure Test_Minus (Object : in out Test);
procedure Test_Multiply_Vector (Object : in out Test);
procedure Test_Multiply_Matrices (Object : in out Test);
procedure Test_Abs (Object : in out Test);
procedure Test_Sum (Object : in out Test);
end Test_SIMD_SSE_Arithmetic;
|
stcarrez/ada-awa | Ada | 33,008 | ads | -----------------------------------------------------------------------
-- AWA.Questions.Models -- AWA.Questions.Models
-----------------------------------------------------------------------
-- File generated by Dynamo DO NOT MODIFY
-- Template used: templates/model/package-spec.xhtml
-- Ada Generator: https://github.com/stcarrez/dynamo Version 1.4.0
-----------------------------------------------------------------------
-- Copyright (C) 2023 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
pragma Warnings (Off);
with ADO.Sessions;
with ADO.Objects;
with ADO.Statements;
with ADO.SQL;
with ADO.Schemas;
with ADO.Queries;
with ADO.Queries.Loaders;
with Ada.Calendar;
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded;
with Util.Beans.Objects;
with Util.Beans.Basic.Lists;
with AWA.Users.Models;
with AWA.Workspaces.Models;
with Util.Beans.Methods;
pragma Warnings (On);
package AWA.Questions.Models is
pragma Style_Checks ("-mrIu");
type Question_Ref is new ADO.Objects.Object_Ref with null record;
type Answer_Ref is new ADO.Objects.Object_Ref with null record;
-- --------------------
-- The question table holds a single question asked by a user to the community.
-- The short description is used to give an overview of the question in long lists
-- while the description contains the full question text. The rating is updating
-- according to users voting for the question.
-- --------------------
-- Create an object key for Question.
function Question_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Question from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Question_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Question : constant Question_Ref;
function "=" (Left, Right : Question_Ref'Class) return Boolean;
-- Set the date when the question was created.
procedure Set_Create_Date (Object : in out Question_Ref;
Value : in Ada.Calendar.Time);
-- Get the date when the question was created.
function Get_Create_Date (Object : in Question_Ref)
return Ada.Calendar.Time;
-- Set the question title.
procedure Set_Title (Object : in out Question_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Title (Object : in out Question_Ref;
Value : in String);
-- Get the question title.
function Get_Title (Object : in Question_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Title (Object : in Question_Ref)
return String;
-- Set the full description.
procedure Set_Description (Object : in out Question_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Description (Object : in out Question_Ref;
Value : in String);
-- Get the full description.
function Get_Description (Object : in Question_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Description (Object : in Question_Ref)
return String;
-- Set the date when the question was edited.
procedure Set_Edit_Date (Object : in out Question_Ref;
Value : in ADO.Nullable_Time);
-- Get the date when the question was edited.
function Get_Edit_Date (Object : in Question_Ref)
return ADO.Nullable_Time;
-- Set Title: Questions and Answers model
-- Date: 2015-11-15
-- the question short description.
procedure Set_Short_Description (Object : in out Question_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Short_Description (Object : in out Question_Ref;
Value : in String);
-- Get Title: Questions and Answers model
-- Date: 2015-11-15
-- the question short description.
function Get_Short_Description (Object : in Question_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Short_Description (Object : in Question_Ref)
return String;
-- Set the question rating.
procedure Set_Rating (Object : in out Question_Ref;
Value : in Integer);
-- Get the question rating.
function Get_Rating (Object : in Question_Ref)
return Integer;
-- Set the question identifier.
procedure Set_Id (Object : in out Question_Ref;
Value : in ADO.Identifier);
-- Get the question identifier.
function Get_Id (Object : in Question_Ref)
return ADO.Identifier;
-- Get the optimistic locking version.
function Get_Version (Object : in Question_Ref)
return Integer;
-- Set the user who asked the question.
procedure Set_Author (Object : in out Question_Ref;
Value : in AWA.Users.Models.User_Ref'Class);
-- Get the user who asked the question.
function Get_Author (Object : in Question_Ref)
return AWA.Users.Models.User_Ref'Class;
--
procedure Set_Workspace (Object : in out Question_Ref;
Value : in AWA.Workspaces.Models.Workspace_Ref'Class);
--
function Get_Workspace (Object : in Question_Ref)
return AWA.Workspaces.Models.Workspace_Ref'Class;
--
procedure Set_Accepted_Answer (Object : in out Question_Ref;
Value : in Answer_Ref'Class);
--
function Get_Accepted_Answer (Object : in Question_Ref)
return Answer_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Question_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Question_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Reload from the database the same object if it was modified.
-- Returns True in `Updated` if the object was reloaded.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Reload (Object : in out Question_Ref;
Session : in out ADO.Sessions.Session'Class;
Updated : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Question_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Question_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Question_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Question_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
QUESTION_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Question_Ref);
-- Copy of the object.
procedure Copy (Object : in Question_Ref;
Into : in out Question_Ref);
-- --------------------
-- The answer table gives a list of anwsers to the question.
-- Ranking is updating according to users voting for the anwser.
-- --------------------
-- Create an object key for Answer.
function Answer_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Answer from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Answer_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Answer : constant Answer_Ref;
function "=" (Left, Right : Answer_Ref'Class) return Boolean;
-- Set the answer creation date.
procedure Set_Create_Date (Object : in out Answer_Ref;
Value : in Ada.Calendar.Time);
-- Get the answer creation date.
function Get_Create_Date (Object : in Answer_Ref)
return Ada.Calendar.Time;
-- Set the date when the answer was edited.
procedure Set_Edit_Date (Object : in out Answer_Ref;
Value : in ADO.Nullable_Time);
-- Get the date when the answer was edited.
function Get_Edit_Date (Object : in Answer_Ref)
return ADO.Nullable_Time;
-- Set the answer text.
procedure Set_Answer (Object : in out Answer_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Answer (Object : in out Answer_Ref;
Value : in String);
-- Get the answer text.
function Get_Answer (Object : in Answer_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Answer (Object : in Answer_Ref)
return String;
-- Set the anwser rank number.
procedure Set_Rank (Object : in out Answer_Ref;
Value : in Integer);
-- Get the anwser rank number.
function Get_Rank (Object : in Answer_Ref)
return Integer;
-- Set the answer identifier.
procedure Set_Id (Object : in out Answer_Ref;
Value : in ADO.Identifier);
-- Get the answer identifier.
function Get_Id (Object : in Answer_Ref)
return ADO.Identifier;
--
function Get_Version (Object : in Answer_Ref)
return Integer;
-- Set the user who wrote the answer.
procedure Set_Author (Object : in out Answer_Ref;
Value : in AWA.Users.Models.User_Ref'Class);
-- Get the user who wrote the answer.
function Get_Author (Object : in Answer_Ref)
return AWA.Users.Models.User_Ref'Class;
--
procedure Set_Question (Object : in out Answer_Ref;
Value : in Question_Ref'Class);
--
function Get_Question (Object : in Answer_Ref)
return Question_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Answer_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Answer_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Reload from the database the same object if it was modified.
-- Returns True in `Updated` if the object was reloaded.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Reload (Object : in out Answer_Ref;
Session : in out ADO.Sessions.Session'Class;
Updated : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Answer_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Answer_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Answer_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Answer_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
ANSWER_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Answer_Ref);
-- Copy of the object.
procedure Copy (Object : in Answer_Ref;
Into : in out Answer_Ref);
-- --------------------
-- The list of answers.
-- --------------------
type Answer_Info is
new Util.Beans.Basic.Bean with record
-- the answer identifier.
Id : ADO.Identifier;
-- the answer creation date.
Create_Date : Ada.Calendar.Time;
-- the answer edit date.
Edit_Date : ADO.Nullable_Time;
-- the answer description.
Answer : Ada.Strings.Unbounded.Unbounded_String;
-- the answer rank.
Rank : Integer;
-- the question rating as voted by the current user.
User_Rating : Integer;
-- the author's identifier.
Author_Id : ADO.Identifier;
-- the author's name.
Author_Name : Ada.Strings.Unbounded.Unbounded_String;
-- the author's email.
Author_Email : Ada.Strings.Unbounded.Unbounded_String;
end record;
-- Get the bean attribute identified by the name.
overriding
function Get_Value (From : in Answer_Info;
Name : in String) return Util.Beans.Objects.Object;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out Answer_Info;
Name : in String;
Value : in Util.Beans.Objects.Object);
package Answer_Info_Beans is
new Util.Beans.Basic.Lists (Element_Type => Answer_Info);
package Answer_Info_Vectors renames Answer_Info_Beans.Vectors;
subtype Answer_Info_List_Bean is Answer_Info_Beans.List_Bean;
type Answer_Info_List_Bean_Access is access all Answer_Info_List_Bean;
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
procedure List (Object : in out Answer_Info_List_Bean'Class;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
subtype Answer_Info_Vector is Answer_Info_Vectors.Vector;
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
procedure List (Object : in out Answer_Info_Vector;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
Query_Answer_List : constant ADO.Queries.Query_Definition_Access;
-- --------------------
-- The list of questions.
-- --------------------
type Question_Display_Info is
new Util.Beans.Basic.Bean with record
-- the question identifier.
Id : ADO.Identifier;
-- the question title.
Title : Ada.Strings.Unbounded.Unbounded_String;
-- the question creation date.
Create_Date : Ada.Calendar.Time;
-- the question edit date.
Edit_Date : ADO.Nullable_Time;
-- the question description.
Description : Ada.Strings.Unbounded.Unbounded_String;
-- the question rating.
Rating : Integer;
-- the question rating as voted by the current user.
User_Rating : Integer;
-- the author's identifier.
Author_Id : ADO.Identifier;
-- the author's name.
Author_Name : Ada.Strings.Unbounded.Unbounded_String;
-- the author's email.
Author_Email : Ada.Strings.Unbounded.Unbounded_String;
end record;
-- Get the bean attribute identified by the name.
overriding
function Get_Value (From : in Question_Display_Info;
Name : in String) return Util.Beans.Objects.Object;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out Question_Display_Info;
Name : in String;
Value : in Util.Beans.Objects.Object);
package Question_Display_Info_Beans is
new Util.Beans.Basic.Lists (Element_Type => Question_Display_Info);
package Question_Display_Info_Vectors renames Question_Display_Info_Beans.Vectors;
subtype Question_Display_Info_List_Bean is Question_Display_Info_Beans.List_Bean;
type Question_Display_Info_List_Bean_Access is access all Question_Display_Info_List_Bean;
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
procedure List (Object : in out Question_Display_Info_List_Bean'Class;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
subtype Question_Display_Info_Vector is Question_Display_Info_Vectors.Vector;
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
procedure List (Object : in out Question_Display_Info_Vector;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
Query_Question_Info : constant ADO.Queries.Query_Definition_Access;
-- --------------------
-- The list of questions.
-- --------------------
type Question_Info is
new Util.Beans.Basic.Bean with record
-- the question identifier.
Id : ADO.Identifier;
-- the question title.
Title : Ada.Strings.Unbounded.Unbounded_String;
-- the question creation date.
Create_Date : Ada.Calendar.Time;
-- the question short description.
Description : Ada.Strings.Unbounded.Unbounded_String;
-- the question rating.
Rating : Integer;
-- the number of answers.
Answer_Count : Integer;
-- the author's identifier.
Author_Id : ADO.Identifier;
-- the author's name.
Author_Name : Ada.Strings.Unbounded.Unbounded_String;
-- the author's email.
Author_Email : Ada.Strings.Unbounded.Unbounded_String;
end record;
-- Get the bean attribute identified by the name.
overriding
function Get_Value (From : in Question_Info;
Name : in String) return Util.Beans.Objects.Object;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out Question_Info;
Name : in String;
Value : in Util.Beans.Objects.Object);
package Question_Info_Beans is
new Util.Beans.Basic.Lists (Element_Type => Question_Info);
package Question_Info_Vectors renames Question_Info_Beans.Vectors;
subtype Question_Info_List_Bean is Question_Info_Beans.List_Bean;
type Question_Info_List_Bean_Access is access all Question_Info_List_Bean;
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
procedure List (Object : in out Question_Info_List_Bean'Class;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
subtype Question_Info_Vector is Question_Info_Vectors.Vector;
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
procedure List (Object : in out Question_Info_Vector;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class);
Query_Question_List : constant ADO.Queries.Query_Definition_Access;
Query_Question_Tag_List : constant ADO.Queries.Query_Definition_Access;
type Question_Bean is abstract new AWA.Questions.Models.Question_Ref
and Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with null record;
-- This bean provides some methods that can be used in a Method_Expression.
overriding
function Get_Method_Bindings (From : in Question_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out Question_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
procedure Save (Bean : in out Question_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
procedure Delete (Bean : in out Question_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
procedure Load (Bean : in out Question_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
type Answer_Bean is abstract new AWA.Questions.Models.Answer_Ref
and Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with null record;
-- This bean provides some methods that can be used in a Method_Expression.
overriding
function Get_Method_Bindings (From : in Answer_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out Answer_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
procedure Save (Bean : in out Answer_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
procedure Delete (Bean : in out Answer_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
procedure Load (Bean : in out Answer_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
-- --------------------
-- load the list of questions
-- --------------------
type Question_List_Bean is abstract limited
new Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with record
-- the optional tag to filter questions.
Tag : Ada.Strings.Unbounded.Unbounded_String;
Page : Integer;
-- the number of questions per page.
Page_Size : Integer;
-- the number of questions.
Count : Integer;
end record;
-- This bean provides some methods that can be used in a Method_Expression.
overriding
function Get_Method_Bindings (From : in Question_List_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access;
-- Get the bean attribute identified by the name.
overriding
function Get_Value (From : in Question_List_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out Question_List_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
procedure Load (Bean : in out Question_List_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
type Question_Display_Bean is abstract limited
new Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with null record;
-- This bean provides some methods that can be used in a Method_Expression.
overriding
function Get_Method_Bindings (From : in Question_Display_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access;
-- Get the bean attribute identified by the name.
overriding
function Get_Value (From : in Question_Display_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the bean attribute identified by the name.
overriding
procedure Set_Value (Item : in out Question_Display_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
procedure Load (Bean : in out Question_Display_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract;
private
QUESTION_NAME : aliased constant String := "awa_question";
COL_0_1_NAME : aliased constant String := "create_date";
COL_1_1_NAME : aliased constant String := "title";
COL_2_1_NAME : aliased constant String := "description";
COL_3_1_NAME : aliased constant String := "edit_date";
COL_4_1_NAME : aliased constant String := "short_description";
COL_5_1_NAME : aliased constant String := "rating";
COL_6_1_NAME : aliased constant String := "id";
COL_7_1_NAME : aliased constant String := "version";
COL_8_1_NAME : aliased constant String := "author_id";
COL_9_1_NAME : aliased constant String := "workspace_id";
COL_10_1_NAME : aliased constant String := "accepted_answer_id";
QUESTION_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 11,
Table => QUESTION_NAME'Access,
Members => (
1 => COL_0_1_NAME'Access,
2 => COL_1_1_NAME'Access,
3 => COL_2_1_NAME'Access,
4 => COL_3_1_NAME'Access,
5 => COL_4_1_NAME'Access,
6 => COL_5_1_NAME'Access,
7 => COL_6_1_NAME'Access,
8 => COL_7_1_NAME'Access,
9 => COL_8_1_NAME'Access,
10 => COL_9_1_NAME'Access,
11 => COL_10_1_NAME'Access)
);
QUESTION_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= QUESTION_DEF'Access;
Null_Question : constant Question_Ref
:= Question_Ref'(ADO.Objects.Object_Ref with null record);
type Question_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => QUESTION_DEF'Access)
with record
Create_Date : Ada.Calendar.Time;
Title : Ada.Strings.Unbounded.Unbounded_String;
Description : Ada.Strings.Unbounded.Unbounded_String;
Edit_Date : ADO.Nullable_Time;
Short_Description : Ada.Strings.Unbounded.Unbounded_String;
Rating : Integer;
Version : Integer;
Author : AWA.Users.Models.User_Ref;
Workspace : AWA.Workspaces.Models.Workspace_Ref;
Accepted_Answer : Answer_Ref;
end record;
type Question_Access is access all Question_Impl;
overriding
procedure Destroy (Object : access Question_Impl);
overriding
procedure Find (Object : in out Question_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Question_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Question_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Question_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Create (Object : in out Question_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Question_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Question_Ref'Class;
Impl : out Question_Access);
ANSWER_NAME : aliased constant String := "awa_answer";
COL_0_2_NAME : aliased constant String := "create_date";
COL_1_2_NAME : aliased constant String := "edit_date";
COL_2_2_NAME : aliased constant String := "answer";
COL_3_2_NAME : aliased constant String := "rank";
COL_4_2_NAME : aliased constant String := "id";
COL_5_2_NAME : aliased constant String := "version";
COL_6_2_NAME : aliased constant String := "author_id";
COL_7_2_NAME : aliased constant String := "question_id";
ANSWER_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 8,
Table => ANSWER_NAME'Access,
Members => (
1 => COL_0_2_NAME'Access,
2 => COL_1_2_NAME'Access,
3 => COL_2_2_NAME'Access,
4 => COL_3_2_NAME'Access,
5 => COL_4_2_NAME'Access,
6 => COL_5_2_NAME'Access,
7 => COL_6_2_NAME'Access,
8 => COL_7_2_NAME'Access)
);
ANSWER_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= ANSWER_DEF'Access;
Null_Answer : constant Answer_Ref
:= Answer_Ref'(ADO.Objects.Object_Ref with null record);
type Answer_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => ANSWER_DEF'Access)
with record
Create_Date : Ada.Calendar.Time;
Edit_Date : ADO.Nullable_Time;
Answer : Ada.Strings.Unbounded.Unbounded_String;
Rank : Integer;
Version : Integer;
Author : AWA.Users.Models.User_Ref;
Question : Question_Ref;
end record;
type Answer_Access is access all Answer_Impl;
overriding
procedure Destroy (Object : access Answer_Impl);
overriding
procedure Find (Object : in out Answer_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Answer_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Answer_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Answer_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Create (Object : in out Answer_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Answer_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Answer_Ref'Class;
Impl : out Answer_Access);
package File_1 is
new ADO.Queries.Loaders.File (Path => "answer-list.xml",
Sha1 => "2EDE0E19B5963DDEE7C4F8CE3A1B331A0063EC0A");
package Def_Answerinfo_Answer_List is
new ADO.Queries.Loaders.Query (Name => "answer-list",
File => File_1.File'Access);
Query_Answer_List : constant ADO.Queries.Query_Definition_Access
:= Def_Answerinfo_Answer_List.Query'Access;
package File_2 is
new ADO.Queries.Loaders.File (Path => "question-info.xml",
Sha1 => "EEBB96CEACAFAD6A3C4CBFCE81E28E885E0740A2");
package Def_Questiondisplayinfo_Question_Info is
new ADO.Queries.Loaders.Query (Name => "question-info",
File => File_2.File'Access);
Query_Question_Info : constant ADO.Queries.Query_Definition_Access
:= Def_Questiondisplayinfo_Question_Info.Query'Access;
package File_3 is
new ADO.Queries.Loaders.File (Path => "question-list.xml",
Sha1 => "6B1373D779DD15CEB92310B13BBB715BD674231C");
package Def_Questioninfo_Question_List is
new ADO.Queries.Loaders.Query (Name => "question-list",
File => File_3.File'Access);
Query_Question_List : constant ADO.Queries.Query_Definition_Access
:= Def_Questioninfo_Question_List.Query'Access;
package Def_Questioninfo_Question_Tag_List is
new ADO.Queries.Loaders.Query (Name => "question-tag-list",
File => File_3.File'Access);
Query_Question_Tag_List : constant ADO.Queries.Query_Definition_Access
:= Def_Questioninfo_Question_Tag_List.Query'Access;
end AWA.Questions.Models;
|
AdaCore/spat | Ada | 3,200 | adb | ------------------------------------------------------------------------------
-- Copyright (C) 2020 by Heisenbug Ltd. ([email protected])
--
-- This work is free. You can redistribute it and/or modify it under the
-- terms of the Do What The Fuck You Want To Public License, Version 2,
-- as published by Sam Hocevar. See the LICENSE file for more details.
------------------------------------------------------------------------------
pragma License (Unrestricted);
with SPAT.Field_Names;
with SPAT.Log;
package body SPAT.Preconditions is
---------------------------------------------------------------------------
-- Ensure_Field
---------------------------------------------------------------------------
function Ensure_Field (Object : in JSON_Value;
Field : in UTF8_String;
Kind : in JSON_Value_Type;
Is_Optional : in Boolean := False) return Boolean is
begin
if not Object.Has_Field (Field => Field) then
if not Is_Optional then
Log.Warning
(Message => "Expected field """ & Field & """ not present!");
end if;
return False;
end if;
if Object.Get (Field => Field).Kind /= Kind then
if not Is_Optional then
Log.Warning
(Message =>
"Field """ & Field & """ not of expected type """ & Kind'Image &
"""!");
end if;
return False;
end if;
return True;
end Ensure_Field;
---------------------------------------------------------------------------
-- Ensure_Field
---------------------------------------------------------------------------
function Ensure_Field
(Object : in JSON_Value;
Field : in UTF8_String;
Kinds_Allowed : in Accepted_Value_Types) return Boolean is
begin
if not Object.Has_Field (Field => Field) then
Log.Warning
(Message => "Expected field """ & Field & """ not present!");
return False;
end if;
declare
Field_Kind : constant JSON_Value_Type :=
Object.Get (Field => Field).Kind;
begin
if not Kinds_Allowed (Field_Kind) then
Log.Warning
(Message =>
"Field """ & Field & """ has unacceptable kind """ &
Field_Kind'Image & """!");
return False;
end if;
end;
return True;
end Ensure_Field;
---------------------------------------------------------------------------
-- Ensure_Rule_Severity
---------------------------------------------------------------------------
function Ensure_Rule_Severity (Object : in JSON_Value) return Boolean is
(Preconditions.Ensure_Field (Object => Object,
Field => Field_Names.Rule,
Kind => JSON_String_Type) and
Preconditions.Ensure_Field (Object => Object,
Field => Field_Names.Severity,
Kind => JSON_String_Type));
end SPAT.Preconditions;
|
reznikmm/webidl | Ada | 870 | ads | -- SPDX-FileCopyrightText: 2021 Max Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with League.String_Vectors;
with WebIDL.Definitions;
package WebIDL.Enumerations is
pragma Preelaborate;
type Enumeration is limited interface and WebIDL.Definitions.Definition;
-- An enumeration is a definition used to declare a type whose valid values
-- are a set of predefined strings.
type Enumeration_Access is access all Enumeration'Class
with Storage_Size => 0;
not overriding function Values (Self : Enumeration)
return League.String_Vectors.Universal_String_Vector is abstract;
-- The enumeration values are specified as a comma-separated list of string
-- literals. The list of enumeration values must not include duplicates.
end WebIDL.Enumerations;
|
onox/orka | Ada | 4,272 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2012 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.
private with GL.Low_Level;
with GL.Types;
package GL.Toggles is
pragma Preelaborate;
type Toggle is (Cull_Face, Depth_Test,
Stencil_Test, Dither, Blend, Color_Logic_Op, Scissor_Test,
Polygon_Offset_Point, Polygon_Offset_Line,
Clip_Distance_0, Clip_Distance_1, Clip_Distance_2, Clip_Distance_3,
Clip_Distance_4, Clip_Distance_5, Clip_Distance_6, Clip_Distance_7,
Polygon_Offset_Fill, Multisample,
Sample_Alpha_To_Coverage, Sample_Alpha_To_One, Sample_Coverage,
Debug_Output_Synchronous,
Program_Point_Size, Depth_Clamp,
Texture_Cube_Map_Seamless, Sample_Shading,
Rasterizer_Discard, Primitive_Restart_Fixed_Index,
Framebuffer_SRGB, Sample_Mask, Primitive_Restart,
Debug_Output);
procedure Enable (Subject : Toggle);
procedure Disable (Subject : Toggle);
procedure Set (Subject : Toggle; Enable : Boolean);
function Is_Enabled (Subject : Toggle) return Boolean;
type Toggle_Indexed is (Blend, Scissor_Test);
procedure Enable (Subject : Toggle_Indexed; Index : Types.UInt);
procedure Disable (Subject : Toggle_Indexed; Index : Types.UInt);
procedure Set (Subject : Toggle_Indexed; Index : Types.UInt; Enable : Boolean);
function Is_Enabled (Subject : Toggle_Indexed; Index : Types.UInt) return Boolean;
private
for Toggle use (Cull_Face => 16#0B44#,
Depth_Test => 16#0B71#,
Stencil_Test => 16#0B90#,
Dither => 16#0BD0#,
Blend => 16#0BE2#,
Color_Logic_Op => 16#0BF2#,
Scissor_Test => 16#0C11#,
Polygon_Offset_Point => 16#2A01#,
Polygon_Offset_Line => 16#2A02#,
Clip_Distance_0 => 16#3000#,
Clip_Distance_1 => 16#3001#,
Clip_Distance_2 => 16#3002#,
Clip_Distance_3 => 16#3003#,
Clip_Distance_4 => 16#3004#,
Clip_Distance_5 => 16#3005#,
Clip_Distance_6 => 16#3006#,
Clip_Distance_7 => 16#3007#,
Polygon_Offset_Fill => 16#8037#,
Multisample => 16#809D#,
Sample_Alpha_To_Coverage => 16#809E#,
Sample_Alpha_To_One => 16#809F#,
Sample_Coverage => 16#80A0#,
Debug_Output_Synchronous => 16#8242#,
Program_Point_Size => 16#8642#,
Depth_Clamp => 16#864F#,
Texture_Cube_Map_Seamless => 16#884F#,
Sample_Shading => 16#8C36#,
Rasterizer_Discard => 16#8C89#,
Primitive_Restart_Fixed_Index => 16#8D69#,
Framebuffer_SRGB => 16#8DB9#,
Sample_Mask => 16#8E51#,
Primitive_Restart => 16#8F9D#,
Debug_Output => 16#92E0#);
for Toggle'Size use Low_Level.Enum'Size;
for Toggle_Indexed use
(Blend => 16#0BE2#,
Scissor_Test => 16#0C11#);
for Toggle_Indexed'Size use Low_Level.Enum'Size;
end GL.Toggles;
|
damaki/libkeccak | Ada | 2,451 | ads | -------------------------------------------------------------------------------
-- Copyright (c) 2019, Daniel King
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
-- * Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * The name of the copyright holder may not be used to endorse or promote
-- Products derived from this software without specific prior written
-- permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------
with Keccak.Keccak_1600.Rounds_24;
with Keccak.Generic_XOF;
pragma Elaborate_All (Keccak.Generic_XOF);
-- @summary
-- Instantations of RawSHAKE128 and RawSHAKE256.
--
-- @group SHAKE
package RawSHAKE
with SPARK_Mode => On
is
-- RawSHAKE has 2 suffix bits appended to each message: 2#11#.
--
-- See Section 6.3 of NIST FIPS-202.
package RawSHAKE128 is new Keccak.Generic_XOF
(XOF_Sponge => Keccak.Keccak_1600.Rounds_24.Sponge,
Capacity => 256,
Suffix => 2#11#,
Suffix_Size => 2);
package RawSHAKE256 is new Keccak.Generic_XOF
(XOF_Sponge => Keccak.Keccak_1600.Rounds_24.Sponge,
Capacity => 512,
Suffix => 2#11#,
Suffix_Size => 2);
end RawSHAKE;
|
reznikmm/matreshka | Ada | 8,966 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.Internals.UML_Elements;
with AMF.UML.Connectable_Element_Template_Parameters;
with AMF.UML.Connectable_Elements;
with AMF.UML.Parameterable_Elements;
with AMF.UML.Template_Signatures;
with AMF.Visitors;
package AMF.Internals.UML_Connectable_Element_Template_Parameters is
type UML_Connectable_Element_Template_Parameter_Proxy is
limited new AMF.Internals.UML_Elements.UML_Element_Proxy
and AMF.UML.Connectable_Element_Template_Parameters.UML_Connectable_Element_Template_Parameter with null record;
overriding function Get_Parametered_Element
(Self : not null access constant UML_Connectable_Element_Template_Parameter_Proxy)
return AMF.UML.Connectable_Elements.UML_Connectable_Element_Access;
-- Getter of ConnectableElementTemplateParameter::parameteredElement.
--
-- The ConnectableElement for this template parameter.
overriding procedure Set_Parametered_Element
(Self : not null access UML_Connectable_Element_Template_Parameter_Proxy;
To : AMF.UML.Connectable_Elements.UML_Connectable_Element_Access);
-- Setter of ConnectableElementTemplateParameter::parameteredElement.
--
-- The ConnectableElement for this template parameter.
overriding function Get_Default
(Self : not null access constant UML_Connectable_Element_Template_Parameter_Proxy)
return AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access;
-- Getter of TemplateParameter::default.
--
-- The element that is the default for this formal template parameter.
overriding procedure Set_Default
(Self : not null access UML_Connectable_Element_Template_Parameter_Proxy;
To : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access);
-- Setter of TemplateParameter::default.
--
-- The element that is the default for this formal template parameter.
overriding function Get_Owned_Default
(Self : not null access constant UML_Connectable_Element_Template_Parameter_Proxy)
return AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access;
-- Getter of TemplateParameter::ownedDefault.
--
-- The element that is owned by this template parameter for the purpose of
-- providing a default.
overriding procedure Set_Owned_Default
(Self : not null access UML_Connectable_Element_Template_Parameter_Proxy;
To : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access);
-- Setter of TemplateParameter::ownedDefault.
--
-- The element that is owned by this template parameter for the purpose of
-- providing a default.
overriding function Get_Owned_Parametered_Element
(Self : not null access constant UML_Connectable_Element_Template_Parameter_Proxy)
return AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access;
-- Getter of TemplateParameter::ownedParameteredElement.
--
-- The element that is owned by this template parameter.
overriding procedure Set_Owned_Parametered_Element
(Self : not null access UML_Connectable_Element_Template_Parameter_Proxy;
To : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access);
-- Setter of TemplateParameter::ownedParameteredElement.
--
-- The element that is owned by this template parameter.
overriding function Get_Parametered_Element
(Self : not null access constant UML_Connectable_Element_Template_Parameter_Proxy)
return AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access;
-- Getter of TemplateParameter::parameteredElement.
--
-- The element exposed by this template parameter.
overriding procedure Set_Parametered_Element
(Self : not null access UML_Connectable_Element_Template_Parameter_Proxy;
To : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access);
-- Setter of TemplateParameter::parameteredElement.
--
-- The element exposed by this template parameter.
overriding function Get_Signature
(Self : not null access constant UML_Connectable_Element_Template_Parameter_Proxy)
return AMF.UML.Template_Signatures.UML_Template_Signature_Access;
-- Getter of TemplateParameter::signature.
--
-- The template signature that owns this template parameter.
overriding procedure Set_Signature
(Self : not null access UML_Connectable_Element_Template_Parameter_Proxy;
To : AMF.UML.Template_Signatures.UML_Template_Signature_Access);
-- Setter of TemplateParameter::signature.
--
-- The template signature that owns this template parameter.
overriding procedure Enter_Element
(Self : not null access constant UML_Connectable_Element_Template_Parameter_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Leave_Element
(Self : not null access constant UML_Connectable_Element_Template_Parameter_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Visit_Element
(Self : not null access constant UML_Connectable_Element_Template_Parameter_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of iterator interface.
end AMF.Internals.UML_Connectable_Element_Template_Parameters;
|
reznikmm/matreshka | Ada | 3,704 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Text_Duration_Attributes is
pragma Preelaborate;
type ODF_Text_Duration_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Text_Duration_Attribute_Access is
access all ODF_Text_Duration_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Text_Duration_Attributes;
|
charlie5/cBound | Ada | 1,557 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_glx_get_error_reply_t is
-- Item
--
type Item is record
response_type : aliased Interfaces.Unsigned_8;
pad0 : aliased Interfaces.Unsigned_8;
sequence : aliased Interfaces.Unsigned_16;
length : aliased Interfaces.Unsigned_32;
error : aliased Interfaces.Integer_32;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C.size_t range <>) of aliased xcb.xcb_glx_get_error_reply_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_get_error_reply_t.Item,
Element_Array => xcb.xcb_glx_get_error_reply_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C.size_t range <>) of aliased xcb.xcb_glx_get_error_reply_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_get_error_reply_t.Pointer,
Element_Array => xcb.xcb_glx_get_error_reply_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_glx_get_error_reply_t;
|
reznikmm/matreshka | Ada | 7,021 | 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.Named_Expressions_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Table_Named_Expressions_Element_Node is
begin
return Self : Table_Named_Expressions_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_Named_Expressions_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_Named_Expressions
(ODF.DOM.Table_Named_Expressions_Elements.ODF_Table_Named_Expressions_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_Named_Expressions_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Named_Expressions_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Table_Named_Expressions_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_Named_Expressions
(ODF.DOM.Table_Named_Expressions_Elements.ODF_Table_Named_Expressions_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_Named_Expressions_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_Named_Expressions
(Visitor,
ODF.DOM.Table_Named_Expressions_Elements.ODF_Table_Named_Expressions_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.Named_Expressions_Element,
Table_Named_Expressions_Element_Node'Tag);
end Matreshka.ODF_Table.Named_Expressions_Elements;
|
reznikmm/spawn | Ada | 12,891 | adb | --
-- Copyright (C) 2018-2022, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
--
with Ada.Containers.Hashed_Maps;
with Ada.Containers.Synchronized_Queue_Interfaces;
with Ada.Containers.Unbounded_Synchronized_Queues;
with Ada.Interrupts.Names;
with Ada.Strings.Unbounded;
with Interfaces.C.Strings;
with GNAT.OS_Lib;
with Spawn.Channels;
with Spawn.Environments.Internal;
with Spawn.Polls.POSIX_Polls;
with Spawn.Posix;
package body Spawn.Internal.Monitor is
use type Interfaces.C.int;
use all type Pipe_Kinds;
type Process_Access is access all Process'Class;
procedure Start_Process (Self : Process_Access);
procedure Do_Close_Pipe
(Self : Process_Access;
Kind : Common.Standard_Pipe);
procedure Check_Children;
package Command_Queue_Interfaces is
new Ada.Containers.Synchronized_Queue_Interfaces (Command);
package Command_Queues is new Ada.Containers.Unbounded_Synchronized_Queues
(Queue_Interfaces => Command_Queue_Interfaces);
Queue : Command_Queues.Queue;
Poll : Spawn.Polls.Poll_Access;
Wake : Interfaces.C.int := -1;
type Wake_Up_Listener is new Spawn.Polls.Listener with null record;
overriding procedure On_Event
(Self : in out Wake_Up_Listener;
Poll : Spawn.Polls.Poll_Access;
Value : Spawn.Polls.Descriptor;
Events : Spawn.Polls.Event_Set);
-- Restart watching of the pipe descriptor.
function Hash (Value : Interfaces.C.int) return Ada.Containers.Hash_Type;
package Process_Maps is new Ada.Containers.Hashed_Maps
(Key_Type => Interfaces.C.int,
Element_Type => Process_Access,
Hash => Hash,
Equivalent_Keys => Interfaces.C."=",
"=" => "=");
Map : Process_Maps.Map;
Pipe_Flags : constant Interfaces.C.int := Posix.O_CLOEXEC;
protected SIGCHLD is
entry Wait;
procedure Handle
with Interrupt_Handler,
Attach_Handler => Ada.Interrupts.Names.SIGCHLD;
private
Fired : Boolean := False;
end SIGCHLD;
protected body SIGCHLD is
entry Wait when Fired is
begin
Fired := False;
end Wait;
procedure Handle is
begin
Fired := True;
end Handle;
end SIGCHLD;
--------------------
-- Check_Children --
--------------------
procedure Check_Children is
function WIFEXITED (Status : Interfaces.C.unsigned) return Boolean;
function WEXITSTATUS
(Status : Interfaces.C.unsigned) return Interfaces.C.unsigned
with Import => True,
Convention => C,
External_Name => "__spawn_WEXITSTATUS";
function WIFSIGNALED (Status : Interfaces.C.unsigned) return Boolean;
function WTERMSIG
(Status : Interfaces.C.unsigned) return Interfaces.C.unsigned
with Import, Convention => C, External_Name => "__spawn_WTERMSIG";
---------------
-- WIFEXITED --
---------------
function WIFEXITED (Status : Interfaces.C.unsigned) return Boolean is
function Imported
(Status : Interfaces.C.unsigned) return Interfaces.C.int
with Import => True,
Convention => C,
External_Name => "__spawn_WIFEXITED";
begin
return Imported (Status) /= 0;
end WIFEXITED;
-----------------
-- WIFSIGNALED --
-----------------
function WIFSIGNALED (Status : Interfaces.C.unsigned) return Boolean is
function Imported
(Status : Interfaces.C.unsigned) return Interfaces.C.int
with Import => True,
Convention => C,
External_Name => "__spawn_WIFSIGNALED";
begin
return Imported (Status) /= 0;
end WIFSIGNALED;
status : aliased Interfaces.C.unsigned := 0;
Process : Process_Access;
begin
loop
declare
pid : constant Interfaces.C.int :=
Posix.waitpid (-1, status'Unchecked_Access, Posix.WNOHANG);
Cursor : constant Process_Maps.Cursor := Map.Find (pid);
begin
exit when pid <= 0; -- no more children change state
if Process_Maps.Has_Element (Cursor) then
Process := Process_Maps.Element (Cursor);
Process.Exit_Status :=
(if WIFEXITED (status) then Normal else Crash);
case Process.Exit_Status is
when Normal =>
Process.Exit_Code :=
Process_Exit_Code (WEXITSTATUS (status));
when Crash =>
Process.Exit_Code :=
(if WIFSIGNALED (status)
then Process_Exit_Code (WTERMSIG (status))
else Process_Exit_Code'Last);
end case;
if Spawn.Channels.Is_Active (Process.Channels) then
Process.Pending_Finish := True;
elsif Process.Pending_Error = 0 then
Process.Status := Not_Running;
Process.Emit_Finished
(Process.Exit_Status, Process.Exit_Code);
else
Process.Status := Not_Running;
Process.Emit_Error_Occurred (Process.Pending_Error);
end if;
end if;
end;
end loop;
end Check_Children;
-------------------
-- Do_Close_Pipe --
-------------------
procedure Do_Close_Pipe
(Self : Process_Access;
Kind : Common.Standard_Pipe) is
begin
Spawn.Channels.Close_Parent_Descriptor (Self.Channels, Kind, Poll);
end Do_Close_Pipe;
-------------
-- Enqueue --
-------------
procedure Enqueue (Value : Command) is
Ignore : Interfaces.C.size_t;
begin
Queue.Enqueue (Value);
-- Wake up monitoring tread.
Ignore := Posix.write (Wake, (1 => 0), 1);
end Enqueue;
----------
-- Hash --
----------
function Hash (Value : Interfaces.C.int) return Ada.Containers.Hash_Type is
begin
return Ada.Containers.Hash_Type (abs Value);
end Hash;
----------------
-- Loop_Cycle --
----------------
procedure Loop_Cycle (Timeout : Duration) is
use type Ada.Containers.Count_Type;
Command : Monitor.Command;
begin
select
SIGCHLD.Wait;
Check_Children;
else
null;
end select;
while Queue.Current_Use > 0 loop
Queue.Dequeue (Command);
case Command.Kind is
when Start =>
Start_Process (Process_Access (Command.Process));
when Close_Pipe =>
Do_Close_Pipe (Command.Process, Command.Pipe);
when Watch_Pipe =>
Spawn.Channels.Start_Watch
(Command.Process.Channels, Command.Pipe, Poll);
end case;
end loop;
Poll.Wait (Timeout);
end Loop_Cycle;
-------------------
-- Start_Process --
-------------------
procedure Start_Process (Self : Process_Access) is
use Ada.Strings.Unbounded;
use type Interfaces.C.Strings.chars_ptr;
use type Ada.Streams.Stream_Element_Offset;
procedure Send_Errno_And_Exit with No_Return;
-- Put errno into Launch pipe end abort process
procedure Prepare_Arguments (argv : out Posix.chars_ptr_array);
-- Allocate argumnets
procedure Free (argv : out Posix.chars_ptr_array);
-- Deallocate argumnets
--------------------
-- Free_Arguments --
--------------------
procedure Free (argv : out Posix.chars_ptr_array) is
begin
for J in argv'Range loop
Interfaces.C.Strings.Free (argv (J));
end loop;
end Free;
-----------------------
-- Prepare_Arguments --
-----------------------
procedure Prepare_Arguments (argv : out Posix.chars_ptr_array) is
begin
argv (0) := Interfaces.C.Strings.New_String (Self.Program);
for J in 1 .. Self.Arguments.Last_Index loop
argv (J) := Interfaces.C.Strings.New_String
(Self.Arguments.Element (J));
end loop;
argv (argv'Last) := Interfaces.C.Strings.Null_Ptr;
end Prepare_Arguments;
Child_Ends : Spawn.Channels.Pipe_Array;
Dup : constant array (Stdout .. Stdin) of Interfaces.C.int :=
(Stdin => 0, Stdout => 1, Stderr => 2);
----------------
-- Send_Errno --
----------------
procedure Send_Errno_And_Exit is
count : Interfaces.C.size_t;
pragma Unreferenced (count);
errno : Integer;
Error_Dump : Ada.Streams.Stream_Element_Array (1 .. errno'Size / 8)
with Import, Convention => Ada, Address => errno'Address;
begin
errno := GNAT.OS_Lib.Errno;
count := Posix.write
(Child_Ends (Launch),
Error_Dump,
Error_Dump'Length);
GNAT.OS_Lib.OS_Exit (127);
end Send_Errno_And_Exit;
pid : Interfaces.C.int;
dir : Interfaces.C.Strings.chars_ptr :=
(if Length (Self.Directory) = 0 then Interfaces.C.Strings.Null_Ptr
else Interfaces.C.Strings.New_String
(To_String (Self.Directory)));
argv : Posix.chars_ptr_array (0 .. Natural (Self.Arguments.Length) + 1);
envp : Posix.chars_ptr_array :=
Spawn.Environments.Internal.Raw (Self.Environment);
Ok : Boolean;
begin
-- Create pipes for children's stdio
Spawn.Channels.Setup_Channels
(Self.Channels, Self.Use_PTY, Child_Ends, Ok);
if not Ok then
Interfaces.C.Strings.Free (dir);
return;
end if;
Prepare_Arguments (argv);
pid := Posix.fork;
if pid = -1 then
-- Fork failed
Self.Emit_Error_Occurred (GNAT.OS_Lib.Errno);
Free (argv);
Free (envp);
Interfaces.C.Strings.Free (dir);
return;
elsif pid = 0 then -- Child process
-- Close unused ends
Spawn.Channels.Close_Parent_Descriptors (Self.Channels, Ok);
if not Ok then
Send_Errno_And_Exit;
-- Copy fd to standard numbers
elsif (for some X in Dup'Range =>
Posix.dup2 (Child_Ends (X), Dup (X)) = -1)
then
Send_Errno_And_Exit;
-- Change directory if needed
elsif dir /= Interfaces.C.Strings.Null_Ptr
and then Posix.chdir (dir) /= 0
then
Send_Errno_And_Exit;
else -- Replace executable
declare
Ignore : Interfaces.C.int;
begin
Ignore := Posix.execve (argv (0), argv, envp);
Send_Errno_And_Exit;
end;
end if;
end if;
-- Parent process
Free (argv);
Free (envp);
Interfaces.C.Strings.Free (dir);
-- Close unused ends
Spawn.Channels.Close_Child_Descriptors (Self.Channels, Ok);
if not Ok then
Self.Emit_Error_Occurred (GNAT.OS_Lib.Errno);
return;
end if;
Self.pid := pid;
Map.Insert (pid, Self);
for Kind in Launch .. Stderr loop
Spawn.Channels.Start_Watch (Self.Channels, Kind, Poll);
end loop;
end Start_Process;
procedure Initialize;
-- Do low level initialization if needed
procedure Dummy is null;
-- This is to be used in Initialize procedure
procedure Initialize is separate;
type POSIX_Poll_Access is access Polls.POSIX_Polls.POSIX_Poll;
--------------
-- On_Event --
--------------
overriding procedure On_Event
(Self : in out Wake_Up_Listener;
Poll : Spawn.Polls.Poll_Access;
Value : Spawn.Polls.Descriptor;
Events : Spawn.Polls.Event_Set)
is
Byte : Ada.Streams.Stream_Element_Array (1 .. 1);
Ignore : Interfaces.C.size_t;
begin
if Events (Spawn.Polls.Input) then
Ignore := Posix.read (Value, Byte, Byte'Length);
Poll.Watch
(Value => Value,
Events => Spawn.Polls.Input,
Listener => Self'Unchecked_Access);
end if;
end On_Event;
WL : aliased Wake_Up_Listener;
begin
declare
Object : constant POSIX_Poll_Access := new Polls.POSIX_Polls.POSIX_Poll;
Value : Posix.Fd_Pair;
Result : constant Interfaces.C.int := Posix.pipe2 (Value, Pipe_Flags);
begin
pragma Assert (Result = 0, GNAT.OS_Lib.Errno_Message);
Wake := Value (Posix.Write_End);
Poll := Spawn.Polls.Poll_Access (Object);
Poll.Initialize;
Poll.Watch
(Value => Value (Posix.Read_End),
Events => Spawn.Polls.Input,
Listener => WL'Access);
end;
Initialize;
end Spawn.Internal.Monitor;
|
zhmu/ananas | Ada | 4,875 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- B I N D O . V A L I D A T O R S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2019-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- For full architecture, see unit Bindo.
-- The following unit contains facilities to verify the validity of the
-- various graphs used in determining the elaboration order of units.
with Bindo.Graphs;
use Bindo.Graphs;
use Bindo.Graphs.Invocation_Graphs;
use Bindo.Graphs.Library_Graphs;
package Bindo.Validators is
----------------------
-- Cycle_Validators --
----------------------
package Cycle_Validators is
Invalid_Cycle : exception;
-- Exception raised when the library graph contains an invalid cycle
procedure Validate_Cycles (G : Library_Graph);
-- Ensure that all cycles of library graph G meet the following
-- requirements:
--
-- * Are of proper kind
-- * Have enough edges to form a circuit
-- * No edge is repeated
--
-- Diagnose issues and raise Invalid_Cycle if this is not the case.
end Cycle_Validators;
----------------------------------
-- Elaboration_Order_Validators --
----------------------------------
package Elaboration_Order_Validators is
Invalid_Elaboration_Order : exception;
-- Exception raised when the elaboration order contains invalid data
procedure Validate_Elaboration_Order (Order : Unit_Id_Table);
-- Ensure that elaboration order Order meets the following requirements:
--
-- * All units that must be elaborated appear in the order
-- * No other units appear in the order
--
-- Diagnose issues and raise Invalid_Elaboration_Order if this is not
-- the case.
end Elaboration_Order_Validators;
---------------------------------
-- Invocation_Graph_Validators --
---------------------------------
package Invocation_Graph_Validators is
Invalid_Invocation_Graph : exception;
-- Exception raised when the invocation graph contains invalid data
procedure Validate_Invocation_Graph (G : Invocation_Graph);
-- Ensure that invocation graph G meets the following requirements:
--
-- * All attributes of edges are properly set
-- * All attributes of vertices are properly set
--
-- Diagnose issues and raise Invalid_Invocation_Graph if this is not the
-- case.
end Invocation_Graph_Validators;
------------------------------
-- Library_Graph_Validators --
------------------------------
package Library_Graph_Validators is
Invalid_Library_Graph : exception;
-- Exception raised when the library graph contains invalid data
procedure Validate_Library_Graph (G : Library_Graph);
-- Ensure that library graph G meets the following requirements:
--
-- * All attributes edges are properly set
-- * All attributes of vertices are properly set
--
-- Diagnose issues and raise Invalid_Library_Graph if this is not the
-- case.
end Library_Graph_Validators;
end Bindo.Validators;
|
zhmu/ananas | Ada | 4,144 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- B A C K E N D _ U T I L S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2021-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Lib;
with Opt; use Opt;
with Switch; use Switch;
package body Backend_Utils is
---------------------------------
-- Scan_Common_Back_End_Switch --
---------------------------------
function Scan_Common_Back_End_Switch (Switch_Chars : String) return Boolean
is
First : constant Positive := Switch_Chars'First + 1;
Last : constant Natural := Switch_Last (Switch_Chars);
begin
-- Recognize -gxxx switches
if Switch_Chars (First) = 'g' then
Debugger_Level := 2;
if First < Last then
case Switch_Chars (First + 1) is
when '0' =>
Debugger_Level := 0;
when '1' =>
Debugger_Level := 1;
when '2' =>
Debugger_Level := 2;
when '3' =>
Debugger_Level := 3;
when others =>
null;
end case;
end if;
-- Back end switch -fdiagnostics-format=json tells the frontend to
-- output its error and warning messages in the same format GCC
-- uses when passed -fdiagnostics-format=json.
elsif Switch_Chars (First .. Last) = "fdiagnostics-format=json" then
Opt.JSON_Output := True;
-- Back-end switch -fno-inline also sets the front end flags to entirely
-- inhibit all inlining. So we store it and set the appropriate
-- flags.
-- For gcc back ends, -fno-inline disables Inline pragmas only,
-- not Inline_Always to remain consistent with the always_inline
-- attribute behavior.
elsif Switch_Chars (First .. Last) = "fno-inline" then
Opt.Disable_FE_Inline := True;
-- Back end switch -fpreserve-control-flow also sets the front end
-- flag that inhibits improper control flow transformations.
elsif Switch_Chars (First .. Last) = "fpreserve-control-flow" then
Opt.Suppress_Control_Flow_Optimizations := True;
elsif Switch_Chars (First .. Last) = "S" then
Generate_Asm := True;
else
return False;
end if;
Lib.Store_Compilation_Switch (Switch_Chars);
return True;
end Scan_Common_Back_End_Switch;
end Backend_Utils;
|
reznikmm/matreshka | Ada | 3,756 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.Constants;
package body Matreshka.ODF_Attributes.Office.Version is
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Office_Version_Node)
return League.Strings.Universal_String is
begin
return ODF.Constants.Version_Name;
end Get_Local_Name;
end Matreshka.ODF_Attributes.Office.Version;
|
tum-ei-rcs/StratoX | Ada | 302 | ads | with CSV;
with Ada.Text_IO; use Ada.Text_IO;
package Simulation is
package CSV_here is new CSV (filename => "../rawdata.csv");
have_data : Boolean := False;
csv_file : File_Type;
Finished : Boolean := False;
procedure init;
procedure update;
procedure close;
end Simulation;
|
zhmu/ananas | Ada | 316 | adb | -- { dg-do run }
-- { dg-options "-O" }
procedure Array37 is
type Arr is array (Integer range -1 .. 1) of Integer;
A : Arr := (-100, 0, 100);
function Ident (I : Integer) return Integer IS
begin
return I;
end;
begin
if Ident (A (1)) <= Ident (A (0)) then
raise Program_Error;
end if;
end;
|
ZinebZaad/ENSEEIHT | Ada | 517 | adb | with Ada.Text_IO; use Ada.Text_IO;
-- Demander confirmation par 'o' ou 'n'.
procedure Demander_Confirmation is
Reponse: Character; -- la réponse de l'utilisateur
begin
-- Demander la réponse
Put("Confirmation (o/n) ? ");
Get(Reponse);
while Reponse /= 'o' and Reponse /= 'n' loop
Put_Line("Merci de répondre par 'o' (oui) ou 'n' (non).");
Put("Confirmation (o/n) ?");
Get(Reponse);
end loop;
-- Afficher la réponse
Put (Reponse);
end Demander_Confirmation;
|
sungyeon/drake | Ada | 2,167 | ads | pragma License (Unrestricted);
package Ada.Calendar is
type Time is private;
subtype Year_Number is Integer range 1901 .. 2399;
subtype Month_Number is Integer range 1 .. 12;
subtype Day_Number is Integer range 1 .. 31;
subtype Day_Duration is Duration range 0.0 .. 86_400.0;
function Clock return Time;
function Year (Date : Time) return Year_Number;
function Month (Date : Time) return Month_Number;
function Day (Date : Time) return Day_Number;
function Seconds (Date : Time) return Day_Duration;
pragma Pure_Function (Year);
pragma Pure_Function (Month);
pragma Pure_Function (Day);
pragma Pure_Function (Seconds);
pragma Inline (Year);
pragma Inline (Month);
pragma Inline (Day);
-- Note: Year, Month, and Day would be optimized,
-- but Seconds is inefficient.
procedure Split (
Date : Time;
Year : out Year_Number;
Month : out Month_Number;
Day : out Day_Number;
Seconds : out Day_Duration);
function Time_Of (
Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Seconds : Day_Duration := 0.0)
return Time;
function "+" (Left : Time; Right : Duration) return Time
with Convention => Intrinsic;
function "+" (Left : Duration; Right : Time) return Time
with Convention => Intrinsic;
function "-" (Left : Time; Right : Duration) return Time
with Convention => Intrinsic;
function "-" (Left : Time; Right : Time) return Duration
with Convention => Intrinsic;
pragma Pure_Function ("+");
pragma Pure_Function ("-");
pragma Inline_Always ("+");
pragma Inline_Always ("-");
function "<" (Left, Right : Time) return Boolean
with Import, Convention => Intrinsic;
function "<=" (Left, Right : Time) return Boolean
with Import, Convention => Intrinsic;
function ">" (Left, Right : Time) return Boolean
with Import, Convention => Intrinsic;
function ">=" (Left, Right : Time) return Boolean
with Import, Convention => Intrinsic;
Time_Error : exception;
private
type Time is new Duration; -- 0 = 2150-01-01 00:00:00
end Ada.Calendar;
|
charlie5/aIDE | Ada | 2,479 | adb | with
AdaM.Factory;
package body AdaM.raw_source
is
-- Storage Pool
--
record_Version : constant := 1;
max_Sources : constant := 5_000;
package Pool is new AdaM.Factory.Pools (".adam-store",
"raw_Source",
max_Sources,
record_Version,
raw_Source.item,
raw_Source.view);
-- Forge
--
procedure define (Self : in out Item)
is
begin
null;
end define;
procedure destruct (Self : in out Item)
is
begin
null;
end destruct;
function new_Source return View
is
new_View : constant raw_Source.view := Pool.new_Item;
begin
define (raw_Source.item (new_View.all));
return new_View;
end new_Source;
procedure free (Self : in out raw_Source.view)
is
begin
destruct (raw_Source.item (Self.all));
Pool.free (Self);
end free;
-- Attributes
--
overriding
function Name (Self : in Item) return Identifier
is
pragma Unreferenced (Self);
begin
return "raw_Source";
end Name;
function Lines (Self : in Item) return text_Lines
is
begin
return Self.Lines;
end Lines;
procedure Lines_are (Self : in out Item; Now : in text_Lines)
is
begin
Self.Lines := Now;
end Lines_are;
overriding
function Id (Self : access Item) return AdaM.Id
is
begin
return Pool.to_Id (Self);
end Id;
overriding
function to_Source (Self : in Item) return text_Vectors.Vector
is
the_Source : text_Vectors.Vector;
begin
for i in 1 .. Self.Lines.Length
loop
declare
the_Line : Text renames Self.Lines.Element (Integer (i));
begin
the_Source.append (the_Line);
end;
end loop;
return the_Source;
end to_Source;
-- Streams
--
procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in View)
renames Pool.View_write;
procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out View)
renames Pool.View_read;
end AdaM.raw_source;
|
alvaromb/Compilemon | Ada | 13,804 | adb | -- Copyright (c) 1990 Regents of the University of California.
-- All rights reserved.
--
-- This software was developed by John Self of the Arcadia project
-- at the University of California, Irvine.
--
-- Redistribution and use in source and binary forms are permitted
-- provided that the above copyright notice and this paragraph are
-- duplicated in all such forms and that any documentation,
-- advertising materials, and other materials related to such
-- distribution and use acknowledge that the software was developed
-- by the University of California, Irvine. The name of the
-- University may not be used to endorse or promote products derived
-- from this software without specific prior written permission.
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-- TITLE skeleton manager
-- AUTHOR: John Self (UCI)
-- DESCRIPTION outputs skeleton sections when called by gen.
-- NOTES allows use of internal or external skeleton
-- $Header: /dc/uc/self/arcadia/aflex/ada/src/RCS/skeleton_managerB.a,v 1.19 1992/12/29 22:46:15 self Exp self $
with misc_defs, text_io, file_string;
package body skeleton_manager is
use FILE_STRING; -- to save having to type FILE_STRING 177 times
USE_EXTERNAL_SKELETON : BOOLEAN := FALSE;
-- are we using an external skelfile?
CURRENT_LINE : INTEGER := 1;
type FILE_ARRAY is array(POSITIVE range <>) of FILE_STRING.VSTRING;
SKEL_TEMPLATE : constant FILE_ARRAY := (
-- START OF SKELETON
-- START OF S1
VSTR("-- A lexical scanner generated by aflex"),
VSTR("with text_io; use text_io;"),
VSTR("%% user's code up to the double pound goes right here"),
-- BEGIN S2
VSTR("function YYLex return Token is"),
VSTR("subtype short is integer range -32768..32767;"),
VSTR(" yy_act : integer;"),
VSTR(" yy_c : short;"),
VSTR(""),
VSTR("-- returned upon end-of-file"),
VSTR("YY_END_TOK : constant integer := 0;"),
VSTR("%% tables get generated here."),
-- BEGIN S3
VSTR(""),
VSTR("-- copy whatever the last rule matched to the standard output"),
VSTR(""),
VSTR("procedure ECHO is"),
VSTR("begin"),
VSTR(" if (text_io.is_open(user_output_file)) then"),
VSTR(" text_io.put( user_output_file, yytext );"),
VSTR(" else"),
VSTR(" text_io.put( yytext );"),
VSTR(" end if;"),
VSTR("end ECHO;"),
VSTR(""),
VSTR("-- enter a start condition."),
VSTR("-- Using procedure requires a () after the ENTER, but makes everything"),
VSTR("-- much neater."),
VSTR(""),
VSTR("procedure ENTER( state : integer ) is"),
VSTR("begin"),
VSTR(" yy_start := 1 + 2 * state;"),
VSTR("end ENTER;"),
VSTR(""),
VSTR("-- action number for EOF rule of a given start state"),
VSTR("function YY_STATE_EOF(state : integer) return integer is"),
VSTR("begin"),
VSTR(" return YY_END_OF_BUFFER + state + 1;"),
VSTR("end YY_STATE_EOF;"),
VSTR(""),
VSTR("-- return all but the first 'n' matched characters back to the input stream"),
VSTR("procedure yyless(n : integer) is"),
VSTR("begin"),
VSTR(" yy_ch_buf(yy_cp) := yy_hold_char; -- undo effects of setting up yytext"),
VSTR(" yy_cp := yy_bp + n;"),
VSTR(" yy_c_buf_p := yy_cp;"),
VSTR(" YY_DO_BEFORE_ACTION; -- set up yytext again"),
VSTR("end yyless;"),
VSTR(""),
VSTR("-- redefine this if you have something you want each time."),
VSTR("procedure YY_USER_ACTION is"),
VSTR("begin"),
VSTR(" null;"),
VSTR("end;"),
VSTR(""),
VSTR("-- yy_get_previous_state - get the state just before the EOB char was reached"),
VSTR(""),
VSTR("function yy_get_previous_state return yy_state_type is"),
VSTR(" yy_current_state : yy_state_type;"),
VSTR(" yy_c : short;"),
VSTR("%% a local declaration of yy_bp goes here if bol_needed"),
VSTR("begin"),
VSTR("%% code to get the start state into yy_current_state goes here"),
-- BEGIN S3A
VSTR(""),
VSTR(" for yy_cp in yytext_ptr..yy_c_buf_p - 1 loop"),
VSTR("%% code to find the next state goes here"),
-- BEGIN S4
VSTR(" end loop;"),
VSTR(""),
VSTR(" return yy_current_state;"),
VSTR("end yy_get_previous_state;"),
VSTR(""),
VSTR("procedure yyrestart( input_file : file_type ) is"),
VSTR("begin"),
VSTR(" open_input(text_io.name(input_file));"),
VSTR("end yyrestart;"),
VSTR(""),
VSTR("begin -- of YYLex"),
VSTR("<<new_file>>"),
VSTR(" -- this is where we enter upon encountering an end-of-file and"),
VSTR(" -- yywrap() indicating that we should continue processing"),
VSTR(""),
VSTR(" if ( yy_init ) then"),
VSTR(" if ( yy_start = 0 ) then"),
VSTR(" yy_start := 1; -- first start state"),
VSTR(" end if;"),
VSTR(""),
VSTR(" -- we put in the '\n' and start reading from [1] so that an"),
VSTR(" -- initial match-at-newline will be true."),
VSTR(""),
VSTR(" yy_ch_buf(0) := ASCII.LF;"),
VSTR(" yy_n_chars := 1;"),
VSTR(""),
VSTR(" -- we always need two end-of-buffer characters. The first causes"),
VSTR(" -- a transition to the end-of-buffer state. The second causes"),
VSTR(" -- a jam in that state."),
VSTR(""),
VSTR(" yy_ch_buf(yy_n_chars) := YY_END_OF_BUFFER_CHAR;"),
VSTR(" yy_ch_buf(yy_n_chars + 1) := YY_END_OF_BUFFER_CHAR;"),
VSTR(""),
VSTR(" yy_eof_has_been_seen := false;"),
VSTR(""),
VSTR(" yytext_ptr := 1;"),
VSTR(" yy_c_buf_p := yytext_ptr;"),
VSTR(" yy_hold_char := yy_ch_buf(yy_c_buf_p);"),
VSTR(" yy_init := false;"),
VSTR("-- UMASS CODES :"),
VSTR("-- Initialization"),
VSTR(" tok_begin_line := 1;"),
VSTR(" tok_end_line := 1;"),
VSTR(" tok_begin_col := 0;"),
VSTR(" tok_end_col := 0;"),
VSTR(" token_at_end_of_line := false;"),
VSTR(" line_number_of_saved_tok_line1 := 0;"),
VSTR(" line_number_of_saved_tok_line2 := 0;"),
VSTR("-- END OF UMASS CODES."),
VSTR(" end if; -- yy_init"),
VSTR(""),
VSTR(" loop -- loops until end-of-file is reached"),
VSTR(""),
VSTR("-- UMASS CODES :"),
VSTR("-- if last matched token is end_of_line, we must"),
VSTR("-- update the token_end_line and reset tok_end_col."),
VSTR(" if Token_At_End_Of_Line then"),
VSTR(" Tok_End_Line := Tok_End_Line + 1;"),
VSTR(" Tok_End_Col := 0;"),
VSTR(" Token_At_End_Of_Line := False;"),
VSTR(" end if;"),
VSTR("-- END OF UMASS CODES."),
VSTR(""),
VSTR(" yy_cp := yy_c_buf_p;"),
VSTR(""),
VSTR(" -- support of yytext"),
VSTR(" yy_ch_buf(yy_cp) := yy_hold_char;"),
VSTR(""),
VSTR(" -- yy_bp points to the position in yy_ch_buf of the start of the"),
VSTR(" -- current run."),
VSTR("%%"),
-- BEGIN S5
VSTR(""),
VSTR("<<next_action>>"),
VSTR("%% call to gen_find_action goes here"),
-- BEGIN S6
VSTR(" YY_DO_BEFORE_ACTION;"),
VSTR(" YY_USER_ACTION;"),
VSTR(""),
VSTR(" if aflex_debug then -- output acceptance info. for (-d) debug mode"),
VSTR(" text_io.put( Standard_Error, ""--accepting rule #"" );"),
VSTR(" text_io.put( Standard_Error, INTEGER'IMAGE(yy_act) );"),
VSTR(" text_io.put_line( Standard_Error, ""("""""" & yytext & """""")"");"),
VSTR(" end if;"),
VSTR(""),
VSTR("-- UMASS CODES :"),
VSTR("-- Update tok_begin_line, tok_end_line, tok_begin_col and tok_end_col"),
VSTR("-- after matching the token."),
VSTR(" if yy_act /= YY_END_OF_BUFFER and then yy_act /= 0 then"),
VSTR("-- Token are matched only when yy_act is not yy_end_of_buffer or 0."),
VSTR(" Tok_Begin_Line := Tok_End_Line;"),
VSTR(" Tok_Begin_Col := Tok_End_Col + 1;"),
VSTR(" Tok_End_Col := Tok_Begin_Col + yy_cp - yy_bp - 1;"),
VSTR(" if yy_ch_buf ( yy_bp ) = ASCII.LF then"),
VSTR(" Token_At_End_Of_Line := True;"),
VSTR(" end if;"),
VSTR(" end if;"),
VSTR("-- END OF UMASS CODES."),
VSTR(""),
VSTR("<<do_action>> -- this label is used only to access EOF actions"),
VSTR(" case yy_act is"), VSTR("%% actions go here"),
-- BEGIN S7
VSTR(" when YY_END_OF_BUFFER =>"),
VSTR(" -- undo the effects of YY_DO_BEFORE_ACTION"),
VSTR(" yy_ch_buf(yy_cp) := yy_hold_char;"),
VSTR(""),
VSTR(" yytext_ptr := yy_bp;"), VSTR(""),
VSTR(" case yy_get_next_buffer is"),
VSTR(" when EOB_ACT_END_OF_FILE =>"),
VSTR(" begin"),
VSTR(" if ( yywrap ) then"),
VSTR(" -- note: because we've taken care in"),
VSTR(" -- yy_get_next_buffer() to have set up yytext,"),
VSTR(" -- we can now set up yy_c_buf_p so that if some"),
VSTR(" -- total hoser (like aflex itself) wants"),
VSTR(" -- to call the scanner after we return the"),
VSTR(" -- End_Of_Input, it'll still work - another"),
VSTR(" -- End_Of_Input will get returned."),
VSTR(""),
VSTR(" yy_c_buf_p := yytext_ptr;"),
VSTR(""),
VSTR(" yy_act := YY_STATE_EOF((yy_start - 1) / 2);"),
VSTR(""),
VSTR(" goto do_action;"),
VSTR(" else"),
VSTR(" -- start processing a new file"),
VSTR(" yy_init := true;"),
VSTR(" goto new_file;"),
VSTR(" end if;"),
VSTR(" end;"),
VSTR(" when EOB_ACT_RESTART_SCAN =>"),
VSTR(" yy_c_buf_p := yytext_ptr;"),
VSTR(" yy_hold_char := yy_ch_buf(yy_c_buf_p);"),
VSTR(" when EOB_ACT_LAST_MATCH =>"),
VSTR(" yy_c_buf_p := yy_n_chars;"),
VSTR(" yy_current_state := yy_get_previous_state;"),
VSTR(""),
VSTR(" yy_cp := yy_c_buf_p;"),
VSTR(" yy_bp := yytext_ptr;"),
VSTR(" goto next_action;"),
VSTR(" when others => null;"),
VSTR(" end case; -- case yy_get_next_buffer()"),
VSTR(" when others =>"),
VSTR(" text_io.put( ""action # "" );"),
VSTR(" text_io.put( INTEGER'IMAGE(yy_act) );"),
VSTR(" text_io.new_line;"),
VSTR(" raise AFLEX_INTERNAL_ERROR;"),
VSTR(" end case; -- case (yy_act)"),
VSTR(" end loop; -- end of loop waiting for end of file"),
VSTR("end YYLex;"),
VSTR("%%"),
VSTR("ERROR tried to output beyond end of skeleton file")
-- END OF SKELETON
);
-- set_external_skeleton
--
-- DESCRIPTION
-- sets flag so we know to use an external skelfile
procedure SET_EXTERNAL_SKELETON is
begin
USE_EXTERNAL_SKELETON := TRUE;
end SET_EXTERNAL_SKELETON;
procedure GET_INTERNAL(BUFFER : in out FILE_STRING.VSTRING) is
begin
BUFFER := SKEL_TEMPLATE(CURRENT_LINE);
CURRENT_LINE := CURRENT_LINE + 1;
end GET_INTERNAL;
procedure GET_EXTERNAL(BUFFER : in out FILE_STRING.VSTRING) is
begin
FILE_STRING.GET_LINE(MISC_DEFS.SKELFILE, BUFFER);
end GET_EXTERNAL;
-- end_of_skeleton
--
-- DESCRIPTION
-- returns true if there are no more lines left to output in the skeleton
function END_OF_SKELETON return BOOLEAN is
begin
if (USE_EXTERNAL_SKELETON) then
-- we're using an external skelfile
return TEXT_IO.END_OF_FILE(MISC_DEFS.SKELFILE);
else
-- internal skeleton
return CURRENT_LINE > SKEL_TEMPLATE'LAST;
end if;
end END_OF_SKELETON;
procedure GET_FILE_LINE(BUFFER : in out FILE_STRING.VSTRING) is
begin
if (USE_EXTERNAL_SKELETON) then
GET_EXTERNAL(BUFFER);
else
GET_INTERNAL(BUFFER);
end if;
end GET_FILE_LINE;
-- skelout - write out one section of the skeleton file
--
-- DESCRIPTION
-- Either outputs internal skeleton, or from a file with "%%" dividers
-- if a skeleton file is specified by the user.
-- Copies from skelfile to stdout until a line beginning with "%%" or
-- EOF is found.
procedure SKELOUT is
BUF : FILE_STRING.VSTRING;
LINE_LEN : INTEGER;
-- UMASS CODES :
Umass_Codes : Boolean := False;
-- Indicates whether or not current line of the template
-- is the Umass codes.
-- END OF UMASS CODES.
begin
while (not END_OF_SKELETON) loop
GET_FILE_LINE(BUF);
if ((FILE_STRING.LEN(BUF) >= 2)
and then ((FILE_STRING.CHAR(BUF, 1) = '%')
and (FILE_STRING.CHAR(BUF, 2) = '%'))) then
exit;
else
-- UMASS CODES :
-- In the template, the codes between "-- UMASS CODES : " and
-- "-- END OF UMASS CODES." are specific to be used by Ayacc
-- extension. Ayacc extension has more power in error recovery.
-- So we generate those codes only when Ayacc_Extension_Flag is True.
if FILE_STRING.STR(BUF) = "-- UMASS CODES :" then
Umass_Codes := True;
end if;
if not Umass_Codes or else
MISC_DEFS.Ayacc_Extension_Flag then
FILE_STRING.PUT_LINE(BUF);
end if;
if FILE_STRING.STR(BUF) = "-- END OF UMASS CODES." then
Umass_Codes := False;
end if;
-- END OF UMASS CODES.
-- UCI CODES commented out :
-- The following line is commented out because it is done in Umass codes.
-- FILE_STRING.PUT_LINE(BUF);
end if;
end loop;
end SKELOUT;
end skeleton_manager;
|
AdaCore/Ada_Drivers_Library | Ada | 3,095 | ads | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2022, 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. --
-- --
------------------------------------------------------------------------------
-- sample definitions for custom characters
package LCD_HD44780.Custom_Characters is
--
-- Sample Custom Characters
--
Filled_Heart : constant Custom_Character_Definition :=
(2#00000#,
2#00000#,
2#01010#,
2#11111#,
2#11111#,
2#11111#,
2#01110#,
2#00100#);
Open_Heart : constant Custom_Character_Definition :=
(2#00000#,
2#00000#,
2#01010#,
2#10101#,
2#10001#,
2#10001#,
2#01010#,
2#00100#);
Thermometer : constant Custom_Character_Definition :=
(2#00100#,
2#01010#,
2#01010#,
2#01010#,
2#01010#,
2#10001#,
2#10001#,
2#01110#);
end LCD_HD44780.Custom_Characters;
|
zhmu/ananas | Ada | 511 | adb | with Inline16_Types; use Inline16_Types;
package body Inline16_Gen
with SPARK_Mode => On
is
procedure Gfw_Image_Read (Data : out Payload_Type)
with SPARK_Mode => Off
is
Array_Len : constant NvU32 := Data'Size / NvU8'Size;
Array_Max_Idx : constant NvU32 := Array_Len - 1;
type Payload_As_Arr_Type is new Arr_NvU8_Idx32(0 .. Array_Max_Idx);
Data_As_Array : Payload_As_Arr_Type with Address => Data'Address;
begin
null;
end Gfw_Image_Read;
end Inline16_Gen;
|
reznikmm/matreshka | Ada | 3,671 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2015, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Asis;
with Engines.Contexts;
with League.Strings;
package Properties.Statements.Extended_Return is
function Code
(Engine : access Engines.Contexts.Context;
Element : Asis.Expression;
Name : Engines.Text_Property) return League.Strings.Universal_String;
end Properties.Statements.Extended_Return;
|
Fabien-Chouteau/samd51-hal | Ada | 3,132 | ads | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2020, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with HAL; use HAL;
private with SAM_SVD.QSPI;
package SAM.QSPI is
procedure Enable;
procedure Reset;
procedure Configure (Baud : UInt8);
procedure Run (Command : UInt8);
procedure Read (Command : UInt8; Data : out UInt8_Array);
procedure Write (Command : UInt8; Data : in out UInt8_Array);
procedure Erase (Command : UInt8; Addr : UInt32);
procedure Read_Memory (Addr : UInt32; Data : out UInt8_Array);
procedure Write_Memory (Addr : UInt32; Data : in out UInt8_Array);
private
procedure Run_Instruction (Command : UInt8;
Iframe : SAM_SVD.QSPI.QSPI_INSTRFRAME_Register;
Addr : UInt32;
Buffer : in out UInt8_Array);
end SAM.QSPI;
|
reznikmm/matreshka | Ada | 3,398 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Testsuite Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
package XMLCatConf is
pragma Pure;
end XMLCatConf;
|
reznikmm/matreshka | Ada | 4,157 | 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 Matreshka.ODF_Documents;
with ODF.DOM.Office_Document_Content_Elements;
with ODF.DOM.Office_Document_Styles_Elements;
with ODF.DOM.Packages;
package Matreshka.ODF_Packages is
type Package_Node is
new Matreshka.ODF_Documents.Document_Node
and ODF.DOM.Packages.ODF_Package with null record;
overriding function Get_Styles
(Self : not null access constant Package_Node)
return ODF.DOM.Office_Document_Styles_Elements.ODF_Office_Document_Styles_Access;
overriding function Get_Content
(Self : not null access constant Package_Node)
return ODF.DOM.Office_Document_Content_Elements.ODF_Office_Document_Content_Access;
package Constructors is
procedure Initialize (Self : not null access Package_Node'Class);
end Constructors;
end Matreshka.ODF_Packages;
|
AdaDoom3/wayland_ada_binding | Ada | 2,579 | ads | ------------------------------------------------------------------------------
-- Copyright (C) 2016-2017, 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 MERCHAN- --
-- TABILITY 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/>. --
-- --
------------------------------------------------------------------------------
-- This package describes the concept of property models. They are used to
-- annotate containers. Models of a map are sequences of elements indexed
-- by a discrete type. For ease of use, the content models property is
-- instantiated in the spark version of containers.
pragma Ada_2012;
package Conts.Properties.SPARK is
-----------------------------
-- Property content models --
-----------------------------
generic
type Map_Type (<>) is limited private;
type Element_Type (<>) is private;
type Model_Type is private;
type Index_Type is (<>);
with function Model (M : Map_Type) return Model_Type;
with function Get (M : Model_Type; I : Index_Type) return Element_Type;
with function First return Index_Type;
with function Last (M : Model_Type) return Index_Type;
package Content_Models with Ghost is
subtype Map is Map_Type;
subtype Element is Element_Type;
end Content_Models;
end Conts.Properties.SPARK;
|
reznikmm/matreshka | Ada | 4,089 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Text_Main_Entry_Style_Name_Attributes;
package Matreshka.ODF_Text.Main_Entry_Style_Name_Attributes is
type Text_Main_Entry_Style_Name_Attribute_Node is
new Matreshka.ODF_Text.Abstract_Text_Attribute_Node
and ODF.DOM.Text_Main_Entry_Style_Name_Attributes.ODF_Text_Main_Entry_Style_Name_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Text_Main_Entry_Style_Name_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Text_Main_Entry_Style_Name_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Text.Main_Entry_Style_Name_Attributes;
|
reznikmm/matreshka | Ada | 3,744 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Number_Display_Factor_Attributes is
pragma Preelaborate;
type ODF_Number_Display_Factor_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Number_Display_Factor_Attribute_Access is
access all ODF_Number_Display_Factor_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Number_Display_Factor_Attributes;
|
AdaCore/langkit | Ada | 235 | ads | package Libfoolang.Implementation.Extensions is
function Literal_P_Result (Node : Bare_Literal) return Integer;
function Name_P_Designated_Unit (Node : Bare_Name) return Internal_Unit;
end Libfoolang.Implementation.Extensions;
|
RREE/ada-util | Ada | 3,863 | adb | -----------------------------------------------------------------------
-- util-log-appenders-consoles -- Console log appenders
-- Copyright (C) 2001 - 2019, 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.Text_IO;
with Util.Beans.Objects;
with Util.Properties.Basic;
with Util.Log.Appenders.Formatter;
package body Util.Log.Appenders.Consoles is
use Ada;
overriding
procedure Append (Self : in out Console_Appender;
Message : in Util.Strings.Builders.Builder;
Date : in Ada.Calendar.Time;
Level : in Level_Type;
Logger : in String) is
procedure Write_Standard_Output (Data : in String) with Inline_Always;
procedure Write_Standard_Error (Data : in String) with Inline_Always;
procedure Write_Standard_Output (Data : in String) is
begin
-- Don't use Text_IO.Standard_Output so that we honor the Set_Output definition.
Text_IO.Put (Data);
end Write_Standard_Output;
procedure Write_Standard_Error (Data : in String) is
begin
Text_IO.Put (Text_IO.Current_Error, Data);
end Write_Standard_Error;
procedure Write_Output is new Formatter (Write_Standard_Output);
procedure Write_Error is new Formatter (Write_Standard_Error);
begin
if Self.Level >= Level then
if Self.Stderr then
if not Util.Beans.Objects.Is_Null (Self.Prefix) then
Text_IO.Put (Text_IO.Current_Error,
Util.Beans.Objects.To_String (Self.Prefix));
end if;
Write_Error (Self, Message, Date, Level, Logger);
Text_IO.New_Line (Text_IO.Current_Error);
else
Write_Output (Self, Message, Date, Level, Logger);
Text_IO.New_Line;
end if;
end if;
end Append;
-- ------------------------------
-- Flush the log events.
-- ------------------------------
overriding
procedure Flush (Self : in out Console_Appender) is
begin
if Self.Stderr then
Text_IO.Flush (Text_IO.Current_Error);
else
Text_IO.Flush;
end if;
end Flush;
-- ------------------------------
-- Create a console appender and configure it according to the properties
-- ------------------------------
function Create (Name : in String;
Properties : in Util.Properties.Manager;
Default : in Level_Type)
return Appender_Access is
use Util.Properties.Basic;
Result : constant Console_Appender_Access
:= new Console_Appender '(Finalization.Limited_Controlled with Length => Name'Length,
Name => Name,
others => <>);
begin
Result.Set_Level (Name, Properties, Default);
Result.Set_Layout (Name, Properties, FULL);
Result.Prefix := Properties.Get_Value ("appender." & Name & ".prefix");
Result.Stderr := Boolean_Property.Get (Properties, "appender." & Name & ".stderr", False);
return Result.all'Access;
end Create;
end Util.Log.Appenders.Consoles;
|
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.Elements;
package ODF.DOM.Db_Table_Exclude_Filter_Elements is
pragma Preelaborate;
type ODF_Db_Table_Exclude_Filter is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Db_Table_Exclude_Filter_Access is
access all ODF_Db_Table_Exclude_Filter'Class
with Storage_Size => 0;
end ODF.DOM.Db_Table_Exclude_Filter_Elements;
|
persan/A-gst | Ada | 24,551 | ads | pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h;
with glib;
with glib.Values;
with System;
with GStreamer.GST_Low_Level.gstreamer_0_10_gst_audio_multichannel_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h;
with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstformat_h;
limited 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_gstclock_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gststructure_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstsegment_h;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_audio_audio_h is
-- arg-macro: function GST_AUDIO_FORMAT_INFO_FORMAT (info)
-- return (info).format;
-- arg-macro: function GST_AUDIO_FORMAT_INFO_NAME (info)
-- return (info).name;
-- arg-macro: function GST_AUDIO_FORMAT_INFO_FLAGS (info)
-- return (info).flags;
-- arg-macro: procedure GST_AUDIO_FORMAT_INFO_IS_INTEGER (info)
-- notnot((info).flags and GST_AUDIO_FORMAT_FLAG_INTEGER)
-- arg-macro: procedure GST_AUDIO_FORMAT_INFO_IS_FLOAT (info)
-- notnot((info).flags and GST_AUDIO_FORMAT_FLAG_FLOAT)
-- arg-macro: procedure GST_AUDIO_FORMAT_INFO_IS_SIGNED (info)
-- notnot((info).flags and GST_AUDIO_FORMAT_FLAG_SIGNED)
-- arg-macro: function GST_AUDIO_FORMAT_INFO_ENDIANNESS (info)
-- return (info).endianness;
-- arg-macro: function GST_AUDIO_FORMAT_INFO_IS_LITTLE_ENDIAN (info)
-- return (info).endianness = G_LITTLE_ENDIAN;
-- arg-macro: function GST_AUDIO_FORMAT_INFO_IS_BIG_ENDIAN (info)
-- return (info).endianness = G_BIG_ENDIAN;
-- arg-macro: function GST_AUDIO_FORMAT_INFO_WIDTH (info)
-- return (info).width;
-- arg-macro: function GST_AUDIO_FORMAT_INFO_DEPTH (info)
-- return (info).depth;
-- arg-macro: function GST_AUDIO_INFO_IS_VALID (i)
-- return (i).finfo /= NULL and then (i).rate > 0 and then (i).channels > 0 and then (i).bpf > 0;
-- arg-macro: function GST_AUDIO_INFO_FORMAT (i)
-- return GST_AUDIO_FORMAT_INFO_FORMAT((i).finfo);
-- arg-macro: function GST_AUDIO_INFO_NAME (i)
-- return GST_AUDIO_FORMAT_INFO_NAME((i).finfo);
-- arg-macro: function GST_AUDIO_INFO_WIDTH (i)
-- return GST_AUDIO_FORMAT_INFO_WIDTH((i).finfo);
-- arg-macro: function GST_AUDIO_INFO_DEPTH (i)
-- return GST_AUDIO_FORMAT_INFO_DEPTH((i).finfo);
-- arg-macro: function GST_AUDIO_INFO_BPS (info)
-- return GST_AUDIO_INFO_DEPTH(info) >> 3;
-- arg-macro: function GST_AUDIO_INFO_IS_INTEGER (i)
-- return GST_AUDIO_FORMAT_INFO_IS_INTEGER((i).finfo);
-- arg-macro: function GST_AUDIO_INFO_IS_FLOAT (i)
-- return GST_AUDIO_FORMAT_INFO_IS_FLOAT((i).finfo);
-- arg-macro: function GST_AUDIO_INFO_IS_SIGNED (i)
-- return GST_AUDIO_FORMAT_INFO_IS_SIGNED((i).finfo);
-- arg-macro: function GST_AUDIO_INFO_ENDIANNESS (i)
-- return GST_AUDIO_FORMAT_INFO_ENDIANNES((i).finfo);
-- arg-macro: function GST_AUDIO_INFO_IS_LITTLE_ENDIAN (i)
-- return GST_AUDIO_FORMAT_INFO_IS_LITTLE_ENDIAN((i).finfo);
-- arg-macro: function GST_AUDIO_INFO_IS_BIG_ENDIAN (i)
-- return GST_AUDIO_FORMAT_INFO_IS_BIG_ENDIAN((i).finfo);
-- arg-macro: function GST_AUDIO_INFO_FLAGS (info)
-- return (info).flags;
-- arg-macro: function GST_AUDIO_INFO_HAS_DEFAULT_POSITIONS (info)
-- return (info).flags and GST_AUDIO_FLAG_DEFAULT_POSITIONS;
-- arg-macro: function GST_AUDIO_INFO_RATE (info)
-- return (info).rate;
-- arg-macro: function GST_AUDIO_INFO_CHANNELS (info)
-- return (info).channels;
-- arg-macro: function GST_AUDIO_INFO_BPF (info)
-- return (info).bpf;
-- arg-macro: function GST_AUDIO_INFO_POSITION (info, c)
-- return (info).position(c);
-- arg-macro: function GST_FRAMES_TO_CLOCK_TIME (frames, rate)
-- return (GstClockTime) gst_util_uint64_scale_round (frames, GST_SECOND, rate);
-- arg-macro: procedure GST_CLOCK_TIME_TO_FRAMES (clocktime, rate)
-- gst_util_uint64_scale_round (clocktime, rate, GST_SECOND)
GST_AUDIO_DEF_RATE : constant := 44100; -- gst/audio/audio.h:340
GST_AUDIO_INT_PAD_TEMPLATE_CAPS : aliased constant String := "audio/x-raw-int, " & "rate = (int) [ 1, MAX ], " & "channels = (int) [ 1, MAX ], " & "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " & "width = (int) { 8, 16, 24, 32 }, " & "depth = (int) [ 1, 32 ], " & "signed = (boolean) { true, false }" & ASCII.NUL; -- gst/audio/audio.h:348
GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS : aliased constant String := "audio/x-raw-int, " & "rate = (int) [ 1, MAX ], " & "channels = (int) 2, " & "endianness = (int) BYTE_ORDER, " & "width = (int) 16, " & "depth = (int) 16, " & "signed = (boolean) true" & ASCII.NUL; -- gst/audio/audio.h:363
GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS : aliased constant String := "audio/x-raw-float, " & "rate = (int) [ 1, MAX ], " & "channels = (int) [ 1, MAX ], " & "endianness = (int) { LITTLE_ENDIAN , BIG_ENDIAN }, " & "width = (int) { 32, 64 }" & ASCII.NUL; -- gst/audio/audio.h:378
GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS : aliased constant String := "audio/x-raw-float, " & "width = (int) 32, " & "rate = (int) [ 1, MAX ], " & "channels = (int) 1, " & "endianness = (int) BYTE_ORDER" & ASCII.NUL; -- gst/audio/audio.h:391
-- GStreamer
-- * Copyright (C) <1999> Erik Walthinsen <[email protected]>
-- * Library <2001> Thomas Vander Stichele <[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.
--
--*
-- * GstAudioFormat:
-- * @GST_AUDIO_FORMAT_UNKNOWN: unknown audio format
-- * @GST_AUDIO_FORMAT_S8: 8 bits in 8 bits, signed
-- * @GST_AUDIO_FORMAT_U8: 8 bits in 8 bits, unsigned
-- * @GST_AUDIO_FORMAT_S16LE: 16 bits in 16 bits, signed, little endian
-- * @GST_AUDIO_FORMAT_S16BE: 16 bits in 16 bits, signed, big endian
-- * @GST_AUDIO_FORMAT_U16LE: 16 bits in 16 bits, unsigned, little endian
-- * @GST_AUDIO_FORMAT_U16BE: 16 bits in 16 bits, unsigned, big endian
-- * @GST_AUDIO_FORMAT_S24_32LE: 24 bits in 32 bits, signed, little endian
-- * @GST_AUDIO_FORMAT_S24_32BE: 24 bits in 32 bits, signed, big endian
-- * @GST_AUDIO_FORMAT_U24_32LE: 24 bits in 32 bits, unsigned, little endian
-- * @GST_AUDIO_FORMAT_U24_32BE: 24 bits in 32 bits, unsigned, big endian
-- * @GST_AUDIO_FORMAT_S32LE: 32 bits in 32 bits, signed, little endian
-- * @GST_AUDIO_FORMAT_S32BE: 32 bits in 32 bits, signed, big endian
-- * @GST_AUDIO_FORMAT_U32LE: 32 bits in 32 bits, unsigned, little endian
-- * @GST_AUDIO_FORMAT_U32BE: 32 bits in 32 bits, unsigned, big endian
-- * @GST_AUDIO_FORMAT_S24LE: 24 bits in 24 bits, signed, little endian
-- * @GST_AUDIO_FORMAT_S24BE: 24 bits in 24 bits, signed, big endian
-- * @GST_AUDIO_FORMAT_U24LE: 24 bits in 24 bits, unsigned, little endian
-- * @GST_AUDIO_FORMAT_U24BE: 24 bits in 24 bits, unsigned, big endian
-- * @GST_AUDIO_FORMAT_S20LE: 20 bits in 24 bits, signed, little endian
-- * @GST_AUDIO_FORMAT_S20BE: 20 bits in 24 bits, signed, big endian
-- * @GST_AUDIO_FORMAT_U20LE: 20 bits in 24 bits, unsigned, little endian
-- * @GST_AUDIO_FORMAT_U20BE: 20 bits in 24 bits, unsigned, big endian
-- * @GST_AUDIO_FORMAT_S18LE: 18 bits in 24 bits, signed, little endian
-- * @GST_AUDIO_FORMAT_S18BE: 18 bits in 24 bits, signed, big endian
-- * @GST_AUDIO_FORMAT_U18LE: 18 bits in 24 bits, unsigned, little endian
-- * @GST_AUDIO_FORMAT_U18BE: 18 bits in 24 bits, unsigned, big endian
-- * @GST_AUDIO_FORMAT_F32LE: 32-bit floating point samples, little endian
-- * @GST_AUDIO_FORMAT_F32BE: 32-bit floating point samples, big endian
-- * @GST_AUDIO_FORMAT_F64LE: 64-bit floating point samples, little endian
-- * @GST_AUDIO_FORMAT_F64BE: 64-bit floating point samples, big endian
-- * @GST_AUDIO_FORMAT_S16: 16 bits in 16 bits, signed, native endianness
-- * @GST_AUDIO_FORMAT_U16: 16 bits in 16 bits, unsigned, native endianness
-- * @GST_AUDIO_FORMAT_S24_32: 24 bits in 32 bits, signed, native endianness
-- * @GST_AUDIO_FORMAT_U24_32: 24 bits in 32 bits, unsigned, native endianness
-- * @GST_AUDIO_FORMAT_S32: 32 bits in 32 bits, signed, native endianness
-- * @GST_AUDIO_FORMAT_U32: 32 bits in 32 bits, unsigned, native endianness
-- * @GST_AUDIO_FORMAT_S24: 24 bits in 24 bits, signed, native endianness
-- * @GST_AUDIO_FORMAT_U24: 24 bits in 24 bits, unsigned, native endianness
-- * @GST_AUDIO_FORMAT_S20: 20 bits in 24 bits, signed, native endianness
-- * @GST_AUDIO_FORMAT_U20: 20 bits in 24 bits, unsigned, native endianness
-- * @GST_AUDIO_FORMAT_S18: 18 bits in 24 bits, signed, native endianness
-- * @GST_AUDIO_FORMAT_U18: 18 bits in 24 bits, unsigned, native endianness
-- * @GST_AUDIO_FORMAT_F32: 32-bit floating point samples, native endianness
-- * @GST_AUDIO_FORMAT_F64: 64-bit floating point samples, native endianness
-- *
-- * Enum value describing the most common audio formats.
-- *
-- * Since: 0.10.36
--
-- 8 bit
-- 16 bit
-- 24 bit in low 3 bytes of 32 bits
-- 32 bit
-- 24 bit in 3 bytes
-- 20 bit in 3 bytes
-- 18 bit in 3 bytes
-- float
-- native endianness equivalents
subtype GstAudioFormat is unsigned;
GST_AUDIO_FORMAT_UNKNOWN : constant GstAudioFormat := 0;
GST_AUDIO_FORMAT_S8 : constant GstAudioFormat := 1;
GST_AUDIO_FORMAT_U8 : constant GstAudioFormat := 2;
GST_AUDIO_FORMAT_S16LE : constant GstAudioFormat := 3;
GST_AUDIO_FORMAT_S16BE : constant GstAudioFormat := 4;
GST_AUDIO_FORMAT_U16LE : constant GstAudioFormat := 5;
GST_AUDIO_FORMAT_U16BE : constant GstAudioFormat := 6;
GST_AUDIO_FORMAT_S24_32LE : constant GstAudioFormat := 7;
GST_AUDIO_FORMAT_S24_32BE : constant GstAudioFormat := 8;
GST_AUDIO_FORMAT_U24_32LE : constant GstAudioFormat := 9;
GST_AUDIO_FORMAT_U24_32BE : constant GstAudioFormat := 10;
GST_AUDIO_FORMAT_S32LE : constant GstAudioFormat := 11;
GST_AUDIO_FORMAT_S32BE : constant GstAudioFormat := 12;
GST_AUDIO_FORMAT_U32LE : constant GstAudioFormat := 13;
GST_AUDIO_FORMAT_U32BE : constant GstAudioFormat := 14;
GST_AUDIO_FORMAT_S24LE : constant GstAudioFormat := 15;
GST_AUDIO_FORMAT_S24BE : constant GstAudioFormat := 16;
GST_AUDIO_FORMAT_U24LE : constant GstAudioFormat := 17;
GST_AUDIO_FORMAT_U24BE : constant GstAudioFormat := 18;
GST_AUDIO_FORMAT_S20LE : constant GstAudioFormat := 19;
GST_AUDIO_FORMAT_S20BE : constant GstAudioFormat := 20;
GST_AUDIO_FORMAT_U20LE : constant GstAudioFormat := 21;
GST_AUDIO_FORMAT_U20BE : constant GstAudioFormat := 22;
GST_AUDIO_FORMAT_S18LE : constant GstAudioFormat := 23;
GST_AUDIO_FORMAT_S18BE : constant GstAudioFormat := 24;
GST_AUDIO_FORMAT_U18LE : constant GstAudioFormat := 25;
GST_AUDIO_FORMAT_U18BE : constant GstAudioFormat := 26;
GST_AUDIO_FORMAT_F32LE : constant GstAudioFormat := 27;
GST_AUDIO_FORMAT_F32BE : constant GstAudioFormat := 28;
GST_AUDIO_FORMAT_F64LE : constant GstAudioFormat := 29;
GST_AUDIO_FORMAT_F64BE : constant GstAudioFormat := 30;
GST_AUDIO_FORMAT_S16 : constant GstAudioFormat := 3;
GST_AUDIO_FORMAT_U16 : constant GstAudioFormat := 5;
GST_AUDIO_FORMAT_S24_32 : constant GstAudioFormat := 7;
GST_AUDIO_FORMAT_U24_32 : constant GstAudioFormat := 9;
GST_AUDIO_FORMAT_S32 : constant GstAudioFormat := 11;
GST_AUDIO_FORMAT_U32 : constant GstAudioFormat := 13;
GST_AUDIO_FORMAT_S24 : constant GstAudioFormat := 15;
GST_AUDIO_FORMAT_U24 : constant GstAudioFormat := 17;
GST_AUDIO_FORMAT_S20 : constant GstAudioFormat := 19;
GST_AUDIO_FORMAT_U20 : constant GstAudioFormat := 21;
GST_AUDIO_FORMAT_S18 : constant GstAudioFormat := 23;
GST_AUDIO_FORMAT_U18 : constant GstAudioFormat := 25;
GST_AUDIO_FORMAT_F32 : constant GstAudioFormat := 27;
GST_AUDIO_FORMAT_F64 : constant GstAudioFormat := 29; -- gst/audio/audio.h:143
-- FIXME: need GTypes
type GstAudioFormatInfo;
type u_GstAudioFormatInfo_silence_array is array (0 .. 7) of aliased GLIB.guint8;
type u_GstAudioFormatInfo_padding_i_array is array (0 .. 3) of aliased GLIB.guint;
type u_GstAudioFormatInfo_padding_p_array is array (0 .. 3) of System.Address;
--subtype GstAudioFormatInfo is u_GstAudioFormatInfo; -- gst/audio/audio.h:146
type GstAudioInfo;
type u_GstAudioInfo_position_array is array (0 .. 63) of aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_audio_multichannel_h.GstAudioChannelPosition;
--subtype GstAudioInfo is u_GstAudioInfo; -- gst/audio/audio.h:147
--*
-- * GstAudioFormatFlags:
-- * @GST_AUDIO_FORMAT_FLAG_INTEGER: integer samples
-- * @GST_AUDIO_FORMAT_FLAG_FLOAT: float samples
-- * @GST_AUDIO_FORMAT_FLAG_SIGNED: signed samples
-- * @GST_AUDIO_FORMAT_FLAG_COMPLEX: complex layout
-- *
-- * The different audio flags that a format info can have.
-- *
-- * Since: 0.10.36
--
subtype GstAudioFormatFlags is unsigned;
GST_AUDIO_FORMAT_FLAG_INTEGER : constant GstAudioFormatFlags := 1;
GST_AUDIO_FORMAT_FLAG_FLOAT : constant GstAudioFormatFlags := 2;
GST_AUDIO_FORMAT_FLAG_SIGNED : constant GstAudioFormatFlags := 4;
GST_AUDIO_FORMAT_FLAG_COMPLEX : constant GstAudioFormatFlags := 16; -- gst/audio/audio.h:166
--*
-- * GstAudioFormatInfo:
-- * @format: #GstAudioFormat
-- * @name: string representation of the format
-- * @flags: #GstAudioFormatFlags
-- * @endianness: the endianness
-- * @width: amount of bits used for one sample
-- * @depth: amount of valid bits in @width
-- * @silence: @width/8 bytes with 1 silent sample
-- *
-- * Information for an audio format.
-- *
-- * Since: 0.10.36
--
type GstAudioFormatInfo is record
format : aliased GstAudioFormat; -- gst/audio/audio.h:183
name : access GLIB.gchar; -- gst/audio/audio.h:184
flags : aliased GstAudioFormatFlags; -- gst/audio/audio.h:185
endianness : aliased GLIB.gint; -- gst/audio/audio.h:186
width : aliased GLIB.gint; -- gst/audio/audio.h:187
depth : aliased GLIB.gint; -- gst/audio/audio.h:188
silence : aliased u_GstAudioFormatInfo_silence_array; -- gst/audio/audio.h:189
padding_i : aliased u_GstAudioFormatInfo_padding_i_array; -- gst/audio/audio.h:191
padding_p : u_GstAudioFormatInfo_padding_p_array; -- gst/audio/audio.h:192
end record;
pragma Convention (C_Pass_By_Copy, GstAudioFormatInfo); -- gst/audio/audio.h:182
--< private >
function gst_audio_format_get_info (format : GstAudioFormat) return access constant GstAudioFormatInfo; -- gst/audio/audio.h:209
pragma Import (C, gst_audio_format_get_info, "gst_audio_format_get_info");
--*
-- * GstAudioFlags:
-- * @GST_AUDIO_FLAG_NONE: no valid flag
-- * @GST_AUDIO_FLAG_DEFAULT_POSITIONS: unpositioned audio layout, position array
-- * contains the default layout (meaning that the channel layout was not
-- * explicitly specified in the caps)
-- *
-- * Extra audio flags
-- *
-- * Since: 0.10.36
--
type GstAudioFlags is
(GST_AUDIO_FLAG_NONE,
GST_AUDIO_FLAG_DEFAULT_POSITIONS);
pragma Convention (C, GstAudioFlags); -- gst/audio/audio.h:225
--*
-- * GstAudioInfo:
-- * @finfo: the format info of the audio
-- * @flags: additional audio flags
-- * @rate: the audio sample rate
-- * @channels: the number of channels
-- * @bpf: the number of bytes for one frame, this is the size of one
-- * sample * @channels
-- * @position: the position for each channel (assume all NONE for >64 channels)
-- *
-- * Information describing audio properties. This information can be filled
-- * in from GstCaps with gst_audio_info_from_caps().
-- *
-- * Use the provided macros to access the info in this structure.
-- *
-- * Since: 0.10.36
--
type GstAudioInfo is record
finfo : access constant GstAudioFormatInfo; -- gst/audio/audio.h:245
flags : aliased GstAudioFlags; -- gst/audio/audio.h:246
rate : aliased GLIB.gint; -- gst/audio/audio.h:247
channels : aliased GLIB.gint; -- gst/audio/audio.h:248
bpf : aliased GLIB.gint; -- gst/audio/audio.h:249
position : aliased u_GstAudioInfo_position_array; -- gst/audio/audio.h:250
end record;
pragma Convention (C_Pass_By_Copy, GstAudioInfo); -- gst/audio/audio.h:244
procedure gst_audio_info_init (info : access GstAudioInfo); -- gst/audio/audio.h:277
pragma Import (C, gst_audio_info_init, "gst_audio_info_init");
procedure gst_audio_info_clear (info : access GstAudioInfo); -- gst/audio/audio.h:278
pragma Import (C, gst_audio_info_clear, "gst_audio_info_clear");
function gst_audio_info_copy (info : access GstAudioInfo) return access GstAudioInfo; -- gst/audio/audio.h:280
pragma Import (C, gst_audio_info_copy, "gst_audio_info_copy");
procedure gst_audio_info_free (info : access GstAudioInfo); -- gst/audio/audio.h:281
pragma Import (C, gst_audio_info_free, "gst_audio_info_free");
function gst_audio_info_from_caps (info : access GstAudioInfo; caps : access constant GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return GLIB.gboolean; -- gst/audio/audio.h:283
pragma Import (C, gst_audio_info_from_caps, "gst_audio_info_from_caps");
function gst_audio_info_to_caps (info : access GstAudioInfo) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; -- gst/audio/audio.h:284
pragma Import (C, gst_audio_info_to_caps, "gst_audio_info_to_caps");
function gst_audio_info_convert
(info : access GstAudioInfo;
src_fmt : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstformat_h.GstFormat;
src_val : GLIB.gint64;
dest_fmt : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstformat_h.GstFormat;
dest_val : access GLIB.gint64) return GLIB.gboolean; -- gst/audio/audio.h:286
pragma Import (C, gst_audio_info_convert, "gst_audio_info_convert");
-- For people that are looking at this source: the purpose of these defines is
-- * to make GstCaps a bit easier, in that you don't have to know all of the
-- * properties that need to be defined. you can just use these macros. currently
-- * (8/01) the only plugins that use these are the passthrough, speed, volume,
-- * adder, and [de]interleave plugins. These are for convenience only, and do not
-- * specify the 'limits' of GStreamer. you might also use these definitions as a
-- * base for making your own caps, if need be.
-- *
-- * For example, to make a source pad that can output streams of either mono
-- * float or any channel int:
-- *
-- * template = gst_pad_template_new
-- * ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
-- * gst_caps_append(gst_caps_new ("sink_int", "audio/x-raw-int",
-- * GST_AUDIO_INT_PAD_TEMPLATE_PROPS),
-- * gst_caps_new ("sink_float", "audio/x-raw-float",
-- * GST_AUDIO_FLOAT_PAD_TEMPLATE_PROPS)),
-- * NULL);
-- *
-- * sinkpad = gst_pad_new_from_template(template, "sink");
-- *
-- * Andy Wingo, 18 August 2001
-- * Thomas, 6 September 2002
-- conversion macros
--*
-- * GST_FRAMES_TO_CLOCK_TIME:
-- * @frames: sample frames
-- * @rate: sampling rate
-- *
-- * Calculate clocktime from sample @frames and @rate.
--
--*
-- * GST_CLOCK_TIME_TO_FRAMES:
-- * @clocktime: clock time
-- * @rate: sampling rate
-- *
-- * Calculate frames from @clocktime and sample @rate.
--
--*
-- * GST_AUDIO_DEF_RATE:
-- *
-- * Standard sampling rate used in consumer audio.
--
--*
-- * GST_AUDIO_INT_PAD_TEMPLATE_CAPS:
-- *
-- * Template caps for integer audio. Can be used when defining a
-- * #GstStaticPadTemplate
--
--*
-- * GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS:
-- *
-- * Template caps for 16bit integer stereo audio in native byte-order.
-- * Can be used when defining a #GstStaticPadTemplate
--
--*
-- * GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS:
-- *
-- * Template caps for float audio. Can be used when defining a
-- * #GstStaticPadTemplate
--
--*
-- * GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS:
-- *
-- * Template caps for 32bit float mono audio in native byte-order.
-- * Can be used when defining a #GstStaticPadTemplate
--
-- * this library defines and implements some helper functions for audio
-- * handling
--
-- get byte size of audio frame (based on caps of pad
function gst_audio_frame_byte_size (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return int; -- gst/audio/audio.h:404
pragma Import (C, gst_audio_frame_byte_size, "gst_audio_frame_byte_size");
-- get length in frames of buffer
function gst_audio_frame_length (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; buf : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return long; -- gst/audio/audio.h:407
pragma Import (C, gst_audio_frame_length, "gst_audio_frame_length");
function gst_audio_duration_from_pad_buffer (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; buf : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClockTime; -- gst/audio/audio.h:409
pragma Import (C, gst_audio_duration_from_pad_buffer, "gst_audio_duration_from_pad_buffer");
-- check if the buffer size is a whole multiple of the frame size
function gst_audio_is_buffer_framed (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; buf : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GLIB.gboolean; -- gst/audio/audio.h:412
pragma Import (C, gst_audio_is_buffer_framed, "gst_audio_is_buffer_framed");
-- functions useful for _getcaps functions
--*
-- * GstAudioFieldFlag:
-- * @GST_AUDIO_FIELD_RATE: add rate field to caps
-- * @GST_AUDIO_FIELD_CHANNELS: add channels field to caps
-- * @GST_AUDIO_FIELD_ENDIANNESS: add endianness field to caps
-- * @GST_AUDIO_FIELD_WIDTH: add width field to caps
-- * @GST_AUDIO_FIELD_DEPTH: add depth field to caps
-- * @GST_AUDIO_FIELD_SIGNED: add signed field to caps
-- *
-- * Do not use anymore.
-- *
-- * Deprecated: use gst_structure_set() directly
--
subtype GstAudioFieldFlag is unsigned;
GST_AUDIO_FIELD_RATE : constant GstAudioFieldFlag := 1;
GST_AUDIO_FIELD_CHANNELS : constant GstAudioFieldFlag := 2;
GST_AUDIO_FIELD_ENDIANNESS : constant GstAudioFieldFlag := 4;
GST_AUDIO_FIELD_WIDTH : constant GstAudioFieldFlag := 8;
GST_AUDIO_FIELD_DEPTH : constant GstAudioFieldFlag := 16;
GST_AUDIO_FIELD_SIGNED : constant GstAudioFieldFlag := 32; -- gst/audio/audio.h:436
procedure gst_audio_structure_set_int (structure : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gststructure_h.GstStructure; flag : GstAudioFieldFlag); -- gst/audio/audio.h:440
pragma Import (C, gst_audio_structure_set_int, "gst_audio_structure_set_int");
function gst_audio_buffer_clip
(buffer : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer;
segment : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstsegment_h.GstSegment;
rate : GLIB.gint;
frame_size : GLIB.gint) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; -- gst/audio/audio.h:443
pragma Import (C, gst_audio_buffer_clip, "gst_audio_buffer_clip");
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_audio_audio_h;
|
reznikmm/matreshka | Ada | 6,921 | 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.Cell_Address_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Table_Cell_Address_Element_Node is
begin
return Self : Table_Cell_Address_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_Cell_Address_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_Cell_Address
(ODF.DOM.Table_Cell_Address_Elements.ODF_Table_Cell_Address_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_Cell_Address_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Cell_Address_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Table_Cell_Address_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_Cell_Address
(ODF.DOM.Table_Cell_Address_Elements.ODF_Table_Cell_Address_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_Cell_Address_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_Cell_Address
(Visitor,
ODF.DOM.Table_Cell_Address_Elements.ODF_Table_Cell_Address_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.Cell_Address_Element,
Table_Cell_Address_Element_Node'Tag);
end Matreshka.ODF_Table.Cell_Address_Elements;
|
annexi-strayline/ASAP-HEX | Ada | 4,409 | ads | ------------------------------------------------------------------------------
-- --
-- Generic HEX String Handling Package --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2018-2019, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * Richard Wai, Ensi Martini, Aninda Poddar, Noshen Atashe --
-- (ANNEXI-STRAYLINE) --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- --
-- * Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- Standard, verified package to represent an 12-bit modular value
with Hex.Modular_Codec;
package Hex.Unsigned_12
with SPARK_Mode => On
is
pragma Assertion_Policy (Pre => Check,
Post => Ignore,
Assert => Ignore);
type Unsigned_12 is mod 2**12;
package Codec is new Hex.Modular_Codec
(Modular_Value => Unsigned_12,
Bit_Width => 12);
Maximum_Length: Positive renames Codec.Max_Nibbles;
function Decode (Input: String) return Unsigned_12
renames Codec.Decode;
procedure Decode (Input : in String;
Value : out Unsigned_12)
renames Codec.Decode;
function Encode (Value: Unsigned_12; Use_Case: Set_Case := Lower_Case)
return String
renames Codec.Encode;
procedure Encode (Value : in Unsigned_12;
Buffer : out String;
Use_Case: in Set_Case := Lower_Case)
renames Codec.Encode;
end Hex.Unsigned_12;
|
reznikmm/matreshka | Ada | 4,437 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Nodes.Documents;
package body XML.DOM.Nodes.Documents.Internals is
------------
-- Create --
------------
function Create
(Node : Matreshka.DOM_Nodes.Document_Access)
return XML.DOM.Nodes.Documents.DOM_Document is
begin
Matreshka.DOM_Nodes.Reference (Matreshka.DOM_Nodes.Node_Access (Node));
return
(Ada.Finalization.Controlled
with Node => Matreshka.DOM_Nodes.Node_Access (Node));
end Create;
--------------
-- Internal --
--------------
function Internal
(Document : XML.DOM.Nodes.Documents.DOM_Document'Class)
return Matreshka.DOM_Nodes.Document_Access is
begin
return Matreshka.DOM_Nodes.Document_Access (Document.Node);
end Internal;
----------
-- Wrap --
----------
function Wrap
(Node : Matreshka.DOM_Nodes.Document_Access)
return XML.DOM.Nodes.Documents.DOM_Document is
begin
return
(Ada.Finalization.Controlled
with Node => Matreshka.DOM_Nodes.Node_Access (Node));
end Wrap;
end XML.DOM.Nodes.Documents.Internals;
|
reznikmm/matreshka | Ada | 7,001 | 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.Filter_Condition_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Table_Filter_Condition_Element_Node is
begin
return Self : Table_Filter_Condition_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_Filter_Condition_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_Filter_Condition
(ODF.DOM.Table_Filter_Condition_Elements.ODF_Table_Filter_Condition_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_Filter_Condition_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Filter_Condition_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Table_Filter_Condition_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_Filter_Condition
(ODF.DOM.Table_Filter_Condition_Elements.ODF_Table_Filter_Condition_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_Filter_Condition_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_Filter_Condition
(Visitor,
ODF.DOM.Table_Filter_Condition_Elements.ODF_Table_Filter_Condition_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.Filter_Condition_Element,
Table_Filter_Condition_Element_Node'Tag);
end Matreshka.ODF_Table.Filter_Condition_Elements;
|
godunko/cga | Ada | 1,300 | adb | --
-- Copyright (C) 2023, Vadim Godunko <[email protected]>
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
--
package body CGK.Primitives.Vectors_2D is
use CGK.Primitives.XYs;
---------
-- "-" --
---------
function "-" (Self : Vector_2D) return Vector_2D is
begin
return (Coordinates => -Self.Coordinates);
end "-";
----------------------
-- Create_Vector_2D --
----------------------
function Create_Vector_2D
(X : CGK.Reals.Real; Y : CGK.Reals.Real) return Vector_2D is
begin
return (Coordinates => Create_XY (X, Y));
end Create_Vector_2D;
----------------------
-- Create_Vector_2D --
----------------------
function Create_Vector_2D
(Point_1 : CGK.Primitives.Points_2D.Point_2D;
Point_2 : CGK.Primitives.Points_2D.Point_2D) return Vector_2D is
begin
return
(Coordinates => Points_2D.XY (Point_2) - Points_2D.XY (Point_1));
end Create_Vector_2D;
-------
-- X --
-------
function X (Self : Vector_2D) return CGK.Reals.Real is
begin
return X (Self.Coordinates);
end X;
-------
-- Y --
-------
function Y (Self : Vector_2D) return CGK.Reals.Real is
begin
return Y (Self.Coordinates);
end Y;
end CGK.Primitives.Vectors_2D;
|
reznikmm/matreshka | Ada | 17,945 | 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_Fork_Nodes is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Fork_Node_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_Fork_Node
(AMF.UML.Fork_Nodes.UML_Fork_Node_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Fork_Node_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_Fork_Node
(AMF.UML.Fork_Nodes.UML_Fork_Node_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Fork_Node_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_Fork_Node
(Visitor,
AMF.UML.Fork_Nodes.UML_Fork_Node_Access (Self),
Control);
end if;
end Visit_Element;
------------------
-- Get_Activity --
------------------
overriding function Get_Activity
(Self : not null access constant UML_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_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;
------------------------
-- Is_Consistent_With --
------------------------
overriding function Is_Consistent_With
(Self : not null access constant UML_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_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_Fork_Node_Proxy.Namespace";
return Namespace (Self);
end Namespace;
end AMF.Internals.UML_Fork_Nodes;
|
reznikmm/matreshka | Ada | 4,616 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Style.Num_Prefix_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Style_Num_Prefix_Attribute_Node is
begin
return Self : Style_Num_Prefix_Attribute_Node do
Matreshka.ODF_Style.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Style_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Style_Num_Prefix_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Num_Prefix_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Style_URI,
Matreshka.ODF_String_Constants.Num_Prefix_Attribute,
Style_Num_Prefix_Attribute_Node'Tag);
end Matreshka.ODF_Style.Num_Prefix_Attributes;
|
ekoeppen/MSP430_Generic_Ada_Drivers | Ada | 13,221 | ads | -- This spec has been automatically generated from msp430g2553.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
-- USCI_A0 UART Mode
package MSP430_SVD.USCI_A0_UART_MODE is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- UCA0ABCTL_UCDELIM array
type UCA0ABCTL_UCDELIM_Field_Array is array (0 .. 1) of MSP430_SVD.Bit
with Component_Size => 1, Size => 2;
-- Type definition for UCA0ABCTL_UCDELIM
type UCA0ABCTL_UCDELIM_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- UCDELIM as a value
Val : MSP430_SVD.UInt2;
when True =>
-- UCDELIM as an array
Arr : UCA0ABCTL_UCDELIM_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for UCA0ABCTL_UCDELIM_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- USCI A0 LIN Control
type UCA0ABCTL_Register is record
-- Auto Baud Rate detect enable
UCABDEN : MSP430_SVD.Bit := 16#0#;
-- unspecified
Reserved_1_1 : MSP430_SVD.Bit := 16#0#;
-- Break Timeout error
UCBTOE : MSP430_SVD.Bit := 16#0#;
-- Sync-Field Timeout error
UCSTOE : MSP430_SVD.Bit := 16#0#;
-- Break Sync Delimiter 0
UCDELIM : UCA0ABCTL_UCDELIM_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_6_7 : MSP430_SVD.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for UCA0ABCTL_Register use record
UCABDEN at 0 range 0 .. 0;
Reserved_1_1 at 0 range 1 .. 1;
UCBTOE at 0 range 2 .. 2;
UCSTOE at 0 range 3 .. 3;
UCDELIM at 0 range 4 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
end record;
-- UCA0IRTCTL_UCIRTXPL array
type UCA0IRTCTL_UCIRTXPL_Field_Array is array (0 .. 5) of MSP430_SVD.Bit
with Component_Size => 1, Size => 6;
-- Type definition for UCA0IRTCTL_UCIRTXPL
type UCA0IRTCTL_UCIRTXPL_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- UCIRTXPL as a value
Val : MSP430_SVD.UInt6;
when True =>
-- UCIRTXPL as an array
Arr : UCA0IRTCTL_UCIRTXPL_Field_Array;
end case;
end record
with Unchecked_Union, Size => 6;
for UCA0IRTCTL_UCIRTXPL_Field use record
Val at 0 range 0 .. 5;
Arr at 0 range 0 .. 5;
end record;
-- USCI A0 IrDA Transmit Control
type UCA0IRTCTL_Register is record
-- IRDA Encoder/Decoder enable
UCIREN : MSP430_SVD.Bit := 16#0#;
-- IRDA Transmit Pulse Clock Select
UCIRTXCLK : MSP430_SVD.Bit := 16#0#;
-- IRDA Transmit Pulse Length 0
UCIRTXPL : UCA0IRTCTL_UCIRTXPL_Field :=
(As_Array => False, Val => 16#0#);
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for UCA0IRTCTL_Register use record
UCIREN at 0 range 0 .. 0;
UCIRTXCLK at 0 range 1 .. 1;
UCIRTXPL at 0 range 2 .. 7;
end record;
-- UCA0IRRCTL_UCIRRXFL array
type UCA0IRRCTL_UCIRRXFL_Field_Array is array (0 .. 5) of MSP430_SVD.Bit
with Component_Size => 1, Size => 6;
-- Type definition for UCA0IRRCTL_UCIRRXFL
type UCA0IRRCTL_UCIRRXFL_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- UCIRRXFL as a value
Val : MSP430_SVD.UInt6;
when True =>
-- UCIRRXFL as an array
Arr : UCA0IRRCTL_UCIRRXFL_Field_Array;
end case;
end record
with Unchecked_Union, Size => 6;
for UCA0IRRCTL_UCIRRXFL_Field use record
Val at 0 range 0 .. 5;
Arr at 0 range 0 .. 5;
end record;
-- USCI A0 IrDA Receive Control
type UCA0IRRCTL_Register is record
-- IRDA Receive Filter enable
UCIRRXFE : MSP430_SVD.Bit := 16#0#;
-- IRDA Receive Input Polarity
UCIRRXPL : MSP430_SVD.Bit := 16#0#;
-- IRDA Receive Filter Length 0
UCIRRXFL : UCA0IRRCTL_UCIRRXFL_Field :=
(As_Array => False, Val => 16#0#);
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for UCA0IRRCTL_Register use record
UCIRRXFE at 0 range 0 .. 0;
UCIRRXPL at 0 range 1 .. 1;
UCIRRXFL at 0 range 2 .. 7;
end record;
-- Async. Mode: USCI Mode 1
type UCA0CTL0_UCMODE_Field is
(-- Sync. Mode: USCI Mode: 0
Ucmode_0,
-- Sync. Mode: USCI Mode: 1
Ucmode_1,
-- Sync. Mode: USCI Mode: 2
Ucmode_2,
-- Sync. Mode: USCI Mode: 3
Ucmode_3)
with Size => 2;
for UCA0CTL0_UCMODE_Field use
(Ucmode_0 => 0,
Ucmode_1 => 1,
Ucmode_2 => 2,
Ucmode_3 => 3);
-- USCI A0 Control Register 0
type UCA0CTL0_Register is record
-- Sync-Mode 0:UART-Mode / 1:SPI-Mode
UCSYNC : MSP430_SVD.Bit := 16#0#;
-- Async. Mode: USCI Mode 1
UCMODE : UCA0CTL0_UCMODE_Field := MSP430_SVD.USCI_A0_UART_MODE.Ucmode_0;
-- Async. Mode: Stop Bits 0:one / 1: two
UCSPB : MSP430_SVD.Bit := 16#0#;
-- Async. Mode: Data Bits 0:8-bits / 1:7-bits
UC7BIT : MSP430_SVD.Bit := 16#0#;
-- Async. Mode: MSB first 0:LSB / 1:MSB
UCMSB : MSP430_SVD.Bit := 16#0#;
-- Async. Mode: Parity 0:odd / 1:even
UCPAR : MSP430_SVD.Bit := 16#0#;
-- Async. Mode: Parity enable
UCPEN : MSP430_SVD.Bit := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for UCA0CTL0_Register use record
UCSYNC at 0 range 0 .. 0;
UCMODE at 0 range 1 .. 2;
UCSPB at 0 range 3 .. 3;
UC7BIT at 0 range 4 .. 4;
UCMSB at 0 range 5 .. 5;
UCPAR at 0 range 6 .. 6;
UCPEN at 0 range 7 .. 7;
end record;
-- USCI 0 Clock Source Select 1
type UCA0CTL1_UCSSEL_Field is
(-- USCI 0 Clock Source: 0
Ucssel_0,
-- USCI 0 Clock Source: 1
Ucssel_1,
-- USCI 0 Clock Source: 2
Ucssel_2,
-- USCI 0 Clock Source: 3
Ucssel_3)
with Size => 2;
for UCA0CTL1_UCSSEL_Field use
(Ucssel_0 => 0,
Ucssel_1 => 1,
Ucssel_2 => 2,
Ucssel_3 => 3);
-- USCI A0 Control Register 1
type UCA0CTL1_Register is record
-- USCI Software Reset
UCSWRST : MSP430_SVD.Bit := 16#0#;
-- Send next Data as Break
UCTXBRK : MSP430_SVD.Bit := 16#0#;
-- Send next Data as Address
UCTXADDR : MSP430_SVD.Bit := 16#0#;
-- Dormant (Sleep) Mode
UCDORM : MSP430_SVD.Bit := 16#0#;
-- Break interrupt enable
UCBRKIE : MSP430_SVD.Bit := 16#0#;
-- RX Error interrupt enable
UCRXEIE : MSP430_SVD.Bit := 16#0#;
-- USCI 0 Clock Source Select 1
UCSSEL : UCA0CTL1_UCSSEL_Field :=
MSP430_SVD.USCI_A0_UART_MODE.Ucssel_0;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for UCA0CTL1_Register use record
UCSWRST at 0 range 0 .. 0;
UCTXBRK at 0 range 1 .. 1;
UCTXADDR at 0 range 2 .. 2;
UCDORM at 0 range 3 .. 3;
UCBRKIE at 0 range 4 .. 4;
UCRXEIE at 0 range 5 .. 5;
UCSSEL at 0 range 6 .. 7;
end record;
-- USCI Second Stage Modulation Select 2
type UCA0MCTL_UCBRS_Field is
(-- USCI Second Stage Modulation: 0
Ucbrs_0,
-- USCI Second Stage Modulation: 1
Ucbrs_1,
-- USCI Second Stage Modulation: 2
Ucbrs_2,
-- USCI Second Stage Modulation: 3
Ucbrs_3,
-- USCI Second Stage Modulation: 4
Ucbrs_4,
-- USCI Second Stage Modulation: 5
Ucbrs_5,
-- USCI Second Stage Modulation: 6
Ucbrs_6,
-- USCI Second Stage Modulation: 7
Ucbrs_7)
with Size => 3;
for UCA0MCTL_UCBRS_Field use
(Ucbrs_0 => 0,
Ucbrs_1 => 1,
Ucbrs_2 => 2,
Ucbrs_3 => 3,
Ucbrs_4 => 4,
Ucbrs_5 => 5,
Ucbrs_6 => 6,
Ucbrs_7 => 7);
-- USCI First Stage Modulation Select 3
type UCA0MCTL_UCBRF_Field is
(-- USCI First Stage Modulation: 0
Ucbrf_0,
-- USCI First Stage Modulation: 1
Ucbrf_1,
-- USCI First Stage Modulation: 2
Ucbrf_2,
-- USCI First Stage Modulation: 3
Ucbrf_3,
-- USCI First Stage Modulation: 4
Ucbrf_4,
-- USCI First Stage Modulation: 5
Ucbrf_5,
-- USCI First Stage Modulation: 6
Ucbrf_6,
-- USCI First Stage Modulation: 7
Ucbrf_7,
-- USCI First Stage Modulation: 8
Ucbrf_8,
-- USCI First Stage Modulation: 9
Ucbrf_9,
-- USCI First Stage Modulation: A
Ucbrf_10,
-- USCI First Stage Modulation: B
Ucbrf_11,
-- USCI First Stage Modulation: C
Ucbrf_12,
-- USCI First Stage Modulation: D
Ucbrf_13,
-- USCI First Stage Modulation: E
Ucbrf_14,
-- USCI First Stage Modulation: F
Ucbrf_15)
with Size => 4;
for UCA0MCTL_UCBRF_Field use
(Ucbrf_0 => 0,
Ucbrf_1 => 1,
Ucbrf_2 => 2,
Ucbrf_3 => 3,
Ucbrf_4 => 4,
Ucbrf_5 => 5,
Ucbrf_6 => 6,
Ucbrf_7 => 7,
Ucbrf_8 => 8,
Ucbrf_9 => 9,
Ucbrf_10 => 10,
Ucbrf_11 => 11,
Ucbrf_12 => 12,
Ucbrf_13 => 13,
Ucbrf_14 => 14,
Ucbrf_15 => 15);
-- USCI A0 Modulation Control
type UCA0MCTL_Register is record
-- USCI 16-times Oversampling enable
UCOS16 : MSP430_SVD.Bit := 16#0#;
-- USCI Second Stage Modulation Select 2
UCBRS : UCA0MCTL_UCBRS_Field := MSP430_SVD.USCI_A0_UART_MODE.Ucbrs_0;
-- USCI First Stage Modulation Select 3
UCBRF : UCA0MCTL_UCBRF_Field := MSP430_SVD.USCI_A0_UART_MODE.Ucbrf_0;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for UCA0MCTL_Register use record
UCOS16 at 0 range 0 .. 0;
UCBRS at 0 range 1 .. 3;
UCBRF at 0 range 4 .. 7;
end record;
-- USCI A0 Status Register
type UCA0STAT_Register is record
-- USCI Busy Flag
UCBUSY : MSP430_SVD.Bit := 16#0#;
-- USCI Address received Flag
UCADDR : MSP430_SVD.Bit := 16#0#;
-- USCI RX Error Flag
UCRXERR : MSP430_SVD.Bit := 16#0#;
-- USCI Break received
UCBRK : MSP430_SVD.Bit := 16#0#;
-- USCI Parity Error Flag
UCPE : MSP430_SVD.Bit := 16#0#;
-- USCI Overrun Error Flag
UCOE : MSP430_SVD.Bit := 16#0#;
-- USCI Frame Error Flag
UCFE : MSP430_SVD.Bit := 16#0#;
-- USCI Listen mode
UCLISTEN : MSP430_SVD.Bit := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for UCA0STAT_Register use record
UCBUSY at 0 range 0 .. 0;
UCADDR at 0 range 1 .. 1;
UCRXERR at 0 range 2 .. 2;
UCBRK at 0 range 3 .. 3;
UCPE at 0 range 4 .. 4;
UCOE at 0 range 5 .. 5;
UCFE at 0 range 6 .. 6;
UCLISTEN at 0 range 7 .. 7;
end record;
-----------------
-- Peripherals --
-----------------
-- USCI_A0 UART Mode
type USCI_A0_UART_MODE_Peripheral is record
-- USCI A0 LIN Control
UCA0ABCTL : aliased UCA0ABCTL_Register;
-- USCI A0 IrDA Transmit Control
UCA0IRTCTL : aliased UCA0IRTCTL_Register;
-- USCI A0 IrDA Receive Control
UCA0IRRCTL : aliased UCA0IRRCTL_Register;
-- USCI A0 Control Register 0
UCA0CTL0 : aliased UCA0CTL0_Register;
-- USCI A0 Control Register 1
UCA0CTL1 : aliased UCA0CTL1_Register;
-- USCI A0 Baud Rate 0
UCA0BR0 : aliased MSP430_SVD.Byte;
-- USCI A0 Baud Rate 1
UCA0BR1 : aliased MSP430_SVD.Byte;
-- USCI A0 Modulation Control
UCA0MCTL : aliased UCA0MCTL_Register;
-- USCI A0 Status Register
UCA0STAT : aliased UCA0STAT_Register;
-- USCI A0 Receive Buffer
UCA0RXBUF : aliased MSP430_SVD.Byte;
-- USCI A0 Transmit Buffer
UCA0TXBUF : aliased MSP430_SVD.Byte;
end record
with Volatile;
for USCI_A0_UART_MODE_Peripheral use record
UCA0ABCTL at 16#1# range 0 .. 7;
UCA0IRTCTL at 16#2# range 0 .. 7;
UCA0IRRCTL at 16#3# range 0 .. 7;
UCA0CTL0 at 16#4# range 0 .. 7;
UCA0CTL1 at 16#5# range 0 .. 7;
UCA0BR0 at 16#6# range 0 .. 7;
UCA0BR1 at 16#7# range 0 .. 7;
UCA0MCTL at 16#8# range 0 .. 7;
UCA0STAT at 16#9# range 0 .. 7;
UCA0RXBUF at 16#A# range 0 .. 7;
UCA0TXBUF at 16#B# range 0 .. 7;
end record;
-- USCI_A0 UART Mode
USCI_A0_UART_MODE_Periph : aliased USCI_A0_UART_MODE_Peripheral
with Import, Address => USCI_A0_UART_MODE_Base;
end MSP430_SVD.USCI_A0_UART_MODE;
|
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.Table_Message_Type_Attributes is
pragma Preelaborate;
type ODF_Table_Message_Type_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Table_Message_Type_Attribute_Access is
access all ODF_Table_Message_Type_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Table_Message_Type_Attributes;
|
fengjixuchui/ewok-kernel | Ada | 3,140 | ads | with m4.mpu;
with types;
package soc.layout
with spark_mode => on
is
FLASH_BASE : constant system_address := 16#0800_0000#;
FLASH_SIZE : constant := 1 * MBYTE;
SRAM_BASE : constant system_address := 16#1000_0000#;
SRAM_SIZE : constant := 64 * KBYTE;
BOOTROM_BASE : constant system_address := 16#1FFF_0000#;
RAM_BASE : constant system_address := 16#2000_0000#; -- SRAM
RAM_SIZE : constant := 128 * KBYTE;
PERIPH_BASE : constant system_address := 16#4000_0000#;
MEMORY_BANK1_BASE : constant system_address := 16#6000_0000#;
MEMORY_BANK2_BASE : constant system_address := MEMORY_BANK1_BASE;
APB1PERIPH_BASE : constant system_address := PERIPH_BASE;
APB2PERIPH_BASE : constant system_address := PERIPH_BASE + 16#0001_0000#;
AHB1PERIPH_BASE : constant system_address := PERIPH_BASE + 16#0002_0000#;
AHB2PERIPH_BASE : constant system_address := PERIPH_BASE + 16#1000_0000#;
--
-- AHB1 peripherals
--
GPIOA_BASE : constant system_address := AHB1PERIPH_BASE + 16#0000#;
GPIOB_BASE : constant system_address := AHB1PERIPH_BASE + 16#0400#;
GPIOC_BASE : constant system_address := AHB1PERIPH_BASE + 16#0800#;
GPIOD_BASE : constant system_address := AHB1PERIPH_BASE + 16#0C00#;
GPIOE_BASE : constant system_address := AHB1PERIPH_BASE + 16#1000#;
GPIOF_BASE : constant system_address := AHB1PERIPH_BASE + 16#1400#;
GPIOG_BASE : constant system_address := AHB1PERIPH_BASE + 16#1800#;
GPIOH_BASE : constant system_address := AHB1PERIPH_BASE + 16#1C00#;
GPIOI_BASE : constant system_address := AHB1PERIPH_BASE + 16#2000#;
DMA1_BASE : constant system_address := AHB1PERIPH_BASE + 16#6000#;
DMA2_BASE : constant system_address := AHB1PERIPH_BASE + 16#6400#;
--
-- APB2 peripherals
--
SYSCFG_BASE : constant system_address := APB2PERIPH_BASE + 16#3800#;
--
-- Flash and firmware structure
--
--
-- Flip bank
FW1_SIZE : constant unsigned_32 := 576*1024;
FW1_KERN_BASE : constant unsigned_32 := 16#08020000#;
FW1_KERN_SIZE : constant unsigned_32 := 64*1024;
FW1_KERN_REGION_SIZE : constant m4.mpu.t_region_size := m4.mpu.REGION_SIZE_64KB;
FW1_USER_BASE : constant unsigned_32 := 16#08080000#;
FW1_USER_SIZE : constant unsigned_32 := 512*1024;
FW1_USER_REGION_SIZE : constant m4.mpu.t_region_size := m4.mpu.REGION_SIZE_512KB;
-- DFU 1
DFU1_SIZE : constant unsigned_32 := 320*1024;
DFU1_KERN_BASE : constant unsigned_32 := 16#08030000#;
DFU1_USER_BASE : constant unsigned_32 := 16#08040000#;
DFU1_KERN_SIZE : constant unsigned_32 := 64*1024;
DFU1_KERN_REGION_SIZE: constant m4.mpu.t_region_size := m4.mpu.REGION_SIZE_64KB;
DFU1_USER_SIZE : constant unsigned_32 := 256*1024;
DFU1_USER_REGION_SIZE: constant m4.mpu.t_region_size := m4.mpu.REGION_SIZE_256KB;
-- STM32F429 has 1MB flash that can be mapped at a time, which forbid
-- the usage of efficient dual banking.
-- This layout does not declare the complete dual bank
end soc.layout;
|
reznikmm/matreshka | Ada | 6,265 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-2011, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with League.Strings;
with XML.SAX.Input_Sources;
package XML.SAX.Entity_Resolvers is
pragma Preelaborate;
type SAX_Entity_Resolver is limited interface;
not overriding function Error_String
(Self : SAX_Entity_Resolver)
return League.Strings.Universal_String is abstract;
not overriding procedure Get_External_Subset
(Self : in out SAX_Entity_Resolver;
Name : League.Strings.Universal_String;
Base_URI : League.Strings.Universal_String;
Source : out XML.SAX.Input_Sources.SAX_Input_Source_Access;
Success : in out Boolean) is null;
-- The reader calls this function to allow applications to provide an
-- external subset for documents that don't explicitly define one.
--
-- The parameter Name is a name of the document root element. This name
-- comes from a DOCTYPE declaration (where available) or from the actual
-- root element. The parameter Base_URI is the document's base URI, serving
-- as an additional hint for selecting the external subset. Source is
-- the return value.
--
-- If this subprogram sets Success to False the reader stops parsing and
-- reports an error. The reader uses the function Error_String to get the
-- error message.
not overriding procedure Resolve_Entity
(Self : in out SAX_Entity_Resolver;
Name : League.Strings.Universal_String;
Public_Id : League.Strings.Universal_String;
Base_URI : League.Strings.Universal_String;
System_Id : League.Strings.Universal_String;
Source : out XML.SAX.Input_Sources.SAX_Input_Source_Access;
Success : in out Boolean) is null;
-- The reader calls this function before it opens any external entity,
-- except the top-level document entity. The application may request the
-- reader to resolve the entity itself (by setting Source to null) or to
-- use an entirely different input source (by setting Source to the input
-- source).
--
-- The reader deletes the input source Source when it no longer needs it,
-- so you should allocate it on the heap with new.
--
-- The argument Name is a name of the entity. "[dtd]" is used as for name
-- of the external subset; names of parameter entities start with '%'.
-- The argument Public_Id is the public identifier of the external entity.
-- Base_URI is the URI with respect to which relative System_IDs are
-- interpreted. System_Id is the system identifier of the external entity.
-- Source is the return value. If Source is null the reader should resolve
-- the entity itself, if it is non-zero it must point to an input source
-- which the reader uses instead.
--
-- If this subprogram sets Success to False the reader stops parsing and
-- reports an error. The reader uses the function Error_String to get the
-- error message.
end XML.SAX.Entity_Resolvers;
|
albertklee/SPARKZumo | Ada | 1,224 | adb | pragma SPARK_Mode;
with Sparkduino; use Sparkduino;
with Types; use Types;
package body Zumo_Pushbutton is
Zumo_Button : constant := 12;
Zumo_Button_Pullup : constant PinMode := INPUT_PULLUP;
Zumo_Button_Default_Pinval : constant DigPinValue := HIGH;
procedure Init
is
begin
Initd := True;
SetPinMode (Pin => Zumo_Button,
Mode => PinMode'Pos (Zumo_Button_Pullup));
DelayMicroseconds (Time => 5);
end Init;
function IsPressed return Boolean
is
begin
return DigitalRead (Pin => Zumo_Button) /=
DigPinValue'Pos (Zumo_Button_Default_Pinval);
end IsPressed;
procedure WaitForPress
is
begin
loop
while not IsPressed loop
null;
end loop;
SysDelay (Time => 10);
exit when IsPressed;
end loop;
end WaitForPress;
procedure WaitForRelease
is
begin
loop
while IsPressed loop
null;
end loop;
SysDelay (Time => 10);
exit when not IsPressed;
end loop;
end WaitForRelease;
procedure WaitForButton
is
begin
WaitForPress;
WaitForRelease;
end WaitForButton;
end Zumo_Pushbutton;
|
reznikmm/matreshka | Ada | 3,987 | 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.
------------------------------------------------------------------------------
-- See Annex A.
------------------------------------------------------------------------------
with AMF.UMLDI.UML_Behavior_Diagrams;
package AMF.UMLDI.UML_Use_Case_Diagrams is
pragma Preelaborate;
type UMLDI_UML_Use_Case_Diagram is limited interface
and AMF.UMLDI.UML_Behavior_Diagrams.UMLDI_UML_Behavior_Diagram;
type UMLDI_UML_Use_Case_Diagram_Access is
access all UMLDI_UML_Use_Case_Diagram'Class;
for UMLDI_UML_Use_Case_Diagram_Access'Storage_Size use 0;
end AMF.UMLDI.UML_Use_Case_Diagrams;
|
optikos/oasis | Ada | 3,765 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Elements.Defining_Character_Literals;
with Program.Element_Visitors;
package Program.Nodes.Defining_Character_Literals is
pragma Preelaborate;
type Defining_Character_Literal is
new Program.Nodes.Node
and Program.Elements.Defining_Character_Literals
.Defining_Character_Literal
and Program.Elements.Defining_Character_Literals
.Defining_Character_Literal_Text
with private;
function Create
(Character_Literal_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Defining_Character_Literal;
type Implicit_Defining_Character_Literal is
new Program.Nodes.Node
and Program.Elements.Defining_Character_Literals
.Defining_Character_Literal
with private;
function Create
(Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Defining_Character_Literal
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Defining_Character_Literal is
abstract new Program.Nodes.Node
and Program.Elements.Defining_Character_Literals
.Defining_Character_Literal
with null record;
procedure Initialize
(Self : aliased in out Base_Defining_Character_Literal'Class);
overriding procedure Visit
(Self : not null access Base_Defining_Character_Literal;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Is_Defining_Character_Literal_Element
(Self : Base_Defining_Character_Literal)
return Boolean;
overriding function Is_Defining_Name_Element
(Self : Base_Defining_Character_Literal)
return Boolean;
type Defining_Character_Literal is
new Base_Defining_Character_Literal
and Program.Elements.Defining_Character_Literals
.Defining_Character_Literal_Text
with record
Character_Literal_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Defining_Character_Literal_Text
(Self : aliased in out Defining_Character_Literal)
return Program.Elements.Defining_Character_Literals
.Defining_Character_Literal_Text_Access;
overriding function Character_Literal_Token
(Self : Defining_Character_Literal)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Image (Self : Defining_Character_Literal) return Text;
type Implicit_Defining_Character_Literal is
new Base_Defining_Character_Literal
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Defining_Character_Literal_Text
(Self : aliased in out Implicit_Defining_Character_Literal)
return Program.Elements.Defining_Character_Literals
.Defining_Character_Literal_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Defining_Character_Literal)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Defining_Character_Literal)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Defining_Character_Literal)
return Boolean;
overriding function Image
(Self : Implicit_Defining_Character_Literal)
return Text;
end Program.Nodes.Defining_Character_Literals;
|
reznikmm/matreshka | Ada | 3,927 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.ODF_Attributes.Style.Font_Style_Complex;
package ODF.DOM.Attributes.Style.Font_Style_Complex.Internals is
function Create
(Node : Matreshka.ODF_Attributes.Style.Font_Style_Complex.Style_Font_Style_Complex_Access)
return ODF.DOM.Attributes.Style.Font_Style_Complex.ODF_Style_Font_Style_Complex;
function Wrap
(Node : Matreshka.ODF_Attributes.Style.Font_Style_Complex.Style_Font_Style_Complex_Access)
return ODF.DOM.Attributes.Style.Font_Style_Complex.ODF_Style_Font_Style_Complex;
end ODF.DOM.Attributes.Style.Font_Style_Complex.Internals;
|
DeanHnter/chocolate-box | Ada | 16,271 | ads | ----------------------------------------------------------------
-- ZLib for Ada thick binding. --
-- --
-- Copyright (C) 2002-2003 Dmitriy Anisimkov --
-- --
-- Open source license information is in the zlib.ads file. --
----------------------------------------------------------------
-- $Id: zlib-thin.ads,v 1.1 2006/02/23 21:33:49 BayStone Exp $
with Interfaces.C.Strings;
with System;
private package ZLib.Thin is
-- From zconf.h
MAX_MEM_LEVEL : constant := 9; -- zconf.h:105
-- zconf.h:105
MAX_WBITS : constant := 15; -- zconf.h:115
-- 32K LZ77 window
-- zconf.h:115
SEEK_SET : constant := 8#0000#; -- zconf.h:244
-- Seek from beginning of file.
-- zconf.h:244
SEEK_CUR : constant := 1; -- zconf.h:245
-- Seek from current position.
-- zconf.h:245
SEEK_END : constant := 2; -- zconf.h:246
-- Set file pointer to EOF plus "offset"
-- zconf.h:246
type Byte is new Interfaces.C.unsigned_char; -- 8 bits
-- zconf.h:214
type UInt is new Interfaces.C.unsigned; -- 16 bits or more
-- zconf.h:216
type Int is new Interfaces.C.int;
type ULong is new Interfaces.C.unsigned_long; -- 32 bits or more
-- zconf.h:217
subtype Chars_Ptr is Interfaces.C.Strings.chars_ptr;
type ULong_Access is access ULong;
type Int_Access is access Int;
subtype Voidp is System.Address; -- zconf.h:232
subtype Byte_Access is Voidp;
Nul : constant Voidp := System.Null_Address;
-- end from zconf
Z_NO_FLUSH : constant := 8#0000#; -- zlib.h:125
-- zlib.h:125
Z_PARTIAL_FLUSH : constant := 1; -- zlib.h:126
-- will be removed, use
-- Z_SYNC_FLUSH instead
-- zlib.h:126
Z_SYNC_FLUSH : constant := 2; -- zlib.h:127
-- zlib.h:127
Z_FULL_FLUSH : constant := 3; -- zlib.h:128
-- zlib.h:128
Z_FINISH : constant := 4; -- zlib.h:129
-- zlib.h:129
Z_OK : constant := 8#0000#; -- zlib.h:132
-- zlib.h:132
Z_STREAM_END : constant := 1; -- zlib.h:133
-- zlib.h:133
Z_NEED_DICT : constant := 2; -- zlib.h:134
-- zlib.h:134
Z_ERRNO : constant := -1; -- zlib.h:135
-- zlib.h:135
Z_STREAM_ERROR : constant := -2; -- zlib.h:136
-- zlib.h:136
Z_DATA_ERROR : constant := -3; -- zlib.h:137
-- zlib.h:137
Z_MEM_ERROR : constant := -4; -- zlib.h:138
-- zlib.h:138
Z_BUF_ERROR : constant := -5; -- zlib.h:139
-- zlib.h:139
Z_VERSION_ERROR : constant := -6; -- zlib.h:140
-- zlib.h:140
Z_NO_COMPRESSION : constant := 8#0000#; -- zlib.h:145
-- zlib.h:145
Z_BEST_SPEED : constant := 1; -- zlib.h:146
-- zlib.h:146
Z_BEST_COMPRESSION : constant := 9; -- zlib.h:147
-- zlib.h:147
Z_DEFAULT_COMPRESSION : constant := -1; -- zlib.h:148
-- zlib.h:148
Z_FILTERED : constant := 1; -- zlib.h:151
-- zlib.h:151
Z_HUFFMAN_ONLY : constant := 2; -- zlib.h:152
-- zlib.h:152
Z_DEFAULT_STRATEGY : constant := 8#0000#; -- zlib.h:153
-- zlib.h:153
Z_BINARY : constant := 8#0000#; -- zlib.h:156
-- zlib.h:156
Z_ASCII : constant := 1; -- zlib.h:157
-- zlib.h:157
Z_UNKNOWN : constant := 2; -- zlib.h:158
-- zlib.h:158
Z_DEFLATED : constant := 8; -- zlib.h:161
-- zlib.h:161
Z_NULL : constant := 8#0000#; -- zlib.h:164
-- for initializing zalloc, zfree, opaque
-- zlib.h:164
type gzFile is new Voidp; -- zlib.h:646
type Z_Stream is private;
type Z_Streamp is access all Z_Stream; -- zlib.h:89
type alloc_func is access function
(Opaque : Voidp;
Items : UInt;
Size : UInt)
return Voidp; -- zlib.h:63
type free_func is access procedure (opaque : Voidp; address : Voidp);
function zlibVersion return Chars_Ptr;
function Deflate (strm : Z_Streamp; flush : Int) return Int;
function DeflateEnd (strm : Z_Streamp) return Int;
function Inflate (strm : Z_Streamp; flush : Int) return Int;
function InflateEnd (strm : Z_Streamp) return Int;
function deflateSetDictionary
(strm : Z_Streamp;
dictionary : Byte_Access;
dictLength : UInt)
return Int;
function deflateCopy (dest : Z_Streamp; source : Z_Streamp) return Int;
-- zlib.h:478
function deflateReset (strm : Z_Streamp) return Int; -- zlib.h:495
function deflateParams
(strm : Z_Streamp;
level : Int;
strategy : Int)
return Int; -- zlib.h:506
function inflateSetDictionary
(strm : Z_Streamp;
dictionary : Byte_Access;
dictLength : UInt)
return Int; -- zlib.h:548
function inflateSync (strm : Z_Streamp) return Int; -- zlib.h:565
function inflateReset (strm : Z_Streamp) return Int; -- zlib.h:580
function compress
(dest : Byte_Access;
destLen : ULong_Access;
source : Byte_Access;
sourceLen : ULong)
return Int; -- zlib.h:601
function compress2
(dest : Byte_Access;
destLen : ULong_Access;
source : Byte_Access;
sourceLen : ULong;
level : Int)
return Int; -- zlib.h:615
function uncompress
(dest : Byte_Access;
destLen : ULong_Access;
source : Byte_Access;
sourceLen : ULong)
return Int;
function gzopen (path : Chars_Ptr; mode : Chars_Ptr) return gzFile;
function gzdopen (fd : Int; mode : Chars_Ptr) return gzFile;
function gzsetparams
(file : gzFile;
level : Int;
strategy : Int)
return Int;
function gzread
(file : gzFile;
buf : Voidp;
len : UInt)
return Int;
function gzwrite
(file : in gzFile;
buf : in Voidp;
len : in UInt)
return Int;
function gzprintf (file : in gzFile; format : in Chars_Ptr) return Int;
function gzputs (file : in gzFile; s : in Chars_Ptr) return Int;
function gzgets
(file : gzFile;
buf : Chars_Ptr;
len : Int)
return Chars_Ptr;
function gzputc (file : gzFile; char : Int) return Int;
function gzgetc (file : gzFile) return Int;
function gzflush (file : gzFile; flush : Int) return Int;
function gzseek
(file : gzFile;
offset : Int;
whence : Int)
return Int;
function gzrewind (file : gzFile) return Int;
function gztell (file : gzFile) return Int;
function gzeof (file : gzFile) return Int;
function gzclose (file : gzFile) return Int;
function gzerror (file : gzFile; errnum : Int_Access) return Chars_Ptr;
function adler32
(adler : ULong;
buf : Byte_Access;
len : UInt)
return ULong;
function crc32
(crc : ULong;
buf : Byte_Access;
len : UInt)
return ULong;
function deflateInit
(strm : Z_Streamp;
level : Int;
version : Chars_Ptr;
stream_size : Int)
return Int;
function deflateInit2
(strm : Z_Streamp;
level : Int;
method : Int;
windowBits : Int;
memLevel : Int;
strategy : Int;
version : Chars_Ptr;
stream_size : Int)
return Int;
function Deflate_Init
(strm : Z_Streamp;
level : Int;
method : Int;
windowBits : Int;
memLevel : Int;
strategy : Int)
return Int;
pragma Inline (Deflate_Init);
function inflateInit
(strm : Z_Streamp;
version : Chars_Ptr;
stream_size : Int)
return Int;
function inflateInit2
(strm : in Z_Streamp;
windowBits : in Int;
version : in Chars_Ptr;
stream_size : in Int)
return Int;
function inflateBackInit
(strm : in Z_Streamp;
windowBits : in Int;
window : in Byte_Access;
version : in Chars_Ptr;
stream_size : in Int)
return Int;
-- Size of window have to be 2**windowBits.
function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int;
pragma Inline (Inflate_Init);
function zError (err : Int) return Chars_Ptr;
function inflateSyncPoint (z : Z_Streamp) return Int;
function get_crc_table return ULong_Access;
-- Interface to the available fields of the z_stream structure.
-- The application must update next_in and avail_in when avail_in has
-- dropped to zero. It must update next_out and avail_out when avail_out
-- has dropped to zero. The application must initialize zalloc, zfree and
-- opaque before calling the init function.
procedure Set_In
(Strm : in out Z_Stream;
Buffer : in Voidp;
Size : in UInt);
pragma Inline (Set_In);
procedure Set_Out
(Strm : in out Z_Stream;
Buffer : in Voidp;
Size : in UInt);
pragma Inline (Set_Out);
procedure Set_Mem_Func
(Strm : in out Z_Stream;
Opaque : in Voidp;
Alloc : in alloc_func;
Free : in free_func);
pragma Inline (Set_Mem_Func);
function Last_Error_Message (Strm : in Z_Stream) return String;
pragma Inline (Last_Error_Message);
function Avail_Out (Strm : in Z_Stream) return UInt;
pragma Inline (Avail_Out);
function Avail_In (Strm : in Z_Stream) return UInt;
pragma Inline (Avail_In);
function Total_In (Strm : in Z_Stream) return ULong;
pragma Inline (Total_In);
function Total_Out (Strm : in Z_Stream) return ULong;
pragma Inline (Total_Out);
function inflateCopy
(dest : in Z_Streamp;
Source : in Z_Streamp)
return Int;
function compressBound (Source_Len : in ULong) return ULong;
function deflateBound
(Strm : in Z_Streamp;
Source_Len : in ULong)
return ULong;
function gzungetc (C : in Int; File : in gzFile) return Int;
function zlibCompileFlags return ULong;
private
type Z_Stream is record -- zlib.h:68
Next_In : Voidp := Nul; -- next input byte
Avail_In : UInt := 0; -- number of bytes available at next_in
Total_In : ULong := 0; -- total nb of input bytes read so far
Next_Out : Voidp := Nul; -- next output byte should be put there
Avail_Out : UInt := 0; -- remaining free space at next_out
Total_Out : ULong := 0; -- total nb of bytes output so far
msg : Chars_Ptr; -- last error message, NULL if no error
state : Voidp; -- not visible by applications
zalloc : alloc_func := null; -- used to allocate the internal state
zfree : free_func := null; -- used to free the internal state
opaque : Voidp; -- private data object passed to
-- zalloc and zfree
data_type : Int; -- best guess about the data type:
-- ascii or binary
adler : ULong; -- adler32 value of the uncompressed
-- data
reserved : ULong; -- reserved for future use
end record;
pragma Convention (C, Z_Stream);
pragma Import (C, zlibVersion, "zlibVersion");
pragma Import (C, Deflate, "deflate");
pragma Import (C, DeflateEnd, "deflateEnd");
pragma Import (C, Inflate, "inflate");
pragma Import (C, InflateEnd, "inflateEnd");
pragma Import (C, deflateSetDictionary, "deflateSetDictionary");
pragma Import (C, deflateCopy, "deflateCopy");
pragma Import (C, deflateReset, "deflateReset");
pragma Import (C, deflateParams, "deflateParams");
pragma Import (C, inflateSetDictionary, "inflateSetDictionary");
pragma Import (C, inflateSync, "inflateSync");
pragma Import (C, inflateReset, "inflateReset");
pragma Import (C, compress, "compress");
pragma Import (C, compress2, "compress2");
pragma Import (C, uncompress, "uncompress");
pragma Import (C, gzopen, "gzopen");
pragma Import (C, gzdopen, "gzdopen");
pragma Import (C, gzsetparams, "gzsetparams");
pragma Import (C, gzread, "gzread");
pragma Import (C, gzwrite, "gzwrite");
pragma Import (C, gzprintf, "gzprintf");
pragma Import (C, gzputs, "gzputs");
pragma Import (C, gzgets, "gzgets");
pragma Import (C, gzputc, "gzputc");
pragma Import (C, gzgetc, "gzgetc");
pragma Import (C, gzflush, "gzflush");
pragma Import (C, gzseek, "gzseek");
pragma Import (C, gzrewind, "gzrewind");
pragma Import (C, gztell, "gztell");
pragma Import (C, gzeof, "gzeof");
pragma Import (C, gzclose, "gzclose");
pragma Import (C, gzerror, "gzerror");
pragma Import (C, adler32, "adler32");
pragma Import (C, crc32, "crc32");
pragma Import (C, deflateInit, "deflateInit_");
pragma Import (C, inflateInit, "inflateInit_");
pragma Import (C, deflateInit2, "deflateInit2_");
pragma Import (C, inflateInit2, "inflateInit2_");
pragma Import (C, zError, "zError");
pragma Import (C, inflateSyncPoint, "inflateSyncPoint");
pragma Import (C, get_crc_table, "get_crc_table");
-- since zlib 1.2.0:
pragma Import (C, inflateCopy, "inflateCopy");
pragma Import (C, compressBound, "compressBound");
pragma Import (C, deflateBound, "deflateBound");
pragma Import (C, gzungetc, "gzungetc");
pragma Import (C, zlibCompileFlags, "zlibCompileFlags");
pragma Import (C, inflateBackInit, "inflateBackInit_");
-- I stopped binding the inflateBack routines, becouse realize that
-- it does not support zlib and gzip headers for now, and have no
-- symmetric deflateBack routines.
-- ZLib-Ada is symmetric regarding deflate/inflate data transformation
-- and has a similar generic callback interface for the
-- deflate/inflate transformation based on the regular Deflate/Inflate
-- routines.
-- pragma Import (C, inflateBack, "inflateBack");
-- pragma Import (C, inflateBackEnd, "inflateBackEnd");
end ZLib.Thin;
|
stcarrez/dynamo | Ada | 5,455 | ads | -- part of AdaYaml, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "copying.txt"
with Ada.Finalization;
with Ada.Strings.Unbounded;
with Text;
with Lexer;
package Yaml is
-- occurs when the lexical analysis of a YAML character streams discovers
-- ill-formed input.
Lexer_Error : exception renames Lexer.Lexer_Error;
-- occurs when the syntactic analysis of a YAML token stream discovers an
-- ill-formed input.
Parser_Error : exception;
-- occurs when a DOM cannot be composed from a given event stream.
Composer_Error : exception;
-- occurs when an ill-formed event stream is tried to be presented.
Presenter_Error : exception;
-- occurs when data cannot be written to a destination.
Destination_Error : exception;
-- occurs when an event stream contains an invalid sequence of events.
Stream_Error : exception;
-- occurs when annotation processing encounters an invalid usage of an
-- annotation.
Annotation_Error : exception;
-- the version of the library. major and minor version correspond to the
-- YAML version, the patch version is local to this implementation.
function Version_Major return Natural with Inline;
function Version_Minor return Natural with Inline;
function Version_Patch return Natural with Inline;
-- all positions in a mark start at 1
subtype Mark_Position is Positive;
-- a position in the input stream.
type Mark is record
Index, Line, Column : Mark_Position;
end record;
type Event_Kind is (Stream_Start, Stream_End, Document_Start, Document_End,
Alias, Scalar, Sequence_Start, Sequence_End,
Mapping_Start, Mapping_End, Annotation_Start,
Annotation_End);
type Collection_Style_Type is (Any, Block, Flow) with
Convention => C;
type Scalar_Style_Type is
(Any, Plain, Single_Quoted, Double_Quoted, Literal, Folded) with
Convention => C;
subtype Flow_Scalar_Style_Type is Scalar_Style_Type range Literal .. Folded;
type Properties is record
Anchor, Tag : Text.Reference;
end record;
function Default_Properties return Properties;
function Is_Empty (Props : Properties) return Boolean with Inline;
type Event (Kind : Event_Kind := Stream_End) is record
-- Start_Position is first character, End_Position is after last
-- character. this is necessary for zero-length events.
Start_Position, End_Position : Mark;
case Kind is
when Document_Start =>
Version : Text.Reference;
Implicit_Start : Boolean := True;
when Document_End =>
Implicit_End : Boolean;
when Mapping_Start | Sequence_Start =>
Collection_Style : Collection_Style_Type := Any;
Collection_Properties : Properties;
when Annotation_Start =>
Annotation_Properties : Properties;
Namespace : Text.Reference;
Name : Text.Reference;
when Scalar =>
Scalar_Properties : Properties;
Content : Text.Reference;
Scalar_Style : Scalar_Style_Type := Any;
when Alias =>
Target : Text.Reference;
when Mapping_End | Sequence_End | Annotation_End | Stream_Start |
Stream_End => null;
end case;
end record;
function To_String (E : Event) return String;
function To_String (T : Text.Reference) return String
renames Ada.Strings.Unbounded.To_String;
Standard_Annotation_Namespace : constant Text.Reference;
-- base type for refcounted types (mainly event streams). all streams and
-- some other objects can be used with reference-counting smart pointers, so
-- this base type implements the reference counting. note that this type
-- does not have any stream semantic; that is to be implemented by child
-- types by providing a Stream_Concept instance (if they are streams).
--
-- beware that this type is only the vessel for the reference count and does
-- not do any reference counting itself; the reference-counting management
-- functions must be called from a smart pointer type. An object of a child
-- type can be used on the stack, in which case the reference count is not
-- used and instead the object just goes out of scope.
type Refcount_Base is abstract limited new
Ada.Finalization.Limited_Controlled with private;
-- increases reference count. only call this explicitly when implementing
-- a reference-counting smart pointer.
procedure Increase_Refcount (Object : not null access Refcount_Base'Class);
-- decreases reference count. only call this explicitly when implementing a
-- reference-counting smart pointer. this procedure will free the object
-- when the reference count hits zero, rendering the provided pointer
-- useless and dangerous to use afterwards!
procedure Decrease_Refcount (Object : not null access Refcount_Base'Class);
private
Standard_Annotation_Namespace_Holder : constant Text.Constant_Instance :=
Ada.Strings.Unbounded.To_Unbounded_String ("@@");
Standard_Annotation_Namespace : constant Text.Reference :=
(Standard_Annotation_Namespace_Holder);
type Refcount_Base is abstract limited new
Ada.Finalization.Limited_Controlled with record
Refcount : Natural := 1;
end record;
end Yaml;
|
KipodAfterFree/KAF-2019-FireHog | Ada | 8,965 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- Sample.Curses_Demo.Mouse --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer <[email protected]> 1996
-- Version Control
-- $Revision: 1.7 $
-- Binding Version 00.93
------------------------------------------------------------------------------
with Terminal_Interface.Curses; use Terminal_Interface.Curses;
with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels;
with Terminal_Interface.Curses.Mouse; use Terminal_Interface.Curses.Mouse;
with Terminal_Interface.Curses.Text_IO; use Terminal_Interface.Curses.Text_IO;
with Terminal_Interface.Curses.Text_IO.Integer_IO;
with Terminal_Interface.Curses.Text_IO.Enumeration_IO;
with Sample.Helpers; use Sample.Helpers;
with Sample.Manifest; use Sample.Manifest;
with Sample.Keyboard_Handler; use Sample.Keyboard_Handler;
with Sample.Function_Key_Setting; use Sample.Function_Key_Setting;
with Sample.Explanation; use Sample.Explanation;
package body Sample.Curses_Demo.Mouse is
package Int_IO is new
Terminal_Interface.Curses.Text_IO.Integer_IO (Integer);
use Int_IO;
package Button_IO is new
Terminal_Interface.Curses.Text_IO.Enumeration_IO (Mouse_Button);
use Button_IO;
package State_IO is new
Terminal_Interface.Curses.Text_IO.Enumeration_IO (Button_State);
use State_IO;
procedure Demo is
type Controls is array (1 .. 3) of Panel;
Frame : Window;
Msg : Window;
Ctl : Controls;
Pan : Panel;
N : constant Natural := Ctl'Length;
K : Real_Key_Code;
V : Cursor_Visibility := Invisible;
W : Window;
Note : Window;
Msg_L : constant Line_Count := 8;
Lins : Line_Position := Lines;
Cols : Column_Position;
Mask : Event_Mask;
procedure Show_Mouse_Event;
procedure Show_Mouse_Event
is
Evt : constant Mouse_Event := Get_Mouse;
Y : Line_Position;
X : Column_Position;
Button : Mouse_Button;
State : Button_State;
W : Window;
begin
Get_Event (Evt, Y, X, Button, State);
Put (Msg, "Event at");
Put (Msg, " X="); Put (Msg, Integer (X), 3);
Put (Msg, ", Y="); Put (Msg, Integer (Y), 3);
Put (Msg, ", Btn="); Put (Msg, Button, 10);
Put (Msg, ", Stat="); Put (Msg, State, 15);
for I in Ctl'Range loop
W := Get_Window (Ctl (I));
if Enclosed_In_Window (W, Evt) then
Transform_Coordinates (W, Y, X, From_Screen);
Put (Msg, ",Box(");
Put (Msg, Integer (I), 1); Put (Msg, ",");
Put (Msg, Integer (Y), 1); Put (Msg, ",");
Put (Msg, Integer (X), 1); Put (Msg, ")");
end if;
end loop;
New_Line (Msg);
Flush (Msg);
Update_Panels; Update_Screen;
end Show_Mouse_Event;
begin
Push_Environment ("MOUSE00");
Notepad ("MOUSE-PAD00");
Default_Labels;
Set_Cursor_Visibility (V);
Note := Notepad_Window;
if Note /= Null_Window then
Get_Window_Position (Note, Lins, Cols);
end if;
Frame := Create (Msg_L, Columns, Lins - Msg_L, 0);
if Has_Colors then
Set_Background (Win => Frame,
Ch => (Color => Default_Colors,
Attr => Normal_Video,
Ch => ' '));
Set_Character_Attributes (Win => Frame,
Attr => Normal_Video,
Color => Default_Colors);
Erase (Frame);
end if;
Msg := Derived_Window (Frame, Msg_L - 2, Columns - 2, 1, 1);
Pan := Create (Frame);
Set_Meta_Mode;
Set_KeyPad_Mode;
Mask := Start_Mouse;
Box (Frame);
Window_Title (Frame, "Mouse Protocol");
Refresh_Without_Update (Frame);
Allow_Scrolling (Msg, True);
declare
Middle_Column : constant Integer := Integer (Columns) / 2;
Middle_Index : constant Natural := Ctl'First + (Ctl'Length / 2);
Width : constant Column_Count := 5;
Height : constant Line_Count := 3;
Half : constant Column_Count := Width / 2;
Space : constant Column_Count := 3;
Position : Integer;
W : Window;
begin
for I in Ctl'Range loop
Position := (Integer (I) - Integer (Middle_Index)) *
Integer (Half + Space + Width) + Middle_Column;
W := Create (Height,
Width,
1,
Column_Position (Position));
if Has_Colors then
Set_Background (Win => W,
Ch => (Color => Menu_Back_Color,
Attr => Normal_Video,
Ch => ' '));
Set_Character_Attributes (Win => W,
Attr => Normal_Video,
Color => Menu_Fore_Color);
Erase (W);
end if;
Ctl (I) := Create (W);
Box (W);
Move_Cursor (W, 1, Half);
Put (W, Integer (I), 1);
Refresh_Without_Update (W);
end loop;
end;
Update_Panels; Update_Screen;
loop
K := Get_Key;
if K in Special_Key_Code'Range then
case K is
when QUIT_CODE => exit;
when HELP_CODE => Explain_Context;
when EXPLAIN_CODE => Explain ("MOUSEKEYS");
when Key_Mouse => Show_Mouse_Event;
when others => null;
end case;
end if;
end loop;
for I in Ctl'Range loop
W := Get_Window (Ctl (I));
Clear (W);
Delete (Ctl (I));
Delete (W);
end loop;
Clear (Frame);
Delete (Pan);
Delete (Msg);
Delete (Frame);
Set_Cursor_Visibility (V);
End_Mouse;
Pop_Environment;
Update_Panels; Update_Screen;
end Demo;
end Sample.Curses_Demo.Mouse;
|
MinimSecure/unum-sdk | Ada | 834 | adb | -- Copyright 2012-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 body Pck is
procedure Update_Small (S : in out Small) is
begin
null;
end Update_Small;
end Pck;
|
reznikmm/matreshka | Ada | 4,835 | 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.Classes.Collections is
pragma Preelaborate;
package CMOF_Class_Collections is
new AMF.Generic_Collections
(CMOF_Class,
CMOF_Class_Access);
type Set_Of_CMOF_Class is
new CMOF_Class_Collections.Set with null record;
Empty_Set_Of_CMOF_Class : constant Set_Of_CMOF_Class;
type Ordered_Set_Of_CMOF_Class is
new CMOF_Class_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_CMOF_Class : constant Ordered_Set_Of_CMOF_Class;
type Bag_Of_CMOF_Class is
new CMOF_Class_Collections.Bag with null record;
Empty_Bag_Of_CMOF_Class : constant Bag_Of_CMOF_Class;
type Sequence_Of_CMOF_Class is
new CMOF_Class_Collections.Sequence with null record;
Empty_Sequence_Of_CMOF_Class : constant Sequence_Of_CMOF_Class;
private
Empty_Set_Of_CMOF_Class : constant Set_Of_CMOF_Class
:= (CMOF_Class_Collections.Set with null record);
Empty_Ordered_Set_Of_CMOF_Class : constant Ordered_Set_Of_CMOF_Class
:= (CMOF_Class_Collections.Ordered_Set with null record);
Empty_Bag_Of_CMOF_Class : constant Bag_Of_CMOF_Class
:= (CMOF_Class_Collections.Bag with null record);
Empty_Sequence_Of_CMOF_Class : constant Sequence_Of_CMOF_Class
:= (CMOF_Class_Collections.Sequence with null record);
end AMF.CMOF.Classes.Collections;
|
optikos/oasis | Ada | 4,767 | adb | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Program.Nodes.Membership_Tests is
function Create
(Expression : not null Program.Elements.Expressions.Expression_Access;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
In_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Choices : not null Program.Element_Vectors.Element_Vector_Access)
return Membership_Test is
begin
return Result : Membership_Test :=
(Expression => Expression, Not_Token => Not_Token,
In_Token => In_Token, Choices => Choices, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Expression : not null Program.Elements.Expressions
.Expression_Access;
Choices : not null Program.Element_Vectors
.Element_Vector_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False;
Has_Not : Boolean := False)
return Implicit_Membership_Test is
begin
return Result : Implicit_Membership_Test :=
(Expression => Expression, Choices => Choices,
Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Has_Not => Has_Not,
Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Expression
(Self : Base_Membership_Test)
return not null Program.Elements.Expressions.Expression_Access is
begin
return Self.Expression;
end Expression;
overriding function Choices
(Self : Base_Membership_Test)
return not null Program.Element_Vectors.Element_Vector_Access is
begin
return Self.Choices;
end Choices;
overriding function Not_Token
(Self : Membership_Test)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Not_Token;
end Not_Token;
overriding function In_Token
(Self : Membership_Test)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.In_Token;
end In_Token;
overriding function Has_Not (Self : Membership_Test) return Boolean is
begin
return Self.Not_Token.Assigned;
end Has_Not;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Membership_Test)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Membership_Test)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Membership_Test)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
overriding function Has_Not
(Self : Implicit_Membership_Test)
return Boolean is
begin
return Self.Has_Not;
end Has_Not;
procedure Initialize (Self : aliased in out Base_Membership_Test'Class) is
begin
Set_Enclosing_Element (Self.Expression, Self'Unchecked_Access);
for Item in Self.Choices.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
null;
end Initialize;
overriding function Is_Membership_Test_Element
(Self : Base_Membership_Test)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Membership_Test_Element;
overriding function Is_Expression_Element
(Self : Base_Membership_Test)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Expression_Element;
overriding procedure Visit
(Self : not null access Base_Membership_Test;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Membership_Test (Self);
end Visit;
overriding function To_Membership_Test_Text
(Self : aliased in out Membership_Test)
return Program.Elements.Membership_Tests.Membership_Test_Text_Access is
begin
return Self'Unchecked_Access;
end To_Membership_Test_Text;
overriding function To_Membership_Test_Text
(Self : aliased in out Implicit_Membership_Test)
return Program.Elements.Membership_Tests.Membership_Test_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Membership_Test_Text;
end Program.Nodes.Membership_Tests;
|
charlie5/cBound | Ada | 1,418 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces.C;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_glx_get_color_table_cookie_t is
-- Item
--
type Item is record
sequence : aliased Interfaces.C.unsigned;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_glx_get_color_table_cookie_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_get_color_table_cookie_t.Item,
Element_Array => xcb.xcb_glx_get_color_table_cookie_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_glx_get_color_table_cookie_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_get_color_table_cookie_t.Pointer,
Element_Array => xcb.xcb_glx_get_color_table_cookie_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_glx_get_color_table_cookie_t;
|
reznikmm/matreshka | Ada | 4,049 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Draw_Auto_Grow_Height_Attributes;
package Matreshka.ODF_Draw.Auto_Grow_Height_Attributes is
type Draw_Auto_Grow_Height_Attribute_Node is
new Matreshka.ODF_Draw.Abstract_Draw_Attribute_Node
and ODF.DOM.Draw_Auto_Grow_Height_Attributes.ODF_Draw_Auto_Grow_Height_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Draw_Auto_Grow_Height_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Draw_Auto_Grow_Height_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Draw.Auto_Grow_Height_Attributes;
|
MinimSecure/unum-sdk | Ada | 1,024 | ads | -- Copyright 2015-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/>.
generic
type Index_Base_T is range <>;
type Component_T is private;
package Array_List_G is
subtype Length_T is Index_Base_T range 0 .. Index_Base_T'Last;
subtype Index_T is Length_T range 1 .. Length_T'Last;
type T is array (Index_T range <>) of Component_T;
pragma Pack(T);
end Array_List_G;
|
AdaCore/training_material | Ada | 2,740 | adb | -----------------------------------------------------------------------
-- Ada Labs --
-- --
-- Copyright (C) 2008-2019, AdaCore --
-- --
-- Labs is free software; you can redistribute it and/or modify it --
-- under the terms of the GNU General Public License as published by --
-- the Free Software Foundation; either version 2 of the License, or --
-- (at your option) any later version. --
-- --
-- This program is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. You should have received --
-- a copy of the GNU General Public License along with this program; --
-- if not, write to the Free Software Foundation, Inc., 59 Temple --
-- Place - Suite 330, Boston, MA 02111-1307, USA. --
-----------------------------------------------------------------------
with Display; use Display;
with Display.Basic; use Display.Basic;
with Ada.Real_Time; use Ada.Real_Time;
--with Last_Chance_Handler; pragma Unreferenced (Last_Chance_Handler);
procedure Main is
Width : constant := 240.0;
Height : constant := 320.0;
Ball_Radius : constant := 20.0;
X : Float := 0.0;
Y : Float := 0.0;
Speed_X : Float := 2.0;
Speed_Y : Float := 4.0;
Next : Time;
Period : constant Time_Span := Milliseconds (40);
-- reference to the application window
Window : Window_Id;
-- reference to the graphical canvas associated with the application window
Canvas : Canvas_Id;
begin
Window :=
Create_Window
(Width => Integer (Width),
Height => Integer (Height),
Name => "Bouncing ball");
Canvas := Get_Canvas (Window);
Next := Clock + Period;
while not Is_Killed loop
if (abs X) + Ball_Radius >= Width / 2.0 then
Speed_X := -Speed_X;
end if;
if (abs Y) + Ball_Radius >= Height / 2.0 then
Speed_Y := -Speed_Y;
end if;
X := X + Speed_X;
Y := Y + Speed_Y;
Draw_Sphere
(Canvas => Canvas,
Position => (X, Y, 0.0),
Radius => Ball_Radius,
Color => Red);
Swap_Buffers (Window);
delay until Next;
Next := Next + Period;
end loop;
end Main;
|
DrenfongWong/tkm-rpc | Ada | 1,050 | ads | with Tkmrpc.Types;
with Tkmrpc.Operations.Ike;
package Tkmrpc.Response.Ike.Dh_Generate_Key is
Data_Size : constant := 0;
Padding_Size : constant := Response.Body_Size - Data_Size;
subtype Padding_Range is Natural range 1 .. Padding_Size;
subtype Padding_Type is Types.Byte_Sequence (Padding_Range);
type Response_Type is record
Header : Response.Header_Type;
Padding : Padding_Type;
end record;
for Response_Type use record
Header at 0 range 0 .. (Response.Header_Size * 8) - 1;
Padding at Response.Header_Size + Data_Size range
0 .. (Padding_Size * 8) - 1;
end record;
for Response_Type'Size use Response.Response_Size * 8;
Null_Response : constant Response_Type :=
Response_Type'
(Header =>
Response.Header_Type'(Operation => Operations.Ike.Dh_Generate_Key,
Result => Results.Invalid_Operation,
Request_Id => 0),
Padding => Padding_Type'(others => 0));
end Tkmrpc.Response.Ike.Dh_Generate_Key;
|
charlie5/cBound | Ada | 1,688 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_glx_feedback_buffer_request_t is
-- Item
--
type Item is record
major_opcode : aliased Interfaces.Unsigned_8;
minor_opcode : aliased Interfaces.Unsigned_8;
length : aliased Interfaces.Unsigned_16;
context_tag : aliased xcb.xcb_glx_context_tag_t;
size : aliased Interfaces.Integer_32;
the_type : aliased Interfaces.Integer_32;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_glx_feedback_buffer_request_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_feedback_buffer_request_t.Item,
Element_Array => xcb.xcb_glx_feedback_buffer_request_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_glx_feedback_buffer_request_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_feedback_buffer_request_t.Pointer,
Element_Array => xcb.xcb_glx_feedback_buffer_request_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_glx_feedback_buffer_request_t;
|
Heziode/lsystem-editor | Ada | 9,081 | 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.
-------------------------------------------------------------------------------
with Ada.Strings.Unbounded;
with LSE.Utils.Angle;
with LSE.Utils.Coordinate_2D_List;
with LSE.Model.IO.Drawing_Area.Drawing_Area_Ptr;
use Ada.Strings.Unbounded;
use LSE.Utils.Angle;
use LSE.Utils.Coordinate_2D_List;
use LSE.Model.IO.Drawing_Area.Drawing_Area_Ptr;
-- @summary
-- Represent an abstract LOGO Turtle.
--
-- @description
-- This package represent an abstract LOGO Turtle. It encapsulates a set of
-- structures and methods which is designed to draw what is dictated to him
-- on a specific medium.
--
package LSE.Model.IO.Turtle is
-- Representing a LOGO Turtle
type Instance is tagged private;
-- Raise when Max_X - Min_X or Max_Y - Min_Y give 0
Divide_By_Zero : exception;
-- Default width of the medium
Default_Width : constant Positive := 600;
-- Default height of the medium
Default_Height : constant Positive := 600;
-- Default background color
Default_Background_Color : constant Unbounded_String :=
To_Unbounded_String ("");
-- Default foreground color
Default_Foreground_Color : constant Unbounded_String :=
To_Unbounded_String ("#000000");
-- Default size of line that will be drawn
Default_Line_Size : constant Float := 100.0;
-- Default angle
Default_Angle : constant LSE.Utils.Angle.Angle := 0.0;
Default_Margin_Top,
Default_Margin_Right,
Default_Margin_Bottom,
Default_Margin_Left : constant Float := 0.0;
-- Constructor
function Initialize return Instance;
-- Mutator of Width
procedure Set_Width (This : out Instance; Value : Positive);
-- Mutator of Height
procedure Set_Height (This : out Instance; Value : Positive);
-- Mutator of background color
procedure Set_Background_Color (This : out Instance;
Value : String);
-- Mutator of foreground color
procedure Set_Foreground_Color (This : out Instance; Value : String);
-- Mutator of angle
procedure Set_Angle (This : out Instance;
Value : LSE.Utils.Angle.Angle);
-- Accessor of width
function Get_Width (This : Instance) return Positive;
-- Accessor of height
function Get_Height (This : Instance) return Positive;
-- Accessor of background color
function Get_Background_Color (This : Instance) return String;
-- Accessor of foreground color
function Get_Foreground_Color (This : Instance) return String;
-- Accessor of offset x
function Get_Offset_X (This : Instance) return Float;
-- Accessor of offset y
function Get_Offset_Y (This : Instance) return Float;
-- Accessor of max X
function Get_Max_X (This : Instance) return Float;
-- Accessor of max Y
function Get_Max_Y (This : Instance) return Float;
-- Accessor of min X
function Get_Min_X (This : Instance) return Float;
-- Accessor of min Y
function Get_Min_Y (This : Instance) return Float;
-- Mutator of max X
procedure Set_Max_X (This : out Instance; Value : Float);
-- Mutator of max Y
procedure Set_Max_Y (This : out Instance; Value : Float);
-- Mutator of min X
procedure Set_Min_X (This : out Instance; Value : Float);
-- Mutator of min Y
procedure Set_Min_Y (This : out Instance; Value : Float);
-- Accessor of margin top
function Get_Margin_Top (This : Instance) return Float;
-- Accessor of margin right
function Get_Margin_Right (This : Instance) return Float;
-- Accessor of margin Bottom
function Get_Margin_Bottom (This : Instance) return Float;
-- Accessor of margin left
function Get_Margin_Left (This : Instance) return Float;
-- Accessor of medium
function Get_Medium (This : Instance)
return LSE.Model.IO.Drawing_Area.Drawing_Area_Ptr.Holder;
-- Mutator of margin top
procedure Set_Margin_Top (This : out Instance; Value : Natural);
-- Mutator of margin right
procedure Set_Margin_Right (This : out Instance; Value : Natural);
-- Mutator of margin Bottom
procedure Set_Margin_Bottom (This : out Instance; Value : Natural);
-- Mutator of margin left
procedure Set_Margin_Left (This : out Instance; Value : Natural);
-- Mutator of all margin of medium
procedure Set_Margin (This : out Instance; Value : Natural);
-- Mutator of medium
procedure Set_Medium (This : out Instance;
Value : LSE.Model.IO.Drawing_Area.
Drawing_Area_Ptr.Holder);
-- Mutator of dry run
procedure Set_Dry_Run (This : out Instance; Value : Boolean);
-- Put this Turtle configuration in STDIO
procedure Put (This : Instance);
-- Configure the medium and turtle
procedure Configure (This : in out Instance);
-- Draw the final representation (save file, display in screen, etc.)
procedure Draw (This : in out Instance);
-- Go forward
-- @param Trace True for stroke, False otherwise
procedure Forward (This : in out Instance; Trace : Boolean := False);
-- Positive rotation by angle
procedure Rotate_Clockwise (This : in out Instance);
-- Negative rotation by angle
procedure Rotate_Anticlockwise (This : in out Instance);
-- Go backward
procedure UTurn (This : in out Instance);
-- Save the current position in medium
procedure Position_Save (This : in out Instance);
-- Restore the previous saved location in medium
procedure Position_Restore (This : in out Instance);
private
type Instance is tagged record
-- Width of the medium
Width : Positive := Default_Width;
-- Height of the medium
Height : Positive := Default_Height;
-- Background color
Background_Color : Unbounded_String := Default_Background_Color;
-- foreground color
Foreground_Color : Unbounded_String := Default_Foreground_Color;
-- Size of line that will be drawn
Line_Size : Float := Default_Line_Size;
-- Angle step
Angle : LSE.Utils.Angle.Angle := Default_Angle;
-- Current angle use in medium
Stack_Angle : List.Vector;
-- "Stack_Coordinate" to save / restore coordinate
Stack_Coordinate : LSE.Utils.Coordinate_2D_List.Vector;
-- Maximum X coordinate of the L-System
Max_X,
-- Maximum Y coordinate of the L-System
Max_Y,
-- Minimum X coordinate of the L-System
Min_X,
-- Minimum Y coordinate of the L-System
Min_Y : Float := 0.0;
-- Ratio of the L-System (to fit closely the medium)
Ratio : Float := 1.0;
-- X shift on medium.
-- Note: offset does not take margin in consideration because it is
-- depending to the medium orientation.
Offset_X,
-- Y shift on medium
-- Note: offset does not take margin in consideration because it is
-- depending to the medium orientation.
Offset_Y : Float := 0.0;
-- Margin top
Margin_Top : Float := Default_Margin_Top;
-- Margin right
Margin_Right : Float := Default_Margin_Right;
-- Margin bottom
Margin_Bottom : Float := Default_Margin_Bottom;
-- Margin left
Margin_Left : Float := Default_Margin_Left;
-- Medium where draw L-System
Medium : LSE.Model.IO.Drawing_Area.Drawing_Area_Ptr.Holder;
-- Dry run it just used to compute l-system dimensions
Dry_Run : Boolean := False;
end record;
-- Make ratio and offsets for current medium
procedure Make_Offset (This : in out Instance);
end LSE.Model.IO.Turtle;
|
reznikmm/matreshka | Ada | 3,969 | 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_Prefix_Attributes;
package Matreshka.ODF_Text.Prefix_Attributes is
type Text_Prefix_Attribute_Node is
new Matreshka.ODF_Text.Abstract_Text_Attribute_Node
and ODF.DOM.Text_Prefix_Attributes.ODF_Text_Prefix_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Text_Prefix_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Text_Prefix_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Text.Prefix_Attributes;
|
reznikmm/matreshka | Ada | 3,765 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.Constants;
package body Matreshka.ODF_Attributes.Style.Num_Format is
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Style_Num_Format_Node)
return League.Strings.Universal_String is
begin
return ODF.Constants.Num_Format_Name;
end Get_Local_Name;
end Matreshka.ODF_Attributes.Style.Num_Format;
|
persan/A-gst | Ada | 11,018 | ads | pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
with System;
-- limited -- with GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h;
with glib;
with glib.Values;
with System;
with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h;
-- with GStreamer.GST_Low_Level.glib_2_0_glib_deprecated_gthread_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaskpool_h;
with glib;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttask_h is
-- unsupported macro: GST_TYPE_TASK (gst_task_get_type ())
-- arg-macro: function GST_TASK (task)
-- return G_TYPE_CHECK_INSTANCE_CAST ((task), GST_TYPE_TASK, GstTask);
-- arg-macro: function GST_IS_TASK (task)
-- return G_TYPE_CHECK_INSTANCE_TYPE ((task), GST_TYPE_TASK);
-- arg-macro: function GST_TASK_CLASS (tclass)
-- return G_TYPE_CHECK_CLASS_CAST ((tclass), GST_TYPE_TASK, GstTaskClass);
-- arg-macro: function GST_IS_TASK_CLASS (tclass)
-- return G_TYPE_CHECK_CLASS_TYPE ((tclass), GST_TYPE_TASK);
-- arg-macro: function GST_TASK_GET_CLASS (task)
-- return G_TYPE_INSTANCE_GET_CLASS ((task), GST_TYPE_TASK, GstTaskClass);
-- arg-macro: function GST_TASK_CAST (task)
-- return (GstTask*)(task);
-- arg-macro: function GST_TASK_STATE (task)
-- return GST_TASK_CAST(task).state;
-- arg-macro: function GST_TASK_GET_COND (task)
-- return GST_TASK_CAST(task).cond;
-- arg-macro: procedure GST_TASK_WAIT (task)
-- g_cond_wait(GST_TASK_GET_COND (task), GST_OBJECT_GET_LOCK (task))
-- arg-macro: procedure GST_TASK_SIGNAL (task)
-- g_cond_signal(GST_TASK_GET_COND (task))
-- arg-macro: procedure GST_TASK_BROADCAST (task)
-- g_cond_broadcast(GST_TASK_GET_COND (task))
-- arg-macro: function GST_TASK_GET_LOCK (task)
-- return GST_TASK_CAST(task).lock;
-- GStreamer
-- * Copyright (C) <1999> Erik Walthinsen <[email protected]>
-- * <2005> Wim Taymans <[email protected]>
-- *
-- * gsttask.h: Streaming tasks
-- *
-- * 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.
--
--*
-- * GstTaskFunction:
-- * @data: user data passed to the function
-- *
-- * A function that will repeatedly be called in the thread created by
-- * a #GstTask.
--
type GstTaskFunction is access procedure (arg1 : System.Address);
pragma Convention (C, GstTaskFunction); -- gst/gsttask.h:38
-- --- standard type macros ---
type GstTask;
type anon_192;
type anon_193 is record
thread : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GThread; -- gst/gsttask.h:160
end record;
pragma Convention (C_Pass_By_Copy, anon_193);
type u_GstTask_u_gst_reserved_array is array (0 .. 2) of System.Address;
type anon_192 (discr : unsigned := 0) is record
case discr is
when 0 =>
ABI : aliased anon_193; -- gst/gsttask.h:161
when others =>
u_gst_reserved : u_GstTask_u_gst_reserved_array; -- gst/gsttask.h:162
end case;
end record;
pragma Convention (C_Pass_By_Copy, anon_192);
pragma Unchecked_Union (anon_192);--subtype GstTask is u_GstTask; -- gst/gsttask.h:49
type GstTaskClass;
type u_GstTaskClass_u_gst_reserved_array is array (0 .. 3) of System.Address;
--subtype GstTaskClass is u_GstTaskClass; -- gst/gsttask.h:50
-- skipped empty struct u_GstTaskPrivate
-- skipped empty struct GstTaskPrivate
--*
-- * GstTaskState:
-- * @GST_TASK_STARTED: the task is started and running
-- * @GST_TASK_STOPPED: the task is stopped
-- * @GST_TASK_PAUSED: the task is paused
-- *
-- * The different states a task can be in
--
type GstTaskState is
(GST_TASK_STARTED,
GST_TASK_STOPPED,
GST_TASK_PAUSED);
pragma Convention (C, GstTaskState); -- gst/gsttask.h:65
--*
-- * GST_TASK_STATE:
-- * @task: Task to get the state of
-- *
-- * Get access to the state of the task.
--
--*
-- * GST_TASK_GET_COND:
-- * @task: Task to get the cond of
-- *
-- * Get access to the cond of the task.
--
--*
-- * GST_TASK_WAIT:
-- * @task: Task to wait for
-- *
-- * Wait for the task cond to be signalled
--
--*
-- * GST_TASK_SIGNAL:
-- * @task: Task to signal
-- *
-- * Signal the task cond
--
--*
-- * GST_TASK_BROADCAST:
-- * @task: Task to broadcast
-- *
-- * Send a broadcast signal to all waiting task conds
--
--*
-- * GST_TASK_GET_LOCK:
-- * @task: Task to get the lock of
-- *
-- * Get access to the task lock.
--
--*
-- * GstTaskThreadCallbacks:
-- * @enter_thread: a thread is entered, this callback is called when the new
-- * thread enters its function.
-- * @leave_thread: a thread is exiting, this is called when the thread is about
-- * to leave its function
-- *
-- * Custom GstTask thread callback functions that can be installed.
-- *
-- * Since: 0.10.24
--
-- manage the lifetime of the thread
type GstTaskThreadCallbacks_u_gst_reserved_array is array (0 .. 3) of System.Address;
type GstTaskThreadCallbacks is record
enter_thread : access procedure
(arg1 : access GstTask;
arg2 : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GThread;
arg3 : System.Address); -- gst/gsttask.h:125
leave_thread : access procedure
(arg1 : access GstTask;
arg2 : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GThread;
arg3 : System.Address); -- gst/gsttask.h:126
u_gst_reserved : GstTaskThreadCallbacks_u_gst_reserved_array; -- gst/gsttask.h:128
end record;
pragma Convention (C_Pass_By_Copy, GstTaskThreadCallbacks); -- gst/gsttask.h:129
-- skipped anonymous struct anon_191
--< private >
--*
-- * GstTask:
-- * @state: the state of the task
-- * @cond: used to pause/resume the task
-- * @lock: The lock taken when iterating the task function
-- * @func: the function executed by this task
-- * @data: data passed to the task function
-- * @running: a flag indicating that the task is running
-- *
-- * The #GstTask object.
--
type GstTask is record
object : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject; -- gst/gsttask.h:143
state : aliased GstTaskState; -- gst/gsttask.h:146
cond : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GCond; -- gst/gsttask.h:147
lock : access GStreamer.GST_Low_Level.glib_2_0_glib_deprecated_gthread_h.GStaticRecMutex; -- gst/gsttask.h:149
func : GstTaskFunction; -- gst/gsttask.h:151
data : System.Address; -- gst/gsttask.h:152
running : aliased GLIB.gboolean; -- gst/gsttask.h:154
abidata : aliased anon_192; -- gst/gsttask.h:163
priv : System.Address; -- gst/gsttask.h:165
end record;
pragma Convention (C_Pass_By_Copy, GstTask); -- gst/gsttask.h:142
--< public >
-- with LOCK
--< private >
-- thread this task is currently running in
type GstTaskClass is record
parent_class : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObjectClass; -- gst/gsttask.h:169
pool : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaskpool_h.GstTaskPool; -- gst/gsttask.h:172
u_gst_reserved : u_GstTaskClass_u_gst_reserved_array; -- gst/gsttask.h:175
end record;
pragma Convention (C_Pass_By_Copy, GstTaskClass); -- gst/gsttask.h:168
--< private >
--< private >
procedure gst_task_cleanup_all; -- gst/gsttask.h:178
pragma Import (C, gst_task_cleanup_all, "gst_task_cleanup_all");
function gst_task_get_type return GLIB.GType; -- gst/gsttask.h:180
pragma Import (C, gst_task_get_type, "gst_task_get_type");
function gst_task_create (func : GstTaskFunction; data : System.Address) return access GstTask; -- gst/gsttask.h:182
pragma Import (C, gst_task_create, "gst_task_create");
procedure gst_task_set_lock (c_task : access GstTask; mutex : access GStreamer.GST_Low_Level.glib_2_0_glib_deprecated_gthread_h.GStaticRecMutex); -- gst/gsttask.h:183
pragma Import (C, gst_task_set_lock, "gst_task_set_lock");
procedure gst_task_set_priority (c_task : access GstTask; priority : GStreamer.GST_Low_Level.glib_2_0_glib_deprecated_gthread_h.GThreadPriority); -- gst/gsttask.h:184
pragma Import (C, gst_task_set_priority, "gst_task_set_priority");
function gst_task_get_pool (c_task : access GstTask) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaskpool_h.GstTaskPool; -- gst/gsttask.h:186
pragma Import (C, gst_task_get_pool, "gst_task_get_pool");
procedure gst_task_set_pool (c_task : access GstTask; pool : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaskpool_h.GstTaskPool); -- gst/gsttask.h:187
pragma Import (C, gst_task_set_pool, "gst_task_set_pool");
procedure gst_task_set_thread_callbacks
(c_task : access GstTask;
callbacks : access GstTaskThreadCallbacks;
user_data : System.Address;
notify : GStreamer.GST_Low_Level.glib_2_0_glib_gtypes_h.GDestroyNotify); -- gst/gsttask.h:189
pragma Import (C, gst_task_set_thread_callbacks, "gst_task_set_thread_callbacks");
function gst_task_get_state (c_task : access GstTask) return GstTaskState; -- gst/gsttask.h:194
pragma Import (C, gst_task_get_state, "gst_task_get_state");
function gst_task_set_state (c_task : access GstTask; state : GstTaskState) return GLIB.gboolean; -- gst/gsttask.h:195
pragma Import (C, gst_task_set_state, "gst_task_set_state");
function gst_task_start (c_task : access GstTask) return GLIB.gboolean; -- gst/gsttask.h:197
pragma Import (C, gst_task_start, "gst_task_start");
function gst_task_stop (c_task : access GstTask) return GLIB.gboolean; -- gst/gsttask.h:198
pragma Import (C, gst_task_stop, "gst_task_stop");
function gst_task_pause (c_task : access GstTask) return GLIB.gboolean; -- gst/gsttask.h:199
pragma Import (C, gst_task_pause, "gst_task_pause");
function gst_task_join (c_task : access GstTask) return GLIB.gboolean; -- gst/gsttask.h:201
pragma Import (C, gst_task_join, "gst_task_join");
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttask_h;
|
io7m/coreland-c_string | Ada | 186 | ads | package Test is
procedure Assert
(Check : in Boolean;
Pass_Message : in String := "Assertion passed";
Fail_Message : in String := "Assertion failed");
end Test;
|
zhmu/ananas | Ada | 3,227 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 9 9 --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Handling of packed arrays with Component_Size = 99
package System.Pack_99 is
pragma Preelaborate;
Bits : constant := 99;
type Bits_99 is mod 2 ** Bits;
for Bits_99'Size use Bits;
-- In all subprograms below, Rev_SSO is set True if the array has the
-- non-default scalar storage order.
function Get_99
(Arr : System.Address;
N : Natural;
Rev_SSO : Boolean) return Bits_99 with Inline;
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is extracted and returned.
procedure Set_99
(Arr : System.Address;
N : Natural;
E : Bits_99;
Rev_SSO : Boolean) with Inline;
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is set to the given value.
end System.Pack_99;
|
Letractively/ada-ado | Ada | 11,796 | adb | -----------------------------------------------------------------------
-- ADO Sessions -- Sessions Management
-- Copyright (C) 2009, 2010, 2011, 2012, 2013, 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.
-----------------------------------------------------------------------
with Util.Log;
with Util.Log.Loggers;
with Ada.Unchecked_Deallocation;
with ADO.Drivers;
with ADO.Sequences;
package body ADO.Sessions is
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("ADO.Sessions");
procedure Check_Session (Database : in Session'Class;
Message : in String := "") is
begin
if Database.Impl = null then
Log.Error ("Session is closed or not initialized");
raise NOT_OPEN;
end if;
if Message'Length > 0 then
Log.Info (Message, Database.Impl.Database.Get_Ident);
end if;
end Check_Session;
-- ---------
-- Session
-- ---------
-- ------------------------------
-- Get the session status.
-- ------------------------------
function Get_Status (Database : in Session) return ADO.Databases.Connection_Status is
begin
if Database.Impl = null then
return ADO.Databases.CLOSED;
end if;
return Database.Impl.Database.Get_Status;
end Get_Status;
-- ------------------------------
-- Close the session.
-- ------------------------------
procedure Close (Database : in out Session) is
procedure Free is new
Ada.Unchecked_Deallocation (Object => Session_Record,
Name => Session_Record_Access);
Is_Zero : Boolean;
begin
Log.Info ("Closing session");
if Database.Impl /= null then
ADO.Objects.Release_Proxy (Database.Impl.Proxy);
Database.Impl.Database.Close;
Util.Concurrent.Counters.Decrement (Database.Impl.Counter, Is_Zero);
if Is_Zero then
Free (Database.Impl);
end if;
Database.Impl := null;
end if;
end Close;
-- ------------------------------
-- Get the database connection.
-- ------------------------------
function Get_Connection (Database : in Session) return ADO.Databases.Connection'Class is
begin
Check_Session (Database);
return Database.Impl.Database;
end Get_Connection;
-- ------------------------------
-- Attach the object to the session.
-- ------------------------------
procedure Attach (Database : in out Session;
Object : in ADO.Objects.Object_Ref'Class) is
pragma Unreferenced (Object);
begin
Check_Session (Database);
end Attach;
-- ------------------------------
-- Check if the session contains the object identified by the given key.
-- ------------------------------
function Contains (Database : in Session;
Item : in ADO.Objects.Object_Key) return Boolean is
begin
Check_Session (Database);
return ADO.Objects.Cache.Contains (Database.Impl.Cache, Item);
end Contains;
-- ------------------------------
-- Remove the object from the session cache.
-- ------------------------------
procedure Evict (Database : in out Session;
Item : in ADO.Objects.Object_Key) is
begin
Check_Session (Database);
ADO.Objects.Cache.Remove (Database.Impl.Cache, Item);
end Evict;
-- ------------------------------
-- Create a query statement. The statement is not prepared
-- ------------------------------
function Create_Statement (Database : in Session;
Table : in ADO.Schemas.Class_Mapping_Access)
return Query_Statement is
begin
Check_Session (Database);
return Database.Impl.Database.Create_Statement (Table);
end Create_Statement;
-- ------------------------------
-- Create a query statement. The statement is not prepared
-- ------------------------------
function Create_Statement (Database : in Session;
Query : in String)
return Query_Statement is
begin
Check_Session (Database);
return Database.Impl.Database.Create_Statement (Query);
end Create_Statement;
-- ------------------------------
-- Create a query statement. The statement is not prepared
-- ------------------------------
function Create_Statement (Database : in Session;
Query : in ADO.Queries.Context'Class)
return Query_Statement is
begin
Check_Session (Database);
declare
SQL : constant String := Query.Get_SQL (Database.Impl.Database.Get_Driver_Index);
Stmt : Query_Statement := Database.Impl.Database.Create_Statement (SQL);
begin
Stmt.Set_Parameters (Query);
return Stmt;
end;
end Create_Statement;
-- ------------------------------
-- Create a query statement and initialize the SQL statement with the query definition.
-- ------------------------------
function Create_Statement (Database : in Session;
Query : in ADO.Queries.Query_Definition_Access)
return Query_Statement is
begin
Check_Session (Database);
declare
Index : constant ADO.Drivers.Driver_Index := Database.Impl.Database.Get_Driver_Index;
SQL : constant String := ADO.Queries.Get_SQL (Query, Index, False);
begin
return Database.Impl.Database.Create_Statement (SQL);
end;
end Create_Statement;
-- ------------------------------
-- Create a query statement. The statement is not prepared
-- ------------------------------
function Create_Statement (Database : in Session;
Query : in ADO.SQL.Query'Class;
Table : in ADO.Schemas.Class_Mapping_Access)
return Query_Statement is
begin
Check_Session (Database);
declare
Stmt : Query_Statement := Database.Impl.Database.Create_Statement (Table);
begin
if Query in ADO.Queries.Context'Class then
declare
Pos : constant ADO.Drivers.Driver_Index := Database.Impl.Database.Get_Driver_Index;
SQL : constant String := ADO.Queries.Context'Class (Query).Get_SQL (Pos);
begin
ADO.SQL.Append (Stmt.Get_Query.SQL, SQL);
end;
end if;
Stmt.Set_Parameters (Query);
return Stmt;
end;
end Create_Statement;
-- ---------
-- Master Session
-- ---------
-- ------------------------------
-- Start a transaction.
-- ------------------------------
procedure Begin_Transaction (Database : in out Master_Session) is
begin
Check_Session (Database, "Begin transaction {0}");
Database.Impl.Database.Begin_Transaction;
end Begin_Transaction;
-- ------------------------------
-- Commit the current transaction.
-- ------------------------------
procedure Commit (Database : in out Master_Session) is
begin
Check_Session (Database, "Commit transaction {0}");
Database.Impl.Database.Commit;
end Commit;
-- ------------------------------
-- Rollback the current transaction.
-- ------------------------------
procedure Rollback (Database : in out Master_Session) is
begin
Check_Session (Database, "Rollback transaction {0}");
Database.Impl.Database.Rollback;
end Rollback;
-- ------------------------------
-- Allocate an identifier for the table.
-- ------------------------------
procedure Allocate (Database : in out Master_Session;
Id : in out ADO.Objects.Object_Record'Class) is
begin
Check_Session (Database);
ADO.Sequences.Allocate (Database.Sequences.all, Id);
end Allocate;
-- ------------------------------
-- Flush the objects that were modified.
-- ------------------------------
procedure Flush (Database : in out Master_Session) is
begin
Check_Session (Database);
end Flush;
overriding
procedure Adjust (Object : in out Session) is
begin
if Object.Impl /= null then
Util.Concurrent.Counters.Increment (Object.Impl.Counter);
end if;
end Adjust;
overriding
procedure Finalize (Object : in out Session) is
procedure Free is
new Ada.Unchecked_Deallocation (Object => Session_Record,
Name => Session_Record_Access);
Is_Zero : Boolean;
begin
if Object.Impl /= null then
Util.Concurrent.Counters.Decrement (Object.Impl.Counter, Is_Zero);
if Is_Zero then
ADO.Objects.Release_Proxy (Object.Impl.Proxy);
Object.Impl.Database.Close;
Free (Object.Impl);
end if;
Object.Impl := null;
end if;
end Finalize;
-- ------------------------------
-- Create a delete statement
-- ------------------------------
function Create_Statement (Database : in Master_Session;
Table : in ADO.Schemas.Class_Mapping_Access)
return Delete_Statement is
begin
Check_Session (Database);
return Database.Impl.Database.Create_Statement (Table);
end Create_Statement;
-- ------------------------------
-- Create an update statement
-- ------------------------------
function Create_Statement (Database : in Master_Session;
Table : in ADO.Schemas.Class_Mapping_Access)
return Update_Statement is
begin
Check_Session (Database);
return Database.Impl.Database.Create_Statement (Table);
end Create_Statement;
-- ------------------------------
-- Create an insert statement
-- ------------------------------
function Create_Statement (Database : in Master_Session;
Table : in ADO.Schemas.Class_Mapping_Access)
return Insert_Statement is
begin
Check_Session (Database);
return Database.Impl.Database.Create_Statement (Table);
end Create_Statement;
-- ------------------------------
-- Internal method to get the session proxy associated with the given database session.
-- The session proxy is associated with some ADO objects to be able to retrieve the database
-- session for the implementation of lazy loading. The session proxy is kept until the
-- session exist and at least one ADO object is refering to it.
-- ------------------------------
function Get_Session_Proxy (Database : in Session) return ADO.Objects.Session_Proxy_Access is
use type ADO.Objects.Session_Proxy_Access;
begin
Check_Session (Database);
if Database.Impl.Proxy = null then
Database.Impl.Proxy := ADO.Objects.Create_Session_Proxy (Database.Impl);
end if;
return Database.Impl.Proxy;
end Get_Session_Proxy;
end ADO.Sessions;
|
reznikmm/matreshka | Ada | 3,997 | 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.Office_Display_Attributes;
package Matreshka.ODF_Office.Display_Attributes is
type Office_Display_Attribute_Node is
new Matreshka.ODF_Office.Abstract_Office_Attribute_Node
and ODF.DOM.Office_Display_Attributes.ODF_Office_Display_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Office_Display_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Office_Display_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Office.Display_Attributes;
|
charlie5/lace | Ada | 2,660 | ads | private package GID.Decoding_PNG is
type PNG_Chunk_tag is (
--
-- Critical chunks
--
IHDR, -- must be the first chunk; it contains the header.
PLTE, -- contains the palette; list of colors.
IDAT, -- contains the image, which may be split among multiple IDAT chunks.
IEND, -- marks the image end.
--
-- Ancillary chunks
--
bKGD, -- gives the default background color.
cHRM, -- gives the chromaticity coordinates of the display primaries and white point.
gAMA, -- specifies gamma.
hIST, -- can store the histogram, or total amount of each color in the image.
iCCP, -- is an ICC color profile.
iTXt, -- contains UTF-8 text, compressed or not, with an optional language tag.
pHYs, -- holds the intended pixel size and/or aspect ratio of the image.
sBIT, -- (significant bits) indicates the color-accuracy of the source data.
sPLT, -- suggests a palette to use if the full range of colors is unavailable.
sRGB, -- indicates that the standard sRGB color space is used.
tEXt, -- can store text that can be represented in ISO/IEC 8859-1.
tIME, -- stores the time that the image was last changed.
tRNS, -- contains transparency information.
zTXt, -- contains compressed text with the same limits as tEXt.
--
-- Public extentions
-- PNG Extensions and Register of Public Chunks and Keywords
--
oFFs, -- image offset from frame or page origin
pCAL, -- physical calibration of pixel values
sCAL, -- physical scale of image subject
sTER, -- stereographic subimage layout
gIFg, -- GIF Graphic Control Extension
gIFx, -- GIF Application Extension
fRAc, -- fractal image parameters
--
-- Private chunks (not defined in the ISO standard)
--
vpAg, -- used in ImageMagick to store "virtual page" size
spAL,
prVW,
cmOD,
cmPP,
cpIp,
mkBF,
mkBS,
mkBT,
mkTS,
pcLb
);
type Chunk_head is record
length: U32;
kind : PNG_Chunk_tag;
end record;
procedure Read( image: in out image_descriptor; ch: out Chunk_head);
--------------------
-- Image decoding --
--------------------
generic
type Primary_color_range is mod <>;
with procedure Set_X_Y (x, y: Natural);
with procedure Put_Pixel (
red, green, blue : Primary_color_range;
alpha : Primary_color_range
);
with procedure Feedback (percents: Natural);
--
procedure Load (image: in out Image_descriptor);
end GID.Decoding_PNG;
|
persan/protobuf-ada | Ada | 35,302 | adb | pragma Ada_2012;
with Ada.Unchecked_Conversion;
package body Protocol_Buffers.IO.Coded_Output_Stream is
-----------------------
-- Encode_Zig_Zag_32 --
-----------------------
function Encode_Zig_Zag_32
(Value : in TMP_INTEGER)
return TMP_UNSIGNED_INTEGER
is
function TMP_INTEGER_To_Interfaces_Unsigned_32 is new Ada.Unchecked_Conversion (Source => TMP_INTEGER,
Target => Interfaces.Unsigned_32);
Value_To_Unsigned_32 : Interfaces.Unsigned_32 := TMP_INTEGER_To_Interfaces_Unsigned_32 (Value);
use type Interfaces.Unsigned_32;
begin
return TMP_UNSIGNED_INTEGER (Interfaces.Shift_Left (Value_To_Unsigned_32, 1) xor Interfaces.Shift_Right_Arithmetic (Value_To_Unsigned_32, 31));
end Encode_Zig_Zag_32;
-----------------------
-- Encode_Zig_Zag_64 --
-----------------------
function Encode_Zig_Zag_64
(Value : in TMP_LONG)
return TMP_UNSIGNED_LONG
is
function TMP_LONG_To_Interfaces_Unsigned_64 is new Ada.Unchecked_Conversion (Source => TMP_LONG,
Target => Interfaces.Unsigned_64);
Value_To_Unsigned_64 : Interfaces.Unsigned_64 := TMP_LONG_To_Interfaces_Unsigned_64 (Value);
use type Interfaces.Unsigned_64;
begin
return TMP_UNSIGNED_LONG (Interfaces.Shift_Left (Value_To_Unsigned_64, 1) xor Interfaces.Shift_Right_Arithmetic (Value_To_Unsigned_64, 63));
end Encode_Zig_Zag_64;
--------------------------------
-- Compute_Raw_Varint_32_Size --
--------------------------------
function Compute_Raw_Varint_32_Size
(Value : in TMP_UNSIGNED_INTEGER)
return TMP_OBJECT_SIZE
is
Value_To_Unsigned_32 : Interfaces.Unsigned_32 := Interfaces.Unsigned_32 (Value);
use type Interfaces.Unsigned_32;
begin
if Interfaces.Shift_Right (Value_To_Unsigned_32, 7) = 0 then return 1; end if;
if Interfaces.Shift_Right (Value_To_Unsigned_32, 14) = 0 then return 2; end if;
if Interfaces.Shift_Right (Value_To_Unsigned_32, 21) = 0 then return 3; end if;
if Interfaces.Shift_Right (Value_To_Unsigned_32, 28) = 0 then return 4; end if;
return 5;
end Compute_Raw_Varint_32_Size;
--------------------------------
-- Compute_Raw_Varint_64_Size --
--------------------------------
function Compute_Raw_Varint_64_Size
(Value : in TMP_UNSIGNED_LONG)
return TMP_OBJECT_SIZE
is
Value_To_Unsigned_64 : Interfaces.Unsigned_64 := Interfaces.Unsigned_64 (Value);
use type Interfaces.Unsigned_64;
begin
if Interfaces.Shift_Right (Value_To_Unsigned_64, 7) = 0 then return 1; end if;
if Interfaces.Shift_Right (Value_To_Unsigned_64, 14) = 0 then return 2; end if;
if Interfaces.Shift_Right (Value_To_Unsigned_64, 21) = 0 then return 3; end if;
if Interfaces.Shift_Right (Value_To_Unsigned_64, 28) = 0 then return 4; end if;
if Interfaces.Shift_Right (Value_To_Unsigned_64, 35) = 0 then return 5; end if;
if Interfaces.Shift_Right (Value_To_Unsigned_64, 42) = 0 then return 6; end if;
if Interfaces.Shift_Right (Value_To_Unsigned_64, 56) = 0 then return 8; end if;
if Interfaces.Shift_Right (Value_To_Unsigned_64, 63) = 0 then return 9; end if;
return 10;
end Compute_Raw_Varint_64_Size;
--------------------------
-- Compute_Boolean_Size --
--------------------------
function Compute_Boolean_Size
(Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_BOOLEAN)
return TMP_OBJECT_SIZE
is
begin
return Compute_Tag_Size (Field_Number) + Compute_Boolean_Size_No_Tag (Value);
end Compute_Boolean_Size;
-------------------------
-- Compute_Double_Size --
-------------------------
function Compute_Double_Size
(Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_DOUBLE)
return TMP_OBJECT_SIZE
is
begin
return Compute_Tag_Size (Field_Number) + Compute_Double_Size_No_Tag (Value);
end Compute_Double_Size;
------------------------------
-- Compute_Enumeration_Size --
------------------------------
function Compute_Enumeration_Size
(Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_INTEGER)
return TMP_OBJECT_SIZE
is
begin
return Compute_Tag_Size (Field_Number) + Compute_Enumeration_Size_No_Tag (Value);
end Compute_Enumeration_Size;
---------------------------
-- Compute_Fixed_32_Size --
---------------------------
function Compute_Fixed_32_Size
(Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_UNSIGNED_INTEGER)
return TMP_OBJECT_SIZE
is
begin
return Compute_Tag_Size (Field_Number) + Compute_Fixed_32_Size_No_Tag (Value);
end Compute_Fixed_32_Size;
---------------------------
-- Compute_Fixed_64_Size --
---------------------------
function Compute_Fixed_64_Size
(Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_UNSIGNED_LONG)
return TMP_OBJECT_SIZE
is
begin
return Compute_Tag_Size (Field_Number) + Compute_Fixed_64_Size_No_Tag (Value);
end Compute_Fixed_64_Size;
------------------------
-- Compute_Float_Size --
------------------------
function Compute_Float_Size
(Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_FLOAT)
return TMP_OBJECT_SIZE
is
begin
return Compute_Tag_Size (Field_Number) + Compute_Float_Size_No_Tag (Value);
end Compute_Float_Size;
-----------------------------
-- Compute_Integer_32_Size --
-----------------------------
function Compute_Integer_32_Size
(Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_INTEGER)
return TMP_OBJECT_SIZE
is
begin
return Compute_Tag_Size (Field_Number) + Compute_Integer_32_Size_No_Tag (Value);
end Compute_Integer_32_Size;
-----------------------------
-- Compute_Integer_64_Size --
-----------------------------
function Compute_Integer_64_Size
(Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_LONG)
return TMP_OBJECT_SIZE
is
begin
return Compute_Tag_Size (Field_Number) + Compute_Integer_64_Size_No_Tag (Value);
end Compute_Integer_64_Size;
----------------------------------
-- Compute_Signed_Fixed_32_Size --
----------------------------------
function Compute_Signed_Fixed_32_Size
(Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_INTEGER)
return TMP_OBJECT_SIZE
is
begin
return Compute_Tag_Size (Field_Number) + Compute_Signed_Fixed_32_Size_No_Tag (Value);
end Compute_Signed_Fixed_32_Size;
----------------------------------
-- Compute_Signed_Fixed_64_Size --
----------------------------------
function Compute_Signed_Fixed_64_Size
(Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_LONG)
return TMP_OBJECT_SIZE
is
begin
return Compute_Tag_Size (Field_Number) + Compute_Signed_Fixed_64_Size_No_Tag (Value);
end Compute_Signed_Fixed_64_Size;
------------------------------------
-- Compute_Signed_Integer_32_Size --
------------------------------------
function Compute_Signed_Integer_32_Size
(Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_INTEGER)
return TMP_OBJECT_SIZE
is
begin
return Compute_Tag_Size (Field_Number) + Compute_Signed_Integer_32_Size_No_Tag (Value);
end Compute_Signed_Integer_32_Size;
------------------------------------
-- Compute_Signed_Integer_64_Size --
------------------------------------
function Compute_Signed_Integer_64_Size
(Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_LONG)
return TMP_OBJECT_SIZE
is
begin
return Compute_Tag_Size (Field_Number) + Compute_Signed_Integer_64_Size_No_Tag (Value);
end Compute_Signed_Integer_64_Size;
-------------------------
-- Compute_String_Size --
-------------------------
function Compute_String_Size
(Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_STRING)
return TMP_OBJECT_SIZE
is
begin
return Compute_Tag_Size (Field_Number) + Compute_String_Size_No_Tag (Value);
end Compute_String_Size;
----------------------
-- Compute_Tag_Size --
----------------------
function Compute_Tag_Size
(Field_Number : TMP_FIELD_TYPE)
return TMP_OBJECT_SIZE
is
function TMP_FIELD_TYPE_To_TMP_UNSIGNED_INTEGER is new Ada.Unchecked_Conversion (Source => TMP_FIELD_TYPE,
Target => TMP_UNSIGNED_INTEGER);
Tag : TMP_UNSIGNED_INTEGER := Wire_Format.Make_Tag (Field_Number, TMP_WIRE_TYPE'Val (0));
begin
return Compute_Raw_Varint_32_Size (Tag);
end Compute_Tag_Size;
--------------------------------------
-- Compute_Unsigned_Integer_32_Size --
--------------------------------------
function Compute_Unsigned_Integer_32_Size
(Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_UNSIGNED_INTEGER)
return TMP_OBJECT_SIZE
is
begin
return Compute_Tag_Size (Field_Number) + Compute_Unsigned_Integer_32_Size_No_Tag (Value);
end Compute_Unsigned_Integer_32_Size;
--------------------------------------
-- Compute_Unsigned_Integer_64_Size --
--------------------------------------
function Compute_Unsigned_Integer_64_Size
(Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_UNSIGNED_LONG)
return TMP_OBJECT_SIZE
is
begin
return Compute_Tag_Size (Field_Number) + Compute_Unsigned_Integer_64_Size_No_Tag (Value);
end Compute_Unsigned_Integer_64_Size;
---------------------------------
-- Compute_Boolean_Size_No_Tag --
---------------------------------
function Compute_Boolean_Size_No_Tag
(Value : in TMP_BOOLEAN)
return TMP_OBJECT_SIZE
is
begin
return 1;
end Compute_Boolean_Size_No_Tag;
--------------------------------
-- Compute_Double_Size_No_Tag --
--------------------------------
function Compute_Double_Size_No_Tag
(Value : in TMP_DOUBLE)
return TMP_OBJECT_SIZE
is
begin
return TMP_LITTLE_ENDIAN_64_SIZE;
end Compute_Double_Size_No_Tag;
-------------------------------------
-- Compute_Enumeration_Size_No_Tag --
-------------------------------------
function Compute_Enumeration_Size_No_Tag
(Value : in TMP_INTEGER)
return TMP_OBJECT_SIZE
is
begin
return Compute_Integer_32_Size_No_Tag (Value);
end Compute_Enumeration_Size_No_Tag;
----------------------------------
-- Compute_Fixed_32_Size_No_Tag --
----------------------------------
function Compute_Fixed_32_Size_No_Tag
(Value : in TMP_UNSIGNED_INTEGER)
return TMP_OBJECT_SIZE
is
begin
return TMP_LITTLE_ENDIAN_32_SIZE;
end Compute_Fixed_32_Size_No_Tag;
----------------------------------
-- Compute_Fixed_64_Size_No_Tag --
----------------------------------
function Compute_Fixed_64_Size_No_Tag
(Value : in TMP_UNSIGNED_LONG)
return TMP_OBJECT_SIZE
is
begin
return TMP_LITTLE_ENDIAN_64_SIZE;
end Compute_Fixed_64_Size_No_Tag;
-------------------------------
-- Compute_Float_Size_No_Tag --
-------------------------------
function Compute_Float_Size_No_Tag
(Value : in TMP_FLOAT)
return TMP_OBJECT_SIZE
is
begin
return TMP_LITTLE_ENDIAN_32_SIZE;
end Compute_Float_Size_No_Tag;
------------------------------------
-- Compute_Integer_32_Size_No_Tag --
------------------------------------
function Compute_Integer_32_Size_No_Tag
(Value : in TMP_INTEGER)
return TMP_OBJECT_SIZE
is
function TMP_INTEGER_To_TMP_UNSIGNED_INTEGER is new Ada.Unchecked_Conversion (Source => TMP_INTEGER,
Target => TMP_UNSIGNED_INTEGER);
begin
if Value >= 0 then
return Compute_Raw_Varint_32_Size (TMP_INTEGER_To_TMP_UNSIGNED_INTEGER (Value));
else
-- Value must be sign-extended. See More Value Types
-- https://developers.google.com/protocol-buffers/docs/encoding
return 10;
end if;
end Compute_Integer_32_Size_No_Tag;
------------------------------------
-- Compute_Integer_64_Size_No_Tag --
------------------------------------
function Compute_Integer_64_Size_No_Tag
(Value : in TMP_LONG)
return TMP_OBJECT_SIZE
is
function TMP_LONG_To_TMP_UNSIGNED_LONG is new Ada.Unchecked_Conversion (Source => TMP_LONG,
Target => TMP_UNSIGNED_LONG);
begin
return Compute_Raw_Varint_64_Size (TMP_LONG_To_TMP_UNSIGNED_LONG (Value));
end Compute_Integer_64_Size_No_Tag;
-----------------------------------------
-- Compute_Signed_Fixed_32_Size_No_Tag --
-----------------------------------------
function Compute_Signed_Fixed_32_Size_No_Tag
(Value : in TMP_INTEGER)
return TMP_OBJECT_SIZE
is
begin
return TMP_LITTLE_ENDIAN_32_SIZE;
end Compute_Signed_Fixed_32_Size_No_Tag;
-----------------------------------------
-- Compute_Signed_Fixed_64_Size_No_Tag --
-----------------------------------------
function Compute_Signed_Fixed_64_Size_No_Tag
(Value : in TMP_LONG)
return TMP_OBJECT_SIZE
is
begin
return TMP_LITTLE_ENDIAN_64_SIZE;
end Compute_Signed_Fixed_64_Size_No_Tag;
-------------------------------------------
-- Compute_Signed_Integer_32_Size_No_Tag --
-------------------------------------------
function Compute_Signed_Integer_32_Size_No_Tag
(Value : in TMP_INTEGER)
return TMP_OBJECT_SIZE
is
begin
return Compute_Raw_Varint_32_Size (Encode_Zig_Zag_32 (Value));
end Compute_Signed_Integer_32_Size_No_Tag;
-------------------------------------------
-- Compute_Signed_Integer_64_Size_No_Tag --
-------------------------------------------
function Compute_Signed_Integer_64_Size_No_Tag
(Value : in TMP_LONG)
return TMP_OBJECT_SIZE
is
begin
return Compute_Raw_Varint_64_Size (Encode_Zig_Zag_64 (Value));
end Compute_Signed_Integer_64_Size_No_Tag;
--------------------------------
-- Compute_String_Size_No_Tag --
--------------------------------
function Compute_String_Size_No_Tag
(Value : in TMP_STRING)
return TMP_OBJECT_SIZE
is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Compute_String_Size_No_Tag unimplemented");
raise Program_Error with "Unimplemented function Compute_String_Size_No_Tag";
return Compute_String_Size_No_Tag (Value);
end Compute_String_Size_No_Tag;
---------------------------------------------
-- Compute_Unsigned_Integer_32_Size_No_Tag --
---------------------------------------------
function Compute_Unsigned_Integer_32_Size_No_Tag
(Value : in TMP_UNSIGNED_INTEGER)
return TMP_OBJECT_SIZE
is
begin
return Compute_Raw_Varint_32_Size (Value);
end Compute_Unsigned_Integer_32_Size_No_Tag;
---------------------------------------------
-- Compute_Unsigned_Integer_64_Size_No_Tag --
---------------------------------------------
function Compute_Unsigned_Integer_64_Size_No_Tag
(Value : in TMP_UNSIGNED_LONG)
return TMP_OBJECT_SIZE
is
begin
return Compute_Raw_Varint_64_Size (Value);
end Compute_Unsigned_Integer_64_Size_No_Tag;
-----------
-- Flush --
-----------
procedure Flush
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance)
is
begin
-- -- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Flush unimplemented");
-- raise Program_Error with "Unimplemented procedure Flush";
null;
end Flush;
-------------------
-- Write_Boolean --
-------------------
procedure Write_Boolean
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_BOOLEAN)
is
begin
The_Coded_Output_Stream.Write_Tag (Field_Number, Wire_Format.VARINT);
The_Coded_Output_Stream.Write_Boolean_No_Tag (Value);
end Write_Boolean;
------------------
-- Write_Double --
------------------
procedure Write_Double
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_DOUBLE)
is
begin
The_Coded_Output_Stream.Write_Tag (Field_Number, Wire_Format.FIXED_64);
The_Coded_Output_Stream.Write_Double_No_Tag (Value);
end Write_Double;
-----------------------
-- Write_Enumeration --
-----------------------
procedure Write_Enumeration
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_INTEGER)
is
begin
The_Coded_Output_Stream.Write_Tag (Field_Number, Wire_Format.VARINT);
The_Coded_Output_Stream.Write_Enumeration_No_Tag (Value);
end Write_Enumeration;
--------------------
-- Write_Fixed_32 --
--------------------
procedure Write_Fixed_32
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_UNSIGNED_INTEGER)
is
begin
The_Coded_Output_Stream.Write_Tag (Field_Number, Wire_Format.FIXED_32);
The_Coded_Output_Stream.Write_Fixed_32_No_Tag (Value);
end Write_Fixed_32;
--------------------
-- Write_Fixed_64 --
--------------------
procedure Write_Fixed_64
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_UNSIGNED_LONG)
is
begin
The_Coded_Output_Stream.Write_Tag (Field_Number, Wire_Format.FIXED_64);
The_Coded_Output_Stream.Write_Fixed_64_No_Tag (Value);
end Write_Fixed_64;
-----------------
-- Write_Float --
-----------------
procedure Write_Float
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_FLOAT)
is
begin
The_Coded_Output_Stream.Write_Tag (Field_Number, Wire_Format.FIXED_32);
The_Coded_Output_Stream.Write_Float_No_Tag (Value);
end Write_Float;
----------------------
-- Write_Integer_32 --
----------------------
procedure Write_Integer_32
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_INTEGER)
is
begin
The_Coded_Output_Stream.Write_Tag (Field_Number, Wire_Format.VARINT);
The_Coded_Output_Stream.Write_Integer_32_No_Tag (Value);
end Write_Integer_32;
----------------------
-- Write_Integer_64 --
----------------------
procedure Write_Integer_64
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_LONG)
is
begin
The_Coded_Output_Stream.Write_Tag (Field_Number, Wire_Format.VARINT);
The_Coded_Output_Stream.Write_Integer_64_No_Tag (Value);
end Write_Integer_64;
---------------------------
-- Write_Signed_Fixed_32 --
---------------------------
procedure Write_Signed_Fixed_32
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_INTEGER)
is
begin
The_Coded_Output_Stream.Write_Tag (Field_Number, Wire_Format.FIXED_32);
The_Coded_Output_Stream.Write_Signed_Fixed_32_No_Tag (Value);
end Write_Signed_Fixed_32;
---------------------------
-- Write_Signed_Fixed_64 --
---------------------------
procedure Write_Signed_Fixed_64
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_LONG)
is
begin
The_Coded_Output_Stream.Write_Tag (Field_Number, Wire_Format.FIXED_64);
The_Coded_Output_Stream.Write_Signed_Fixed_64_No_Tag (Value);
end Write_Signed_Fixed_64;
-----------------------------
-- Write_Signed_Integer_32 --
-----------------------------
procedure Write_Signed_Integer_32
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_INTEGER)
is
begin
The_Coded_Output_Stream.Write_Tag (Field_Number, Wire_Format.VARINT);
The_Coded_Output_Stream.Write_Signed_Integer_32_No_Tag (Value);
end Write_Signed_Integer_32;
-----------------------------
-- Write_Signed_Integer_64 --
-----------------------------
procedure Write_Signed_Integer_64
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_LONG)
is
begin
The_Coded_Output_Stream.Write_Tag (Field_Number, Wire_Format.VARINT);
The_Coded_Output_Stream.Write_Signed_Integer_64_No_Tag (Value);
end Write_Signed_Integer_64;
------------------
-- Write_String --
------------------
procedure Write_String
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_STRING)
is
begin
The_Coded_Output_Stream.Write_Tag (Field_Number, Wire_Format.LENGTH_DELIMITED);
The_Coded_Output_Stream.Write_String_No_Tag (Value);
end Write_String;
-------------------------------
-- Write_Unsigned_Integer_32 --
-------------------------------
procedure Write_Unsigned_Integer_32
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_UNSIGNED_INTEGER)
is
begin
The_Coded_Output_Stream.Write_Tag (Field_Number, Wire_Format.VARINT);
The_Coded_Output_Stream.Write_Unsigned_Integer_32_No_Tag (Value);
end Write_Unsigned_Integer_32;
-------------------------------
-- Write_Unsigned_Integer_64 --
-------------------------------
procedure Write_Unsigned_Integer_64
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Field_Number : in TMP_FIELD_TYPE;
Value : in TMP_UNSIGNED_LONG)
is
begin
The_Coded_Output_Stream.Write_Tag (Field_Number, Wire_Format.VARINT);
The_Coded_Output_Stream.Write_Unsigned_Integer_64_No_Tag (Value);
end Write_Unsigned_Integer_64;
--------------------------
-- Write_Boolean_No_Tag --
--------------------------
procedure Write_Boolean_No_Tag
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Value : in TMP_BOOLEAN)
is
begin
if Value then
The_Coded_Output_Stream.Write_Raw_Byte (1);
else
The_Coded_Output_Stream.Write_Raw_Byte (0);
end if;
end Write_Boolean_No_Tag;
-------------------------
-- Write_Double_No_Tag --
-------------------------
procedure Write_Double_No_Tag
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Value : in TMP_DOUBLE)
is
function TMP_DOUBLE_To_TMP_UNSIGNED_LONG is new Ada.Unchecked_Conversion (Source => TMP_DOUBLE,
Target => TMP_UNSIGNED_LONG);
begin
The_Coded_Output_Stream.Write_Raw_Little_Endian_64 (TMP_DOUBLE_To_TMP_UNSIGNED_LONG (Value));
end Write_Double_No_Tag;
------------------------------
-- Write_Enumeration_No_Tag --
------------------------------
procedure Write_Enumeration_No_Tag
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Value : in TMP_INTEGER)
is
begin
The_Coded_Output_Stream.Write_Integer_32_No_Tag (Value);
end Write_Enumeration_No_Tag;
---------------------------
-- Write_Fixed_32_No_Tag --
---------------------------
procedure Write_Fixed_32_No_Tag
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Value : in TMP_UNSIGNED_INTEGER)
is
begin
The_Coded_Output_Stream.Write_Raw_Little_Endian_32 (Value);
end Write_Fixed_32_No_Tag;
---------------------------
-- Write_Fixed_64_No_Tag --
---------------------------
procedure Write_Fixed_64_No_Tag
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Value : in TMP_UNSIGNED_LONG)
is
begin
The_Coded_Output_Stream.Write_Raw_Little_Endian_64 (Value);
end Write_Fixed_64_No_Tag;
------------------------
-- Write_Float_No_Tag --
------------------------
procedure Write_Float_No_Tag
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Value : in TMP_FLOAT)
is
function TMP_FLOAT_To_TMP_UNSIGNED_INTEGER is new Ada.Unchecked_Conversion (Source => TMP_FLOAT,
Target => TMP_UNSIGNED_INTEGER);
begin
The_Coded_Output_Stream.Write_Raw_Little_Endian_32 (TMP_FLOAT_To_TMP_UNSIGNED_INTEGER (Value));
end Write_Float_No_Tag;
-----------------------------
-- Write_Integer_32_No_Tag --
-----------------------------
procedure Write_Integer_32_No_Tag
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Value : in TMP_INTEGER)
is
function TMP_INTEGER_To_TMP_UNSIGNED_INTEGER is new Ada.Unchecked_Conversion (Source => TMP_INTEGER,
Target => TMP_UNSIGNED_INTEGER);
function TMP_LONG_To_TMP_UNSIGNED_LONG is new Ada.Unchecked_Conversion (Source => TMP_LONG,
Target => TMP_UNSIGNED_LONG);
Value_As_Unsigned_Integer : TMP_UNSIGNED_INTEGER := TMP_INTEGER_To_TMP_UNSIGNED_INTEGER (Value);
Value_As_Long : TMP_LONG := TMP_LONG (Value);
Value_As_Unsigned_Long : TMP_UNSIGNED_LONG := TMP_LONG_To_TMP_UNSIGNED_LONG (Value_As_Long);
begin
if Value >= 0 then
The_Coded_Output_Stream.Write_Raw_Varint_32 (Value_As_Unsigned_Integer);
else
The_Coded_Output_Stream.Write_Raw_Varint_64 (Value_As_Unsigned_Long);
end if;
end Write_Integer_32_No_Tag;
-----------------------------
-- Write_Integer_64_No_Tag --
-----------------------------
procedure Write_Integer_64_No_Tag
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Value : in TMP_LONG)
is
function TMP_LONG_To_TMP_UNSIGNED_LONG is new Ada.Unchecked_Conversion (Source => TMP_LONG,
Target => TMP_UNSIGNED_LONG);
begin
The_Coded_Output_Stream.Write_Raw_Varint_64 (TMP_LONG_To_TMP_UNSIGNED_LONG (Value));
end Write_Integer_64_No_Tag;
----------------------------------
-- Write_Signed_Fixed_32_No_Tag --
----------------------------------
procedure Write_Signed_Fixed_32_No_Tag
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Value : in TMP_INTEGER)
is
function TMP_INTEGER_To_TMP_UNSIGNED_INTEGER is new Ada.Unchecked_Conversion (Source => TMP_INTEGER,
Target => TMP_UNSIGNED_INTEGER);
begin
The_Coded_Output_Stream.Write_Raw_Little_Endian_32 (TMP_INTEGER_To_TMP_UNSIGNED_INTEGER (Value));
end Write_Signed_Fixed_32_No_Tag;
----------------------------------
-- Write_Signed_Fixed_64_No_Tag --
----------------------------------
procedure Write_Signed_Fixed_64_No_Tag
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Value : in TMP_LONG)
is
function TMP_LONG_To_TMP_UNSIGNED_LONG is new Ada.Unchecked_Conversion (Source => TMP_LONG,
Target => TMP_UNSIGNED_LONG);
begin
The_Coded_Output_Stream.Write_Raw_Little_Endian_64 (TMP_LONG_To_TMP_UNSIGNED_LONG (Value));
end Write_Signed_Fixed_64_No_Tag;
------------------------------------
-- Write_Signed_Integer_32_No_Tag --
------------------------------------
procedure Write_Signed_Integer_32_No_Tag
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Value : in TMP_INTEGER)
is
begin
The_Coded_Output_Stream.Write_Raw_Varint_32 (Encode_Zig_Zag_32 (Value));
end Write_Signed_Integer_32_No_Tag;
------------------------------------
-- Write_Signed_Integer_64_No_Tag --
------------------------------------
procedure Write_Signed_Integer_64_No_Tag
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Value : in TMP_LONG)
is
begin
The_Coded_Output_Stream.Write_Raw_Varint_64 (Encode_Zig_Zag_64 (Value));
end Write_Signed_Integer_64_No_Tag;
-------------------------
-- Write_String_No_Tag --
-------------------------
procedure Write_String_No_Tag
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Value : in TMP_STRING)
is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Write_String_No_Tag unimplemented");
raise Program_Error with "Unimplemented procedure Write_String_No_Tag";
end Write_String_No_Tag;
--------------------------------------
-- Write_Unsigned_Integer_32_No_Tag --
--------------------------------------
procedure Write_Unsigned_Integer_32_No_Tag
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Value : in TMP_UNSIGNED_INTEGER)
is
begin
The_Coded_Output_Stream.Write_Raw_Varint_32 (Value);
end Write_Unsigned_Integer_32_No_Tag;
--------------------------------------
-- Write_Unsigned_Integer_64_No_Tag --
--------------------------------------
procedure Write_Unsigned_Integer_64_No_Tag
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Value : in TMP_UNSIGNED_LONG)
is
begin
The_Coded_Output_Stream.Write_Raw_Varint_64 (Value);
end Write_Unsigned_Integer_64_No_Tag;
---------------
-- Write_Tag --
---------------
procedure Write_Tag
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Field_Number : in TMP_FIELD_TYPE;
Wire_Type : in TMP_WIRE_TYPE)
is
function TMP_FIELD_TYPE_To_TMP_UNSIGNED_INTEGER is new Ada.Unchecked_Conversion (Source => TMP_FIELD_TYPE,
Target => TMP_UNSIGNED_INTEGER);
Tag : TMP_UNSIGNED_INTEGER := Wire_Format.Make_Tag (Field_Number => Field_Number,
Wire_Type => Wire_Type);
begin
The_Coded_Output_Stream.Write_Raw_Varint_32 (Tag);
end Write_Tag;
--------------------------------
-- Write_Raw_Little_Endian_32 --
--------------------------------
procedure Write_Raw_Little_Endian_32
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Value : in TMP_UNSIGNED_INTEGER)
is
begin
TMP_UNSIGNED_INTEGER'Write (The_Coded_Output_Stream.Output_Stream, Value);
end Write_Raw_Little_Endian_32;
--------------------------------
-- Write_Raw_Little_Endian_64 --
--------------------------------
procedure Write_Raw_Little_Endian_64
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Value : in TMP_UNSIGNED_LONG)
is
begin
TMP_UNSIGNED_LONG'Write (The_Coded_Output_Stream.Output_Stream, Value);
end Write_Raw_Little_Endian_64;
-------------------------
-- Write_Raw_Varint_32 --
-------------------------
procedure Write_Raw_Varint_32
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Value : in TMP_UNSIGNED_INTEGER)
is
Value_To_Unsigned_32 : Interfaces.Unsigned_32 := Interfaces.Unsigned_32 (Value);
function Unsigned_32_To_TMP_UNSIGNED_BYTE is new Ada.Unchecked_Conversion (Source => Interfaces.Unsigned_32,
Target => TMP_UNSIGNED_BYTE);
use type Interfaces.Unsigned_32;
begin
loop
if (Value_To_Unsigned_32 and (not 16#7F#)) = 0 then
The_Coded_Output_Stream.Write_Raw_Byte (Unsigned_32_To_TMP_UNSIGNED_BYTE (Value_To_Unsigned_32));
return;
else
The_Coded_Output_Stream.Write_Raw_Byte (Unsigned_32_To_TMP_UNSIGNED_BYTE ((Value_To_Unsigned_32 and 16#7f#) or 16#80#));
Value_To_Unsigned_32 := Interfaces.Shift_Right (Value => Value_To_Unsigned_32,
Amount => 7);
end if;
end loop;
end Write_Raw_Varint_32;
-------------------------
-- Write_Raw_Varint_64 --
-------------------------
procedure Write_Raw_Varint_64
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Value : in TMP_UNSIGNED_LONG)
is
Value_To_Unsigned_64 : Interfaces.Unsigned_64 := Interfaces.Unsigned_64 (Value);
function Unsigned_64_To_TMP_UNSIGNED_BYTE is new Ada.Unchecked_Conversion (Source => Interfaces.Unsigned_64,
Target => TMP_UNSIGNED_BYTE);
use type Interfaces.Unsigned_64;
begin
loop
if (Value_To_Unsigned_64 and (not 16#7F#)) = 0 then
The_Coded_Output_Stream.Write_Raw_Byte (Unsigned_64_To_TMP_UNSIGNED_BYTE (Value_To_Unsigned_64));
return;
else
The_Coded_Output_Stream.Write_Raw_Byte (Unsigned_64_To_TMP_UNSIGNED_BYTE ((Value_To_Unsigned_64 and 16#7f#) or 16#80#));
Value_To_Unsigned_64 := Interfaces.Shift_Right (Value => Value_To_Unsigned_64,
Amount => 7);
end if;
end loop;
end Write_Raw_Varint_64;
--------------------
-- Write_Raw_Byte --
--------------------
procedure Write_Raw_Byte
(The_Coded_Output_Stream : in Coded_Output_Stream.Instance;
Value : in TMP_UNSIGNED_BYTE)
is
begin
TMP_UNSIGNED_BYTE'Write (The_Coded_Output_Stream.Output_Stream, Value);
end Write_Raw_Byte;
end Protocol_Buffers.IO.Coded_Output_Stream;
|
reznikmm/clic | Ada | 2,763 | ads | with AAA.Strings;
package CLIC.User_Input is
-------------------
-- Interactivity --
-------------------
Not_Interactive : aliased Boolean := False;
-- When not Interactive, instead of asking the user something, use default.
User_Interrupt : exception;
-- Raised when the user hits Ctrl-D and no further input can be obtained as
-- stdin is closed.
type Answer_Kind is (Yes, No, Always);
type Answer_Set is array (Answer_Kind) of Boolean;
function Query (Question : String;
Valid : Answer_Set;
Default : Answer_Kind)
return Answer_Kind;
-- If interactive, ask the user for one of the valid answer.
-- Otherwise return the Default answer.
function Query_Multi (Question : String;
Choices : AAA.Strings.Vector;
Page_Size : Positive := 10)
return Positive
with Pre => Page_Size >= 2 and then Page_Size < 36;
-- Present the Choices in a numbered list 1-9-0-a-z, with paging if
-- Choices.Length > Page_Size. Default is always First of Choices.
type Answer_With_Input (Length : Natural) is record
Input : String (1 .. Length);
Answer : Answer_Kind;
end record;
function Validated_Input
(Question : String;
Prompt : String;
Valid : Answer_Set;
Default : access function (User_Input : String) return Answer_Kind;
Confirm : String := "Is this information correct?";
Is_Valid : access function (User_Input : String) return Boolean)
return Answer_With_Input;
-- Interactive prompt for information from the user, with confirmation:
-- Put_Line (Question)
-- loop
-- Put (Prompt); Get_Line (User_Input);
-- if Is_Valid (User_Input) then
-- exit when Query (Confirm, Valid, Default (User_Input)) /= No;
-- end if;
-- end loop
function Img (Kind : Answer_Kind) return String;
type String_Validation_Access is
access function (Str : String) return Boolean;
function Query_String (Question : String;
Default : String;
Validation : String_Validation_Access)
return String
with Pre => Validation = null or else Validation (Default);
-- If interactive, ask the user to provide a valid string.
-- Otherwise return the Default value.
--
-- If Validation is null, any input is accepted.
--
-- The Default value has to be a valid input.
procedure Continue_Or_Abort;
-- If interactive, ask the user to press Enter or Ctrl-C to stop.
-- Output a log trace otherwise and continue.
end CLIC.User_Input;
|
AdaCore/training_material | Ada | 283 | adb | task body Select_Requeue_Quit is
begin
accept Receive_Message (V : String) do
requeue Receive_Message;
end Receive_Message;
delay 2.0;
end Select_Requeue_Quit;
...
select
Select_Requeue_Quit.Receive_Message ("Hello");
or
delay 0.1;
end select;
|
zhmu/ananas | Ada | 269 | ads | with Discr49_Rec1; use Discr49_Rec1;
package Discr49_Rec2 is
type Child (Discr : Boolean) is private;
function Value (Obj : Child) return Integer;
private
type Child (Discr : Boolean) is
new Parent (Discr_1 => Discr, Discr_2 => True);
end Discr49_Rec2;
|
reznikmm/matreshka | Ada | 6,521 | 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$
------------------------------------------------------------------------------
-- Helper subprograms for element modification notification.
------------------------------------------------------------------------------
with AMF.UML;
package AMF.Internals.Tables.UML_Notification is
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.Internals.AMF_Element;
New_Value : AMF.Internals.AMF_Element);
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.UML.UML_Aggregation_Kind;
New_Value : AMF.UML.UML_Aggregation_Kind);
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.UML.UML_Call_Concurrency_Kind;
New_Value : AMF.UML.UML_Call_Concurrency_Kind);
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.UML.UML_Expansion_Kind;
New_Value : AMF.UML.UML_Expansion_Kind);
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.UML.UML_Interaction_Operator_Kind;
New_Value : AMF.UML.UML_Interaction_Operator_Kind);
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.UML.UML_Message_Sort;
New_Value : AMF.UML.UML_Message_Sort);
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.UML.UML_Object_Node_Ordering_Kind;
New_Value : AMF.UML.UML_Object_Node_Ordering_Kind);
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.UML.Optional_UML_Parameter_Effect_Kind;
New_Value : AMF.UML.Optional_UML_Parameter_Effect_Kind);
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.UML.UML_Parameter_Direction_Kind;
New_Value : AMF.UML.UML_Parameter_Direction_Kind);
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.UML.UML_Pseudostate_Kind;
New_Value : AMF.UML.UML_Pseudostate_Kind);
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.UML.UML_Transition_Kind;
New_Value : AMF.UML.UML_Transition_Kind);
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.UML.UML_Visibility_Kind;
New_Value : AMF.UML.UML_Visibility_Kind);
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.UML.Optional_UML_Visibility_Kind;
New_Value : AMF.UML.Optional_UML_Visibility_Kind);
end AMF.Internals.Tables.UML_Notification;
|
reznikmm/matreshka | Ada | 5,900 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
-- A template binding represents a relationship between a templateable
-- element and a template. A template binding specifies the substitutions of
-- actual parameters for the formal parameters of the template.
------------------------------------------------------------------------------
with AMF.UML.Directed_Relationships;
limited with AMF.UML.Template_Parameter_Substitutions.Collections;
limited with AMF.UML.Template_Signatures;
limited with AMF.UML.Templateable_Elements;
package AMF.UML.Template_Bindings is
pragma Preelaborate;
type UML_Template_Binding is limited interface
and AMF.UML.Directed_Relationships.UML_Directed_Relationship;
type UML_Template_Binding_Access is
access all UML_Template_Binding'Class;
for UML_Template_Binding_Access'Storage_Size use 0;
not overriding function Get_Bound_Element
(Self : not null access constant UML_Template_Binding)
return AMF.UML.Templateable_Elements.UML_Templateable_Element_Access is abstract;
-- Getter of TemplateBinding::boundElement.
--
-- The element that is bound by this binding.
not overriding procedure Set_Bound_Element
(Self : not null access UML_Template_Binding;
To : AMF.UML.Templateable_Elements.UML_Templateable_Element_Access) is abstract;
-- Setter of TemplateBinding::boundElement.
--
-- The element that is bound by this binding.
not overriding function Get_Parameter_Substitution
(Self : not null access constant UML_Template_Binding)
return AMF.UML.Template_Parameter_Substitutions.Collections.Set_Of_UML_Template_Parameter_Substitution is abstract;
-- Getter of TemplateBinding::parameterSubstitution.
--
-- The parameter substitutions owned by this template binding.
not overriding function Get_Signature
(Self : not null access constant UML_Template_Binding)
return AMF.UML.Template_Signatures.UML_Template_Signature_Access is abstract;
-- Getter of TemplateBinding::signature.
--
-- The template signature for the template that is the target of the
-- binding.
not overriding procedure Set_Signature
(Self : not null access UML_Template_Binding;
To : AMF.UML.Template_Signatures.UML_Template_Signature_Access) is abstract;
-- Setter of TemplateBinding::signature.
--
-- The template signature for the template that is the target of the
-- binding.
end AMF.UML.Template_Bindings;
|
Subsets and Splits