repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
zhmu/ananas | Ada | 2,987 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- ADA.WIDE_WIDE_TEXT_IO.RESET_STANDARD_FILES --
-- --
-- S p e c --
-- --
-- Copyright (C) 2009-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides a reset routine that resets the standard files used
-- by Ada.Wide_Wide_Text_IO. This is useful in systems such as VxWorks where
-- Ada.Wide_Wide_Text_IO is elaborated at the program start, but a system
-- restart may alter the status of these files, resulting in incorrect
-- operation of Wide_Wide_Text_IO (in particular if the standard input file
-- is changed to be interactive, then Get_Line may hang looking for an extra
-- character after the end of the line.
procedure Ada.Wide_Wide_Text_IO.Reset_Standard_Files;
-- Reset standard Wide_Wide_Text_IO files as described above
|
reznikmm/gela | Ada | 6,198 | adb | with Gela.Nodes.Fixed_Operator_Symbols;
with Gela.Nodes.Fixed_Identifiers;
with Gela.Element_Visiters;
with Gela.Elements.Association_Lists;
with Gela.Elements.Associations;
with Gela.Elements.Function_Calls;
with Gela.Elements.Parenthesized_Expressions;
with Gela.Elements.Prefixes;
package body Gela.Fix_Node_Factories is
----------------
-- Identifier --
----------------
overriding function Identifier
(Self : in out Element_Factory;
Identifier_Token : Gela.Lexical_Types.Token_Count)
return Gela.Elements.Identifiers.Identifier_Access
is
Result : constant Gela.Nodes.Fixed_Identifiers.Identifier_Access :=
new Gela.Nodes.Fixed_Identifiers.Identifier'
(Gela.Nodes.Fixed_Identifiers.Create
(Self.Comp, Identifier_Token));
begin
return Gela.Elements.Identifiers.Identifier_Access (Result);
end Identifier;
---------------------
-- Operator_Symbol --
---------------------
overriding function Operator_Symbol
(Self : in out Element_Factory;
Operator_Symbol_Token : Gela.Lexical_Types.Token_Count)
return Gela.Elements.Operator_Symbols.Operator_Symbol_Access
is
Result : constant Gela.Nodes.Fixed_Operator_Symbols
.Operator_Symbol_Access :=
new Gela.Nodes.Fixed_Operator_Symbols.Operator_Symbol'
(Gela.Nodes.Fixed_Operator_Symbols.Create
(Self.Comp,
Operator_Symbol_Token));
begin
Result.Set_Full_Name (Gela.Lexical_Types.No_Symbol);
return Gela.Elements.Operator_Symbols.Operator_Symbol_Access (Result);
end Operator_Symbol;
overriding function Procedure_Call_Statement
(Self : in out Element_Factory;
Function_Call : Gela.Elements.Names.Name_Access;
Semicolon_Token : Gela.Lexical_Types.Token_Count)
return Gela.Elements.Procedure_Call_Statements.
Procedure_Call_Statement_Access
is
package Get is
type Visiter is new Gela.Element_Visiters.Visiter with record
Result : Gela.Elements.Function_Calls.Function_Call_Access;
end record;
overriding procedure Function_Call
(Self : in out Visiter;
Node : not null Gela.Elements.Function_Calls.
Function_Call_Access);
end Get;
package body Get is
overriding procedure Function_Call
(Self : in out Visiter;
Node : not null Gela.Elements.Function_Calls.
Function_Call_Access)
is
begin
Self.Result := Node;
end Function_Call;
end Get;
use type Gela.Elements.Function_Calls.Function_Call_Access;
V : Get.Visiter;
Parent : Gela.Node_Factories.Element_Factory renames
Gela.Node_Factories.Element_Factory (Self);
begin
Function_Call.Visit (V);
if V.Result /= null then
return Parent. Procedure_Call_Statement
(Function_Call, Semicolon_Token);
end if;
declare
Prefix : constant Gela.Elements.Prefixes.Prefix_Access :=
Gela.Elements.Prefixes.Prefix_Access (Function_Call);
Args : constant Gela.Elements.Associations.Association_Sequence_Access
:= Self.Association_Sequence;
RA : constant Gela.Elements.Association_Lists.
Association_List_Access :=
Self.Association_List
(Left_Token => 0,
Record_Component_Associations => Args,
Right_Token => 0);
Call : constant Gela.Elements.Function_Calls.Function_Call_Access
:= Self.Function_Call
(Prefix => Prefix,
Function_Call_Parameters => RA);
Name : constant Gela.Elements.Names.Name_Access :=
Gela.Elements.Names.Name_Access (Call);
begin
return Parent.Procedure_Call_Statement (Name, Semicolon_Token);
end;
end Procedure_Call_Statement;
--------------------------
-- Qualified_Expression --
--------------------------
overriding function Qualified_Expression
(Self : in out Element_Factory;
Converted_Or_Qualified_Subtype_Mark : Gela.Elements.Subtype_Marks.
Subtype_Mark_Access;
Apostrophe_Token : Gela.Lexical_Types.Token_Count;
Left_Parenthesis_Token : Gela.Lexical_Types.Token_Count;
Converted_Or_Qualified_Expression : Gela.Elements.Expressions.
Expression_Access;
Right_Parenthesis_Token : Gela.Lexical_Types.Token_Count)
return Gela.Elements.Qualified_Expressions.Qualified_Expression_Access
is
pragma Unreferenced (Left_Parenthesis_Token);
pragma Unreferenced (Right_Parenthesis_Token);
package Get is
type Visiter is new Gela.Element_Visiters.Visiter with record
Result : Gela.Elements.Expressions.Expression_Access;
Left_Parenthesis_Token : Gela.Lexical_Types.Token_Count := 0;
Right_Parenthesis_Token : Gela.Lexical_Types.Token_Count := 0;
end record;
overriding procedure Parenthesized_Expression
(Self : in out Visiter;
Node : not null Gela.Elements.Parenthesized_Expressions.
Parenthesized_Expression_Access);
end Get;
package body Get is
overriding procedure Parenthesized_Expression
(Self : in out Visiter;
Node : not null Gela.Elements.Parenthesized_Expressions.
Parenthesized_Expression_Access) is
begin
Self.Result := Node.Expression_Parenthesized;
end Parenthesized_Expression;
end Get;
V : Get.Visiter :=
(Result => Converted_Or_Qualified_Expression, others => <>);
Parent : Gela.Node_Factories.Element_Factory renames
Gela.Node_Factories.Element_Factory (Self);
begin
Converted_Or_Qualified_Expression.Visit (V);
return Parent.Qualified_Expression
(Converted_Or_Qualified_Subtype_Mark,
Apostrophe_Token,
V.Left_Parenthesis_Token,
V.Result,
V.Right_Parenthesis_Token);
end Qualified_Expression;
end Gela.Fix_Node_Factories;
|
reznikmm/matreshka | Ada | 4,097 | 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_Animation_Start_Inside_Attributes;
package Matreshka.ODF_Text.Animation_Start_Inside_Attributes is
type Text_Animation_Start_Inside_Attribute_Node is
new Matreshka.ODF_Text.Abstract_Text_Attribute_Node
and ODF.DOM.Text_Animation_Start_Inside_Attributes.ODF_Text_Animation_Start_Inside_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Text_Animation_Start_Inside_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Text_Animation_Start_Inside_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Text.Animation_Start_Inside_Attributes;
|
stcarrez/ada-keystore | Ada | 1,214 | adb | -----------------------------------------------------------------------
-- intl -- Small libintl binding
-- 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.
-----------------------------------------------------------------------
package body Intl is
function Gettext (Message : in String) return String is
begin
return Message;
end Gettext;
procedure Initialize (Domain : in String;
Dirname : in String) is
begin
null;
end Initialize;
function Current_Locale return String is
begin
return "en";
end Current_Locale;
end Intl;
|
AdaCore/libadalang | Ada | 91 | adb | package body Test_Sep is
A : Integer := 12;
procedure Bar is separate;
end Test_Sep;
|
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_Style.Background_Image_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Style_Background_Image_Element_Node is
begin
return Self : Style_Background_Image_Element_Node do
Matreshka.ODF_Style.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Style_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Style_Background_Image_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_Style_Background_Image
(ODF.DOM.Style_Background_Image_Elements.ODF_Style_Background_Image_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 Style_Background_Image_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Background_Image_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Style_Background_Image_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_Style_Background_Image
(ODF.DOM.Style_Background_Image_Elements.ODF_Style_Background_Image_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 Style_Background_Image_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_Style_Background_Image
(Visitor,
ODF.DOM.Style_Background_Image_Elements.ODF_Style_Background_Image_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.Style_URI,
Matreshka.ODF_String_Constants.Background_Image_Element,
Style_Background_Image_Element_Node'Tag);
end Matreshka.ODF_Style.Background_Image_Elements;
|
JeremyGrosser/clock3 | Ada | 4,834 | ads | pragma Style_Checks (Off);
-- Copyright (c) 2018 Microchip Technology Inc.
--
-- SPDX-License-Identifier: Apache-2.0
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-- This spec has been automatically generated from ATSAMD21G18A.svd
pragma Restrictions (No_Elaboration_Code);
with HAL;
with System;
package SAMD21_SVD.HMATRIXB is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Special Function
-- Special Function
type HMATRIXB_SFR_Registers is array (0 .. 15) of HAL.UInt32;
-----------------
-- Peripherals --
-----------------
-- HSB Matrix
type HMATRIX_Peripheral is record
-- Priority A for Slave
PRAS0 : aliased HAL.UInt32;
-- Priority B for Slave
PRBS0 : aliased HAL.UInt32;
-- Priority A for Slave
PRAS1 : aliased HAL.UInt32;
-- Priority B for Slave
PRBS1 : aliased HAL.UInt32;
-- Priority A for Slave
PRAS2 : aliased HAL.UInt32;
-- Priority B for Slave
PRBS2 : aliased HAL.UInt32;
-- Priority A for Slave
PRAS3 : aliased HAL.UInt32;
-- Priority B for Slave
PRBS3 : aliased HAL.UInt32;
-- Priority A for Slave
PRAS4 : aliased HAL.UInt32;
-- Priority B for Slave
PRBS4 : aliased HAL.UInt32;
-- Priority A for Slave
PRAS5 : aliased HAL.UInt32;
-- Priority B for Slave
PRBS5 : aliased HAL.UInt32;
-- Priority A for Slave
PRAS6 : aliased HAL.UInt32;
-- Priority B for Slave
PRBS6 : aliased HAL.UInt32;
-- Priority A for Slave
PRAS7 : aliased HAL.UInt32;
-- Priority B for Slave
PRBS7 : aliased HAL.UInt32;
-- Priority A for Slave
PRAS8 : aliased HAL.UInt32;
-- Priority B for Slave
PRBS8 : aliased HAL.UInt32;
-- Priority A for Slave
PRAS9 : aliased HAL.UInt32;
-- Priority B for Slave
PRBS9 : aliased HAL.UInt32;
-- Priority A for Slave
PRAS10 : aliased HAL.UInt32;
-- Priority B for Slave
PRBS10 : aliased HAL.UInt32;
-- Priority A for Slave
PRAS11 : aliased HAL.UInt32;
-- Priority B for Slave
PRBS11 : aliased HAL.UInt32;
-- Priority A for Slave
PRAS12 : aliased HAL.UInt32;
-- Priority B for Slave
PRBS12 : aliased HAL.UInt32;
-- Priority A for Slave
PRAS13 : aliased HAL.UInt32;
-- Priority B for Slave
PRBS13 : aliased HAL.UInt32;
-- Priority A for Slave
PRAS14 : aliased HAL.UInt32;
-- Priority B for Slave
PRBS14 : aliased HAL.UInt32;
-- Priority A for Slave
PRAS15 : aliased HAL.UInt32;
-- Priority B for Slave
PRBS15 : aliased HAL.UInt32;
-- Special Function
SFR : aliased HMATRIXB_SFR_Registers;
end record
with Volatile;
for HMATRIX_Peripheral use record
PRAS0 at 16#80# range 0 .. 31;
PRBS0 at 16#84# range 0 .. 31;
PRAS1 at 16#88# range 0 .. 31;
PRBS1 at 16#8C# range 0 .. 31;
PRAS2 at 16#90# range 0 .. 31;
PRBS2 at 16#94# range 0 .. 31;
PRAS3 at 16#98# range 0 .. 31;
PRBS3 at 16#9C# range 0 .. 31;
PRAS4 at 16#A0# range 0 .. 31;
PRBS4 at 16#A4# range 0 .. 31;
PRAS5 at 16#A8# range 0 .. 31;
PRBS5 at 16#AC# range 0 .. 31;
PRAS6 at 16#B0# range 0 .. 31;
PRBS6 at 16#B4# range 0 .. 31;
PRAS7 at 16#B8# range 0 .. 31;
PRBS7 at 16#BC# range 0 .. 31;
PRAS8 at 16#C0# range 0 .. 31;
PRBS8 at 16#C4# range 0 .. 31;
PRAS9 at 16#C8# range 0 .. 31;
PRBS9 at 16#CC# range 0 .. 31;
PRAS10 at 16#D0# range 0 .. 31;
PRBS10 at 16#D4# range 0 .. 31;
PRAS11 at 16#D8# range 0 .. 31;
PRBS11 at 16#DC# range 0 .. 31;
PRAS12 at 16#E0# range 0 .. 31;
PRBS12 at 16#E4# range 0 .. 31;
PRAS13 at 16#E8# range 0 .. 31;
PRBS13 at 16#EC# range 0 .. 31;
PRAS14 at 16#F0# range 0 .. 31;
PRBS14 at 16#F4# range 0 .. 31;
PRAS15 at 16#F8# range 0 .. 31;
PRBS15 at 16#FC# range 0 .. 31;
SFR at 16#110# range 0 .. 511;
end record;
-- HSB Matrix
HMATRIX_Periph : aliased HMATRIX_Peripheral
with Import, Address => HMATRIX_Base;
end SAMD21_SVD.HMATRIXB;
|
mfkiwl/ewok-kernel-security-OS | Ada | 148 | ads |
package ewok.tasks.debug
with spark_mode => on
is
procedure crashdump
(frame_a : in ewok.t_stack_frame_access);
end ewok.tasks.debug;
|
kontena/ruby-packer | Ada | 3,859 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Text_IO.Fixed_IO --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control:
-- $Revision: 1.11 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Ada.Text_IO;
with Terminal_Interface.Curses.Text_IO.Aux;
package body Terminal_Interface.Curses.Text_IO.Fixed_IO is
package Aux renames Terminal_Interface.Curses.Text_IO.Aux;
package FIXIO is new Ada.Text_IO.Fixed_IO (Num);
procedure Put
(Win : Window;
Item : Num;
Fore : Field := Default_Fore;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp)
is
Buf : String (1 .. Field'Last);
Len : Field := Fore + 1 + Aft;
begin
if Exp > 0 then
Len := Len + 1 + Exp;
end if;
FIXIO.Put (Buf, Item, Aft, Exp);
Aux.Put_Buf (Win, Buf, Len, False);
end Put;
procedure Put
(Item : Num;
Fore : Field := Default_Fore;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp) is
begin
Put (Get_Window, Item, Fore, Aft, Exp);
end Put;
end Terminal_Interface.Curses.Text_IO.Fixed_IO;
|
zhmu/ananas | Ada | 693 | ads | with Ada.Finalization;
with Interfaces;
with System;
package Opt85 is
type Data_Type is record
Value : Interfaces.Integer_16;
end record;
for Data_Type use record
Value at 0 range 0 .. 15;
end record;
for Data_Type'Alignment use 1;
for Data_Type'Size use 2 * System.Storage_Unit;
for Data_Type'Bit_Order use System.High_Order_First;
for Data_Type'Scalar_Storage_Order use System.High_Order_First;
type Header_Type is array (1 .. 1) of Boolean;
type Record_Type is new Ada.Finalization.Controlled with record
Header : Header_Type;
Data : Data_Type;
end record;
function Create (Value : Integer) return Record_Type;
end Opt85;
|
charlie5/cBound | Ada | 1,900 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with swig;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_reparent_notify_event_t is
-- Item
--
type Item is record
response_type : aliased Interfaces.Unsigned_8;
pad0 : aliased Interfaces.Unsigned_8;
sequence : aliased Interfaces.Unsigned_16;
event : aliased xcb.xcb_window_t;
window : aliased xcb.xcb_window_t;
parent : aliased xcb.xcb_window_t;
x : aliased Interfaces.Integer_16;
y : aliased Interfaces.Integer_16;
override_redirect : aliased Interfaces.Unsigned_8;
pad1 : aliased swig.int8_t_Array (0 .. 2);
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_reparent_notify_event_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_reparent_notify_event_t.Item,
Element_Array => xcb.xcb_reparent_notify_event_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_reparent_notify_event_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_reparent_notify_event_t.Pointer,
Element_Array => xcb.xcb_reparent_notify_event_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_reparent_notify_event_t;
|
AdaCore/libadalang | Ada | 533 | adb | procedure Test is
Denorm : constant Boolean := Float'Denorm;
pragma Test_Statement;
Signed_Zeros : constant Boolean := Float'Signed_Zeros;
pragma Test_Statement;
Model : constant := Float'Model (1.0);
pragma Test_Statement;
Model_Emin : constant := Float'Model_Emin;
pragma Test_Statement;
Unbiased_Rounding : constant := Float'Unbiased_Rounding (1.0);
pragma Test_Statement;
Leading_Part : constant := Float'Leading_Part (1.0);
pragma Test_Statement;
begin
null;
end Test;
|
reznikmm/matreshka | Ada | 5,097 | 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.Package_Merges.Collections is
pragma Preelaborate;
package CMOF_Package_Merge_Collections is
new AMF.Generic_Collections
(CMOF_Package_Merge,
CMOF_Package_Merge_Access);
type Set_Of_CMOF_Package_Merge is
new CMOF_Package_Merge_Collections.Set with null record;
Empty_Set_Of_CMOF_Package_Merge : constant Set_Of_CMOF_Package_Merge;
type Ordered_Set_Of_CMOF_Package_Merge is
new CMOF_Package_Merge_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_CMOF_Package_Merge : constant Ordered_Set_Of_CMOF_Package_Merge;
type Bag_Of_CMOF_Package_Merge is
new CMOF_Package_Merge_Collections.Bag with null record;
Empty_Bag_Of_CMOF_Package_Merge : constant Bag_Of_CMOF_Package_Merge;
type Sequence_Of_CMOF_Package_Merge is
new CMOF_Package_Merge_Collections.Sequence with null record;
Empty_Sequence_Of_CMOF_Package_Merge : constant Sequence_Of_CMOF_Package_Merge;
private
Empty_Set_Of_CMOF_Package_Merge : constant Set_Of_CMOF_Package_Merge
:= (CMOF_Package_Merge_Collections.Set with null record);
Empty_Ordered_Set_Of_CMOF_Package_Merge : constant Ordered_Set_Of_CMOF_Package_Merge
:= (CMOF_Package_Merge_Collections.Ordered_Set with null record);
Empty_Bag_Of_CMOF_Package_Merge : constant Bag_Of_CMOF_Package_Merge
:= (CMOF_Package_Merge_Collections.Bag with null record);
Empty_Sequence_Of_CMOF_Package_Merge : constant Sequence_Of_CMOF_Package_Merge
:= (CMOF_Package_Merge_Collections.Sequence with null record);
end AMF.CMOF.Package_Merges.Collections;
|
reznikmm/matreshka | Ada | 38,591 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.CMOF.Enumerations;
with AMF.CMOF.Enumeration_Literals.Collections;
with AMF.CMOF.Primitive_Types;
with Generator.Names;
with Generator.Type_Mapping;
with Generator.Units;
package body Generator.Factories is
use Generator.Names;
use Generator.Type_Mapping;
procedure Generate_Factory_Interface
(Metamodel_Info : Metamodel_Information);
-- Generates factory interface package specification.
procedure Generate_Factory_Specification
(Metamodel_Info : Metamodel_Information);
-- Generates factory implementation package specification.
procedure Generate_Factory_Implementation
(Metamodel_Info : Metamodel_Information);
-- Generates factory implementation package specification.
-------------------------------------
-- Generate_Factory_Implementation --
-------------------------------------
procedure Generate_Factory_Implementation is
Position : Extent_Vectors.Cursor := Module_Info.Extents.First;
begin
while Extent_Vectors.Has_Element (Position) loop
Generate_Factory_Specification
(Metamodel_Infos.Element (Extent_Vectors.Element (Position)).all);
Generate_Factory_Implementation
(Metamodel_Infos.Element (Extent_Vectors.Element (Position)).all);
Extent_Vectors.Next (Position);
end loop;
end Generate_Factory_Implementation;
-------------------------------------
-- Generate_Factory_Implementation --
-------------------------------------
procedure Generate_Factory_Implementation
(Metamodel_Info : Metamodel_Information)
is
Package_Name : constant League.Strings.Universal_String
:= "AMF.Internals.Factories." & Metamodel_Info.Ada_Name & "_Factories";
Type_Name : constant League.Strings.Universal_String
:= Metamodel_Info.Ada_Name & "_Factory";
Unit : Generator.Units.Unit;
Data_Types : CMOF_Data_Type_Ordered_Sets.Set;
begin
-- Prepare ordered set of data types.
declare
Position : CMOF_Element_Sets.Cursor
:= Metamodel_Info.Data_Types.First;
begin
while CMOF_Element_Sets.Has_Element (Position) loop
if CMOF_Element_Sets.Element (Position).all
in AMF.CMOF.Primitive_Types.CMOF_Primitive_Type'Class
or CMOF_Element_Sets.Element (Position).all
in AMF.CMOF.Enumerations.CMOF_Enumeration'Class
then
-- Add elements of CMOF::PrimitiveType and CMOF::Enumeration
-- types only to exclude elements of CMOF::DataType, which
-- can't be tested by Ada constructions.
Data_Types.Insert
(AMF.CMOF.Data_Types.CMOF_Data_Type_Access
(CMOF_Element_Sets.Element (Position)));
end if;
CMOF_Element_Sets.Next (Position);
end loop;
end;
-- Generate factory implementation package specification.
Unit.Add_Unit_Header (2012, 2012);
Unit.Add_Line;
Unit.Add_Line ("package body " & Package_Name & " is");
-- Generate constants for string representation of names of enumeration
-- literals.
declare
Position : CMOF_Data_Type_Ordered_Sets.Cursor
:= Data_Types.First;
The_Data_Type : AMF.CMOF.Data_Types.CMOF_Data_Type_Access;
Literals :
AMF.CMOF.Enumeration_Literals.Collections.Ordered_Set_Of_CMOF_Enumeration_Literal;
Name : League.Strings.Universal_String;
begin
while CMOF_Data_Type_Ordered_Sets.Has_Element (Position) loop
The_Data_Type := CMOF_Data_Type_Ordered_Sets.Element (Position);
if The_Data_Type.all
in AMF.CMOF.Enumerations.CMOF_Enumeration'Class
then
-- Data type is an enumeration type. Generate string constants
-- for its enumeration literals.
Unit.Add_Line;
Literals :=
AMF.CMOF.Enumerations.CMOF_Enumeration'Class
(The_Data_Type.all).Get_Owned_Literal;
for J in 1 .. Literals.Length loop
Name := Literals.Element (J).Get_Name.Value;
Unit.Add_Line
(+" "
& To_Ada_Identifier (Name)
& "_Img : constant League.Strings.Universal_String");
Unit.Add_Line
(" := League.Strings.To_Universal_String ("""
& Name
& """);");
end loop;
end if;
CMOF_Data_Type_Ordered_Sets.Next (Position);
end loop;
end;
-- Generate specifications for user defined conversion subprograms.
declare
Position : CMOF_Data_Type_Ordered_Sets.Cursor
:= Data_Types.First;
The_Data_Type : AMF.CMOF.Data_Types.CMOF_Data_Type_Access;
begin
while CMOF_Data_Type_Ordered_Sets.Has_Element (Position) loop
The_Data_Type := CMOF_Data_Type_Ordered_Sets.Element (Position);
if The_Data_Type.all
in AMF.CMOF.Primitive_Types.CMOF_Primitive_Type'Class
then
-- Data type is not an enumeration, user must provide own
-- implementation of String<->Holder conversion operation in
-- separate compilation units.
Unit.Add_Line;
Unit.Add_Line
(+" function Convert_"
& To_Ada_Identifier (The_Data_Type.Get_Name.Value)
& "_To_String");
Unit.Add_Line
(+" (Value : League.Holders.Holder)"
& " return League.Strings.Universal_String");
Unit.Add_Line (+" is separate;");
Unit.Add_Line;
Unit.Add_Line
(+" function Create_"
& To_Ada_Identifier (The_Data_Type.Get_Name.Value)
& "_From_String");
Unit.Add_Line
(+" (Image : League.Strings.Universal_String)"
& " return League.Holders.Holder");
Unit.Add_Line (+" is separate;");
end if;
CMOF_Data_Type_Ordered_Sets.Next (Position);
end loop;
end;
-- Generate implementation of Constructor.
Unit.Add_Header (+"Constructor", 3);
Unit.Add_Line;
Unit.Add_Line (+" function Constructor");
Unit.Add_Line (+" (Extent : AMF.Internals.AMF_Extent)");
Unit.Add_Line (+" return not null AMF.Factories.Factory_Access is");
Unit.Add_Line (+" begin");
Unit.Add_Line (" return new " & Type_Name & "'(Extent => Extent);");
Unit.Add_Line (+" end Constructor;");
-- Generate implementation of Convert_To_String.
Unit.Add_Header (+"Convert_To_String", 3);
Unit.Add_Line;
Unit.Add_Line (+" overriding function Convert_To_String");
Unit.Add_Line (" (Self : not null access " & Type_Name & ";");
Unit.Add_Line
(+" Data_Type : not null access"
& " AMF.CMOF.Data_Types.CMOF_Data_Type'Class;");
Unit.Add
(+" Value : League.Holders.Holder)"
& " return League.Strings.Universal_String");
if Data_Types.Is_Empty then
Unit.Add_Line (+" is");
Unit.Add_Line (+" begin");
Unit.Add_Line (+" raise Program_Error;");
Unit.Add_Line
(+" return League.Strings.Empty_Universal_String;");
else
Unit.Add_Line;
Unit.Add_Line (+" is");
Unit.Add_Line (+" pragma Unreferenced (Self);");
Unit.Add_Line;
Unit.Context.Add (+"AMF.Internals.Elements");
Unit.Add_Line
(+" DT : constant AMF.Internals.CMOF_Element");
Unit.Add_Line
(+" := AMF.Internals.Elements.Element_Base'Class"
& " (Data_Type.all).Element;");
Unit.Add_Line;
Unit.Add_Line (+" begin");
declare
Position : CMOF_Data_Type_Ordered_Sets.Cursor
:= Data_Types.First;
The_Data_Type : AMF.CMOF.Data_Types.CMOF_Data_Type_Access;
Literals :
AMF.CMOF.Enumeration_Literals.Collections.Ordered_Set_Of_CMOF_Enumeration_Literal;
First : Boolean := True;
First_Literal : Boolean := True;
begin
while CMOF_Data_Type_Ordered_Sets.Has_Element (Position) loop
The_Data_Type := CMOF_Data_Type_Ordered_Sets.Element (Position);
if The_Data_Type.all
in AMF.CMOF.Enumerations.CMOF_Enumeration'Class
or The_Data_Type.all
in AMF.CMOF.Primitive_Types.CMOF_Primitive_Type'Class
then
if First then
First := False;
Unit.Add (+" if");
else
Unit.Add_Line;
Unit.Add (+" elsif");
end if;
Unit.Context.Add
(Element_Constant_Package_Name
(AMF.CMOF.Elements.CMOF_Element_Access (The_Data_Type)));
Unit.Add_Line
(" DT = "
& Element_Constant_Qualified_Name
(AMF.CMOF.Elements.CMOF_Element_Access
(The_Data_Type))
& " then");
if The_Data_Type.all
in AMF.CMOF.Enumerations.CMOF_Enumeration'Class
then
Unit.Add_Line (+" declare");
Unit.Add_Line
(" Item : constant "
& Public_Ada_Type_Qualified_Name
(The_Data_Type, Value));
Unit.Context.Add
("AMF."
& Owning_Metamodel_Ada_Name (The_Data_Type)
& ".Holders."
& Plural
(To_Ada_Identifier
(The_Data_Type.Get_Name.Value)));
Unit.Add_Line
(" := AMF."
& Owning_Metamodel_Ada_Name (The_Data_Type)
& ".Holders."
& Plural
(To_Ada_Identifier (The_Data_Type.Get_Name.Value))
& ".Element (Value);");
Unit.Add_Line;
Unit.Add_Line (+" begin");
Literals :=
AMF.CMOF.Enumerations.CMOF_Enumeration'Class
(The_Data_Type.all).Get_Owned_Literal;
Unit.Add_Line (+" case Item is");
First_Literal := True;
for J in 1 .. Literals.Length loop
if First_Literal then
First_Literal := False;
else
Unit.Add_Line;
end if;
Unit.Add_Line
(" when "
& Ada_Enumeration_Literal_Qualified_Name
(Literals.Element (J))
& " =>");
Unit.Add_Line
(+" return "
& To_Ada_Identifier
(Literals.Element (J).Get_Name.Value)
& "_Img;");
end loop;
Unit.Add_Line (+" end case;");
Unit.Add_Line (+" end;");
else
-- Data type is not an enumeration, user must provide own
-- implementation of Convert_<Data_Type>_To_String
-- operation in separate compilation unit.
Unit.Add_Line
(+" return Convert_"
& To_Ada_Identifier (The_Data_Type.Get_Name.Value)
& "_To_String (Value);");
end if;
end if;
CMOF_Data_Type_Ordered_Sets.Next (Position);
end loop;
Unit.Add_Line;
Unit.Add_Line (+" else");
Unit.Add_Line (+" raise Program_Error;");
Unit.Add_Line (+" end if;");
end;
end if;
Unit.Add_Line (+" end Convert_To_String;");
-- Generate implementation of Create.
Unit.Add_Header (+"Create", 3);
Unit.Add_Line;
Unit.Add_Line (+" overriding function Create");
Unit.Add_Line (" (Self : not null access " & Type_Name & ";");
Unit.Add_Line
(+" Meta_Class : not null access"
& " AMF.CMOF.Classes.CMOF_Class'Class)");
Unit.Add
(+" return not null AMF.Elements.Element_Access");
if Metamodel_Info.Non_Abstract_Classes.Is_Empty then
Unit.Add_Line (+" is");
Unit.Add_Line (+" begin");
Unit.Add_Line (+" raise Program_Error;");
Unit.Add_Line (+" return null;");
else
Unit.Add_Line;
Unit.Add_Line (+" is");
Unit.Add_Line
(+" MC : constant AMF.Internals.CMOF_Element");
Unit.Context.Add (+"AMF.Internals.Elements");
Unit.Add_Line
(+" := AMF.Internals.Elements.Element_Base'Class"
& " (Meta_Class.all).Element;");
Unit.Add_Line (+" Element : AMF.Internals.AMF_Element;");
Unit.Add_Line;
Unit.Add_Line (+" begin");
declare
Position : CMOF_Class_Ordered_Sets.Cursor
:= Metamodel_Info.Non_Abstract_Classes.First;
The_Class : AMF.CMOF.Classes.CMOF_Class_Access;
First : Boolean := True;
begin
while CMOF_Class_Ordered_Sets.Has_Element (Position) loop
The_Class := CMOF_Class_Ordered_Sets.Element (Position);
if First then
First := False;
Unit.Add (+" if");
else
Unit.Add_Line;
Unit.Add (+" elsif");
end if;
Unit.Context.Add
(Element_Constant_Package_Name
(AMF.CMOF.Elements.CMOF_Element_Access (The_Class)));
Unit.Add_Line
(" MC = "
& Element_Constant_Qualified_Name
(AMF.CMOF.Elements.CMOF_Element_Access (The_Class))
& " then");
Unit.Context.Add
("AMF.Internals.Tables."
& Module_Info.Ada_Name
& "_Constructors");
Unit.Add_Line
(+" Element := AMF.Internals.Tables."
& Module_Info.Ada_Name
& "_Constructors.Create_"
& Owning_Metamodel_Ada_Name (The_Class)
& "_"
& To_Ada_Identifier (The_Class.Get_Name.Value)
& ";");
CMOF_Class_Ordered_Sets.Next (Position);
end loop;
Unit.Add_Line;
Unit.Add_Line (+" else");
Unit.Add_Line (+" raise Program_Error;");
Unit.Add_Line (+" end if;");
Unit.Add_Line;
Unit.Context.Add (+"AMF.Internals.Extents");
Unit.Add_Line
(+" AMF.Internals.Extents.Internal_Append"
& " (Self.Extent, Element);");
Unit.Context.Add (+"AMF.Internals.Listener_Registry");
Unit.Context.Add (+"AMF.Internals.Helpers");
Unit.Add_Line
(+" AMF.Internals.Listener_Registry.Notify_Instance_Create");
Unit.Add_Line
(+" (AMF.Internals.Helpers.To_Element (Element));");
Unit.Add_Line;
Unit.Add_Line
(+" return AMF.Internals.Helpers.To_Element (Element);");
end;
end if;
Unit.Add_Line (+" end Create;");
-- Generate implementation of Create_From_String.
Unit.Add_Header (+"Create_From_String", 3);
Unit.Add_Line;
Unit.Add_Line (+" overriding function Create_From_String");
Unit.Add_Line (" (Self : not null access " & Type_Name & ";");
Unit.Add_Line
(+" Data_Type : not null access"
& " AMF.CMOF.Data_Types.CMOF_Data_Type'Class;");
Unit.Add
(+" Image : League.Strings.Universal_String)"
& " return League.Holders.Holder");
if Data_Types.Is_Empty then
Unit.Add_Line (+" is");
Unit.Add_Line (+" begin");
Unit.Add_Line (+" raise Program_Error;");
Unit.Add_Line (+" return League.Holders.Empty_Holder;");
else
Unit.Add_Line;
Unit.Add_Line (+" is");
Unit.Add_Line (+" pragma Unreferenced (Self);");
Unit.Add_Line;
Unit.Add_Line (+" use type League.Strings.Universal_String;");
Unit.Add_Line;
Unit.Context.Add (+"AMF.Internals.Elements");
Unit.Add_Line
(+" DT : constant AMF.Internals.CMOF_Element");
Unit.Add_Line
(+" := AMF.Internals.Elements.Element_Base'Class"
& " (Data_Type.all).Element;");
Unit.Add_Line;
Unit.Add_Line (+" begin");
declare
Position : CMOF_Data_Type_Ordered_Sets.Cursor
:= Data_Types.First;
The_Data_Type : AMF.CMOF.Data_Types.CMOF_Data_Type_Access;
Literals :
AMF.CMOF.Enumeration_Literals.Collections.Ordered_Set_Of_CMOF_Enumeration_Literal;
First : Boolean := True;
First_Literal : Boolean := True;
begin
while CMOF_Data_Type_Ordered_Sets.Has_Element (Position) loop
The_Data_Type := CMOF_Data_Type_Ordered_Sets.Element (Position);
if The_Data_Type.all
in AMF.CMOF.Enumerations.CMOF_Enumeration'Class
or The_Data_Type.all
in AMF.CMOF.Primitive_Types.CMOF_Primitive_Type'Class
then
if First then
First := False;
Unit.Add (+" if");
else
Unit.Add_Line;
Unit.Add (+" elsif");
end if;
Unit.Context.Add
(Element_Constant_Package_Name
(AMF.CMOF.Elements.CMOF_Element_Access (The_Data_Type)));
Unit.Add_Line
(" DT = "
& Element_Constant_Qualified_Name
(AMF.CMOF.Elements.CMOF_Element_Access
(The_Data_Type))
& " then");
if The_Data_Type.all
in AMF.CMOF.Enumerations.CMOF_Enumeration'Class
then
Literals :=
AMF.CMOF.Enumerations.CMOF_Enumeration'Class
(The_Data_Type.all).Get_Owned_Literal;
First_Literal := True;
for J in 1 .. Literals.Length loop
if First_Literal then
First_Literal := False;
Unit.Add (+" if");
else
Unit.Add_Line;
Unit.Add (+" elsif");
end if;
Unit.Add_Line
(+" Image = "
& To_Ada_Identifier
(Literals.Element (J).Get_Name.Value)
& "_Img then");
Unit.Context.Add
("AMF."
& Owning_Metamodel_Ada_Name (The_Data_Type)
& ".Holders."
& Plural
(To_Ada_Identifier
(The_Data_Type.Get_Name.Value)));
Unit.Add_Line
(+" return");
Unit.Add_Line
(" AMF."
& Owning_Metamodel_Ada_Name (The_Data_Type)
& ".Holders."
& Plural
(To_Ada_Identifier
(The_Data_Type.Get_Name.Value))
& ".To_Holder");
Unit.Add_Line
(" ("
& Ada_Enumeration_Literal_Qualified_Name
(Literals.Element (J))
& ");");
end loop;
Unit.Add_Line;
Unit.Add_Line (+" else");
Unit.Add_Line (+" raise Constraint_Error;");
Unit.Add_Line (+" end if;");
else
-- Data type is not an enumeration, user must provide own
-- implementation of Create_<Data_Type>_From_String
-- operation in separate compilation unit.
Unit.Add_Line
(+" return Create_"
& To_Ada_Identifier (The_Data_Type.Get_Name.Value)
& "_From_String (Image);");
end if;
end if;
CMOF_Data_Type_Ordered_Sets.Next (Position);
end loop;
Unit.Add_Line;
Unit.Add_Line (+" else");
Unit.Add_Line (+" raise Program_Error;");
Unit.Add_Line (+" end if;");
end;
end if;
Unit.Add_Line (+" end Create_From_String;");
-- Generate implementation of Create_Link.
Unit.Add_Header (+"Create_Link", 3);
Unit.Add_Line;
Unit.Add_Line (+" overriding function Create_Link");
Unit.Add_Line
(" (Self : not null access " & Type_Name & ";");
Unit.Add_Line (+" Association :");
Unit.Add_Line
(+" not null access"
& " AMF.CMOF.Associations.CMOF_Association'Class;");
Unit.Add_Line
(+" First_Element : not null AMF.Elements.Element_Access;");
Unit.Add_Line
(+" Second_Element : not null AMF.Elements.Element_Access)");
Unit.Add_Line (+" return not null AMF.Links.Link_Access");
Unit.Add_Line (+" is");
Unit.Add_Line (+" pragma Unreferenced (Self);");
Unit.Add_Line;
Unit.Add_Line (+" begin");
Unit.Context.Add (+"AMF.Internals.Elements");
Unit.Context.Add (+"AMF.Internals.Links");
Unit.Add_Line (+" return");
Unit.Add_Line (+" AMF.Internals.Links.Proxy");
Unit.Add_Line (+" (AMF.Internals.Links.Create_Link");
Unit.Add_Line (+" (AMF.Internals.Elements.Element_Base'Class");
Unit.Add_Line (+" (Association.all).Element,");
Unit.Add_Line
(+" AMF.Internals.Helpers.To_Element (First_Element),");
Unit.Add_Line
(+" AMF.Internals.Helpers.To_Element (Second_Element)));");
Unit.Add_Line (+" end Create_Link;");
-- Generate implementation of Get_Package.
Unit.Add_Header (+"Get_Package", 3);
Unit.Add_Line;
Unit.Add_Line (+" overriding function Get_Package");
Unit.Add_Line
(" (Self : not null access constant " & Type_Name & ")");
Unit.Add_Line
(+" return AMF.CMOF.Packages.Collections.Set_Of_CMOF_Package");
Unit.Add_Line (+" is");
Unit.Add_Line (+" pragma Unreferenced (Self);");
Unit.Add_Line;
Unit.Add_Line (+" begin");
Unit.Add_Line
(+" return Result :"
& " AMF.CMOF.Packages.Collections.Set_Of_CMOF_Package do");
Unit.Add_Line (+" Result.Add (Get_Package);");
Unit.Add_Line (+" end return;");
Unit.Add_Line (+" end Get_Package;");
-- Generate implementation of Get_Package.
Unit.Add_Header (+"Get_Package", 3);
Unit.Add_Line;
Unit.Add_Line
(+" function Get_Package"
& " return not null AMF.CMOF.Packages.CMOF_Package_Access is");
Unit.Add_Line (+" begin");
Unit.Add_Line (+" return");
Unit.Add_Line (+" AMF.CMOF.Packages.CMOF_Package_Access");
Unit.Context.Add (+"AMF.Internals.Helpers");
Unit.Context.Add
(Element_Constant_Package_Name
(AMF.CMOF.Elements.CMOF_Element_Access
(Metamodel_Info.Root_Package)));
Unit.Add_Line
(+" (AMF.Internals.Helpers.To_Element");
Unit.Add_Line
(+" ("
& Element_Constant_Qualified_Name
(AMF.CMOF.Elements.CMOF_Element_Access
(Metamodel_Info.Root_Package))
& "));");
Unit.Add_Line (+" end Get_Package;");
-- Generate implementation of Create_<Class>.
declare
Position : CMOF_Class_Ordered_Sets.Cursor
:= Metamodel_Info.Non_Abstract_Classes.First;
The_Class : AMF.CMOF.Classes.CMOF_Class_Access;
begin
while CMOF_Class_Ordered_Sets.Has_Element (Position) loop
The_Class := CMOF_Class_Ordered_Sets.Element (Position);
Unit.Add_Header
(+"Create_" & To_Ada_Identifier (The_Class.Get_Name.Value), 3);
Unit.Add_Line;
Unit.Add_Line
(+" overriding function Create_"
& To_Ada_Identifier (The_Class.Get_Name.Value));
Unit.Add_Line
(" (Self : not null access " & Type_Name & ')');
Unit.Add_Line
(" return "
& Public_Ada_Type_Qualified_Name (The_Class, Value)
& " is");
Unit.Add_Line (+" begin");
Unit.Add_Line (+" return");
Unit.Add_Line
(" " & Public_Ada_Type_Qualified_Name (The_Class, Value));
Unit.Add_Line (+" (Self.Create");
Unit.Add_Line (+" (AMF.CMOF.Classes.CMOF_Class_Access");
Unit.Add_Line (+" (AMF.Internals.Helpers.To_Element");
Unit.Add_Line
(+" ("
& Type_Constant_Qualified_Name (The_Class)
& "))));");
Unit.Add_Line
(+" end Create_"
& To_Ada_Identifier (The_Class.Get_Name.Value)
& ";");
CMOF_Class_Ordered_Sets.Next (Position);
end loop;
end;
Unit.Add_Line;
Unit.Add_Line ("end " & Package_Name & ';');
Unit.Context.Instantiate (Package_Name);
Unit.Put;
end Generate_Factory_Implementation;
--------------------------------
-- Generate_Factory_Interface --
--------------------------------
procedure Generate_Factory_Interface
(Metamodel_Info : Metamodel_Information)
is
Package_Name : constant League.Strings.Universal_String
:= "AMF.Factories." & Metamodel_Info.Ada_Name & "_Factories";
Type_Name : constant League.Strings.Universal_String
:= Metamodel_Info.Ada_Name & "_Factory";
The_Class : AMF.CMOF.Classes.CMOF_Class_Access;
Unit : Generator.Units.Unit;
begin
-- Generate factory interface package specification.
Unit.Add_Unit_Header (2012, 2012);
Unit.Add_Line;
Unit.Add_Line ("package " & Package_Name & " is");
Unit.Add_Line;
Unit.Add_Line (+" pragma Preelaborate;");
Unit.Add_Line;
Unit.Add_Line (" type " & Type_Name & " is limited interface");
Unit.Add_Line (+" and AMF.Factories.Factory;");
Unit.Add_Line;
Unit.Add_Line
(" type "
& Type_Name
& "_Access is access all "
& Type_Name
& "'Class;");
Unit.Add_Line (" for " & Type_Name & "_Access'Storage_Size use 0;");
declare
Position : CMOF_Class_Ordered_Sets.Cursor
:= Metamodel_Info.Non_Abstract_Classes.First;
begin
while CMOF_Class_Ordered_Sets.Has_Element (Position) loop
The_Class := CMOF_Class_Ordered_Sets.Element (Position);
Unit.Add_Line;
Unit.Add_Line
(+" not overriding function Create_"
& To_Ada_Identifier (The_Class.Get_Name.Value));
Unit.Add_Line
(" (Self : not null access " & Type_Name & ')');
Unit.Context.Add (Public_Ada_Package_Name (The_Class, Value));
Unit.Add_Line
(" return "
& Public_Ada_Type_Qualified_Name (The_Class, Value)
& " is abstract;");
CMOF_Class_Ordered_Sets.Next (Position);
end loop;
end;
Unit.Add_Line;
Unit.Add_Line ("end " & Package_Name & ';');
Unit.Context.Instantiate (Package_Name);
Unit.Put;
end Generate_Factory_Interface;
--------------------------------
-- Generate_Factory_Interface --
--------------------------------
procedure Generate_Factory_Interface is
Position : Extent_Vectors.Cursor := Module_Info.Extents.First;
begin
while Extent_Vectors.Has_Element (Position) loop
Generate_Factory_Interface
(Metamodel_Infos.Element (Extent_Vectors.Element (Position)).all);
Extent_Vectors.Next (Position);
end loop;
end Generate_Factory_Interface;
------------------------------------
-- Generate_Factory_Specification --
------------------------------------
procedure Generate_Factory_Specification
(Metamodel_Info : Metamodel_Information)
is
Package_Name : constant League.Strings.Universal_String
:= "AMF.Internals.Factories." & Metamodel_Info.Ada_Name & "_Factories";
Type_Name : constant League.Strings.Universal_String
:= Metamodel_Info.Ada_Name & "_Factory";
Unit : Generator.Units.Unit;
begin
-- Generate factory implementation package specification.
Unit.Add_Unit_Header (2012, 2012);
Unit.Add_Line;
Unit.Add_Line ("package " & Package_Name & " is");
-- Unit.Add_Line;
-- Unit.Add_Line (+" pragma Preelaborate;");
Unit.Add_Line;
Unit.Context.Add
("AMF.Factories." & Metamodel_Info.Ada_Name & "_Factories");
Unit.Add_Line (" type " & Type_Name & " is");
Unit.Add_Line
(+" limited new AMF.Internals.Factories.Metamodel_Factory_Base");
Unit.Add_Line
(" and AMF.Factories."
& Metamodel_Info.Ada_Name
& "_Factories."
& Metamodel_Info.Ada_Name
& "_Factory with null record;");
-- Common subprograms of factory.
Unit.Add_Line;
Unit.Add_Line (+" overriding function Convert_To_String");
Unit.Add_Line (" (Self : not null access " & Type_Name & ";");
Unit.Context.Add (+"AMF.CMOF.Data_Types");
Unit.Context.Add (+"League.Holders");
Unit.Add_Line
(+" Data_Type : not null access"
& " AMF.CMOF.Data_Types.CMOF_Data_Type'Class;");
Unit.Add_Line
(+" Value : League.Holders.Holder)"
& " return League.Strings.Universal_String;");
Unit.Add_Line;
Unit.Context.Add (+"AMF.CMOF.Classes");
Unit.Add_Line (+" overriding function Create");
Unit.Add_Line (" (Self : not null access " & Type_Name & ";");
Unit.Add_Line
(+" Meta_Class : not null access"
& " AMF.CMOF.Classes.CMOF_Class'Class)");
Unit.Add_Line
(+" return not null AMF.Elements.Element_Access;");
Unit.Add_Line;
Unit.Add_Line (+" overriding function Create_From_String");
Unit.Add_Line (" (Self : not null access " & Type_Name & ";");
Unit.Add_Line
(+" Data_Type : not null access"
& " AMF.CMOF.Data_Types.CMOF_Data_Type'Class;");
Unit.Add_Line
(+" Image : League.Strings.Universal_String)"
& " return League.Holders.Holder;");
Unit.Add_Line;
Unit.Context.Add (+"AMF.Links");
Unit.Context.Add (+"AMF.CMOF.Associations");
Unit.Add_Line (+" overriding function Create_Link");
Unit.Add_Line
(" (Self : not null access " & Type_Name & ";");
Unit.Add_Line (+" Association :");
Unit.Add_Line
(+" not null access"
& " AMF.CMOF.Associations.CMOF_Association'Class;");
Unit.Add_Line
(+" First_Element : not null AMF.Elements.Element_Access;");
Unit.Add_Line
(+" Second_Element : not null AMF.Elements.Element_Access)");
Unit.Add_Line (+" return not null AMF.Links.Link_Access;");
Unit.Add_Line;
Unit.Add_Line (+" overriding function Get_Package");
Unit.Add_Line
(" (Self : not null access constant " & Type_Name & ")");
Unit.Add_Line
(+" return AMF.CMOF.Packages.Collections.Set_Of_CMOF_Package;");
Unit.Add_Line;
Unit.Add_Line (+" function Constructor");
Unit.Add_Line (+" (Extent : AMF.Internals.AMF_Extent)");
Unit.Add_Line (+" return not null AMF.Factories.Factory_Access;");
Unit.Add_Line;
Unit.Add_Line
(+" function Get_Package"
& " return not null AMF.CMOF.Packages.CMOF_Package_Access;");
declare
Position : CMOF_Class_Ordered_Sets.Cursor
:= Metamodel_Info.Non_Abstract_Classes.First;
The_Class : AMF.CMOF.Classes.CMOF_Class_Access;
begin
while CMOF_Class_Ordered_Sets.Has_Element (Position) loop
The_Class := CMOF_Class_Ordered_Sets.Element (Position);
Unit.Add_Line;
Unit.Add_Line
(+" function Create_"
& To_Ada_Identifier (The_Class.Get_Name.Value));
Unit.Add_Line
(" (Self : not null access " & Type_Name & ')');
Unit.Context.Add (Public_Ada_Package_Name (The_Class, Value));
Unit.Add_Line
(" return "
& Public_Ada_Type_Qualified_Name (The_Class, Value)
& ";");
CMOF_Class_Ordered_Sets.Next (Position);
end loop;
end;
Unit.Add_Line;
Unit.Add_Line ("end " & Package_Name & ';');
Unit.Context.Instantiate (Package_Name);
Unit.Put;
end Generate_Factory_Specification;
end Generator.Factories;
|
reznikmm/matreshka | Ada | 3,663 | 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 XML.DOM.Attributes;
package ODF.DOM.Attributes.Draw.Shadow_Offset_X is
type ODF_Draw_Shadow_Offset_X is
new XML.DOM.Attributes.DOM_Attribute with private;
private
type ODF_Draw_Shadow_Offset_X is
new XML.DOM.Attributes.DOM_Attribute with null record;
end ODF.DOM.Attributes.Draw.Shadow_Offset_X;
|
onox/orka | Ada | 4,192 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2017 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with GL.Pixels.Extensions;
with GL.Types;
with Orka.Strings;
package body Orka.Rendering.Textures is
procedure Bind
(Object : GL.Objects.Textures.Texture_Base'Class;
Target : Indexed_Texture_Target;
Index : Natural) is
begin
case Target is
when Texture =>
Object.Bind_Texture_Unit (GL.Types.UInt (Index));
when Image =>
Object.Bind_Image_Texture (GL.Types.UInt (Index));
end case;
end Bind;
function Bayer_Dithering_Pattern return GL.Objects.Samplers.Sampler is
use all type GL.Objects.Samplers.Minifying_Function;
use all type GL.Objects.Samplers.Magnifying_Function;
use all type GL.Objects.Samplers.Wrapping_Mode;
begin
return Result : GL.Objects.Samplers.Sampler do
Result.Set_X_Wrapping (Repeat);
Result.Set_Y_Wrapping (Repeat);
Result.Set_Minifying_Filter (Nearest);
Result.Set_Magnifying_Filter (Nearest);
end return;
end Bayer_Dithering_Pattern;
function Bayer_Dithering_Pattern return GL.Objects.Textures.Texture is
Pixels : aliased constant GL.Types.UByte_Array
:= (0, 32, 8, 40, 2, 34, 10, 42,
48, 16, 56, 24, 50, 18, 58, 26,
12, 44, 4, 36, 14, 46, 6, 38,
60, 28, 52, 20, 62, 30, 54, 22,
3, 35, 11, 43, 1, 33, 9, 41,
51, 19, 59, 27, 49, 17, 57, 25,
15, 47, 7, 39, 13, 45, 5, 37,
63, 31, 55, 23, 61, 29, 53, 21);
-- * Bayer, B. E. (1973). An optimum method for two-level rendition of
-- continuous-tone pictures. In IEEE Int. Conf. on Communications
-- (Vol. 26, pp. 11-15).
-- * http://www.anisopteragames.com/how-to-fix-color-banding-with-dithering/
begin
return Result : GL.Objects.Textures.Texture (GL.Low_Level.Enums.Texture_2D) do
Result.Allocate_Storage (1, 1, GL.Pixels.R8, Width => 8, Height => 8, Depth => 1);
Result.Load_From_Data
(Level => 0,
Width => 8, Height => 8, Depth => 1,
Source_Format => GL.Pixels.Red,
Source_Type => GL.Pixels.Unsigned_Byte,
Source => Pixels'Address);
end return;
end Bayer_Dithering_Pattern;
function Get_Format_Kind
(Format : GL.Pixels.Internal_Format) return Format_Kind
is
package PE renames GL.Pixels.Extensions;
begin
if PE.Depth_Stencil_Format (Format) then
return Depth_Stencil;
elsif PE.Depth_Format (Format) then
return Depth;
elsif PE.Stencil_Format (Format) then
return Stencil;
else
return Color;
end if;
end Get_Format_Kind;
function Image
(Texture : GL.Objects.Textures.Texture;
Level : GL.Objects.Textures.Mipmap_Level := 0) return String
is
Width : constant String := Orka.Strings.Trim (Texture.Width (Level)'Image);
Height : constant String := Orka.Strings.Trim (Texture.Height (Level)'Image);
Depth : constant String := Orka.Strings.Trim (Texture.Depth (Level)'Image);
function U (Value : Wide_Wide_String) return String renames Orka.Strings.Unicode;
begin
return (if Texture.Allocated then "" else "unallocated ") &
Width & U (" × ") & Height & U (" × ") & Depth & " " & Texture.Kind'Image &
" with " &
(if Texture.Compressed then
Texture.Compressed_Format'Image
else
Texture.Internal_Format'Image) & " format";
end Image;
end Orka.Rendering.Textures;
|
vasil-sd/ada-tlsf | Ada | 81 | ads | package TLSF.Block with SPARK_Mode, Pure, Preelaborate is
end TLSF.Block;
|
kisom/rover-mk1 | Ada | 234 | ads | with Interfaces;
use Interfaces;
eackage ROSA.Task_Manager is
type Manager_Type is private;
private
type Manager_Type is record
Task_Count : Unsigned_8;
end record;
Manager : Manager_Type;
end ROSA.Task_Manager;
|
adamnemecek/GA_Ada | Ada | 1,025 | ads |
with Ada.Exceptions;
with GA_Maths;
package Metric is
type Metric_Record (Dim : Integer) is private;
type Metric_Matrix is array (Integer range <>, Integer range <>) of float;
type Metric_Data is array (Integer range <>) of float;
Null_Metric : constant Metric_Matrix (1 .. 0, 1 .. 0) := (others => (others => 0.0));
Metric_Exception : Ada.Exceptions.Exception_Id;
function Matrix (Met : Metric_Record) return GA_Maths.Float_Matrix;
function New_Metric (Dimension : Integer) return Metric_Matrix;
function New_Metric (Dimension : Integer; Data : Metric_Data) return Metric_Matrix;
function New_Metric (Met : Metric_Matrix) return Metric_Record;
private
type Metric_Record (Dim : Integer) is record
Matrix : GA_Maths.Float_Matrix (1 .. Dim, 1 .. Dim);
Eigen_Metric : GA_Maths.Float_Array_Package.Real_Vector (1 .. Dim);
Diagonal : Boolean;
Euclidean : Boolean := False;
Anti_Euclidean : Boolean := False;
end record;
end Metric;
|
Heziode/lsystem-editor | Ada | 1,802 | adb | -------------------------------------------------------------------------------
-- 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.
-------------------------------------------------------------------------------
package body LSE.Model.L_System.Error.Not_A_Angle is
function Initialize return Instance
is
begin
return Instance '(Error => Error_Type.Not_A_Angle);
end Initialize;
function Get_Error (This : Instance) return String
is
pragma Unreferenced (This);
begin
return "Value for Angle is not valid";
end Get_Error;
end LSE.Model.L_System.Error.Not_A_Angle;
|
pdaxrom/Kino2 | Ada | 3,888 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Contact: http://www.familiepfeifer.de/Contact.aspx?Lang=en
-- Version Control:
-- $Revision: 1.7 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Interfaces.C;
with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
package body Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address is
use type Interfaces.C.int;
procedure Set_Field_Type (Fld : in Field;
Typ : in Internet_V4_Address_Field)
is
C_IPV4_Field_Type : C_Field_Type;
pragma Import (C, C_IPV4_Field_Type, "TYPE_IPV4");
function Set_Fld_Type (F : Field := Fld;
Cft : C_Field_Type := C_IPV4_Field_Type)
return C_Int;
pragma Import (C, Set_Fld_Type, "set_field_type");
Res : Eti_Error;
begin
Res := Set_Fld_Type;
if Res /= E_Ok then
Eti_Exception (Res);
end if;
Wrap_Builtin (Fld, Typ);
end Set_Field_Type;
end Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address;
|
zhmu/ananas | Ada | 23,007 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . C H A R A C T E R S . W I D E _ W I D E _ L A T I N _ 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. --
-- --
------------------------------------------------------------------------------
-- This package provides definitions analogous to those in the GNAT package
-- Ada.Characters.Latin_9 except that the type of the various constants is
-- Wide_Wide_Character instead of Character. The provision of this package
-- is in accordance with the implementation permission in RM (A.3.3(27)).
package Ada.Characters.Wide_Wide_Latin_9 is
pragma Pure;
------------------------
-- Control Characters --
------------------------
NUL : constant Wide_Wide_Character := Wide_Wide_Character'Val (0);
SOH : constant Wide_Wide_Character := Wide_Wide_Character'Val (1);
STX : constant Wide_Wide_Character := Wide_Wide_Character'Val (2);
ETX : constant Wide_Wide_Character := Wide_Wide_Character'Val (3);
EOT : constant Wide_Wide_Character := Wide_Wide_Character'Val (4);
ENQ : constant Wide_Wide_Character := Wide_Wide_Character'Val (5);
ACK : constant Wide_Wide_Character := Wide_Wide_Character'Val (6);
BEL : constant Wide_Wide_Character := Wide_Wide_Character'Val (7);
BS : constant Wide_Wide_Character := Wide_Wide_Character'Val (8);
HT : constant Wide_Wide_Character := Wide_Wide_Character'Val (9);
LF : constant Wide_Wide_Character := Wide_Wide_Character'Val (10);
VT : constant Wide_Wide_Character := Wide_Wide_Character'Val (11);
FF : constant Wide_Wide_Character := Wide_Wide_Character'Val (12);
CR : constant Wide_Wide_Character := Wide_Wide_Character'Val (13);
SO : constant Wide_Wide_Character := Wide_Wide_Character'Val (14);
SI : constant Wide_Wide_Character := Wide_Wide_Character'Val (15);
DLE : constant Wide_Wide_Character := Wide_Wide_Character'Val (16);
DC1 : constant Wide_Wide_Character := Wide_Wide_Character'Val (17);
DC2 : constant Wide_Wide_Character := Wide_Wide_Character'Val (18);
DC3 : constant Wide_Wide_Character := Wide_Wide_Character'Val (19);
DC4 : constant Wide_Wide_Character := Wide_Wide_Character'Val (20);
NAK : constant Wide_Wide_Character := Wide_Wide_Character'Val (21);
SYN : constant Wide_Wide_Character := Wide_Wide_Character'Val (22);
ETB : constant Wide_Wide_Character := Wide_Wide_Character'Val (23);
CAN : constant Wide_Wide_Character := Wide_Wide_Character'Val (24);
EM : constant Wide_Wide_Character := Wide_Wide_Character'Val (25);
SUB : constant Wide_Wide_Character := Wide_Wide_Character'Val (26);
ESC : constant Wide_Wide_Character := Wide_Wide_Character'Val (27);
FS : constant Wide_Wide_Character := Wide_Wide_Character'Val (28);
GS : constant Wide_Wide_Character := Wide_Wide_Character'Val (29);
RS : constant Wide_Wide_Character := Wide_Wide_Character'Val (30);
US : constant Wide_Wide_Character := Wide_Wide_Character'Val (31);
-------------------------------------
-- ISO 646 Graphic Wide_Wide_Characters --
-------------------------------------
Space : constant Wide_Wide_Character := ' '; -- WC'Val(32)
Exclamation : constant Wide_Wide_Character := '!'; -- WC'Val(33)
Quotation : constant Wide_Wide_Character := '"'; -- WC'Val(34)
Number_Sign : constant Wide_Wide_Character := '#'; -- WC'Val(35)
Dollar_Sign : constant Wide_Wide_Character := '$'; -- WC'Val(36)
Percent_Sign : constant Wide_Wide_Character := '%'; -- WC'Val(37)
Ampersand : constant Wide_Wide_Character := '&'; -- WC'Val(38)
Apostrophe : constant Wide_Wide_Character := '''; -- WC'Val(39)
Left_Parenthesis : constant Wide_Wide_Character := '('; -- WC'Val(40)
Right_Parenthesis : constant Wide_Wide_Character := ')'; -- WC'Val(41)
Asterisk : constant Wide_Wide_Character := '*'; -- WC'Val(42)
Plus_Sign : constant Wide_Wide_Character := '+'; -- WC'Val(43)
Comma : constant Wide_Wide_Character := ','; -- WC'Val(44)
Hyphen : constant Wide_Wide_Character := '-'; -- WC'Val(45)
Minus_Sign : Wide_Wide_Character renames Hyphen;
Full_Stop : constant Wide_Wide_Character := '.'; -- WC'Val(46)
Solidus : constant Wide_Wide_Character := '/'; -- WC'Val(47)
-- Decimal digits '0' though '9' are at positions 48 through 57
Colon : constant Wide_Wide_Character := ':'; -- WC'Val(58)
Semicolon : constant Wide_Wide_Character := ';'; -- WC'Val(59)
Less_Than_Sign : constant Wide_Wide_Character := '<'; -- WC'Val(60)
Equals_Sign : constant Wide_Wide_Character := '='; -- WC'Val(61)
Greater_Than_Sign : constant Wide_Wide_Character := '>'; -- WC'Val(62)
Question : constant Wide_Wide_Character := '?'; -- WC'Val(63)
Commercial_At : constant Wide_Wide_Character := '@'; -- WC'Val(64)
-- Letters 'A' through 'Z' are at positions 65 through 90
Left_Square_Bracket : constant Wide_Wide_Character := '['; -- WC'Val (91)
Reverse_Solidus : constant Wide_Wide_Character := '\'; -- WC'Val (92)
Right_Square_Bracket : constant Wide_Wide_Character := ']'; -- WC'Val (93)
Circumflex : constant Wide_Wide_Character := '^'; -- WC'Val (94)
Low_Line : constant Wide_Wide_Character := '_'; -- WC'Val (95)
Grave : constant Wide_Wide_Character := '`'; -- WC'Val (96)
LC_A : constant Wide_Wide_Character := 'a'; -- WC'Val (97)
LC_B : constant Wide_Wide_Character := 'b'; -- WC'Val (98)
LC_C : constant Wide_Wide_Character := 'c'; -- WC'Val (99)
LC_D : constant Wide_Wide_Character := 'd'; -- WC'Val (100)
LC_E : constant Wide_Wide_Character := 'e'; -- WC'Val (101)
LC_F : constant Wide_Wide_Character := 'f'; -- WC'Val (102)
LC_G : constant Wide_Wide_Character := 'g'; -- WC'Val (103)
LC_H : constant Wide_Wide_Character := 'h'; -- WC'Val (104)
LC_I : constant Wide_Wide_Character := 'i'; -- WC'Val (105)
LC_J : constant Wide_Wide_Character := 'j'; -- WC'Val (106)
LC_K : constant Wide_Wide_Character := 'k'; -- WC'Val (107)
LC_L : constant Wide_Wide_Character := 'l'; -- WC'Val (108)
LC_M : constant Wide_Wide_Character := 'm'; -- WC'Val (109)
LC_N : constant Wide_Wide_Character := 'n'; -- WC'Val (110)
LC_O : constant Wide_Wide_Character := 'o'; -- WC'Val (111)
LC_P : constant Wide_Wide_Character := 'p'; -- WC'Val (112)
LC_Q : constant Wide_Wide_Character := 'q'; -- WC'Val (113)
LC_R : constant Wide_Wide_Character := 'r'; -- WC'Val (114)
LC_S : constant Wide_Wide_Character := 's'; -- WC'Val (115)
LC_T : constant Wide_Wide_Character := 't'; -- WC'Val (116)
LC_U : constant Wide_Wide_Character := 'u'; -- WC'Val (117)
LC_V : constant Wide_Wide_Character := 'v'; -- WC'Val (118)
LC_W : constant Wide_Wide_Character := 'w'; -- WC'Val (119)
LC_X : constant Wide_Wide_Character := 'x'; -- WC'Val (120)
LC_Y : constant Wide_Wide_Character := 'y'; -- WC'Val (121)
LC_Z : constant Wide_Wide_Character := 'z'; -- WC'Val (122)
Left_Curly_Bracket : constant Wide_Wide_Character := '{'; -- WC'Val (123)
Vertical_Line : constant Wide_Wide_Character := '|'; -- WC'Val (124)
Right_Curly_Bracket : constant Wide_Wide_Character := '}'; -- WC'Val (125)
Tilde : constant Wide_Wide_Character := '~'; -- WC'Val (126)
DEL : constant Wide_Wide_Character :=
Wide_Wide_Character'Val (127);
--------------------------------------
-- ISO 6429 Control Wide_Wide_Characters --
--------------------------------------
IS4 : Wide_Wide_Character renames FS;
IS3 : Wide_Wide_Character renames GS;
IS2 : Wide_Wide_Character renames RS;
IS1 : Wide_Wide_Character renames US;
Reserved_128
: constant Wide_Wide_Character := Wide_Wide_Character'Val (128);
Reserved_129
: constant Wide_Wide_Character := Wide_Wide_Character'Val (129);
BPH : constant Wide_Wide_Character := Wide_Wide_Character'Val (130);
NBH : constant Wide_Wide_Character := Wide_Wide_Character'Val (131);
Reserved_132
: constant Wide_Wide_Character := Wide_Wide_Character'Val (132);
NEL : constant Wide_Wide_Character := Wide_Wide_Character'Val (133);
SSA : constant Wide_Wide_Character := Wide_Wide_Character'Val (134);
ESA : constant Wide_Wide_Character := Wide_Wide_Character'Val (135);
HTS : constant Wide_Wide_Character := Wide_Wide_Character'Val (136);
HTJ : constant Wide_Wide_Character := Wide_Wide_Character'Val (137);
VTS : constant Wide_Wide_Character := Wide_Wide_Character'Val (138);
PLD : constant Wide_Wide_Character := Wide_Wide_Character'Val (139);
PLU : constant Wide_Wide_Character := Wide_Wide_Character'Val (140);
RI : constant Wide_Wide_Character := Wide_Wide_Character'Val (141);
SS2 : constant Wide_Wide_Character := Wide_Wide_Character'Val (142);
SS3 : constant Wide_Wide_Character := Wide_Wide_Character'Val (143);
DCS : constant Wide_Wide_Character := Wide_Wide_Character'Val (144);
PU1 : constant Wide_Wide_Character := Wide_Wide_Character'Val (145);
PU2 : constant Wide_Wide_Character := Wide_Wide_Character'Val (146);
STS : constant Wide_Wide_Character := Wide_Wide_Character'Val (147);
CCH : constant Wide_Wide_Character := Wide_Wide_Character'Val (148);
MW : constant Wide_Wide_Character := Wide_Wide_Character'Val (149);
SPA : constant Wide_Wide_Character := Wide_Wide_Character'Val (150);
EPA : constant Wide_Wide_Character := Wide_Wide_Character'Val (151);
SOS : constant Wide_Wide_Character := Wide_Wide_Character'Val (152);
Reserved_153
: constant Wide_Wide_Character := Wide_Wide_Character'Val (153);
SCI : constant Wide_Wide_Character := Wide_Wide_Character'Val (154);
CSI : constant Wide_Wide_Character := Wide_Wide_Character'Val (155);
ST : constant Wide_Wide_Character := Wide_Wide_Character'Val (156);
OSC : constant Wide_Wide_Character := Wide_Wide_Character'Val (157);
PM : constant Wide_Wide_Character := Wide_Wide_Character'Val (158);
APC : constant Wide_Wide_Character := Wide_Wide_Character'Val (159);
-----------------------------------
-- Other Graphic Wide_Wide_Characters --
-----------------------------------
-- Wide_Wide_Character positions 160 (16#A0#) .. 175 (16#AF#)
No_Break_Space
: constant Wide_Wide_Character := Wide_Wide_Character'Val (160);
NBSP : Wide_Wide_Character renames No_Break_Space;
Inverted_Exclamation
: constant Wide_Wide_Character := Wide_Wide_Character'Val (161);
Cent_Sign : constant Wide_Wide_Character := Wide_Wide_Character'Val (162);
Pound_Sign : constant Wide_Wide_Character := Wide_Wide_Character'Val (163);
Euro_Sign : constant Wide_Wide_Character := Wide_Wide_Character'Val (164);
Yen_Sign : constant Wide_Wide_Character := Wide_Wide_Character'Val (165);
UC_S_Caron : constant Wide_Wide_Character := Wide_Wide_Character'Val (166);
Section_Sign
: constant Wide_Wide_Character := Wide_Wide_Character'Val (167);
LC_S_Caron : constant Wide_Wide_Character := Wide_Wide_Character'Val (168);
Copyright_Sign
: constant Wide_Wide_Character := Wide_Wide_Character'Val (169);
Feminine_Ordinal_Indicator
: constant Wide_Wide_Character := Wide_Wide_Character'Val (170);
Left_Angle_Quotation
: constant Wide_Wide_Character := Wide_Wide_Character'Val (171);
Not_Sign : constant Wide_Wide_Character := Wide_Wide_Character'Val (172);
Soft_Hyphen : constant Wide_Wide_Character := Wide_Wide_Character'Val (173);
Registered_Trade_Mark_Sign
: constant Wide_Wide_Character := Wide_Wide_Character'Val (174);
Macron : constant Wide_Wide_Character := Wide_Wide_Character'Val (175);
-- Wide_Wide_Character positions 176 (16#B0#) .. 191 (16#BF#)
Degree_Sign : constant Wide_Wide_Character := Wide_Wide_Character'Val (176);
Ring_Above : Wide_Wide_Character renames Degree_Sign;
Plus_Minus_Sign
: constant Wide_Wide_Character := Wide_Wide_Character'Val (177);
Superscript_Two
: constant Wide_Wide_Character := Wide_Wide_Character'Val (178);
Superscript_Three
: constant Wide_Wide_Character := Wide_Wide_Character'Val (179);
UC_Z_Caron : constant Wide_Wide_Character := Wide_Wide_Character'Val (180);
Micro_Sign : constant Wide_Wide_Character := Wide_Wide_Character'Val (181);
Pilcrow_Sign
: constant Wide_Wide_Character := Wide_Wide_Character'Val (182);
Paragraph_Sign
: Wide_Wide_Character renames Pilcrow_Sign;
Middle_Dot : constant Wide_Wide_Character := Wide_Wide_Character'Val (183);
LC_Z_Caron : constant Wide_Wide_Character := Wide_Wide_Character'Val (184);
Superscript_One
: constant Wide_Wide_Character := Wide_Wide_Character'Val (185);
Masculine_Ordinal_Indicator
: constant Wide_Wide_Character := Wide_Wide_Character'Val (186);
Right_Angle_Quotation
: constant Wide_Wide_Character := Wide_Wide_Character'Val (187);
UC_Ligature_OE
: constant Wide_Wide_Character := Wide_Wide_Character'Val (188);
LC_Ligature_OE
: constant Wide_Wide_Character := Wide_Wide_Character'Val (189);
UC_Y_Diaeresis
: constant Wide_Wide_Character := Wide_Wide_Character'Val (190);
Inverted_Question
: constant Wide_Wide_Character := Wide_Wide_Character'Val (191);
-- Wide_Wide_Character positions 192 (16#C0#) .. 207 (16#CF#)
UC_A_Grave : constant Wide_Wide_Character := Wide_Wide_Character'Val (192);
UC_A_Acute : constant Wide_Wide_Character := Wide_Wide_Character'Val (193);
UC_A_Circumflex
: constant Wide_Wide_Character := Wide_Wide_Character'Val (194);
UC_A_Tilde : constant Wide_Wide_Character := Wide_Wide_Character'Val (195);
UC_A_Diaeresis
: constant Wide_Wide_Character := Wide_Wide_Character'Val (196);
UC_A_Ring : constant Wide_Wide_Character := Wide_Wide_Character'Val (197);
UC_AE_Diphthong
: constant Wide_Wide_Character := Wide_Wide_Character'Val (198);
UC_C_Cedilla
: constant Wide_Wide_Character := Wide_Wide_Character'Val (199);
UC_E_Grave : constant Wide_Wide_Character := Wide_Wide_Character'Val (200);
UC_E_Acute : constant Wide_Wide_Character := Wide_Wide_Character'Val (201);
UC_E_Circumflex
: constant Wide_Wide_Character := Wide_Wide_Character'Val (202);
UC_E_Diaeresis
: constant Wide_Wide_Character := Wide_Wide_Character'Val (203);
UC_I_Grave : constant Wide_Wide_Character := Wide_Wide_Character'Val (204);
UC_I_Acute : constant Wide_Wide_Character := Wide_Wide_Character'Val (205);
UC_I_Circumflex
: constant Wide_Wide_Character := Wide_Wide_Character'Val (206);
UC_I_Diaeresis
: constant Wide_Wide_Character := Wide_Wide_Character'Val (207);
-- Wide_Wide_Character positions 208 (16#D0#) .. 223 (16#DF#)
UC_Icelandic_Eth
: constant Wide_Wide_Character := Wide_Wide_Character'Val (208);
UC_N_Tilde : constant Wide_Wide_Character := Wide_Wide_Character'Val (209);
UC_O_Grave : constant Wide_Wide_Character := Wide_Wide_Character'Val (210);
UC_O_Acute : constant Wide_Wide_Character := Wide_Wide_Character'Val (211);
UC_O_Circumflex
: constant Wide_Wide_Character := Wide_Wide_Character'Val (212);
UC_O_Tilde : constant Wide_Wide_Character := Wide_Wide_Character'Val (213);
UC_O_Diaeresis
: constant Wide_Wide_Character := Wide_Wide_Character'Val (214);
Multiplication_Sign
: constant Wide_Wide_Character := Wide_Wide_Character'Val (215);
UC_O_Oblique_Stroke
: constant Wide_Wide_Character := Wide_Wide_Character'Val (216);
UC_U_Grave : constant Wide_Wide_Character := Wide_Wide_Character'Val (217);
UC_U_Acute : constant Wide_Wide_Character := Wide_Wide_Character'Val (218);
UC_U_Circumflex
: constant Wide_Wide_Character := Wide_Wide_Character'Val (219);
UC_U_Diaeresis
: constant Wide_Wide_Character := Wide_Wide_Character'Val (220);
UC_Y_Acute : constant Wide_Wide_Character := Wide_Wide_Character'Val (221);
UC_Icelandic_Thorn
: constant Wide_Wide_Character := Wide_Wide_Character'Val (222);
LC_German_Sharp_S
: constant Wide_Wide_Character := Wide_Wide_Character'Val (223);
-- Wide_Wide_Character positions 224 (16#E0#) .. 239 (16#EF#)
LC_A_Grave : constant Wide_Wide_Character := Wide_Wide_Character'Val (224);
LC_A_Acute : constant Wide_Wide_Character := Wide_Wide_Character'Val (225);
LC_A_Circumflex
: constant Wide_Wide_Character := Wide_Wide_Character'Val (226);
LC_A_Tilde : constant Wide_Wide_Character := Wide_Wide_Character'Val (227);
LC_A_Diaeresis
: constant Wide_Wide_Character := Wide_Wide_Character'Val (228);
LC_A_Ring : constant Wide_Wide_Character := Wide_Wide_Character'Val (229);
LC_AE_Diphthong
: constant Wide_Wide_Character := Wide_Wide_Character'Val (230);
LC_C_Cedilla
: constant Wide_Wide_Character := Wide_Wide_Character'Val (231);
LC_E_Grave : constant Wide_Wide_Character := Wide_Wide_Character'Val (232);
LC_E_Acute : constant Wide_Wide_Character := Wide_Wide_Character'Val (233);
LC_E_Circumflex
: constant Wide_Wide_Character := Wide_Wide_Character'Val (234);
LC_E_Diaeresis
: constant Wide_Wide_Character := Wide_Wide_Character'Val (235);
LC_I_Grave : constant Wide_Wide_Character := Wide_Wide_Character'Val (236);
LC_I_Acute : constant Wide_Wide_Character := Wide_Wide_Character'Val (237);
LC_I_Circumflex
: constant Wide_Wide_Character := Wide_Wide_Character'Val (238);
LC_I_Diaeresis
: constant Wide_Wide_Character := Wide_Wide_Character'Val (239);
-- Wide_Wide_Character positions 240 (16#F0#) .. 255 (16#FF)
LC_Icelandic_Eth
: constant Wide_Wide_Character := Wide_Wide_Character'Val (240);
LC_N_Tilde : constant Wide_Wide_Character := Wide_Wide_Character'Val (241);
LC_O_Grave : constant Wide_Wide_Character := Wide_Wide_Character'Val (242);
LC_O_Acute : constant Wide_Wide_Character := Wide_Wide_Character'Val (243);
LC_O_Circumflex
: constant Wide_Wide_Character := Wide_Wide_Character'Val (244);
LC_O_Tilde : constant Wide_Wide_Character := Wide_Wide_Character'Val (245);
LC_O_Diaeresis
: constant Wide_Wide_Character := Wide_Wide_Character'Val (246);
Division_Sign
: constant Wide_Wide_Character := Wide_Wide_Character'Val (247);
LC_O_Oblique_Stroke
: constant Wide_Wide_Character := Wide_Wide_Character'Val (248);
LC_U_Grave : constant Wide_Wide_Character := Wide_Wide_Character'Val (249);
LC_U_Acute : constant Wide_Wide_Character := Wide_Wide_Character'Val (250);
LC_U_Circumflex
: constant Wide_Wide_Character := Wide_Wide_Character'Val (251);
LC_U_Diaeresis
: constant Wide_Wide_Character := Wide_Wide_Character'Val (252);
LC_Y_Acute : constant Wide_Wide_Character := Wide_Wide_Character'Val (253);
LC_Icelandic_Thorn
: constant Wide_Wide_Character := Wide_Wide_Character'Val (254);
LC_Y_Diaeresis
: constant Wide_Wide_Character := Wide_Wide_Character'Val (255);
------------------------------------------------
-- Summary of Changes from Latin-1 => Latin-9 --
------------------------------------------------
-- 164 Currency => Euro_Sign
-- 166 Broken_Bar => UC_S_Caron
-- 168 Diaeresis => LC_S_Caron
-- 180 Acute => UC_Z_Caron
-- 184 Cedilla => LC_Z_Caron
-- 188 Fraction_One_Quarter => UC_Ligature_OE
-- 189 Fraction_One_Half => LC_Ligature_OE
-- 190 Fraction_Three_Quarters => UC_Y_Diaeresis
end Ada.Characters.Wide_Wide_Latin_9;
|
zhmu/ananas | Ada | 537 | ads | package Volatile10_Pkg is
type Num is mod 2**9;
type Rec is record
B1 : Boolean;
N1 : Num;
B2 : Boolean;
N2 : Num;
B3 : Boolean;
B4 : Boolean;
B5 : Boolean;
B6 : Boolean;
B7 : Boolean;
B8 : Boolean;
B9 : Boolean;
B10 : Boolean;
B11 : Boolean;
B12 : Boolean;
B13 : Boolean;
B14 : Boolean;
end record;
pragma Pack (Rec);
for Rec'Size use 32;
pragma Volatile(Rec);
function F return Rec;
end Volatile10_Pkg;
|
faelys/natools | Ada | 1,555 | ads | ------------------------------------------------------------------------------
-- Copyright (c) 2014, Natacha Porté --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- HMAC is an empty parent package for main procedures of HMAC computing --
-- tools. --
------------------------------------------------------------------------------
package HMAC is
pragma Pure (HMAC);
end HMAC;
|
zhmu/ananas | Ada | 2,425 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . W I D E _ W I D E _ T E X T _ I O . F L O A T _ 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. --
-- --
------------------------------------------------------------------------------
-- In Ada 95, the package Ada.Wide_Wide_Text_IO.Float_IO is a subpackage of
-- Wide_Wide_Text_IO. In GNAT we make it a child package to avoid loading
-- the necessary code if Float_IO is not instantiated. See the routine
-- Rtsfind.Check_Text_IO_Special_Unit for a description of how we patch up
-- the difference in semantics so that it is invisible to the Ada programmer.
private generic
type Num is digits <>;
package Ada.Wide_Wide_Text_IO.Float_IO is
Default_Fore : Field := 2;
Default_Aft : Field := Num'Digits - 1;
Default_Exp : Field := 3;
procedure Get
(File : File_Type;
Item : out Num;
Width : Field := 0);
procedure Get
(Item : out Num;
Width : Field := 0);
procedure Put
(File : File_Type;
Item : Num;
Fore : Field := Default_Fore;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp);
procedure Put
(Item : Num;
Fore : Field := Default_Fore;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp);
procedure Get
(From : Wide_Wide_String;
Item : out Num;
Last : out Positive);
procedure Put
(To : out Wide_Wide_String;
Item : Num;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp);
end Ada.Wide_Wide_Text_IO.Float_IO;
|
ytomino/openssl-ada | Ada | 536 | adb | with Ada.Streams;
with Ada.Text_IO;
with Crypto.SHA256; use Crypto.SHA256;
procedure Test_SHA256 is
procedure Test_01 is
use type Ada.Streams.Stream_Element_Array;
C : Context := Initial;
D : Fingerprint;
begin
Update (C, "a");
Final (C, D);
pragma Assert (
Image (D) =
"ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb");
pragma Assert (D = Value (Image (D)));
end Test_01;
pragma Debug (Test_01);
begin
-- finish
Ada.Text_IO.Put_Line (Ada.Text_IO.Standard_Error.all, "ok");
end Test_SHA256;
|
sparre/Ada-2012-Examples | Ada | 938 | ads | with Ada.Containers.Indefinite_Vectors;
package Settings is
------------------------------------------------------------------
-- You may want to put this block in a separate package:
package String_Vectors is
new Ada.Containers.Indefinite_Vectors (Index_Type => Positive,
Element_Type => String);
pragma Warnings (Off); -- We want to rename "&" as "+"!
function "+" (Left, Right : String) return String_Vectors.Vector
renames String_Vectors."&";
function "+" (Left : String_Vectors.Vector;
Right : String) return String_Vectors.Vector
renames String_Vectors."&";
pragma Warnings (On);
------------------------------------------------------------------
File_Names : constant String_Vectors.Vector :=
"/some/file/name" +
"/var/spool/mail/mine" +
"/etc/passwd";
end Settings;
|
stcarrez/ada-asf | Ada | 5,423 | adb | -----------------------------------------------------------------------
-- components-ajax-includes -- AJAX Include component
-- Copyright (C) 2011, 2022 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ASF.Applications.Main;
with ASF.Applications.Views;
with ASF.Components.Root;
with ASF.Contexts.Writer;
package body ASF.Components.Ajax.Includes is
-- ------------------------------
-- Get the HTML layout that must be used for the include container.
-- The default layout is a "div".
-- Returns "div", "span", "pre", "b".
-- ------------------------------
function Get_Layout (UI : in UIInclude;
Context : in ASF.Contexts.Faces.Faces_Context'Class) return String is
Layout : constant String := UI.Get_Attribute (Name => LAYOUT_ATTR_NAME,
Context => Context,
Default => "div");
begin
if Layout = "div" or else Layout = "span" or else Layout = "pre" or else Layout = "b" then
return Layout;
else
return "div";
end if;
end Get_Layout;
-- ------------------------------
-- The included XHTML file is rendered according to the <b>async</b> attribute:
--
-- When <b>async</b> is false, render the specified XHTML file in such a way that inner
-- forms will be posted on the included view.
--
-- When <b>async</b> is true, trigger an AJAX call to include the specified
-- XHTML view when the page is loaded.
--
--
-- ------------------------------
overriding
procedure Encode_Children (UI : in UIInclude;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
begin
if not UI.Is_Rendered (Context) then
return;
end if;
declare
App : constant ASF.Contexts.Faces.Application_Access := Context.Get_Application;
View_Handler : constant access ASF.Applications.Views.View_Handler'Class
:= App.Get_View_Handler;
Id : constant Ada.Strings.Unbounded.Unbounded_String := UI.Get_Client_Id;
Layout : constant String := UIInclude'Class (UI).Get_Layout (Context);
Async : constant Boolean := UI.Get_Attribute (Name => ASYNC_ATTR_NAME,
Context => Context,
Default => False);
Page : constant String := UI.Get_Attribute (Name => SRC_ATTR_NAME,
Context => Context,
Default => "");
Writer : constant Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer;
begin
Writer.Start_Element (Layout);
UI.Render_Attributes (Context, Writer);
-- In Async mode, generate the javascript code to trigger the async update of
-- the generated div/span.
if Async then
Writer.Write_Attribute ("id", Id);
Writer.Queue_Script ("ASF.Update(null,""");
Writer.Queue_Script (View_Handler.Get_Action_URL (Context, Page));
Writer.Queue_Script (""", ""#");
Writer.Queue_Script (Id);
Writer.Queue_Script (""");");
else
-- Include the view content as if the user fetched the patch. This has almost the
-- same final result except that the inner content is returned now and not by
-- another async http GET request.
declare
View : constant ASF.Components.Root.UIViewRoot := Context.Get_View_Root;
Include_View : ASF.Components.Root.UIViewRoot;
Is_Ajax : constant Boolean := Context.Is_Ajax_Request;
Content_Type : constant String := Context.Get_Response.Get_Content_Type;
begin
Context.Set_Ajax_Request (True);
View_Handler.Restore_View (Page, Context, Include_View);
Context.Set_View_Root (Include_View);
View_Handler.Render_View (Context, Include_View);
Context.Get_Response.Set_Content_Type (Content_Type);
Context.Set_View_Root (View);
Context.Set_Ajax_Request (Is_Ajax);
exception
when others =>
Context.Get_Response.Set_Content_Type (Content_Type);
Context.Set_View_Root (View);
Context.Set_Ajax_Request (Is_Ajax);
raise;
end;
end if;
Writer.End_Element (Layout);
end;
end Encode_Children;
end ASF.Components.Ajax.Includes;
|
zhmu/ananas | Ada | 4,624 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . T E X T _ I O . M O D U L A R _ I O --
-- --
-- S p e c --
-- --
-- Copyright (C) 1993-2022, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
-- In Ada 95, the package Ada.Text_IO.Modular_IO is a subpackage of Text_IO.
-- This is for compatibility with Ada 83. In GNAT we make it a child package
-- to avoid loading the necessary code if Modular_IO is not instantiated.
-- See routine Rtsfind.Check_Text_IO_Special_Unit for a description of how
-- we patch up the difference in semantics so that it is invisible to the
-- Ada programmer.
private generic
type Num is mod <>;
package Ada.Text_IO.Modular_IO is
Default_Width : Field := Num'Width;
Default_Base : Number_Base := 10;
procedure Get
(File : File_Type;
Item : out Num;
Width : Field := 0)
with
Pre => Is_Open (File) and then Mode (File) = In_File,
Global => (In_Out => File_System);
procedure Get
(Item : out Num;
Width : Field := 0)
with
Post =>
Line_Length'Old = Line_Length
and Page_Length'Old = Page_Length,
Global => (In_Out => File_System);
procedure Put
(File : File_Type;
Item : Num;
Width : Field := Default_Width;
Base : Number_Base := Default_Base)
with
Pre => Is_Open (File) and then Mode (File) /= In_File,
Post =>
Line_Length (File)'Old = Line_Length (File)
and Page_Length (File)'Old = Page_Length (File),
Global => (In_Out => File_System);
procedure Put
(Item : Num;
Width : Field := Default_Width;
Base : Number_Base := Default_Base)
with
Post =>
Line_Length'Old = Line_Length
and Page_Length'Old = Page_Length,
Global => (In_Out => File_System);
procedure Get
(From : String;
Item : out Num;
Last : out Positive)
with
Global => null;
procedure Put
(To : out String;
Item : Num;
Base : Number_Base := Default_Base)
with
Global => null;
private
pragma Inline (Get);
pragma Inline (Put);
end Ada.Text_IO.Modular_IO;
|
riccardo-bernardini/eugen | Ada | 9,803 | ads | with Ada.Containers.Vectors;
with Ada.Iterator_Interfaces;
with EU_Projects.Nodes.Action_Nodes;
with EU_Projects.Nodes.Timed_Nodes.Deliverables;
with EU_Projects.Nodes.Action_Nodes.Tasks;
with EU_Projects.Nodes.Partners;
with EU_Projects.Node_Tables;
package EU_Projects.Nodes.Action_Nodes.WPs is
type Project_WP is
new Action_Node
-- and Searchable_Nodes.Searchable_Node
with
private;
type Project_WP_Access is access all Project_WP;
subtype WP_Index is Node_Index;
No_WP : constant Extended_Node_Index := No_Index;
type WP_Label is new Node_Label;
function Create
(Label : WP_Label;
Name : String;
Short_Name : String;
Leader : Partners.Partner_Label;
Objectives : String;
Description : String;
Active_When : Action_Time;
Depends_On : Node_Label_Lists.Vector;
Node_Dir : in out Node_Tables.Node_Table)
return Project_WP_Access
with
Post => Create'Result.Index = No_WP;
procedure Set_Index (WP : in out Project_WP;
Idx : WP_Index)
with Pre => Wp.Index = No_WP,
Post => Wp.Index = Idx;
overriding
function Full_Index (Item : Project_WP;
Prefixed : Boolean)
return String;
overriding function Dependency_List (Item : Project_WP)
return Node_Label_Lists.Vector;
-- As many other "add" procedures, this procedure is in charge of assigning
-- an index to the new task, unless the task has already an index (which
-- must not be already present). New indexes are assigned incrementally.
--
-- This, basically, is the plain english "translation" of
-- the pre/postconditions...
procedure Add_Task (WP : in out Project_WP;
Tsk : Tasks.Project_Task_Access)
with
Post => (
(Tsk.Index /= Tasks.No_Task)
and (WP.Contains (Tsk.Index))
and Correctly_Updated (Old_Index => Tsk.Index'Old,
New_Index => Tsk.Index,
Old_Max => WP.Max_Task_Index'Old,
New_Max => WP.Max_Task_Index)
),
Pre => (Tsk.Index = Tasks.No_Task);
-- Return the maximum of the indexes of the tasks currently included
-- in the WP. It is here since it is necessary for the post condition of
-- Add_Task.
function Max_Task_Index (WP : Project_WP) return Extended_Node_Index;
procedure Add_Deliverable
(WP : in out Project_WP;
Item : Timed_Nodes.Deliverables.Deliverable_Access)
with Pre =>
not Item.Is_Clone
and Item.Index = Timed_Nodes.Deliverables.No_Deliverable,
Post =>
Item.Index /= Timed_Nodes.Deliverables.No_Deliverable;
function Contains (WP : Project_WP;
Idx : Tasks.Task_Index)
return Boolean;
type Task_Cursor is private;
function Has_Element (X : Task_Cursor) return Boolean;
package Task_Iterator_Interfaces is
new Ada.Iterator_Interfaces (Cursor => Task_Cursor,
Has_Element => Has_Element);
type Task_Iterator is
new Task_Iterator_Interfaces.Forward_Iterator
with private;
overriding
function First (Object : Task_Iterator) return Task_Cursor;
overriding
function Next
(Object : Task_Iterator;
Position : Task_Cursor) return Task_Cursor;
function All_Tasks
(Item : Project_WP)
return Task_Iterator_Interfaces.Forward_Iterator'Class;
function Element (Index : Task_Cursor)
return Tasks.Project_Task_Access;
function Task_List (Item : Project_WP) return Node_Label_Lists.Vector;
---------------------------
-- Deliverable Iterators --
---------------------------
type Deliverable_Cursor is private;
function Has_Element (X : Deliverable_Cursor) return Boolean;
package Deliverable_Iterator_Interfaces is
new Ada.Iterator_Interfaces (Cursor => Deliverable_Cursor,
Has_Element => Has_Element);
type Deliverable_Iterator is
new Deliverable_Iterator_Interfaces.Forward_Iterator
with private;
overriding
function First (Object : Deliverable_Iterator) return Deliverable_Cursor;
overriding
function Next
(Object : Deliverable_Iterator;
Position : Deliverable_Cursor) return Deliverable_Cursor;
function All_Deliverables
(Item : Project_WP)
return Deliverable_Iterator_Interfaces.Forward_Iterator'Class;
function Element (Index : Deliverable_Cursor)
return Nodes.Timed_Nodes.Deliverables.Deliverable_Access;
overriding procedure Parse_Raw_Expressions
(Item : in out Project_WP;
Vars : Times.Time_Expressions.Parsing.Symbol_Table);
private
use Tasks;
use type Timed_Nodes.Deliverables.Deliverable_Access;
package WP_Index_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => WP_Index);
package Deliverable_Vectors is
new Ada.Containers.Vectors (Index_Type => Timed_Nodes.Deliverables.Deliverable_Index,
Element_Type => Timed_Nodes.Deliverables.Deliverable_Access);
---------------------
-- Task iteration --
---------------------
package Task_Vectors is
new Ada.Containers.Vectors (Index_Type => Tasks.Task_Index,
Element_Type => Tasks.Project_Task_Access);
type Task_Cursor is new Task_Vectors.Cursor;
type Task_Iterator is
new Task_Iterator_Interfaces.Forward_Iterator
with
record
Start : Task_Vectors.Cursor;
end record;
overriding
function First (Object : Task_Iterator) return Task_Cursor
is (Task_Cursor (Object.Start));
overriding
function Next
(Object : Task_Iterator;
Position : Task_Cursor) return Task_Cursor
is (Task_Cursor (Task_Vectors.Next (Task_Vectors.Cursor (Position))));
function Element (Index : Task_Cursor) return Tasks.Project_Task_Access
is (Task_Vectors.Element (Task_Vectors.Cursor (Index)));
function Has_Element (X : Task_Cursor) return Boolean
is (Task_Vectors.Has_Element (Task_Vectors.Cursor (X)));
----------------
-- Finally... --
----------------
type Project_WP is
new Nodes.Action_Nodes.Action_Node
with
record
Objectives : Unbounded_String;
Depend_On : Node_Label_Lists.Vector;
WP_Tasks : Task_Vectors.Vector;
Deliverables : Deliverable_Vectors.Vector;
end record;
--
-- function Index (WP : Project_WP) return Extended_Node_Index
-- is (WP_Index (WP.Index));
function Contains (WP : Project_WP; Idx : Tasks.Task_Index) return Boolean
is ((Idx >= WP.WP_Tasks.First_Index and Idx <= WP.WP_Tasks.Last_Index)
and then (WP.WP_Tasks (Idx) /= null));
----------------------------
-- Deliverable iteration --
----------------------------
type Deliverable_Cursor is
record
Top_Level : Deliverable_Vectors.Cursor;
Clone : Natural;
end record;
type Deliverable_Iterator is
new Deliverable_Iterator_Interfaces.Forward_Iterator
with
record
Start : Deliverable_Vectors.Cursor;
end record;
overriding
function First (Object : Deliverable_Iterator) return Deliverable_Cursor
is (Deliverable_Cursor'(Top_Level => Object.Start, Clone => 0));
function Has_Element (X : Deliverable_Cursor) return Boolean
is (Deliverable_Vectors.Has_Element (X.Top_Level));
function All_Deliverables (Item : Project_WP)
return Deliverable_Iterator_Interfaces.Forward_Iterator'Class
is (Deliverable_Iterator'(Start => Item.Deliverables.First));
overriding
function Full_Index (Item : Project_WP;
Prefixed : Boolean)
return String
is ((if Prefixed then "WP" else "") & Chop (Node_Index'Image (Item.Index)));
function Max_Task_Index (WP : Project_WP) return Extended_Node_Index
is (WP.WP_Tasks.Last_Index);
function All_Tasks (Item : Project_WP)
return Task_Iterator_Interfaces.Forward_Iterator'Class
is (Task_Iterator'(Start => Item.WP_Tasks.First));
-- function All_Deliverables
-- (Item : Project_WP)
-- return Deliverable_Iterator_Interfaces.Forward_Iterator'Class
-- is (Deliverable_Iterator'(Start => Item.WP_Deliverables.First));
--
--
-- function All_Milestones
-- (Item : Project_WP)
-- return Milestone_Iterator_Interfaces.Forward_Iterator'Class
-- is (Milestone_Iterator'(Start => Item.WP_Milestones.First));
end EU_Projects.Nodes.Action_Nodes.WPs;
-- procedure Add_Deliverable (WP : in out Project_WP;
-- Deliverable : Timed_Nodes.Deliverables.Deliverable_Access);
--
-- procedure Add_Dependence (WP : in out Project_WP;
-- Label : Identifiers.Identifier);
--
-- procedure Summarize_Tasks (WP : in out Project_WP);
-- function Find (Where : Project_WP;
-- Label : Identifiers.Identifier)
-- return Searchable_Nodes.Child_Value;
-- -- Search for a child with the given name and return it
-- -- Return No_Child if the child does not exist
--
-- function Exists (Where : Project_WP;
-- Label : Identifiers.Identifier)
-- return Searchable_Nodes.Child_Class;
|
sungyeon/drake | Ada | 13,728 | adb | with System.Long_Long_Elementary_Functions;
with System.Long_Long_Integer_Types;
package body Ada.Numerics.Distributions is
use type System.Long_Long_Integer_Types.Long_Long_Unsigned;
subtype Long_Long_Unsigned is
System.Long_Long_Integer_Types.Long_Long_Unsigned;
function popcountll (x : Long_Long_Unsigned) return Integer
with Import,
Convention => Intrinsic, External_Name => "__builtin_popcountll";
-- Simple distributions
function Linear_Discrete (X : Source) return Target is
Source_W : constant Long_Long_Unsigned :=
Source'Pos (Source'Last) - Source'Pos (Source'First);
Target_W : constant Long_Long_Unsigned :=
Target'Pos (Target'Last) - Target'Pos (Target'First);
begin
if Source_W = 0 or else Target_W = 0 then
-- 0 bit value
return Target'First;
elsif Source_W = Target_W then
-- 1:1 mapping
return Target'Val (
Long_Long_Unsigned (X) + Target'Pos (Target'First));
elsif Long_Long_Unsigned'Max (Source_W, Target_W) <
Long_Long_Unsigned'Last
and then (Source_W + 1) * (Target_W + 1) >= Source_W
and then (Source_W + 1) * (Target_W + 1) >= Target_W
then
-- no overflow
return Target'Val (
Long_Long_Unsigned (X) * (Target_W + 1) / (Source_W + 1)
+ Target'Pos (Target'First));
else
-- use Long_Long_Float
declare
function To_Float is
new Linear_Float_0_To_Less_Than_1 (
Source,
Long_Long_Float);
begin
return Target'Val (
Long_Long_Unsigned (
Long_Long_Float'Floor (
To_Float (X) * (Long_Long_Float (Target_W) + 1.0)))
+ Target'Pos (Target'First));
end;
end if;
end Linear_Discrete;
function Linear_Float_0_To_1 (X : Source) return Target'Base is
begin
return Target'Base (X) * Target'Base (1.0 / (Source'Modulus - 1));
end Linear_Float_0_To_1;
function Linear_Float_0_To_Less_Than_1 (X : Source) return Target'Base is
begin
return Target'Base (X) * Target'Base (1.0 / Source'Modulus);
end Linear_Float_0_To_Less_Than_1;
function Linear_Float_Greater_Than_0_To_Less_Than_1 (X : Source)
return Target'Base is
begin
return (Target'Base (X) + 0.5) * Target'Base (1.0 / Source'Modulus);
end Linear_Float_Greater_Than_0_To_Less_Than_1;
function Exponentially_Float (X : Source) return Target'Base is
subtype Float_Type is Target;
function Fast_Log (X : Float_Type'Base) return Float_Type'Base;
function Fast_Log (X : Float_Type'Base) return Float_Type'Base is
begin
if Float_Type'Digits <= Float'Digits then
declare
function logf (A1 : Float) return Float
with Import,
Convention => Intrinsic,
External_Name => "__builtin_logf";
begin
return Float_Type'Base (logf (Float (X)));
end;
elsif Float_Type'Digits <= Long_Float'Digits then
declare
function log (A1 : Long_Float) return Long_Float
with Import,
Convention => Intrinsic, External_Name => "__builtin_log";
begin
return Float_Type'Base (log (Long_Float (X)));
end;
else
return Float_Type'Base (
System.Long_Long_Elementary_Functions.Fast_Log (
Long_Long_Float (X)));
end if;
end Fast_Log;
function Float_0_To_Less_Than_1 is
new Linear_Float_0_To_Less_Than_1 (Source, Target'Base);
Y : constant Target'Base := Float_0_To_Less_Than_1 (X); -- [0,1)
Z : constant Target'Base := 1.0 - Y; -- (0,1]
begin
return -Fast_Log (Z);
end Exponentially_Float;
-- Simple distributions for random number
function Linear_Discrete_Random (Gen : aliased in out Generator)
return Target is
begin
if Target'First > Target'Last then
raise Constraint_Error;
end if;
declare
function To_Target is new Linear_Discrete (Source, Target);
begin
return To_Target (Get (Gen));
end;
end Linear_Discrete_Random;
-- Strict uniform distributions for random number
function Uniform_Discrete_Random (Gen : aliased in out Generator)
return Target is
begin
if Target'First > Target'Last then
raise Constraint_Error;
end if;
declare
Source_W : constant Long_Long_Unsigned :=
Source'Pos (Source'Last) - Source'Pos (Source'First);
Target_W : constant Long_Long_Unsigned :=
Target'Pos (Target'Last) - Target'Pos (Target'First);
begin
if Source_W = 0 or else Target_W = 0 then
-- 0 bit value
return Target'First;
elsif Source_W = Target_W then
-- 1:1 mapping
declare
X : constant Long_Long_Unsigned :=
Long_Long_Unsigned (Get (Gen));
begin
return Target'Val (X + Target'Pos (Target'First));
end;
elsif Source_W > Target_W
and then (
Source_W = Long_Long_Unsigned'Last
or else popcountll (Source_W + 1) = 1)
and then popcountll (Target_W + 1) = 1
then
-- narrow, and 2 ** n
declare
X : constant Long_Long_Unsigned :=
Long_Long_Unsigned (Get (Gen));
begin
return Target'Val (
X / (Source_W / (Target_W + 1) + 1)
+ Target'Pos (Target'First));
end;
else
loop
declare
Max : Long_Long_Unsigned;
X : Long_Long_Unsigned;
begin
if Source_W > Target_W then
-- narrow
Max := Source_W;
X := Long_Long_Unsigned (Get (Gen));
else
-- wide
Max := 0;
X := 0;
loop
declare
Old_Max : constant Long_Long_Unsigned := Max;
begin
Max := (Max * (Source_W + 1)) + Source_W;
X := (X * (Source_W + 1))
+ Long_Long_Unsigned (Get (Gen));
exit when Max >= Target_W
or else Max <= Old_Max; -- overflow
end;
end loop;
end if;
if Target_W = Long_Long_Unsigned'Last then
-- Source'Range_Length <
-- Target'Range_Length =
-- Long_Long_Unsigned'Range_Length
return Target'Val (X + Target'Pos (Target'First));
else
declare
-- (Max + 1) mod (Target_W + 1)
R : constant Long_Long_Unsigned :=
(Max mod (Target_W + 1) + 1) mod (Target_W + 1);
begin
-- (Max - R + 1) mod (Target_W + 1) = 0
if R = 0 or else X <= Max - R then
return Target'Val (
X mod (Target_W + 1)
+ Target'Pos (Target'First));
end if;
end;
end if;
end;
end loop;
end if;
end;
end Uniform_Discrete_Random;
function Uniform_Float_Random_0_To_1 (Gen : aliased in out Generator)
return Target is
begin
if Target'Machine_Mantissa <= 24 then -- Float'Machine_Mantissa
declare
type Unsigned_24_plus_1 is range 0 .. 2 ** 24;
function Unsigned_24_plus_1_Random is
new Uniform_Discrete_Random (
Source,
Unsigned_24_plus_1,
Generator,
Get);
X : constant Unsigned_24_plus_1 := Unsigned_24_plus_1_Random (Gen);
begin
return Target'Base (X) * Target'Base (1.0 / 2 ** 24);
end;
elsif Target'Machine_Mantissa <= 53 then -- Long_Float'Machine_Mantissa
declare
type Unsigned_53_plus_1 is range 0 .. 2 ** 53;
function Unsigned_53_plus_1_Random is
new Uniform_Discrete_Random (
Source,
Unsigned_53_plus_1,
Generator,
Get);
X : constant Unsigned_53_plus_1 := Unsigned_53_plus_1_Random (Gen);
begin
return Target'Base (X) * Target'Base (1.0 / 2 ** 53);
end;
else
declare
type Unsigned_1 is mod 2; -- high 1 bit
type Unsigned_64 is mod 2 ** 64; -- low bits
function Unsigned_1_Random is
new Uniform_Discrete_Random (
Source,
Unsigned_1,
Generator,
Get);
function Unsigned_64_Random is
new Uniform_Discrete_Random (
Source,
Unsigned_64,
Generator,
Get);
begin
loop
declare
X : constant Unsigned_64 := Unsigned_64_Random (Gen);
begin
if Unsigned_1_Random (Gen) = 1 then
if X = 0 then -- a 128 bit random value = 2 ** 64
return 1.0;
end if;
else
return Target'Base (X) * Target'Base (1.0 / 2 ** 64);
end if;
end;
end loop;
end;
end if;
end Uniform_Float_Random_0_To_1;
function Uniform_Float_Random_0_To_Less_Than_1 (
Gen : aliased in out Generator)
return Target is
begin
if Target'Machine_Mantissa <= 24 then -- Float'Machine_Mantissa
declare
type Unsigned_24 is mod 2 ** 24;
function Unsigned_24_Random is
new Uniform_Discrete_Random (
Source,
Unsigned_24,
Generator,
Get);
function Float_0_To_Less_Than_1 is
new Linear_Float_0_To_Less_Than_1 (Unsigned_24, Target);
begin
return Float_0_To_Less_Than_1 (Unsigned_24_Random (Gen));
end;
elsif Target'Machine_Mantissa <= 53 then -- Long_Float'Machine_Mantissa
declare
type Unsigned_53 is mod 2 ** 53;
function Unsigned_53_Random is
new Uniform_Discrete_Random (
Source,
Unsigned_53,
Generator,
Get);
function Float_0_To_Less_Than_1 is
new Linear_Float_0_To_Less_Than_1 (Unsigned_53, Target);
begin
return Float_0_To_Less_Than_1 (Unsigned_53_Random (Gen));
end;
else
declare
type Unsigned_64 is mod 2 ** 64;
function Unsigned_64_Random is
new Uniform_Discrete_Random (
Source,
Unsigned_64,
Generator,
Get);
function Float_0_To_Less_Than_1 is
new Linear_Float_0_To_Less_Than_1 (Unsigned_64, Target);
begin
return Float_0_To_Less_Than_1 (Unsigned_64_Random (Gen));
end;
end if;
end Uniform_Float_Random_0_To_Less_Than_1;
function Uniform_Float_Random_Greater_Than_0_To_Less_Than_1 (
Gen : aliased in out Generator)
return Target is
begin
if Target'Machine_Mantissa <= 24 then -- Float'Machine_Mantissa
declare
type Unsigned_24 is mod 2 ** 24;
subtype Repr is Unsigned_24 range 1 .. Unsigned_24'Last;
function Unsigned_24_Random is
new Uniform_Discrete_Random (Source, Repr, Generator, Get);
function Float_0_To_Less_Than_1 is
new Linear_Float_0_To_Less_Than_1 (Unsigned_24, Target);
begin
return Float_0_To_Less_Than_1 (Unsigned_24_Random (Gen));
end;
elsif Target'Machine_Mantissa <= 53 then -- Long_Float'Machine_Mantissa
declare
type Unsigned_53 is mod 2 ** 53;
subtype Repr is Unsigned_53 range 1 .. Unsigned_53'Last;
function Unsigned_53_Random is
new Uniform_Discrete_Random (Source, Repr, Generator, Get);
function Float_0_To_Less_Than_1 is
new Linear_Float_0_To_Less_Than_1 (Unsigned_53, Target);
begin
return Float_0_To_Less_Than_1 (Unsigned_53_Random (Gen));
end;
else
declare
type Unsigned_64 is mod 2 ** 64;
subtype Repr is Unsigned_64 range 1 .. Unsigned_64'Last;
function Unsigned_64_Random is
new Uniform_Discrete_Random (Source, Repr, Generator, Get);
function Float_0_To_Less_Than_1 is
new Linear_Float_0_To_Less_Than_1 (Unsigned_64, Target);
begin
return Float_0_To_Less_Than_1 (Unsigned_64_Random (Gen));
end;
end if;
end Uniform_Float_Random_Greater_Than_0_To_Less_Than_1;
end Ada.Numerics.Distributions;
|
AdaCore/libadalang | Ada | 16,878 | adb | ------------------------------------------------------------------------------
-- STATIC STACK ANALYSIS TOOL --
-- --
-- D I S P A T C H I N G _ C A L L S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2010-2011, AdaCore --
-- --
-- GNATstack 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. GNATstack is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANT- --
-- ABILITY 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 GNATstack; see file COPYING3. If --
-- not, go to http://www.gnu.org/licenses for a complete copy of the --
-- license. --
------------------------------------------------------------------------------
with Global_Data;
with Static_Stack_Analysis; use Static_Stack_Analysis;
package body Dispatching_Calls is
-----------------------
-- Local Subprograms --
-----------------------
function Get_Overriding_Methods
(Node : Dispatching_Node) return List_Of_Edges.Vector;
-- This function returns the list of potential targets for a dispatching
-- call. The dispatching call is specified using the index in a vtable
-- used for dispatch, the type whose vtable is used, and the static type
-- of the expression.
procedure Propagate_Derived_Classes
(Position : Static_Stack_Analysis.List_Of_Classes.Cursor);
-- Include in the traversed classes the list of descendent
procedure Propagate_Overloaded_Methods
(Position : Static_Stack_Analysis.List_Of_Virtual_Methods.Cursor);
-- Include in the traversed methods the list of methods which overload them
------------------------------
-- Create_Class_Hierarchies --
------------------------------
procedure Create_Class_Hierarchies is
begin
-- Iterate over all the classes
Static_Stack_Analysis.List_Of_Classes.Iterate
(Global_Data.List_Of_Classes, Propagate_Derived_Classes'Access);
end Create_Class_Hierarchies;
-------------------------------
-- Create_Method_Hierarchies --
-------------------------------
procedure Create_Method_Hierarchies is
begin
-- Iterate over all the methods
Static_Stack_Analysis.List_Of_Virtual_Methods.Iterate
(Global_Data.List_Of_Methods, Propagate_Overloaded_Methods'Access);
end Create_Method_Hierarchies;
----------------------------
-- Get_Overriding_Methods --
----------------------------
function Get_Overriding_Methods
(Node : Dispatching_Node) return List_Of_Edges.Vector
is
Result : List_Of_Edges.Vector := List_Of_Edges.Empty_Vector;
Base_Method : constant Virtual_Class_Access :=
Get_Method (Vtable_Loc'(Node.Base_Class, Node.Slot));
Method_Subprogram : Node_Id;
Static_Class : Class_Access renames Node.Static_Class;
procedure Add_To_Potential_Targets
(Position : Static_Stack_Analysis.List_Of_Virtual_Methods.Cursor);
procedure Add_To_Potential_Targets
(Position : Static_Stack_Analysis.List_Of_Virtual_Methods.Cursor)
is
Explored_Method : constant Virtual_Class_Access :=
List_Of_Virtual_Methods.Element (Position);
begin
if
Static_Class.Derived.Contains (Explored_Method.Vtable_Entry.Class)
and then
Explored_Method /= null
and then
Explored_Method.Symbol_Name /= null
then
-- The method is overloaded in a class which is a descencent
-- of the static class used for dispatching, so it is a potential
-- canditate for dispatching and we add it to the list.
--
-- If we do not have information about the subprogram associated
-- to the method, it means that the method is abstract, so it
-- does not count for dispatching.
Method_Subprogram := Get_Node (Explored_Method.Symbol_Name.all);
if List_Of_Nodes.Has_Element (Method_Subprogram) then
-- Mark the potential target of the dispatching call as
-- reachable.
List_Of_Nodes.Element (Method_Subprogram).Is_Called := True;
Static_Stack_Analysis.List_Of_Edges.Append
(Result,
new Static_Stack_Analysis.Edge_Element'(
Ada_File_Name => Node.Ada_File_Name,
Target => Method_Subprogram,
Point_Of_Call => Node.Location_List,
Feasible_Call => True,
Under_Analysis => False));
end if;
end if;
end Add_To_Potential_Targets;
-- Start of processing for Get_Overriding_Methods
begin
-- We need to get the list of methods which override the one defined
-- in the base class, and from this set we take only those which are
-- defined by classes derived from the static class.
-- At least there is the base method
-- Get the subprogram associated to the base method. If it is not in
-- the list, it means that the method is abstract, so it does not count
-- for dispatching.
if Base_Method /= null and then Base_Method.Symbol_Name /= null then
-- Get the demangled name from the symbol name
Method_Subprogram := Get_Node (Base_Method.Symbol_Name.all);
if List_Of_Nodes.Has_Element (Method_Subprogram) then
-- Mark the potential target of the dispatching call as reachable
List_Of_Nodes.Element (Method_Subprogram).Is_Called := True;
Static_Stack_Analysis.List_Of_Edges.Append
(Result,
new Static_Stack_Analysis.Edge_Element'(
Ada_File_Name => Node.Ada_File_Name,
Target => Method_Subprogram,
Point_Of_Call => Node.Location_List,
Feasible_Call => True,
Under_Analysis => False));
end if;
end if;
-- Now we need to iterate over the list of overriding methods.
--
-- When Base_Method is null it means that GNATstack does not have any
-- information about this method, so the only thing that we can say is
-- that it is an unresolved call.
if Base_Method /= null then
-- We need to use the Redefined_By list that comes from either
-- the Base_Method or the one in the first base class.
-- The C++ compiler, when a method is overridden, generates a
-- pointer to the root of this method (the one defined by the
-- first base class). The Ada compiler generates a pointer to the
-- method directly overloaded.
-- For Example, if we have the hierarchy Parent->Child->Grandchild
-- and the three classes define a method called Foo, the Ada
-- compiler generates the following for Grandchild::Foo:
-- "1:grandchild__foo,1:child__foo"
-- while the C++ compiler generates the following:
-- "1:grandchild__foo,1:parent__foo"
--
-- Note that there is another issue to consider for Ada. If we have
-- again the hierarchy Parent->Child->Grandchild, and Parent and
-- Grandchild (but no Child) define a method called Foo, the Ada
-- compiler generates the following for Grandchild::Foo:
-- "1:grandchild__foo,1:child__foo"
-- even when the method Child::Foo does not actually exist. The C++
-- compiler consistently generates the following:
-- "1:grandchild__foo,1:parent__foo"
-- This issue is handled at the moment of propagating the different
-- methods upstream (in Propagate_Overloaded_Methods), when we add
-- to every method the list of methods are overloading it, putting
-- the information in the Redefined_By field.
declare
Overriding_List : List_Of_Virtual_Methods.Set :=
List_Of_Virtual_Methods.Empty_Set;
First_Base_Method : Virtual_Class_Access;
begin
if List_Of_Virtual_Methods.Is_Empty (Base_Method.Redefined_By) then
-- If the list of methods overloading the direct base is empty
-- it means that we may need to verify the method in the
-- first base method. The reason for this is the different
-- information generated by Ada and C++. When using Ada, the
-- Redefined_By field is update throughout the whole class
-- hierarchy, while in C++ this information is propagated
-- only to the first base classes.
--
-- Note that here, there may be two different first base
-- classes (the one in field Redefines and the one in field
-- Redefines_Multiple). We can simply take the field Redefines
-- (which is always available) because the required
-- information has been propagated to both.
First_Base_Method := Get_Method (Base_Method.Redefines);
if First_Base_Method /= null then
Overriding_List := First_Base_Method.Redefined_By;
end if;
else
Overriding_List := Base_Method.Redefined_By;
end if;
List_Of_Virtual_Methods.Iterate
(Overriding_List, Add_To_Potential_Targets'Access);
end;
end if;
return Result;
end Get_Overriding_Methods;
-------------------------------
-- Propagate_Derived_Classes --
-------------------------------
procedure Propagate_Derived_Classes
(Position : Static_Stack_Analysis.List_Of_Classes.Cursor)
is
Accumulated_Descendent : Static_Stack_Analysis.List_Of_Classes.Set :=
Static_Stack_Analysis.List_Of_Classes.Empty_Set;
Child : constant Class_Access := List_Of_Classes.Element (Position);
procedure Propagate_To_Parent
(Position : Static_Stack_Analysis.List_Of_Classes.Cursor);
procedure Propagate_To_Parent
(Position : Static_Stack_Analysis.List_Of_Classes.Cursor)
is
Parent : constant Class_Access := List_Of_Classes.Element (Position);
begin
-- Include the list of descendent classes to the parent
Parent.Derived.Union (Accumulated_Descendent);
-- Add this class to the list and continue going upstream
Accumulated_Descendent.Insert (Parent);
Static_Stack_Analysis.List_Of_Classes.Iterate
(Parent.Parents, Propagate_To_Parent'Access);
-- Remove me from the list
Accumulated_Descendent.Delete (Parent);
end Propagate_To_Parent;
-- Start of processing for Propagate_Derived_Classes
begin
-- Add this class to the list of classes to propagate upstream
Accumulated_Descendent.Insert (Child);
-- Go up the parent's links
Static_Stack_Analysis.List_Of_Classes.Iterate
(Child.Parents, Propagate_To_Parent'Access);
end Propagate_Derived_Classes;
----------------------------------
-- Propagate_Overloaded_Methods --
----------------------------------
procedure Propagate_Overloaded_Methods
(Position : Static_Stack_Analysis.List_Of_Virtual_Methods.Cursor)
is
Accumulated_Overloaded :
Static_Stack_Analysis.List_Of_Virtual_Methods.Set :=
Static_Stack_Analysis.List_Of_Virtual_Methods.Empty_Set;
Overloaded : constant Virtual_Class_Access :=
List_Of_Virtual_Methods.Element (Position);
procedure Propagate_To_Base (Base : Vtable_Loc);
procedure Propagate_To_Base (Base : Vtable_Loc) is
Overloaded_Method : Virtual_Class_Access;
Primary_Parent : Class_Access;
begin
if Base = Null_Vtable_Loc then
-- Stop propagating because this is not overriding any other
-- method.
null;
else
Overloaded_Method := Static_Stack_Analysis.Get_Method (Base);
if Overloaded_Method = null then
-- It means that this method is overriding another one, but the
-- one to which it is pointing is not a real one and we need to
-- look for the real on going upstream in the class hierarchy.
--
-- This happens with the Ada compiler when we have hierarchy
-- like Parent->Child->Grandchild, and Parent and Grandchild
-- (but no Child) define a method called Foo. The Ada compiler
-- generates the following for Grandchild::Foo:
-- "1:grandchild__foo,1:child__foo"
-- even when the method Child::Foo does not actually exist. The
-- C++ compiler consistently generates the following:
-- "1:grandchild__foo,1:parent__foo"
-- ??? Go up through the primary parents hierarchy. Note that
-- we may need to go up through the secondary parents also.
-- This should be fixed in the compiler.
Primary_Parent := Base.Class.Primary_Parent;
while Primary_Parent /= null loop
Overloaded_Method := Static_Stack_Analysis.Get_Method
(Vtable_Loc'(Primary_Parent, Base.Slot));
if Overloaded_Method = null then
Primary_Parent := Primary_Parent.Primary_Parent;
else
-- Found
exit;
end if;
end loop;
end if;
if Overloaded_Method /= null then
-- Include the list of overloaded methods to the base
Overloaded_Method.Redefined_By.Union (Accumulated_Overloaded);
-- Add this method to the list and continue going upstream
-- through both the primary and secondary vtables that may be
-- overridden.
Accumulated_Overloaded.Insert (Overloaded_Method);
-- Go up the bases' links (primary and secondary)
Propagate_To_Base (Overloaded_Method.Redefines);
Propagate_To_Base (Overloaded_Method.Redefines_Multiple);
-- Remove me from the list
Accumulated_Overloaded.Delete (Overloaded_Method);
end if;
end if;
end Propagate_To_Base;
-- Start of processing of Propagate_Overloaded_Methods
begin
-- Add this method to the list of methods to propagate upstream
Accumulated_Overloaded.Insert (Overloaded);
-- Go up the bases' links (primary and secondary)
Propagate_To_Base (Overloaded.Redefines);
Propagate_To_Base (Overloaded.Redefines_Multiple);
end Propagate_Overloaded_Methods;
-------------------------------
-- Resolve_Dispatching_Calls --
-------------------------------
procedure Resolve_Dispatching_Calls is
Index : List_Of_Nodes.Cursor :=
Global_Data.List_Of_Subprograms.First;
Node : Static_Stack_Analysis.Node_Class_Access;
begin
-- Loop for every instance of dispatching call
while Static_Stack_Analysis.List_Of_Nodes.Has_Element (Index) loop
Node := Static_Stack_Analysis.List_Of_Nodes.Element (Index);
if Node.all in Dispatching_Node'Class then
-- If the node is an artificial dispatching node, we need to
-- verify whether we have all the potential targets. If the
-- information is not there yet we compute and store it.
List_Of_Edges.Append
(Node.Target_Calls,
Dispatching_Calls.Get_Overriding_Methods
(Dispatching_Node (Node.all)));
end if;
Index := Static_Stack_Analysis.List_Of_Nodes.Next (Index);
end loop;
end Resolve_Dispatching_Calls;
end Dispatching_Calls;
|
AdaCore/gpr | Ada | 7,334 | adb | --
-- Copyright (C) 2019-2023, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-Exception
--
with GNAT.String_Split;
package body GPR2.Builtin is
-----------------
-- Alternative --
-----------------
function Alternative
(Value, Alternative_Value : Value_Type) return Value_Type is
begin
return (if Value = "" then "" else Alternative_Value);
end Alternative;
function Alternative
(List, Alternative : Containers.Source_Value_List)
return Containers.Source_Value_List is
begin
return (if List.Is_Empty
then Containers.Source_Value_Type_List.Empty
else Alternative);
end Alternative;
-------------
-- Default --
-------------
function Default (Value, Default_Value : Value_Type) return Value_Type is
begin
return (if Value = "" then Default_Value else Value);
end Default;
function Default
(List, Default : Containers.Source_Value_List)
return Containers.Source_Value_List is
begin
return (if List.Is_Empty then Default else List);
end Default;
--------------
-- External --
--------------
function External
(Context : GPR2.Context.Object;
Variable : Name_Type;
Default_Value : Source_Reference.Value.Object :=
Source_Reference.Value.Undefined;
Sloc : Source_Reference.Object :=
Source_Reference.Undefined)
return Source_Reference.Value.Object is
begin
if Context.Contains (Variable) then
return Source_Reference.Value.Object
(Source_Reference.Value.Create
((if Source_Reference.Object (Default_Value).Is_Defined
then Source_Reference.Object (Default_Value)
else Sloc),
Context (Variable)));
elsif Default_Value.Is_Defined then
return Default_Value;
else
raise Project_Error
with "undefined external reference """ & String (Variable) & '"';
end if;
end External;
----------------------
-- External_As_List --
----------------------
function External_As_List
(Context : GPR2.Context.Object;
Variable : Name_Type;
Separator : Value_Not_Empty) return Containers.Value_List
is
use GNAT.String_Split;
Result : Containers.Value_List;
begin
if Context.Contains (Variable) then
declare
Str : constant String := String'(Context (Variable));
Slices : Slice_Set;
begin
Create (Slices, Str, String (Separator), Mode => Single);
for K in 1 .. Slice_Count (Slices) loop
declare
Value : constant String := Slice (Slices, K);
begin
-- We ignore empty values at the start or at the end
if Value /= "" or else K not in 1 | Slice_Count (Slices) then
Result.Append (Value);
end if;
end;
end loop;
end;
end if;
return Result;
end External_As_List;
----------------
-- Filter_Out --
----------------
function Filter_Out
(List : Containers.Source_Value_List;
Regex : GNAT.Regexp.Regexp)
return Containers.Source_Value_List
is
R : Containers.Source_Value_List;
begin
for E of List loop
if not GNAT.Regexp.Match (E.Text, Regex) then
R.Append (E);
end if;
end loop;
return R;
end Filter_Out;
-------------
-- Item_At --
-------------
function Item_At
(List : Containers.Source_Value_List;
Index : Integer) return Value_Type
is
I : constant Positive :=
(if Index > 0
then Index
else Positive (List.Length) + Index + 1);
begin
return List (I).Text;
end Item_At;
-----------
-- Lower --
-----------
function Lower
(Value : Value_Type) return Value_Type is
begin
return Characters.Handling.To_Lower (String (Value));
end Lower;
-----------
-- Match --
-----------
function Match
(Value, Pattern : Value_Type;
Regex : GNAT.Regpat.Pattern_Matcher;
Replacement : Value_Type) return Value_Type
is
use GNAT;
use type GNAT.Regpat.Match_Location;
Matches : Regpat.Match_Array (0 .. Regpat.Paren_Count (Regex));
R : Unbounded_String;
I : Natural := Replacement'First;
Found : Boolean := False;
begin
Regpat.Match (Regex, Value, Matches);
Found := Matches (0) /= Regpat.No_Match;
if Found then
if Replacement = "" then
if Matches'Last = 1 then
-- No replacement and a single match group, returns the
-- matching pattern.
return Value (Matches (1).First .. Matches (1).Last);
else
-- No replacement and no match group, just replace by the
-- pattern.
return Pattern;
end if;
else
-- Check for replacement pattern \n and replace them by the
-- corresponding matching group.
while I <= Replacement'Last loop
if Replacement (I) = '\'
and then I < Replacement'Last
and then Replacement (I + 1) in '0' .. '9'
then
declare
P : constant Natural :=
Natural'Value (String'(1 => Replacement (I + 1)));
begin
if P <= Matches'Length
and then
Matches (P) /= Regpat.No_Match
then
Append
(R,
Value (Matches (P).First .. Matches (P).Last));
end if;
end;
I := I + 1;
else
Append (R, Replacement (I));
end if;
I := I + 1;
end loop;
end if;
end if;
return To_String (R);
end Match;
-------------------
-- Remove_Prefix --
-------------------
function Remove_Prefix
(Value, Pattern : Value_Type) return Value_Type is
begin
if Pattern'Length <= Value'Length
and then
Value (Value'First .. Value'First + Pattern'Length - 1) = Pattern
then
return Value (Value'First + Pattern'Length .. Value'Last);
else
return Value;
end if;
end Remove_Prefix;
-------------------
-- Remove_Suffix --
-------------------
function Remove_Suffix
(Value, Pattern : Value_Type) return Value_Type is
begin
if Pattern'Length <= Value'Length
and then
Value (Value'Last - Pattern'Length + 1 .. Value'Last) = Pattern
then
return Value (Value'First .. Value'Last - Pattern'Length);
else
return Value;
end if;
end Remove_Suffix;
-----------
-- Upper --
-----------
function Upper
(Value : Value_Type) return Value_Type is
begin
return Characters.Handling.To_Upper (String (Value));
end Upper;
end GPR2.Builtin;
|
reznikmm/matreshka | Ada | 4,588 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.Internals.Strings;
package Matreshka.Internals.XML.Notation_Tables is
pragma Preelaborate;
type Notation_Table is limited private;
procedure New_Notation
(Self : in out Notation_Table;
Name : Symbol_Identifier;
Public_Id : Matreshka.Internals.Strings.Shared_String_Access;
System_Id : Matreshka.Internals.Strings.Shared_String_Access;
Notation : out Notation_Identifier);
-- Allocates new notation.
procedure Finalize (Self : in out Notation_Table);
-- Releases occupied resources.
procedure Reset (Self : in out Notation_Table);
-- Resets to initial state.
private
type Notation_Record is record
Name : Symbol_Identifier;
Public_Id : Matreshka.Internals.Strings.Shared_String_Access;
System_Id : Matreshka.Internals.Strings.Shared_String_Access;
end record;
type Notation_Array is
array (Notation_Identifier range <>) of Notation_Record;
type Notation_Array_Access is access all Notation_Array;
type Notation_Table is limited record
Table : Notation_Array_Access := new Notation_Array (1 .. 15);
Last : Notation_Identifier := No_Notation;
end record;
end Matreshka.Internals.XML.Notation_Tables;
|
AaronC98/PlaneSystem | Ada | 2,747 | adb | ------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2014, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
------------------------------------------------------------------------------
-- This procedure is to be used by the internal Web Server
package body AWS.Net.WebSocket.Registry.Utils is
--------------
-- Register --
--------------
function Register (WebSocket : Object'Class) return Object_Class is
begin
return Net.WebSocket.Registry.Register (WebSocket);
end Register;
-----------
-- Watch --
-----------
procedure Watch (WebSocket : in out Object_Class) is
begin
Net.WebSocket.Registry.Watch (WebSocket);
end Watch;
end AWS.Net.WebSocket.Registry.Utils;
|
AdaCore/langkit | Ada | 156 | ads | package Libfoolang.Implementation.C.Extensions is
procedure foo_do_something with Export, Convention => C;
end Libfoolang.Implementation.C.Extensions;
|
stcarrez/ada-awa | Ada | 3,181 | ads | -----------------------------------------------------------------------
-- awa-events-queues-fifos -- Fifo event queues (memory based)
-- Copyright (C) 2012 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Concurrent.Fifos;
with Util.Beans.Basic;
with EL.Beans;
with EL.Contexts;
private package AWA.Events.Queues.Fifos is
type Fifo_Queue (Name_Length : Natural) is limited new Queue
and Util.Beans.Basic.Bean with private;
type Fifo_Queue_Access is access all Fifo_Queue'Class;
-- Get the queue name.
overriding
function Get_Name (From : in Fifo_Queue) return String;
-- Get the model queue reference object.
-- Returns a null object if the queue is not persistent.
overriding
function Get_Queue (From : in Fifo_Queue) return AWA.Events.Models.Queue_Ref;
-- Queue the event.
overriding
procedure Enqueue (Into : in out Fifo_Queue;
Event : in AWA.Events.Module_Event'Class);
-- Dequeue an event and process it with the <b>Process</b> procedure.
overriding
procedure Dequeue (From : in out Fifo_Queue;
Process : access procedure (Event : in Module_Event'Class));
-- Get the value identified by the name.
-- If the name cannot be found, the method should return the Null object.
overriding
function Get_Value (From : in Fifo_Queue;
Name : in String) return Util.Beans.Objects.Object;
-- Set the value identified by the name.
-- If the name cannot be found, the method should raise the No_Value
-- exception.
overriding
procedure Set_Value (From : in out Fifo_Queue;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- Release the queue storage.
overriding
procedure Finalize (From : in out Fifo_Queue);
-- Create the queue associated with the given name and configure it by using
-- the configuration properties.
function Create_Queue (Name : in String;
Props : in EL.Beans.Param_Vectors.Vector;
Context : in EL.Contexts.ELContext'Class) return Queue_Access;
private
package Fifo_Protected_Queue is
new Util.Concurrent.Fifos (Module_Event_Access, 100, True);
type Fifo_Queue (Name_Length : Natural) is limited new Queue
and Util.Beans.Basic.Bean with record
Fifo : Fifo_Protected_Queue.Fifo;
Name : String (1 .. Name_Length);
end record;
end AWA.Events.Queues.Fifos;
|
AdaCore/libadalang | Ada | 796 | adb | with Ada.Text_IO; use Ada.Text_IO;
with GNATCOLL.VFS; use GNATCOLL.VFS;
with Libadalang.Analysis; use Libadalang.Analysis;
with Libadalang.Helpers; use Libadalang.Helpers;
procedure Main is
procedure Process_Unit (Context : App_Job_Context; Unit : Analysis_Unit);
package App is new Libadalang.Helpers.App
(Name => "test",
Description => "Test App for the auto provider",
Process_Unit => Process_Unit);
------------------
-- Process_Unit --
------------------
procedure Process_Unit (Context : App_Job_Context; Unit : Analysis_Unit) is
pragma Unreferenced (Context);
File : constant String := +Create (+Unit.Get_Filename).Base_Name;
begin
Put_Line ("Processing: " & File);
end Process_Unit;
begin
App.Run;
end Main;
|
BrickBot/Bound-T-H8-300 | Ada | 2,539 | ads | -- Flow.Slim.Output (decl)
--
-- A component of the Bound-T Worst-Case Execution Time Tool.
--
-------------------------------------------------------------------------------
-- Copyright (c) 1999 .. 2015 Tidorum Ltd
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- 1. Redistributions of source code must retain the above copyright notice, this
-- list of conditions and the following disclaimer.
-- 2. Redistributions in binary form must reproduce the above copyright notice,
-- this list of conditions and the following disclaimer in the documentation
-- and/or other materials provided with the distribution.
--
-- This software is provided by the copyright holders and contributors "as is" and
-- any express or implied warranties, including, but not limited to, the implied
-- warranties of merchantability and fitness for a particular purpose are
-- disclaimed. In no event shall the copyright owner or contributors be liable for
-- any direct, indirect, incidental, special, exemplary, or consequential damages
-- (including, but not limited to, procurement of substitute goods or services;
-- loss of use, data, or profits; or business interruption) however caused and
-- on any theory of liability, whether in contract, strict liability, or tort
-- (including negligence or otherwise) arising in any way out of the use of this
-- software, even if advised of the possibility of such damage.
--
-- Other modules (files) of this software composition should contain their
-- own copyright statements, which may have different copyright and usage
-- conditions. The above conditions apply to this file.
-------------------------------------------------------------------------------
--
-- $Revision: 1.2 $
-- $Date: 2015/10/24 19:36:49 $
--
-- $Log: flow-slim-output.ads,v $
-- Revision 1.2 2015/10/24 19:36:49 niklas
-- Moved to free licence.
--
-- Revision 1.1 2000-08-23 09:19:44 parviain
-- First version, added function Show_Nodes.
--
package Flow.Slim.Output is
-- This package is the means to print slimemd graphs. For
-- their explanation, see package Flow.Slim.
-- As there is a package to print normal node graphs (Flow.output)
-- this package concentrates on printing the differences of
-- slim and normal graphs. (There is always the normal graph at
-- hand with slim graph.)
procedure Show_Nodes (Graph : in Flow.Slim.Graph_T);
end Flow.Slim.Output;
|
ytomino/openssl-ada | Ada | 496 | adb | with Ada.Streams;
with Ada.Text_IO;
with Crypto.SHA1; use Crypto.SHA1;
procedure Test_SHA1 is
procedure Test_01 is
use type Ada.Streams.Stream_Element_Array;
C : Context := Initial;
D : Fingerprint;
begin
Update (C, "a");
Final (C, D);
pragma Assert (Image (D) = "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8");
pragma Assert (D = Value (Image (D)));
end Test_01;
pragma Debug (Test_01);
begin
-- finish
Ada.Text_IO.Put_Line (Ada.Text_IO.Standard_Error.all, "ok");
end Test_SHA1;
|
zhmu/ananas | Ada | 3,422 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . C O M M A N D _ L I N E . E N V I R O N M E N T --
-- --
-- B o d y --
-- --
-- Copyright (C) 1996-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System;
package body Ada.Command_Line.Environment is
-----------------------
-- Environment_Count --
-----------------------
function Environment_Count return Natural is
function Env_Count return Natural;
pragma Import (C, Env_Count, "__gnat_env_count");
begin
return Env_Count;
end Environment_Count;
-----------------------
-- Environment_Value --
-----------------------
function Environment_Value (Number : Positive) return String is
procedure Fill_Env (E : System.Address; Env_Num : Integer);
pragma Import (C, Fill_Env, "__gnat_fill_env");
function Len_Env (Env_Num : Integer) return Integer;
pragma Import (C, Len_Env, "__gnat_len_env");
begin
if Number > Environment_Count then
raise Constraint_Error;
end if;
declare
Env : aliased String (1 .. Len_Env (Number - 1));
begin
Fill_Env (Env'Address, Number - 1);
return Env;
end;
end Environment_Value;
end Ada.Command_Line.Environment;
|
reznikmm/matreshka | Ada | 4,712 | 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.First_Row_Start_Column_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Table_First_Row_Start_Column_Attribute_Node is
begin
return Self : Table_First_Row_Start_Column_Attribute_Node do
Matreshka.ODF_Table.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Table_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Table_First_Row_Start_Column_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.First_Row_Start_Column_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Table_URI,
Matreshka.ODF_String_Constants.First_Row_Start_Column_Attribute,
Table_First_Row_Start_Column_Attribute_Node'Tag);
end Matreshka.ODF_Table.First_Row_Start_Column_Attributes;
|
persan/a-cups | Ada | 6,318 | ads | pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
with System;
private package CUPS.cups_sidechannel_h is
CUPS_SC_FD : constant := 4; -- cups/sidechannel.h:41
-- * "$Id: sidechannel.h 10996 2013-05-29 11:51:34Z msweet $"
-- *
-- * Side-channel API definitions for CUPS.
-- *
-- * Copyright 2007-2012 by Apple Inc.
-- * Copyright 2006 by Easy Software Products.
-- *
-- * These coded instructions, statements, and computer programs are the
-- * property of Apple Inc. and are protected by Federal copyright
-- * law. Distribution and use rights are outlined in the file "LICENSE.txt"
-- * which should have been included with this file. If this file is
-- * file is missing or damaged, see the license at "http://www.cups.org/".
-- *
-- * This file is subject to the Apple OS-Developed Software exception.
--
-- * Include necessary headers...
--
-- * C++ magic...
--
-- * Constants...
--
-- * Enumerations...
--
--*** Bidirectional capability values ***
type cups_sc_bidi_e is
(CUPS_SC_BIDI_NOT_SUPPORTED,
CUPS_SC_BIDI_SUPPORTED);
pragma Convention (C, cups_sc_bidi_e); -- cups/sidechannel.h:48
-- Bidirectional I/O is not supported
-- Bidirectional I/O is supported
subtype cups_sc_bidi_t is cups_sc_bidi_e;
--*** Bidirectional capabilities ***
--*** Request command codes ***
type cups_sc_command_e is
(CUPS_SC_CMD_NONE,
CUPS_SC_CMD_SOFT_RESET,
CUPS_SC_CMD_DRAIN_OUTPUT,
CUPS_SC_CMD_GET_BIDI,
CUPS_SC_CMD_GET_DEVICE_ID,
CUPS_SC_CMD_GET_STATE,
CUPS_SC_CMD_SNMP_GET,
CUPS_SC_CMD_SNMP_GET_NEXT,
CUPS_SC_CMD_GET_CONNECTED,
CUPS_SC_CMD_MAX);
pragma Convention (C, cups_sc_command_e); -- cups/sidechannel.h:56
-- No command @private@
-- Do a soft reset
-- Drain all pending output
-- Return bidirectional capabilities
-- Return the IEEE-1284 device ID
-- Return the device state
-- Query an SNMP OID @since CUPS 1.4/OS X 10.6@
-- Query the next SNMP OID @since CUPS 1.4/OS X 10.6@
-- Return whether the backend is "connected" to the printer @since CUPS 1.5/OS X 10.7@
-- End of valid values @private@
subtype cups_sc_command_t is cups_sc_command_e;
--*** Request command codes ***
--*** Connectivity values ***
type cups_sc_connected_e is
(CUPS_SC_NOT_CONNECTED,
CUPS_SC_CONNECTED);
pragma Convention (C, cups_sc_connected_e); -- cups/sidechannel.h:72
-- Backend is not "connected" to printer
-- Backend is "connected" to printer
subtype cups_sc_connected_t is cups_sc_connected_e;
--*** Connectivity values ***
--*** Printer state bits ***
subtype cups_sc_state_e is unsigned;
CUPS_SC_STATE_OFFLINE : constant cups_sc_state_e := 0;
CUPS_SC_STATE_ONLINE : constant cups_sc_state_e := 1;
CUPS_SC_STATE_BUSY : constant cups_sc_state_e := 2;
CUPS_SC_STATE_ERROR : constant cups_sc_state_e := 4;
CUPS_SC_STATE_MEDIA_LOW : constant cups_sc_state_e := 16;
CUPS_SC_STATE_MEDIA_EMPTY : constant cups_sc_state_e := 32;
CUPS_SC_STATE_MARKER_LOW : constant cups_sc_state_e := 64;
CUPS_SC_STATE_MARKER_EMPTY : constant cups_sc_state_e := 128; -- cups/sidechannel.h:81
-- Device is offline
-- Device is online
-- Device is busy
-- Other error condition
-- Paper low condition
-- Paper out condition
-- Toner/ink low condition
-- Toner/ink out condition
subtype cups_sc_state_t is cups_sc_state_e;
--*** Printer state bits ***
--*** Response status codes ***
type cups_sc_status_e is
(CUPS_SC_STATUS_NONE,
CUPS_SC_STATUS_OK,
CUPS_SC_STATUS_IO_ERROR,
CUPS_SC_STATUS_TIMEOUT,
CUPS_SC_STATUS_NO_RESPONSE,
CUPS_SC_STATUS_BAD_MESSAGE,
CUPS_SC_STATUS_TOO_BIG,
CUPS_SC_STATUS_NOT_IMPLEMENTED);
pragma Convention (C, cups_sc_status_e); -- cups/sidechannel.h:95
-- No status
-- Operation succeeded
-- An I/O error occurred
-- The backend did not respond
-- The device did not respond
-- The command/response message was invalid
-- Response too big
-- Command not implemented
subtype cups_sc_status_t is cups_sc_status_e;
--*** Response status codes ***
type cups_sc_walk_func_t is access procedure
(arg1 : Interfaces.C.Strings.chars_ptr;
arg2 : Interfaces.C.Strings.chars_ptr;
arg3 : int;
arg4 : System.Address);
pragma Convention (C, cups_sc_walk_func_t); -- cups/sidechannel.h:109
--*** SNMP walk callback ***
-- * Prototypes...
--
function cupsSideChannelDoRequest
(command : cups_sc_command_t;
data : Interfaces.C.Strings.chars_ptr;
datalen : access int;
timeout : double) return cups_sc_status_t; -- cups/sidechannel.h:118
pragma Import (C, cupsSideChannelDoRequest, "cupsSideChannelDoRequest");
function cupsSideChannelRead
(command : access cups_sc_command_t;
status : access cups_sc_status_t;
data : Interfaces.C.Strings.chars_ptr;
datalen : access int;
timeout : double) return int; -- cups/sidechannel.h:121
pragma Import (C, cupsSideChannelRead, "cupsSideChannelRead");
function cupsSideChannelWrite
(command : cups_sc_command_t;
status : cups_sc_status_t;
data : Interfaces.C.Strings.chars_ptr;
datalen : int;
timeout : double) return int; -- cups/sidechannel.h:125
pragma Import (C, cupsSideChannelWrite, "cupsSideChannelWrite");
--*** New in CUPS 1.4 ***
function cupsSideChannelSNMPGet
(oid : Interfaces.C.Strings.chars_ptr;
data : Interfaces.C.Strings.chars_ptr;
datalen : access int;
timeout : double) return cups_sc_status_t; -- cups/sidechannel.h:131
pragma Import (C, cupsSideChannelSNMPGet, "cupsSideChannelSNMPGet");
function cupsSideChannelSNMPWalk
(oid : Interfaces.C.Strings.chars_ptr;
timeout : double;
cb : cups_sc_walk_func_t;
context : System.Address) return cups_sc_status_t; -- cups/sidechannel.h:134
pragma Import (C, cupsSideChannelSNMPWalk, "cupsSideChannelSNMPWalk");
-- * End of "$Id: sidechannel.h 10996 2013-05-29 11:51:34Z msweet $".
--
end CUPS.cups_sidechannel_h;
|
stcarrez/ada-asf | Ada | 2,869 | ads | -----------------------------------------------------------------------
-- html.lists -- List of items
-- Copyright (C) 2009, 2010, 2014, 2022 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package ASF.Components.Html.Lists is
-- The attribute that defines the layout of the list.
LAYOUT_ATTR_NAME : constant String := "layout";
-- The attribute that defines the CSS style to apply on the list.
STYLE_CLASS_ATTR_NAME : constant String := "styleClass";
-- The attribute representing the CSS to be applied on each item of the list.
ITEM_STYLE_CLASS_ATTR_NAME : constant String := "itemStyleClass";
type UIList is new UIHtmlComponent with private;
-- Get the list layout to use. The default is to use no layout or a div if some CSS style
-- is applied on the list or some specific list ID must be generated. Possible layout values
-- include:
-- "simple" : the list is rendered as is or as a div with each children as is,
-- "unorderedList" : the list is rendered as an HTML ul/li list,
-- "orderedList" : the list is rendered as an HTML ol/li list.
function Get_Layout (UI : in UIList;
Class : in String;
Context : in Faces_Context'Class) return String;
-- Get the value to write on the output.
function Get_Value (UI : in UIList) return EL.Objects.Object;
-- Set the value to write on the output.
procedure Set_Value (UI : in out UIList;
Value : in EL.Objects.Object);
-- Get the variable name
function Get_Var (UI : in UIList) return String;
-- Encode an item of the list with the given item layout and item class.
procedure Encode_Item (UI : in UIList;
Item_Layout : in String;
Item_Class : in String;
Context : in out Faces_Context'Class);
overriding
procedure Encode_Children (UI : in UIList;
Context : in out Faces_Context'Class);
private
type UIList is new UIHtmlComponent with record
Value : EL.Objects.Object;
end record;
end ASF.Components.Html.Lists;
|
AdaCore/libadalang | Ada | 103 | adb | package body Bar is
procedure Proc (E : Element_Type) is
begin
null;
end Proc;
end Bar;
|
mirror/ncurses | Ada | 6,774 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- ncurses --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright 2020 Thomas E. Dickey --
-- Copyright 2000-2006,2011 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Eugene V. Melaragno <[email protected]> 2000
-- Version Control
-- $Revision: 1.9 $
-- $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 Terminal_Interface.Curses.Menus; use Terminal_Interface.Curses.Menus;
with Terminal_Interface.Curses.Mouse; use Terminal_Interface.Curses.Mouse;
procedure ncurses2.menu_test is
function menu_virtualize (c : Key_Code) return Key_Code;
procedure xAdd (l : Line_Position; c : Column_Position; s : String);
function menu_virtualize (c : Key_Code) return Key_Code is
begin
case c is
when Character'Pos (newl) | Key_Exit =>
return Menu_Request_Code'Last + 1; -- MAX_COMMAND? TODO
when Character'Pos ('u') =>
return M_ScrollUp_Line;
when Character'Pos ('d') =>
return M_ScrollDown_Line;
when Character'Pos ('b') | Key_Next_Page =>
return M_ScrollUp_Page;
when Character'Pos ('f') | Key_Previous_Page =>
return M_ScrollDown_Page;
when Character'Pos ('n') | Key_Cursor_Down =>
return M_Next_Item;
when Character'Pos ('p') | Key_Cursor_Up =>
return M_Previous_Item;
when Character'Pos (' ') =>
return M_Toggle_Item;
when Key_Mouse =>
return c;
when others =>
Beep;
return c;
end case;
end menu_virtualize;
MENU_Y : constant Line_Count := 8;
MENU_X : constant Column_Count := 8;
type String_Access is access String;
animals : constant array (Positive range <>) of String_Access :=
(new String'("Lions"),
new String'("Tigers"),
new String'("Bears"),
new String'("(Oh my!)"),
new String'("Newts"),
new String'("Platypi"),
new String'("Lemurs"));
items_a : constant Item_Array_Access :=
new Item_Array (1 .. animals'Last + 1);
tmp : Event_Mask;
procedure xAdd (l : Line_Position; c : Column_Position; s : String) is
begin
Add (Line => l, Column => c, Str => s);
end xAdd;
mrows : Line_Count;
mcols : Column_Count;
menuwin : Window;
m : Menu;
c1 : Key_Code;
c : Driver_Result;
r : Key_Code;
begin
tmp := Start_Mouse;
xAdd (0, 0, "This is the menu test:");
xAdd (2, 0, " Use up and down arrow to move the select bar.");
xAdd (3, 0, " 'n' and 'p' act like arrows.");
xAdd (4, 0, " 'b' and 'f' scroll up/down (page), 'u' and 'd' (line).");
xAdd (5, 0, " Press return to exit.");
Refresh;
for i in animals'Range loop
items_a.all (i) := New_Item (animals (i).all);
end loop;
items_a.all (animals'Last + 1) := Null_Item;
m := New_Menu (items_a);
Set_Format (m, Line_Position (animals'Last + 1) / 2, 1);
Scale (m, mrows, mcols);
menuwin := Create (mrows + 2, mcols + 2, MENU_Y, MENU_X);
Set_Window (m, menuwin);
Set_KeyPad_Mode (menuwin, True);
Box (menuwin); -- 0,0?
Set_Sub_Window (m, Derived_Window (menuwin, mrows, mcols, 1, 1));
Post (m);
loop
c1 := Getchar (menuwin);
r := menu_virtualize (c1);
c := Driver (m, r);
exit when c = Unknown_Request; -- E_UNKNOWN_COMMAND?
if c = Request_Denied then
Beep;
end if;
-- continue ?
end loop;
Move_Cursor (Line => Lines - 2, Column => 0);
Add (Str => "You chose: ");
Add (Str => Name (Current (m)));
Add (Ch => newl);
Pause; -- the C version didn't use Pause, it spelled it out
Post (m, False); -- unpost, not clear :-(
declare begin
Delete (menuwin);
exception when Curses_Exception => null; end;
-- menuwin has children so will raise the exception.
Delete (m);
End_Mouse (tmp);
end ncurses2.menu_test;
|
reznikmm/matreshka | Ada | 5,097 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Generic_Collections;
package AMF.UML.Literal_Strings.Collections is
pragma Preelaborate;
package UML_Literal_String_Collections is
new AMF.Generic_Collections
(UML_Literal_String,
UML_Literal_String_Access);
type Set_Of_UML_Literal_String is
new UML_Literal_String_Collections.Set with null record;
Empty_Set_Of_UML_Literal_String : constant Set_Of_UML_Literal_String;
type Ordered_Set_Of_UML_Literal_String is
new UML_Literal_String_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_UML_Literal_String : constant Ordered_Set_Of_UML_Literal_String;
type Bag_Of_UML_Literal_String is
new UML_Literal_String_Collections.Bag with null record;
Empty_Bag_Of_UML_Literal_String : constant Bag_Of_UML_Literal_String;
type Sequence_Of_UML_Literal_String is
new UML_Literal_String_Collections.Sequence with null record;
Empty_Sequence_Of_UML_Literal_String : constant Sequence_Of_UML_Literal_String;
private
Empty_Set_Of_UML_Literal_String : constant Set_Of_UML_Literal_String
:= (UML_Literal_String_Collections.Set with null record);
Empty_Ordered_Set_Of_UML_Literal_String : constant Ordered_Set_Of_UML_Literal_String
:= (UML_Literal_String_Collections.Ordered_Set with null record);
Empty_Bag_Of_UML_Literal_String : constant Bag_Of_UML_Literal_String
:= (UML_Literal_String_Collections.Bag with null record);
Empty_Sequence_Of_UML_Literal_String : constant Sequence_Of_UML_Literal_String
:= (UML_Literal_String_Collections.Sequence with null record);
end AMF.UML.Literal_Strings.Collections;
|
sebsgit/textproc | Ada | 1,728 | ads | with PixelArray;
with Ada.Strings.Unbounded;
package Histogram
with SPARK_Mode => On
is
pragma Assertion_Policy (Pre => Check,
Post => Check,
Type_Invariant => Check);
type CompareMethod is (Correlation, ChiSquare, Bhattacharyya);
type Bins is array (Positive range<>) of Float;
type Data (Size: Positive) is tagged record
bin: Bins(1 .. Size) := (others => 0.0);
end record;
procedure set(d: out Data; i: Natural; value: Float)
with Pre'Class => (i < d.size),
Inline;
function get(d: Data; i: Natural) return Float
with Pre'Class => (i < d.size),
Inline;
function size(d: Data) return Natural
with Inline;
function sum(d: Data) return Float;
function average(d: Data) return Float;
function normalized(d: Data) return Data
with Post => (normalized'Result.size = d.size);
procedure normalize(d: in out Data);
function resized(d: Data; size: Positive) return Data
with Post => resized'Result.size = size;
procedure multiply(d: in out Data; value: Float)
with Post => (for all i in 0 .. d.size - 1 => d.get(i) = d'Old.get(i) * value);
function multiplied(d: Data; value: Float) return Data
with Post => d.size = multiplied'Result.size;
function compare(d0, d1: Data; method: CompareMethod) return Float
with
Pre'Class => d0.size = d1.size;
function add(d0, d1: Data) return Data
with
Pre'Class => d0.size = d1.size,
Post => add'Result.size = d1.size and (for all i in 0 .. d1.size -1 => add'Result.get(i) = d0.get(i) + d1.get(i));
function toString(d: Data) return Ada.Strings.Unbounded.Unbounded_String;
end Histogram;
|
tum-ei-rcs/StratoX | Ada | 16,114 | ads | -- This spec has been automatically generated from STM32F427x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
with System;
with HAL;
package STM32_SVD.USART is
pragma Preelaborate;
---------------
-- Registers --
---------------
-----------------
-- SR_Register --
-----------------
-- Status register
type SR_Register is record
-- Read-only. Parity error
PE : Boolean := False;
-- Read-only. Framing error
FE : Boolean := False;
-- Read-only. Noise detected flag
NF : Boolean := False;
-- Read-only. Overrun error
ORE : Boolean := False;
-- Read-only. IDLE line detected
IDLE : Boolean := False;
-- Read data register not empty
RXNE : Boolean := False;
-- Transmission complete
TC : Boolean := False;
-- Read-only. Transmit data register empty
TXE : Boolean := False;
-- LIN break detection flag
LBD : Boolean := False;
-- CTS flag
CTS : Boolean := False;
-- unspecified
Reserved_10_31 : HAL.UInt22 := 16#3000#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
PE at 0 range 0 .. 0;
FE at 0 range 1 .. 1;
NF at 0 range 2 .. 2;
ORE at 0 range 3 .. 3;
IDLE at 0 range 4 .. 4;
RXNE at 0 range 5 .. 5;
TC at 0 range 6 .. 6;
TXE at 0 range 7 .. 7;
LBD at 0 range 8 .. 8;
CTS at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-----------------
-- DR_Register --
-----------------
subtype DR_DR_Field is HAL.UInt9;
-- Data register
type DR_Register is record
-- Data value
DR : DR_DR_Field := 16#0#;
-- unspecified
Reserved_9_31 : HAL.UInt23 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR_Register use record
DR at 0 range 0 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
------------------
-- BRR_Register --
------------------
subtype BRR_DIV_Fraction_Field is HAL.UInt4;
subtype BRR_DIV_Mantissa_Field is HAL.UInt12;
-- Baud rate register
type BRR_Register is record
-- fraction of USARTDIV
DIV_Fraction : BRR_DIV_Fraction_Field := 16#0#;
-- mantissa of USARTDIV
DIV_Mantissa : BRR_DIV_Mantissa_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for BRR_Register use record
DIV_Fraction at 0 range 0 .. 3;
DIV_Mantissa at 0 range 4 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
------------------
-- CR1_Register --
------------------
-- Control register 1
type CR1_Register is record
-- Send break
SBK : Boolean := False;
-- Receiver wakeup
RWU : Boolean := False;
-- Receiver enable
RE : Boolean := False;
-- Transmitter enable
TE : Boolean := False;
-- IDLE interrupt enable
IDLEIE : Boolean := False;
-- RXNE interrupt enable
RXNEIE : Boolean := False;
-- Transmission complete interrupt enable
TCIE : Boolean := False;
-- TXE interrupt enable
TXEIE : Boolean := False;
-- PE interrupt enable
PEIE : Boolean := False;
-- Parity selection
PS : Boolean := False;
-- Parity control enable
PCE : Boolean := False;
-- Wakeup method
WAKE : Boolean := False;
-- Word length
M : Boolean := False;
-- USART enable
UE : Boolean := False;
-- unspecified
Reserved_14_14 : HAL.Bit := 16#0#;
-- Oversampling mode
OVER8 : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR1_Register use record
SBK at 0 range 0 .. 0;
RWU at 0 range 1 .. 1;
RE at 0 range 2 .. 2;
TE at 0 range 3 .. 3;
IDLEIE at 0 range 4 .. 4;
RXNEIE at 0 range 5 .. 5;
TCIE at 0 range 6 .. 6;
TXEIE at 0 range 7 .. 7;
PEIE at 0 range 8 .. 8;
PS at 0 range 9 .. 9;
PCE at 0 range 10 .. 10;
WAKE at 0 range 11 .. 11;
M at 0 range 12 .. 12;
UE at 0 range 13 .. 13;
Reserved_14_14 at 0 range 14 .. 14;
OVER8 at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
------------------
-- CR2_Register --
------------------
subtype CR2_ADD_Field is HAL.UInt4;
subtype CR2_STOP_Field is HAL.UInt2;
-- Control register 2
type CR2_Register is record
-- Address of the USART node
ADD : CR2_ADD_Field := 16#0#;
-- unspecified
Reserved_4_4 : HAL.Bit := 16#0#;
-- lin break detection length
LBDL : Boolean := False;
-- LIN break detection interrupt enable
LBDIE : Boolean := False;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- Last bit clock pulse
LBCL : Boolean := False;
-- Clock phase
CPHA : Boolean := False;
-- Clock polarity
CPOL : Boolean := False;
-- Clock enable
CLKEN : Boolean := False;
-- STOP bits
STOP : CR2_STOP_Field := 16#0#;
-- LIN mode enable
LINEN : Boolean := False;
-- unspecified
Reserved_15_31 : HAL.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR2_Register use record
ADD at 0 range 0 .. 3;
Reserved_4_4 at 0 range 4 .. 4;
LBDL at 0 range 5 .. 5;
LBDIE at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
LBCL at 0 range 8 .. 8;
CPHA at 0 range 9 .. 9;
CPOL at 0 range 10 .. 10;
CLKEN at 0 range 11 .. 11;
STOP at 0 range 12 .. 13;
LINEN at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
------------------
-- CR3_Register --
------------------
-- Control register 3
type CR3_Register is record
-- Error interrupt enable
EIE : Boolean := False;
-- IrDA mode enable
IREN : Boolean := False;
-- IrDA low-power
IRLP : Boolean := False;
-- Half-duplex selection
HDSEL : Boolean := False;
-- Smartcard NACK enable
NACK : Boolean := False;
-- Smartcard mode enable
SCEN : Boolean := False;
-- DMA enable receiver
DMAR : Boolean := False;
-- DMA enable transmitter
DMAT : Boolean := False;
-- RTS enable
RTSE : Boolean := False;
-- CTS enable
CTSE : Boolean := False;
-- CTS interrupt enable
CTSIE : Boolean := False;
-- One sample bit method enable
ONEBIT : Boolean := False;
-- unspecified
Reserved_12_31 : HAL.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR3_Register use record
EIE at 0 range 0 .. 0;
IREN at 0 range 1 .. 1;
IRLP at 0 range 2 .. 2;
HDSEL at 0 range 3 .. 3;
NACK at 0 range 4 .. 4;
SCEN at 0 range 5 .. 5;
DMAR at 0 range 6 .. 6;
DMAT at 0 range 7 .. 7;
RTSE at 0 range 8 .. 8;
CTSE at 0 range 9 .. 9;
CTSIE at 0 range 10 .. 10;
ONEBIT at 0 range 11 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
-------------------
-- GTPR_Register --
-------------------
subtype GTPR_PSC_Field is HAL.Byte;
subtype GTPR_GT_Field is HAL.Byte;
-- Guard time and prescaler register
type GTPR_Register is record
-- Prescaler value
PSC : GTPR_PSC_Field := 16#0#;
-- Guard time value
GT : GTPR_GT_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for GTPR_Register use record
PSC at 0 range 0 .. 7;
GT at 0 range 8 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-----------------
-- SR_Register --
-----------------
-- Status register
type SR_Register_1 is record
-- Read-only. Parity error
PE : Boolean := False;
-- Read-only. Framing error
FE : Boolean := False;
-- Read-only. Noise detected flag
NF : Boolean := False;
-- Read-only. Overrun error
ORE : Boolean := False;
-- Read-only. IDLE line detected
IDLE : Boolean := False;
-- Read data register not empty
RXNE : Boolean := False;
-- Transmission complete
TC : Boolean := False;
-- Read-only. Transmit data register empty
TXE : Boolean := False;
-- LIN break detection flag
LBD : Boolean := False;
-- unspecified
Reserved_9_31 : HAL.UInt23 := 16#6000#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register_1 use record
PE at 0 range 0 .. 0;
FE at 0 range 1 .. 1;
NF at 0 range 2 .. 2;
ORE at 0 range 3 .. 3;
IDLE at 0 range 4 .. 4;
RXNE at 0 range 5 .. 5;
TC at 0 range 6 .. 6;
TXE at 0 range 7 .. 7;
LBD at 0 range 8 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
------------------
-- CR2_Register --
------------------
-- Control register 2
type CR2_Register_1 is record
-- Address of the USART node
ADD : CR2_ADD_Field := 16#0#;
-- unspecified
Reserved_4_4 : HAL.Bit := 16#0#;
-- lin break detection length
LBDL : Boolean := False;
-- LIN break detection interrupt enable
LBDIE : Boolean := False;
-- unspecified
Reserved_7_11 : HAL.UInt5 := 16#0#;
-- STOP bits
STOP : CR2_STOP_Field := 16#0#;
-- LIN mode enable
LINEN : Boolean := False;
-- unspecified
Reserved_15_31 : HAL.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR2_Register_1 use record
ADD at 0 range 0 .. 3;
Reserved_4_4 at 0 range 4 .. 4;
LBDL at 0 range 5 .. 5;
LBDIE at 0 range 6 .. 6;
Reserved_7_11 at 0 range 7 .. 11;
STOP at 0 range 12 .. 13;
LINEN at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
------------------
-- CR3_Register --
------------------
-- Control register 3
type CR3_Register_1 is record
-- Error interrupt enable
EIE : Boolean := False;
-- IrDA mode enable
IREN : Boolean := False;
-- IrDA low-power
IRLP : Boolean := False;
-- Half-duplex selection
HDSEL : Boolean := False;
-- unspecified
Reserved_4_5 : HAL.UInt2 := 16#0#;
-- DMA enable receiver
DMAR : Boolean := False;
-- DMA enable transmitter
DMAT : Boolean := False;
-- unspecified
Reserved_8_10 : HAL.UInt3 := 16#0#;
-- One sample bit method enable
ONEBIT : Boolean := False;
-- unspecified
Reserved_12_31 : HAL.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR3_Register_1 use record
EIE at 0 range 0 .. 0;
IREN at 0 range 1 .. 1;
IRLP at 0 range 2 .. 2;
HDSEL at 0 range 3 .. 3;
Reserved_4_5 at 0 range 4 .. 5;
DMAR at 0 range 6 .. 6;
DMAT at 0 range 7 .. 7;
Reserved_8_10 at 0 range 8 .. 10;
ONEBIT at 0 range 11 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Universal synchronous asynchronous receiver transmitter
type USART2_Peripheral is record
-- Status register
SR : SR_Register;
-- Data register
DR : DR_Register;
-- Baud rate register
BRR : BRR_Register;
-- Control register 1
CR1 : CR1_Register;
-- Control register 2
CR2 : CR2_Register;
-- Control register 3
CR3 : CR3_Register;
-- Guard time and prescaler register
GTPR : GTPR_Register;
end record
with Volatile;
for USART2_Peripheral use record
SR at 0 range 0 .. 31;
DR at 4 range 0 .. 31;
BRR at 8 range 0 .. 31;
CR1 at 12 range 0 .. 31;
CR2 at 16 range 0 .. 31;
CR3 at 20 range 0 .. 31;
GTPR at 24 range 0 .. 31;
end record;
-- Universal synchronous asynchronous receiver transmitter
USART2_Periph : aliased USART2_Peripheral
with Import, Address => USART2_Base;
-- Universal synchronous asynchronous receiver transmitter
USART3_Periph : aliased USART2_Peripheral
with Import, Address => USART3_Base;
-- Universal synchronous asynchronous receiver transmitter
UART7_Periph : aliased USART2_Peripheral
with Import, Address => UART7_Base;
-- Universal synchronous asynchronous receiver transmitter
UART8_Periph : aliased USART2_Peripheral
with Import, Address => UART8_Base;
-- Universal synchronous asynchronous receiver transmitter
USART1_Periph : aliased USART2_Peripheral
with Import, Address => USART1_Base;
-- Universal synchronous asynchronous receiver transmitter
USART6_Periph : aliased USART2_Peripheral
with Import, Address => USART6_Base;
-- Universal synchronous asynchronous receiver transmitter
type UART4_Peripheral is record
-- Status register
SR : SR_Register_1;
-- Data register
DR : DR_Register;
-- Baud rate register
BRR : BRR_Register;
-- Control register 1
CR1 : CR1_Register;
-- Control register 2
CR2 : CR2_Register_1;
-- Control register 3
CR3 : CR3_Register_1;
end record
with Volatile;
for UART4_Peripheral use record
SR at 0 range 0 .. 31;
DR at 4 range 0 .. 31;
BRR at 8 range 0 .. 31;
CR1 at 12 range 0 .. 31;
CR2 at 16 range 0 .. 31;
CR3 at 20 range 0 .. 31;
end record;
-- Universal synchronous asynchronous receiver transmitter
UART4_Periph : aliased UART4_Peripheral
with Import, Address => UART4_Base;
-- Universal synchronous asynchronous receiver transmitter
UART5_Periph : aliased UART4_Peripheral
with Import, Address => UART5_Base;
end STM32_SVD.USART;
|
stcarrez/ada-enet | Ada | 1,741 | ads | -----------------------------------------------------------------------
-- echo_server -- A simple UDP echo server
-- Copyright (C) 2016 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Net.Sockets.Udp;
with Net.Buffers;
package Echo_Server is
type Message is record
Id : Natural := 0;
Content : String (1 .. 80) := (others => ' ');
end record;
type Message_List is array (1 .. 10) of Message;
-- Logger that saves the message received by the echo UDP socket.
protected type Logger is
procedure Echo (Content : in Message);
function Get return Message_List;
private
Id : Natural := 0;
List : Message_List;
end Logger;
type Echo_Server is new Net.Sockets.Udp.Socket with record
Count : Natural := 0;
Messages : Logger;
end record;
overriding
procedure Receive (Endpoint : in out Echo_Server;
From : in Net.Sockets.Sockaddr_In;
Packet : in out Net.Buffers.Buffer_Type);
Server : aliased Echo_Server;
end Echo_Server;
|
stcarrez/ada-util | Ada | 3,129 | ads | --
-- Copyright (c) 2008-2009 Tero Koskinen <[email protected]>
--
-- Permission to use, copy, modify, and distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--
with Ada.Finalization;
generic
type Element_Type is private;
package Ahven.SList is
type List is new Ada.Finalization.Controlled with private;
type Cursor is private;
subtype Count_Type is Natural;
Invalid_Cursor : exception;
List_Full : exception;
-- Thrown when the size of the list exceeds Count_Type'Last.
Empty_List : constant List;
procedure Append (Target : in out List; Node_Data : Element_Type);
-- Append an element at the end of the list.
--
-- Raises List_Full if the list has already Count_Type'Last items.
procedure Clear (Target : in out List);
-- Remove all elements from the list.
function First (Target : List) return Cursor;
-- Return a cursor to the first element of the list.
function Next (Position : Cursor) return Cursor;
-- Move the cursor to point to the next element on the list.
function Data (Position : Cursor) return Element_Type;
-- Return element pointed by the cursor.
function Is_Valid (Position : Cursor) return Boolean;
-- Tell the validity of the cursor. The cursor
-- will become invalid when you iterate it over
-- the last item.
function Length (Target : List) return Count_Type;
-- Return the length of the list.
generic
with procedure Action (T : in out Element_Type) is <>;
procedure For_Each (Target : List);
-- A generic procedure for walk through every item
-- in the list and call Action procedure for them.
private
type Node;
type Node_Access is access Node;
type Cursor is new Node_Access;
procedure Remove (Ptr : Node_Access);
-- A procedure to release memory pointed by Ptr.
type Node is record
Next : Node_Access := null;
Data : Element_Type;
end record;
type List is new Ada.Finalization.Controlled with record
First : Node_Access := null;
Last : Node_Access := null;
Size : Count_Type := 0;
end record;
overriding
procedure Initialize (Target : in out List);
overriding
procedure Finalize (Target : in out List);
overriding
procedure Adjust (Target : in out List);
Empty_List : constant List :=
(Ada.Finalization.Controlled with First => null,
Last => null,
Size => 0);
end Ahven.SList;
|
stcarrez/ada-util | Ada | 6,637 | adb | -----------------------------------------------------------------------
-- util-streams-pipes -- Pipe stream to or from a process
-- Copyright (C) 2011, 2013, 2016, 2017, 2018, 2021 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.IO_Exceptions;
package body Util.Streams.Pipes is
-- -----------------------
-- Set the shell executable path to use to launch a command. The default on Unix is
-- the /bin/sh command. Argument splitting is done by the /bin/sh -c command.
-- When setting an empty shell command, the argument splitting is done by the
-- <tt>Spawn</tt> procedure.
-- -----------------------
procedure Set_Shell (Stream : in out Pipe_Stream;
Shell : in String) is
begin
Util.Processes.Set_Shell (Stream.Proc, Shell);
end Set_Shell;
-- -----------------------
-- Before launching the process, redirect the input stream of the process
-- to the specified file.
-- Raises <b>Invalid_State</b> if the process is running.
-- -----------------------
procedure Set_Input_Stream (Stream : in out Pipe_Stream;
File : in String) is
begin
Util.Processes.Set_Input_Stream (Stream.Proc, File);
end Set_Input_Stream;
-- -----------------------
-- Set the output stream of the process.
-- Raises <b>Invalid_State</b> if the process is running.
-- -----------------------
procedure Set_Output_Stream (Stream : in out Pipe_Stream;
File : in String;
Append : in Boolean := False) is
begin
Util.Processes.Set_Output_Stream (Stream.Proc, File, Append);
end Set_Output_Stream;
-- -----------------------
-- Set the error stream of the process.
-- Raises <b>Invalid_State</b> if the process is running.
-- -----------------------
procedure Set_Error_Stream (Stream : in out Pipe_Stream;
File : in String;
Append : in Boolean := False) is
begin
Util.Processes.Set_Error_Stream (Stream.Proc, File, Append);
end Set_Error_Stream;
-- -----------------------
-- Closes the given file descriptor in the child process before executing the command.
-- -----------------------
procedure Add_Close (Stream : in out Pipe_Stream;
Fd : in Util.Processes.File_Type) is
begin
Util.Processes.Add_Close (Stream.Proc, Fd);
end Add_Close;
-- -----------------------
-- Set the working directory that the process will use once it is created.
-- The directory must exist or the <b>Invalid_Directory</b> exception will be raised.
-- -----------------------
procedure Set_Working_Directory (Stream : in out Pipe_Stream;
Path : in String) is
begin
Util.Processes.Set_Working_Directory (Stream.Proc, Path);
end Set_Working_Directory;
-- -----------------------
-- Open a pipe to read or write to an external process. The pipe is created and the
-- command is executed with the input and output streams redirected through the pipe.
-- -----------------------
procedure Open (Stream : in out Pipe_Stream;
Command : in String;
Mode : in Pipe_Mode := READ) is
begin
Util.Processes.Spawn (Stream.Proc, Command, Mode);
end Open;
-- -----------------------
-- Close the pipe and wait for the external process to terminate.
-- -----------------------
overriding
procedure Close (Stream : in out Pipe_Stream) is
begin
Util.Processes.Wait (Stream.Proc);
end Close;
-- -----------------------
-- Get the process exit status.
-- -----------------------
function Get_Exit_Status (Stream : in Pipe_Stream) return Integer is
begin
return Util.Processes.Get_Exit_Status (Stream.Proc);
end Get_Exit_Status;
-- -----------------------
-- Returns True if the process is running.
-- -----------------------
function Is_Running (Stream : in Pipe_Stream) return Boolean is
begin
return Util.Processes.Is_Running (Stream.Proc);
end Is_Running;
-- -----------------------
-- Write the buffer array to the output stream.
-- -----------------------
overriding
procedure Write (Stream : in out Pipe_Stream;
Buffer : in Ada.Streams.Stream_Element_Array) is
Output : constant Streams.Output_Stream_Access := Processes.Get_Input_Stream (Stream.Proc);
begin
if Output = null then
raise Ada.IO_Exceptions.Status_Error with "Process is not launched";
end if;
Output.Write (Buffer);
end Write;
-- -----------------------
-- Read into the buffer as many bytes as possible and return in
-- <b>last</b> the position of the last byte read.
-- -----------------------
overriding
procedure Read (Stream : in out Pipe_Stream;
Into : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset) is
Input : Streams.Input_Stream_Access := Processes.Get_Output_Stream (Stream.Proc);
begin
if Input = null then
Input := Processes.Get_Error_Stream (Stream.Proc);
if Input = null then
raise Ada.IO_Exceptions.Status_Error with "Process is not launched";
end if;
end if;
Input.Read (Into, Last);
end Read;
-- -----------------------
-- Terminate the process by sending a signal on Unix and exiting the process on Windows.
-- This operation is not portable and has a different behavior between Unix and Windows.
-- Its intent is to stop the process.
-- -----------------------
procedure Stop (Stream : in out Pipe_Stream;
Signal : in Positive := 15) is
begin
Util.Processes.Stop (Stream.Proc, Signal);
end Stop;
end Util.Streams.Pipes;
|
reznikmm/matreshka | Ada | 4,347 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Nodes;
with XML.DOM.Elements.Internals;
package body ODF.DOM.Elements.Style.Table_Cell_Properties.Internals is
------------
-- Create --
------------
function Create
(Node : Matreshka.ODF_Elements.Style.Table_Cell_Properties.Style_Table_Cell_Properties_Access)
return ODF.DOM.Elements.Style.Table_Cell_Properties.ODF_Style_Table_Cell_Properties is
begin
return
(XML.DOM.Elements.Internals.Create
(Matreshka.DOM_Nodes.Element_Access (Node)) with null record);
end Create;
----------
-- Wrap --
----------
function Wrap
(Node : Matreshka.ODF_Elements.Style.Table_Cell_Properties.Style_Table_Cell_Properties_Access)
return ODF.DOM.Elements.Style.Table_Cell_Properties.ODF_Style_Table_Cell_Properties is
begin
return
(XML.DOM.Elements.Internals.Wrap
(Matreshka.DOM_Nodes.Element_Access (Node)) with null record);
end Wrap;
end ODF.DOM.Elements.Style.Table_Cell_Properties.Internals;
|
reznikmm/matreshka | Ada | 3,667 | 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 XML.DOM.Attributes;
package ODF.DOM.Attributes.Style.Country_Complex is
type ODF_Style_Country_Complex is
new XML.DOM.Attributes.DOM_Attribute with private;
private
type ODF_Style_Country_Complex is
new XML.DOM.Attributes.DOM_Attribute with null record;
end ODF.DOM.Attributes.Style.Country_Complex;
|
kraileth/ravenadm | Ada | 4,747 | ads | -- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../License.txt
with Interfaces.C;
with Interfaces.C_Streams;
with Interfaces.C.Strings;
with HelperText;
package Unix is
package HT renames HelperText;
package IC renames Interfaces.C;
package ICS renames Interfaces.C.Strings;
package CSM renames Interfaces.C_Streams;
type process_exit is (still_running, exited_normally, exited_with_error);
type Int32 is private;
subtype pid_t is Int32;
-- check if process identified by pid has exited or keeps going
function process_status (pid : pid_t) return process_exit;
-- Kill everything with the identified process group
procedure kill_process_tree (process_group : pid_t);
-- Allows other packages to call external commands (e.g. Pilot)
-- Returns "True" on success
function external_command (command : String) return Boolean;
-- wrapper for nonblocking spawn
function launch_process (command : String) return pid_t;
-- Returns True if pid is less than zero
function fork_failed (pid : pid_t) return Boolean;
-- Returns True if "variable" is defined in the environment. The
-- value of variable is irrelevant
function env_variable_defined (variable : String) return Boolean;
-- Return value of "variable" defined in environment. If it's not
-- defined than an empty string is returned;
function env_variable_value (variable : String) return String;
-- Execute popen and return stdout+stderr combined
-- Also the result status is returned as an "out" variable
function piped_command
(command : String;
status : out Integer) return HT.Text;
-- Run external command that is expected to have no output to standard
-- out, but catch stdout anyway. Don't return any output, but do return
-- True of the command returns status of zero.
function piped_mute_command
(command : String;
abnormal : out HT.Text) return Boolean;
-- When the cone of silence is deployed, the terminal does not echo
-- and Control-Q/S keystrokes are not captured (and vice-versa)
procedure cone_of_silence (deploy : Boolean);
-- Returns True if a TTY device is detected
function screen_attached return Boolean;
-- Equivalent of libc's realpath() function
-- It resolves symlinks and relative directories to get the true path
function true_path (provided_path : String) return String;
-- Ignore SIGTTOU signal (background process trying to write to terminal)
-- If that happens, synth will suspend and ultimately fail.
procedure ignore_background_tty;
-- Attempts to create a hardlink and returns True on success
function create_hardlink (actual_file : String; destination : String) return Boolean;
-- Attempts to create a symlink and returns True on success
function create_symlink (actual_file : String; destination : String) return Boolean;
private
type uInt8 is mod 2 ** 16;
type Int32 is range -(2 ** 31) .. +(2 ** 31) - 1;
popen_re : constant IC.char_array := IC.To_C ("re");
popen_r : constant IC.char_array := IC.To_C ("r");
function popen (Command, Mode : IC.char_array) return CSM.FILEs;
pragma Import (C, popen);
function pclose (FileStream : CSM.FILEs) return CSM.int;
pragma Import (C, pclose);
function ferror (FileStream : CSM.FILEs) return CSM.int;
pragma Import (C, ferror);
function realpath (pathname, resolved_path : IC.char_array)
return ICS.chars_ptr;
pragma Import (C, realpath, "realpath");
function nohang_waitpid (pid : pid_t) return uInt8;
pragma Import (C, nohang_waitpid, "__nohang_waitpid");
function silent_control return uInt8;
pragma Import (C, silent_control, "__silent_control");
function chatty_control return uInt8;
pragma Import (C, chatty_control, "__chatty_control");
function signal_runaway (pid : pid_t) return IC.int;
pragma Import (C, signal_runaway, "__shut_it_down");
function ignore_tty_write return uInt8;
pragma Import (C, ignore_tty_write, "__ignore_background_tty_writes");
function ignore_tty_read return uInt8;
pragma Import (C, ignore_tty_read, "__ignore_background_tty_reads");
function link (path1, path2 : IC.char_array) return IC.int;
pragma Import (C, link);
function symlink (path1, path2 : IC.char_array) return IC.int;
pragma Import (C, symlink);
-- internal pipe close command
function pipe_close (OpenFile : CSM.FILEs) return Integer;
-- internal pipe read command
function pipe_read (OpenFile : CSM.FILEs) return HT.Text;
-- Internal file error check
function good_stream (OpenFile : CSM.FILEs) return Boolean;
end Unix;
|
stcarrez/dynamo | Ada | 33,060 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- N A M E T --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Alloc;
with Table;
with Hostparm; use Hostparm;
with System; use System;
with Types; use Types;
package Namet is
-- WARNING: There is a C version of this package. Any changes to this
-- source file must be properly reflected in the C header file namet.h
-- which is created manually from namet.ads and namet.adb.
-- This package contains routines for handling the names table. The table
-- is used to store character strings for identifiers and operator symbols,
-- as well as other string values such as unit names and file names.
-- The forms of the entries are as follows:
-- Identifiers Stored with upper case letters folded to lower case.
-- Upper half (16#80# bit set) and wide characters are
-- stored in an encoded form (Uhh for upper half char,
-- Whhhh for wide characters, WWhhhhhhhh as provided by
-- the routine Store_Encoded_Character, where hh are hex
-- digits for the character code using lower case a-f).
-- Normally the use of U or W in other internal names is
-- avoided, but these letters may be used in internal
-- names (without this special meaning), if they appear
-- as the last character of the name, or they are
-- followed by an upper case letter (other than the WW
-- sequence), or an underscore.
-- Operator symbols Stored with an initial letter O, and the remainder
-- of the name is the lower case characters XXX where
-- the name is Name_Op_XXX, see Snames spec for a full
-- list of the operator names. Normally the use of O
-- in other internal names is avoided, but it may be
-- used in internal names (without this special meaning)
-- if it is the last character of the name, or if it is
-- followed by an upper case letter or an underscore.
-- Character literals Character literals have names that are used only for
-- debugging and error message purposes. The form is an
-- upper case Q followed by a single lower case letter,
-- or by a Uxx/Wxxxx/WWxxxxxxx encoding as described for
-- identifiers. The Set_Character_Literal_Name procedure
-- should be used to construct these encodings. Normally
-- the use of O in other internal names is avoided, but
-- it may be used in internal names (without this special
-- meaning) if it is the last character of the name, or
-- if it is followed by an upper case letter or an
-- underscore.
-- Unit names Stored with upper case letters folded to lower case,
-- using Uhh/Whhhh/WWhhhhhhhh encoding as described for
-- identifiers, and a %s or %b suffix for specs/bodies.
-- See package Uname for further details.
-- File names Are stored in the form provided by Osint. Typically
-- they may include wide character escape sequences and
-- upper case characters (in non-encoded form). Casing
-- is also derived from the external environment. Note
-- that file names provided by Osint must generally be
-- consistent with the names from Fname.Get_File_Name.
-- Other strings The names table is also used as a convenient storage
-- location for other variable length strings such as
-- error messages etc. There are no restrictions on what
-- characters may appear for such entries.
-- Note: the encodings Uhh (upper half characters), Whhhh (wide characters),
-- WWhhhhhhhh (wide wide characters) and Qx (character literal names) are
-- described in the spec, since they are visible throughout the system (e.g.
-- in debugging output). However, no code should depend on these particular
-- encodings, so it should be possible to change the encodings by making
-- changes only to the Namet specification (to change these comments) and the
-- body (which actually implements the encodings).
-- The names are hashed so that a given name appears only once in the table,
-- except that names entered with Name_Enter as opposed to Name_Find are
-- omitted from the hash table.
-- The first 26 entries in the names table (with Name_Id values in the range
-- First_Name_Id .. First_Name_Id + 25) represent names which are the one
-- character lower case letters in the range a-z, and these names are created
-- and initialized by the Initialize procedure.
-- Five values, one of type Int, one of type Byte, and three of type Boolean,
-- are stored with each names table entry and subprograms are provided for
-- setting and retrieving these associated values. The usage of these values
-- is up to the client:
-- In the compiler we have the following uses:
-- The Int field is used to point to a chain of potentially visible
-- entities (see Sem.Ch8 for details).
-- The Byte field is used to hold the Token_Type value for reserved words
-- (see Sem for details).
-- The Boolean1 field is used to mark address clauses to optimize the
-- performance of the Exp_Util.Following_Address_Clause function.
-- The Boolean2 field is used to mark simple names that appear in
-- Restriction[_Warning]s pragmas for No_Use_Of_Entity. This avoids most
-- unnecessary searches of the No_Use_Of_Entity table.
-- The Boolean3 field is not used
-- In the binder, we have the following uses:
-- The Int field is used in various ways depending on the name involved,
-- see binder documentation for details.
-- The Byte and Boolean fields are unused.
-- Note that the value of the Int and Byte fields are initialized to zero,
-- and the Boolean field is initialized to False, when a new Name table entry
-- is created.
Name_Buffer : String (1 .. 4 * Max_Line_Length);
-- This buffer is used to set the name to be stored in the table for the
-- Name_Find call, and to retrieve the name for the Get_Name_String call.
-- The limit here is intended to be an infinite value that ensures that we
-- never overflow the buffer (names this long are too absurd to worry).
Name_Len : Natural := 0;
-- Length of name stored in Name_Buffer. Used as an input parameter for
-- Name_Find, and as an output value by Get_Name_String, or Write_Name.
-- Note: in normal usage, all users of Name_Buffer/Name_Len are expected
-- to initialize Name_Len appropriately. The reason we preinitialize to
-- zero here is that some circuitry (e.g. Osint.Write_Program_Name) does
-- a save/restore on Name_Len and Name_Buffer (1 .. Name_Len), and we do
-- not want some arbitrary junk value to result in saving an arbitrarily
-- long slice which would waste time and blow the stack.
-----------------------------
-- Types for Namet Package --
-----------------------------
-- Name_Id values are used to identify entries in the names table. Except
-- for the special values No_Name and Error_Name, they are subscript values
-- for the Names table defined in this package.
-- Note that with only a few exceptions, which are clearly documented, the
-- type Name_Id should be regarded as a private type. In particular it is
-- never appropriate to perform arithmetic operations using this type.
type Name_Id is range Names_Low_Bound .. Names_High_Bound;
for Name_Id'Size use 32;
-- Type used to identify entries in the names table
No_Name : constant Name_Id := Names_Low_Bound;
-- The special Name_Id value No_Name is used in the parser to indicate
-- a situation where no name is present (e.g. on a loop or block).
Error_Name : constant Name_Id := Names_Low_Bound + 1;
-- The special Name_Id value Error_Name is used in the parser to
-- indicate that some kind of error was encountered in scanning out
-- the relevant name, so it does not have a representable label.
subtype Error_Name_Or_No_Name is Name_Id range No_Name .. Error_Name;
-- Used to test for either error name or no name
First_Name_Id : constant Name_Id := Names_Low_Bound + 2;
-- Subscript of first entry in names table
------------------------------
-- Name_Id Membership Tests --
------------------------------
-- The following functions allow a convenient notation for testing whether
-- a Name_Id value matches any one of a list of possible values. In each
-- case True is returned if the given T argument is equal to any of the V
-- arguments. These essentially duplicate the Ada 2012 membership tests,
-- but we cannot use the latter (yet) in the compiler front end, because
-- of bootstrap considerations
function Nam_In
(T : Name_Id;
V1 : Name_Id;
V2 : Name_Id) return Boolean;
function Nam_In
(T : Name_Id;
V1 : Name_Id;
V2 : Name_Id;
V3 : Name_Id) return Boolean;
function Nam_In
(T : Name_Id;
V1 : Name_Id;
V2 : Name_Id;
V3 : Name_Id;
V4 : Name_Id) return Boolean;
function Nam_In
(T : Name_Id;
V1 : Name_Id;
V2 : Name_Id;
V3 : Name_Id;
V4 : Name_Id;
V5 : Name_Id) return Boolean;
function Nam_In
(T : Name_Id;
V1 : Name_Id;
V2 : Name_Id;
V3 : Name_Id;
V4 : Name_Id;
V5 : Name_Id;
V6 : Name_Id) return Boolean;
function Nam_In
(T : Name_Id;
V1 : Name_Id;
V2 : Name_Id;
V3 : Name_Id;
V4 : Name_Id;
V5 : Name_Id;
V6 : Name_Id;
V7 : Name_Id) return Boolean;
function Nam_In
(T : Name_Id;
V1 : Name_Id;
V2 : Name_Id;
V3 : Name_Id;
V4 : Name_Id;
V5 : Name_Id;
V6 : Name_Id;
V7 : Name_Id;
V8 : Name_Id) return Boolean;
function Nam_In
(T : Name_Id;
V1 : Name_Id;
V2 : Name_Id;
V3 : Name_Id;
V4 : Name_Id;
V5 : Name_Id;
V6 : Name_Id;
V7 : Name_Id;
V8 : Name_Id;
V9 : Name_Id) return Boolean;
function Nam_In
(T : Name_Id;
V1 : Name_Id;
V2 : Name_Id;
V3 : Name_Id;
V4 : Name_Id;
V5 : Name_Id;
V6 : Name_Id;
V7 : Name_Id;
V8 : Name_Id;
V9 : Name_Id;
V10 : Name_Id) return Boolean;
function Nam_In
(T : Name_Id;
V1 : Name_Id;
V2 : Name_Id;
V3 : Name_Id;
V4 : Name_Id;
V5 : Name_Id;
V6 : Name_Id;
V7 : Name_Id;
V8 : Name_Id;
V9 : Name_Id;
V10 : Name_Id;
V11 : Name_Id) return Boolean;
pragma Inline (Nam_In);
-- Inline all above functions
-----------------
-- Subprograms --
-----------------
procedure Finalize;
-- Called at the end of a use of the Namet package (before a subsequent
-- call to Initialize). Currently this routine is only used to generate
-- debugging output.
procedure Get_Name_String (Id : Name_Id);
-- Get_Name_String is used to retrieve the string associated with an entry
-- in the names table. The resulting string is stored in Name_Buffer and
-- Name_Len is set. It is an error to call Get_Name_String with one of the
-- special name Id values (No_Name or Error_Name).
function Get_Name_String (Id : Name_Id) return String;
-- This functional form returns the result as a string without affecting
-- the contents of either Name_Buffer or Name_Len. The lower bound is 1.
procedure Get_Unqualified_Name_String (Id : Name_Id);
-- Similar to the above except that qualification (as defined in unit
-- Exp_Dbug) is removed (including both preceding __ delimited names, and
-- also the suffixes used to indicate package body entities and to
-- distinguish between overloaded entities). Note that names are not
-- qualified until just before the call to gigi, so this routine is only
-- needed by processing that occurs after gigi has been called. This
-- includes all ASIS processing, since ASIS works on the tree written
-- after gigi has been called.
procedure Get_Name_String_And_Append (Id : Name_Id);
-- Like Get_Name_String but the resulting characters are appended to the
-- current contents of the entry stored in Name_Buffer, and Name_Len is
-- incremented to include the added characters.
procedure Get_Decoded_Name_String (Id : Name_Id);
-- Same calling sequence an interface as Get_Name_String, except that the
-- result is decoded, so that upper half characters and wide characters
-- appear as originally found in the source program text, operators have
-- their source forms (special characters and enclosed in quotes), and
-- character literals appear surrounded by apostrophes.
procedure Get_Unqualified_Decoded_Name_String (Id : Name_Id);
-- Similar to the above except that qualification (as defined in unit
-- Exp_Dbug) is removed (including both preceding __ delimited names, and
-- also the suffix used to indicate package body entities). Note that
-- names are not qualified until just before the call to gigi, so this
-- routine is only needed by processing that occurs after gigi has been
-- called. This includes all ASIS processing, since ASIS works on the tree
-- written after gigi has been called.
procedure Get_Decoded_Name_String_With_Brackets (Id : Name_Id);
-- This routine is similar to Decoded_Name, except that the brackets
-- notation (Uhh replaced by ["hh"], Whhhh replaced by ["hhhh"],
-- WWhhhhhhhh replaced by ["hhhhhhhh"]) is used for all non-lower half
-- characters, regardless of how Opt.Wide_Character_Encoding_Method is
-- set, and also in that characters in the range 16#80# .. 16#FF# are
-- converted to brackets notation in all cases. This routine can be used
-- when there is a requirement for a canonical representation not affected
-- by the character set options (e.g. in the binder generation of
-- symbols).
function Get_Name_Table_Byte (Id : Name_Id) return Byte;
pragma Inline (Get_Name_Table_Byte);
-- Fetches the Byte value associated with the given name
function Get_Name_Table_Int (Id : Name_Id) return Int;
pragma Inline (Get_Name_Table_Int);
-- Fetches the Int value associated with the given name
function Get_Name_Table_Boolean1 (Id : Name_Id) return Boolean;
function Get_Name_Table_Boolean2 (Id : Name_Id) return Boolean;
function Get_Name_Table_Boolean3 (Id : Name_Id) return Boolean;
-- Fetches the Boolean values associated with the given name
function Is_Operator_Name (Id : Name_Id) return Boolean;
-- Returns True if name given is of the form of an operator (that
-- is, it starts with an upper case O).
procedure Initialize;
-- This is a dummy procedure. It is retained for easy compatibility with
-- clients who used to call Initialize when this call was required. Now
-- initialization is performed automatically during package elaboration.
-- Note that this change fixes problems which existed prior to the change
-- of Initialize being called more than once. See also Reinitialize which
-- allows reinitialization of the tables.
procedure Lock;
-- Lock name tables before calling back end. We reserve some extra space
-- before locking to avoid unnecessary inefficiencies when we unlock.
procedure Reinitialize;
-- Clears the name tables and removes all existing entries from the table.
procedure Unlock;
-- Unlocks the name table to allow use of the extra space reserved by the
-- call to Lock. See gnat1drv for details of the need for this.
function Length_Of_Name (Id : Name_Id) return Nat;
pragma Inline (Length_Of_Name);
-- Returns length of given name in characters. This is the length of the
-- encoded name, as stored in the names table, the result is equivalent to
-- calling Get_Name_String and reading Name_Len, except that a call to
-- Length_Of_Name does not affect the contents of Name_Len and Name_Buffer.
function Name_Chars_Address return System.Address;
-- Return starting address of name characters table (used in Back_End call
-- to Gigi).
function Name_Find return Name_Id;
-- Name_Find is called with a string stored in Name_Buffer whose length is
-- in Name_Len (i.e. the characters of the name are in subscript positions
-- 1 to Name_Len in Name_Buffer). It searches the names table to see if the
-- string has already been stored. If so the Id of the existing entry is
-- returned. Otherwise a new entry is created with its Name_Table_Int
-- fields set to zero/false. The contents of Name_Buffer and Name_Len are
-- not modified by this call. Note that it is permissible for Name_Len to
-- be set to zero to lookup the null name string.
function Name_Find_Str (S : String) return Name_Id;
-- Similar to Name_Find, except that the string is provided as an argument.
-- This call destroys the contents of Name_Buffer and Name_Len (by storing
-- the given string there.
function Name_Enter return Name_Id;
-- Name_Enter has the same calling interface as Name_Find. The difference
-- is that it does not search the table for an existing match, and also
-- subsequent Name_Find calls using the same name will not locate the
-- entry created by this call. Thus multiple calls to Name_Enter with the
-- same name will create multiple entries in the name table with different
-- Name_Id values. This is useful in the case of created names, which are
-- never expected to be looked up. Note: Name_Enter should never be used
-- for one character names, since these are efficiently located without
-- hashing by Name_Find in any case.
function Name_Entries_Address return System.Address;
-- Return starting address of Names table (used in Back_End call to Gigi)
function Name_Entries_Count return Nat;
-- Return current number of entries in the names table
function Is_OK_Internal_Letter (C : Character) return Boolean;
pragma Inline (Is_OK_Internal_Letter);
-- Returns true if C is a suitable character for using as a prefix or a
-- suffix of an internally generated name, i.e. it is an upper case letter
-- other than one of the ones used for encoding source names (currently
-- the set of reserved letters is O, Q, U, W) and also returns False for
-- the letter X, which is reserved for debug output (see Exp_Dbug).
function Is_Internal_Name (Id : Name_Id) return Boolean;
-- Returns True if the name is an internal name (i.e. contains a character
-- for which Is_OK_Internal_Letter is true, or if the name starts or ends
-- with an underscore. This call destroys the value of Name_Len and
-- Name_Buffer (it loads these as for Get_Name_String).
--
-- Note: if the name is qualified (has a double underscore), then only the
-- final entity name is considered, not the qualifying names. Consider for
-- example that the name:
--
-- pkg__B_1__xyz
--
-- is not an internal name, because the B comes from the internal name of
-- a qualifying block, but the xyz means that this was indeed a declared
-- identifier called "xyz" within this block and there is nothing internal
-- about that name.
function Is_Internal_Name return Boolean;
-- Like the form with an Id argument, except that the name to be tested is
-- passed in Name_Buffer and Name_Len (which are not affected by the call).
-- Name_Buffer (it loads these as for Get_Name_String).
function Is_Valid_Name (Id : Name_Id) return Boolean;
-- True if Id is a valid name -- points to a valid entry in the
-- Name_Entries table.
procedure Reset_Name_Table;
-- This procedure is used when there are multiple source files to reset
-- the name table info entries associated with current entries in the
-- names table. There is no harm in keeping the names entries themselves
-- from one compilation to another, but we can't keep the entity info,
-- since this refers to tree nodes, which are destroyed between each main
-- source file.
procedure Add_Char_To_Name_Buffer (C : Character);
pragma Inline (Add_Char_To_Name_Buffer);
-- Add given character to the end of the string currently stored in the
-- Name_Buffer, incrementing Name_Len.
procedure Add_Nat_To_Name_Buffer (V : Nat);
-- Add decimal representation of given value to the end of the string
-- currently stored in Name_Buffer, incrementing Name_Len as required.
procedure Add_Str_To_Name_Buffer (S : String);
-- Add characters of string S to the end of the string currently stored
-- in the Name_Buffer, incrementing Name_Len by the length of the string.
procedure Insert_Str_In_Name_Buffer (S : String; Index : Positive);
-- Inserts given string in name buffer, starting at Index. Any existing
-- characters at or past this location get moved beyond the inserted string
-- and Name_Len is incremented by the length of the string.
procedure Set_Character_Literal_Name (C : Char_Code);
-- This procedure sets the proper encoded name for the character literal
-- for the given character code. On return Name_Buffer and Name_Len are
-- set to reflect the stored name.
procedure Set_Name_Table_Int (Id : Name_Id; Val : Int);
pragma Inline (Set_Name_Table_Int);
-- Sets the Int value associated with the given name
procedure Set_Name_Table_Byte (Id : Name_Id; Val : Byte);
pragma Inline (Set_Name_Table_Byte);
-- Sets the Byte value associated with the given name
procedure Set_Name_Table_Boolean1 (Id : Name_Id; Val : Boolean);
procedure Set_Name_Table_Boolean2 (Id : Name_Id; Val : Boolean);
procedure Set_Name_Table_Boolean3 (Id : Name_Id; Val : Boolean);
-- Sets the Boolean value associated with the given name
procedure Store_Encoded_Character (C : Char_Code);
-- Stores given character code at the end of Name_Buffer, updating the
-- value in Name_Len appropriately. Lower case letters and digits are
-- stored unchanged. Other 8-bit characters are stored using the Uhh
-- encoding (hh = hex code), other 16-bit wide character values are stored
-- using the Whhhh (hhhh = hex code) encoding, and other 32-bit wide wide
-- character values are stored using the WWhhhhhhhh (hhhhhhhh = hex code).
-- Note that this procedure does not fold upper case letters (they are
-- stored using the Uhh encoding). If folding is required, it must be done
-- by the caller prior to the call.
procedure Tree_Read;
-- Initializes internal tables from current tree file using the relevant
-- Table.Tree_Read routines. Note that Initialize should not be called if
-- Tree_Read is used. Tree_Read includes all necessary initialization.
procedure Tree_Write;
-- Writes out internal tables to current tree file using the relevant
-- Table.Tree_Write routines.
procedure Get_Last_Two_Chars (N : Name_Id; C1, C2 : out Character);
-- Obtains last two characters of a name. C1 is last but one character
-- and C2 is last character. If name is less than two characters long,
-- then both C1 and C2 are set to ASCII.NUL on return.
procedure Write_Name (Id : Name_Id);
-- Write_Name writes the characters of the specified name using the
-- standard output procedures in package Output. No end of line is
-- written, just the characters of the name. On return Name_Buffer and
-- Name_Len are set as for a call to Get_Name_String. The name is written
-- in encoded form (i.e. including Uhh, Whhh, Qx, _op as they appear in
-- the name table). If Id is Error_Name, or No_Name, no text is output.
procedure Write_Name_Decoded (Id : Name_Id);
-- Like Write_Name, except that the name written is the decoded name, as
-- described for Get_Decoded_Name_String, and the resulting value stored
-- in Name_Len and Name_Buffer is the decoded name.
------------------------------
-- File and Unit Name Types --
------------------------------
-- These are defined here in Namet rather than Fname and Uname to avoid
-- problems with dependencies, and to avoid dragging in Fname and Uname
-- into many more files, but it would be cleaner to move to Fname/Uname.
type File_Name_Type is new Name_Id;
-- File names are stored in the names table and this type is used to
-- indicate that a Name_Id value is being used to hold a simple file name
-- (which does not include any directory information).
No_File : constant File_Name_Type := File_Name_Type (No_Name);
-- Constant used to indicate no file is present (this is used for example
-- when a search for a file indicates that no file of the name exists).
Error_File_Name : constant File_Name_Type := File_Name_Type (Error_Name);
-- The special File_Name_Type value Error_File_Name is used to indicate
-- a unit name where some previous processing has found an error.
subtype Error_File_Name_Or_No_File is
File_Name_Type range No_File .. Error_File_Name;
-- Used to test for either error file name or no file
type Path_Name_Type is new Name_Id;
-- Path names are stored in the names table and this type is used to
-- indicate that a Name_Id value is being used to hold a path name (that
-- may contain directory information).
No_Path : constant Path_Name_Type := Path_Name_Type (No_Name);
-- Constant used to indicate no path name is present
type Unit_Name_Type is new Name_Id;
-- Unit names are stored in the names table and this type is used to
-- indicate that a Name_Id value is being used to hold a unit name, which
-- terminates in %b for a body or %s for a spec.
No_Unit_Name : constant Unit_Name_Type := Unit_Name_Type (No_Name);
-- Constant used to indicate no file name present
Error_Unit_Name : constant Unit_Name_Type := Unit_Name_Type (Error_Name);
-- The special Unit_Name_Type value Error_Unit_Name is used to indicate
-- a unit name where some previous processing has found an error.
subtype Error_Unit_Name_Or_No_Unit_Name is
Unit_Name_Type range No_Unit_Name .. Error_Unit_Name;
------------------------
-- Debugging Routines --
------------------------
procedure wn (Id : Name_Id);
pragma Export (Ada, wn);
-- This routine is intended for debugging use only (i.e. it is intended to
-- be called from the debugger). It writes the characters of the specified
-- name using the standard output procedures in package Output, followed by
-- a new line. The name is written in encoded form (i.e. including Uhh,
-- Whhh, Qx, _op as they appear in the name table). If Id is Error_Name,
-- No_Name, or invalid an appropriate string is written (<Error_Name>,
-- <No_Name>, <invalid name>). Unlike Write_Name, this call does not affect
-- the contents of Name_Buffer or Name_Len.
---------------------------
-- Table Data Structures --
---------------------------
-- The following declarations define the data structures used to store
-- names. The definitions are in the private part of the package spec,
-- rather than the body, since they are referenced directly by gigi.
private
-- This table stores the actual string names. Although logically there is
-- no need for a terminating character (since the length is stored in the
-- name entry table), we still store a NUL character at the end of every
-- name (for convenience in interfacing to the C world).
package Name_Chars is new Table.Table (
Table_Component_Type => Character,
Table_Index_Type => Int,
Table_Low_Bound => 0,
Table_Initial => Alloc.Name_Chars_Initial,
Table_Increment => Alloc.Name_Chars_Increment,
Table_Name => "Name_Chars");
type Name_Entry is record
Name_Chars_Index : Int;
-- Starting location of characters in the Name_Chars table minus one
-- (i.e. pointer to character just before first character). The reason
-- for the bias of one is that indexes in Name_Buffer are one's origin,
-- so this avoids unnecessary adds and subtracts of 1.
Name_Len : Short;
-- Length of this name in characters
Byte_Info : Byte;
-- Byte value associated with this name
Boolean1_Info : Boolean;
Boolean2_Info : Boolean;
Boolean3_Info : Boolean;
-- Boolean values associated with the name
Name_Has_No_Encodings : Boolean;
-- This flag is set True if the name entry is known not to contain any
-- special character encodings. This is used to speed up repeated calls
-- to Get_Decoded_Name_String. A value of False means that it is not
-- known whether the name contains any such encodings.
Hash_Link : Name_Id;
-- Link to next entry in names table for same hash code
Int_Info : Int;
-- Int Value associated with this name
end record;
for Name_Entry use record
Name_Chars_Index at 0 range 0 .. 31;
Name_Len at 4 range 0 .. 15;
Byte_Info at 6 range 0 .. 7;
Boolean1_Info at 7 range 0 .. 0;
Boolean2_Info at 7 range 1 .. 1;
Boolean3_Info at 7 range 2 .. 2;
Name_Has_No_Encodings at 7 range 3 .. 7;
Hash_Link at 8 range 0 .. 31;
Int_Info at 12 range 0 .. 31;
end record;
for Name_Entry'Size use 16 * 8;
-- This ensures that we did not leave out any fields
-- This is the table that is referenced by Name_Id entries.
-- It contains one entry for each unique name in the table.
package Name_Entries is new Table.Table (
Table_Component_Type => Name_Entry,
Table_Index_Type => Name_Id'Base,
Table_Low_Bound => First_Name_Id,
Table_Initial => Alloc.Names_Initial,
Table_Increment => Alloc.Names_Increment,
Table_Name => "Name_Entries");
end Namet;
|
jhumphry/PRNG_Zoo | Ada | 5,648 | adb | --
-- PRNG Zoo
-- Copyright (c) 2014 - 2015, James Humphry
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
-- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
-- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-- PERFORMANCE OF THIS SOFTWARE.
with AUnit.Assertions; use AUnit.Assertions;
with PRNG_Zoo.xorshift_star;
with PRNG_Zoo.Linear_Congruential.Examples;
with PRNG_Zoo.Filters;
package body PRNGTests_Suite.Dispatcher_Tests is
--------------------
-- Register_Tests --
--------------------
procedure Register_Tests (T: in out Dispatcher_Test) is
use AUnit.Test_Cases.Registration;
begin
Register_Routine (T, Test_Dispatcher'Access, "Basic check on Dispatcher holder type.");
Register_Routine (T, Test_Dispatcher_32'Access, "Basic check on Dispatcher_32 holder type.");
Register_Routine (T, Test_Split_32'Access, "Basic check on Split_32 filter.");
Register_Routine (T, Test_Bit_Reverse'Access, "Test bit reversing filter.");
end Register_Tests;
----------
-- Name --
----------
function Name (T : Dispatcher_Test) return Test_String is
pragma Unreferenced (T);
begin
return Format ("Test Dispatcher holding types and filters");
end Name;
------------
-- Set_Up --
------------
procedure Set_Up (T : in out Dispatcher_Test) is
begin
null;
end Set_Up;
---------------------
-- Test_Dispatcher --
---------------------
procedure Test_Dispatcher (T : in out Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
G1: aliased xorshift_star.xorshift64_star;
G2 : xorshift_star.xorshift64_star;
G : Dispatcher(G1'Access);
begin
G.Reset(5489);
G2.Reset(5489);
for I in 1..64 loop
Assert(U64'(G.Generate) = U64'(G2.Generate),
"xorshift64* wrapped in a Dispatcher produces different 64-bit output than plain xorshift64*.");
end loop;
G.Reset(5432);
G2.Reset(5432);
Assert(U64'(G.Generate) = U64'(G2.Generate),
"Resetting a xorshift64* wrapped in a Dispatcher seems different from resetting a plain xorshift64*.");
Assert(G.Strength = G2.Strength,
"xorshift64* wrapped in a Dispatcher has a different strength than plain xorshift64*.");
end Test_Dispatcher;
------------------------
-- Test_Dispatcher_32 --
------------------------
procedure Test_Dispatcher_32 (T : in out Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
G1: aliased Linear_Congruential.Examples.MINSTD;
G2 : Linear_Congruential.Examples.MINSTD;
G : Dispatcher(G1'Access);
begin
G.Reset(5489);
G2.Reset(5489);
for I in 1..64 loop
Assert(U32'(G.Generate) = U32'(G2.Generate),
"MINSTD wrapped in a Dispatcher produces different 64-bit output than plain MINSTD.");
end loop;
G.Reset(5432);
G2.Reset(5432);
Assert(U32'(G.Generate) = U32'(G2.Generate),
"Resetting a MINSTD wrapped in a Dispatcher seems different from resetting a plain MINSTD.");
Assert(G.Strength = G2.Strength,
"MINSTD wrapped in a Dispatcher has a different strength than plain MINSTD.");
end Test_Dispatcher_32;
-------------------
-- Test_Split_32 --
-------------------
procedure Test_Split_32 (T : in out Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
IG : aliased Filters.Incrementer;
G : Filters.Split_32(IG => IG'Access);
Expected_Array : constant U32_array := (16#33333334#, 16#22222222#,
16#33333335#, 16#22222222#);
begin
G.Reset(16#2222222233333333#);
for E of Expected_Array loop
Assert(U32'(G.Generate) = E,
"Split_32 implementation produces unexpected result.");
end loop;
end Test_Split_32;
----------------------
-- Test_Bit_Reverse --
----------------------
procedure Test_Bit_Reverse (T : in out Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
IG : aliased Filters.Incrementer;
G : Filters.Bit_Reverse(IG => IG'Access);
Expected_Array_32 : constant U32_array := (16#2CCCCCCC#, 16#ACCCCCCC#,
16#6CCCCCCC#, 16#ECCCCCCC#);
Expected_Array_64 : constant U64_array := (16#2CCCCCCC44444444#,
16#ACCCCCCC44444444#,
16#6CCCCCCC44444444#,
16#ECCCCCCC44444444#);
begin
G.Reset(16#33333333#);
for E of Expected_Array_32 loop
Assert(U32'(G.Generate) = E,
"Bit Reverse implementation produces unexpected result in 32 bits.");
end loop;
G.Reset(16#2222222233333333#);
for E of Expected_Array_64 loop
Assert(U64'(G.Generate) = E,
"Bit Reverse implementation produces unexpected result in 64 bits.");
end loop;
end Test_Bit_Reverse;
end PRNGTests_Suite.Dispatcher_Tests;
|
Rodeo-McCabe/orka | Ada | 738 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2013 Felix Krause <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package Glfw_Test is
procedure Enable_Print_Errors;
end Glfw_Test;
|
reznikmm/markdown | Ada | 2,811 | adb | -- SPDX-FileCopyrightText: 2020 Max Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
----------------------------------------------------------------
with Markdown.Visitors;
with Markdown.List_Items;
package body Markdown.Lists is
overriding procedure Append_Child
(Self : in out List;
Child : not null Markdown.Blocks.Block_Access)
is
type Visitor is new Markdown.Visitors.Visitor with null record;
overriding procedure List_Item
(Ignore : in out Visitor;
Value : in out Markdown.List_Items.List_Item);
overriding procedure List_Item
(Ignore : in out Visitor;
Value : in out Markdown.List_Items.List_Item)
is
Marker : constant League.Strings.Universal_String := Value.Marker;
begin
Self.Is_Ordered := Value.Is_Ordered;
if Self.Marker.Is_Empty and then Self.Is_Ordered then
Self.Start := Natural'Wide_Wide_Value
(Marker.Head_To (Marker.Length - 1).To_Wide_Wide_String);
end if;
Self.Is_Loose := Self.Is_Loose
or Value.Has_Blank_Line
or Self.Ends_Blank;
Self.Ends_Blank := Value.Ends_With_Blank_Line;
Self.Marker := Marker.Tail_From (Marker.Length);
end List_Item;
List_Item_Detector : Visitor;
begin
Child.Visit (List_Item_Detector);
Markdown.Blocks.Container_Block (Self).Append_Child (Child);
end Append_Child;
------------
-- Create --
------------
overriding function Create
(Line : not null access Markdown.Blocks.Text_Line) return List
is
pragma Unreferenced (Line);
begin
return raise Program_Error;
end Create;
--------------
-- Is_Loose --
--------------
function Is_Loose (Self : List'Class) return Boolean is
begin
return Self.Is_Loose;
end Is_Loose;
----------------
-- Is_Ordered --
----------------
function Is_Ordered (Self : List'Class) return Boolean is
begin
return Self.Is_Ordered;
end Is_Ordered;
-----------
-- Match --
-----------
function Match
(Self : List'Class;
Marker : League.Strings.Universal_String) return Boolean
is
use type League.Strings.Universal_String;
Tail : constant League.Strings.Universal_String :=
Marker.Tail_From (Marker.Length);
begin
return Tail = Self.Marker;
end Match;
-----------
-- Start --
-----------
function Start (Self : List'Class) return Natural is
begin
return Self.Start;
end Start;
-----------
-- Visit --
-----------
overriding procedure Visit
(Self : in out List;
Visitor : in out Markdown.Visitors.Visitor'Class) is
begin
Visitor.List (Self);
end Visit;
end Markdown.Lists;
|
reznikmm/matreshka | Ada | 139 | ads | package Matreshka.Opts.internal is
INTERNAL_PARSER_ERROR : exception;
NOT_IMPLEMENTED : exception;
end Matreshka.Opts.internal;
|
zrmyers/VulkanAda | Ada | 15,270 | adb | --------------------------------------------------------------------------------
-- MIT License
--
-- Copyright (c) 2020 Zane Myers
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
--------------------------------------------------------------------------------
with Vulkan.Math.Integers;
with Vulkan.Math.Common;
with Vulkan.Math.GenFType;
with Ada.Unchecked_Conversion;
use Vulkan.Math.Integers;
use Vulkan.Math.Common;
use Vulkan.Math.GenFType;
package body Vulkan.Math.Packing is
-- A short value.
type Half_Float_Unused_Bits is mod 2 ** 16;
-- A sign bit.
type Sign_Bit is mod 2 ** 1;
-- Single float exponent MSB bits
type Single_Float_Exponent_Msb is mod 2 ** 3;
-- Single float exponent LSB bits
type Single_Float_Exponent_Lsb is mod 2 ** 5;
-- Single float mantissa MSB bits
type Single_Float_Mantissa_Msb is mod 2 ** 10;
-- Single float mantissa LSB bits
type Single_Float_Mantissa_Lsb is mod 2 ** 13;
-- The layout of a single-precision floating point number.
type Single_Float_Bits is record
sign : Sign_Bit;
exponent_msb : Single_Float_Exponent_Msb;
exponent_lsb : Single_Float_Exponent_Lsb;
mantissa_msb : Single_Float_Mantissa_Msb;
mantissa_lsb : Single_Float_Mantissa_Lsb;
end record;
-- The bit positions to use for each field of the record.
for Single_Float_Bits use record
sign at 0 range 31 .. 31;
exponent_msb at 0 range 28 .. 30;
exponent_lsb at 0 range 23 .. 27;
mantissa_msb at 0 range 13 .. 22;
mantissa_lsb at 0 range 0 .. 12;
end record;
-- The size of a single precision float.
for Single_Float_Bits'Size use 32;
-- The layout of a half-precision floating point number.
type Vkm_Half_Float_Bits is record
unused : Half_Float_Unused_Bits;
sign : Sign_Bit;
exponent : Single_Float_Exponent_Lsb;
mantissa : Single_Float_Mantissa_Msb;
end record;
-- The bit positions to use for each field of the record.
for Vkm_Half_Float_Bits use record
unused at 0 range 16 .. 31;
sign at 0 range 15 .. 15;
exponent at 0 range 10 .. 14;
mantissa at 0 range 0 .. 9;
end record;
-- The size of a half-precision float.
for Vkm_Half_Float_Bits'Size use 32;
-- The layout of a packed double-precision floating point number.
type Vkm_Double_Float_Bits is record
msb : Vkm_Uint;
lsb : Vkm_Uint;
end record;
-- The bit positions to use for each field of the record.
for Vkm_Double_Float_Bits use record
msb at 0 range 32 .. 63;
lsb at 0 range 0 .. 31;
end record;
-- The size of a double-precision float.
for Vkm_Double_Float_Bits'Size use 64;
----------------------------------------------------------------------------
-- Unchecked Conversion Operations
----------------------------------------------------------------------------
-- Unchecked conversion from 32-bit float to Single Float Bits.
function Convert_Vkm_Float_To_Single_Float_Bits is new
Ada.Unchecked_Conversion(Source => Vkm_Float, Target => Single_Float_Bits);
-- Unchecked conversion to 32-bit float from Single Float Bits.
function Convert_Single_Float_Bits_To_Vkm_Float is new
Ada.Unchecked_Conversion(Source => Single_Float_Bits, Target => Vkm_Float);
-- Unchecked conversion from Half_Float_Bits to unsigned integer.
function Convert_Vkm_Half_Float_Bits_To_Vkm_Uint is new
Ada.Unchecked_Conversion(Source => Vkm_Half_Float_Bits, Target => Vkm_Uint);
-- Unchecked conversion from unsigned integer to Vkm_Half_Float_Bits.
function Convert_Vkm_Uint_To_Half_Float_Bits is new
Ada.Unchecked_Conversion(Source => Vkm_Uint, Target => Vkm_Half_Float_Bits);
-- Unchecked conversion from Vkm_Double_Float_Bits to Vkm_Double.
function Convert_Vkm_Double_Float_Bits_To_Vkm_Double is new
Ada.Unchecked_Conversion(Source => Vkm_Double_Float_Bits, Target => Vkm_Double);
-- Unchecked conversion from Vkm_Double_Float_Bits to Vkm_Double.
function Convert_Vkm_Double_To_Vkm_Double_Float_Bits is new
Ada.Unchecked_Conversion(Source => Vkm_Double, Target => Vkm_Double_Float_Bits);
----------------------------------------------------------------------------
-- Local Operation Declarations
----------------------------------------------------------------------------
-- @summary
-- Convert a single-precision floating point number to a half-precision
-- floating point number.
--
-- @description
-- Convert a single-precision floating point number to a half-precision
-- floating point number.
--
-- @param value
-- The Vkm_Float to convert to bits for a half-precision floating point number.
--
-- @return
-- The bits for a half-precision floating point number.
----------------------------------------------------------------------------
function Convert_Single_To_Half(
value : in Vkm_Float) return Vkm_Uint;
----------------------------------------------------------------------------
-- @summary
-- Convert a half-precision floating point number to a single-precision
-- floating point number.
--
-- @description
-- Convert a half-precision floating point number to a single-precision
-- floating point number.
--
-- @param value
-- The bits for a half-precision floating point number to convert to a
-- single-precision floating point number.
--
-- @return
-- The bits for a half-precision floating point number.
----------------------------------------------------------------------------
function Convert_Half_To_Single(
value : in Vkm_Uint) return Vkm_Float;
----------------------------------------------------------------------------
-- Operations
----------------------------------------------------------------------------
function Pack_Unsigned_Normalized_2x16(
vector : in Vkm_Vec2) return Vkm_Uint is
converted : constant Vkm_Vec2 := Round(Clamp(vector, 0.0, 1.0) * 65535.0);
packed : Vkm_Uint := 0;
begin
packed := Bitfield_Insert(packed, To_Vkm_Uint(converted.x), 0, 16);
packed := Bitfield_Insert(packed, To_Vkm_Uint(converted.y), 16, 16);
return packed;
end Pack_Unsigned_Normalized_2x16;
----------------------------------------------------------------------------
function Pack_Signed_Normalized_2x16(
vector : in Vkm_Vec2) return Vkm_Uint is
converted : constant Vkm_Vec2 := Round(Clamp(vector, -1.0, 1.0) * 32767.0);
packed : Vkm_Int := 0;
begin
packed := Bitfield_Insert(packed, To_Vkm_Int(converted.x), 0, 16);
packed := Bitfield_Insert(packed, To_Vkm_Int(converted.y), 16, 16);
return To_Vkm_Uint(packed);
end Pack_Signed_Normalized_2x16;
----------------------------------------------------------------------------
function Pack_Unsigned_Normalized_4x8(
vector : in Vkm_Vec4) return Vkm_Uint is
converted : constant Vkm_Vec4 := Round(Clamp(vector, 0.0, 1.0) * 255.0);
packed : Vkm_Uint := 0;
begin
packed := Bitfield_Insert(packed, To_Vkm_Uint(converted.x), 0, 8);
packed := Bitfield_Insert(packed, To_Vkm_Uint(converted.y), 8, 8);
packed := Bitfield_Insert(packed, To_Vkm_Uint(converted.z), 16, 8);
packed := Bitfield_Insert(packed, To_Vkm_Uint(converted.w), 24, 8);
return packed;
end Pack_Unsigned_Normalized_4x8;
----------------------------------------------------------------------------
function Pack_Signed_Normalized_4x8(
vector : in Vkm_Vec4) return Vkm_Uint is
converted : constant Vkm_Vec4 := Round(Clamp(vector, -1.0, 1.0) * 127.0);
packed : Vkm_Int := 0;
begin
packed := Bitfield_Insert(packed, To_Vkm_Int(converted.x), 0, 8);
packed := Bitfield_Insert(packed, To_Vkm_Int(converted.y), 8, 8);
packed := Bitfield_Insert(packed, To_Vkm_Int(converted.z), 16, 8);
packed := Bitfield_Insert(packed, To_Vkm_Int(converted.w), 24, 8);
return To_Vkm_Uint(packed);
end Pack_Signed_Normalized_4x8;
----------------------------------------------------------------------------
function Unpack_Unsigned_Normalized_2x16(
packed : in Vkm_Uint) return Vkm_Vec2 is
unpacked : Vkm_Vec2 := Make_Vec2;
begin
unpacked.x(To_Vkm_Float(Bitfield_Extract(packed, 0, 16)));
unpacked.y(To_Vkm_Float(Bitfield_Extract(packed, 16, 16)));
return unpacked / 65535.0;
end Unpack_Unsigned_Normalized_2x16;
----------------------------------------------------------------------------
function Unpack_Signed_Normalized_2x16(
packed : in Vkm_Uint) return Vkm_Vec2 is
unpacked : Vkm_Vec2 := Make_Vec2;
begin
unpacked.x(To_Vkm_Float(Bitfield_Extract(To_Vkm_Int(packed), 0, 16)));
unpacked.y(To_Vkm_Float(Bitfield_Extract(To_Vkm_Int(packed), 16, 16)));
return Clamp(unpacked / 32767.0, -1.0, 1.0);
end Unpack_Signed_Normalized_2x16;
----------------------------------------------------------------------------
function Unpack_Unsigned_Normalized_4x8(
packed : in Vkm_Uint) return Vkm_Vec4 is
unpacked : Vkm_Vec4 := Make_Vec4;
begin
unpacked.x(To_Vkm_Float(Bitfield_Extract(packed, 0, 8)));
unpacked.y(To_Vkm_Float(Bitfield_Extract(packed, 8, 8)));
unpacked.z(To_Vkm_Float(Bitfield_Extract(packed, 16, 8)));
unpacked.w(To_Vkm_Float(Bitfield_Extract(packed, 24, 8)));
return unpacked / 255.0;
end Unpack_Unsigned_Normalized_4x8;
----------------------------------------------------------------------------
function Unpack_Signed_Normalized_4x8(
packed : in Vkm_Uint) return Vkm_Vec4 is
unpacked : Vkm_Vec4 := Make_Vec4;
begin
unpacked.x(To_Vkm_Float(Bitfield_Extract(To_Vkm_Int(packed), 0, 8)))
.y(To_Vkm_Float(Bitfield_Extract(To_Vkm_Int(packed), 8, 8)))
.z(To_Vkm_Float(Bitfield_Extract(To_Vkm_Int(packed), 16, 8)))
.w(To_Vkm_Float(Bitfield_Extract(To_Vkm_Int(packed), 24, 8)));
return Clamp( unpacked / 127.0, -1.0, 1.0);
end Unpack_Signed_Normalized_4x8;
----------------------------------------------------------------------------
function Pack_Half_2x16(
vector : in Vkm_Vec2) return Vkm_Uint is
packed : Vkm_Uint := 0;
begin
packed := Bitfield_Insert(packed, Convert_Single_To_Half(vector.x), 0, 16);
packed := Bitfield_Insert(packed, Convert_Single_To_Half(vector.y), 16, 16);
return packed;
end Pack_Half_2x16;
----------------------------------------------------------------------------
function Unpack_Half_2x16(
packed : in Vkm_Uint) return Vkm_Vec2 is
unpacked : Vkm_Vec2 := Make_Vec2;
begin
unpacked.x(Convert_Half_To_Single(Bitfield_Extract(packed, 0, 16)))
.y(Convert_Half_To_Single(Bitfield_Extract(packed, 16, 16)));
return unpacked;
end Unpack_Half_2x16;
----------------------------------------------------------------------------
function Pack_Double_2x32(
vector : in Vkm_Uvec2) return Vkm_Double is
double_float_bits : constant Vkm_Double_Float_Bits :=
(lsb => vector.x,
msb => vector.y);
begin
return Convert_Vkm_Double_Float_Bits_To_Vkm_Double(double_float_bits);
end Pack_Double_2x32;
----------------------------------------------------------------------------
function Unpack_Double_2x32(
packed : in Vkm_Double) return Vkm_Uvec2 is
double_float_bits : constant Vkm_Double_Float_Bits :=
Convert_Vkm_Double_To_Vkm_Double_Float_Bits(packed);
unpacked : Vkm_Uvec2 := Make_Uvec2;
begin
unpacked.x(double_float_bits.lsb)
.y(double_float_bits.msb);
return unpacked;
end Unpack_Double_2x32;
----------------------------------------------------------------------------
-- Local Operation Definitions
----------------------------------------------------------------------------
function Convert_Single_To_Half(
value : in Vkm_Float) return Vkm_Uint is
float_bits : constant Single_Float_Bits :=
Convert_Vkm_Float_To_Single_Float_Bits(value);
half_float_bits : constant Vkm_Half_Float_Bits :=
(unused => 0,
sign => float_bits.sign,
exponent => float_bits.exponent_lsb,
mantissa => float_bits.mantissa_msb);
begin
return Convert_Vkm_Half_Float_Bits_To_Vkm_Uint(half_float_bits);
end Convert_Single_To_Half;
----------------------------------------------------------------------------
function Convert_Half_To_Single(
value : in Vkm_Uint) return Vkm_Float is
half_float_bits : constant Vkm_Half_Float_Bits :=
Convert_Vkm_Uint_To_Half_Float_Bits(value);
float_bits : constant Single_Float_Bits :=
(sign => half_float_bits.sign,
exponent_msb => 0,
exponent_lsb => half_float_bits.exponent,
mantissa_msb => half_float_bits.mantissa,
mantissa_lsb => 0);
begin
return Convert_Single_Float_Bits_To_Vkm_Float(float_bits);
end Convert_Half_To_Single;
end Vulkan.Math.Packing;
|
reznikmm/matreshka | Ada | 3,644 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Elements;
package ODF.DOM.Text_Span_Elements is
pragma Preelaborate;
type ODF_Text_Span is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Text_Span_Access is
access all ODF_Text_Span'Class
with Storage_Size => 0;
end ODF.DOM.Text_Span_Elements;
|
reznikmm/matreshka | Ada | 3,991 | 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.Svg_Alphabetic_Attributes;
package Matreshka.ODF_Svg.Alphabetic_Attributes is
type Svg_Alphabetic_Attribute_Node is
new Matreshka.ODF_Svg.Abstract_Svg_Attribute_Node
and ODF.DOM.Svg_Alphabetic_Attributes.ODF_Svg_Alphabetic_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Svg_Alphabetic_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Svg_Alphabetic_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Svg.Alphabetic_Attributes;
|
annexi-strayline/ASAP-CLI | Ada | 14,717 | adb | ------------------------------------------------------------------------------
-- --
-- Command Line Interface Toolkit --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2019-2021, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * Ensi Martini (ANNEXI-STRAYLINE) --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- --
-- * Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Ada.Text_IO; use Ada;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Interfaces.C; use Interfaces.C;
with Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
pragma External_With ("tty_ifo.c");
package body CLI is
--
-- Helper functions, state, and constants
--
Column_Actual: Positive;
-- This is initialized by the package elaboration, which actually ensures
-- the cursor is at this position by calling Clear_Line
Control_Preamble: constant Character := Character'Val (8#33#); -- '\033'
-- Needs to be output at the beginning of all ANSI terminal control codes
CSI: constant String := Control_Preamble & '[';
function Trim_Num (Num : Integer) return String is
(Ada.Strings.Fixed.Trim(Integer'Image(Num), Ada.Strings.Left));
-- Helper function to ensure our codes with ordinals don't have extra spaces
--------------------
-- Terminal_Width --
--------------------
function Terminal_Width return Positive is
function term_width return Interfaces.C.unsigned_short with
Import => True,
Convention => C,
External_Name => "tty_ifo__term_width";
begin
if Output_Is_Terminal then
return Positive (term_width);
else
return 80;
end if;
end Terminal_Width;
-----------------------
-- Ouput_Is_Terminal --
-----------------------
use type Interfaces.C.int;
function isatty return Interfaces.C.int with
Import => True,
Convention => C,
External_Name => "tty_ifo__isatty";
Is_TTY: constant Boolean := (isatty > 0);
function Output_Is_Terminal return Boolean is
(Is_TTY);
----------------
-- Set_Column --
----------------
procedure Set_Column (Col: in Positive) is
begin
if Is_TTY then
Text_IO.Put (CSI & Trim_Num (Col) & 'G');
end if;
Column_Actual := Col;
end Set_Column;
--------------------
-- Current_Column --
--------------------
function Current_Column return Positive is (Column_Actual);
------------------
-- Clear_Screen --
------------------
procedure Clear_Screen is
Clear_Screen_Sequence : constant String
:= CSI & "2J" & -- Clear entire screen
CSI & ";H"; -- Home cursor to top-left
begin
if Is_TTY then
Text_IO.Put (Clear_Screen_Sequence);
end if;
Column_Actual := 1;
end Clear_Screen;
----------------
-- Clear_Line --
----------------
procedure Clear_Line is
begin
-- Move cursor to column 1 and clear line
Set_Column (1);
Clear_To_End;
end Clear_Line;
------------------
-- Clear_To_End --
------------------
procedure Clear_To_End is
begin
if Is_TTY then
Text_IO.Put (CSI & 'K'); -- Clear to end
end if;
end Clear_To_End;
---------
-- Put --
---------
procedure Put (Char : Character;
Style : Text_Style := Neutral)
is begin
Put (Message => String'(1 .. 1 => Char),
Style => Style);
end Put;
--------------------------------------------------
procedure Put (Message: String;
Style : Text_Style := Neutral)
is begin
Clear_Style;
Apply_Style(Style);
Text_IO.Put(Message);
Clear_Style;
Column_Actual := Column_Actual + Message'Length;
end Put;
-------------------
-- Wide_Wide_Put --
-------------------
procedure Wide_Wide_Put (Char : in Wide_Wide_Character;
Style: in Text_Style := Neutral)
is begin
Wide_Wide_Put (Message => Wide_Wide_String'(1 .. 1 => Char),
Style => Style);
end Wide_Wide_Put;
--------------------------------------------------
procedure Wide_Wide_Put (Message: in Wide_Wide_String;
Style : in Text_Style := Neutral)
is
use Ada.Strings.UTF_Encoding;
use Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
Encoded_Message: constant UTF_8_String := Encode (Message);
begin
Clear_Style;
Apply_Style(Style);
Text_IO.Put(Encoded_Message);
Clear_Style;
Column_Actual := Column_Actual + Message'Length;
end Wide_Wide_Put;
------------
-- Put_At --
------------
procedure Put_At (Char : in Character;
Column : in Positive;
Style : in Text_Style := Neutral)
is begin
Put_At (Message => String'(1 .. 1 => Char),
Column => Column,
Style => Style);
end Put_At;
--------------------------------------------------
procedure Put_At (Message: in String;
Column : in Positive;
Style : in Text_Style := Neutral)
is
Save_Col: constant Positive := Current_Column;
begin
Set_Column (Column);
Put (Message => Message,
Style => Style);
Set_Column (Save_Col);
end Put_At;
----------------------
-- Wide_Wide_Put_At --
----------------------
procedure Wide_Wide_Put_At (Char : in Wide_Wide_Character;
Column: in Positive;
Style : in Text_Style := Neutral)
is begin
Wide_Wide_Put_At (Message => Wide_Wide_String'(1 .. 1 => Char),
Column => Column,
Style => Style);
end Wide_Wide_Put_At;
--------------------------------------------------
procedure Wide_Wide_Put_At (Message: in Wide_Wide_String;
Column : in Positive;
Style : in Text_Style := Neutral)
is
Save_Col: constant Positive := Current_Column;
begin
Set_Column (Column);
Wide_Wide_Put (Message => Message,
Style => Style);
Set_Column (Save_Col);
end Wide_Wide_Put_At;
--------------
-- Put_Line --
--------------
procedure Put_Line (Message: String;
Style : Text_Style := Neutral)
is begin
Put (Message, Style);
New_Line;
end Put_Line;
------------------------
-- Wide_Wide_Put_Line --
------------------------
procedure Wide_Wide_Put_Line (Message: Wide_Wide_String;
Style : Text_Style := Neutral)
is begin
Wide_Wide_Put (Message, Style);
New_Line;
end Wide_Wide_Put_Line;
--------------
-- New_Line --
--------------
procedure New_Line is
begin
Text_IO.New_Line;
Set_Column (1);
end New_Line;
-----------------------
-- Get/Get_Immediate --
-----------------------
procedure Get (Item: out String) renames Text_IO.Get;
procedure Get (Item: out Character) renames Text_IO.Get;
procedure Get_Line (Item: out String; Last: out Natural)
renames Text_IO.Get_Line;
procedure Get_Immediate (Item: out Character; Available: out Boolean)
renames Text_IO.Get_Immediate;
--------------------------
-- Text_Style Operators --
--------------------------
-- "+" --
function "+" (Left, Right : Text_Style) return Text_Style is
-- This function will always take the color of the right Cursor, because
-- addition works like an overwrite for all the attributes that are not
-- currently turned on for Left cursor
FG : Color := (if (Right.Foreground /= Default)
then Right.Foreground
else Left.Foreground);
BG : Color := (if (Right.Background /= Default)
then Right.Background
else Left.Background);
begin
return (Text_Style'(Foreground => FG,
Background => BG,
Bold => Left.Bold or Right.Bold,
Underscore => Left.Underscore or Right.Underscore,
Blink => Left.Blink or Right.Blink,
Reverse_Vid => Left.Reverse_Vid or Right.Reverse_Vid,
Concealed => Left.Concealed or Right.Concealed));
end "+";
-- "-" --
function "-" (Left, Right : Text_Style) return Text_Style is
-- This function will always take the color of the left Cursor, unless
-- they are the same
-- This is because subtracting the right Cursor means we cannot have that
-- property of it
FG : Color := (if (Left.Foreground = Right.Foreground)
then Default
else Left.Foreground);
BG : Color := (if (Left.Background = Right.Background)
then Default
else Left.Background);
begin
return (Text_Style'(Foreground => FG,
Background => BG,
Bold => Left.Bold and (Left.Bold xor Right.Bold),
Underscore =>
Left.Underscore and
(Left.Underscore xor Right.Underscore),
Blink =>
Left.Blink and (Left.Blink xor Right.Blink),
Reverse_Vid =>
Left.Reverse_Vid
and (Left.Reverse_Vid xor Right.Reverse_Vid),
Concealed => Left.Concealed
and (Left.Concealed xor Right.Concealed)));
end "-";
-----------------
-- Apply_Style --
-----------------
procedure Apply_Style (Style : Text_Style) is
Attribute_Sequence : String := CSI & "0m";
Change_Foreground_Sequence : String :=
CSI & Trim_Num(Color'Pos(Style.Foreground) + 30) & 'm';
Change_Background_Sequence : String :=
CSI & Trim_Num(Color'Pos(Style.Background) + 40) & 'm';
begin
if not Is_TTY then return; end if;
if Style.Foreground /= Default then
Text_IO.Put(Change_Foreground_Sequence);
end if;
if Style.Background /= Default then
Text_IO.Put(Change_Background_Sequence);
end if;
declare
procedure Apply_Attribute (Attribute_Num : Integer) with Inline is
begin
-- Take first index of Trim_Num return because it is a string but
-- we need a char
Attribute_Sequence(3) := Trim_Num(Attribute_Num)(1);
Text_IO.Put(Attribute_Sequence);
end Apply_Attribute;
begin
if Style.Bold then
Apply_Attribute(1);
end if;
if Style.Underscore then
Apply_Attribute(4);
end if;
if Style.Blink then
Apply_Attribute(5);
end if;
if Style.Reverse_Vid then
Apply_Attribute(7);
end if;
if Style.Concealed then
Apply_Attribute(8);
end if;
end;
end Apply_Style;
-----------------
-- Clear_Style --
-----------------
procedure Clear_Style is
begin
if not Is_TTY then return; end if;
Text_IO.Put (CSI & "0m"); -- "Reset attributes";
end Clear_Style;
begin
Clear_Line;
end CLI;
|
sungyeon/drake | Ada | 514 | ads | pragma License (Unrestricted);
-- implementation unit required by compiler
with System.Long_Long_Integer_Types;
with System.Unsigned_Types;
package System.Img_Uns is
pragma Pure;
-- required for Modular'Image by compiler (s-imguns.ads)
procedure Image_Unsigned (
V : Unsigned_Types.Unsigned;
S : in out String;
P : out Natural);
-- helper
procedure Image (
V : Long_Long_Integer_Types.Word_Unsigned;
S : in out String;
P : out Natural);
end System.Img_Uns;
|
stcarrez/babel | Ada | 7,497 | adb | -----------------------------------------------------------------------
-- babel-files-maps -- Hash maps for files and directories
-- Copyright (C) 2014 Stephane.Carrez
-- Written by Stephane.Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package body Babel.Files.Maps is
-- ------------------------------
-- Find the file with the given name in the file map.
-- ------------------------------
function Find (From : in File_Map;
Name : in String) return File_Cursor is
begin
return From.Find (Key => Name'Unrestricted_Access);
end Find;
-- ------------------------------
-- Find the file with the given name in the file map.
-- ------------------------------
function Find (From : in File_Map;
Name : in String) return File_Type is
Pos : constant File_Cursor := From.Find (Key => Name'Unrestricted_Access);
begin
if File_Maps.Has_Element (Pos) then
return File_Maps.Element (Pos);
else
return NO_FILE;
end if;
end Find;
-- ------------------------------
-- Insert the file in the file map.
-- ------------------------------
procedure Insert (Into : in out File_Map;
File : in File_Type) is
begin
Into.Insert (Key => File.Name'Unrestricted_Access, New_Item => File);
end Insert;
-- ------------------------------
-- Find the directory with the given name in the directory map.
-- ------------------------------
function Find (From : in Directory_Map;
Name : in String) return Directory_Cursor is
begin
return From.Find (Key => Name'Unrestricted_Access);
end Find;
-- ------------------------------
-- Find the directory with the given name in the directory map.
-- ------------------------------
function Find (From : in Directory_Map;
Name : in String) return Directory_Type is
Pos : constant Directory_Cursor := From.Find (Key => Name'Unrestricted_Access);
begin
if Directory_Maps.Has_Element (Pos) then
return Directory_Maps.Element (Pos);
else
return NO_DIRECTORY;
end if;
end Find;
procedure Add_File (Dirs : in out Directory_Map;
Files : in out File_Map;
Path : in String;
File : out File_Type) is
Pos : constant Natural := Util.Strings.Rindex (Path, '/');
File_Pos : File_Cursor;
Dir : Directory_Type := NO_DIRECTORY;
begin
if Pos = 0 then
File := Find (Files, Path);
Dir := Find (Dirs, ".");
else
File := Find (Files, Path (Pos + 1 .. Path'Last));
Dir := Find (Dirs, Path (Path'First .. Pos - 1));
end if;
if Dir = NO_DIRECTORY then
if Pos = 0 then
Dir := Allocate (".", NO_DIRECTORY);
else
Dir := Allocate (Path (Path'First .. Pos - 1), NO_DIRECTORY);
end if;
Dirs.Insert (Dir.Name.all'Access, Dir);
end if;
if File = NO_FILE then
if Pos = 0 then
File := Allocate (Path, Dir);
else
File := Allocate (Path (Pos + 1 .. Path'Last), Dir);
end if;
Files.Insert (File.Name'Unrestricted_Access, File);
end if;
end Add_File;
-- ------------------------------
-- Add the file with the given name in the container.
-- ------------------------------
overriding
procedure Add_File (Into : in out Differential_Container;
Element : in File_Type) is
use type ADO.Identifier;
begin
if Element.Id = ADO.NO_IDENTIFIER then
Into.Known_Files.Insert (Element.Name'Unrestricted_Access, Element);
end if;
end Add_File;
-- ------------------------------
-- Add the directory with the given name in the container.
-- ------------------------------
overriding
procedure Add_Directory (Into : in out Differential_Container;
Element : in Directory_Type) is
use type ADO.Identifier;
begin
if Element.Id = ADO.NO_IDENTIFIER then
Into.Known_Dirs.Insert (Element.Name.all'Access, Element);
end if;
end Add_Directory;
-- ------------------------------
-- Create a new file instance with the given name in the container.
-- ------------------------------
overriding
function Create (Into : in Differential_Container;
Name : in String) return File_Type is
begin
return Allocate (Name => Name,
Dir => Into.Current);
end Create;
-- ------------------------------
-- Create a new directory instance with the given name in the container.
-- ------------------------------
overriding
function Create (Into : in Differential_Container;
Name : in String) return Directory_Type is
begin
return Allocate (Name => Name,
Dir => Into.Current);
end Create;
-- ------------------------------
-- Find the file with the given name in this file container.
-- Returns NO_FILE if the file was not found.
-- ------------------------------
overriding
function Find (From : in Differential_Container;
Name : in String) return File_Type is
begin
return Find (From.Known_Files, Name);
end Find;
-- ------------------------------
-- Find the directory with the given name in this file container.
-- Returns NO_DIRECTORY if the directory was not found.
-- ------------------------------
overriding
function Find (From : in Differential_Container;
Name : in String) return Directory_Type is
begin
return Find (From.Known_Dirs, Name);
end Find;
-- ------------------------------
-- Set the directory object associated with the container.
-- ------------------------------
overriding
procedure Set_Directory (Into : in out Differential_Container;
Directory : in Directory_Type) is
begin
Default_Container (Into).Set_Directory (Directory);
Into.Known_Files.Clear;
Into.Known_Dirs.Clear;
end Set_Directory;
-- ------------------------------
-- Prepare the differential container by setting up the known files and known
-- directories. The <tt>Update</tt> procedure is called to give access to the
-- maps that can be updated.
-- ------------------------------
procedure Prepare (Container : in out Differential_Container;
Update : access procedure (Files : in out File_Map;
Dirs : in out Directory_Map)) is
begin
Update (Container.Known_Files, Container.Known_Dirs);
end Prepare;
end Babel.Files.Maps;
|
charlie5/lace | Ada | 740 | ads | package lace.Dice.any
--
-- provide a model of many sided dice.
--
is
type Item is new Dice.item with private;
procedure Seed_is (Now : Integer);
--
-- If the seed is not set, a random seed will be used.
--------
-- Forge
--
function to_Dice (Sides : in Positive := 6;
Rolls : in Positive := 3;
Modifier : in Integer := 0) return Dice.any.item;
-------------
-- Attributes
--
overriding
function side_Count (Self : in Item) return Positive;
overriding
function Roll (Self : in Item) return Natural;
private
type Item is new Dice.item with
record
side_Count : Positive;
end record;
end lace.Dice.any;
|
reznikmm/matreshka | Ada | 18,220 | adb | with Ada.Streams;
with Ada.Text_IO;
with Interfaces;
with League.Calendars;
with League.Stream_Element_Vectors;
with League.Strings;
with League.Text_Codecs;
-- with Zip.Metadata.Local_File_Headers; use Zip.Metadata.Local_File_Headers;
with Zip.IO_Types;
package body Zip.Metadata is
use type Ada.Streams.Stream_Element_Offset;
-- use type Zip.Stream_Element_IO.Count;
End_Of_Central_Directory_Signature :
constant Ada.Streams.Stream_Element_Array (0 .. 3)
:= (16#50#, 16#4B#, 16#05#, 16#06#);
ZIP64_End_Of_Central_Directory_Locator_Signature :
constant Ada.Streams.Stream_Element_Array (0 .. 3)
:= (16#50#, 16#4B#, 16#06#, 16#07#);
Central_Directory_Header_Signature :
constant Ada.Streams.Stream_Element_Array (0 .. 3)
:= (16#50#, 16#4B#, 16#01#, 16#02#);
Local_File_Header_Signature :
constant Ada.Streams.Stream_Element_Array (0 .. 3)
:= (16#50#, 16#4B#, 16#03#, 16#04#);
type End_Of_Central_Directory_Record is record
Number_Of_This_Disk,
Number_Of_The_Disk_With_The_Start_Of_The_Central_Directory,
Total_Number_Of_Entries_In_The_Central_Directory_On_This_Disk,
Total_Number_Of_Entries_In_The_Central_Directory :
Zip.IO_Types.Unsigned_16;
Size_Of_The_Central_Directory : Zip.IO_Types.Size;
Offset_Of_Central_Directory_With_Respect_To_The_Starting_Disk_Number :
Zip.IO_Types.Size;
ZIP_File_Comment_Length : Zip.IO_Types.Length;
end record;
type ZIP64_End_Of_Central_Directory_Locator is record
Number_Of_The_Disk_With_The_Start_Of_The_ZIP64_End_Of_Central_Directory :
Ada.Streams.Stream_Element_Array (0 .. 3);
Relative_Offset_Of_The_ZIP64_End_Of_Central_Directory_Record :
Ada.Streams.Stream_Element_Array (0 .. 7);
Total_Number_Of_Disks :
Ada.Streams.Stream_Element_Array (0 .. 3);
end record;
type Local_File_Header is record
Version_Needed_To_Extract : Zip.IO_Types.Version;
General_Purpose_Bit_Flag : Zip.IO_Types.Flags;
Compression_Method : Zip.IO_Types.Method;
Last_Modified : Zip.IO_Types.Date_Time;
CRC32 : Zip.IO_Types.CRC32;
Compressed_Size : Zip.IO_Types.Size;
Uncompressed_Size : Zip.IO_Types.Size;
File_Name_Length : Zip.IO_Types.Length;
Extra_Field_Length : Zip.IO_Types.Length;
end record;
type Central_Directory_File_Header is record
Version_Made_By : Zip.IO_Types.Version;
Version_Needed_To_Extract : Zip.IO_Types.Version;
General_Purpose_Bit_Flag : Zip.IO_Types.Flags;
Compression_Method : Zip.IO_Types.Method;
Last_Modified : Zip.IO_Types.Date_Time;
CRC32 : Zip.IO_Types.CRC32;
Compressed_Size : Zip.IO_Types.Size;
Uncompressed_Size : Zip.IO_Types.Size;
File_Name_Length : Zip.IO_Types.Length;
Extra_Field_Length : Zip.IO_Types.Length;
File_Comment_Length : Zip.IO_Types.Length;
Disk_Number_Start : Zip.IO_Types.Unsigned_16;
Internal_File_Attributes : Zip.IO_Types.Unsigned_16;
External_File_Attributes : Zip.IO_Types.Unsigned_32;
Relative_Offset_Of_Local_Header : Zip.IO_Types.Unsigned_32;
end record;
Signature_Length : constant Ada.Streams.Stream_Element_Offset := 4;
End_Of_Central_Directory_Record_Length :
constant Ada.Streams.Stream_Element_Offset := 4 * 2 + 2 * 4 + 2;
ZIP64_End_Of_Central_Directory_Locator_Length :
constant Ada.Streams.Stream_Element_Offset := 4 + 8 + 4;
Central_Directory_File_Header_Length : constant := 42;
Local_File_Header_Length :
constant Ada.Streams.Stream_Element_Offset := 26;
function To_Stream_Element_Offset
(Item : Ada.Streams.Stream_Element_Array)
return Ada.Streams.Stream_Element_Offset;
procedure Read_String
(File : Zip.IO.File_Type;
Length : Ada.Streams.Stream_Element_Offset;
Value : out League.Strings.Universal_String);
-- ----------
-- -- Read --
-- ----------
--
-- procedure Read
-- (File : Zip.Stream_Element_IO.File_Type;
-- Item : out Ada.Streams.Stream_Element_Array) is
-- begin
-- for J in Item'Range loop
-- Zip.Stream_Element_IO.Read (File, Item (J));
-- end loop;
-- end Read;
--
----------
-- Read --
----------
function Read (File : access Zip.IO.File_Type) return Central_Directory is
use type Ada.Streams.Stream_Element;
use type Ada.Streams.Stream_Element_Array;
use type Ada.Streams.Stream_Element_Offset;
Signature : Ada.Streams.Stream_Element_Array (0 .. 3);
-- Header : Local_File_Header_Type;
Result : Central_Directory;
File_Info : File_Record;
begin
-- loop
-- Read (File, Signature);
--
-- if Signature /= Local_File_Header_Signature then
-- Ada.Text_IO.Put_Line
-- (Ada.Streams.Stream_Element'Image (Signature (0))
-- & Ada.Streams.Stream_Element'Image (Signature (1))
-- & Ada.Streams.Stream_Element'Image (Signature (2))
-- & Ada.Streams.Stream_Element'Image (Signature (3)));
-- raise Program_Error;
-- end if;
--
-- Read (File, Header);
--
-- Ada.Text_IO.Put_Line (Header.File_Name.To_UTF_8_String);
--
-- Zip.Stream_Element_IO.Set_Index
-- (File, Zip.Stream_Element_IO.Index (File) + Header.Compressed_Size);
-- end loop;
null;
-- Lookup for central directory at the end of file.
declare
Record_Size : constant
Ada.Streams.Stream_Element_Offset
:= End_Of_Central_Directory_Record_Length + Signature_Length;
Maximum_Lookup_Buffer_Size : constant
Ada.Streams.Stream_Element_Offset := 2 ** 16 - 1 + Record_Size;
File_Size : constant Zip_File_Offset := File.Get_Size;
Lookup_Buffer_Size : constant
Ada.Streams.Stream_Element_Offset
:= Ada.Streams.Stream_Element_Offset'Min
(Maximum_Lookup_Buffer_Size,
Ada.Streams.Stream_Element_Offset (File_Size));
Position : constant Zip_File_Offset
:= File_Size - Zip_File_Offset (Lookup_Buffer_Size);
Buffer : Ada.Streams.Stream_Element_Array
(1 .. Lookup_Buffer_Size);
Record_Position : Zip_File_Offset := 0;
Directory_Position : Zip_File_Offset;
begin
File.Set_Position (Position);
File.Read (Buffer);
for J in reverse Buffer'First .. Buffer'Last - Record_Size + 1 loop
if Buffer (J .. J + Signature_Length - 1)
= End_Of_Central_Directory_Signature
then
declare
Raw_Record : End_Of_Central_Directory_Record;
begin
-- Exit when total size of end of central directory record
-- is confirmed by record's position (it should be placed at
-- the end of the archive file).
File.Set_Position
(Position + Zip_File_Offset (J + Signature_Length - 1));
End_Of_Central_Directory_Record'Read (File, Raw_Record);
if Ada.Streams.Stream_Element_Offset
(Raw_Record.ZIP_File_Comment_Length)
= Buffer'Last - (J + Record_Size - 1)
then
Record_Position := Position + Zip_File_Offset (J) - 1;
Directory_Position :=
Zip_File_Offset
(Raw_Record
.Offset_Of_Central_Directory_With_Respect_To_The_Starting_Disk_Number);
Ada.Text_IO.Put_Line
("offset of central directory record position:" &
Zip_File_Offset'Image (Directory_Position));
exit;
end if;
-- Otherwise, continue to lookup for end of central
-- directory record signature.
end;
end if;
end loop;
Ada.Text_IO.Put_Line ("end of central directory record position:" &
Zip_File_Offset'Image (Record_Position));
File.Set_Position
(Record_Position
- Zip_File_Offset (ZIP64_End_Of_Central_Directory_Locator_Length)
- Zip_File_Offset (Signature_Length));
File.Read (Signature);
if Signature = ZIP64_End_Of_Central_Directory_Locator_Signature then
Ada.Text_IO.Put_Line
("end of central directory record position:"
& Zip_File_Offset'Image
(Record_Position - Zip_File_Offset (ZIP64_End_Of_Central_Directory_Locator_Length) - Zip_File_Offset (Signature_Length)));
raise Program_Error with "ZIP64 is not implemented now";
end if;
File.Set_Position (Directory_Position);
while File.Get_Position < Record_Position loop
File_Info := (others => <>);
File.Read (Signature);
if Signature /= Central_Directory_Header_Signature then
raise Program_Error;
end if;
-- Ada.Text_IO.Put_Line ("read CDH");
declare
use type Zip.IO_Types.Flags;
Raw_Header : Central_Directory_File_Header;
Name_Length : ZIP_File_Offset_16;
begin
Central_Directory_File_Header'Read (File, Raw_Header);
Name_Length := ZIP_File_Offset_16 (Raw_Header.File_Name_Length);
File_Info :=
(File_Name => <>,
Method => Zip.Compression_Method
(Raw_Header.Compression_Method),
Last_Modified => League.Calendars.Date_Time
(Raw_Header.Last_Modified),
CRC32 => GNAT.CRC32.CRC32
(Raw_Header.CRC32),
Compressed_Size => Ada.Streams.Stream_Element_Offset
(Raw_Header.Compressed_Size),
Uncompressed_Size => Ada.Streams.Stream_Element_Offset
(Raw_Header.Uncompressed_Size),
Has_Data_Descriptor =>
(Raw_Header.General_Purpose_Bit_Flag and
IO_Types.Has_Data_Descriptor) /= 0,
Local_Header_Offset => Ada.Streams.Stream_Element_Offset
(Raw_Header.Relative_Offset_Of_Local_Header));
-- Ada.Text_IO.Put_Line ("file name length:" & Zip_File_Offset'Image (Name_Length));
Read_String
(File => File.all,
Length => Ada.Streams.Stream_Element_Offset (Name_Length),
Value => File_Info.File_Name);
end;
Result.Files.Append (File_Info);
end loop;
end;
return Result;
end Read;
----------------------------
-- Read_Local_File_Header --
----------------------------
procedure Read_Local_File_Header
(Stream : access Zip.IO.File_Type;
Header : out File_Record)
is
use type Ada.Streams.Stream_Element_Array;
use type Zip.IO_Types.Flags;
Result : Local_File_Header;
Signature : Ada.Streams.Stream_Element_Array (0 .. 3);
Offset : Zip.Zip_File_Offset := Stream.Get_Position;
begin
Ada.Streams.Stream_Element_Array'Read (Stream, Signature);
pragma Assert (Signature = Local_File_Header_Signature);
Local_File_Header'Read (Stream, Result);
Header :=
(File_Name => <>,
Method => Zip.Compression_Method
(Result.Compression_Method),
CRC32 => GNAT.CRC32.CRC32 (Result.CRC32),
Last_Modified => League.Calendars.Date_Time
(Result.Last_Modified),
Compressed_Size => Ada.Streams.Stream_Element_Offset
(Result.Compressed_Size),
Uncompressed_Size => Ada.Streams.Stream_Element_Offset
(Result.Uncompressed_Size),
Has_Data_Descriptor => (Result.General_Purpose_Bit_Flag and
IO_Types.Has_Data_Descriptor) /= 0,
Local_Header_Offset => Ada.Streams.Stream_Element_Offset (Offset));
Read_String
(File => Stream.all,
Length =>
Ada.Streams.Stream_Element_Offset (Result.File_Name_Length),
Value => Header.File_Name);
end Read_Local_File_Header;
-----------------
-- Read_String --
-----------------
procedure Read_String
(File : Zip.IO.File_Type;
Length : Ada.Streams.Stream_Element_Offset;
Value : out League.Strings.Universal_String)
is
Buffer : Ada.Streams.Stream_Element_Array (1 .. Length);
Codec : League.Text_Codecs.Text_Codec := League.Text_Codecs.Codec
(League.Strings.To_Universal_String ("IBM437"));
begin
File.Read (Buffer);
Value := Codec.Decode (Buffer);
end Read_String;
------------------------------
-- To_Stream_Element_Offset --
------------------------------
function To_Stream_Element_Offset
(Item : Ada.Streams.Stream_Element_Array)
return Ada.Streams.Stream_Element_Offset
is
use type Ada.Streams.Stream_Element_Offset;
Result : Ada.Streams.Stream_Element_Offset := 0;
begin
for J of reverse Item loop
Result := Result * 2 ** 8 + Ada.Streams.Stream_Element_Offset (J);
end loop;
return Result;
end To_Stream_Element_Offset;
-----------
-- Write --
-----------
procedure Write
(Stream : access Ada.Streams.Root_Stream_Type'Class;
Offset : Zip.Zip_File_Offset;
Directory : Central_Directory)
is
Codec : constant League.Text_Codecs.Text_Codec := League.Text_Codecs.Codec
(League.Strings.To_Universal_String ("UTF-8"));
Total : Zip.IO_Types.Size := 0;
begin
for X of Directory.Files loop
declare
use Zip.IO_Types;
Name : constant League.Stream_Element_Vectors.Stream_Element_Vector
:= Codec.Encode (X.File_Name);
Header : Central_Directory_File_Header :=
(Version_Made_By => 20,
Version_Needed_To_Extract => 20,
General_Purpose_Bit_Flag => Use_UTF_8_Names,
Compression_Method => Method (X.Method),
Last_Modified => Date_Time (X.Last_Modified),
CRC32 => CRC32 (X.CRC32),
Compressed_Size => Size (X.Compressed_Size),
Uncompressed_Size => Size (X.Uncompressed_Size),
File_Name_Length => Length (Name.Length),
Extra_Field_Length => 0,
File_Comment_Length => 0,
Disk_Number_Start => 0,
Internal_File_Attributes => 0,
External_File_Attributes => 0,
Relative_Offset_Of_Local_Header => Unsigned_32
(X.Local_Header_Offset));
begin
Ada.Streams.Stream_Element_Array'Write
(Stream, Central_Directory_Header_Signature);
Central_Directory_File_Header'Write (Stream, Header);
Ada.Streams.Stream_Element_Array'Write
(Stream, Name.To_Stream_Element_Array);
Total := Total + 4 + Central_Directory_File_Header_Length +
Size (Name.Length);
end;
end loop;
declare
Count : Zip.IO_Types.Unsigned_16 :=
Zip.IO_Types.Unsigned_16 (Directory.Files.Length);
Header : End_Of_Central_Directory_Record :=
(Number_Of_This_Disk => 0,
Number_Of_The_Disk_With_The_Start_Of_The_Central_Directory => 0,
Total_Number_Of_Entries_In_The_Central_Directory_On_This_Disk |
Total_Number_Of_Entries_In_The_Central_Directory => Count,
Size_Of_The_Central_Directory => Total,
Offset_Of_Central_Directory_With_Respect_To_The_Starting_Disk_Number
=> Zip.IO_Types.Size (Offset),
ZIP_File_Comment_Length => 0);
begin
Ada.Streams.Stream_Element_Array'Write
(Stream, End_Of_Central_Directory_Signature);
End_Of_Central_Directory_Record'Write (Stream, Header);
end;
end Write;
-----------------------------
-- Write_Local_File_Header --
-----------------------------
procedure Write_Local_File_Header
(Stream : access Ada.Streams.Root_Stream_Type'Class;
Header : File_Record)
is
Codec : constant League.Text_Codecs.Text_Codec := League.Text_Codecs.Codec
(League.Strings.To_Universal_String ("UTF-8"));
Name : constant League.Stream_Element_Vectors.Stream_Element_Vector :=
Codec.Encode (Header.File_Name);
Value : constant Local_File_Header :=
(Version_Needed_To_Extract => 20,
General_Purpose_Bit_Flag => IO_Types.Use_UTF_8_Names,
Compression_Method => IO_Types.Method (Header.Method),
Last_Modified => IO_Types.Date_Time (Header.Last_Modified),
CRC32 => IO_Types.CRC32 (Header.CRC32),
Compressed_Size => IO_Types.Size (Header.Compressed_Size),
Uncompressed_Size => IO_Types.Size (Header.Uncompressed_Size),
File_Name_Length => IO_Types.Length (Name.Length),
Extra_Field_Length => 0);
begin
Stream.Write (Local_File_Header_Signature);
Local_File_Header'Write (Stream, Value);
Ada.Streams.Stream_Element_Array'Write
(Stream, Name.To_Stream_Element_Array);
end Write_Local_File_Header;
end Zip.Metadata;
|
reznikmm/matreshka | Ada | 6,781 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Chart.Chart_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Chart_Chart_Element_Node is
begin
return Self : Chart_Chart_Element_Node do
Matreshka.ODF_Chart.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Chart_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Chart_Chart_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_Chart_Chart
(ODF.DOM.Chart_Chart_Elements.ODF_Chart_Chart_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 Chart_Chart_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Chart_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Chart_Chart_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_Chart_Chart
(ODF.DOM.Chart_Chart_Elements.ODF_Chart_Chart_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 Chart_Chart_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_Chart_Chart
(Visitor,
ODF.DOM.Chart_Chart_Elements.ODF_Chart_Chart_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.Chart_URI,
Matreshka.ODF_String_Constants.Chart_Element,
Chart_Chart_Element_Node'Tag);
end Matreshka.ODF_Chart.Chart_Elements;
|
kontena/ruby-packer | Ada | 3,736 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998,2003 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control:
-- $Revision: 1.11 $
-- Binding Version 01.00
------------------------------------------------------------------------------
generic
type T is (<>);
package Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada is
pragma Preelaborate
(Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada);
function Create (Set : Type_Set := Mixed_Case;
Case_Sensitive : Boolean := False;
Must_Be_Unique : Boolean := False)
return Enumeration_Field;
function Value (Fld : Field;
Buf : Buffer_Number := Buffer_Number'First) return T;
-- Translate the content of the fields buffer - indicated by the
-- buffer number - into an enumeration value. If the buffer is empty
-- or the content is invalid, a Constraint_Error is raises.
end Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada;
|
Gabriel-Degret/adalib | Ada | 581 | ads | -- Standard Ada library specification
-- Copyright (c) 2004-2016 AXE Consultants
-- Copyright (c) 2004, 2005, 2006 Ada-Europe
-- Copyright (c) 2000 The MITRE Corporation, Inc.
-- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
-- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
---------------------------------------------------------------------------
function Ada.Strings.Unbounded.Less_Case_Insensitive
(Left, Right : Unbounded_String) return Boolean;
pragma Preelaborate(Ada.Strings.Unbounded.Less_Case_Insensitive);
|
reznikmm/matreshka | Ada | 4,684 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Visitors;
with ODF.DOM.Meta_Keyword_Elements;
package Matreshka.ODF_Meta.Keyword_Elements is
type Meta_Keyword_Element_Node is
new Matreshka.ODF_Meta.Abstract_Meta_Element_Node
and ODF.DOM.Meta_Keyword_Elements.ODF_Meta_Keyword
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Meta_Keyword_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Meta_Keyword_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Meta_Keyword_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 Meta_Keyword_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 Meta_Keyword_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_Meta.Keyword_Elements;
|
reznikmm/matreshka | Ada | 3,991 | 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.Svg_Stop_Color_Attributes;
package Matreshka.ODF_Svg.Stop_Color_Attributes is
type Svg_Stop_Color_Attribute_Node is
new Matreshka.ODF_Svg.Abstract_Svg_Attribute_Node
and ODF.DOM.Svg_Stop_Color_Attributes.ODF_Svg_Stop_Color_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Svg_Stop_Color_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Svg_Stop_Color_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Svg.Stop_Color_Attributes;
|
stcarrez/ada-asf | Ada | 1,081 | ads | -----------------------------------------------------------------------
-- html-factory -- Factory for HTML UI Components
-- Copyright (C) 2009, 2010, 2018 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ASF.Factory;
package ASF.Components.Html.Factory is
-- Register the HTML component factory.
procedure Register (Factory : in out ASF.Factory.Component_Factory);
end ASF.Components.Html.Factory;
|
charlie5/aIDE | Ada | 2,812 | ads | with
AdaM.Entity,
AdaM.Declaration.of_exception,
ada.Streams,
ada.Containers.Vectors;
limited
with
adam.Block;
package AdaM.exception_Handler
is
type Item is new Entity.item with private;
-- View
--
type View is access all Item'Class;
procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in View);
procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out View);
for View'write use View_write;
for View'read use View_read;
-- Vector
--
package Vectors is new ada.Containers.Vectors (Positive, View);
subtype Vector is Vectors.Vector;
function to_Source (the_exception_Handlers : in Vector) return text_Vectors.Vector;
-- Forge
--
type Block_view is access all Block.item'Class;
procedure Block_view_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in Block_view);
procedure Block_view_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out Block_view);
for Block_view'write use Block_view_write;
for Block_view'read use Block_view_read;
function new_Handler (-- Name : in String := "";
Parent : in AdaM.Block.view) return exception_Handler.view;
procedure free (Self : in out exception_Handler.view);
procedure destruct (Self : in out Item);
-- Attributes
--
overriding
function Id (Self : access Item) return AdaM.Id;
function is_Free (Self : in Item; Slot : in Positive) return Boolean;
function my_Exception (Self : in Item; Id : in Positive) return Declaration.of_exception.view;
procedure my_Exception_is (Self : in out Item; Id : in Positive;
Now : in Declaration.of_exception.view);
procedure add_Exception (Self : in out Item; the_Exception : in AdaM.Declaration.of_exception.view);
function exception_Count (Self : in Item) return Natural;
overriding
function to_Source (Self : in Item) return text_Lines;
function Handler (Self : in Item) return access AdaM.Block.item'Class;
overriding
function Name (Self : in Item) return Identifier;
-- Operations
--
private
type Item is new Entity.item with
record
Exceptions : AdaM.Declaration.of_exception.vector;
Handler : Block_view; -- access AdaM.Block.item'Class;
Parent : Block_view; -- access AdaM.Block.item'Class;
end record;
end AdaM.exception_Handler;
|
reznikmm/matreshka | Ada | 3,981 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Fo_Min_Height_Attributes;
package Matreshka.ODF_Fo.Min_Height_Attributes is
type Fo_Min_Height_Attribute_Node is
new Matreshka.ODF_Fo.Abstract_Fo_Attribute_Node
and ODF.DOM.Fo_Min_Height_Attributes.ODF_Fo_Min_Height_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Fo_Min_Height_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Fo_Min_Height_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Fo.Min_Height_Attributes;
|
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.Table_Column_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Table_Table_Column_Element_Node is
begin
return Self : Table_Table_Column_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_Table_Column_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_Table_Column
(ODF.DOM.Table_Table_Column_Elements.ODF_Table_Table_Column_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_Table_Column_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Table_Column_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Table_Table_Column_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_Table_Column
(ODF.DOM.Table_Table_Column_Elements.ODF_Table_Table_Column_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_Table_Column_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_Table_Column
(Visitor,
ODF.DOM.Table_Table_Column_Elements.ODF_Table_Table_Column_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.Table_Column_Element,
Table_Table_Column_Element_Node'Tag);
end Matreshka.ODF_Table.Table_Column_Elements;
|
charlie5/cBound | Ada | 1,812 | 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_make_context_current_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;
old_context_tag : aliased xcb.xcb_glx_context_tag_t;
drawable : aliased xcb.xcb_glx_drawable_t;
read_drawable : aliased xcb.xcb_glx_drawable_t;
context : aliased xcb.xcb_glx_context_t;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb
.xcb_glx_make_context_current_request_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_make_context_current_request_t.Item,
Element_Array => xcb.xcb_glx_make_context_current_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_make_context_current_request_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_make_context_current_request_t.Pointer,
Element_Array =>
xcb.xcb_glx_make_context_current_request_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_glx_make_context_current_request_t;
|
zhmu/ananas | Ada | 233 | adb | -- { dg-do compile }
-- { dg-options "-fdump-tree-optimized" }
package body ZCUR_Attr is
function F return Integer is (0);
end ZCUR_Attr;
-- { dg-final { scan-tree-dump "zero_call_used_regs \[(\]\"all\"\[)\]" "optimized" } }
|
AdaDoom3/wayland_ada_binding | Ada | 3,533 | ads | ------------------------------------------------------------------------------
-- Copyright (C) 2016-2016, 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/>. --
-- --
------------------------------------------------------------------------------
-- An implementation of property maps that can be used when the key
-- maps to indexes. These are implemented as vectors, rather than
-- arrays, so that they can be used without necessarily knowing the
-- required size in advance, and because a very large array for a
-- very large container could blow the stack.
-- The map is also set as a limited type to limit the number of
-- copies. This ensures that Create_Map builds the map in place.
pragma Ada_2012;
with Conts.Vectors.Definite_Unbounded;
generic
type Container_Type (<>) is limited private;
type Key_Type (<>) is limited private;
type Element_Type is private;
Default_Value : Element_Type;
-- These maps are implemented as vectors, and a default value is needed
-- when the vector is resized.
type Index_Type is (<>);
type Container_Base_Type is abstract tagged limited private;
with function Get_Index (K : Key_Type) return Index_Type is <>;
-- Maps the key to an index
with function Length (G : Container_Type) return Count_Type is <>;
-- Use to reserve the initial capacity for the vector. This can
-- safely return 0 or any values, since the vector is unbounded. But
-- returning a proper value will speed things up by avoiding reallocs.
package Conts.Properties.Indexed is
package Value_Vectors is new Conts.Vectors.Definite_Unbounded
(Index_Type, Element_Type, Container_Base_Type => Container_Base_Type);
type Map is limited record
Values : Value_Vectors.Vector;
end record;
function Get (M : Map; K : Key_Type) return Element_Type;
procedure Set (M : in out Map; K : Key_Type; Val : Element_Type);
procedure Clear (M : in out Map);
function Create_Map (G : Container_Type) return Map;
-- Create a new uninitialized map
package As_Map is new Maps (Map, Key_Type, Element_Type, Set, Get, Clear);
package As_Read_Only renames As_Map.As_Read_Only;
end Conts.Properties.Indexed;
|
kontena/ruby-packer | Ada | 3,044 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- Sample.Curses_Demo.Attributes --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998,2003 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control
-- $Revision: 1.10 $
-- Binding Version 01.00
------------------------------------------------------------------------------
package Sample.Curses_Demo.Attributes is
procedure Demo;
end Sample.Curses_Demo.Attributes;
|
ohenley/ada-util | Ada | 6,022 | adb | -----------------------------------------------------------------------
-- util-beans-objects-record_tests -- Unit tests for objects.records package
-- Copyright (C) 2011, 2017 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Test_Caller;
with Util.Strings;
with Util.Beans.Basic;
with Util.Beans.Objects.Vectors;
with Util.Beans.Objects.Records;
package body Util.Beans.Objects.Record_Tests is
use Util.Tests;
package Caller is new Util.Test_Caller (Test, "Objects.Records");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test Util.Beans.Objects.Records",
Test_Record'Access);
Caller.Add_Test (Suite, "Test Util.Beans.Basic",
Test_Bean'Access);
end Add_Tests;
type Data is record
Name : Unbounded_String;
Value : Util.Beans.Objects.Object;
end record;
package Data_Bean is new Util.Beans.Objects.Records (Data);
use type Data_Bean.Element_Type_Access;
subtype Data_Access is Data_Bean.Element_Type_Access;
procedure Test_Record (T : in out Test) is
D : Data;
begin
D.Name := To_Unbounded_String ("testing");
D.Value := To_Object (Integer (23));
declare
V : Object := Data_Bean.To_Object (D);
P : constant Data_Access := Data_Bean.To_Element_Access (V);
V2 : constant Object := V;
begin
T.Assert (not Is_Empty (V), "Object with data record should not be empty");
T.Assert (not Is_Null (V), "Object with data record should not be null");
T.Assert (P /= null, "To_Element_Access returned null");
Assert_Equals (T, "testing", To_String (P.Name), "Data name is not the same");
Assert_Equals (T, 23, To_Integer (P.Value), "Data value is not the same");
V := Data_Bean.Create;
declare
D2 : constant Data_Access := Data_Bean.To_Element_Access (V);
begin
T.Assert (D2 /= null, "Null element");
D2.Name := To_Unbounded_String ("second test");
D2.Value := V2;
end;
V := Data_Bean.To_Object (D);
end;
end Test_Record;
type Bean_Type is new Util.Beans.Basic.Readonly_Bean with record
Name : Unbounded_String;
end record;
type Bean_Type_Access is access all Bean_Type'Class;
overriding
function Get_Value (Bean : in Bean_Type;
Name : in String) return Util.Beans.Objects.Object;
overriding
function Get_Value (Bean : in Bean_Type;
Name : in String) return Util.Beans.Objects.Object is
begin
if Name = "name" then
return Util.Beans.Objects.To_Object (Bean.Name);
elsif Name = "length" then
return Util.Beans.Objects.To_Object (Length (Bean.Name));
else
return Util.Beans.Objects.Null_Object;
end if;
end Get_Value;
procedure Test_Bean (T : in out Test) is
use Basic;
Static : aliased Bean_Type;
begin
Static.Name := To_Unbounded_String ("Static");
-- Allocate dynamically several Bean_Type objects and drop the list.
-- The memory held by internal proxy as well as the Bean_Type must be freed.
-- The static bean should never be freed!
for I in 1 .. 10 loop
declare
List : Util.Beans.Objects.Vectors.Vector;
Value : Util.Beans.Objects.Object;
Bean : Bean_Type_Access;
P : access Readonly_Bean'Class;
begin
for J in 1 .. 1_000 loop
if I = J then
Value := To_Object (Static'Unchecked_Access, Objects.STATIC);
List.Append (Value);
end if;
Bean := new Bean_Type;
Bean.Name := To_Unbounded_String ("B" & Util.Strings.Image (J));
Value := To_Object (Bean);
List.Append (Value);
end loop;
-- Verify each bean of the list
for J in 1 .. 1_000 + 1 loop
Value := List.Element (J);
-- Check some common status.
T.Assert (not Is_Null (Value), "The value should hold a bean");
T.Assert (Get_Type (Value) = TYPE_BEAN, "The value should hold a bean");
T.Assert (not Is_Empty (Value), "The value should not be empty");
-- Check the bean access.
P := To_Bean (Value);
T.Assert (P /= null, "To_Bean returned null");
Bean := Bean_Type'Class (P.all)'Unchecked_Access;
-- Check we have the good bean object.
if I = J then
Assert_Equals (T, "Static", To_String (Bean.Name),
"Bean at" & Integer'Image (J) & " is invalid");
elsif J > I then
Assert_Equals (T, "B" & Util.Strings.Image (J - 1), To_String (Bean.Name),
"Bean at" & Integer'Image (J) & " is invalid");
else
Assert_Equals (T, "B" & Util.Strings.Image (J), To_String (Bean.Name),
"Bean at" & Integer'Image (J) & " is invalid");
end if;
end loop;
end;
end loop;
end Test_Bean;
end Util.Beans.Objects.Record_Tests;
|
AdaCore/gpr | Ada | 2,802 | adb | with Ada.Text_IO;
with Ada.Environment_Variables;
with Ada.Exceptions;
with GPR2.KB;
with GPR2.Log;
with GPR2.Project.Configuration;
with GPR2.Containers;
with GPR2.Context;
with GPR2.Path_Name;
with GPR2.Project.Tree;
procedure Main is
use Ada.Text_IO;
use Ada.Exceptions;
use GPR2;
use GPR2.Containers;
use GPR2.KB;
Project_Tree : Project.Tree.Object;
Ctx : Context.Object := Context.Empty;
RTS : Lang_Value_Map := Lang_Value_Maps.Empty_Map;
Msgs : GPR2.Log.Object;
Tgt : constant Optional_Name_Type := "x86_64-wrs-vxworks7";
Descrs : constant Project.Configuration.Description_Set :=
(1 => Project.Configuration.Create
(Language => GPR2.Ada_Language,
Runtime => "rtp"));
KBase : GPR2.KB.Object := Create_Default (Default_Flags);
Conf_Obj : GPR2.Project.Configuration.Object :=
GPR2.Project.Configuration.Create
(Descrs, Tgt, Project.Create ("foo.gpr"), KBase);
procedure Report_If_Errors (S : String);
procedure Report_If_Errors (S : String) is
begin
if Project_Tree.Log_Messages.Has_Error then
Put_Line (S);
for M of Project_Tree.Log_Messages.all loop
Put_Line (M.Format);
end loop;
end if;
end Report_If_Errors;
begin
RTS.Insert (Ada_Language, "rtp");
-- Autoconf + external set by aggregate project
Project_Tree.Load_Autoconf
(Filename => Project.Create ("agg.gpr"),
Context => Ctx,
Target => Tgt,
Language_Runtimes => RTS);
Report_If_Errors ("autoconf + agg external");
Project_Tree.Unload;
-- Configuration object + external set by aggregate project
Project_Tree.Load
(Filename => Project.Create ("agg.gpr"),
Context => Ctx,
Config => Conf_Obj);
Report_If_Errors ("conf obj + agg external");
Project_Tree.Unload;
Ada.Environment_Variables.Set("VSB_DIR", "/foo");
-- Autoconf + external set by environment
Project_Tree.Load_Autoconf
(Filename => Project.Create ("agg2.gpr"),
Context => Ctx,
Target => Tgt,
Language_Runtimes => RTS);
Report_If_Errors ("autoconf + env external");
Project_Tree.Unload;
-- Configuration object + external set by environment
Project_Tree.Load
(Filename => Project.Create ("agg2.gpr"),
Context => Ctx,
Config => Conf_Obj);
Report_If_Errors ("conf obj + env external");
Project_Tree.Unload;
exception
when E : Project_Error =>
Ada.Text_IO.Put_Line
("Exception Project_Error " & Exception_Information (E));
for M of Project_Tree.Log_Messages.all loop
Put_Line (M.Format);
end loop;
end Main;
|
riccardo-bernardini/eugen | Ada | 3,548 | adb |
with DOM.Core.Documents;
with Project_Processor.Parsers.Parser_Tables;
with XML_Utilities;
with XML_Scanners;
with DOM.Core.Nodes;
with EU_Projects.Nodes.Action_Nodes.Tasks;
with EU_Projects.Nodes.Action_Nodes.WPs;
with EU_Projects.Nodes.Timed_Nodes.Milestones;
with Project_Processor.Parsers.XML_Parsers.Sub_Parsers;
with EU_Projects.Nodes.Timed_Nodes.Deliverables;
package body Project_Processor.Parsers.XML_Parsers is
use XML_Scanners;
use EU_Projects.Projects;
------------
-- Create --
------------
function Create
(Params : not null access Plugins.Parameter_Maps.Map)
return Parser_Type
is
pragma Unreferenced (Params);
Result : Parser_Type;
begin
return Result;
end Create;
procedure Parse_Project
(Parser : in out Parser_Type;
Project : out Project_Descriptor;
N : in DOM.Core.Node)
is
pragma Unreferenced (Parser);
use EU_Projects.Nodes;
Scanner : XML_Scanner := Create_Child_Scanner (N);
procedure Add_Partner (N : DOM.Core.Node) is
begin
Project.Add_Partner (Sub_Parsers.Parse_Partner (N));
end Add_Partner;
procedure Add_Milestone (N : DOM.Core.Node) is
Milestone : Timed_Nodes.Milestones.Milestone_Access;
begin
Sub_Parsers.Parse_Milestone (N, Milestone);
Project.Add_Milestone (Milestone);
end Add_Milestone;
procedure Add_WP (N : DOM.Core.Node) is
WP : Action_Nodes.WPs.Project_WP_Access;
begin
Sub_Parsers.Parse_WP (N, WP);
Project.Add_WP (WP);
end Add_WP;
procedure Handle_Configuration (N : DOM.Core.Node) is
begin
Sub_Parsers.Parse_Configuration (Project, N);
end Handle_Configuration;
procedure Add_Risk (N : DOM.Core.Node) is
begin
Project.Add_Risk (Sub_Parsers.Parse_Risk (N));
end Add_Risk;
procedure Add_Deliverable (N : DOM.Core.Node) is
Deliv : Timed_Nodes.Deliverables.Deliverable_Access;
begin
Sub_Parsers.Parse_Deliverable (N, Deliv);
Project.Add_Deliverable (Deliv);
end Add_Deliverable;
begin
if DOM.Core.Nodes.Node_Name (N) /= "project" then
raise Parsing_Error;
end if;
Dom.Core.Nodes.Print (N);
Scanner.Parse_Optional ("configuration", Handle_Configuration'Access);
Scanner.Parse_Sequence ("partner", Add_Partner'Access);
Scanner.Parse_Sequence ("wp", Add_WP'Access);
Scanner.Parse_Sequence ("milestone", Add_Milestone'Access);
Scanner.Parse_Sequence (Name => "deliverable",
Callback => Add_Deliverable'Access,
Min_Length => 0);
Scanner.Parse_Sequence (Name => "risk",
Callback => Add_Risk'Access,
Min_Length => 0);
end Parse_Project;
-----------
-- Parse --
-----------
procedure Parse
(Parser : in out Parser_Type;
Project : out EU_Projects.Projects.Project_Descriptor;
Input : String)
is
use DOM.Core.Documents;
begin
Parse_Project
(Parser => Parser,
Project => Project,
N => Get_Element (XML_Utilities.Parse_String (Input)));
Project.Freeze;
end Parse;
begin
Parser_Tables.Register (ID => "xml",
Tag => Parser_Type'Tag);
end Project_Processor.Parsers.XML_Parsers;
|
reznikmm/matreshka | Ada | 10,539 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- 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 Interfaces;
with Matreshka.Internals.Strings.Constants;
package body Matreshka.Internals.Strings.Handlers.Portable is
use Interfaces;
use Matreshka.Internals.Strings.Constants;
use Matreshka.Internals.Unicode;
use Matreshka.Internals.Utf16;
type Unsigned_64_Unrestricted_Array is
array (Utf16_String_Index) of Unsigned_64;
--------------------------
-- Fill_Null_Terminator --
--------------------------
overriding procedure Fill_Null_Terminator
(Self : Portable_String_Handler;
Item : not null Shared_String_Access)
is
pragma Unreferenced (Self);
pragma Suppress (Access_Check);
-- Suppress not null check of Self which is generated by compiler; but
-- not needed actually.
pragma Suppress (Alignment_Check);
-- Suppress alignment check of Value below which is generated because of
-- bug in the GNAT GPL 2010 compiler.
SV : Unsigned_64_Unrestricted_Array;
for SV'Address use Item.Value'Address;
Index : constant Utf16_String_Index := Item.Unused / 4;
Offset : constant Utf16_String_Index := Item.Unused mod 4;
begin
SV (Index) := SV (Index) and Terminator_Mask_64 (Offset);
end Fill_Null_Terminator;
--------------
-- Is_Equal --
--------------
overriding function Is_Equal
(Self : Portable_String_Handler;
Left : not null Shared_String_Access;
Right : not null Shared_String_Access) return Boolean
is
pragma Unreferenced (Self);
pragma Suppress (Access_Check);
pragma Suppress (Alignment_Check);
begin
if Left = Right then
return True;
end if;
if Left.Unused /= Right.Unused then
return False;
end if;
declare
LV : Unsigned_64_Unrestricted_Array;
for LV'Address use Left.Value'Address;
RV : Unsigned_64_Unrestricted_Array;
for RV'Address use Right.Value'Address;
Last : constant Utf16_String_Index := Left.Unused / 4;
begin
for J in 0 .. Last loop
if LV (J) /= RV (J) then
return False;
end if;
end loop;
end;
return True;
end Is_Equal;
----------------
-- Is_Greater --
----------------
overriding function Is_Greater
(Self : Portable_String_Handler;
Left : not null Shared_String_Access;
Right : not null Shared_String_Access) return Boolean
is
pragma Unreferenced (Self);
pragma Suppress (Access_Check);
pragma Suppress (Alignment_Check);
pragma Suppress (Index_Check);
begin
if Left = Right then
return False;
end if;
declare
Last : constant Utf16_String_Index
:= Utf16_String_Index'Min (Left.Unused, Right.Unused) / 4;
LV : Unsigned_64_Unrestricted_Array;
for LV'Address use Left.Value'Address;
RV : Unsigned_64_Unrestricted_Array;
for RV'Address use Right.Value'Address;
begin
for J in 0 .. Last loop
if LV (J) /= RV (J) then
for K in J * 4 .. J * 4 + 3 loop
if Left.Value (K) /= Right.Value (K) then
return Is_Greater (Left.Value (K), Right.Value (K));
end if;
end loop;
end if;
end loop;
end;
return Left.Unused > Right.Unused;
end Is_Greater;
-------------------------
-- Is_Greater_Or_Equal --
-------------------------
overriding function Is_Greater_Or_Equal
(Self : Portable_String_Handler;
Left : not null Shared_String_Access;
Right : not null Shared_String_Access) return Boolean
is
pragma Unreferenced (Self);
pragma Suppress (Access_Check);
pragma Suppress (Alignment_Check);
pragma Suppress (Index_Check);
begin
if Left = Right then
return True;
end if;
declare
Last : constant Utf16_String_Index
:= Utf16_String_Index'Min (Left.Unused, Right.Unused) / 4;
LV : Unsigned_64_Unrestricted_Array;
for LV'Address use Left.Value'Address;
RV : Unsigned_64_Unrestricted_Array;
for RV'Address use Right.Value'Address;
begin
for J in 0 .. Last loop
if LV (J) /= RV (J) then
for K in J * 4 .. J * 4 + 3 loop
if Left.Value (K) /= Right.Value (K) then
return Is_Greater (Left.Value (K), Right.Value (K));
end if;
end loop;
end if;
end loop;
end;
return Left.Unused >= Right.Unused;
end Is_Greater_Or_Equal;
-------------
-- Is_Less --
-------------
overriding function Is_Less
(Self : Portable_String_Handler;
Left : not null Shared_String_Access;
Right : not null Shared_String_Access) return Boolean
is
pragma Unreferenced (Self);
pragma Suppress (Access_Check);
pragma Suppress (Alignment_Check);
pragma Suppress (Index_Check);
begin
if Left = Right then
return False;
end if;
declare
Last : constant Utf16_String_Index
:= Utf16_String_Index'Min (Left.Unused, Right.Unused) / 4;
LV : Unsigned_64_Unrestricted_Array;
for LV'Address use Left.Value'Address;
RV : Unsigned_64_Unrestricted_Array;
for RV'Address use Right.Value'Address;
begin
for J in 0 .. Last loop
if LV (J) /= RV (J) then
for K in J * 4 .. J * 4 + 3 loop
if Left.Value (K) /= Right.Value (K) then
return Is_Less (Left.Value (K), Right.Value (K));
end if;
end loop;
end if;
end loop;
end;
return Left.Unused < Right.Unused;
end Is_Less;
----------------------
-- Is_Less_Or_Equal --
----------------------
overriding function Is_Less_Or_Equal
(Self : Portable_String_Handler;
Left : not null Shared_String_Access;
Right : not null Shared_String_Access) return Boolean
is
pragma Unreferenced (Self);
pragma Suppress (Access_Check);
pragma Suppress (Alignment_Check);
pragma Suppress (Index_Check);
begin
if Left = Right then
return True;
end if;
declare
Last : constant Utf16_String_Index
:= Utf16_String_Index'Min (Left.Unused, Right.Unused) / 4;
LV : Unsigned_64_Unrestricted_Array;
for LV'Address use Left.Value'Address;
RV : Unsigned_64_Unrestricted_Array;
for RV'Address use Right.Value'Address;
begin
for J in 0 .. Last loop
if LV (J) /= RV (J) then
for K in J * 4 .. J * 4 + 3 loop
if Left.Value (K) /= Right.Value (K) then
return Is_Less (Left.Value (K), Right.Value (K));
end if;
end loop;
end if;
end loop;
end;
return Left.Unused <= Right.Unused;
end Is_Less_Or_Equal;
end Matreshka.Internals.Strings.Handlers.Portable;
|
docandrew/troodon | Ada | 50,702 | ads | pragma Ada_2012;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
limited with Xlib;
with GLX;
with GL;
with System;
limited with Xutil;
with X11;
with Interfaces.C.Strings;
with glext;
with bits_stdint_intn_h;
package glxext is
GLX_GLXEXT_VERSION : constant := 20190911; -- /usr/include/GL/glxext.h:37
GLX_ARB_context_flush_control : constant := 1; -- /usr/include/GL/glxext.h:160
GLX_CONTEXT_RELEASE_BEHAVIOR_ARB : constant := 16#2097#; -- /usr/include/GL/glxext.h:161
GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB : constant := 0; -- /usr/include/GL/glxext.h:162
GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB : constant := 16#2098#; -- /usr/include/GL/glxext.h:163
GLX_ARB_create_context : constant := 1; -- /usr/include/GL/glxext.h:167
GLX_CONTEXT_DEBUG_BIT_ARB : constant := 16#00000001#; -- /usr/include/GL/glxext.h:168
GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB : constant := 16#00000002#; -- /usr/include/GL/glxext.h:169
GLX_CONTEXT_MAJOR_VERSION_ARB : constant := 16#2091#; -- /usr/include/GL/glxext.h:170
GLX_CONTEXT_MINOR_VERSION_ARB : constant := 16#2092#; -- /usr/include/GL/glxext.h:171
GLX_CONTEXT_FLAGS_ARB : constant := 16#2094#; -- /usr/include/GL/glxext.h:172
GLX_ARB_create_context_no_error : constant := 1; -- /usr/include/GL/glxext.h:180
GLX_CONTEXT_OPENGL_NO_ERROR_ARB : constant := 16#31B3#; -- /usr/include/GL/glxext.h:181
GLX_ARB_create_context_profile : constant := 1; -- /usr/include/GL/glxext.h:185
GLX_CONTEXT_CORE_PROFILE_BIT_ARB : constant := 16#00000001#; -- /usr/include/GL/glxext.h:186
GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB : constant := 16#00000002#; -- /usr/include/GL/glxext.h:187
GLX_CONTEXT_PROFILE_MASK_ARB : constant := 16#9126#; -- /usr/include/GL/glxext.h:188
GLX_ARB_create_context_robustness : constant := 1; -- /usr/include/GL/glxext.h:192
GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB : constant := 16#00000004#; -- /usr/include/GL/glxext.h:193
GLX_LOSE_CONTEXT_ON_RESET_ARB : constant := 16#8252#; -- /usr/include/GL/glxext.h:194
GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB : constant := 16#8256#; -- /usr/include/GL/glxext.h:195
GLX_NO_RESET_NOTIFICATION_ARB : constant := 16#8261#; -- /usr/include/GL/glxext.h:196
GLX_ARB_fbconfig_float : constant := 1; -- /usr/include/GL/glxext.h:200
GLX_RGBA_FLOAT_TYPE_ARB : constant := 16#20B9#; -- /usr/include/GL/glxext.h:201
GLX_RGBA_FLOAT_BIT_ARB : constant := 16#00000004#; -- /usr/include/GL/glxext.h:202
GLX_ARB_framebuffer_sRGB : constant := 1; -- /usr/include/GL/glxext.h:206
GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB : constant := 16#20B2#; -- /usr/include/GL/glxext.h:207
GLX_ARB_multisample : constant := 1; -- /usr/include/GL/glxext.h:219
GLX_SAMPLE_BUFFERS_ARB : constant := 100000; -- /usr/include/GL/glxext.h:220
GLX_SAMPLES_ARB : constant := 100001; -- /usr/include/GL/glxext.h:221
GLX_ARB_robustness_application_isolation : constant := 1; -- /usr/include/GL/glxext.h:225
GLX_CONTEXT_RESET_ISOLATION_BIT_ARB : constant := 16#00000008#; -- /usr/include/GL/glxext.h:226
GLX_ARB_robustness_share_group_isolation : constant := 1; -- /usr/include/GL/glxext.h:230
GLX_ARB_vertex_buffer_object : constant := 1; -- /usr/include/GL/glxext.h:234
GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB : constant := 16#2095#; -- /usr/include/GL/glxext.h:235
GLX_3DFX_multisample : constant := 1; -- /usr/include/GL/glxext.h:239
GLX_SAMPLE_BUFFERS_3DFX : constant := 16#8050#; -- /usr/include/GL/glxext.h:240
GLX_SAMPLES_3DFX : constant := 16#8051#; -- /usr/include/GL/glxext.h:241
GLX_AMD_gpu_association : constant := 1; -- /usr/include/GL/glxext.h:245
GLX_GPU_VENDOR_AMD : constant := 16#1F00#; -- /usr/include/GL/glxext.h:246
GLX_GPU_RENDERER_STRING_AMD : constant := 16#1F01#; -- /usr/include/GL/glxext.h:247
GLX_GPU_OPENGL_VERSION_STRING_AMD : constant := 16#1F02#; -- /usr/include/GL/glxext.h:248
GLX_GPU_FASTEST_TARGET_GPUS_AMD : constant := 16#21A2#; -- /usr/include/GL/glxext.h:249
GLX_GPU_RAM_AMD : constant := 16#21A3#; -- /usr/include/GL/glxext.h:250
GLX_GPU_CLOCK_AMD : constant := 16#21A4#; -- /usr/include/GL/glxext.h:251
GLX_GPU_NUM_PIPES_AMD : constant := 16#21A5#; -- /usr/include/GL/glxext.h:252
GLX_GPU_NUM_SIMD_AMD : constant := 16#21A6#; -- /usr/include/GL/glxext.h:253
GLX_GPU_NUM_RB_AMD : constant := 16#21A7#; -- /usr/include/GL/glxext.h:254
GLX_GPU_NUM_SPI_AMD : constant := 16#21A8#; -- /usr/include/GL/glxext.h:255
GLX_EXT_buffer_age : constant := 1; -- /usr/include/GL/glxext.h:279
GLX_BACK_BUFFER_AGE_EXT : constant := 16#20F4#; -- /usr/include/GL/glxext.h:280
GLX_EXT_context_priority : constant := 1; -- /usr/include/GL/glxext.h:284
GLX_CONTEXT_PRIORITY_LEVEL_EXT : constant := 16#3100#; -- /usr/include/GL/glxext.h:285
GLX_CONTEXT_PRIORITY_HIGH_EXT : constant := 16#3101#; -- /usr/include/GL/glxext.h:286
GLX_CONTEXT_PRIORITY_MEDIUM_EXT : constant := 16#3102#; -- /usr/include/GL/glxext.h:287
GLX_CONTEXT_PRIORITY_LOW_EXT : constant := 16#3103#; -- /usr/include/GL/glxext.h:288
GLX_EXT_create_context_es2_profile : constant := 1; -- /usr/include/GL/glxext.h:292
GLX_CONTEXT_ES2_PROFILE_BIT_EXT : constant := 16#00000004#; -- /usr/include/GL/glxext.h:293
GLX_EXT_create_context_es_profile : constant := 1; -- /usr/include/GL/glxext.h:297
GLX_CONTEXT_ES_PROFILE_BIT_EXT : constant := 16#00000004#; -- /usr/include/GL/glxext.h:298
GLX_EXT_fbconfig_packed_float : constant := 1; -- /usr/include/GL/glxext.h:302
GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT : constant := 16#20B1#; -- /usr/include/GL/glxext.h:303
GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT : constant := 16#00000008#; -- /usr/include/GL/glxext.h:304
GLX_EXT_framebuffer_sRGB : constant := 1; -- /usr/include/GL/glxext.h:308
GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT : constant := 16#20B2#; -- /usr/include/GL/glxext.h:309
GLX_EXT_import_context : constant := 1; -- /usr/include/GL/glxext.h:313
GLX_SHARE_CONTEXT_EXT : constant := 16#800A#; -- /usr/include/GL/glxext.h:314
GLX_VISUAL_ID_EXT : constant := 16#800B#; -- /usr/include/GL/glxext.h:315
GLX_SCREEN_EXT : constant := 16#800C#; -- /usr/include/GL/glxext.h:316
GLX_EXT_libglvnd : constant := 1; -- /usr/include/GL/glxext.h:332
GLX_VENDOR_NAMES_EXT : constant := 16#20F6#; -- /usr/include/GL/glxext.h:333
GLX_EXT_no_config_context : constant := 1; -- /usr/include/GL/glxext.h:337
GLX_EXT_stereo_tree : constant := 1; -- /usr/include/GL/glxext.h:341
GLX_STEREO_TREE_EXT : constant := 16#20F5#; -- /usr/include/GL/glxext.h:352
GLX_STEREO_NOTIFY_MASK_EXT : constant := 16#00000001#; -- /usr/include/GL/glxext.h:353
GLX_STEREO_NOTIFY_EXT : constant := 16#00000000#; -- /usr/include/GL/glxext.h:354
GLX_EXT_swap_control : constant := 1; -- /usr/include/GL/glxext.h:358
GLX_SWAP_INTERVAL_EXT : constant := 16#20F1#; -- /usr/include/GL/glxext.h:359
GLX_MAX_SWAP_INTERVAL_EXT : constant := 16#20F2#; -- /usr/include/GL/glxext.h:360
GLX_EXT_swap_control_tear : constant := 1; -- /usr/include/GL/glxext.h:368
GLX_LATE_SWAPS_TEAR_EXT : constant := 16#20F3#; -- /usr/include/GL/glxext.h:369
GLX_EXT_texture_from_pixmap : constant := 1; -- /usr/include/GL/glxext.h:373
GLX_TEXTURE_1D_BIT_EXT : constant := 16#00000001#; -- /usr/include/GL/glxext.h:374
GLX_TEXTURE_2D_BIT_EXT : constant := 16#00000002#; -- /usr/include/GL/glxext.h:375
GLX_TEXTURE_RECTANGLE_BIT_EXT : constant := 16#00000004#; -- /usr/include/GL/glxext.h:376
GLX_BIND_TO_TEXTURE_RGB_EXT : constant := 16#20D0#; -- /usr/include/GL/glxext.h:377
GLX_BIND_TO_TEXTURE_RGBA_EXT : constant := 16#20D1#; -- /usr/include/GL/glxext.h:378
GLX_BIND_TO_MIPMAP_TEXTURE_EXT : constant := 16#20D2#; -- /usr/include/GL/glxext.h:379
GLX_BIND_TO_TEXTURE_TARGETS_EXT : constant := 16#20D3#; -- /usr/include/GL/glxext.h:380
GLX_Y_INVERTED_EXT : constant := 16#20D4#; -- /usr/include/GL/glxext.h:381
GLX_TEXTURE_FORMAT_EXT : constant := 16#20D5#; -- /usr/include/GL/glxext.h:382
GLX_TEXTURE_TARGET_EXT : constant := 16#20D6#; -- /usr/include/GL/glxext.h:383
GLX_MIPMAP_TEXTURE_EXT : constant := 16#20D7#; -- /usr/include/GL/glxext.h:384
GLX_TEXTURE_FORMAT_NONE_EXT : constant := 16#20D8#; -- /usr/include/GL/glxext.h:385
GLX_TEXTURE_FORMAT_RGB_EXT : constant := 16#20D9#; -- /usr/include/GL/glxext.h:386
GLX_TEXTURE_FORMAT_RGBA_EXT : constant := 16#20DA#; -- /usr/include/GL/glxext.h:387
GLX_TEXTURE_1D_EXT : constant := 16#20DB#; -- /usr/include/GL/glxext.h:388
GLX_TEXTURE_2D_EXT : constant := 16#20DC#; -- /usr/include/GL/glxext.h:389
GLX_TEXTURE_RECTANGLE_EXT : constant := 16#20DD#; -- /usr/include/GL/glxext.h:390
GLX_FRONT_LEFT_EXT : constant := 16#20DE#; -- /usr/include/GL/glxext.h:391
GLX_FRONT_RIGHT_EXT : constant := 16#20DF#; -- /usr/include/GL/glxext.h:392
GLX_BACK_LEFT_EXT : constant := 16#20E0#; -- /usr/include/GL/glxext.h:393
GLX_BACK_RIGHT_EXT : constant := 16#20E1#; -- /usr/include/GL/glxext.h:394
GLX_FRONT_EXT : constant := 16#20DE#; -- /usr/include/GL/glxext.h:395
GLX_BACK_EXT : constant := 16#20E0#; -- /usr/include/GL/glxext.h:396
GLX_AUX0_EXT : constant := 16#20E2#; -- /usr/include/GL/glxext.h:397
GLX_AUX1_EXT : constant := 16#20E3#; -- /usr/include/GL/glxext.h:398
GLX_AUX2_EXT : constant := 16#20E4#; -- /usr/include/GL/glxext.h:399
GLX_AUX3_EXT : constant := 16#20E5#; -- /usr/include/GL/glxext.h:400
GLX_AUX4_EXT : constant := 16#20E6#; -- /usr/include/GL/glxext.h:401
GLX_AUX5_EXT : constant := 16#20E7#; -- /usr/include/GL/glxext.h:402
GLX_AUX6_EXT : constant := 16#20E8#; -- /usr/include/GL/glxext.h:403
GLX_AUX7_EXT : constant := 16#20E9#; -- /usr/include/GL/glxext.h:404
GLX_AUX8_EXT : constant := 16#20EA#; -- /usr/include/GL/glxext.h:405
GLX_AUX9_EXT : constant := 16#20EB#; -- /usr/include/GL/glxext.h:406
GLX_EXT_visual_info : constant := 1; -- /usr/include/GL/glxext.h:416
GLX_X_VISUAL_TYPE_EXT : constant := 16#22#; -- /usr/include/GL/glxext.h:417
GLX_TRANSPARENT_TYPE_EXT : constant := 16#23#; -- /usr/include/GL/glxext.h:418
GLX_TRANSPARENT_INDEX_VALUE_EXT : constant := 16#24#; -- /usr/include/GL/glxext.h:419
GLX_TRANSPARENT_RED_VALUE_EXT : constant := 16#25#; -- /usr/include/GL/glxext.h:420
GLX_TRANSPARENT_GREEN_VALUE_EXT : constant := 16#26#; -- /usr/include/GL/glxext.h:421
GLX_TRANSPARENT_BLUE_VALUE_EXT : constant := 16#27#; -- /usr/include/GL/glxext.h:422
GLX_TRANSPARENT_ALPHA_VALUE_EXT : constant := 16#28#; -- /usr/include/GL/glxext.h:423
GLX_NONE_EXT : constant := 16#8000#; -- /usr/include/GL/glxext.h:424
GLX_TRUE_COLOR_EXT : constant := 16#8002#; -- /usr/include/GL/glxext.h:425
GLX_DIRECT_COLOR_EXT : constant := 16#8003#; -- /usr/include/GL/glxext.h:426
GLX_PSEUDO_COLOR_EXT : constant := 16#8004#; -- /usr/include/GL/glxext.h:427
GLX_STATIC_COLOR_EXT : constant := 16#8005#; -- /usr/include/GL/glxext.h:428
GLX_GRAY_SCALE_EXT : constant := 16#8006#; -- /usr/include/GL/glxext.h:429
GLX_STATIC_GRAY_EXT : constant := 16#8007#; -- /usr/include/GL/glxext.h:430
GLX_TRANSPARENT_RGB_EXT : constant := 16#8008#; -- /usr/include/GL/glxext.h:431
GLX_TRANSPARENT_INDEX_EXT : constant := 16#8009#; -- /usr/include/GL/glxext.h:432
GLX_EXT_visual_rating : constant := 1; -- /usr/include/GL/glxext.h:436
GLX_VISUAL_CAVEAT_EXT : constant := 16#20#; -- /usr/include/GL/glxext.h:437
GLX_SLOW_VISUAL_EXT : constant := 16#8001#; -- /usr/include/GL/glxext.h:438
GLX_NON_CONFORMANT_VISUAL_EXT : constant := 16#800D#; -- /usr/include/GL/glxext.h:439
GLX_INTEL_swap_event : constant := 1; -- /usr/include/GL/glxext.h:443
GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK : constant := 16#04000000#; -- /usr/include/GL/glxext.h:444
GLX_EXCHANGE_COMPLETE_INTEL : constant := 16#8180#; -- /usr/include/GL/glxext.h:445
GLX_COPY_COMPLETE_INTEL : constant := 16#8181#; -- /usr/include/GL/glxext.h:446
GLX_FLIP_COMPLETE_INTEL : constant := 16#8182#; -- /usr/include/GL/glxext.h:447
GLX_MESA_agp_offset : constant := 1; -- /usr/include/GL/glxext.h:451
GLX_MESA_copy_sub_buffer : constant := 1; -- /usr/include/GL/glxext.h:459
GLX_MESA_pixmap_colormap : constant := 1; -- /usr/include/GL/glxext.h:467
GLX_MESA_query_renderer : constant := 1; -- /usr/include/GL/glxext.h:475
GLX_RENDERER_VENDOR_ID_MESA : constant := 16#8183#; -- /usr/include/GL/glxext.h:476
GLX_RENDERER_DEVICE_ID_MESA : constant := 16#8184#; -- /usr/include/GL/glxext.h:477
GLX_RENDERER_VERSION_MESA : constant := 16#8185#; -- /usr/include/GL/glxext.h:478
GLX_RENDERER_ACCELERATED_MESA : constant := 16#8186#; -- /usr/include/GL/glxext.h:479
GLX_RENDERER_VIDEO_MEMORY_MESA : constant := 16#8187#; -- /usr/include/GL/glxext.h:480
GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA : constant := 16#8188#; -- /usr/include/GL/glxext.h:481
GLX_RENDERER_PREFERRED_PROFILE_MESA : constant := 16#8189#; -- /usr/include/GL/glxext.h:482
GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA : constant := 16#818A#; -- /usr/include/GL/glxext.h:483
GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA : constant := 16#818B#; -- /usr/include/GL/glxext.h:484
GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA : constant := 16#818C#; -- /usr/include/GL/glxext.h:485
GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA : constant := 16#818D#; -- /usr/include/GL/glxext.h:486
GLX_MESA_release_buffers : constant := 1; -- /usr/include/GL/glxext.h:500
GLX_MESA_set_3dfx_mode : constant := 1; -- /usr/include/GL/glxext.h:508
GLX_3DFX_WINDOW_MODE_MESA : constant := 16#1#; -- /usr/include/GL/glxext.h:509
GLX_3DFX_FULLSCREEN_MODE_MESA : constant := 16#2#; -- /usr/include/GL/glxext.h:510
GLX_MESA_swap_control : constant := 1; -- /usr/include/GL/glxext.h:518
GLX_NV_copy_buffer : constant := 1; -- /usr/include/GL/glxext.h:528
GLX_NV_copy_image : constant := 1; -- /usr/include/GL/glxext.h:538
GLX_NV_delay_before_swap : constant := 1; -- /usr/include/GL/glxext.h:546
GLX_NV_float_buffer : constant := 1; -- /usr/include/GL/glxext.h:554
GLX_FLOAT_COMPONENTS_NV : constant := 16#20B0#; -- /usr/include/GL/glxext.h:555
GLX_NV_multigpu_context : constant := 1; -- /usr/include/GL/glxext.h:559
GLX_CONTEXT_MULTIGPU_ATTRIB_NV : constant := 16#20AA#; -- /usr/include/GL/glxext.h:560
GLX_CONTEXT_MULTIGPU_ATTRIB_SINGLE_NV : constant := 16#20AB#; -- /usr/include/GL/glxext.h:561
GLX_CONTEXT_MULTIGPU_ATTRIB_AFR_NV : constant := 16#20AC#; -- /usr/include/GL/glxext.h:562
GLX_CONTEXT_MULTIGPU_ATTRIB_MULTICAST_NV : constant := 16#20AD#; -- /usr/include/GL/glxext.h:563
GLX_CONTEXT_MULTIGPU_ATTRIB_MULTI_DISPLAY_MULTICAST_NV : constant := 16#20AE#; -- /usr/include/GL/glxext.h:564
GLX_NV_multisample_coverage : constant := 1; -- /usr/include/GL/glxext.h:568
GLX_COVERAGE_SAMPLES_NV : constant := 100001; -- /usr/include/GL/glxext.h:569
GLX_COLOR_SAMPLES_NV : constant := 16#20B3#; -- /usr/include/GL/glxext.h:570
GLX_NV_present_video : constant := 1; -- /usr/include/GL/glxext.h:574
GLX_NUM_VIDEO_SLOTS_NV : constant := 16#20F0#; -- /usr/include/GL/glxext.h:575
GLX_NV_robustness_video_memory_purge : constant := 1; -- /usr/include/GL/glxext.h:585
GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV : constant := 16#20F7#; -- /usr/include/GL/glxext.h:586
GLX_NV_swap_group : constant := 1; -- /usr/include/GL/glxext.h:590
GLX_NV_video_capture : constant := 1; -- /usr/include/GL/glxext.h:608
GLX_DEVICE_ID_NV : constant := 16#20CD#; -- /usr/include/GL/glxext.h:610
GLX_UNIQUE_ID_NV : constant := 16#20CE#; -- /usr/include/GL/glxext.h:611
GLX_NUM_VIDEO_CAPTURE_SLOTS_NV : constant := 16#20CF#; -- /usr/include/GL/glxext.h:612
GLX_NV_video_out : constant := 1; -- /usr/include/GL/glxext.h:628
GLX_VIDEO_OUT_COLOR_NV : constant := 16#20C3#; -- /usr/include/GL/glxext.h:630
GLX_VIDEO_OUT_ALPHA_NV : constant := 16#20C4#; -- /usr/include/GL/glxext.h:631
GLX_VIDEO_OUT_DEPTH_NV : constant := 16#20C5#; -- /usr/include/GL/glxext.h:632
GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV : constant := 16#20C6#; -- /usr/include/GL/glxext.h:633
GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV : constant := 16#20C7#; -- /usr/include/GL/glxext.h:634
GLX_VIDEO_OUT_FRAME_NV : constant := 16#20C8#; -- /usr/include/GL/glxext.h:635
GLX_VIDEO_OUT_FIELD_1_NV : constant := 16#20C9#; -- /usr/include/GL/glxext.h:636
GLX_VIDEO_OUT_FIELD_2_NV : constant := 16#20CA#; -- /usr/include/GL/glxext.h:637
GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV : constant := 16#20CB#; -- /usr/include/GL/glxext.h:638
GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV : constant := 16#20CC#; -- /usr/include/GL/glxext.h:639
GLX_OML_swap_method : constant := 1; -- /usr/include/GL/glxext.h:657
GLX_SWAP_METHOD_OML : constant := 16#8060#; -- /usr/include/GL/glxext.h:658
GLX_SWAP_EXCHANGE_OML : constant := 16#8061#; -- /usr/include/GL/glxext.h:659
GLX_SWAP_COPY_OML : constant := 16#8062#; -- /usr/include/GL/glxext.h:660
GLX_SWAP_UNDEFINED_OML : constant := 16#8063#; -- /usr/include/GL/glxext.h:661
GLX_OML_sync_control : constant := 1; -- /usr/include/GL/glxext.h:665
GLX_SGIS_blended_overlay : constant := 1; -- /usr/include/GL/glxext.h:718
GLX_BLENDED_RGBA_SGIS : constant := 16#8025#; -- /usr/include/GL/glxext.h:719
GLX_SGIS_multisample : constant := 1; -- /usr/include/GL/glxext.h:723
GLX_SAMPLE_BUFFERS_SGIS : constant := 100000; -- /usr/include/GL/glxext.h:724
GLX_SAMPLES_SGIS : constant := 100001; -- /usr/include/GL/glxext.h:725
GLX_SGIS_shared_multisample : constant := 1; -- /usr/include/GL/glxext.h:729
GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS : constant := 16#8026#; -- /usr/include/GL/glxext.h:730
GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS : constant := 16#8027#; -- /usr/include/GL/glxext.h:731
GLX_SGIX_dmbuffer : constant := 1; -- /usr/include/GL/glxext.h:735
GLX_SGIX_fbconfig : constant := 1; -- /usr/include/GL/glxext.h:747
GLX_WINDOW_BIT_SGIX : constant := 16#00000001#; -- /usr/include/GL/glxext.h:749
GLX_PIXMAP_BIT_SGIX : constant := 16#00000002#; -- /usr/include/GL/glxext.h:750
GLX_RGBA_BIT_SGIX : constant := 16#00000001#; -- /usr/include/GL/glxext.h:751
GLX_COLOR_INDEX_BIT_SGIX : constant := 16#00000002#; -- /usr/include/GL/glxext.h:752
GLX_DRAWABLE_TYPE_SGIX : constant := 16#8010#; -- /usr/include/GL/glxext.h:753
GLX_RENDER_TYPE_SGIX : constant := 16#8011#; -- /usr/include/GL/glxext.h:754
GLX_X_RENDERABLE_SGIX : constant := 16#8012#; -- /usr/include/GL/glxext.h:755
GLX_FBCONFIG_ID_SGIX : constant := 16#8013#; -- /usr/include/GL/glxext.h:756
GLX_RGBA_TYPE_SGIX : constant := 16#8014#; -- /usr/include/GL/glxext.h:757
GLX_COLOR_INDEX_TYPE_SGIX : constant := 16#8015#; -- /usr/include/GL/glxext.h:758
GLX_SGIX_hyperpipe : constant := 1; -- /usr/include/GL/glxext.h:776
GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX : constant := 80; -- /usr/include/GL/glxext.h:796
GLX_BAD_HYPERPIPE_CONFIG_SGIX : constant := 91; -- /usr/include/GL/glxext.h:797
GLX_BAD_HYPERPIPE_SGIX : constant := 92; -- /usr/include/GL/glxext.h:798
GLX_HYPERPIPE_DISPLAY_PIPE_SGIX : constant := 16#00000001#; -- /usr/include/GL/glxext.h:799
GLX_HYPERPIPE_RENDER_PIPE_SGIX : constant := 16#00000002#; -- /usr/include/GL/glxext.h:800
GLX_PIPE_RECT_SGIX : constant := 16#00000001#; -- /usr/include/GL/glxext.h:801
GLX_PIPE_RECT_LIMITS_SGIX : constant := 16#00000002#; -- /usr/include/GL/glxext.h:802
GLX_HYPERPIPE_STEREO_SGIX : constant := 16#00000003#; -- /usr/include/GL/glxext.h:803
GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX : constant := 16#00000004#; -- /usr/include/GL/glxext.h:804
GLX_HYPERPIPE_ID_SGIX : constant := 16#8030#; -- /usr/include/GL/glxext.h:805
GLX_SGIX_pbuffer : constant := 1; -- /usr/include/GL/glxext.h:827
GLX_PBUFFER_BIT_SGIX : constant := 16#00000004#; -- /usr/include/GL/glxext.h:828
GLX_BUFFER_CLOBBER_MASK_SGIX : constant := 16#08000000#; -- /usr/include/GL/glxext.h:829
GLX_FRONT_LEFT_BUFFER_BIT_SGIX : constant := 16#00000001#; -- /usr/include/GL/glxext.h:830
GLX_FRONT_RIGHT_BUFFER_BIT_SGIX : constant := 16#00000002#; -- /usr/include/GL/glxext.h:831
GLX_BACK_LEFT_BUFFER_BIT_SGIX : constant := 16#00000004#; -- /usr/include/GL/glxext.h:832
GLX_BACK_RIGHT_BUFFER_BIT_SGIX : constant := 16#00000008#; -- /usr/include/GL/glxext.h:833
GLX_AUX_BUFFERS_BIT_SGIX : constant := 16#00000010#; -- /usr/include/GL/glxext.h:834
GLX_DEPTH_BUFFER_BIT_SGIX : constant := 16#00000020#; -- /usr/include/GL/glxext.h:835
GLX_STENCIL_BUFFER_BIT_SGIX : constant := 16#00000040#; -- /usr/include/GL/glxext.h:836
GLX_ACCUM_BUFFER_BIT_SGIX : constant := 16#00000080#; -- /usr/include/GL/glxext.h:837
GLX_SAMPLE_BUFFERS_BIT_SGIX : constant := 16#00000100#; -- /usr/include/GL/glxext.h:838
GLX_MAX_PBUFFER_WIDTH_SGIX : constant := 16#8016#; -- /usr/include/GL/glxext.h:839
GLX_MAX_PBUFFER_HEIGHT_SGIX : constant := 16#8017#; -- /usr/include/GL/glxext.h:840
GLX_MAX_PBUFFER_PIXELS_SGIX : constant := 16#8018#; -- /usr/include/GL/glxext.h:841
GLX_OPTIMAL_PBUFFER_WIDTH_SGIX : constant := 16#8019#; -- /usr/include/GL/glxext.h:842
GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX : constant := 16#801A#; -- /usr/include/GL/glxext.h:843
GLX_PRESERVED_CONTENTS_SGIX : constant := 16#801B#; -- /usr/include/GL/glxext.h:844
GLX_LARGEST_PBUFFER_SGIX : constant := 16#801C#; -- /usr/include/GL/glxext.h:845
GLX_WIDTH_SGIX : constant := 16#801D#; -- /usr/include/GL/glxext.h:846
GLX_HEIGHT_SGIX : constant := 16#801E#; -- /usr/include/GL/glxext.h:847
GLX_EVENT_MASK_SGIX : constant := 16#801F#; -- /usr/include/GL/glxext.h:848
GLX_DAMAGED_SGIX : constant := 16#8020#; -- /usr/include/GL/glxext.h:849
GLX_SAVED_SGIX : constant := 16#8021#; -- /usr/include/GL/glxext.h:850
GLX_WINDOW_SGIX : constant := 16#8022#; -- /usr/include/GL/glxext.h:851
GLX_PBUFFER_SGIX : constant := 16#8023#; -- /usr/include/GL/glxext.h:852
GLX_SGIX_swap_barrier : constant := 1; -- /usr/include/GL/glxext.h:868
GLX_SGIX_swap_group : constant := 1; -- /usr/include/GL/glxext.h:878
GLX_SGIX_video_resize : constant := 1; -- /usr/include/GL/glxext.h:886
GLX_SYNC_FRAME_SGIX : constant := 16#00000000#; -- /usr/include/GL/glxext.h:887
GLX_SYNC_SWAP_SGIX : constant := 16#00000001#; -- /usr/include/GL/glxext.h:888
GLX_SGIX_video_source : constant := 1; -- /usr/include/GL/glxext.h:904
GLX_SGIX_visual_select_group : constant := 1; -- /usr/include/GL/glxext.h:917
GLX_VISUAL_SELECT_GROUP_SGIX : constant := 16#8028#; -- /usr/include/GL/glxext.h:918
GLX_SGI_cushion : constant := 1; -- /usr/include/GL/glxext.h:922
GLX_SGI_make_current_read : constant := 1; -- /usr/include/GL/glxext.h:930
GLX_SGI_swap_control : constant := 1; -- /usr/include/GL/glxext.h:940
GLX_SGI_video_sync : constant := 1; -- /usr/include/GL/glxext.h:948
GLX_SUN_get_transparent_index : constant := 1; -- /usr/include/GL/glxext.h:958
--** Copyright (c) 2013-2018 The Khronos Group Inc.
--**
--** Permission is hereby granted, free of charge, to any person obtaining a
--** copy of this software and/or associated documentation files (the
--** "Materials"), to deal in the Materials without restriction, including
--** without limitation the rights to use, copy, modify, merge, publish,
--** distribute, sublicense, and/or sell copies of the Materials, and to
--** permit persons to whom the Materials are 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 Materials.
--**
--** THE MATERIALS ARE 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
--** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
--
--** This header is generated from the Khronos OpenGL / OpenGL ES XML
--** API Registry. The current version of the Registry, generator scripts
--** used to make the header, and the header can be found at
--** https://github.com/KhronosGroup/OpenGL-Registry
--
-- Generated C header for:
-- * API: glx
-- * Versions considered: .*
-- * Versions emitted: 1\.[3-9]
-- * Default extensions included: glx
-- * Additional extensions included: _nomatch_^
-- * Extensions removed: _nomatch_^
--
type PFNGLXCREATECONTEXTATTRIBSARBPROC is access function
(arg1 : access Xlib.Display;
arg2 : GLX.GLXFBConfig;
arg3 : GLX.GLXContext;
arg4 : int;
arg5 : access int) return GLX.GLXContext
with Convention => C; -- /usr/include/GL/glxext.h:173
type PFNGLXGETGPUIDSAMDPROC is access function (arg1 : unsigned; arg2 : access unsigned) return unsigned
with Convention => C; -- /usr/include/GL/glxext.h:256
type PFNGLXGETGPUINFOAMDPROC is access function
(arg1 : unsigned;
arg2 : int;
arg3 : GL.GLenum;
arg4 : unsigned;
arg5 : System.Address) return int
with Convention => C; -- /usr/include/GL/glxext.h:257
type PFNGLXGETCONTEXTGPUIDAMDPROC is access function (arg1 : GLX.GLXContext) return unsigned
with Convention => C; -- /usr/include/GL/glxext.h:258
type PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC is access function (arg1 : unsigned; arg2 : GLX.GLXContext) return GLX.GLXContext
with Convention => C; -- /usr/include/GL/glxext.h:259
type PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC is access function
(arg1 : unsigned;
arg2 : GLX.GLXContext;
arg3 : access int) return GLX.GLXContext
with Convention => C; -- /usr/include/GL/glxext.h:260
type PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC is access function (arg1 : GLX.GLXContext) return int
with Convention => C; -- /usr/include/GL/glxext.h:261
type PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC is access function (arg1 : GLX.GLXContext) return int
with Convention => C; -- /usr/include/GL/glxext.h:262
type PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC is access function return GLX.GLXContext
with Convention => C; -- /usr/include/GL/glxext.h:263
type PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC is access procedure
(arg1 : GLX.GLXContext;
arg2 : GL.GLint;
arg3 : GL.GLint;
arg4 : GL.GLint;
arg5 : GL.GLint;
arg6 : GL.GLint;
arg7 : GL.GLint;
arg8 : GL.GLint;
arg9 : GL.GLint;
arg10 : GL.GLbitfield;
arg11 : GL.GLenum)
with Convention => C; -- /usr/include/GL/glxext.h:264
type PFNGLXGETCURRENTDISPLAYEXTPROC is access function return access Xlib.Display
with Convention => C; -- /usr/include/GL/glxext.h:317
type PFNGLXQUERYCONTEXTINFOEXTPROC is access function
(arg1 : access Xlib.Display;
arg2 : GLX.GLXContext;
arg3 : int;
arg4 : access int) return int
with Convention => C; -- /usr/include/GL/glxext.h:318
type PFNGLXGETCONTEXTIDEXTPROC is access function (arg1 : GLX.GLXContext) return GLX.GLXContextID
with Convention => C; -- /usr/include/GL/glxext.h:319
type PFNGLXIMPORTCONTEXTEXTPROC is access function (arg1 : access Xlib.Display; arg2 : GLX.GLXContextID) return GLX.GLXContext
with Convention => C; -- /usr/include/GL/glxext.h:320
type PFNGLXFREECONTEXTEXTPROC is access procedure (arg1 : access Xlib.Display; arg2 : GLX.GLXContext)
with Convention => C; -- /usr/include/GL/glxext.h:321
-- skipped anonymous struct anon_107
type GLXStereoNotifyEventEXT is record
c_type : aliased int; -- /usr/include/GL/glxext.h:343
serial : aliased unsigned_long; -- /usr/include/GL/glxext.h:344
send_event : aliased int; -- /usr/include/GL/glxext.h:345
the_display : access Xlib.Display; -- /usr/include/GL/glxext.h:346
extension : aliased int; -- /usr/include/GL/glxext.h:347
evtype : aliased int; -- /usr/include/GL/glxext.h:348
window : aliased GLX.GLXDrawable; -- /usr/include/GL/glxext.h:349
stereo_tree : aliased int; -- /usr/include/GL/glxext.h:350
end record
with Convention => C_Pass_By_Copy; -- /usr/include/GL/glxext.h:351
type PFNGLXSWAPINTERVALEXTPROC is access procedure
(arg1 : access Xlib.Display;
arg2 : GLX.GLXDrawable;
arg3 : int)
with Convention => C; -- /usr/include/GL/glxext.h:361
type PFNGLXBINDTEXIMAGEEXTPROC is access procedure
(arg1 : access Xlib.Display;
arg2 : GLX.GLXDrawable;
arg3 : int;
arg4 : access int)
with Convention => C; -- /usr/include/GL/glxext.h:407
type PFNGLXRELEASETEXIMAGEEXTPROC is access procedure
(arg1 : access Xlib.Display;
arg2 : GLX.GLXDrawable;
arg3 : int)
with Convention => C; -- /usr/include/GL/glxext.h:408
type PFNGLXGETAGPOFFSETMESAPROC is access function (arg1 : System.Address) return unsigned
with Convention => C; -- /usr/include/GL/glxext.h:452
type PFNGLXCOPYSUBBUFFERMESAPROC is access procedure
(arg1 : access Xlib.Display;
arg2 : GLX.GLXDrawable;
arg3 : int;
arg4 : int;
arg5 : int;
arg6 : int)
with Convention => C; -- /usr/include/GL/glxext.h:460
type PFNGLXCREATEGLXPIXMAPMESAPROC is access function
(arg1 : access Xlib.Display;
arg2 : access Xutil.XVisualInfo;
arg3 : X11.Pixmap;
arg4 : X11.Colormap) return GLX.GLXPixmap
with Convention => C; -- /usr/include/GL/glxext.h:468
type PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC is access function (arg1 : int; arg2 : access unsigned) return int
with Convention => C; -- /usr/include/GL/glxext.h:487
type PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC is access function (arg1 : int) return Interfaces.C.Strings.chars_ptr
with Convention => C; -- /usr/include/GL/glxext.h:488
type PFNGLXQUERYRENDERERINTEGERMESAPROC is access function
(arg1 : access Xlib.Display;
arg2 : int;
arg3 : int;
arg4 : int;
arg5 : access unsigned) return int
with Convention => C; -- /usr/include/GL/glxext.h:489
type PFNGLXQUERYRENDERERSTRINGMESAPROC is access function
(arg1 : access Xlib.Display;
arg2 : int;
arg3 : int;
arg4 : int) return Interfaces.C.Strings.chars_ptr
with Convention => C; -- /usr/include/GL/glxext.h:490
type PFNGLXRELEASEBUFFERSMESAPROC is access function (arg1 : access Xlib.Display; arg2 : GLX.GLXDrawable) return int
with Convention => C; -- /usr/include/GL/glxext.h:501
type PFNGLXSET3DFXMODEMESAPROC is access function (arg1 : GL.GLint) return GL.GLboolean
with Convention => C; -- /usr/include/GL/glxext.h:511
type PFNGLXGETSWAPINTERVALMESAPROC is access function return int
with Convention => C; -- /usr/include/GL/glxext.h:519
type PFNGLXSWAPINTERVALMESAPROC is access function (arg1 : unsigned) return int
with Convention => C; -- /usr/include/GL/glxext.h:520
type PFNGLXCOPYBUFFERSUBDATANVPROC is access procedure
(arg1 : access Xlib.Display;
arg2 : GLX.GLXContext;
arg3 : GLX.GLXContext;
arg4 : GL.GLenum;
arg5 : GL.GLenum;
arg6 : glext.GLintptr;
arg7 : glext.GLintptr;
arg8 : glext.GLsizeiptr)
with Convention => C; -- /usr/include/GL/glxext.h:529
type PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC is access procedure
(arg1 : access Xlib.Display;
arg2 : GLX.GLXContext;
arg3 : GLX.GLXContext;
arg4 : GL.GLuint;
arg5 : GL.GLuint;
arg6 : glext.GLintptr;
arg7 : glext.GLintptr;
arg8 : glext.GLsizeiptr)
with Convention => C; -- /usr/include/GL/glxext.h:530
type PFNGLXCOPYIMAGESUBDATANVPROC is access procedure
(arg1 : access Xlib.Display;
arg2 : GLX.GLXContext;
arg3 : GL.GLuint;
arg4 : GL.GLenum;
arg5 : GL.GLint;
arg6 : GL.GLint;
arg7 : GL.GLint;
arg8 : GL.GLint;
arg9 : GLX.GLXContext;
arg10 : GL.GLuint;
arg11 : GL.GLenum;
arg12 : GL.GLint;
arg13 : GL.GLint;
arg14 : GL.GLint;
arg15 : GL.GLint;
arg16 : GL.GLsizei;
arg17 : GL.GLsizei;
arg18 : GL.GLsizei)
with Convention => C; -- /usr/include/GL/glxext.h:539
type PFNGLXDELAYBEFORESWAPNVPROC is access function
(arg1 : access Xlib.Display;
arg2 : GLX.GLXDrawable;
arg3 : GL.GLfloat) return int
with Convention => C; -- /usr/include/GL/glxext.h:547
type PFNGLXENUMERATEVIDEODEVICESNVPROC is access function
(arg1 : access Xlib.Display;
arg2 : int;
arg3 : access int) return access unsigned
with Convention => C; -- /usr/include/GL/glxext.h:576
type PFNGLXBINDVIDEODEVICENVPROC is access function
(arg1 : access Xlib.Display;
arg2 : unsigned;
arg3 : unsigned;
arg4 : access int) return int
with Convention => C; -- /usr/include/GL/glxext.h:577
type PFNGLXJOINSWAPGROUPNVPROC is access function
(arg1 : access Xlib.Display;
arg2 : GLX.GLXDrawable;
arg3 : GL.GLuint) return int
with Convention => C; -- /usr/include/GL/glxext.h:591
type PFNGLXBINDSWAPBARRIERNVPROC is access function
(arg1 : access Xlib.Display;
arg2 : GL.GLuint;
arg3 : GL.GLuint) return int
with Convention => C; -- /usr/include/GL/glxext.h:592
type PFNGLXQUERYSWAPGROUPNVPROC is access function
(arg1 : access Xlib.Display;
arg2 : GLX.GLXDrawable;
arg3 : access GL.GLuint;
arg4 : access GL.GLuint) return int
with Convention => C; -- /usr/include/GL/glxext.h:593
type PFNGLXQUERYMAXSWAPGROUPSNVPROC is access function
(arg1 : access Xlib.Display;
arg2 : int;
arg3 : access GL.GLuint;
arg4 : access GL.GLuint) return int
with Convention => C; -- /usr/include/GL/glxext.h:594
type PFNGLXQUERYFRAMECOUNTNVPROC is access function
(arg1 : access Xlib.Display;
arg2 : int;
arg3 : access GL.GLuint) return int
with Convention => C; -- /usr/include/GL/glxext.h:595
type PFNGLXRESETFRAMECOUNTNVPROC is access function (arg1 : access Xlib.Display; arg2 : int) return int
with Convention => C; -- /usr/include/GL/glxext.h:596
subtype GLXVideoCaptureDeviceNV is X11.XID; -- /usr/include/GL/glxext.h:609
type PFNGLXBINDVIDEOCAPTUREDEVICENVPROC is access function
(arg1 : access Xlib.Display;
arg2 : unsigned;
arg3 : GLXVideoCaptureDeviceNV) return int
with Convention => C; -- /usr/include/GL/glxext.h:613
type PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC is access function
(arg1 : access Xlib.Display;
arg2 : int;
arg3 : access int) return access GLXVideoCaptureDeviceNV
with Convention => C; -- /usr/include/GL/glxext.h:614
type PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC is access procedure (arg1 : access Xlib.Display; arg2 : GLXVideoCaptureDeviceNV)
with Convention => C; -- /usr/include/GL/glxext.h:615
type PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC is access function
(arg1 : access Xlib.Display;
arg2 : GLXVideoCaptureDeviceNV;
arg3 : int;
arg4 : access int) return int
with Convention => C; -- /usr/include/GL/glxext.h:616
type PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC is access procedure (arg1 : access Xlib.Display; arg2 : GLXVideoCaptureDeviceNV)
with Convention => C; -- /usr/include/GL/glxext.h:617
subtype GLXVideoDeviceNV is unsigned; -- /usr/include/GL/glxext.h:629
type PFNGLXGETVIDEODEVICENVPROC is access function
(arg1 : access Xlib.Display;
arg2 : int;
arg3 : int;
arg4 : access GLXVideoDeviceNV) return int
with Convention => C; -- /usr/include/GL/glxext.h:640
type PFNGLXRELEASEVIDEODEVICENVPROC is access function
(arg1 : access Xlib.Display;
arg2 : int;
arg3 : GLXVideoDeviceNV) return int
with Convention => C; -- /usr/include/GL/glxext.h:641
type PFNGLXBINDVIDEOIMAGENVPROC is access function
(arg1 : access Xlib.Display;
arg2 : GLXVideoDeviceNV;
arg3 : GLX.GLXPbuffer;
arg4 : int) return int
with Convention => C; -- /usr/include/GL/glxext.h:642
type PFNGLXRELEASEVIDEOIMAGENVPROC is access function (arg1 : access Xlib.Display; arg2 : GLX.GLXPbuffer) return int
with Convention => C; -- /usr/include/GL/glxext.h:643
type PFNGLXSENDPBUFFERTOVIDEONVPROC is access function
(arg1 : access Xlib.Display;
arg2 : GLX.GLXPbuffer;
arg3 : int;
arg4 : access unsigned_long;
arg5 : GL.GLboolean) return int
with Convention => C; -- /usr/include/GL/glxext.h:644
type PFNGLXGETVIDEOINFONVPROC is access function
(arg1 : access Xlib.Display;
arg2 : int;
arg3 : GLXVideoDeviceNV;
arg4 : access unsigned_long;
arg5 : access unsigned_long) return int
with Convention => C; -- /usr/include/GL/glxext.h:645
-- This code block is duplicated in glext.h, so must be protected
-- Define int32_t, int64_t, and uint64_t types for UST/MSC
-- (as used in the GLX_OML_sync_control extension).
-- Fallback if nothing above works
type PFNGLXGETSYNCVALUESOMLPROC is access function
(arg1 : access Xlib.Display;
arg2 : GLX.GLXDrawable;
arg3 : access bits_stdint_intn_h.int64_t;
arg4 : access bits_stdint_intn_h.int64_t;
arg5 : access bits_stdint_intn_h.int64_t) return int
with Convention => C; -- /usr/include/GL/glxext.h:703
type PFNGLXGETMSCRATEOMLPROC is access function
(arg1 : access Xlib.Display;
arg2 : GLX.GLXDrawable;
arg3 : access bits_stdint_intn_h.int32_t;
arg4 : access bits_stdint_intn_h.int32_t) return int
with Convention => C; -- /usr/include/GL/glxext.h:704
type PFNGLXSWAPBUFFERSMSCOMLPROC is access function
(arg1 : access Xlib.Display;
arg2 : GLX.GLXDrawable;
arg3 : bits_stdint_intn_h.int64_t;
arg4 : bits_stdint_intn_h.int64_t;
arg5 : bits_stdint_intn_h.int64_t) return bits_stdint_intn_h.int64_t
with Convention => C; -- /usr/include/GL/glxext.h:705
type PFNGLXWAITFORMSCOMLPROC is access function
(arg1 : access Xlib.Display;
arg2 : GLX.GLXDrawable;
arg3 : bits_stdint_intn_h.int64_t;
arg4 : bits_stdint_intn_h.int64_t;
arg5 : bits_stdint_intn_h.int64_t;
arg6 : access bits_stdint_intn_h.int64_t;
arg7 : access bits_stdint_intn_h.int64_t;
arg8 : access bits_stdint_intn_h.int64_t) return int
with Convention => C; -- /usr/include/GL/glxext.h:706
type PFNGLXWAITFORSBCOMLPROC is access function
(arg1 : access Xlib.Display;
arg2 : GLX.GLXDrawable;
arg3 : bits_stdint_intn_h.int64_t;
arg4 : access bits_stdint_intn_h.int64_t;
arg5 : access bits_stdint_intn_h.int64_t;
arg6 : access bits_stdint_intn_h.int64_t) return int
with Convention => C; -- /usr/include/GL/glxext.h:707
subtype GLXPbufferSGIX is X11.XID; -- /usr/include/GL/glxext.h:736
type GLXFBConfigSGIX is access all GLX.uu_GLXFBConfigRec; -- /usr/include/GL/glxext.h:748
type PFNGLXGETFBCONFIGATTRIBSGIXPROC is access function
(arg1 : access Xlib.Display;
arg2 : GLXFBConfigSGIX;
arg3 : int;
arg4 : access int) return int
with Convention => C; -- /usr/include/GL/glxext.h:759
type PFNGLXCHOOSEFBCONFIGSGIXPROC is access function
(arg1 : access Xlib.Display;
arg2 : int;
arg3 : access int;
arg4 : access int) return System.Address
with Convention => C; -- /usr/include/GL/glxext.h:760
type PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC is access function
(arg1 : access Xlib.Display;
arg2 : GLXFBConfigSGIX;
arg3 : X11.Pixmap) return GLX.GLXPixmap
with Convention => C; -- /usr/include/GL/glxext.h:761
type PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC is access function
(arg1 : access Xlib.Display;
arg2 : GLXFBConfigSGIX;
arg3 : int;
arg4 : GLX.GLXContext;
arg5 : int) return GLX.GLXContext
with Convention => C; -- /usr/include/GL/glxext.h:762
type PFNGLXGETVISUALFROMFBCONFIGSGIXPROC is access function (arg1 : access Xlib.Display; arg2 : GLXFBConfigSGIX) return access Xutil.XVisualInfo
with Convention => C; -- /usr/include/GL/glxext.h:763
type PFNGLXGETFBCONFIGFROMVISUALSGIXPROC is access function (arg1 : access Xlib.Display; arg2 : access Xutil.XVisualInfo) return GLXFBConfigSGIX
with Convention => C; -- /usr/include/GL/glxext.h:764
-- Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]
-- skipped anonymous struct anon_109
subtype GLXHyperpipeNetworkSGIX_array8453 is Interfaces.C.char_array (0 .. 79);
type GLXHyperpipeNetworkSGIX is record
pipeName : aliased GLXHyperpipeNetworkSGIX_array8453; -- /usr/include/GL/glxext.h:778
networkId : aliased int; -- /usr/include/GL/glxext.h:779
end record
with Convention => C_Pass_By_Copy; -- /usr/include/GL/glxext.h:780
-- Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]
-- skipped anonymous struct anon_110
subtype GLXHyperpipeConfigSGIX_array8453 is Interfaces.C.char_array (0 .. 79);
type GLXHyperpipeConfigSGIX is record
pipeName : aliased GLXHyperpipeConfigSGIX_array8453; -- /usr/include/GL/glxext.h:782
channel : aliased int; -- /usr/include/GL/glxext.h:783
participationType : aliased unsigned; -- /usr/include/GL/glxext.h:784
timeSlice : aliased int; -- /usr/include/GL/glxext.h:785
end record
with Convention => C_Pass_By_Copy; -- /usr/include/GL/glxext.h:786
-- Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]
-- skipped anonymous struct anon_111
subtype GLXPipeRect_array8453 is Interfaces.C.char_array (0 .. 79);
type GLXPipeRect is record
pipeName : aliased GLXPipeRect_array8453; -- /usr/include/GL/glxext.h:788
srcXOrigin : aliased int; -- /usr/include/GL/glxext.h:789
srcYOrigin : aliased int; -- /usr/include/GL/glxext.h:789
srcWidth : aliased int; -- /usr/include/GL/glxext.h:789
srcHeight : aliased int; -- /usr/include/GL/glxext.h:789
destXOrigin : aliased int; -- /usr/include/GL/glxext.h:790
destYOrigin : aliased int; -- /usr/include/GL/glxext.h:790
destWidth : aliased int; -- /usr/include/GL/glxext.h:790
destHeight : aliased int; -- /usr/include/GL/glxext.h:790
end record
with Convention => C_Pass_By_Copy; -- /usr/include/GL/glxext.h:791
-- Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]
-- skipped anonymous struct anon_112
subtype GLXPipeRectLimits_array8453 is Interfaces.C.char_array (0 .. 79);
type GLXPipeRectLimits is record
pipeName : aliased GLXPipeRectLimits_array8453; -- /usr/include/GL/glxext.h:793
XOrigin : aliased int; -- /usr/include/GL/glxext.h:794
YOrigin : aliased int; -- /usr/include/GL/glxext.h:794
maxHeight : aliased int; -- /usr/include/GL/glxext.h:794
maxWidth : aliased int; -- /usr/include/GL/glxext.h:794
end record
with Convention => C_Pass_By_Copy; -- /usr/include/GL/glxext.h:795
type PFNGLXQUERYHYPERPIPENETWORKSGIXPROC is access function (arg1 : access Xlib.Display; arg2 : access int) return access GLXHyperpipeNetworkSGIX
with Convention => C; -- /usr/include/GL/glxext.h:806
type PFNGLXHYPERPIPECONFIGSGIXPROC is access function
(arg1 : access Xlib.Display;
arg2 : int;
arg3 : int;
arg4 : access GLXHyperpipeConfigSGIX;
arg5 : access int) return int
with Convention => C; -- /usr/include/GL/glxext.h:807
type PFNGLXQUERYHYPERPIPECONFIGSGIXPROC is access function
(arg1 : access Xlib.Display;
arg2 : int;
arg3 : access int) return access GLXHyperpipeConfigSGIX
with Convention => C; -- /usr/include/GL/glxext.h:808
type PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC is access function (arg1 : access Xlib.Display; arg2 : int) return int
with Convention => C; -- /usr/include/GL/glxext.h:809
type PFNGLXBINDHYPERPIPESGIXPROC is access function (arg1 : access Xlib.Display; arg2 : int) return int
with Convention => C; -- /usr/include/GL/glxext.h:810
type PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC is access function
(arg1 : access Xlib.Display;
arg2 : int;
arg3 : int;
arg4 : int;
arg5 : System.Address;
arg6 : System.Address) return int
with Convention => C; -- /usr/include/GL/glxext.h:811
type PFNGLXHYPERPIPEATTRIBSGIXPROC is access function
(arg1 : access Xlib.Display;
arg2 : int;
arg3 : int;
arg4 : int;
arg5 : System.Address) return int
with Convention => C; -- /usr/include/GL/glxext.h:812
type PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC is access function
(arg1 : access Xlib.Display;
arg2 : int;
arg3 : int;
arg4 : int;
arg5 : System.Address) return int
with Convention => C; -- /usr/include/GL/glxext.h:813
type PFNGLXCREATEGLXPBUFFERSGIXPROC is access function
(arg1 : access Xlib.Display;
arg2 : GLXFBConfigSGIX;
arg3 : unsigned;
arg4 : unsigned;
arg5 : access int) return GLXPbufferSGIX
with Convention => C; -- /usr/include/GL/glxext.h:853
type PFNGLXDESTROYGLXPBUFFERSGIXPROC is access procedure (arg1 : access Xlib.Display; arg2 : GLXPbufferSGIX)
with Convention => C; -- /usr/include/GL/glxext.h:854
type PFNGLXQUERYGLXPBUFFERSGIXPROC is access procedure
(arg1 : access Xlib.Display;
arg2 : GLXPbufferSGIX;
arg3 : int;
arg4 : access unsigned)
with Convention => C; -- /usr/include/GL/glxext.h:855
type PFNGLXSELECTEVENTSGIXPROC is access procedure
(arg1 : access Xlib.Display;
arg2 : GLX.GLXDrawable;
arg3 : unsigned_long)
with Convention => C; -- /usr/include/GL/glxext.h:856
type PFNGLXGETSELECTEDEVENTSGIXPROC is access procedure
(arg1 : access Xlib.Display;
arg2 : GLX.GLXDrawable;
arg3 : access unsigned_long)
with Convention => C; -- /usr/include/GL/glxext.h:857
type PFNGLXBINDSWAPBARRIERSGIXPROC is access procedure
(arg1 : access Xlib.Display;
arg2 : GLX.GLXDrawable;
arg3 : int)
with Convention => C; -- /usr/include/GL/glxext.h:869
type PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC is access function
(arg1 : access Xlib.Display;
arg2 : int;
arg3 : access int) return int
with Convention => C; -- /usr/include/GL/glxext.h:870
type PFNGLXJOINSWAPGROUPSGIXPROC is access procedure
(arg1 : access Xlib.Display;
arg2 : GLX.GLXDrawable;
arg3 : GLX.GLXDrawable)
with Convention => C; -- /usr/include/GL/glxext.h:879
type PFNGLXBINDCHANNELTOWINDOWSGIXPROC is access function
(arg1 : access Xlib.Display;
arg2 : int;
arg3 : int;
arg4 : X11.Window) return int
with Convention => C; -- /usr/include/GL/glxext.h:889
type PFNGLXCHANNELRECTSGIXPROC is access function
(arg1 : access Xlib.Display;
arg2 : int;
arg3 : int;
arg4 : int;
arg5 : int;
arg6 : int;
arg7 : int) return int
with Convention => C; -- /usr/include/GL/glxext.h:890
type PFNGLXQUERYCHANNELRECTSGIXPROC is access function
(arg1 : access Xlib.Display;
arg2 : int;
arg3 : int;
arg4 : access int;
arg5 : access int;
arg6 : access int;
arg7 : access int) return int
with Convention => C; -- /usr/include/GL/glxext.h:891
type PFNGLXQUERYCHANNELDELTASSGIXPROC is access function
(arg1 : access Xlib.Display;
arg2 : int;
arg3 : int;
arg4 : access int;
arg5 : access int;
arg6 : access int;
arg7 : access int) return int
with Convention => C; -- /usr/include/GL/glxext.h:892
type PFNGLXCHANNELRECTSYNCSGIXPROC is access function
(arg1 : access Xlib.Display;
arg2 : int;
arg3 : int;
arg4 : GL.GLenum) return int
with Convention => C; -- /usr/include/GL/glxext.h:893
subtype GLXVideoSourceSGIX is X11.XID; -- /usr/include/GL/glxext.h:905
type PFNGLXCUSHIONSGIPROC is access procedure
(arg1 : access Xlib.Display;
arg2 : X11.Window;
arg3 : float)
with Convention => C; -- /usr/include/GL/glxext.h:923
type PFNGLXMAKECURRENTREADSGIPROC is access function
(arg1 : access Xlib.Display;
arg2 : GLX.GLXDrawable;
arg3 : GLX.GLXDrawable;
arg4 : GLX.GLXContext) return int
with Convention => C; -- /usr/include/GL/glxext.h:931
type PFNGLXGETCURRENTREADDRAWABLESGIPROC is access function return GLX.GLXDrawable
with Convention => C; -- /usr/include/GL/glxext.h:932
type PFNGLXSWAPINTERVALSGIPROC is access function (arg1 : int) return int
with Convention => C; -- /usr/include/GL/glxext.h:941
type PFNGLXGETVIDEOSYNCSGIPROC is access function (arg1 : access unsigned) return int
with Convention => C; -- /usr/include/GL/glxext.h:949
type PFNGLXWAITVIDEOSYNCSGIPROC is access function
(arg1 : int;
arg2 : int;
arg3 : access unsigned) return int
with Convention => C; -- /usr/include/GL/glxext.h:950
type PFNGLXGETTRANSPARENTINDEXSUNPROC is access function
(arg1 : access Xlib.Display;
arg2 : X11.Window;
arg3 : X11.Window;
arg4 : access unsigned_long) return int
with Convention => C; -- /usr/include/GL/glxext.h:959
end glxext;
|
DrenfongWong/tkm-rpc | Ada | 1,024 | adb | with Tkmrpc.Servers.Ike;
with Tkmrpc.Results;
with Tkmrpc.Request.Ike.Isa_Reset.Convert;
with Tkmrpc.Response.Ike.Isa_Reset.Convert;
package body Tkmrpc.Operation_Handlers.Ike.Isa_Reset is
-------------------------------------------------------------------------
procedure Handle (Req : Request.Data_Type; Res : out Response.Data_Type) is
Specific_Req : Request.Ike.Isa_Reset.Request_Type;
Specific_Res : Response.Ike.Isa_Reset.Response_Type;
begin
Specific_Res := Response.Ike.Isa_Reset.Null_Response;
Specific_Req := Request.Ike.Isa_Reset.Convert.From_Request (S => Req);
if Specific_Req.Data.Isa_Id'Valid then
Servers.Ike.Isa_Reset
(Result => Specific_Res.Header.Result,
Isa_Id => Specific_Req.Data.Isa_Id);
Res :=
Response.Ike.Isa_Reset.Convert.To_Response (S => Specific_Res);
else
Res.Header.Result := Results.Invalid_Parameter;
end if;
end Handle;
end Tkmrpc.Operation_Handlers.Ike.Isa_Reset;
|
reznikmm/matreshka | Ada | 4,229 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Nodes;
with XML.DOM.Attributes.Internals;
package body ODF.DOM.Attributes.FO.Border_Top.Internals is
------------
-- Create --
------------
function Create
(Node : Matreshka.ODF_Attributes.FO.Border_Top.FO_Border_Top_Access)
return ODF.DOM.Attributes.FO.Border_Top.ODF_FO_Border_Top is
begin
return
(XML.DOM.Attributes.Internals.Create
(Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record);
end Create;
----------
-- Wrap --
----------
function Wrap
(Node : Matreshka.ODF_Attributes.FO.Border_Top.FO_Border_Top_Access)
return ODF.DOM.Attributes.FO.Border_Top.ODF_FO_Border_Top is
begin
return
(XML.DOM.Attributes.Internals.Wrap
(Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record);
end Wrap;
end ODF.DOM.Attributes.FO.Border_Top.Internals;
|
optikos/oasis | Ada | 2,801 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Anonymous_Access_Definitions;
with Program.Lexical_Elements;
with Program.Elements.Parameter_Specifications;
package Program.Elements.Anonymous_Access_To_Procedures is
pragma Pure (Program.Elements.Anonymous_Access_To_Procedures);
type Anonymous_Access_To_Procedure is
limited interface
and Program.Elements.Anonymous_Access_Definitions
.Anonymous_Access_Definition;
type Anonymous_Access_To_Procedure_Access is
access all Anonymous_Access_To_Procedure'Class with Storage_Size => 0;
not overriding function Parameters
(Self : Anonymous_Access_To_Procedure)
return Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access is abstract;
not overriding function Has_Not_Null
(Self : Anonymous_Access_To_Procedure)
return Boolean is abstract;
not overriding function Has_Protected
(Self : Anonymous_Access_To_Procedure)
return Boolean is abstract;
type Anonymous_Access_To_Procedure_Text is limited interface;
type Anonymous_Access_To_Procedure_Text_Access is
access all Anonymous_Access_To_Procedure_Text'Class
with Storage_Size => 0;
not overriding function To_Anonymous_Access_To_Procedure_Text
(Self : aliased in out Anonymous_Access_To_Procedure)
return Anonymous_Access_To_Procedure_Text_Access is abstract;
not overriding function Not_Token
(Self : Anonymous_Access_To_Procedure_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Null_Token
(Self : Anonymous_Access_To_Procedure_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Access_Token
(Self : Anonymous_Access_To_Procedure_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Protected_Token
(Self : Anonymous_Access_To_Procedure_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Procedure_Token
(Self : Anonymous_Access_To_Procedure_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Left_Bracket_Token
(Self : Anonymous_Access_To_Procedure_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Right_Bracket_Token
(Self : Anonymous_Access_To_Procedure_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
end Program.Elements.Anonymous_Access_To_Procedures;
|
AdaCore/Ada-IntelliJ | Ada | 2,709 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT EXAMPLE --
-- --
-- Copyright (C) 2014, 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. --
-- --
------------------------------------------------------------------------------
-- The "last chance handler" (LCH) is the routine automatically called when
-- any exception is propagated. It is not intended to be called directly. The
-- system-defined LCH simply stops the entire application, ungracefully.
-- Users may redefine it, however, as we have done here. This one turns off
-- all but the red LED, which it turns on, and then goes into an infinite
-- loop.
with System;
package Last_Chance_Handler is
procedure Last_Chance_Handler (Msg : System.Address; Line : Integer);
pragma Export (C, Last_Chance_Handler, "__gnat_last_chance_handler");
pragma No_Return (Last_Chance_Handler);
end Last_Chance_Handler;
|
faelys/natools | Ada | 2,565 | adb | ------------------------------------------------------------------------------
-- Copyright (c) 2016, Natacha Porté --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
with GNAT.Perfect_Hash_Generators;
package body Natools.Smaz_Tools.GNAT is
package Perfect_Hash_Generators
renames Standard.GNAT.Perfect_Hash_Generators;
procedure Build_Perfect_Hash
(List : in String_Lists.List;
Package_Name : in String)
is
Seed : Natural := 2;
NK : constant Float := Float (String_Lists.Length (List));
NV : Natural := Natural (String_Lists.Length (List)) * 2 + 1;
Retries_Before_Expand : constant := 2;
begin
for S of List loop
Perfect_Hash_Generators.Insert (S);
end loop;
Expanding_Retries :
loop
Retires_Without_Expand :
for I in 1 .. Retries_Before_Expand loop
begin
Perfect_Hash_Generators.Initialize (Seed, Float (NV) / NK);
Perfect_Hash_Generators.Compute;
exit Expanding_Retries;
exception
when Perfect_Hash_Generators.Too_Many_Tries => null;
end;
Seed := Seed * NV;
end loop Retires_Without_Expand;
NV := NV + 1;
Seed := NV;
end loop Expanding_Retries;
Perfect_Hash_Generators.Produce (Package_Name);
Perfect_Hash_Generators.Finalize;
exception
when others =>
Perfect_Hash_Generators.Finalize;
raise;
end Build_Perfect_Hash;
end Natools.Smaz_Tools.GNAT;
|
wookey-project/ewok-legacy | Ada | 1,062 | ads | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with ewok.tasks_shared;
package ewok.syscalls.log
with spark_mode => off
is
procedure sys_log
(caller_id : in ewok.tasks_shared.t_task_id;
params : in out t_parameters;
mode : in ewok.tasks_shared.t_task_mode);
end ewok.syscalls.log;
|
ohenley/ada-util | Ada | 6,799 | ads | -----------------------------------------------------------------------
-- util-http-clients-web -- HTTP Clients with AWS implementation
-- Copyright (C) 2011, 2012, 2017 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
private with AWS.Headers;
private with AWS.Response;
private with AWS.Client;
package Util.Http.Clients.Web is
-- Register the Http manager.
procedure Register;
private
type AWS_Http_Manager is new Http_Manager with record
Timeout : Duration := 60.0;
end record;
type AWS_Http_Manager_Access is access all Http_Manager'Class;
procedure Create (Manager : in AWS_Http_Manager;
Http : in out Client'Class);
overriding
procedure Do_Get (Manager : in AWS_Http_Manager;
Http : in Client'Class;
URI : in String;
Reply : out Response'Class);
overriding
procedure Do_Post (Manager : in AWS_Http_Manager;
Http : in Client'Class;
URI : in String;
Data : in String;
Reply : out Response'Class);
overriding
procedure Do_Put (Manager : in AWS_Http_Manager;
Http : in Client'Class;
URI : in String;
Data : in String;
Reply : out Response'Class);
overriding
procedure Do_Delete (Manager : in AWS_Http_Manager;
Http : in Client'Class;
URI : in String;
Reply : out Response'Class);
-- Set the timeout for the connection.
overriding
procedure Set_Timeout (Manager : in AWS_Http_Manager;
Http : in Client'Class;
Timeout : in Duration);
type AWS_Http_Request is new Http_Request with record
Timeouts : AWS.Client.Timeouts_Values := AWS.Client.No_Timeout;
Headers : AWS.Headers.List;
end record;
type AWS_Http_Request_Access is access all AWS_Http_Request'Class;
-- Returns a boolean indicating whether the named request header has already
-- been set.
overriding
function Contains_Header (Http : in AWS_Http_Request;
Name : in String) return Boolean;
-- Returns the value of the specified request header as a String. If the request
-- did not include a header of the specified name, this method returns null.
-- If there are multiple headers with the same name, this method returns the
-- first head in the request. The header name is case insensitive. You can use
-- this method with any response header.
overriding
function Get_Header (Request : in AWS_Http_Request;
Name : in String) return String;
-- Sets a request header with the given name and value. If the header had already
-- been set, the new value overwrites the previous one. The containsHeader
-- method can be used to test for the presence of a header before setting its value.
overriding
procedure Set_Header (Http : in out AWS_Http_Request;
Name : in String;
Value : in String);
-- Adds a request header with the given name and value.
-- This method allows request headers to have multiple values.
overriding
procedure Add_Header (Http : in out AWS_Http_Request;
Name : in String;
Value : in String);
-- Iterate over the request headers and executes the <b>Process</b> procedure.
overriding
procedure Iterate_Headers (Request : in AWS_Http_Request;
Process : not null access
procedure (Name : in String;
Value : in String));
type AWS_Http_Response is new Http_Response with record
Data : AWS.Response.Data;
end record;
type AWS_Http_Response_Access is access all AWS_Http_Response'Class;
-- Returns a boolean indicating whether the named response header has already
-- been set.
overriding
function Contains_Header (Reply : in AWS_Http_Response;
Name : in String) return Boolean;
-- Returns the value of the specified response header as a String. If the response
-- did not include a header of the specified name, this method returns null.
-- If there are multiple headers with the same name, this method returns the
-- first head in the request. The header name is case insensitive. You can use
-- this method with any response header.
overriding
function Get_Header (Reply : in AWS_Http_Response;
Name : in String) return String;
-- Sets a message header with the given name and value. If the header had already
-- been set, the new value overwrites the previous one. The containsHeader
-- method can be used to test for the presence of a header before setting its value.
overriding
procedure Set_Header (Reply : in out AWS_Http_Response;
Name : in String;
Value : in String);
-- Adds a request header with the given name and value.
-- This method allows request headers to have multiple values.
overriding
procedure Add_Header (Reply : in out AWS_Http_Response;
Name : in String;
Value : in String);
-- Iterate over the response headers and executes the <b>Process</b> procedure.
overriding
procedure Iterate_Headers (Reply : in AWS_Http_Response;
Process : not null access
procedure (Name : in String;
Value : in String));
-- Get the response body as a string.
function Get_Body (Reply : in AWS_Http_Response) return String;
-- Get the response status code.
overriding
function Get_Status (Reply : in AWS_Http_Response) return Natural;
end Util.Http.Clients.Web;
|
optikos/oasis | Ada | 3,667 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Elements.Defining_Operator_Symbols;
with Program.Element_Visitors;
package Program.Nodes.Defining_Operator_Symbols is
pragma Preelaborate;
type Defining_Operator_Symbol is
new Program.Nodes.Node
and Program.Elements.Defining_Operator_Symbols
.Defining_Operator_Symbol
and Program.Elements.Defining_Operator_Symbols
.Defining_Operator_Symbol_Text
with private;
function Create
(Operator_Symbol_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Defining_Operator_Symbol;
type Implicit_Defining_Operator_Symbol is
new Program.Nodes.Node
and Program.Elements.Defining_Operator_Symbols
.Defining_Operator_Symbol
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_Operator_Symbol
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Defining_Operator_Symbol is
abstract new Program.Nodes.Node
and Program.Elements.Defining_Operator_Symbols.Defining_Operator_Symbol
with null record;
procedure Initialize
(Self : aliased in out Base_Defining_Operator_Symbol'Class);
overriding procedure Visit
(Self : not null access Base_Defining_Operator_Symbol;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Is_Defining_Operator_Symbol_Element
(Self : Base_Defining_Operator_Symbol)
return Boolean;
overriding function Is_Defining_Name_Element
(Self : Base_Defining_Operator_Symbol)
return Boolean;
type Defining_Operator_Symbol is
new Base_Defining_Operator_Symbol
and Program.Elements.Defining_Operator_Symbols
.Defining_Operator_Symbol_Text
with record
Operator_Symbol_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Defining_Operator_Symbol_Text
(Self : aliased in out Defining_Operator_Symbol)
return Program.Elements.Defining_Operator_Symbols
.Defining_Operator_Symbol_Text_Access;
overriding function Operator_Symbol_Token
(Self : Defining_Operator_Symbol)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Image (Self : Defining_Operator_Symbol) return Text;
type Implicit_Defining_Operator_Symbol is
new Base_Defining_Operator_Symbol
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Defining_Operator_Symbol_Text
(Self : aliased in out Implicit_Defining_Operator_Symbol)
return Program.Elements.Defining_Operator_Symbols
.Defining_Operator_Symbol_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Defining_Operator_Symbol)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Defining_Operator_Symbol)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Defining_Operator_Symbol)
return Boolean;
overriding function Image
(Self : Implicit_Defining_Operator_Symbol)
return Text;
end Program.Nodes.Defining_Operator_Symbols;
|
stcarrez/ada-awa | Ada | 987 | ads | -----------------------------------------------------------------------
-- awa-events-action_method -- AWA Events
-- Copyright (C) 2012 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with EL.Methods.Proc_In;
package AWA.Events.Action_Method is
new EL.Methods.Proc_In (Param1_Type => AWA.Events.Module_Event'Class);
|
zhmu/ananas | Ada | 468 | adb | -- { dg-do compile }
with Interfaces.C; use Interfaces.C;
procedure Object_Overflow5 is
procedure Proc (c : Character) is begin null; end;
type Index_T is new ptrdiff_t range 0 .. ptrdiff_t'Last;
type Arr is array(Index_T range <>) of Character;
type Rec (Size: Index_T := 6) is record -- { dg-warning "Storage_Error" }
A: Arr (0..Size);
end record;
Obj : Rec; -- { dg-warning "Storage_Error" }
begin
Obj.A(1) := 'a';
Proc (Obj.A(1));
end;
|
persan/gprTools | Ada | 22 | ads | package p1 is
end p1;
|
AaronC98/PlaneSystem | Ada | 3,248 | ads | ------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2008-2012, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
------------------------------------------------------------------------------
with AWS.Headers;
with AWS.Messages;
package AWS.SMTP.Messages is
-- SMTP headers
subtype Header_Name is String;
From_Token : constant Header_Name := "From";
To_Token : constant Header_Name := "To";
Message_Id_Token : constant Header_Name := "Message-ID";
Subject_Token : constant Header_Name := "Subject";
MIME_Version_Token : constant Header_Name := "MIME-Version";
Content_Type_Token : constant Header_Name :=
AWS.Messages.Content_Type_Token;
Date_Token : constant Header_Name :=
AWS.Messages.Date_Token;
-- A message as reported by the server
type Data is private;
function Message_Body (Message : Data) return String;
-- Returns the message body
function Headers (Message : Data) return Headers.List;
-- Returns the SMTP headers
private
type Data is record
Message_Body : Unbounded_String;
Headers : AWS.Headers.List;
end record;
end AWS.SMTP.Messages;
|
reznikmm/matreshka | Ada | 26,346 | 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_Add_Variable_Value_Actions is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Enter_Add_Variable_Value_Action
(AMF.UML.Add_Variable_Value_Actions.UML_Add_Variable_Value_Action_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Leave_Add_Variable_Value_Action
(AMF.UML.Add_Variable_Value_Actions.UML_Add_Variable_Value_Action_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then
AMF.Visitors.UML_Iterators.UML_Iterator'Class
(Iterator).Visit_Add_Variable_Value_Action
(Visitor,
AMF.UML.Add_Variable_Value_Actions.UML_Add_Variable_Value_Action_Access (Self),
Control);
end if;
end Visit_Element;
-------------------
-- Get_Insert_At --
-------------------
overriding function Get_Insert_At
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Input_Pins.UML_Input_Pin_Access is
begin
return
AMF.UML.Input_Pins.UML_Input_Pin_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Insert_At
(Self.Element)));
end Get_Insert_At;
-------------------
-- Set_Insert_At --
-------------------
overriding procedure Set_Insert_At
(Self : not null access UML_Add_Variable_Value_Action_Proxy;
To : AMF.UML.Input_Pins.UML_Input_Pin_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Insert_At
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Insert_At;
------------------------
-- Get_Is_Replace_All --
------------------------
overriding function Get_Is_Replace_All
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Replace_All
(Self.Element);
end Get_Is_Replace_All;
------------------------
-- Set_Is_Replace_All --
------------------------
overriding procedure Set_Is_Replace_All
(Self : not null access UML_Add_Variable_Value_Action_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Replace_All
(Self.Element, To);
end Set_Is_Replace_All;
---------------
-- Get_Value --
---------------
overriding function Get_Value
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Input_Pins.UML_Input_Pin_Access is
begin
return
AMF.UML.Input_Pins.UML_Input_Pin_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Value
(Self.Element)));
end Get_Value;
---------------
-- Set_Value --
---------------
overriding procedure Set_Value
(Self : not null access UML_Add_Variable_Value_Action_Proxy;
To : AMF.UML.Input_Pins.UML_Input_Pin_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Value
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Value;
------------------
-- Get_Variable --
------------------
overriding function Get_Variable
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Variables.UML_Variable_Access is
begin
return
AMF.UML.Variables.UML_Variable_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Variable
(Self.Element)));
end Get_Variable;
------------------
-- Set_Variable --
------------------
overriding procedure Set_Variable
(Self : not null access UML_Add_Variable_Value_Action_Proxy;
To : AMF.UML.Variables.UML_Variable_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Variable
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Variable;
-----------------
-- Get_Context --
-----------------
overriding function Get_Context
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Classifiers.UML_Classifier_Access is
begin
return
AMF.UML.Classifiers.UML_Classifier_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Context
(Self.Element)));
end Get_Context;
---------------
-- Get_Input --
---------------
overriding function Get_Input
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Input_Pins.Collections.Ordered_Set_Of_UML_Input_Pin is
begin
return
AMF.UML.Input_Pins.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Input
(Self.Element)));
end Get_Input;
------------------------------
-- Get_Is_Locally_Reentrant --
------------------------------
overriding function Get_Is_Locally_Reentrant
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Locally_Reentrant
(Self.Element);
end Get_Is_Locally_Reentrant;
------------------------------
-- Set_Is_Locally_Reentrant --
------------------------------
overriding procedure Set_Is_Locally_Reentrant
(Self : not null access UML_Add_Variable_Value_Action_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Locally_Reentrant
(Self.Element, To);
end Set_Is_Locally_Reentrant;
-----------------------------
-- Get_Local_Postcondition --
-----------------------------
overriding function Get_Local_Postcondition
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is
begin
return
AMF.UML.Constraints.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Postcondition
(Self.Element)));
end Get_Local_Postcondition;
----------------------------
-- Get_Local_Precondition --
----------------------------
overriding function Get_Local_Precondition
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is
begin
return
AMF.UML.Constraints.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Precondition
(Self.Element)));
end Get_Local_Precondition;
----------------
-- Get_Output --
----------------
overriding function Get_Output
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Output_Pins.Collections.Ordered_Set_Of_UML_Output_Pin is
begin
return
AMF.UML.Output_Pins.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Output
(Self.Element)));
end Get_Output;
-----------------
-- Get_Handler --
-----------------
overriding function Get_Handler
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Exception_Handlers.Collections.Set_Of_UML_Exception_Handler is
begin
return
AMF.UML.Exception_Handlers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Handler
(Self.Element)));
end Get_Handler;
------------------
-- Get_Activity --
------------------
overriding function Get_Activity
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Activities.UML_Activity_Access is
begin
return
AMF.UML.Activities.UML_Activity_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Activity
(Self.Element)));
end Get_Activity;
------------------
-- Set_Activity --
------------------
overriding procedure Set_Activity
(Self : not null access UML_Add_Variable_Value_Action_Proxy;
To : AMF.UML.Activities.UML_Activity_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Activity
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Activity;
------------------
-- Get_In_Group --
------------------
overriding function Get_In_Group
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Activity_Groups.Collections.Set_Of_UML_Activity_Group is
begin
return
AMF.UML.Activity_Groups.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Group
(Self.Element)));
end Get_In_Group;
---------------------------------
-- Get_In_Interruptible_Region --
---------------------------------
overriding function Get_In_Interruptible_Region
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Interruptible_Activity_Regions.Collections.Set_Of_UML_Interruptible_Activity_Region is
begin
return
AMF.UML.Interruptible_Activity_Regions.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Interruptible_Region
(Self.Element)));
end Get_In_Interruptible_Region;
----------------------
-- Get_In_Partition --
----------------------
overriding function Get_In_Partition
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Activity_Partitions.Collections.Set_Of_UML_Activity_Partition is
begin
return
AMF.UML.Activity_Partitions.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Partition
(Self.Element)));
end Get_In_Partition;
----------------------------
-- Get_In_Structured_Node --
----------------------------
overriding function Get_In_Structured_Node
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access is
begin
return
AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Structured_Node
(Self.Element)));
end Get_In_Structured_Node;
----------------------------
-- Set_In_Structured_Node --
----------------------------
overriding procedure Set_In_Structured_Node
(Self : not null access UML_Add_Variable_Value_Action_Proxy;
To : AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_In_Structured_Node
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_In_Structured_Node;
------------------
-- Get_Incoming --
------------------
overriding function Get_Incoming
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is
begin
return
AMF.UML.Activity_Edges.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Incoming
(Self.Element)));
end Get_Incoming;
------------------
-- Get_Outgoing --
------------------
overriding function Get_Outgoing
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is
begin
return
AMF.UML.Activity_Edges.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Outgoing
(Self.Element)));
end Get_Outgoing;
------------------------
-- Get_Redefined_Node --
------------------------
overriding function Get_Redefined_Node
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Activity_Nodes.Collections.Set_Of_UML_Activity_Node is
begin
return
AMF.UML.Activity_Nodes.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Node
(Self.Element)));
end Get_Redefined_Node;
-----------------
-- Get_Is_Leaf --
-----------------
overriding function Get_Is_Leaf
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf
(Self.Element);
end Get_Is_Leaf;
-----------------
-- Set_Is_Leaf --
-----------------
overriding procedure Set_Is_Leaf
(Self : not null access UML_Add_Variable_Value_Action_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Leaf
(Self.Element, To);
end Set_Is_Leaf;
---------------------------
-- Get_Redefined_Element --
---------------------------
overriding function Get_Redefined_Element
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is
begin
return
AMF.UML.Redefinable_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Element
(Self.Element)));
end Get_Redefined_Element;
------------------------------
-- Get_Redefinition_Context --
------------------------------
overriding function Get_Redefinition_Context
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
begin
return
AMF.UML.Classifiers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefinition_Context
(Self.Element)));
end Get_Redefinition_Context;
---------------------------
-- Get_Client_Dependency --
---------------------------
overriding function Get_Client_Dependency
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
begin
return
AMF.UML.Dependencies.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency
(Self.Element)));
end Get_Client_Dependency;
-------------------------
-- Get_Name_Expression --
-------------------------
overriding function Get_Name_Expression
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access is
begin
return
AMF.UML.String_Expressions.UML_String_Expression_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression
(Self.Element)));
end Get_Name_Expression;
-------------------------
-- Set_Name_Expression --
-------------------------
overriding procedure Set_Name_Expression
(Self : not null access UML_Add_Variable_Value_Action_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Name_Expression;
-------------------
-- Get_Namespace --
-------------------
overriding function Get_Namespace
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
return
AMF.UML.Namespaces.UML_Namespace_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace
(Self.Element)));
end Get_Namespace;
------------------------
-- Get_Qualified_Name --
------------------------
overriding function Get_Qualified_Name
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.Optional_String is
begin
declare
use type Matreshka.Internals.Strings.Shared_String_Access;
Aux : constant Matreshka.Internals.Strings.Shared_String_Access
:= AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
begin
if Aux = null then
return (Is_Empty => True);
else
return (False, League.Strings.Internals.Create (Aux));
end if;
end;
end Get_Qualified_Name;
-------------
-- Context --
-------------
overriding function Context
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Classifiers.UML_Classifier_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Context unimplemented");
raise Program_Error with "Unimplemented procedure UML_Add_Variable_Value_Action_Proxy.Context";
return Context (Self);
end Context;
------------------------
-- Is_Consistent_With --
------------------------
overriding function Is_Consistent_With
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy;
Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented");
raise Program_Error with "Unimplemented procedure UML_Add_Variable_Value_Action_Proxy.Is_Consistent_With";
return Is_Consistent_With (Self, Redefinee);
end Is_Consistent_With;
-----------------------------------
-- Is_Redefinition_Context_Valid --
-----------------------------------
overriding function Is_Redefinition_Context_Valid
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy;
Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented");
raise Program_Error with "Unimplemented procedure UML_Add_Variable_Value_Action_Proxy.Is_Redefinition_Context_Valid";
return Is_Redefinition_Context_Valid (Self, Redefined);
end Is_Redefinition_Context_Valid;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
raise Program_Error with "Unimplemented procedure UML_Add_Variable_Value_Action_Proxy.All_Owning_Packages";
return All_Owning_Packages (Self);
end All_Owning_Packages;
-----------------------------
-- Is_Distinguishable_From --
-----------------------------
overriding function Is_Distinguishable_From
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
raise Program_Error with "Unimplemented procedure UML_Add_Variable_Value_Action_Proxy.Is_Distinguishable_From";
return Is_Distinguishable_From (Self, N, Ns);
end Is_Distinguishable_From;
---------------
-- Namespace --
---------------
overriding function Namespace
(Self : not null access constant UML_Add_Variable_Value_Action_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
raise Program_Error with "Unimplemented procedure UML_Add_Variable_Value_Action_Proxy.Namespace";
return Namespace (Self);
end Namespace;
end AMF.Internals.UML_Add_Variable_Value_Actions;
|
kontena/ruby-packer | Ada | 3,585 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Text_IO.Aux --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control:
-- $Revision: 1.14 $
-- $Date: 2009/12/26 17:38:58 $
-- Binding Version 01.00
------------------------------------------------------------------------------
private package Terminal_Interface.Curses.Text_IO.Aux is
-- pragma Preelaborate (Aux);
-- This routine is called from the Text_IO output routines for numeric
-- and enumeration types.
--
procedure Put_Buf
(Win : Window; -- The output window
Buf : String; -- The buffer containing the text
Width : Field; -- The width of the output field
Signal : Boolean := True; -- If true, we raise Layout_Error
Ljust : Boolean := False); -- The Buf is left justified
end Terminal_Interface.Curses.Text_IO.Aux;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.