repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
AdaCore/gpr | Ada | 56 | adb | with ABC.Plop;
procedure Tst is
begin
null;
end Tst;
|
reznikmm/matreshka | Ada | 4,067 | 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.Style_Wrap_Contour_Mode_Attributes;
package Matreshka.ODF_Style.Wrap_Contour_Mode_Attributes is
type Style_Wrap_Contour_Mode_Attribute_Node is
new Matreshka.ODF_Style.Abstract_Style_Attribute_Node
and ODF.DOM.Style_Wrap_Contour_Mode_Attributes.ODF_Style_Wrap_Contour_Mode_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Style_Wrap_Contour_Mode_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Style_Wrap_Contour_Mode_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Style.Wrap_Contour_Mode_Attributes;
|
onox/orka | Ada | 747 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2022 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package Orka.SIMD.AVX.Longs.Random is
pragma Pure;
end Orka.SIMD.AVX.Longs.Random;
|
AdaCore/gpr | Ada | 12,867 | ads | ------------------------------------------------------------------------------
-- --
-- GPR2 PROJECT MANAGER --
-- --
-- Copyright (C) 2019-2023, AdaCore --
-- --
-- This is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. This software is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public --
-- License for more details. You should have received a copy of the GNU --
-- General Public License distributed with GNAT; see file COPYING. If not, --
-- see <http://www.gnu.org/licenses/>. --
-- --
------------------------------------------------------------------------------
with Ada.Strings.Unbounded;
with GNAT.OS_Lib;
with GNAT.Sockets;
with GPR2.Containers;
with GPR2.Time_Stamp;
private with Ada.Finalization;
package GPR2.Compilation.Protocol is
pragma Warnings (Off, "already use-visible");
use Ada.Strings.Unbounded;
pragma Warnings (On, "already use-visible");
use GNAT;
use GNAT.Sockets;
Wrong_Command : exception;
-- Raised when a command cannot be parsed
WD_Path_Tag : constant String := "<1>";
-- The string replacing root working diretory of full path name, see
-- Set_Rewrite below.
CD_Path_Tag : constant String := "<2>";
-- The string replacing the compiler root directory, see Set_Rewrite below
Any_OS : constant String := "any";
-- Used when OS check is not necessary, for example gprclean does not need
-- this check. It is safe to clean-up a Solaris slave from a Windows
-- master.
--
-- Communication
--
type Communication_Channel is tagged private;
-- A communication channel, this channel is used for any communication
-- between the build master and the slaves.
No_Channel : constant Communication_Channel;
function Create
(Sock : Socket_Type;
Virtual : Boolean := False) return Communication_Channel;
-- Create a communication channel. If Virtual is True it only creates a
-- virtual channel which cannot be used as a regular channel. This is
-- meant to be used as a key for comparing against another channel.
function Sock (Channel : Communication_Channel) return Socket_Type;
pragma Inline (Sock);
procedure Close (Channel : in out Communication_Channel);
-- Close the channel
procedure Set_Rewrite_WD
(Channel : in out Communication_Channel; Path : String);
-- Add rewrite information for the working directory. This is needed to
-- translate paths to/from build master and slave working directories.
procedure Set_Rewrite_CD
(Channel : in out Communication_Channel; Path : String);
-- Add rewrite information for the compiler directory. This is needed to
-- translate paths to/from compilers path in build master and in slave.
-- This is needed to be able to find the files from other projects
-- installed with the compiler. The translated paths are in the
-- gprbuild mapping file.
procedure Clear_Rewrite (Channel : in out Communication_Channel);
-- Remove any rewrite information from the channel
function Translate_Receive
(Channel : Communication_Channel; Str : String) return String;
-- Translate Str using Channel rewrite
function Translate_Send
(Channel : Communication_Channel; Str : String) return String;
-- Translate Str using Channel rewrite
--
-- Command
--
type Command is tagged private;
type Command_Kind is
(EX, -- execute a command
AK, -- acknowledge received command (with pid)
TS, -- a file timestamp
ES, -- end of file timestamp
FL, -- a file, content being rewritten from builder/slave PATH
FR, -- a RAW file, no rewrite taking place
OK, -- compilation ok (with optional pid)
KO, -- compilation failed (with optional pid)
CX, -- master context
CU, -- clean-up request
DP, -- display output
EC, -- end of compilation
SI, -- a signal as been detected (like EC but no ACK needed)
SY, -- synchronization requested
IR, -- information requested
PG); -- PING just to know if the slave is listening
function Kind (Cmd : Command) return Command_Kind;
pragma Inline (Kind);
function Args (Cmd : Command) return OS_Lib.Argument_List_Access;
pragma Inline (Args);
-- Returns all arguments for Cmd
function Output (Cmd : Command) return Unbounded_String;
pragma Inline (Output);
-- Returns the output for a DP command
function Get_Command (Channel : Communication_Channel'Class) return Command;
-- Wait and return a command as parsed from the communication channel
Invalid_Pid : constant := -1;
--
-- From GPRbuild / GPRremote
--
procedure Send_Context
(Channel : Communication_Channel;
Target : String;
Project_Name : String;
Build_Env : String;
Sync : Boolean;
Hash : String;
Included_Artifact_Patterns : String);
-- Send initial context to the slave
procedure Send_Exec
(Channel : Communication_Channel;
Project : String;
Dir : String;
Language : String;
Target : String;
Runtime : String;
Options : Containers.Value_List;
Obj_Name : Name_Type;
Dep_Name : String;
Env : String;
Filter : access function (Str, Sep : String) return String := null);
-- Send a compilation job to a slave. The compilation must be done on
-- Dir. This directory is specified relative to the root directory of
-- the sources. Dep_Name is the dependency file that is generated by this
-- compilation and which must be sent back to the build master after the
-- compilation. Filter is a function used to make path on the command line
-- all relatives to the root directory. The build master root in full path
-- is replaced by Full_Path_Tag. The slaves will change back this tag to
-- the actual full path on their working environment. The Env string is a
-- set of environment variables (name=value[;name=value]) to set before
-- spawning the process.
-- If Language is empty, this is not a compilation based on a specific
-- language. In this case the command in Options (Options'First) is to be
-- executed as-is.
procedure Send_File
(Channel : Communication_Channel;
Path_Name : String;
Rewrite : Boolean;
Keep_Time_Stamp : Boolean := False);
-- Path_Name is the full path name to the local filename
procedure Sync_Files
(Channel : Communication_Channel;
Root_Dir : String;
Files : File_Data_Set.Vector);
-- Send a set of filenames and associated timestamps. Will receive a OK or
-- KO with the list of files to be transferred to the slave.
procedure Send_End_Of_Compilation (Channel : Communication_Channel);
-- Send an end of compilation signal, the slave will at this point be able
-- to get jobs from another build master (Get_Context).
procedure Send_End_Of_File_List (Channel : Communication_Channel);
-- Send an end of file list signal, it means that all files timestamps have
-- been checked. After this the compilation can be started.
procedure Get_Pid
(Channel : Communication_Channel;
Pid : out Remote_Id;
Success : out Boolean);
-- Get a process id, Success is set to False in case of failure
procedure Send_Clean_Up
(Channel : Communication_Channel; Project_Name : String);
-- Send a clean-up requets to the slave
procedure Send_Sync_Request (Channel : Communication_Channel);
-- Send a sync request to the slave
procedure Send_Info_Request (Channel : Communication_Channel);
-- Send a info request to the slave
procedure Get_Info_Response
(Channel : Communication_Channel;
Version_String : out Unbounded_String;
Current_UTC_Time : out Time_Stamp.Data;
GPR_Hash : out Unbounded_String;
Success : out Boolean);
-- Read and return the info sent from the slave
--
-- From GPRslave
--
procedure Get_Context
(Channel : Communication_Channel;
Target : out Unbounded_String;
Project_Name : out Unbounded_String;
Build_Env : out Unbounded_String;
Sync : out Boolean;
Timestamp : out Time_Stamp.Data;
Version : out Unbounded_String;
Hash : out Unbounded_String;
Included_Artifact_Patterns : out Unbounded_String;
Is_Ping : out Boolean);
-- Wait for an initial context from a build master
procedure Send_Slave_Config
(Channel : Communication_Channel;
Max_Process : Positive;
Root_Directory : String;
Clock_Status : Boolean);
-- Send the slave configuration to the build master
procedure Send_Ack
(Channel : Communication_Channel; Pid : Remote_Id);
-- Send Acknoledgement of a received compilation job
procedure Send_Ok
(Channel : Communication_Channel; Pid : Remote_Id);
-- Send Pid of a successful command
procedure Send_Ko
(Channel : Communication_Channel; Pid : Remote_Id);
-- Send Pid of an un-successful command
procedure Send_Ok (Channel : Communication_Channel);
-- Send Ok for a successful command (clean-up for example)
procedure Send_Ko (Channel : Communication_Channel; Message : String := "");
-- Send Ko to initial handshake (slave not compatible with master for
-- example).
procedure Send_Ko
(Channel : Communication_Channel;
Files : File_Data_Set.Vector);
-- Send a Ko message with a list of file names
procedure Send_Ping_Response
(Channel : Communication_Channel;
Version_String : String;
Current_UTC_Time : Time_Stamp.Data;
GPR_Hash : String);
-- Send a ping response with some environment information
procedure Send_Info_Response
(Channel : Communication_Channel;
Version_String : String;
Current_UTC_Time : Time_Stamp.Data;
GPR_Hash : String);
-- Send an information response
procedure Send_Output (Channel : Communication_Channel; File_Name : String);
-- Send an output of a command
procedure Get_RAW_File_Content
(Channel : Communication_Channel;
Path_Name : String;
Timestamp : Time_Stamp.Data := Time_Stamp.Empty);
-- Create Path_Name from data received from the channel. The data must be
-- sent by Send_RAW_File_Content to have the correct format. If specified
-- the file's timestamp is set.
private
type Communication_Channel is new Finalization.Controlled with record
Sock : Socket_Type;
Channel : Stream_Access;
WD_From, WD_To : Unbounded_String; -- working directory
CD_From, CD_To : Unbounded_String; -- compiler directory
Refs : Shared_Counter_Access;
end record;
overriding procedure Initialize (Channel : in out Communication_Channel);
overriding procedure Adjust (Channel : in out Communication_Channel);
overriding procedure Finalize (Channel : in out Communication_Channel);
No_Channel : constant Communication_Channel :=
(Finalization.Controlled
with Sock => No_Socket,
Channel => null,
Refs => new Shared_Counter (1),
others => Null_Unbounded_String);
type Command is new Finalization.Controlled with record
Cmd : Command_Kind;
Args : OS_Lib.Argument_List_Access;
Output : Unbounded_String;
Refs : Shared_Counter_Access;
end record;
overriding procedure Initialize (Cmd : in out Command);
overriding procedure Adjust (Cmd : in out Command);
overriding procedure Finalize (Cmd : in out Command);
end GPR2.Compilation.Protocol;
|
reznikmm/matreshka | Ada | 4,017 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Draw_Display_Name_Attributes;
package Matreshka.ODF_Draw.Display_Name_Attributes is
type Draw_Display_Name_Attribute_Node is
new Matreshka.ODF_Draw.Abstract_Draw_Attribute_Node
and ODF.DOM.Draw_Display_Name_Attributes.ODF_Draw_Display_Name_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Draw_Display_Name_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Draw_Display_Name_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Draw.Display_Name_Attributes;
|
alvaromb/Compilemon | Ada | 1,366 | adb | -- Copyright (c) 1990 Regents of the University of California.
-- All rights reserved.
--
-- This software was developed by John Self of the Arcadia project
-- at the University of California, Irvine.
--
-- Redistribution and use in source and binary forms are permitted
-- provided that the above copyright notice and this paragraph are
-- duplicated in all such forms and that any documentation,
-- advertising materials, and other materials related to such
-- distribution and use acknowledge that the software was developed
-- by the University of California, Irvine. The name of the
-- University may not be used to endorse or promote products derived
-- from this software without specific prior written permission.
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-- TITLE scanner parser interface
-- AUTHOR: John Self (UCI)
-- DESCRIPTION causes parser to call augmented version of YYLex.
-- $Header: /co/ua/self/arcadia/aflex/ada/src/RCS/aflex_scanner.a,v 1.3 90/01/12 15:19:33 self Exp Locker: self $
with parse_tokens, scanner; use parse_tokens, scanner;
package body aflex_scanner is
function YYLEX return TOKEN is
begin
return SCANNER.GET_TOKEN;
end YYLEX;
end aflex_scanner;
|
onox/orka | Ada | 3,155 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2021 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package Orka.SIMD.SSE2.Integers.Shift is
pragma Pure;
function Shift_Bits_Left_Zeros (Elements, Bits : m128i) return m128i
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_pslld128";
-- Shift each element to the left by the given amount of bits from the
-- first Double of the Bits register
function Shift_Bits_Right_Zeros (Elements, Bits : m128i) return m128i
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_psrld128";
-- Shift each element to the right by the given amount of bits from the
-- first Double of the Bits register, shifting in zeros
function Shift_Bits_Right_Signs (Elements, Bits : m128i) return m128i
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_psrad128";
-- Shift each element to the right by the given amount of bits from the
-- first Double of the Bits register, shifting in sign bits
--
-- If the value of the Double is > 31, then the elements will be either 16#FFFF_FFFF# or 0.
----------------------------------------------------------------------------
type Bits_Count is new Integer range 1 .. 32;
function Shift_Bits_Left_Zeros (Elements : m128i; Bits : Bits_Count) return m128i
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_pslldi128";
-- Shift each element to the left by the given amount of bits, shifting in zeros
function Shift_Bits_Right_Zeros (Elements : m128i; Bits : Bits_Count) return m128i
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_psrldi128";
-- Shift each element to the right by the given amount of bits, shifting in zeros
function Shift_Bits_Right_Signs (Elements : m128i; Bits : Bits_Count) return m128i
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_psradi128";
-- Shift each element to the right by the given amount of bits, shifting in
-- sign bits
--
-- If Bits is > 31, then the elements will be either 16#FFFF_FFFF# or 0.
----------------------------------------------------------------------------
function Shift_Elements_Left_Zeros (Elements : m128i) return m128i
with Inline_Always;
-- Shift each element to the left by one element, shifting in zeros
function Shift_Elements_Right_Zeros (Elements : m128i) return m128i
with Inline_Always;
-- Shift each element to the right by one element, shifting in zeros
end Orka.SIMD.SSE2.Integers.Shift;
|
sungyeon/drake | Ada | 314 | ads | pragma License (Unrestricted);
-- extended unit
with Ada.Directories.Volumes;
function Ada.Directories.Less_File_Names (
FS : Volumes.File_System;
Left, Right : String)
return Boolean;
-- This function is "<" version of Ada.Directories.Equal_File_Names.
pragma Inline (Ada.Directories.Less_File_Names);
|
AdaCore/libadalang | Ada | 198 | ads | package Absent_Base_Type is
type T1_Child is new T1_Parent with null record;
type T2_Parent is tagged null record;
type T2_Child is new T2_Parent with null record;
end Absent_Base_Type;
|
stcarrez/ada-asf | Ada | 4,260 | adb | -----------------------------------------------------------------------
-- components-utils-scrollers -- Data scrollers
-- Copyright (C) 2013, 2015 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.Contexts.Writer;
package body ASF.Components.Utils.Scrollers is
-- ------------------------------
-- Get the list value holder that the scroller is controlling.
-- ------------------------------
function Get_List (UI : in UIScroller;
Context : in ASF.Contexts.Faces.Faces_Context'Class)
return Holders.List_Holder_Access is
use type Base.UIComponent_Access;
Id : constant String := UI.Get_Attribute ("for", Context, "");
C : Base.UIComponent_Access;
begin
C := UI.Find (Id);
if C = null then
return null;
elsif not (C.all in Holders.List_Holder'Class) then
return null;
else
return Holders.List_Holder'Class (C.all)'Access;
end if;
end Get_List;
-- Encode the data scroller.
overriding
procedure Encode_Children (UI : in UIScroller;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
use type Holders.List_Holder_Access;
List : Holders.List_Holder_Access;
begin
if not UI.Is_Rendered (Context) then
return;
end if;
List := UIScroller'Class (UI).Get_List (Context);
if List = null then
Base.Log_Error (UI, "There is no list object associated with the scroller");
return;
end if;
declare
Id : constant Ada.Strings.Unbounded.Unbounded_String := UI.Get_Client_Id;
Writer : constant Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer;
Row_Count : constant Natural := List.Get_Row_Count; -- (Context);
Row_Per_Page : constant Natural := List.Get_Row_Per_Page; -- (Context);
Current_Page : constant Natural := List.Get_Current_Page; -- (Context);
Page_Count : constant Natural := (Row_Count + Row_Per_Page - 1) / Row_Per_Page;
begin
Writer.Start_Element ("div");
UI.Render_Attributes (Context, Writer);
if Current_Page > 1 then
UI.Render_Page ("first", 1, Context);
end if;
if Current_Page > 1 then
UI.Render_Page ("previous", Current_Page - 1, Context);
end if;
if Current_Page < Page_Count then
UI.Render_Page ("next", Current_Page + 1, Context);
end if;
if Current_Page < Page_Count then
UI.Render_Page ("last", Page_Count, Context);
end if;
Writer.End_Element ("div");
Writer.Queue_Script ("$('#" & Id & "').scroller();");
end;
end Encode_Children;
procedure Render_Page (UI : in UIScroller;
Name : in String;
Page : in Positive;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
use type ASF.Components.Base.UIComponent_Access;
Writer : constant Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer;
F : constant ASF.Components.Base.UIComponent_Access := UI.Get_Facet (Name);
begin
Writer.Start_Element ("div");
Writer.Write_Attribute ("class", "asf-scroll-" & Name);
if F /= null then
F.Encode_All (Context);
else
Writer.Write_Text (Positive'Image (Page));
end if;
Writer.End_Element ("div");
end Render_Page;
end ASF.Components.Utils.Scrollers;
|
Gabriel-Degret/adalib | Ada | 8,317 | 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
---------------------------------------------------------------------------
with Ada.Iterator_Interfaces;
generic
type Element_Type is private;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Multiway_Trees is
pragma Preelaborate(Multiway_Trees);
pragma Remote_Types(Multiway_Trees);
type Tree is tagged private
with Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type;
pragma Preelaborable_Initialization(Tree);
type Cursor is private;
pragma Preelaborable_Initialization(Cursor);
Empty_Tree : constant Tree;
No_Element : constant Cursor;
function Has_Element (Position : Cursor) return Boolean;
package Tree_Iterator_Interfaces is new
Ada.Iterator_Interfaces (Cursor, Has_Element);
function Equal_Subtree (Left_Position : Cursor;
Right_Position: Cursor) return Boolean;
function "=" (Left, Right : Tree) return Boolean;
function Is_Empty (Container : Tree) return Boolean;
function Node_Count (Container : Tree) return Count_Type;
function Subtree_Node_Count (Position : Cursor) return Count_Type;
function Depth (Position : Cursor) return Count_Type;
function Is_Root (Position : Cursor) return Boolean;
function Is_Leaf (Position : Cursor) return Boolean;
function Root (Container : Tree) return Cursor;
procedure Clear (Container : in out Tree);
function Element (Position : Cursor) return Element_Type;
procedure Replace_Element (Container : in out Tree;
Position : in Cursor;
New_Item : in Element_Type);
procedure Query_Element
(Position : in Cursor;
Process : not null access procedure (Element : in Element_Type));
procedure Update_Element
(Container : in out Tree;
Position : in Cursor;
Process : not null access procedure
(Element : in out Element_Type));
type Constant_Reference_Type
(Element : not null access constant Element_Type) is private
with Implicit_Dereference => Element;
type Reference_Type (Element : not null access Element_Type) is private
with Implicit_Dereference => Element;
function Constant_Reference (Container : aliased in Tree;
Position : in Cursor)
return Constant_Reference_Type;
function Reference (Container : aliased in out Tree;
Position : in Cursor)
return Reference_Type;
procedure Assign (Target : in out Tree; Source : in Tree);
function Copy (Source : Tree) return Tree;
procedure Move (Target : in out Tree;
Source : in out Tree);
procedure Delete_Leaf (Container : in out Tree;
Position : in out Cursor);
procedure Delete_Subtree (Container : in out Tree;
Position : in out Cursor);
procedure Swap (Container : in out Tree;
I, J : in Cursor);
function Find (Container : Tree;
Item : Element_Type)
return Cursor;
function Find_In_Subtree (Position : Cursor;
Item : Element_Type)
return Cursor;
function Ancestor_Find (Position : Cursor;
Item : Element_Type)
return Cursor;
function Contains (Container : Tree;
Item : Element_Type) return Boolean;
procedure Iterate
(Container : in Tree;
Process : not null access procedure (Position : in Cursor));
procedure Iterate_Subtree
(Position : in Cursor;
Process : not null access procedure (Position : in Cursor));
function Iterate (Container : in Tree)
return Tree_Iterator_Interfaces.Forward_Iterator'Class;
function Iterate_Subtree (Position : in Cursor)
return Tree_Iterator_Interfaces.Forward_Iterator'Class;
function Child_Count (Parent : Cursor) return Count_Type;
function Child_Depth (Parent, Child : Cursor) return Count_Type;
procedure Insert_Child (Container : in out Tree;
Parent : in Cursor;
Before : in Cursor;
New_Item : in Element_Type;
Count : in Count_Type := 1);
procedure Insert_Child (Container : in out Tree;
Parent : in Cursor;
Before : in Cursor;
New_Item : in Element_Type;
Position : out Cursor;
Count : in Count_Type := 1);
procedure Insert_Child (Container : in out Tree;
Parent : in Cursor;
Before : in Cursor;
Position : out Cursor;
Count : in Count_Type := 1);
procedure Prepend_Child (Container : in out Tree;
Parent : in Cursor;
New_Item : in Element_Type;
Count : in Count_Type := 1);
procedure Append_Child (Container : in out Tree;
Parent : in Cursor;
New_Item : in Element_Type;
Count : in Count_Type := 1);
procedure Delete_Children (Container : in out Tree;
Parent : in Cursor);
procedure Copy_Subtree (Target : in out Tree;
Parent : in Cursor;
Before : in Cursor;
Source : in Cursor);
procedure Splice_Subtree (Target : in out Tree;
Parent : in Cursor;
Before : in Cursor;
Source : in out Tree;
Position : in out Cursor);
procedure Splice_Subtree (Container: in out Tree;
Parent : in Cursor;
Before : in Cursor;
Position : in Cursor);
procedure Splice_Children (Target : in out Tree;
Target_Parent : in Cursor;
Before : in Cursor;
Source : in out Tree;
Source_Parent : in Cursor);
procedure Splice_Children (Container : in out Tree;
Target_Parent : in Cursor;
Before : in Cursor;
Source_Parent : in Cursor);
function Parent (Position : Cursor) return Cursor;
function First_Child (Parent : Cursor) return Cursor;
function First_Child_Element (Parent : Cursor) return Element_Type;
function Last_Child (Parent : Cursor) return Cursor;
function Last_Child_Element (Parent : Cursor) return Element_Type;
function Next_Sibling (Position : Cursor) return Cursor;
function Previous_Sibling (Position : Cursor) return Cursor;
procedure Next_Sibling (Position : in out Cursor);
procedure Previous_Sibling (Position : in out Cursor);
procedure Iterate_Children
(Parent : in Cursor;
Process : not null access procedure (Position : in Cursor));
procedure Reverse_Iterate_Children
(Parent : in Cursor;
Process : not null access procedure (Position : in Cursor));
function Iterate_Children (Container : in Tree; Parent : in Cursor)
return Tree_Iterator_Interfaces.Reversible_Iterator'Class;
private
-- not specified by the language
end Ada.Containers.Multiway_Trees;
|
damaki/libkeccak | Ada | 8,482 | ads | -------------------------------------------------------------------------------
-- Copyright (c) 2019, Daniel King
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
-- * Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * The name of the copyright holder may not be used to endorse or promote
-- Products derived from this software without specific prior written
-- permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------
with Keccak.Generic_CSHAKE;
with Keccak.Types;
pragma Elaborate_All (Keccak.Generic_CSHAKE);
-- @summary
-- Generic implementation of KMAC as described in NIST SP 800-185.
--
-- @description
-- This package implements the KMAC algorithm on top of any instantiation
-- of the Generic_CSHAKE package. For example, KMAC128 is implemented on
-- top of cSHAKE128.
--
-- The KECCAK Message Authentication Code (KMAC) algorithm is a PRF and
-- keyed hash function based on KECCAK. It provides variable-length output,
-- and unlike SHAKE and cSHAKE, altering the requested output length generates
-- a new, unrelated output.
--
-- This API is used as follows:
--
-- 1 Call Init to initialise a new context. The private key and an optional
-- customisation string (for domain separation) are provided here.
--
-- 2 Call Update one or more times to input an arbitrary amount of data into
-- the KMAC context.
--
-- 3 Call either Finish or Extract to produce the desired type of output
-- (KMAC or KMACXOF):
--
-- * Finish is used to produce a single output of arbitrary length (KMAC).
-- The requested output length affects the output. For example, requesting
-- a 10-byte output will produce an unrelated hash to requesting a 20-byte
-- output.
--
-- * Extract can be called one or more times to produce an arbitrary number
-- of output bytes (KMACXOF). In this case, the total output length is
-- unknown in advance so the output does not change based on the overall length.
-- For example, a 10-byte output is the truncated version of a 20-byte output.
--
-- @group KMAC
generic
with package KMAC_CSHAKE is new Keccak.Generic_CSHAKE (<>);
package Keccak.Generic_KMAC
is
type Context is private;
type States is (Updating, Extracting, Finished);
-- @value Updating When in this state additional data can be input into the
-- KMAC context.
--
-- @value Extracting When in this state, the KMAC context can generate
-- output bytes by calling the Extract procedure.
--
-- @value Finished When in this state the context is finished and no more data
-- can be input or output.
procedure Init (Ctx : out Context;
Key : in Types.Byte_Array;
Customization : in String)
with Global => null,
Depends => (Ctx => (Key, Customization)),
Post => State_Of (Ctx) = Updating;
-- Initialize the KMAC context.
--
-- In cases where many KMAC computations are performed with the same
-- key and customization string it is possible to
-- initialize a context once with the desired parameters, then copy the
-- context as many times as necessary for the different computations.
--
-- @param Ctx The contex to initialize.
--
-- @param Key The variable-length key to use for the KMAC context.
-- Note that it is permitted for the length of the key to be 0.
--
-- @param Customization An optional customization string to provide domain
-- separation for different usages of KMAC.
procedure Update (Ctx : in out Context;
Message : in Types.Byte_Array)
with Global => null,
Depends => (Ctx =>+ Message),
Pre => State_Of (Ctx) = Updating,
Post => State_Of (Ctx) = Updating;
-- Process data with KMAC.
--
-- Note that this function can be called multiple times to process an
-- arbitrary amount of data.
--
-- @param Ctx The KMAC context.
--
-- @param Message The byte array containing the bytes to process.
procedure Finish (Ctx : in out Context;
MAC : out Types.Byte_Array)
with Global => null,
Depends => ((Ctx, MAC) => (Ctx, MAC)),
Pre => State_Of (Ctx) = Updating,
Post => State_Of (Ctx) = Finished;
-- Finish the KMAC computation and generate the MAC.
--
-- After calling this procedure the context can no longer be used. However,
-- it can be re-initialized to perform a new KMAC computation.
--
-- The number of output bytes requested is determined from the length of
-- the MAC array (i.e. MAC'Length) and has an effect on the value of the
-- output MAC. For example, two different KMAC computations with identical
-- inputs (same key and input data) but with different MAC lengths will
-- produce independent MAC values.
--
-- Note that this procedure can only be called once for each KMAC
-- computation. This requires that the required MAC length is known before
-- calling this procedure, and a Byte_Array with the correct length is
-- given to this procedure. For applications where the number of required
-- output bytes is not known until after bytes are output, see the Extract
-- procedure.
--
-- @param Ctx The KMAC context.
--
-- @param MAC The computed MAC is written to this array. The length of
-- this array can be arbitrary.
procedure Extract (Ctx : in out Context;
MAC : out Types.Byte_Array)
with Global => null,
Depends => ((Ctx, MAC) => (Ctx, MAC)),
Pre => State_Of (Ctx) in Updating | Extracting,
Post => State_Of (Ctx) = Extracting;
-- Finish the KMAC computation generate XOF output bytes.
--
-- After calling this procudure no more data can be input into the KMAC
-- computation.
--
-- This function can be called multiple times to produce an arbitrary
-- number of output bytes.
function State_Of (Ctx : in Context) return States
with Global => null;
-- Get the current state of the context.
--
-- The context can only be used whilst it is in the "Updating" state.
-- Otherwise, once the context is finished then it can no longer be used,
-- and it must be reset in order to be re-used for a new KMAC computation.
function Rate return Positive
with Global => null,
Post => Rate'Result mod 8 = 0;
-- Get the rate parameter (in bits) of the KMAC instance.
--
-- The rate is defined as the underlying state size minus the capacity
-- parameter. E.g. for KMAC128 the state size is 1600 bits (the state
-- is based on Keccak[1600]), and the Capacity is 256 bits, which results
-- in a rate of 1600 - 256 = 1344 bits (168 bytes).
private
use type KMAC_CSHAKE.States;
type Context is record
CSHAKE_Ctx : KMAC_CSHAKE.Context;
Finished : Boolean;
end record;
function State_Of (Ctx : in Context) return States
is (if Ctx.Finished then Finished
elsif KMAC_CSHAKE.State_Of (Ctx.CSHAKE_Ctx) = KMAC_CSHAKE.Updating then
Updating
else Extracting);
function Rate return Positive
is (KMAC_CSHAKE.Rate);
end Keccak.Generic_KMAC;
|
tum-ei-rcs/StratoX | Ada | 7,895 | ads | -- This spec has been automatically generated from STM32F429x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
with HAL;
with System;
package STM32_SVD.FLASH is
pragma Preelaborate;
---------------
-- Registers --
---------------
------------------
-- ACR_Register --
------------------
subtype ACR_LATENCY_Field is HAL.UInt3;
-- Flash access control register
type ACR_Register is record
-- Latency
LATENCY : ACR_LATENCY_Field := 16#0#;
-- unspecified
Reserved_3_7 : HAL.UInt5 := 16#0#;
-- Prefetch enable
PRFTEN : Boolean := False;
-- Instruction cache enable
ICEN : Boolean := False;
-- Data cache enable
DCEN : Boolean := False;
-- Write-only. Instruction cache reset
ICRST : Boolean := False;
-- Data cache reset
DCRST : Boolean := False;
-- unspecified
Reserved_13_31 : HAL.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ACR_Register use record
LATENCY at 0 range 0 .. 2;
Reserved_3_7 at 0 range 3 .. 7;
PRFTEN at 0 range 8 .. 8;
ICEN at 0 range 9 .. 9;
DCEN at 0 range 10 .. 10;
ICRST at 0 range 11 .. 11;
DCRST at 0 range 12 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
-----------------
-- SR_Register --
-----------------
-- Status register
type SR_Register is record
-- End of operation
EOP : Boolean := False;
-- Operation error
OPERR : Boolean := False;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- Write protection error
WRPERR : Boolean := False;
-- Programming alignment error
PGAERR : Boolean := False;
-- Programming parallelism error
PGPERR : Boolean := False;
-- Programming sequence error
PGSERR : Boolean := False;
-- unspecified
Reserved_8_15 : HAL.Byte := 16#0#;
-- Read-only. Busy
BSY : Boolean := False;
-- unspecified
Reserved_17_31 : HAL.UInt15 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
EOP at 0 range 0 .. 0;
OPERR at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
WRPERR at 0 range 4 .. 4;
PGAERR at 0 range 5 .. 5;
PGPERR at 0 range 6 .. 6;
PGSERR at 0 range 7 .. 7;
Reserved_8_15 at 0 range 8 .. 15;
BSY at 0 range 16 .. 16;
Reserved_17_31 at 0 range 17 .. 31;
end record;
-----------------
-- CR_Register --
-----------------
subtype CR_SNB_Field is HAL.UInt5;
subtype CR_PSIZE_Field is HAL.UInt2;
-- Control register
type CR_Register is record
-- Programming
PG : Boolean := False;
-- Sector Erase
SER : Boolean := False;
-- Mass Erase of sectors 0 to 11
MER : Boolean := False;
-- Sector number
SNB : CR_SNB_Field := 16#0#;
-- Program size
PSIZE : CR_PSIZE_Field := 16#0#;
-- unspecified
Reserved_10_14 : HAL.UInt5 := 16#0#;
-- Mass Erase of sectors 12 to 23
MER1 : Boolean := False;
-- Start
STRT : Boolean := False;
-- unspecified
Reserved_17_23 : HAL.UInt7 := 16#0#;
-- End of operation interrupt enable
EOPIE : Boolean := False;
-- Error interrupt enable
ERRIE : Boolean := False;
-- unspecified
Reserved_26_30 : HAL.UInt5 := 16#0#;
-- Lock
LOCK : Boolean := True;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
PG at 0 range 0 .. 0;
SER at 0 range 1 .. 1;
MER at 0 range 2 .. 2;
SNB at 0 range 3 .. 7;
PSIZE at 0 range 8 .. 9;
Reserved_10_14 at 0 range 10 .. 14;
MER1 at 0 range 15 .. 15;
STRT at 0 range 16 .. 16;
Reserved_17_23 at 0 range 17 .. 23;
EOPIE at 0 range 24 .. 24;
ERRIE at 0 range 25 .. 25;
Reserved_26_30 at 0 range 26 .. 30;
LOCK at 0 range 31 .. 31;
end record;
--------------------
-- OPTCR_Register --
--------------------
subtype OPTCR_BOR_LEV_Field is HAL.UInt2;
subtype OPTCR_RDP_Field is HAL.Byte;
subtype OPTCR_nWRP_Field is HAL.UInt12;
-- Flash option control register
type OPTCR_Register is record
-- Option lock
OPTLOCK : Boolean := True;
-- Option start
OPTSTRT : Boolean := False;
-- BOR reset Level
BOR_LEV : OPTCR_BOR_LEV_Field := 16#3#;
-- unspecified
Reserved_4_4 : HAL.Bit := 16#0#;
-- WDG_SW User option bytes
WDG_SW : Boolean := True;
-- nRST_STOP User option bytes
nRST_STOP : Boolean := True;
-- nRST_STDBY User option bytes
nRST_STDBY : Boolean := True;
-- Read protect
RDP : OPTCR_RDP_Field := 16#AA#;
-- Not write protect
nWRP : OPTCR_nWRP_Field := 16#FFF#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OPTCR_Register use record
OPTLOCK at 0 range 0 .. 0;
OPTSTRT at 0 range 1 .. 1;
BOR_LEV at 0 range 2 .. 3;
Reserved_4_4 at 0 range 4 .. 4;
WDG_SW at 0 range 5 .. 5;
nRST_STOP at 0 range 6 .. 6;
nRST_STDBY at 0 range 7 .. 7;
RDP at 0 range 8 .. 15;
nWRP at 0 range 16 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
---------------------
-- OPTCR1_Register --
---------------------
subtype OPTCR1_nWRP_Field is HAL.UInt12;
-- Flash option control register 1
type OPTCR1_Register is record
-- unspecified
Reserved_0_15 : HAL.Short := 16#0#;
-- Not write protect
nWRP : OPTCR1_nWRP_Field := 16#FFF#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OPTCR1_Register use record
Reserved_0_15 at 0 range 0 .. 15;
nWRP at 0 range 16 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- FLASH
type FLASH_Peripheral is record
-- Flash access control register
ACR : ACR_Register;
-- Flash key register
KEYR : HAL.Word;
-- Flash option key register
OPTKEYR : HAL.Word;
-- Status register
SR : SR_Register;
-- Control register
CR : CR_Register;
-- Flash option control register
OPTCR : OPTCR_Register;
-- Flash option control register 1
OPTCR1 : OPTCR1_Register;
end record
with Volatile;
for FLASH_Peripheral use record
ACR at 0 range 0 .. 31;
KEYR at 4 range 0 .. 31;
OPTKEYR at 8 range 0 .. 31;
SR at 12 range 0 .. 31;
CR at 16 range 0 .. 31;
OPTCR at 20 range 0 .. 31;
OPTCR1 at 24 range 0 .. 31;
end record;
-- FLASH
FLASH_Periph : aliased FLASH_Peripheral
with Import, Address => FLASH_Base;
end STM32_SVD.FLASH;
|
reznikmm/matreshka | Ada | 24,401 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-2011, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
with League.Strings.Internals;
package body Matreshka.Internals.XML.Entity_Tables is
procedure Free is
new Ada.Unchecked_Deallocation (Entity_Array, Entity_Array_Access);
procedure New_Entity
(Self : in out Entity_Table;
Entity : out Entity_Identifier);
-- Allocates new entity and returns its identifier. Reallocates internal
-- memory when needed.
------------------------
-- Enclosing_Base_URI --
------------------------
function Enclosing_Base_URI
(Self : Entity_Table;
Entity : Entity_Identifier)
return not null Matreshka.Internals.Strings.Shared_String_Access is
begin
return Self.Data (Entity).Enclosing_Base_URI;
end Enclosing_Base_URI;
----------------------
-- Enclosing_Entity --
----------------------
function Enclosing_Entity
(Self : Entity_Table;
Entity : Entity_Identifier)
return Matreshka.Internals.XML.Entity_Identifier is
begin
return Self.Data (Entity).Enclosing;
end Enclosing_Entity;
---------------------
-- Entity_Base_URI --
---------------------
function Entity_Base_URI
(Self : Entity_Table;
Entity : Entity_Identifier)
return not null Matreshka.Internals.Strings.Shared_String_Access is
begin
return Self.Data (Entity).Entity_Base_URI;
end Entity_Base_URI;
--------------
-- Finalize --
--------------
procedure Finalize (Self : in out Entity_Table) is
begin
for J in Self.Data'First .. Self.Last loop
Matreshka.Internals.Strings.Dereference
(Self.Data (J).Replacement_Text);
Matreshka.Internals.Strings.Dereference (Self.Data (J).Public_Id);
Matreshka.Internals.Strings.Dereference (Self.Data (J).System_Id);
Matreshka.Internals.Strings.Dereference (Self.Data (J).Enclosing_Base_URI);
Matreshka.Internals.Strings.Dereference (Self.Data (J).Entity_Base_URI);
end loop;
Free (Self.Data);
end Finalize;
------------------
-- First_Entity --
------------------
function First_Entity (Self : Entity_Table) return Entity_Identifier is
pragma Unreferenced (Self);
begin
return No_Entity + 1;
end First_Entity;
--------------------
-- First_Position --
--------------------
function First_Position
(Self : Entity_Table;
Entity : Entity_Identifier)
return Matreshka.Internals.Utf16.Utf16_String_Index is
begin
return Self.Data (Entity).First_Position;
end First_Position;
----------------
-- Initialize --
----------------
procedure Initialize (Self : in out Entity_Table) is
procedure Register_Predefined_Entity
(Name : Matreshka.Internals.XML.Symbol_Identifier;
Text : League.Strings.Universal_String);
-- Creates predefined entity.
--------------------------------
-- Register_Predefined_Entity --
--------------------------------
procedure Register_Predefined_Entity
(Name : Matreshka.Internals.XML.Symbol_Identifier;
Text : League.Strings.Universal_String)
is
T : constant Matreshka.Internals.Strings.Shared_String_Access
:= League.Strings.Internals.Internal (Text);
E : Entity_Identifier;
begin
Matreshka.Internals.Strings.Reference (T);
New_Internal_General_Entity (Self, No_Entity, Name, T, E);
end Register_Predefined_Entity;
begin
Self.Data := new Entity_Array (1 .. 16);
Self.Last := 0;
Register_Predefined_Entity
(Symbol_lt, League.Strings.To_Universal_String ("<"));
Register_Predefined_Entity
(Symbol_gt, League.Strings.To_Universal_String (">"));
Register_Predefined_Entity
(Symbol_amp, League.Strings.To_Universal_String ("&"));
Register_Predefined_Entity
(Symbol_apos, League.Strings.To_Universal_String ("'"));
Register_Predefined_Entity
(Symbol_quot, League.Strings.To_Universal_String (""""));
end Initialize;
------------------------
-- Is_Document_Entity --
------------------------
function Is_Document_Entity
(Self : Entity_Table;
Entity : Entity_Identifier) return Boolean is
begin
return Self.Data (Entity).Kind = Document_Entity;
end Is_Document_Entity;
---------------------------------------
-- Is_External_Parsed_General_Entity --
---------------------------------------
function Is_External_Parsed_General_Entity
(Self : Entity_Table;
Entity : Entity_Identifier) return Boolean is
begin
return Self.Data (Entity).Kind = External_Parsed_General_Entity;
end Is_External_Parsed_General_Entity;
------------------------
-- Is_External_Subset --
------------------------
function Is_External_Subset
(Self : Entity_Table;
Entity : Entity_Identifier) return Boolean is
begin
return Self.Data (Entity).Kind = External_Subset_Entity;
end Is_External_Subset;
-----------------------------------------
-- Is_External_Unparsed_General_Entity --
-----------------------------------------
function Is_External_Unparsed_General_Entity
(Self : Entity_Table;
Entity : Entity_Identifier) return Boolean is
begin
return Self.Data (Entity).Kind = External_Unparsed_General_Entity;
end Is_External_Unparsed_General_Entity;
--------------------------------
-- Is_Internal_General_Entity --
--------------------------------
function Is_Internal_General_Entity
(Self : Entity_Table;
Entity : Entity_Identifier) return Boolean is
begin
return Self.Data (Entity).Kind = Internal_General_Entity;
end Is_Internal_General_Entity;
-------------------------
-- Is_Parameter_Entity --
-------------------------
function Is_Parameter_Entity
(Self : Entity_Table;
Entity : Entity_Identifier) return Boolean is
begin
return
Self.Data (Entity).Kind = Internal_Parameter_Entity
or Self.Data (Entity).Kind = External_Parameter_Entity;
end Is_Parameter_Entity;
------------------------------
-- Is_Parsed_General_Entity --
------------------------------
function Is_Parsed_General_Entity
(Self : Entity_Table;
Entity : Entity_Identifier) return Boolean is
begin
return
Self.Data (Entity).Kind = Internal_General_Entity
or Self.Data (Entity).Kind = External_Parsed_General_Entity;
end Is_Parsed_General_Entity;
-----------------
-- Is_Resolved --
-----------------
function Is_Resolved
(Self : Entity_Table;
Entity : Entity_Identifier) return Boolean is
begin
return Self.Data (Entity).Is_Resolved;
end Is_Resolved;
----------
-- Name --
----------
function Name
(Self : Entity_Table;
Entity : Entity_Identifier)
return Matreshka.Internals.XML.Symbol_Identifier is
begin
return Self.Data (Entity).Name;
end Name;
-------------------------
-- New_Document_Entity --
-------------------------
procedure New_Document_Entity
(Self : in out Entity_Table;
Public_Id : League.Strings.Universal_String;
System_Id : League.Strings.Universal_String;
Entity_Base_URI : League.Strings.Universal_String;
Entity : out Entity_Identifier)
is
P : constant Matreshka.Internals.Strings.Shared_String_Access
:= League.Strings.Internals.Internal (Public_Id);
S : constant Matreshka.Internals.Strings.Shared_String_Access
:= League.Strings.Internals.Internal (System_Id);
B : constant Matreshka.Internals.Strings.Shared_String_Access
:= League.Strings.Internals.Internal (Entity_Base_URI);
begin
New_Entity (Self, Entity);
Matreshka.Internals.Strings.Reference (P);
Matreshka.Internals.Strings.Reference (S);
Matreshka.Internals.Strings.Reference (B);
Self.Data (Entity) :=
(Kind => Document_Entity,
Enclosing => No_Entity,
Name => No_Symbol,
Notation => No_Symbol,
Public_Id => P,
System_Id => S,
Enclosing_Base_URI => Matreshka.Internals.Strings.Shared_Empty'Access,
Entity_Base_URI => B,
Is_Resolved => False,
Replacement_Text => Matreshka.Internals.Strings.Shared_Empty'Access,
First_Position => 0);
end New_Document_Entity;
----------------
-- New_Entity --
----------------
procedure New_Entity
(Self : in out Entity_Table;
Entity : out Entity_Identifier)
is
Aux : Entity_Array_Access := Self.Data;
begin
Self.Last := Self.Last + 1;
Entity := Self.Last;
if Self.Last > Self.Data'Last then
Self.Data :=
new Entity_Array (Self.Data'First .. Self.Data'Last + 16);
Self.Data (Aux'Range) := Aux.all;
Free (Aux);
end if;
end New_Entity;
-----------------------------------
-- New_External_Parameter_Entity --
-----------------------------------
procedure New_External_Parameter_Entity
(Self : in out Entity_Table;
Enclosing_Entity : Entity_Identifier;
Name : Matreshka.Internals.XML.Symbol_Identifier;
Public_Id : League.Strings.Universal_String;
System_Id : League.Strings.Universal_String;
Enclosing_Base_URI : League.Strings.Universal_String;
Entity : out Entity_Identifier)
is
P : constant Matreshka.Internals.Strings.Shared_String_Access
:= League.Strings.Internals.Internal (Public_Id);
S : constant Matreshka.Internals.Strings.Shared_String_Access
:= League.Strings.Internals.Internal (System_Id);
B : constant Matreshka.Internals.Strings.Shared_String_Access
:= League.Strings.Internals.Internal (Enclosing_Base_URI);
begin
New_Entity (Self, Entity);
Matreshka.Internals.Strings.Reference (P);
Matreshka.Internals.Strings.Reference (S);
Matreshka.Internals.Strings.Reference (B);
Self.Data (Entity) :=
(Kind => External_Parameter_Entity,
Enclosing => Enclosing_Entity,
Name => Name,
Notation => No_Symbol,
Public_Id => P,
System_Id => S,
Enclosing_Base_URI => B,
Entity_Base_URI => Matreshka.Internals.Strings.Shared_Empty'Access,
Is_Resolved => False,
Replacement_Text => Matreshka.Internals.Strings.Shared_Empty'Access,
First_Position => 0);
end New_External_Parameter_Entity;
----------------------------------------
-- New_External_Parsed_General_Entity --
----------------------------------------
procedure New_External_Parsed_General_Entity
(Self : in out Entity_Table;
Enclosing_Entity : Entity_Identifier;
Name : Matreshka.Internals.XML.Symbol_Identifier;
Public_Id : League.Strings.Universal_String;
System_Id : League.Strings.Universal_String;
Enclosing_Base_URI : League.Strings.Universal_String;
Entity : out Entity_Identifier)
is
P : constant Matreshka.Internals.Strings.Shared_String_Access
:= League.Strings.Internals.Internal (Public_Id);
S : constant Matreshka.Internals.Strings.Shared_String_Access
:= League.Strings.Internals.Internal (System_Id);
B : constant Matreshka.Internals.Strings.Shared_String_Access
:= League.Strings.Internals.Internal (Enclosing_Base_URI);
begin
New_Entity (Self, Entity);
Matreshka.Internals.Strings.Reference (P);
Matreshka.Internals.Strings.Reference (S);
Matreshka.Internals.Strings.Reference (B);
Self.Data (Entity) :=
(Kind => External_Parsed_General_Entity,
Enclosing => Enclosing_Entity,
Name => Name,
Notation => No_Symbol,
Public_Id => P,
System_Id => S,
Enclosing_Base_URI => B,
Entity_Base_URI => Matreshka.Internals.Strings.Shared_Empty'Access,
Is_Resolved => False,
Replacement_Text => Matreshka.Internals.Strings.Shared_Empty'Access,
First_Position => 0);
end New_External_Parsed_General_Entity;
--------------------------------
-- New_External_Subset_Entity --
--------------------------------
procedure New_External_Subset_Entity
(Self : in out Entity_Table;
Enclosing_Entity : Entity_Identifier;
Public_Id : League.Strings.Universal_String;
System_Id : League.Strings.Universal_String;
Enclosing_Base_URI : League.Strings.Universal_String;
Entity : out Entity_Identifier)
is
P : constant Matreshka.Internals.Strings.Shared_String_Access
:= League.Strings.Internals.Internal (Public_Id);
S : constant Matreshka.Internals.Strings.Shared_String_Access
:= League.Strings.Internals.Internal (System_Id);
B : constant Matreshka.Internals.Strings.Shared_String_Access
:= League.Strings.Internals.Internal (Enclosing_Base_URI);
begin
New_Entity (Self, Entity);
Matreshka.Internals.Strings.Reference (P);
Matreshka.Internals.Strings.Reference (S);
Matreshka.Internals.Strings.Reference (B);
Self.Data (Entity) :=
(Kind => External_Subset_Entity,
Enclosing => Enclosing_Entity,
Name => No_Symbol,
Notation => No_Symbol,
Public_Id => P,
System_Id => S,
Enclosing_Base_URI => B,
Entity_Base_URI => Matreshka.Internals.Strings.Shared_Empty'Access,
Is_Resolved => False,
Replacement_Text => Matreshka.Internals.Strings.Shared_Empty'Access,
First_Position => 0);
end New_External_Subset_Entity;
------------------------------------------
-- New_External_Unparsed_General_Entity --
------------------------------------------
procedure New_External_Unparsed_General_Entity
(Self : in out Entity_Table;
Enclosing_Entity : Entity_Identifier;
Name : Matreshka.Internals.XML.Symbol_Identifier;
Notation : Symbol_Identifier;
Entity : out Entity_Identifier) is
begin
New_Entity (Self, Entity);
Self.Data (Entity) :=
(Kind => External_Unparsed_General_Entity,
Enclosing => Enclosing_Entity,
Name => Name,
Notation => Notation,
Public_Id => Matreshka.Internals.Strings.Shared_Empty'Access,
System_Id => Matreshka.Internals.Strings.Shared_Empty'Access,
Enclosing_Base_URI => Matreshka.Internals.Strings.Shared_Empty'Access,
Entity_Base_URI => Matreshka.Internals.Strings.Shared_Empty'Access,
Is_Resolved => False,
Replacement_Text => Matreshka.Internals.Strings.Shared_Empty'Access,
First_Position => 0);
end New_External_Unparsed_General_Entity;
---------------------------------
-- New_Internal_General_Entity --
---------------------------------
procedure New_Internal_General_Entity
(Self : in out Entity_Table;
Enclosing_Entity : Entity_Identifier;
Name : Matreshka.Internals.XML.Symbol_Identifier;
Replacement_Text :
not null Matreshka.Internals.Strings.Shared_String_Access;
Entity : out Entity_Identifier) is
begin
New_Entity (Self, Entity);
Self.Data (Entity) :=
(Kind => Internal_General_Entity,
Enclosing => Enclosing_Entity,
Name => Name,
Notation => No_Symbol,
Public_Id => Matreshka.Internals.Strings.Shared_Empty'Access,
System_Id => Matreshka.Internals.Strings.Shared_Empty'Access,
Enclosing_Base_URI => Matreshka.Internals.Strings.Shared_Empty'Access,
Entity_Base_URI => Matreshka.Internals.Strings.Shared_Empty'Access,
Is_Resolved => True,
Replacement_Text => Replacement_Text,
First_Position => 0);
end New_Internal_General_Entity;
-----------------------------------
-- New_Internal_Parameter_Entity --
-----------------------------------
procedure New_Internal_Parameter_Entity
(Self : in out Entity_Table;
Enclosing_Entity : Entity_Identifier;
Name : Matreshka.Internals.XML.Symbol_Identifier;
Replacement_Text :
not null Matreshka.Internals.Strings.Shared_String_Access;
Entity : out Entity_Identifier) is
begin
New_Entity (Self, Entity);
Self.Data (Entity) :=
(Kind => Internal_Parameter_Entity,
Enclosing => Enclosing_Entity,
Name => Name,
Notation => No_Symbol,
Public_Id => Matreshka.Internals.Strings.Shared_Empty'Access,
System_Id => Matreshka.Internals.Strings.Shared_Empty'Access,
Enclosing_Base_URI => Matreshka.Internals.Strings.Shared_Empty'Access,
Entity_Base_URI => Matreshka.Internals.Strings.Shared_Empty'Access,
Is_Resolved => True,
Replacement_Text => Replacement_Text,
First_Position => 0);
end New_Internal_Parameter_Entity;
-----------------
-- Next_Entity --
-----------------
procedure Next_Entity
(Self : Entity_Table;
Entity : in out Entity_Identifier) is
begin
if Entity = Self.Last then
Entity := No_Entity;
else
Entity := Entity + 1;
end if;
end Next_Entity;
--------------
-- Notation --
--------------
function Notation
(Self : Entity_Table;
Entity : Entity_Identifier)
return Matreshka.Internals.XML.Symbol_Identifier is
begin
return Self.Data (Entity).Notation;
end Notation;
---------------
-- Public_Id --
---------------
function Public_Id
(Self : Entity_Table;
Entity : Entity_Identifier)
return not null Matreshka.Internals.Strings.Shared_String_Access is
begin
return Self.Data (Entity).Public_Id;
end Public_Id;
----------------------
-- Replacement_Text --
----------------------
function Replacement_Text
(Self : Entity_Table;
Entity : Entity_Identifier)
return Matreshka.Internals.Strings.Shared_String_Access is
begin
return Self.Data (Entity).Replacement_Text;
end Replacement_Text;
-----------
-- Reset --
-----------
procedure Reset (Self : in out Entity_Table) is
begin
Finalize (Self);
Initialize (Self);
end Reset;
-------------------------
-- Set_Entity_Base_URI --
-------------------------
procedure Set_Entity_Base_URI
(Self : in out Entity_Table;
Entity : Entity_Identifier;
Entity_Base_URI : League.Strings.Universal_String)
is
B : constant Matreshka.Internals.Strings.Shared_String_Access
:= League.Strings.Internals.Internal (Entity_Base_URI);
begin
Matreshka.Internals.Strings.Dereference
(Self.Data (Entity).Entity_Base_URI);
Self.Data (Entity).Entity_Base_URI := B;
Matreshka.Internals.Strings.Reference
(Self.Data (Entity).Entity_Base_URI);
end Set_Entity_Base_URI;
------------------------
-- Set_First_Position --
------------------------
procedure Set_First_Position
(Self : in out Entity_Table;
Entity : Entity_Identifier;
Position : Matreshka.Internals.Utf16.Utf16_String_Index) is
begin
Self.Data (Entity).First_Position := Position;
end Set_First_Position;
---------------------
-- Set_Is_Resolved --
---------------------
procedure Set_Is_Resolved
(Self : in out Entity_Table;
Entity : Entity_Identifier;
To : Boolean) is
begin
Self.Data (Entity).Is_Resolved := To;
end Set_Is_Resolved;
--------------------------
-- Set_Replacement_Text --
--------------------------
procedure Set_Replacement_Text
(Self : in out Entity_Table;
Entity : Entity_Identifier;
Replacement_Text :
not null Matreshka.Internals.Strings.Shared_String_Access) is
begin
Self.Data (Entity).Replacement_Text := Replacement_Text;
end Set_Replacement_Text;
---------------
-- System_Id --
---------------
function System_Id
(Self : Entity_Table;
Entity : Entity_Identifier)
return not null Matreshka.Internals.Strings.Shared_String_Access is
begin
return Self.Data (Entity).System_Id;
end System_Id;
end Matreshka.Internals.XML.Entity_Tables;
|
AdaCore/libadalang | Ada | 31 | adb | This is an invalid Ada source.
|
AaronC98/PlaneSystem | Ada | 21,946 | adb | ------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2000-2015, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
------------------------------------------------------------------------------
pragma Ada_2012;
with Ada.Directories;
with Ada.Strings.Fixed;
with AWS.Headers.Values;
with AWS.Resources.Streams.Disk.Once;
with AWS.Resources.Streams.Memory;
with AWS.Response.Set;
with AWS.Translator;
package body AWS.Response is
package RSM renames AWS.Resources.Streams.Memory;
-----------------
-- Acknowledge --
-----------------
function Acknowledge
(Status_Code : Messages.Status_Code;
Message_Body : String := "";
Content_Type : String := MIME.Text_HTML) return Data
is
Result : Data;
begin
Set.Status_Code (Result, Status_Code);
if Message_Body = "" then
Set.Mode (Result, Header);
else
Set.Message_Body (Result, Message_Body);
Set.Content_Type (Result, Content_Type);
end if;
return Result;
end Acknowledge;
------------
-- Adjust --
------------
overriding procedure Adjust (Object : in out Data) is
begin
Object.Ref_Counter.Counter := Object.Ref_Counter.Counter + 1;
end Adjust;
------------------
-- Authenticate --
------------------
function Authenticate
(Realm : String;
Mode : Authentication_Mode := Basic;
Stale : Boolean := False;
Message : String := Default_Authenticate_Message)
return Data
is
Result : Data;
begin
Set.Authentication (Result, Realm, Mode, Stale);
Set.Content_Type (Result, AWS.MIME.Text_HTML);
Set.Message_Body (Result, Message);
return Result;
end Authenticate;
--------------------
-- Authentication --
--------------------
function Authentication (D : Data) return Authentication_Mode is
use AWS.Headers;
Auth_Values : constant VString_Array :=
Get_Values (D.Header, Messages.WWW_Authenticate_Token);
begin
if Auth_Values'Length = 1 then
return Authentication_Mode'Value
(Values.Get_Unnamed_Value (To_String (Auth_Values (1)), 1));
else
return Any;
end if;
end Authentication;
--------------------------
-- Authentication_Stale --
--------------------------
function Authentication_Stale (D : Data) return Boolean is
use AWS.Headers;
Auth_Values : constant VString_Array :=
Get_Values (D.Header, Messages.WWW_Authenticate_Token);
begin
for J in Auth_Values'Range loop
declare
Stale_Image : constant String :=
Values.Search
(To_String (Auth_Values (J)), "stale", False);
begin
if Stale_Image /= "" then
return Boolean'Value (Stale_Image);
end if;
end;
end loop;
return False;
end Authentication_Stale;
-----------
-- Build --
-----------
function Build
(Content_Type : String;
Message_Body : String;
Status_Code : Messages.Status_Code := Messages.S200;
Cache_Control : Messages.Cache_Option := Messages.Unspecified;
Encoding : Messages.Content_Encoding := Messages.Identity)
return Data
is
Result : Data;
begin
Set.Status_Code (Result, Status_Code);
Set.Content_Type (Result, Content_Type);
Set.Data_Encoding (Result, Encoding);
Set.Message_Body (Result, Message_Body);
Set.Cache_Control (Result, Cache_Control);
return Result;
end Build;
function Build
(Content_Type : String;
UString_Message : Strings.Unbounded.Unbounded_String;
Status_Code : Messages.Status_Code := Messages.S200;
Cache_Control : Messages.Cache_Option := Messages.Unspecified;
Encoding : Messages.Content_Encoding := Messages.Identity)
return Data
is
Result : Data;
begin
Set.Status_Code (Result, Status_Code);
Set.Content_Type (Result, Content_Type);
Set.Data_Encoding (Result, Encoding);
Set.Message_Body (Result, UString_Message);
Set.Cache_Control (Result, Cache_Control);
return Result;
end Build;
function Build
(Content_Type : String;
Message_Body : Streams.Stream_Element_Array;
Status_Code : Messages.Status_Code := Messages.S200;
Cache_Control : Messages.Cache_Option := Messages.Unspecified;
Encoding : Messages.Content_Encoding := Messages.Identity)
return Data
is
Result : Data;
begin
Set.Status_Code (Result, Status_Code);
Set.Content_Type (Result, Content_Type);
Set.Data_Encoding (Result, Encoding);
Set.Message_Body (Result, Message_Body);
Set.Cache_Control (Result, Cache_Control);
return Result;
end Build;
-------------------
-- Cache_Control --
-------------------
function Cache_Control (D : Data) return Messages.Cache_Option is
begin
return Messages.Cache_Option
(Headers.Get (D.Header, Messages.Cache_Control_Token));
end Cache_Control;
function Cache_Control (D : Data) return Messages.Cache_Data is
begin
return Messages.To_Cache_Data (Messages.Response, Cache_Control (D));
end Cache_Control;
--------------------
-- Close_Resource --
--------------------
function Close_Resource (D : Data) return Boolean is
begin
return D.Close_Stream;
end Close_Resource;
--------------------
-- Content_Length --
--------------------
function Content_Length (D : Data) return Content_Length_Type is
CL_Image : constant String :=
Headers.Get (D.Header, Messages.Content_Length_Token);
begin
if CL_Image = "" then
return Undefined_Length;
else
return Content_Length_Type'Value (CL_Image);
end if;
end Content_Length;
------------------
-- Content_Type --
------------------
function Content_Type (D : Data) return String is
begin
return To_String (D.Content_Type);
end Content_Type;
----------------------
-- Create_Resource --
----------------------
procedure Create_Resource
(D : in out Data;
File : out AWS.Resources.File_Type;
GZip : Boolean)
is
use AWS.Resources;
GZip_Out : Boolean := GZip;
begin
case D.Mode is
when Response.File =>
Open (File, Filename (D), "shared=no", GZip_Out);
if GZip_Out then
Set.Update_Header (D, Messages.Content_Encoding_Token, "gzip");
end if;
when Response.File_Once =>
declare
Stream : AWS.Resources.Streams.Stream_Access;
begin
Stream := new AWS.Resources.Streams.Disk.Once.Stream_Type;
AWS.Resources.Streams.Disk.Once.Open
(AWS.Resources.Streams.Disk.Once.Stream_Type (Stream.all),
Filename (D), "shared=no");
AWS.Resources.Streams.Create (File, Stream);
end;
when Response.Stream | Response.Message =>
Resources.Streams.Create (File, D.Stream);
D.Ref_Counter.Stream_Taken := True;
when others =>
-- Should not be called for others response modes
raise Constraint_Error;
end case;
end Create_Resource;
-----------
-- Empty --
-----------
function Empty return Data is
Result : Data;
begin
Set.Status_Code (Result, Messages.S204);
return Result;
end Empty;
-------------
-- Expires --
-------------
function Expires (D : Data) return Calendar.Time is
begin
return Messages.To_Time (Headers.Get (D.Header, Messages.Expires_Token));
end Expires;
----------
-- File --
----------
function File
(Content_Type : String;
Filename : String;
Status_Code : Messages.Status_Code := Messages.S200;
Cache_Control : Messages.Cache_Option := Messages.Unspecified;
Encoding : Messages.Content_Encoding := Messages.Identity;
Once : Boolean := False;
Disposition : Disposition_Mode := None;
User_Filename : String := "") return Data
is
function CD_Filename return String is
(if User_Filename = ""
then Directories.Simple_Name (Filename)
else User_Filename) with Inline;
-- Returns the Content-Disposition filename
Result : Data;
begin
Set.Status_Code (Result, Status_Code);
Set.Content_Type (Result, Content_Type);
Set.Filename (Result, Filename);
Set.Cache_Control (Result, Cache_Control);
if Resources.Is_Regular_File (Filename) then
-- Set the Content_Disposition to properly pass the filename to
-- the browser.
case Disposition is
when Attachment =>
Set.Add_Header
(Result,
Messages.Content_Disposition_Token,
"attachment; filename=""" & CD_Filename & '"');
when Inline =>
Set.Add_Header
(Result,
Messages.Content_Disposition_Token,
"inline; filename=""" & CD_Filename & '"');
when None =>
null;
end case;
if Once then
Set.Mode (Result, File_Once);
else
Set.Mode (Result, File);
end if;
case Encoding is
when Messages.GZip =>
Response.Set.Add_Header
(Result, Messages.Content_Encoding_Token, "gzip");
when Messages.Deflate =>
Response.Set.Add_Header
(Result, Messages.Content_Encoding_Token, "deflate");
when Messages.Identity =>
null;
end case;
end if;
return Result;
end File;
--------------
-- Filename --
--------------
function Filename (D : Data) return String is
begin
return To_String (D.Filename);
end Filename;
--------------
-- Finalize --
--------------
overriding procedure Finalize (Object : in out Data) is
use Resources.Streams;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Release_Controller, Release_Controller_Access);
Ref_Counter : Release_Controller_Access := Object.Ref_Counter;
begin
-- Ensure call is idempotent
Object.Ref_Counter := null;
if Ref_Counter /= null then
Ref_Counter.Counter := Ref_Counter.Counter - 1;
if Ref_Counter.Counter = 0 then
-- No more reference to this object
if not Ref_Counter.Stream_Taken
and then Object.Stream /= null
then
-- We can finalize it as the socket has not been recorded
Close (Object.Stream.all);
Unchecked_Free (Object.Stream);
end if;
Unchecked_Free (Ref_Counter);
end if;
end if;
end Finalize;
----------------
-- Has_Header --
----------------
function Has_Header (D : Data; Name : String) return Boolean is
begin
return D.Header.Exist (Name);
end Has_Header;
------------
-- Header --
------------
function Header (D : Data) return AWS.Headers.List is
begin
return D.Header;
end Header;
function Header (D : Data; Name : String; N : Positive) return String is
begin
return Headers.Get (D.Header, Name, N);
end Header;
function Header (D : Data; Name : String) return String is
begin
return Headers.Get_Values (D.Header, Name);
end Header;
----------------
-- Initialize --
----------------
overriding procedure Initialize (Object : in out Data) is
begin
Object.Ref_Counter := new Release_Controller;
Object.Header.Reset;
end Initialize;
--------------
-- Is_Empty --
--------------
function Is_Empty (D : Data) return Boolean is
begin
return D.Mode = No_Data;
end Is_Empty;
----------------
-- Keep_Alive --
----------------
function Keep_Alive (D : Data) return Boolean is
begin
return D.Keep_Alive;
end Keep_Alive;
--------------
-- Location --
--------------
function Location (D : Data) return String is
begin
return Headers.Get (D.Header, Messages.Location_Token);
end Location;
------------------
-- Message_Body --
------------------
function Message_Body (D : Data) return String is
begin
return Translator.To_String (Message_Body (D));
end Message_Body;
function Message_Body (D : Data) return Unbounded_String is
use type Resources.Streams.Stream_Access;
Result : Unbounded_String;
Buffer : Stream_Element_Array (1 .. 4_096);
Last : Stream_Element_Offset;
begin
if D.Stream = null then
return Null_Unbounded_String;
end if;
loop
Resources.Streams.Read (D.Stream.all, Buffer, Last);
Append (Result, Translator.To_String (Buffer (1 .. Last)));
exit when Last < Buffer'Last;
end loop;
RSM.Reset (RSM.Stream_Type (D.Stream.all));
return Result;
end Message_Body;
function Message_Body (D : Data) return Streams.Stream_Element_Array is
use type Resources.Streams.Stream_Access;
No_Data : constant Streams.Stream_Element_Array := (1 .. 0 => 0);
Size : Stream_Element_Offset;
begin
if D.Stream = null then
return No_Data;
end if;
Size := Resources.Streams.Size (D.Stream.all);
if Size = Resources.Undefined_Length then
-- Undefined_Length could have only user defined streams.
-- We do not have memory stream here.
raise Constraint_Error;
else
declare
Result : Stream_Element_Array (1 .. Size);
Last : Stream_Element_Offset;
begin
Resources.Streams.Read (D.Stream.all, Result, Last);
-- Raise Contraint_Error on try to get Message_Body
-- not from memory stream.
RSM.Reset (RSM.Stream_Type (D.Stream.all));
return Result;
end;
end if;
end Message_Body;
procedure Message_Body
(D : Data;
File : out AWS.Resources.File_Type) is
begin
Resources.Streams.Create (File, D.Stream);
D.Ref_Counter.Stream_Taken := True;
end Message_Body;
----------
-- Mode --
----------
function Mode (D : Data) return Data_Mode is
begin
return D.Mode;
end Mode;
-----------
-- Moved --
-----------
function Moved
(Location : String;
Message : String := Default_Moved_Message;
Content_Type : String := AWS.MIME.Text_HTML;
Cache_Control : Messages.Cache_Option := Messages.Unspecified)
return Data
is
use Ada.Strings;
function Build_Message_Body return String;
-- Returns proper message body using Message template. It replaces _@_
-- in Message by Location.
------------------------
-- Build_Message_Body --
------------------------
function Build_Message_Body return String is
Start : constant Natural := Fixed.Index (Message, "_@_");
begin
if Start = 0 then
return Message;
else
return Fixed.Replace_Slice (Message, Start, Start + 2, Location);
end if;
end Build_Message_Body;
Message_Body : constant String := Build_Message_Body;
Result : Data;
begin
Set.Location (Result, Location);
Set.Status_Code (Result, Messages.S301);
Set.Message_Body (Result, Message_Body);
Set.Content_Type (Result, Content_Type);
Set.Cache_Control (Result, Cache_Control);
return Result;
end Moved;
-----------
-- Realm --
-----------
function Realm (D : Data) return String is
use Headers;
begin
return Values.Search
(Header_Value => Get (D.Header, Messages.WWW_Authenticate_Token),
Name => "realm",
Case_Sensitive => False);
end Realm;
-----------------
-- Send_Header --
-----------------
procedure Send_Header (Socket : Net.Socket_Type'Class; D : Data) is
begin
Headers.Send_Header (Socket, D.Header);
end Send_Header;
------------------
-- Socket_Taken --
------------------
function Socket_Taken return Data is
Result : Data;
begin
Set.Mode (Result, Socket_Taken);
return Result;
end Socket_Taken;
-----------------
-- Status_Code --
-----------------
function Status_Code (D : Data) return Messages.Status_Code is
begin
return D.Status_Code;
end Status_Code;
------------
-- Stream --
------------
function Stream
(Content_Type : String;
Handle : not null access Resources.Streams.Stream_Type'Class;
Status_Code : Messages.Status_Code := Messages.S200;
Cache_Control : Messages.Cache_Option := Messages.No_Cache;
Encoding : Messages.Content_Encoding := Messages.Identity;
Server_Close : Boolean := True;
Disposition : Disposition_Mode := None;
User_Filename : String := "") return Data
is
function CD_Filename return String with Inline;
-- Returns the Content-Disposition filename
-----------------
-- CD_Filename --
-----------------
function CD_Filename return String is
begin
if User_Filename = "" then
return Directories.Simple_Name
(Resources.Streams.Name (Handle.all));
else
return User_Filename;
end if;
end CD_Filename;
Result : Data;
begin
if Handle.Name /= "" then
Set.Filename (Result, Handle.Name);
end if;
Set.Stream (Result, Handle, Encoding);
Set.Status_Code (Result, Status_Code);
Set.Content_Type (Result, Content_Type);
Set.Cache_Control (Result, Cache_Control);
Set.Close_Resource (Result, Server_Close);
-- Set the Content_Disposition to properly pass the filename to
-- the browser.
if Disposition = None or else CD_Filename = "" then
null;
elsif Disposition = Attachment then
Set.Add_Header
(Result,
Messages.Content_Disposition_Token,
"attachment; filename=""" & CD_Filename & '"');
elsif Disposition = Inline then
Set.Add_Header
(Result,
Messages.Content_Disposition_Token,
"inline; filename=""" & CD_Filename & '"');
end if;
return Result;
end Stream;
---------
-- URL --
---------
function URL
(Location : String;
Cache_Control : Messages.Cache_Option := Messages.Unspecified)
return Data
is
Result : Data;
begin
Set.Status_Code (Result, Messages.S302);
Set.Location (Result, Location);
Set.Mode (Result, Header);
Set.Cache_Control (Result, Cache_Control);
return Result;
end URL;
---------------
-- WebSocket --
---------------
function WebSocket return Data is
Result : Data;
begin
Set.Status_Code (Result, Messages.S101);
Set.Mode (Result, WebSocket);
Set.Add_Header
(Result, Messages.Connection_Token, Messages.Upgrade_Token);
Set.Add_Header
(Result, Messages.Upgrade_Token, Messages.Websocket_Token);
return Result;
end WebSocket;
end AWS.Response;
|
micahwelf/FLTK-Ada | Ada | 4,547 | adb |
with
Interfaces.C,
System;
use type
System.Address;
package body FLTK.Widgets.Groups.Wizards is
procedure wizard_set_draw_hook
(W, D : in System.Address);
pragma Import (C, wizard_set_draw_hook, "wizard_set_draw_hook");
pragma Inline (wizard_set_draw_hook);
procedure wizard_set_handle_hook
(W, H : in System.Address);
pragma Import (C, wizard_set_handle_hook, "wizard_set_handle_hook");
pragma Inline (wizard_set_handle_hook);
function new_fl_wizard
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
return System.Address;
pragma Import (C, new_fl_wizard, "new_fl_wizard");
pragma Inline (new_fl_wizard);
procedure free_fl_wizard
(S : in System.Address);
pragma Import (C, free_fl_wizard, "free_fl_wizard");
pragma Inline (free_fl_wizard);
procedure fl_wizard_next
(W : in System.Address);
pragma Import (C, fl_wizard_next, "fl_wizard_next");
pragma Inline (fl_wizard_next);
procedure fl_wizard_prev
(W : in System.Address);
pragma Import (C, fl_wizard_prev, "fl_wizard_prev");
pragma Inline (fl_wizard_prev);
function fl_wizard_get_visible
(W : in System.Address)
return System.Address;
pragma Import (C, fl_wizard_get_visible, "fl_wizard_get_visible");
pragma Inline (fl_wizard_get_visible);
procedure fl_wizard_set_visible
(W, I : in System.Address);
pragma Import (C, fl_wizard_set_visible, "fl_wizard_set_visible");
pragma Inline (fl_wizard_set_visible);
procedure fl_wizard_draw
(W : in System.Address);
pragma Import (C, fl_wizard_draw, "fl_wizard_draw");
pragma Inline (fl_wizard_draw);
function fl_wizard_handle
(W : in System.Address;
E : in Interfaces.C.int)
return Interfaces.C.int;
pragma Import (C, fl_wizard_handle, "fl_wizard_handle");
pragma Inline (fl_wizard_handle);
procedure Finalize
(This : in out Wizard) is
begin
if This.Void_Ptr /= System.Null_Address and then
This in Wizard'Class
then
This.Clear;
free_fl_wizard (This.Void_Ptr);
This.Void_Ptr := System.Null_Address;
end if;
Finalize (Group (This));
end Finalize;
package body Forge is
function Create
(X, Y, W, H : in Integer;
Text : in String)
return Wizard is
begin
return This : Wizard do
This.Void_Ptr := new_fl_wizard
(Interfaces.C.int (X),
Interfaces.C.int (Y),
Interfaces.C.int (W),
Interfaces.C.int (H),
Interfaces.C.To_C (Text));
fl_group_end (This.Void_Ptr);
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
wizard_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
wizard_set_handle_hook (This.Void_Ptr, Handle_Hook'Address);
end return;
end Create;
end Forge;
procedure Next
(This : in out Wizard) is
begin
fl_wizard_next (This.Void_Ptr);
end Next;
procedure Prev
(This : in out Wizard) is
begin
fl_wizard_prev (This.Void_Ptr);
end Prev;
function Get_Visible
(This : in Wizard)
return access Widget'Class
is
Widget_Ptr : System.Address :=
fl_wizard_get_visible (This.Void_Ptr);
Actual_Widget : access Widget'Class :=
Widget_Convert.To_Pointer (fl_widget_get_user_data (Widget_Ptr));
begin
return Actual_Widget;
end Get_Visible;
procedure Set_Visible
(This : in out Wizard;
Item : in out Widget'Class) is
begin
fl_wizard_set_visible (This.Void_Ptr, Item.Void_Ptr);
end Set_Visible;
procedure Draw
(This : in out Wizard) is
begin
fl_wizard_draw (This.Void_Ptr);
end Draw;
function Handle
(This : in out Wizard;
Event : in Event_Kind)
return Event_Outcome is
begin
return Event_Outcome'Val
(fl_wizard_handle (This.Void_Ptr, Event_Kind'Pos (Event)));
end Handle;
end FLTK.Widgets.Groups.Wizards;
|
AdaCore/gpr | Ada | 64 | ads | package Test1 is
Msg : constant String := "Hello";
end Test1; |
MinimSecure/unum-sdk | Ada | 818 | adb | -- Copyright 2008-2019 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure Foo is
D : Data := (1, 2, 3, 4, 5, 6);
begin
Call_Me (D);
end Foo;
|
reznikmm/matreshka | Ada | 3,791 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- Helper subprograms for element modification notification.
------------------------------------------------------------------------------
with AMF.Utp;
package AMF.Internals.Tables.UTP_Notification is
procedure Notify_Attribute_Set
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Old_Value : AMF.Utp.Utp_Verdict;
New_Value : AMF.Utp.Utp_Verdict);
end AMF.Internals.Tables.UTP_Notification;
|
reznikmm/matreshka | Ada | 7,001 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Table.Movement_Cut_Off_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Table_Movement_Cut_Off_Element_Node is
begin
return Self : Table_Movement_Cut_Off_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_Movement_Cut_Off_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_Movement_Cut_Off
(ODF.DOM.Table_Movement_Cut_Off_Elements.ODF_Table_Movement_Cut_Off_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_Movement_Cut_Off_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Movement_Cut_Off_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Table_Movement_Cut_Off_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_Movement_Cut_Off
(ODF.DOM.Table_Movement_Cut_Off_Elements.ODF_Table_Movement_Cut_Off_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_Movement_Cut_Off_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_Movement_Cut_Off
(Visitor,
ODF.DOM.Table_Movement_Cut_Off_Elements.ODF_Table_Movement_Cut_Off_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.Movement_Cut_Off_Element,
Table_Movement_Cut_Off_Element_Node'Tag);
end Matreshka.ODF_Table.Movement_Cut_Off_Elements;
|
JeremyGrosser/clock3 | Ada | 2,057 | ads | with HAL.I2C; use HAL.I2C;
with HAL; use HAL;
with Ada.Unchecked_Conversion;
package DS3231 is
type Device
(Port : not null Any_I2C_Port;
Address : I2C_Address)
is tagged limited null record;
subtype Seconds_Type is Natural range 0 .. 59;
subtype Minutes_Type is Natural range 0 .. 59;
subtype Hours_Type is Natural range 0 .. 23;
subtype Date_Type is Natural range 1 .. 31;
subtype Month_Type is Natural range 1 .. 12;
subtype Year_Type is Natural;
type Date_Time is record
Second : Seconds_Type;
Minute : Minutes_Type;
Hour : Hours_Type;
Day : Date_Type;
Month : Month_Type;
Year : Year_Type;
end record;
procedure Initialize
(This : in out Device);
procedure Read
(This : in out Device;
Now : out Date_Time);
private
type Timer is record
Seconds_10 : UInt3;
Seconds : UInt4;
Minutes_10 : UInt3;
Minutes : UInt4;
Hour_24 : Boolean;
AM_PM : Boolean;
Hour_10 : Boolean;
Hour : UInt4;
Day : UInt3;
Date_10 : UInt2;
Date : UInt4;
Century : Boolean;
Month_10 : Boolean;
Month : UInt4;
Year_10 : UInt4;
Year : UInt4;
end record
with Size => 8 * 7;
for Timer use record
Seconds_10 at 0 range 4 .. 6;
Seconds at 0 range 0 .. 3;
Minutes_10 at 1 range 4 .. 6;
Minutes at 1 range 0 .. 3;
Hour_24 at 2 range 6 .. 6;
AM_PM at 2 range 5 .. 5;
Hour_10 at 2 range 4 .. 4;
Hour at 2 range 0 .. 3;
Day at 3 range 0 .. 2;
Date_10 at 4 range 4 .. 6;
Date at 4 range 0 .. 3;
Century at 5 range 7 .. 7;
Month_10 at 5 range 4 .. 4;
Month at 5 range 0 .. 3;
Year_10 at 6 range 4 .. 7;
Year at 6 range 0 .. 3;
end record;
end DS3231;
|
onox/orka | Ada | 937 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2016 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package Orka.SIMD.SSE.Singles is
pragma Pure;
type m128 is array (Index_4D) of Float_32
with Alignment => 16;
pragma Machine_Attribute (m128, "vector_type");
type m128_Array is array (Index_4D) of m128
with Alignment => 16;
end Orka.SIMD.SSE.Singles;
|
AdaCore/libadalang | Ada | 184 | adb | procedure Test is
type Arr is array (Integer range 1 .. 10) of Integer;
X : Arr := (others => 0);
begin
X (1 + 1 .. 3) := X (2 + 2 .. 5);
pragma Test_Statement;
end Test;
|
reznikmm/matreshka | Ada | 9,633 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Utp.Coding_Rules;
with AMF.Utp.Data_Partitions;
with AMF.Utp.Data_Pools;
with AMF.Utp.Data_Selectors;
with AMF.Utp.Default_Applications;
with AMF.Utp.Defaults;
with AMF.Utp.Determ_Alts;
with AMF.Utp.Finish_Actions;
with AMF.Utp.Get_Timezone_Actions;
with AMF.Utp.Literal_Anies;
with AMF.Utp.Literal_Any_Or_Nulls;
with AMF.Utp.Log_Actions;
with AMF.Utp.Managed_Elements;
with AMF.Utp.Read_Timer_Actions;
with AMF.Utp.SUTs;
with AMF.Utp.Set_Timezone_Actions;
with AMF.Utp.Start_Timer_Actions;
with AMF.Utp.Stop_Timer_Actions;
with AMF.Utp.Test_Cases;
with AMF.Utp.Test_Components;
with AMF.Utp.Test_Contexts;
with AMF.Utp.Test_Log_Applications;
with AMF.Utp.Test_Logs;
with AMF.Utp.Test_Objectives;
with AMF.Utp.Test_Suites;
with AMF.Utp.Time_Out_Actions;
with AMF.Utp.Time_Out_Messages;
with AMF.Utp.Time_Outs;
with AMF.Utp.Timer_Running_Actions;
with AMF.Utp.Validation_Actions;
package AMF.Factories.Utp_Factories is
pragma Preelaborate;
type Utp_Factory is limited interface
and AMF.Factories.Factory;
type Utp_Factory_Access is access all Utp_Factory'Class;
for Utp_Factory_Access'Storage_Size use 0;
not overriding function Create_Coding_Rule
(Self : not null access Utp_Factory)
return AMF.Utp.Coding_Rules.Utp_Coding_Rule_Access is abstract;
not overriding function Create_Data_Partition
(Self : not null access Utp_Factory)
return AMF.Utp.Data_Partitions.Utp_Data_Partition_Access is abstract;
not overriding function Create_Data_Pool
(Self : not null access Utp_Factory)
return AMF.Utp.Data_Pools.Utp_Data_Pool_Access is abstract;
not overriding function Create_Data_Selector
(Self : not null access Utp_Factory)
return AMF.Utp.Data_Selectors.Utp_Data_Selector_Access is abstract;
not overriding function Create_Default
(Self : not null access Utp_Factory)
return AMF.Utp.Defaults.Utp_Default_Access is abstract;
not overriding function Create_Default_Application
(Self : not null access Utp_Factory)
return AMF.Utp.Default_Applications.Utp_Default_Application_Access is abstract;
not overriding function Create_Determ_Alt
(Self : not null access Utp_Factory)
return AMF.Utp.Determ_Alts.Utp_Determ_Alt_Access is abstract;
not overriding function Create_Finish_Action
(Self : not null access Utp_Factory)
return AMF.Utp.Finish_Actions.Utp_Finish_Action_Access is abstract;
not overriding function Create_Get_Timezone_Action
(Self : not null access Utp_Factory)
return AMF.Utp.Get_Timezone_Actions.Utp_Get_Timezone_Action_Access is abstract;
not overriding function Create_Literal_Any
(Self : not null access Utp_Factory)
return AMF.Utp.Literal_Anies.Utp_Literal_Any_Access is abstract;
not overriding function Create_Literal_Any_Or_Null
(Self : not null access Utp_Factory)
return AMF.Utp.Literal_Any_Or_Nulls.Utp_Literal_Any_Or_Null_Access is abstract;
not overriding function Create_Log_Action
(Self : not null access Utp_Factory)
return AMF.Utp.Log_Actions.Utp_Log_Action_Access is abstract;
not overriding function Create_Managed_Element
(Self : not null access Utp_Factory)
return AMF.Utp.Managed_Elements.Utp_Managed_Element_Access is abstract;
not overriding function Create_Read_Timer_Action
(Self : not null access Utp_Factory)
return AMF.Utp.Read_Timer_Actions.Utp_Read_Timer_Action_Access is abstract;
not overriding function Create_SUT
(Self : not null access Utp_Factory)
return AMF.Utp.SUTs.Utp_SUT_Access is abstract;
not overriding function Create_Set_Timezone_Action
(Self : not null access Utp_Factory)
return AMF.Utp.Set_Timezone_Actions.Utp_Set_Timezone_Action_Access is abstract;
not overriding function Create_Start_Timer_Action
(Self : not null access Utp_Factory)
return AMF.Utp.Start_Timer_Actions.Utp_Start_Timer_Action_Access is abstract;
not overriding function Create_Stop_Timer_Action
(Self : not null access Utp_Factory)
return AMF.Utp.Stop_Timer_Actions.Utp_Stop_Timer_Action_Access is abstract;
not overriding function Create_Test_Case
(Self : not null access Utp_Factory)
return AMF.Utp.Test_Cases.Utp_Test_Case_Access is abstract;
not overriding function Create_Test_Component
(Self : not null access Utp_Factory)
return AMF.Utp.Test_Components.Utp_Test_Component_Access is abstract;
not overriding function Create_Test_Context
(Self : not null access Utp_Factory)
return AMF.Utp.Test_Contexts.Utp_Test_Context_Access is abstract;
not overriding function Create_Test_Log
(Self : not null access Utp_Factory)
return AMF.Utp.Test_Logs.Utp_Test_Log_Access is abstract;
not overriding function Create_Test_Log_Application
(Self : not null access Utp_Factory)
return AMF.Utp.Test_Log_Applications.Utp_Test_Log_Application_Access is abstract;
not overriding function Create_Test_Objective
(Self : not null access Utp_Factory)
return AMF.Utp.Test_Objectives.Utp_Test_Objective_Access is abstract;
not overriding function Create_Test_Suite
(Self : not null access Utp_Factory)
return AMF.Utp.Test_Suites.Utp_Test_Suite_Access is abstract;
not overriding function Create_Time_Out
(Self : not null access Utp_Factory)
return AMF.Utp.Time_Outs.Utp_Time_Out_Access is abstract;
not overriding function Create_Time_Out_Action
(Self : not null access Utp_Factory)
return AMF.Utp.Time_Out_Actions.Utp_Time_Out_Action_Access is abstract;
not overriding function Create_Time_Out_Message
(Self : not null access Utp_Factory)
return AMF.Utp.Time_Out_Messages.Utp_Time_Out_Message_Access is abstract;
not overriding function Create_Timer_Running_Action
(Self : not null access Utp_Factory)
return AMF.Utp.Timer_Running_Actions.Utp_Timer_Running_Action_Access is abstract;
not overriding function Create_Validation_Action
(Self : not null access Utp_Factory)
return AMF.Utp.Validation_Actions.Utp_Validation_Action_Access is abstract;
end AMF.Factories.Utp_Factories;
|
msrLi/portingSources | Ada | 856 | ads | -- Copyright 2014 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with System;
package Pck is
type Time_T is record
Secs : Integer;
end record;
procedure Do_Nothing (A : System.Address);
end Pck;
|
docandrew/troodon | Ada | 2,120 | ads | with Interfaces; use Interfaces;
with GL;
-------------------------------------------------------------------------------
-- Helper geometry primitives and functions
-------------------------------------------------------------------------------
package Render.Util is
type Point is record
x : GL.GLfloat;
y : GL.GLfloat;
s : GL.GLfloat;
t : GL.GLfloat;
end record;
type Box is array (Natural range 1..4) of Point with Convention => C;
type Point2D is record
x : GL.GLfloat;
y : GL.GLfloat;
end record;
type Line2D is array (Natural range 1..2) of Point2D with Convention => C;
type Box2D is array (Natural range 1..4) of Point2D with Convention => C;
-- Can pass these to GL functions with myvec(1)'Access
type Vec2 is array (Natural range 1..2) of aliased GL.GLfloat with Convention => C;
type Vec4 is array (Natural range 1..4) of aliased GL.GLfloat with Convention => C;
-- Make sure you transpose these if not already in column-major form
type Mat4 is array (Natural range 1..16) of aliased GL.GLfloat with Convention => C;
type DecorationColor is record
r : Float;
g : Float;
b : Float;
a : Float;
end record;
---------------------------------------------------------------------------
-- rgbaToGLColor
-- Convenience function for taking 32-bit RGBA and converting to
-- floating-point GL color
---------------------------------------------------------------------------
function rgbaToGLColor (rgb : Unsigned_32) return DecorationColor;
---------------------------------------------------------------------------
-- Build orthographic projection matrix. Akin to glm::ortho
---------------------------------------------------------------------------
function ortho (left : GL.GLfloat;
right : GL.GLfloat;
bottom : GL.GLfloat;
top : GL.GLfloat;
nearVal : GL.GLfloat;
farVal : GL.GLfloat) return Mat4;
end Render.Util; |
onox/orka | Ada | 2,739 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2017 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Containers.Ordered_Sets;
with Ada.Real_Time;
with Orka.Behaviors;
with Orka.Cameras;
with Orka.Jobs.System;
use Ada.Real_Time;
generic
Time_Step, Frame_Limit : Time_Span;
Camera : Cameras.Camera_Ptr;
with package Job_Manager is new Orka.Jobs.System (<>);
Maximum_Frame_Time : Time_Span := Milliseconds (1000);
-- Maximum allowed duration of a frame. The simulation loop will
-- exit by raising an exception if this time is exceeded
package Orka.Loops is
protected Handler is
procedure Stop;
procedure Set_Frame_Limit (Value : Time_Span);
function Frame_Limit return Time_Span;
procedure Enable_Limit (Enable : Boolean);
function Limit_Enabled return Boolean;
function Should_Stop return Boolean;
private
Limit : Time_Span := Orka.Loops.Frame_Limit;
Stop_Flag : Boolean := False;
Limit_Flag : Boolean := False;
end Handler;
use type Behaviors.Behavior_Ptr;
use type Behaviors.Behavior_Array_Access;
function "<" (Left, Right : Behaviors.Behavior_Ptr) return Boolean;
package Behavior_Sets is new Ada.Containers.Ordered_Sets
(Behaviors.Behavior_Ptr, "<", "=");
protected Scene is
procedure Add (Object : Behaviors.Behavior_Ptr)
with Post => Modified;
procedure Remove (Object : Behaviors.Behavior_Ptr)
with Post => Modified;
procedure Replace_Array (Target : in out Behaviors.Behavior_Array_Access)
with Pre => Target /= null,
Post => Target /= null and not Modified;
function Modified return Boolean;
procedure Set_Camera (Camera : Cameras.Camera_Ptr);
function Camera return Cameras.Camera_Ptr;
private
Modified_Flag : Boolean := False;
Behaviors_Set : Behavior_Sets.Set;
Scene_Camera : Cameras.Camera_Ptr := Orka.Loops.Camera;
end Scene;
procedure Stop_Loop;
procedure Run_Loop
(Render : not null access procedure
(Scene : not null Behaviors.Behavior_Array_Access;
Camera : Cameras.Camera_Ptr));
end Orka.Loops;
|
AdaCore/training_material | Ada | 249 | ads | with Task_Type;
package Protected_Object is
protected Monitor is
procedure Set (Id : Task_Type.Task_Id_T);
function Get return Task_Type.Task_Id_T;
private
Value : Task_Type.Task_Id_T;
end Monitor;
end Protected_Object;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 1,834 | adb | with STM32_SVD; use STM32_SVD;
with STM32_SVD.RCC; use STM32_SVD.RCC;
with STM32_SVD.GPIO; use STM32_SVD.GPIO;
with STM32GD.Startup;
package body STM32GD.Board is
procedure Enable_Peripherals is
begin
RCC_Periph.IOPENR.IOPAEN := 1;
RCC_Periph.IOPENR.IOPBEN := 1;
RCC_Periph.IOPENR.IOPCEN := 1;
RCC_Periph.APB1ENR.USART2EN := 1;
RCC_Periph.APB2ENR.SPI1EN := 1;
RCC_Periph.APB1ENR.I2C1EN := 1;
RCC_Periph.APB2ENR.ADCEN := 1;
BUTTON.Init;
LED.Init;
LED2.Init;
CSN.Init;
CSN.Set;
SCLK.Init;
MISO.Init;
MOSI.Init;
IRQ.Init;
CE.Init;
TX.Init;
RX.Init;
SCL.Init;
SDA.Init;
USART.Init;
I2C.Init;
SPI.Init;
end Enable_Peripherals;
procedure Disable_Peripherals is
begin
RCC_Periph.IOPENR := ( Reserved_5_6 => 0, Reserved_8_31 => 0, others => 1);
GPIOA_Periph.MODER.Val := 16#FFFF_FFFF#;
GPIOB_Periph.MODER.Val := 16#FFFF_FFFF#;
GPIOC_Periph.MODER.Val := 16#FFFF_FFFF#;
GPIOD_Periph.MODER.Val := 16#FFFF_FFFF#;
GPIOE_Periph.MODER.Val := 16#FFFF_FFFF#;
GPIOH_Periph.MODER.Val := 16#FFFF_FFFF#;
MOSI.Set_Input;
MOSI.Set_Pull_Down;
MISO.Set_Input;
MISO.Set_Pull_Down;
SCLK.Set_Input;
SCLK.Set_Pull_Up;
CSN.Set_Input;
CSN.Set_Pull_Up;
CE.Set_Input;
CE.Set_Pull_Down;
RCC_Periph.IOPENR := ( Reserved_5_6 => 0, Reserved_8_31 => 0, others => 0);
RCC_Periph.APB1ENR.USART2EN := 0;
RCC_Periph.APB2ENR.SPI1EN := 0;
RCC_Periph.APB1ENR.I2C1EN := 0;
RCC_Periph.APB2ENR.ADCEN := 0;
end Disable_Peripherals;
procedure Init is
begin
CLOCKS.Init;
RTC.Init;
Enable_Peripherals;
STM32GD.Clear_Event;
end Init;
end STM32GD.Board;
|
Tim-Tom/project-euler | Ada | 3,058 | adb | with Ada.Text_IO;
with PrimeInstances;
with Ada.Containers.Vectors;
package body Problem_47 is
package IO renames Ada.Text_IO;
package Positive_Primes renames PrimeInstances.Positive_Primes;
package Positive_Vectors is new Ada.Containers.Vectors(Index_Type => Positive,
Element_Type => Positive);
procedure Solve is
gen : Positive_Primes.Prime_Generator := Positive_Primes.Make_Generator;
searching : constant := 4;
next_prime : Positive;
primes : Positive_Vectors.Vector := Positive_Vectors.Empty_Vector;
function Num_Factors(num : Positive) return Natural is
factor_count : Natural := 0;
function "=" (left,right : Positive_Vectors.Cursor) return Boolean renames Positive_Vectors."=";
prime_cursor : Positive_Vectors.Cursor := primes.First;
begin
while prime_cursor /= Positive_Vectors.No_Element loop
declare
prime : constant Positive := Positive_Vectors.Element(prime_cursor);
begin
Positive_Vectors.Next(prime_cursor);
exit when prime > num;
if num mod prime = 0 then
factor_count := Natural'Succ(factor_count);
end if;
end;
end loop;
return factor_count;
end;
begin
loop
Positive_Primes.Next_Prime(gen, next_prime);
primes.Append(next_prime);
exit when next_prime > 644;
end loop;
composite_search:
for composite_base in 161 .. 1_000_000 loop
declare
composite : constant Positive := composite_base * searching;
begin
while composite > next_prime loop
Positive_Primes.Next_Prime(gen, next_prime);
primes.Append(next_prime);
end loop;
if Num_Factors(composite) = searching then
declare
prime_count : Positive := 1;
smallest : Positive := composite;
begin
for comp in reverse composite - (searching - 1) .. composite - 1 loop
if Num_Factors(comp) = searching then
prime_count := prime_count + 1;
smallest := comp;
else
exit;
end if;
end loop;
for comp in composite + 1 .. composite + (searching - 1) loop
if Num_Factors(comp) = searching then
prime_count := prime_count + 1;
if prime_count = searching then
IO.Put_Line(Positive'Image(smallest));
exit composite_search;
end if;
else
exit;
end if;
end loop;
end;
end if;
end;
end loop composite_search;
end Solve;
end Problem_47;
|
strenkml/EE368 | Ada | 337 | adb |
with Memory.Stats;
separate (Parser)
procedure Parse_Stats(parser : in out Parser_Type;
result : out Memory_Pointer) is
mem : Memory_Pointer := null;
begin
if Get_Type(parser) = Open then
Parse_Memory(parser, mem);
end if;
result := Memory_Pointer(Stats.Create_Stats(mem));
end Parse_Stats;
|
AdaCore/libadalang | Ada | 75 | ads | package Testpr3
with Preelaborate
is
A : Integer := 12;
end Testpr3;
|
micahwelf/FLTK-Ada | Ada | 6,154 | ads |
private with
Interfaces.C.Strings,
System;
package FLTK.Widgets.Inputs is
type Input is new Widget with private;
type Input_Reference (Data : not null access Input'Class) is limited null record
with Implicit_Dereference => Data;
type Input_Kind is
(Normal_Kind, Float_Kind, Integer_Kind, Multiline_Kind,
Secret_Kind, Readonly_Kind, Wrap_Kind);
package Forge is
function Create
(X, Y, W, H : in Integer;
Text : in String)
return Input;
end Forge;
procedure Copy
(This : in out Input);
procedure Cut
(This : in out Input);
procedure Cut
(This : in out Input;
Num_Bytes : in Integer);
procedure Cut
(This : in out Input;
Start, Finish : in Integer);
procedure Copy_Cuts
(This : in out Input);
procedure Undo
(This : in out Input);
function Has_Changed
(This : in Input)
return Boolean;
procedure Clear_Changed
(This : in out Input);
function Is_Readonly
(This : in Input)
return Boolean;
procedure Set_Readonly
(This : in out Input;
To : in Boolean);
function Is_Tab_Nav
(This : in Input)
return Boolean;
procedure Set_Tab_Nav
(This : in out Input;
To : in Boolean);
function Is_Wrap
(This : in Input)
return Boolean;
procedure Set_Wrap
(This : in out Input;
To : in Boolean);
function Get_Input_Type
(This : in Input)
return Input_Kind;
function Get_Shortcut_Key
(This : in Input)
return Key_Combo;
procedure Set_Shortcut_Key
(This : in out Input;
To : in Key_Combo);
function Get_Mark
(This : in Input)
return Natural;
procedure Set_Mark
(This : in out Input;
To : in Natural);
function Get_Position
(This : in Input)
return Natural;
procedure Set_Position
(This : in out Input;
To : in Natural);
function Index
(This : in Input;
Place : in Integer)
return Character;
procedure Insert
(This : in out Input;
Str : in String);
procedure Replace
(This : in out Input;
From, To : in Natural;
New_Text : in String);
function Get_Value
(This : in Input)
return String;
procedure Set_Value
(This : in out Input;
To : in String);
function Get_Maximum_Size
(This : in Input)
return Natural;
procedure Set_Maximum_Size
(This : in out Input;
To : in Natural);
function Size
(This : in Input)
return Natural;
function Get_Cursor_Color
(This : in Input)
return Color;
procedure Set_Cursor_Color
(This : in out Input;
To : in Color);
function Get_Text_Color
(This : in Input)
return Color;
procedure Set_Text_Color
(This : in out Input;
To : in Color);
function Get_Text_Font
(This : in Input)
return Font_Kind;
procedure Set_Text_Font
(This : in out Input;
To : in Font_Kind);
function Get_Text_Size
(This : in Input)
return Font_Size;
procedure Set_Text_Size
(This : in out Input;
To : in Font_Size);
procedure Resize
(This : in out Input;
W, H : in Integer);
procedure Draw
(This : in out Input);
function Handle
(This : in out Input;
Event : in Event_Kind)
return Event_Outcome;
package Extra is
procedure Set_Input_Type
(This : in out Input;
To : in Input_Kind);
end Extra;
private
type Input is new Widget with record
Was_Changed : Boolean := False;
end record;
overriding procedure Finalize
(This : in out Input);
pragma Inline (Copy);
pragma Inline (Cut);
pragma Inline (Copy_Cuts);
pragma Inline (Undo);
pragma Inline (Has_Changed);
pragma Inline (Clear_Changed);
pragma Inline (Is_Readonly);
pragma Inline (Set_Readonly);
pragma Inline (Is_Tab_Nav);
pragma Inline (Set_Tab_Nav);
pragma Inline (Is_Wrap);
pragma Inline (Set_Wrap);
pragma Inline (Get_Input_Type);
pragma Inline (Get_Shortcut_Key);
pragma Inline (Set_Shortcut_Key);
pragma Inline (Get_Mark);
pragma Inline (Set_Mark);
pragma Inline (Get_Position);
pragma Inline (Set_Position);
pragma Inline (Index);
pragma Inline (Insert);
pragma Inline (Replace);
pragma Inline (Get_Value);
pragma Inline (Set_Value);
pragma Inline (Get_Maximum_Size);
pragma Inline (Set_Maximum_Size);
pragma Inline (Size);
pragma Inline (Get_Cursor_Color);
pragma Inline (Set_Cursor_Color);
pragma Inline (Get_Text_Color);
pragma Inline (Set_Text_Color);
pragma Inline (Get_Text_Font);
pragma Inline (Set_Text_Font);
pragma Inline (Get_Text_Size);
pragma Inline (Set_Text_Size);
pragma Inline (Resize);
pragma Inline (Draw);
pragma Inline (Handle);
Input_Kind_Values : array (Input_Kind) of Interfaces.C.int :=
(Normal_Kind => 0,
Float_Kind => 1,
Integer_Kind => 2,
Multiline_Kind => 4,
Secret_Kind => 5,
Readonly_Kind => 8,
Wrap_Kind => 16);
function fl_input_get_value
(F : in System.Address)
return Interfaces.C.Strings.chars_ptr;
pragma Import (C, fl_input_get_value, "fl_input_get_value");
pragma Inline (fl_input_get_value);
end FLTK.Widgets.Inputs;
|
reznikmm/matreshka | Ada | 3,678 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with League.Holders.Generic_Holders;
package AMF.DG.Holders.Elliptical_Arc_Tos is
new League.Holders.Generic_Holders
(AMF.DG.DG_Elliptical_Arc_To);
pragma Preelaborate (AMF.DG.Holders.Elliptical_Arc_Tos);
|
stcarrez/ada-el | Ada | 2,421 | adb | -----------------------------------------------------------------------
-- methods -- Example of Method_Expression
-- Copyright (C) 2010, 2022 Free Software Foundation, Inc.
-- Written by Stephane Carrez ([email protected])
--
-- This file is part of ASF.
--
-- This program is free software; you can redistribute it and/or
-- modify it under the terms of the GNU General Public License as
-- published by the Free Software Foundation; either version 2,
-- or (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; see the file COPYING. If not, write to
-- the Free Software Foundation, 59 Temple Place - Suite 330,
-- Boston, MA 02111-1307, USA.
-----------------------------------------------------------------------
with EL.Expressions;
with EL.Contexts.Default;
with EL.Methods;
with EL.Methods.Func_String;
with Ada.Text_IO;
with Bean;
procedure Methods is
procedure Evaluate (Ctx : EL.Contexts.ELContext'Class;
Msg : in String);
use Bean;
use EL.Methods;
Joe : Person_Access := Create_Person ("Joe", "Smith", 12);
Bill : Person_Access := Create_Person ("Bill", "Johnson", 42);
Ctx : EL.Contexts.Default.Default_Context;
Method : EL.Expressions.Method_Expression;
procedure Evaluate (Ctx : EL.Contexts.ELContext'Class;
Msg : in String) is
Result : constant String := Func_String.Execute (Method, Msg, Ctx);
begin
Ada.Text_IO.Put_Line ("#{user.print} returned: " & Result);
end Evaluate;
begin
-- Get a method expression to invoke 'print' on the 'user' bean.
-- The method expression does not know anything about 'user' (Joe or Bill).
Method := EL.Expressions.Create_Expression ("#{user.print}", Ctx);
-- Bind the context to 'Joe' and evaluate.
Ctx.Set_Variable ("user", Joe);
Evaluate (Ctx, "This is Joe");
-- Bind the context to 'Bill' and evaluate.
Ctx.Set_Variable ("user", Bill);
Evaluate (Ctx, "This is Bill");
Free (Joe);
Free (Bill);
end Methods;
|
pdaxrom/Kino2 | Ada | 3,521 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Forms.Field_Types.IntField --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Contact: http://www.familiepfeifer.de/Contact.aspx?Lang=en
-- Version Control:
-- $Revision: 1.10 $
-- Binding Version 01.00
------------------------------------------------------------------------------
package Terminal_Interface.Curses.Forms.Field_Types.IntField is
pragma Preelaborate (Terminal_Interface.Curses.Forms.Field_Types.IntField);
type Integer_Field is new Field_Type with
record
Precision : Natural;
Lower_Limit : Integer;
Upper_Limit : Integer;
end record;
procedure Set_Field_Type (Fld : in Field;
Typ : in Integer_Field);
pragma Inline (Set_Field_Type);
end Terminal_Interface.Curses.Forms.Field_Types.IntField;
|
pdibez/mundo-aspiradora | Ada | 679 | adb | package body aspiradora is
procedure moverse(a : in out t_aspiradora) is
begin
a.direccion := direccion.direccion_opuesta(a.direccion);
end moverse;
function limpiar(a : in out t_aspiradora) return t_estado_casillero is
begin
return estado_casillero.Limpio;
end limpiar;
procedure no_hacer_nada(a : in out t_aspiradora) is
begin
null;
end no_hacer_nada;
procedure set_direccion(a : in out t_aspiradora; d: in t_direccion) is
begin
a.direccion := d ;
end set_direccion;
function get_direccion (a : in t_aspiradora) return t_direccion is
begin
return a.direccion;
end get_direccion;
end aspiradora;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 21,746 | ads | -- This spec has been automatically generated from STM32F103.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package STM32_SVD.SDIO is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype POWER_PWRCTRL_Field is STM32_SVD.UInt2;
-- Bits 1:0 = PWRCTRL: Power supply control bits
type POWER_Register is record
-- PWRCTRL
PWRCTRL : POWER_PWRCTRL_Field := 16#0#;
-- unspecified
Reserved_2_31 : STM32_SVD.UInt30 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for POWER_Register use record
PWRCTRL at 0 range 0 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
subtype CLKCR_CLKDIV_Field is STM32_SVD.Byte;
subtype CLKCR_CLKEN_Field is STM32_SVD.Bit;
subtype CLKCR_PWRSAV_Field is STM32_SVD.Bit;
subtype CLKCR_BYPASS_Field is STM32_SVD.Bit;
subtype CLKCR_WIDBUS_Field is STM32_SVD.UInt2;
subtype CLKCR_NEGEDGE_Field is STM32_SVD.Bit;
subtype CLKCR_HWFC_EN_Field is STM32_SVD.Bit;
-- SDI clock control register (SDIO_CLKCR)
type CLKCR_Register is record
-- Clock divide factor
CLKDIV : CLKCR_CLKDIV_Field := 16#0#;
-- Clock enable bit
CLKEN : CLKCR_CLKEN_Field := 16#0#;
-- Power saving configuration bit
PWRSAV : CLKCR_PWRSAV_Field := 16#0#;
-- Clock divider bypass enable bit
BYPASS : CLKCR_BYPASS_Field := 16#0#;
-- Wide bus mode enable bit
WIDBUS : CLKCR_WIDBUS_Field := 16#0#;
-- SDIO_CK dephasing selection bit
NEGEDGE : CLKCR_NEGEDGE_Field := 16#0#;
-- HW Flow Control enable
HWFC_EN : CLKCR_HWFC_EN_Field := 16#0#;
-- unspecified
Reserved_15_31 : STM32_SVD.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CLKCR_Register use record
CLKDIV at 0 range 0 .. 7;
CLKEN at 0 range 8 .. 8;
PWRSAV at 0 range 9 .. 9;
BYPASS at 0 range 10 .. 10;
WIDBUS at 0 range 11 .. 12;
NEGEDGE at 0 range 13 .. 13;
HWFC_EN at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
subtype CMD_CMDINDEX_Field is STM32_SVD.UInt6;
subtype CMD_WAITRESP_Field is STM32_SVD.UInt2;
subtype CMD_WAITINT_Field is STM32_SVD.Bit;
subtype CMD_WAITPEND_Field is STM32_SVD.Bit;
subtype CMD_CPSMEN_Field is STM32_SVD.Bit;
subtype CMD_SDIOSuspend_Field is STM32_SVD.Bit;
subtype CMD_ENCMDcompl_Field is STM32_SVD.Bit;
subtype CMD_nIEN_Field is STM32_SVD.Bit;
subtype CMD_CE_ATACMD_Field is STM32_SVD.Bit;
-- SDIO command register (SDIO_CMD)
type CMD_Register is record
-- CMDINDEX
CMDINDEX : CMD_CMDINDEX_Field := 16#0#;
-- WAITRESP
WAITRESP : CMD_WAITRESP_Field := 16#0#;
-- WAITINT
WAITINT : CMD_WAITINT_Field := 16#0#;
-- WAITPEND
WAITPEND : CMD_WAITPEND_Field := 16#0#;
-- CPSMEN
CPSMEN : CMD_CPSMEN_Field := 16#0#;
-- SDIOSuspend
SDIOSuspend : CMD_SDIOSuspend_Field := 16#0#;
-- ENCMDcompl
ENCMDcompl : CMD_ENCMDcompl_Field := 16#0#;
-- nIEN
nIEN : CMD_nIEN_Field := 16#0#;
-- CE_ATACMD
CE_ATACMD : CMD_CE_ATACMD_Field := 16#0#;
-- unspecified
Reserved_15_31 : STM32_SVD.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CMD_Register use record
CMDINDEX at 0 range 0 .. 5;
WAITRESP at 0 range 6 .. 7;
WAITINT at 0 range 8 .. 8;
WAITPEND at 0 range 9 .. 9;
CPSMEN at 0 range 10 .. 10;
SDIOSuspend at 0 range 11 .. 11;
ENCMDcompl at 0 range 12 .. 12;
nIEN at 0 range 13 .. 13;
CE_ATACMD at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
subtype RESPCMD_RESPCMD_Field is STM32_SVD.UInt6;
-- SDIO command register
type RESPCMD_Register is record
-- Read-only. RESPCMD
RESPCMD : RESPCMD_RESPCMD_Field;
-- unspecified
Reserved_6_31 : STM32_SVD.UInt26;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RESPCMD_Register use record
RESPCMD at 0 range 0 .. 5;
Reserved_6_31 at 0 range 6 .. 31;
end record;
subtype DLEN_DATALENGTH_Field is STM32_SVD.UInt25;
-- Bits 24:0 = DATALENGTH: Data length value
type DLEN_Register is record
-- Data length value
DATALENGTH : DLEN_DATALENGTH_Field := 16#0#;
-- unspecified
Reserved_25_31 : STM32_SVD.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DLEN_Register use record
DATALENGTH at 0 range 0 .. 24;
Reserved_25_31 at 0 range 25 .. 31;
end record;
subtype DCTRL_DTEN_Field is STM32_SVD.Bit;
subtype DCTRL_DTDIR_Field is STM32_SVD.Bit;
subtype DCTRL_DTMODE_Field is STM32_SVD.Bit;
subtype DCTRL_DMAEN_Field is STM32_SVD.Bit;
subtype DCTRL_DBLOCKSIZE_Field is STM32_SVD.UInt4;
subtype DCTRL_PWSTART_Field is STM32_SVD.Bit;
subtype DCTRL_PWSTOP_Field is STM32_SVD.Bit;
subtype DCTRL_RWMOD_Field is STM32_SVD.Bit;
subtype DCTRL_SDIOEN_Field is STM32_SVD.Bit;
-- SDIO data control register (SDIO_DCTRL)
type DCTRL_Register is record
-- DTEN
DTEN : DCTRL_DTEN_Field := 16#0#;
-- DTDIR
DTDIR : DCTRL_DTDIR_Field := 16#0#;
-- DTMODE
DTMODE : DCTRL_DTMODE_Field := 16#0#;
-- DMAEN
DMAEN : DCTRL_DMAEN_Field := 16#0#;
-- DBLOCKSIZE
DBLOCKSIZE : DCTRL_DBLOCKSIZE_Field := 16#0#;
-- PWSTART
PWSTART : DCTRL_PWSTART_Field := 16#0#;
-- PWSTOP
PWSTOP : DCTRL_PWSTOP_Field := 16#0#;
-- RWMOD
RWMOD : DCTRL_RWMOD_Field := 16#0#;
-- SDIOEN
SDIOEN : DCTRL_SDIOEN_Field := 16#0#;
-- unspecified
Reserved_12_31 : STM32_SVD.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DCTRL_Register use record
DTEN at 0 range 0 .. 0;
DTDIR at 0 range 1 .. 1;
DTMODE at 0 range 2 .. 2;
DMAEN at 0 range 3 .. 3;
DBLOCKSIZE at 0 range 4 .. 7;
PWSTART at 0 range 8 .. 8;
PWSTOP at 0 range 9 .. 9;
RWMOD at 0 range 10 .. 10;
SDIOEN at 0 range 11 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
subtype DCOUNT_DATACOUNT_Field is STM32_SVD.UInt25;
-- Bits 24:0 = DATACOUNT: Data count value
type DCOUNT_Register is record
-- Read-only. Data count value
DATACOUNT : DCOUNT_DATACOUNT_Field;
-- unspecified
Reserved_25_31 : STM32_SVD.UInt7;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DCOUNT_Register use record
DATACOUNT at 0 range 0 .. 24;
Reserved_25_31 at 0 range 25 .. 31;
end record;
subtype STA_CCRCFAIL_Field is STM32_SVD.Bit;
subtype STA_DCRCFAIL_Field is STM32_SVD.Bit;
subtype STA_CTIMEOUT_Field is STM32_SVD.Bit;
subtype STA_DTIMEOUT_Field is STM32_SVD.Bit;
subtype STA_TXUNDERR_Field is STM32_SVD.Bit;
subtype STA_RXOVERR_Field is STM32_SVD.Bit;
subtype STA_CMDREND_Field is STM32_SVD.Bit;
subtype STA_CMDSENT_Field is STM32_SVD.Bit;
subtype STA_DATAEND_Field is STM32_SVD.Bit;
subtype STA_STBITERR_Field is STM32_SVD.Bit;
subtype STA_DBCKEND_Field is STM32_SVD.Bit;
subtype STA_CMDACT_Field is STM32_SVD.Bit;
subtype STA_TXACT_Field is STM32_SVD.Bit;
subtype STA_RXACT_Field is STM32_SVD.Bit;
subtype STA_TXFIFOHE_Field is STM32_SVD.Bit;
subtype STA_RXFIFOHF_Field is STM32_SVD.Bit;
subtype STA_TXFIFOF_Field is STM32_SVD.Bit;
subtype STA_RXFIFOF_Field is STM32_SVD.Bit;
subtype STA_TXFIFOE_Field is STM32_SVD.Bit;
subtype STA_RXFIFOE_Field is STM32_SVD.Bit;
subtype STA_TXDAVL_Field is STM32_SVD.Bit;
subtype STA_RXDAVL_Field is STM32_SVD.Bit;
subtype STA_SDIOIT_Field is STM32_SVD.Bit;
subtype STA_CEATAEND_Field is STM32_SVD.Bit;
-- SDIO status register (SDIO_STA)
type STA_Register is record
-- Read-only. CCRCFAIL
CCRCFAIL : STA_CCRCFAIL_Field;
-- Read-only. DCRCFAIL
DCRCFAIL : STA_DCRCFAIL_Field;
-- Read-only. CTIMEOUT
CTIMEOUT : STA_CTIMEOUT_Field;
-- Read-only. DTIMEOUT
DTIMEOUT : STA_DTIMEOUT_Field;
-- Read-only. TXUNDERR
TXUNDERR : STA_TXUNDERR_Field;
-- Read-only. RXOVERR
RXOVERR : STA_RXOVERR_Field;
-- Read-only. CMDREND
CMDREND : STA_CMDREND_Field;
-- Read-only. CMDSENT
CMDSENT : STA_CMDSENT_Field;
-- Read-only. DATAEND
DATAEND : STA_DATAEND_Field;
-- Read-only. STBITERR
STBITERR : STA_STBITERR_Field;
-- Read-only. DBCKEND
DBCKEND : STA_DBCKEND_Field;
-- Read-only. CMDACT
CMDACT : STA_CMDACT_Field;
-- Read-only. TXACT
TXACT : STA_TXACT_Field;
-- Read-only. RXACT
RXACT : STA_RXACT_Field;
-- Read-only. TXFIFOHE
TXFIFOHE : STA_TXFIFOHE_Field;
-- Read-only. RXFIFOHF
RXFIFOHF : STA_RXFIFOHF_Field;
-- Read-only. TXFIFOF
TXFIFOF : STA_TXFIFOF_Field;
-- Read-only. RXFIFOF
RXFIFOF : STA_RXFIFOF_Field;
-- Read-only. TXFIFOE
TXFIFOE : STA_TXFIFOE_Field;
-- Read-only. RXFIFOE
RXFIFOE : STA_RXFIFOE_Field;
-- Read-only. TXDAVL
TXDAVL : STA_TXDAVL_Field;
-- Read-only. RXDAVL
RXDAVL : STA_RXDAVL_Field;
-- Read-only. SDIOIT
SDIOIT : STA_SDIOIT_Field;
-- Read-only. CEATAEND
CEATAEND : STA_CEATAEND_Field;
-- unspecified
Reserved_24_31 : STM32_SVD.Byte;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for STA_Register use record
CCRCFAIL at 0 range 0 .. 0;
DCRCFAIL at 0 range 1 .. 1;
CTIMEOUT at 0 range 2 .. 2;
DTIMEOUT at 0 range 3 .. 3;
TXUNDERR at 0 range 4 .. 4;
RXOVERR at 0 range 5 .. 5;
CMDREND at 0 range 6 .. 6;
CMDSENT at 0 range 7 .. 7;
DATAEND at 0 range 8 .. 8;
STBITERR at 0 range 9 .. 9;
DBCKEND at 0 range 10 .. 10;
CMDACT at 0 range 11 .. 11;
TXACT at 0 range 12 .. 12;
RXACT at 0 range 13 .. 13;
TXFIFOHE at 0 range 14 .. 14;
RXFIFOHF at 0 range 15 .. 15;
TXFIFOF at 0 range 16 .. 16;
RXFIFOF at 0 range 17 .. 17;
TXFIFOE at 0 range 18 .. 18;
RXFIFOE at 0 range 19 .. 19;
TXDAVL at 0 range 20 .. 20;
RXDAVL at 0 range 21 .. 21;
SDIOIT at 0 range 22 .. 22;
CEATAEND at 0 range 23 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype ICR_CCRCFAILC_Field is STM32_SVD.Bit;
subtype ICR_DCRCFAILC_Field is STM32_SVD.Bit;
subtype ICR_CTIMEOUTC_Field is STM32_SVD.Bit;
subtype ICR_DTIMEOUTC_Field is STM32_SVD.Bit;
subtype ICR_TXUNDERRC_Field is STM32_SVD.Bit;
subtype ICR_RXOVERRC_Field is STM32_SVD.Bit;
subtype ICR_CMDRENDC_Field is STM32_SVD.Bit;
subtype ICR_CMDSENTC_Field is STM32_SVD.Bit;
subtype ICR_DATAENDC_Field is STM32_SVD.Bit;
subtype ICR_STBITERRC_Field is STM32_SVD.Bit;
subtype ICR_DBCKENDC_Field is STM32_SVD.Bit;
subtype ICR_SDIOITC_Field is STM32_SVD.Bit;
subtype ICR_CEATAENDC_Field is STM32_SVD.Bit;
-- SDIO interrupt clear register (SDIO_ICR)
type ICR_Register is record
-- CCRCFAILC
CCRCFAILC : ICR_CCRCFAILC_Field := 16#0#;
-- DCRCFAILC
DCRCFAILC : ICR_DCRCFAILC_Field := 16#0#;
-- CTIMEOUTC
CTIMEOUTC : ICR_CTIMEOUTC_Field := 16#0#;
-- DTIMEOUTC
DTIMEOUTC : ICR_DTIMEOUTC_Field := 16#0#;
-- TXUNDERRC
TXUNDERRC : ICR_TXUNDERRC_Field := 16#0#;
-- RXOVERRC
RXOVERRC : ICR_RXOVERRC_Field := 16#0#;
-- CMDRENDC
CMDRENDC : ICR_CMDRENDC_Field := 16#0#;
-- CMDSENTC
CMDSENTC : ICR_CMDSENTC_Field := 16#0#;
-- DATAENDC
DATAENDC : ICR_DATAENDC_Field := 16#0#;
-- STBITERRC
STBITERRC : ICR_STBITERRC_Field := 16#0#;
-- DBCKENDC
DBCKENDC : ICR_DBCKENDC_Field := 16#0#;
-- unspecified
Reserved_11_21 : STM32_SVD.UInt11 := 16#0#;
-- SDIOITC
SDIOITC : ICR_SDIOITC_Field := 16#0#;
-- CEATAENDC
CEATAENDC : ICR_CEATAENDC_Field := 16#0#;
-- unspecified
Reserved_24_31 : STM32_SVD.Byte := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ICR_Register use record
CCRCFAILC at 0 range 0 .. 0;
DCRCFAILC at 0 range 1 .. 1;
CTIMEOUTC at 0 range 2 .. 2;
DTIMEOUTC at 0 range 3 .. 3;
TXUNDERRC at 0 range 4 .. 4;
RXOVERRC at 0 range 5 .. 5;
CMDRENDC at 0 range 6 .. 6;
CMDSENTC at 0 range 7 .. 7;
DATAENDC at 0 range 8 .. 8;
STBITERRC at 0 range 9 .. 9;
DBCKENDC at 0 range 10 .. 10;
Reserved_11_21 at 0 range 11 .. 21;
SDIOITC at 0 range 22 .. 22;
CEATAENDC at 0 range 23 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype MASK_CCRCFAILIE_Field is STM32_SVD.Bit;
subtype MASK_DCRCFAILIE_Field is STM32_SVD.Bit;
subtype MASK_CTIMEOUTIE_Field is STM32_SVD.Bit;
subtype MASK_DTIMEOUTIE_Field is STM32_SVD.Bit;
subtype MASK_TXUNDERRIE_Field is STM32_SVD.Bit;
subtype MASK_RXOVERRIE_Field is STM32_SVD.Bit;
subtype MASK_CMDRENDIE_Field is STM32_SVD.Bit;
subtype MASK_CMDSENTIE_Field is STM32_SVD.Bit;
subtype MASK_DATAENDIE_Field is STM32_SVD.Bit;
subtype MASK_STBITERRIE_Field is STM32_SVD.Bit;
subtype MASK_DBACKENDIE_Field is STM32_SVD.Bit;
subtype MASK_CMDACTIE_Field is STM32_SVD.Bit;
subtype MASK_TXACTIE_Field is STM32_SVD.Bit;
subtype MASK_RXACTIE_Field is STM32_SVD.Bit;
subtype MASK_TXFIFOHEIE_Field is STM32_SVD.Bit;
subtype MASK_RXFIFOHFIE_Field is STM32_SVD.Bit;
subtype MASK_TXFIFOFIE_Field is STM32_SVD.Bit;
subtype MASK_RXFIFOFIE_Field is STM32_SVD.Bit;
subtype MASK_TXFIFOEIE_Field is STM32_SVD.Bit;
subtype MASK_RXFIFOEIE_Field is STM32_SVD.Bit;
subtype MASK_TXDAVLIE_Field is STM32_SVD.Bit;
subtype MASK_RXDAVLIE_Field is STM32_SVD.Bit;
subtype MASK_SDIOITIE_Field is STM32_SVD.Bit;
subtype MASK_CEATENDIE_Field is STM32_SVD.Bit;
-- SDIO mask register (SDIO_MASK)
type MASK_Register is record
-- CCRCFAILIE
CCRCFAILIE : MASK_CCRCFAILIE_Field := 16#0#;
-- DCRCFAILIE
DCRCFAILIE : MASK_DCRCFAILIE_Field := 16#0#;
-- CTIMEOUTIE
CTIMEOUTIE : MASK_CTIMEOUTIE_Field := 16#0#;
-- DTIMEOUTIE
DTIMEOUTIE : MASK_DTIMEOUTIE_Field := 16#0#;
-- TXUNDERRIE
TXUNDERRIE : MASK_TXUNDERRIE_Field := 16#0#;
-- RXOVERRIE
RXOVERRIE : MASK_RXOVERRIE_Field := 16#0#;
-- CMDRENDIE
CMDRENDIE : MASK_CMDRENDIE_Field := 16#0#;
-- CMDSENTIE
CMDSENTIE : MASK_CMDSENTIE_Field := 16#0#;
-- DATAENDIE
DATAENDIE : MASK_DATAENDIE_Field := 16#0#;
-- STBITERRIE
STBITERRIE : MASK_STBITERRIE_Field := 16#0#;
-- DBACKENDIE
DBACKENDIE : MASK_DBACKENDIE_Field := 16#0#;
-- CMDACTIE
CMDACTIE : MASK_CMDACTIE_Field := 16#0#;
-- TXACTIE
TXACTIE : MASK_TXACTIE_Field := 16#0#;
-- RXACTIE
RXACTIE : MASK_RXACTIE_Field := 16#0#;
-- TXFIFOHEIE
TXFIFOHEIE : MASK_TXFIFOHEIE_Field := 16#0#;
-- RXFIFOHFIE
RXFIFOHFIE : MASK_RXFIFOHFIE_Field := 16#0#;
-- TXFIFOFIE
TXFIFOFIE : MASK_TXFIFOFIE_Field := 16#0#;
-- RXFIFOFIE
RXFIFOFIE : MASK_RXFIFOFIE_Field := 16#0#;
-- TXFIFOEIE
TXFIFOEIE : MASK_TXFIFOEIE_Field := 16#0#;
-- RXFIFOEIE
RXFIFOEIE : MASK_RXFIFOEIE_Field := 16#0#;
-- TXDAVLIE
TXDAVLIE : MASK_TXDAVLIE_Field := 16#0#;
-- RXDAVLIE
RXDAVLIE : MASK_RXDAVLIE_Field := 16#0#;
-- SDIOITIE
SDIOITIE : MASK_SDIOITIE_Field := 16#0#;
-- CEATENDIE
CEATENDIE : MASK_CEATENDIE_Field := 16#0#;
-- unspecified
Reserved_24_31 : STM32_SVD.Byte := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for MASK_Register use record
CCRCFAILIE at 0 range 0 .. 0;
DCRCFAILIE at 0 range 1 .. 1;
CTIMEOUTIE at 0 range 2 .. 2;
DTIMEOUTIE at 0 range 3 .. 3;
TXUNDERRIE at 0 range 4 .. 4;
RXOVERRIE at 0 range 5 .. 5;
CMDRENDIE at 0 range 6 .. 6;
CMDSENTIE at 0 range 7 .. 7;
DATAENDIE at 0 range 8 .. 8;
STBITERRIE at 0 range 9 .. 9;
DBACKENDIE at 0 range 10 .. 10;
CMDACTIE at 0 range 11 .. 11;
TXACTIE at 0 range 12 .. 12;
RXACTIE at 0 range 13 .. 13;
TXFIFOHEIE at 0 range 14 .. 14;
RXFIFOHFIE at 0 range 15 .. 15;
TXFIFOFIE at 0 range 16 .. 16;
RXFIFOFIE at 0 range 17 .. 17;
TXFIFOEIE at 0 range 18 .. 18;
RXFIFOEIE at 0 range 19 .. 19;
TXDAVLIE at 0 range 20 .. 20;
RXDAVLIE at 0 range 21 .. 21;
SDIOITIE at 0 range 22 .. 22;
CEATENDIE at 0 range 23 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype FIFOCNT_FIF0COUNT_Field is STM32_SVD.UInt24;
-- Bits 23:0 = FIFOCOUNT: Remaining number of words to be written to or
-- read from the FIFO
type FIFOCNT_Register is record
-- Read-only. FIF0COUNT
FIF0COUNT : FIFOCNT_FIF0COUNT_Field;
-- unspecified
Reserved_24_31 : STM32_SVD.Byte;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FIFOCNT_Register use record
FIF0COUNT at 0 range 0 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Secure digital input/output interface
type SDIO_Peripheral is record
-- Bits 1:0 = PWRCTRL: Power supply control bits
POWER : aliased POWER_Register;
-- SDI clock control register (SDIO_CLKCR)
CLKCR : aliased CLKCR_Register;
-- Bits 31:0 = : Command argument
ARG : aliased STM32_SVD.UInt32;
-- SDIO command register (SDIO_CMD)
CMD : aliased CMD_Register;
-- SDIO command register
RESPCMD : aliased RESPCMD_Register;
-- Bits 31:0 = CARDSTATUS1
RESPI1 : aliased STM32_SVD.UInt32;
-- Bits 31:0 = CARDSTATUS2
RESP2 : aliased STM32_SVD.UInt32;
-- Bits 31:0 = CARDSTATUS3
RESP3 : aliased STM32_SVD.UInt32;
-- Bits 31:0 = CARDSTATUS4
RESP4 : aliased STM32_SVD.UInt32;
-- Bits 31:0 = DATATIME: Data timeout period
DTIMER : aliased STM32_SVD.UInt32;
-- Bits 24:0 = DATALENGTH: Data length value
DLEN : aliased DLEN_Register;
-- SDIO data control register (SDIO_DCTRL)
DCTRL : aliased DCTRL_Register;
-- Bits 24:0 = DATACOUNT: Data count value
DCOUNT : aliased DCOUNT_Register;
-- SDIO status register (SDIO_STA)
STA : aliased STA_Register;
-- SDIO interrupt clear register (SDIO_ICR)
ICR : aliased ICR_Register;
-- SDIO mask register (SDIO_MASK)
MASK : aliased MASK_Register;
-- Bits 23:0 = FIFOCOUNT: Remaining number of words to be written to or
-- read from the FIFO
FIFOCNT : aliased FIFOCNT_Register;
-- bits 31:0 = FIFOData: Receive and transmit FIFO data
FIFO : aliased STM32_SVD.UInt32;
end record
with Volatile;
for SDIO_Peripheral use record
POWER at 16#0# range 0 .. 31;
CLKCR at 16#4# range 0 .. 31;
ARG at 16#8# range 0 .. 31;
CMD at 16#C# range 0 .. 31;
RESPCMD at 16#10# range 0 .. 31;
RESPI1 at 16#14# range 0 .. 31;
RESP2 at 16#18# range 0 .. 31;
RESP3 at 16#1C# range 0 .. 31;
RESP4 at 16#20# range 0 .. 31;
DTIMER at 16#24# range 0 .. 31;
DLEN at 16#28# range 0 .. 31;
DCTRL at 16#2C# range 0 .. 31;
DCOUNT at 16#30# range 0 .. 31;
STA at 16#34# range 0 .. 31;
ICR at 16#38# range 0 .. 31;
MASK at 16#3C# range 0 .. 31;
FIFOCNT at 16#48# range 0 .. 31;
FIFO at 16#80# range 0 .. 31;
end record;
-- Secure digital input/output interface
SDIO_Periph : aliased SDIO_Peripheral
with Import, Address => System'To_Address (16#40018000#);
end STM32_SVD.SDIO;
|
reznikmm/matreshka | Ada | 4,623 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Dr3d.Texture_Mode_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Dr3d_Texture_Mode_Attribute_Node is
begin
return Self : Dr3d_Texture_Mode_Attribute_Node do
Matreshka.ODF_Dr3d.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Dr3d_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Dr3d_Texture_Mode_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Texture_Mode_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Dr3d_URI,
Matreshka.ODF_String_Constants.Texture_Mode_Attribute,
Dr3d_Texture_Mode_Attribute_Node'Tag);
end Matreshka.ODF_Dr3d.Texture_Mode_Attributes;
|
reznikmm/matreshka | Ada | 6,860 | 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_Meta.Print_Date_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Meta_Print_Date_Element_Node is
begin
return Self : Meta_Print_Date_Element_Node do
Matreshka.ODF_Meta.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Meta_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Meta_Print_Date_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_Meta_Print_Date
(ODF.DOM.Meta_Print_Date_Elements.ODF_Meta_Print_Date_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 Meta_Print_Date_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Print_Date_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Meta_Print_Date_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_Meta_Print_Date
(ODF.DOM.Meta_Print_Date_Elements.ODF_Meta_Print_Date_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 Meta_Print_Date_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_Meta_Print_Date
(Visitor,
ODF.DOM.Meta_Print_Date_Elements.ODF_Meta_Print_Date_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.Meta_URI,
Matreshka.ODF_String_Constants.Print_Date_Element,
Meta_Print_Date_Element_Node'Tag);
end Matreshka.ODF_Meta.Print_Date_Elements;
|
onox/orka | Ada | 965 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2022 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with AUnit.Test_Suites;
with Orka.Transforms.SIMD_Vectors;
generic
Suite_Name : String;
with package Vectors is new Orka.Transforms.SIMD_Vectors (<>);
package Generic_Test_Transforms_Vectors is
function Suite return AUnit.Test_Suites.Access_Test_Suite;
end Generic_Test_Transforms_Vectors;
|
reznikmm/matreshka | Ada | 4,259 | 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.Style.Line_Style.Internals is
------------
-- Create --
------------
function Create
(Node : Matreshka.ODF_Attributes.Style.Line_Style.Style_Line_Style_Access)
return ODF.DOM.Attributes.Style.Line_Style.ODF_Style_Line_Style 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.Style.Line_Style.Style_Line_Style_Access)
return ODF.DOM.Attributes.Style.Line_Style.ODF_Style_Line_Style is
begin
return
(XML.DOM.Attributes.Internals.Wrap
(Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record);
end Wrap;
end ODF.DOM.Attributes.Style.Line_Style.Internals;
|
reznikmm/matreshka | Ada | 4,833 | 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.Vertexs.Collections is
pragma Preelaborate;
package UML_Vertex_Collections is
new AMF.Generic_Collections
(UML_Vertex,
UML_Vertex_Access);
type Set_Of_UML_Vertex is
new UML_Vertex_Collections.Set with null record;
Empty_Set_Of_UML_Vertex : constant Set_Of_UML_Vertex;
type Ordered_Set_Of_UML_Vertex is
new UML_Vertex_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_UML_Vertex : constant Ordered_Set_Of_UML_Vertex;
type Bag_Of_UML_Vertex is
new UML_Vertex_Collections.Bag with null record;
Empty_Bag_Of_UML_Vertex : constant Bag_Of_UML_Vertex;
type Sequence_Of_UML_Vertex is
new UML_Vertex_Collections.Sequence with null record;
Empty_Sequence_Of_UML_Vertex : constant Sequence_Of_UML_Vertex;
private
Empty_Set_Of_UML_Vertex : constant Set_Of_UML_Vertex
:= (UML_Vertex_Collections.Set with null record);
Empty_Ordered_Set_Of_UML_Vertex : constant Ordered_Set_Of_UML_Vertex
:= (UML_Vertex_Collections.Ordered_Set with null record);
Empty_Bag_Of_UML_Vertex : constant Bag_Of_UML_Vertex
:= (UML_Vertex_Collections.Bag with null record);
Empty_Sequence_Of_UML_Vertex : constant Sequence_Of_UML_Vertex
:= (UML_Vertex_Collections.Sequence with null record);
end AMF.UML.Vertexs.Collections;
|
charlie5/lace | Ada | 14,249 | adb | with
openGL.Geometry.textured,
openGL.Texture,
openGL.IO,
openGL.Primitive.indexed;
package body openGL.Model.capsule.textured
is
---------
--- Forge
--
function new_Capsule (Radius : in Real;
Height : in Real;
Image : in asset_Name := null_Asset) return View
is
Self : constant View := new Item;
begin
Self.Radius := Radius;
Self.Height := Height;
Self.Image := Image;
return Self;
end new_Capsule;
--------------
--- Attributes
--
overriding
function to_GL_Geometries (Self : access Item; Textures : access Texture.name_Map_of_texture'Class;
Fonts : in Font.font_id_Map_of_font) return Geometry.views
is
pragma unreferenced (Textures, Fonts);
use --Geometry,
Geometry.textured,
real_Functions;
Length : constant Real := Self.Height;
Radius : constant Real := Self.Radius;
quality_Level : constant Index_t := 4;
sides_Count : constant Index_t := Index_t (quality_Level * 4); -- Number of sides to the cylinder (divisible by 4):
type Edge is -- A 'shaft' edge.
record
Fore : Site;
Aft : Site;
end record;
type Edges is array (Index_t range 1 .. sides_Count) of Edge;
type arch_Edges is array (Index_t range 1 .. quality_Level) of Sites (1 .. sides_Count);
tmp,
nx, ny, nz,
start_nx,
start_ny : Real;
a : constant Real := Pi * 2.0 / Real (sides_Count);
ca : constant Real := Cos (a);
sa : constant Real := Sin (a);
L : constant Real := Length * 0.5;
the_Edges : Edges;
the_shaft_Geometry : constant Geometry.textured.view
:= Geometry.textured.new_Geometry;
cap_1_Geometry : Geometry.textured.view;
cap_2_Geometry : Geometry.textured.view;
begin
-- Define capsule shaft,
--
declare
vertex_Count : constant Index_t := Index_t (sides_Count * 2 + 2); -- 2 triangles per side plus 2 since we cannot share the first and last edge.
indices_Count : constant long_Index_t := long_Index_t (sides_Count * 2 * 3); -- 2 triangles per side with 3 vertices per triangle.
the_Vertices : aliased Geometry.textured.Vertex_array := (1 .. vertex_Count => <>);
the_Indices : aliased Indices := (1 .. indices_Count => <>);
begin
ny := 1.0;
nz := 0.0; -- Normal vector = (0.0, ny, nz)
-- Set vertices.
--
declare
S : Real := 0.0;
S_delta : constant Real := 1.0 / Real (sides_Count);
i : Index_t := 1;
begin
for Each in 1 .. Index_t (Edges'Length)
loop
the_Edges (Each).Fore (1) := ny * Radius;
the_Edges (Each).Fore (2) := nz * Radius;
the_Edges (Each).Fore (3) := L;
the_Edges (Each).Aft (1) := ny * Radius;
the_Edges (Each).Aft (2) := nz * Radius;
the_Edges (Each).Aft (3) := -L;
-- Rotate ny, nz.
--
tmp := ca * ny - sa * nz;
nz := sa * ny + ca * nz;
ny := tmp;
the_Vertices (i).Site := the_Edges (Each).Fore;
the_Vertices (i).Coords := (s => S,
t => 1.0);
i := i + 1;
the_Vertices (i).Site := the_Edges (Each).Aft;
the_Vertices (i).Coords := (s => S,
t => 0.0);
i := i + 1;
S := S + S_delta;
end loop;
the_Vertices (i).Site := the_Edges (1).Fore;
the_Vertices (i).Coords := (s => S,
t => 1.0);
i := i + 1;
the_Vertices (i).Site := the_Edges (1).Aft;
the_Vertices (i).Coords := (s => S,
t => 0.0);
end;
-- Set indices.
--
declare
i : long_Index_t := 1;
Start : Index_t := 1;
begin
for Each in 1 .. long_Index_t (sides_Count)
loop
the_Indices (i) := Start; i := i + 1;
the_Indices (i) := Start + 1; i := i + 1;
the_Indices (i) := Start + 2; i := i + 1;
the_Indices (i) := Start + 1; i := i + 1;
the_Indices (i) := Start + 3; i := i + 1;
the_Indices (i) := Start + 2; i := i + 1;
Start := Start + 2;
end loop;
end;
if Self.Image /= null_Asset
then
set_Texture:
declare
use Texture;
the_Image : constant Image := IO.to_Image (Self.Image);
the_Texture : constant Texture.object := Forge.to_Texture (the_Image);
begin
the_shaft_Geometry.Texture_is (the_Texture);
end set_Texture;
end if;
Vertices_are (the_shaft_Geometry.all, the_Vertices);
declare
the_Primitive : constant Primitive.indexed.view
:= Primitive.indexed.new_Primitive (primitive.Triangles,
the_Indices);
begin
the_shaft_Geometry.add (Primitive.view (the_Primitive));
end;
end;
declare
function new_Cap (is_Fore : Boolean) return Geometry.textured.view
is
cap_Geometry : constant Geometry.textured.view
:= Geometry.textured.new_Geometry;
hoop_Count : constant Index_t := quality_Level;
vertex_Count : constant Index_t := Index_t (Edges'Length * hoop_Count + 1); -- A vertex for each edge of each hoop, + 1 for the pole.
indices_Count : constant long_Index_t := long_Index_t ( (hoop_count - 1) * sides_Count * 2 * 3 -- For each hoop, 2 triangles per side with 3 vertices per triangle
+ sides_Count * 3); -- plus the extra indices for the pole triangles.
the_Vertices : aliased Geometry.textured.Vertex_array := (1 .. vertex_Count => <>);
the_Indices : aliased Indices := (1 .. indices_Count => <>);
the_arch_Edges : arch_Edges;
i : Index_t := 1;
pole_Site : constant Site := (if is_Fore then (0.0, 0.0, L + Radius)
else (0.0, 0.0, -L - Radius));
Degrees_90 : constant := Pi / 2.0;
Degrees_360 : constant := Pi * 2.0;
latitude_Count : constant := hoop_Count + 1;
longitude_Count : constant := Edges'Length;
latitude_Spacing : constant Real := Degrees_90 / Real (latitude_Count - 1);
longitude_Spacing : constant Real := Degrees_360 / Real (longitude_Count);
a, b : Real := 0.0; -- Angular 'cursors' used to track lat/long for texture coords.
begin
if not is_Fore
then
a := Degrees_360;
end if;
-- Set the vertices.
--
start_nx := 0.0;
start_ny := 1.0;
for each_Hoop in 1 .. quality_Level
loop
-- Get n=start_n.
--
nx := start_nx;
ny := start_ny;
nz := 0.0;
for Each in 1 .. sides_Count
loop
the_arch_Edges (each_Hoop) (Each) (1) := ny * Radius;
the_arch_Edges (each_Hoop) (Each) (2) := nz * Radius;
the_arch_Edges (each_Hoop) (Each) (3) := (if is_Fore then nx * Radius + L
else nx * Radius - L);
-- Rotate ny, nz.
--
tmp := ca * ny - sa * nz;
nz := sa * ny + ca * nz;
ny := tmp;
the_Vertices (i).Site := the_arch_Edges (each_Hoop) (Each);
the_Vertices (i).Coords := (s => a / Degrees_360,
t => b / Degrees_90);
i := i + 1;
a := (if is_Fore then a + longitude_Spacing
else a - longitude_Spacing);
end loop;
declare
tmp : constant Real := start_nx;
begin
if is_Fore
then
start_nx := ca * start_nx + sa * start_ny;
start_ny := -sa * tmp + ca * start_ny;
else
start_nx := ca * start_nx - sa * start_ny;
start_ny := sa * tmp + ca * start_ny;
end if;
end;
a := (if is_Fore then 0.0
else Degrees_360);
b := b + latitude_Spacing;
end loop;
-- Add pole vertex.
--
the_Vertices (i).Site := pole_Site;
the_Vertices (i).Coords := (s => 0.5,
t => 1.0);
-- Set indices.
--
declare
i : long_Index_t := 1;
Start : Index_t := 1;
hoop_Start : Index_t := 1;
pole_Index : constant Index_t := vertex_Count;
begin
for each_Hoop in 1 .. quality_Level
loop
for Each in 1 .. sides_Count
loop
declare
function next_hoop_Vertex return Index_t
is
begin
if Each = sides_Count then return hoop_Start;
else return Start + 1;
end if;
end next_hoop_Vertex;
begin
if each_Hoop = quality_Level
then
if is_Fore
then
the_Indices (i) := Start; i := i + 1;
the_Indices (i) := next_hoop_Vertex; i := i + 1;
the_Indices (i) := pole_Index; i := i + 1;
else
the_Indices (i) := Start; i := i + 1;
the_Indices (i) := pole_Index; i := i + 1;
the_Indices (i) := next_hoop_Vertex; i := i + 1;
end if;
else
declare
v1 : constant Index_t := Start;
v2 : constant Index_t := next_hoop_Vertex;
v3 : constant Index_t := v1 + sides_Count;
v4 : constant Index_t := v2 + sides_Count;
begin
if is_Fore
then
the_Indices (i) := v1; i := i + 1;
the_Indices (i) := v2; i := i + 1;
the_Indices (i) := v3; i := i + 1;
the_Indices (i) := v2; i := i + 1;
the_Indices (i) := v4; i := i + 1;
the_Indices (i) := v3; i := i + 1;
else
the_Indices (i) := v1; i := i + 1;
the_Indices (i) := v3; i := i + 1;
the_Indices (i) := v2; i := i + 1;
the_Indices (i) := v2; i := i + 1;
the_Indices (i) := v3; i := i + 1;
the_Indices (i) := v4; i := i + 1;
end if;
end;
end if;
Start := Start + 1;
end;
end loop;
hoop_Start := hoop_Start + sides_Count;
end loop;
if Self.Image /= null_Asset
then
set_the_Texture:
declare
use Texture;
the_Image : constant Image := IO.to_Image (Self.Image);
the_Texture : constant Texture.object := Forge.to_Texture (the_Image);
begin
cap_Geometry.Texture_is (the_Texture);
end set_the_Texture;
end if;
Vertices_are (cap_Geometry.all, the_Vertices);
declare
the_Primitive : constant Primitive.indexed.view
:= Primitive.indexed.new_Primitive (Primitive.Triangles,
the_Indices);
begin
cap_Geometry.add (Primitive.view (the_Primitive));
end;
end;
return cap_Geometry;
end new_Cap;
begin
cap_1_Geometry := new_Cap (is_Fore => True);
cap_2_Geometry := new_Cap (is_Fore => False);
end;
return (1 => the_shaft_Geometry.all'Access,
2 => cap_1_Geometry.all'Access,
3 => cap_2_Geometry.all'Access);
end to_GL_Geometries;
end openGL.Model.capsule.textured;
|
zhmu/ananas | Ada | 3,717 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- G N A T . S E C U R E _ H A S H E S . S H A 1 --
-- --
-- S p e c --
-- --
-- Copyright (C) 2002-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 supporting code for implementation of the SHA-1
-- secure hash function as described in FIPS PUB 180-3. The complete text
-- of FIPS PUB 180-3 can be found at:
-- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf
-- This is an internal unit and should not be used directly in applications.
-- Use GNAT.SHA1 instead.
with GNAT.Byte_Swapping;
with Interfaces;
package GNAT.Secure_Hashes.SHA1 is
package Hash_State is new Hash_Function_State
(Word => Interfaces.Unsigned_32,
Swap => GNAT.Byte_Swapping.Swap4,
Hash_Bit_Order => System.High_Order_First);
-- SHA-1 operates on 32-bit big endian words
Block_Words : constant := 16;
-- Messages are processed in chunks of 16 words
procedure Transform
(H : in out Hash_State.State;
M : in out Message_State);
-- Transformation function applied for each block
Initial_State : constant Hash_State.State;
-- Initialization vector
private
Initial_State : constant Hash_State.State :=
[0 => 16#67452301#,
1 => 16#EFCDAB89#,
2 => 16#98BADCFE#,
3 => 16#10325476#,
4 => 16#C3D2E1F0#];
-- Initialization vector from FIPS PUB 180-3
end GNAT.Secure_Hashes.SHA1;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 18,583 | ads | -- This spec has been automatically generated from STM32F103.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package STM32_SVD.DMA is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype ISR_GIF1_Field is STM32_SVD.Bit;
subtype ISR_TCIF1_Field is STM32_SVD.Bit;
subtype ISR_HTIF1_Field is STM32_SVD.Bit;
subtype ISR_TEIF1_Field is STM32_SVD.Bit;
subtype ISR_GIF2_Field is STM32_SVD.Bit;
subtype ISR_TCIF2_Field is STM32_SVD.Bit;
subtype ISR_HTIF2_Field is STM32_SVD.Bit;
subtype ISR_TEIF2_Field is STM32_SVD.Bit;
subtype ISR_GIF3_Field is STM32_SVD.Bit;
subtype ISR_TCIF3_Field is STM32_SVD.Bit;
subtype ISR_HTIF3_Field is STM32_SVD.Bit;
subtype ISR_TEIF3_Field is STM32_SVD.Bit;
subtype ISR_GIF4_Field is STM32_SVD.Bit;
subtype ISR_TCIF4_Field is STM32_SVD.Bit;
subtype ISR_HTIF4_Field is STM32_SVD.Bit;
subtype ISR_TEIF4_Field is STM32_SVD.Bit;
subtype ISR_GIF5_Field is STM32_SVD.Bit;
subtype ISR_TCIF5_Field is STM32_SVD.Bit;
subtype ISR_HTIF5_Field is STM32_SVD.Bit;
subtype ISR_TEIF5_Field is STM32_SVD.Bit;
subtype ISR_GIF6_Field is STM32_SVD.Bit;
subtype ISR_TCIF6_Field is STM32_SVD.Bit;
subtype ISR_HTIF6_Field is STM32_SVD.Bit;
subtype ISR_TEIF6_Field is STM32_SVD.Bit;
subtype ISR_GIF7_Field is STM32_SVD.Bit;
subtype ISR_TCIF7_Field is STM32_SVD.Bit;
subtype ISR_HTIF7_Field is STM32_SVD.Bit;
subtype ISR_TEIF7_Field is STM32_SVD.Bit;
-- DMA interrupt status register (DMA_ISR)
type ISR_Register is record
-- Read-only. Channel 1 Global interrupt flag
GIF1 : ISR_GIF1_Field;
-- Read-only. Channel 1 Transfer Complete flag
TCIF1 : ISR_TCIF1_Field;
-- Read-only. Channel 1 Half Transfer Complete flag
HTIF1 : ISR_HTIF1_Field;
-- Read-only. Channel 1 Transfer Error flag
TEIF1 : ISR_TEIF1_Field;
-- Read-only. Channel 2 Global interrupt flag
GIF2 : ISR_GIF2_Field;
-- Read-only. Channel 2 Transfer Complete flag
TCIF2 : ISR_TCIF2_Field;
-- Read-only. Channel 2 Half Transfer Complete flag
HTIF2 : ISR_HTIF2_Field;
-- Read-only. Channel 2 Transfer Error flag
TEIF2 : ISR_TEIF2_Field;
-- Read-only. Channel 3 Global interrupt flag
GIF3 : ISR_GIF3_Field;
-- Read-only. Channel 3 Transfer Complete flag
TCIF3 : ISR_TCIF3_Field;
-- Read-only. Channel 3 Half Transfer Complete flag
HTIF3 : ISR_HTIF3_Field;
-- Read-only. Channel 3 Transfer Error flag
TEIF3 : ISR_TEIF3_Field;
-- Read-only. Channel 4 Global interrupt flag
GIF4 : ISR_GIF4_Field;
-- Read-only. Channel 4 Transfer Complete flag
TCIF4 : ISR_TCIF4_Field;
-- Read-only. Channel 4 Half Transfer Complete flag
HTIF4 : ISR_HTIF4_Field;
-- Read-only. Channel 4 Transfer Error flag
TEIF4 : ISR_TEIF4_Field;
-- Read-only. Channel 5 Global interrupt flag
GIF5 : ISR_GIF5_Field;
-- Read-only. Channel 5 Transfer Complete flag
TCIF5 : ISR_TCIF5_Field;
-- Read-only. Channel 5 Half Transfer Complete flag
HTIF5 : ISR_HTIF5_Field;
-- Read-only. Channel 5 Transfer Error flag
TEIF5 : ISR_TEIF5_Field;
-- Read-only. Channel 6 Global interrupt flag
GIF6 : ISR_GIF6_Field;
-- Read-only. Channel 6 Transfer Complete flag
TCIF6 : ISR_TCIF6_Field;
-- Read-only. Channel 6 Half Transfer Complete flag
HTIF6 : ISR_HTIF6_Field;
-- Read-only. Channel 6 Transfer Error flag
TEIF6 : ISR_TEIF6_Field;
-- Read-only. Channel 7 Global interrupt flag
GIF7 : ISR_GIF7_Field;
-- Read-only. Channel 7 Transfer Complete flag
TCIF7 : ISR_TCIF7_Field;
-- Read-only. Channel 7 Half Transfer Complete flag
HTIF7 : ISR_HTIF7_Field;
-- Read-only. Channel 7 Transfer Error flag
TEIF7 : ISR_TEIF7_Field;
-- unspecified
Reserved_28_31 : STM32_SVD.UInt4;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ISR_Register use record
GIF1 at 0 range 0 .. 0;
TCIF1 at 0 range 1 .. 1;
HTIF1 at 0 range 2 .. 2;
TEIF1 at 0 range 3 .. 3;
GIF2 at 0 range 4 .. 4;
TCIF2 at 0 range 5 .. 5;
HTIF2 at 0 range 6 .. 6;
TEIF2 at 0 range 7 .. 7;
GIF3 at 0 range 8 .. 8;
TCIF3 at 0 range 9 .. 9;
HTIF3 at 0 range 10 .. 10;
TEIF3 at 0 range 11 .. 11;
GIF4 at 0 range 12 .. 12;
TCIF4 at 0 range 13 .. 13;
HTIF4 at 0 range 14 .. 14;
TEIF4 at 0 range 15 .. 15;
GIF5 at 0 range 16 .. 16;
TCIF5 at 0 range 17 .. 17;
HTIF5 at 0 range 18 .. 18;
TEIF5 at 0 range 19 .. 19;
GIF6 at 0 range 20 .. 20;
TCIF6 at 0 range 21 .. 21;
HTIF6 at 0 range 22 .. 22;
TEIF6 at 0 range 23 .. 23;
GIF7 at 0 range 24 .. 24;
TCIF7 at 0 range 25 .. 25;
HTIF7 at 0 range 26 .. 26;
TEIF7 at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype IFCR_CGIF1_Field is STM32_SVD.Bit;
subtype IFCR_CTCIF1_Field is STM32_SVD.Bit;
subtype IFCR_CHTIF1_Field is STM32_SVD.Bit;
subtype IFCR_CTEIF1_Field is STM32_SVD.Bit;
subtype IFCR_CGIF2_Field is STM32_SVD.Bit;
subtype IFCR_CTCIF2_Field is STM32_SVD.Bit;
subtype IFCR_CHTIF2_Field is STM32_SVD.Bit;
subtype IFCR_CTEIF2_Field is STM32_SVD.Bit;
subtype IFCR_CGIF3_Field is STM32_SVD.Bit;
subtype IFCR_CTCIF3_Field is STM32_SVD.Bit;
subtype IFCR_CHTIF3_Field is STM32_SVD.Bit;
subtype IFCR_CTEIF3_Field is STM32_SVD.Bit;
subtype IFCR_CGIF4_Field is STM32_SVD.Bit;
subtype IFCR_CTCIF4_Field is STM32_SVD.Bit;
subtype IFCR_CHTIF4_Field is STM32_SVD.Bit;
subtype IFCR_CTEIF4_Field is STM32_SVD.Bit;
subtype IFCR_CGIF5_Field is STM32_SVD.Bit;
subtype IFCR_CTCIF5_Field is STM32_SVD.Bit;
subtype IFCR_CHTIF5_Field is STM32_SVD.Bit;
subtype IFCR_CTEIF5_Field is STM32_SVD.Bit;
subtype IFCR_CGIF6_Field is STM32_SVD.Bit;
subtype IFCR_CTCIF6_Field is STM32_SVD.Bit;
subtype IFCR_CHTIF6_Field is STM32_SVD.Bit;
subtype IFCR_CTEIF6_Field is STM32_SVD.Bit;
subtype IFCR_CGIF7_Field is STM32_SVD.Bit;
subtype IFCR_CTCIF7_Field is STM32_SVD.Bit;
subtype IFCR_CHTIF7_Field is STM32_SVD.Bit;
subtype IFCR_CTEIF7_Field is STM32_SVD.Bit;
-- DMA interrupt flag clear register (DMA_IFCR)
type IFCR_Register is record
-- Write-only. Channel 1 Global interrupt clear
CGIF1 : IFCR_CGIF1_Field := 16#0#;
-- Write-only. Channel 1 Transfer Complete clear
CTCIF1 : IFCR_CTCIF1_Field := 16#0#;
-- Write-only. Channel 1 Half Transfer clear
CHTIF1 : IFCR_CHTIF1_Field := 16#0#;
-- Write-only. Channel 1 Transfer Error clear
CTEIF1 : IFCR_CTEIF1_Field := 16#0#;
-- Write-only. Channel 2 Global interrupt clear
CGIF2 : IFCR_CGIF2_Field := 16#0#;
-- Write-only. Channel 2 Transfer Complete clear
CTCIF2 : IFCR_CTCIF2_Field := 16#0#;
-- Write-only. Channel 2 Half Transfer clear
CHTIF2 : IFCR_CHTIF2_Field := 16#0#;
-- Write-only. Channel 2 Transfer Error clear
CTEIF2 : IFCR_CTEIF2_Field := 16#0#;
-- Write-only. Channel 3 Global interrupt clear
CGIF3 : IFCR_CGIF3_Field := 16#0#;
-- Write-only. Channel 3 Transfer Complete clear
CTCIF3 : IFCR_CTCIF3_Field := 16#0#;
-- Write-only. Channel 3 Half Transfer clear
CHTIF3 : IFCR_CHTIF3_Field := 16#0#;
-- Write-only. Channel 3 Transfer Error clear
CTEIF3 : IFCR_CTEIF3_Field := 16#0#;
-- Write-only. Channel 4 Global interrupt clear
CGIF4 : IFCR_CGIF4_Field := 16#0#;
-- Write-only. Channel 4 Transfer Complete clear
CTCIF4 : IFCR_CTCIF4_Field := 16#0#;
-- Write-only. Channel 4 Half Transfer clear
CHTIF4 : IFCR_CHTIF4_Field := 16#0#;
-- Write-only. Channel 4 Transfer Error clear
CTEIF4 : IFCR_CTEIF4_Field := 16#0#;
-- Write-only. Channel 5 Global interrupt clear
CGIF5 : IFCR_CGIF5_Field := 16#0#;
-- Write-only. Channel 5 Transfer Complete clear
CTCIF5 : IFCR_CTCIF5_Field := 16#0#;
-- Write-only. Channel 5 Half Transfer clear
CHTIF5 : IFCR_CHTIF5_Field := 16#0#;
-- Write-only. Channel 5 Transfer Error clear
CTEIF5 : IFCR_CTEIF5_Field := 16#0#;
-- Write-only. Channel 6 Global interrupt clear
CGIF6 : IFCR_CGIF6_Field := 16#0#;
-- Write-only. Channel 6 Transfer Complete clear
CTCIF6 : IFCR_CTCIF6_Field := 16#0#;
-- Write-only. Channel 6 Half Transfer clear
CHTIF6 : IFCR_CHTIF6_Field := 16#0#;
-- Write-only. Channel 6 Transfer Error clear
CTEIF6 : IFCR_CTEIF6_Field := 16#0#;
-- Write-only. Channel 7 Global interrupt clear
CGIF7 : IFCR_CGIF7_Field := 16#0#;
-- Write-only. Channel 7 Transfer Complete clear
CTCIF7 : IFCR_CTCIF7_Field := 16#0#;
-- Write-only. Channel 7 Half Transfer clear
CHTIF7 : IFCR_CHTIF7_Field := 16#0#;
-- Write-only. Channel 7 Transfer Error clear
CTEIF7 : IFCR_CTEIF7_Field := 16#0#;
-- unspecified
Reserved_28_31 : STM32_SVD.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for IFCR_Register use record
CGIF1 at 0 range 0 .. 0;
CTCIF1 at 0 range 1 .. 1;
CHTIF1 at 0 range 2 .. 2;
CTEIF1 at 0 range 3 .. 3;
CGIF2 at 0 range 4 .. 4;
CTCIF2 at 0 range 5 .. 5;
CHTIF2 at 0 range 6 .. 6;
CTEIF2 at 0 range 7 .. 7;
CGIF3 at 0 range 8 .. 8;
CTCIF3 at 0 range 9 .. 9;
CHTIF3 at 0 range 10 .. 10;
CTEIF3 at 0 range 11 .. 11;
CGIF4 at 0 range 12 .. 12;
CTCIF4 at 0 range 13 .. 13;
CHTIF4 at 0 range 14 .. 14;
CTEIF4 at 0 range 15 .. 15;
CGIF5 at 0 range 16 .. 16;
CTCIF5 at 0 range 17 .. 17;
CHTIF5 at 0 range 18 .. 18;
CTEIF5 at 0 range 19 .. 19;
CGIF6 at 0 range 20 .. 20;
CTCIF6 at 0 range 21 .. 21;
CHTIF6 at 0 range 22 .. 22;
CTEIF6 at 0 range 23 .. 23;
CGIF7 at 0 range 24 .. 24;
CTCIF7 at 0 range 25 .. 25;
CHTIF7 at 0 range 26 .. 26;
CTEIF7 at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype CCR_EN_Field is STM32_SVD.Bit;
subtype CCR_TCIE_Field is STM32_SVD.Bit;
subtype CCR_HTIE_Field is STM32_SVD.Bit;
subtype CCR_TEIE_Field is STM32_SVD.Bit;
subtype CCR_DIR_Field is STM32_SVD.Bit;
subtype CCR_CIRC_Field is STM32_SVD.Bit;
subtype CCR_PINC_Field is STM32_SVD.Bit;
subtype CCR_MINC_Field is STM32_SVD.Bit;
subtype CCR_PSIZE_Field is STM32_SVD.UInt2;
subtype CCR_MSIZE_Field is STM32_SVD.UInt2;
subtype CCR_PL_Field is STM32_SVD.UInt2;
subtype CCR_MEM2MEM_Field is STM32_SVD.Bit;
-- DMA channel configuration register (DMA_CCR)
type CCR_Register is record
-- Channel enable
EN : CCR_EN_Field := 16#0#;
-- Transfer complete interrupt enable
TCIE : CCR_TCIE_Field := 16#0#;
-- Half Transfer interrupt enable
HTIE : CCR_HTIE_Field := 16#0#;
-- Transfer error interrupt enable
TEIE : CCR_TEIE_Field := 16#0#;
-- Data transfer direction
DIR : CCR_DIR_Field := 16#0#;
-- Circular mode
CIRC : CCR_CIRC_Field := 16#0#;
-- Peripheral increment mode
PINC : CCR_PINC_Field := 16#0#;
-- Memory increment mode
MINC : CCR_MINC_Field := 16#0#;
-- Peripheral size
PSIZE : CCR_PSIZE_Field := 16#0#;
-- Memory size
MSIZE : CCR_MSIZE_Field := 16#0#;
-- Channel Priority level
PL : CCR_PL_Field := 16#0#;
-- Memory to memory mode
MEM2MEM : CCR_MEM2MEM_Field := 16#0#;
-- unspecified
Reserved_15_31 : STM32_SVD.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCR_Register use record
EN at 0 range 0 .. 0;
TCIE at 0 range 1 .. 1;
HTIE at 0 range 2 .. 2;
TEIE at 0 range 3 .. 3;
DIR at 0 range 4 .. 4;
CIRC at 0 range 5 .. 5;
PINC at 0 range 6 .. 6;
MINC at 0 range 7 .. 7;
PSIZE at 0 range 8 .. 9;
MSIZE at 0 range 10 .. 11;
PL at 0 range 12 .. 13;
MEM2MEM at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
subtype CNDTR_NDT_Field is STM32_SVD.UInt16;
-- DMA channel 1 number of data register
type CNDTR_Register is record
-- Number of data to transfer
NDT : CNDTR_NDT_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CNDTR_Register use record
NDT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- DMA controller
type DMA_Peripheral is record
-- DMA interrupt status register (DMA_ISR)
ISR : aliased ISR_Register;
-- DMA interrupt flag clear register (DMA_IFCR)
IFCR : aliased IFCR_Register;
-- DMA channel configuration register (DMA_CCR)
CCR1 : aliased CCR_Register;
-- DMA channel 1 number of data register
CNDTR1 : aliased CNDTR_Register;
-- DMA channel 1 peripheral address register
CPAR1 : aliased STM32_SVD.UInt32;
-- DMA channel 1 memory address register
CMAR1 : aliased STM32_SVD.UInt32;
-- DMA channel configuration register (DMA_CCR)
CCR2 : aliased CCR_Register;
-- DMA channel 2 number of data register
CNDTR2 : aliased CNDTR_Register;
-- DMA channel 2 peripheral address register
CPAR2 : aliased STM32_SVD.UInt32;
-- DMA channel 2 memory address register
CMAR2 : aliased STM32_SVD.UInt32;
-- DMA channel configuration register (DMA_CCR)
CCR3 : aliased CCR_Register;
-- DMA channel 3 number of data register
CNDTR3 : aliased CNDTR_Register;
-- DMA channel 3 peripheral address register
CPAR3 : aliased STM32_SVD.UInt32;
-- DMA channel 3 memory address register
CMAR3 : aliased STM32_SVD.UInt32;
-- DMA channel configuration register (DMA_CCR)
CCR4 : aliased CCR_Register;
-- DMA channel 4 number of data register
CNDTR4 : aliased CNDTR_Register;
-- DMA channel 4 peripheral address register
CPAR4 : aliased STM32_SVD.UInt32;
-- DMA channel 4 memory address register
CMAR4 : aliased STM32_SVD.UInt32;
-- DMA channel configuration register (DMA_CCR)
CCR5 : aliased CCR_Register;
-- DMA channel 5 number of data register
CNDTR5 : aliased CNDTR_Register;
-- DMA channel 5 peripheral address register
CPAR5 : aliased STM32_SVD.UInt32;
-- DMA channel 5 memory address register
CMAR5 : aliased STM32_SVD.UInt32;
-- DMA channel configuration register (DMA_CCR)
CCR6 : aliased CCR_Register;
-- DMA channel 6 number of data register
CNDTR6 : aliased CNDTR_Register;
-- DMA channel 6 peripheral address register
CPAR6 : aliased STM32_SVD.UInt32;
-- DMA channel 6 memory address register
CMAR6 : aliased STM32_SVD.UInt32;
-- DMA channel configuration register (DMA_CCR)
CCR7 : aliased CCR_Register;
-- DMA channel 7 number of data register
CNDTR7 : aliased CNDTR_Register;
-- DMA channel 7 peripheral address register
CPAR7 : aliased STM32_SVD.UInt32;
-- DMA channel 7 memory address register
CMAR7 : aliased STM32_SVD.UInt32;
end record
with Volatile;
for DMA_Peripheral use record
ISR at 16#0# range 0 .. 31;
IFCR at 16#4# range 0 .. 31;
CCR1 at 16#8# range 0 .. 31;
CNDTR1 at 16#C# range 0 .. 31;
CPAR1 at 16#10# range 0 .. 31;
CMAR1 at 16#14# range 0 .. 31;
CCR2 at 16#1C# range 0 .. 31;
CNDTR2 at 16#20# range 0 .. 31;
CPAR2 at 16#24# range 0 .. 31;
CMAR2 at 16#28# range 0 .. 31;
CCR3 at 16#30# range 0 .. 31;
CNDTR3 at 16#34# range 0 .. 31;
CPAR3 at 16#38# range 0 .. 31;
CMAR3 at 16#3C# range 0 .. 31;
CCR4 at 16#44# range 0 .. 31;
CNDTR4 at 16#48# range 0 .. 31;
CPAR4 at 16#4C# range 0 .. 31;
CMAR4 at 16#50# range 0 .. 31;
CCR5 at 16#58# range 0 .. 31;
CNDTR5 at 16#5C# range 0 .. 31;
CPAR5 at 16#60# range 0 .. 31;
CMAR5 at 16#64# range 0 .. 31;
CCR6 at 16#6C# range 0 .. 31;
CNDTR6 at 16#70# range 0 .. 31;
CPAR6 at 16#74# range 0 .. 31;
CMAR6 at 16#78# range 0 .. 31;
CCR7 at 16#80# range 0 .. 31;
CNDTR7 at 16#84# range 0 .. 31;
CPAR7 at 16#88# range 0 .. 31;
CMAR7 at 16#8C# range 0 .. 31;
end record;
-- DMA controller
DMA1_Periph : aliased DMA_Peripheral
with Import, Address => System'To_Address (16#40020000#);
-- DMA controller
DMA2_Periph : aliased DMA_Peripheral
with Import, Address => System'To_Address (16#40020400#);
end STM32_SVD.DMA;
|
zhmu/ananas | Ada | 86 | ads | package Renaming8_Pkg3 is
function Last_Index return Integer;
end Renaming8_Pkg3;
|
reznikmm/matreshka | Ada | 3,597 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Elements.Generic_Hash;
function AMF.DG.Polylines.Hash is
new AMF.Elements.Generic_Hash (DG_Polyline, DG_Polyline_Access);
|
stcarrez/atlas | Ada | 5,711 | ads | -----------------------------------------------------------------------
-- atlas -- atlas applications
-- Copyright (C) 2012, 2013, 2014, 2015, 2016, 2018, 2020 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Beans.Objects;
with ASF.Servlets.Faces;
with Servlet.Core.Files;
with ASF.Servlets.Ajax;
with ASF.Filters.Dump;
with ASF.Filters.Cache_Control;
with Servlet.Core.Measures;
with ASF.Security.Servlets;
with ASF.Converters.Sizes;
with AWA.Users.Servlets;
with AWA.Users.Modules;
with AWA.Mail.Modules;
with AWA.Blogs.Modules;
with AWA.Applications;
with AWA.Workspaces.Modules;
with AWA.Storages.Modules;
with AWA.Images.Modules;
with AWA.Questions.Modules;
with AWA.Wikis.Modules;
with AWA.Wikis.Previews;
with AWA.Jobs.Modules;
with AWA.Counters.Modules;
with AWA.Votes.Modules;
with AWA.Tags.Modules;
with AWA.Comments.Modules;
with AWA.Services.Filters;
with AWA.Converters.Dates;
with Atlas.Microblog.Modules;
with Atlas.Reviews.Modules;
package Atlas.Applications is
CONFIG_PATH : constant String := "/atlas";
CONTEXT_PATH : constant String := "/atlas";
ATLAS_NS_URI : aliased constant String := "http://code.google.com/p/ada-awa/atlas";
-- Given an Email address, return the Gravatar link to the user image.
-- (See http://en.gravatar.com/site/implement/hash/ and
-- http://en.gravatar.com/site/implement/images/)
function Get_Gravatar_Link (Email : in String) return String;
-- EL function to convert an Email address to a Gravatar image.
function To_Gravatar_Link (Email : in Util.Beans.Objects.Object)
return Util.Beans.Objects.Object;
type Application is new AWA.Applications.Application with private;
type Application_Access is access all Application'Class;
-- Initialize the ASF components provided by the application.
-- This procedure is called by <b>Initialize</b>.
-- It should register the component factories used by the application.
overriding
procedure Initialize_Components (App : in out Application);
-- Initialize the servlets provided by the application.
-- This procedure is called by <b>Initialize</b>.
-- It should register the application servlets.
overriding
procedure Initialize_Servlets (App : in out Application);
-- Initialize the filters provided by the application.
-- This procedure is called by <b>Initialize</b>.
-- It should register the application filters.
overriding
procedure Initialize_Filters (App : in out Application);
-- Initialize the AWA modules provided by the application.
-- This procedure is called by <b>Initialize</b>.
-- It should register the modules used by the application.
overriding
procedure Initialize_Modules (App : in out Application);
private
type Application is new AWA.Applications.Application with record
Self : Application_Access;
-- Application servlets and filters (add new servlet and filter instances here).
Faces : aliased ASF.Servlets.Faces.Faces_Servlet;
Ajax : aliased ASF.Servlets.Ajax.Ajax_Servlet;
Files : aliased Servlet.Core.Files.File_Servlet;
Dump : aliased ASF.Filters.Dump.Dump_Filter;
Service_Filter : aliased AWA.Services.Filters.Service_Filter;
Measures : aliased Servlet.Core.Measures.Measure_Servlet;
No_Cache : aliased ASF.Filters.Cache_Control.Cache_Control_Filter;
-- Authentication servlet and filter.
Auth : aliased ASF.Security.Servlets.Request_Auth_Servlet;
Verify_Auth : aliased AWA.Users.Servlets.Verify_Auth_Servlet;
-- Converters shared by web requests.
Rel_Date_Converter : aliased AWA.Converters.Dates.Relative_Date_Converter;
Size_Converter : aliased ASF.Converters.Sizes.Size_Converter;
-- The application modules.
User_Module : aliased AWA.Users.Modules.User_Module;
Workspace_Module : aliased AWA.Workspaces.Modules.Workspace_Module;
Blog_Module : aliased AWA.Blogs.Modules.Blog_Module;
Mail_Module : aliased AWA.Mail.Modules.Mail_Module;
Job_Module : aliased AWA.Jobs.Modules.Job_Module;
Storage_Module : aliased AWA.Storages.Modules.Storage_Module;
Image_Module : aliased AWA.Images.Modules.Image_Module;
Vote_Module : aliased AWA.Votes.Modules.Vote_Module;
Question_Module : aliased AWA.Questions.Modules.Question_Module;
Tag_Module : aliased AWA.Tags.Modules.Tag_Module;
Comment_Module : aliased AWA.Comments.Modules.Comment_Module;
Wiki_Module : aliased AWA.Wikis.Modules.Wiki_Module;
Preview_Module : aliased AWA.Wikis.Previews.Preview_Module;
Counter_Module : aliased AWA.Counters.Modules.Counter_Module;
Microblog_Module : aliased Atlas.Microblog.Modules.Microblog_Module;
Review_Module : aliased Atlas.Reviews.Modules.Review_Module;
end record;
end Atlas.Applications;
|
reznikmm/matreshka | Ada | 3,997 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Fo_Break_Before_Attributes;
package Matreshka.ODF_Fo.Break_Before_Attributes is
type Fo_Break_Before_Attribute_Node is
new Matreshka.ODF_Fo.Abstract_Fo_Attribute_Node
and ODF.DOM.Fo_Break_Before_Attributes.ODF_Fo_Break_Before_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Fo_Break_Before_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Fo_Break_Before_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Fo.Break_Before_Attributes;
|
esbullington/aflex | Ada | 46,857 | adb |
pragma Warnings (Off);
with Ada.Text_Io;
with misc_defs, misc, sym, parse_tokens, int_io;
with tstring, ascan_dfa, ascan_io;
use misc_defs, parse_tokens, tstring;
use ascan_dfa, ascan_io;
package body scanner is
use Ada;
use Ada.Text_IO;
beglin : Boolean := False;
i, bracelevel: Integer;
function get_token return Token is
toktype : Token;
didadef, indented_code : Boolean;
cclval : Integer;
nmdefptr : vstring;
nmdef, tmpbuf : vstring;
procedure ACTION_ECHO is
begin
Ada.Text_IO.Put (temp_action_file, yytext(1 .. YYLength));
end ACTION_ECHO;
procedure MARK_END_OF_PROLOG is
begin
Ada.Text_IO.Put (temp_action_file, "%%%% end of prolog");
Ada.Text_IO.New_Line (temp_action_file);
end MARK_END_OF_PROLOG;
procedure PUT_BACK_STRING(str : vstring; start : Integer) is
begin
for i in reverse start + 1 .. tstring.len (str) loop
unput (CHAR (str, i));
end loop;
end PUT_BACK_STRING;
function check_yylex_here return Boolean is
begin
return ( (yytext'length >= 2) and then
((yytext(1) = '#') and (yytext(2) = '#')));
end check_yylex_here;
function YYLex return Token is
subtype Short is Integer range -32768 .. 32767;
yy_act : Integer;
yy_c : Short;
-- returned upon end-of-file
YY_END_TOK : constant Integer := 0;
YY_END_OF_BUFFER : constant := 84;
subtype yy_state_type is Integer;
yy_current_state : yy_state_type;
INITIAL : constant := 0;
SECT2 : constant := 1;
SECT2PROLOG : constant := 2;
SECT3 : constant := 3;
PICKUPDEF : constant := 4;
SC : constant := 5;
CARETISBOL : constant := 6;
NUM : constant := 7;
QUOTE : constant := 8;
FIRSTCCL : constant := 9;
CCL : constant := 10;
ACTION : constant := 11;
RECOVER : constant := 12;
BRACEERROR : constant := 13;
ACTION_STRING : constant := 14;
yy_accept : constant array (0 .. 213) of Short :=
(0,
0, 0, 0, 0, 0, 0, 82, 82, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
84, 15, 7, 14, 12, 1, 13, 15, 15, 15,
10, 41, 33, 34, 27, 41, 40, 25, 41, 41,
41, 33, 23, 41, 41, 26, 83, 21, 82, 82,
17, 16, 18, 47, 83, 43, 44, 46, 48, 62,
63, 60, 59, 61, 49, 51, 50, 49, 55, 54,
55, 55, 57, 57, 57, 58, 68, 73, 72, 74,
68, 74, 69, 66, 67, 83, 19, 65, 64, 75,
77, 78, 79, 7, 14, 12, 0, 1, 13, 0,
0, 2, 0, 8, 4, 6, 5, 0, 10, 33,
34, 0, 30, 0, 0, 0, 80, 80, 29, 28,
29, 0, 33, 23, 0, 0, 37, 0, 0, 21,
20, 82, 82, 17, 16, 45, 46, 59, 81, 81,
52, 53, 56, 68, 0, 71, 0, 68, 69, 0,
19, 75, 76, 11, 0, 8, 0, 0, 0, 3,
0, 31, 0, 38, 0, 80, 29, 29, 39, 0,
0, 0, 37, 0, 32, 81, 68, 70, 0, 11,
0, 9, 0, 0, 0, 0, 0, 0, 0, 0,
6, 0, 0, 0, 24, 0, 24, 0, 24, 4,
0, 36, 0
);
yy_ec : constant array (ASCII.NUL .. Character'Last) of Short := (0,
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 4, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 5, 1, 6, 7, 8, 9, 1, 10, 11,
11, 11, 11, 12, 13, 14, 15, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 1, 1, 17,
1, 18, 11, 1, 24, 23, 23, 23, 25, 26,
23, 23, 27, 23, 23, 23, 23, 28, 29, 23,
23, 30, 31, 32, 33, 23, 23, 34, 23, 23,
19, 20, 21, 22, 23, 1, 24, 23, 23, 23,
25, 26, 23, 23, 27, 23, 23, 23, 23, 28,
29, 23, 23, 30, 31, 32, 33, 23, 23, 34,
23, 23, 35, 36, 37, 1, 1, others => 1
);
yy_meta : constant array (0 .. 37) of Short :=
(0,
1, 2, 3, 2, 2, 4, 1, 1, 1, 5,
1, 1, 6, 7, 5, 6, 1, 1, 1, 8,
9, 1, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 5, 1, 11
);
yy_base : constant array (0 .. 259) of Short :=
(0,
0, 37, 73, 108, 400, 399, 398, 397, 92, 96,
144, 0, 377, 376, 179, 180, 83, 112, 181, 184,
121, 187, 217, 0, 394, 393, 99, 101, 182, 252,
395, 911, 207, 911, 380, 257, 911, 390, 247, 379,
377, 911, 261, 911, 911, 80, 911, 373, 369, 371,
282, 315, 911, 377, 372, 911, 381, 0, 380, 911,
0, 135, 911, 911, 911, 911, 360, 0, 911, 911,
911, 911, 365, 911, 911, 911, 911, 359, 911, 911,
358, 348, 911, 0, 344, 911, 0, 911, 911, 179,
346, 911, 0, 911, 911, 355, 911, 911, 911, 0,
911, 911, 0, 271, 911, 343, 0, 280, 911, 343,
351, 911, 348, 0, 318, 321, 911, 345, 333, 285,
911, 343, 911, 320, 85, 110, 911, 328, 0, 911,
339, 330, 375, 911, 329, 202, 0, 338, 337, 0,
911, 336, 911, 0, 290, 911, 0, 322, 911, 321,
911, 911, 911, 0, 247, 911, 0, 411, 0, 333,
911, 0, 911, 321, 331, 0, 309, 304, 327, 911,
326, 911, 298, 911, 280, 310, 0, 0, 911, 312,
266, 319, 0, 321, 911, 307, 0, 911, 299, 277,
283, 911, 247, 239, 242, 283, 195, 190, 183, 103,
911, 115, 193, 126, 911, 117, 911, 104, 911, 911,
73, 911, 911, 448, 459, 470, 481, 492, 503, 514,
525, 536, 547, 558, 564, 574, 585, 591, 601, 612,
623, 634, 645, 656, 667, 678, 684, 694, 705, 716,
727, 736, 742, 752, 763, 774, 70, 785, 796, 807,
818, 828, 839, 845, 855, 866, 877, 888, 899
);
yy_def : constant array (0 .. 259) of Short :=
(0,
213, 213, 214, 214, 215, 215, 216, 216, 217, 217,
213, 11, 218, 218, 219, 219, 220, 220, 221, 221,
222, 222, 213, 23, 223, 223, 218, 218, 224, 224,
213, 213, 213, 213, 225, 213, 213, 226, 227, 213,
228, 213, 213, 213, 213, 213, 213, 213, 229, 230,
231, 232, 213, 213, 213, 213, 233, 234, 235, 213,
236, 213, 213, 213, 213, 213, 213, 237, 213, 213,
213, 213, 213, 213, 213, 213, 213, 230, 213, 213,
238, 239, 213, 240, 230, 213, 241, 213, 213, 242,
241, 213, 243, 213, 213, 244, 213, 213, 213, 245,
213, 213, 246, 213, 213, 225, 247, 213, 213, 213,
226, 213, 213, 248, 213, 213, 213, 249, 228, 213,
213, 250, 213, 213, 229, 229, 213, 213, 251, 213,
251, 213, 232, 213, 213, 250, 252, 253, 233, 234,
213, 235, 213, 236, 213, 213, 237, 213, 213, 213,
213, 213, 213, 241, 242, 213, 242, 213, 243, 244,
213, 245, 213, 254, 255, 248, 213, 213, 249, 213,
250, 213, 213, 213, 229, 213, 251, 131, 213, 213,
253, 250, 252, 253, 213, 213, 158, 213, 256, 254,
255, 213, 213, 213, 213, 229, 257, 258, 259, 213,
213, 213, 229, 257, 213, 258, 213, 259, 213, 213,
213, 213, 0, 213, 213, 213, 213, 213, 213, 213,
213, 213, 213, 213, 213, 213, 213, 213, 213, 213,
213, 213, 213, 213, 213, 213, 213, 213, 213, 213,
213, 213, 213, 213, 213, 213, 213, 213, 213, 213,
213, 213, 213, 213, 213, 213, 213, 213, 213
);
yy_nxt : constant array (0 .. 948) of Short :=
(0,
32, 33, 34, 33, 33, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 32, 32, 32, 32, 36, 37,
36, 36, 32, 38, 32, 39, 32, 32, 32, 40,
32, 32, 32, 32, 32, 32, 32, 32, 32, 41,
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
41, 32, 32, 32, 43, 44, 43, 43, 45, 164,
46, 123, 123, 47, 123, 76, 47, 47, 77, 48,
212, 49, 50, 62, 63, 62, 62, 62, 63, 62,
62, 98, 78, 98, 126, 174, 209, 51, 47, 52,
53, 52, 52, 45, 76, 46, 54, 77, 47, 207,
55, 47, 47, 65, 48, 175, 49, 50, 205, 56,
125, 78, 211, 84, 210, 99, 145, 99, 145, 145,
85, 86, 51, 47, 64, 64, 65, 64, 64, 64,
64, 64, 64, 64, 64, 66, 64, 64, 64, 64,
64, 67, 64, 64, 64, 64, 68, 68, 68, 68,
68, 68, 68, 68, 68, 68, 68, 68, 64, 64,
64, 71, 71, 65, 101, 209, 65, 102, 156, 65,
72, 72, 207, 80, 73, 73, 80, 205, 157, 84,
81, 103, 82, 81, 172, 82, 85, 86, 104, 105,
104, 104, 126, 174, 182, 74, 74, 87, 87, 88,
87, 87, 89, 87, 87, 87, 90, 87, 87, 91,
87, 92, 87, 87, 87, 87, 87, 87, 87, 93,
93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
93, 94, 87, 95, 101, 114, 156, 102, 108, 109,
108, 108, 120, 121, 120, 120, 157, 202, 185, 110,
201, 103, 104, 105, 104, 104, 200, 115, 198, 116,
117, 108, 109, 108, 108, 192, 120, 121, 120, 120,
107, 145, 110, 145, 145, 196, 122, 130, 203, 126,
174, 188, 126, 174, 131, 131, 131, 131, 131, 131,
131, 131, 131, 131, 131, 131, 133, 134, 133, 133,
122, 172, 149, 185, 197, 127, 195, 135, 172, 170,
194, 199, 193, 192, 107, 161, 186, 148, 143, 140,
185, 181, 180, 176, 173, 172, 107, 170, 168, 167,
136, 178, 165, 112, 178, 118, 107, 161, 158, 128,
152, 178, 178, 178, 178, 178, 178, 178, 178, 178,
178, 178, 178, 150, 128, 179, 133, 134, 133, 133,
148, 146, 143, 140, 138, 137, 128, 135, 126, 124,
107, 118, 112, 107, 213, 97, 97, 69, 69, 60,
60, 58, 58, 213, 213, 213, 213, 213, 213, 213,
136, 187, 187, 188, 187, 187, 189, 187, 187, 187,
189, 187, 187, 187, 187, 189, 187, 187, 187, 187,
187, 187, 187, 189, 189, 189, 189, 189, 189, 189,
189, 189, 189, 189, 189, 189, 187, 189, 42, 42,
42, 42, 42, 42, 42, 42, 42, 42, 42, 57,
57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
59, 61, 61, 61, 61, 61, 61, 61, 61, 61,
61, 61, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 70, 70, 70, 70, 70, 70, 70,
70, 70, 70, 70, 75, 75, 75, 75, 75, 75,
75, 75, 75, 75, 75, 79, 79, 79, 79, 79,
79, 79, 79, 79, 79, 79, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 96, 96, 96,
96, 96, 96, 96, 96, 96, 96, 96, 100, 100,
100, 100, 100, 100, 100, 100, 100, 100, 100, 106,
106, 213, 213, 106, 111, 111, 111, 111, 111, 111,
111, 111, 111, 111, 111, 113, 113, 113, 113, 113,
113, 113, 113, 113, 113, 113, 119, 119, 213, 213,
119, 125, 125, 213, 125, 125, 125, 125, 125, 213,
125, 125, 127, 127, 213, 127, 127, 127, 127, 127,
127, 127, 127, 129, 129, 213, 129, 129, 129, 129,
129, 129, 129, 129, 132, 132, 132, 132, 132, 132,
132, 132, 132, 132, 132, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 139, 141, 213, 213, 141,
141, 141, 141, 141, 141, 141, 141, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 144, 144,
213, 144, 144, 144, 144, 144, 144, 144, 144, 147,
213, 213, 213, 147, 149, 149, 213, 149, 149, 149,
149, 149, 149, 149, 149, 151, 151, 213, 151, 151,
151, 151, 151, 151, 151, 151, 153, 153, 213, 153,
153, 153, 153, 153, 213, 153, 153, 154, 154, 213,
213, 213, 154, 154, 154, 154, 155, 155, 213, 155,
155, 155, 155, 155, 155, 155, 155, 159, 213, 213,
213, 159, 160, 160, 160, 160, 160, 160, 160, 160,
160, 160, 160, 162, 162, 213, 213, 162, 162, 162,
213, 162, 162, 162, 163, 163, 213, 163, 163, 163,
163, 163, 163, 163, 163, 166, 166, 213, 166, 166,
166, 166, 166, 166, 166, 166, 169, 169, 169, 169,
169, 169, 169, 169, 169, 169, 169, 171, 171, 171,
171, 171, 171, 171, 171, 171, 171, 171, 177, 177,
213, 177, 177, 177, 177, 177, 177, 177, 183, 183,
213, 183, 183, 183, 183, 183, 183, 183, 183, 184,
184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
190, 190, 213, 213, 190, 191, 191, 191, 191, 191,
191, 191, 191, 191, 191, 191, 189, 189, 189, 189,
189, 189, 189, 189, 189, 189, 189, 204, 204, 204,
204, 204, 204, 204, 204, 204, 204, 204, 206, 206,
206, 206, 206, 206, 206, 206, 206, 206, 206, 208,
208, 208, 208, 208, 208, 208, 208, 208, 208, 208,
31, 213, 213, 213, 213, 213, 213, 213, 213, 213,
213, 213, 213, 213, 213, 213, 213, 213, 213, 213,
213, 213, 213, 213, 213, 213, 213, 213, 213, 213,
213, 213, 213, 213, 213, 213, 213, 213
);
yy_chk : constant array (0 .. 948) of Short :=
(0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 3, 3, 3, 3, 3, 247,
3, 46, 46, 3, 46, 17, 3, 3, 17, 3,
211, 3, 3, 9, 9, 9, 9, 10, 10, 10,
10, 27, 17, 28, 125, 125, 208, 3, 3, 4,
4, 4, 4, 4, 18, 4, 4, 18, 4, 206,
4, 4, 4, 21, 4, 126, 4, 4, 204, 4,
126, 18, 202, 21, 200, 27, 62, 28, 62, 62,
21, 21, 4, 4, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 15, 16, 19, 29, 199, 20, 29, 90, 22,
15, 16, 198, 19, 15, 16, 20, 197, 90, 22,
19, 29, 19, 20, 136, 20, 22, 22, 33, 33,
33, 33, 203, 203, 136, 15, 16, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 30, 39, 155, 30, 36, 36,
36, 36, 43, 43, 43, 43, 155, 195, 181, 36,
194, 30, 104, 104, 104, 104, 193, 39, 181, 39,
39, 108, 108, 108, 108, 191, 120, 120, 120, 120,
190, 145, 108, 145, 145, 175, 43, 51, 196, 175,
175, 189, 196, 196, 51, 51, 51, 51, 51, 51,
51, 51, 51, 51, 51, 51, 52, 52, 52, 52,
120, 182, 186, 184, 180, 176, 173, 52, 171, 169,
168, 182, 167, 165, 164, 160, 150, 148, 142, 139,
138, 135, 132, 128, 124, 122, 119, 118, 116, 115,
52, 131, 113, 111, 131, 110, 106, 96, 91, 85,
82, 131, 131, 131, 131, 131, 131, 131, 131, 131,
131, 131, 131, 81, 78, 131, 133, 133, 133, 133,
73, 67, 59, 57, 55, 54, 50, 133, 49, 48,
41, 40, 38, 35, 31, 26, 25, 14, 13, 8,
7, 6, 5, 0, 0, 0, 0, 0, 0, 0,
133, 158, 158, 158, 158, 158, 158, 158, 158, 158,
158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
158, 158, 158, 158, 158, 158, 158, 158, 214, 214,
214, 214, 214, 214, 214, 214, 214, 214, 214, 215,
215, 215, 215, 215, 215, 215, 215, 215, 215, 215,
216, 216, 216, 216, 216, 216, 216, 216, 216, 216,
216, 217, 217, 217, 217, 217, 217, 217, 217, 217,
217, 217, 218, 218, 218, 218, 218, 218, 218, 218,
218, 218, 218, 219, 219, 219, 219, 219, 219, 219,
219, 219, 219, 219, 220, 220, 220, 220, 220, 220,
220, 220, 220, 220, 220, 221, 221, 221, 221, 221,
221, 221, 221, 221, 221, 221, 222, 222, 222, 222,
222, 222, 222, 222, 222, 222, 222, 223, 223, 223,
223, 223, 223, 223, 223, 223, 223, 223, 224, 224,
224, 224, 224, 224, 224, 224, 224, 224, 224, 225,
225, 0, 0, 225, 226, 226, 226, 226, 226, 226,
226, 226, 226, 226, 226, 227, 227, 227, 227, 227,
227, 227, 227, 227, 227, 227, 228, 228, 0, 0,
228, 229, 229, 0, 229, 229, 229, 229, 229, 0,
229, 229, 230, 230, 0, 230, 230, 230, 230, 230,
230, 230, 230, 231, 231, 0, 231, 231, 231, 231,
231, 231, 231, 231, 232, 232, 232, 232, 232, 232,
232, 232, 232, 232, 232, 233, 233, 233, 233, 233,
233, 233, 233, 233, 233, 233, 234, 0, 0, 234,
234, 234, 234, 234, 234, 234, 234, 235, 235, 235,
235, 235, 235, 235, 235, 235, 235, 235, 236, 236,
0, 236, 236, 236, 236, 236, 236, 236, 236, 237,
0, 0, 0, 237, 238, 238, 0, 238, 238, 238,
238, 238, 238, 238, 238, 239, 239, 0, 239, 239,
239, 239, 239, 239, 239, 239, 240, 240, 0, 240,
240, 240, 240, 240, 0, 240, 240, 241, 241, 0,
0, 0, 241, 241, 241, 241, 242, 242, 0, 242,
242, 242, 242, 242, 242, 242, 242, 243, 0, 0,
0, 243, 244, 244, 244, 244, 244, 244, 244, 244,
244, 244, 244, 245, 245, 0, 0, 245, 245, 245,
0, 245, 245, 245, 246, 246, 0, 246, 246, 246,
246, 246, 246, 246, 246, 248, 248, 0, 248, 248,
248, 248, 248, 248, 248, 248, 249, 249, 249, 249,
249, 249, 249, 249, 249, 249, 249, 250, 250, 250,
250, 250, 250, 250, 250, 250, 250, 250, 251, 251,
0, 251, 251, 251, 251, 251, 251, 251, 252, 252,
0, 252, 252, 252, 252, 252, 252, 252, 252, 253,
253, 253, 253, 253, 253, 253, 253, 253, 253, 253,
254, 254, 0, 0, 254, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 256, 256, 256, 256,
256, 256, 256, 256, 256, 256, 256, 257, 257, 257,
257, 257, 257, 257, 257, 257, 257, 257, 258, 258,
258, 258, 258, 258, 258, 258, 258, 258, 258, 259,
259, 259, 259, 259, 259, 259, 259, 259, 259, 259,
213, 213, 213, 213, 213, 213, 213, 213, 213, 213,
213, 213, 213, 213, 213, 213, 213, 213, 213, 213,
213, 213, 213, 213, 213, 213, 213, 213, 213, 213,
213, 213, 213, 213, 213, 213, 213, 213
);
-- copy whatever the last rule matched to the standard output
procedure ECHO is
begin
if Text_IO.Is_Open (user_output_file) then
Text_IO.Put (user_output_file, YYText);
else
Text_IO.Put (YYText);
end if;
end ECHO;
-- enter a start condition.
-- Using procedure requires a () after the ENTER, but makes everything
-- much neater.
procedure ENTER (state : Integer) is
begin
yy_start := 1 + 2 * state;
end ENTER;
-- action number for EOF rule of a given start state
function YY_STATE_EOF (state : Integer) return Integer is
begin
return YY_END_OF_BUFFER + state + 1;
end YY_STATE_EOF;
-- return all but the first 'n' matched characters back to the input stream
procedure yyless (n : Integer) is
begin
yy_ch_buf (yy_cp) := yy_hold_char; -- undo effects of setting up yytext
yy_cp := yy_bp + n;
yy_c_buf_p := yy_cp;
YY_DO_BEFORE_ACTION; -- set up yytext again
end yyless;
-- redefine this if you have something you want each time.
procedure YY_USER_ACTION is
begin
null;
end YY_USER_ACTION;
-- yy_get_previous_state - get the state just before the EOB char was reached
function yy_get_previous_state return yy_state_type is
yy_current_state : yy_state_type;
yy_c : Short;
yy_bp : constant Integer := yytext_ptr;
begin
yy_current_state := yy_start;
if yy_ch_buf (yy_bp - 1) = ASCII.LF then
yy_current_state := yy_current_state + 1;
end if;
for yy_cp in yytext_ptr .. yy_c_buf_p - 1 loop
yy_c := yy_ec (yy_ch_buf (yy_cp));
if yy_accept (yy_current_state) /= 0 then
yy_last_accepting_state := yy_current_state;
yy_last_accepting_cpos := yy_cp;
end if;
while yy_chk (yy_base (yy_current_state) + yy_c) /= yy_current_state loop
yy_current_state := yy_def (yy_current_state);
if yy_current_state >= 214 then
yy_c := yy_meta (yy_c);
end if;
end loop;
yy_current_state := yy_nxt (yy_base (yy_current_state) + yy_c);
end loop;
return yy_current_state;
end yy_get_previous_state;
procedure yyrestart (input_file : File_Type) is
begin
Open_Input (Text_IO.Name (input_file));
end yyrestart;
begin -- of YYLex
<<new_file>>
-- this is where we enter upon encountering an end-of-file and
-- yyWrap () indicating that we should continue processing
if yy_init then
if yy_start = 0 then
yy_start := 1; -- first start state
end if;
-- we put in the '\n' and start reading from [1] so that an
-- initial match-at-newline will be true.
yy_ch_buf (0) := ASCII.LF;
yy_n_chars := 1;
-- we always need two end-of-buffer characters. The first causes
-- a transition to the end-of-buffer state. The second causes
-- a jam in that state.
yy_ch_buf (yy_n_chars) := YY_END_OF_BUFFER_CHAR;
yy_ch_buf (yy_n_chars + 1) := YY_END_OF_BUFFER_CHAR;
yy_eof_has_been_seen := False;
yytext_ptr := 1;
yy_c_buf_p := yytext_ptr;
yy_hold_char := yy_ch_buf (yy_c_buf_p);
yy_init := False;
end if; -- yy_init
loop -- loops until end-of-file is reached
yy_cp := yy_c_buf_p;
-- support of yytext
yy_ch_buf (yy_cp) := yy_hold_char;
-- yy_bp points to the position in yy_ch_buf of the start of the
-- current run.
yy_bp := yy_cp;
yy_current_state := yy_start;
if yy_ch_buf (yy_bp - 1) = ASCII.LF then
yy_current_state := yy_current_state + 1;
end if;
loop
yy_c := yy_ec (yy_ch_buf (yy_cp));
if yy_accept (yy_current_state) /= 0 then
yy_last_accepting_state := yy_current_state;
yy_last_accepting_cpos := yy_cp;
end if;
while yy_chk (yy_base (yy_current_state) + yy_c) /= yy_current_state loop
yy_current_state := yy_def (yy_current_state);
if yy_current_state >= 214 then
yy_c := yy_meta (yy_c);
end if;
end loop;
yy_current_state := yy_nxt (yy_base (yy_current_state) + yy_c);
yy_cp := yy_cp + 1;
if yy_current_state = 213 then
exit;
end if;
end loop;
yy_cp := yy_last_accepting_cpos;
yy_current_state := yy_last_accepting_state;
<<next_action>>
yy_act := yy_accept (yy_current_state);
YY_DO_BEFORE_ACTION;
YY_USER_ACTION;
if aflex_debug then -- output acceptance info. for (-d) debug mode
Text_IO.Put (Standard_Error, "--accepting rule #");
Text_IO.Put (Standard_Error, Integer'Image (yy_act));
Text_IO.Put_Line (Standard_Error, "(""" & YYText & """)");
end if;
<<do_action>> -- this label is used only to access EOF actions
case yy_act is
when 0 => -- must backtrack
-- undo the effects of YY_DO_BEFORE_ACTION
yy_ch_buf (yy_cp) := yy_hold_char;
yy_cp := yy_last_accepting_cpos;
yy_current_state := yy_last_accepting_state;
goto next_action;
when 1 =>
--# line 55 "ascan.l"
indented_code := True;
when 2 =>
--# line 56 "ascan.l"
linenum := linenum + 1; ECHO;
-- treat as a comment;
when 3 =>
--# line 59 "ascan.l"
linenum := linenum + 1; ECHO;
when 4 =>
--# line 60 "ascan.l"
return SCDECL;
when 5 =>
--# line 61 "ascan.l"
return XSCDECL;
when 6 =>
--# line 62 "ascan.l"
return USCDECL;
when 7 =>
--# line 64 "ascan.l"
return WHITESPACE;
when 8 =>
--# line 66 "ascan.l"
sectnum := 2;
misc.line_directive_out;
ENTER(SECT2PROLOG);
return SECTEND;
when 9 =>
--# line 73 "ascan.l"
Ada.Text_IO.Put( Standard_Error, "old-style lex command at line " );
int_io.put( Standard_Error, linenum );
Ada.Text_IO.Put( Standard_Error, " ignored:" );
text_io.new_line( Standard_Error );
Ada.Text_IO.Put( Standard_Error, ASCII.HT );
Ada.Text_IO.Put( Standard_Error, yytext(1..YYLength) );
linenum := linenum + 1;
when 10 =>
--# line 83 "ascan.l"
nmstr := vstr(yytext(1..YYLength));
didadef := False;
ENTER(PICKUPDEF);
when 11 =>
--# line 89 "ascan.l"
nmstr := vstr(yytext(1..YYLength));
return UNAME;
when 12 =>
--# line 93 "ascan.l"
nmstr := vstr(yytext(1..YYLength));
return NAME;
when 13 =>
--# line 96 "ascan.l"
linenum := linenum + 1;
-- allows blank lines in section 1;
when 14 =>
--# line 99 "ascan.l"
linenum := linenum + 1; return Newline;
when 15 =>
--# line 100 "ascan.l"
misc.synerr( "illegal character" );ENTER(RECOVER);
when 16 =>
--# line 102 "ascan.l"
null;
-- separates name and definition;
when 17 =>
--# line 106 "ascan.l"
nmdef := vstr(yytext(1..YYLength));
i := tstring.len( nmdef );
while ( i >= tstring.first ) loop
if ( (CHAR(nmdef,i) /= ' ') and
(CHAR(nmdef,i) /= ASCII.HT) ) then
exit;
end if;
i := i - 1;
end loop;
sym.ndinstal( nmstr,
tstring.slice(nmdef, tstring.first, i) );
didadef := True;
when 18 =>
--# line 123 "ascan.l"
if not didadef then
misc.synerr( "incomplete name definition" );
end if;
ENTER(0);
linenum := linenum + 1;
when 19 =>
--# line 131 "ascan.l"
linenum := linenum + 1;
ENTER(0);
nmstr := vstr(yytext(1..YYLength));
return NAME;
when 20 =>
yy_ch_buf (yy_cp) := yy_hold_char; -- undo effects of setting up yytext
yy_cp := yy_cp - 1;
yy_c_buf_p := yy_cp;
YY_DO_BEFORE_ACTION; -- set up yytext again
--# line 137 "ascan.l"
linenum := linenum + 1;
ACTION_ECHO;
MARK_END_OF_PROLOG;
ENTER(SECT2);
when 21 =>
--# line 144 "ascan.l"
linenum := linenum + 1; ACTION_ECHO;
when YY_END_OF_BUFFER +SECT2PROLOG + 1
=>
--# line 146 "ascan.l"
MARK_END_OF_PROLOG;
return End_Of_Input;
when 23 =>
--# line 150 "ascan.l"
linenum := linenum + 1;
-- allow blank lines in sect2;
-- this rule matches indented lines which
-- are not comments.
when 24 =>
--# line 155 "ascan.l"
misc.synerr("indented code found outside of action");
linenum := linenum + 1;
when 25 =>
--# line 160 "ascan.l"
ENTER(SC); return ( '<' );
when 26 =>
--# line 161 "ascan.l"
return ( '^' );
when 27 =>
--# line 162 "ascan.l"
ENTER(QUOTE); return ( '"' );
when 28 =>
yy_ch_buf (yy_cp) := yy_hold_char; -- undo effects of setting up yytext
yy_cp := yy_bp + 1;
yy_c_buf_p := yy_cp;
YY_DO_BEFORE_ACTION; -- set up yytext again
--# line 163 "ascan.l"
ENTER(NUM); return ( '{' );
when 29 =>
--# line 164 "ascan.l"
ENTER(BRACEERROR);
when 30 =>
yy_ch_buf (yy_cp) := yy_hold_char; -- undo effects of setting up yytext
yy_cp := yy_bp + 1;
yy_c_buf_p := yy_cp;
YY_DO_BEFORE_ACTION; -- set up yytext again
--# line 165 "ascan.l"
return '$';
when 31 =>
--# line 167 "ascan.l"
continued_action := True;
linenum := linenum + 1;
return Newline;
when 32 =>
--# line 172 "ascan.l"
linenum := linenum + 1; ACTION_ECHO;
when 33 =>
--# line 174 "ascan.l"
-- this rule is separate from the one below because
-- otherwise we get variable trailing context, so
-- we can't build the scanner using -f,F
bracelevel := 0;
continued_action := False;
ENTER(ACTION);
return Newline;
when 34 =>
yy_ch_buf (yy_cp) := yy_hold_char; -- undo effects of setting up yytext
yy_cp := yy_cp - 1;
yy_c_buf_p := yy_cp;
YY_DO_BEFORE_ACTION; -- set up yytext again
--# line 185 "ascan.l"
bracelevel := 0;
continued_action := False;
ENTER(ACTION);
return Newline;
when 35 =>
--# line 192 "ascan.l"
linenum := linenum + 1; return Newline;
when 36 =>
--# line 194 "ascan.l"
return EOF_OP;
when 37 =>
--# line 196 "ascan.l"
sectnum := 3;
ENTER(SECT3);
return End_Of_Input;
-- to stop the parser
when 38 =>
--# line 203 "ascan.l"
nmstr := vstr(yytext(1..YYLength));
-- check to see if we've already encountered this ccl
cclval := sym.ccllookup( nmstr );
if ( cclval /= 0 ) then
YYLVal := cclval;
cclreuse := cclreuse + 1;
return PREVCCL;
else
-- we fudge a bit. We know that this ccl will
-- soon be numbered as lastccl + 1 by cclinit
sym.cclinstal( nmstr, lastccl + 1 );
-- push back everything but the leading bracket
-- so the ccl can be rescanned
PUT_BACK_STRING(nmstr, 1);
ENTER(FIRSTCCL);
return '[';
end if;
when 39 =>
--# line 228 "ascan.l"
nmstr := vstr(yytext(1..YYLength));
-- chop leading and trailing brace
tmpbuf := slice(vstr(yytext(1..YYLength)),
2, YYLength-1);
nmdefptr := sym.ndlookup( tmpbuf );
if ( nmdefptr = NUL ) then
misc.synerr( "undefined {name}" );
else
-- push back name surrounded by ()'s
unput(')');
PUT_BACK_STRING(nmdefptr, 0);
unput('(');
end if;
when 40 =>
--# line 245 "ascan.l"
tmpbuf := vstr(yytext(1..YYLength));
case tstring.CHAR(tmpbuf,1) is
when '/' => return '/';
when '|' => return '|';
when '*' => return '*';
when '+' => return '+';
when '?' => return '?';
when '.' => return '.';
when '(' => return '(';
when ')' => return ')';
when others =>
misc.aflexerror("error in aflex case");
end case;
when 41 =>
--# line 259 "ascan.l"
tmpbuf := vstr(yytext(1..YYLength));
YYLVal := CHARACTER'POS(CHAR(tmpbuf,1));
return CHAR;
when 42 =>
--# line 263 "ascan.l"
linenum := linenum + 1; return Newline;
when 43 =>
--# line 266 "ascan.l"
return ( ',' );
when 44 =>
--# line 267 "ascan.l"
ENTER(SECT2); return ( '>' );
when 45 =>
yy_ch_buf (yy_cp) := yy_hold_char; -- undo effects of setting up yytext
yy_cp := yy_bp + 1;
yy_c_buf_p := yy_cp;
YY_DO_BEFORE_ACTION; -- set up yytext again
--# line 268 "ascan.l"
ENTER(CARETISBOL); return ( '>' );
when 46 =>
--# line 269 "ascan.l"
nmstr := vstr(yytext(1..YYLength));
return NAME;
when 47 =>
--# line 272 "ascan.l"
misc.synerr( "bad start condition name" );
when 48 =>
--# line 274 "ascan.l"
ENTER(SECT2); return '^';
when 49 =>
--# line 277 "ascan.l"
tmpbuf := vstr(yytext(1..YYLength));
YYLVal := CHARACTER'POS(CHAR(tmpbuf,1));
return CHAR;
when 50 =>
--# line 281 "ascan.l"
ENTER(SECT2); return '"';
when 51 =>
--# line 283 "ascan.l"
misc.synerr( "missing quote" );
ENTER(SECT2);
linenum := linenum + 1;
return '"';
when 52 =>
yy_ch_buf (yy_cp) := yy_hold_char; -- undo effects of setting up yytext
yy_cp := yy_bp + 1;
yy_c_buf_p := yy_cp;
YY_DO_BEFORE_ACTION; -- set up yytext again
--# line 291 "ascan.l"
ENTER(CCL); return '^';
when 53 =>
yy_ch_buf (yy_cp) := yy_hold_char; -- undo effects of setting up yytext
yy_cp := yy_bp + 1;
yy_c_buf_p := yy_cp;
YY_DO_BEFORE_ACTION; -- set up yytext again
--# line 292 "ascan.l"
return '^';
when 54 =>
--# line 293 "ascan.l"
ENTER(CCL); YYLVal := CHARACTER'POS('-'); return ( CHAR );
when 55 =>
--# line 294 "ascan.l"
ENTER(CCL);
tmpbuf := vstr(yytext(1..YYLength));
YYLVal := CHARACTER'POS(CHAR(tmpbuf,1));
return CHAR;
when 56 =>
yy_ch_buf (yy_cp) := yy_hold_char; -- undo effects of setting up yytext
yy_cp := yy_bp + 1;
yy_c_buf_p := yy_cp;
YY_DO_BEFORE_ACTION; -- set up yytext again
--# line 300 "ascan.l"
return '-';
when 57 =>
--# line 301 "ascan.l"
tmpbuf := vstr(yytext(1..YYLength));
YYLVal := CHARACTER'POS(CHAR(tmpbuf,1));
return CHAR;
when 58 =>
--# line 305 "ascan.l"
ENTER(SECT2); return ']';
when 59 =>
--# line 308 "ascan.l"
YYLVal := misc.myctoi( vstr(yytext(1..YYLength)) );
return NUMBER;
when 60 =>
--# line 313 "ascan.l"
return ',';
when 61 =>
--# line 314 "ascan.l"
ENTER(SECT2); return '}';
when 62 =>
--# line 316 "ascan.l"
misc.synerr( "bad character inside {}'s" );
ENTER(SECT2);
return '}';
when 63 =>
--# line 322 "ascan.l"
misc.synerr( "missing }" );
ENTER(SECT2);
linenum := linenum + 1;
return '}';
when 64 =>
--# line 330 "ascan.l"
misc.synerr( "bad name in {}'s" ); ENTER(SECT2);
when 65 =>
--# line 331 "ascan.l"
misc.synerr( "missing }" );
linenum := linenum + 1;
ENTER(SECT2);
when 66 =>
--# line 336 "ascan.l"
bracelevel := bracelevel + 1;
when 67 =>
--# line 337 "ascan.l"
bracelevel := bracelevel - 1;
when 68 =>
--# line 338 "ascan.l"
ACTION_ECHO;
when 69 =>
--# line 339 "ascan.l"
ACTION_ECHO;
when 70 =>
--# line 340 "ascan.l"
linenum := linenum + 1; ACTION_ECHO;
when 71 =>
--# line 341 "ascan.l"
ACTION_ECHO;
-- character constant;
when 72 =>
--# line 345 "ascan.l"
ACTION_ECHO; ENTER(ACTION_STRING);
when 73 =>
--# line 347 "ascan.l"
linenum := linenum + 1;
ACTION_ECHO;
if bracelevel = 0 then
text_io.new_line ( temp_action_file );
ENTER(SECT2);
end if;
when 74 =>
--# line 355 "ascan.l"
ACTION_ECHO;
when 75 =>
--# line 357 "ascan.l"
ACTION_ECHO;
when 76 =>
--# line 358 "ascan.l"
ACTION_ECHO;
when 77 =>
--# line 359 "ascan.l"
linenum := linenum + 1; ACTION_ECHO;
when 78 =>
--# line 360 "ascan.l"
ACTION_ECHO; ENTER(ACTION);
when 79 =>
--# line 361 "ascan.l"
ACTION_ECHO;
when 80 =>
--# line 364 "ascan.l"
YYLVal := CHARACTER'POS(misc.myesc( vstr(yytext(1..YYLength)) ));
return ( CHAR );
when 81 =>
--# line 369 "ascan.l"
YYLVal := CHARACTER'POS(misc.myesc( vstr(yytext(1..YYLength)) ));
ENTER(CCL);
return CHAR;
when 82 =>
--# line 376 "ascan.l"
if check_yylex_here then
return End_Of_Input;
else
ECHO;
end if;
when 83 =>
--# line 382 "ascan.l"
ECHO;
when YY_END_OF_BUFFER + INITIAL + 1 |
YY_END_OF_BUFFER + SECT2 + 1 |
YY_END_OF_BUFFER + SECT3 + 1 |
YY_END_OF_BUFFER + PICKUPDEF + 1 |
YY_END_OF_BUFFER + SC + 1 |
YY_END_OF_BUFFER + CARETISBOL + 1 |
YY_END_OF_BUFFER + NUM + 1 |
YY_END_OF_BUFFER + QUOTE + 1 |
YY_END_OF_BUFFER + FIRSTCCL + 1 |
YY_END_OF_BUFFER + CCL + 1 |
YY_END_OF_BUFFER + ACTION + 1 |
YY_END_OF_BUFFER + RECOVER + 1 |
YY_END_OF_BUFFER + BRACEERROR + 1 |
YY_END_OF_BUFFER + ACTION_STRING + 1 =>
return End_Of_Input;
when YY_END_OF_BUFFER =>
-- undo the effects of YY_DO_BEFORE_ACTION
yy_ch_buf (yy_cp) := yy_hold_char;
yytext_ptr := yy_bp;
case yy_get_next_buffer is
when EOB_ACT_END_OF_FILE =>
if yyWrap then
-- note: because we've taken care in
-- yy_get_next_buffer() to have set up yytext,
-- we can now set up yy_c_buf_p so that if some
-- total hoser (like aflex itself) wants
-- to call the scanner after we return the
-- End_Of_Input, it'll still work - another
-- End_Of_Input will get returned.
yy_c_buf_p := yytext_ptr;
yy_act := YY_STATE_EOF ((yy_start - 1) / 2);
goto do_action;
else
-- start processing a new file
yy_init := True;
goto new_file;
end if;
when EOB_ACT_RESTART_SCAN =>
yy_c_buf_p := yytext_ptr;
yy_hold_char := yy_ch_buf (yy_c_buf_p);
when EOB_ACT_LAST_MATCH =>
yy_c_buf_p := yy_n_chars;
yy_current_state := yy_get_previous_state;
yy_cp := yy_c_buf_p;
yy_bp := yytext_ptr;
goto next_action;
when others =>
null;
end case; -- case yy_get_next_buffer()
when others =>
Text_IO.Put ("action # ");
Text_IO.Put (Integer'Image (yy_act));
Text_IO.New_Line;
raise AFLEX_INTERNAL_ERROR;
end case; -- case (yy_act)
end loop; -- end of loop waiting for end of file
end YYLex;
--# line 382 "ascan.l"
begin
if (call_yylex) then
toktype := YYLex;
call_yylex := False;
return toktype;
end if;
if ( eofseen ) then
toktype := End_Of_Input;
else
toktype := YYLex;
end if;
-- this tracing code allows easy tracing of aflex runs
if (trace) then
Ada.Text_IO.New_Line (Standard_Error);
Ada.Text_IO.Put (Standard_Error, "toktype = :" );
Ada.Text_IO.Put (Standard_Error, Token'Image (toktype));
Ada.Text_IO.Put_line (Standard_Error, ":" );
end if;
if ( toktype = End_Of_Input ) then
eofseen := True;
if sectnum = 1 then
misc.synerr ("unexpected EOF");
sectnum := 2;
toktype := SECTEND;
elsif sectnum = 2 then
sectnum := 3;
toktype := SECTEND;
end if;
end if;
if trace then
if beglin then
Int_IO.Put (Standard_Error, num_rules + 1);
Ada.Text_IO.Put (Standard_Error, ASCII.HT);
beglin := False;
end if;
case toktype is
when '<' | '>'|'^'|'$'|'"'|'['|']'|'{'|'}'|'|'|'('|
')'|'-'|'/'|'?'|'.'|'*'|'+'|',' =>
Ada.Text_IO.Put (Standard_Error, Token'Image (toktype));
when NEWLINE =>
Ada.Text_IO.New_Line (Standard_Error);
if sectnum = 2 then
beglin := True;
end if;
when SCDECL =>
Ada.Text_IO.Put (Standard_Error, "%s");
when XSCDECL =>
Ada.Text_IO.Put (Standard_Error, "%x");
when WHITESPACE =>
Ada.Text_IO.Put (Standard_Error, " ");
when SECTEND =>
Ada.Text_IO.Put_line (Standard_Error, "%%");
-- we set beglin to be true so we'll start
-- writing out numbers as we echo rules. aflexscan() has
-- already assigned sectnum
if sectnum = 2 then
beglin := True;
end if;
when NAME =>
Ada.Text_IO.Put (Standard_Error, ''');
Ada.Text_IO.Put (Standard_Error, YYText);
Ada.Text_IO.Put (Standard_Error, ''');
when CHAR =>
if ( (YYLVal < CHARACTER'POS(' ')) or
(YYLVal = CHARACTER'POS(ASCII.DEL)) ) then
Ada.Text_IO.Put (Standard_Error, '\');
Int_IO.Put (Standard_Error, YYLVal);
Ada.Text_IO.Put (Standard_Error, '\');
else
Ada.Text_IO.Put (Standard_Error, Token'Image (toktype));
end if;
when NUMBER =>
Int_IO.Put (Standard_Error, YYLVal);
when PREVCCL =>
Ada.Text_IO.Put (Standard_Error, '[');
Int_IO.Put (Standard_Error, YYLVal);
Ada.Text_IO.Put (Standard_Error, ']');
when End_Of_Input =>
Ada.Text_IO.Put (Standard_Error, "End Marker");
when others =>
Ada.Text_IO.Put (Standard_Error, "Something weird:");
Ada.Text_IO.Put_line (Standard_Error, Token'Image (toktype));
end case;
end if;
return toktype;
end get_token;
end scanner;
|
io7m/coreland-lua-ada | Ada | 601 | adb | with UTest;
with Lua;
with Lua.Lib;
procedure loadstring2 is
use type Lua.Error_t;
State : Lua.State_t;
Error_Code : Lua.Error_t;
begin
State := Lua.Open;
Lua.Lib.Open_Base (State);
Error_Code := Lua.Load_String (State, "print 'loaded string'");
if Error_Code /= Lua.Lua_Error_None then
UTest.Fail (1, Lua.To_String (State, -1));
end if;
Error_Code := Lua.PCall (State, 0, -1, 0);
if Error_Code /= Lua.Lua_Error_None then
UTest.Fail (1, Lua.To_String (State, -1));
end if;
exception
when others =>
UTest.Fail (2, "unexpected exception");
end loadstring2;
|
reznikmm/matreshka | Ada | 4,221 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.OCL.Ocl_Expressions;
limited with AMF.UML.States;
package AMF.OCL.State_Exps is
pragma Preelaborate;
type OCL_State_Exp is limited interface
and AMF.OCL.Ocl_Expressions.OCL_Ocl_Expression;
type OCL_State_Exp_Access is
access all OCL_State_Exp'Class;
for OCL_State_Exp_Access'Storage_Size use 0;
not overriding function Get_Referred_State
(Self : not null access constant OCL_State_Exp)
return AMF.UML.States.UML_State_Access is abstract;
-- Getter of StateExp::referredState.
--
not overriding procedure Set_Referred_State
(Self : not null access OCL_State_Exp;
To : AMF.UML.States.UML_State_Access) is abstract;
-- Setter of StateExp::referredState.
--
end AMF.OCL.State_Exps;
|
sungyeon/drake | Ada | 178 | adb | function System.Environment_Block return C.char_ptr_ptr is
environ : C.char_ptr_ptr
with Import, Convention => C;
begin
return environ;
end System.Environment_Block;
|
reznikmm/matreshka | Ada | 4,017 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Draw_Dots1_Length_Attributes;
package Matreshka.ODF_Draw.Dots1_Length_Attributes is
type Draw_Dots1_Length_Attribute_Node is
new Matreshka.ODF_Draw.Abstract_Draw_Attribute_Node
and ODF.DOM.Draw_Dots1_Length_Attributes.ODF_Draw_Dots1_Length_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Draw_Dots1_Length_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Draw_Dots1_Length_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Draw.Dots1_Length_Attributes;
|
jrcarter/Ada_GUI | Ada | 5,675 | ads | -- --
-- package Copyright (c) Dmitry A. Kazakov --
-- Generic_Unbounded_Array Luebeck --
-- Interface Spring, 2002 --
-- --
-- Last revision : 13:51 30 May 2014 --
-- --
-- This library is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public License as --
-- published by the Free Software Foundation; either version 2 of --
-- the License, or (at your option) any later version. This library --
-- is distributed in the hope that it will be useful, but WITHOUT --
-- ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. You should have --
-- received a copy of the GNU General Public License along with --
-- this library; if not, write to the Free Software Foundation, --
-- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
--____________________________________________________________________--
--
-- This package defines a generic type Unbounded_Array. An instance of
-- Unbounded_Array is a dynamically expanded vector of elements. The
-- implementation keeps vector contiguous, so it might be very
-- inefficient to put complex data structures into the array. In many
-- cases it is better to put pointers to elements there. See also
-- Generic_Unbounded_Ptr_Array which instantiates Unbounded_Array for
-- this purpose. The type wraps the component Vector which is a pointer
-- to an array of elements. One can use Vector to access array elements
-- and query its present bounds, which are rather arbitrary. The unused
-- elements of the array vector are padded using a distinguished
-- null-element value. The package generic parameters are:
--
-- Index_Type - The array index type
-- Object_Type - The array element type
-- Object_Array_Type - The array type
-- Null_Element - To pad unused array elements
-- Minimal_Size - Minimal additionally allocated size
-- Increment - By which the vector is enlarged if necessary
--
-- The parameter Increment controls array vector size growth. When
-- there is no free space in the vector then it is enlarged by Size *
-- Increment / 100. Here Size is the current vector size. The allocated
-- amount of elements cannot be less than the parameter Minimal_Size
-- specifies. So it will be the initial vector size after the first
-- element is put in.
--
with Ada.Finalization;
generic
type Index_Type is (<>);
type Object_Type is private;
type Object_Array_Type is array (Index_Type range <>) of Object_Type;
Null_Element : Object_Type;
Minimal_Size : Positive := 64;
Increment : Natural := 50;
package Generic_Unbounded_Array is
type Object_Array_Ptr is access Object_Array_Type;
type Unbounded_Array is
new Ada.Finalization.Limited_Controlled with
record
Vector : Object_Array_Ptr := null;
end record;
--
-- Erase -- Delete all array items
--
-- Container - The array
--
-- This procedure makes Container empty.
--
procedure Erase (Container : in out Unbounded_Array);
--
-- Finalize -- Destructor
--
-- Container - The array
--
procedure Finalize (Container : in out Unbounded_Array);
--
-- Fetch -- Get an array element by its index
--
-- Container - The array
-- Index - Of the element
--
-- This function returns the element corresponding to Index. If the
-- container does not have it, the result is Null_Element.
--
-- Returns :
--
-- The element
--
function Fetch
( Container : Unbounded_Array;
Index : Index_Type
) return Object_Type;
--
-- Get -- Get an array element by its index
--
-- Container - The array
-- Index - Of the element
--
-- This an equivalent to Container.Vector (Index). However, subscript
-- checks cannot be suppressed for Get.
--
-- Returns :
--
-- The element
--
-- Exceptions :
--
-- Constraint_Error - Wrong index
--
function Get
( Container : Unbounded_Array;
Index : Index_Type
) return Object_Type;
--
-- Put -- Replace an array element by its index
--
-- Container - The array
-- Index - Of the element
-- Element - To put in
--
-- The array is expanded as necessary.
--
procedure Put
( Container : in out Unbounded_Array;
Index : Index_Type;
Element : Object_Type
);
private
pragma Inline (Fetch);
pragma Inline (Get);
end Generic_Unbounded_Array;
|
reznikmm/matreshka | Ada | 4,369 | 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.Hyphenation_Ladder_Count.Internals is
------------
-- Create --
------------
function Create
(Node : Matreshka.ODF_Attributes.FO.Hyphenation_Ladder_Count.FO_Hyphenation_Ladder_Count_Access)
return ODF.DOM.Attributes.FO.Hyphenation_Ladder_Count.ODF_FO_Hyphenation_Ladder_Count 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.Hyphenation_Ladder_Count.FO_Hyphenation_Ladder_Count_Access)
return ODF.DOM.Attributes.FO.Hyphenation_Ladder_Count.ODF_FO_Hyphenation_Ladder_Count is
begin
return
(XML.DOM.Attributes.Internals.Wrap
(Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record);
end Wrap;
end ODF.DOM.Attributes.FO.Hyphenation_Ladder_Count.Internals;
|
charlie5/cBound | Ada | 1,725 | 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_fill_poly_request_t is
-- Item
--
type Item is record
major_opcode : aliased Interfaces.Unsigned_8;
pad0 : aliased Interfaces.Unsigned_8;
length : aliased Interfaces.Unsigned_16;
drawable : aliased xcb.xcb_drawable_t;
gc : aliased xcb.xcb_gcontext_t;
shape : aliased Interfaces.Unsigned_8;
coordinate_mode : aliased Interfaces.Unsigned_8;
pad1 : aliased swig.int8_t_Array (0 .. 1);
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C.size_t range <>) of aliased xcb.xcb_fill_poly_request_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_fill_poly_request_t.Item,
Element_Array => xcb.xcb_fill_poly_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_fill_poly_request_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_fill_poly_request_t.Pointer,
Element_Array => xcb.xcb_fill_poly_request_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_fill_poly_request_t;
|
AdaCore/libadalang | Ada | 193 | adb | procedure Testsucc is
type Enum is (A, B, C, D);
Inst : Enum := A;
Inst_2 : Enum := Enum'Succ(Inst);
Inst_3 : Enum := Enum'Succ(C);
begin
null;
end Testsucc;
pragma Test_Block;
|
reznikmm/conan-ada-index | Ada | 95 | adb | with Asis.Implementation;
procedure Main is
begin
Asis.Implementation.Initialize ("");
end; |
reznikmm/matreshka | Ada | 6,840 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Text.Ruby_Base_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Text_Ruby_Base_Element_Node is
begin
return Self : Text_Ruby_Base_Element_Node do
Matreshka.ODF_Text.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Text_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Text_Ruby_Base_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Text_Ruby_Base
(ODF.DOM.Text_Ruby_Base_Elements.ODF_Text_Ruby_Base_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Text_Ruby_Base_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Ruby_Base_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Text_Ruby_Base_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Text_Ruby_Base
(ODF.DOM.Text_Ruby_Base_Elements.ODF_Text_Ruby_Base_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Text_Ruby_Base_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Text_Ruby_Base
(Visitor,
ODF.DOM.Text_Ruby_Base_Elements.ODF_Text_Ruby_Base_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Text_URI,
Matreshka.ODF_String_Constants.Ruby_Base_Element,
Text_Ruby_Base_Element_Node'Tag);
end Matreshka.ODF_Text.Ruby_Base_Elements;
|
reznikmm/matreshka | Ada | 5,262 | 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.Redefinable_Elements.Collections is
pragma Preelaborate;
package UML_Redefinable_Element_Collections is
new AMF.Generic_Collections
(UML_Redefinable_Element,
UML_Redefinable_Element_Access);
type Set_Of_UML_Redefinable_Element is
new UML_Redefinable_Element_Collections.Set with null record;
Empty_Set_Of_UML_Redefinable_Element : constant Set_Of_UML_Redefinable_Element;
type Ordered_Set_Of_UML_Redefinable_Element is
new UML_Redefinable_Element_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_UML_Redefinable_Element : constant Ordered_Set_Of_UML_Redefinable_Element;
type Bag_Of_UML_Redefinable_Element is
new UML_Redefinable_Element_Collections.Bag with null record;
Empty_Bag_Of_UML_Redefinable_Element : constant Bag_Of_UML_Redefinable_Element;
type Sequence_Of_UML_Redefinable_Element is
new UML_Redefinable_Element_Collections.Sequence with null record;
Empty_Sequence_Of_UML_Redefinable_Element : constant Sequence_Of_UML_Redefinable_Element;
private
Empty_Set_Of_UML_Redefinable_Element : constant Set_Of_UML_Redefinable_Element
:= (UML_Redefinable_Element_Collections.Set with null record);
Empty_Ordered_Set_Of_UML_Redefinable_Element : constant Ordered_Set_Of_UML_Redefinable_Element
:= (UML_Redefinable_Element_Collections.Ordered_Set with null record);
Empty_Bag_Of_UML_Redefinable_Element : constant Bag_Of_UML_Redefinable_Element
:= (UML_Redefinable_Element_Collections.Bag with null record);
Empty_Sequence_Of_UML_Redefinable_Element : constant Sequence_Of_UML_Redefinable_Element
:= (UML_Redefinable_Element_Collections.Sequence with null record);
end AMF.UML.Redefinable_Elements.Collections;
|
reznikmm/matreshka | Ada | 6,780 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Draw.Handle_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Draw_Handle_Element_Node is
begin
return Self : Draw_Handle_Element_Node do
Matreshka.ODF_Draw.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Draw_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Draw_Handle_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_Draw_Handle
(ODF.DOM.Draw_Handle_Elements.ODF_Draw_Handle_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 Draw_Handle_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Handle_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Draw_Handle_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_Draw_Handle
(ODF.DOM.Draw_Handle_Elements.ODF_Draw_Handle_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 Draw_Handle_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_Draw_Handle
(Visitor,
ODF.DOM.Draw_Handle_Elements.ODF_Draw_Handle_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.Draw_URI,
Matreshka.ODF_String_Constants.Handle_Element,
Draw_Handle_Element_Node'Tag);
end Matreshka.ODF_Draw.Handle_Elements;
|
joakim-strandberg/wayland_ada_binding | Ada | 2,320 | adb | package body C_Binding.Linux.Sockets.TCP_Client is
use type Interfaces.C.unsigned;
procedure Initialize_Client_Socket is
procedure Create_Stream_Socket;
procedure Connect_To_Socket;
procedure Create_Stream_Socket is
begin
-- This file descriptor will listen
This.My_File_Descriptor := C_Socket (AF_INET, SOCK_STREAM, 0);
if This.My_File_Descriptor = -1 then
Call_Result.Initialize (-0266673276, -1311936320);
Handle_Failure;
else
Connect_To_Socket;
declare
int_Result : Interfaces.C.int;
begin
int_Result := C_Close (This.My_File_Descriptor);
if int_Result = -1 then
Call_Result.Initialize (1659143720, 1750778895);
Handle_Failure;
end if;
end;
end if;
end Create_Stream_Socket;
procedure Connect_To_Socket is
Address : aliased Internet_Socket_Address
:= (
Address_Family => 0,
Port_Number => 0,
Address => (Value => 0),
Padding => (others => 0)
);
Result : Interfaces.C.int;
begin
Address.Address_Family := AF_INET;
Address.Address.Value
:= C_Get_Internet_Address (Settings.Address.all);
Address.Port_Number
:= C_Host_To_Network_Short
(Interfaces.C.unsigned_short (Settings.Port));
Result := C_Connect
(This.My_File_Descriptor,
Address'Access,
Address'Size/8);
if Result = -1 then
Call_Result.Initialize (-2105416615, -2051337028);
Handle_Failure;
else
Handle_Success;
declare
int_Result : Interfaces.C.int;
begin
int_Result := C_Shutdown (This.My_File_Descriptor, SHUT_RDWR);
if int_Result = -1 then
Call_Result.Initialize (-1550497564, 1680888681);
Handle_Failure;
end if;
end;
end if;
end Connect_To_Socket;
begin
Create_Stream_Socket;
end Initialize_Client_Socket;
end C_Binding.Linux.Sockets.TCP_Client;
|
rtoal/enhanced-dining-philosophers | Ada | 1,281 | ads | ------------------------------------------------------------------------------
-- orders.ads
--
-- This package contains the public data type Order and a heat lamp to store
-- finished orders under.
--
-- Types:
--
-- Order An order is simply a pair consisting of a meal and the
-- philosopher who ordered it.
--
-- Objects:
--
-- Heat_Lamp When cooks are finished preparing an order they place it
-- under this heat lamp. A waiter should come by and pick it up
-- and take it to the table. This object is represented as a
-- bounded blocking queue with a capacity of five orders.
------------------------------------------------------------------------------
with Names, Meals, Buffers;
use Names, Meals;
package Orders is
type Order is record
Diner : Philosopher_Name; -- Who ordered it
Food : Meal; -- What they ordered
end record;
-- The order bin and the heat lamp are simply queues of orders, so first
-- instantiate the generic package for blocking queues:
package Order_Buffers is new Buffers (Order, 5);
use Order_Buffers;
-- Now declare the buffer objects:
Heat_Lamp : Buffer;
end Orders;
|
charlie5/lace | Ada | 3,311 | ads | with
physics.remote.Model,
physics.Shape;
package physics.Model
--
-- Provides a model describing physical properties.
--
is
type Heightfield_view is access physics.Heightfield;
type Vector_3_array_view is access physics.Vector_3_array;
type Vector_view is access Vector;
type shape_Kind is (Cylinder, Cone, Cube, a_Sphere, a_Capsule, Heightfield, Hull, Mesh, multi_Sphere, Plane, -- 3D
Circle, Polygon); -- 2D
type a_Shape (Kind : shape_Kind := Cube) is
record
case Kind
is
when Cube | Cylinder =>
half_Extents : Vector_3;
when a_Capsule =>
lower_Radius,
upper_Radius : Real;
Height : Real;
when Heightfield =>
Heights : Heightfield_view;
height_Range : Vector_2;
when a_Sphere =>
sphere_Radius : Real;
when Circle =>
circle_Radius : Real;
when Hull =>
Points : Vector_3_array_view;
when Mesh =>
Model : access Geometry_3D.a_Model;
when multi_Sphere =>
Sites : Vector_3_array_view;
Radii : Vector_view;
when Plane =>
plane_Normal : Vector_3;
plane_Offset : Real;
when Polygon =>
Vertices : Geometry_2d.Sites (1 .. 8);
vertex_Count : Natural := 0;
when others =>
null;
end case;
end record;
type Item is new physics.remote.Model.item with
record
shape_Info : a_Shape;
Shape : physics.Shape.view;
Mass : Real;
Friction : Real;
Restitution : Real; -- Bounce
-- Site : Vector_3;
is_Tangible : Boolean := True;
end record;
type View is access all Item'Class;
----------
--- Forge
--
package Forge
is
function new_physics_Model (Id : in model_Id := null_model_Id;
shape_Info : in a_Shape;
Scale : in Vector_3 := [1.0, 1.0, 1.0];
Mass : in Real := 0.0;
Friction : in Real := 0.1;
Restitution : in Real := 0.1;
-- Site : in Vector_3 := Origin_3d;
is_Tangible : in Boolean := True) return View;
end Forge;
procedure define (Self : in out Item; Scale : in Vector_3);
procedure destroy (Self : in out Item);
procedure free (Self : in out View);
---------------
--- Attributes
--
function Id (Self : in Item'Class) return model_Id;
procedure Id_is (Self : in out Item'Class; Now : in model_Id);
procedure Scale_is (Self : in out Item'Class; Now : in Vector_3);
end physics.Model;
|
io7m/coreland-serial_io | Ada | 1,072 | adb | with Ada.Streams.Stream_IO;
with Serial_IO;
with Test;
procedure T_R32_01 is
package Stream_IO renames Ada.Streams.Stream_IO;
use type Serial_IO.Unsigned_32_t;
Output : Stream_IO.File_Type;
Input : Stream_IO.File_Type;
type R_t is record
A : Serial_IO.Unsigned_32_t;
B : Serial_IO.Unsigned_32_t;
C : Serial_IO.Unsigned_32_t;
D : Serial_IO.Unsigned_32_t;
E : Serial_IO.Unsigned_32_t;
end record;
R : R_t;
S : R_t;
begin
Stream_IO.Create
(Name => "t_r32_01.dat",
Mode => Stream_IO.Out_File,
File => Output);
R.A := 16#ffff_ffff#;
R.B := 16#7fff_ffff#;
R.C := 16#0000_ffff#;
R.D := 16#0000_7fff#;
R.E := 16#0000_0000#;
R_t'Output (Stream_IO.Stream (Output), R);
pragma Warnings (Off);
Stream_IO.Close (Output);
pragma Warnings (On);
Stream_IO.Open
(Name => "t_r32_01.dat",
Mode => Stream_IO.In_File,
File => Input);
S := R_t'Input (Stream_IO.Stream (Input));
Test.Assert (S = R);
pragma Warnings (Off);
Stream_IO.Close (Input);
pragma Warnings (On);
end T_R32_01;
|
reznikmm/matreshka | Ada | 4,597 | 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_Db.Schema_Name_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Db_Schema_Name_Attribute_Node is
begin
return Self : Db_Schema_Name_Attribute_Node do
Matreshka.ODF_Db.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Db_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Db_Schema_Name_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Schema_Name_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Db_URI,
Matreshka.ODF_String_Constants.Schema_Name_Attribute,
Db_Schema_Name_Attribute_Node'Tag);
end Matreshka.ODF_Db.Schema_Name_Attributes;
|
reznikmm/matreshka | Ada | 3,603 | 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.Elements.Generic_Hash;
function AMF.UML.Loop_Nodes.Hash is
new AMF.Elements.Generic_Hash (UML_Loop_Node, UML_Loop_Node_Access);
|
MR-D05/lovelace-api | Ada | 32,562 | ads | pragma Ada_95;
pragma Warnings (Off);
with System;
package ada_main is
gnat_argc : Integer;
gnat_argv : System.Address;
gnat_envp : System.Address;
pragma Import (C, gnat_argc);
pragma Import (C, gnat_argv);
pragma Import (C, gnat_envp);
gnat_exit_status : Integer;
pragma Import (C, gnat_exit_status);
GNAT_Version : constant String :=
"GNAT Version: GPL 2016 (20160515-49)" & ASCII.NUL;
pragma Export (C, GNAT_Version, "__gnat_version");
Ada_Main_Program_Name : constant String := "_ada_single_thread_server" & ASCII.NUL;
pragma Export (C, Ada_Main_Program_Name, "__gnat_ada_main_program_name");
procedure adainit;
pragma Export (C, adainit, "adainit");
procedure adafinal;
pragma Export (C, adafinal, "adafinal");
function main
(argc : Integer;
argv : System.Address;
envp : System.Address)
return Integer;
pragma Export (C, main, "main");
type Version_32 is mod 2 ** 32;
u00001 : constant Version_32 := 16#beea0b01#;
pragma Export (C, u00001, "single_thread_serverB");
u00002 : constant Version_32 := 16#b6df930e#;
pragma Export (C, u00002, "system__standard_libraryB");
u00003 : constant Version_32 := 16#937076cc#;
pragma Export (C, u00003, "system__standard_libraryS");
u00004 : constant Version_32 := 16#3ffc8e18#;
pragma Export (C, u00004, "adaS");
u00005 : constant Version_32 := 16#e7214354#;
pragma Export (C, u00005, "ada__exceptionsB");
u00006 : constant Version_32 := 16#020f9e08#;
pragma Export (C, u00006, "ada__exceptionsS");
u00007 : constant Version_32 := 16#e947e6a9#;
pragma Export (C, u00007, "ada__exceptions__last_chance_handlerB");
u00008 : constant Version_32 := 16#41e5552e#;
pragma Export (C, u00008, "ada__exceptions__last_chance_handlerS");
u00009 : constant Version_32 := 16#6326c08a#;
pragma Export (C, u00009, "systemS");
u00010 : constant Version_32 := 16#5f84b5ab#;
pragma Export (C, u00010, "system__soft_linksB");
u00011 : constant Version_32 := 16#fda218df#;
pragma Export (C, u00011, "system__soft_linksS");
u00012 : constant Version_32 := 16#b01dad17#;
pragma Export (C, u00012, "system__parametersB");
u00013 : constant Version_32 := 16#1d0ccdf5#;
pragma Export (C, u00013, "system__parametersS");
u00014 : constant Version_32 := 16#0f0cb66d#;
pragma Export (C, u00014, "system__secondary_stackB");
u00015 : constant Version_32 := 16#c8470fe3#;
pragma Export (C, u00015, "system__secondary_stackS");
u00016 : constant Version_32 := 16#39a03df9#;
pragma Export (C, u00016, "system__storage_elementsB");
u00017 : constant Version_32 := 16#4ee58a8e#;
pragma Export (C, u00017, "system__storage_elementsS");
u00018 : constant Version_32 := 16#41837d1e#;
pragma Export (C, u00018, "system__stack_checkingB");
u00019 : constant Version_32 := 16#ed99ab62#;
pragma Export (C, u00019, "system__stack_checkingS");
u00020 : constant Version_32 := 16#87a448ff#;
pragma Export (C, u00020, "system__exception_tableB");
u00021 : constant Version_32 := 16#3e88a9c8#;
pragma Export (C, u00021, "system__exception_tableS");
u00022 : constant Version_32 := 16#ce4af020#;
pragma Export (C, u00022, "system__exceptionsB");
u00023 : constant Version_32 := 16#0b45ad7c#;
pragma Export (C, u00023, "system__exceptionsS");
u00024 : constant Version_32 := 16#4c9e814d#;
pragma Export (C, u00024, "system__exceptions__machineS");
u00025 : constant Version_32 := 16#aa0563fc#;
pragma Export (C, u00025, "system__exceptions_debugB");
u00026 : constant Version_32 := 16#1dac394e#;
pragma Export (C, u00026, "system__exceptions_debugS");
u00027 : constant Version_32 := 16#6c2f8802#;
pragma Export (C, u00027, "system__img_intB");
u00028 : constant Version_32 := 16#61fd2048#;
pragma Export (C, u00028, "system__img_intS");
u00029 : constant Version_32 := 16#39df8c17#;
pragma Export (C, u00029, "system__tracebackB");
u00030 : constant Version_32 := 16#3d041e4e#;
pragma Export (C, u00030, "system__tracebackS");
u00031 : constant Version_32 := 16#9ed49525#;
pragma Export (C, u00031, "system__traceback_entriesB");
u00032 : constant Version_32 := 16#637d36fa#;
pragma Export (C, u00032, "system__traceback_entriesS");
u00033 : constant Version_32 := 16#0162f862#;
pragma Export (C, u00033, "system__traceback__symbolicB");
u00034 : constant Version_32 := 16#dd19f67a#;
pragma Export (C, u00034, "system__traceback__symbolicS");
u00035 : constant Version_32 := 16#701f9d88#;
pragma Export (C, u00035, "ada__exceptions__tracebackB");
u00036 : constant Version_32 := 16#20245e75#;
pragma Export (C, u00036, "ada__exceptions__tracebackS");
u00037 : constant Version_32 := 16#5ab55268#;
pragma Export (C, u00037, "interfacesS");
u00038 : constant Version_32 := 16#769e25e6#;
pragma Export (C, u00038, "interfaces__cB");
u00039 : constant Version_32 := 16#70be4e8c#;
pragma Export (C, u00039, "interfaces__cS");
u00040 : constant Version_32 := 16#5f72f755#;
pragma Export (C, u00040, "system__address_operationsB");
u00041 : constant Version_32 := 16#702a7eb9#;
pragma Export (C, u00041, "system__address_operationsS");
u00042 : constant Version_32 := 16#13b71684#;
pragma Export (C, u00042, "system__crtlS");
u00043 : constant Version_32 := 16#f82008fb#;
pragma Export (C, u00043, "system__dwarf_linesB");
u00044 : constant Version_32 := 16#0aa7ccc7#;
pragma Export (C, u00044, "system__dwarf_linesS");
u00045 : constant Version_32 := 16#12c24a43#;
pragma Export (C, u00045, "ada__charactersS");
u00046 : constant Version_32 := 16#8f637df8#;
pragma Export (C, u00046, "ada__characters__handlingB");
u00047 : constant Version_32 := 16#3b3f6154#;
pragma Export (C, u00047, "ada__characters__handlingS");
u00048 : constant Version_32 := 16#4b7bb96a#;
pragma Export (C, u00048, "ada__characters__latin_1S");
u00049 : constant Version_32 := 16#af50e98f#;
pragma Export (C, u00049, "ada__stringsS");
u00050 : constant Version_32 := 16#e2ea8656#;
pragma Export (C, u00050, "ada__strings__mapsB");
u00051 : constant Version_32 := 16#1e526bec#;
pragma Export (C, u00051, "ada__strings__mapsS");
u00052 : constant Version_32 := 16#04ec3c16#;
pragma Export (C, u00052, "system__bit_opsB");
u00053 : constant Version_32 := 16#0765e3a3#;
pragma Export (C, u00053, "system__bit_opsS");
u00054 : constant Version_32 := 16#57a0bc09#;
pragma Export (C, u00054, "system__unsigned_typesS");
u00055 : constant Version_32 := 16#92f05f13#;
pragma Export (C, u00055, "ada__strings__maps__constantsS");
u00056 : constant Version_32 := 16#57a37a42#;
pragma Export (C, u00056, "system__address_imageB");
u00057 : constant Version_32 := 16#c2ca5db0#;
pragma Export (C, u00057, "system__address_imageS");
u00058 : constant Version_32 := 16#ec78c2bf#;
pragma Export (C, u00058, "system__img_unsB");
u00059 : constant Version_32 := 16#c85480fe#;
pragma Export (C, u00059, "system__img_unsS");
u00060 : constant Version_32 := 16#d7aac20c#;
pragma Export (C, u00060, "system__ioB");
u00061 : constant Version_32 := 16#fd6437c5#;
pragma Export (C, u00061, "system__ioS");
u00062 : constant Version_32 := 16#cf909744#;
pragma Export (C, u00062, "system__object_readerB");
u00063 : constant Version_32 := 16#27c18a1d#;
pragma Export (C, u00063, "system__object_readerS");
u00064 : constant Version_32 := 16#1a74a354#;
pragma Export (C, u00064, "system__val_lliB");
u00065 : constant Version_32 := 16#f902262a#;
pragma Export (C, u00065, "system__val_lliS");
u00066 : constant Version_32 := 16#afdbf393#;
pragma Export (C, u00066, "system__val_lluB");
u00067 : constant Version_32 := 16#2d52eb7b#;
pragma Export (C, u00067, "system__val_lluS");
u00068 : constant Version_32 := 16#27b600b2#;
pragma Export (C, u00068, "system__val_utilB");
u00069 : constant Version_32 := 16#cf867674#;
pragma Export (C, u00069, "system__val_utilS");
u00070 : constant Version_32 := 16#d1060688#;
pragma Export (C, u00070, "system__case_utilB");
u00071 : constant Version_32 := 16#472fa95d#;
pragma Export (C, u00071, "system__case_utilS");
u00072 : constant Version_32 := 16#84a27f0d#;
pragma Export (C, u00072, "interfaces__c_streamsB");
u00073 : constant Version_32 := 16#b1330297#;
pragma Export (C, u00073, "interfaces__c_streamsS");
u00074 : constant Version_32 := 16#931ff6be#;
pragma Export (C, u00074, "system__exception_tracesB");
u00075 : constant Version_32 := 16#47f9e010#;
pragma Export (C, u00075, "system__exception_tracesS");
u00076 : constant Version_32 := 16#8c33a517#;
pragma Export (C, u00076, "system__wch_conB");
u00077 : constant Version_32 := 16#785be258#;
pragma Export (C, u00077, "system__wch_conS");
u00078 : constant Version_32 := 16#9721e840#;
pragma Export (C, u00078, "system__wch_stwB");
u00079 : constant Version_32 := 16#554ace59#;
pragma Export (C, u00079, "system__wch_stwS");
u00080 : constant Version_32 := 16#a831679c#;
pragma Export (C, u00080, "system__wch_cnvB");
u00081 : constant Version_32 := 16#77ec58ab#;
pragma Export (C, u00081, "system__wch_cnvS");
u00082 : constant Version_32 := 16#ece6fdb6#;
pragma Export (C, u00082, "system__wch_jisB");
u00083 : constant Version_32 := 16#f79c418a#;
pragma Export (C, u00083, "system__wch_jisS");
u00084 : constant Version_32 := 16#db5c917c#;
pragma Export (C, u00084, "ada__io_exceptionsS");
u00085 : constant Version_32 := 16#10558b11#;
pragma Export (C, u00085, "ada__streamsB");
u00086 : constant Version_32 := 16#2e6701ab#;
pragma Export (C, u00086, "ada__streamsS");
u00087 : constant Version_32 := 16#920eada5#;
pragma Export (C, u00087, "ada__tagsB");
u00088 : constant Version_32 := 16#13ca27f3#;
pragma Export (C, u00088, "ada__tagsS");
u00089 : constant Version_32 := 16#c3335bfd#;
pragma Export (C, u00089, "system__htableB");
u00090 : constant Version_32 := 16#e7e47360#;
pragma Export (C, u00090, "system__htableS");
u00091 : constant Version_32 := 16#089f5cd0#;
pragma Export (C, u00091, "system__string_hashB");
u00092 : constant Version_32 := 16#45ba181e#;
pragma Export (C, u00092, "system__string_hashS");
u00093 : constant Version_32 := 16#96edd2a0#;
pragma Export (C, u00093, "blackS");
u00094 : constant Version_32 := 16#35b260ac#;
pragma Export (C, u00094, "black__requestB");
u00095 : constant Version_32 := 16#111535fb#;
pragma Export (C, u00095, "black__requestS");
u00096 : constant Version_32 := 16#e5480ede#;
pragma Export (C, u00096, "ada__strings__fixedB");
u00097 : constant Version_32 := 16#a86b22b3#;
pragma Export (C, u00097, "ada__strings__fixedS");
u00098 : constant Version_32 := 16#45c9251c#;
pragma Export (C, u00098, "ada__strings__searchB");
u00099 : constant Version_32 := 16#c1ab8667#;
pragma Export (C, u00099, "ada__strings__searchS");
u00100 : constant Version_32 := 16#5eea256b#;
pragma Export (C, u00100, "black__text_ioB");
u00101 : constant Version_32 := 16#7de6382d#;
pragma Export (C, u00101, "black__text_ioS");
u00102 : constant Version_32 := 16#52f1910f#;
pragma Export (C, u00102, "system__assertionsB");
u00103 : constant Version_32 := 16#aeabec1e#;
pragma Export (C, u00103, "system__assertionsS");
u00104 : constant Version_32 := 16#7268f812#;
pragma Export (C, u00104, "system__img_boolB");
u00105 : constant Version_32 := 16#96ffb161#;
pragma Export (C, u00105, "system__img_boolS");
u00106 : constant Version_32 := 16#276453b7#;
pragma Export (C, u00106, "system__img_lldB");
u00107 : constant Version_32 := 16#9004c9e3#;
pragma Export (C, u00107, "system__img_lldS");
u00108 : constant Version_32 := 16#bd3715ff#;
pragma Export (C, u00108, "system__img_decB");
u00109 : constant Version_32 := 16#cd0bc951#;
pragma Export (C, u00109, "system__img_decS");
u00110 : constant Version_32 := 16#9dca6636#;
pragma Export (C, u00110, "system__img_lliB");
u00111 : constant Version_32 := 16#7269955b#;
pragma Export (C, u00111, "system__img_lliS");
u00112 : constant Version_32 := 16#f4e1c091#;
pragma Export (C, u00112, "system__stream_attributesB");
u00113 : constant Version_32 := 16#8bc30a4e#;
pragma Export (C, u00113, "system__stream_attributesS");
u00114 : constant Version_32 := 16#912365e0#;
pragma Export (C, u00114, "system__strings__stream_opsB");
u00115 : constant Version_32 := 16#55d4bd57#;
pragma Export (C, u00115, "system__strings__stream_opsS");
u00116 : constant Version_32 := 16#8e64967b#;
pragma Export (C, u00116, "ada__streams__stream_ioB");
u00117 : constant Version_32 := 16#31fc8e02#;
pragma Export (C, u00117, "ada__streams__stream_ioS");
u00118 : constant Version_32 := 16#5de653db#;
pragma Export (C, u00118, "system__communicationB");
u00119 : constant Version_32 := 16#7a469558#;
pragma Export (C, u00119, "system__communicationS");
u00120 : constant Version_32 := 16#b29d05bd#;
pragma Export (C, u00120, "system__file_ioB");
u00121 : constant Version_32 := 16#c45721ef#;
pragma Export (C, u00121, "system__file_ioS");
u00122 : constant Version_32 := 16#cf417de3#;
pragma Export (C, u00122, "ada__finalizationS");
u00123 : constant Version_32 := 16#95817ed8#;
pragma Export (C, u00123, "system__finalization_rootB");
u00124 : constant Version_32 := 16#2cd4b31a#;
pragma Export (C, u00124, "system__finalization_rootS");
u00125 : constant Version_32 := 16#d3560627#;
pragma Export (C, u00125, "system__os_libB");
u00126 : constant Version_32 := 16#bf5ce13f#;
pragma Export (C, u00126, "system__os_libS");
u00127 : constant Version_32 := 16#1a817b8e#;
pragma Export (C, u00127, "system__stringsB");
u00128 : constant Version_32 := 16#1d99d1ec#;
pragma Export (C, u00128, "system__stringsS");
u00129 : constant Version_32 := 16#9eb95a22#;
pragma Export (C, u00129, "system__file_control_blockS");
u00130 : constant Version_32 := 16#5130abd7#;
pragma Export (C, u00130, "ada__strings__unboundedB");
u00131 : constant Version_32 := 16#4c956ffe#;
pragma Export (C, u00131, "ada__strings__unboundedS");
u00132 : constant Version_32 := 16#5b9edcc4#;
pragma Export (C, u00132, "system__compare_array_unsigned_8B");
u00133 : constant Version_32 := 16#ca25b107#;
pragma Export (C, u00133, "system__compare_array_unsigned_8S");
u00134 : constant Version_32 := 16#6a86c9a5#;
pragma Export (C, u00134, "system__storage_pools__subpoolsB");
u00135 : constant Version_32 := 16#cc5a1856#;
pragma Export (C, u00135, "system__storage_pools__subpoolsS");
u00136 : constant Version_32 := 16#6abe5dbe#;
pragma Export (C, u00136, "system__finalization_mastersB");
u00137 : constant Version_32 := 16#38daf940#;
pragma Export (C, u00137, "system__finalization_mastersS");
u00138 : constant Version_32 := 16#6d4d969a#;
pragma Export (C, u00138, "system__storage_poolsB");
u00139 : constant Version_32 := 16#40cb5e27#;
pragma Export (C, u00139, "system__storage_poolsS");
u00140 : constant Version_32 := 16#9aad1ff1#;
pragma Export (C, u00140, "system__storage_pools__subpools__finalizationB");
u00141 : constant Version_32 := 16#fe2f4b3a#;
pragma Export (C, u00141, "system__storage_pools__subpools__finalizationS");
u00142 : constant Version_32 := 16#020a3f4d#;
pragma Export (C, u00142, "system__atomic_countersB");
u00143 : constant Version_32 := 16#d77aed07#;
pragma Export (C, u00143, "system__atomic_countersS");
u00144 : constant Version_32 := 16#d0432c8d#;
pragma Export (C, u00144, "system__img_enum_newB");
u00145 : constant Version_32 := 16#026ac64a#;
pragma Export (C, u00145, "system__img_enum_newS");
u00146 : constant Version_32 := 16#4b37b589#;
pragma Export (C, u00146, "system__val_enumB");
u00147 : constant Version_32 := 16#d83c821f#;
pragma Export (C, u00147, "system__val_enumS");
u00148 : constant Version_32 := 16#298ec06d#;
pragma Export (C, u00148, "url_utilitiesB");
u00149 : constant Version_32 := 16#744cd0fd#;
pragma Export (C, u00149, "url_utilitiesS");
u00150 : constant Version_32 := 16#3f0ac625#;
pragma Export (C, u00150, "hex_utilitiesB");
u00151 : constant Version_32 := 16#051621f5#;
pragma Export (C, u00151, "hex_utilitiesS");
u00152 : constant Version_32 := 16#f64b89a4#;
pragma Export (C, u00152, "ada__integer_text_ioB");
u00153 : constant Version_32 := 16#f1daf268#;
pragma Export (C, u00153, "ada__integer_text_ioS");
u00154 : constant Version_32 := 16#d5bfa9f3#;
pragma Export (C, u00154, "ada__text_ioB");
u00155 : constant Version_32 := 16#8d734ca7#;
pragma Export (C, u00155, "ada__text_ioS");
u00156 : constant Version_32 := 16#f6fdca1c#;
pragma Export (C, u00156, "ada__text_io__integer_auxB");
u00157 : constant Version_32 := 16#b9793d30#;
pragma Export (C, u00157, "ada__text_io__integer_auxS");
u00158 : constant Version_32 := 16#181dc502#;
pragma Export (C, u00158, "ada__text_io__generic_auxB");
u00159 : constant Version_32 := 16#a6c327d3#;
pragma Export (C, u00159, "ada__text_io__generic_auxS");
u00160 : constant Version_32 := 16#b10ba0c7#;
pragma Export (C, u00160, "system__img_biuB");
u00161 : constant Version_32 := 16#91823444#;
pragma Export (C, u00161, "system__img_biuS");
u00162 : constant Version_32 := 16#4e06ab0c#;
pragma Export (C, u00162, "system__img_llbB");
u00163 : constant Version_32 := 16#d04524ba#;
pragma Export (C, u00163, "system__img_llbS");
u00164 : constant Version_32 := 16#a756d097#;
pragma Export (C, u00164, "system__img_llwB");
u00165 : constant Version_32 := 16#7929072c#;
pragma Export (C, u00165, "system__img_llwS");
u00166 : constant Version_32 := 16#eb55dfbb#;
pragma Export (C, u00166, "system__img_wiuB");
u00167 : constant Version_32 := 16#ffc3b3d6#;
pragma Export (C, u00167, "system__img_wiuS");
u00168 : constant Version_32 := 16#d763507a#;
pragma Export (C, u00168, "system__val_intB");
u00169 : constant Version_32 := 16#2b83eab5#;
pragma Export (C, u00169, "system__val_intS");
u00170 : constant Version_32 := 16#1d9142a4#;
pragma Export (C, u00170, "system__val_unsB");
u00171 : constant Version_32 := 16#47085132#;
pragma Export (C, u00171, "system__val_unsS");
u00172 : constant Version_32 := 16#7af902e7#;
pragma Export (C, u00172, "black__httpB");
u00173 : constant Version_32 := 16#2a9c5f17#;
pragma Export (C, u00173, "black__httpS");
u00174 : constant Version_32 := 16#3b059870#;
pragma Export (C, u00174, "black__mime_typesS");
u00175 : constant Version_32 := 16#d25fcbe0#;
pragma Export (C, u00175, "black__optional_http_methodB");
u00176 : constant Version_32 := 16#2d3ab89b#;
pragma Export (C, u00176, "black__optional_http_methodS");
u00177 : constant Version_32 := 16#223d1c85#;
pragma Export (C, u00177, "black__generic_optionalB");
u00178 : constant Version_32 := 16#4314fecc#;
pragma Export (C, u00178, "black__generic_optionalS");
u00179 : constant Version_32 := 16#b82c289f#;
pragma Export (C, u00179, "black__optional_naturalB");
u00180 : constant Version_32 := 16#fb38d653#;
pragma Export (C, u00180, "black__optional_naturalS");
u00181 : constant Version_32 := 16#ece93279#;
pragma Export (C, u00181, "black__optional_stringB");
u00182 : constant Version_32 := 16#906c1870#;
pragma Export (C, u00182, "black__optional_stringS");
u00183 : constant Version_32 := 16#a1a3150b#;
pragma Export (C, u00183, "black__parameterS");
u00184 : constant Version_32 := 16#1786c53e#;
pragma Export (C, u00184, "black__parameter__vectorsB");
u00185 : constant Version_32 := 16#a869daaa#;
pragma Export (C, u00185, "black__parameter__vectorsS");
u00186 : constant Version_32 := 16#5e196e91#;
pragma Export (C, u00186, "ada__containersS");
u00187 : constant Version_32 := 16#bcec81df#;
pragma Export (C, u00187, "ada__containers__helpersB");
u00188 : constant Version_32 := 16#4adfc5eb#;
pragma Export (C, u00188, "ada__containers__helpersS");
u00189 : constant Version_32 := 16#5a895de2#;
pragma Export (C, u00189, "system__pool_globalB");
u00190 : constant Version_32 := 16#7141203e#;
pragma Export (C, u00190, "system__pool_globalS");
u00191 : constant Version_32 := 16#a6359005#;
pragma Export (C, u00191, "system__memoryB");
u00192 : constant Version_32 := 16#3a5ba6be#;
pragma Export (C, u00192, "system__memoryS");
u00193 : constant Version_32 := 16#124253f8#;
pragma Export (C, u00193, "black__parsingB");
u00194 : constant Version_32 := 16#1e608c18#;
pragma Export (C, u00194, "black__parsingS");
u00195 : constant Version_32 := 16#f89f7823#;
pragma Export (C, u00195, "system__val_boolB");
u00196 : constant Version_32 := 16#99b4ac94#;
pragma Export (C, u00196, "system__val_boolS");
u00197 : constant Version_32 := 16#faa9a7b2#;
pragma Export (C, u00197, "system__val_realB");
u00198 : constant Version_32 := 16#9d0fb79b#;
pragma Export (C, u00198, "system__val_realS");
u00199 : constant Version_32 := 16#6c05c057#;
pragma Export (C, u00199, "system__exn_llfB");
u00200 : constant Version_32 := 16#df587b56#;
pragma Export (C, u00200, "system__exn_llfS");
u00201 : constant Version_32 := 16#1b28662b#;
pragma Export (C, u00201, "system__float_controlB");
u00202 : constant Version_32 := 16#83da83b6#;
pragma Export (C, u00202, "system__float_controlS");
u00203 : constant Version_32 := 16#3356a6fd#;
pragma Export (C, u00203, "system__powten_tableS");
u00204 : constant Version_32 := 16#797888ab#;
pragma Export (C, u00204, "black__responseB");
u00205 : constant Version_32 := 16#0ae74871#;
pragma Export (C, u00205, "black__responseS");
u00206 : constant Version_32 := 16#fd2ad2f1#;
pragma Export (C, u00206, "gnatS");
u00207 : constant Version_32 := 16#077f0b47#;
pragma Export (C, u00207, "gnat__sha1B");
u00208 : constant Version_32 := 16#ffc0a8a4#;
pragma Export (C, u00208, "gnat__sha1S");
u00209 : constant Version_32 := 16#3d380933#;
pragma Export (C, u00209, "gnat__secure_hashesB");
u00210 : constant Version_32 := 16#af7b2199#;
pragma Export (C, u00210, "gnat__secure_hashesS");
u00211 : constant Version_32 := 16#cadfacae#;
pragma Export (C, u00211, "gnat__secure_hashes__sha1B");
u00212 : constant Version_32 := 16#e28d1bf0#;
pragma Export (C, u00212, "gnat__secure_hashes__sha1S");
u00213 : constant Version_32 := 16#45efda4c#;
pragma Export (C, u00213, "gnat__byte_swappingB");
u00214 : constant Version_32 := 16#3ade0442#;
pragma Export (C, u00214, "gnat__byte_swappingS");
u00215 : constant Version_32 := 16#1abab4ca#;
pragma Export (C, u00215, "system__byte_swappingS");
u00216 : constant Version_32 := 16#ccd71d25#;
pragma Export (C, u00216, "gnat__socketsB");
u00217 : constant Version_32 := 16#6c513279#;
pragma Export (C, u00217, "gnat__socketsS");
u00218 : constant Version_32 := 16#163f9ef3#;
pragma Export (C, u00218, "gnat__sockets__linker_optionsS");
u00219 : constant Version_32 := 16#b0810072#;
pragma Export (C, u00219, "gnat__sockets__thinB");
u00220 : constant Version_32 := 16#390cab4a#;
pragma Export (C, u00220, "gnat__sockets__thinS");
u00221 : constant Version_32 := 16#87cd2ab9#;
pragma Export (C, u00221, "ada__calendar__delaysB");
u00222 : constant Version_32 := 16#b27fb9e9#;
pragma Export (C, u00222, "ada__calendar__delaysS");
u00223 : constant Version_32 := 16#c5dcd3d2#;
pragma Export (C, u00223, "ada__calendarB");
u00224 : constant Version_32 := 16#12a38fcc#;
pragma Export (C, u00224, "ada__calendarS");
u00225 : constant Version_32 := 16#d083f760#;
pragma Export (C, u00225, "system__os_primitivesB");
u00226 : constant Version_32 := 16#e9a9d1fc#;
pragma Export (C, u00226, "system__os_primitivesS");
u00227 : constant Version_32 := 16#ee80728a#;
pragma Export (C, u00227, "system__tracesB");
u00228 : constant Version_32 := 16#913ba820#;
pragma Export (C, u00228, "system__tracesS");
u00229 : constant Version_32 := 16#c024395a#;
pragma Export (C, u00229, "gnat__os_libS");
u00230 : constant Version_32 := 16#00e9dcb1#;
pragma Export (C, u00230, "gnat__task_lockS");
u00231 : constant Version_32 := 16#b6166bc6#;
pragma Export (C, u00231, "system__task_lockB");
u00232 : constant Version_32 := 16#02acf7e4#;
pragma Export (C, u00232, "system__task_lockS");
u00233 : constant Version_32 := 16#0a2632e6#;
pragma Export (C, u00233, "gnat__sockets__thin_commonB");
u00234 : constant Version_32 := 16#5de24e36#;
pragma Export (C, u00234, "gnat__sockets__thin_commonS");
u00235 : constant Version_32 := 16#bb956a8c#;
pragma Export (C, u00235, "interfaces__c__stringsB");
u00236 : constant Version_32 := 16#603c1c44#;
pragma Export (C, u00236, "interfaces__c__stringsS");
u00237 : constant Version_32 := 16#27da7a5e#;
pragma Export (C, u00237, "system__pool_sizeB");
u00238 : constant Version_32 := 16#620888d3#;
pragma Export (C, u00238, "system__pool_sizeS");
u00239 : constant Version_32 := 16#7dc03a19#;
pragma Export (C, u00239, "system__os_constantsS");
u00240 : constant Version_32 := 16#46b14d99#;
pragma Export (C, u00240, "gnat__sockets__convenienceB");
u00241 : constant Version_32 := 16#3cb87139#;
pragma Export (C, u00241, "gnat__sockets__convenienceS");
-- BEGIN ELABORATION ORDER
-- ada%s
-- ada.characters%s
-- ada.characters.handling%s
-- ada.characters.latin_1%s
-- gnat%s
-- interfaces%s
-- system%s
-- gnat.byte_swapping%s
-- system.address_operations%s
-- system.address_operations%b
-- system.atomic_counters%s
-- system.atomic_counters%b
-- system.byte_swapping%s
-- gnat.byte_swapping%b
-- system.case_util%s
-- system.case_util%b
-- system.exn_llf%s
-- system.exn_llf%b
-- system.float_control%s
-- system.float_control%b
-- system.htable%s
-- system.img_bool%s
-- system.img_bool%b
-- system.img_dec%s
-- system.img_enum_new%s
-- system.img_enum_new%b
-- system.img_int%s
-- system.img_int%b
-- system.img_dec%b
-- system.img_lld%s
-- system.img_lli%s
-- system.img_lli%b
-- system.img_lld%b
-- system.io%s
-- system.io%b
-- system.os_primitives%s
-- system.os_primitives%b
-- system.parameters%s
-- system.parameters%b
-- system.crtl%s
-- interfaces.c_streams%s
-- interfaces.c_streams%b
-- system.powten_table%s
-- system.standard_library%s
-- system.exceptions_debug%s
-- system.exceptions_debug%b
-- system.storage_elements%s
-- system.storage_elements%b
-- system.stack_checking%s
-- system.stack_checking%b
-- system.string_hash%s
-- system.string_hash%b
-- system.htable%b
-- system.strings%s
-- system.strings%b
-- system.os_lib%s
-- gnat.os_lib%s
-- system.task_lock%s
-- gnat.task_lock%s
-- system.traceback_entries%s
-- system.traceback_entries%b
-- ada.exceptions%s
-- system.soft_links%s
-- system.task_lock%b
-- system.traces%s
-- system.traces%b
-- system.unsigned_types%s
-- system.img_biu%s
-- system.img_biu%b
-- system.img_llb%s
-- system.img_llb%b
-- system.img_llw%s
-- system.img_llw%b
-- system.img_uns%s
-- system.img_uns%b
-- system.img_wiu%s
-- system.img_wiu%b
-- system.val_bool%s
-- system.val_enum%s
-- system.val_int%s
-- system.val_lli%s
-- system.val_llu%s
-- system.val_real%s
-- system.val_uns%s
-- system.val_util%s
-- system.val_util%b
-- system.val_uns%b
-- system.val_real%b
-- system.val_llu%b
-- system.val_lli%b
-- system.val_int%b
-- system.val_enum%b
-- system.val_bool%b
-- system.wch_con%s
-- system.wch_con%b
-- system.wch_cnv%s
-- system.wch_jis%s
-- system.wch_jis%b
-- system.wch_cnv%b
-- system.wch_stw%s
-- system.wch_stw%b
-- ada.exceptions.last_chance_handler%s
-- ada.exceptions.last_chance_handler%b
-- ada.exceptions.traceback%s
-- system.address_image%s
-- system.bit_ops%s
-- system.bit_ops%b
-- system.compare_array_unsigned_8%s
-- system.compare_array_unsigned_8%b
-- system.exception_table%s
-- system.exception_table%b
-- ada.containers%s
-- ada.io_exceptions%s
-- ada.strings%s
-- ada.strings.maps%s
-- ada.strings.fixed%s
-- ada.strings.maps.constants%s
-- ada.strings.search%s
-- ada.strings.search%b
-- ada.tags%s
-- ada.streams%s
-- ada.streams%b
-- interfaces.c%s
-- interfaces.c.strings%s
-- system.communication%s
-- system.communication%b
-- system.exceptions%s
-- system.exceptions%b
-- system.exceptions.machine%s
-- system.file_control_block%s
-- ada.streams.stream_io%s
-- system.file_io%s
-- ada.streams.stream_io%b
-- system.finalization_root%s
-- system.finalization_root%b
-- ada.finalization%s
-- ada.containers.helpers%s
-- ada.containers.helpers%b
-- system.os_constants%s
-- system.storage_pools%s
-- system.storage_pools%b
-- system.finalization_masters%s
-- system.storage_pools.subpools%s
-- system.storage_pools.subpools.finalization%s
-- system.storage_pools.subpools.finalization%b
-- system.stream_attributes%s
-- system.stream_attributes%b
-- ada.calendar%s
-- ada.calendar%b
-- ada.calendar.delays%s
-- ada.calendar.delays%b
-- gnat.secure_hashes%s
-- gnat.secure_hashes%b
-- gnat.secure_hashes.sha1%s
-- gnat.secure_hashes.sha1%b
-- gnat.sha1%s
-- gnat.sha1%b
-- system.assertions%s
-- system.assertions%b
-- system.exception_traces%s
-- system.exception_traces%b
-- system.memory%s
-- system.memory%b
-- system.standard_library%b
-- system.object_reader%s
-- system.dwarf_lines%s
-- system.pool_global%s
-- system.pool_global%b
-- gnat.sockets%s
-- gnat.sockets.convenience%s
-- gnat.sockets.linker_options%s
-- system.pool_size%s
-- system.pool_size%b
-- system.secondary_stack%s
-- system.storage_pools.subpools%b
-- system.finalization_masters%b
-- system.file_io%b
-- interfaces.c.strings%b
-- interfaces.c%b
-- ada.tags%b
-- ada.strings.fixed%b
-- ada.strings.maps%b
-- system.soft_links%b
-- system.os_lib%b
-- ada.characters.handling%b
-- system.secondary_stack%b
-- gnat.sockets.convenience%b
-- system.dwarf_lines%b
-- system.object_reader%b
-- system.address_image%b
-- ada.exceptions.traceback%b
-- ada.strings.unbounded%s
-- ada.strings.unbounded%b
-- gnat.sockets.thin_common%s
-- gnat.sockets.thin_common%b
-- gnat.sockets.thin%s
-- gnat.sockets.thin%b
-- gnat.sockets%b
-- system.strings.stream_ops%s
-- system.strings.stream_ops%b
-- system.traceback%s
-- system.traceback%b
-- system.traceback.symbolic%s
-- system.traceback.symbolic%b
-- ada.exceptions%b
-- ada.text_io%s
-- ada.text_io%b
-- ada.text_io.generic_aux%s
-- ada.text_io.generic_aux%b
-- ada.text_io.integer_aux%s
-- ada.text_io.integer_aux%b
-- ada.integer_text_io%s
-- ada.integer_text_io%b
-- black%s
-- black.http%s
-- black.http%b
-- black.generic_optional%s
-- black.generic_optional%b
-- black.mime_types%s
-- black.optional_http_method%s
-- black.optional_http_method%b
-- black.optional_natural%s
-- black.optional_natural%b
-- black.optional_string%s
-- black.optional_string%b
-- black.parameter%s
-- black.parameter.vectors%s
-- black.parameter.vectors%b
-- black.parsing%s
-- black.request%s
-- black.response%s
-- single_thread_server%b
-- black.text_io%s
-- black.text_io%b
-- black.response%b
-- black.parsing%b
-- hex_utilities%s
-- hex_utilities%b
-- url_utilities%s
-- url_utilities%b
-- black.request%b
-- END ELABORATION ORDER
end ada_main;
|
PThierry/ewok-kernel | Ada | 2,803 | adb | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
package body rings is
procedure init
(r : out ring)
is
begin
r.top := ring_range'first;
r.bottom := ring_range'first;
r.state := EMPTY;
end init;
procedure write
(r : out ring;
item : in object;
success : out boolean)
is
begin
if r.state = FULL then
success := false;
return;
end if;
-- write
r.buf(r.top) := item;
-- increment top
if r.top = r.buf'last then
r.top := r.buf'first;
else
r.top := r.top + 1;
end if;
-- adjust state
if r.top = r.bottom then
r.state := FULL;
else
r.state := USED;
end if;
success := true;
end write;
procedure read
(r : in out ring;
item : out object;
success : out boolean)
is
begin
-- read data only if buffer is not empty
if r.state = EMPTY then
success := false;
return;
end if;
-- read
item := r.buf(r.bottom);
-- incrementing bottom
if r.bottom = r.buf'last then
r.bottom := r.buf'first;
else
r.bottom := r.bottom + 1;
end if;
-- adjust state
if r.bottom = r.top then
r.state := EMPTY;
else
r.state := USED;
end if;
success := true;
end read;
procedure unwrite
(r : out ring;
success : out boolean)
is
begin
if r.state = EMPTY then
success := false;
return;
end if;
-- decrementing top counter
if r.top = r.buf'first then
r.top := r.buf'last;
else
r.top := r.top - 1;
end if;
-- adjust state
if r.bottom = r.top then
r.state := EMPTY;
else
r.state := USED;
end if;
success := true;
end unwrite;
function state
(r : in ring)
return ring_state
is
begin
return r.state;
end state;
end rings;
|
osannolik/Ada_Drivers_Library | Ada | 9,836 | ads | -- This spec has been automatically generated from STM32F446x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.SPDIF_RX is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CR_SPDIFEN_Field is HAL.UInt2;
subtype CR_DRFMT_Field is HAL.UInt2;
subtype CR_NBTR_Field is HAL.UInt2;
subtype CR_INSEL_Field is HAL.UInt3;
-- Control register
type CR_Register is record
-- Peripheral Block Enable
SPDIFEN : CR_SPDIFEN_Field := 16#0#;
-- Receiver DMA ENable for data flow
RXDMAEN : Boolean := False;
-- STerEO Mode
RXSTEO : Boolean := False;
-- RX Data format
DRFMT : CR_DRFMT_Field := 16#0#;
-- Mask Parity error bit
PMSK : Boolean := False;
-- Mask of Validity bit
VMSK : Boolean := False;
-- Mask of channel status and user bits
CUMSK : Boolean := False;
-- Mask of Preamble Type bits
PTMSK : Boolean := False;
-- Control Buffer DMA ENable for control flow
CBDMAEN : Boolean := False;
-- Channel Selection
CHSEL : Boolean := False;
-- Maximum allowed re-tries during synchronization phase
NBTR : CR_NBTR_Field := 16#0#;
-- Wait For Activity
WFA : Boolean := False;
-- unspecified
Reserved_15_15 : HAL.Bit := 16#0#;
-- input selection
INSEL : CR_INSEL_Field := 16#0#;
-- unspecified
Reserved_19_31 : HAL.UInt13 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
SPDIFEN at 0 range 0 .. 1;
RXDMAEN at 0 range 2 .. 2;
RXSTEO at 0 range 3 .. 3;
DRFMT at 0 range 4 .. 5;
PMSK at 0 range 6 .. 6;
VMSK at 0 range 7 .. 7;
CUMSK at 0 range 8 .. 8;
PTMSK at 0 range 9 .. 9;
CBDMAEN at 0 range 10 .. 10;
CHSEL at 0 range 11 .. 11;
NBTR at 0 range 12 .. 13;
WFA at 0 range 14 .. 14;
Reserved_15_15 at 0 range 15 .. 15;
INSEL at 0 range 16 .. 18;
Reserved_19_31 at 0 range 19 .. 31;
end record;
-- Interrupt mask register
type IMR_Register is record
-- RXNE interrupt enable
RXNEIE : Boolean := False;
-- Control Buffer Ready Interrupt Enable
CSRNEIE : Boolean := False;
-- Parity error interrupt enable
PERRIE : Boolean := False;
-- Overrun error Interrupt Enable
OVRIE : Boolean := False;
-- Synchronization Block Detected Interrupt Enable
SBLKIE : Boolean := False;
-- Synchronization Done
SYNCDIE : Boolean := False;
-- Serial Interface Error Interrupt Enable
IFEIE : Boolean := False;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for IMR_Register use record
RXNEIE at 0 range 0 .. 0;
CSRNEIE at 0 range 1 .. 1;
PERRIE at 0 range 2 .. 2;
OVRIE at 0 range 3 .. 3;
SBLKIE at 0 range 4 .. 4;
SYNCDIE at 0 range 5 .. 5;
IFEIE at 0 range 6 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
subtype SR_WIDTH5_Field is HAL.UInt15;
-- Status register
type SR_Register is record
-- Read-only. Read data register not empty
RXNE : Boolean;
-- Read-only. Control Buffer register is not empty
CSRNE : Boolean;
-- Read-only. Parity error
PERR : Boolean;
-- Read-only. Overrun error
OVR : Boolean;
-- Read-only. Synchronization Block Detected
SBD : Boolean;
-- Read-only. Synchronization Done
SYNCD : Boolean;
-- Read-only. Framing error
FERR : Boolean;
-- Read-only. Synchronization error
SERR : Boolean;
-- Read-only. Time-out error
TERR : Boolean;
-- unspecified
Reserved_9_15 : HAL.UInt7;
-- Read-only. Duration of 5 symbols counted with SPDIF_CLK
WIDTH5 : SR_WIDTH5_Field;
-- unspecified
Reserved_31_31 : HAL.Bit;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
RXNE at 0 range 0 .. 0;
CSRNE at 0 range 1 .. 1;
PERR at 0 range 2 .. 2;
OVR at 0 range 3 .. 3;
SBD at 0 range 4 .. 4;
SYNCD at 0 range 5 .. 5;
FERR at 0 range 6 .. 6;
SERR at 0 range 7 .. 7;
TERR at 0 range 8 .. 8;
Reserved_9_15 at 0 range 9 .. 15;
WIDTH5 at 0 range 16 .. 30;
Reserved_31_31 at 0 range 31 .. 31;
end record;
-- Interrupt Flag Clear register
type IFCR_Register is record
-- unspecified
Reserved_0_1 : HAL.UInt2 := 16#0#;
-- Write-only. Clears the Parity error flag
PERRCF : Boolean := False;
-- Write-only. Clears the Overrun error flag
OVRCF : Boolean := False;
-- Write-only. Clears the Synchronization Block Detected flag
SBDCF : Boolean := False;
-- Write-only. Clears the Synchronization Done flag
SYNCDCF : Boolean := False;
-- unspecified
Reserved_6_31 : HAL.UInt26 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for IFCR_Register use record
Reserved_0_1 at 0 range 0 .. 1;
PERRCF at 0 range 2 .. 2;
OVRCF at 0 range 3 .. 3;
SBDCF at 0 range 4 .. 4;
SYNCDCF at 0 range 5 .. 5;
Reserved_6_31 at 0 range 6 .. 31;
end record;
subtype DR_DR_Field is HAL.UInt24;
subtype DR_PT_Field is HAL.UInt2;
-- Data input register
type DR_Register is record
-- Read-only. Parity Error bit
DR : DR_DR_Field;
-- Read-only. Parity Error bit
PE : Boolean;
-- Read-only. Validity bit
V : Boolean;
-- Read-only. User bit
U : Boolean;
-- Read-only. Channel Status bit
C : Boolean;
-- Read-only. Preamble Type
PT : DR_PT_Field;
-- unspecified
Reserved_30_31 : HAL.UInt2;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR_Register use record
DR at 0 range 0 .. 23;
PE at 0 range 24 .. 24;
V at 0 range 25 .. 25;
U at 0 range 26 .. 26;
C at 0 range 27 .. 27;
PT at 0 range 28 .. 29;
Reserved_30_31 at 0 range 30 .. 31;
end record;
subtype CSR_USR_Field is HAL.UInt16;
subtype CSR_CS_Field is HAL.UInt8;
-- Channel Status register
type CSR_Register is record
-- Read-only. User data information
USR : CSR_USR_Field;
-- Read-only. Channel A status information
CS : CSR_CS_Field;
-- Read-only. Start Of Block
SOB : Boolean;
-- unspecified
Reserved_25_31 : HAL.UInt7;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CSR_Register use record
USR at 0 range 0 .. 15;
CS at 0 range 16 .. 23;
SOB at 0 range 24 .. 24;
Reserved_25_31 at 0 range 25 .. 31;
end record;
subtype DIR_THI_Field is HAL.UInt13;
subtype DIR_TLO_Field is HAL.UInt13;
-- Debug Information register
type DIR_Register is record
-- Read-only. Threshold HIGH
THI : DIR_THI_Field;
-- unspecified
Reserved_13_15 : HAL.UInt3;
-- Read-only. Threshold LOW
TLO : DIR_TLO_Field;
-- unspecified
Reserved_29_31 : HAL.UInt3;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DIR_Register use record
THI at 0 range 0 .. 12;
Reserved_13_15 at 0 range 13 .. 15;
TLO at 0 range 16 .. 28;
Reserved_29_31 at 0 range 29 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Receiver Interface
type SPDIF_RX_Peripheral is record
-- Control register
CR : aliased CR_Register;
-- Interrupt mask register
IMR : aliased IMR_Register;
-- Status register
SR : aliased SR_Register;
-- Interrupt Flag Clear register
IFCR : aliased IFCR_Register;
-- Data input register
DR : aliased DR_Register;
-- Channel Status register
CSR : aliased CSR_Register;
-- Debug Information register
DIR : aliased DIR_Register;
end record
with Volatile;
for SPDIF_RX_Peripheral use record
CR at 16#0# range 0 .. 31;
IMR at 16#4# range 0 .. 31;
SR at 16#8# range 0 .. 31;
IFCR at 16#C# range 0 .. 31;
DR at 16#10# range 0 .. 31;
CSR at 16#14# range 0 .. 31;
DIR at 16#18# range 0 .. 31;
end record;
-- Receiver Interface
SPDIF_RX_Periph : aliased SPDIF_RX_Peripheral
with Import, Address => System'To_Address (16#40004000#);
end STM32_SVD.SPDIF_RX;
|
docandrew/troodon | Ada | 2,223 | adb | with GID.Buffering;
package body GID.Color_tables is
procedure Convert(c, d: in U8; rgb: out RGB_color) is
begin
rgb.red := (d and 127) / 4;
rgb.green:= (d and 3) * 8 + c / 32;
rgb.blue := c and 31;
--
rgb.red := U8((U16(rgb.red ) * 255) / 31);
rgb.green:= U8((U16(rgb.green) * 255) / 31);
rgb.blue := U8((U16(rgb.blue ) * 255) / 31);
end Convert;
procedure Load_palette (image: in out Image_descriptor) is
c, d: U8;
use GID.Buffering;
begin
if image.palette = null then
return;
end if;
declare
palette: Color_table renames image.palette.all;
begin
for i in palette'Range loop
case image.format is
when BMP =>
-- order is BGRx
U8'Read(image.stream, palette(i).blue);
U8'Read(image.stream, palette(i).green);
U8'Read(image.stream, palette(i).red);
U8'Read(image.stream, c);
-- x discarded
when GIF | PNG =>
-- buffered; order is RGB
Get_Byte(image.buffer, palette(i).red);
Get_Byte(image.buffer, palette(i).green);
Get_Byte(image.buffer, palette(i).blue);
when TGA =>
case image.subformat_id is -- = palette's bit depth
when 8 => -- Grey
U8'Read(image.stream, c);
palette(i).red := c;
palette(i).green:= c;
palette(i).blue := c;
when 15 | 16 => -- RGB, 5 bit per channel
U8'Read(image.stream, c);
U8'Read(image.stream, d);
Convert(c, d, palette(i));
when 24 | 32 => -- RGB | RGBA, 8 bit per channel
U8'Read(image.stream, palette(i).blue);
U8'Read(image.stream, palette(i).green);
U8'Read(image.stream, palette(i).red);
when others =>
null;
end case;
when others =>
raise unsupported_image_subformat with
"Palette loading not implemented for " &
Image_format_type'Image(image.format);
end case;
end loop;
end;
end Load_palette;
end GID.Color_tables;
|
stcarrez/ada-css | Ada | 1,521 | adb | -----------------------------------------------------------------------
-- CSS testsuite - Ada CSS Test suite
-- Copyright (C) 2017 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with CSS.Core.Tests;
with CSS.Core.Properties.Tests;
with CSS.Comments.Tests;
with CSS.Parser.Tests;
with CSS.Printer.Tests;
with CSS.Analysis.Rules.Tests;
package body CSS.Testsuite is
Tests : aliased Util.Tests.Test_Suite;
function Suite return Util.Tests.Access_Test_Suite is
Ret : constant Util.Tests.Access_Test_Suite := Tests'Access;
begin
CSS.Comments.Tests.Add_Tests (Ret);
CSS.Core.Tests.Add_Tests (Ret);
CSS.Core.Properties.Tests.Add_Tests (Ret);
CSS.Parser.Tests.Add_Tests (Ret);
CSS.Printer.Tests.Add_Tests (Ret);
CSS.Analysis.Rules.Tests.Add_Tests (Ret);
return Ret;
end Suite;
end CSS.Testsuite;
|
reznikmm/matreshka | Ada | 10,001 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2015, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
pragma Restrictions (No_Elaboration_Code);
-- GNAT: enforce generation of preinitialized data section instead of
-- generation of elaboration code.
package Matreshka.Internals.Unicode.Ucd.Core_0112 is
pragma Preelaborate;
Group_0112 : aliased constant Core_Second_Stage
:= (16#00# .. 16#11# => -- 011200 .. 011211
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#13# .. 16#2B# => -- 011213 .. 01122B
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#2C# .. 16#2E# => -- 01122C .. 01122E
(Spacing_Mark, Neutral,
Spacing_Mark, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#2F# .. 16#31# => -- 01122F .. 011231
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#32# .. 16#33# => -- 011232 .. 011233
(Spacing_Mark, Neutral,
Spacing_Mark, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#34# => -- 011234
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#35# => -- 011235
(Spacing_Mark, Neutral,
Spacing_Mark, Extend, Extend, Combining_Mark,
(Diacritic
| Grapheme_Base
| Grapheme_Link
| ID_Continue
| XID_Continue => True,
others => False)),
16#36# => -- 011236
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#37# => -- 011237
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#38# .. 16#39# => -- 011238 .. 011239
(Other_Punctuation, Neutral,
Other, Other, S_Term, Break_After,
(STerm
| Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#3A# => -- 01123A
(Other_Punctuation, Neutral,
Other, Other, Other, Alphabetic,
(Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#3B# .. 16#3C# => -- 01123B .. 01123C
(Other_Punctuation, Neutral,
Other, Other, S_Term, Break_After,
(STerm
| Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#3D# => -- 01123D
(Other_Punctuation, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#B0# .. 16#DE# => -- 0112B0 .. 0112DE
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#DF# => -- 0112DF
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#E0# .. 16#E2# => -- 0112E0 .. 0112E2
(Spacing_Mark, Neutral,
Spacing_Mark, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#E3# .. 16#E8# => -- 0112E3 .. 0112E8
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#E9# => -- 0112E9
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#EA# => -- 0112EA
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| Grapheme_Link
| ID_Continue
| XID_Continue => True,
others => False)),
16#F0# .. 16#F9# => -- 0112F0 .. 0112F9
(Decimal_Number, Neutral,
Other, Numeric, Numeric, Numeric,
(Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
others =>
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)));
end Matreshka.Internals.Unicode.Ucd.Core_0112;
|
zhmu/ananas | Ada | 20,032 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- A S P E C T S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2010-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Atree; use Atree;
with Einfo; use Einfo;
with Einfo.Entities; use Einfo.Entities;
with Einfo.Utils; use Einfo.Utils;
with Nlists; use Nlists;
with Sinfo; use Sinfo;
with Sinfo.Nodes; use Sinfo.Nodes;
with Sinfo.Utils; use Sinfo.Utils;
with GNAT.HTable;
package body Aspects is
-- The following array indicates aspects that a subtype inherits from its
-- base type. True means that the subtype inherits the aspect from its base
-- type. False means it is not inherited.
Base_Aspect : constant array (Aspect_Id) of Boolean :=
(Aspect_Atomic => True,
Aspect_Atomic_Components => True,
Aspect_Constant_Indexing => True,
Aspect_Default_Iterator => True,
Aspect_Discard_Names => True,
Aspect_Independent_Components => True,
Aspect_Iterator_Element => True,
Aspect_Stable_Properties => True,
Aspect_Type_Invariant => True,
Aspect_Unchecked_Union => True,
Aspect_Variable_Indexing => True,
Aspect_Volatile => True,
Aspect_Volatile_Full_Access => True,
others => False);
-- The following array indicates type aspects that are inherited and apply
-- to the class-wide type as well.
Inherited_Aspect : constant array (Aspect_Id) of Boolean :=
(Aspect_Constant_Indexing => True,
Aspect_Default_Iterator => True,
Aspect_Implicit_Dereference => True,
Aspect_Iterator_Element => True,
Aspect_Remote_Types => True,
Aspect_Variable_Indexing => True,
others => False);
------------------------------------------
-- Hash Table for Aspect Specifications --
------------------------------------------
type AS_Hash_Range is range 0 .. 510;
-- Size of hash table headers
function AS_Hash (F : Node_Id) return AS_Hash_Range;
-- Hash function for hash table
function AS_Hash (F : Node_Id) return AS_Hash_Range is
begin
return AS_Hash_Range (F mod 511);
end AS_Hash;
package Aspect_Specifications_Hash_Table is new
GNAT.HTable.Simple_HTable
(Header_Num => AS_Hash_Range,
Element => List_Id,
No_Element => No_List,
Key => Node_Id,
Hash => AS_Hash,
Equal => "=");
-------------------------------------
-- Hash Table for Aspect Id Values --
-------------------------------------
type AI_Hash_Range is range 0 .. 112;
-- Size of hash table headers
function AI_Hash (F : Name_Id) return AI_Hash_Range;
-- Hash function for hash table
function AI_Hash (F : Name_Id) return AI_Hash_Range is
begin
return AI_Hash_Range (F mod 113);
end AI_Hash;
package Aspect_Id_Hash_Table is new
GNAT.HTable.Simple_HTable
(Header_Num => AI_Hash_Range,
Element => Aspect_Id,
No_Element => No_Aspect,
Key => Name_Id,
Hash => AI_Hash,
Equal => "=");
---------------------------
-- Aspect_Specifications --
---------------------------
function Aspect_Specifications (N : Node_Id) return List_Id is
begin
if Has_Aspects (N) then
return Aspect_Specifications_Hash_Table.Get (N);
else
return No_List;
end if;
end Aspect_Specifications;
--------------------------------
-- Aspects_On_Body_Or_Stub_OK --
--------------------------------
function Aspects_On_Body_Or_Stub_OK (N : Node_Id) return Boolean is
Aspect : Node_Id;
Aspects : List_Id;
begin
-- The routine should be invoked on a body [stub] with aspects
pragma Assert (Has_Aspects (N));
pragma Assert
(Nkind (N) in N_Body_Stub | N_Entry_Body | N_Package_Body |
N_Protected_Body | N_Subprogram_Body | N_Task_Body);
-- Look through all aspects and see whether they can be applied to a
-- body [stub].
Aspects := Aspect_Specifications (N);
Aspect := First (Aspects);
while Present (Aspect) loop
if not Aspect_On_Body_Or_Stub_OK (Get_Aspect_Id (Aspect)) then
return False;
end if;
Next (Aspect);
end loop;
return True;
end Aspects_On_Body_Or_Stub_OK;
----------------------
-- Exchange_Aspects --
----------------------
procedure Exchange_Aspects (N1 : Node_Id; N2 : Node_Id) is
begin
pragma Assert
(Permits_Aspect_Specifications (N1)
and then Permits_Aspect_Specifications (N2));
-- Perform the exchange only when both nodes have lists to be swapped
if Has_Aspects (N1) and then Has_Aspects (N2) then
declare
L1 : constant List_Id := Aspect_Specifications (N1);
L2 : constant List_Id := Aspect_Specifications (N2);
begin
Set_Parent (L1, N2);
Set_Parent (L2, N1);
Aspect_Specifications_Hash_Table.Set (N1, L2);
Aspect_Specifications_Hash_Table.Set (N2, L1);
end;
end if;
end Exchange_Aspects;
-----------------
-- Find_Aspect --
-----------------
function Find_Aspect
(Id : Entity_Id;
A : Aspect_Id;
Class_Present : Boolean := False) return Node_Id
is
Decl : Node_Id;
Item : Node_Id;
Owner : Entity_Id;
Spec : Node_Id;
begin
Owner := Id;
-- Handle various cases of base or inherited aspects for types
if Is_Type (Id) then
if Base_Aspect (A) then
Owner := Base_Type (Owner);
end if;
if Is_Class_Wide_Type (Owner) and then Inherited_Aspect (A) then
Owner := Root_Type (Owner);
end if;
if Is_Private_Type (Owner)
and then Present (Full_View (Owner))
and then not Operational_Aspect (A)
then
Owner := Full_View (Owner);
end if;
end if;
-- Search the representation items for the desired aspect
Item := First_Rep_Item (Owner);
while Present (Item) loop
if Nkind (Item) = N_Aspect_Specification
and then Get_Aspect_Id (Item) = A
and then Class_Present = Sinfo.Nodes.Class_Present (Item)
then
return Item;
end if;
Next_Rep_Item (Item);
end loop;
-- Note that not all aspects are added to the chain of representation
-- items. In such cases, search the list of aspect specifications. First
-- find the declaration node where the aspects reside. This is usually
-- the parent or the parent of the parent.
if No (Parent (Owner)) then
return Empty;
end if;
Decl := Parent (Owner);
if not Permits_Aspect_Specifications (Decl) then
Decl := Parent (Decl);
end if;
-- Search the list of aspect specifications for the desired aspect
if Permits_Aspect_Specifications (Decl) then
Spec := First (Aspect_Specifications (Decl));
while Present (Spec) loop
if Get_Aspect_Id (Spec) = A
and then Class_Present = Sinfo.Nodes.Class_Present (Spec)
then
return Spec;
end if;
Next (Spec);
end loop;
end if;
-- The entity does not carry any aspects or the desired aspect was not
-- found.
return Empty;
end Find_Aspect;
--------------------------
-- Find_Value_Of_Aspect --
--------------------------
function Find_Value_Of_Aspect
(Id : Entity_Id;
A : Aspect_Id;
Class_Present : Boolean := False) return Node_Id
is
Spec : constant Node_Id := Find_Aspect (Id, A,
Class_Present => Class_Present);
begin
if Present (Spec) then
if A = Aspect_Default_Iterator then
return Expression (Aspect_Rep_Item (Spec));
else
return Expression (Spec);
end if;
end if;
return Empty;
end Find_Value_Of_Aspect;
-------------------
-- Get_Aspect_Id --
-------------------
function Get_Aspect_Id (Name : Name_Id) return Aspect_Id is
begin
return Aspect_Id_Hash_Table.Get (Name);
end Get_Aspect_Id;
function Get_Aspect_Id (Aspect : Node_Id) return Aspect_Id is
begin
pragma Assert (Nkind (Aspect) = N_Aspect_Specification);
return Aspect_Id_Hash_Table.Get (Chars (Identifier (Aspect)));
end Get_Aspect_Id;
----------------
-- Has_Aspect --
----------------
function Has_Aspect
(Id : Entity_Id;
A : Aspect_Id;
Class_Present : Boolean := False) return Boolean
is
begin
return Present (Find_Aspect (Id, A, Class_Present => Class_Present));
end Has_Aspect;
------------------
-- Is_Aspect_Id --
------------------
function Is_Aspect_Id (Aspect : Name_Id) return Boolean is
(Get_Aspect_Id (Aspect) /= No_Aspect);
function Is_Aspect_Id (Aspect : Node_Id) return Boolean is
(Get_Aspect_Id (Aspect) /= No_Aspect);
------------------
-- Move_Aspects --
------------------
procedure Move_Aspects (From : Node_Id; To : Node_Id) is
pragma Assert (not Has_Aspects (To));
begin
if Has_Aspects (From) then
Set_Aspect_Specifications (To, Aspect_Specifications (From));
Aspect_Specifications_Hash_Table.Remove (From);
Set_Has_Aspects (From, False);
end if;
end Move_Aspects;
---------------------------
-- Move_Or_Merge_Aspects --
---------------------------
procedure Move_Or_Merge_Aspects (From : Node_Id; To : Node_Id) is
procedure Relocate_Aspect (Asp : Node_Id);
-- Move aspect specification Asp to the aspect specifications of node To
---------------------
-- Relocate_Aspect --
---------------------
procedure Relocate_Aspect (Asp : Node_Id) is
Asps : List_Id;
begin
if Has_Aspects (To) then
Asps := Aspect_Specifications (To);
-- Create a new aspect specification list for node To
else
Asps := New_List;
Set_Aspect_Specifications (To, Asps);
Set_Has_Aspects (To);
end if;
-- Remove the aspect from its original owner and relocate it to node
-- To.
Remove (Asp);
Append (Asp, Asps);
end Relocate_Aspect;
-- Local variables
Asp : Node_Id;
Asp_Id : Aspect_Id;
Next_Asp : Node_Id;
-- Start of processing for Move_Or_Merge_Aspects
begin
if Has_Aspects (From) then
Asp := First (Aspect_Specifications (From));
while Present (Asp) loop
-- Store the next aspect now as a potential relocation will alter
-- the contents of the list.
Next_Asp := Next (Asp);
-- When moving or merging aspects from a subprogram body stub that
-- also acts as a spec, relocate only those aspects that may apply
-- to a body [stub]. Note that a precondition must also be moved
-- to the proper body as the pre/post machinery expects it to be
-- there.
if Nkind (From) = N_Subprogram_Body_Stub
and then No (Corresponding_Spec_Of_Stub (From))
then
Asp_Id := Get_Aspect_Id (Asp);
if Aspect_On_Body_Or_Stub_OK (Asp_Id)
or else Asp_Id = Aspect_Pre
or else Asp_Id = Aspect_Precondition
then
Relocate_Aspect (Asp);
end if;
-- When moving or merging aspects from a single concurrent type
-- declaration, relocate only those aspects that may apply to the
-- anonymous object created for the type.
-- Note: It is better to use Is_Single_Concurrent_Type_Declaration
-- here, but Aspects and Sem_Util have incompatible licenses.
elsif Nkind (Original_Node (From)) in
N_Single_Protected_Declaration | N_Single_Task_Declaration
then
Asp_Id := Get_Aspect_Id (Asp);
if Aspect_On_Anonymous_Object_OK (Asp_Id) then
Relocate_Aspect (Asp);
end if;
-- Default case - relocate the aspect to its new owner
else
Relocate_Aspect (Asp);
end if;
Asp := Next_Asp;
end loop;
-- The relocations may have left node From's aspect specifications
-- list empty. If this is the case, simply remove the aspects.
if Is_Empty_List (Aspect_Specifications (From)) then
Remove_Aspects (From);
end if;
end if;
end Move_Or_Merge_Aspects;
-----------------------------------
-- Permits_Aspect_Specifications --
-----------------------------------
Has_Aspect_Specifications_Flag : constant array (Node_Kind) of Boolean :=
(N_Abstract_Subprogram_Declaration => True,
N_Component_Declaration => True,
N_Entry_Body => True,
N_Entry_Declaration => True,
N_Exception_Declaration => True,
N_Exception_Renaming_Declaration => True,
N_Expression_Function => True,
N_Formal_Abstract_Subprogram_Declaration => True,
N_Formal_Concrete_Subprogram_Declaration => True,
N_Formal_Object_Declaration => True,
N_Formal_Package_Declaration => True,
N_Formal_Type_Declaration => True,
N_Full_Type_Declaration => True,
N_Function_Instantiation => True,
N_Generic_Package_Declaration => True,
N_Generic_Renaming_Declaration => True,
N_Generic_Subprogram_Declaration => True,
N_Object_Declaration => True,
N_Object_Renaming_Declaration => True,
N_Package_Body => True,
N_Package_Body_Stub => True,
N_Package_Declaration => True,
N_Package_Instantiation => True,
N_Package_Specification => True,
N_Package_Renaming_Declaration => True,
N_Parameter_Specification => True,
N_Private_Extension_Declaration => True,
N_Private_Type_Declaration => True,
N_Procedure_Instantiation => True,
N_Protected_Body => True,
N_Protected_Body_Stub => True,
N_Protected_Type_Declaration => True,
N_Single_Protected_Declaration => True,
N_Single_Task_Declaration => True,
N_Subprogram_Body => True,
N_Subprogram_Body_Stub => True,
N_Subprogram_Declaration => True,
N_Subprogram_Renaming_Declaration => True,
N_Subtype_Declaration => True,
N_Task_Body => True,
N_Task_Body_Stub => True,
N_Task_Type_Declaration => True,
others => False);
function Permits_Aspect_Specifications (N : Node_Id) return Boolean is
begin
pragma Assert (Present (N));
return Has_Aspect_Specifications_Flag (Nkind (N));
end Permits_Aspect_Specifications;
--------------------
-- Remove_Aspects --
--------------------
procedure Remove_Aspects (N : Node_Id) is
begin
if Has_Aspects (N) then
Aspect_Specifications_Hash_Table.Remove (N);
Set_Has_Aspects (N, False);
end if;
end Remove_Aspects;
-----------------
-- Same_Aspect --
-----------------
-- Table used for Same_Aspect, maps aspect to canonical aspect
type Aspect_To_Aspect_Mapping is array (Aspect_Id) of Aspect_Id;
function Init_Canonical_Aspect return Aspect_To_Aspect_Mapping;
-- Initialize the Canonical_Aspect mapping below
function Init_Canonical_Aspect return Aspect_To_Aspect_Mapping is
Result : Aspect_To_Aspect_Mapping;
begin
-- They all map to themselves...
for Aspect in Aspect_Id loop
Result (Aspect) := Aspect;
end loop;
-- ...except for these:
Result (Aspect_Dynamic_Predicate) := Aspect_Predicate;
Result (Aspect_Inline_Always) := Aspect_Inline;
Result (Aspect_Interrupt_Priority) := Aspect_Priority;
Result (Aspect_Postcondition) := Aspect_Post;
Result (Aspect_Precondition) := Aspect_Pre;
Result (Aspect_Shared) := Aspect_Atomic;
Result (Aspect_Static_Predicate) := Aspect_Predicate;
Result (Aspect_Type_Invariant) := Aspect_Invariant;
return Result;
end Init_Canonical_Aspect;
Canonical_Aspect : constant Aspect_To_Aspect_Mapping :=
Init_Canonical_Aspect;
function Same_Aspect (A1 : Aspect_Id; A2 : Aspect_Id) return Boolean is
begin
return Canonical_Aspect (A1) = Canonical_Aspect (A2);
end Same_Aspect;
-------------------------------
-- Set_Aspect_Specifications --
-------------------------------
procedure Set_Aspect_Specifications (N : Node_Id; L : List_Id) is
begin
pragma Assert (Permits_Aspect_Specifications (N));
pragma Assert (not Has_Aspects (N));
pragma Assert (L /= No_List);
Set_Has_Aspects (N);
Set_Parent (L, N);
Aspect_Specifications_Hash_Table.Set (N, L);
end Set_Aspect_Specifications;
-- Package initialization sets up Aspect Id hash table
begin
for J in Aspect_Id loop
Aspect_Id_Hash_Table.Set (Aspect_Names (J), J);
end loop;
end Aspects;
|
OhYea777/Minix | Ada | 20,398 | adb | ----------------------------------------------------------------
-- ZLib for Ada thick binding. --
-- --
-- Copyright (C) 2002-2004 Dmitriy Anisimkov --
-- --
-- Open source license information is in the zlib.ads file. --
----------------------------------------------------------------
-- $Id: zlib.adb,v 1.1 2005/09/23 22:39:01 beng Exp $
with Ada.Exceptions;
with Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation;
with Interfaces.C.Strings;
with ZLib.Thin;
package body ZLib is
use type Thin.Int;
type Z_Stream is new Thin.Z_Stream;
type Return_Code_Enum is
(OK,
STREAM_END,
NEED_DICT,
ERRNO,
STREAM_ERROR,
DATA_ERROR,
MEM_ERROR,
BUF_ERROR,
VERSION_ERROR);
type Flate_Step_Function is access
function (Strm : in Thin.Z_Streamp; Flush : in Thin.Int) return Thin.Int;
pragma Convention (C, Flate_Step_Function);
type Flate_End_Function is access
function (Ctrm : in Thin.Z_Streamp) return Thin.Int;
pragma Convention (C, Flate_End_Function);
type Flate_Type is record
Step : Flate_Step_Function;
Done : Flate_End_Function;
end record;
subtype Footer_Array is Stream_Element_Array (1 .. 8);
Simple_GZip_Header : constant Stream_Element_Array (1 .. 10)
:= (16#1f#, 16#8b#, -- Magic header
16#08#, -- Z_DEFLATED
16#00#, -- Flags
16#00#, 16#00#, 16#00#, 16#00#, -- Time
16#00#, -- XFlags
16#03# -- OS code
);
-- The simplest gzip header is not for informational, but just for
-- gzip format compatibility.
-- Note that some code below is using assumption
-- Simple_GZip_Header'Last > Footer_Array'Last, so do not make
-- Simple_GZip_Header'Last <= Footer_Array'Last.
Return_Code : constant array (Thin.Int range <>) of Return_Code_Enum
:= (0 => OK,
1 => STREAM_END,
2 => NEED_DICT,
-1 => ERRNO,
-2 => STREAM_ERROR,
-3 => DATA_ERROR,
-4 => MEM_ERROR,
-5 => BUF_ERROR,
-6 => VERSION_ERROR);
Flate : constant array (Boolean) of Flate_Type
:= (True => (Step => Thin.Deflate'Access,
Done => Thin.DeflateEnd'Access),
False => (Step => Thin.Inflate'Access,
Done => Thin.InflateEnd'Access));
Flush_Finish : constant array (Boolean) of Flush_Mode
:= (True => Finish, False => No_Flush);
procedure Raise_Error (Stream : in Z_Stream);
pragma Inline (Raise_Error);
procedure Raise_Error (Message : in String);
pragma Inline (Raise_Error);
procedure Check_Error (Stream : in Z_Stream; Code : in Thin.Int);
procedure Free is new Ada.Unchecked_Deallocation
(Z_Stream, Z_Stream_Access);
function To_Thin_Access is new Ada.Unchecked_Conversion
(Z_Stream_Access, Thin.Z_Streamp);
procedure Translate_GZip
(Filter : in out Filter_Type;
In_Data : in Ada.Streams.Stream_Element_Array;
In_Last : out Ada.Streams.Stream_Element_Offset;
Out_Data : out Ada.Streams.Stream_Element_Array;
Out_Last : out Ada.Streams.Stream_Element_Offset;
Flush : in Flush_Mode);
-- Separate translate routine for make gzip header.
procedure Translate_Auto
(Filter : in out Filter_Type;
In_Data : in Ada.Streams.Stream_Element_Array;
In_Last : out Ada.Streams.Stream_Element_Offset;
Out_Data : out Ada.Streams.Stream_Element_Array;
Out_Last : out Ada.Streams.Stream_Element_Offset;
Flush : in Flush_Mode);
-- translate routine without additional headers.
-----------------
-- Check_Error --
-----------------
procedure Check_Error (Stream : in Z_Stream; Code : in Thin.Int) is
use type Thin.Int;
begin
if Code /= Thin.Z_OK then
Raise_Error
(Return_Code_Enum'Image (Return_Code (Code))
& ": " & Last_Error_Message (Stream));
end if;
end Check_Error;
-----------
-- Close --
-----------
procedure Close
(Filter : in out Filter_Type;
Ignore_Error : in Boolean := False)
is
Code : Thin.Int;
begin
if not Ignore_Error and then not Is_Open (Filter) then
raise Status_Error;
end if;
Code := Flate (Filter.Compression).Done (To_Thin_Access (Filter.Strm));
if Ignore_Error or else Code = Thin.Z_OK then
Free (Filter.Strm);
else
declare
Error_Message : constant String
:= Last_Error_Message (Filter.Strm.all);
begin
Free (Filter.Strm);
Ada.Exceptions.Raise_Exception
(ZLib_Error'Identity,
Return_Code_Enum'Image (Return_Code (Code))
& ": " & Error_Message);
end;
end if;
end Close;
-----------
-- CRC32 --
-----------
function CRC32
(CRC : in Unsigned_32;
Data : in Ada.Streams.Stream_Element_Array)
return Unsigned_32
is
use Thin;
begin
return Unsigned_32 (crc32 (ULong (CRC),
Data'Address,
Data'Length));
end CRC32;
procedure CRC32
(CRC : in out Unsigned_32;
Data : in Ada.Streams.Stream_Element_Array) is
begin
CRC := CRC32 (CRC, Data);
end CRC32;
------------------
-- Deflate_Init --
------------------
procedure Deflate_Init
(Filter : in out Filter_Type;
Level : in Compression_Level := Default_Compression;
Strategy : in Strategy_Type := Default_Strategy;
Method : in Compression_Method := Deflated;
Window_Bits : in Window_Bits_Type := Default_Window_Bits;
Memory_Level : in Memory_Level_Type := Default_Memory_Level;
Header : in Header_Type := Default)
is
use type Thin.Int;
Win_Bits : Thin.Int := Thin.Int (Window_Bits);
begin
if Is_Open (Filter) then
raise Status_Error;
end if;
-- We allow ZLib to make header only in case of default header type.
-- Otherwise we would either do header by ourselfs, or do not do
-- header at all.
if Header = None or else Header = GZip then
Win_Bits := -Win_Bits;
end if;
-- For the GZip CRC calculation and make headers.
if Header = GZip then
Filter.CRC := 0;
Filter.Offset := Simple_GZip_Header'First;
else
Filter.Offset := Simple_GZip_Header'Last + 1;
end if;
Filter.Strm := new Z_Stream;
Filter.Compression := True;
Filter.Stream_End := False;
Filter.Header := Header;
if Thin.Deflate_Init
(To_Thin_Access (Filter.Strm),
Level => Thin.Int (Level),
method => Thin.Int (Method),
windowBits => Win_Bits,
memLevel => Thin.Int (Memory_Level),
strategy => Thin.Int (Strategy)) /= Thin.Z_OK
then
Raise_Error (Filter.Strm.all);
end if;
end Deflate_Init;
-----------
-- Flush --
-----------
procedure Flush
(Filter : in out Filter_Type;
Out_Data : out Ada.Streams.Stream_Element_Array;
Out_Last : out Ada.Streams.Stream_Element_Offset;
Flush : in Flush_Mode)
is
No_Data : Stream_Element_Array := (1 .. 0 => 0);
Last : Stream_Element_Offset;
begin
Translate (Filter, No_Data, Last, Out_Data, Out_Last, Flush);
end Flush;
-----------------------
-- Generic_Translate --
-----------------------
procedure Generic_Translate
(Filter : in out ZLib.Filter_Type;
In_Buffer_Size : in Integer := Default_Buffer_Size;
Out_Buffer_Size : in Integer := Default_Buffer_Size)
is
In_Buffer : Stream_Element_Array
(1 .. Stream_Element_Offset (In_Buffer_Size));
Out_Buffer : Stream_Element_Array
(1 .. Stream_Element_Offset (Out_Buffer_Size));
Last : Stream_Element_Offset;
In_Last : Stream_Element_Offset;
In_First : Stream_Element_Offset;
Out_Last : Stream_Element_Offset;
begin
Main : loop
Data_In (In_Buffer, Last);
In_First := In_Buffer'First;
loop
Translate
(Filter => Filter,
In_Data => In_Buffer (In_First .. Last),
In_Last => In_Last,
Out_Data => Out_Buffer,
Out_Last => Out_Last,
Flush => Flush_Finish (Last < In_Buffer'First));
if Out_Buffer'First <= Out_Last then
Data_Out (Out_Buffer (Out_Buffer'First .. Out_Last));
end if;
exit Main when Stream_End (Filter);
-- The end of in buffer.
exit when In_Last = Last;
In_First := In_Last + 1;
end loop;
end loop Main;
end Generic_Translate;
------------------
-- Inflate_Init --
------------------
procedure Inflate_Init
(Filter : in out Filter_Type;
Window_Bits : in Window_Bits_Type := Default_Window_Bits;
Header : in Header_Type := Default)
is
use type Thin.Int;
Win_Bits : Thin.Int := Thin.Int (Window_Bits);
procedure Check_Version;
-- Check the latest header types compatibility.
procedure Check_Version is
begin
if Version <= "1.1.4" then
Raise_Error
("Inflate header type " & Header_Type'Image (Header)
& " incompatible with ZLib version " & Version);
end if;
end Check_Version;
begin
if Is_Open (Filter) then
raise Status_Error;
end if;
case Header is
when None =>
Check_Version;
-- Inflate data without headers determined
-- by negative Win_Bits.
Win_Bits := -Win_Bits;
when GZip =>
Check_Version;
-- Inflate gzip data defined by flag 16.
Win_Bits := Win_Bits + 16;
when Auto =>
Check_Version;
-- Inflate with automatic detection
-- of gzip or native header defined by flag 32.
Win_Bits := Win_Bits + 32;
when Default => null;
end case;
Filter.Strm := new Z_Stream;
Filter.Compression := False;
Filter.Stream_End := False;
Filter.Header := Header;
if Thin.Inflate_Init
(To_Thin_Access (Filter.Strm), Win_Bits) /= Thin.Z_OK
then
Raise_Error (Filter.Strm.all);
end if;
end Inflate_Init;
-------------
-- Is_Open --
-------------
function Is_Open (Filter : in Filter_Type) return Boolean is
begin
return Filter.Strm /= null;
end Is_Open;
-----------------
-- Raise_Error --
-----------------
procedure Raise_Error (Message : in String) is
begin
Ada.Exceptions.Raise_Exception (ZLib_Error'Identity, Message);
end Raise_Error;
procedure Raise_Error (Stream : in Z_Stream) is
begin
Raise_Error (Last_Error_Message (Stream));
end Raise_Error;
----------
-- Read --
----------
procedure Read
(Filter : in out Filter_Type;
Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
Flush : in Flush_Mode := No_Flush)
is
In_Last : Stream_Element_Offset;
Item_First : Ada.Streams.Stream_Element_Offset := Item'First;
V_Flush : Flush_Mode := Flush;
begin
pragma Assert (Rest_First in Buffer'First .. Buffer'Last + 1);
pragma Assert (Rest_Last in Buffer'First - 1 .. Buffer'Last);
loop
if Rest_Last = Buffer'First - 1 then
V_Flush := Finish;
elsif Rest_First > Rest_Last then
Read (Buffer, Rest_Last);
Rest_First := Buffer'First;
if Rest_Last < Buffer'First then
V_Flush := Finish;
end if;
end if;
Translate
(Filter => Filter,
In_Data => Buffer (Rest_First .. Rest_Last),
In_Last => In_Last,
Out_Data => Item (Item_First .. Item'Last),
Out_Last => Last,
Flush => V_Flush);
Rest_First := In_Last + 1;
exit when Stream_End (Filter)
or else Last = Item'Last
or else (Last >= Item'First and then Allow_Read_Some);
Item_First := Last + 1;
end loop;
end Read;
----------------
-- Stream_End --
----------------
function Stream_End (Filter : in Filter_Type) return Boolean is
begin
if Filter.Header = GZip and Filter.Compression then
return Filter.Stream_End
and then Filter.Offset = Footer_Array'Last + 1;
else
return Filter.Stream_End;
end if;
end Stream_End;
--------------
-- Total_In --
--------------
function Total_In (Filter : in Filter_Type) return Count is
begin
return Count (Thin.Total_In (To_Thin_Access (Filter.Strm).all));
end Total_In;
---------------
-- Total_Out --
---------------
function Total_Out (Filter : in Filter_Type) return Count is
begin
return Count (Thin.Total_Out (To_Thin_Access (Filter.Strm).all));
end Total_Out;
---------------
-- Translate --
---------------
procedure Translate
(Filter : in out Filter_Type;
In_Data : in Ada.Streams.Stream_Element_Array;
In_Last : out Ada.Streams.Stream_Element_Offset;
Out_Data : out Ada.Streams.Stream_Element_Array;
Out_Last : out Ada.Streams.Stream_Element_Offset;
Flush : in Flush_Mode) is
begin
if Filter.Header = GZip and then Filter.Compression then
Translate_GZip
(Filter => Filter,
In_Data => In_Data,
In_Last => In_Last,
Out_Data => Out_Data,
Out_Last => Out_Last,
Flush => Flush);
else
Translate_Auto
(Filter => Filter,
In_Data => In_Data,
In_Last => In_Last,
Out_Data => Out_Data,
Out_Last => Out_Last,
Flush => Flush);
end if;
end Translate;
--------------------
-- Translate_Auto --
--------------------
procedure Translate_Auto
(Filter : in out Filter_Type;
In_Data : in Ada.Streams.Stream_Element_Array;
In_Last : out Ada.Streams.Stream_Element_Offset;
Out_Data : out Ada.Streams.Stream_Element_Array;
Out_Last : out Ada.Streams.Stream_Element_Offset;
Flush : in Flush_Mode)
is
use type Thin.Int;
Code : Thin.Int;
begin
if not Is_Open (Filter) then
raise Status_Error;
end if;
if Out_Data'Length = 0 and then In_Data'Length = 0 then
raise Constraint_Error;
end if;
Set_Out (Filter.Strm.all, Out_Data'Address, Out_Data'Length);
Set_In (Filter.Strm.all, In_Data'Address, In_Data'Length);
Code := Flate (Filter.Compression).Step
(To_Thin_Access (Filter.Strm),
Thin.Int (Flush));
if Code = Thin.Z_STREAM_END then
Filter.Stream_End := True;
else
Check_Error (Filter.Strm.all, Code);
end if;
In_Last := In_Data'Last
- Stream_Element_Offset (Avail_In (Filter.Strm.all));
Out_Last := Out_Data'Last
- Stream_Element_Offset (Avail_Out (Filter.Strm.all));
end Translate_Auto;
--------------------
-- Translate_GZip --
--------------------
procedure Translate_GZip
(Filter : in out Filter_Type;
In_Data : in Ada.Streams.Stream_Element_Array;
In_Last : out Ada.Streams.Stream_Element_Offset;
Out_Data : out Ada.Streams.Stream_Element_Array;
Out_Last : out Ada.Streams.Stream_Element_Offset;
Flush : in Flush_Mode)
is
Out_First : Stream_Element_Offset;
procedure Add_Data (Data : in Stream_Element_Array);
-- Add data to stream from the Filter.Offset till necessary,
-- used for add gzip headr/footer.
procedure Put_32
(Item : in out Stream_Element_Array;
Data : in Unsigned_32);
pragma Inline (Put_32);
--------------
-- Add_Data --
--------------
procedure Add_Data (Data : in Stream_Element_Array) is
Data_First : Stream_Element_Offset renames Filter.Offset;
Data_Last : Stream_Element_Offset;
Data_Len : Stream_Element_Offset; -- -1
Out_Len : Stream_Element_Offset; -- -1
begin
Out_First := Out_Last + 1;
if Data_First > Data'Last then
return;
end if;
Data_Len := Data'Last - Data_First;
Out_Len := Out_Data'Last - Out_First;
if Data_Len <= Out_Len then
Out_Last := Out_First + Data_Len;
Data_Last := Data'Last;
else
Out_Last := Out_Data'Last;
Data_Last := Data_First + Out_Len;
end if;
Out_Data (Out_First .. Out_Last) := Data (Data_First .. Data_Last);
Data_First := Data_Last + 1;
Out_First := Out_Last + 1;
end Add_Data;
------------
-- Put_32 --
------------
procedure Put_32
(Item : in out Stream_Element_Array;
Data : in Unsigned_32)
is
D : Unsigned_32 := Data;
begin
for J in Item'First .. Item'First + 3 loop
Item (J) := Stream_Element (D and 16#FF#);
D := Shift_Right (D, 8);
end loop;
end Put_32;
begin
Out_Last := Out_Data'First - 1;
if not Filter.Stream_End then
Add_Data (Simple_GZip_Header);
Translate_Auto
(Filter => Filter,
In_Data => In_Data,
In_Last => In_Last,
Out_Data => Out_Data (Out_First .. Out_Data'Last),
Out_Last => Out_Last,
Flush => Flush);
CRC32 (Filter.CRC, In_Data (In_Data'First .. In_Last));
end if;
if Filter.Stream_End and then Out_Last <= Out_Data'Last then
-- This detection method would work only when
-- Simple_GZip_Header'Last > Footer_Array'Last
if Filter.Offset = Simple_GZip_Header'Last + 1 then
Filter.Offset := Footer_Array'First;
end if;
declare
Footer : Footer_Array;
begin
Put_32 (Footer, Filter.CRC);
Put_32 (Footer (Footer'First + 4 .. Footer'Last),
Unsigned_32 (Total_In (Filter)));
Add_Data (Footer);
end;
end if;
end Translate_GZip;
-------------
-- Version --
-------------
function Version return String is
begin
return Interfaces.C.Strings.Value (Thin.zlibVersion);
end Version;
-----------
-- Write --
-----------
procedure Write
(Filter : in out Filter_Type;
Item : in Ada.Streams.Stream_Element_Array;
Flush : in Flush_Mode := No_Flush)
is
Buffer : Stream_Element_Array (1 .. Buffer_Size);
In_Last : Stream_Element_Offset;
Out_Last : Stream_Element_Offset;
In_First : Stream_Element_Offset := Item'First;
begin
if Item'Length = 0 and Flush = No_Flush then
return;
end if;
loop
Translate
(Filter => Filter,
In_Data => Item (In_First .. Item'Last),
In_Last => In_Last,
Out_Data => Buffer,
Out_Last => Out_Last,
Flush => Flush);
if Out_Last >= Buffer'First then
Write (Buffer (1 .. Out_Last));
end if;
exit when In_Last = Item'Last or Stream_End (Filter);
In_First := In_Last + 1;
end loop;
end Write;
end ZLib;
|
flyx/OpenGLAda | Ada | 3,013 | ads | -- part of OpenGLAda, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "COPYING"
with GL.Low_Level;
with GL.Types.Colors;
package GL.Fixed.Textures is
pragma Preelaborate;
type Texture_Function is (Add, Blend, Replace, Modulate, Decal, Combine);
type Combine_Function is (Add, Replace, Modulate, Subtract, Add_Signed,
Interpolate, Dot3_RGB, Dot3_RGBA);
-- needs to be declared here because of following subtype declaration
for Combine_Function use (Add => 16#0104#,
Replace => 16#1E01#,
Modulate => 16#2100#,
Subtract => 16#84E7#,
Add_Signed => 16#8574#,
Interpolate => 16#8575#,
Dot3_RGB => 16#86AE#,
Dot3_RGBA => 16#86AF#);
for Combine_Function'Size use Low_Level.Enum'Size;
subtype Alpha_Combine_Function is Combine_Function range Add .. Interpolate;
type Source_Kind is (Texture, Constant_Src, Primary_Color, Previous);
subtype Scaling_Factor is Double range 1.0 .. 4.0;
type Source_Index is range 0 .. 2;
procedure Set_Tex_Function (Func : Texture_Function);
function Tex_Function return Texture_Function;
procedure Set_RGB_Combine (Func : Combine_Function);
function RGB_Combine return Combine_Function;
procedure Set_Alpha_Combine (Func : Alpha_Combine_Function);
function Alpha_Combine return Alpha_Combine_Function;
procedure Set_RGB_Source (Source : Source_Kind; Index : Source_Index);
function RGB_Source (Index : Source_Index) return Source_Kind;
procedure Set_Alpha_Source (Source : Source_Kind; Index : Source_Index);
function Alpha_Source (Index : Source_Index) return Source_Kind;
procedure Set_RGB_Scale (Value : Scaling_Factor);
function RGB_Scale return Scaling_Factor;
procedure Set_Alpha_Scale (Value : Scaling_Factor);
function Alpha_Scale return Scaling_Factor;
procedure Set_LoD_Bias (Value : Double);
function LoD_Bias return Double;
procedure Set_Env_Color (Value : Colors.Color);
function Env_Color return Colors.Color;
procedure Toggle_Point_Sprite_Coord_Replace (Enabled : Boolean);
function Point_Sprite_Coord_Replace return Boolean;
private
for Texture_Function use (Add => 16#0104#,
Blend => 16#0BE2#,
Replace => 16#1E01#,
Modulate => 16#2100#,
Decal => 16#2101#,
Combine => 16#8570#);
for Texture_Function'Size use Low_Level.Enum'Size;
for Source_Kind use (Texture => 16#1702#,
Constant_Src => 16#8576#,
Primary_Color => 16#8577#,
Previous => 16#8578#);
for Source_Kind'Size use Low_Level.Enum'Size;
end GL.Fixed.Textures;
|
reznikmm/matreshka | Ada | 4,591 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Draw.Class_Id_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Draw_Class_Id_Attribute_Node is
begin
return Self : Draw_Class_Id_Attribute_Node do
Matreshka.ODF_Draw.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Draw_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Draw_Class_Id_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Class_Id_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Draw_URI,
Matreshka.ODF_String_Constants.Class_Id_Attribute,
Draw_Class_Id_Attribute_Node'Tag);
end Matreshka.ODF_Draw.Class_Id_Attributes;
|
reznikmm/matreshka | Ada | 3,654 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with League.Holders.Generic_Holders;
package AMF.DC.Holders.Dimensions is
new League.Holders.Generic_Holders
(AMF.DC.DC_Dimension);
pragma Preelaborate (AMF.DC.Holders.Dimensions);
|
mirror/ncurses | Ada | 5,277 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Forms.Field_Types.Enumeration --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- Copyright 2018,2020 Thomas E. Dickey --
-- Copyright 1999-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.15 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Interfaces.C.Strings;
package Terminal_Interface.Curses.Forms.Field_Types.Enumeration is
pragma Preelaborate
(Terminal_Interface.Curses.Forms.Field_Types.Enumeration);
type String_Access is access String;
-- Type_Set is used by the child package Ada
type Type_Set is (Lower_Case, Upper_Case, Mixed_Case);
type Enum_Array is array (Positive range <>)
of String_Access;
type Enumeration_Info (C : Positive) is
record
Case_Sensitive : Boolean := False;
Match_Must_Be_Unique : Boolean := False;
Names : Enum_Array (1 .. C);
end record;
type Enumeration_Field is new Field_Type with private;
function Create (Info : Enumeration_Info;
Auto_Release_Names : Boolean := False)
return Enumeration_Field;
-- Make an fieldtype from the info. Enumerations are special, because
-- they normally don't copy the enum values into a private store, so
-- we have to care for the lifetime of the info we provide.
-- The Auto_Release_Names flag may be used to automatically releases
-- the strings in the Names array of the Enumeration_Info.
function Make_Enumeration_Type (Info : Enumeration_Info;
Auto_Release_Names : Boolean := False)
return Enumeration_Field renames Create;
procedure Release (Enum : in out Enumeration_Field);
-- But we may want to release the field to release the memory allocated
-- by it internally. After that the Enumeration field is no longer usable.
-- The next type definitions are all ncurses extensions. They are typically
-- not available in other curses implementations.
procedure Set_Field_Type (Fld : Field;
Typ : Enumeration_Field);
pragma Inline (Set_Field_Type);
private
type CPA_Access is access Interfaces.C.Strings.chars_ptr_array;
type Enumeration_Field is new Field_Type with
record
Case_Sensitive : Boolean := False;
Match_Must_Be_Unique : Boolean := False;
Arr : CPA_Access := null;
end record;
end Terminal_Interface.Curses.Forms.Field_Types.Enumeration;
|
reznikmm/matreshka | Ada | 4,083 | 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.Table_Rejecting_Change_Id_Attributes;
package Matreshka.ODF_Table.Rejecting_Change_Id_Attributes is
type Table_Rejecting_Change_Id_Attribute_Node is
new Matreshka.ODF_Table.Abstract_Table_Attribute_Node
and ODF.DOM.Table_Rejecting_Change_Id_Attributes.ODF_Table_Rejecting_Change_Id_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Table_Rejecting_Change_Id_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Table_Rejecting_Change_Id_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Table.Rejecting_Change_Id_Attributes;
|
sungyeon/drake | Ada | 36,126 | adb | -- reference:
-- http://www.loc.gov/standards/iso639-2/php/code_list.php
pragma Check_Policy (Validate => Ignore);
with System.Native_Locales;
with System.Once;
package body Ada.Locales is
type Long_Boolean is new Boolean;
for Long_Boolean'Size use Long_Integer'Size;
function expect (exp, c : Long_Boolean) return Long_Boolean
with Import,
Convention => Intrinsic, External_Name => "__builtin_expect";
type Alpha_2_NP is new String (1 .. 2); -- no predicate
type Alpha_3_NP is new String (1 .. 3);
function Compare (Left, Right : Alpha_2_NP) return Integer;
function Compare (Left, Right : Alpha_2_NP) return Integer is
type Compare_Integer is mod 16#10000#;
Left_Value : constant Compare_Integer :=
Character'Pos (Left (1)) * 16#100#
or Character'Pos (Left (2));
Right_Value : constant Compare_Integer :=
Character'Pos (Right (1)) * 16#100#
or Character'Pos (Right (2));
begin
return Integer (Left_Value) - Integer (Right_Value);
end Compare;
function Compare (Left, Right : Alpha_3_NP) return Integer;
function Compare (Left, Right : Alpha_3_NP) return Integer is
type Compare_Integer is mod 16#1000000#;
Left_Value : constant Compare_Integer :=
Character'Pos (Left (1)) * 16#10000#
or Character'Pos (Left (2)) * 16#100#
or Character'Pos (Left (3));
Right_Value : constant Compare_Integer :=
Character'Pos (Right (1)) * 16#10000#
or Character'Pos (Right (2)) * 16#100#
or Character'Pos (Right (3));
begin
return Integer (Left_Value) - Integer (Right_Value);
end Compare;
type Language_Table_Element is record
Alpha_3 : Alpha_3_NP;
Alpha_2 : Alpha_2_NP;
end record;
pragma Suppress_Initialization (Language_Table_Element);
type Language_Table_Array is
array (Positive range <>) of Language_Table_Element;
pragma Suppress_Initialization (Language_Table_Array);
type Language_Table_Array_Access is access Language_Table_Array;
unde : constant Alpha_2_NP :=
(1 => ISO_639_Alpha_2_Unknown (1), 2 => ISO_639_Alpha_2_Unknown (2));
Language_Table : constant Language_Table_Array := (
("aar", "aa"), -- "Afar", "afar"
("abk", "ab"), -- "Abkhazian", "abkhaze"
("ace", unde), -- "Achinese", "aceh"
("ach", unde), -- "Acoli", "acoli"
("ada", unde), -- "Adangme", "adangme"
("ady", unde), -- "Adyghe; Adygei", "adyghé"
("afa", unde), -- "Afro-Asiatic languages", "afro-asiatiques, langues"
("afh", unde), -- "Afrihili", "afrihili"
("afr", "af"), -- "Afrikaans", "afrikaans"
("ain", unde), -- "Ainu", "aïnou"
("aka", "ak"), -- "Akan", "akan"
("akk", unde), -- "Akkadian", "akkadien"
("alb", "sq"), -- (B)
("sqi", "sq"), -- (T) "Albanian", "albanais"
("ale", unde), -- "Aleut", "aléoute"
("alg", unde), -- "Algonquian languages", "algonquines, langues"
("alt", unde), -- "Southern Altai", "altai du Sud"
("amh", "am"), -- "Amharic", "amharique"
("ang", unde), -- "English, Old (ca.450-1100)",
-- "anglo-saxon (ca.450-1100)"
("anp", unde), -- "Angika", "angika"
("apa", unde), -- "Apache languages", "apaches, langues"
("ara", "ar"), -- "Arabic", "arabe"
("arc", unde), -- "Official Aramaic (700-300 BCE); "
-- & "Imperial Aramaic (700-300 BCE)",
-- "araméen d'empire (700-300 BCE)"
("arg", "an"), -- "Aragonese", "aragonais"
("arm", "hy"), -- (B)
("hye", "hy"), -- (T) "Armenian", "arménien"
("arn", unde), -- "Mapudungun; Mapuche", "mapudungun; mapuche; mapuce"
("arp", unde), -- "Arapaho", "arapaho"
("art", unde), -- "Artificial languages", "artificielles, langues"
("arw", unde), -- "Arawak", "arawak"
("asm", "as"), -- "Assamese", "assamais"
("ast", unde), -- "Asturian; Bable; Leonese; Asturleonese",
-- "asturien; bable; léonais; asturoléonais"
("ath", unde), -- "Athapascan languages", "athapascanes, langues"
("aus", unde), -- "Australian languages", "australiennes, langues"
("ava", "av"), -- "Avaric", "avar"
("ave", "ae"), -- "Avestan", "avestique"
("awa", unde), -- "Awadhi", "awadhi"
("aym", "ay"), -- "Aymara", "aymara"
("aze", "az"), -- "Azerbaijani", "azéri"
("bad", unde), -- "Banda languages", "banda, langues"
("bai", unde), -- "Bamileke languages", "bamiléké, langues"
("bak", "ba"), -- "Bashkir", "bachkir"
("bal", unde), -- "Baluchi", "baloutchi"
("bam", "bm"), -- "Bambara", "bambara"
("ban", unde), -- "Balinese", "balinais"
("baq", "eu"), -- (B)
("eus", "eu"), -- (T) "Basque", "basque"
("bas", unde), -- "Basa", "basa"
("bat", unde), -- "Baltic languages", "baltes, langues"
("bej", unde), -- "Beja; Bedawiyet", "bedja"
("bel", "be"), -- "Belarusian", "biélorusse"
("bem", unde), -- "Bemba", "bemba"
("ben", "bn"), -- "Bengali", "bengali"
("ber", unde), -- "Berber languages", "berbères, langues"
("bho", unde), -- "Bhojpuri", "bhojpuri"
("bih", "bh"), -- "Bihari languages", "langues biharis"
("bik", unde), -- "Bikol", "bikol"
("bin", unde), -- "Bini; Edo", "bini; edo"
("bis", "bi"), -- "Bislama", "bichlamar"
("bla", unde), -- "Siksika", "blackfoot"
("bnt", unde), -- "Bantu languages", "bantou, langues"
("tib", "bo"), -- (B)
("bod", "bo"), -- (T) "Tibetan", "tibétain"
("bos", "bs"), -- "Bosnian", "bosniaque"
("bra", unde), -- "Braj", "braj"
("bre", "br"), -- "Breton", "breton"
("btk", unde), -- "Batak languages", "batak, langues"
("bua", unde), -- "Buriat", "bouriate"
("bug", unde), -- "Buginese", "bugi"
("bul", "bg"), -- "Bulgarian", "bulgare"
("bur", "my"), -- (B)
("mya", "my"), -- (T) "Burmese", "birman"
("byn", unde), -- "Blin; Bilin", "blin; bilen"
("cad", unde), -- "Caddo", "caddo"
("cai", unde), -- "Central American Indian languages",
-- "amérindiennes de l'Amérique centrale, langues"
("car", unde), -- "Galibi Carib", "karib; galibi; carib"
("cat", "ca"), -- "Catalan; Valencian", "catalan; valencien"
("cau", unde), -- "Caucasian languages", "caucasiennes, langues"
("ceb", unde), -- "Cebuano", "cebuano"
("cel", unde), -- "Celtic languages",
-- "celtiques, langues; celtes, langues"
("cze", "cs"), -- (B)
("ces", "cs"), -- (T) "Czech", "tchèque"
("cha", "ch"), -- "Chamorro", "chamorro"
("chb", unde), -- "Chibcha", "chibcha"
("che", "ce"), -- "Chechen", "tchétchène"
("chg", unde), -- "Chagatai", "djaghataï"
("chi", "zh"), -- (B)
("zho", "zh"), -- (T) "Chinese", "chinois"
("chk", unde), -- "Chuukese", "chuuk"
("chm", unde), -- "Mari", "mari"
("chn", unde), -- "Chinook jargon", "chinook, jargon"
("cho", unde), -- "Choctaw", "choctaw"
("chp", unde), -- "Chipewyan; Dene Suline", "chipewyan"
("chr", unde), -- "Cherokee", "cherokee"
("chu", "cu"), -- "Church Slavic; Old Slavonic; Church Slavonic; "
-- & "Old Bulgarian; Old Church Slavonic",
-- "slavon d'église; vieux slave; slavon liturgique; "
-- & "vieux bulgare"
("chv", "cv"), -- "Chuvash", "tchouvache"
("chy", unde), -- "Cheyenne", "cheyenne"
("cmc", unde), -- "Chamic languages", "chames, langues"
("cop", unde), -- "Coptic", "copte"
("cor", "kw"), -- "Cornish", "cornique"
("cos", "co"), -- "Corsican", "corse"
("cpe", unde), -- "Creoles and pidgins, English based",
-- "créoles et pidgins basés sur l'anglais"
("cpf", unde), -- "Creoles and pidgins, French-based",
-- "créoles et pidgins basés sur le français"
("cpp", unde), -- "Creoles and pidgins, Portuguese-based",
-- "créoles et pidgins basés sur le portugais"
("cre", "cr"), -- "Cree", "cree"
("crh", unde), -- "Crimean Tatar; Crimean Turkish", "tatar de Crimé"
("crp", unde), -- "Creoles and pidgins", "créoles et pidgins"
("csb", unde), -- "Kashubian", "kachoube"
("cus", unde), -- "Cushitic languages", "couchitiques, langues"
("wel", "cy"), -- (B)
("cym", "cy"), -- (T) "Welsh", "gallois"
("dak", unde), -- "Dakota", "dakota"
("dan", "da"), -- "Danish", "danois"
("dar", unde), -- "Dargwa", "dargwa"
("day", unde), -- "Land Dayak languages", "dayak, langues"
("del", unde), -- "Delaware", "delaware"
("den", unde), -- "Slave (Athapascan)", "esclave (athapascan)"
("ger", "de"), -- (B)
("deu", "de"), -- (T) "German", "allemand"
("dgr", unde), -- "Dogrib", "dogrib"
("din", unde), -- "Dinka", "dinka"
("div", "dv"), -- "Divehi; Dhivehi; Maldivian", "maldivien"
("doi", unde), -- "Dogri", "dogri"
("dra", unde), -- "Dravidian languages", "dravidiennes, langues"
("dsb", unde), -- "Lower Sorbian", "bas-sorabe"
("dua", unde), -- "Duala", "douala"
("dum", unde), -- "Dutch, Middle (ca.1050-1350)",
-- "néerlandais moyen (ca. 1050-1350)"
("dut", "nl"), -- (B)
("nld", "nl"), -- (T) "Dutch; Flemish", "néerlandais; flamand"
("dyu", unde), -- "Dyula", "dioula"
("dzo", "dz"), -- "Dzongkha", "dzongkha"
("efi", unde), -- "Efik", "efik"
("egy", unde), -- "Egyptian (Ancient)", "égyptien"
("eka", unde), -- "Ekajuk", "ekajuk"
("gre", "el"), -- (B)
("ell", "el"), -- (T) "Greek, Modern (1453-)",
-- "grec moderne (après 1453)"
("elx", unde), -- "Elamite", "élamite"
("eng", "en"), -- "English", "anglais"
("enm", unde), -- "English, Middle (1100-1500)",
-- "anglais moyen (1100-1500)"
("epo", "eo"), -- "Esperanto", "espéranto"
("est", "et"), -- "Estonian", "estonien"
("ewe", "ee"), -- "Ewe", "éwé"
("ewo", unde), -- "Ewondo", "éwondo"
("fan", unde), -- "Fang", "fang"
("fao", "fo"), -- "Faroese", "féroïen"
("per", "fa"), -- (B)
("fas", "fa"), -- (T) "Persian", "persan"
("fat", unde), -- "Fanti", "fanti"
("fij", "fj"), -- "Fijian", "fidjien"
("fil", unde), -- "Filipino; Pilipino", "filipino; pilipino"
("fin", "fi"), -- "Finnish", "finnois"
("fiu", unde), -- "Finno-Ugrian languages", "finno-ougriennes, langues"
("fon", unde), -- "Fon", "fon"
("fre", "fr"), -- (B)
("fra", "fr"), -- (T) "French", "français"
("frm", unde), -- "French, Middle (ca.1400-1600)",
-- "français moyen (1400-1600)"
("fro", unde), -- "French, Old (842-ca.1400)",
-- "français ancien (842-ca.1400)"
("frr", unde), -- "Northern Frisian", "frison septentrional"
("frs", unde), -- "Eastern Frisian", "frison oriental"
("fry", "fy"), -- "Western Frisian", "frison occidental"
("ful", "ff"), -- "Fulah", "peul"
("fur", unde), -- "Friulian", "frioulan"
("gaa", unde), -- "Ga", "ga"
("gay", unde), -- "Gayo", "gayo"
("gba", unde), -- "Gbaya", "gbaya"
("gem", unde), -- "Germanic languages", "germaniques, langues"
("geo", "ka"), -- (B)
("kat", "ka"), -- (T) "Georgian", "géorgien"
("gez", unde), -- "Geez", "guèze"
("gil", unde), -- "Gilbertese", "kiribati"
("gla", "gd"), -- "Gaelic; Scottish Gaelic",
-- "gaélique; gaélique écossais"
("gle", "ga"), -- "Irish", "irlandais"
("glg", "gl"), -- "Galician", "galicien"
("glv", "gv"), -- "Manx", "manx; mannois"
("gmh", unde), -- "German, Middle High (ca.1050-1500)",
-- "allemand, moyen haut (ca. 1050-1500)"
("goh", unde), -- "German, Old High (ca.750-1050)",
-- "allemand, vieux haut (ca. 750-1050)"
("gon", unde), -- "Gondi", "gond"
("gor", unde), -- "Gorontalo", "gorontalo"
("got", unde), -- "Gothic", "gothique"
("grb", unde), -- "Grebo", "grebo"
("grc", unde), -- "Greek, Ancient (to 1453)",
-- "grec ancien (jusqu'à 1453)"
("grn", "gn"), -- "Guarani", "guarani"
("gsw", unde), -- "Swiss German; Alemannic; Alsatian",
-- "suisse alémanique; alémanique; alsacien"
("guj", "gu"), -- "Gujarati", "goudjrati"
("gwi", unde), -- "Gwich'in", "gwich'in"
("hai", unde), -- "Haida", "haida"
("hat", "ht"), -- "Haitian; Haitian Creole",
-- "haïtien; créole haïtien"
("hau", "ha"), -- "Hausa", "haoussa"
("haw", unde), -- "Hawaiian", "hawaïen"
("heb", "he"), -- "Hebrew", "hébreu"
("her", "hz"), -- "Herero", "herero"
("hil", unde), -- "Hiligaynon", "hiligaynon"
("him", unde), -- "Himachali languages; Western Pahari languages",
-- "langues himachalis; langues paharis occidentales"
("hin", "hi"), -- "Hindi", "hindi"
("hit", unde), -- "Hittite", "hittite"
("hmn", unde), -- "Hmong; Mong", "hmong"
("hmo", "ho"), -- "Hiri Motu", "hiri motu"
("hrv", "hr"), -- "Croatian", "croate"
("hsb", unde), -- "Upper Sorbian", "haut-sorabe"
("hun", "hu"), -- "Hungarian", "hongrois"
("hup", unde), -- "Hupa", "hupa"
("iba", unde), -- "Iban", "iban"
("ibo", "ig"), -- "Igbo", "igbo"
("ice", "is"), -- (B)
("isl", "is"), -- (T) "Icelandic", "islandais"
("ido", "io"), -- "Ido", "ido"
("iii", "ii"), -- "Sichuan Yi; Nuosu", "yi de Sichuan"
("ijo", unde), -- "Ijo languages", "ijo, langues"
("iku", "iu"), -- "Inuktitut", "inuktitut"
("ile", "ie"), -- "Interlingue; Occidental", "interlingue"
("ilo", unde), -- "Iloko", "ilocano"
("ina", "ia"),
-- "Interlingua (International Auxiliary Language Association)",
-- "interlingua (langue auxiliaire internationale)"
("inc", unde), -- "Indic languages", "indo-aryennes, langues"
("ind", "id"), -- "Indonesian", "indonésien"
("ine", unde), -- "Indo-European languages",
-- "indo-européennes, langues"
("inh", unde), -- "Ingush", "ingouche"
("ipk", "ik"), -- "Inupiaq", "inupiaq"
("ira", unde), -- "Iranian languages", "iraniennes, langues"
("iro", unde), -- "Iroquoian languages", "iroquoises, langues"
("ita", "it"), -- "Italian", "italien"
("jav", "jv"), -- "Javanese", "javanais"
("jbo", unde), -- "Lojban", "lojban"
("jpn", "ja"), -- "Japanese", "japonais"
("jpr", unde), -- "Judeo-Persian", "judéo-persan"
("jrb", unde), -- "Judeo-Arabic", "judéo-arabe"
("kaa", unde), -- "Kara-Kalpak", "karakalpak"
("kab", unde), -- "Kabyle", "kabyle"
("kac", unde), -- "Kachin; Jingpho", "kachin; jingpho"
("kal", "kl"), -- "Kalaallisut; Greenlandic", "groenlandais"
("kam", unde), -- "Kamba", "kamba"
("kan", "kn"), -- "Kannada", "kannada"
("kar", unde), -- "Karen languages", "karen, langues"
("kas", "ks"), -- "Kashmiri", "kashmiri"
("kau", "kr"), -- "Kanuri", "kanouri"
("kaw", unde), -- "Kawi", "kawi"
("kaz", "kk"), -- "Kazakh", "kazakh"
("kbd", unde), -- "Kabardian", "kabardien"
("kha", unde), -- "Khasi", "khasi"
("khi", unde), -- "Khoisan languages", "khoïsan, langues"
("khm", "km"), -- "Central Khmer", "khmer central"
("kho", unde), -- "Khotanese; Sakan", "khotanais; sakan"
("kik", "ki"), -- "Kikuyu; Gikuyu", "kikuyu"
("kin", "rw"), -- "Kinyarwanda", "rwanda"
("kir", "ky"), -- "Kirghiz; Kyrgyz", "kirghiz"
("kmb", unde), -- "Kimbundu", "kimbundu"
("kok", unde), -- "Konkani", "konkani"
("kom", "kv"), -- "Komi", "kom"
("kon", "kg"), -- "Kongo", "kongo"
("kor", "ko"), -- "Korean", "coréen"
("kos", unde), -- "Kosraean", "kosrae"
("kpe", unde), -- "Kpelle", "kpellé"
("krc", unde), -- "Karachay-Balkar", "karatchai balkar"
("krl", unde), -- "Karelian", "carélien"
("kro", unde), -- "Kru languages", "krou, langues"
("kru", unde), -- "Kurukh", "kurukh"
("kua", "kj"), -- "Kuanyama; Kwanyama", "kuanyama; kwanyama"
("kum", unde), -- "Kumyk", "koumyk"
("kur", "ku"), -- "Kurdish", "kurde"
("kut", unde), -- "Kutenai", "kutenai"
("lad", unde), -- "Ladino", "judéo-espagnol"
("lah", unde), -- "Lahnda", "lahnda"
("lam", unde), -- "Lamba", "lamba"
("lao", "lo"), -- "Lao", "lao"
("lat", "la"), -- "Latin", "latin"
("lav", "lv"), -- "Latvian", "letton"
("lez", unde), -- "Lezghian", "lezghien"
("lim", "li"), -- "Limburgan; Limburger; Limburgish", "limbourgeois"
("lin", "ln"), -- "Lingala", "lingala"
("lit", "lt"), -- "Lithuanian", "lituanien"
("lol", unde), -- "Mongo", "mongo"
("loz", unde), -- "Lozi", "lozi"
("ltz", "lb"), -- "Luxembourgish; Letzeburgesch", "luxembourgeois"
("lua", unde), -- "Luba-Lulua", "luba-lulua"
("lub", "lu"), -- "Luba-Katanga", "luba-katanga"
("lug", "lg"), -- "Ganda", "ganda"
("lui", unde), -- "Luiseno", "luiseno"
("lun", unde), -- "Lunda", "lunda"
("luo", unde), -- "Luo (Kenya and Tanzania)", "luo (Kenya et Tanzanie)"
("lus", unde), -- "Lushai", "lushai"
("mac", "mk"), -- (B)
("mkd", "mk"), -- (T) "Macedonian", "macédonien"
("mad", unde), -- "Madurese", "madourais"
("mag", unde), -- "Magahi", "magahi"
("mah", "mh"), -- "Marshallese", "marshall"
("mai", unde), -- "Maithili", "maithili"
("mak", unde), -- "Makasar", "makassar"
("mal", "ml"), -- "Malayalam", "malayalam"
("man", unde), -- "Mandingo", "mandingue"
("mao", "mi"), -- (B)
("mri", "mi"), -- (T) "Maori", "maori"
("map", unde), -- "Austronesian languages", "austronésiennes, langues"
("mar", "mr"), -- "Marathi", "marathe"
("mas", unde), -- "Masai", "massaï"
("may", "ms"), -- (B)
("msa", "ms"), -- (T) "Malay", "malais"
("mdf", unde), -- "Moksha", "moksa"
("mdr", unde), -- "Mandar", "mandar"
("men", unde), -- "Mende", "mendé"
("mga", unde), -- "Irish, Middle (900-1200)",
-- "irlandais moyen (900-1200)"
("mic", unde), -- "Mi'kmaq; Micmac", "mi'kmaq; micmac"
("min", unde), -- "Minangkabau", "minangkabau"
("mkh", unde), -- "Mon-Khmer languages", "môn-khmer, langues"
("mlg", "mg"), -- "Malagasy", "malgache"
("mlt", "mt"), -- "Maltese", "maltais"
("mnc", unde), -- "Manchu", "mandchou"
("mni", unde), -- "Manipuri", "manipuri"
("mno", unde), -- "Manobo languages", "manobo, langues"
("moh", unde), -- "Mohawk", "mohawk"
("mon", "mn"), -- "Mongolian", "mongol"
("mos", unde), -- "Mossi", "moré"
("mun", unde), -- "Munda languages", "mounda, langues"
("mus", unde), -- "Creek", "muskogee"
("mwl", unde), -- "Mirandese", "mirandais"
("mwr", unde), -- "Marwari", "marvari"
("myn", unde), -- "Mayan languages", "maya, langues"
("myv", unde), -- "Erzya", "erza"
("nah", unde), -- "Nahuatl languages", "nahuatl, langues"
("nai", unde), -- "North American Indian languages",
-- "nord-amérindiennes, langues"
("nap", unde), -- "Neapolitan", "napolitain"
("nau", "na"), -- "Nauru", "nauruan"
("nav", "nv"), -- "Navajo; Navaho", "navaho"
("nbl", "nr"), -- "Ndebele, South; South Ndebele", "ndébélé du Sud"
("nde", "nd"), -- "Ndebele, North; North Ndebele", "ndébélé du Nord"
("ndo", "ng"), -- "Ndonga", "ndonga"
("nds", unde), -- "Low German; Low Saxon; German, Low; Saxon, Low",
-- "bas allemand; bas saxon; allemand, bas; saxon, bas"
("nep", "ne"), -- "Nepali", "népalais"
("new", unde), -- "Nepal Bhasa; Newari", "nepal bhasa; newari"
("nia", unde), -- "Nias", "nias"
("nic", unde), -- "Niger-Kordofanian languages",
-- "nigéro-kordofaniennes, langues"
("niu", unde), -- "Niuean", "niué"
("nno", "nn"), -- "Norwegian Nynorsk; Nynorsk, Norwegian",
-- "norvégien nynorsk; nynorsk, norvégien"
("nob", "nb"), -- "Bokmål, Norwegian; Norwegian Bokmål",
-- "norvégien bokmål"
("nog", unde), -- "Nogai", "nogaï; nogay"
("non", unde), -- "Norse, Old", "norrois, vieux"
("nor", "no"), -- "Norwegian", "norvégien"
("nqo", unde), -- "N'Ko", "n'ko"
("nso", unde), -- "Pedi; Sepedi; Northern Sotho",
-- "pedi; sepedi; sotho du Nord"
("nub", unde), -- "Nubian languages", "nubiennes, langues"
("nwc", unde), -- "Classical Newari; Old Newari; Classical Nepal Bhasa",
-- "newari classique"
("nya", "ny"), -- "Chichewa; Chewa; Nyanja", "chichewa; chewa; nyanja"
("nym", unde), -- "Nyamwezi", "nyamwezi"
("nyn", unde), -- "Nyankole", "nyankolé"
("nyo", unde), -- "Nyoro", "nyoro"
("nzi", unde), -- "Nzima", "nzema"
("oci", "oc"), -- "Occitan (post 1500)", "occitan (après 1500)"
("oji", "oj"), -- "Ojibwa", "ojibwa"
("ori", "or"), -- "Oriya", "oriya"
("orm", "om"), -- "Oromo", "galla"
("osa", unde), -- "Osage", "osage"
("oss", "os"), -- "Ossetian; Ossetic", "ossète"
("ota", unde), -- "Turkish, Ottoman (1500-1928)",
-- "turc ottoman (1500-1928)"
("oto", unde), -- "Otomian languages", "otomi, langues"
("paa", unde), -- "Papuan languages", "papoues, langues"
("pag", unde), -- "Pangasinan", "pangasinan"
("pal", unde), -- "Pahlavi", "pahlavi"
("pam", unde), -- "Pampanga; Kapampangan", "pampangan"
("pan", "pa"), -- "Panjabi; Punjabi", "pendjabi"
("pap", unde), -- "Papiamento", "papiamento"
("pau", unde), -- "Palauan", "palau"
("peo", unde), -- "Persian, Old (ca.600-400 B.C.)",
-- "perse, vieux (ca. 600-400 av. J.-C.)"
("phi", unde), -- "Philippine languages", "philippines, langues"
("phn", unde), -- "Phoenician", "phénicien"
("pli", "pi"), -- "Pali", "pali"
("pol", "pl"), -- "Polish", "polonais"
("pon", unde), -- "Pohnpeian", "pohnpei"
("por", "pt"), -- "Portuguese", "portugais"
("pra", unde), -- "Prakrit languages", "prâkrit, langues"
("pro", unde), -- "Provençal, Old (to 1500); Occitan, Old (to 1500)",
-- "provençal ancien (jusqu'à 1500); "
-- & "occitan ancien (jusqu'à 1500)"
("pus", "ps"), -- "Pushto; Pashto", "pachto"
("que", "qu"), -- "Quechua", "quechua"
("raj", unde), -- "Rajasthani", "rajasthani"
("rap", unde), -- "Rapanui", "rapanui"
("rar", unde), -- "Rarotongan; Cook Islands Maori",
-- "rarotonga; maori des îles Cook"
("roa", unde), -- "Romance languages", "romanes, langues"
("roh", "rm"), -- "Romansh", "romanche"
("rom", unde), -- "Romany", "tsigane"
("rum", "ro"), -- (B)
("ron", "ro"), -- (T) "Romanian; Moldavian; Moldovan", "roumain; moldave"
("run", "rn"), -- "Rundi", "rundi"
("rup", unde), -- "Aromanian; Arumanian; Macedo-Romanian",
-- "aroumain; macédo-roumain"
("rus", "ru"), -- "Russian", "russe"
("sad", unde), -- "Sandawe", "sandawe"
("sag", "sg"), -- "Sango", "sango"
("sah", unde), -- "Yakut", "iakoute"
("sai", unde), -- "South American Indian languages",
-- "sud-amérindiennes, langues"
("sal", unde), -- "Salishan languages", "salishennes, langues"
("sam", unde), -- "Samaritan Aramaic", "samaritain"
("san", "sa"), -- "Sanskrit", "sanskrit"
("sas", unde), -- "Sasak", "sasak"
("sat", unde), -- "Santali", "santal"
("scn", unde), -- "Sicilian", "sicilien"
("sco", unde), -- "Scots", "écossais"
("sel", unde), -- "Selkup", "selkoupe"
("sem", unde), -- "Semitic languages", "sémitiques, langues"
("sga", unde), -- "Irish, Old (to 900)",
-- "irlandais ancien (jusqu'à 900)"
("sgn", unde), -- "Sign Languages", "langues des signes"
("shn", unde), -- "Shan", "chan"
("sid", unde), -- "Sidamo", "sidamo"
("sin", "si"), -- "Sinhala; Sinhalese", "singhalais"
("sio", unde), -- "Siouan languages", "sioux, langues"
("sit", unde), -- "Sino-Tibetan languages", "sino-tibétaines, langues"
("sla", unde), -- "Slavic languages", "slaves, langues"
("slo", "sk"), -- (B)
("slk", "sk"), -- (T) "Slovak", "slovaque"
("slv", "sl"), -- "Slovenian", "slovène"
("sma", unde), -- "Southern Sami", "sami du Sud"
("sme", "se"), -- "Northern Sami", "sami du Nord"
("smi", unde), -- "Sami languages", "sames, langues"
("smj", unde), -- "Lule Sami", "sami de Lule"
("smn", unde), -- "Inari Sami", "sami d'Inari"
("smo", "sm"), -- "Samoan", "samoan"
("sms", unde), -- "Skolt Sami", "sami skolt"
("sna", "sn"), -- "Shona", "shona"
("snd", "sd"), -- "Sindhi", "sindhi"
("snk", unde), -- "Soninke", "soninké"
("sog", unde), -- "Sogdian", "sogdien"
("som", "so"), -- "Somali", "somali"
("son", unde), -- "Songhai languages", "songhai, langues"
("sot", "st"), -- "Sotho, Southern", "sotho du Sud"
("spa", "es"), -- "Spanish; Castilian", "espagnol; castillan"
("srd", "sc"), -- "Sardinian", "sarde"
("srn", unde), -- "Sranan Tongo", "sranan tongo"
("srp", "sr"), -- "Serbian", "serbe"
("srr", unde), -- "Serer", "sérère"
("ssa", unde), -- "Nilo-Saharan languages", "nilo-sahariennes, langues"
("ssw", "ss"), -- "Swati", "swati"
("suk", unde), -- "Sukuma", "sukuma"
("sun", "su"), -- "Sundanese", "soundanais"
("sus", unde), -- "Susu", "soussou"
("sux", unde), -- "Sumerian", "sumérien"
("swa", "sw"), -- "Swahili", "swahili"
("swe", "sv"), -- "Swedish", "suédois"
("syc", unde), -- "Classical Syriac", "syriaque classique"
("syr", unde), -- "Syriac", "syriaque"
("tah", "ty"), -- "Tahitian", "tahitien"
("tai", unde), -- "Tai languages", "tai, langues"
("tam", "ta"), -- "Tamil", "tamoul"
("tat", "tt"), -- "Tatar", "tatar"
("tel", "te"), -- "Telugu", "télougou"
("tem", unde), -- "Timne", "temne"
("ter", unde), -- "Tereno", "tereno"
("tet", unde), -- "Tetum", "tetum"
("tgk", "tg"), -- "Tajik", "tadjik"
("tgl", "tl"), -- "Tagalog", "tagalog"
("tha", "th"), -- "Thai", "thaï"
("tig", unde), -- "Tigre", "tigré"
("tir", "ti"), -- "Tigrinya", "tigrigna"
("tiv", unde), -- "Tiv", "tiv"
("tkl", unde), -- "Tokelau", "tokelau"
("tlh", unde), -- "Klingon; tlhIngan-Hol", "klingon"
("tli", unde), -- "Tlingit", "tlingit"
("tmh", unde), -- "Tamashek", "tamacheq"
("tog", unde), -- "Tonga (Nyasa)", "tonga (Nyasa)"
("ton", "to"), -- "Tonga (Tonga Islands)", "tongan (Îles Tonga)"
("tpi", unde), -- "Tok Pisin", "tok pisin"
("tsi", unde), -- "Tsimshian", "tsimshian"
("tsn", "tn"), -- "Tswana", "tswana"
("tso", "ts"), -- "Tsonga", "tsonga"
("tuk", "tk"), -- "Turkmen", "turkmène"
("tum", unde), -- "Tumbuka", "tumbuka"
("tup", unde), -- "Tupi languages", "tupi, langues"
("tur", "tr"), -- "Turkish", "turc"
("tut", unde), -- "Altaic languages", "altaïques, langues"
("tvl", unde), -- "Tuvalu", "tuvalu"
("twi", "tw"), -- "Twi", "twi"
("tyv", unde), -- "Tuvinian", "touva"
("udm", unde), -- "Udmurt", "oudmourte"
("uga", unde), -- "Ugaritic", "ougaritique"
("uig", "ug"), -- "Uighur; Uyghur", "ouïgour"
("ukr", "uk"), -- "Ukrainian", "ukrainien"
("umb", unde), -- "Umbundu", "umbundu"
("urd", "ur"), -- "Urdu", "ourdou"
("uzb", "uz"), -- "Uzbek", "ouszbek"
("vai", unde), -- "Vai", "vaï"
("ven", "ve"), -- "Venda", "venda"
("vie", "vi"), -- "Vietnamese", "vietnamien"
("vol", "vo"), -- "Volapük", "volapük"
("vot", unde), -- "Votic", "vote"
("wak", unde), -- "Wakashan languages", "wakashanes, langues"
("wal", unde), -- "Wolaitta; Wolaytta", "wolaitta; wolaytta"
("war", unde), -- "Waray", "waray"
("was", unde), -- "Washo", "washo"
("wen", unde), -- "Sorbian languages", "sorabes, langues"
("wln", "wa"), -- "Walloon", "wallon"
("wol", "wo"), -- "Wolof", "wolof"
("xal", unde), -- "Kalmyk; Oirat", "kalmouk; oïrat"
("xho", "xh"), -- "Xhosa", "xhosa"
("yao", unde), -- "Yao", "yao"
("yap", unde), -- "Yapese", "yapois"
("yid", "yi"), -- "Yiddish", "yiddish"
("yor", "yo"), -- "Yoruba", "yoruba"
("ypk", unde), -- "Yupik languages", "yupik, langues"
("zap", unde), -- "Zapotec", "zapotèque"
("zbl", unde), -- "Blissymbols; Blissymbolics; Bliss",
-- "symboles Bliss; Bliss"
("zen", unde), -- "Zenaga", "zenaga"
("zha", "za"), -- "Zhuang; Chuang", "zhuang; chuang"
("znd", unde), -- "Zande languages", "zandé, langues"
("zul", "zu"), -- "Zulu", "zoulou"
("zun", unde), -- "Zuni", "zuni"
("zza", unde)); -- "Zaza; Dimili; Dimli; Kirdki; Kirmanjki; Zazaki",
-- "zaza; dimili; dimli; kirdki; kirmanjki; zazaki"
-- mis, mul, qaa-qtz, und, zxx are excluded
Lang_Map_3 : Language_Table_Array_Access;
Lang_Map_3_Flag : aliased System.Once.Flag := 0;
procedure Lang_Map_3_Init;
procedure Lang_Map_3_Init is
begin
-- copy table
Lang_Map_3 := new Language_Table_Array'(Language_Table);
-- check duplicated?
pragma Check (Validate,
Check =>
(for all I in Lang_Map_3'First .. Lang_Map_3'Last - 1 =>
(for all J in I + 1 .. Lang_Map_3'Last =>
Lang_Map_3 (I).Alpha_3 /= Lang_Map_3 (J).Alpha_3)));
-- sort
for I in Lang_Map_3'First + 1 .. Lang_Map_3'Last loop
for J in reverse Lang_Map_3'First .. I - 1 loop
exit when Compare (
Lang_Map_3 (J + 1).Alpha_3,
Lang_Map_3 (J).Alpha_3) >= 0;
declare
Temp : constant Language_Table_Element := Lang_Map_3 (J);
begin
Lang_Map_3 (J) := Lang_Map_3 (J + 1);
Lang_Map_3 (J + 1) := Temp;
end;
end loop;
end loop;
end Lang_Map_3_Init;
function To_Alpha_2 (Item : ISO_639_Alpha_3) return ISO_639_Alpha_2 is
pragma Check (Dynamic_Predicate,
Check => (for all E of Item => E in 'a' .. 'z'));
begin
System.Once.Initialize (Lang_Map_3_Flag'Access, Lang_Map_3_Init'Access);
declare
First : Positive := Lang_Map_3'First;
Last : Natural := Lang_Map_3'Last;
begin
while First <= Last loop
declare
Middle : constant Positive := (First + Last) / 2;
Middle_Item : Language_Table_Element
renames Lang_Map_3 (Middle);
Compared : constant Integer :=
Compare (Middle_Item.Alpha_3, Alpha_3_NP (Item));
begin
if Compared > 0 then
Last := Middle - 1;
elsif expect (Long_Boolean (Compared < 0), True) then
First := Middle + 1;
else
return (
1 => Middle_Item.Alpha_2 (1),
2 => Middle_Item.Alpha_2 (2));
end if;
end;
end loop;
return ISO_639_Alpha_2_Unknown;
end;
end To_Alpha_2;
Lang_Map_2 : Language_Table_Array_Access;
Lang_Map_2_Flag : aliased System.Once.Flag := 0;
procedure Lang_Map_2_Init;
procedure Lang_Map_2_Init is
begin
-- copy table
-- select terminology (second)
declare
Num : Natural := 0;
J : Positive;
begin
for I in Language_Table'Range loop
if Language_Table (I).Alpha_2 /= unde
and then (
I = Language_Table'Last
or else Language_Table (I).Alpha_2 /=
Language_Table (I + 1).Alpha_2)
then
Num := Num + 1;
end if;
end loop;
Lang_Map_2 := new Language_Table_Array (1 .. Num);
J := Lang_Map_2'First;
for I in Language_Table'Range loop
if Language_Table (I).Alpha_2 /= unde
and then (
I = Language_Table'Last
or else Language_Table (I).Alpha_2 /=
Language_Table (I + 1).Alpha_2)
then
Lang_Map_2 (J) := Language_Table (I);
J := J + 1;
end if;
end loop;
end;
-- check duplicated?
pragma Check (Validate,
Check =>
(for all I in Lang_Map_2'First .. Lang_Map_2'Last - 1 =>
(for all J in I + 1 .. Lang_Map_2'Last =>
Lang_Map_2 (I).Alpha_2 /= Lang_Map_2 (J).Alpha_2)));
-- sort
for I in Lang_Map_2'First + 1 .. Lang_Map_2'Last loop
for J in reverse Lang_Map_2'First .. I - 1 loop
exit when Compare (
Lang_Map_2 (J + 1).Alpha_2,
Lang_Map_2 (J).Alpha_2) >= 0;
declare
Temp : constant Language_Table_Element := Lang_Map_2 (J);
begin
Lang_Map_2 (J) := Lang_Map_2 (J + 1);
Lang_Map_2 (J + 1) := Temp;
end;
end loop;
end loop;
end Lang_Map_2_Init;
function To_Alpha_3 (Item : ISO_639_Alpha_2) return ISO_639_Alpha_3 is
pragma Check (Dynamic_Predicate,
Check => (for all E of Item => E in 'a' .. 'z'));
begin
System.Once.Initialize (Lang_Map_2_Flag'Access, Lang_Map_2_Init'Access);
declare
First : Positive := Lang_Map_2'First;
Last : Natural := Lang_Map_2'Last;
begin
while First <= Last loop
declare
Middle : constant Positive := (First + Last) / 2;
Middle_Item : Language_Table_Element
renames Lang_Map_2 (Middle);
Compared : constant Integer :=
Compare (Middle_Item.Alpha_2, Alpha_2_NP (Item));
begin
if Compared > 0 then
Last := Middle - 1;
elsif expect (Long_Boolean (Compared < 0), True) then
First := Middle + 1;
else
return (
1 => Middle_Item.Alpha_3 (1),
2 => Middle_Item.Alpha_3 (2),
3 => Middle_Item.Alpha_3 (3));
end if;
end;
end loop;
return ISO_639_Alpha_3_Unknown;
end;
end To_Alpha_3;
function Language return ISO_639_Alpha_2
renames System.Native_Locales.Language;
function Language return ISO_639_Alpha_3
renames System.Native_Locales.Language;
function Country return ISO_3166_1_Alpha_2
renames System.Native_Locales.Country;
end Ada.Locales;
|
reznikmm/matreshka | Ada | 3,674 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Elements;
package ODF.DOM.Meta_Printed_By_Elements is
pragma Preelaborate;
type ODF_Meta_Printed_By is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Meta_Printed_By_Access is
access all ODF_Meta_Printed_By'Class
with Storage_Size => 0;
end ODF.DOM.Meta_Printed_By_Elements;
|
pvrego/adaino | Ada | 389 | adb | with System.Machine_Code;
-- =============================================================================
-- Package body AVR.INTERRUPTS
-- =============================================================================
package body AVR.WATCHDOG is
procedure Watchdog_Reset is
begin
System.Machine_Code.Asm ("wdr", Volatile => True);
end Watchdog_Reset;
end AVR.WATCHDOG;
|
thierr26/ada-keystore | Ada | 3,868 | ads | -----------------------------------------------------------------------
-- keystore-repository-data -- Data access and management for the keystore
-- 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.
-----------------------------------------------------------------------
with Ada.Streams;
with Util.Streams;
with Util.Encoders.AES;
with Keystore.IO;
with Keystore.Repository.Keys;
private package Keystore.Repository.Data is
-- Start offset of the data entry descriptor in the data block.
function Data_Entry_Offset (Index : in Natural) return IO.Block_Index is
(IO.BT_DATA_START + Stream_Element_Offset (Index * DATA_ENTRY_SIZE) - DATA_ENTRY_SIZE - 1);
-- Write the data in one or several blocks.
procedure Add_Data (Manager : in out Wallet_Repository;
Iterator : in out Keys.Data_Key_Iterator;
Content : in Ada.Streams.Stream_Element_Array;
Offset : in out Interfaces.Unsigned_64);
procedure Add_Data (Manager : in out Wallet_Repository;
Iterator : in out Keys.Data_Key_Iterator;
Content : in out Util.Streams.Input_Stream'Class;
Offset : in out Interfaces.Unsigned_64);
-- Update the data fragments.
procedure Update_Data (Manager : in out Wallet_Repository;
Iterator : in out Keys.Data_Key_Iterator;
Content : in Ada.Streams.Stream_Element_Array;
Last_Pos : out Ada.Streams.Stream_Element_Offset;
Offset : in out Interfaces.Unsigned_64);
procedure Update_Data (Manager : in out Wallet_Repository;
Iterator : in out Keys.Data_Key_Iterator;
Content : in out Util.Streams.Input_Stream'Class;
End_Of_Stream : out Boolean;
Offset : in out Interfaces.Unsigned_64);
-- Erase the data fragments starting at the key iterator current position.
procedure Delete_Data (Manager : in out Wallet_Repository;
Iterator : in out Keys.Data_Key_Iterator);
-- Get the data associated with the named entry.
procedure Get_Data (Manager : in out Wallet_Repository;
Iterator : in out Keys.Data_Key_Iterator;
Output : out Ada.Streams.Stream_Element_Array);
-- Get the data associated with the named entry and write it in the output stream.
procedure Get_Data (Manager : in out Wallet_Repository;
Iterator : in out Keys.Data_Key_Iterator;
Output : in out Util.Streams.Output_Stream'Class);
private
-- Find the data block to hold a new data entry that occupies the given space.
-- The first data block that has enough space is used otherwise a new block
-- is allocated and initialized.
procedure Allocate_Data_Block (Manager : in out Wallet_Repository;
Space : in IO.Block_Index;
Work : in Workers.Data_Work_Access);
end Keystore.Repository.Data;
|
AdaCore/libadalang | Ada | 3,107 | ads | with Langkit_Support.Token_Data_Handlers;
with Libadalang.Analysis;
with Libadalang.Common;
package Highlighter is
package LAL renames Libadalang.Analysis;
package LALCO renames Libadalang.Common;
subtype Token_Index is Langkit_Support.Token_Data_Handlers.Token_Index;
type Highlight_Type is
(Text,
Comment,
Keyword,
Keyword_Type,
Keyword_Special,
Punctuation,
Punctuation_Special,
Operator,
Preprocessor_Directive,
Integer_Literal,
String_Literal,
Character_Literal,
Identifier,
Label_Name,
Block_Name,
Type_Name,
Attribute_Name);
-- Highlighting "category": keyword, comment, identifier, ...
function Highlight_Name (H : Highlight_Type) return String is
(Highlight_Type'Image (H));
-- Return an unique name for a given highlighting type
type Highlights_Holder (Token_Count, Trivia_Count : Token_Index) is
limited private;
-- Annotations on a set of tokens. Provides highlighting types for all
-- tokens/trivias.
function Get
(Highlights : Highlights_Holder;
Token : LALCO.Token_Data_Type) return Highlight_Type;
-- Return the annotation in Highlights corresponding to Token
procedure Set
(Highlights : in out Highlights_Holder;
Token : LALCO.Token_Data_Type;
HL : Highlight_Type);
-- Assign the HL highlighting type to Token
procedure Set_Range
(Highlights : in out Highlights_Holder;
First, Last : LALCO.Token_Reference;
HL : Highlight_Type);
-- Likewise, for a range of tokens
function Highlights_Match_Unit
(Unit : LAL.Analysis_Unit;
Highlights : Highlights_Holder) return Boolean
is (Natural (Highlights.Token_Count) = LAL.Token_Count (Unit)
and then
Natural (Highlights.Trivia_Count) = LAL.Trivia_Count (Unit));
-- Return whether Highlights has the appropriate number of tokens/trivias
-- to annotate the tokens in Unit.
procedure Highlight
(Unit : LAL.Analysis_Unit;
Highlights : in out Highlights_Holder)
with Pre => Highlights_Match_Unit (Unit, Highlights);
-- Compute highlighting types for all tokens in Unit
generic
with procedure Put_Token
(Token : LALCO.Token_Reference;
Data : LALCO.Token_Data_Type;
HL : Highlight_Type) is <>;
with procedure New_Line is <>;
with procedure Add_Whitespace (C : Character) is <>;
procedure Put_Tokens
(Unit : LAL.Analysis_Unit;
Highlights : Highlights_Holder)
with Pre => Highlights_Match_Unit (Unit, Highlights);
-- Using the given output primitives, output the token stream from Unit
-- with the given highlightings.
private
type Highlight_Array is array (Token_Index range <>) of Highlight_Type;
type Highlights_Holder (Token_Count, Trivia_Count : Token_Index) is
limited record
Token_Highlights : Highlight_Array (1 .. Token_Count);
Trivia_Highlights : Highlight_Array (1 .. Trivia_Count);
end record;
end Highlighter;
|
onox/orka | Ada | 4,028 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2021 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Unchecked_Conversion;
with Orka.SIMD.AVX2.Integers.Arithmetic;
with Orka.SIMD.AVX2.Integers.Convert;
with Orka.SIMD.AVX2.Integers.Logical;
with Orka.SIMD.AVX2.Integers.Shift;
package body Orka.SIMD.AVX2.Integers.Random is
-- This is an Ada port of xoshiro128++ random number generator.
--
-- https://arxiv.org/abs/1805.01407
-- doi:10.1145/3460772
-- https://arxiv.org/abs/1910.06437
--
-- David Blackman and Sebastiano Vigna.
-- Scrambled linear pseudorandom number generators. ACM Trans. Math. Softw., 47:1−32, 2021.
--
-- The following comment is from https://prng.di.unimi.it/xoshiro128plusplus.c:
--
-- /* Written in 2019 by David Blackman and Sebastiano Vigna ([email protected])
--
-- To the extent possible under law, the author has dedicated all copyright
-- and related and neighboring rights to this software to the public domain
-- worldwide. This software is distributed without any warranty.
--
-- See <http://creativecommons.org/publicdomain/zero/1.0/>. */
--
-- /* This is xoshiro128++ 1.0, one of our 32-bit all-purpose, rock-solid
-- generators. It has excellent speed, a state size (128 bits) that is
-- large enough for mild parallelism, and it passes all tests we are aware
-- of.
--
-- For generating just single-precision (i.e., 32-bit) floating-point
-- numbers, xoshiro128+ is even faster.
--
-- The state must be seeded so that it is not everywhere zero. */
procedure Next (S : in out State; Value : out m256i) is
use Orka.SIMD.AVX2.Integers.Arithmetic;
use Orka.SIMD.AVX2.Integers.Logical;
use Orka.SIMD.AVX2.Integers.Shift;
function Rotate_Left (X : m256i; K : Bits_Count) return m256i is
(Shift_Bits_Left_Zeros (X, K) or Shift_Bits_Right_Zeros (X, Unsigned_32'Size - K));
-- xoshiro128++ (xoshiro128+ is just S (0) + S (3))
Result : constant m256i := Rotate_Left (S (0) + S (3), 7) + S (0);
T : constant m256i := Shift_Bits_Left_Zeros (S (1), 9);
begin
S (2) := S (2) xor S (0);
S (3) := S (3) xor S (1);
S (1) := S (1) xor S (2);
S (0) := S (0) xor S (3);
S (2) := S (2) xor T;
S (3) := Rotate_Left (S (3), 11);
Value := Result;
end Next;
procedure Next (S : in out State; Value : out m256) is
Result : m256i;
begin
Next (S, Result);
Value := SIMD.AVX2.Integers.Convert.To_Unit_Floats (Result);
end Next;
procedure Reset (S : out State; Seed : Duration) is
Value : constant Unsigned_32 := Unsigned_32 (Unsigned_64 (Seed) mod Unsigned_32'Modulus);
function Convert is new Ada.Unchecked_Conversion (Unsigned_32, Integer_32);
function Rotate_Left (X : Unsigned_32; K : Natural) return Unsigned_32 is
((X * 2**K) or (X / 2**(Unsigned_32'Size - K)));
begin
for I in S'Range loop
S (I) :=
(Convert (Rotate_Left (Value, 1)),
Convert (Rotate_Left (Value, 2)),
Convert (Rotate_Left (Value, 3)),
Convert (Rotate_Left (Value, 4)),
Convert (Rotate_Left (Value, 5)),
Convert (Rotate_Left (Value, 6)),
Convert (Rotate_Left (Value, 7)),
Convert (Rotate_Left (Value, 8)));
end loop;
end Reset;
end Orka.SIMD.AVX2.Integers.Random;
|
AdaCore/gpr | Ada | 47 | ads | package Pkg is
Var : Integer := 4;
end Pkg;
|
osannolik/ada-canopen | Ada | 1,349 | ads | private with System;
private with ACO.Utils.DS.Generic_Collection;
private with ACO.Utils.Scope_Locks;
generic
type Item_Type is private;
Max_Nof_Subscribers : Positive;
package ACO.Utils.Generic_Pubsub is
pragma Preelaborate;
type Sub is abstract tagged null record;
type Sub_Access is access all Sub'Class;
procedure Update
(This : access Sub;
Data : in Item_Type) is abstract;
type Pub is abstract tagged limited private;
procedure Update
(This : in out Pub;
Data : in Item_Type);
function Nof_Subscribers (This : in out Pub) return Natural;
procedure Attach
(This : in out Pub;
Subscriber : in Sub_Access)
with Pre => This.Nof_Subscribers < Max_Nof_Subscribers;
procedure Detach
(This : in out Pub;
Subscriber : in Sub_Access);
private
package C is new ACO.Utils.DS.Generic_Collection
(Item_Type => Sub_Access,
"=" => "=");
type Pub is tagged limited record
Subscribers : C.Collection (Max_Size => Max_Nof_Subscribers);
Mutex : aliased ACO.Utils.Scope_Locks.Mutex (System.Priority'Last);
end record;
type Sub_Array is array (Positive range <>) of Sub_Access;
function Get_Subscribers
(This : in out Pub)
return Sub_Array;
end ACO.Utils.Generic_Pubsub;
|
zhmu/ananas | Ada | 4,567 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . I M A G E _ R --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains routines for the Image attribute of real types, and
-- is also for Float_IO/Fixed_IO output.
generic
type Num is digits <>;
Maxpow : Positive;
Powten_Address : System.Address;
type Uns is mod <>;
with procedure Set_Image_Unsigned
(V : Uns;
S : in out String;
P : in out Natural);
package System.Image_R is
pragma Pure;
procedure Image_Fixed_Point
(V : Num;
S : in out String;
P : out Natural;
Aft : Natural);
-- Computes fixed_type'Image (V) and returns the result in S (1 .. P)
-- updating P on return. The result is computed according to the rules for
-- image for fixed-point types (RM 3.5(34)), where Aft is the value of the
-- Aft attribute for the fixed-point type. The caller guarantees that S is
-- long enough to hold the result and has a lower bound of 1.
--
-- Note: this procedure should NOT be called with V = -0.0 or V = +/-Inf.
procedure Image_Floating_Point
(V : Num;
S : in out String;
P : out Natural;
Digs : Natural);
-- Computes Uns'Image (V) and returns the result in S (1 .. P) updating P
-- on return. The result is computed according to the rules for image for
-- floating-point types (RM 3.5(33)), where Digs is the value of the Digits
-- attribute for the floating-point type. The caller guarantees that S is
-- long enough to hold the result and has a lower bound of 1.
procedure Set_Image_Real
(V : Num;
S : in out String;
P : in out Natural;
Fore : Natural;
Aft : Natural;
Exp : Natural);
-- Sets the image of V starting at S (P + 1), updating P to point to the
-- last character stored, the caller promises that the buffer is large
-- enough and no check is made for this. Constraint_Error will not
-- necessarily be raised if this is violated, since it is perfectly valid
-- to compile this unit with checks off). The Fore, Aft and Exp values
-- can be set to any valid values for the case of use from Text_IO. Note
-- that no space is stored at the start for non-negative values.
end System.Image_R;
|
skordal/cupcake | Ada | 3,445 | ads | -- The Cupcake GUI Toolkit
-- (c) Kristian Klomsten Skordal 2012 <[email protected]>
-- Report bugs and issues on <http://github.com/skordal/cupcake/issues>
-- vim:ts=3:sw=3:et:si:sta
with Cupcake.Colors;
with Cupcake.Primitives;
with Cupcake.Backends;
private with Ada.Containers.Doubly_Linked_Lists;
package Cupcake.Windows is
-- Normal window type:
type Window_Record (<>) is tagged limited private;
type Window is access all Window_Record'Class;
-- Creates a new window:
function New_Window (Width, Height : in Positive; Title : in String)
return Window;
function New_Window (Size : in Primitives.Dimension; Title : in String)
return Window;
-- Destroys a window:
procedure Destroy (Object : not null access Window_Record);
-- Sets the visibility of a window; this is used to show and close windows:
procedure Set_Visible (This : access Window_Record'Class;
Visible : Boolean := True);
-- Window size operations:
function Get_Size (This : in Window_Record'Class)
return Primitives.Dimension with Inline, Pure_Function;
procedure Set_Size (This : in out Window_Record'Class;
Size : in Primitives.Dimension) with Inline;
-- Window color operations:
function Get_Background_Color (This : in Window_Record'Class)
return Colors.Color with Inline, Pure_Function;
procedure Set_Background_Color (This : out Window_Record'Class;
Color : in Colors.Color) with Inline;
-- Expose handler for windows:
procedure Expose_Handler (This : in Window_Record'Class);
-- Resize handler for windows:
procedure Resize_Handler (This : in out Window_Record'Class;
New_Size : in Primitives.Dimension);
-- Close event handler for windows; returns true if the window should
-- close:
function Close_Handler (This : in Window_Record'Class) return Boolean;
---- BACKEND OPERATIONS: ----
-- Posts an expose event to a window; this causes a redraw of the entire
-- window:
procedure Post_Expose (ID : in Backends.Window_ID_Type);
pragma Export (C, Post_Expose);
procedure Post_Expose (This : in Window_Record'Class);
-- Posts a resize event to a window:
procedure Post_Resize (ID : in Backends.Window_ID_Type;
Width, Height : in Natural);
pragma Export (C, Post_Resize);
procedure Post_Resize (ID : in Backends.Window_ID_Type;
New_Size : in Primitives.Dimension);
-- Posts a close request to a window:
procedure Post_Close_Event (ID : in Backends.Window_ID_Type);
pragma Export (C, Post_Close_Event);
private
-- List of active (visible) windows, for event propagation:
package Window_Lists is new Ada.Containers.Doubly_Linked_Lists (
Element_Type => Window);
Visible_Window_List : Window_Lists.List;
-- Gets a window pointer by ID if the window is visible; returns null
-- otherwise:
function Get_Visible_Window (ID : in Backends.Window_ID_Type) return Window;
function Get_Visible_Window (ID : in Backends.Window_ID_Type)
return Backends.Window_Data_Pointer;
pragma Export (C, Get_Visible_Window);
-- Normal window type definition:
type Window_Record is tagged limited record
Size : Primitives.Dimension;
Background_Color : Colors.Color := Colors.DEFAULT_BACKGROUND_COLOR;
Backend_Data : Backends.Window_Data_Pointer;
ID : Backends.Window_ID_Type;
end record;
end Cupcake.Windows;
|
Hamster-Furtif/JeremyPlusPlus | Ada | 8,542 | ads | with utils; use utils;
package read_preflop is
Type T_array_chance is Private;
-- / E : card1, card2 : T_card
-- nécessite : card1 differente de card2
-- / S : p : float
-- entraine : renvoie la probabilite p de gagner avec la main card1 et card2
Function Get_Winning_Chance (card1 : T_card; card2 : T_card) return Float;
-- / E : card1, card2 : T_card
-- nécessite : card1 differente de card2
-- / S : p : float
-- entraine : renvoie la probabilite p de perdre avec la main card1 et card2
Function Get_Losing_Chance (card1 : T_card; card2 : T_card) return Float;
-- / E : card1, card2 : T_card
-- nécessite : card1 differente de card2
-- / S : p : float
-- entraine : renvoie la probabilite p d'egalite avec la main card1 et card2
Function Get_Tie_Chance (card1 : T_card; card2 : T_card) return Float;
Private
Type T_array_chance is Array(0..168) of Integer;
WIN_ARRAY : constant T_array_chance := (1781508418,1389004215,1370002117,1350786717,1331725962,1290209940,1269195105,1245678450,1220344506,1217936943,1198506708,1181668536,1164284001,
1352291878,1722470558,1309061790,1289515286,1270857555,1229977429,1191219968,1171417014,1149567662,1129204024,1109381784,1092208613,1074795095,
1332142795,1267610255,1670338644,1239054394,1220171285,1179313858,1141436364,1101718156,1084009562,1063751334,1043815735,1026518567,1008970414,
1311720573,1246822903,1193649409,1618339604,1177887186,1135038051,1097274797,1058318785,1018879951,1003078936,983104243,965759044,948153923,
1291435142,1226959959,1173537003,1129039428,1566053110,1098642842,1059465943,1020494848,981668027,942628592,927212359,909895095,892310673,
1247001366,1183191163,1129794528,1083173398,1044920282,1503238936,1024795719,985655348,947078416,908515397,868544377,855951949,838461663,
1224440175,1141742922,1089280295,1042779957,1003019374,966316620,1441396848,958257237,919124997,880780296,841184813,803004465,790348964,
1199171976,1120467131,1046780178,1001090143,961312472,924443362,895522755,1378636878,898379280,859564300,820337671,782469104,743376257,
1171920110,1096969965,1027737078,958874577,919746160,883149152,853640324,831767413,1315178390,846332445,807166360,769503449,730742786,
1169234974,1075088026,1005974746,941907501,877990854,841896769,812626207,790253778,776369338,1250992922,808247748,771039857,732672291,
1148061584,1053508976,984280928,920178475,861166500,798877137,770001459,748030580,734213031,735719749,1180021110,749407203,711453440,
1129654161,1034758983,965405538,901258949,842284099,785077590,728903246,707257588,693662773,695659494,672613963,1108341244,694128063,
1110608066,1015702916,946213445,882013792,823068840,765970787,714995931,665146081,651897304,654312693,631734409,613318625,1035889822);
-- va de l'as au 2
-- surdiagonale : meme couleur
-- diagonale et sous-diagonale : couleurs differentes
LOSE_ARRAY : constant T_array_chance := (304661670,673957209,690016869, 705041543, 719134692, 754019509, 768134954, 784885484, 804780676, 801655845, 819532598, 836814184, 854728551,
709592683,363424882,746895468, 762297170, 776310470, 810946418, 842504852, 855198011, 870979191, 886182741, 904464207, 922096479, 940058441,
726706236,787022855,414934680, 808665883, 822993463, 857784464, 888983752, 921231985, 932457169, 947570537, 965983128, 983759701, 1001879140,
742722264,803451257,852387398, 465955440, 862082680, 897489212, 928812709, 960790848, 993461269, 1003630618,1022100069,1039944977,1058144226,
757743309,818398367,867678116, 908890685, 516772724, 929682183, 961535711, 993686298, 1026108216,1059410559,1072763176,1090600453,1108801845,
795066539,855469612,904916521, 946780981, 980664407, 577905278, 991202871, 1022667806,1054965342,1087988954,1126043589,1138526088,1156656186,
810270096,889187966,938263805, 980265461, 1014712347,1046148851,637479762, 1044830752,1076725291,1109625751,1147362116,1185874183,1198467986,
828271026,902850280,972707935, 1014433489,1049069216,1079755744,1103148347,697512212, 1092540371,1124884696,1162270840,1200476022,1240253676,
849630112,919797298,984776601, 1049310444,1083692281,1114245195,1137194278,1153839298,757863966, 1134396836,1170746176,1208585765,1248047597,
846354213,936062067,1000937099,1060173322,1119171845,1149436843,1172253905,1188290423,1198220417,817847556, 1166789139,1203435009,1242410576,
865741863,955868151,1020875843,1080165166,1133678575,1190239950,1212723838,1228381882,1237190410,1232622607,885403592, 1225893915,1263995344,
884464630,974949238,1040102775,1099456682,1152953414,1203773415,1253975431,1269312307,1277726314,1271872234,1295765244,953411342, 1282101494,
903847893,994361217,1059673784,1119103759,1172593597,1223328146,1267594076,1311884399,1319968310,1313594570,1336529218,1355723830,1021877238);
-- va de l'as au 2
-- surdiagonale : meme couleur
-- diagonale et sous-diagonale : couleurs differentes
TIE_ARRAY : constant T_array_chance := (11402312,34610976,37553414,41744140,46711746,53342951,60242341,67008466,72447218,77979612,79533094,79089680,78559848,
35687839,11676960,41615142,45759944,50404375,56648553,63847580,70957375,77025547,82185635,83726409,83267308,82718864,
38723369,42939290,12299076,49852123,54407652,60474078,67152284,74622259,81105669,86250529,87773537,87294132,86722846,
43129563,47298240,51535593,13277356,57602534,65045137,71484894,78462767,85231180,90862846,92368088,91868379,91274251,
48393949,52214074,56357281,59642287,14746566,69247375,76570746,83391254,89796157,95533249,97596865,97076852,96459882,
55504495,58911625,62861351,67618021,71987711,16428186,81573810,89249246,95528642,101068049,102984434,103094363,102454551,
62862129,66641512,70028300,74526982,79840679,85106929,18695790,94484411,101722112,107166353,109025471,108693752,108755450,
70129398,74254989,78084287,82048768,87190712,93373294,98901298,21423310,106652749,113123404,114963889,114627274,113942467,
76022178,80805137,85058721,89387379,94133959,100178053,106737798,111965689,24530044,116843119,119659864,119483186,118782017,
81983213,86422307,90660555,95491577,100409701,106238788,112692288,119028199,122982645,28731922,122535513,123097534,122489533,
83768953,88195273,92415629,97228759,102727325,108455313,114847103,121159938,126168959,129230044,32147698,122271282,122123616,
83453609,87864179,92064087,96856769,102334887,108721395,114693723,121002505,126183313,130040672,129193193,35819814,121342843,
83116441,87508267,91685171,96454849,101909963,108273467,114982393,120541920,125706786,129665137,129308773,128529945,39805340);
-- va de l'as au 2
-- surdiagonale : meme couleur
-- diagonale et sous-diagonale : couleurs differentes
-- / E : x,y : entiers
-- / E : lst : T_array_chance
-- / necessite : 1 <= x,y <= 13
-- / S : integer
--entraine : donne l'entier de la case (x,y) du tableau lst
function getFromArray(lst : T_array_chance; x : Integer; y : Integer) return Integer;
end read_preflop;
|
reznikmm/matreshka | Ada | 5,612 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-2011, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Containers.Vectors;
with Ada.Strings.Wide_Unbounded;
with Asis;
package Scanner_Extractor is
package Unbounded_Wide_String_Vectors is
new Ada.Containers.Vectors
(Positive,
Ada.Strings.Wide_Unbounded.Unbounded_Wide_String,
Ada.Strings.Wide_Unbounded."=");
type Choice_Information (Is_Empty : Boolean := True) is record
case Is_Empty is
when True =>
null;
when False =>
Choice : Positive;
Line : Positive;
File : Ada.Strings.Wide_Unbounded.Unbounded_Wide_String;
Text : Unbounded_Wide_String_Vectors.Vector;
end case;
end record;
package Choice_Vectors is
new Ada.Containers.Vectors (Positive, Choice_Information);
type State_Constant_Information is record
Name : Ada.Strings.Wide_Unbounded.Unbounded_Wide_String;
Value : Integer;
end record;
package State_Constants_Vectors is
new Ada.Containers.Vectors (Positive, State_Constant_Information);
package Integer_Vectors is
new Ada.Containers.Vectors (Natural, Integer);
type Plane_Information is record
Number : Natural;
Values : Integer_Vectors.Vector;
end record;
type Reference_Information is record
Number : Natural;
Reference : Natural;
end record;
package Plane_Vectors is
new Ada.Containers.Vectors (Positive, Plane_Information);
package Reference_Vectors is
new Ada.Containers.Vectors (Positive, Reference_Information);
YY_End_Of_Buffer : Integer := -1;
YY_Jam_State : Integer := -1;
YY_Jam_Base : Integer := -1;
YY_First_Template : Integer := -1;
State_Constants : State_Constants_Vectors.Vector;
YY_EC_Planes : Plane_Vectors.Vector;
YY_EC_Base : Reference_Vectors.Vector;
YY_EC_Base_Others : Natural;
YY_Accept : Integer_Vectors.Vector;
YY_Meta : Integer_Vectors.Vector;
YY_Base : Integer_Vectors.Vector;
YY_Def : Integer_Vectors.Vector;
YY_Nxt : Integer_Vectors.Vector;
YY_Chk : Integer_Vectors.Vector;
Choices : Choice_Vectors.Vector;
procedure Extract (Element : Asis.Element);
end Scanner_Extractor;
|
NCommander/dnscatcher | Ada | 9,268 | adb | -- Copyright 2019 Michael Casadevall <[email protected]>
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to
-- deal in the Software without restriction, including without limitation the
-- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-- sell copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
with Ada.Characters.Latin_1;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Containers.Indefinite_Ordered_Maps;
package body DNSCatcher.Config is
-- Parse_Procedure prototype
--
-- Parse_Procedure is an access procedure that is used as a common prototype
-- for all parsing functionality dispatched from GCP_Management and other
-- vectors.
--
-- @value Config
-- Configuration struct to update
--
-- @value Value_Str
-- Pure text version of the configuration argument
--
type Parse_Procedure is access procedure
(Config : in out Configuration;
Value_Str : String);
-- GCP_Management is a vector that handles dynamic dispatch to the
-- parsing parameters above; it is used to match key/values from the
-- config file to
package GCP_Management is new Ada.Containers.Indefinite_Ordered_Maps
(String, Parse_Procedure);
GCP_Map : GCP_Management.Map;
-- Configuration constructor
procedure Initialize (Config : in out Configuration) is
begin
-- We initialize the ports to 53 by default
Config.Local_Listen_Port := 53;
Config.Upstream_DNS_Server_Port := 53;
-- No upstream server is set
Config.Upstream_DNS_Server := To_Unbounded_String ("");
end Initialize;
-- Loads the load listen value and sets it in the config record
--
-- @value Config
-- Configuration struct to update
--
-- @value Value_Str
-- Pure text version of the configuration argument
--
procedure Parse_Local_Listen_Port
(Config : in out Configuration;
Value_Str : String)
is
begin
Config.Local_Listen_Port := Port_Type'Value (Value_Str);
exception
when Constraint_Error =>
raise Malformed_Line with "Local_Listen_Port not a valid port number";
end Parse_Local_Listen_Port;
-- Loads the upstream DNS Server from the config file
--
-- @value Config
-- Configuration struct to update
--
-- @value Value_Str
-- Pure text version of the configuration argument
--
procedure Parse_Upstream_DNS_Server
(Config : in out Configuration;
Value_Str : String)
is
begin
Config.Upstream_DNS_Server := To_Unbounded_String (Value_Str);
exception
when Constraint_Error =>
raise Malformed_Line with "Invalid upstrema DNS Server";
end Parse_Upstream_DNS_Server;
-- Loads the upstream DNS Server port from the config file
--
-- @value Config
-- Configuration struct to update
--
-- @value Value_Str
-- Pure text version of the configuration argument
--
procedure Parse_Upstream_DNS_Server_Port
(Config : in out Configuration;
Value_Str : String)
is
begin
Config.Upstream_DNS_Server_Port := Port_Type'Value (Value_Str);
exception
when Constraint_Error =>
raise Malformed_Line
with "Upstream_DNS_Server_Port not a valid port number";
end Parse_Upstream_DNS_Server_Port;
procedure Initialize_Config_Parse is
begin
-- Load String to Type Mapping
GCP_Map.Insert ("LOCAL_LISTEN_PORT", Parse_Local_Listen_Port'Access);
GCP_Map.Insert ("UPSTREAM_DNS_SERVER", Parse_Upstream_DNS_Server'Access);
GCP_Map.Insert
("UPSTREAM_DNS_SERVER_PORT", Parse_Upstream_DNS_Server_Port'Access);
end Initialize_Config_Parse;
procedure Read_Cfg_File
(Config : in out Configuration;
Config_File_Path : String)
is
Config_File : Ada.Text_IO.File_Type;
Line_Count : Integer := 1;
Exception_Message : Unbounded_String;
use GCP_Management;
begin
Initialize_Config_Parse;
-- Try to open the configuration file
Open
(File => Config_File,
Mode => Ada.Text_IO.In_File,
Name => Config_File_Path);
while not End_Of_File (Config_File)
loop
declare
Current_Line : constant String := Get_Line (Config_File);
Key_End_Loc : Integer := 0;
Equals_Loc : Integer := 0;
Value_Loc : Integer := 0;
Is_Whitespace : Boolean := True;
begin
-- Skip lines starting with a comment or blank
if Current_Line = ""
then
goto Config_Parse_Continue;
end if;
-- Has to be done seperately or it blows an index check
if Current_Line (1) = '#'
then
goto Config_Parse_Continue;
end if;
-- Skip line if its all whitespace
for I in Current_Line'range
loop
if Current_Line (I) /= ' ' and
Current_Line (I) /= Ada.Characters.Latin_1.HT
then
Is_Whitespace := False;
end if;
if Current_Line (I) = '='
then
Equals_Loc := I;
end if;
-- Determine length of the key
--
-- This is a little non-obvious at first glance. We subtract 2
-- here to remove the character we want, and the previous char
-- because a 17 char string will be 1..18 in the array.
if (Is_Whitespace or Current_Line (I) = '=') and Key_End_Loc = 0
then
Key_End_Loc := I - 2;
end if;
exit when Is_Whitespace and Equals_Loc /= 0;
-- We also want to confirm there's a = in there somewhere
end loop;
-- It's all whitespace, skip it
if Is_Whitespace
then
goto Config_Parse_Continue;
end if;
if Equals_Loc = 0
then
Exception_Message :=
To_Unbounded_String ("Malformed line (no = found) at");
Append (Exception_Message, Line_Count'Image);
Append (Exception_Message, ": ");
Append (Exception_Message, Current_Line);
raise Malformed_Line with To_String (Exception_Message);
end if;
-- Read in the essential values
for C in GCP_Map.Iterate
loop
-- Slightly annoying, but need to handle not reading past the
-- end of Current_Line. We also need to check that the next char
-- is a space or = so we don't match substrings by accident.
if Key_End_Loc = Key (C)'Length
then
if Key (C) = To_Upper (Current_Line
(1 .. Key (C)'Length))
then
-- Determine the starting character of the value
for I in Current_Line
(Equals_Loc + 1 .. Current_Line'Length)'range
loop
if Current_Line (I) /= ' ' and
Current_Line (I) /= Ada.Characters.Latin_1.HT
then
Value_Loc := I;
exit;
end if;
end loop;
-- If Value_Loc is zero, pass an empty string in
if Value_Loc = 0
then
Element (C).all (Config, "");
else
Element (C).all (Config, Current_Line
(Value_Loc .. Current_Line'Length));
end if;
end if;
end if;
end loop;
<<Config_Parse_Continue>>
Line_Count := Line_Count + 1;
end;
end loop;
-- Clean up
Close (Config_File);
-- Confirm mandatory values are set
if Config.Upstream_DNS_Server = ""
then
raise Missing_Mandatory_Config_Option
with "Upstream_DNS_Server must be set";
end if;
end Read_Cfg_File;
end DNSCatcher.Config;
|
gagath/cellular | Ada | 549 | ads | with Ada.Numerics.Discrete_Random;
package Cellular is
type CellularArray is array(Integer range <>) of Boolean;
package Boolean_Random is new Ada.Numerics.Discrete_Random(Boolean);
use Boolean_Random;
procedure Generate (Previous : in out CellularArray);
function "=" (Left, Right : in CellularArray) return Boolean;
function NextStep(Left, Cell, Right : in Boolean) return Boolean;
function NextArray(Previous : in CellularArray) return CellularArray;
procedure Put(Line : in CellularArray);
end Cellular;
|
eqcola/ada-ado | Ada | 1,369 | ads | -----------------------------------------------------------------------
-- ADO Objects Tests -- Tests for ADO.Objects
-- Copyright (C) 2011 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
package ADO.Objects.Tests is
type Test is new Util.Tests.Test with null record;
procedure Test_Key (T : in out Test);
procedure Test_Object_Ref (T : in out Test);
procedure Test_Create_Object (T : in out Test);
procedure Test_Delete_Object (T : in out Test);
-- Test Is_Inserted and Is_Null
procedure Test_Is_Inserted (T : in out Test);
-- Add the tests in the test suite
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
end ADO.Objects.Tests;
|
AdaCore/training_material | Ada | 2,745 | ads | -----------------------------------------------------------------------
-- Ada Labs --
-- --
-- Copyright (C) 2008-2009, AdaCore --
-- --
-- Labs is free software; you can redistribute it and/or modify it --
-- under the terms of the GNU General Public License as published by --
-- the Free Software Foundation; either version 2 of the License, or --
-- (at your option) any later version. --
-- --
-- This program is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. You should have received --
-- a copy of the GNU General Public License along with this program; --
-- if not, write to the Free Software Foundation, Inc., 59 Temple --
-- Place - Suite 330, Boston, MA 02111-1307, USA. --
-----------------------------------------------------------------------
with Display; use Display;
with Display.Basic; use Display.Basic;
package Solar_System is
-- define type Bodies_Enum as an enumeration of Sun, Earth, Moon, Satellite
type Bodies_Enum_T is
(Sun, Earth, Moon, Satellite, Comet, Black_Hole, Asteroid_1, Asteroid_2);
type Bodies_Array_T is private;
procedure Init_Body
(B : Bodies_Enum_T;
Bodies : in out Bodies_Array_T;
Radius : Float;
Color : RGBA_T;
Distance : Float;
Angle : Float;
Speed : Float;
Turns_Around : Bodies_Enum_T;
Visible : Boolean := True);
procedure Move_All (Bodies : in out Bodies_Array_T);
private
-- define a type Body_T to store every information about a body
-- X, Y, Distance, Speed, Angle, Radius, Color
type Body_T is record
X : Float := 0.0;
Y : Float := 0.0;
Distance : Float;
Speed : Float;
Angle : Float;
Radius : Float;
Color : RGBA_T;
Visible : Boolean := True;
Turns_Around : Bodies_Enum_T;
end record;
-- define type Bodies_Array as an array of Body_T indexed by bodies enumeration
type Bodies_Array_T is array (Bodies_Enum_T) of Body_T;
procedure Move (Body_To_Move : in out Body_T; Bodies : Bodies_Array_T);
end Solar_System;
|
onox/orka | Ada | 2,290 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2022 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Unchecked_Conversion;
with Orka.SIMD.AVX.Integers.Swizzle;
with Orka.SIMD.SSE2.Integers;
with Orka.SIMD.SSE2.Longs.Shift;
with Orka.SIMD.SSSE3.Longs.Shift;
package body Orka.SIMD.AVX.Longs.Shift.Emulation is
use SIMD.AVX.Integers;
use SIMD.AVX.Integers.Swizzle;
use SIMD.SSE2.Integers;
use SIMD.SSE2.Longs;
use SIMD.SSE2.Longs.Shift;
use SIMD.SSSE3.Longs.Shift;
function Convert is new Ada.Unchecked_Conversion (m256i, m256l);
function Convert is new Ada.Unchecked_Conversion (m256l, m256i);
function Convert is new Ada.Unchecked_Conversion (m128i, m128l);
function Convert is new Ada.Unchecked_Conversion (m128l, m128i);
function Shift_Elements_Left_Zeros (Elements : m256l) return m256l is
Low : constant m128l := Convert (Extract (Convert (Elements), 0));
High : constant m128l := Convert (Extract (Convert (Elements), 1));
begin
return Convert (Pack
(High => Convert (Align_Right_Bytes
(High, Low, (m128l'Length - 1) * m128l'Component_Size)),
Low => Convert (Shift_Elements_Left_Zeros (Low))));
end Shift_Elements_Left_Zeros;
function Shift_Elements_Right_Zeros (Elements : m256l) return m256l is
Low : constant m128l := Convert (Extract (Convert (Elements), 0));
High : constant m128l := Convert (Extract (Convert (Elements), 1));
begin
return Convert (Pack
(High => Convert (Shift_Elements_Right_Zeros (High)),
Low => Convert (Align_Right_Bytes (High, Low, m128l'Component_Size))));
end Shift_Elements_Right_Zeros;
end Orka.SIMD.AVX.Longs.Shift.Emulation;
|
Subsets and Splits