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/libadalang | Ada | 1,184 | adb | procedure Ea is
type T1 (D1 : Boolean;
D2, D3 : Positive) is
tagged record
C1 : String (1 .. D2);
C2 : String (1 .. D3);
case D1 is
when True =>
C3 : Integer;
when False =>
C4 : Positive;
end case;
end record;
type T2 is new T1 with record
C5 : Float;
end record;
type T3 is new T2 with record
C6 : Long_Float;
end record;
type T4 is new T3 with record
C7 : Boolean;
end record;
I1 : T1 := (True, 1, 4, "1", "four", 0);
pragma Test_Statement;
I2 : T2 := (I1 with 3.14);
pragma Test_Statement;
I2_2 : T2 := (True, 1, 4, "1", "four", 0, 3.14);
pragma Test_Statement;
I3 : T3 := (I1 with 3.14, 3.1416);
pragma Test_Statement;
I4 : T3 := (I1 with C6 => 3.14, C5 => 3.1416);
pragma Test_Statement;
I5 : T4 := (I1 with 3.14, 3.1416, True);
pragma Test_Statement;
package Foo is
type V is tagged null record;
type W is new V with record
X : Integer;
end record;
end Foo;
F1 : Foo.W := (Foo.V with X => 1);
pragma Test_Statement;
begin
null;
end Ea;
|
reznikmm/matreshka | Ada | 3,630 | 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.Elements.Generic_Hash;
function AMF.OCL.Tuple_Literal_Parts.Hash is
new AMF.Elements.Generic_Hash (OCL_Tuple_Literal_Part, OCL_Tuple_Literal_Part_Access);
|
godunko/cga | Ada | 1,938 | ads | --
-- Copyright (C) 2023, Vadim Godunko <[email protected]>
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
--
-- Routines for Arbitrary Precision Floating-point Arithmetic
--
-- This code is based on the work "Adaptive Precision Floating-Point
-- Arithmetic and Fast Robust Geometric Predicates" by Jonathan Richard
-- Shewchuk, CMU-CS-96-140
with Interfaces;
with CGK.Reals;
package CGK.Internals.Shewchuk_Arithmetic is
pragma Pure;
procedure Two_Sum
(A : CGK.Reals.Real;
B : CGK.Reals.Real;
X : out CGK.Reals.Real;
Y : out CGK.Reals.Real);
procedure Two_Diff_Tail
(A : CGK.Reals.Real;
B : CGK.Reals.Real;
X : CGK.Reals.Real;
Y : out CGK.Reals.Real);
procedure Two_Product
(A : CGK.Reals.Real;
B : CGK.Reals.Real;
X : out CGK.Reals.Real;
Y : out CGK.Reals.Real);
procedure Two_Two_Diff
(A1 : CGK.Reals.Real;
A0 : CGK.Reals.Real;
B1 : CGK.Reals.Real;
B0 : CGK.Reals.Real;
X3 : out CGK.Reals.Real;
X2 : out CGK.Reals.Real;
X1 : out CGK.Reals.Real;
X0 : out CGK.Reals.Real);
type Real_Array is
array (Interfaces.Unsigned_32 range <>) of CGK.Reals.Real;
function Estimate (E : Real_Array) return CGK.Reals.Real;
-- Produce a one-word estimate of an expansion's value.
procedure Fast_Expansion_Sum_Zero_Elim
(E : Real_Array;
F : Real_Array;
H : out Real_Array;
L : out Interfaces.Unsigned_32);
-- Sum two expansions, eliminating zero components from the output
-- expansion.
--
-- Sets h = e + f.
--
-- h cannot be e or f.
--
-- If round-to-even is used (as with IEEE 754), maintains the strongly
-- nonoverlapping property. (That is, if e is strongly nonoverlapping,
-- h will be also.) Does NOT maintain the nonoverlapping or nonadjacent
-- properties.
end CGK.Internals.Shewchuk_Arithmetic;
|
ohenley/ada-util | Ada | 56,362 | adb | -----------------------------------------------------------------------
-- util-encoders-aes -- AES encryption and decryption
-- 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.
-----------------------------------------------------------------------
package body Util.Encoders.AES is
use Ada.Streams;
type Sbox is array (Unsigned_32 range 0 .. 255) of Unsigned_32;
type Final_Sbox is array (Unsigned_32 range 0 .. 255) of Unsigned_8;
type Key_Sbox is array (Natural range 0 .. 9) of Unsigned_32;
function To_Unsigned_32 (Data : in Stream_Element_Array;
Offset : in Stream_Element_Offset) return Unsigned_32;
pragma Inline_Always (To_Unsigned_32);
Te0 : constant Sbox := (
16#c66363a5#, 16#f87c7c84#, 16#ee777799#, 16#f67b7b8d#,
16#fff2f20d#, 16#d66b6bbd#, 16#de6f6fb1#, 16#91c5c554#,
16#60303050#, 16#02010103#, 16#ce6767a9#, 16#562b2b7d#,
16#e7fefe19#, 16#b5d7d762#, 16#4dababe6#, 16#ec76769a#,
16#8fcaca45#, 16#1f82829d#, 16#89c9c940#, 16#fa7d7d87#,
16#effafa15#, 16#b25959eb#, 16#8e4747c9#, 16#fbf0f00b#,
16#41adadec#, 16#b3d4d467#, 16#5fa2a2fd#, 16#45afafea#,
16#239c9cbf#, 16#53a4a4f7#, 16#e4727296#, 16#9bc0c05b#,
16#75b7b7c2#, 16#e1fdfd1c#, 16#3d9393ae#, 16#4c26266a#,
16#6c36365a#, 16#7e3f3f41#, 16#f5f7f702#, 16#83cccc4f#,
16#6834345c#, 16#51a5a5f4#, 16#d1e5e534#, 16#f9f1f108#,
16#e2717193#, 16#abd8d873#, 16#62313153#, 16#2a15153f#,
16#0804040c#, 16#95c7c752#, 16#46232365#, 16#9dc3c35e#,
16#30181828#, 16#379696a1#, 16#0a05050f#, 16#2f9a9ab5#,
16#0e070709#, 16#24121236#, 16#1b80809b#, 16#dfe2e23d#,
16#cdebeb26#, 16#4e272769#, 16#7fb2b2cd#, 16#ea75759f#,
16#1209091b#, 16#1d83839e#, 16#582c2c74#, 16#341a1a2e#,
16#361b1b2d#, 16#dc6e6eb2#, 16#b45a5aee#, 16#5ba0a0fb#,
16#a45252f6#, 16#763b3b4d#, 16#b7d6d661#, 16#7db3b3ce#,
16#5229297b#, 16#dde3e33e#, 16#5e2f2f71#, 16#13848497#,
16#a65353f5#, 16#b9d1d168#, 16#00000000#, 16#c1eded2c#,
16#40202060#, 16#e3fcfc1f#, 16#79b1b1c8#, 16#b65b5bed#,
16#d46a6abe#, 16#8dcbcb46#, 16#67bebed9#, 16#7239394b#,
16#944a4ade#, 16#984c4cd4#, 16#b05858e8#, 16#85cfcf4a#,
16#bbd0d06b#, 16#c5efef2a#, 16#4faaaae5#, 16#edfbfb16#,
16#864343c5#, 16#9a4d4dd7#, 16#66333355#, 16#11858594#,
16#8a4545cf#, 16#e9f9f910#, 16#04020206#, 16#fe7f7f81#,
16#a05050f0#, 16#783c3c44#, 16#259f9fba#, 16#4ba8a8e3#,
16#a25151f3#, 16#5da3a3fe#, 16#804040c0#, 16#058f8f8a#,
16#3f9292ad#, 16#219d9dbc#, 16#70383848#, 16#f1f5f504#,
16#63bcbcdf#, 16#77b6b6c1#, 16#afdada75#, 16#42212163#,
16#20101030#, 16#e5ffff1a#, 16#fdf3f30e#, 16#bfd2d26d#,
16#81cdcd4c#, 16#180c0c14#, 16#26131335#, 16#c3ecec2f#,
16#be5f5fe1#, 16#359797a2#, 16#884444cc#, 16#2e171739#,
16#93c4c457#, 16#55a7a7f2#, 16#fc7e7e82#, 16#7a3d3d47#,
16#c86464ac#, 16#ba5d5de7#, 16#3219192b#, 16#e6737395#,
16#c06060a0#, 16#19818198#, 16#9e4f4fd1#, 16#a3dcdc7f#,
16#44222266#, 16#542a2a7e#, 16#3b9090ab#, 16#0b888883#,
16#8c4646ca#, 16#c7eeee29#, 16#6bb8b8d3#, 16#2814143c#,
16#a7dede79#, 16#bc5e5ee2#, 16#160b0b1d#, 16#addbdb76#,
16#dbe0e03b#, 16#64323256#, 16#743a3a4e#, 16#140a0a1e#,
16#924949db#, 16#0c06060a#, 16#4824246c#, 16#b85c5ce4#,
16#9fc2c25d#, 16#bdd3d36e#, 16#43acacef#, 16#c46262a6#,
16#399191a8#, 16#319595a4#, 16#d3e4e437#, 16#f279798b#,
16#d5e7e732#, 16#8bc8c843#, 16#6e373759#, 16#da6d6db7#,
16#018d8d8c#, 16#b1d5d564#, 16#9c4e4ed2#, 16#49a9a9e0#,
16#d86c6cb4#, 16#ac5656fa#, 16#f3f4f407#, 16#cfeaea25#,
16#ca6565af#, 16#f47a7a8e#, 16#47aeaee9#, 16#10080818#,
16#6fbabad5#, 16#f0787888#, 16#4a25256f#, 16#5c2e2e72#,
16#381c1c24#, 16#57a6a6f1#, 16#73b4b4c7#, 16#97c6c651#,
16#cbe8e823#, 16#a1dddd7c#, 16#e874749c#, 16#3e1f1f21#,
16#964b4bdd#, 16#61bdbddc#, 16#0d8b8b86#, 16#0f8a8a85#,
16#e0707090#, 16#7c3e3e42#, 16#71b5b5c4#, 16#cc6666aa#,
16#904848d8#, 16#06030305#, 16#f7f6f601#, 16#1c0e0e12#,
16#c26161a3#, 16#6a35355f#, 16#ae5757f9#, 16#69b9b9d0#,
16#17868691#, 16#99c1c158#, 16#3a1d1d27#, 16#279e9eb9#,
16#d9e1e138#, 16#ebf8f813#, 16#2b9898b3#, 16#22111133#,
16#d26969bb#, 16#a9d9d970#, 16#078e8e89#, 16#339494a7#,
16#2d9b9bb6#, 16#3c1e1e22#, 16#15878792#, 16#c9e9e920#,
16#87cece49#, 16#aa5555ff#, 16#50282878#, 16#a5dfdf7a#,
16#038c8c8f#, 16#59a1a1f8#, 16#09898980#, 16#1a0d0d17#,
16#65bfbfda#, 16#d7e6e631#, 16#844242c6#, 16#d06868b8#,
16#824141c3#, 16#299999b0#, 16#5a2d2d77#, 16#1e0f0f11#,
16#7bb0b0cb#, 16#a85454fc#, 16#6dbbbbd6#, 16#2c16163a#);
Te1 : constant Sbox := (
16#a5c66363#, 16#84f87c7c#, 16#99ee7777#, 16#8df67b7b#,
16#0dfff2f2#, 16#bdd66b6b#, 16#b1de6f6f#, 16#5491c5c5#,
16#50603030#, 16#03020101#, 16#a9ce6767#, 16#7d562b2b#,
16#19e7fefe#, 16#62b5d7d7#, 16#e64dabab#, 16#9aec7676#,
16#458fcaca#, 16#9d1f8282#, 16#4089c9c9#, 16#87fa7d7d#,
16#15effafa#, 16#ebb25959#, 16#c98e4747#, 16#0bfbf0f0#,
16#ec41adad#, 16#67b3d4d4#, 16#fd5fa2a2#, 16#ea45afaf#,
16#bf239c9c#, 16#f753a4a4#, 16#96e47272#, 16#5b9bc0c0#,
16#c275b7b7#, 16#1ce1fdfd#, 16#ae3d9393#, 16#6a4c2626#,
16#5a6c3636#, 16#417e3f3f#, 16#02f5f7f7#, 16#4f83cccc#,
16#5c683434#, 16#f451a5a5#, 16#34d1e5e5#, 16#08f9f1f1#,
16#93e27171#, 16#73abd8d8#, 16#53623131#, 16#3f2a1515#,
16#0c080404#, 16#5295c7c7#, 16#65462323#, 16#5e9dc3c3#,
16#28301818#, 16#a1379696#, 16#0f0a0505#, 16#b52f9a9a#,
16#090e0707#, 16#36241212#, 16#9b1b8080#, 16#3ddfe2e2#,
16#26cdebeb#, 16#694e2727#, 16#cd7fb2b2#, 16#9fea7575#,
16#1b120909#, 16#9e1d8383#, 16#74582c2c#, 16#2e341a1a#,
16#2d361b1b#, 16#b2dc6e6e#, 16#eeb45a5a#, 16#fb5ba0a0#,
16#f6a45252#, 16#4d763b3b#, 16#61b7d6d6#, 16#ce7db3b3#,
16#7b522929#, 16#3edde3e3#, 16#715e2f2f#, 16#97138484#,
16#f5a65353#, 16#68b9d1d1#, 16#00000000#, 16#2cc1eded#,
16#60402020#, 16#1fe3fcfc#, 16#c879b1b1#, 16#edb65b5b#,
16#bed46a6a#, 16#468dcbcb#, 16#d967bebe#, 16#4b723939#,
16#de944a4a#, 16#d4984c4c#, 16#e8b05858#, 16#4a85cfcf#,
16#6bbbd0d0#, 16#2ac5efef#, 16#e54faaaa#, 16#16edfbfb#,
16#c5864343#, 16#d79a4d4d#, 16#55663333#, 16#94118585#,
16#cf8a4545#, 16#10e9f9f9#, 16#06040202#, 16#81fe7f7f#,
16#f0a05050#, 16#44783c3c#, 16#ba259f9f#, 16#e34ba8a8#,
16#f3a25151#, 16#fe5da3a3#, 16#c0804040#, 16#8a058f8f#,
16#ad3f9292#, 16#bc219d9d#, 16#48703838#, 16#04f1f5f5#,
16#df63bcbc#, 16#c177b6b6#, 16#75afdada#, 16#63422121#,
16#30201010#, 16#1ae5ffff#, 16#0efdf3f3#, 16#6dbfd2d2#,
16#4c81cdcd#, 16#14180c0c#, 16#35261313#, 16#2fc3ecec#,
16#e1be5f5f#, 16#a2359797#, 16#cc884444#, 16#392e1717#,
16#5793c4c4#, 16#f255a7a7#, 16#82fc7e7e#, 16#477a3d3d#,
16#acc86464#, 16#e7ba5d5d#, 16#2b321919#, 16#95e67373#,
16#a0c06060#, 16#98198181#, 16#d19e4f4f#, 16#7fa3dcdc#,
16#66442222#, 16#7e542a2a#, 16#ab3b9090#, 16#830b8888#,
16#ca8c4646#, 16#29c7eeee#, 16#d36bb8b8#, 16#3c281414#,
16#79a7dede#, 16#e2bc5e5e#, 16#1d160b0b#, 16#76addbdb#,
16#3bdbe0e0#, 16#56643232#, 16#4e743a3a#, 16#1e140a0a#,
16#db924949#, 16#0a0c0606#, 16#6c482424#, 16#e4b85c5c#,
16#5d9fc2c2#, 16#6ebdd3d3#, 16#ef43acac#, 16#a6c46262#,
16#a8399191#, 16#a4319595#, 16#37d3e4e4#, 16#8bf27979#,
16#32d5e7e7#, 16#438bc8c8#, 16#596e3737#, 16#b7da6d6d#,
16#8c018d8d#, 16#64b1d5d5#, 16#d29c4e4e#, 16#e049a9a9#,
16#b4d86c6c#, 16#faac5656#, 16#07f3f4f4#, 16#25cfeaea#,
16#afca6565#, 16#8ef47a7a#, 16#e947aeae#, 16#18100808#,
16#d56fbaba#, 16#88f07878#, 16#6f4a2525#, 16#725c2e2e#,
16#24381c1c#, 16#f157a6a6#, 16#c773b4b4#, 16#5197c6c6#,
16#23cbe8e8#, 16#7ca1dddd#, 16#9ce87474#, 16#213e1f1f#,
16#dd964b4b#, 16#dc61bdbd#, 16#860d8b8b#, 16#850f8a8a#,
16#90e07070#, 16#427c3e3e#, 16#c471b5b5#, 16#aacc6666#,
16#d8904848#, 16#05060303#, 16#01f7f6f6#, 16#121c0e0e#,
16#a3c26161#, 16#5f6a3535#, 16#f9ae5757#, 16#d069b9b9#,
16#91178686#, 16#5899c1c1#, 16#273a1d1d#, 16#b9279e9e#,
16#38d9e1e1#, 16#13ebf8f8#, 16#b32b9898#, 16#33221111#,
16#bbd26969#, 16#70a9d9d9#, 16#89078e8e#, 16#a7339494#,
16#b62d9b9b#, 16#223c1e1e#, 16#92158787#, 16#20c9e9e9#,
16#4987cece#, 16#ffaa5555#, 16#78502828#, 16#7aa5dfdf#,
16#8f038c8c#, 16#f859a1a1#, 16#80098989#, 16#171a0d0d#,
16#da65bfbf#, 16#31d7e6e6#, 16#c6844242#, 16#b8d06868#,
16#c3824141#, 16#b0299999#, 16#775a2d2d#, 16#111e0f0f#,
16#cb7bb0b0#, 16#fca85454#, 16#d66dbbbb#, 16#3a2c1616#);
Te2 : constant Sbox := (
16#63a5c663#, 16#7c84f87c#, 16#7799ee77#, 16#7b8df67b#,
16#f20dfff2#, 16#6bbdd66b#, 16#6fb1de6f#, 16#c55491c5#,
16#30506030#, 16#01030201#, 16#67a9ce67#, 16#2b7d562b#,
16#fe19e7fe#, 16#d762b5d7#, 16#abe64dab#, 16#769aec76#,
16#ca458fca#, 16#829d1f82#, 16#c94089c9#, 16#7d87fa7d#,
16#fa15effa#, 16#59ebb259#, 16#47c98e47#, 16#f00bfbf0#,
16#adec41ad#, 16#d467b3d4#, 16#a2fd5fa2#, 16#afea45af#,
16#9cbf239c#, 16#a4f753a4#, 16#7296e472#, 16#c05b9bc0#,
16#b7c275b7#, 16#fd1ce1fd#, 16#93ae3d93#, 16#266a4c26#,
16#365a6c36#, 16#3f417e3f#, 16#f702f5f7#, 16#cc4f83cc#,
16#345c6834#, 16#a5f451a5#, 16#e534d1e5#, 16#f108f9f1#,
16#7193e271#, 16#d873abd8#, 16#31536231#, 16#153f2a15#,
16#040c0804#, 16#c75295c7#, 16#23654623#, 16#c35e9dc3#,
16#18283018#, 16#96a13796#, 16#050f0a05#, 16#9ab52f9a#,
16#07090e07#, 16#12362412#, 16#809b1b80#, 16#e23ddfe2#,
16#eb26cdeb#, 16#27694e27#, 16#b2cd7fb2#, 16#759fea75#,
16#091b1209#, 16#839e1d83#, 16#2c74582c#, 16#1a2e341a#,
16#1b2d361b#, 16#6eb2dc6e#, 16#5aeeb45a#, 16#a0fb5ba0#,
16#52f6a452#, 16#3b4d763b#, 16#d661b7d6#, 16#b3ce7db3#,
16#297b5229#, 16#e33edde3#, 16#2f715e2f#, 16#84971384#,
16#53f5a653#, 16#d168b9d1#, 16#00000000#, 16#ed2cc1ed#,
16#20604020#, 16#fc1fe3fc#, 16#b1c879b1#, 16#5bedb65b#,
16#6abed46a#, 16#cb468dcb#, 16#bed967be#, 16#394b7239#,
16#4ade944a#, 16#4cd4984c#, 16#58e8b058#, 16#cf4a85cf#,
16#d06bbbd0#, 16#ef2ac5ef#, 16#aae54faa#, 16#fb16edfb#,
16#43c58643#, 16#4dd79a4d#, 16#33556633#, 16#85941185#,
16#45cf8a45#, 16#f910e9f9#, 16#02060402#, 16#7f81fe7f#,
16#50f0a050#, 16#3c44783c#, 16#9fba259f#, 16#a8e34ba8#,
16#51f3a251#, 16#a3fe5da3#, 16#40c08040#, 16#8f8a058f#,
16#92ad3f92#, 16#9dbc219d#, 16#38487038#, 16#f504f1f5#,
16#bcdf63bc#, 16#b6c177b6#, 16#da75afda#, 16#21634221#,
16#10302010#, 16#ff1ae5ff#, 16#f30efdf3#, 16#d26dbfd2#,
16#cd4c81cd#, 16#0c14180c#, 16#13352613#, 16#ec2fc3ec#,
16#5fe1be5f#, 16#97a23597#, 16#44cc8844#, 16#17392e17#,
16#c45793c4#, 16#a7f255a7#, 16#7e82fc7e#, 16#3d477a3d#,
16#64acc864#, 16#5de7ba5d#, 16#192b3219#, 16#7395e673#,
16#60a0c060#, 16#81981981#, 16#4fd19e4f#, 16#dc7fa3dc#,
16#22664422#, 16#2a7e542a#, 16#90ab3b90#, 16#88830b88#,
16#46ca8c46#, 16#ee29c7ee#, 16#b8d36bb8#, 16#143c2814#,
16#de79a7de#, 16#5ee2bc5e#, 16#0b1d160b#, 16#db76addb#,
16#e03bdbe0#, 16#32566432#, 16#3a4e743a#, 16#0a1e140a#,
16#49db9249#, 16#060a0c06#, 16#246c4824#, 16#5ce4b85c#,
16#c25d9fc2#, 16#d36ebdd3#, 16#acef43ac#, 16#62a6c462#,
16#91a83991#, 16#95a43195#, 16#e437d3e4#, 16#798bf279#,
16#e732d5e7#, 16#c8438bc8#, 16#37596e37#, 16#6db7da6d#,
16#8d8c018d#, 16#d564b1d5#, 16#4ed29c4e#, 16#a9e049a9#,
16#6cb4d86c#, 16#56faac56#, 16#f407f3f4#, 16#ea25cfea#,
16#65afca65#, 16#7a8ef47a#, 16#aee947ae#, 16#08181008#,
16#bad56fba#, 16#7888f078#, 16#256f4a25#, 16#2e725c2e#,
16#1c24381c#, 16#a6f157a6#, 16#b4c773b4#, 16#c65197c6#,
16#e823cbe8#, 16#dd7ca1dd#, 16#749ce874#, 16#1f213e1f#,
16#4bdd964b#, 16#bddc61bd#, 16#8b860d8b#, 16#8a850f8a#,
16#7090e070#, 16#3e427c3e#, 16#b5c471b5#, 16#66aacc66#,
16#48d89048#, 16#03050603#, 16#f601f7f6#, 16#0e121c0e#,
16#61a3c261#, 16#355f6a35#, 16#57f9ae57#, 16#b9d069b9#,
16#86911786#, 16#c15899c1#, 16#1d273a1d#, 16#9eb9279e#,
16#e138d9e1#, 16#f813ebf8#, 16#98b32b98#, 16#11332211#,
16#69bbd269#, 16#d970a9d9#, 16#8e89078e#, 16#94a73394#,
16#9bb62d9b#, 16#1e223c1e#, 16#87921587#, 16#e920c9e9#,
16#ce4987ce#, 16#55ffaa55#, 16#28785028#, 16#df7aa5df#,
16#8c8f038c#, 16#a1f859a1#, 16#89800989#, 16#0d171a0d#,
16#bfda65bf#, 16#e631d7e6#, 16#42c68442#, 16#68b8d068#,
16#41c38241#, 16#99b02999#, 16#2d775a2d#, 16#0f111e0f#,
16#b0cb7bb0#, 16#54fca854#, 16#bbd66dbb#, 16#163a2c16#);
Te3 : constant Sbox := (
16#6363a5c6#, 16#7c7c84f8#, 16#777799ee#, 16#7b7b8df6#,
16#f2f20dff#, 16#6b6bbdd6#, 16#6f6fb1de#, 16#c5c55491#,
16#30305060#, 16#01010302#, 16#6767a9ce#, 16#2b2b7d56#,
16#fefe19e7#, 16#d7d762b5#, 16#ababe64d#, 16#76769aec#,
16#caca458f#, 16#82829d1f#, 16#c9c94089#, 16#7d7d87fa#,
16#fafa15ef#, 16#5959ebb2#, 16#4747c98e#, 16#f0f00bfb#,
16#adadec41#, 16#d4d467b3#, 16#a2a2fd5f#, 16#afafea45#,
16#9c9cbf23#, 16#a4a4f753#, 16#727296e4#, 16#c0c05b9b#,
16#b7b7c275#, 16#fdfd1ce1#, 16#9393ae3d#, 16#26266a4c#,
16#36365a6c#, 16#3f3f417e#, 16#f7f702f5#, 16#cccc4f83#,
16#34345c68#, 16#a5a5f451#, 16#e5e534d1#, 16#f1f108f9#,
16#717193e2#, 16#d8d873ab#, 16#31315362#, 16#15153f2a#,
16#04040c08#, 16#c7c75295#, 16#23236546#, 16#c3c35e9d#,
16#18182830#, 16#9696a137#, 16#05050f0a#, 16#9a9ab52f#,
16#0707090e#, 16#12123624#, 16#80809b1b#, 16#e2e23ddf#,
16#ebeb26cd#, 16#2727694e#, 16#b2b2cd7f#, 16#75759fea#,
16#09091b12#, 16#83839e1d#, 16#2c2c7458#, 16#1a1a2e34#,
16#1b1b2d36#, 16#6e6eb2dc#, 16#5a5aeeb4#, 16#a0a0fb5b#,
16#5252f6a4#, 16#3b3b4d76#, 16#d6d661b7#, 16#b3b3ce7d#,
16#29297b52#, 16#e3e33edd#, 16#2f2f715e#, 16#84849713#,
16#5353f5a6#, 16#d1d168b9#, 16#00000000#, 16#eded2cc1#,
16#20206040#, 16#fcfc1fe3#, 16#b1b1c879#, 16#5b5bedb6#,
16#6a6abed4#, 16#cbcb468d#, 16#bebed967#, 16#39394b72#,
16#4a4ade94#, 16#4c4cd498#, 16#5858e8b0#, 16#cfcf4a85#,
16#d0d06bbb#, 16#efef2ac5#, 16#aaaae54f#, 16#fbfb16ed#,
16#4343c586#, 16#4d4dd79a#, 16#33335566#, 16#85859411#,
16#4545cf8a#, 16#f9f910e9#, 16#02020604#, 16#7f7f81fe#,
16#5050f0a0#, 16#3c3c4478#, 16#9f9fba25#, 16#a8a8e34b#,
16#5151f3a2#, 16#a3a3fe5d#, 16#4040c080#, 16#8f8f8a05#,
16#9292ad3f#, 16#9d9dbc21#, 16#38384870#, 16#f5f504f1#,
16#bcbcdf63#, 16#b6b6c177#, 16#dada75af#, 16#21216342#,
16#10103020#, 16#ffff1ae5#, 16#f3f30efd#, 16#d2d26dbf#,
16#cdcd4c81#, 16#0c0c1418#, 16#13133526#, 16#ecec2fc3#,
16#5f5fe1be#, 16#9797a235#, 16#4444cc88#, 16#1717392e#,
16#c4c45793#, 16#a7a7f255#, 16#7e7e82fc#, 16#3d3d477a#,
16#6464acc8#, 16#5d5de7ba#, 16#19192b32#, 16#737395e6#,
16#6060a0c0#, 16#81819819#, 16#4f4fd19e#, 16#dcdc7fa3#,
16#22226644#, 16#2a2a7e54#, 16#9090ab3b#, 16#8888830b#,
16#4646ca8c#, 16#eeee29c7#, 16#b8b8d36b#, 16#14143c28#,
16#dede79a7#, 16#5e5ee2bc#, 16#0b0b1d16#, 16#dbdb76ad#,
16#e0e03bdb#, 16#32325664#, 16#3a3a4e74#, 16#0a0a1e14#,
16#4949db92#, 16#06060a0c#, 16#24246c48#, 16#5c5ce4b8#,
16#c2c25d9f#, 16#d3d36ebd#, 16#acacef43#, 16#6262a6c4#,
16#9191a839#, 16#9595a431#, 16#e4e437d3#, 16#79798bf2#,
16#e7e732d5#, 16#c8c8438b#, 16#3737596e#, 16#6d6db7da#,
16#8d8d8c01#, 16#d5d564b1#, 16#4e4ed29c#, 16#a9a9e049#,
16#6c6cb4d8#, 16#5656faac#, 16#f4f407f3#, 16#eaea25cf#,
16#6565afca#, 16#7a7a8ef4#, 16#aeaee947#, 16#08081810#,
16#babad56f#, 16#787888f0#, 16#25256f4a#, 16#2e2e725c#,
16#1c1c2438#, 16#a6a6f157#, 16#b4b4c773#, 16#c6c65197#,
16#e8e823cb#, 16#dddd7ca1#, 16#74749ce8#, 16#1f1f213e#,
16#4b4bdd96#, 16#bdbddc61#, 16#8b8b860d#, 16#8a8a850f#,
16#707090e0#, 16#3e3e427c#, 16#b5b5c471#, 16#6666aacc#,
16#4848d890#, 16#03030506#, 16#f6f601f7#, 16#0e0e121c#,
16#6161a3c2#, 16#35355f6a#, 16#5757f9ae#, 16#b9b9d069#,
16#86869117#, 16#c1c15899#, 16#1d1d273a#, 16#9e9eb927#,
16#e1e138d9#, 16#f8f813eb#, 16#9898b32b#, 16#11113322#,
16#6969bbd2#, 16#d9d970a9#, 16#8e8e8907#, 16#9494a733#,
16#9b9bb62d#, 16#1e1e223c#, 16#87879215#, 16#e9e920c9#,
16#cece4987#, 16#5555ffaa#, 16#28287850#, 16#dfdf7aa5#,
16#8c8c8f03#, 16#a1a1f859#, 16#89898009#, 16#0d0d171a#,
16#bfbfda65#, 16#e6e631d7#, 16#4242c684#, 16#6868b8d0#,
16#4141c382#, 16#9999b029#, 16#2d2d775a#, 16#0f0f111e#,
16#b0b0cb7b#, 16#5454fca8#, 16#bbbbd66d#, 16#16163a2c#);
Te4 : constant Sbox := (
16#63636363#, 16#7c7c7c7c#, 16#77777777#, 16#7b7b7b7b#,
16#f2f2f2f2#, 16#6b6b6b6b#, 16#6f6f6f6f#, 16#c5c5c5c5#,
16#30303030#, 16#01010101#, 16#67676767#, 16#2b2b2b2b#,
16#fefefefe#, 16#d7d7d7d7#, 16#abababab#, 16#76767676#,
16#cacacaca#, 16#82828282#, 16#c9c9c9c9#, 16#7d7d7d7d#,
16#fafafafa#, 16#59595959#, 16#47474747#, 16#f0f0f0f0#,
16#adadadad#, 16#d4d4d4d4#, 16#a2a2a2a2#, 16#afafafaf#,
16#9c9c9c9c#, 16#a4a4a4a4#, 16#72727272#, 16#c0c0c0c0#,
16#b7b7b7b7#, 16#fdfdfdfd#, 16#93939393#, 16#26262626#,
16#36363636#, 16#3f3f3f3f#, 16#f7f7f7f7#, 16#cccccccc#,
16#34343434#, 16#a5a5a5a5#, 16#e5e5e5e5#, 16#f1f1f1f1#,
16#71717171#, 16#d8d8d8d8#, 16#31313131#, 16#15151515#,
16#04040404#, 16#c7c7c7c7#, 16#23232323#, 16#c3c3c3c3#,
16#18181818#, 16#96969696#, 16#05050505#, 16#9a9a9a9a#,
16#07070707#, 16#12121212#, 16#80808080#, 16#e2e2e2e2#,
16#ebebebeb#, 16#27272727#, 16#b2b2b2b2#, 16#75757575#,
16#09090909#, 16#83838383#, 16#2c2c2c2c#, 16#1a1a1a1a#,
16#1b1b1b1b#, 16#6e6e6e6e#, 16#5a5a5a5a#, 16#a0a0a0a0#,
16#52525252#, 16#3b3b3b3b#, 16#d6d6d6d6#, 16#b3b3b3b3#,
16#29292929#, 16#e3e3e3e3#, 16#2f2f2f2f#, 16#84848484#,
16#53535353#, 16#d1d1d1d1#, 16#00000000#, 16#edededed#,
16#20202020#, 16#fcfcfcfc#, 16#b1b1b1b1#, 16#5b5b5b5b#,
16#6a6a6a6a#, 16#cbcbcbcb#, 16#bebebebe#, 16#39393939#,
16#4a4a4a4a#, 16#4c4c4c4c#, 16#58585858#, 16#cfcfcfcf#,
16#d0d0d0d0#, 16#efefefef#, 16#aaaaaaaa#, 16#fbfbfbfb#,
16#43434343#, 16#4d4d4d4d#, 16#33333333#, 16#85858585#,
16#45454545#, 16#f9f9f9f9#, 16#02020202#, 16#7f7f7f7f#,
16#50505050#, 16#3c3c3c3c#, 16#9f9f9f9f#, 16#a8a8a8a8#,
16#51515151#, 16#a3a3a3a3#, 16#40404040#, 16#8f8f8f8f#,
16#92929292#, 16#9d9d9d9d#, 16#38383838#, 16#f5f5f5f5#,
16#bcbcbcbc#, 16#b6b6b6b6#, 16#dadadada#, 16#21212121#,
16#10101010#, 16#ffffffff#, 16#f3f3f3f3#, 16#d2d2d2d2#,
16#cdcdcdcd#, 16#0c0c0c0c#, 16#13131313#, 16#ecececec#,
16#5f5f5f5f#, 16#97979797#, 16#44444444#, 16#17171717#,
16#c4c4c4c4#, 16#a7a7a7a7#, 16#7e7e7e7e#, 16#3d3d3d3d#,
16#64646464#, 16#5d5d5d5d#, 16#19191919#, 16#73737373#,
16#60606060#, 16#81818181#, 16#4f4f4f4f#, 16#dcdcdcdc#,
16#22222222#, 16#2a2a2a2a#, 16#90909090#, 16#88888888#,
16#46464646#, 16#eeeeeeee#, 16#b8b8b8b8#, 16#14141414#,
16#dededede#, 16#5e5e5e5e#, 16#0b0b0b0b#, 16#dbdbdbdb#,
16#e0e0e0e0#, 16#32323232#, 16#3a3a3a3a#, 16#0a0a0a0a#,
16#49494949#, 16#06060606#, 16#24242424#, 16#5c5c5c5c#,
16#c2c2c2c2#, 16#d3d3d3d3#, 16#acacacac#, 16#62626262#,
16#91919191#, 16#95959595#, 16#e4e4e4e4#, 16#79797979#,
16#e7e7e7e7#, 16#c8c8c8c8#, 16#37373737#, 16#6d6d6d6d#,
16#8d8d8d8d#, 16#d5d5d5d5#, 16#4e4e4e4e#, 16#a9a9a9a9#,
16#6c6c6c6c#, 16#56565656#, 16#f4f4f4f4#, 16#eaeaeaea#,
16#65656565#, 16#7a7a7a7a#, 16#aeaeaeae#, 16#08080808#,
16#babababa#, 16#78787878#, 16#25252525#, 16#2e2e2e2e#,
16#1c1c1c1c#, 16#a6a6a6a6#, 16#b4b4b4b4#, 16#c6c6c6c6#,
16#e8e8e8e8#, 16#dddddddd#, 16#74747474#, 16#1f1f1f1f#,
16#4b4b4b4b#, 16#bdbdbdbd#, 16#8b8b8b8b#, 16#8a8a8a8a#,
16#70707070#, 16#3e3e3e3e#, 16#b5b5b5b5#, 16#66666666#,
16#48484848#, 16#03030303#, 16#f6f6f6f6#, 16#0e0e0e0e#,
16#61616161#, 16#35353535#, 16#57575757#, 16#b9b9b9b9#,
16#86868686#, 16#c1c1c1c1#, 16#1d1d1d1d#, 16#9e9e9e9e#,
16#e1e1e1e1#, 16#f8f8f8f8#, 16#98989898#, 16#11111111#,
16#69696969#, 16#d9d9d9d9#, 16#8e8e8e8e#, 16#94949494#,
16#9b9b9b9b#, 16#1e1e1e1e#, 16#87878787#, 16#e9e9e9e9#,
16#cececece#, 16#55555555#, 16#28282828#, 16#dfdfdfdf#,
16#8c8c8c8c#, 16#a1a1a1a1#, 16#89898989#, 16#0d0d0d0d#,
16#bfbfbfbf#, 16#e6e6e6e6#, 16#42424242#, 16#68686868#,
16#41414141#, 16#99999999#, 16#2d2d2d2d#, 16#0f0f0f0f#,
16#b0b0b0b0#, 16#54545454#, 16#bbbbbbbb#, 16#16161616#);
Td0 : constant Sbox := (
16#51f4a750#, 16#7e416553#, 16#1a17a4c3#, 16#3a275e96#,
16#3bab6bcb#, 16#1f9d45f1#, 16#acfa58ab#, 16#4be30393#,
16#2030fa55#, 16#ad766df6#, 16#88cc7691#, 16#f5024c25#,
16#4fe5d7fc#, 16#c52acbd7#, 16#26354480#, 16#b562a38f#,
16#deb15a49#, 16#25ba1b67#, 16#45ea0e98#, 16#5dfec0e1#,
16#c32f7502#, 16#814cf012#, 16#8d4697a3#, 16#6bd3f9c6#,
16#038f5fe7#, 16#15929c95#, 16#bf6d7aeb#, 16#955259da#,
16#d4be832d#, 16#587421d3#, 16#49e06929#, 16#8ec9c844#,
16#75c2896a#, 16#f48e7978#, 16#99583e6b#, 16#27b971dd#,
16#bee14fb6#, 16#f088ad17#, 16#c920ac66#, 16#7dce3ab4#,
16#63df4a18#, 16#e51a3182#, 16#97513360#, 16#62537f45#,
16#b16477e0#, 16#bb6bae84#, 16#fe81a01c#, 16#f9082b94#,
16#70486858#, 16#8f45fd19#, 16#94de6c87#, 16#527bf8b7#,
16#ab73d323#, 16#724b02e2#, 16#e31f8f57#, 16#6655ab2a#,
16#b2eb2807#, 16#2fb5c203#, 16#86c57b9a#, 16#d33708a5#,
16#302887f2#, 16#23bfa5b2#, 16#02036aba#, 16#ed16825c#,
16#8acf1c2b#, 16#a779b492#, 16#f307f2f0#, 16#4e69e2a1#,
16#65daf4cd#, 16#0605bed5#, 16#d134621f#, 16#c4a6fe8a#,
16#342e539d#, 16#a2f355a0#, 16#058ae132#, 16#a4f6eb75#,
16#0b83ec39#, 16#4060efaa#, 16#5e719f06#, 16#bd6e1051#,
16#3e218af9#, 16#96dd063d#, 16#dd3e05ae#, 16#4de6bd46#,
16#91548db5#, 16#71c45d05#, 16#0406d46f#, 16#605015ff#,
16#1998fb24#, 16#d6bde997#, 16#894043cc#, 16#67d99e77#,
16#b0e842bd#, 16#07898b88#, 16#e7195b38#, 16#79c8eedb#,
16#a17c0a47#, 16#7c420fe9#, 16#f8841ec9#, 16#00000000#,
16#09808683#, 16#322bed48#, 16#1e1170ac#, 16#6c5a724e#,
16#fd0efffb#, 16#0f853856#, 16#3daed51e#, 16#362d3927#,
16#0a0fd964#, 16#685ca621#, 16#9b5b54d1#, 16#24362e3a#,
16#0c0a67b1#, 16#9357e70f#, 16#b4ee96d2#, 16#1b9b919e#,
16#80c0c54f#, 16#61dc20a2#, 16#5a774b69#, 16#1c121a16#,
16#e293ba0a#, 16#c0a02ae5#, 16#3c22e043#, 16#121b171d#,
16#0e090d0b#, 16#f28bc7ad#, 16#2db6a8b9#, 16#141ea9c8#,
16#57f11985#, 16#af75074c#, 16#ee99ddbb#, 16#a37f60fd#,
16#f701269f#, 16#5c72f5bc#, 16#44663bc5#, 16#5bfb7e34#,
16#8b432976#, 16#cb23c6dc#, 16#b6edfc68#, 16#b8e4f163#,
16#d731dcca#, 16#42638510#, 16#13972240#, 16#84c61120#,
16#854a247d#, 16#d2bb3df8#, 16#aef93211#, 16#c729a16d#,
16#1d9e2f4b#, 16#dcb230f3#, 16#0d8652ec#, 16#77c1e3d0#,
16#2bb3166c#, 16#a970b999#, 16#119448fa#, 16#47e96422#,
16#a8fc8cc4#, 16#a0f03f1a#, 16#567d2cd8#, 16#223390ef#,
16#87494ec7#, 16#d938d1c1#, 16#8ccaa2fe#, 16#98d40b36#,
16#a6f581cf#, 16#a57ade28#, 16#dab78e26#, 16#3fadbfa4#,
16#2c3a9de4#, 16#5078920d#, 16#6a5fcc9b#, 16#547e4662#,
16#f68d13c2#, 16#90d8b8e8#, 16#2e39f75e#, 16#82c3aff5#,
16#9f5d80be#, 16#69d0937c#, 16#6fd52da9#, 16#cf2512b3#,
16#c8ac993b#, 16#10187da7#, 16#e89c636e#, 16#db3bbb7b#,
16#cd267809#, 16#6e5918f4#, 16#ec9ab701#, 16#834f9aa8#,
16#e6956e65#, 16#aaffe67e#, 16#21bccf08#, 16#ef15e8e6#,
16#bae79bd9#, 16#4a6f36ce#, 16#ea9f09d4#, 16#29b07cd6#,
16#31a4b2af#, 16#2a3f2331#, 16#c6a59430#, 16#35a266c0#,
16#744ebc37#, 16#fc82caa6#, 16#e090d0b0#, 16#33a7d815#,
16#f104984a#, 16#41ecdaf7#, 16#7fcd500e#, 16#1791f62f#,
16#764dd68d#, 16#43efb04d#, 16#ccaa4d54#, 16#e49604df#,
16#9ed1b5e3#, 16#4c6a881b#, 16#c12c1fb8#, 16#4665517f#,
16#9d5eea04#, 16#018c355d#, 16#fa877473#, 16#fb0b412e#,
16#b3671d5a#, 16#92dbd252#, 16#e9105633#, 16#6dd64713#,
16#9ad7618c#, 16#37a10c7a#, 16#59f8148e#, 16#eb133c89#,
16#cea927ee#, 16#b761c935#, 16#e11ce5ed#, 16#7a47b13c#,
16#9cd2df59#, 16#55f2733f#, 16#1814ce79#, 16#73c737bf#,
16#53f7cdea#, 16#5ffdaa5b#, 16#df3d6f14#, 16#7844db86#,
16#caaff381#, 16#b968c43e#, 16#3824342c#, 16#c2a3405f#,
16#161dc372#, 16#bce2250c#, 16#283c498b#, 16#ff0d9541#,
16#39a80171#, 16#080cb3de#, 16#d8b4e49c#, 16#6456c190#,
16#7bcb8461#, 16#d532b670#, 16#486c5c74#, 16#d0b85742#);
Td1 : constant Sbox := (
16#5051f4a7#, 16#537e4165#, 16#c31a17a4#, 16#963a275e#,
16#cb3bab6b#, 16#f11f9d45#, 16#abacfa58#, 16#934be303#,
16#552030fa#, 16#f6ad766d#, 16#9188cc76#, 16#25f5024c#,
16#fc4fe5d7#, 16#d7c52acb#, 16#80263544#, 16#8fb562a3#,
16#49deb15a#, 16#6725ba1b#, 16#9845ea0e#, 16#e15dfec0#,
16#02c32f75#, 16#12814cf0#, 16#a38d4697#, 16#c66bd3f9#,
16#e7038f5f#, 16#9515929c#, 16#ebbf6d7a#, 16#da955259#,
16#2dd4be83#, 16#d3587421#, 16#2949e069#, 16#448ec9c8#,
16#6a75c289#, 16#78f48e79#, 16#6b99583e#, 16#dd27b971#,
16#b6bee14f#, 16#17f088ad#, 16#66c920ac#, 16#b47dce3a#,
16#1863df4a#, 16#82e51a31#, 16#60975133#, 16#4562537f#,
16#e0b16477#, 16#84bb6bae#, 16#1cfe81a0#, 16#94f9082b#,
16#58704868#, 16#198f45fd#, 16#8794de6c#, 16#b7527bf8#,
16#23ab73d3#, 16#e2724b02#, 16#57e31f8f#, 16#2a6655ab#,
16#07b2eb28#, 16#032fb5c2#, 16#9a86c57b#, 16#a5d33708#,
16#f2302887#, 16#b223bfa5#, 16#ba02036a#, 16#5ced1682#,
16#2b8acf1c#, 16#92a779b4#, 16#f0f307f2#, 16#a14e69e2#,
16#cd65daf4#, 16#d50605be#, 16#1fd13462#, 16#8ac4a6fe#,
16#9d342e53#, 16#a0a2f355#, 16#32058ae1#, 16#75a4f6eb#,
16#390b83ec#, 16#aa4060ef#, 16#065e719f#, 16#51bd6e10#,
16#f93e218a#, 16#3d96dd06#, 16#aedd3e05#, 16#464de6bd#,
16#b591548d#, 16#0571c45d#, 16#6f0406d4#, 16#ff605015#,
16#241998fb#, 16#97d6bde9#, 16#cc894043#, 16#7767d99e#,
16#bdb0e842#, 16#8807898b#, 16#38e7195b#, 16#db79c8ee#,
16#47a17c0a#, 16#e97c420f#, 16#c9f8841e#, 16#00000000#,
16#83098086#, 16#48322bed#, 16#ac1e1170#, 16#4e6c5a72#,
16#fbfd0eff#, 16#560f8538#, 16#1e3daed5#, 16#27362d39#,
16#640a0fd9#, 16#21685ca6#, 16#d19b5b54#, 16#3a24362e#,
16#b10c0a67#, 16#0f9357e7#, 16#d2b4ee96#, 16#9e1b9b91#,
16#4f80c0c5#, 16#a261dc20#, 16#695a774b#, 16#161c121a#,
16#0ae293ba#, 16#e5c0a02a#, 16#433c22e0#, 16#1d121b17#,
16#0b0e090d#, 16#adf28bc7#, 16#b92db6a8#, 16#c8141ea9#,
16#8557f119#, 16#4caf7507#, 16#bbee99dd#, 16#fda37f60#,
16#9ff70126#, 16#bc5c72f5#, 16#c544663b#, 16#345bfb7e#,
16#768b4329#, 16#dccb23c6#, 16#68b6edfc#, 16#63b8e4f1#,
16#cad731dc#, 16#10426385#, 16#40139722#, 16#2084c611#,
16#7d854a24#, 16#f8d2bb3d#, 16#11aef932#, 16#6dc729a1#,
16#4b1d9e2f#, 16#f3dcb230#, 16#ec0d8652#, 16#d077c1e3#,
16#6c2bb316#, 16#99a970b9#, 16#fa119448#, 16#2247e964#,
16#c4a8fc8c#, 16#1aa0f03f#, 16#d8567d2c#, 16#ef223390#,
16#c787494e#, 16#c1d938d1#, 16#fe8ccaa2#, 16#3698d40b#,
16#cfa6f581#, 16#28a57ade#, 16#26dab78e#, 16#a43fadbf#,
16#e42c3a9d#, 16#0d507892#, 16#9b6a5fcc#, 16#62547e46#,
16#c2f68d13#, 16#e890d8b8#, 16#5e2e39f7#, 16#f582c3af#,
16#be9f5d80#, 16#7c69d093#, 16#a96fd52d#, 16#b3cf2512#,
16#3bc8ac99#, 16#a710187d#, 16#6ee89c63#, 16#7bdb3bbb#,
16#09cd2678#, 16#f46e5918#, 16#01ec9ab7#, 16#a8834f9a#,
16#65e6956e#, 16#7eaaffe6#, 16#0821bccf#, 16#e6ef15e8#,
16#d9bae79b#, 16#ce4a6f36#, 16#d4ea9f09#, 16#d629b07c#,
16#af31a4b2#, 16#312a3f23#, 16#30c6a594#, 16#c035a266#,
16#37744ebc#, 16#a6fc82ca#, 16#b0e090d0#, 16#1533a7d8#,
16#4af10498#, 16#f741ecda#, 16#0e7fcd50#, 16#2f1791f6#,
16#8d764dd6#, 16#4d43efb0#, 16#54ccaa4d#, 16#dfe49604#,
16#e39ed1b5#, 16#1b4c6a88#, 16#b8c12c1f#, 16#7f466551#,
16#049d5eea#, 16#5d018c35#, 16#73fa8774#, 16#2efb0b41#,
16#5ab3671d#, 16#5292dbd2#, 16#33e91056#, 16#136dd647#,
16#8c9ad761#, 16#7a37a10c#, 16#8e59f814#, 16#89eb133c#,
16#eecea927#, 16#35b761c9#, 16#ede11ce5#, 16#3c7a47b1#,
16#599cd2df#, 16#3f55f273#, 16#791814ce#, 16#bf73c737#,
16#ea53f7cd#, 16#5b5ffdaa#, 16#14df3d6f#, 16#867844db#,
16#81caaff3#, 16#3eb968c4#, 16#2c382434#, 16#5fc2a340#,
16#72161dc3#, 16#0cbce225#, 16#8b283c49#, 16#41ff0d95#,
16#7139a801#, 16#de080cb3#, 16#9cd8b4e4#, 16#906456c1#,
16#617bcb84#, 16#70d532b6#, 16#74486c5c#, 16#42d0b857#);
Td2 : constant Sbox := (
16#a75051f4#, 16#65537e41#, 16#a4c31a17#, 16#5e963a27#,
16#6bcb3bab#, 16#45f11f9d#, 16#58abacfa#, 16#03934be3#,
16#fa552030#, 16#6df6ad76#, 16#769188cc#, 16#4c25f502#,
16#d7fc4fe5#, 16#cbd7c52a#, 16#44802635#, 16#a38fb562#,
16#5a49deb1#, 16#1b6725ba#, 16#0e9845ea#, 16#c0e15dfe#,
16#7502c32f#, 16#f012814c#, 16#97a38d46#, 16#f9c66bd3#,
16#5fe7038f#, 16#9c951592#, 16#7aebbf6d#, 16#59da9552#,
16#832dd4be#, 16#21d35874#, 16#692949e0#, 16#c8448ec9#,
16#896a75c2#, 16#7978f48e#, 16#3e6b9958#, 16#71dd27b9#,
16#4fb6bee1#, 16#ad17f088#, 16#ac66c920#, 16#3ab47dce#,
16#4a1863df#, 16#3182e51a#, 16#33609751#, 16#7f456253#,
16#77e0b164#, 16#ae84bb6b#, 16#a01cfe81#, 16#2b94f908#,
16#68587048#, 16#fd198f45#, 16#6c8794de#, 16#f8b7527b#,
16#d323ab73#, 16#02e2724b#, 16#8f57e31f#, 16#ab2a6655#,
16#2807b2eb#, 16#c2032fb5#, 16#7b9a86c5#, 16#08a5d337#,
16#87f23028#, 16#a5b223bf#, 16#6aba0203#, 16#825ced16#,
16#1c2b8acf#, 16#b492a779#, 16#f2f0f307#, 16#e2a14e69#,
16#f4cd65da#, 16#bed50605#, 16#621fd134#, 16#fe8ac4a6#,
16#539d342e#, 16#55a0a2f3#, 16#e132058a#, 16#eb75a4f6#,
16#ec390b83#, 16#efaa4060#, 16#9f065e71#, 16#1051bd6e#,
16#8af93e21#, 16#063d96dd#, 16#05aedd3e#, 16#bd464de6#,
16#8db59154#, 16#5d0571c4#, 16#d46f0406#, 16#15ff6050#,
16#fb241998#, 16#e997d6bd#, 16#43cc8940#, 16#9e7767d9#,
16#42bdb0e8#, 16#8b880789#, 16#5b38e719#, 16#eedb79c8#,
16#0a47a17c#, 16#0fe97c42#, 16#1ec9f884#, 16#00000000#,
16#86830980#, 16#ed48322b#, 16#70ac1e11#, 16#724e6c5a#,
16#fffbfd0e#, 16#38560f85#, 16#d51e3dae#, 16#3927362d#,
16#d9640a0f#, 16#a621685c#, 16#54d19b5b#, 16#2e3a2436#,
16#67b10c0a#, 16#e70f9357#, 16#96d2b4ee#, 16#919e1b9b#,
16#c54f80c0#, 16#20a261dc#, 16#4b695a77#, 16#1a161c12#,
16#ba0ae293#, 16#2ae5c0a0#, 16#e0433c22#, 16#171d121b#,
16#0d0b0e09#, 16#c7adf28b#, 16#a8b92db6#, 16#a9c8141e#,
16#198557f1#, 16#074caf75#, 16#ddbbee99#, 16#60fda37f#,
16#269ff701#, 16#f5bc5c72#, 16#3bc54466#, 16#7e345bfb#,
16#29768b43#, 16#c6dccb23#, 16#fc68b6ed#, 16#f163b8e4#,
16#dccad731#, 16#85104263#, 16#22401397#, 16#112084c6#,
16#247d854a#, 16#3df8d2bb#, 16#3211aef9#, 16#a16dc729#,
16#2f4b1d9e#, 16#30f3dcb2#, 16#52ec0d86#, 16#e3d077c1#,
16#166c2bb3#, 16#b999a970#, 16#48fa1194#, 16#642247e9#,
16#8cc4a8fc#, 16#3f1aa0f0#, 16#2cd8567d#, 16#90ef2233#,
16#4ec78749#, 16#d1c1d938#, 16#a2fe8cca#, 16#0b3698d4#,
16#81cfa6f5#, 16#de28a57a#, 16#8e26dab7#, 16#bfa43fad#,
16#9de42c3a#, 16#920d5078#, 16#cc9b6a5f#, 16#4662547e#,
16#13c2f68d#, 16#b8e890d8#, 16#f75e2e39#, 16#aff582c3#,
16#80be9f5d#, 16#937c69d0#, 16#2da96fd5#, 16#12b3cf25#,
16#993bc8ac#, 16#7da71018#, 16#636ee89c#, 16#bb7bdb3b#,
16#7809cd26#, 16#18f46e59#, 16#b701ec9a#, 16#9aa8834f#,
16#6e65e695#, 16#e67eaaff#, 16#cf0821bc#, 16#e8e6ef15#,
16#9bd9bae7#, 16#36ce4a6f#, 16#09d4ea9f#, 16#7cd629b0#,
16#b2af31a4#, 16#23312a3f#, 16#9430c6a5#, 16#66c035a2#,
16#bc37744e#, 16#caa6fc82#, 16#d0b0e090#, 16#d81533a7#,
16#984af104#, 16#daf741ec#, 16#500e7fcd#, 16#f62f1791#,
16#d68d764d#, 16#b04d43ef#, 16#4d54ccaa#, 16#04dfe496#,
16#b5e39ed1#, 16#881b4c6a#, 16#1fb8c12c#, 16#517f4665#,
16#ea049d5e#, 16#355d018c#, 16#7473fa87#, 16#412efb0b#,
16#1d5ab367#, 16#d25292db#, 16#5633e910#, 16#47136dd6#,
16#618c9ad7#, 16#0c7a37a1#, 16#148e59f8#, 16#3c89eb13#,
16#27eecea9#, 16#c935b761#, 16#e5ede11c#, 16#b13c7a47#,
16#df599cd2#, 16#733f55f2#, 16#ce791814#, 16#37bf73c7#,
16#cdea53f7#, 16#aa5b5ffd#, 16#6f14df3d#, 16#db867844#,
16#f381caaf#, 16#c43eb968#, 16#342c3824#, 16#405fc2a3#,
16#c372161d#, 16#250cbce2#, 16#498b283c#, 16#9541ff0d#,
16#017139a8#, 16#b3de080c#, 16#e49cd8b4#, 16#c1906456#,
16#84617bcb#, 16#b670d532#, 16#5c74486c#, 16#5742d0b8#);
Td3 : constant Sbox := (
16#f4a75051#, 16#4165537e#, 16#17a4c31a#, 16#275e963a#,
16#ab6bcb3b#, 16#9d45f11f#, 16#fa58abac#, 16#e303934b#,
16#30fa5520#, 16#766df6ad#, 16#cc769188#, 16#024c25f5#,
16#e5d7fc4f#, 16#2acbd7c5#, 16#35448026#, 16#62a38fb5#,
16#b15a49de#, 16#ba1b6725#, 16#ea0e9845#, 16#fec0e15d#,
16#2f7502c3#, 16#4cf01281#, 16#4697a38d#, 16#d3f9c66b#,
16#8f5fe703#, 16#929c9515#, 16#6d7aebbf#, 16#5259da95#,
16#be832dd4#, 16#7421d358#, 16#e0692949#, 16#c9c8448e#,
16#c2896a75#, 16#8e7978f4#, 16#583e6b99#, 16#b971dd27#,
16#e14fb6be#, 16#88ad17f0#, 16#20ac66c9#, 16#ce3ab47d#,
16#df4a1863#, 16#1a3182e5#, 16#51336097#, 16#537f4562#,
16#6477e0b1#, 16#6bae84bb#, 16#81a01cfe#, 16#082b94f9#,
16#48685870#, 16#45fd198f#, 16#de6c8794#, 16#7bf8b752#,
16#73d323ab#, 16#4b02e272#, 16#1f8f57e3#, 16#55ab2a66#,
16#eb2807b2#, 16#b5c2032f#, 16#c57b9a86#, 16#3708a5d3#,
16#2887f230#, 16#bfa5b223#, 16#036aba02#, 16#16825ced#,
16#cf1c2b8a#, 16#79b492a7#, 16#07f2f0f3#, 16#69e2a14e#,
16#daf4cd65#, 16#05bed506#, 16#34621fd1#, 16#a6fe8ac4#,
16#2e539d34#, 16#f355a0a2#, 16#8ae13205#, 16#f6eb75a4#,
16#83ec390b#, 16#60efaa40#, 16#719f065e#, 16#6e1051bd#,
16#218af93e#, 16#dd063d96#, 16#3e05aedd#, 16#e6bd464d#,
16#548db591#, 16#c45d0571#, 16#06d46f04#, 16#5015ff60#,
16#98fb2419#, 16#bde997d6#, 16#4043cc89#, 16#d99e7767#,
16#e842bdb0#, 16#898b8807#, 16#195b38e7#, 16#c8eedb79#,
16#7c0a47a1#, 16#420fe97c#, 16#841ec9f8#, 16#00000000#,
16#80868309#, 16#2bed4832#, 16#1170ac1e#, 16#5a724e6c#,
16#0efffbfd#, 16#8538560f#, 16#aed51e3d#, 16#2d392736#,
16#0fd9640a#, 16#5ca62168#, 16#5b54d19b#, 16#362e3a24#,
16#0a67b10c#, 16#57e70f93#, 16#ee96d2b4#, 16#9b919e1b#,
16#c0c54f80#, 16#dc20a261#, 16#774b695a#, 16#121a161c#,
16#93ba0ae2#, 16#a02ae5c0#, 16#22e0433c#, 16#1b171d12#,
16#090d0b0e#, 16#8bc7adf2#, 16#b6a8b92d#, 16#1ea9c814#,
16#f1198557#, 16#75074caf#, 16#99ddbbee#, 16#7f60fda3#,
16#01269ff7#, 16#72f5bc5c#, 16#663bc544#, 16#fb7e345b#,
16#4329768b#, 16#23c6dccb#, 16#edfc68b6#, 16#e4f163b8#,
16#31dccad7#, 16#63851042#, 16#97224013#, 16#c6112084#,
16#4a247d85#, 16#bb3df8d2#, 16#f93211ae#, 16#29a16dc7#,
16#9e2f4b1d#, 16#b230f3dc#, 16#8652ec0d#, 16#c1e3d077#,
16#b3166c2b#, 16#70b999a9#, 16#9448fa11#, 16#e9642247#,
16#fc8cc4a8#, 16#f03f1aa0#, 16#7d2cd856#, 16#3390ef22#,
16#494ec787#, 16#38d1c1d9#, 16#caa2fe8c#, 16#d40b3698#,
16#f581cfa6#, 16#7ade28a5#, 16#b78e26da#, 16#adbfa43f#,
16#3a9de42c#, 16#78920d50#, 16#5fcc9b6a#, 16#7e466254#,
16#8d13c2f6#, 16#d8b8e890#, 16#39f75e2e#, 16#c3aff582#,
16#5d80be9f#, 16#d0937c69#, 16#d52da96f#, 16#2512b3cf#,
16#ac993bc8#, 16#187da710#, 16#9c636ee8#, 16#3bbb7bdb#,
16#267809cd#, 16#5918f46e#, 16#9ab701ec#, 16#4f9aa883#,
16#956e65e6#, 16#ffe67eaa#, 16#bccf0821#, 16#15e8e6ef#,
16#e79bd9ba#, 16#6f36ce4a#, 16#9f09d4ea#, 16#b07cd629#,
16#a4b2af31#, 16#3f23312a#, 16#a59430c6#, 16#a266c035#,
16#4ebc3774#, 16#82caa6fc#, 16#90d0b0e0#, 16#a7d81533#,
16#04984af1#, 16#ecdaf741#, 16#cd500e7f#, 16#91f62f17#,
16#4dd68d76#, 16#efb04d43#, 16#aa4d54cc#, 16#9604dfe4#,
16#d1b5e39e#, 16#6a881b4c#, 16#2c1fb8c1#, 16#65517f46#,
16#5eea049d#, 16#8c355d01#, 16#877473fa#, 16#0b412efb#,
16#671d5ab3#, 16#dbd25292#, 16#105633e9#, 16#d647136d#,
16#d7618c9a#, 16#a10c7a37#, 16#f8148e59#, 16#133c89eb#,
16#a927eece#, 16#61c935b7#, 16#1ce5ede1#, 16#47b13c7a#,
16#d2df599c#, 16#f2733f55#, 16#14ce7918#, 16#c737bf73#,
16#f7cdea53#, 16#fdaa5b5f#, 16#3d6f14df#, 16#44db8678#,
16#aff381ca#, 16#68c43eb9#, 16#24342c38#, 16#a3405fc2#,
16#1dc37216#, 16#e2250cbc#, 16#3c498b28#, 16#0d9541ff#,
16#a8017139#, 16#0cb3de08#, 16#b4e49cd8#, 16#56c19064#,
16#cb84617b#, 16#32b670d5#, 16#6c5c7448#, 16#b85742d0#);
Td4 : constant Final_Sbox := (
16#52#, 16#09#, 16#6a#, 16#d5#, 16#30#, 16#36#, 16#a5#, 16#38#,
16#bf#, 16#40#, 16#a3#, 16#9e#, 16#81#, 16#f3#, 16#d7#, 16#fb#,
16#7c#, 16#e3#, 16#39#, 16#82#, 16#9b#, 16#2f#, 16#ff#, 16#87#,
16#34#, 16#8e#, 16#43#, 16#44#, 16#c4#, 16#de#, 16#e9#, 16#cb#,
16#54#, 16#7b#, 16#94#, 16#32#, 16#a6#, 16#c2#, 16#23#, 16#3d#,
16#ee#, 16#4c#, 16#95#, 16#0b#, 16#42#, 16#fa#, 16#c3#, 16#4e#,
16#08#, 16#2e#, 16#a1#, 16#66#, 16#28#, 16#d9#, 16#24#, 16#b2#,
16#76#, 16#5b#, 16#a2#, 16#49#, 16#6d#, 16#8b#, 16#d1#, 16#25#,
16#72#, 16#f8#, 16#f6#, 16#64#, 16#86#, 16#68#, 16#98#, 16#16#,
16#d4#, 16#a4#, 16#5c#, 16#cc#, 16#5d#, 16#65#, 16#b6#, 16#92#,
16#6c#, 16#70#, 16#48#, 16#50#, 16#fd#, 16#ed#, 16#b9#, 16#da#,
16#5e#, 16#15#, 16#46#, 16#57#, 16#a7#, 16#8d#, 16#9d#, 16#84#,
16#90#, 16#d8#, 16#ab#, 16#00#, 16#8c#, 16#bc#, 16#d3#, 16#0a#,
16#f7#, 16#e4#, 16#58#, 16#05#, 16#b8#, 16#b3#, 16#45#, 16#06#,
16#d0#, 16#2c#, 16#1e#, 16#8f#, 16#ca#, 16#3f#, 16#0f#, 16#02#,
16#c1#, 16#af#, 16#bd#, 16#03#, 16#01#, 16#13#, 16#8a#, 16#6b#,
16#3a#, 16#91#, 16#11#, 16#41#, 16#4f#, 16#67#, 16#dc#, 16#ea#,
16#97#, 16#f2#, 16#cf#, 16#ce#, 16#f0#, 16#b4#, 16#e6#, 16#73#,
16#96#, 16#ac#, 16#74#, 16#22#, 16#e7#, 16#ad#, 16#35#, 16#85#,
16#e2#, 16#f9#, 16#37#, 16#e8#, 16#1c#, 16#75#, 16#df#, 16#6e#,
16#47#, 16#f1#, 16#1a#, 16#71#, 16#1d#, 16#29#, 16#c5#, 16#89#,
16#6f#, 16#b7#, 16#62#, 16#0e#, 16#aa#, 16#18#, 16#be#, 16#1b#,
16#fc#, 16#56#, 16#3e#, 16#4b#, 16#c6#, 16#d2#, 16#79#, 16#20#,
16#9a#, 16#db#, 16#c0#, 16#fe#, 16#78#, 16#cd#, 16#5a#, 16#f4#,
16#1f#, 16#dd#, 16#a8#, 16#33#, 16#88#, 16#07#, 16#c7#, 16#31#,
16#b1#, 16#12#, 16#10#, 16#59#, 16#27#, 16#80#, 16#ec#, 16#5f#,
16#60#, 16#51#, 16#7f#, 16#a9#, 16#19#, 16#b5#, 16#4a#, 16#0d#,
16#2d#, 16#e5#, 16#7a#, 16#9f#, 16#93#, 16#c9#, 16#9c#, 16#ef#,
16#a0#, 16#e0#, 16#3b#, 16#4d#, 16#ae#, 16#2a#, 16#f5#, 16#b0#,
16#c8#, 16#eb#, 16#bb#, 16#3c#, 16#83#, 16#53#, 16#99#, 16#61#,
16#17#, 16#2b#, 16#04#, 16#7e#, 16#ba#, 16#77#, 16#d6#, 16#26#,
16#e1#, 16#69#, 16#14#, 16#63#, 16#55#, 16#21#, 16#0c#, 16#7d#);
Rcon : constant Key_Sbox := (
16#01000000#, 16#02000000#, 16#04000000#, 16#08000000#,
16#10000000#, 16#20000000#, 16#40000000#, 16#80000000#,
16#1B000000#, 16#36000000#); -- for 128-bit blocks, Rijndael never uses more than 10 rcon values
function To_Unsigned_32 (Data : in Stream_Element_Array;
Offset : in Stream_Element_Offset) return Unsigned_32 is
begin
return Shift_Left (Unsigned_32 (Data (Data'First + Offset)), 24) or
Shift_Left (Unsigned_32 (Data (Data'First + Offset + 1)), 16) or
Shift_Left (Unsigned_32 (Data (Data'First + Offset + 2)), 8) or
Unsigned_32 (Data (Data'First + Offset + 3));
end To_Unsigned_32;
procedure Put_Unsigned_32 (Data : in out Block_Type;
Value : in Unsigned_32;
Offset : in Stream_Element_Offset) is
begin
Data (Data'First + Offset) := Stream_Element (Shift_Right (Value, 24));
Data (Data'First + Offset + 1) := Stream_Element (Shift_Right (Value, 16) and 16#0ff#);
Data (Data'First + Offset + 2) := Stream_Element (Shift_Right (Value, 8) and 16#0ff#);
Data (Data'First + Offset + 3) := Stream_Element (Value and 16#0ff#);
end Put_Unsigned_32;
procedure Set_Encrypt_Key (Key : out Key_Type;
Data : in Stream_Element_Array) is
Temp : Unsigned_32;
N : Natural := 0;
I : Natural := 0;
begin
Key.Key (0) := To_Unsigned_32 (Data, 0);
Key.Key (1) := To_Unsigned_32 (Data, 4);
Key.Key (2) := To_Unsigned_32 (Data, 8);
Key.Key (3) := To_Unsigned_32 (Data, 12);
if Data'Length = 128 / 8 then
Key.Rounds := 10;
loop
Temp := Key.Key (N + 3);
Key.Key (N + 4) := Key.Key (n + 0)
xor (Te2 (Shift_Right (Temp, 16) and 16#0ff#) and 16#ff000000#)
xor (Te3 (Shift_Right (Temp, 8) and 16#0ff#) and 16#00ff0000#)
xor (Te0 (Temp and 16#0ff#) and 16#0000ff00#)
xor (Te1 (Shift_Right (Temp, 24) and 16#0ff#) and 16#00ff#)
xor Rcon (I);
Key.Key (N + 5) := Key.Key (N + 1) xor Key.Key (N + 4);
Key.Key (N + 6) := Key.Key (N + 2) xor Key.Key (N + 5);
Key.Key (N + 7) := Key.Key (N + 3) xor Key.Key (N + 6);
I := I + 1;
exit when I = 10;
N := N + 4;
end loop;
return;
end if;
Key.Key (4) := To_Unsigned_32 (Data, 16);
Key.Key (5) := To_Unsigned_32 (Data, 20);
if Data'Length = 192 / 8 then
Key.Rounds := 12;
loop
Temp := Key.Key (N + 5);
Key.Key (N + 6) := Key.Key (N + 0)
xor (Te2 (Shift_Right (Temp, 16) and 16#0ff#) and 16#ff000000#)
xor (Te3 (Shift_Right (Temp, 8) and 16#0ff#) and 16#00ff0000#)
xor (Te0 (Temp and 16#0ff#) and 16#0000ff00#)
xor (Te1 (Shift_Right (Temp, 24) and 16#0ff#) and 16#00ff#)
xor Rcon (I);
Key.Key (N + 7) := Key.Key (N + 1) xor Key.Key (N + 6);
Key.Key (N + 8) := Key.Key (N + 2) xor Key.Key (N + 7);
Key.Key (N + 9) := Key.Key (N + 3) xor Key.Key (N + 8);
I := I + 1;
exit when I = 8;
Key.Key (N + 10) := Key.Key (N + 4) xor Key.Key (N + 9);
Key.Key (N + 11) := Key.Key (N + 5) xor Key.Key (N + 10);
N := N + 6;
end loop;
return;
end if;
Key.Key (6) := To_Unsigned_32 (Data, 24);
Key.Key (7) := To_Unsigned_32 (Data, 28);
if Data'Length = 256 / 8 then
Key.Rounds := 14;
loop
Temp := Key.Key (N + 7);
Key.Key (N + 8) := Key.Key (N + 0)
xor (Te2 (Shift_Right (Temp, 16) and 16#0ff#) and 16#ff000000#)
xor (Te3 (Shift_Right (Temp, 8) and 16#0ff#) and 16#00ff0000#)
xor (Te0 (Temp and 16#0ff#) and 16#0000ff00#)
xor (Te1 (Shift_Right (Temp, 24) and 16#0ff#) and 16#00ff#)
xor Rcon (I);
Key.Key (N + 8) := Key.Key (N + 0);
Key.Key (N + 8) := Key.Key (N + 8) xor (Te2 (Shift_Right (Temp, 16) and 16#0ff#) and 16#ff000000#);
Key.Key (N + 8) := Key.Key (N + 8) xor (Te3 (Shift_Right (Temp, 8) and 16#0ff#) and 16#00ff0000#);
Key.Key (N + 8) := Key.Key (N + 8) xor (Te0 (Temp and 16#0ff#) and 16#0000ff00#);
Key.Key (N + 8) := Key.Key (N + 8) xor (Te1 (Shift_Right (Temp, 24) and 16#0ff#) and 16#00ff#);
Key.Key (N + 8) := Key.Key (N + 8) xor Rcon (I);
Key.Key (N + 9) := Key.Key (N + 1) xor Key.Key (N + 8);
Key.Key (N + 10) := Key.Key (N + 2) xor Key.Key (N + 9);
Key.Key (N + 11) := Key.Key (N + 3) xor Key.Key (N + 10);
I := I + 1;
exit when I = 7;
Temp := Key.Key (N + 11);
Key.Key (N + 12) := Key.Key (N + 4)
xor (Te2 (Shift_Right (Temp, 24) and 16#0ff#) and 16#ff000000#)
xor (Te3 (Shift_Right (Temp, 16) and 16#0ff#) and 16#00ff0000#)
xor (Te0 (Shift_Right (Temp, 8) and 16#0ff#) and 16#0000ff00#)
xor (Te1 (Temp and 16#0ff#) and 16#00ff#);
Key.Key (N + 13) := Key.Key (N + 5) xor Key.Key (N + 12);
Key.Key (N + 14) := Key.Key (N + 6) xor Key.Key (N + 13);
Key.Key (N + 15) := Key.Key (N + 7) xor Key.Key (N + 14);
N := N + 8;
end loop;
return;
end if;
end Set_Encrypt_Key;
procedure Swap (A, B : in out Unsigned_32) is
Temp : constant Unsigned_32 := A;
begin
A := B;
B := Temp;
end Swap;
procedure Set_Decrypt_Key (Key : out Key_Type;
Data : in Ada.Streams.Stream_Element_Array) is
I : Natural := 0;
J : Natural := 0;
Last : Natural;
begin
Set_Encrypt_Key (Key, Data);
Last := 4 * Key.Rounds;
J := Last;
while I < J loop
Swap (Key.Key (I), Key.Key (J));
Swap (Key.Key (I + 1), Key.Key (J + 1));
Swap (Key.Key (I + 2), Key.Key (J + 2));
Swap (Key.Key (I + 3), Key.Key (J + 3));
I := I + 4;
J := J - 4;
end loop;
I := 4;
while I < Last - 4 loop
Key.Key (I) := Td0 (Te4 (Shift_Right (Key.Key (I), 24) and 16#0ff#) and 16#0ff#)
xor Td1 (Te4 (Shift_Right (Key.Key (I), 16) and 16#0ff#) and 16#0ff#)
xor Td2 (Te4 (Shift_Right (Key.Key (I), 8) and 16#0ff#) and 16#0ff#)
xor Td3 (Te4 (Key.Key (I) and 16#0ff#) and 16#0ff#);
Key.Key (I + 1) := Td0 (Te4 (Shift_Right (Key.Key (I + 1), 24) and 16#0ff#) and 16#0ff#)
xor Td1 (Te4 (Shift_Right (Key.Key (I + 1), 16) and 16#0ff#) and 16#0ff#)
xor Td2 (Te4 (Shift_Right (Key.Key (I + 1), 8) and 16#0ff#) and 16#0ff#)
xor Td3 (Te4 (Key.Key (I + 1) and 16#0ff#) and 16#0ff#);
Key.Key (I + 2) := Td0 (Te4 (Shift_Right (Key.Key (I + 2), 24) and 16#0ff#) and 16#0ff#)
xor Td1 (Te4 (Shift_Right (Key.Key (I + 2), 16) and 16#0ff#) and 16#0ff#)
xor Td2 (Te4 (Shift_Right (Key.Key (I + 2), 8) and 16#0ff#) and 16#0ff#)
xor Td3 (Te4 (Key.Key (I + 2) and 16#0ff#) and 16#0ff#);
Key.Key (I + 3) := Td0 (Te4 (Shift_Right (Key.Key (I + 3), 24) and 16#0ff#) and 16#0ff#)
xor Td1 (Te4 (Shift_Right (Key.Key (I + 3), 16) and 16#0ff#) and 16#0ff#)
xor Td2 (Te4 (Shift_Right (Key.Key (I + 3), 8) and 16#0ff#) and 16#0ff#)
xor Td3 (Te4 (Key.Key (I + 3) and 16#0ff#) and 16#0ff#);
I := I + 4;
end loop;
end Set_Decrypt_Key;
-- ------------------------------
-- Encodes the binary input stream represented by <b>Data</b> into
-- an SHA-1 hash output stream <b>Into</b>.
--
-- If the transformer does not have enough room to write the result,
-- it must return in <b>Encoded</b> the index of the last encoded
-- position in the <b>Data</b> stream.
--
-- The transformer returns in <b>Last</b> the last valid position
-- in the output stream <b>Into</b>.
--
-- The <b>Encoding_Error</b> exception is raised if the input
-- stream cannot be transformed.
-- ------------------------------
overriding
procedure Transform (E : in out Encoder;
Data : in Ada.Streams.Stream_Element_Array;
Into : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
Encoded : out Ada.Streams.Stream_Element_Offset) is
pragma Unreferenced (E);
begin
null;
end Transform;
-- ------------------------------
-- Set the encryption key to use.
-- ------------------------------
procedure Set_Key (E : in out Encoder;
Data : in Ada.Streams.Stream_Element_Array;
Mode : in AES_Mode := CBC) is
begin
Set_Encrypt_Key (E.Key, Data);
E.Mode := Mode;
end Set_Key;
procedure Encrypt (Input : in Ada.Streams.Stream_Element_Array;
Output : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
Key : in Key_Type) is
First : Ada.Streams.Stream_Element_Offset := Input'First;
Pad : Ada.Streams.Stream_Element_Offset;
Remain : Ada.Streams.Stream_Element_Offset;
begin
Last := Output'First;
while First + 16 <= Input'Last loop
Encrypt (Input (First .. First + 16),
Output (Last .. Last + 16),
Key);
First := First + 16;
Last := Last + 16;
end loop;
Remain := Input'Last - First;
if Remain > 0 then
declare
B : Block_Type;
begin
Pad := B'Length - Remain;
B (B'First .. B'First + Remain - 1) := Input (First .. Input'Last);
B (B'First + Remain .. B'Last) := (others => Stream_Element (Pad));
Encrypt (B, Output (Last .. Last + 16), Key);
Last := Last + 16;
end;
end if;
end Encrypt;
procedure Encrypt (Input : in Block_Type;
Output : out Block_Type;
Key : in Key_Type) is
S0, S1, S2, S3 : Unsigned_32;
T0, T1, T2, T3 : Unsigned_32;
N : Natural := 0;
R : Natural := Key.Rounds / 2;
begin
S0 := To_Unsigned_32 (Input, 0) xor Key.Key (0);
S1 := To_Unsigned_32 (Input, 4) xor Key.Key (1);
S2 := To_Unsigned_32 (Input, 8) xor Key.Key (2);
S3 := To_Unsigned_32 (Input, 12) xor Key.Key (3);
loop
T0 := Te0 (Shift_Right (S0, 24) and 16#0ff#)
xor Te1 (Shift_Right (S1, 16) and 16#0ff#)
xor Te2 (Shift_Right (S2, 8) and 16#0ff#)
xor Te3 (S3 and 16#0ff#)
xor Key.Key (N + 4);
T1 := Te0 (Shift_Right (S1, 24) and 16#0ff#)
xor Te1 (Shift_Right (S2, 16) and 16#0ff#)
xor Te2 (Shift_Right (S3, 8) and 16#0ff#)
xor Te3 (S0 and 16#0ff#)
xor Key.Key (N + 5);
T2 := Te0 (Shift_Right (S2, 24) and 16#0ff#)
xor Te1 (Shift_Right (S3, 16) and 16#0ff#)
xor Te2 (Shift_Right (S0, 8) and 16#0ff#)
xor Te3 (S1 and 16#0ff#)
xor Key.Key (N + 6);
T3 := Te0 (Shift_Right (S3, 24) and 16#0ff#)
xor Te1 (Shift_Right (S0, 16) and 16#0ff#)
xor Te2 (Shift_Right (S1, 8) and 16#0ff#)
xor Te3 (S2 and 16#0ff#)
xor Key.Key (N + 7);
N := N + 8;
R := R - 1;
exit when R = 0;
S0 := Te0 (Shift_Right (T0, 24) and 16#0ff#)
xor Te1 (Shift_Right (T1, 16) and 16#0ff#)
xor Te2 (Shift_Right (T2, 8) and 16#0ff#)
xor Te3 (T3 and 16#0ff#)
xor Key.Key (N + 0);
S1 := Te0 (Shift_Right (T1, 24) and 16#0ff#)
xor Te1 (Shift_Right (T2, 16) and 16#0ff#)
xor Te2 (Shift_Right (T3, 8) and 16#0ff#)
xor Te3 (T0 and 16#0ff#)
xor Key.Key (N + 1);
S2 := Te0 (Shift_Right (T2, 24) and 16#0ff#)
xor Te1 (Shift_Right (T3, 16) and 16#0ff#)
xor Te2 (Shift_Right (T0, 8) and 16#0ff#)
xor Te3 (T1 and 16#0ff#)
xor Key.Key (N + 2);
S3 := Te0 (Shift_Right (T3, 24) and 16#0ff#)
xor Te1 (Shift_Right (T0, 16) and 16#0ff#)
xor Te2 (Shift_Right (T1, 8) and 16#0ff#)
xor Te3 (T2 and 16#0ff#)
xor Key.Key (N + 3);
end loop;
S0 := (Te2 (Shift_Right (T0, 24) and 16#0ff#) and 16#ff000000#)
xor (Te3 (Shift_Right (T1, 16) and 16#0ff#) and 16#00ff0000#)
xor (Te0 (Shift_Right (T2, 8) and 16#0ff#) and 16#0ff00#)
xor (Te1 (T3 and 16#0ff#) and 16#0ff#)
xor Key.Key (N);
Put_Unsigned_32 (Output, S0, 0);
S1 := (Te2 (Shift_Right (T1, 24) and 16#0ff#) and 16#ff000000#)
xor (Te3 (Shift_Right (T2, 16) and 16#0ff#) and 16#00ff0000#)
xor (Te0 (Shift_Right (T3, 8) and 16#0ff#) and 16#0ff00#)
xor (Te1 (T0 and 16#0ff#) and 16#0ff#)
xor Key.Key (N + 1);
Put_Unsigned_32 (Output, S1, 4);
S2 := (Te2 (Shift_Right (T2, 24) and 16#0ff#) and 16#ff000000#)
xor (Te3 (Shift_Right (T3, 16) and 16#0ff#) and 16#00ff0000#)
xor (Te0 (Shift_Right (T0, 8) and 16#0ff#) and 16#0ff00#)
xor (Te1 (T1 and 16#0ff#) and 16#0ff#)
xor Key.Key (N + 2);
Put_Unsigned_32 (Output, S2, 8);
S3 := (Te2 (Shift_Right (T3, 24) and 16#0ff#) and 16#ff000000#)
xor (Te3 (Shift_Right (T0, 16) and 16#0ff#) and 16#00ff0000#)
xor (Te0 (Shift_Right (T1, 8) and 16#0ff#) and 16#0ff00#)
xor (Te1 (T2 and 16#0ff#) and 16#0ff#)
xor Key.Key (N + 3);
Put_Unsigned_32 (Output, S3, 12);
end Encrypt;
procedure Decrypt (Input : in Block_Type;
Output : out Block_Type;
Key : in Key_Type) is
S0, S1, S2, S3 : Unsigned_32;
T0, T1, T2, T3 : Unsigned_32;
N : Natural := 0;
R : Natural := Key.Rounds / 2;
begin
S0 := To_Unsigned_32 (Input, 0) xor Key.Key (0);
S1 := To_Unsigned_32 (Input, 4) xor Key.Key (1);
S2 := To_Unsigned_32 (Input, 8) xor Key.Key (2);
S3 := To_Unsigned_32 (Input, 12) xor Key.Key (3);
loop
T0 := Td0 (Shift_Right (S0, 24) and 16#0ff#)
xor Td1 (Shift_Right (S3, 16) and 16#0ff#)
xor Td2 (Shift_Right (S2, 8) and 16#0ff#)
xor Td3 (S1 and 16#0ff#)
xor Key.Key (N + 4);
T1 := Td0 (Shift_Right (S1, 24) and 16#0ff#)
xor Td1 (Shift_Right (S0, 16) and 16#0ff#)
xor Td2 (Shift_Right (S3, 8) and 16#0ff#)
xor Td3 (S2 and 16#0ff#)
xor Key.Key (N + 5);
T2 := Td0 (Shift_Right (S2, 24) and 16#0ff#)
xor Td1 (Shift_Right (S1, 16) and 16#0ff#)
xor Td2 (Shift_Right (S0, 8) and 16#0ff#)
xor Td3 (S3 and 16#0ff#)
xor Key.Key (N + 6);
T3 := Td0 (Shift_Right (S3, 24) and 16#0ff#)
xor Td1 (Shift_Right (S2, 16) and 16#0ff#)
xor Td2 (Shift_Right (S1, 8) and 16#0ff#)
xor Td3 (S0 and 16#0ff#)
xor Key.Key (N + 7);
N := N + 8;
R := R - 1;
exit when R = 0;
S0 := Td0 (Shift_Right (T0, 24) and 16#0ff#)
xor Td1 (Shift_Right (T3, 16) and 16#0ff#)
xor Td2 (Shift_Right (T2, 8) and 16#0ff#)
xor Td3 (T1 and 16#0ff#)
xor Key.Key (N + 0);
S1 := Td0 (Shift_Right (T1, 24) and 16#0ff#)
xor Td1 (Shift_Right (T0, 16) and 16#0ff#)
xor Td2 (Shift_Right (T3, 8) and 16#0ff#)
xor Td3 (T2 and 16#0ff#)
xor Key.Key (N + 1);
S2 := Td0 (Shift_Right (T2, 24) and 16#0ff#)
xor Td1 (Shift_Right (T1, 16) and 16#0ff#)
xor Td2 (Shift_Right (T0, 8) and 16#0ff#)
xor Td3 (T3 and 16#0ff#)
xor Key.Key (N + 2);
S3 := Td0 (Shift_Right (T3, 24) and 16#0ff#)
xor Td1 (Shift_Right (T2, 16) and 16#0ff#)
xor Td2 (Shift_Right (T1, 8) and 16#0ff#)
xor Td3 (T0 and 16#0ff#)
xor Key.Key (N + 3);
end loop;
S0 := Shift_Left (Unsigned_32 (Td4 (Shift_Right (T0, 24) and 16#0ff#)), 24)
xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T3, 16) and 16#0ff#)), 16)
xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T2, 8) and 16#0ff#)), 8)
xor Unsigned_32 (Td4 (T1 and 16#0ff#))
xor Key.Key (N);
Put_Unsigned_32 (Output, S0, 0);
S1 := Shift_Left (Unsigned_32 (Td4 (Shift_Right (T1, 24) and 16#0ff#)), 24)
xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T0, 16) and 16#0ff#)), 16)
xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T3, 8) and 16#0ff#)), 8)
xor Unsigned_32 (Td4 (T2 and 16#0ff#))
xor Key.Key (N + 1);
Put_Unsigned_32 (Output, S1, 4);
S2 := Shift_Left (Unsigned_32 (Td4 (Shift_Right (T2, 24) and 16#0ff#)), 24)
xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T1, 16) and 16#0ff#)), 16)
xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T0, 8) and 16#0ff#)), 8)
xor Unsigned_32 (Td4 (T3 and 16#0ff#))
xor Key.Key (N + 2);
Put_Unsigned_32 (Output, S2, 8);
S3 := Shift_Left (Unsigned_32 (Td4 (Shift_Right (T3, 24) and 16#0ff#)), 24)
xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T2, 16) and 16#0ff#)), 16)
xor Shift_Left (Unsigned_32 (Td4 (Shift_Right (T1, 8) and 16#0ff#)), 8)
xor Unsigned_32 (Td4 (T0 and 16#0ff#))
xor Key.Key (N + 3);
Put_Unsigned_32 (Output, S3, 12);
end Decrypt;
end Util.Encoders.AES;
|
msrLi/portingSources | Ada | 875 | ads | -- Copyright 2008-2014 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package Pck is
First : Character := ASCII.NUL;
Last : Character := ASCII.NUL;
Length : Integer := 0;
procedure Call_Me (Str : String);
end Pck;
|
peterfrankjohnson/kernel | Ada | 4,281 | ads | with Types; use Types;
with CPU; use CPU;
package Device.PIC is
PIC1_CommandPort : constant Word := 16#0020#;
PIC1_DataPort : constant Word := 16#0021#;
PIC2_CommandPort : constant Word := 16#00A0#;
PIC2_DataPort : constant Word := 16#00A1#;
type InitialisationCommandWord1 is
record
-- The last three bits are only used on the 8080 and 8085
Unused3 : Boolean;
Unused2 : Boolean;
Unused1 : Boolean;
-- This should always be set to true when issuing ICW1
ICW1BeingIssued : Boolean;
-- Sets all IR lines to Level triggered mode, ISA bus only supports Edge
LevelTriggeredMode : Boolean;
-- Used only in 8085, sets ISRs to be 4 bytes apart if true
InterruptVector4Byte : Boolean;
-- This enables or disables the second 8259
-- Set to true to only use the first (Single Mode)
-- Leave false to use both 8259's (Cascaded Mode)
SingleMode : Boolean;
ICW4Required : Boolean;
end record;
for InitialisationCommandWord1'Size use 8;
-- for InitialisationCommandWord1'Component_Size use 1;
pragma Pack (InitialisationCommandWord1);
pragma Convention (C, InitialisationCommandWord1);
subtype InitialisationCommandWord2 is Byte;
type InitialisationCommandWord3 is
record
IRPin7 : Boolean;
IRPin6 : Boolean;
IRPin5 : Boolean;
IRPin4 : Boolean;
IRPin3 : Boolean;
IRPin2 : Boolean;
IRPin1 : Boolean;
IRPin0 : Boolean;
end record;
for InitialisationCommandWord3'Size use 8;
pragma Pack (InitialisationCommandWord3);
type InitialisationCommandWord4 is
record
Reserved3 : Boolean;
Reserved2 : Boolean;
Reserved1 : Boolean;
-- Set to True to enable Special Fully Nested Mode
-- False enables Fully Nested Mode
SpecialFullyNestedMode : Boolean;
-- This is going to be moved to using a 2 bit record type.
-- The next two are used together
-- Turns on Buffered Mode (used in conjunction with MasterSlave bit)
Buffered : Boolean;
-- False indicates Slave, True indicates Master (used in conjunction with Buffered bit)
MasterSlave : Boolean;
-- Set to True to enable Automatic End-Of-Interrupt Command, False for Normal EOI
AutoEOI : Boolean;
-- Set to True to enable 8086 mode, False for 8085
Mode8086 : Boolean;
end record;
for InitialisationCommandWord4'Size use 8;
pragma Pack (InitialisationCommandWord4);
type OperationalCommandWord1 is
record
Pin7Mask : Boolean;
Pin6Mask : Boolean;
Pin5Mask : Boolean;
Pin4Mask : Boolean;
Pin3Mask : Boolean;
Pin2Mask : Boolean;
Pin1Mask : Boolean;
Pin0Mask : Boolean;
end record;
for OperationalCommandWord1'Size use 8;
pragma Pack (OperationalCommandWord1);
type OperationalCommandWord2 is
record
RotatePriority : Boolean;
SpecificEndOfInterrupt : Boolean;
EndOfInterrupt : Boolean;
Unused1 : Boolean;
Unused2 : Boolean;
-- Interrupt : ThreeBits;
InterruptBit1 : Boolean;
InterruptBit2 : Boolean;
InterruptBit3 : Boolean;
end record;
for OperationalCommandWord2'Size use 8;
pragma Pack (OperationalCommandWord2);
procedure Disable;
procedure Enable;
procedure Initialise;
procedure Mask;
procedure Remap (Offset1 : Byte; Offset2 : Byte);
procedure IRQ0;
procedure IRQ1;
procedure IRQ2;
procedure IRQ3;
procedure IRQ4;
procedure IRQ5;
procedure IRQ6;
procedure IRQ7;
procedure IRQ8;
procedure IRQ9;
procedure IRQ10;
procedure IRQ11;
procedure IRQ12;
procedure IRQ13;
procedure IRQ14;
procedure IRQ15;
end Device.PIC;
|
ekoeppen/MSP430_Generic_Ada_Drivers | Ada | 29 | ads | package Ports is
end Ports;
|
AdaCore/Ada_Drivers_Library | Ada | 19,565 | ads | -- Copyright (c) 2013, Nordic Semiconductor ASA
-- 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 Nordic Semiconductor ASA nor the names of its
-- contributors may be used to endorse or promote products derived from
-- this software without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--
-- This spec has been automatically generated from nrf51.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package NRF_SVD.QDEC is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Shortcut between REPORTRDY event and READCLRACC task.
type SHORTS_REPORTRDY_READCLRACC_Field is
(-- Shortcut disabled.
Disabled,
-- Shortcut enabled.
Enabled)
with Size => 1;
for SHORTS_REPORTRDY_READCLRACC_Field use
(Disabled => 0,
Enabled => 1);
-- Shortcut between SAMPLERDY event and STOP task.
type SHORTS_SAMPLERDY_STOP_Field is
(-- Shortcut disabled.
Disabled,
-- Shortcut enabled.
Enabled)
with Size => 1;
for SHORTS_SAMPLERDY_STOP_Field use
(Disabled => 0,
Enabled => 1);
-- Shortcuts for the QDEC.
type SHORTS_Register is record
-- Shortcut between REPORTRDY event and READCLRACC task.
REPORTRDY_READCLRACC : SHORTS_REPORTRDY_READCLRACC_Field :=
NRF_SVD.QDEC.Disabled;
-- Shortcut between SAMPLERDY event and STOP task.
SAMPLERDY_STOP : SHORTS_SAMPLERDY_STOP_Field :=
NRF_SVD.QDEC.Disabled;
-- unspecified
Reserved_2_31 : HAL.UInt30 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for SHORTS_Register use record
REPORTRDY_READCLRACC at 0 range 0 .. 0;
SAMPLERDY_STOP at 0 range 1 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
-- Enable interrupt on SAMPLERDY event.
type INTENSET_SAMPLERDY_Field is
(-- Interrupt disabled.
Disabled,
-- Interrupt enabled.
Enabled)
with Size => 1;
for INTENSET_SAMPLERDY_Field use
(Disabled => 0,
Enabled => 1);
-- Enable interrupt on SAMPLERDY event.
type INTENSET_SAMPLERDY_Field_1 is
(-- Reset value for the field
Intenset_Samplerdy_Field_Reset,
-- Enable interrupt on write.
Set)
with Size => 1;
for INTENSET_SAMPLERDY_Field_1 use
(Intenset_Samplerdy_Field_Reset => 0,
Set => 1);
-- Enable interrupt on REPORTRDY event.
type INTENSET_REPORTRDY_Field is
(-- Interrupt disabled.
Disabled,
-- Interrupt enabled.
Enabled)
with Size => 1;
for INTENSET_REPORTRDY_Field use
(Disabled => 0,
Enabled => 1);
-- Enable interrupt on REPORTRDY event.
type INTENSET_REPORTRDY_Field_1 is
(-- Reset value for the field
Intenset_Reportrdy_Field_Reset,
-- Enable interrupt on write.
Set)
with Size => 1;
for INTENSET_REPORTRDY_Field_1 use
(Intenset_Reportrdy_Field_Reset => 0,
Set => 1);
-- Enable interrupt on ACCOF event.
type INTENSET_ACCOF_Field is
(-- Interrupt disabled.
Disabled,
-- Interrupt enabled.
Enabled)
with Size => 1;
for INTENSET_ACCOF_Field use
(Disabled => 0,
Enabled => 1);
-- Enable interrupt on ACCOF event.
type INTENSET_ACCOF_Field_1 is
(-- Reset value for the field
Intenset_Accof_Field_Reset,
-- Enable interrupt on write.
Set)
with Size => 1;
for INTENSET_ACCOF_Field_1 use
(Intenset_Accof_Field_Reset => 0,
Set => 1);
-- Interrupt enable set register.
type INTENSET_Register is record
-- Enable interrupt on SAMPLERDY event.
SAMPLERDY : INTENSET_SAMPLERDY_Field_1 :=
Intenset_Samplerdy_Field_Reset;
-- Enable interrupt on REPORTRDY event.
REPORTRDY : INTENSET_REPORTRDY_Field_1 :=
Intenset_Reportrdy_Field_Reset;
-- Enable interrupt on ACCOF event.
ACCOF : INTENSET_ACCOF_Field_1 := Intenset_Accof_Field_Reset;
-- unspecified
Reserved_3_31 : HAL.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for INTENSET_Register use record
SAMPLERDY at 0 range 0 .. 0;
REPORTRDY at 0 range 1 .. 1;
ACCOF at 0 range 2 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
-- Disable interrupt on SAMPLERDY event.
type INTENCLR_SAMPLERDY_Field is
(-- Interrupt disabled.
Disabled,
-- Interrupt enabled.
Enabled)
with Size => 1;
for INTENCLR_SAMPLERDY_Field use
(Disabled => 0,
Enabled => 1);
-- Disable interrupt on SAMPLERDY event.
type INTENCLR_SAMPLERDY_Field_1 is
(-- Reset value for the field
Intenclr_Samplerdy_Field_Reset,
-- Disable interrupt on write.
Clear)
with Size => 1;
for INTENCLR_SAMPLERDY_Field_1 use
(Intenclr_Samplerdy_Field_Reset => 0,
Clear => 1);
-- Disable interrupt on REPORTRDY event.
type INTENCLR_REPORTRDY_Field is
(-- Interrupt disabled.
Disabled,
-- Interrupt enabled.
Enabled)
with Size => 1;
for INTENCLR_REPORTRDY_Field use
(Disabled => 0,
Enabled => 1);
-- Disable interrupt on REPORTRDY event.
type INTENCLR_REPORTRDY_Field_1 is
(-- Reset value for the field
Intenclr_Reportrdy_Field_Reset,
-- Disable interrupt on write.
Clear)
with Size => 1;
for INTENCLR_REPORTRDY_Field_1 use
(Intenclr_Reportrdy_Field_Reset => 0,
Clear => 1);
-- Disable interrupt on ACCOF event.
type INTENCLR_ACCOF_Field is
(-- Interrupt disabled.
Disabled,
-- Interrupt enabled.
Enabled)
with Size => 1;
for INTENCLR_ACCOF_Field use
(Disabled => 0,
Enabled => 1);
-- Disable interrupt on ACCOF event.
type INTENCLR_ACCOF_Field_1 is
(-- Reset value for the field
Intenclr_Accof_Field_Reset,
-- Disable interrupt on write.
Clear)
with Size => 1;
for INTENCLR_ACCOF_Field_1 use
(Intenclr_Accof_Field_Reset => 0,
Clear => 1);
-- Interrupt enable clear register.
type INTENCLR_Register is record
-- Disable interrupt on SAMPLERDY event.
SAMPLERDY : INTENCLR_SAMPLERDY_Field_1 :=
Intenclr_Samplerdy_Field_Reset;
-- Disable interrupt on REPORTRDY event.
REPORTRDY : INTENCLR_REPORTRDY_Field_1 :=
Intenclr_Reportrdy_Field_Reset;
-- Disable interrupt on ACCOF event.
ACCOF : INTENCLR_ACCOF_Field_1 := Intenclr_Accof_Field_Reset;
-- unspecified
Reserved_3_31 : HAL.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for INTENCLR_Register use record
SAMPLERDY at 0 range 0 .. 0;
REPORTRDY at 0 range 1 .. 1;
ACCOF at 0 range 2 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
-- Enable or disable QDEC.
type ENABLE_ENABLE_Field is
(-- Disabled QDEC.
Disabled,
-- Enable QDEC.
Enabled)
with Size => 1;
for ENABLE_ENABLE_Field use
(Disabled => 0,
Enabled => 1);
-- Enable the QDEC.
type ENABLE_Register is record
-- Enable or disable QDEC.
ENABLE : ENABLE_ENABLE_Field := NRF_SVD.QDEC.Disabled;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for ENABLE_Register use record
ENABLE at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- LED output pin polarity.
type LEDPOL_LEDPOL_Field is
(-- LED output is active low.
Activelow,
-- LED output is active high.
Activehigh)
with Size => 1;
for LEDPOL_LEDPOL_Field use
(Activelow => 0,
Activehigh => 1);
-- LED output pin polarity.
type LEDPOL_Register is record
-- LED output pin polarity.
LEDPOL : LEDPOL_LEDPOL_Field := NRF_SVD.QDEC.Activelow;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for LEDPOL_Register use record
LEDPOL at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- Sample period.
type SAMPLEPER_SAMPLEPER_Field is
(-- 128us sample period.
Val_128US,
-- 256us sample period.
Val_256US,
-- 512us sample period.
Val_512US,
-- 1024us sample period.
Val_1024US,
-- 2048us sample period.
Val_2048US,
-- 4096us sample period.
Val_4096US,
-- 8192us sample period.
Val_8192US,
-- 16384us sample period.
Val_16384US)
with Size => 3;
for SAMPLEPER_SAMPLEPER_Field use
(Val_128US => 0,
Val_256US => 1,
Val_512US => 2,
Val_1024US => 3,
Val_2048US => 4,
Val_4096US => 5,
Val_8192US => 6,
Val_16384US => 7);
-- Sample period.
type SAMPLEPER_Register is record
-- Sample period.
SAMPLEPER : SAMPLEPER_SAMPLEPER_Field := NRF_SVD.QDEC.Val_128US;
-- unspecified
Reserved_3_31 : HAL.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for SAMPLEPER_Register use record
SAMPLEPER at 0 range 0 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
-- Number of samples to generate an EVENT_REPORTRDY.
type REPORTPER_REPORTPER_Field is
(-- 10 samples per report.
Val_10Smpl,
-- 40 samples per report.
Val_40Smpl,
-- 80 samples per report.
Val_80Smpl,
-- 120 samples per report.
Val_120Smpl,
-- 160 samples per report.
Val_160Smpl,
-- 200 samples per report.
Val_200Smpl,
-- 240 samples per report.
Val_240Smpl,
-- 280 samples per report.
Val_280Smpl)
with Size => 3;
for REPORTPER_REPORTPER_Field use
(Val_10Smpl => 0,
Val_40Smpl => 1,
Val_80Smpl => 2,
Val_120Smpl => 3,
Val_160Smpl => 4,
Val_200Smpl => 5,
Val_240Smpl => 6,
Val_280Smpl => 7);
-- Number of samples to generate an EVENT_REPORTRDY.
type REPORTPER_Register is record
-- Number of samples to generate an EVENT_REPORTRDY.
REPORTPER : REPORTPER_REPORTPER_Field := NRF_SVD.QDEC.Val_10Smpl;
-- unspecified
Reserved_3_31 : HAL.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for REPORTPER_Register use record
REPORTPER at 0 range 0 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
-- Enable debounce input filters.
type DBFEN_DBFEN_Field is
(-- Debounce input filters disabled.
Disabled,
-- Debounce input filters enabled.
Enabled)
with Size => 1;
for DBFEN_DBFEN_Field use
(Disabled => 0,
Enabled => 1);
-- Enable debouncer input filters.
type DBFEN_Register is record
-- Enable debounce input filters.
DBFEN : DBFEN_DBFEN_Field := NRF_SVD.QDEC.Disabled;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for DBFEN_Register use record
DBFEN at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
subtype LEDPRE_LEDPRE_Field is HAL.UInt9;
-- Time LED is switched ON before the sample.
type LEDPRE_Register is record
-- Period in us the LED in switched on prior to sampling.
LEDPRE : LEDPRE_LEDPRE_Field := 16#10#;
-- unspecified
Reserved_9_31 : HAL.UInt23 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for LEDPRE_Register use record
LEDPRE at 0 range 0 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
subtype ACCDBL_ACCDBL_Field is HAL.UInt4;
-- Accumulated double (error) transitions register.
type ACCDBL_Register is record
-- Read-only. Accumulated double (error) transitions.
ACCDBL : ACCDBL_ACCDBL_Field;
-- unspecified
Reserved_4_31 : HAL.UInt28;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for ACCDBL_Register use record
ACCDBL at 0 range 0 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
subtype ACCDBLREAD_ACCDBLREAD_Field is HAL.UInt4;
-- Snapshot of ACCDBL register. Value generated by the TASKS_READCLEACC
-- task.
type ACCDBLREAD_Register is record
-- Read-only. Snapshot of accumulated double (error) transitions.
ACCDBLREAD : ACCDBLREAD_ACCDBLREAD_Field;
-- unspecified
Reserved_4_31 : HAL.UInt28;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for ACCDBLREAD_Register use record
ACCDBLREAD at 0 range 0 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
-- Peripheral power control.
type POWER_POWER_Field is
(-- Module power disabled.
Disabled,
-- Module power enabled.
Enabled)
with Size => 1;
for POWER_POWER_Field use
(Disabled => 0,
Enabled => 1);
-- Peripheral power control.
type POWER_Register is record
-- Peripheral power control.
POWER : POWER_POWER_Field := NRF_SVD.QDEC.Disabled;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for POWER_Register use record
POWER at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Rotary decoder.
type QDEC_Peripheral is record
-- Start the quadrature decoder.
TASKS_START : aliased HAL.UInt32;
-- Stop the quadrature decoder.
TASKS_STOP : aliased HAL.UInt32;
-- Transfers the content from ACC registers to ACCREAD registers, and
-- clears the ACC registers.
TASKS_READCLRACC : aliased HAL.UInt32;
-- A new sample is written to the sample register.
EVENTS_SAMPLERDY : aliased HAL.UInt32;
-- REPORTPER number of samples accumulated in ACC register, and ACC
-- register different than zero.
EVENTS_REPORTRDY : aliased HAL.UInt32;
-- ACC or ACCDBL register overflow.
EVENTS_ACCOF : aliased HAL.UInt32;
-- Shortcuts for the QDEC.
SHORTS : aliased SHORTS_Register;
-- Interrupt enable set register.
INTENSET : aliased INTENSET_Register;
-- Interrupt enable clear register.
INTENCLR : aliased INTENCLR_Register;
-- Enable the QDEC.
ENABLE : aliased ENABLE_Register;
-- LED output pin polarity.
LEDPOL : aliased LEDPOL_Register;
-- Sample period.
SAMPLEPER : aliased SAMPLEPER_Register;
-- Motion sample value.
SAMPLE : aliased HAL.UInt32;
-- Number of samples to generate an EVENT_REPORTRDY.
REPORTPER : aliased REPORTPER_Register;
-- Accumulated valid transitions register.
ACC : aliased HAL.UInt32;
-- Snapshot of ACC register. Value generated by the TASKS_READCLEACC
-- task.
ACCREAD : aliased HAL.UInt32;
-- Pin select for LED output.
PSELLED : aliased HAL.UInt32;
-- Pin select for phase A input.
PSELA : aliased HAL.UInt32;
-- Pin select for phase B input.
PSELB : aliased HAL.UInt32;
-- Enable debouncer input filters.
DBFEN : aliased DBFEN_Register;
-- Time LED is switched ON before the sample.
LEDPRE : aliased LEDPRE_Register;
-- Accumulated double (error) transitions register.
ACCDBL : aliased ACCDBL_Register;
-- Snapshot of ACCDBL register. Value generated by the TASKS_READCLEACC
-- task.
ACCDBLREAD : aliased ACCDBLREAD_Register;
-- Peripheral power control.
POWER : aliased POWER_Register;
end record
with Volatile;
for QDEC_Peripheral use record
TASKS_START at 16#0# range 0 .. 31;
TASKS_STOP at 16#4# range 0 .. 31;
TASKS_READCLRACC at 16#8# range 0 .. 31;
EVENTS_SAMPLERDY at 16#100# range 0 .. 31;
EVENTS_REPORTRDY at 16#104# range 0 .. 31;
EVENTS_ACCOF at 16#108# range 0 .. 31;
SHORTS at 16#200# range 0 .. 31;
INTENSET at 16#304# range 0 .. 31;
INTENCLR at 16#308# range 0 .. 31;
ENABLE at 16#500# range 0 .. 31;
LEDPOL at 16#504# range 0 .. 31;
SAMPLEPER at 16#508# range 0 .. 31;
SAMPLE at 16#50C# range 0 .. 31;
REPORTPER at 16#510# range 0 .. 31;
ACC at 16#514# range 0 .. 31;
ACCREAD at 16#518# range 0 .. 31;
PSELLED at 16#51C# range 0 .. 31;
PSELA at 16#520# range 0 .. 31;
PSELB at 16#524# range 0 .. 31;
DBFEN at 16#528# range 0 .. 31;
LEDPRE at 16#540# range 0 .. 31;
ACCDBL at 16#544# range 0 .. 31;
ACCDBLREAD at 16#548# range 0 .. 31;
POWER at 16#FFC# range 0 .. 31;
end record;
-- Rotary decoder.
QDEC_Periph : aliased QDEC_Peripheral
with Import, Address => QDEC_Base;
end NRF_SVD.QDEC;
|
leonhxx/pok | Ada | 3,167 | ads | -- POK header
--
-- The following file is a part of the POK project. Any modification should
-- be made according to the POK licence. You CANNOT use this file or a part
-- of a file for your own project.
--
-- For more information on the POK licence, please see our LICENCE FILE
--
-- Please follow the coding guidelines described in doc/CODING_GUIDELINES
--
-- Copyright (c) 2007-2021 POK team
-- ---------------------------------------------------------------------------
-- --
-- BLACKBOARD constant and type definitions and management services --
-- --
-- ---------------------------------------------------------------------------
with APEX.Processes;
package APEX.Blackboards is
Max_Number_Of_Blackboards : constant := System_Limit_Number_Of_Blackboards;
subtype Blackboard_Name_Type is Name_Type;
type Blackboard_Id_Type is private;
Null_Blackboard_Id : constant Blackboard_Id_Type;
type Empty_Indicator_Type is (Empty, Occupied);
type Blackboard_Status_Type is record
Empty_Indicator : Empty_Indicator_Type;
Max_Message_Size : Message_Size_Type;
Waiting_Processes : APEX.Processes.Waiting_Range_Type;
end record;
procedure Create_Blackboard
(Blackboard_Name : in Blackboard_Name_Type;
Max_Message_Size : in Message_Size_Type;
Blackboard_Id : out Blackboard_Id_Type;
Return_Code : out Return_Code_Type);
procedure Display_Blackboard
(Blackboard_Id : in Blackboard_Id_Type;
Message_Addr : in Message_Addr_Type;
Length : in Message_Size_Type;
Return_Code : out Return_Code_Type);
procedure Read_Blackboard
(Blackboard_Id : in Blackboard_Id_Type;
Time_Out : in System_Time_Type;
Message_Addr : in Message_Addr_Type;
-- The message address is passed IN, although the respective message is
-- passed OUT
Length : out Message_Size_Type;
Return_Code : out Return_Code_Type);
procedure Clear_Blackboard
(Blackboard_Id : in Blackboard_Id_Type;
Return_Code : out Return_Code_Type);
procedure Get_Blackboard_Id
(Blackboard_Name : in Blackboard_Name_Type;
Blackboard_Id : out Blackboard_Id_Type;
Return_Code : out Return_Code_Type);
procedure Get_Blackboard_Status
(Blackboard_Id : in Blackboard_Id_Type;
Blackboard_Status : out Blackboard_Status_Type;
Return_Code : out Return_Code_Type);
private
type Blackboard_Id_Type is new APEX_Integer;
Null_Blackboard_Id : constant Blackboard_Id_Type := 0;
pragma Convention (C, Empty_Indicator_Type);
pragma Convention (C, Blackboard_Status_Type);
-- POK BINDINGS
pragma Import (C, Create_Blackboard, "CREATE_BLACKBOARD");
pragma Import (C, Display_Blackboard, "DISPLAY_BLACKBOARD");
pragma Import (C, Read_Blackboard, "READ_BLACKBOARD");
pragma Import (C, Clear_Blackboard, "CLEAR_BLACKBOARD");
pragma Import (C, Get_Blackboard_Id, "GET_BLACKBOARD_ID");
pragma Import (C, Get_Blackboard_Status, "GET_BLACKBOARD_STATUS");
-- END OF POK BINDINGS
end APEX.Blackboards;
|
reznikmm/gela | Ada | 1,186 | ads | -- This package provides Environment_Set.
with Gela.Contexts;
with Gela.Error_Sets;
with Gela.Semantic_Types;
package Gela.Plain_Error_Sets is
pragma Preelaborate;
type Error_Set (Context : access Gela.Contexts.Context'Class) is
new Gela.Error_Sets.Error_Set with private;
type Plain_Error_Set_Access is access all Error_Set;
private
type Error_Set (Context : access Gela.Contexts.Context'Class) is
new Gela.Error_Sets.Error_Set with record
Last : Gela.Semantic_Types.Error_Set_Index := 0;
end record;
overriding procedure Add
(Self : in out Error_Set;
Prev : Gela.Semantic_Types.Error_Set_Index;
Next : out Gela.Semantic_Types.Error_Set_Index);
overriding procedure Join
(Self : in out Error_Set;
Prev_1 : Gela.Semantic_Types.Error_Set_Index;
Prev_2 : Gela.Semantic_Types.Error_Set_Index;
Prev_3 : Gela.Semantic_Types.Error_Set_Index := 0;
Prev_4 : Gela.Semantic_Types.Error_Set_Index := 0;
Prev_5 : Gela.Semantic_Types.Error_Set_Index := 0;
Prev_6 : Gela.Semantic_Types.Error_Set_Index := 0;
Next : out Gela.Semantic_Types.Error_Set_Index);
end Gela.Plain_Error_Sets;
|
vpodzime/ada-util | Ada | 6,590 | ads | -----------------------------------------------------------------------
-- util-system-os -- Unix system operations
-- Copyright (C) 2011, 2012, 2014, 2015, 2016, 2017 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with System;
with Interfaces.C;
with Interfaces.C.Strings;
with Util.Processes;
with Util.Systems.Constants;
with Util.Systems.Types;
-- The <b>Util.Systems.Os</b> package defines various types and operations which are specific
-- to the OS (Unix).
package Util.Systems.Os is
-- The directory separator.
Directory_Separator : constant Character := '/';
-- The path separator.
Path_Separator : constant Character := ':';
subtype Ptr is Interfaces.C.Strings.chars_ptr;
subtype Ptr_Array is Interfaces.C.Strings.chars_ptr_array;
type Ptr_Ptr_Array is access all Ptr_Array;
type File_Type is new Integer;
-- Standard file streams Posix, X/Open standard values.
STDIN_FILENO : constant File_Type := 0;
STDOUT_FILENO : constant File_Type := 1;
STDERR_FILENO : constant File_Type := 2;
-- File is not opened
NO_FILE : constant File_Type := -1;
-- The following values should be externalized. They are valid for GNU/Linux.
F_SETFL : constant Interfaces.C.int := Util.Systems.Constants.F_SETFL;
FD_CLOEXEC : constant Interfaces.C.int := Util.Systems.Constants.FD_CLOEXEC;
-- These values are specific to Linux.
O_RDONLY : constant Interfaces.C.int := Util.Systems.Constants.O_RDONLY;
O_WRONLY : constant Interfaces.C.int := Util.Systems.Constants.O_WRONLY;
O_RDWR : constant Interfaces.C.int := Util.Systems.Constants.O_RDWR;
O_CREAT : constant Interfaces.C.int := Util.Systems.Constants.O_CREAT;
O_EXCL : constant Interfaces.C.int := Util.Systems.Constants.O_EXCL;
O_TRUNC : constant Interfaces.C.int := Util.Systems.Constants.O_TRUNC;
O_APPEND : constant Interfaces.C.int := Util.Systems.Constants.O_APPEND;
type Size_T is mod 2 ** Standard'Address_Size;
type Ssize_T is range -(2 ** (Standard'Address_Size - 1))
.. +(2 ** (Standard'Address_Size - 1)) - 1;
function Close (Fd : in File_Type) return Integer;
pragma Import (C, Close, "close");
function Read (Fd : in File_Type;
Buf : in System.Address;
Size : in Size_T) return Ssize_T;
pragma Import (C, Read, "read");
function Write (Fd : in File_Type;
Buf : in System.Address;
Size : in Size_T) return Ssize_T;
pragma Import (C, Write, "write");
-- System exit without any process cleaning.
-- (destructors, finalizers, atexit are not called)
procedure Sys_Exit (Code : in Integer);
pragma Import (C, Sys_Exit, "_exit");
-- Fork a new process
function Sys_Fork return Util.Processes.Process_Identifier;
pragma Import (C, Sys_Fork, "fork");
-- Fork a new process (vfork implementation)
function Sys_VFork return Util.Processes.Process_Identifier;
pragma Import (C, Sys_VFork, "fork");
-- Execute a process with the given arguments.
function Sys_Execvp (File : in Ptr;
Args : in Ptr_Array) return Integer;
pragma Import (C, Sys_Execvp, "execvp");
-- Wait for the process <b>Pid</b> to finish and return
function Sys_Waitpid (Pid : in Integer;
Status : in System.Address;
Options : in Integer) return Integer;
pragma Import (C, Sys_Waitpid, "waitpid");
-- Create a bi-directional pipe
function Sys_Pipe (Fds : in System.Address) return Integer;
pragma Import (C, Sys_Pipe, "pipe");
-- Make <b>fd2</b> the copy of <b>fd1</b>
function Sys_Dup2 (Fd1, Fd2 : in File_Type) return Integer;
pragma Import (C, Sys_Dup2, "dup2");
-- Close a file
function Sys_Close (Fd : in File_Type) return Integer;
pragma Import (C, Sys_Close, "close");
-- Open a file
function Sys_Open (Path : in Ptr;
Flags : in Interfaces.C.int;
Mode : in Util.Systems.Types.mode_t) return File_Type;
pragma Import (C, Sys_Open, "open");
-- Change the file settings
function Sys_Fcntl (Fd : in File_Type;
Cmd : in Interfaces.C.int;
Flags : in Interfaces.C.int) return Integer;
pragma Import (C, Sys_Fcntl, "fcntl");
function Sys_Kill (Pid : in Integer;
Signal : in Integer) return Integer;
pragma Import (C, Sys_Kill, "kill");
function Sys_Stat (Path : in Ptr;
Stat : access Util.Systems.Types.Stat_Type) return Integer;
pragma Import (C, Sys_Stat, Util.Systems.Types.STAT_NAME);
function Sys_Fstat (Fs : in File_Type;
Stat : access Util.Systems.Types.Stat_Type) return Integer;
pragma Import (C, Sys_Fstat, Util.Systems.Types.FSTAT_NAME);
function Sys_Lseek (Fs : in File_Type;
Offset : in Util.Systems.Types.off_t;
Mode : in Util.Systems.Types.Seek_Mode) return Util.Systems.Types.off_t;
pragma Import (C, Sys_Lseek, "lseek");
function Sys_Fchmod (Fd : in File_Type;
Mode : in Util.Systems.Types.mode_t) return Integer;
pragma Import (C, Sys_Fchmod, "fchmod");
-- Change permission of a file.
function Sys_Chmod (Path : in Ptr;
Mode : in Util.Systems.Types.mode_t) return Integer;
pragma Import (C, Sys_Chmod, "chmod");
-- Rename a file (the Ada.Directories.Rename does not allow to use
-- the Unix atomic file rename!)
function Sys_Rename (Oldpath : in Ptr;
Newpath : in Ptr) return Integer;
pragma Import (C, Sys_Rename, "rename");
-- Libc errno. The __get_errno function is provided by the GNAT runtime.
function Errno return Integer;
pragma Import (C, Errno, "__get_errno");
end Util.Systems.Os;
|
reznikmm/matreshka | Ada | 4,567 | 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.Layer_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Draw_Layer_Attribute_Node is
begin
return Self : Draw_Layer_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_Layer_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Layer_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Draw_URI,
Matreshka.ODF_String_Constants.Layer_Attribute,
Draw_Layer_Attribute_Node'Tag);
end Matreshka.ODF_Draw.Layer_Attributes;
|
sungyeon/drake | Ada | 2,768 | ads | pragma License (Unrestricted);
-- implementation unit specialized for POSIX (Darwin, FreeBSD, or Linux)
with C;
package System.C_Encoding is
pragma Preelaborate;
-- Character (UTF-8) from/to char (UTF-8)
-- In POSIX, other packages (Ada.Command_Line, Ada.Environment_Variables,
-- Ada.Text_IO, etc) also assume that the system encoding is UTF-8.
function To_char (
Item : Character;
Substitute : C.char) -- unreferenced
return C.char;
pragma Inline (To_char);
function To_Character (
Item : C.char;
Substitute : Character) -- unreferenced
return Character;
pragma Inline (To_Character);
procedure To_Non_Nul_Terminated (
Item : String;
Target : out C.char_array;
Count : out C.size_t;
Substitute : C.char_array); -- unreferenced
procedure From_Non_Nul_Terminated (
Item : C.char_array;
Target : out String;
Count : out Natural;
Substitute : String); -- unreferenced
Expanding_To_char : constant := 1;
Expanding_To_Character : constant := 1;
-- Wide_Character (UTF-16) from/to wchar_t (UTF-32)
function To_wchar_t (
Item : Wide_Character;
Substitute : C.wchar_t)
return C.wchar_t;
pragma Inline (To_wchar_t);
function To_Wide_Character (
Item : C.wchar_t;
Substitute : Wide_Character)
return Wide_Character;
pragma Inline (To_Wide_Character);
procedure To_Non_Nul_Terminated (
Item : Wide_String;
Target : out C.wchar_t_array;
Count : out C.size_t;
Substitute : C.wchar_t_array);
procedure From_Non_Nul_Terminated (
Item : C.wchar_t_array;
Target : out Wide_String;
Count : out Natural;
Substitute : Wide_String);
Expanding_From_Wide_To_wchar_t : constant := 1; -- Expanding_From_16_To_32
Expanding_From_wchar_t_To_Wide : constant := 2; -- Expanding_From_32_To_16
-- Wide_Wide_Character (UTF-32) from/to wchar_t (UTF-32)
function To_wchar_t (
Item : Wide_Wide_Character;
Substitute : C.wchar_t) -- unreferenced
return C.wchar_t;
function To_Wide_Wide_Character (
Item : C.wchar_t;
Substitute : Wide_Wide_Character) -- unreferenced
return Wide_Wide_Character;
procedure To_Non_Nul_Terminated (
Item : Wide_Wide_String;
Target : out C.wchar_t_array;
Count : out C.size_t;
Substitute : C.wchar_t_array); -- unreferenced
procedure From_Non_Nul_Terminated (
Item : C.wchar_t_array;
Target : out Wide_Wide_String;
Count : out Natural;
Substitute : Wide_Wide_String); -- unreferenced
Expanding_From_Wide_Wide_To_wchar_t : constant := 1;
Expanding_From_wchar_t_To_Wide_Wide : constant := 1;
end System.C_Encoding;
|
justinjhendrick/learning-ada | Ada | 360 | adb | package body Array_Ops is
-- Find the max element of an array
function Max(A : Element_Array) return Element_Type is
Result : Element_Type;
begin
Result := A(A'First);
for I in Index_Type'Succ(A'First) .. A'Last loop
if A(I) > Result then
Result := A(I);
end if;
end loop;
return Result;
end Max;
end Array_Ops;
|
AaronC98/PlaneSystem | Ada | 7,286 | adb | ------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2006-2012, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
------------------------------------------------------------------------------
with Ada.Strings.Fixed;
with AWS.Net.Buffered;
with AWS.Utils;
package body AWS.Config.Utils is
-------------------
-- Parse_Strings --
-------------------
procedure Parse_Strings (Vector : in out SV.Vector; Line : String) is
use Ada.Strings;
First : Positive := Line'First;
Last : Natural;
procedure Append (Item : String);
------------
-- Append --
------------
procedure Append (Item : String) is
begin
SV.Append
(Vector, Fixed.Trim (Item, AWS.Utils.Spaces, AWS.Utils.Spaces));
end Append;
begin
SV.Clear (Vector);
if Line = "" then
return;
end if;
loop
Last := Fixed.Index (Line (First .. Line'Last), ",");
if Last = 0 then
Append (Line (First .. Line'Last));
exit;
end if;
Append (Line (First .. Last - 1));
First := Last + 1;
end loop;
end Parse_Strings;
-------------------
-- Set_Parameter --
-------------------
procedure Set_Parameter
(Param_Set : in out Parameter_Set;
Name : Parameter_Name;
Value : String;
Error_Context : String)
is
procedure Set_Parameter (Param : in out Values);
-- Set parameter depending on the type (Param.Kind)
procedure Error (Message : String);
-- Raises Constraint_Error with associated message and Error_Context
-- string.
function "+" (S : String)
return Unbounded_String
renames To_Unbounded_String;
-----------
-- Error --
-----------
procedure Error (Message : String) is
function Error_Message return String;
-------------------
-- Error_Message --
-------------------
function Error_Message return String is
begin
if Error_Context = "" then
return Message;
else
return Error_Context & ' ' & Message;
end if;
end Error_Message;
begin
raise Constraint_Error with Error_Message & '.';
end Error;
Expected_Type : Unbounded_String;
-------------------
-- Set_Parameter --
-------------------
procedure Set_Parameter (Param : in out Values) is
begin
case Param.Kind is
when Str =>
Expected_Type := +"string";
Param.Str_Value := +Value;
when Str_Vect =>
Expected_Type := +"string list";
Parse_Strings (Param.Strs_Value, Value);
when Dir =>
Expected_Type := +"string";
if Value (Value'Last) = '/'
or else Value (Value'Last) = '\'
then
Param.Dir_Value := +Value;
else
Param.Dir_Value := +(Value & '/');
end if;
when Pos =>
Expected_Type := +"positive";
Param.Pos_Value := Positive'Value (Value);
if Name = Input_Line_Size_Limit then
Net.Buffered.Set_Input_Limit (Param.Pos_Value);
end if;
when Nat =>
Expected_Type := +"natural";
Param.Nat_Value := Natural'Value (Value);
when Dur =>
Expected_Type := +"duration";
Param.Dur_Value := Duration'Value (Value);
when Bool =>
Expected_Type := +"boolean";
Param.Bool_Value := Boolean'Value (Value);
when Regexp =>
Expected_Type := +"regexp (string)";
Param.Pattern := GNAT.Regexp.Compile (Value);
Param.Is_Set := True;
end case;
exception
when others =>
Error
("wrong value for " & Parameter_Name'Image (Name)
& " " & To_String (Expected_Type) & " expected, but '"
& Value & "' found");
end Set_Parameter;
begin
if Name not in Param_Set'Range then
declare
Not_Supported_Msg : constant String :=
" option '" & Parameter_Name'Image (Name)
& "' not supported for this configuration"
& " context";
begin
if Name in Process_Parameter_Name'Range then
Error ("Per process" & Not_Supported_Msg);
else
Error ("Per server" & Not_Supported_Msg);
end if;
end;
return;
else
Set_Parameter (Param_Set (Name));
end if;
end Set_Parameter;
-----------
-- Value --
-----------
function Value
(Item : String; Error_Context : String) return Parameter_Name is
begin
return Parameter_Name'Value (Item);
exception
when Constraint_Error =>
raise Constraint_Error
with Error_Context & "unrecognized option " & Item;
end Value;
end AWS.Config.Utils;
|
reznikmm/matreshka | Ada | 4,514 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
-- A script file that can be interpreted by a computer system. Subclass of
-- «File».
------------------------------------------------------------------------------
with AMF.Standard_Profile_L2.Files;
limited with AMF.UML.Artifacts;
package AMF.Standard_Profile_L2.Scripts is
pragma Preelaborate;
type Standard_Profile_L2_Script is limited interface
and AMF.Standard_Profile_L2.Files.Standard_Profile_L2_File;
type Standard_Profile_L2_Script_Access is
access all Standard_Profile_L2_Script'Class;
for Standard_Profile_L2_Script_Access'Storage_Size use 0;
overriding function Get_Base_Artifact
(Self : not null access constant Standard_Profile_L2_Script)
return AMF.UML.Artifacts.UML_Artifact_Access is abstract;
-- Getter of Script::base_Artifact.
--
overriding procedure Set_Base_Artifact
(Self : not null access Standard_Profile_L2_Script;
To : AMF.UML.Artifacts.UML_Artifact_Access) is abstract;
-- Setter of Script::base_Artifact.
--
end AMF.Standard_Profile_L2.Scripts;
|
reznikmm/matreshka | Ada | 2,821 | ads | limited with Types.Visiters;
package Types is
pragma Preelaborate;
type Ada_Type is limited interface;
type Type_Access is access all Ada_Type'Class with Storage_Size => 0;
-- Equal types always have the same access value
not overriding function Is_Anonymous
(Self : Ada_Type) return Boolean is abstract;
-- Returns whether type is anonymous. Anonymous types can be:
-- - access types
-- - array type declared as part of object declaration
-- - XXX may be task/protected objects
not overriding function Is_Derived
(Self : Ada_Type) return Boolean is abstract;
-- Check if given type is derived from another. See ARM 3.4 (2/2)
not overriding function Parent_Type
(Self : Ada_Type) return Type_Access is abstract;
-- Return parent type if given type Is_Derived or null otherwise
not overriding function Is_Enumeration
(Self : Ada_Type) return Boolean is abstract;
not overriding function Is_Boolean
(Self : Ada_Type) return Boolean is abstract;
-- This implies Is_Enumeration
not overriding function Is_Character
(Self : Ada_Type) return Boolean is abstract;
-- This implies Is_Enumeration
-- Category tests functions:
not overriding function Is_Signed_Integer
(Self : Ada_Type) return Boolean is abstract;
not overriding function Is_Modular_Integer
(Self : Ada_Type) return Boolean is abstract;
not overriding function Is_Floating_Point
(Self : Ada_Type) return Boolean is abstract;
not overriding function Is_Fixed_Point
(Self : Ada_Type) return Boolean is abstract;
not overriding function Is_Decimal_Fixed_Point
(Self : Ada_Type) return Boolean is abstract;
-- This implies Is_Fixed_Point
not overriding function Is_Object_Access
(Self : Ada_Type) return Boolean is abstract;
not overriding function Is_Subprogram_Access
(Self : Ada_Type) return Boolean is abstract;
not overriding function Is_Array
(Self : Ada_Type) return Boolean is abstract;
not overriding function Is_String
(Self : Ada_Type) return Boolean is abstract;
-- This implies Is_String
not overriding function Is_Record
(Self : Ada_Type) return Boolean is abstract;
not overriding function Is_Tagged_Record
(Self : Ada_Type) return Boolean is abstract;
-- This implies Is_Record
not overriding function Is_Task
(Self : Ada_Type) return Boolean is abstract;
not overriding function Is_Protected
(Self : Ada_Type) return Boolean is abstract;
not overriding function Is_Interface
(Self : Ada_Type) return Boolean is abstract;
-- Visiter support:
not overriding procedure Enumeration_Type
(Self : not null access Ada_Type;
Visiter : not null access Types.Visiters.Type_Visiter)
is abstract;
end Types;
|
charlie5/aIDE | Ada | 104 | adb | package body AdaM.program_Unit
is
procedure dummy is begin null; end dummy;
end AdaM.program_Unit;
|
Hamster-Furtif/JeremyPlusPlus | Ada | 4,237 | adb | with Ada.Characters.Handling,Ada.Text_IO;
use Ada.Characters.Handling,Ada.Text_IO;
package body opstrat is
function opIsBluffing(op_hand : in T_set) return Float is
r : Float;
begin
--Si l'op a peu de chances de gagner, mais mise quand même, il bluff (r=1)
--On diminue les chances linéairement de 0.5 à 0.75 jusqu'à atteindre 0, où la probabilité qu'il bluffe est estimée nulle
if(Get_Winning_Chance(get_card(op_hand, 0), get_card(op_hand, 1)) < 0.25) then
r := 1.0;
elsif(Get_Winning_Chance(get_card(op_hand, 0), get_card(op_hand, 1)) < 0.5) then
r := 1.0 - Get_Winning_Chance(get_card(op_hand, 0), get_card(op_hand, 1))*2.0;
else
r := 0.0;
end if;
return r;
end opIsBluffing;
procedure add_bluff(logic : in out T_logic; r : in Float) is
begin
logic.nbr_of_bluff := logic.nbr_of_bluff + r;
if(logic.nbr_of_bluff > 2.0) then
logic.can_bluff := TRUE;
end if;
end add_bluff;
procedure add_semi_bluff(logic : in out T_logic; r : in Float) is
begin
logic.nbr_of_semi_bluff := logic.nbr_of_semi_bluff + r;
if(logic.nbr_of_semi_bluff > 2.5) then
logic.can_semi_bluff := TRUE;
end if;
end add_semi_bluff;
procedure add_bluffed(logic : in out T_logic; r : in Float) is
begin
logic.nbr_of_bluffed := logic.nbr_of_bluffed + r;
if(logic.nbr_of_bluffed > 2.0) then
logic.can_get_bluffed := TRUE;
end if;
end add_bluffed;
function can_bluff(logic : T_logic) return Boolean is
begin
return logic.can_bluff;
end can_bluff;
function can_semi_bluff(logic : T_logic) return Boolean is
begin
return logic.can_semi_bluff;
end can_semi_bluff;
function can_get_bluffed(logic : T_logic) return Boolean is
begin
return logic.can_get_bluffed;
end can_get_bluffed;
function has_logic(logic : T_logic) return Boolean is
begin
return logic.has_logic;
end has_logic;
function get_winning_chances(logic : T_logic) return Float is
begin
return logic.winning_chances;
end get_winning_chances;
procedure set_winning_chances(logic : in out T_logic; chances : Float) is
begin
logic.winning_chances := chances;
end set_winning_chances;
function get_nbr_of_bluff(logic : T_logic) return Float is
begin
return logic.nbr_of_bluff;
end get_nbr_of_bluff;
function get_nbr_of_semi_bluff(logic : T_logic) return Float is
begin
return logic.nbr_of_semi_bluff;
end get_nbr_of_semi_bluff;
function get_nbr_of_bluffed(logic : T_logic) return Float is
begin
return logic.nbr_of_bluffed;
end get_nbr_of_bluffed;
function get_expectation(logic : T_logic; game : T_game) return Float is
e : Float := 0.0;
eb : Float := Float(get_pot(game) - get_min_bet(game));
ob : Float := Float(get_min_bet(game));
P_we_bluff : Float := 0.2; -- valeur arbitraire. On estime qu'on bluffe 20% du temps ...
P_bluffed : Float := logic.nbr_of_bluffed / logic.bluffed_possibilities;
P_bluff : Float := logic.nbr_of_bluff / logic.bluff_possibilities;
win_chances : Float := logic.winning_chances;
los_chances : Float := 1.0 - win_chances - P_bluff - P_bluffed;
begin
e := eb*(P_we_bluff*P_bluffed + win_chances ) - ob*(P_bluff+los_chances);
return e;
end get_expectation;
function create_round(move : T_move; bet : Integer) return T_round is
round : T_round;
begin
round.move := move;
round.bet := bet;
return round;
end create_round;
function toString(round: T_round) return String is
begin
if(round.bet = -1) then
return To_Lower(round.move'Img);
else
return To_Lower(round.move'Img &round.bet'Img);
end if;
end toString;
procedure set_current_move(logic : in out T_logic; move: T_move) is
begin
logic.current_move := move;
end set_current_move;
function get_current_move(logic : in T_logic) return T_move is
begin
return logic.current_move;
end get_current_move;
end opstrat;
|
ashleygay/adaboy | Ada | 4,221 | ads | pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with sprite_hpp;
package array_hpp is
subtype size_type is unsigned; -- ./array.hpp:5
-- For some reason, g++ -fdump-ada-spec does not generate
-- templated types, we must write them by hand.
-- The binding generator does not make the connection between
-- the templated type and its instanciation
-- ie: memory expects a member of type class_array but
-- the type generated is actually a record of type c_array_unsigned_char65536
type c_array_sprite40 is array (0 .. 39) of sprite_hpp.Class_Sprite.Sprite;
type c_array_unsigned_char65536 is array (0 .. 65535) of unsigned_char;
type c_array_int144 is array (0 .. 143) of int;
type c_array_c_array160 is array (0 .. 159) of c_array_int144;
-- Manual check done
package template_array_c_array_160 is
type instance is limited record
underlying_array : aliased c_array_c_array160; -- ./array.hpp:15
current_size : aliased size_type; -- ./array.hpp:16
end record;
pragma Import (CPP, instance);
function New_c_array return instance; -- ./array.hpp:11
pragma CPP_Constructor (New_c_array, "_ZNSt5arrayIS_IiLj144EELj160EEC1Ev");
function operator_ob (this : access instance; index : size_type) return access c_array_int144; -- ./array.hpp:11
pragma Import (CPP, operator_ob, "_ZNSt5arrayIS_IiLj144EELj160EEixEj");
function size (this : access constant instance) return size_type; -- ./array.hpp:13
pragma Import (CPP, size, "_ZNKSt5arrayIS_IiLj144EELj160EE4sizeEv");
end;
use template_array_c_array_160;
-- Manual check done
package template_array_int_144 is
type instance is limited record
underlying_array : aliased c_array_int144; -- ./array.hpp:15
current_size : aliased size_type; -- ./array.hpp:16
end record;
pragma Import (CPP, instance);
function New_c_array return instance; -- ./array.hpp:11
pragma CPP_Constructor (New_c_array, "_ZNSt5arrayIiLj144EEC1Ev");
function operator_ob (this : access instance; index : size_type) return access int; -- ./array.hpp:11
pragma Import (CPP, operator_ob, "_ZNSt5arrayIiLj144EEixEj");
function size (this : access constant instance) return size_type; -- ./array.hpp:13
pragma Import (CPP, size, "_ZNKSt5arrayIiLj144EE4sizeEv");
end;
use template_array_int_144;
-- Manual check done
package template_array_unsigned_char_65536 is
type instance is limited record
underlying_array : aliased c_array_unsigned_char65536; -- ./array.hpp:15
current_size : aliased size_type; -- ./array.hpp:16
end record;
pragma Import (CPP, instance);
function New_c_array return instance; -- ./array.hpp:11
pragma CPP_Constructor (New_c_array, "_ZNSt5arrayIhLj65536EEC1Ev");
function operator_ob (this : access instance; index : size_type) return access unsigned_char; -- ./array.hpp:11
pragma Import (CPP, operator_ob, "_ZNSt5arrayIhLj65536EEixEj");
function size (this : access constant instance) return size_type; -- ./array.hpp:13
pragma Import (CPP, size, "_ZNKSt5arrayIhLj65536EE4sizeEv");
end;
use template_array_unsigned_char_65536;
-- Manual check done
package template_array_Class_Sprite_40 is
type instance is limited record
underlying_array : aliased c_array_sprite40; -- ./array.hpp:15
current_size : aliased size_type; -- ./array.hpp:16
end record;
pragma Import (CPP, instance);
function New_c_array return instance; -- ./array.hpp:11
pragma CPP_Constructor (New_c_array, "_ZNSt5arrayI6SpriteLj40EEC1Ev");
function operator_ob (this : access instance; index : size_type) return access sprite_hpp.Class_Sprite.Sprite; -- ./array.hpp:11
pragma Import (CPP, operator_ob, "_ZNSt5arrayI6SpriteLj40EEixEj");
function size (this : access constant instance) return size_type; -- ./array.hpp:13
pragma Import (CPP, size, "_ZNKSt5arrayI6SpriteLj40EE4sizeEv");
end;
use template_array_Class_Sprite_40;
--const T& operator[](size_type index) const;
end array_hpp;
|
zhmu/ananas | Ada | 296 | ads | -- { dg-do compile }
-- { dg-options "-O2" }
package Pack12 is
type Rec1 is record
B : Boolean;
N : Natural;
end record;
type Rec2 is record
B : Boolean;
R : Rec1;
end record;
pragma Pack (Rec2);
type Rec3 is tagged record
R : Rec2;
end record;
end Pack12;
|
fractal-mind/Amass | Ada | 382 | ads | -- Copyright 2022 Jeff Foley. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
name = "DNSSpy"
type = "scrape"
function start()
set_rate_limit(1)
end
function vertical(ctx, domain)
scrape(ctx, {url=build_url(domain)})
end
function build_url(domain)
return "https://dnsspy.io/scan/" .. domain
end
|
reznikmm/matreshka | Ada | 3,749 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Style_Auto_Text_Indent_Attributes is
pragma Preelaborate;
type ODF_Style_Auto_Text_Indent_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Style_Auto_Text_Indent_Attribute_Access is
access all ODF_Style_Auto_Text_Indent_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Style_Auto_Text_Indent_Attributes;
|
zhmu/ananas | Ada | 2,748 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . E X C E P T I O N _ T R A C E S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2022, AdaCore --
-- --
-- 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 an interface allowing to control *automatic* output
-- to standard error upon exception occurrences (as opposed to explicit
-- generation of traceback information using System.Traceback).
-- See file s-exctra.ads for full documentation of the interface
with System.Exception_Traces;
package GNAT.Exception_Traces renames System.Exception_Traces;
|
vivianjia123/Password-Manager | Ada | 11,318 | adb | -- Authors: Catherine Jiawen Song 965600, Ziqi Jia 693241
-- Our implementation proves following security properties:
-- The Get, Put, Remove and Lock operations can only ever be performed
-- when the password manager is in the unlocked state.
-- We implemented procedures called Execute_xxx (i.e. Execute_Lock)
-- for each operation and only calls the operation if preconditions are true.
-- We specified the precondition IsLocked(Manager_Information) = False for all
-- four operations to ensure that they are only executed if the password manager
-- is unlocked. This ensures the confidentiality and integrity of the system as
-- only users who has knowledge of the master pin can access and carry out changes
-- to the database and master pin. We added the precondition PasswordDatabase.Has_Password_For
-- for Get and Remove operations to ensure that the operations are not carried out if
-- the database has no entry for the url in question. This ensures the safety of the system
-- and prevents from the system from crashing if Put or Remove operations are executed
-- for an entry that does not exist within the PasswordDatabase. For Put Command we
-- specified the precondition StoredDatabaseLength(Manager_Information) < PasswordDatabase.Max_Entries
-- in addition to IsLocked precondition to ensure that the number of database entries stored
-- currently do not the maximum entries specified. Likewise, this also ensures the safety
-- of the system and prevents the database from overflowing and causing the system to crash.
--
-- The Unlock operation can only ever be performed when the password manager is in the locked state.
-- We have an Execute_Unlock procedure which only calls the procedure Unlock_Manager if the
-- IsLocked(Manager_Information) and supplied input pin equals to the stored master pin preconditions
-- are true. We specified the post condition that if Unlock_Manager is executed then the Pin_Input
-- needs to be equal to the current master pin and that IsLocked(Manager_Information) = False. This
-- ensures the authentication of the system as only users who knows master pin can unlock the password manager.
--
-- The Lock operation, when it is performed, should update the master PIN with
-- the new PIN that is supplied.
-- We have Execute_Lock procedure which only calls the procedure Lock_Manager if the
-- IsLocked(Manager_Information) precondition is false. We specified post conditions
-- that if Lock_Manager is executed then the Master Pin needs to be updated to Pin_Input
-- and IsLocked(Manager_Information) is true. This ensures the authentication of the
-- system as only users who have unlocked the password manager can update
-- changes to the master pin and lock the system.
--
-- The password manager can be in one of two states, either locked or unlocked.
-- We implemented a private record type called information that records the database,
-- master pin and lock status of the system. Our implementation ensures encapsulation
-- and allows information hiding as this information cannot be accessed outside
-- of the PasswordManager package. Is_Locked represents the two states
-- of the Password Manager and can be only accessed through the Lock_Status function.
pragma SPARK_Mode (On);
with PasswordDatabase;
with MyCommandLine;
with MyString;
with MyStringTokeniser;
with PIN;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Characters.Handling; use Ada.Characters.Handling;
with PasswordManager;
with Utility;
procedure Main is
package Lines is new MyString(Max_MyString_Length => 2048);
S : Lines.MyString;
PM_Information : PasswordManager.Information;
GETDB : constant String := "get";
REMDB : constant String := "rem";
PUTDB : constant String := "put";
UNLOCK : constant String := "unlock";
LOCK : constant String := "lock";
TokensList : MyStringTokeniser.TokenArray(1..5):= (others => (Start => 1, Length => 0));
NumTokens : Natural;
begin
-- Program must initiate with 1 Pin input
if (MyCommandLine.Argument_Count = 1) then
declare
Temp_Pin : String := MyCommandLine.Argument(1);
begin
-- Pin must meet specified Pin requirements prior to Password Manager
-- initiation
if (MyCommandLine.Argument(1)'Length = 4 and
(for all I in Temp_Pin'Range => Temp_Pin(I)
>= '0' and Temp_Pin(I) <= '9')) then
PasswordManager.Init(MyCommandLine.Argument(1), PM_Information);
else
Put_Line("Invalid input, program will exit!");
return;
end if;
end;
else
Put_Line("Invalid input, program will exit!");
return;
end if;
-- While loop for the system
while True loop
-- Checks status of Password Manager
if (PasswordManager.Lock_Status(PM_Information)) then
Put("locked> ");Lines.Get_Line(S);
else
Put("unlocked> ");Lines.Get_Line(S);
end if;
-- Tokenises input
MyStringTokeniser.Tokenise(Lines.To_String(S),TokensList,NumTokens);
-- Checks input command validity and termiantes program if input
-- does not follow requirements
if (NumTokens < 1 or NumTokens > 3
or Lines.To_String(S)'Length < 1
or Lines.To_String(S)'Length > Utility.Max_Line_Length) then
Put_Line("Invalid input, program will exit!");
return;
else
declare
-- Converts command token into string
Command : String :=
To_Lower(Lines.To_String(Lines.Substring(S,TokensList(1).Start,
TokensList(1).Start+TokensList(1).Length-1)));
begin
-- Get Command
if (Command = GETDB and NumTokens = Utility.Get_Rem_Pin_Length) then
-- If validity check is met get command is executed
declare
-- Converts Url Token into String
TokUrl : String := Lines.To_String
(Lines.Substring(S,TokensList(2).Start,
TokensList(2).Start+TokensList(2).Length-1));
begin
-- If Url is within required length then get
-- execution is called
if (TokUrl'Length <= PasswordDatabase.Max_URL_Length) then
PasswordManager.Execute_Get_Command
(PM_Information,PasswordDatabase.From_String(TokUrl));
-- Else the program terminates with error message
else
Put_Line("Invalid input, program will exit!");
return;
end if;
end;
-- Put Command
elsif (Command = PUTDB and NumTokens = Utility.Put_Length) then
declare
-- Converts Url Token into String
TokUrl : String := Lines.To_String
(Lines.Substring(S,TokensList(2).Start,
TokensList(2).Start+TokensList(2).Length-1));
-- Converts Pwd Token into String
TokPwd : String := Lines.To_String
(Lines.Substring(S,TokensList(3).Start,
TokensList(3).Start+TokensList(3).Length-1));
begin
-- If url and password are within required length then
-- put execution is called
if (TokUrl'Length <= PasswordDatabase.Max_URL_Length and
TokPwd'Length <= PasswordDatabase.Max_Password_Length) then
PasswordManager.Execute_Put_Command
(PM_Information,PasswordDatabase.From_String(TokUrl),
PasswordDatabase.From_String(TokPwd));
-- Else the program terminates with error message
else
Put_Line("Invalid input, program will exit!");
return;
end if;
end;
-- Rem Command
elsif (Command = REMDB and NumTokens = Utility.Get_Rem_Pin_Length) then
declare
-- Converts Url Token into String
TokUrl : String := Lines.To_String
(Lines.Substring(S,TokensList(2).Start,
TokensList(2).Start+TokensList(2).Length-1));
begin
-- If Url is within required length then command is executed
if (TokUrl'Length <= PasswordDatabase.Max_URL_Length) then
PasswordManager.Execute_Rem_Command
(PM_Information,PasswordDatabase.From_String(TokUrl));
-- Else the program terminates with error message
else
Put_Line("Invalid input, program will exit!");
return;
end if;
end;
-- Unlock Command
elsif (Command = UNLOCK and NumTokens = Utility.Get_Rem_Pin_Length) then
declare
-- Converts Pin Token into String
TokPin : String := Lines.To_String
(Lines.Substring(S,TokensList(2).Start,
TokensList(2).Start+TokensList(2).Length - 1));
begin
-- If Pin validity is met then Password Manager will
-- be unlocked
if (TokPin'Length = 4 and
(for all I in TokPin'Range =>
TokPin(I) >= '0' and TokPin(I) <= '9')) then
PasswordManager.Execute_Unlock
(PM_Information, PIN.From_String(TokPin));
-- Else the program terminates with error message
else
Put_Line("Invalid input, program will exit!");
return;
end if;
end;
-- Lock Command
elsif(Command = LOCK and NumTokens = Utility.Get_Rem_Pin_Length) then
declare
TokPin : String := Lines.To_String
(Lines.Substring(S,TokensList(2).Start,
TokensList(2).Start+TokensList(2).Length-1));
begin
-- If validity check is met Lock command is executed
if (TokPin'Length = 4 and
(for all I in TokPin'Range =>
TokPin(I) >= '0' and TokPin(I) <= '9')) then
PasswordManager.Execute_Lock(PM_Information,
PIN.From_String(TokPin));
-- Else the program terminates with error message
else
Put_Line("Invalid input, program will exit!");
return;
end if;
end;
-- Other irregular commands will cause program to print out
-- error message and terminate
else
Put_Line("Invalid input, program will exit!");
return;
end if;
end;
end if;
end loop;
end Main;
|
sungyeon/drake | Ada | 693 | ads | pragma License (Unrestricted);
-- implementation unit required by compiler
with System.Packed_Arrays;
package System.Pack_09 is
pragma Preelaborate;
-- It can not be Pure, subprograms would become __attribute__((const)).
type Bits_09 is mod 2 ** 9;
for Bits_09'Size use 9;
package Indexing is new Packed_Arrays.Indexing (Bits_09);
-- required for accessing arrays by compiler
function Get_09 (
Arr : Address;
N : Natural;
Rev_SSO : Boolean)
return Bits_09
renames Indexing.Get;
procedure Set_09 (
Arr : Address;
N : Natural;
E : Bits_09;
Rev_SSO : Boolean)
renames Indexing.Set;
end System.Pack_09;
|
albinjal/ada_basic | Ada | 104 | adb | with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure henge
|
reznikmm/matreshka | Ada | 6,243 | 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.
------------------------------------------------------------------------------
-- An object flow is an activity edge that can have objects or data passing
-- along it.
--
-- Object flows have support for multicast/receive, token selection from
-- object nodes, and transformation of tokens.
------------------------------------------------------------------------------
with AMF.UML.Activity_Edges;
limited with AMF.UML.Behaviors;
package AMF.UML.Object_Flows is
pragma Preelaborate;
type UML_Object_Flow is limited interface
and AMF.UML.Activity_Edges.UML_Activity_Edge;
type UML_Object_Flow_Access is
access all UML_Object_Flow'Class;
for UML_Object_Flow_Access'Storage_Size use 0;
not overriding function Get_Is_Multicast
(Self : not null access constant UML_Object_Flow)
return Boolean is abstract;
-- Getter of ObjectFlow::isMulticast.
--
-- Tells whether the objects in the flow are passed by multicasting.
not overriding procedure Set_Is_Multicast
(Self : not null access UML_Object_Flow;
To : Boolean) is abstract;
-- Setter of ObjectFlow::isMulticast.
--
-- Tells whether the objects in the flow are passed by multicasting.
not overriding function Get_Is_Multireceive
(Self : not null access constant UML_Object_Flow)
return Boolean is abstract;
-- Getter of ObjectFlow::isMultireceive.
--
-- Tells whether the objects in the flow are gathered from respondents to
-- multicasting.
not overriding procedure Set_Is_Multireceive
(Self : not null access UML_Object_Flow;
To : Boolean) is abstract;
-- Setter of ObjectFlow::isMultireceive.
--
-- Tells whether the objects in the flow are gathered from respondents to
-- multicasting.
not overriding function Get_Selection
(Self : not null access constant UML_Object_Flow)
return AMF.UML.Behaviors.UML_Behavior_Access is abstract;
-- Getter of ObjectFlow::selection.
--
-- Selects tokens from a source object node.
not overriding procedure Set_Selection
(Self : not null access UML_Object_Flow;
To : AMF.UML.Behaviors.UML_Behavior_Access) is abstract;
-- Setter of ObjectFlow::selection.
--
-- Selects tokens from a source object node.
not overriding function Get_Transformation
(Self : not null access constant UML_Object_Flow)
return AMF.UML.Behaviors.UML_Behavior_Access is abstract;
-- Getter of ObjectFlow::transformation.
--
-- Changes or replaces data tokens flowing along edge.
not overriding procedure Set_Transformation
(Self : not null access UML_Object_Flow;
To : AMF.UML.Behaviors.UML_Behavior_Access) is abstract;
-- Setter of ObjectFlow::transformation.
--
-- Changes or replaces data tokens flowing along edge.
end AMF.UML.Object_Flows;
|
AdaCore/libadalang | Ada | 152 | adb | package body P is
procedure Foo (Self : T) is
Inst : U;
begin
Inst := Convert (Self);
pragma Test_Statement;
end Foo;
end P;
|
reznikmm/matreshka | Ada | 4,216 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2015, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Asis;
with Engines.Contexts;
with League.Strings;
package Properties.Definitions.Tagged_Record_Type is
function Code
(Engine : access Engines.Contexts.Context;
Element : Asis.Definition;
Name : Engines.Text_Property) return League.Strings.Universal_String;
function Initialize
(Engine : access Engines.Contexts.Context;
Element : Asis.Definition;
Name : Engines.Text_Property) return League.Strings.Universal_String;
function Is_Simple_Type
(Engine : access Engines.Contexts.Context;
Element : Asis.Declaration;
Name : Engines.Boolean_Property) return Boolean;
function Tag_Name
(Engine : access Engines.Contexts.Context;
Element : Asis.Definition;
Name : Engines.Text_Property) return League.Strings.Universal_String;
end Properties.Definitions.Tagged_Record_Type;
|
burratoo/Acton | Ada | 1,522 | ads | ------------------------------------------------------------------------------------------
-- --
-- OAKLAND COMPONENTS --
-- --
-- OAKLAND.TASKS --
-- --
-- Copyright (C) 2011-2021, Patrick Bernardi --
-- --
------------------------------------------------------------------------------------------
with Oak.Agent; use Oak.Agent;
with Oak.Message; use Oak.Message;
with Oak.Oak_Time;
package Oakland.Tasks with Preelaborate is
procedure Activate_Tasks (Activation_Chain : in Task_List);
procedure Complete_Activation;
procedure Complete_Task;
procedure Change_Cycle_Period (New_Period : in Oak.Oak_Time.Time_Span);
procedure Change_Relative_Deadline
(New_Deadline : in Oak.Oak_Time.Time_Span);
procedure Begin_Cycles_Stage;
procedure Yield_Processor_To_Kernel
(With_Message : in out Oak_Message) with Inline => False;
procedure New_Cycle;
type Elaboration_Boolean is private;
private
type Elaboration_Boolean is access Boolean;
end Oakland.Tasks;
|
reznikmm/matreshka | Ada | 3,852 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- 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.Streams;
with Ada.Strings.Hash;
package body Matreshka.FastCGI is
----------
-- Hash --
----------
function Hash
(Item : League.Stream_Element_Vectors.Stream_Element_Vector)
return Ada.Containers.Hash_Type
is
Value : constant Ada.Streams.Stream_Element_Array
:= Item.To_Stream_Element_Array;
Aux : String (1 .. Value'Length);
for Aux'Address use Value'Address;
begin
return Ada.Strings.Hash (Aux);
end Hash;
end Matreshka.FastCGI;
|
ohenley/ada-util | Ada | 3,470 | adb | -----------------------------------------------------------------------
-- util-systems-dlls -- Windows shared library support
-- Copyright (C) 2013 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Interfaces.C.Strings;
with Util.Systems.Os;
package body Util.Systems.DLLs is
function Sys_Load_Library (Path : in Interfaces.C.Strings.chars_ptr) return Handle;
pragma Import (Stdcall, Sys_Load_Library, "LoadLibraryA");
function Sys_Free_Library (Lib : in Handle) return Interfaces.C.int;
pragma Import (Stdcall, Sys_Free_Library, "FreeLibrary");
function Sys_Get_Proc_Address (Lib : in Handle;
Symbol : in Interfaces.C.Strings.chars_ptr)
return System.Address;
pragma Import (Stdcall, Sys_Get_Proc_Address, "GetProcAddress");
function Error_Message return String is
Err : constant Integer := Util.Systems.Os.Get_Last_Error;
begin
return Integer'Image (Err);
end Error_Message;
-- -----------------------
-- Load the shared library with the given name or path and return a library handle.
-- Raises the <tt>Load_Error</tt> exception if the library cannot be loaded.
-- -----------------------
function Load (Path : in String;
Mode : in Flags := 0) return Handle is
pragma Unreferenced (Mode);
Lib : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.New_String (Path);
Result : constant Handle := Sys_Load_Library (Lib);
begin
Interfaces.C.Strings.Free (Lib);
if Result = Null_Handle then
raise Load_Error with Error_Message;
else
return Result;
end if;
end Load;
-- -----------------------
-- Unload the shared library.
-- -----------------------
procedure Unload (Lib : in Handle) is
Result : Interfaces.C.int;
begin
if Lib /= Null_Handle then
Result := Sys_Free_Library (Lib);
end if;
end Unload;
-- -----------------------
-- Get a global symbol with the given name in the library.
-- Raises the <tt>Not_Found</tt> exception if the symbol does not exist.
-- -----------------------
function Get_Symbol (Lib : in Handle;
Name : in String) return System.Address is
use type System.Address;
Symbol : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.New_String (Name);
Result : System.Address := Sys_Get_Proc_Address (Lib, Symbol);
begin
Interfaces.C.Strings.Free (Symbol);
if Result = System.Null_Address then
raise Not_Found with Error_Message;
else
return Result;
end if;
end Get_Symbol;
end Util.Systems.DLLs;
|
reznikmm/matreshka | Ada | 4,001 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Form_Data_Field_Attributes;
package Matreshka.ODF_Form.Data_Field_Attributes is
type Form_Data_Field_Attribute_Node is
new Matreshka.ODF_Form.Abstract_Form_Attribute_Node
and ODF.DOM.Form_Data_Field_Attributes.ODF_Form_Data_Field_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Form_Data_Field_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Form_Data_Field_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Form.Data_Field_Attributes;
|
io7m/coreland-openal-ada | Ada | 6,359 | adb | -- Automatically generated, do not edit.
with OpenAL.Load;
package body OpenAL.Extension.EFX_Thin is
--
-- Load function for API pointers
--
function Load_API return API_t is
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Auxiliary_Effect_Slotf_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Auxiliary_Effect_Slotfv_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Auxiliary_Effect_Sloti_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Auxiliary_Effect_Slotiv_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Delete_Auxiliary_Effect_Slots_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Delete_Effects_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Delete_Filters_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Effectf_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Effectfv_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Effecti_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Effectiv_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Filterf_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Filterfv_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Filteri_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Filteriv_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Gen_Auxiliary_Effect_Slots_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Gen_Effects_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Gen_Filters_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Get_Auxiliary_Effect_Slotf_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Get_Auxiliary_Effect_Slotfv_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Get_Auxiliary_Effect_Sloti_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Get_Auxiliary_Effect_Slotiv_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Get_Effectf_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Get_Effectfv_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Get_Effecti_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Get_Effectiv_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Get_Filterf_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Get_Filterfv_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Get_Filteri_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Get_Filteriv_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Is_Auxiliary_Effect_Slot_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Is_Effect_t);
function Load_Function is new Load.Load_Subprogram
(Subprogram_Access_Type => Is_Filter_t);
begin
return API_t'
(Auxiliary_Effect_Slotf => Load_Function ("alAuxiliaryEffectSlotf"),
Auxiliary_Effect_Slotfv => Load_Function ("alAuxiliaryEffectSlotfv"),
Auxiliary_Effect_Sloti => Load_Function ("alAuxiliaryEffectSloti"),
Auxiliary_Effect_Slotiv => Load_Function ("alAuxiliaryEffectSlotiv"),
Delete_Auxiliary_Effect_Slots => Load_Function ("alDeleteAuxiliaryEffectSlots"),
Delete_Effects => Load_Function ("alDeleteEffects"),
Delete_Filters => Load_Function ("alDeleteFilters"),
Effectf => Load_Function ("alEffectf"),
Effectfv => Load_Function ("alEffectfv"),
Effecti => Load_Function ("alEffecti"),
Effectiv => Load_Function ("alEffectiv"),
Filterf => Load_Function ("alFilterf"),
Filterfv => Load_Function ("alFilterfv"),
Filteri => Load_Function ("alFilteri"),
Filteriv => Load_Function ("alFilteriv"),
Gen_Auxiliary_Effect_Slots => Load_Function ("alGenAuxiliaryEffectSlots"),
Gen_Effects => Load_Function ("alGenEffects"),
Gen_Filters => Load_Function ("alGenFilters"),
Get_Auxiliary_Effect_Slotf => Load_Function ("alGetAuxiliaryEffectSlotf"),
Get_Auxiliary_Effect_Slotfv => Load_Function ("alGetAuxiliaryEffectSlotfv"),
Get_Auxiliary_Effect_Sloti => Load_Function ("alGetAuxiliaryEffectSloti"),
Get_Auxiliary_Effect_Slotiv => Load_Function ("alGetAuxiliaryEffectSlotiv"),
Get_Effectf => Load_Function ("alGetEffectf"),
Get_Effectfv => Load_Function ("alGetEffectfv"),
Get_Effecti => Load_Function ("alGetEffecti"),
Get_Effectiv => Load_Function ("alGetEffectiv"),
Get_Filterf => Load_Function ("alGetFilterf"),
Get_Filterfv => Load_Function ("alGetFilterfv"),
Get_Filteri => Load_Function ("alGetFilteri"),
Get_Filteriv => Load_Function ("alGetFilteriv"),
Is_Auxiliary_Effect_Slot => Load_Function ("alIsAuxiliaryEffectSlot"),
Is_Effect => Load_Function ("alIsEffect"),
Is_Filter => Load_Function ("alIsFilter"));
end Load_API;
end OpenAL.Extension.EFX_Thin;
|
burratoo/Acton | Ada | 5,666 | adb | ------------------------------------------------------------------------------
-- --
-- ASIS TUTORIAL COMPONENTS --
-- --
-- U N I T _ P R O C E S S I N G --
-- --
-- B o d y --
-- --
-- Copyright (c) 2000, Free Software Foundation, Inc. --
-- --
-- ASIS Application Templates are 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 2, or (at your --
-- option) any later version. ASIS Application Templates are distributed in --
-- the hope that they 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 distributed with --
-- distributed with GNAT; see file COPYING. If not, write to the Free --
-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, --
-- USA. --
-- --
-- ASIS Tutorial was developed and are now maintained by Ada Core --
-- Technologies Inc (http://www.gnat.com). --
-- --
------------------------------------------------------------------------------
-- This is the modification of the file with the same name from the ASIS
-- Application Templates to be used in the solution of the metrics tool
-- (for Task 1 and Task 2 the same version of this file is used)
with Asis.Compilation_Units;
with Asis.Elements;
with Element_Processing;
with Tasks;
package body Unit_Processing is
------------------
-- Process_Unit --
------------------
procedure Process_Unit (The_Unit : Asis.Compilation_Unit) is
Cont_Clause_Elements : constant Asis.Element_List :=
Asis.Elements.Context_Clause_Elements (Compilation_Unit => The_Unit,
Include_Pragmas => True);
-- This is the list of the context clauses, including pragmas, if any.
-- If you do not want to process pragmas, set Include_Pragmas OFF when
-- calling Asis.Elements.Context_Clause_Elements
Unit_Decl : Asis.Element := Asis.Elements.Unit_Declaration (The_Unit);
-- The top-level structural element of the library item or subunit
-- contained in The_Unit.
begin
for J in Cont_Clause_Elements'Range loop
Element_Processing.Process_Construct (Cont_Clause_Elements (J));
end loop;
-- Many applications are not interested in processing the context
-- clause of the compilation units. If this is the case for your
-- application, simply remove this loop statement.
if Asis.Compilation_Units.Can_Be_Main_Program (The_Unit) then
case Asis.Compilation_Units.Unit_Kind (The_Unit) is
when Asis.A_Procedure_Body =>
Tasks.Add_Task_Body_Information
(Name => Asis.Compilation_Units.Unit_Full_Name (The_Unit),
Has_Cyclic_Section => False,
Is_Main_Task => True,
Source => Asis.Compilation_Units.Text_Name (The_Unit),
Line => 0);
Tasks.Add_Task_Object_Declaration
(Name => Asis.Compilation_Units.Unit_Full_Name (The_Unit),
Unit_Name => Asis.Compilation_Units.Unit_Full_Name (The_Unit),
Is_Main_Task => True,
Number_Of_Tasks => 1,
Source => Asis.Compilation_Units.Text_Name (The_Unit),
Line => 0);
when Asis.A_Procedure =>
Tasks.Add_Task_Unit_Declaration
(Name => Asis.Compilation_Units.Unit_Full_Name (The_Unit),
Is_Main_Task => True,
Is_Singleton => True,
Source => Asis.Compilation_Units.Text_Name (The_Unit),
Line => 0);
Tasks.Add_Task_Object_Declaration
(Name => Asis.Compilation_Units.Unit_Full_Name (The_Unit),
Unit_Name => Asis.Compilation_Units.Unit_Full_Name (The_Unit),
Is_Main_Task => True,
Number_Of_Tasks => 1,
Source => Asis.Compilation_Units.Text_Name (The_Unit),
Line => 0);
when others =>
null;
end case;
end if;
Element_Processing.Process_Construct (Unit_Decl);
-- This procedure does not contain any exception handler because it
-- supposes that Element_Processing.Process_Construct should handle
-- all the exceptions which can be raised when processing the element
-- hierarchy
end Process_Unit;
end Unit_Processing;
|
burratoo/Acton | Ada | 3,344 | ads | ------------------------------------------------------------------------------------------
-- --
-- OAK CORE SUPPORT PACKAGE --
-- FREESCALE e200 --
-- --
-- ISA.POWER.E200.Z6.TIMER_REGISTERS --
-- --
-- Copyright (C) 2010-2021, Patrick Bernardi --
-- --
------------------------------------------------------------------------------------------
package ISA.Power.e200.Timer_Registers with Pure is
-------
-- Time Control Register Type
-------
type WP_Type is mod 2 ** 2;
type WTRC_Type is mod 2 ** 2;
type FITP_Type is mod 2 ** 2;
type WPEXT_Type is mod 2 ** 4;
type FPEXT_Type is mod 2 ** 4;
type Timer_Control_Register_Type is record
Watchdog_Timer_Period : WP_Type;
Watchdog_Timer_Reset_Control : WTRC_Type;
Watchdog_Timer_Interrupt : Enable_Type;
Decrementer_Interrupt : Enable_Type;
Fixed_Interval_Timer_Period : FITP_Type;
Fixed_Interval_Interrupt : Enable_Type;
Auto_Reload : Enable_Type;
Watchdog_Timer_Period_Extension : WPEXT_Type;
Fixed_Interval_Timer_Period_Extension : FPEXT_Type;
end record with Size => Standard'Word_Size;
type Event_Status is (Not_Occurred, Occurred);
type Watchgdog_Status_Type is mod 2 ** 2;
type Timer_Status_Register_Type is record
Next_Watchdog_Time : Enable_Type;
Watchdog_Timer_Interrupt : Event_Status;
Watchdog_Timer_Reset : Watchgdog_Status_Type;
Decrement_Interrupt : Event_Status;
Fixed_Interval_Interrupt : Event_Status;
end record with Size => Standard'Word_Size;
---------------
-- Hardware Representation
---------------
for Timer_Control_Register_Type use record
Watchdog_Timer_Period at 0 range 0 .. 1;
Watchdog_Timer_Reset_Control at 0 range 2 .. 3;
Watchdog_Timer_Interrupt at 0 range 4 .. 4;
Decrementer_Interrupt at 0 range 5 .. 5;
Fixed_Interval_Timer_Period at 0 range 6 .. 7;
Fixed_Interval_Interrupt at 0 range 8 .. 8;
Auto_Reload at 0 range 9 .. 9;
Watchdog_Timer_Period_Extension at 0 range 11 .. 14;
Fixed_Interval_Timer_Period_Extension at 0 range 15 .. 18;
end record;
for Event_Status use (Not_Occurred => 0, Occurred => 1);
for Timer_Status_Register_Type use record
Next_Watchdog_Time at 0 range 0 .. 0;
Watchdog_Timer_Interrupt at 0 range 1 .. 1;
Watchdog_Timer_Reset at 0 range 2 .. 3;
Decrement_Interrupt at 0 range 4 .. 4;
Fixed_Interval_Interrupt at 0 range 5 .. 5;
end record;
end ISA.Power.e200.Timer_Registers;
|
reznikmm/ada-skynet | Ada | 708 | adb | -- Copyright (c) 2020 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Skynet;
with League.Strings;
with Ada.Wide_Wide_Text_IO;
procedure Skynet_Test is
Options : Skynet.Upload_Options;
Skylink : League.Strings.Universal_String;
begin
Skynet.Upload_File
(Path => League.Strings.To_Universal_String ("/etc/hosts"),
Skylink => Skylink,
Options => Options);
Ada.Wide_Wide_Text_IO.Put_Line (Skylink.To_Wide_Wide_String);
Skynet.Download_File
(Path => League.Strings.To_Universal_String ("/tmp/hosts"),
Skylink => Skylink);
end Skynet_Test;
|
AdaCore/training_material | Ada | 91 | ads | --Constants
package Constants is
-- constants for use by other packages
end Constants;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 14,250 | ads | -- This spec has been automatically generated from STM32F030.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package STM32_SVD.GPIO is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- MODER array element
subtype MODER_Element is STM32_SVD.UInt2;
-- MODER array
type MODER_Field_Array is array (0 .. 15) of MODER_Element
with Component_Size => 2, Size => 32;
-- GPIO port mode register
type MODER_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MODER as a value
Val : STM32_SVD.UInt32;
when True =>
-- MODER as an array
Arr : MODER_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for MODER_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- OTYPER_OT array element
subtype OTYPER_OT_Element is STM32_SVD.Bit;
-- OTYPER_OT array
type OTYPER_OT_Field_Array is array (0 .. 15) of OTYPER_OT_Element
with Component_Size => 1, Size => 16;
-- Type definition for OTYPER_OT
type OTYPER_OT_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- OT as a value
Val : STM32_SVD.UInt16;
when True =>
-- OT as an array
Arr : OTYPER_OT_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for OTYPER_OT_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- GPIO port output type register
type OTYPER_Register is record
-- Port x configuration bits (y = 0..15)
OT : OTYPER_OT_Field := (As_Array => False, Val => 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 OTYPER_Register use record
OT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- OSPEEDR array element
subtype OSPEEDR_Element is STM32_SVD.UInt2;
-- OSPEEDR array
type OSPEEDR_Field_Array is array (0 .. 15) of OSPEEDR_Element
with Component_Size => 2, Size => 32;
-- GPIO port output speed register
type OSPEEDR_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- OSPEEDR as a value
Val : STM32_SVD.UInt32;
when True =>
-- OSPEEDR as an array
Arr : OSPEEDR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for OSPEEDR_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- PUPDR array element
subtype PUPDR_Element is STM32_SVD.UInt2;
-- PUPDR array
type PUPDR_Field_Array is array (0 .. 15) of PUPDR_Element
with Component_Size => 2, Size => 32;
-- GPIO port pull-up/pull-down register
type PUPDR_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- PUPDR as a value
Val : STM32_SVD.UInt32;
when True =>
-- PUPDR as an array
Arr : PUPDR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for PUPDR_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- IDR array element
subtype IDR_Element is STM32_SVD.Bit;
-- IDR array
type IDR_Field_Array is array (0 .. 15) of IDR_Element
with Component_Size => 1, Size => 16;
-- Type definition for IDR
type IDR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- IDR as a value
Val : STM32_SVD.UInt16;
when True =>
-- IDR as an array
Arr : IDR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for IDR_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- GPIO port input data register
type IDR_Register is record
-- Read-only. Port input data (y = 0..15)
IDR : IDR_Field;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for IDR_Register use record
IDR at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- ODR array element
subtype ODR_Element is STM32_SVD.Bit;
-- ODR array
type ODR_Field_Array is array (0 .. 15) of ODR_Element
with Component_Size => 1, Size => 16;
-- Type definition for ODR
type ODR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- ODR as a value
Val : STM32_SVD.UInt16;
when True =>
-- ODR as an array
Arr : ODR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for ODR_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- GPIO port output data register
type ODR_Register is record
-- Port output data (y = 0..15)
ODR : ODR_Field := (As_Array => False, Val => 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 ODR_Register use record
ODR at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- BSRR_BS array element
subtype BSRR_BS_Element is STM32_SVD.Bit;
-- BSRR_BS array
type BSRR_BS_Field_Array is array (0 .. 15) of BSRR_BS_Element
with Component_Size => 1, Size => 16;
-- Type definition for BSRR_BS
type BSRR_BS_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- BS as a value
Val : STM32_SVD.UInt16;
when True =>
-- BS as an array
Arr : BSRR_BS_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for BSRR_BS_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- BSRR_BR array element
subtype BSRR_BR_Element is STM32_SVD.Bit;
-- BSRR_BR array
type BSRR_BR_Field_Array is array (0 .. 15) of BSRR_BR_Element
with Component_Size => 1, Size => 16;
-- Type definition for BSRR_BR
type BSRR_BR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- BR as a value
Val : STM32_SVD.UInt16;
when True =>
-- BR as an array
Arr : BSRR_BR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for BSRR_BR_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- GPIO port bit set/reset register
type BSRR_Register is record
-- Write-only. Port x set bit y (y= 0..15)
BS : BSRR_BS_Field := (As_Array => False, Val => 16#0#);
-- Write-only. Port x set bit y (y= 0..15)
BR : BSRR_BR_Field := (As_Array => False, Val => 16#0#);
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for BSRR_Register use record
BS at 0 range 0 .. 15;
BR at 0 range 16 .. 31;
end record;
-- LCKR_LCK array element
subtype LCKR_LCK_Element is STM32_SVD.Bit;
-- LCKR_LCK array
type LCKR_LCK_Field_Array is array (0 .. 15) of LCKR_LCK_Element
with Component_Size => 1, Size => 16;
-- Type definition for LCKR_LCK
type LCKR_LCK_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- LCK as a value
Val : STM32_SVD.UInt16;
when True =>
-- LCK as an array
Arr : LCKR_LCK_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for LCKR_LCK_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
subtype LCKR_LCKK_Field is STM32_SVD.Bit;
-- GPIO port configuration lock register
type LCKR_Register is record
-- Port x lock bit y (y= 0..15)
LCK : LCKR_LCK_Field := (As_Array => False, Val => 16#0#);
-- Port x lock bit y (y= 0..15)
LCKK : LCKR_LCKK_Field := 16#0#;
-- unspecified
Reserved_17_31 : STM32_SVD.UInt15 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for LCKR_Register use record
LCK at 0 range 0 .. 15;
LCKK at 0 range 16 .. 16;
Reserved_17_31 at 0 range 17 .. 31;
end record;
-- AFRL array element
subtype AFRL_Element is STM32_SVD.UInt4;
-- AFRL array
type AFRL_Field_Array is array (0 .. 7) of AFRL_Element
with Component_Size => 4, Size => 32;
-- GPIO alternate function low register
type AFRL_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- AFRL as a value
Val : STM32_SVD.UInt32;
when True =>
-- AFRL as an array
Arr : AFRL_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for AFRL_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- AFRH array element
subtype AFRH_Element is STM32_SVD.UInt4;
-- AFRH array
type AFRH_Field_Array is array (8 .. 15) of AFRH_Element
with Component_Size => 4, Size => 32;
-- GPIO alternate function high register
type AFRH_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- AFRH as a value
Val : STM32_SVD.UInt32;
when True =>
-- AFRH as an array
Arr : AFRH_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for AFRH_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- BRR_BR array element
subtype BRR_BR_Element is STM32_SVD.Bit;
-- BRR_BR array
type BRR_BR_Field_Array is array (0 .. 15) of BRR_BR_Element
with Component_Size => 1, Size => 16;
-- Type definition for BRR_BR
type BRR_BR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- BR as a value
Val : STM32_SVD.UInt16;
when True =>
-- BR as an array
Arr : BRR_BR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 16;
for BRR_BR_Field use record
Val at 0 range 0 .. 15;
Arr at 0 range 0 .. 15;
end record;
-- Port bit reset register
type BRR_Register is record
-- Write-only. Port x Reset bit y
BR : BRR_BR_Field := (As_Array => False, Val => 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 BRR_Register use record
BR at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- General-purpose I/Os
type GPIO_Peripheral is record
-- GPIO port mode register
MODER : aliased MODER_Register;
-- GPIO port output type register
OTYPER : aliased OTYPER_Register;
-- GPIO port output speed register
OSPEEDR : aliased OSPEEDR_Register;
-- GPIO port pull-up/pull-down register
PUPDR : aliased PUPDR_Register;
-- GPIO port input data register
IDR : aliased IDR_Register;
-- GPIO port output data register
ODR : aliased ODR_Register;
-- GPIO port bit set/reset register
BSRR : aliased BSRR_Register;
-- GPIO port configuration lock register
LCKR : aliased LCKR_Register;
-- GPIO alternate function low register
AFRL : aliased AFRL_Register;
-- GPIO alternate function high register
AFRH : aliased AFRH_Register;
-- Port bit reset register
BRR : aliased BRR_Register;
end record
with Volatile;
for GPIO_Peripheral use record
MODER at 16#0# range 0 .. 31;
OTYPER at 16#4# range 0 .. 31;
OSPEEDR at 16#8# range 0 .. 31;
PUPDR at 16#C# range 0 .. 31;
IDR at 16#10# range 0 .. 31;
ODR at 16#14# range 0 .. 31;
BSRR at 16#18# range 0 .. 31;
LCKR at 16#1C# range 0 .. 31;
AFRL at 16#20# range 0 .. 31;
AFRH at 16#24# range 0 .. 31;
BRR at 16#28# range 0 .. 31;
end record;
-- General-purpose I/Os
GPIOA_Periph : aliased GPIO_Peripheral
with Import, Address => System'To_Address (16#48000000#);
-- General-purpose I/Os
GPIOB_Periph : aliased GPIO_Peripheral
with Import, Address => System'To_Address (16#48000400#);
-- General-purpose I/Os
GPIOC_Periph : aliased GPIO_Peripheral
with Import, Address => System'To_Address (16#48000800#);
-- General-purpose I/Os
GPIOD_Periph : aliased GPIO_Peripheral
with Import, Address => System'To_Address (16#48000C00#);
-- General-purpose I/Os
GPIOF_Periph : aliased GPIO_Peripheral
with Import, Address => System'To_Address (16#48001400#);
end STM32_SVD.GPIO;
|
stcarrez/ada-ado | Ada | 10,068 | adb | -----------------------------------------------------------------------
-- ado-audits-tests -- Audit tests
-- Copyright (C) 2018, 2019, 2021, 2022, 2023 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Test_Caller;
with Util.Strings;
with Ada.Text_IO;
with Regtests.Audits.Model;
with ADO.Queries.Loaders;
with ADO.Datasets;
with ADO.Sessions.Entities;
package body ADO.Audits.Tests is
use Ada.Strings.Unbounded;
use type ADO.Objects.Object_Key_Type;
package Caller is new Util.Test_Caller (Test, "ADO.Audits");
package Audit_List_Query_File is
new ADO.Queries.Loaders.File (Path => "regtests/files/audit-list.xml",
Sha1 => "");
package Property_List_Query is
new ADO.Queries.Loaders.Query (Name => "property-list",
File => Audit_List_Query_File.File'Access);
package Email_List_Query is
new ADO.Queries.Loaders.Query (Name => "email-list",
File => Audit_List_Query_File.File'Access);
type Test_Audit_Manager is new Audit_Manager with null record;
-- Save the audit changes in the database.
overriding
procedure Save (Manager : in out Test_Audit_Manager;
Session : in out ADO.Sessions.Master_Session'Class;
Object : in Auditable_Object_Record'Class;
Changes : in Audit_Array);
Audit_Instance : aliased Test_Audit_Manager;
-- Save the audit changes in the database.
overriding
procedure Save (Manager : in out Test_Audit_Manager;
Session : in out ADO.Sessions.Master_Session'Class;
Object : in Auditable_Object_Record'Class;
Changes : in Audit_Array) is
pragma Unreferenced (Manager);
Now : constant Ada.Calendar.Time := Ada.Calendar.Clock;
Kind : constant ADO.Entity_Type
:= ADO.Sessions.Entities.Find_Entity_Type (Session, Object.Get_Key);
begin
for C of Changes loop
declare
Audit : Regtests.Audits.Model.Audit_Ref;
begin
if Object.Key_Type = ADO.Objects.KEY_INTEGER then
Audit.Set_Entity_Id (ADO.Objects.Get_Value (Object.Get_Key));
end if;
Audit.Set_Entity_Type (Kind);
Audit.Set_Old_Value (UBO.To_String (C.Old_Value));
Audit.Set_New_Value (UBO.To_String (C.New_Value));
Audit.Set_Date (Now);
Audit.Save (Session);
end;
end loop;
end Save;
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test ADO.Audits.Audit_Field",
Test_Audit_Field'Access);
end Add_Tests;
overriding
procedure Set_Up (T : in out Test) is
pragma Unreferenced (T);
begin
Regtests.Set_Audit_Manager (Audit_Instance'Access);
end Set_Up;
-- ------------------------------
-- Test populating Audit_Fields
-- ------------------------------
procedure Test_Audit_Field (T : in out Test) is
type Identifier_Array is array (1 .. 10) of ADO.Identifier;
DB : ADO.Sessions.Master_Session := Regtests.Get_Master_Database;
Email : Regtests.Audits.Model.Email_Ref;
Prop : Regtests.Audits.Model.Property_Ref;
List : Identifier_Array;
E1 : ADO.Entity_Type;
E2 : ADO.Entity_Type;
J : ADO.Identifier := 0;
Query : ADO.Queries.Context;
Prop_Count : Natural;
Email_Count : Natural;
begin
Query.Set_Count_Query (Property_List_Query.Query'Access);
Prop_Count := ADO.Datasets.Get_Count (DB, Query);
Query.Set_Count_Query (Email_List_Query.Query'Access);
Email_Count := ADO.Datasets.Get_Count (DB, Query);
E1 := ADO.Sessions.Entities.Find_Entity_Type (DB, "audit_email");
E2 := ADO.Sessions.Entities.Find_Entity_Type (DB, "audit_property");
DB.Begin_Transaction;
for I in List'Range loop
Email := Regtests.Audits.Model.Null_Email;
Email.Set_Email ("Email" & Util.Strings.Image (I) & "@nowhere.com");
Email.Set_Status (ADO.Nullable_Integer '(23, False));
Email.Set_Create_Date (Ada.Calendar.Clock);
Email.Set_Info ("Info");
Email.Save (DB);
List (I) := Email.Get_Id;
end loop;
DB.Commit;
DB.Begin_Transaction;
for Id of List loop
Email.Load (DB, Id);
Email.Set_Status (ADO.Nullable_Integer '(Email.Get_Status.Value + 1, False));
Email.Set_Date (ADO.Nullable_Time '(Ada.Calendar.Clock, False));
Email.Save (DB);
Email.Set_Email ("Email" & Util.Strings.Image (Natural (Id))
& Util.Strings.Image (Email.Get_Status.Value) & "@here.com");
Email.Save (DB);
-- Set a null string, null integer.
Email.Set_Email (ADO.Null_String);
Email.Set_Status (ADO.Null_Integer);
Email.Set_Date (ADO.Null_Time);
Email.Save (DB);
Email.Set_Email ("Email" & Util.Strings.Image (Natural (Id))
& Util.Strings.Image (Email.Get_Status.Value) & "@there.com");
Email.Set_Status (ADO.Nullable_Integer '(Email.Get_Status.Value + 1, False));
Email.Set_Date (ADO.Nullable_Time '(Ada.Calendar.Clock, False));
Email.Save (DB);
declare
New_Email : constant Unbounded_String
:= To_Unbounded_String ("Email" & Util.Strings.Image (Natural (Id))
& Util.Strings.Image (Email.Get_Status.Value)
& "@there.com");
begin
Email.Set_Info (New_Email);
Email.Set_Email (ADO.Nullable_String '(New_Email, False));
Email.Set_Status (ADO.Nullable_Integer '(24, False));
Email.Set_Date (ADO.Nullable_Time '(Ada.Calendar.Clock, False));
Email.Save (DB);
end;
-- Set a null string.
Email.Set_Email (ADO.Null_String);
Email.Save (DB);
declare
New_Email : constant Unbounded_String
:= To_Unbounded_String ("Email-3-" & Util.Strings.Image (Natural (Id))
& Util.Strings.Image (Email.Get_Status.Value)
& "@there.com");
begin
Email.Set_Info (New_Email);
Email.Set_Email (ADO.Nullable_String '(New_Email, False));
Email.Set_Status (ADO.Nullable_Integer '(25, False));
Email.Set_Date (ADO.Nullable_Time '(Ada.Calendar.Clock, False));
Email.Save (DB);
end;
end loop;
DB.Commit;
DB.Begin_Transaction;
for Id of List loop
Email.Load (DB, Id);
Email.Set_Status (ADO.Null_Integer);
Email.Save (DB);
end loop;
DB.Commit;
Prop.set_Id (Util.Tests.Get_Uuid);
for I in 1 .. 10 loop
Prop.Set_Value ((Value => I, Is_Null => False));
Prop.Set_Float_Value (3.0 * Float (I));
Prop.Set_Double_Value (123.0 * Long_Float (I));
Prop.Set_Kind ((if I mod 2 = 0 then E1 else E2));
if I mod 4 = 0 then
Prop.Set_Optional_Kind (ADO.Null_Entity_Type);
elsif I mod 2 = 0 then
Prop.Set_Optional_Kind (ADO.Nullable_Entity_Type '(E1, False));
else
Prop.Set_Optional_Kind (ADO.Nullable_Entity_Type '(E2, False));
end if;
Prop.Set_Object_Id (J);
Prop.Save (DB);
J := J + 1;
end loop;
declare
Audit_List : Regtests.Audits.Model.Audit_Vector;
begin
Query.Clear;
Query.Set_Filter ("entity_id = :entity_id");
for Id of List loop
Query.Bind_Param ("entity_id", Id);
Regtests.Audits.Model.List (Audit_List, DB, Query);
for A of Audit_List loop
Ada.Text_IO.Put_Line (ADO.Identifier'Image (Id) & " "
& ADO.Identifier'Image (A.Get_Id)
& " " & A.Get_Old_Value & " - "
& A.Get_New_Value);
Util.Tests.Assert_Equals (T, Natural (Id), Natural (A.Get_Entity_Id),
"Invalid audit record: id is wrong");
end loop;
Util.Tests.Assert_Equals (T, 23, Natural (Audit_List.Length),
"Invalid number of audit records");
end loop;
end;
-- Load the properties as datasets.
declare
Data : ADO.Datasets.Dataset;
begin
Query.Clear;
Query.Set_Query (Property_List_Query.Query'Access);
ADO.Datasets.List (Data, DB, Query);
Util.Tests.Assert_Equals (T, Prop_Count + 1, Data.Get_Count,
"Invalid dataset size (property)");
end;
-- Load the properties as datasets.
declare
Data : ADO.Datasets.Dataset;
begin
Query.Clear;
Query.Set_Query (Email_List_Query.Query'Access);
ADO.Datasets.List (Data, DB, Query);
Util.Tests.Assert_Equals (T, Email_Count + 10, Data.Get_Count,
"Invalid dataset size (email)");
end;
end Test_Audit_Field;
end ADO.Audits.Tests;
|
persan/A-gst | Ada | 19,343 | ads | pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
with glib;
with glib.Values;
with System;
with glib;
with System;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gststructure_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h;
with Interfaces.C.Strings;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_navigation_h is
-- unsupported macro: GST_TYPE_NAVIGATION (gst_navigation_get_type ())
-- arg-macro: function GST_NAVIGATION (obj)
-- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_NAVIGATION, GstNavigation);
-- arg-macro: function GST_IS_NAVIGATION (obj)
-- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_NAVIGATION);
-- arg-macro: function GST_NAVIGATION_GET_IFACE (obj)
-- return G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_NAVIGATION, GstNavigationInterface);
-- unsupported macro: GST_NAVIGATION_COMMAND_DVD_MENU GST_NAVIGATION_COMMAND_MENU1
-- unsupported macro: GST_NAVIGATION_COMMAND_DVD_TITLE_MENU GST_NAVIGATION_COMMAND_MENU2
-- unsupported macro: GST_NAVIGATION_COMMAND_DVD_ROOT_MENU GST_NAVIGATION_COMMAND_MENU3
-- unsupported macro: GST_NAVIGATION_COMMAND_DVD_SUBPICTURE_MENU GST_NAVIGATION_COMMAND_MENU4
-- unsupported macro: GST_NAVIGATION_COMMAND_DVD_AUDIO_MENU GST_NAVIGATION_COMMAND_MENU5
-- unsupported macro: GST_NAVIGATION_COMMAND_DVD_ANGLE_MENU GST_NAVIGATION_COMMAND_MENU6
-- unsupported macro: GST_NAVIGATION_COMMAND_DVD_CHAPTER_MENU GST_NAVIGATION_COMMAND_MENU7
-- GStreamer Navigation
-- * Copyright (C) 2003 Ronald Bultje <[email protected]>
-- * Copyright (C) 2003 David A. Schleef <[email protected]>
-- *
-- * navigation.h: navigation interface design
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public
-- * License along with this library; if not, write to the
-- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-- * Boston, MA 02111-1307, USA.
--
-- skipped empty struct u_GstNavigation
-- skipped empty struct GstNavigation
type GstNavigationInterface;
type u_GstNavigationInterface_u_gst_reserved_array is array (0 .. 3) of System.Address;
--subtype GstNavigationInterface is u_GstNavigationInterface; -- gst/interfaces/navigation.h:40
--*
-- * GstNavigationInterface:
-- * @g_iface: the parent interface
-- * @send_event: sending a navigation event
-- *
-- * Color-balance interface.
--
type GstNavigationInterface is record
g_iface : aliased GStreamer.GST_Low_Level.glib_2_0_gobject_gtype_h.GTypeInterface; -- gst/interfaces/navigation.h:50
send_event : access procedure (arg1 : System.Address; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gststructure_h.GstStructure); -- gst/interfaces/navigation.h:53
u_gst_reserved : u_GstNavigationInterface_u_gst_reserved_array; -- gst/interfaces/navigation.h:56
end record;
pragma Convention (C_Pass_By_Copy, GstNavigationInterface); -- gst/interfaces/navigation.h:49
-- virtual functions
--< private >
function gst_navigation_get_type return GLIB.GType; -- gst/interfaces/navigation.h:59
pragma Import (C, gst_navigation_get_type, "gst_navigation_get_type");
-- Navigation commands
--*
-- * GstNavigationCommand:
-- * @GST_NAVIGATION_COMMAND_INVALID: An invalid command entry
-- * @GST_NAVIGATION_COMMAND_MENU1: Execute navigation menu command 1. For DVD,
-- * this enters the DVD root menu, or exits back to the title from the menu.
-- * @GST_NAVIGATION_COMMAND_MENU2: Execute navigation menu command 2. For DVD,
-- * this jumps to the DVD title menu.
-- * @GST_NAVIGATION_COMMAND_MENU3: Execute navigation menu command 3. For DVD,
-- * this jumps into the DVD root menu.
-- * @GST_NAVIGATION_COMMAND_MENU4: Execute navigation menu command 4. For DVD,
-- * this jumps to the Subpicture menu.
-- * @GST_NAVIGATION_COMMAND_MENU5: Execute navigation menu command 5. For DVD,
-- * the jumps to the audio menu.
-- * @GST_NAVIGATION_COMMAND_MENU6: Execute navigation menu command 6. For DVD,
-- * this jumps to the angles menu.
-- * @GST_NAVIGATION_COMMAND_MENU7: Execute navigation menu command 7. For DVD,
-- * this jumps to the chapter menu.
-- * @GST_NAVIGATION_COMMAND_LEFT: Select the next button to the left in a menu,
-- * if such a button exists.
-- * @GST_NAVIGATION_COMMAND_RIGHT: Select the next button to the right in a menu,
-- * if such a button exists.
-- * @GST_NAVIGATION_COMMAND_UP: Select the button above the current one in a
-- * menu, if such a button exists.
-- * @GST_NAVIGATION_COMMAND_DOWN: Select the button below the current one in a
-- * menu, if such a button exists.
-- * @GST_NAVIGATION_COMMAND_ACTIVATE: Activate (click) the currently selected
-- * button in a menu, if such a button exists.
-- * @GST_NAVIGATION_COMMAND_PREV_ANGLE: Switch to the previous angle in a
-- * multiangle feature.
-- * @GST_NAVIGATION_COMMAND_NEXT_ANGLE: Switch to the next angle in a multiangle
-- * feature.
-- *
-- * A set of commands that may be issued to an element providing the
-- * #GstNavigation interface. The available commands can be queried via
-- * the gst_navigation_query_new_commands() query.
-- *
-- * For convenience in handling DVD navigation, the MENU commands are aliased as:
-- * GST_NAVIGATION_COMMAND_DVD_MENU = @GST_NAVIGATION_COMMAND_MENU1
-- * GST_NAVIGATION_COMMAND_DVD_TITLE_MENU = @GST_NAVIGATION_COMMAND_MENU2
-- * GST_NAVIGATION_COMMAND_DVD_ROOT_MENU = @GST_NAVIGATION_COMMAND_MENU3
-- * GST_NAVIGATION_COMMAND_DVD_SUBPICTURE_MENU = @GST_NAVIGATION_COMMAND_MENU4
-- * GST_NAVIGATION_COMMAND_DVD_AUDIO_MENU = @GST_NAVIGATION_COMMAND_MENU5
-- * GST_NAVIGATION_COMMAND_DVD_ANGLE_MENU = @GST_NAVIGATION_COMMAND_MENU6
-- * GST_NAVIGATION_COMMAND_DVD_CHAPTER_MENU = @GST_NAVIGATION_COMMAND_MENU7
-- *
-- * Since: 0.10.23
--
subtype GstNavigationCommand is unsigned;
GST_NAVIGATION_COMMAND_INVALID : constant GstNavigationCommand := 0;
GST_NAVIGATION_COMMAND_MENU1 : constant GstNavigationCommand := 1;
GST_NAVIGATION_COMMAND_MENU2 : constant GstNavigationCommand := 2;
GST_NAVIGATION_COMMAND_MENU3 : constant GstNavigationCommand := 3;
GST_NAVIGATION_COMMAND_MENU4 : constant GstNavigationCommand := 4;
GST_NAVIGATION_COMMAND_MENU5 : constant GstNavigationCommand := 5;
GST_NAVIGATION_COMMAND_MENU6 : constant GstNavigationCommand := 6;
GST_NAVIGATION_COMMAND_MENU7 : constant GstNavigationCommand := 7;
GST_NAVIGATION_COMMAND_LEFT : constant GstNavigationCommand := 20;
GST_NAVIGATION_COMMAND_RIGHT : constant GstNavigationCommand := 21;
GST_NAVIGATION_COMMAND_UP : constant GstNavigationCommand := 22;
GST_NAVIGATION_COMMAND_DOWN : constant GstNavigationCommand := 23;
GST_NAVIGATION_COMMAND_ACTIVATE : constant GstNavigationCommand := 24;
GST_NAVIGATION_COMMAND_PREV_ANGLE : constant GstNavigationCommand := 30;
GST_NAVIGATION_COMMAND_NEXT_ANGLE : constant GstNavigationCommand := 31; -- gst/interfaces/navigation.h:129
-- Some aliases for the menu command types
-- Queries
--*
-- * GstNavigationQueryType:
-- * @GST_NAVIGATION_QUERY_INVALID: invalid query
-- * @GST_NAVIGATION_QUERY_COMMANDS: command query
-- * @GST_NAVIGATION_QUERY_ANGLES: viewing angle query
-- *
-- * Tyoes of navigation interface queries.
--
type GstNavigationQueryType is
(GST_NAVIGATION_QUERY_INVALID,
GST_NAVIGATION_QUERY_COMMANDS,
GST_NAVIGATION_QUERY_ANGLES);
pragma Convention (C, GstNavigationQueryType); -- gst/interfaces/navigation.h:154
function gst_navigation_query_get_type (query : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery) return GstNavigationQueryType; -- gst/interfaces/navigation.h:156
pragma Import (C, gst_navigation_query_get_type, "gst_navigation_query_get_type");
function gst_navigation_query_new_commands return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery; -- gst/interfaces/navigation.h:158
pragma Import (C, gst_navigation_query_new_commands, "gst_navigation_query_new_commands");
procedure gst_navigation_query_set_commands (query : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery; n_cmds : GLIB.gint -- , ...
); -- gst/interfaces/navigation.h:159
pragma Import (C, gst_navigation_query_set_commands, "gst_navigation_query_set_commands");
procedure gst_navigation_query_set_commandsv
(query : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery;
n_cmds : GLIB.gint;
cmds : access GstNavigationCommand); -- gst/interfaces/navigation.h:160
pragma Import (C, gst_navigation_query_set_commandsv, "gst_navigation_query_set_commandsv");
function gst_navigation_query_parse_commands_length (query : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery; n_cmds : access GLIB.guint) return GLIB.gboolean; -- gst/interfaces/navigation.h:162
pragma Import (C, gst_navigation_query_parse_commands_length, "gst_navigation_query_parse_commands_length");
function gst_navigation_query_parse_commands_nth
(query : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery;
nth : GLIB.guint;
cmd : access GstNavigationCommand) return GLIB.gboolean; -- gst/interfaces/navigation.h:164
pragma Import (C, gst_navigation_query_parse_commands_nth, "gst_navigation_query_parse_commands_nth");
function gst_navigation_query_new_angles return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery; -- gst/interfaces/navigation.h:167
pragma Import (C, gst_navigation_query_new_angles, "gst_navigation_query_new_angles");
procedure gst_navigation_query_set_angles
(query : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery;
cur_angle : GLIB.guint;
n_angles : GLIB.guint); -- gst/interfaces/navigation.h:168
pragma Import (C, gst_navigation_query_set_angles, "gst_navigation_query_set_angles");
function gst_navigation_query_parse_angles
(query : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery;
cur_angle : access GLIB.guint;
n_angles : access GLIB.guint) return GLIB.gboolean; -- gst/interfaces/navigation.h:170
pragma Import (C, gst_navigation_query_parse_angles, "gst_navigation_query_parse_angles");
-- Element messages
--*
-- * GstNavigationMessageType:
-- * @GST_NAVIGATION_MESSAGE_INVALID: Returned from
-- * gst_navigation_message_get_type() when the passed message is not a
-- * navigation message.
-- * @GST_NAVIGATION_MESSAGE_MOUSE_OVER: Sent when the mouse moves over or leaves a
-- * clickable region of the output, such as a DVD menu button.
-- * @GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED: Sent when the set of available commands
-- * changes and should re-queried by interested applications.
-- * @GST_NAVIGATION_MESSAGE_ANGLES_CHANGED: Sent when display angles in a multi-angle
-- * feature (such as a multiangle DVD) change - either angles have appeared or
-- * disappeared.
-- *
-- * A set of notifications that may be received on the bus when navigation
-- * related status changes.
-- *
-- * Since: 0.10.23
--
type GstNavigationMessageType is
(GST_NAVIGATION_MESSAGE_INVALID,
GST_NAVIGATION_MESSAGE_MOUSE_OVER,
GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED,
GST_NAVIGATION_MESSAGE_ANGLES_CHANGED);
pragma Convention (C, GstNavigationMessageType); -- gst/interfaces/navigation.h:197
function gst_navigation_message_get_type (message : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage) return GstNavigationMessageType; -- gst/interfaces/navigation.h:199
pragma Import (C, gst_navigation_message_get_type, "gst_navigation_message_get_type");
function gst_navigation_message_new_mouse_over (src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject; active : GLIB.gboolean) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage; -- gst/interfaces/navigation.h:201
pragma Import (C, gst_navigation_message_new_mouse_over, "gst_navigation_message_new_mouse_over");
function gst_navigation_message_parse_mouse_over (message : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage; active : access GLIB.gboolean) return GLIB.gboolean; -- gst/interfaces/navigation.h:203
pragma Import (C, gst_navigation_message_parse_mouse_over, "gst_navigation_message_parse_mouse_over");
function gst_navigation_message_new_commands_changed (src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage; -- gst/interfaces/navigation.h:206
pragma Import (C, gst_navigation_message_new_commands_changed, "gst_navigation_message_new_commands_changed");
function gst_navigation_message_new_angles_changed
(src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject;
cur_angle : GLIB.guint;
n_angles : GLIB.guint) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage; -- gst/interfaces/navigation.h:208
pragma Import (C, gst_navigation_message_new_angles_changed, "gst_navigation_message_new_angles_changed");
function gst_navigation_message_parse_angles_changed
(message : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h.GstMessage;
cur_angle : access GLIB.guint;
n_angles : access GLIB.guint) return GLIB.gboolean; -- gst/interfaces/navigation.h:211
pragma Import (C, gst_navigation_message_parse_angles_changed, "gst_navigation_message_parse_angles_changed");
-- event parsing functions
--*
-- * GstNavigationEventType:
-- * @GST_NAVIGATION_EVENT_INVALID: Returned from
-- * gst_navigation_event_get_type() when the passed event is not a navigation event.
-- * @GST_NAVIGATION_EVENT_KEY_PRESS: A key press event. Use
-- * gst_navigation_event_parse_key_event() to extract the details from the event.
-- * @GST_NAVIGATION_EVENT_KEY_RELEASE: A key release event. Use
-- * gst_navigation_event_parse_key_event() to extract the details from the event.
-- * @GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS: A mouse button press event. Use
-- * gst_navigation_event_parse_mouse_button_event() to extract the details from the
-- * event.
-- * @GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE: A mouse button release event. Use
-- * gst_navigation_event_parse_mouse_button_event() to extract the details from the
-- * event.
-- * @GST_NAVIGATION_EVENT_MOUSE_MOVE: A mouse movement event. Use
-- * gst_navigation_event_parse_mouse_move_event() to extract the details from the
-- * event.
-- * @GST_NAVIGATION_EVENT_COMMAND: A navigation command event. Use
-- * gst_navigation_event_parse_command() to extract the details from the event.
-- *
-- * Enum values for the various events that an element implementing the
-- * GstNavigation interface might send up the pipeline.
-- *
-- * Since: 0.10.23
--
type GstNavigationEventType is
(GST_NAVIGATION_EVENT_INVALID,
GST_NAVIGATION_EVENT_KEY_PRESS,
GST_NAVIGATION_EVENT_KEY_RELEASE,
GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS,
GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE,
GST_NAVIGATION_EVENT_MOUSE_MOVE,
GST_NAVIGATION_EVENT_COMMAND);
pragma Convention (C, GstNavigationEventType); -- gst/interfaces/navigation.h:249
function gst_navigation_event_get_type (event : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent) return GstNavigationEventType; -- gst/interfaces/navigation.h:251
pragma Import (C, gst_navigation_event_get_type, "gst_navigation_event_get_type");
function gst_navigation_event_parse_key_event (event : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent; key : System.Address) return GLIB.gboolean; -- gst/interfaces/navigation.h:252
pragma Import (C, gst_navigation_event_parse_key_event, "gst_navigation_event_parse_key_event");
function gst_navigation_event_parse_mouse_button_event
(event : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent;
button : access GLIB.gint;
x : access GLIB.gdouble;
y : access GLIB.gdouble) return GLIB.gboolean; -- gst/interfaces/navigation.h:254
pragma Import (C, gst_navigation_event_parse_mouse_button_event, "gst_navigation_event_parse_mouse_button_event");
function gst_navigation_event_parse_mouse_move_event
(event : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent;
x : access GLIB.gdouble;
y : access GLIB.gdouble) return GLIB.gboolean; -- gst/interfaces/navigation.h:256
pragma Import (C, gst_navigation_event_parse_mouse_move_event, "gst_navigation_event_parse_mouse_move_event");
function gst_navigation_event_parse_command (event : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent; command : access GstNavigationCommand) return GLIB.gboolean; -- gst/interfaces/navigation.h:258
pragma Import (C, gst_navigation_event_parse_command, "gst_navigation_event_parse_command");
-- interface virtual function wrappers
procedure gst_navigation_send_event (navigation : System.Address; structure : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gststructure_h.GstStructure); -- gst/interfaces/navigation.h:262
pragma Import (C, gst_navigation_send_event, "gst_navigation_send_event");
procedure gst_navigation_send_key_event
(navigation : System.Address;
event : Interfaces.C.Strings.chars_ptr;
key : Interfaces.C.Strings.chars_ptr); -- gst/interfaces/navigation.h:264
pragma Import (C, gst_navigation_send_key_event, "gst_navigation_send_key_event");
procedure gst_navigation_send_mouse_event
(navigation : System.Address;
event : Interfaces.C.Strings.chars_ptr;
button : int;
x : double;
y : double); -- gst/interfaces/navigation.h:266
pragma Import (C, gst_navigation_send_mouse_event, "gst_navigation_send_mouse_event");
procedure gst_navigation_send_command (navigation : System.Address; command : GstNavigationCommand); -- gst/interfaces/navigation.h:268
pragma Import (C, gst_navigation_send_command, "gst_navigation_send_command");
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_navigation_h;
|
sungyeon/drake | Ada | 699 | ads | pragma License (Unrestricted);
package Ada.Assertions is
pragma Pure;
Assertion_Error : exception
with Export, Convention => Ada, External_Name => "assertion_error";
-- modified
-- Assert reports the source location if it's called without a message.
-- procedure Assert (Check : Boolean);
-- procedure Assert (Check : Boolean; Message : String);
procedure Assert (
Check : Boolean;
Message : String := Debug.Source_Location);
-- extended
procedure Raise_Assertion_Error (
Message : String := Debug.Source_Location);
pragma No_Return (Raise_Assertion_Error);
-- Note: Raise_Assertion_Error is called by pragma Assert.
end Ada.Assertions;
|
tum-ei-rcs/StratoX | Ada | 8,784 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . B B . T I M E --
-- --
-- S p e c --
-- --
-- Copyright (C) 1999-2002 Universidad Politecnica de Madrid --
-- Copyright (C) 2003-2004 The European Space Agency --
-- Copyright (C) 2003-2016, AdaCore --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNARL 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. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
-- The port of GNARL to bare board targets was initially developed by the --
-- Real-Time Systems Group at the Technical University of Madrid. --
-- --
------------------------------------------------------------------------------
-- Package in charge of implementing clock and timer functionalities
pragma Restrictions (No_Elaboration_Code);
with System.Multiprocessors;
package System.BB.Time is
pragma Preelaborate;
type Time is mod 2 ** 64;
for Time'Size use 64;
------------------
-- Time keeping --
------------------
-- Time is represented at this level as a 64-bit unsigned number. We assume
-- that the Board_Support.Read_Clock function provides access to a hardware
-- clock with a resolution of 20 microseconds or better, counting from
-- 0 to Board_Support.Max_Timer_Interval over a period of at least 0.735
-- seconds, and returning a value of the 32-bit Timer_Interval type. The
-- clock resolution should be an integral number of nanoseconds between 1
-- and 20_000.
-- In addition, Board_Support provides an alarm facility, generating an
-- alarm interrupt at up to Max_Timer_Interval clock ticks in the future.
-- The clock frequency is the same as for Read_Clock, but it may or may not
-- use the same timer. See the next section for more information.
-- The Time package uses these facilities to keep a 64-bit clock that will
-- allow a program to keep track of up to 50 years in the future without
-- having the most significant bit set. This means it is always safe to
-- subtract two Clock readings to determine a Time_Span without overflow.
-- We need to support a clock running for 50 years, so this requires
-- a hardware clock period of at least 1_577_880_000 / 2**31 or 0.735
-- seconds. As comparison, a LEON2 at 80 MHz with 24-bit clock and the
-- minimum prescale factor of 4, has a period of 2**24 / (80E6 / 4) = 0.839
-- seconds, while a 200 MHz LEON3 has a period of 2**32 / (200E6 / 5) =
-- 107 seconds. For faster clocks or smaller clock width, higher prescaler
-- values may be needed to achieve 50 year run time. The prescale factor
-- should be chosen such that the period between clock ticks is an integral
-- number of nanoseconds between 1 and 20_000.
type Time_Span is range -2 ** 63 .. 2 ** 63 - 1;
for Time_Span'Size use 64;
-- Time_Span represents the length of time intervals, and it is defined as
-- a 64-bit signed integer.
------------
-- Alarms --
------------
-- Alarms are used for two purposes:
-- * Waking up tasks that sleep as result of Delay_Until
-- * Clock updates, to prevent undetected wrap-around of the
-- hardware clock
-- Alarms use the same time unit as the clock used for time keeping,
-- and need to be able to provide an alarm up to slightly less than
-- Max_Timer_Interval ticks in the future; there always will be a pending
-- alarm within this time frame because of required clock updates. A
-- requirement is that an alarm always can be handled within 1/8th of the
-- time it takes the hardware clock to wrap around. This gives an upper
-- bound to how early we have to set the alarm to ensure timely clock
-- updates. This will result in an interrupt rate 14% higher than
-- absolutely necessary. However, as long as sleep-related alarms are
-- sufficiently frequent, no extra clock-related interrupts are necessary.
--------------------
-- Execution time --
--------------------
-- System.BB.Execution_Time will set these hooks to enable execution time
-- computation only when needed.
Scheduling_Event_Hook : access procedure := null;
-- This hooks must be called when the charged account change: in case of
-- rescheduling and before and after the handling of interrupt.
--------------------
-- Initialization --
--------------------
procedure Initialize_Timers;
-- Initialize this package (clock and alarm handlers). Must be called
-- before any other functions.
----------------
-- Operations --
----------------
function Epoch return Time;
-- Get the reference startup time
function Clock return Time;
-- Get the number of ticks elapsed since startup
procedure Delay_Until (T : Time);
-- Suspend the calling thread until the absolute time specified by T
function Get_Next_Timeout (CPU_Id : System.Multiprocessors.CPU) return Time;
-- Get the date of the next alarm or timing event
procedure Update_Alarm (Alarm : Time);
-- Re-configure the timer if "Alarm" is earlier than the Pending_Alarm.
-- Update_Alarm is the only routine allowed to set an alarm.
-- Execution time
-- Ada allows reading the execution time of any task. To support that, we
-- need to have exclusive access to the time (which is costly as it is not
-- possible to atomically read that value without using a spin lock and
-- masking interrupts). To avoid that cost, let's split that type in two
-- parts (that can be read or written atomically by the processor). It
-- is not possible to read atomically the whole value, but it is possible
-- to read a coherent value: if the time has been changed from A to B
-- while being read, the value read is between A and B. Because of the
-- architecture of the runtime, the execution time is always written
-- atomically (written by the processor executing the task, within the
-- kernel).
-- The type Composite_Execution_Time is declared here so that s-bbthre
-- doesn't depend on s-bbtiev. But this type is used by s-bbtiev.
type Word is mod 2 ** 32;
type Composite_Execution_Time is record
High : Word;
pragma Atomic (High);
-- High part of execution time
Low : Word;
pragma Atomic (Low);
-- Low part of execution time
end record;
Initial_Composite_Execution_Time : constant Composite_Execution_Time :=
(0, 0);
-- The initial value for Composite_Execution_Time
private
pragma Inline (Clock);
pragma Inline (Epoch);
end System.BB.Time;
|
AdaCore/libadalang | Ada | 247 | adb | procedure Test is
package Set is
type T is record
X : Integer;
end record;
end Set;
type Rec is record
Set : access Set.T;
end record;
X : Rec;
begin
X.Set.X := 2;
pragma Test_Statement;
end Test;
|
bkold/RISC-CPU-Assembler | Ada | 2,041 | adb | package body Improved_Trie is
function Find_Move_Immediate_Child (Parent : in out Cursor; Element : Element_Type) return Boolean is
Tree_Leaf : Trie.Cursor;
begin
Tree_Leaf := Trie.First_Child(Parent);
while Trie.Has_Element(Tree_Leaf) loop
if Trie.Element(Tree_Leaf) = Element then
Parent:=Tree_Leaf;
return True;
else
Trie.Next_Sibling(Tree_Leaf);
end if;
end loop;
return False;
end Find_Move_Immediate_Child;
function Find_Immediate_Child (Parent : Cursor; Element : Element_Type) return Cursor is
Tree_Leaf : Cursor;
begin
Tree_Leaf := First_Child(Parent);
while Has_Element(Tree_Leaf) loop
if Trie.Element(Tree_Leaf) = Element then
return Tree_Leaf;
else
Next_Sibling(Tree_Leaf);
end if;
end loop;
return No_Element;
end Find_Immediate_Child;
function Add_String (T : in out Tree; Input : String; Address : Integer) return Boolean is
Tree_Leaf : Cursor := T.Root;
Test_Element : Element_Type;
begin
Test_Element.B := -1;
--Ada.Text_IO.Put_Line("----");
for I in Input'First..Input'Last loop
Test_Element.A := Input(I);
--Ada.Text_IO.Put_Line(Character'Image(Test_Element.A));
if Find_Move_Immediate_Child(Tree_Leaf, Test_Element) = False then
--Ada.Text_IO.Put_Line("Appending " & Character'Image(Test_Element.A));
Append_Child(T, Tree_Leaf, Test_Element);
Tree_Leaf := Last_Child(Tree_Leaf);
end if;
end loop;
Test_Element.A := Input(Input'Last);
Test_Element.B := Address;
if Element(Tree_Leaf).B > -1 then
return False; --Duplicate string
end if;
Replace_Element(T, Tree_Leaf, Test_Element);
return True;
end Add_String;
function Find_String (T : Tree; Input : String) return Integer is
Tree_Leaf : Cursor := T.Root;
Test_Element : Element_Type;
begin
for I in 1..Input'Length loop
Test_Element.A := Input(I);
if Find_Move_Immediate_Child(Tree_Leaf, Test_Element) = False then
return -1;
end if;
end loop;
return Element(Tree_Leaf).B;
end Find_String;
end Improved_Trie; |
AdaDoom3/wayland_ada_binding | Ada | 1,965 | ads | with Aida;
with Ada.Containers;
with Aida.Subprogram_Call_Result;
with System.Storage_Pools.Subpools;
use all type Ada.Containers.Count_Type;
package Aida.Deepend_XML_SAX_Parser is
type SAX_Parser_T is tagged limited null record;
procedure Start_Tag (This : in out SAX_Parser_T;
Tag_Name : in Standard.String;
Call_Result : in out Subprogram_Call_Result.T) is null;
procedure End_Tag (This : in out SAX_Parser_T;
Tag_Name : in Standard.String;
Call_Result : in out Subprogram_Call_Result.T) is null;
-- It is the responsibility of the implementor of End_Tag to verify
-- that the tag name corresponds to the expected tag name.
procedure Text (This : in out SAX_Parser_T;
Value : in Standard.String;
Call_Result : in out Subprogram_Call_Result.T) is null;
procedure Attribute (This : in out SAX_Parser_T;
Attribute_Name : in Standard.String;
Attribute_Value : in Standard.String;
Call_Result : in out Subprogram_Call_Result.T) is null;
procedure Comment (This : in out SAX_Parser_T;
Value : in Standard.String;
Call_Result : in out Subprogram_Call_Result.T) is null;
procedure CDATA (This : in out SAX_Parser_T;
Value : in Standard.String;
Call_Result : in out Subprogram_Call_Result.T) is null;
procedure Parse (This : in out SAX_Parser_T;
Contents : in Standard.String;
Call_Result : in out Subprogram_Call_Result.T) with
Global => null,
Pre => not Call_Result.Has_Failed and Contents'Length > 0 and Contents'Last < Integer'Last - 4;
end Aida.Deepend_XML_SAX_Parser;
|
onox/orka | Ada | 2,091 | 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 System.Multiprocessors;
with Orka.Jobs.Executors;
with Orka.Jobs.Queues;
with Orka.Jobs.Workers;
generic
Maximum_Queued_Jobs : Positive;
-- Maximum number of jobs that can be enqueued
--
-- Should be no less than the largest width (number of jobs at a
-- particular level) of any job graph.
Maximum_Job_Graphs : Positive;
-- Maximum number of separate job graphs
--
-- For each job graph, a Future object is acquired. The number of
-- concurrent acquired objects is bounded by this number.
package Orka.Jobs.System is
package Queues is new Jobs.Queues
(Maximum_Graphs => Maximum_Job_Graphs,
Capacity => Maximum_Queued_Jobs);
Queue : aliased Queues.Queue;
Number_Of_Workers : constant Standard.System.Multiprocessors.CPU;
procedure Execute_GPU_Jobs;
-- Dequeue and execute GPU jobs in the calling task
procedure Shutdown;
private
package SM renames Standard.System.Multiprocessors;
use type SM.CPU;
Number_Of_Workers : constant SM.CPU := SM.Number_Of_CPUs - 1;
-- For n logical CPU's we spawn n - 1 workers (1 CPU is dedicated
-- to rendering)
package Executors is new Jobs.Executors
(Queues, Maximum_Enqueued_By_Job => Maximum_Queued_Jobs);
package Workers is new Jobs.Workers
(Executors, Queue'Access, "Worker", Number_Of_Workers);
procedure Shutdown renames Workers.Shutdown;
end Orka.Jobs.System;
|
faelys/natools | Ada | 3,672 | adb | ------------------------------------------------------------------------------
-- Copyright (c) 2014, Natacha Porté --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
with Natools.S_Expressions.Parsers;
with Natools.S_Expressions.Templates.Generic_Discrete_Render;
with Natools.S_Expressions.Templates.Tests.Integers;
with Natools.S_Expressions.Templates.Tests.Dates;
with Natools.S_Expressions.Test_Tools;
package body Natools.S_Expressions.Templates.Tests is
type Day_Name is (Monday, Tuesday, Wednesday, Thursday,
Friday, Saturday, Sunday);
procedure Day_Render is new Generic_Discrete_Render (Day_Name);
-------------------------
-- Complete Test Suite --
-------------------------
procedure All_Tests (Report : in out NT.Reporter'Class) is
begin
Test_Date (Report);
Test_Discrete (Report);
Test_Integers (Report);
end All_Tests;
--------------------------------------
-- Inidividual Children Test Suites --
--------------------------------------
procedure Test_Date (Report : in out NT.Reporter'Class) is
begin
Report.Section ("Date templates");
Natools.S_Expressions.Templates.Tests.Dates.All_Tests (Report);
Report.End_Section;
end Test_Date;
procedure Test_Discrete (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Discrete templates");
procedure Render_Test
(Template : in String;
Value : in Day_Name;
Expected : in String);
procedure Render_Test
(Template : in String;
Value : in Day_Name;
Expected : in String)
is
Input : aliased Test_Tools.Memory_Stream;
Output : Test_Tools.Memory_Stream;
Parser : Parsers.Stream_Parser (Input'Access);
begin
Input.Set_Data (To_Atom (Template));
Test_Tools.Next_And_Check (Test, Parser, Events.Open_List, 1);
Parser.Next;
Output.Set_Expected (To_Atom (Expected));
Day_Render (Output, Parser, Value);
Output.Check_Stream (Test);
end Render_Test;
begin
Render_Test ("(a b)", Friday, "FRIDAY");
Render_Test ("(a b)", Monday, "a");
Render_Test ("(a b)", Tuesday, "b");
Render_Test ("(a b (c))", Friday, "c");
exception
when Error : others => Test.Report_Exception (Error);
end Test_Discrete;
procedure Test_Integers (Report : in out NT.Reporter'Class) is
begin
Report.Section ("Integer templates");
Natools.S_Expressions.Templates.Tests.Integers.All_Tests (Report);
Report.End_Section;
end Test_Integers;
end Natools.S_Expressions.Templates.Tests;
|
charlie5/cBound | Ada | 1,693 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_glx_are_textures_resident_request_t is
-- Item
--
type Item is record
major_opcode : aliased Interfaces.Unsigned_8;
minor_opcode : aliased Interfaces.Unsigned_8;
length : aliased Interfaces.Unsigned_16;
context_tag : aliased xcb.xcb_glx_context_tag_t;
n : aliased Interfaces.Integer_32;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb
.xcb_glx_are_textures_resident_request_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_are_textures_resident_request_t.Item,
Element_Array => xcb.xcb_glx_are_textures_resident_request_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb
.xcb_glx_are_textures_resident_request_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_are_textures_resident_request_t.Pointer,
Element_Array =>
xcb.xcb_glx_are_textures_resident_request_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_glx_are_textures_resident_request_t;
|
optikos/oasis | Ada | 5,064 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Elements.Identifiers;
with Program.Elements.Variants;
with Program.Elements.Variant_Parts;
with Program.Element_Visitors;
package Program.Nodes.Variant_Parts is
pragma Preelaborate;
type Variant_Part is
new Program.Nodes.Node and Program.Elements.Variant_Parts.Variant_Part
and Program.Elements.Variant_Parts.Variant_Part_Text
with private;
function Create
(Case_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Discriminant : not null Program.Elements.Identifiers.Identifier_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Variants : not null Program.Elements.Variants
.Variant_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Case_Token_2 : not null Program.Lexical_Elements
.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Variant_Part;
type Implicit_Variant_Part is
new Program.Nodes.Node and Program.Elements.Variant_Parts.Variant_Part
with private;
function Create
(Discriminant : not null Program.Elements.Identifiers
.Identifier_Access;
Variants : not null Program.Elements.Variants
.Variant_Vector_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Variant_Part
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Variant_Part is
abstract new Program.Nodes.Node
and Program.Elements.Variant_Parts.Variant_Part
with record
Discriminant : not null Program.Elements.Identifiers.Identifier_Access;
Variants : not null Program.Elements.Variants
.Variant_Vector_Access;
end record;
procedure Initialize (Self : aliased in out Base_Variant_Part'Class);
overriding procedure Visit
(Self : not null access Base_Variant_Part;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Discriminant
(Self : Base_Variant_Part)
return not null Program.Elements.Identifiers.Identifier_Access;
overriding function Variants
(Self : Base_Variant_Part)
return not null Program.Elements.Variants.Variant_Vector_Access;
overriding function Is_Variant_Part_Element
(Self : Base_Variant_Part)
return Boolean;
overriding function Is_Definition_Element
(Self : Base_Variant_Part)
return Boolean;
type Variant_Part is
new Base_Variant_Part and Program.Elements.Variant_Parts.Variant_Part_Text
with record
Case_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Case_Token_2 : not null Program.Lexical_Elements
.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Variant_Part_Text
(Self : aliased in out Variant_Part)
return Program.Elements.Variant_Parts.Variant_Part_Text_Access;
overriding function Case_Token
(Self : Variant_Part)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Is_Token
(Self : Variant_Part)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function End_Token
(Self : Variant_Part)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Case_Token_2
(Self : Variant_Part)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Semicolon_Token
(Self : Variant_Part)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Variant_Part is
new Base_Variant_Part
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Variant_Part_Text
(Self : aliased in out Implicit_Variant_Part)
return Program.Elements.Variant_Parts.Variant_Part_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Variant_Part)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Variant_Part)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Variant_Part)
return Boolean;
end Program.Nodes.Variant_Parts;
|
onox/orka | Ada | 2,552 | 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.AVX.Longs;
package body Orka.SIMD.AVX2.Integers.Shift is
use SIMD.AVX.Longs;
type All_Bits_Count is new Integer range 0 .. 128;
function Shift_All_Bits_Left_Zeros
(Elements : m256l; Bits : All_Bits_Count) return m256l
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_pslldqi256";
-- Shift each bit to the left by the given amount of bits, shifting in zeros
function Shift_All_Bits_Right_Zeros
(Elements : m256l; Bits : All_Bits_Count) return m256l
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_psrldqi256";
-- Shift each bit to the right by the given amount of bits, shifting in zeros
----------------------------------------------------------------------------
function Convert is new Ada.Unchecked_Conversion (m256i, m256l);
function Convert is new Ada.Unchecked_Conversion (m256l, m256i);
function Shift_Elements_Left_Zeros (Elements : m256i) return m256i is
-- Shifts are done per 128-bit lane, so save 4 and store it afterwards in 5
Last_Element_First_Lane : constant Integer_32 := Elements (4);
begin
return Result : m256i :=
Convert (Shift_All_Bits_Left_Zeros (Convert (Elements), Integer_32'Size))
do
Result (5) := Last_Element_First_Lane;
end return;
end Shift_Elements_Left_Zeros;
function Shift_Elements_Right_Zeros (Elements : m256i) return m256i is
-- Shifts are done per 128-bit lane, so save 5 and store it afterwards in 4
First_Element_Last_Lane : constant Integer_32 := Elements (5);
begin
return Result : m256i :=
Convert (Shift_All_Bits_Right_Zeros (Convert (Elements), Integer_32'Size))
do
Result (4) := First_Element_Last_Lane;
end return;
end Shift_Elements_Right_Zeros;
end Orka.SIMD.AVX2.Integers.Shift;
|
onox/sdlada | Ada | 2,199 | adb | --------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2018 Luke A. Guest
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
with Interfaces.C;
package body SDL.Events.Joysticks is
package C renames Interfaces.C;
use type C.int;
Query : constant C.int := -1;
Ignore : constant C.int := 0;
Enable : constant C.int := 1;
function SDL_Joystick_Event_State (State : in C.int) return C.int with
Import => True,
Convention => C,
External_Name => "SDL_JoystickEventState";
procedure SDL_Joystick_Event_State (State : in C.int) with
Import => True,
Convention => C,
External_Name => "SDL_JoystickEventState";
function Is_Polling_Enabled return Boolean is
Result : C.int := SDL_Joystick_Event_State (Query);
begin
if Result = Enable then
return True;
end if;
return False;
end Is_Polling_Enabled;
procedure Enable_Polling is
begin
SDL_Joystick_Event_State (Enable);
end Enable_Polling;
procedure Disable_Polling is
begin
SDL_Joystick_Event_State (Ignore);
end Disable_Polling;
end SDL.Events.Joysticks;
|
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_Parent_Style_Name_Attributes;
package Matreshka.ODF_Style.Parent_Style_Name_Attributes is
type Style_Parent_Style_Name_Attribute_Node is
new Matreshka.ODF_Style.Abstract_Style_Attribute_Node
and ODF.DOM.Style_Parent_Style_Name_Attributes.ODF_Style_Parent_Style_Name_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Style_Parent_Style_Name_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Style_Parent_Style_Name_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Style.Parent_Style_Name_Attributes;
|
reznikmm/matreshka | Ada | 3,739 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Draw_Auto_Grow_Width_Attributes is
pragma Preelaborate;
type ODF_Draw_Auto_Grow_Width_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Draw_Auto_Grow_Width_Attribute_Access is
access all ODF_Draw_Auto_Grow_Width_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Draw_Auto_Grow_Width_Attributes;
|
stcarrez/ada-el | Ada | 2,935 | ads | -----------------------------------------------------------------------
-- Action_Bean - Simple bean with methods that can be called from EL
-- Copyright (C) 2010, 2022 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with EL.Objects;
with Util.Beans.Basic;
with Util.Beans.Methods;
with EL.Methods.Proc_1;
with EL.Methods.Proc_2;
with Test_Bean;
with Ada.Unchecked_Deallocation;
package Action_Bean is
type Action is new Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with record
Person : Test_Bean.Person;
Count : Natural;
end record;
type Action_Access is access all Action'Class;
-- Get the value identified by the name.
overriding
function Get_Value (From : Action; Name : String) return EL.Objects.Object;
-- Set the value identified by the name.
overriding
procedure Set_Value (From : in out Action;
Name : in String;
Value : in EL.Objects.Object);
-- Get the EL method bindings exposed by the Action type.
overriding
function Get_Method_Bindings (From : in Action)
return Util.Beans.Methods.Method_Binding_Array_Access;
-- Action with one parameter.
-- Sets the person.
procedure Notify (Target : in out Action;
Param : in out Test_Bean.Person);
-- Action with two parameters.
-- Sets the person object and the counter.
procedure Notify (Target : in out Action;
Param : in Test_Bean.Person;
Count : in Natural);
-- Action with one parameter
procedure Print (Target : in out Action;
Param : in out Test_Bean.Person);
-- Package to invoke an EL method with one <b>Person</b> as parameter.
package Proc_Action is new EL.Methods.Proc_1 (Param1_Type => Test_Bean.Person);
-- Package to invoke an EL method with <b>Person</b> as parameter and a <b>Natural</b>.
package Proc2_Action is
new EL.Methods.Proc_2 (Param1_Type => Test_Bean.Person,
Param2_Type => Natural);
procedure Free is new Ada.Unchecked_Deallocation (Object => Action'Class,
Name => Action_Access);
end Action_Bean;
|
ZinebZaad/ENSEEIHT | Ada | 3,384 | adb | with Ada.Text_IO;
use Ada.Text_IO;
procedure Specifier_Et_Tester is
-- La valeur absolue d'un nombre entier.
function Valeur_Absolue (N : in Integer) return Integer with
Post => Valeur_Absolue'Result >= 0
and (Valeur_Absolue'Result = N or Valeur_Absolue'Result = -N)
is
begin
if N >= 0 then
return N;
else
return - N;
end if;
end Valeur_Absolue;
-- Incrémenter un entier N. Les entiers étant bornés, il ne faut pas que
-- l'entier soit le dernier Integer'LAST. Après exécution de Incrémenter,
-- l'entier passé en paramètre a sa valeur augmentée de 1.
procedure Incrementer (N : in out Integer) with
Pre => N /= Integer'LAST,
Post => N = N'Old + 1 -- N incrémenté
-- Quand la post condition est fausse: SYSTEM.ASSERTIONS.ASSERT_FAILURE : failed postcondition
-- Post => N = N'Old * 2
is
begin
N := N + 1;
end Incrementer;
-- Calculer le quotient et le reste de deux nombres entiers, Dividende et
-- Diviseur. Les deux doivent être positif et Diviseur doit être non nul.
-- Quotient et Reste sont tels que Dividende = Quotient * Diviseur + Reste
-- avec Reste compris entre 0 et Diviseur - 1.
procedure Calculer_DivMod (Dividende, Diviseur : in Integer ; Quotient, Reste: out Integer) with
Pre => Dividende >= 0 and Diviseur > 0,
Post => Dividende = Quotient * Diviseur + Reste
and 0 <= Reste and Reste < Diviseur
is
Le_Quotient: Integer;
Le_Reste: Integer;
begin
-- Principe : Le reste étant initialisé avec le dividende, le quotient
-- est le nombre de fois que l'on peut lui retrancher Diviseur.
Le_Quotient := 0;
Le_Reste := Dividende;
while Le_Reste >= Diviseur loop --! Originalement c'était > seulement ce qui posait un problème.
-- Variant : Le_Reste
-- Invariant : Dividende = Le_Quotient * Diviseur + Le_Reste;
Le_Quotient := Le_Quotient + 1;
Le_Reste := Le_Reste - Diviseur;
end loop;
Quotient := Le_Quotient;
Reste := Le_Reste;
--! Quotient et Reste ne doivent être affectés qu'une seule fois car en out
--! Il est conseillé de le faire à la fin au cas où une exception se produirait
end Calculer_DivMod;
procedure Tester_Valeur_Absolue is
begin
pragma Assert (Valeur_Absolue (5) = 5); -- Cas entier positif
pragma Assert (Valeur_Absolue (-7) = 7); -- Cas entier négatif
pragma Assert (Valeur_Absolue (0) = 0); -- Cas entier nul
end Tester_Valeur_Absolue;
procedure Tester_Incrementer is
Un_Nombre: Integer;
begin
-- un premier test
Un_Nombre := 1;
Incrementer (Un_Nombre);
pragma Assert (Un_Nombre = 2);
-- un deuxième test
Un_Nombre := 5;
Incrementer (Un_Nombre);
pragma Assert (Un_Nombre = 6);
end Tester_Incrementer;
procedure Tester_Calculer_DivMod is
Q, R: Integer;
begin
-- Cas Dividende > Diviseur
Calculer_DivMod(13, 3, Q, R);
pragma Assert (Q = 4);
pragma Assert (R = 1);
-- Cas Dividende < Diviseur
Calculer_DivMod(7, 19, Q, R);
pragma Assert (Q = 0);
pragma Assert (R = 7);
-- Cas où la précondition est non verifiée
-- Donne l'exception 'SYSTEM.ASSERTIONS.ASSERT_FAILURE' : failed precondition
-- Calculer_DivMod(-9, 0, Q, R);
Calculer_DivMod(17, 17, Q, R);
end Tester_Calculer_DivMod;
begin
Tester_Valeur_Absolue;
Tester_Incrementer;
Tester_Calculer_DivMod;
Put_Line ("Fin");
end Specifier_Et_Tester;
|
onox/orka | Ada | 2,785 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2020 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package body Orka.Timers is
function Create_Timer return Timer is
begin
return Timer'(others => <>);
end Create_Timer;
function Get_Duration (Value : Unsigned_64) return Duration is
Seconds : constant Unsigned_64 := Value / 1e9;
Nanoseconds : constant Unsigned_64 := Value - Seconds * 1e9;
begin
return Duration (Seconds) + Duration (Nanoseconds) / 1e9;
end Get_Duration;
procedure Record_GPU_Duration (Object : in out Timer) is
begin
declare
Stop_Time : constant Unsigned_64 := Object.Query_Stop.Result;
Start_Time : constant Unsigned_64 := Object.Query_Start.Result;
begin
if Stop_Time > Start_Time then
Object.GPU_Duration := Get_Duration (Stop_Time - Start_Time);
end if;
end;
end Record_GPU_Duration;
procedure Start (Object : in out Timer) is
use GL.Objects.Queries;
begin
if Object.State = Waiting and then Object.Query_Stop.Result_Available then
Object.Record_GPU_Duration;
Object.State := Idle;
end if;
if Object.State = Idle then
Object.CPU_Start := Get_Current_Time;
Object.Query_Start.Record_Current_Time;
Object.State := Busy;
end if;
end Start;
procedure Stop (Object : in out Timer) is
use GL.Objects.Queries;
begin
if Object.State = Busy then
declare
Current_Time : constant Integer_64 := Get_Current_Time;
begin
if Current_Time > Object.CPU_Start then
Object.CPU_Duration := Get_Duration (Unsigned_64 (Current_Time - Object.CPU_Start));
end if;
end;
Object.Query_Stop.Record_Current_Time;
Object.State := Waiting;
end if;
end Stop;
procedure Wait_For_Result (Object : in out Timer) is
begin
Object.Record_GPU_Duration;
Object.State := Idle;
end Wait_For_Result;
function CPU_Duration (Object : Timer) return Duration is (Object.CPU_Duration);
function GPU_Duration (Object : Timer) return Duration is (Object.GPU_Duration);
end Orka.Timers;
|
reznikmm/slimp | Ada | 699 | adb | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Slim.Menu_Commands.Play_File_Commands is
---------
-- Run --
---------
overriding procedure Run (Self : Play_File_Command) is
Value : Slim.Players.Song_Array (1 .. Self.Title_List.Length);
begin
for J in Value'Range loop
Value (J) := (Self.Relative_Path_List (J), Self.Title_List (J));
end loop;
Self.Player.Play_Files
(Self.Root, Self.M3U_Name, Value, Self.Start, Skip => Self.Skip);
end Run;
end Slim.Menu_Commands.Play_File_Commands;
|
AdaCore/libadalang | Ada | 38 | ads | procedure Foo;
--% node.p_body_part()
|
tum-ei-rcs/StratoX | Ada | 6,709 | ads | --
-- Copyright (C) 2016, AdaCore
--
-- This spec has been automatically generated from STM32F429x.svd
pragma Ada_2012;
with Interfaces.Bit_Types;
with System;
package Interfaces.STM32.PWR
with SPARK_Mode => On is
pragma Preelaborate;
pragma No_Elaboration_Code_All;
---------------
-- Registers --
---------------
-----------------
-- CR_Register --
-----------------
subtype CR_LPDS_Field is Interfaces.Bit_Types.Bit;
subtype CR_PDDS_Field is Interfaces.Bit_Types.Bit;
subtype CR_CWUF_Field is Interfaces.Bit_Types.Bit;
subtype CR_CSBF_Field is Interfaces.Bit_Types.Bit;
subtype CR_PVDE_Field is Interfaces.Bit_Types.Bit;
subtype CR_PLS_Field is Interfaces.Bit_Types.UInt3;
subtype CR_DBP_Field is Interfaces.Bit_Types.Bit;
subtype CR_FPDS_Field is Interfaces.Bit_Types.Bit;
subtype CR_LPLVDS_Field is Interfaces.Bit_Types.Bit;
subtype CR_MRLVDS_Field is Interfaces.Bit_Types.Bit;
subtype CR_ADCDC1_Field is Interfaces.Bit_Types.Bit;
subtype CR_VOS_Field is Interfaces.Bit_Types.UInt2;
subtype CR_ODEN_Field is Interfaces.Bit_Types.Bit;
subtype CR_ODSWEN_Field is Interfaces.Bit_Types.Bit;
subtype CR_UDEN_Field is Interfaces.Bit_Types.UInt2;
-- power control register
type CR_Register is record
-- Low-power deep sleep
LPDS : CR_LPDS_Field := 16#0#;
-- Power down deepsleep
PDDS : CR_PDDS_Field := 16#0#;
-- Clear wakeup flag
CWUF : CR_CWUF_Field := 16#0#;
-- Clear standby flag
CSBF : CR_CSBF_Field := 16#0#;
-- Power voltage detector enable
PVDE : CR_PVDE_Field := 16#0#;
-- PVD level selection
PLS : CR_PLS_Field := 16#0#;
-- Disable backup domain write protection
DBP : CR_DBP_Field := 16#0#;
-- Flash power down in Stop mode
FPDS : CR_FPDS_Field := 16#0#;
-- Low-Power Regulator Low Voltage in deepsleep
LPLVDS : CR_LPLVDS_Field := 16#0#;
-- Main regulator low voltage in deepsleep mode
MRLVDS : CR_MRLVDS_Field := 16#0#;
-- unspecified
Reserved_12_12 : Interfaces.Bit_Types.Bit := 16#0#;
-- ADCDC1
ADCDC1 : CR_ADCDC1_Field := 16#0#;
-- Regulator voltage scaling output selection
VOS : CR_VOS_Field := 16#3#;
-- Over-drive enable
ODEN : CR_ODEN_Field := 16#0#;
-- Over-drive switching enabled
ODSWEN : CR_ODSWEN_Field := 16#0#;
-- Under-drive enable in stop mode
UDEN : CR_UDEN_Field := 16#0#;
-- unspecified
Reserved_20_31 : Interfaces.Bit_Types.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
LPDS at 0 range 0 .. 0;
PDDS at 0 range 1 .. 1;
CWUF at 0 range 2 .. 2;
CSBF at 0 range 3 .. 3;
PVDE at 0 range 4 .. 4;
PLS at 0 range 5 .. 7;
DBP at 0 range 8 .. 8;
FPDS at 0 range 9 .. 9;
LPLVDS at 0 range 10 .. 10;
MRLVDS at 0 range 11 .. 11;
Reserved_12_12 at 0 range 12 .. 12;
ADCDC1 at 0 range 13 .. 13;
VOS at 0 range 14 .. 15;
ODEN at 0 range 16 .. 16;
ODSWEN at 0 range 17 .. 17;
UDEN at 0 range 18 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
------------------
-- CSR_Register --
------------------
subtype CSR_WUF_Field is Interfaces.Bit_Types.Bit;
subtype CSR_SBF_Field is Interfaces.Bit_Types.Bit;
subtype CSR_PVDO_Field is Interfaces.Bit_Types.Bit;
subtype CSR_BRR_Field is Interfaces.Bit_Types.Bit;
subtype CSR_EWUP_Field is Interfaces.Bit_Types.Bit;
subtype CSR_BRE_Field is Interfaces.Bit_Types.Bit;
subtype CSR_VOSRDY_Field is Interfaces.Bit_Types.Bit;
subtype CSR_ODRDY_Field is Interfaces.Bit_Types.Bit;
subtype CSR_ODSWRDY_Field is Interfaces.Bit_Types.Bit;
subtype CSR_UDRDY_Field is Interfaces.Bit_Types.UInt2;
-- power control/status register
type CSR_Register is record
-- Read-only. Wakeup flag
WUF : CSR_WUF_Field := 16#0#;
-- Read-only. Standby flag
SBF : CSR_SBF_Field := 16#0#;
-- Read-only. PVD output
PVDO : CSR_PVDO_Field := 16#0#;
-- Read-only. Backup regulator ready
BRR : CSR_BRR_Field := 16#0#;
-- unspecified
Reserved_4_7 : Interfaces.Bit_Types.UInt4 := 16#0#;
-- Enable WKUP pin
EWUP : CSR_EWUP_Field := 16#0#;
-- Backup regulator enable
BRE : CSR_BRE_Field := 16#0#;
-- unspecified
Reserved_10_13 : Interfaces.Bit_Types.UInt4 := 16#0#;
-- Regulator voltage scaling output selection ready bit
VOSRDY : CSR_VOSRDY_Field := 16#0#;
-- unspecified
Reserved_15_15 : Interfaces.Bit_Types.Bit := 16#0#;
-- Read-only. Over-drive mode ready
ODRDY : CSR_ODRDY_Field := 16#0#;
-- Read-only. Over-drive mode switching ready
ODSWRDY : CSR_ODSWRDY_Field := 16#0#;
-- Under-drive ready flag
UDRDY : CSR_UDRDY_Field := 16#0#;
-- unspecified
Reserved_20_31 : Interfaces.Bit_Types.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CSR_Register use record
WUF at 0 range 0 .. 0;
SBF at 0 range 1 .. 1;
PVDO at 0 range 2 .. 2;
BRR at 0 range 3 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
EWUP at 0 range 8 .. 8;
BRE at 0 range 9 .. 9;
Reserved_10_13 at 0 range 10 .. 13;
VOSRDY at 0 range 14 .. 14;
Reserved_15_15 at 0 range 15 .. 15;
ODRDY at 0 range 16 .. 16;
ODSWRDY at 0 range 17 .. 17;
UDRDY at 0 range 18 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Power control
type PWR_Peripheral is record
-- power control register
CR : CR_Register;
-- power control/status register
CSR : CSR_Register;
end record
with Volatile;
for PWR_Peripheral use record
CR at 0 range 0 .. 31;
CSR at 4 range 0 .. 31;
end record;
-- Power control
PWR_Periph : aliased PWR_Peripheral
with Import, Address => PWR_Base;
end Interfaces.STM32.PWR;
|
zhmu/ananas | Ada | 7,079 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- A D A . I N T E R R U P T S . N A M E S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1991-2022, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
-- This is a GNU/Linux version of this package
-- The following signals are reserved by the run time:
-- SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGTRAP, SIGABRT, SIGINT,
-- SIGUSR1, SIGUSR2, SIGVTALRM, SIGUNUSED, SIGSTOP, SIGKILL
-- The pragma Unreserve_All_Interrupts affects the following signal(s):
-- SIGINT: made available for Ada handler
-- This target-dependent package spec contains names of interrupts
-- supported by the local system.
with System.OS_Interface;
package Ada.Interrupts.Names is
-- All identifiers in this unit are implementation defined
pragma Implementation_Defined;
-- Beware that the mapping of names to signals may be many-to-one. There
-- may be aliases. Also, for all signal names that are not supported on the
-- current system the value of the corresponding constant will be zero.
SIGHUP : constant Interrupt_ID :=
System.OS_Interface.SIGHUP; -- hangup
SIGINT : constant Interrupt_ID :=
System.OS_Interface.SIGINT; -- interrupt (rubout)
SIGQUIT : constant Interrupt_ID :=
System.OS_Interface.SIGQUIT; -- quit (ASCD FS)
SIGILL : constant Interrupt_ID :=
System.OS_Interface.SIGILL; -- illegal instruction (not reset)
SIGTRAP : constant Interrupt_ID :=
System.OS_Interface.SIGTRAP; -- trace trap (not reset)
SIGIOT : constant Interrupt_ID :=
System.OS_Interface.SIGIOT; -- IOT instruction
SIGABRT : constant Interrupt_ID := -- used by abort,
System.OS_Interface.SIGABRT; -- replace SIGIOT in the future
SIGFPE : constant Interrupt_ID :=
System.OS_Interface.SIGFPE; -- floating point exception
SIGKILL : constant Interrupt_ID :=
System.OS_Interface.SIGKILL; -- kill (cannot be caught or ignored)
SIGBUS : constant Interrupt_ID :=
System.OS_Interface.SIGBUS; -- bus error
SIGSEGV : constant Interrupt_ID :=
System.OS_Interface.SIGSEGV; -- segmentation violation
SIGPIPE : constant Interrupt_ID := -- write on a pipe with
System.OS_Interface.SIGPIPE; -- no one to read it
SIGALRM : constant Interrupt_ID :=
System.OS_Interface.SIGALRM; -- alarm clock
SIGTERM : constant Interrupt_ID :=
System.OS_Interface.SIGTERM; -- software termination signal from kill
SIGUSR1 : constant Interrupt_ID :=
System.OS_Interface.SIGUSR1; -- user defined signal 1
SIGUSR2 : constant Interrupt_ID :=
System.OS_Interface.SIGUSR2; -- user defined signal 2
SIGCLD : constant Interrupt_ID :=
System.OS_Interface.SIGCLD; -- child status change
SIGCHLD : constant Interrupt_ID :=
System.OS_Interface.SIGCHLD; -- 4.3BSD's/POSIX name for SIGCLD
SIGWINCH : constant Interrupt_ID :=
System.OS_Interface.SIGWINCH; -- window size change
SIGURG : constant Interrupt_ID :=
System.OS_Interface.SIGURG; -- urgent condition on IO channel
SIGPOLL : constant Interrupt_ID :=
System.OS_Interface.SIGPOLL; -- pollable event occurred
SIGIO : constant Interrupt_ID := -- input/output possible,
System.OS_Interface.SIGIO; -- SIGPOLL alias (Solaris)
SIGSTOP : constant Interrupt_ID :=
System.OS_Interface.SIGSTOP; -- stop (cannot be caught or ignored)
SIGTSTP : constant Interrupt_ID :=
System.OS_Interface.SIGTSTP; -- user stop requested from tty
SIGCONT : constant Interrupt_ID :=
System.OS_Interface.SIGCONT; -- stopped process has been continued
SIGTTIN : constant Interrupt_ID :=
System.OS_Interface.SIGTTIN; -- background tty read attempted
SIGTTOU : constant Interrupt_ID :=
System.OS_Interface.SIGTTOU; -- background tty write attempted
SIGVTALRM : constant Interrupt_ID :=
System.OS_Interface.SIGVTALRM; -- virtual timer expired
SIGPROF : constant Interrupt_ID :=
System.OS_Interface.SIGPROF; -- profiling timer expired
SIGXCPU : constant Interrupt_ID :=
System.OS_Interface.SIGXCPU; -- CPU time limit exceeded
SIGXFSZ : constant Interrupt_ID :=
System.OS_Interface.SIGXFSZ; -- filesize limit exceeded
SIGUNUSED : constant Interrupt_ID :=
System.OS_Interface.SIGUNUSED; -- unused signal
SIGSTKFLT : constant Interrupt_ID :=
System.OS_Interface.SIGSTKFLT; -- stack fault on coprocessor
SIGLOST : constant Interrupt_ID :=
System.OS_Interface.SIGLOST; -- Linux alias for SIGIO
SIGPWR : constant Interrupt_ID :=
System.OS_Interface.SIGPWR; -- Power failure
SIGSYS : constant Interrupt_ID :=
System.OS_Interface.SIGSYS; -- bad system call
end Ada.Interrupts.Names;
|
reznikmm/matreshka | Ada | 4,648 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Style.Flow_With_Text_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Style_Flow_With_Text_Attribute_Node is
begin
return Self : Style_Flow_With_Text_Attribute_Node do
Matreshka.ODF_Style.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Style_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Style_Flow_With_Text_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Flow_With_Text_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Style_URI,
Matreshka.ODF_String_Constants.Flow_With_Text_Attribute,
Style_Flow_With_Text_Attribute_Node'Tag);
end Matreshka.ODF_Style.Flow_With_Text_Attributes;
|
AdaCore/libadalang | Ada | 66 | adb | package body Pack is
package body Inner is separate;
end Pack;
|
dan76/Amass | Ada | 1,624 | ads | -- Copyright © by Jeff Foley 2017-2023. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
-- SPDX-License-Identifier: Apache-2.0
local json = require("json")
name = "IPdata"
type = "api"
function start()
set_rate_limit(1)
end
function check()
local c
local cfg = datasrc_config()
if (cfg ~= nil) then
c = cfg.credentials
end
if (c ~= nil and c.key ~= nil and c.key ~= "") then
return true
end
return false
end
function asn(ctx, addr, asn)
if (addr == "") then
return
end
local c
local cfg = datasrc_config()
if (cfg ~= nil) then
c = cfg.credentials
end
if (c == nil or c.key == nil or c.key == "") then
return
end
local resp, err = request(ctx, {['url']=build_url(addr, c.key)})
if (err ~= nil and err ~= "") then
log(ctx, "asn request to service failed: " .. err)
return
elseif (resp.status_code < 200 or resp.status_code >= 400) then
log(ctx, "asn request to service returned with status: " .. resp.status)
return
end
local d = json.decode(resp.body)
if (d == nil) then
log(ctx, "failed to decode the JSON response")
return
elseif (d.asn == nil or d.name == nil or d.route == nil) then
return
end
new_asn(ctx, {
['addr']=addr,
['asn']=tonumber(d.asn:gsub(3)),
['desc']=d.name,
['prefix']=d.route,
})
end
function build_url(addr, key)
return "https://api.ipdata.co/" .. addr .. "/asn?api-key=" .. key
end
|
zhmu/ananas | Ada | 580 | adb | -- { dg-do compile }
procedure Tagged_Prefix_Call is
package Defs is
type Database_Connection_Record is abstract tagged null record;
type Database_Connection is access all Database_Connection_Record'Class;
procedure Start_Transaction
(Self : not null access Database_Connection_Record'Class)
is null;
type DB_Connection (Elem : access Database_Connection)
is null record
with Implicit_Dereference => Elem;
end Defs;
use Defs;
DB : DB_Connection(null);
begin
DB.Start_Transaction;
end Tagged_Prefix_Call;
|
ytomino/gnat4drake | Ada | 495 | ads | pragma License (Unrestricted);
with Ada.Interrupts;
with C.signal;
package System.Interrupt_Management is
pragma Elaborate_Body;
subtype Interrupt_Mask is C.signal.sigset_t;
subtype Interrupt_ID is
C.signed_int range 0 .. C.signed_int (Ada.Interrupts.Interrupt_Id'Last);
type Interrupt_Set is array (Interrupt_ID) of Boolean;
-- Reserve : Interrupt_Set := (others => False);
function Reserve (Interrupt : Interrupt_ID) return Boolean;
end System.Interrupt_Management;
|
strenkml/EE368 | Ada | 526 | adb |
with Memory.Transform.Shift; use Memory.Transform.Shift;
with Parser.Transform_Parser;
separate (Parser)
procedure Parse_Shift(parser : in out Parser_Type;
result : out Memory_Pointer) is
package Shift_Parser is new Transform_Parser(
T_Type => Memory.Transform.Shift.Shift_Type,
T_Pointer => Memory.Transform.Shift.Shift_Pointer,
Create_Transform => Memory.Transform.Shift.Create_Shift
);
begin
Shift_Parser.Parse(parser, result);
end Parse_Shift;
|
Gabriel-Degret/adalib | Ada | 3,289 | ads | -- Standard Ada library specification
-- Copyright (c) 2003-2018 Maxim Reznik <[email protected]>
-- Copyright (c) 2004-2016 AXE Consultants
-- Copyright (c) 2004, 2005, 2006 Ada-Europe
-- Copyright (c) 2000 The MITRE Corporation, Inc.
-- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
-- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
---------------------------------------------------------------------------
package Ada.Strings.Maps is
pragma Pure (Maps);
-- Representation for a set of character values:
type Character_Set is private;
pragma Preelaborable_Initialization (Character_Set);
Null_Set : constant Character_Set;
type Character_Range is
record
Low : Character;
High : Character;
end record;
-- Represents Character range Low..High
type Character_Ranges is
array (Positive range <>) of Character_Range;
function To_Set
(Ranges : in Character_Ranges) return Character_Set;
function To_Set (Span : in Character_Range) return Character_Set;
function To_Ranges
(Set : in Character_Set) return Character_Ranges;
function "=" (Left, Right : in Character_Set) return Boolean;
function "not" (Right : in Character_Set) return Character_Set;
function "and" (Left, Right : in Character_Set) return Character_Set;
function "or" (Left, Right : in Character_Set) return Character_Set;
function "xor" (Left, Right : in Character_Set) return Character_Set;
function "-" (Left, Right : in Character_Set) return Character_Set;
function Is_In (Element : in Character;
Set : in Character_Set)
return Boolean;
function Is_Subset (Elements : in Character_Set;
Set : in Character_Set)
return Boolean;
function "<=" (Left : in Character_Set;
Right : in Character_Set)
return Boolean renames Is_Subset;
-- Alternative representation for a set of character values:
subtype Character_Sequence is String;
function To_Set
(Sequence : in Character_Sequence)return Character_Set;
function To_Set (Singleton : in Character) return Character_Set;
function To_Sequence
(Set : in Character_Set) return Character_Sequence;
-- Representation for a character to character mapping:
type Character_Mapping is private;
pragma Preelaborable_Initialization (Character_Mapping);
function Value (Map : in Character_Mapping;
Element : in Character)
return Character;
Identity : constant Character_Mapping;
function To_Mapping (From, To : in Character_Sequence)
return Character_Mapping;
function To_Domain (Map : in Character_Mapping)
return Character_Sequence;
function To_Range (Map : in Character_Mapping)
return Character_Sequence;
type Character_Mapping_Function is
access function (From : in Character) return Character;
private
pragma Import (Ada, Character_Set);
pragma Import (Ada, Null_Set);
pragma Import (Ada, Character_Mapping);
pragma Import (Ada, Identity);
end Ada.Strings.Maps;
|
vikasbidhuri1995/DW1000 | Ada | 4,412 | ads | -------------------------------------------------------------------------------
-- Copyright (c) 2016 Daniel King
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the "Software"),
-- to deal in the Software without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------------
with Interfaces;
package DW1000.Types
with SPARK_Mode => On
is
type Bits_1 is mod 2**1 with Size => 1;
type Bits_2 is mod 2**2 with Size => 2;
type Bits_3 is mod 2**3 with Size => 3;
type Bits_4 is mod 2**4 with Size => 4;
type Bits_5 is mod 2**5 with Size => 5;
type Bits_6 is mod 2**6 with Size => 6;
type Bits_7 is mod 2**7 with Size => 7;
subtype Bits_8 is Interfaces.Unsigned_8;
type Bits_9 is mod 2**9 with Size => 9;
type Bits_10 is mod 2**10 with Size => 10;
type Bits_11 is mod 2**11 with Size => 11;
type Bits_12 is mod 2**12 with Size => 12;
type Bits_13 is mod 2**13 with Size => 13;
type Bits_14 is mod 2**14 with Size => 14;
type Bits_15 is mod 2**15 with Size => 15;
subtype Bits_16 is Interfaces.Unsigned_16;
type Bits_17 is mod 2**17 with Size => 17;
type Bits_18 is mod 2**18 with Size => 18;
type Bits_19 is mod 2**19 with Size => 19;
type Bits_20 is mod 2**20 with Size => 20;
type Bits_21 is mod 2**21 with Size => 21;
type Bits_22 is mod 2**22 with Size => 22;
type Bits_23 is mod 2**23 with Size => 23;
type Bits_24 is mod 2**24 with Size => 24;
type Bits_25 is mod 2**25 with Size => 25;
type Bits_26 is mod 2**26 with Size => 26;
type Bits_27 is mod 2**27 with Size => 27;
type Bits_28 is mod 2**28 with Size => 28;
type Bits_29 is mod 2**29 with Size => 29;
type Bits_30 is mod 2**30 with Size => 30;
type Bits_31 is mod 2**31 with Size => 31;
subtype Bits_32 is Interfaces.Unsigned_32;
type Bits_33 is mod 2**33 with Size => 33;
type Bits_34 is mod 2**34 with Size => 34;
type Bits_35 is mod 2**35 with Size => 35;
type Bits_36 is mod 2**36 with Size => 36;
type Bits_37 is mod 2**37 with Size => 37;
type Bits_38 is mod 2**38 with Size => 38;
type Bits_39 is mod 2**39 with Size => 39;
type Bits_40 is mod 2**40 with Size => 40;
type Bits_41 is mod 2**41 with Size => 41;
type Bits_42 is mod 2**42 with Size => 42;
type Bits_43 is mod 2**43 with Size => 43;
type Bits_44 is mod 2**44 with Size => 44;
type Bits_45 is mod 2**45 with Size => 45;
type Bits_46 is mod 2**46 with Size => 46;
type Bits_47 is mod 2**47 with Size => 47;
type Bits_48 is mod 2**48 with Size => 48;
type Bits_49 is mod 2**49 with Size => 49;
type Bits_50 is mod 2**50 with Size => 50;
type Bits_51 is mod 2**51 with Size => 51;
type Bits_52 is mod 2**52 with Size => 52;
type Bits_53 is mod 2**53 with Size => 53;
type Bits_54 is mod 2**54 with Size => 54;
type Bits_55 is mod 2**55 with Size => 55;
type Bits_56 is mod 2**56 with Size => 56;
type Bits_57 is mod 2**57 with Size => 57;
type Bits_58 is mod 2**58 with Size => 58;
type Bits_59 is mod 2**59 with Size => 59;
type Bits_60 is mod 2**60 with Size => 60;
type Bits_61 is mod 2**61 with Size => 61;
type Bits_62 is mod 2**62 with Size => 62;
type Bits_63 is mod 2**63 with Size => 63;
subtype Bits_64 is Interfaces.Unsigned_64;
subtype Index is Natural range 0 .. Natural'Last - 1;
type Byte_Array is array (Index range <>) of Bits_8;
end DW1000.Types;
|
reznikmm/matreshka | Ada | 3,684 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Elements;
package ODF.DOM.Text_Bibliography_Elements is
pragma Preelaborate;
type ODF_Text_Bibliography is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Text_Bibliography_Access is
access all ODF_Text_Bibliography'Class
with Storage_Size => 0;
end ODF.DOM.Text_Bibliography_Elements;
|
apple-oss-distributions/old_ncurses | Ada | 3,365 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- Sample.Helpers --
-- --
-- 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 <[email protected]> 1996
-- Version Control
-- $Revision: 1.1.1.1 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Terminal_Interface.Curses; use Terminal_Interface.Curses;
-- This package contains some conveniant helper routines used throughout
-- this example.
--
package Sample.Helpers is
procedure Window_Title (Win : in Window;
Title : in String);
-- Put a title string into the first line of the window
procedure Not_Implemented;
end Sample.Helpers;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 2,358 | adb | with STM32_SVD.EXTI;
with STM32_SVD.GPIO; use STM32_SVD.GPIO;
with STM32_SVD.AFIO; use STM32_SVD.AFIO;
with STM32GD.EXTI;
with STM32GD.EXTI.IRQ;
with STM32GD.GPIO.Port;
package body STM32GD.GPIO.IRQ is
Index : constant Natural := GPIO_Pin'Pos (Pin.Pin);
Pin_Mask : constant UInt16 := GPIO_Pin'Enum_Rep (Pin.Pin);
procedure Connect_External_Interrupt
is
Port_Id : constant UInt4 := GPIO_Port'Enum_Rep (Pin.Port);
begin
case Index is
when 0 .. 3 =>
AFIO_Periph.EXTICR1.EXTI.Arr (Index) := Port_Id;
when 4 .. 7 =>
AFIO_Periph.EXTICR2.EXTI.Arr (Index) := Port_Id;
when 8 .. 11 =>
AFIO_Periph.EXTICR3.EXTI.Arr (Index) := Port_Id;
when 12 .. 15 =>
AFIO_Periph.EXTICR4.EXTI.Arr (Index) := Port_Id;
when others =>
raise Program_Error;
end case;
end Connect_External_Interrupt;
function Interrupt_Line_Number return STM32GD.EXTI.External_Line_Number
is
begin
return STM32GD.EXTI.External_Line_Number'Val (Index);
end Interrupt_Line_Number;
procedure Configure_Trigger (Event : Boolean := False; Rising : Boolean := False; Falling : Boolean := False)
is
use STM32GD.EXTI;
Line : constant External_Line_Number := External_Line_Number'Val (Index);
T : External_Triggers;
begin
Connect_External_Interrupt;
if Event then
if Rising and Falling then T := Event_Rising_Falling_Edge;
elsif Rising then T := Event_Rising_Edge;
else T := Event_Falling_Edge;
Enable_External_Event (Line, T);
end if;
else
if Rising and Falling then T := Interrupt_Rising_Falling_Edge;
elsif Rising then T := Interrupt_Rising_Edge;
else T := Interrupt_Falling_Edge;
end if;
Enable_External_Interrupt (Line, T);
end if;
end Configure_Trigger;
procedure Wait_For_Trigger is
begin
STM32GD.EXTI.IRQ.IRQ_Handler.Wait;
end Wait_For_Trigger;
procedure Clear_Trigger is
begin
STM32GD.EXTI.IRQ.IRQ_Handler.Reset_Status (Interrupt_Line_Number);
end Clear_Trigger;
function Triggered return Boolean is
begin
return False;
end;
procedure Cancel_Wait is
begin
STM32GD.EXTI.IRQ.IRQ_Handler.Cancel;
end Cancel_Wait;
end STM32GD.GPIO.Irq;
|
Componolit/libsparkcrypto | Ada | 4,526 | adb | package body Util
is
Invalid_Input_Data : exception;
---------
-- B2S --
---------
function B2S (Data : LSC.Types.Bytes) return String
is
use type LSC.Types.Byte;
B, Nibble : LSC.Types.Byte;
function Hex_Digit (D : LSC.Types.Byte) return Character is
(case D is
when 16#0# => '0', when 16#1# => '1', when 16#2# => '2', when 16#3# => '3',
when 16#4# => '4', when 16#5# => '5', when 16#6# => '6', when 16#7# => '7',
when 16#8# => '8', when 16#9# => '9', when 16#A# => 'a', when 16#b# => 'b',
when 16#c# => 'c', when 16#d# => 'd', when 16#e# => 'e', when 16#f# => 'f',
when others => '*');
Result_Offset : Natural := 0;
begin
for D of Data
loop
Result_Offset := Result_Offset + (if D = 0 then 2 elsif D <= 16#f# then 1 else 0);
exit when D > 16#f#;
end loop;
return Result : String (Result_Offset + 1 .. 2 * Data'Length)
do
for I in Result'Range
loop
B := Data (Data'First + (I + 1) / 2 - 1);
Nibble := (if I mod 2 = 0
then B and LSC.Types.Byte (16#f#)
else B / LSC.Types.Byte (16#10#));
Result (I) := Hex_Digit (Nibble);
end loop;
end return;
end B2S;
---------
-- S2B --
---------
function S2B (Data : String) return LSC.Types.Bytes
is
function To_Byte (C : Character) return LSC.Types.Byte is
(case C is
when '0' => 16#0#, when '1' => 16#1#, when '2' => 16#2#, when '3' => 16#3#,
when '4' => 16#4#, when '5' => 16#5#, when '6' => 16#6#, when '7' => 16#7#,
when '8' => 16#8#, when '9' => 16#9#, when 'a' => 16#a#, when 'b' => 16#b#,
when 'c' => 16#c#, when 'd' => 16#d#, when 'e' => 16#e#, when 'f' => 16#f#,
when 'A' => 16#a#, when 'B' => 16#b#, when 'C' => 16#c#, when 'D' => 16#d#,
when 'E' => 16#e#, when 'F' => 16#f#,
when others => 16#ff#);
function Is_Whitespace (C : Character) return Boolean is
(case C is
when ' ' => True,
when ASCII.HT => True,
when others => False);
Position : Natural := 1;
Num_Nibbles : Natural := 0;
Nibble : LSC.Types.Byte;
High_Nibble : Boolean;
Previous : LSC.Types.Byte := 0;
use type LSC.Types.Byte;
begin
for C of Data
loop
if To_Byte (C) <= 16#f#
then
Num_Nibbles := Num_Nibbles + 1;
end if;
end loop;
return Result : LSC.Types.Bytes (1 .. (Num_Nibbles + 1) / 2)
do
High_Nibble := Num_Nibbles mod 2 = 0;
for C of Data
loop
if not Is_Whitespace (C)
then
Nibble := To_Byte (C);
if Nibble > 16#f#
then
raise Invalid_Input_Data with ">>>" & Data & "<<<";
end if;
if High_Nibble
then
Previous := 16#10# * Nibble;
else
Result (Position) := Previous + Nibble;
Position := Position + 1;
end if;
High_Nibble := not High_Nibble;
end if;
end loop;
end return;
end S2B;
---------
-- T2B --
---------
procedure T2B (Input : String;
Output : out LSC.Types.Bytes;
Last : out LSC.Types.Natural_Index)
is
function To_Byte (C : Character) return LSC.Types.Byte
is (LSC.Types.Byte (Character'Pos (C)));
begin
for I in 0 .. Input'Length - 1
loop
Output (Output'First + I) := To_Byte (Input (Input'First + I));
end loop;
Last := Output'First + Input'Length - 1;
end T2B;
function T2B (Data : String) return LSC.Types.Bytes
is
Result : LSC.Types.Bytes (1 .. Data'Length);
Unused : LSC.Types.Natural_Index;
begin
T2B (Data, Result, Unused);
pragma Unreferenced (Unused);
return Result;
end T2B;
---------
-- B2T --
---------
function B2T (Data : LSC.Types.Bytes) return String
is
Result : String (1 .. Data'Length);
function To_Character (B : LSC.Types.Byte) return Character
is (Character'Val (B));
begin
for I in 0 .. Data'Length - 1
loop
Result (Result'First + I) := To_Character (Data (Data'First + I));
end loop;
return Result;
end B2T;
end Util;
|
Fabien-Chouteau/microbit_examples | Ada | 2,340 | ads | pragma Warnings (Off);
pragma Ada_95;
pragma Restrictions (No_Exception_Propagation);
with System;
with System.Parameters;
with System.Secondary_Stack;
package ada_main is
GNAT_Version : constant String :=
"GNAT Version: Pro 21.0w (20200723-93)" & ASCII.NUL;
pragma Export (C, GNAT_Version, "__gnat_version");
Ada_Main_Program_Name : constant String := "_ada_main" & ASCII.NUL;
pragma Export (C, Ada_Main_Program_Name, "__gnat_ada_main_program_name");
procedure adainit;
pragma Export (C, adainit, "adainit");
procedure main;
pragma Export (C, main, "main");
-- BEGIN ELABORATION ORDER
-- ada%s
-- interfaces%s
-- system%s
-- ada.exceptions%s
-- ada.exceptions%b
-- system.machine_code%s
-- system.parameters%s
-- system.storage_elements%s
-- system.storage_elements%b
-- system.secondary_stack%s
-- system.secondary_stack%b
-- ada.tags%s
-- ada.tags%b
-- system.unsigned_types%s
-- system.assertions%s
-- system.assertions%b
-- cortex_m%s
-- cortex_m_svd%s
-- hal%s
-- cortex_m_svd.nvic%s
-- nrf_svd%s
-- nrf_svd.aar%s
-- nrf_svd.adc%s
-- nrf_svd.ccm%s
-- nrf_svd.clock%s
-- nrf_svd.ecb%s
-- nrf_svd.gpio%s
-- nrf_svd.gpiote%s
-- nrf_svd.power%s
-- nrf_svd.ppi%s
-- nrf_svd.qdec%s
-- nrf_svd.radio%s
-- nrf_svd.rng%s
-- nrf_svd.rtc%s
-- nrf_svd.spi%s
-- nrf_svd.temp%s
-- nrf_svd.timer%s
-- nrf_svd.twi%s
-- nrf_svd.uart%s
-- nrf_svd.wdt%s
-- cortex_m.nvic%s
-- cortex_m.nvic%b
-- hal.gpio%s
-- hal.i2c%s
-- hal.spi%s
-- hal.time%s
-- hal.uart%s
-- nrf%s
-- nrf.events%s
-- nrf.events%b
-- nrf.gpio%s
-- nrf.gpio%b
-- nrf.interrupts%s
-- nrf.interrupts%b
-- nrf.rtc%s
-- nrf.rtc%b
-- nrf.spi_master%s
-- nrf.spi_master%b
-- nrf.tasks%s
-- nrf.tasks%b
-- nrf.clock%s
-- nrf.clock%b
-- nrf.timers%s
-- nrf.timers%b
-- nrf.twi%s
-- nrf.twi%b
-- nrf.uart%s
-- nrf.uart%b
-- nrf.device%s
-- microbit%s
-- microbit.time%s
-- microbit.time%b
-- microbit.buttons%s
-- microbit.buttons%b
-- microbit.display%s
-- microbit.display%b
-- main%b
-- END ELABORATION ORDER
end ada_main;
|
mfkiwl/ewok-kernel-security-OS | Ada | 1,955 | ads | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with config.applications; use config.applications;
with ewok.exported.sleep; use ewok.exported.sleep;
with ewok.tasks;
with m4.systick;
package ewok.sleep
with spark_mode => on
is
awakening_time : array (t_real_task_id'range) of m4.systick.t_tick
:= (others => 0);
-- Make the task sleeping and not executable for the given time.
-- Only external events can awake the task during this period unless
-- SLEEP_MODE_DEEP is selected.
procedure sleeping
(task_id : in t_real_task_id;
ms : in milliseconds;
mode : in t_sleep_mode)
with
global => (Output => awakening_time);
-- For each task, check if it's sleeping time is over
procedure check_is_awoke
with
global => (In_Out => (awakening_time, ewok.tasks.tasks_list));
-- Try to awake a task
procedure try_waking_up
(task_id : in t_real_task_id)
with
global => (In_Out => (awakening_time, ewok.tasks.tasks_list));
-- Check if a task is currently sleeping
function is_sleeping
(task_id : in t_real_task_id)
return boolean
with
global => (Input => awakening_time);
end ewok.sleep;
|
sf17k/sdlada | Ada | 4,618 | ads | --------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2014-2015 Luke A. Guest
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
-- SDL.Video.Palettes
--
-- Palettes, colours and various conversions.
--------------------------------------------------------------------------------------------------------------------
with Ada.Finalization;
with Ada.Iterator_Interfaces;
with Interfaces.C.Pointers;
package SDL.Video.Palettes is
package C renames Interfaces.C;
type Colour_Component is range 0 .. 255 with
Size => 8,
Convention => C;
type Colour is
record
Red : Colour_Component;
Green : Colour_Component;
Blue : Colour_Component;
Alpha : Colour_Component;
end record with
Convention => C,
Size => Colour_Component'Size * 4;
for Colour use
record
Red at 0 range 0 .. 7;
Green at 0 range 8 .. 15;
Blue at 0 range 16 .. 23;
Alpha at 0 range 24 .. 31;
end record;
Null_Colour : constant Colour := Colour'(others => Colour_Component'First);
type RGB_Colour is
record
Red : Colour_Component;
Green : Colour_Component;
Blue : Colour_Component;
end record;
Null_RGB_Colour : constant RGB_Colour := RGB_Colour'(others => Colour_Component'First);
-- Cursor type for our iterator.
type Cursor is private;
No_Element : constant Cursor;
function Element (Position : in Cursor) return Colour;
function Has_Element (Position : Cursor) return Boolean;
-- Create the iterator interface package.
package Palette_Iterator_Interfaces is new
Ada.Iterator_Interfaces (Cursor, Has_Element);
type Palette is tagged limited private with
Default_Iterator => Iterate,
Iterator_Element => Colour,
Constant_Indexing => Constant_Reference;
type Palette_Access is access Palette;
function Constant_Reference
(Container : aliased Palette;
Position : Cursor) return Colour;
function Iterate (Container : Palette)
return Palette_Iterator_Interfaces.Forward_Iterator'Class;
function Create (Total_Colours : in Positive) return Palette;
procedure Free (Container : in out Palette);
Empty_Palette : constant Palette;
private
type Colour_Array is array (C.size_t range <>) of aliased Colour with
Convention => C;
package Colour_Array_Pointer is new Interfaces.C.Pointers
(Index => C.size_t,
Element => Colour,
Element_Array => Colour_Array,
Default_Terminator => Null_Colour);
type Internal_Palette is
record
Total : C.int;
Colours : Colour_Array_Pointer.Pointer;
Version : Interfaces.Unsigned_32;
Ref_Count : C.int;
end record with
Convention => C;
type Internal_Palette_Access is access Internal_Palette with
Convention => C;
type Palette is tagged limited
record
Data : Internal_Palette_Access;
end record;
type Palette_Constant_Access is access constant Palette;
type Cursor is
record
Container : Palette_Constant_Access;
Index : Natural;
Current : Colour_Array_Pointer.Pointer;
end record;
No_Element : constant Cursor := Cursor'(Container => null,
Index => Natural'First,
Current => null);
Empty_Palette : constant Palette := Palette'(Data => null);
end SDL.Video.Palettes;
|
onox/orka | Ada | 2,128 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2017 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Orka.Logging.Default;
package body Orka.Rendering.Fences is
use all type Orka.Logging.Default_Module;
use all type Orka.Logging.Severity;
procedure Log is new Orka.Logging.Default.Generic_Log (Renderer);
function Create_Buffer_Fence
(Regions : Positive;
Maximum_Wait : Duration := 0.010) return Buffer_Fence is
begin
return Result : Buffer_Fence (Regions => Regions) do
Result.Index := 0;
Result.Maximum_Wait := Maximum_Wait;
end return;
end Create_Buffer_Fence;
procedure Prepare_Index (Object : in out Buffer_Fence; Status : out Fence_Status) is
use GL.Fences;
begin
if not Object.Fences (Object.Index + 1).Initialized then
Status := Not_Initialized;
return;
end if;
case Object.Fences (Object.Index + 1).Client_Wait (Object.Maximum_Wait) is
when Condition_Satisfied =>
Log (Warning, "Fence not already signalled");
Status := Signaled;
when Timeout_Expired | Wait_Failed =>
Log (Error, "Fence timed out or failed");
Status := Not_Signaled;
when Already_Signaled =>
Status := Signaled;
end case;
end Prepare_Index;
procedure Advance_Index (Object : in out Buffer_Fence) is
begin
Object.Fences (Object.Index + 1).Set_Fence;
Object.Index := (Object.Index + 1) mod Object.Regions;
end Advance_Index;
end Orka.Rendering.Fences;
|
sungyeon/drake | Ada | 1,459 | adb | with C.signal;
package body System.Native_Interrupts is
use type C.signed_int;
procedure Mask (How : C.signed_int; Interrupt : Interrupt_Id);
procedure Mask (How : C.signed_int; Interrupt : Interrupt_Id) is
Mask : aliased C.signal.sigset_t;
Dummy : C.signed_int;
R : C.signed_int;
begin
Dummy := C.signal.sigemptyset (Mask'Access);
Dummy := C.signal.sigaddset (Mask'Access, Interrupt);
R := C.signal.sigprocmask (How, Mask'Access, null);
if R < 0 then
raise Program_Error;
end if;
end Mask;
-- implementation
function Is_Blocked (Interrupt : Interrupt_Id) return Boolean is
Current_Mask : aliased C.signal.sigset_t;
R : C.signed_int;
begin
R := C.signal.sigprocmask (
C.signal.SIG_SETMASK,
null,
Current_Mask'Access);
if R < 0 then
raise Program_Error;
end if;
return C.signal.sigismember (Current_Mask'Access, Interrupt) /= 0;
end Is_Blocked;
procedure Block (Interrupt : Interrupt_Id) is
begin
Mask (C.signal.SIG_BLOCK, Interrupt);
end Block;
procedure Unblock (Interrupt : Interrupt_Id) is
begin
Mask (C.signal.SIG_UNBLOCK, Interrupt);
end Unblock;
procedure Raise_Interrupt (Interrupt : Interrupt_Id) is
begin
if C.signal.C_raise (Interrupt) < 0 then
raise Program_Error;
end if;
end Raise_Interrupt;
end System.Native_Interrupts;
|
luk9400/nsi | Ada | 156 | ads | package Poly with SPARK_Mode is
type Vector is array (Natural range <>) of Integer;
function Horner (X: Integer; A: Vector) return Integer;
end Poly;
|
VitalijBondarenko/adanls | Ada | 6,740 | ads | ------------------------------------------------------------------------------
-- --
-- Copyright (c) 2014-2022 Vitalii Bondarenko <[email protected]> --
-- --
------------------------------------------------------------------------------
-- --
-- The MIT License (MIT) --
-- --
-- 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. --
------------------------------------------------------------------------------
-- The set of functions to support message translation.
with Interfaces.C; use Interfaces.C;
with L10n; use L10n;
package I18n is
pragma Preelaborate;
function Gettext (Msg : String) return String;
-- Searches the currently selected message catalogs for a string which is
-- equal to Msg. If there is such a string available it is returned.
-- Otherwise the argument string Msg is returned.
function "-" (Msg : String) return String renames Gettext;
-- Shortcut for Gettext (Msg)
function Dgettext
(Domain : String; Msg : String) return String;
-- The Dgettext functions acts just like the Gettext function. It only
-- takes an additional first argument Domain which guides the selection of
-- the message catalogs which are searched for the translation. If the
-- Domain parameter is the empty string the Dgettext function is exactly
-- equivalent to Gettext since the default value for the domain name is
-- used.
function Dcgettext
(Domain : String; Msg : String; Category : Locale_Category) return String;
-- The Dcgettext adds another argument to those which Dgettext takes. This
-- argument Category specifies the last piece of information needed to
-- localize the message catalog. I.e., the domain name and the locale
-- category exactly specify which message catalog has to be used.
-- Look up Msg in the Domain message catalog for the Category locale.
function Ngettext
(Msg1 : String; Msg2 : String; N : unsigned_long) return String;
-- The Ngettext function is similar to the Gettext function as it finds the
-- message catalogs in the same way. But it takes two extra arguments.
-- The Msg1 parameter must contain the singular form of the string to be
-- converted. It is also used as the key for the search in the catalog.
-- The Msg2 parameter is the plural form. The parameter N is used to
-- determine the plural form. If no message catalog is found Msg1 is
-- returned if N = 1, otherwise Msg2.
function Dngettext
(Domain : String;
Msg1 : String;
Msg2 : String;
N : unsigned_long) return String;
-- The Dngettext is similar to the Dgettext function in the way the message
-- catalog is selected. The difference is that it takes two extra parameter
-- to provide the correct plural form. These two parameters are handled in
-- the same way Ngettext handles them.
function Dcngettext
(Domain : String;
Msg1 : String;
Msg2 : String;
N : unsigned_long;
Category : Locale_Category) return String;
-- The Dcngettext is similar to the Dcgettext function in the way the
-- message catalog is selected. The difference is that it takes two extra
-- parameter to provide the correct plural form. These two parameters are
-- handled in the same way Ngettext handles them.
procedure Text_Domain (Domain_Name : String);
-- Sets the default domain, which is used in all future Gettext calls,
-- to Domain_Name.
--
-- If the Domain_Name parameter is the empty string the default domain is
-- reset to its initial value, the domain with the name messages. This
-- possibility is questionable to use since the domain messages really
-- never should be used.
function Default_Text_Domain return String;
-- Return the currently selected default domain.
procedure Bind_Text_Domain (Domain_Name : String; Dirname : String);
-- The Bind_Text_Domain function can be used to specify the directory which
-- contains the message catalogs for domain Domain_Name for the different
-- languages. To be correct, this is the directory where the hierarchy of
-- directories is expected.
-- The Dirname string ought to be an absolute pathname.
function Text_Domain_Directory (Domain_Name : String) return String;
-- Returns the currently selected directory for the domain with the name
-- Domain_Name.
procedure Bind_Text_Domain_Codeset (Domain_Name : String; Codeset : String);
-- The Bind_Text_Domain_Codeset function can be used to specify the output
-- character set for message catalogs for domain Domain_Name. The Codeset
-- argument must be a valid codeset name which can be used for the
-- 'iconv_open' function from 'libc' library.
function Text_Domain_Codeset (Domain_Name : String) return String;
-- Returns the currently selected codeset for the domain with the name
-- Domain_Name. It returns empty string if no codeset has yet been selected.
end I18n;
|
Fabien-Chouteau/GESTE | Ada | 35,222 | ads | package GESTE_Fonts.FreeMonoBold12pt7b is
Font : constant Bitmap_Font_Ref;
private
FreeMonoBold12pt7bBitmaps : aliased constant Font_Bitmap := (
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#E0#, 16#03#, 16#C0#, 16#07#, 16#80#, 16#0F#,
16#00#, 16#0E#, 16#00#, 16#1C#, 16#00#, 16#38#, 16#00#, 16#70#, 16#00#,
16#E0#, 16#01#, 16#80#, 16#01#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#,
16#3C#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#70#, 16#1C#, 16#E0#, 16#19#,
16#C0#, 16#31#, 16#80#, 16#63#, 16#00#, 16#C4#, 16#01#, 16#88#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#CC#, 16#03#, 16#98#, 16#07#, 16#70#, 16#0E#, 16#E0#, 16#1D#,
16#C0#, 16#FF#, 16#E1#, 16#FF#, 16#C0#, 16#CE#, 16#01#, 16#98#, 16#03#,
16#30#, 16#06#, 16#60#, 16#3F#, 16#F0#, 16#7F#, 16#E0#, 16#33#, 16#00#,
16#66#, 16#01#, 16#CC#, 16#03#, 16#98#, 16#03#, 16#30#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#30#,
16#00#, 16#60#, 16#00#, 16#C0#, 16#07#, 16#F8#, 16#1F#, 16#F0#, 16#38#,
16#E0#, 16#60#, 16#C0#, 16#C0#, 16#01#, 16#F0#, 16#01#, 16#FC#, 16#00#,
16#7C#, 16#18#, 16#18#, 16#30#, 16#30#, 16#70#, 16#E0#, 16#FF#, 16#81#,
16#FE#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#01#, 16#80#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#03#, 16#80#, 16#0F#, 16#80#, 16#31#, 16#80#, 16#63#,
16#00#, 16#C6#, 16#00#, 16#F8#, 16#00#, 16#E7#, 16#00#, 16#78#, 16#07#,
16#F8#, 16#19#, 16#F8#, 16#03#, 16#30#, 16#0C#, 16#20#, 16#0C#, 16#C0#,
16#1F#, 16#80#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#C0#, 16#1F#,
16#80#, 16#72#, 16#00#, 16#E0#, 16#00#, 16#C0#, 16#01#, 16#C0#, 16#07#,
16#80#, 16#1F#, 16#B8#, 16#3B#, 16#F0#, 16#63#, 16#C0#, 16#C7#, 16#81#,
16#FF#, 16#80#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#03#, 16#80#, 16#06#,
16#00#, 16#0C#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#20#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#38#, 16#00#, 16#E0#, 16#01#,
16#C0#, 16#07#, 16#00#, 16#0E#, 16#00#, 16#18#, 16#00#, 16#70#, 16#00#,
16#E0#, 16#01#, 16#C0#, 16#03#, 16#80#, 16#03#, 16#00#, 16#06#, 16#00#,
16#0E#, 16#00#, 16#1C#, 16#00#, 16#1C#, 16#00#, 16#38#, 16#00#, 16#38#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#06#, 16#00#, 16#0E#, 16#00#, 16#1C#, 16#00#, 16#1C#,
16#00#, 16#38#, 16#00#, 16#38#, 16#00#, 16#70#, 16#00#, 16#E0#, 16#01#,
16#C0#, 16#03#, 16#80#, 16#07#, 16#00#, 16#0E#, 16#00#, 16#1C#, 16#00#,
16#30#, 16#00#, 16#E0#, 16#01#, 16#C0#, 16#07#, 16#00#, 16#0E#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#03#, 16#00#, 16#76#,
16#E0#, 16#FF#, 16#C0#, 16#FF#, 16#00#, 16#78#, 16#01#, 16#F8#, 16#03#,
16#38#, 16#06#, 16#30#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#06#,
16#00#, 16#0C#, 16#00#, 16#18#, 16#00#, 16#30#, 16#0F#, 16#FF#, 16#1F#,
16#FE#, 16#01#, 16#80#, 16#03#, 16#00#, 16#06#, 16#00#, 16#0C#, 16#00#,
16#18#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#,
16#38#, 16#00#, 16#60#, 16#01#, 16#C0#, 16#03#, 16#00#, 16#06#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#FF#, 16#1F#,
16#FE#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#,
16#3C#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#,
16#00#, 16#06#, 16#00#, 16#1C#, 16#00#, 16#38#, 16#00#, 16#E0#, 16#01#,
16#C0#, 16#03#, 16#00#, 16#0E#, 16#00#, 16#18#, 16#00#, 16#70#, 16#00#,
16#C0#, 16#03#, 16#80#, 16#06#, 16#00#, 16#1C#, 16#00#, 16#30#, 16#00#,
16#E0#, 16#01#, 16#80#, 16#07#, 16#00#, 16#0E#, 16#00#, 16#08#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#01#, 16#E0#, 16#07#, 16#F0#, 16#1C#, 16#60#, 16#70#,
16#E0#, 16#E0#, 16#C1#, 16#81#, 16#83#, 16#03#, 16#06#, 16#06#, 16#0C#,
16#0C#, 16#18#, 16#18#, 16#38#, 16#30#, 16#70#, 16#E0#, 16#71#, 16#C0#,
16#7F#, 16#00#, 16#78#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#01#, 16#C0#, 16#07#, 16#80#, 16#3F#, 16#00#, 16#76#,
16#00#, 16#0C#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#,
16#C0#, 16#01#, 16#80#, 16#03#, 16#00#, 16#06#, 16#00#, 16#0C#, 16#01#,
16#FF#, 16#83#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#01#, 16#E0#, 16#0F#, 16#F0#, 16#38#, 16#70#, 16#60#,
16#60#, 16#C0#, 16#C0#, 16#03#, 16#80#, 16#0E#, 16#00#, 16#3C#, 16#00#,
16#F0#, 16#03#, 16#C0#, 16#0F#, 16#00#, 16#3C#, 16#60#, 16#F0#, 16#C3#,
16#FF#, 16#87#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#03#, 16#F0#, 16#0F#, 16#F0#, 16#38#, 16#70#, 16#00#,
16#60#, 16#00#, 16#C0#, 16#03#, 16#80#, 16#3E#, 16#00#, 16#FC#, 16#00#,
16#1C#, 16#00#, 16#1C#, 16#00#, 16#38#, 16#00#, 16#70#, 16#C1#, 16#C1#,
16#FF#, 16#01#, 16#FC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#01#, 16#E0#, 16#07#,
16#C0#, 16#1F#, 16#80#, 16#3F#, 16#00#, 16#EE#, 16#01#, 16#9C#, 16#07#,
16#38#, 16#1C#, 16#70#, 16#3F#, 16#F0#, 16#7F#, 16#E0#, 16#03#, 16#80#,
16#1F#, 16#80#, 16#3F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#07#, 16#FC#, 16#0F#, 16#F8#, 16#18#, 16#00#, 16#30#,
16#00#, 16#60#, 16#00#, 16#FE#, 16#01#, 16#FE#, 16#03#, 16#0E#, 16#00#,
16#0C#, 16#00#, 16#1C#, 16#00#, 16#38#, 16#00#, 16#70#, 16#C1#, 16#C1#,
16#FF#, 16#01#, 16#FC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#3C#, 16#01#, 16#FC#, 16#07#, 16#00#, 16#1C#,
16#00#, 16#70#, 16#00#, 16#E0#, 16#01#, 16#BC#, 16#03#, 16#FE#, 16#07#,
16#9C#, 16#0E#, 16#1C#, 16#18#, 16#38#, 16#38#, 16#70#, 16#30#, 16#C0#,
16#7F#, 16#80#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#0F#, 16#FC#, 16#1F#, 16#F8#, 16#30#, 16#70#, 16#60#,
16#E0#, 16#01#, 16#80#, 16#03#, 16#00#, 16#0E#, 16#00#, 16#18#, 16#00#,
16#30#, 16#00#, 16#E0#, 16#01#, 16#80#, 16#03#, 16#00#, 16#0E#, 16#00#,
16#18#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#01#, 16#E0#, 16#0F#, 16#F0#, 16#1C#, 16#70#, 16#70#,
16#60#, 16#E0#, 16#C1#, 16#C1#, 16#81#, 16#C6#, 16#01#, 16#FC#, 16#07#,
16#F8#, 16#1C#, 16#38#, 16#38#, 16#30#, 16#60#, 16#60#, 16#E1#, 16#C0#,
16#FF#, 16#00#, 16#FC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#01#, 16#F0#, 16#07#, 16#F0#, 16#1C#, 16#70#, 16#30#,
16#60#, 16#60#, 16#E0#, 16#C1#, 16#C1#, 16#C7#, 16#81#, 16#FF#, 16#01#,
16#EE#, 16#00#, 16#1C#, 16#00#, 16#70#, 16#00#, 16#E0#, 16#07#, 16#80#,
16#FE#, 16#01#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#0E#, 16#00#, 16#3C#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#,
16#3C#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#1C#, 16#00#, 16#38#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#,
16#38#, 16#00#, 16#E0#, 16#01#, 16#80#, 16#03#, 16#00#, 16#04#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#30#, 16#01#, 16#E0#, 16#0F#, 16#80#, 16#7C#, 16#03#, 16#E0#, 16#1F#,
16#00#, 16#0F#, 16#80#, 16#07#, 16#C0#, 16#03#, 16#E0#, 16#01#, 16#E0#,
16#00#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#03#, 16#FF#, 16#C7#, 16#FF#, 16#80#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#7F#, 16#F8#, 16#FF#, 16#F0#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#60#,
16#01#, 16#F0#, 16#00#, 16#F8#, 16#00#, 16#7C#, 16#00#, 16#3E#, 16#00#,
16#3E#, 16#01#, 16#F0#, 16#0F#, 16#80#, 16#7C#, 16#01#, 16#E0#, 16#01#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#E0#, 16#1F#, 16#E0#, 16#30#,
16#E0#, 16#60#, 16#C0#, 16#01#, 16#80#, 16#07#, 16#00#, 16#3E#, 16#00#,
16#F8#, 16#01#, 16#C0#, 16#03#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#,
16#3C#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#01#, 16#E0#, 16#07#, 16#F0#, 16#1C#, 16#60#, 16#30#,
16#60#, 16#C0#, 16#C1#, 16#87#, 16#83#, 16#3F#, 16#06#, 16#66#, 16#0D#,
16#8C#, 16#1B#, 16#18#, 16#37#, 16#30#, 16#67#, 16#E0#, 16#C7#, 16#C1#,
16#80#, 16#03#, 16#00#, 16#03#, 16#00#, 16#07#, 16#18#, 16#07#, 16#F0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#C0#, 16#3F#, 16#80#, 16#0F#,
16#80#, 16#3F#, 16#00#, 16#76#, 16#00#, 16#CE#, 16#03#, 16#9C#, 16#06#,
16#18#, 16#1F#, 16#F8#, 16#3F#, 16#F0#, 16#60#, 16#71#, 16#C0#, 16#E7#,
16#E3#, 16#FF#, 16#C7#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#7F#, 16#E0#, 16#FF#, 16#F0#, 16#70#,
16#60#, 16#E0#, 16#E1#, 16#C1#, 16#C3#, 16#87#, 16#07#, 16#FC#, 16#0F#,
16#FC#, 16#1C#, 16#1C#, 16#38#, 16#1C#, 16#70#, 16#38#, 16#E0#, 16#77#,
16#FF#, 16#CF#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#FC#, 16#1F#, 16#F8#, 16#70#,
16#71#, 16#C0#, 16#63#, 16#80#, 16#C6#, 16#00#, 16#0C#, 16#00#, 16#18#,
16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#E0#, 16#30#, 16#E0#, 16#E0#,
16#FF#, 16#C0#, 16#7E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#7F#, 16#C0#, 16#FF#, 16#E0#, 16#60#,
16#E0#, 16#C0#, 16#C1#, 16#81#, 16#C3#, 16#01#, 16#86#, 16#03#, 16#0C#,
16#06#, 16#18#, 16#0C#, 16#30#, 16#18#, 16#60#, 16#70#, 16#C1#, 16#C7#,
16#FF#, 16#0F#, 16#FC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#7F#, 16#FC#, 16#FF#, 16#F8#, 16#70#,
16#70#, 16#E0#, 16#E1#, 16#CC#, 16#83#, 16#98#, 16#07#, 16#F0#, 16#0F#,
16#E0#, 16#1C#, 16#C0#, 16#39#, 16#98#, 16#70#, 16#30#, 16#E0#, 16#67#,
16#FF#, 16#CF#, 16#FF#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#7F#, 16#FC#, 16#FF#, 16#F8#, 16#70#,
16#30#, 16#E0#, 16#61#, 16#CC#, 16#C3#, 16#98#, 16#07#, 16#F0#, 16#0F#,
16#E0#, 16#1C#, 16#C0#, 16#39#, 16#80#, 16#70#, 16#00#, 16#E0#, 16#07#,
16#F8#, 16#0F#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#FC#, 16#1F#, 16#F8#, 16#70#,
16#71#, 16#C0#, 16#63#, 16#80#, 16#C6#, 16#00#, 16#0C#, 16#00#, 16#18#,
16#7F#, 16#30#, 16#FE#, 16#60#, 16#18#, 16#E0#, 16#30#, 16#E0#, 16#E0#,
16#FF#, 16#C0#, 16#7E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#3E#, 16#7C#, 16#7C#, 16#F8#, 16#70#,
16#60#, 16#E0#, 16#C1#, 16#C1#, 16#83#, 16#83#, 16#07#, 16#FE#, 16#0F#,
16#FC#, 16#1C#, 16#18#, 16#38#, 16#30#, 16#70#, 16#60#, 16#E0#, 16#C3#,
16#E7#, 16#E7#, 16#CF#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#F8#, 16#3F#, 16#F0#, 16#06#,
16#00#, 16#0C#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#,
16#C0#, 16#01#, 16#80#, 16#03#, 16#00#, 16#06#, 16#00#, 16#0C#, 16#01#,
16#FF#, 16#83#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#FF#, 16#07#, 16#FE#, 16#00#,
16#E0#, 16#01#, 16#C0#, 16#03#, 16#80#, 16#07#, 16#00#, 16#0E#, 16#08#,
16#1C#, 16#38#, 16#38#, 16#70#, 16#70#, 16#E0#, 16#E1#, 16#C3#, 16#83#,
16#FE#, 16#00#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#7F#, 16#7E#, 16#FE#, 16#FC#, 16#71#,
16#E0#, 16#E7#, 16#81#, 16#DE#, 16#03#, 16#F8#, 16#07#, 16#F0#, 16#0F#,
16#F0#, 16#1C#, 16#E0#, 16#38#, 16#E0#, 16#70#, 16#C0#, 16#E1#, 16#C7#,
16#F1#, 16#EF#, 16#E3#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#C0#, 16#7F#, 16#80#, 16#18#,
16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#03#,
16#00#, 16#06#, 16#06#, 16#0C#, 16#1C#, 16#18#, 16#38#, 16#30#, 16#73#,
16#FF#, 16#E7#, 16#FF#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#78#, 16#1F#, 16#F8#, 16#3E#, 16#F0#,
16#F1#, 16#F1#, 16#E3#, 16#E7#, 16#C6#, 16#EF#, 16#8D#, 16#DB#, 16#19#,
16#F6#, 16#33#, 16#CC#, 16#63#, 16#98#, 16#C7#, 16#31#, 16#80#, 16#67#,
16#E3#, 16#FF#, 16#C7#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#78#, 16#7E#, 16#F8#, 16#FC#, 16#78#,
16#70#, 16#F0#, 16#E1#, 16#F1#, 16#C3#, 16#73#, 16#86#, 16#67#, 16#0C#,
16#EE#, 16#18#, 16#FC#, 16#31#, 16#F8#, 16#61#, 16#F0#, 16#C1#, 16#E7#,
16#E3#, 16#CF#, 16#C3#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#C0#, 16#1F#, 16#E0#, 16#70#,
16#E1#, 16#C0#, 16#E3#, 16#00#, 16#C6#, 16#01#, 16#CC#, 16#03#, 16#98#,
16#07#, 16#30#, 16#0E#, 16#60#, 16#18#, 16#E0#, 16#70#, 16#E1#, 16#C0#,
16#FF#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#7F#, 16#E0#, 16#FF#, 16#E0#, 16#70#,
16#E0#, 16#E0#, 16#E1#, 16#C1#, 16#C3#, 16#83#, 16#87#, 16#0E#, 16#0F#,
16#FC#, 16#1F#, 16#E0#, 16#38#, 16#00#, 16#70#, 16#00#, 16#E0#, 16#07#,
16#F8#, 16#0F#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E0#, 16#1F#, 16#E0#, 16#70#,
16#E1#, 16#C0#, 16#E3#, 16#00#, 16#C6#, 16#01#, 16#CC#, 16#03#, 16#98#,
16#07#, 16#30#, 16#0E#, 16#60#, 16#18#, 16#E0#, 16#70#, 16#E1#, 16#C0#,
16#FF#, 16#00#, 16#FC#, 16#01#, 16#81#, 16#87#, 16#FF#, 16#0F#, 16#FC#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#7F#, 16#E0#, 16#FF#, 16#E0#, 16#60#,
16#E0#, 16#C0#, 16#C1#, 16#81#, 16#83#, 16#0F#, 16#07#, 16#FC#, 16#0F#,
16#F0#, 16#18#, 16#F0#, 16#30#, 16#E0#, 16#60#, 16#E0#, 16#C0#, 16#C7#,
16#F1#, 16#EF#, 16#E1#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#F8#, 16#1F#, 16#F0#, 16#70#,
16#E0#, 16#E0#, 16#C1#, 16#C1#, 16#83#, 16#80#, 16#03#, 16#F0#, 16#01#,
16#FC#, 16#00#, 16#3C#, 16#30#, 16#38#, 16#E0#, 16#71#, 16#E1#, 16#E3#,
16#FF#, 16#83#, 16#FC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#FC#, 16#7F#, 16#F8#, 16#C6#,
16#31#, 16#8C#, 16#63#, 16#18#, 16#C6#, 16#31#, 16#80#, 16#60#, 16#00#,
16#C0#, 16#01#, 16#80#, 16#03#, 16#00#, 16#06#, 16#00#, 16#0C#, 16#00#,
16#FF#, 16#01#, 16#FE#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#7E#, 16#7E#, 16#FC#, 16#FC#, 16#60#,
16#70#, 16#C0#, 16#E1#, 16#81#, 16#C3#, 16#03#, 16#86#, 16#07#, 16#0C#,
16#0E#, 16#18#, 16#1C#, 16#30#, 16#38#, 16#60#, 16#60#, 16#E1#, 16#C0#,
16#FF#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#7E#, 16#3F#, 16#FC#, 16#7E#, 16#E0#,
16#30#, 16#C0#, 16#E1#, 16#C1#, 16#81#, 16#87#, 16#03#, 16#8C#, 16#07#,
16#38#, 16#06#, 16#70#, 16#0E#, 16#C0#, 16#0F#, 16#80#, 16#1E#, 16#00#,
16#3C#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#7E#, 16#7E#, 16#FC#, 16#FC#, 16#C0#,
16#31#, 16#CE#, 16#63#, 16#9C#, 16#C7#, 16#79#, 16#8E#, 16#FB#, 16#0D#,
16#FE#, 16#1F#, 16#7C#, 16#3C#, 16#F8#, 16#79#, 16#F0#, 16#F1#, 16#C1#,
16#E3#, 16#83#, 16#87#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#3E#, 16#3E#, 16#7C#, 16#7C#, 16#70#,
16#E0#, 16#73#, 16#80#, 16#7F#, 16#00#, 16#7C#, 16#00#, 16#F0#, 16#01#,
16#E0#, 16#07#, 16#E0#, 16#0E#, 16#E0#, 16#39#, 16#E0#, 16#E1#, 16#C7#,
16#E7#, 16#EF#, 16#CF#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#3E#, 16#3E#, 16#7C#, 16#7C#, 16#70#,
16#E0#, 16#73#, 16#80#, 16#77#, 16#00#, 16#FC#, 16#00#, 16#F8#, 16#00#,
16#E0#, 16#01#, 16#80#, 16#03#, 16#00#, 16#06#, 16#00#, 16#0C#, 16#00#,
16#FF#, 16#01#, 16#FE#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#F8#, 16#3F#, 16#F0#, 16#70#,
16#E0#, 16#E3#, 16#81#, 16#CE#, 16#01#, 16#3C#, 16#00#, 16#70#, 16#01#,
16#C0#, 16#07#, 16#18#, 16#0E#, 16#38#, 16#38#, 16#70#, 16#E0#, 16#E1#,
16#FF#, 16#C3#, 16#FF#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#F8#, 16#01#, 16#F0#, 16#03#, 16#00#, 16#06#,
16#00#, 16#0C#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#,
16#C0#, 16#01#, 16#80#, 16#03#, 16#00#, 16#06#, 16#00#, 16#0C#, 16#00#,
16#18#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#01#, 16#F0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#00#,
16#06#, 16#00#, 16#0E#, 16#00#, 16#0C#, 16#00#, 16#1C#, 16#00#, 16#18#,
16#00#, 16#38#, 16#00#, 16#30#, 16#00#, 16#70#, 16#00#, 16#60#, 16#00#,
16#E0#, 16#00#, 16#C0#, 16#01#, 16#C0#, 16#01#, 16#80#, 16#03#, 16#80#,
16#07#, 16#00#, 16#07#, 16#00#, 16#0E#, 16#00#, 16#0C#, 16#00#, 16#08#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#07#, 16#C0#, 16#0F#, 16#80#, 16#03#, 16#00#, 16#06#,
16#00#, 16#0C#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#,
16#C0#, 16#01#, 16#80#, 16#03#, 16#00#, 16#06#, 16#00#, 16#0C#, 16#00#,
16#18#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#0F#, 16#80#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#20#, 16#00#, 16#C0#, 16#03#, 16#C0#, 16#0F#, 16#C0#, 16#3D#,
16#C0#, 16#71#, 16#C1#, 16#C3#, 16#83#, 16#03#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#01#, 16#80#, 16#03#, 16#80#, 16#03#, 16#80#, 16#01#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#7F#, 16#01#, 16#FF#, 16#00#, 16#07#, 16#00#, 16#0E#, 16#03#,
16#FC#, 16#1F#, 16#F8#, 16#38#, 16#70#, 16#E0#, 16#E1#, 16#C3#, 16#C3#,
16#FF#, 16#E1#, 16#FF#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#3C#, 16#00#, 16#78#, 16#00#, 16#30#, 16#00#, 16#60#,
16#00#, 16#DF#, 16#01#, 16#FF#, 16#83#, 16#C3#, 16#87#, 16#03#, 16#0C#,
16#07#, 16#18#, 16#0E#, 16#30#, 16#1C#, 16#70#, 16#30#, 16#F0#, 16#E7#,
16#FF#, 16#8F#, 16#7E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#1F#, 16#E0#, 16#FF#, 16#C3#, 16#83#, 16#86#, 16#07#, 16#1C#,
16#06#, 16#38#, 16#00#, 16#70#, 16#00#, 16#60#, 16#00#, 16#E0#, 16#60#,
16#FF#, 16#C0#, 16#7E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#3E#, 16#00#, 16#7C#, 16#00#, 16#38#, 16#00#,
16#70#, 16#3E#, 16#E1#, 16#FF#, 16#C3#, 16#87#, 16#8E#, 16#07#, 16#18#,
16#0E#, 16#30#, 16#1C#, 16#60#, 16#38#, 16#E0#, 16#71#, 16#E1#, 16#E1#,
16#FF#, 16#F0#, 16#FF#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#3F#, 16#00#, 16#FF#, 16#03#, 16#87#, 16#0E#, 16#07#, 16#1F#,
16#FE#, 16#3F#, 16#FC#, 16#70#, 16#00#, 16#E0#, 16#00#, 16#E0#, 16#E0#,
16#FF#, 16#C0#, 16#FE#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#7E#, 16#03#, 16#FE#, 16#06#, 16#00#, 16#0C#,
16#00#, 16#FF#, 16#C1#, 16#FF#, 16#80#, 16#60#, 16#00#, 16#C0#, 16#01#,
16#80#, 16#03#, 16#00#, 16#06#, 16#00#, 16#0C#, 16#00#, 16#18#, 16#01#,
16#FF#, 16#83#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#3E#, 16#F1#, 16#FF#, 16#E3#, 16#8F#, 16#0E#, 16#0E#, 16#18#,
16#0C#, 16#30#, 16#18#, 16#60#, 16#30#, 16#E0#, 16#E0#, 16#E3#, 16#C0#,
16#FF#, 16#80#, 16#FB#, 16#00#, 16#06#, 16#00#, 16#0C#, 16#00#, 16#38#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#3E#, 16#00#, 16#7C#, 16#00#, 16#38#, 16#00#, 16#70#,
16#00#, 16#EF#, 16#01#, 16#FF#, 16#03#, 16#C7#, 16#07#, 16#06#, 16#0E#,
16#0C#, 16#1C#, 16#18#, 16#38#, 16#30#, 16#70#, 16#60#, 16#E0#, 16#C3#,
16#E7#, 16#E7#, 16#CF#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#07#, 16#00#, 16#00#,
16#00#, 16#7C#, 16#00#, 16#F8#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#,
16#C0#, 16#01#, 16#80#, 16#03#, 16#00#, 16#06#, 16#00#, 16#0C#, 16#01#,
16#FF#, 16#C3#, 16#FF#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#01#, 16#C0#, 16#00#,
16#00#, 16#FF#, 16#81#, 16#FF#, 16#00#, 16#06#, 16#00#, 16#0C#, 16#00#,
16#18#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#01#, 16#80#,
16#03#, 16#00#, 16#06#, 16#00#, 16#0C#, 16#00#, 16#38#, 16#00#, 16#70#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#1E#, 16#00#, 16#3C#, 16#00#, 16#18#, 16#00#, 16#30#,
16#00#, 16#67#, 16#C0#, 16#CF#, 16#81#, 16#BC#, 16#03#, 16#F0#, 16#07#,
16#C0#, 16#0F#, 16#80#, 16#1F#, 16#80#, 16#37#, 16#80#, 16#67#, 16#83#,
16#C7#, 16#E7#, 16#8F#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#07#, 16#C0#, 16#0F#, 16#80#, 16#03#, 16#00#, 16#06#,
16#00#, 16#0C#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#,
16#C0#, 16#01#, 16#80#, 16#03#, 16#00#, 16#06#, 16#00#, 16#0C#, 16#01#,
16#FF#, 16#C3#, 16#FF#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#03#, 16#FB#, 16#C7#, 16#FF#, 16#C7#, 16#39#, 16#8C#, 16#63#, 16#98#,
16#C7#, 16#31#, 16#8E#, 16#63#, 16#1C#, 16#C6#, 16#39#, 16#8C#, 16#77#,
16#DE#, 16#FF#, 16#BD#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#01#, 16#EF#, 16#03#, 16#FF#, 16#03#, 16#C7#, 16#07#, 16#06#, 16#0E#,
16#0C#, 16#1C#, 16#18#, 16#38#, 16#30#, 16#70#, 16#60#, 16#E0#, 16#C3#,
16#E7#, 16#E7#, 16#C7#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#1F#, 16#00#, 16#FF#, 16#03#, 16#87#, 16#0E#, 16#07#, 16#1C#,
16#06#, 16#30#, 16#0C#, 16#70#, 16#18#, 16#E0#, 16#70#, 16#E1#, 16#C0#,
16#FF#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#03#, 16#DF#, 16#87#, 16#FF#, 16#83#, 16#C3#, 16#87#, 16#03#, 16#8C#,
16#07#, 16#18#, 16#0E#, 16#38#, 16#1C#, 16#70#, 16#38#, 16#F0#, 16#E1#,
16#FF#, 16#83#, 16#3E#, 16#06#, 16#00#, 16#0C#, 16#00#, 16#18#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#3E#, 16#F1#, 16#FF#, 16#E7#, 16#8F#, 16#0C#, 16#0E#, 16#18#,
16#0C#, 16#70#, 16#18#, 16#60#, 16#30#, 16#E0#, 16#E1#, 16#E3#, 16#C1#,
16#FF#, 16#80#, 16#FB#, 16#00#, 16#06#, 16#00#, 16#0C#, 16#00#, 16#18#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#F9#, 16#E1#, 16#FF#, 16#E0#, 16#F8#, 16#81#, 16#E0#, 16#03#,
16#80#, 16#07#, 16#00#, 16#0E#, 16#00#, 16#1C#, 16#00#, 16#38#, 16#03#,
16#FF#, 16#07#, 16#FE#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#3F#, 16#C0#, 16#FF#, 16#83#, 16#87#, 16#07#, 16#06#, 16#0F#,
16#E0#, 16#0F#, 16#F0#, 16#03#, 16#F0#, 16#60#, 16#70#, 16#E0#, 16#E1#,
16#FF#, 16#83#, 16#FC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#18#, 16#00#, 16#30#,
16#03#, 16#FF#, 16#87#, 16#FF#, 16#01#, 16#80#, 16#03#, 16#00#, 16#06#,
16#00#, 16#0C#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#60#, 16#E0#,
16#FF#, 16#C0#, 16#7E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#03#, 16#E3#, 16#C7#, 16#C7#, 16#83#, 16#83#, 16#07#, 16#06#, 16#0E#,
16#0C#, 16#1C#, 16#18#, 16#38#, 16#30#, 16#70#, 16#60#, 16#61#, 16#C0#,
16#FF#, 16#E0#, 16#FB#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#03#, 16#F3#, 16#F7#, 16#E7#, 16#E3#, 16#83#, 16#03#, 16#0E#, 16#07#,
16#18#, 16#0E#, 16#70#, 16#0E#, 16#C0#, 16#1F#, 16#80#, 16#1F#, 16#00#,
16#3C#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#03#, 16#E1#, 16#F7#, 16#C3#, 16#E7#, 16#39#, 16#86#, 16#77#, 16#0D#,
16#EE#, 16#1F#, 16#D8#, 16#3F#, 16#F0#, 16#3D#, 16#E0#, 16#73#, 16#C0#,
16#E7#, 16#01#, 16#C6#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#01#, 16#F3#, 16#E3#, 16#E7#, 16#C3#, 16#CF#, 16#03#, 16#FC#, 16#03#,
16#F0#, 16#03#, 16#C0#, 16#0F#, 16#C0#, 16#3D#, 16#C0#, 16#E1#, 16#E3#,
16#E7#, 16#E7#, 16#CF#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#01#, 16#F1#, 16#F3#, 16#E3#, 16#E3#, 16#83#, 16#07#, 16#0E#, 16#07#,
16#1C#, 16#0E#, 16#70#, 16#0C#, 16#E0#, 16#1F#, 16#80#, 16#1F#, 16#00#,
16#3C#, 16#00#, 16#38#, 16#00#, 16#60#, 16#01#, 16#C0#, 16#03#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#FF#, 16#C1#, 16#FF#, 16#83#, 16#8E#, 16#02#, 16#3C#, 16#00#,
16#F0#, 16#03#, 16#C0#, 16#0F#, 16#00#, 16#1C#, 16#60#, 16#70#, 16#C1#,
16#FF#, 16#83#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#F0#, 16#03#, 16#80#, 16#06#,
16#00#, 16#0C#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#60#, 16#01#,
16#C0#, 16#0F#, 16#00#, 16#1E#, 16#00#, 16#06#, 16#00#, 16#0C#, 16#00#,
16#18#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#E0#, 16#01#, 16#F0#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#03#, 16#00#, 16#06#,
16#00#, 16#0C#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#,
16#C0#, 16#01#, 16#80#, 16#03#, 16#00#, 16#06#, 16#00#, 16#0C#, 16#00#,
16#18#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#01#, 16#80#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#03#, 16#80#, 16#07#, 16#80#, 16#03#, 16#00#, 16#06#,
16#00#, 16#0C#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#,
16#E0#, 16#00#, 16#F0#, 16#01#, 16#E0#, 16#07#, 16#00#, 16#0C#, 16#00#,
16#18#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#07#, 16#80#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#C3#, 16#0F#,
16#CE#, 16#19#, 16#F8#, 16#30#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#);
Font_D : aliased constant Bitmap_Font :=
(
Bytes_Per_Glyph => 45,
Glyph_Width => 15,
Glyph_Height => 24,
Data => FreeMonoBold12pt7bBitmaps'Access);
Font : constant Bitmap_Font_Ref := Font_D'Access;
end GESTE_Fonts.FreeMonoBold12pt7b;
|
micahwelf/FLTK-Ada | Ada | 1,067 | ads |
package FLTK.Widgets.Valuators.Adjusters is
type Adjuster is new Valuator with private;
type Adjuster_Reference (Data : not null access Adjuster'Class) is
limited null record with Implicit_Dereference => Data;
package Forge is
function Create
(X, Y, W, H : in Integer;
Text : in String)
return Adjuster;
end Forge;
function Is_Soft
(This : in Adjuster)
return Boolean;
procedure Set_Soft
(This : in out Adjuster;
To : in Boolean);
procedure Draw
(This : in out Adjuster);
function Handle
(This : in out Adjuster;
Event : in Event_Kind)
return Event_Outcome;
private
type Adjuster is new Valuator with null record;
overriding procedure Finalize
(This : in out Adjuster);
pragma Inline (Is_Soft);
pragma Inline (Set_Soft);
pragma Inline (Draw);
pragma Inline (Handle);
end FLTK.Widgets.Valuators.Adjusters;
|
reznikmm/matreshka | Ada | 5,361 | 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.Link_End_Creation_Datas.Collections is
pragma Preelaborate;
package UML_Link_End_Creation_Data_Collections is
new AMF.Generic_Collections
(UML_Link_End_Creation_Data,
UML_Link_End_Creation_Data_Access);
type Set_Of_UML_Link_End_Creation_Data is
new UML_Link_End_Creation_Data_Collections.Set with null record;
Empty_Set_Of_UML_Link_End_Creation_Data : constant Set_Of_UML_Link_End_Creation_Data;
type Ordered_Set_Of_UML_Link_End_Creation_Data is
new UML_Link_End_Creation_Data_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_UML_Link_End_Creation_Data : constant Ordered_Set_Of_UML_Link_End_Creation_Data;
type Bag_Of_UML_Link_End_Creation_Data is
new UML_Link_End_Creation_Data_Collections.Bag with null record;
Empty_Bag_Of_UML_Link_End_Creation_Data : constant Bag_Of_UML_Link_End_Creation_Data;
type Sequence_Of_UML_Link_End_Creation_Data is
new UML_Link_End_Creation_Data_Collections.Sequence with null record;
Empty_Sequence_Of_UML_Link_End_Creation_Data : constant Sequence_Of_UML_Link_End_Creation_Data;
private
Empty_Set_Of_UML_Link_End_Creation_Data : constant Set_Of_UML_Link_End_Creation_Data
:= (UML_Link_End_Creation_Data_Collections.Set with null record);
Empty_Ordered_Set_Of_UML_Link_End_Creation_Data : constant Ordered_Set_Of_UML_Link_End_Creation_Data
:= (UML_Link_End_Creation_Data_Collections.Ordered_Set with null record);
Empty_Bag_Of_UML_Link_End_Creation_Data : constant Bag_Of_UML_Link_End_Creation_Data
:= (UML_Link_End_Creation_Data_Collections.Bag with null record);
Empty_Sequence_Of_UML_Link_End_Creation_Data : constant Sequence_Of_UML_Link_End_Creation_Data
:= (UML_Link_End_Creation_Data_Collections.Sequence with null record);
end AMF.UML.Link_End_Creation_Datas.Collections;
|
reznikmm/matreshka | Ada | 4,779 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-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$
------------------------------------------------------------------------------
separate (UAFLEX.Scanners)
procedure On_Accept
(Self : not null access UAFLEX.Handlers.Handler'Class;
Scanner : not null access UAFLEX.Scanners.Scanner'Class;
Rule : UAFLEX.Lexer_Types.Rule_Index;
Token : out Parser_Tokens.Token_Kind;
Skip : in out Boolean) is
begin
case Rule is
when 1 | 6 | 13 | 15 =>
Self.Skip_Line (Scanner, Rule, Token, Skip);
when 2 =>
Self.On_Start (Scanner, Rule, Token, Skip);
when 3 =>
Self.On_Exclusive (Scanner, Rule, Token, Skip);
when 4 =>
Self.On_Name (Scanner, Rule, Token, Skip);
when 5 =>
Self.On_Section_End (Scanner, Rule, Token, Skip);
when 7 | 12 | 18 =>
Self.Skip (Scanner, Rule, Token, Skip);
when 8 =>
Self.On_Regexp (Scanner, Rule, Token, Skip);
when 9 =>
Self.End_Of_Macro (Scanner, Rule, Token, Skip);
when 10 =>
Self.End_Of_Name_List (Scanner, Rule, Token, Skip);
when 11 =>
Self.On_Name_2 (Scanner, Rule, Token, Skip);
when 14 =>
Self.On_Regexp_2 (Scanner, Rule, Token, Skip);
when 16 =>
Self.On_Section_End_2 (Scanner, Rule, Token, Skip);
when 17 =>
Self.On_Action (Scanner, Rule, Token, Skip);
when 19 =>
Self.On_End_Of_Rule (Scanner, Rule, Token, Skip);
when others =>
raise Constraint_Error;
end case;
end On_Accept;
|
burratoo/Acton | Ada | 3,974 | ads | ------------------------------------------------------------------------------------------
-- --
-- OAK COMPONENTS --
-- --
-- OAK.STORAGE.SLIM_PRIORITY_QUEUE --
-- --
-- Copyright (C) 2014-2021, Patrick Bernardi --
-- --
------------------------------------------------------------------------------------------
-- This is a slim priority queue since it doesn't store anything. Instead
-- the Item_Type is used to point not only to the node inside the queue, but
-- also to the item refered to outside the queue.
generic
type Item_Type is mod <>;
No_Item : Item_Type;
with function ">" (Left, Right : Item_Type) return Boolean is <>;
with function ">=" (Left, Right : Item_Type) return Boolean is <>;
-- package Oak.Storage.Slim_Priority_Queue with Pure is
package Oak.Storage.Slim_Priority_Queue is
pragma Pure;
Queue_Capacity_Error : exception;
type Queue_Type is private with Preelaborable_Initialization;
procedure Enqueue_Item (To_Queue : in out Queue_Type;
Item : in Item_Type;
Add_To_Head : in Boolean := False);
-- Adds an item to the priority queue
function Head_Of_Queue (From_Queue : in out Queue_Type) return Item_Type;
procedure Remove_Queue_Head (From_Queue : in out Queue_Type;
Item : out Item_Type);
-- Removes the first item from the priority queue. Returns an empty element
-- if the queue is empty.
procedure Remove_Item (Queue : in out Queue_Type; Node : in Item_Type);
-- Removes the node from the Queue tree. Does not deallocate the node.
private
No_Node_Value : constant := 0;
First_Node_Value : constant := No_Node_Value + 1;
-- The constant that represents the No_Node. Needed to satisfy the
-- preelaborable initialization constraints on the types below. ??? Should
-- check to see if there is a bug in the compiler preventing the direct use
-- of No_Node.
No_Node : constant Item_Type := No_Node_Value;
-- The Item_Type that represents the null node, or that no node exists
-- at all.
type Node_Colour is (Red, Black);
-- Colour of a node in the red-black tree.
type Node_Type is record
-- This type represents a Node in the tree. Each node has a link to its
-- parent to allow a bottom-up transversal of the tree without using
-- recursion. Its presence does not impact of the effective size of the
-- node if the Item_Type and priority types' base type is a byte. On a
-- 32 bit aligned system should be able to pack the infrustructure
-- components into just two registers, or two 32 bit words in memory, with
-- two bytes free.
Colour : Node_Colour := Black;
Parent : Item_Type := No_Node_Value;
Left, Right : Item_Type := No_Node_Value;
end record;
type Node_Array is array (Item_Type) of Node_Type;
type Queue_Type is record
-- This type represents the set which is actually a red-black tree.
Root : Item_Type := No_Node_Value;
-- The node pointing to the root of the tree.
First_Node : Item_Type := No_Node_Value;
First_Node_Valid : Boolean := False;
-- Caches the first node in the priority queue.
Nodes : Node_Array;
-- The node pool. The first node is the No_Node which needs to be
-- initialised here.
end record;
end Oak.Storage.Slim_Priority_Queue;
|
reznikmm/matreshka | Ada | 4,807 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Visitors;
with ODF.DOM.Table_Highlighted_Range_Elements;
package Matreshka.ODF_Table.Highlighted_Range_Elements is
type Table_Highlighted_Range_Element_Node is
new Matreshka.ODF_Table.Abstract_Table_Element_Node
and ODF.DOM.Table_Highlighted_Range_Elements.ODF_Table_Highlighted_Range
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Table_Highlighted_Range_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Table_Highlighted_Range_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Table_Highlighted_Range_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Leave_Node
(Self : not null access Table_Highlighted_Range_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Visit_Node
(Self : not null access Table_Highlighted_Range_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
end Matreshka.ODF_Table.Highlighted_Range_Elements;
|
Fabien-Chouteau/lvgl-ada | Ada | 10,180 | ads | with Lv.Style;
with Lv.Objx.Page;
package Lv.Objx.Canvas is
subtype Instance is Obj_T;
-- Create a canvas object
-- @param par pointer to an object, it will be the parent of the new canvas
-- @param copy pointer to a canvas object, if not NULL then the new object will be copied from it
-- @return pointer to the created canvas
function Create (Par : Obj_T; Copy : Instance) return Instance;
----------------------
-- Setter functions --
----------------------
type Img_CF_T is
(LV_IMG_CF_UNKOWN,
LV_IMG_CF_RAW, -- Contains the file as it is. Needs custom decoder function*/
LV_IMG_CF_RAW_ALPHA, -- Contains the file as it is. The image has alpha. Needs custom decoder function*/
LV_IMG_CF_RAW_CHROMA_KEYED, -- Contains the file as it is. The image is chroma keyed. Needs custom decoder function*/
LV_IMG_CF_TRUE_COLOR, -- Color format and depth should match with LV_COLOR settings*/
LV_IMG_CF_TRUE_COLOR_ALPHA, -- Same as `LV_IMG_CF_TRUE_COLOR` but every pixel has an alpha byte*/
LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED, -- Same as `LV_IMG_CF_TRUE_COLOR` but LV_COLOR_TRANSP pixels will be transparent*/
LV_IMG_CF_INDEXED_1BIT, -- Can have 2 different colors in a palette (always chroma keyed)*/
LV_IMG_CF_INDEXED_2BIT, -- Can have 4 different colors in a palette (always chroma keyed)*/
LV_IMG_CF_INDEXED_4BIT, -- Can have 16 different colors in a palette (always chroma keyed)*/
LV_IMG_CF_INDEXED_8BIT, -- Can have 256 different colors in a palette (always chroma keyed)*/
LV_IMG_CF_ALPHA_1BIT, -- Can have one color and it can be drawn or not*/
LV_IMG_CF_ALPHA_2BIT, -- Can have one color but 4 different alpha value*/
LV_IMG_CF_ALPHA_4BIT, -- Can have one color but 16 different alpha value*/
LV_IMG_CF_ALPHA_8BIT); -- Can have one color but 256 different alpha value*/
pragma Convention (C, Img_CF_T);
-- Set a buffer for the canvas.
-- @param buf a buffer where the content of the canvas will be.
-- The required size is (lv_img_color_format_get_px_size(cf) * w * h) / 8)
-- It can be allocated with `lv_mem_alloc()` or
-- it can be statically allocated array (e.g. static lv_color_t buf[100*50]) or
-- it can be an address in RAM or external SRAM
-- @param canvas pointer to a canvas object
-- @param w width of the canvas
-- @param h height of the canvas
-- @param cf color format. The following formats are supported:
-- LV_IMG_CF_TRUE_COLOR, LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED, LV_IMG_CF_INDEXES_1/2/4/8BIT
procedure Set_Buffer (Self : Instance;
Buf : System.Address;
W, H : Lv.Area.Coord_T;
CF : Img_CF_T);
-- Set the color of a pixel on the canvas
-- @param canvas
-- @param x x coordinate of the point to set
-- @param y x coordinate of the point to set
-- @param c color of the point
procedure Set_Px(Self : Instance;
X, Y : Lv.Area.Coord_T;
C : Lv.Color.Color_T);
-- /**
-- * Set a style of a canvas.
-- * @param canvas pointer to canvas object
-- * @param type which style should be set
-- * @param style pointer to a style
-- */
-- void lv_canvas_set_style(lv_obj_t * canvas, lv_canvas_style_t type, lv_style_t * style);
--
----------------------
-- Getter functions --
----------------------
-- Get the color of a pixel on the canvas
-- @param canvas
-- @param x x coordinate of the point to set
-- @param y x coordinate of the point to set
-- @return color of the point
function Get_Px(Self : Instance;
X, Y : Lv.Area.Coord_T)
return Lv.Color.Color_T;
-- /**
-- * Get style of a canvas.
-- * @param canvas pointer to canvas object
-- * @param type which style should be get
-- * @return style pointer to the style
-- */
-- lv_style_t * lv_canvas_get_style(const lv_obj_t * canvas, lv_canvas_style_t type);
---------------------
-- Other functions --
---------------------
-- Copy a buffer to the canvas
-- @param canvas pointer to a canvas object
-- @param to_copy buffer to copy. The color format has to match with the canvas's buffer color format
-- @param w width of the buffer to copy
-- @param h height of the buffer to copy
-- @param x left side of the destination position
-- @param y top side of the destination position
procedure Copy_Buf(Self : Instance;
To_Copy : System.Address;
W, H, X, Y : Lv.Area.Coord_T);
-- Multiply a buffer with the canvas
-- @param canvas pointer to a canvas object
-- @param to_copy buffer to copy (multiply). LV_IMG_CF_TRUE_COLOR_ALPHA is not supported
-- @param w width of the buffer to copy
-- @param h height of the buffer to copy
-- @param x left side of the destination position
-- @param y top side of the destination position
procedure Mult_Buf(Self : Instance;
To_Copy : System.Address;
W, H, X, Y : Lv.Area.Coord_T);
-- Draw circle function of the canvas
-- @param canvas pointer to a canvas object
-- @param x0 x coordinate of the circle
-- @param y0 y coordinate of the circle
-- @param radius radius of the circle
-- @param color border color of the circle
procedure Draw_Circle(Self : Instance;
X0, Y0, Radius : Lv.Area.Coord_T;
Color : Lv.Color.Color_T);
-- Draw line function of the canvas
-- @param canvas pointer to a canvas object
-- @param point1 start point of the line
-- @param point2 end point of the line
-- @param color color of the line
--
-- NOTE: The lv_canvas_draw_line function originates from https://github.com/jb55/bresenham-line.c.
procedure Draw_Line(Self : Instance;
Point1, Point2 : Lv.Area.Point_T;
Color : Lv.Color.Color_T);
-- Draw triangle function of the canvas
-- @param canvas pointer to a canvas object
-- @param points edge points of the triangle
-- @param color line color of the triangle
type Triangle_Points is array (1 .. 3) of Lv.Area.Point_T
with Convention => C;
procedure Draw_Triangle(Self : Instance;
Points : not null access constant Triangle_Points;
Color : Lv.Color.Color_T);
-- Draw rectangle function of the canvas
-- @param canvas pointer to a canvas object
-- @param points edge points of the rectangle
-- @param color line color of the rectangle
type Rectangle_Points is array (1 .. 4) of Lv.Area.Point_T
with Convention => C;
procedure Draw_Rect (Self : Instance;
Points : not null access constant Rectangle_Points;
Color : Lv.Color.Color_T);
-- Draw polygon function of the canvas
-- @param canvas pointer to a canvas object
-- @param points edge points of the polygon
-- @param size edge count of the polygon
-- @param color line color of the polygon
type Poly_Points is array (Natural range <>) of Lv.Area.Point_T
with Convention => C;
procedure Draw_Polygon(Self : Instance;
Points : not null access constant Poly_Points;
Size : Natural;
Color : Lv.Color.Color_T);
-- Fill polygon function of the canvas
-- @param canvas pointer to a canvas object
-- @param points edge points of the polygon
-- @param size edge count of the polygon
-- @param boundary_color line color of the polygon
-- @param fill_color fill color of the polygon
procedure Fill_Polygon(Self : Instance;
Points : not null access constant Poly_Points;
Size : Natural;
Boundary_Color, Fill_Color : Lv.Color.Color_T);
-- Boundary fill function of the canvas
-- @param canvas pointer to a canvas object
-- @param x x coordinate of the start position (seed)
-- @param y y coordinate of the start position (seed)
-- @param boundary_color edge/boundary color of the area
-- @param fill_color fill color of the area
procedure Boundary_Fill4(Self : Instance;
X, Y : Lv.Area.Coord_T;
Boundary_Color, Fill_Color : Lv.Color.Color_T);
-- Flood fill function of the canvas
-- @param canvas pointer to a canvas object
-- @param x x coordinate of the start position (seed)
-- @param y y coordinate of the start position (seed)
-- @param fill_color fill color of the area
-- @param bg_color background color of the area
procedure Flood_Fill(Self : Instance;
X, Y : Lv.Area.Coord_T;
Fill_Color, BG_Color : Lv.Color.Color_T);
-------------
-- Imports --
-------------
pragma Import (C, Create, "lv_canvas_create");
pragma Import (C, Set_Buffer, "lv_canvas_set_buffer");
pragma Import (C, Set_Px, "lv_canvas_set_px");
-- pragma Import (C, Set_Style, "lv_canvas_set_style");
pragma Import (C, Get_Px, "lv_canvas_get_px");
-- pragma Import (C, Get_Style, "lv_canvas_get_style");
pragma Import (C, Copy_Buf, "lv_canvas_copy_buf");
pragma Import (C, Mult_Buf, "lv_canvas_mult_buf");
pragma Import (C, Draw_Circle, "lv_canvas_draw_circle");
pragma Import (C, Draw_Line, "lv_canvas_draw_line");
pragma Import (C, Draw_Triangle, "lv_canvas_draw_triangle");
pragma Import (C, Draw_Rect, "lv_canvas_draw_rect");
pragma Import (C, Draw_Polygon, "lv_canvas_draw_polygon");
pragma Import (C, Fill_Polygon, "lv_canvas_fill_polygon");
pragma Import (C, Boundary_Fill4, "lv_canvas_boundary_fill4");
pragma Import (C, Flood_Fill, "lv_canvas_flood_fill");
end Lv.Objx.Canvas;
|
meowthsli/EVB1000 | Ada | 8,542 | adb | -------------------------------------------------------------------------------
-- Copyright (c) 2016 Daniel King
--
-- 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.Real_Time;
with Interfaces; use Interfaces;
with STM32.GPIO;
with STM32.RCC;
with STM32.SPI;
package body EVB1000.LCD
with SPARK_Mode => Off
is
RW_Pin : constant Integer := 10;
RS_Pin : constant Integer := 11;
CS_Pin : constant Integer := 12;
MISO_Pin : constant Integer := 14;
procedure Set_RS(State : in STM32.Bit)
is
use type STM32.Bit;
begin
if State = 1 then
STM32.GPIO.GPIOB_Periph.BSRR.BS :=
STM32.GPIO.BSRR_BS_Field'(As_Array => True,
Arr => (RS_Pin => 1, others => 0));
else
STM32.GPIO.GPIOB_Periph.BSRR.BR :=
STM32.GPIO.BSRR_BR_Field'(As_Array => True,
Arr => (RS_Pin => 1, others => 0));
end if;
end Set_RS;
procedure Select_LCD
is
begin
STM32.GPIO.GPIOB_Periph.BSRR.BR :=
STM32.GPIO.BSRR_BR_Field'(As_Array => True,
Arr => (CS_Pin => 1, others => 0));
end Select_LCD;
procedure Deselect_LCD
is
begin
STM32.GPIO.GPIOB_Periph.BSRR.BS :=
STM32.GPIO.BSRR_BS_Field'(As_Array => True,
Arr => (CS_Pin => 1, others => 0));
end Deselect_LCD;
-- Send data to the LCD via the SPI bus.
--
-- When RS is set to True the RS pin is asserted during the SPI transaction
procedure Send_To_LCD(RS : in Boolean;
Data : in String)
with Pre => Data'Length > 0 and Data'Length <= 80
is
use type Ada.Real_Time.Time;
use type Ada.Real_Time.Time_Span;
use type STM32.Bit;
First_Byte : Unsigned_8 := Unsigned_8 (Character'Pos (Data (Data'First)));
Delay_Time : Ada.Real_Time.Time_Span := Ada.Real_Time.Time_Span_Zero;
Delay_End : Ada.Real_Time.Time;
begin
Set_RS (if RS then 1 else 0);
if (not RS) and ((First_Byte and 3) /= 0) then
-- If the command = 1 or 2 then the execution time is > 1 ms
Delay_Time := Ada.Real_Time.Milliseconds(2);
end if;
Select_LCD;
for I in Data'Range loop
loop
exit when STM32.SPI.SPI2_Periph.SR.TXE = 1;
end loop;
STM32.SPI.SPI2_Periph.DR.DR := Unsigned_16 (Character'Pos (Data (I)));
end loop;
-- Wait for last byte to finish transmitting
loop
exit when STM32.SPI.SPI2_Periph.SR.BSY = 0;
end loop;
Set_RS (0);
Deselect_LCD;
if Delay_Time > Ada.Real_Time.Time_Span_Zero then
Delay_End := Ada.Real_Time.Clock + Delay_Time;
-- Don't use 'delay until' so that this procedure can be called from
-- protected objects.
loop
exit when Ada.Real_Time.Clock >= Delay_End;
end loop;
end if;
end Send_To_LCD;
-- Send the command to the LCD to reset the cursor back to the origin.
procedure Cursor_Home
is
Command : constant String(1 .. 1) := (others => Character'Val (2));
begin
Send_To_LCD (RS => False,
Data => Command);
end Cursor_Home;
protected body Driver_Type
is
procedure Clear_LCD
is
Command : constant String(1 .. 1) := (others => Character'Val (1));
begin
Send_To_LCD (RS => False,
Data => Command);
end Clear_LCD;
procedure Put(Text_1 : in String;
Text_2 : in String)
is
Data : String (1 .. 80) := (others => ' ');
begin
Clear_LCD;
Cursor_Home;
Data (1 .. Text_1'Length) := Text_1;
Data (41 .. 40 + Text_2'Length) := Text_2;
Send_To_LCD (RS => True,
Data => Data);
end Put;
end Driver_Type;
begin
-- Enable SPI and GPIO peripheral clocks
STM32.RCC.RCC_Periph.APB2ENR.IOPBEN := 1;
STM32.RCC.RCC_Periph.APB2ENR.AFIOEN := 1;
STM32.RCC.RCC_Periph.APB1ENR.SPI2EN := 1;
-- Configure GPIO pins
STM32.GPIO.GPIOB_Periph.CRH.MODE10 := 2#11#;
STM32.GPIO.GPIOB_Periph.CRH.MODE11 := 2#11#;
STM32.GPIO.GPIOB_Periph.CRH.MODE12 := 2#11#;
STM32.GPIO.GPIOB_Periph.CRH.MODE13 := 2#11#;
STM32.GPIO.GPIOB_Periph.CRH.MODE14 := 2#00#;
STM32.GPIO.GPIOB_Periph.CRH.MODE15 := 2#11#;
STM32.GPIO.GPIOB_Periph.CRH.CNF10 := 2#00#;
STM32.GPIO.GPIOB_Periph.CRH.CNF11 := 2#00#;
STM32.GPIO.GPIOB_Periph.CRH.CNF12 := 2#00#;
STM32.GPIO.GPIOB_Periph.CRH.CNF13 := 2#10#;
STM32.GPIO.GPIOB_Periph.CRH.CNF14 := 2#10#;
STM32.GPIO.GPIOB_Periph.CRH.CNF15 := 2#10#;
-- Deselect LCD
STM32.GPIO.GPIOB_Periph.BSRR.BS :=
(As_Array => True,
Arr => (CS_Pin => 1, -- Deselect LCD
MISO_Pin => 1, -- Enable pull-up
others => 0));
-- Clear LCD RS + RW lines
STM32.GPIO.GPIOB_Periph.BSRR.BR :=
(As_Array => True,
Arr => (RW_Pin => 1,
RS_Pin => 1,
others => 0));
-- Reset SPI
STM32.RCC.RCC_Periph.APB1RSTR.SPI2RST := 1;
STM32.RCC.RCC_Periph.APB1RSTR.SPI2RST := 0;
-- Configure SPI
STM32.SPI.SPI2_Periph.CR1 := (CPHA => 1,
CPOL => 1,
MSTR => 1,
BR => 2#110#, -- /128 prescaler
SPE => 0,
LSBFIRST => 0, -- MSB first
SSI => 1,
SSM => 1,
RXONLY => 0, -- Full duplex
DFF => 0, -- 8-bit data
CRCNEXT => 0,
CRCEN => 0, -- No CRC
BIDIOE => 0,
BIDIMODE => 0, -- Bidirectional
Reserved_16_31 => 0);
STM32.SPI.SPI2_Periph.CRCPR.CRCPOLY := 7;
STM32.SPI.SPI2_Periph.CR1.SPE := 1;
-- Send init sequence
declare
use type Ada.Real_Time.Time;
-- These constants have been ported from the DecaWave C code.
Init_Sequence : constant String(1 .. 9) :=
(1 => Character'Val (16#39#),
2 => Character'Val (16#14#),
3 => Character'Val (16#55#),
4 => Character'Val (16#6D#),
5 => Character'Val (16#78#),
6 => Character'Val (16#38#),
7 => Character'Val (16#0C#),
8 => Character'Val (16#01#),
9 => Character'Val (16#06#));
Now : Ada.Real_Time.Time;
begin
-- Give some time for the LCD to start-up before sending the init seq.
Now := Ada.Real_Time.Clock;
delay until Now + Ada.Real_Time.Milliseconds(10);
Send_To_LCD (RS => False,
Data => Init_Sequence);
-- Leave some more time for the init sequence to finish.
Now := Ada.Real_Time.Clock;
delay until Now + Ada.Real_Time.Milliseconds(2);
end;
end EVB1000.LCD;
|
reznikmm/matreshka | Ada | 6,782 | 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_Office.Text_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Office_Text_Element_Node is
begin
return Self : Office_Text_Element_Node do
Matreshka.ODF_Office.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Office_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Office_Text_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_Office_Text
(ODF.DOM.Office_Text_Elements.ODF_Office_Text_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 Office_Text_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Text_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Office_Text_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_Office_Text
(ODF.DOM.Office_Text_Elements.ODF_Office_Text_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 Office_Text_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_Office_Text
(Visitor,
ODF.DOM.Office_Text_Elements.ODF_Office_Text_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.Office_URI,
Matreshka.ODF_String_Constants.Text_Element,
Office_Text_Element_Node'Tag);
end Matreshka.ODF_Office.Text_Elements;
|
AdaCore/langkit | Ada | 1,255 | adb | with Ada.Text_IO; use Ada.Text_IO;
with Langkit_Support.Text; use Langkit_Support.Text;
with Libfoolang.Analysis; use Libfoolang.Analysis;
with Libfoolang.Common; use Libfoolang.Common;
procedure Main is
Ctx : constant Analysis_Context := Create_Context;
U : constant Analysis_Unit := Ctx.Get_From_Buffer
(Filename => "main.txt",
Buffer =>
"def a0 = 2"
& ASCII.LF & "def a = 10000000000000000000000000000000"
& ASCII.LF & "def b = a + 1"
& ASCII.LF & "def c = b - 1"
& ASCII.LF
& ASCII.LF & "def d = a = b"
& ASCII.LF & "def e = a = c"
& ASCII.LF & "def f = a < b"
& ASCII.LF & "def g = a < c");
begin
Put_Line ("main.adb: Running...");
if U.Has_Diagnostics then
raise Program_Error;
end if;
Put_Line ("P_Check_Big_Literal: " & U.Root.P_Check_Big_Literal.Image);
for I in 1 .. U.Root.Children_Count loop
declare
D : constant Decl := U.Root.Child (I).As_Decl;
E : constant Expr := D.F_Expr_Tree;
BI : constant Big_Integer := E.P_Evaluate;
begin
Put_Line (Image (D.F_Name.Text) & " evaluates to " & BI.Image);
end;
end loop;
Put_Line ("main.adb: Done.");
end Main;
|
xeenta/learning-ada | Ada | 624 | adb | package body Animals.Flying_Horses is
function Make (Horse_Color : Color) return Flying_Horse is
R : Flying_Horse;
begin
R.Number_Of_Wings := 2;
R.Number_Of_Legs := 4;
R.Fur_Color := Horse_Color;
return R;
end Make;
-- these are perfect animals, you won't mess with their wings or legs!
overriding
procedure Add_Wings (A : in out Flying_Horse;
N : Positive) is
begin
null;
end Add_Wings;
overriding
procedure Add_Legs (A : in out Flying_Horse;
N : Positive) is
begin
null;
end Add_Legs;
end Animals.Flying_Horses;
|
ivanhawkes/Chrysalis | Ada | 1,417 | adb | <AnimDB FragDef="chrysalis/objects/desk/workdesk/fragment_ids.xml" TagDef="chrysalis/objects/desk/workdesk/tags.xml">
<FragmentList>
<Interact>
<Fragment BlendOutDuration="0.2" Tags="ScopeSlave">
<AnimLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.2"/>
<Animation name="drawer_top_open"/>
</AnimLayer>
</Fragment>
</Interact>
<Closed>
<Fragment BlendOutDuration="0.2" Tags="ScopeSlave">
<AnimLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.2"/>
<Animation name="door_close"/>
</AnimLayer>
</Fragment>
<Fragment BlendOutDuration="0.2" Tags=""/>
</Closed>
<Open>
<Fragment BlendOutDuration="0.2" Tags="ScopeSlave">
<AnimLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.2"/>
<Animation name="drawer_bottom_open"/>
</AnimLayer>
</Fragment>
<Fragment BlendOutDuration="0.2" Tags=""/>
</Open>
<Opening>
<Fragment BlendOutDuration="0.2" Tags="ScopeSlave">
<AnimLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.2"/>
<Animation name="drawer_top_open"/>
</AnimLayer>
</Fragment>
</Opening>
<Closing>
<Fragment BlendOutDuration="0.2" Tags="ScopeSlave">
<AnimLayer>
<Blend ExitTime="0" StartTime="0" Duration="0.2"/>
<Animation name="drawer_top_close"/>
</AnimLayer>
</Fragment>
<Fragment BlendOutDuration="0.2" Tags=""/>
</Closing>
</FragmentList>
</AnimDB>
|
Rodeo-McCabe/orka | Ada | 1,707 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2013 Felix Krause <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package Glfw.Errors is
pragma Preelaborate;
type Kind is (Not_Initialized,
No_Current_Context,
Invalid_Enum,
Invalid_Value,
Out_Of_Memory,
API_Unavailable,
Version_Unavailable,
Platform_Error,
Format_Unavailable);
type Callback is access procedure (Error : Kind; Description : String);
procedure Set_Callback (Handler : Callback);
private
for Kind use (Not_Initialized => 16#00010001#,
No_Current_Context => 16#00010002#,
Invalid_Enum => 16#00010003#,
Invalid_Value => 16#00010004#,
Out_Of_Memory => 16#00010005#,
API_Unavailable => 16#00010006#,
Version_Unavailable => 16#00010007#,
Platform_Error => 16#00010008#,
Format_Unavailable => 16#00010009#);
for Kind'Size use Interfaces.C.int'Size;
end Glfw.Errors;
|
DrenfongWong/tkm-rpc | Ada | 284 | ads | with Tkmrpc.Request;
with Tkmrpc.Response;
package Tkmrpc.Operation_Handlers.Ike.Esa_Create_First is
procedure Handle (Req : Request.Data_Type; Res : out Response.Data_Type);
-- Handler for the esa_create_first operation.
end Tkmrpc.Operation_Handlers.Ike.Esa_Create_First;
|
reznikmm/matreshka | Ada | 14,830 | 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.
------------------------------------------------------------------------------
-- Operation specializes TemplateableElement in order to support
-- specification of template operations and bound operations. Operation
-- specializes ParameterableElement to specify that an operation can be
-- exposed as a formal template parameter, and provided as an actual
-- parameter in a binding of a template.
--
-- An operation may invoke both the execution of method behaviors as well as
-- other behavioral responses.
--
-- An operation is a behavioral feature of a classifier that specifies the
-- name, type, parameters, and constraints for invoking an associated
-- behavior.
------------------------------------------------------------------------------
with AMF.UML.Behavioral_Features;
limited with AMF.UML.Classes;
limited with AMF.UML.Constraints.Collections;
limited with AMF.UML.Data_Types;
limited with AMF.UML.Interfaces;
limited with AMF.UML.Operation_Template_Parameters;
limited with AMF.UML.Operations.Collections;
with AMF.UML.Parameterable_Elements;
limited with AMF.UML.Parameters.Collections;
limited with AMF.UML.Redefinable_Elements;
with AMF.UML.Templateable_Elements;
limited with AMF.UML.Types.Collections;
package AMF.UML.Operations is
pragma Preelaborate;
type UML_Operation is limited interface
and AMF.UML.Behavioral_Features.UML_Behavioral_Feature
and AMF.UML.Templateable_Elements.UML_Templateable_Element
and AMF.UML.Parameterable_Elements.UML_Parameterable_Element;
type UML_Operation_Access is
access all UML_Operation'Class;
for UML_Operation_Access'Storage_Size use 0;
not overriding function Get_Body_Condition
(Self : not null access constant UML_Operation)
return AMF.UML.Constraints.UML_Constraint_Access is abstract;
-- Getter of Operation::bodyCondition.
--
-- An optional Constraint on the result values of an invocation of this
-- Operation.
not overriding procedure Set_Body_Condition
(Self : not null access UML_Operation;
To : AMF.UML.Constraints.UML_Constraint_Access) is abstract;
-- Setter of Operation::bodyCondition.
--
-- An optional Constraint on the result values of an invocation of this
-- Operation.
not overriding function Get_Class
(Self : not null access constant UML_Operation)
return AMF.UML.Classes.UML_Class_Access is abstract;
-- Getter of Operation::class.
--
-- The class that owns the operation.
not overriding procedure Set_Class
(Self : not null access UML_Operation;
To : AMF.UML.Classes.UML_Class_Access) is abstract;
-- Setter of Operation::class.
--
-- The class that owns the operation.
not overriding function Get_Datatype
(Self : not null access constant UML_Operation)
return AMF.UML.Data_Types.UML_Data_Type_Access is abstract;
-- Getter of Operation::datatype.
--
-- The DataType that owns this Operation.
not overriding procedure Set_Datatype
(Self : not null access UML_Operation;
To : AMF.UML.Data_Types.UML_Data_Type_Access) is abstract;
-- Setter of Operation::datatype.
--
-- The DataType that owns this Operation.
not overriding function Get_Interface
(Self : not null access constant UML_Operation)
return AMF.UML.Interfaces.UML_Interface_Access is abstract;
-- Getter of Operation::interface.
--
-- The Interface that owns this Operation.
not overriding procedure Set_Interface
(Self : not null access UML_Operation;
To : AMF.UML.Interfaces.UML_Interface_Access) is abstract;
-- Setter of Operation::interface.
--
-- The Interface that owns this Operation.
not overriding function Get_Is_Ordered
(Self : not null access constant UML_Operation)
return Boolean is abstract;
-- Getter of Operation::isOrdered.
--
-- This information is derived from the return result for this Operation.
-- Specifies whether the return parameter is ordered or not, if present.
not overriding function Get_Is_Query
(Self : not null access constant UML_Operation)
return Boolean is abstract;
-- Getter of Operation::isQuery.
--
-- Specifies whether an execution of the BehavioralFeature leaves the
-- state of the system unchanged (isQuery=true) or whether side effects
-- may occur (isQuery=false).
not overriding procedure Set_Is_Query
(Self : not null access UML_Operation;
To : Boolean) is abstract;
-- Setter of Operation::isQuery.
--
-- Specifies whether an execution of the BehavioralFeature leaves the
-- state of the system unchanged (isQuery=true) or whether side effects
-- may occur (isQuery=false).
not overriding function Get_Is_Unique
(Self : not null access constant UML_Operation)
return Boolean is abstract;
-- Getter of Operation::isUnique.
--
-- This information is derived from the return result for this Operation.
-- Specifies whether the return parameter is unique or not, if present.
not overriding function Get_Lower
(Self : not null access constant UML_Operation)
return AMF.Optional_Integer is abstract;
-- Getter of Operation::lower.
--
-- Specifies the lower multiplicity of the return parameter, if present.
-- This information is derived from the return result for this Operation.
overriding function Get_Owned_Parameter
(Self : not null access constant UML_Operation)
return AMF.UML.Parameters.Collections.Ordered_Set_Of_UML_Parameter is abstract;
-- Getter of Operation::ownedParameter.
--
-- Specifies the ordered set of formal parameters of this
-- BehavioralFeature.
-- Specifies the parameters owned by this Operation.
not overriding function Get_Postcondition
(Self : not null access constant UML_Operation)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is abstract;
-- Getter of Operation::postcondition.
--
-- An optional set of Constraints specifying the state of the system when
-- the Operation is completed.
not overriding function Get_Precondition
(Self : not null access constant UML_Operation)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is abstract;
-- Getter of Operation::precondition.
--
-- An optional set of Constraints on the state of the system when the
-- Operation is invoked.
overriding function Get_Raised_Exception
(Self : not null access constant UML_Operation)
return AMF.UML.Types.Collections.Set_Of_UML_Type is abstract;
-- Getter of Operation::raisedException.
--
-- References the Types representing exceptions that may be raised during
-- an invocation of this operation.
not overriding function Get_Redefined_Operation
(Self : not null access constant UML_Operation)
return AMF.UML.Operations.Collections.Set_Of_UML_Operation is abstract;
-- Getter of Operation::redefinedOperation.
--
-- References the Operations that are redefined by this Operation.
not overriding function Get_Template_Parameter
(Self : not null access constant UML_Operation)
return AMF.UML.Operation_Template_Parameters.UML_Operation_Template_Parameter_Access is abstract;
-- Getter of Operation::templateParameter.
--
-- The template parameter that exposes this element as a formal parameter.
not overriding procedure Set_Template_Parameter
(Self : not null access UML_Operation;
To : AMF.UML.Operation_Template_Parameters.UML_Operation_Template_Parameter_Access) is abstract;
-- Setter of Operation::templateParameter.
--
-- The template parameter that exposes this element as a formal parameter.
not overriding function Get_Type
(Self : not null access constant UML_Operation)
return AMF.UML.Types.UML_Type_Access is abstract;
-- Getter of Operation::type.
--
-- This information is derived from the return result for this Operation.
-- Specifies the return result of the operation, if present.
not overriding function Get_Upper
(Self : not null access constant UML_Operation)
return AMF.Optional_Unlimited_Natural is abstract;
-- Getter of Operation::upper.
--
-- Specifies the upper multiplicity of the return parameter, if present.
-- This information is derived from the return result for this Operation.
overriding function Is_Consistent_With
(Self : not null access constant UML_Operation;
Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is abstract;
-- Operation Operation::isConsistentWith.
--
-- A redefining operation is consistent with a redefined operation if it
-- has the same number of owned parameters, and the type of each owned
-- parameter conforms to the type of the corresponding redefined parameter.
-- The query isConsistentWith() specifies, for any two Operations in a
-- context in which redefinition is possible, whether redefinition would
-- be consistent in the sense of maintaining type covariance. Other senses
-- of consistency may be required, for example to determine consistency in
-- the sense of contravariance. Users may define alternative queries under
-- names different from 'isConsistentWith()', as for example, users may
-- define a query named 'isContravariantWith()'.
not overriding function Is_Ordered
(Self : not null access constant UML_Operation)
return Boolean is abstract;
-- Operation Operation::isOrdered.
--
-- If this operation has a return parameter, isOrdered equals the value of
-- isOrdered for that parameter. Otherwise isOrdered is false.
not overriding function Is_Unique
(Self : not null access constant UML_Operation)
return Boolean is abstract;
-- Operation Operation::isUnique.
--
-- If this operation has a return parameter, isUnique equals the value of
-- isUnique for that parameter. Otherwise isUnique is true.
not overriding function Lower
(Self : not null access constant UML_Operation)
return Integer is abstract;
-- Operation Operation::lower.
--
-- If this operation has a return parameter, lower equals the value of
-- lower for that parameter. Otherwise lower is not defined.
not overriding function Return_Result
(Self : not null access constant UML_Operation)
return AMF.UML.Parameters.Collections.Set_Of_UML_Parameter is abstract;
-- Operation Operation::returnResult.
--
-- The query returnResult() returns the set containing the return
-- parameter of the Operation if one exists, otherwise, it returns an
-- empty set
not overriding function Types
(Self : not null access constant UML_Operation)
return AMF.UML.Types.UML_Type_Access is abstract;
-- Operation Operation::type.
--
-- If this operation has a return parameter, type equals the value of type
-- for that parameter. Otherwise type is not defined.
not overriding function Upper
(Self : not null access constant UML_Operation)
return AMF.Unlimited_Natural is abstract;
-- Operation Operation::upper.
--
-- If this operation has a return parameter, upper equals the value of
-- upper for that parameter. Otherwise upper is not defined.
end AMF.UML.Operations;
|
AenBleidd/rappture-runtime | Ada | 16,904 | ads | ----------------------------------------------------------------
-- ZLib for Ada thick binding. --
-- --
-- Copyright (C) 2002-2003 Dmitriy Anisimkov --
-- --
-- Open source license information is in the zlib.ads file. --
----------------------------------------------------------------
-- $Id: zlib-thin.ads,v 1.1 2004/08/12 20:24:12 andreas_kupries Exp $
with Interfaces.C.Strings;
with System.Address_To_Access_Conversions;
private package ZLib.Thin is
-- From zconf.h
MAX_MEM_LEVEL : constant := 9; -- zconf.h:105
-- zconf.h:105
MAX_WBITS : constant := 15; -- zconf.h:115
-- 32K LZ77 window
-- zconf.h:115
SEEK_SET : constant := 8#0000#; -- zconf.h:244
-- Seek from beginning of file.
-- zconf.h:244
SEEK_CUR : constant := 1; -- zconf.h:245
-- Seek from current position.
-- zconf.h:245
SEEK_END : constant := 2; -- zconf.h:246
-- Set file pointer to EOF plus "offset"
-- zconf.h:246
type Byte is new Interfaces.C.unsigned_char; -- 8 bits
-- zconf.h:214
type UInt is new Interfaces.C.unsigned; -- 16 bits or more
-- zconf.h:216
type Int is new Interfaces.C.int;
type ULong is new Interfaces.C.unsigned; -- 32 bits or more
-- zconf.h:217
subtype Chars_Ptr is Interfaces.C.Strings.chars_ptr;
type ULong_Access is access ULong;
type Int_Access is access Int;
subtype Voidp is System.Address; -- zconf.h:232
package Bytes is new System.Address_To_Access_Conversions (Byte);
subtype Byte_Access is Bytes.Object_Pointer;
-- end from zconf
Z_NO_FLUSH : constant := 8#0000#; -- zlib.h:125
-- zlib.h:125
Z_PARTIAL_FLUSH : constant := 1; -- zlib.h:126
-- will be removed, use
-- Z_SYNC_FLUSH instead
-- zlib.h:126
Z_SYNC_FLUSH : constant := 2; -- zlib.h:127
-- zlib.h:127
Z_FULL_FLUSH : constant := 3; -- zlib.h:128
-- zlib.h:128
Z_FINISH : constant := 4; -- zlib.h:129
-- zlib.h:129
Z_OK : constant := 8#0000#; -- zlib.h:132
-- zlib.h:132
Z_STREAM_END : constant := 1; -- zlib.h:133
-- zlib.h:133
Z_NEED_DICT : constant := 2; -- zlib.h:134
-- zlib.h:134
Z_ERRNO : constant := -1; -- zlib.h:135
-- zlib.h:135
Z_STREAM_ERROR : constant := -2; -- zlib.h:136
-- zlib.h:136
Z_DATA_ERROR : constant := -3; -- zlib.h:137
-- zlib.h:137
Z_MEM_ERROR : constant := -4; -- zlib.h:138
-- zlib.h:138
Z_BUF_ERROR : constant := -5; -- zlib.h:139
-- zlib.h:139
Z_VERSION_ERROR : constant := -6; -- zlib.h:140
-- zlib.h:140
Z_NO_COMPRESSION : constant := 8#0000#; -- zlib.h:145
-- zlib.h:145
Z_BEST_SPEED : constant := 1; -- zlib.h:146
-- zlib.h:146
Z_BEST_COMPRESSION : constant := 9; -- zlib.h:147
-- zlib.h:147
Z_DEFAULT_COMPRESSION : constant := -1; -- zlib.h:148
-- zlib.h:148
Z_FILTERED : constant := 1; -- zlib.h:151
-- zlib.h:151
Z_HUFFMAN_ONLY : constant := 2; -- zlib.h:152
-- zlib.h:152
Z_DEFAULT_STRATEGY : constant := 8#0000#; -- zlib.h:153
-- zlib.h:153
Z_BINARY : constant := 8#0000#; -- zlib.h:156
-- zlib.h:156
Z_ASCII : constant := 1; -- zlib.h:157
-- zlib.h:157
Z_UNKNOWN : constant := 2; -- zlib.h:158
-- zlib.h:158
Z_DEFLATED : constant := 8; -- zlib.h:161
-- zlib.h:161
Z_NULL : constant := 8#0000#; -- zlib.h:164
-- for initializing zalloc, zfree, opaque
-- zlib.h:164
type gzFile is new Voidp; -- zlib.h:646
type Z_Stream is private;
type Z_Streamp is access all Z_Stream; -- zlib.h:89
type alloc_func is access function
(Opaque : Voidp;
Items : UInt;
Size : UInt)
return Voidp; -- zlib.h:63
type free_func is access procedure (opaque : Voidp; address : Voidp);
function zlibVersion return Chars_Ptr;
function Deflate (strm : Z_Streamp; flush : Int) return Int;
function DeflateEnd (strm : Z_Streamp) return Int;
function Inflate (strm : Z_Streamp; flush : Int) return Int;
function InflateEnd (strm : Z_Streamp) return Int;
function deflateSetDictionary
(strm : Z_Streamp;
dictionary : Byte_Access;
dictLength : UInt)
return Int;
function deflateCopy (dest : Z_Streamp; source : Z_Streamp) return Int;
-- zlib.h:478
function deflateReset (strm : Z_Streamp) return Int; -- zlib.h:495
function deflateParams
(strm : Z_Streamp;
level : Int;
strategy : Int)
return Int; -- zlib.h:506
function inflateSetDictionary
(strm : Z_Streamp;
dictionary : Byte_Access;
dictLength : UInt)
return Int; -- zlib.h:548
function inflateSync (strm : Z_Streamp) return Int; -- zlib.h:565
function inflateReset (strm : Z_Streamp) return Int; -- zlib.h:580
function compress
(dest : Byte_Access;
destLen : ULong_Access;
source : Byte_Access;
sourceLen : ULong)
return Int; -- zlib.h:601
function compress2
(dest : Byte_Access;
destLen : ULong_Access;
source : Byte_Access;
sourceLen : ULong;
level : Int)
return Int; -- zlib.h:615
function uncompress
(dest : Byte_Access;
destLen : ULong_Access;
source : Byte_Access;
sourceLen : ULong)
return Int;
function gzopen (path : Chars_Ptr; mode : Chars_Ptr) return gzFile;
function gzdopen (fd : Int; mode : Chars_Ptr) return gzFile;
function gzsetparams
(file : gzFile;
level : Int;
strategy : Int)
return Int;
function gzread
(file : gzFile;
buf : Voidp;
len : UInt)
return Int;
function gzwrite
(file : in gzFile;
buf : in Voidp;
len : in UInt)
return Int;
function gzprintf (file : in gzFile; format : in Chars_Ptr) return Int;
function gzputs (file : in gzFile; s : in Chars_Ptr) return Int;
function gzgets
(file : gzFile;
buf : Chars_Ptr;
len : Int)
return Chars_Ptr;
function gzputc (file : gzFile; char : Int) return Int;
function gzgetc (file : gzFile) return Int;
function gzflush (file : gzFile; flush : Int) return Int;
function gzseek
(file : gzFile;
offset : Int;
whence : Int)
return Int;
function gzrewind (file : gzFile) return Int;
function gztell (file : gzFile) return Int;
function gzeof (file : gzFile) return Int;
function gzclose (file : gzFile) return Int;
function gzerror (file : gzFile; errnum : Int_Access) return Chars_Ptr;
function adler32
(adler : ULong;
buf : Byte_Access;
len : UInt)
return ULong;
function crc32
(crc : ULong;
buf : Byte_Access;
len : UInt)
return ULong;
function deflateInit
(strm : Z_Streamp;
level : Int;
version : Chars_Ptr;
stream_size : Int)
return Int;
function Deflate_Init
(strm : in Z_Streamp;
level : in Int := Z_DEFAULT_COMPRESSION)
return Int;
pragma Inline (Deflate_Init);
function deflateInit2
(strm : Z_Streamp;
level : Int;
method : Int;
windowBits : Int;
memLevel : Int;
strategy : Int;
version : Chars_Ptr;
stream_size : Int)
return Int;
function Deflate_Init
(strm : Z_Streamp;
level : Int;
method : Int;
windowBits : Int;
memLevel : Int;
strategy : Int)
return Int;
pragma Inline (Deflate_Init);
function inflateInit
(strm : Z_Streamp;
version : Chars_Ptr;
stream_size : Int)
return Int;
function Inflate_Init (strm : Z_Streamp) return Int;
pragma Inline (Inflate_Init);
function inflateInit2
(strm : in Z_Streamp;
windowBits : in Int;
version : in Chars_Ptr;
stream_size : in Int)
return Int;
function inflateBackInit
(strm : in Z_Streamp;
windowBits : in Int;
window : in Byte_Access;
version : in Chars_Ptr;
stream_size : in Int)
return Int;
-- Size of window have to be 2**windowBits.
function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int;
pragma Inline (Inflate_Init);
function zError (err : Int) return Chars_Ptr;
function inflateSyncPoint (z : Z_Streamp) return Int;
function get_crc_table return ULong_Access;
-- Interface to the available fields of the z_stream structure.
-- The application must update next_in and avail_in when avail_in has
-- dropped to zero. It must update next_out and avail_out when avail_out
-- has dropped to zero. The application must initialize zalloc, zfree and
-- opaque before calling the init function.
function Need_In (strm : in Z_Stream) return Boolean;
-- return true when we do not need to setup Next_In and Avail_In fields.
pragma Inline (Need_In);
function Need_Out (strm : in Z_Stream) return Boolean;
-- return true when we do not need to setup Next_Out and Avail_Out field.
pragma Inline (Need_Out);
procedure Set_In
(Strm : in out Z_Stream;
Buffer : in Byte_Access;
Size : in UInt);
pragma Inline (Set_In);
procedure Set_In
(Strm : in out Z_Stream;
Buffer : in Voidp;
Size : in UInt);
pragma Inline (Set_In);
procedure Set_Out
(Strm : in out Z_Stream;
Buffer : in Byte_Access;
Size : in UInt);
pragma Inline (Set_Out);
procedure Set_Out
(Strm : in out Z_Stream;
Buffer : in Voidp;
Size : in UInt);
pragma Inline (Set_Out);
procedure Set_Mem_Func
(Strm : in out Z_Stream;
Opaque : in Voidp;
Alloc : in alloc_func;
Free : in free_func);
pragma Inline (Set_Mem_Func);
function Last_Error_Message (Strm : in Z_Stream) return String;
pragma Inline (Last_Error_Message);
function Avail_Out (Strm : in Z_Stream) return UInt;
pragma Inline (Avail_Out);
function Avail_In (Strm : in Z_Stream) return UInt;
pragma Inline (Avail_In);
function Total_In (Strm : in Z_Stream) return ULong;
pragma Inline (Total_In);
function Total_Out (Strm : in Z_Stream) return ULong;
pragma Inline (Total_Out);
function inflateCopy
(dest : in Z_Streamp;
Source : in Z_Streamp)
return Int;
function compressBound (Source_Len : in ULong) return ULong;
function deflateBound
(Strm : in Z_Streamp;
Source_Len : in ULong)
return ULong;
function gzungetc (C : in Int; File : in gzFile) return Int;
function zlibCompileFlags return ULong;
function deflatePrime
(strm : Z_Streamp;
bits : Int;
value : Int)
return Int;
private
type Z_Stream is record -- zlib.h:68
Next_In : Byte_Access; -- next input byte
Avail_In : UInt := 0; -- number of bytes available at next_in
Total_In : ULong := 0; -- total nb of input bytes read so far
Next_Out : Byte_Access; -- next output byte should be put there
Avail_Out : UInt := 0; -- remaining free space at next_out
Total_Out : ULong := 0; -- total nb of bytes output so far
msg : Chars_Ptr; -- last error message, NULL if no error
state : Voidp; -- not visible by applications
zalloc : alloc_func := null; -- used to allocate the internal state
zfree : free_func := null; -- used to free the internal state
opaque : Voidp; -- private data object passed to
-- zalloc and zfree
data_type : Int; -- best guess about the data type:
-- ascii or binary
adler : ULong; -- adler32 value of the uncompressed
-- data
reserved : ULong; -- reserved for future use
end record;
pragma Convention (C, Z_Stream);
pragma Import (C, zlibVersion, "zlibVersion");
pragma Import (C, Deflate, "deflate");
pragma Import (C, DeflateEnd, "deflateEnd");
pragma Import (C, Inflate, "inflate");
pragma Import (C, InflateEnd, "inflateEnd");
pragma Import (C, deflateSetDictionary, "deflateSetDictionary");
pragma Import (C, deflateCopy, "deflateCopy");
pragma Import (C, deflateReset, "deflateReset");
pragma Import (C, deflateParams, "deflateParams");
pragma Import (C, inflateSetDictionary, "inflateSetDictionary");
pragma Import (C, inflateSync, "inflateSync");
pragma Import (C, inflateReset, "inflateReset");
pragma Import (C, compress, "compress");
pragma Import (C, compress2, "compress2");
pragma Import (C, uncompress, "uncompress");
pragma Import (C, gzopen, "gzopen");
pragma Import (C, gzdopen, "gzdopen");
pragma Import (C, gzsetparams, "gzsetparams");
pragma Import (C, gzread, "gzread");
pragma Import (C, gzwrite, "gzwrite");
pragma Import (C, gzprintf, "gzprintf");
pragma Import (C, gzputs, "gzputs");
pragma Import (C, gzgets, "gzgets");
pragma Import (C, gzputc, "gzputc");
pragma Import (C, gzgetc, "gzgetc");
pragma Import (C, gzflush, "gzflush");
pragma Import (C, gzseek, "gzseek");
pragma Import (C, gzrewind, "gzrewind");
pragma Import (C, gztell, "gztell");
pragma Import (C, gzeof, "gzeof");
pragma Import (C, gzclose, "gzclose");
pragma Import (C, gzerror, "gzerror");
pragma Import (C, adler32, "adler32");
pragma Import (C, crc32, "crc32");
pragma Import (C, deflateInit, "deflateInit_");
pragma Import (C, inflateInit, "inflateInit_");
pragma Import (C, deflateInit2, "deflateInit2_");
pragma Import (C, inflateInit2, "inflateInit2_");
pragma Import (C, zError, "zError");
pragma Import (C, inflateSyncPoint, "inflateSyncPoint");
pragma Import (C, get_crc_table, "get_crc_table");
-- added in zlib 1.2.1:
pragma Import (C, inflateCopy, "inflateCopy");
pragma Import (C, compressBound, "compressBound");
pragma Import (C, deflateBound, "deflateBound");
pragma Import (C, gzungetc, "gzungetc");
pragma Import (C, zlibCompileFlags, "zlibCompileFlags");
pragma Import (C, deflatePrime, "deflatePrime");
pragma Import (C, inflateBackInit, "inflateBackInit_");
-- I stopped binding the inflateBack routines, becouse realize that
-- it does not support zlib and gzip headers for now, and have no
-- symmetric deflateBack routines.
-- ZLib-Ada is symmetric regarding deflate/inflate data transformation
-- and has a similar generic callback interface for the
-- deflate/inflate transformation based on the regular Deflate/Inflate
-- routines.
-- pragma Import (C, inflateBack, "inflateBack");
-- pragma Import (C, inflateBackEnd, "inflateBackEnd");
end ZLib.Thin;
|
charlie5/lace | Ada | 14,170 | adb | with
openGL.Primitive.indexed,
openGL.Primitive.long_indexed,
ada.unchecked_Deallocation,
ada.unchecked_Conversion;
package body openGL.Geometry
is
---------
-- Forge
--
procedure destroy (Self : in out Item)
is
use openGL.Buffer;
begin
free (Self.Vertices);
Self.free_Primitives;
end destroy;
procedure free (Self : in out View)
is
procedure deallocate is new ada.unchecked_Deallocation (Item'Class, View);
begin
if Self = null then
return;
end if;
Self.destroy;
deallocate (Self);
end free;
procedure free_Primitives (Self : in out Item)
is
begin
for Each in 1 .. Self.primitive_Count
loop
Primitive.free (Self.Primitives (Each));
end loop;
Self.primitive_Count := 0;
end free_Primitives;
--------------
-- Attributes
--
function Label (Self : in Item'Class) return String
is
begin
return to_String (Self.Label);
end Label;
procedure Label_is (Self : in out Item'Class; Now : in String)
is
begin
overwrite (Self.Label, 1, Now);
end Label_is;
procedure Indices_are (Self : in out Item; Now : in Indices;
for_Facia : in Positive)
is
the_Primitive : constant Primitive.indexed.view
:= Primitive.indexed.view (Self.Primitives (Index_t (for_Facia)));
begin
the_Primitive.Indices_are (Now);
end Indices_are;
procedure Indices_are (Self : in out Item; Now : in long_Indices;
for_Facia : in Positive)
is
the_Primitive : constant Primitive.long_indexed.view
:= Primitive.long_indexed.view (Self.Primitives (Index_t (for_Facia)));
begin
the_Primitive.Indices_are (Now);
end Indices_are;
function Primitives (Self : in Item'Class) return Primitive.views
is
begin
return Self.Primitives (1 .. Self.primitive_Count);
end Primitives;
function Texture (Self : in Item'Class) return openGL.Texture.Object
is
begin
return Self.Texture;
end Texture;
procedure Texture_is (Self : in out Item'Class; Now : in openGL.Texture.Object)
is
begin
Self.Texture := Now;
Self.is_Transparent := Self.is_Transparent
or Now .is_Transparent;
end Texture_is;
procedure Program_is (Self : in out Item; Now : in openGL.Program.view)
is
begin
Self.Program := Now;
end Program_is;
function Program (Self : in Item) return openGL.Program.view
is
begin
return Self.Program;
end Program;
function Bounds (self : in Item'Class) return openGL.Bounds
is
begin
return Self.Bounds;
end Bounds;
procedure Bounds_are (Self : in out Item'Class; Now : in openGL.Bounds)
is
begin
Self.Bounds := Now;
end Bounds_are;
function is_Transparent (Self : in Item) return Boolean
is
begin
return Self.is_Transparent
or Self.Texture.is_Transparent;
end is_Transparent;
procedure is_Transparent (Self : in out Item; Now : in Boolean := True)
is
begin
Self.is_Transparent := Now;
end is_Transparent;
--------------
-- Operations
--
procedure add (Self : in out Item'Class; the_Primitive : in Primitive.view)
is
begin
Self.primitive_Count := Self.primitive_Count + 1;
Self.Primitives (self.primitive_Count) := the_Primitive;
end add;
procedure render (Self : in out Item'Class)
is
begin
if Self.primitive_Count = 0
then
raise Error with "Unable to render geometry with no primitives.";
end if;
Self .enable_Texture;
Self.Program .set_Uniforms;
Self.Vertices.enable;
Self.Program .enable_Attributes;
for Each in 1 .. self.primitive_Count -- Render each primitive.
loop
Self.Primitives (Each).render;
end loop;
end render;
-----------
-- Normals
--
generic
type any_Index_t is range <>;
type any_Indices is array (long_Index_t range <>) of any_Index_t;
function any_vertex_Id_in (face_Kind : in primitive.facet_Kind;
Indices : in any_Indices;
for_Facet : in long_Index_t;
for_Point : in long_Index_t) return any_Index_t;
function any_vertex_Id_in (face_Kind : in Primitive.facet_Kind;
Indices : in any_Indices;
for_Facet : in long_Index_t;
for_Point : in long_Index_t) return any_Index_t
is
use openGL.Primitive;
begin
case face_Kind
is
when Triangles =>
return Indices (3 * (for_Facet - 1) + for_Point);
when triangle_Strip =>
return Indices (for_Facet - 1 + for_Point);
when triangle_Fan =>
if for_Point = 1
then return 1;
else return Indices (for_Facet - 1 + for_Point);
end if;
when others =>
raise Error with "openGL primitive " & face_Kind'Image & " not yet supported.";
end case;
end any_vertex_Id_in;
generic
type any_Index_t is range <>;
type any_Indices is array (long_Index_t range <>) of any_Index_t;
function any_facet_Count_in (face_Kind : in primitive.facet_Kind;
Indices : in any_Indices) return long_Index_t;
--
-- Returns the maximum possible facet count, which includes redundant facets.
function any_facet_Count_in (face_Kind : in primitive.facet_Kind;
Indices : in any_Indices) return long_Index_t
is
use Primitive;
begin
case face_Kind
is
when Triangles =>
return Indices'Length / 3;
when triangle_Strip
| triangle_Fan =>
return Indices'Length - 2;
when others =>
raise Error with "openGL primitive " & face_Kind'Image & " not yet supported.";
end case;
end any_facet_Count_in;
function facet_Count_in is new any_facet_Count_in (any_Index_t => Index_t,
any_Indices => Indices);
pragma Unreferenced (facet_Count_in);
----------
-- Facets
--
type Facet is array ( Index_t range 1 .. 3) of Index_t; -- An 'indexed' triangle.
type Facets is array (long_Index_t range <> ) of Facet;
type Facets_view is access all Facets;
procedure free is new ada.unchecked_Deallocation (Facets, Facets_view);
generic
type any_Index_t is range <>;
type any_Indices is array (long_Index_t range <>) of any_Index_t;
function any_Facets_of (face_Kind : in primitive.facet_Kind;
Indices : in any_Indices) return access Facets;
--
-- 'Facets_of' returns all non-redundant facets.
function any_Facets_of (face_Kind : in primitive.facet_Kind;
Indices : in any_Indices) return access Facets
is
use openGL.Primitive;
function facet_Count_in is new any_facet_Count_in (any_Index_t => any_Index_t,
any_Indices => any_Indices);
function vertex_Id_in is new any_vertex_Id_in (any_Index_t => any_Index_t,
any_Indices => any_Indices);
the_Facets : Facets_view := new Facets (1 .. facet_Count_in (face_Kind, Indices));
Count : long_Index_t := 0;
begin
for Each in the_Facets'Range
loop
declare
P1 : constant Index_t := Index_t (vertex_Id_in (face_Kind, Indices, Each, 1));
P2 : constant Index_t := Index_t (vertex_Id_in (face_Kind, Indices, Each, 2));
P3 : constant Index_t := Index_t (vertex_Id_in (face_Kind, Indices, Each, 3));
begin
if not ( P1 = P2
or P1 = P3
or P2 = P3)
then
Count := Count + 1;
case face_Kind
is
when Triangles
| triangle_Fan =>
the_Facets (Count) := [P1, P2, P3];
when triangle_Strip =>
if Each mod 2 = 0
then -- Is an even facet.
the_Facets (Count) := [P1, P3, P2];
else
the_Facets (Count) := [P1, P2, P3];
end if;
when others =>
raise Error with "openGL primitive " & face_Kind'Image & " not yet supported.";
end case;
end if;
end;
end loop;
declare
Result : constant Facets_view := new Facets' (the_Facets (1 .. Count));
begin
free (the_Facets);
return Result;
end;
end any_Facets_of;
function Facets_of is new any_Facets_of (Index_t,
Indices);
pragma Unreferenced (Facets_of);
-----------
-- Normals
--
type Normals_view is access Normals;
generic
type any_Index_t is range <>;
type any_Indices is array (long_Index_t range <>) of any_Index_t;
function any_Normals_of (face_Kind : in primitive.facet_Kind;
Indices : in any_Indices;
Sites : in openGL.Sites) return access Normals;
function any_Normals_of (face_Kind : in primitive.facet_Kind;
Indices : in any_Indices;
Sites : in openGL.Sites) return access Normals
is
function Facets_of is new any_Facets_of (any_Index_t,
any_Indices);
the_Normals : constant Normals_view := new Normals (Sites'Range);
the_Facets : Facets_view := Facets_of (face_Kind,
Indices).all'unchecked_Access;
type facet_Normals is array (long_Index_t range 1 .. the_Facets'Length) of Normal;
type facet_Normals_view is access all facet_Normals;
procedure free is new ada.unchecked_Deallocation (facet_Normals, facet_Normals_view); -- TODO: Should not be needed since freeing will occur when 'facet_Normals_view' goes out of scope ?
the_facet_Normals : facet_Normals_view := new facet_Normals;
N : Vector_3;
length_N : Real;
begin
-- Calculate normal at each facet.
--
for Each in the_Facets'Range
loop
N := (Sites (the_Facets (Each)(2)) - Sites (the_Facets (Each)(1)))
* (Sites (the_Facets (Each)(3)) - Sites (the_Facets (Each)(1)));
length_N := abs (N);
if almost_Zero (length_N)
then the_facet_Normals (Each) := N; -- 0 vector !
else the_facet_Normals (Each) := (1.0 / length_N) * N;
end if;
end loop;
-- Calculate normal at each vertex.
--
declare
Id : Index_t;
Length : Real;
begin
for Each in the_Normals'Range
loop
the_Normals (Each) := Origin_3D;
end loop;
for f in the_Facets'Range
loop
for p in Index_t' (1) .. 3
loop
Id := the_Facets (f) (p);
the_Normals (Id) := the_Normals (Id) + the_facet_Normals (f);
end loop;
end loop;
for p in the_Normals'Range
loop
Length := abs (the_Normals (p));
if almost_Zero (Length)
then the_Normals (p) := [0.0, -1.0, 0.0];
else the_Normals (p) := (1.0 / Length) * the_Normals (p);
end if;
end loop;
end;
free (the_Facets);
free (the_facet_Normals);
return the_Normals.all'Unchecked_Access;
end any_Normals_of;
function Normals_of (face_Kind : in primitive.facet_Kind;
Indices : in openGL.Indices;
Sites : in openGL.Sites) return access Normals
is
function my_Normals_of is new any_Normals_of (any_Index_t => Index_t,
any_Indices => openGL.Indices);
begin
return my_Normals_of (face_Kind,
Indices,
Sites).all'unchecked_Access;
end Normals_of;
function Normals_of (face_Kind : in primitive.facet_Kind;
Indices : in openGL.long_Indices;
Sites : in openGL.Sites) return access Normals
is
function my_Normals_of is new any_Normals_of (any_Index_t => long_Index_t,
any_Indices => openGL.long_Indices);
begin
return my_Normals_of (face_Kind,
Indices,
Sites).all'unchecked_Access;
end Normals_of;
---------
-- Bounds
--
function get_Bounds (Count : in Natural) return openGL.Bounds
is
use Geometry_3D;
the_Bounds : openGL.Bounds := null_Bounds;
begin
for i in 1 .. any_Index_t (Count)
loop
the_Bounds.Box := the_Bounds.Box
or get_Site (i);
the_Bounds.Ball := Real'Max (the_Bounds.Ball,
abs (get_Site (i)));
end loop;
return the_Bounds;
end get_Bounds;
---------------
-- Transparency
--
function get_Transparency (Count : in Natural) return Boolean
is
use type color_Value;
begin
for i in 1 .. any_Index_t (Count)
loop
if get_Color (i).Alpha /= opaque_Value
then
return True;
end if;
end loop;
return False;
end get_Transparency;
end openGL.Geometry;
|
AdaCore/training_material | Ada | 11,476 | adb | ------------------------------------------------------------------------------
-- --
-- Hardware Abstraction Layer for STM32 Targets --
-- --
-- Copyright (C) 2014, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with STM32F4.RCC; use STM32F4.RCC;
package body STM32F429_Discovery is
--------
-- On --
--------
procedure On (This : User_LED) is
begin
Set (GPIO_G, This);
end On;
---------
-- Off --
---------
procedure Off (This : User_LED) is
begin
Clear (GPIO_G, This);
end Off;
------------
-- Toggle --
------------
procedure Toggle (This : User_LED) is
begin
Toggle (GPIO_G, This);
end Toggle;
All_LEDs : constant GPIO_Pins := Green & Red;
------------------
-- All_LEDs_Off --
------------------
procedure All_LEDs_Off is
begin
Clear (GPIO_G, ALL_LEDs);
end All_LEDs_Off;
-----------------
-- All_LEDs_On --
-----------------
procedure All_LEDs_On is
begin
Set (GPIO_G, ALL_LEDs);
end All_LEDs_On;
---------------------
-- Initialize_LEDs --
---------------------
procedure Initialize_LEDs is
Conf : GPIO_Port_Configuration;
begin
Enable_Clock (GPIO_G);
Conf.Mode := Mode_Out;
Conf.Output_Type := Push_Pull;
Conf.Speed := Speed_100MHz;
Conf.Resistors := Floating;
Configure_IO (GPIO_G, All_LEDs, Conf);
end Initialize_LEDs;
------------------
-- Enable_Clock --
------------------
procedure Enable_Clock (This : aliased in out GPIO_Port) is
begin
if This'Address = System'To_Address (GPIOA_Base) then
GPIOA_Clock_Enable;
elsif This'Address = System'To_Address (GPIOB_Base) then
GPIOB_Clock_Enable;
elsif This'Address = System'To_Address (GPIOC_Base) then
GPIOC_Clock_Enable;
elsif This'Address = System'To_Address (GPIOD_Base) then
GPIOD_Clock_Enable;
elsif This'Address = System'To_Address (GPIOE_Base) then
GPIOE_Clock_Enable;
elsif This'Address = System'To_Address (GPIOF_Base) then
GPIOF_Clock_Enable;
elsif This'Address = System'To_Address (GPIOG_Base) then
GPIOG_Clock_Enable;
elsif This'Address = System'To_Address (GPIOH_Base) then
GPIOH_Clock_Enable;
elsif This'Address = System'To_Address (GPIOI_Base) then
GPIOI_Clock_Enable;
elsif This'Address = System'To_Address (GPIOJ_Base) then
GPIOJ_Clock_Enable;
elsif This'Address = System'To_Address (GPIOK_Base) then
GPIOK_Clock_Enable;
else
raise Program_Error;
end if;
end Enable_Clock;
------------------
-- Enable_Clock --
------------------
procedure Enable_Clock (This : aliased in out USART) is
begin
if This'Address = System'To_Address (USART1_Base) then
USART1_Clock_Enable;
elsif This'Address = System'To_Address (USART2_Base) then
USART2_Clock_Enable;
elsif This'Address = System'To_Address (USART3_Base) then
USART3_Clock_Enable;
elsif This'Address = System'To_Address (USART6_Base) then
USART6_Clock_Enable;
else
raise Program_Error;
end if;
end Enable_Clock;
------------------
-- Enable_Clock --
------------------
procedure Enable_Clock (This : aliased in out DMA_Controller) is
begin
if This'Address = System'To_Address (STM32F4.DMA1_BASE) then
DMA1_Clock_Enable;
elsif This'Address = System'To_Address (STM32F4.DMA2_BASE) then
DMA2_Clock_Enable;
else
raise Program_Error;
end if;
end Enable_Clock;
------------------
-- Enable_Clock --
------------------
procedure Enable_Clock (This : aliased in out I2C_Port) is
begin
if This'Address = System'To_Address (I2C1_Base) then
I2C1_Clock_Enable;
elsif This'Address = System'To_Address (I2C2_Base) then
I2C2_Clock_Enable;
elsif This'Address = System'To_Address (I2C3_Base) then
I2C3_Clock_Enable;
else
raise Program_Error;
end if;
end Enable_Clock;
-----------
-- Reset --
-----------
procedure Reset (This : in out I2C_Port) is
begin
if This'Address = System'To_Address (I2C1_Base) then
I2C1_Force_Reset;
I2C1_Release_Reset;
elsif This'Address = System'To_Address (I2C2_Base) then
I2C2_Force_Reset;
I2C2_Release_Reset;
elsif This'Address = System'To_Address (I2C3_Base) then
I2C3_Force_Reset;
I2C3_Release_Reset;
else
raise Program_Error;
end if;
end Reset;
------------------
-- Enable_Clock --
------------------
procedure Enable_Clock (This : aliased in out SPI_Port) is
begin
if This'Address = System'To_Address (SPI1_Base) then
SPI1_Force_Reset;
SPI1_Release_Reset;
elsif This'Address = System'To_Address (SPI2_Base) then
SPI2_Force_Reset;
SPI2_Release_Reset;
elsif This'Address = System'To_Address (SPI3_Base) then
SPI3_Force_Reset;
SPI3_Release_Reset;
elsif This'Address = System'To_Address (SPI4_Base) then
SPI4_Force_Reset;
SPI4_Release_Reset;
elsif This'Address = System'To_Address (SPI5_Base) then
SPI5_Force_Reset;
SPI5_Release_Reset;
elsif This'Address = System'To_Address (SPI6_Base) then
SPI6_Force_Reset;
SPI6_Release_Reset;
else
raise Program_Error;
end if;
end Enable_Clock;
-----------
-- Reset --
-----------
procedure Reset (This : in out SPI_Port) is
begin
if This'Address = System'To_Address (SPI1_Base) then
SPI1_Clock_Enable;
elsif This'Address = System'To_Address (SPI2_Base) then
SPI2_Clock_Enable;
elsif This'Address = System'To_Address (SPI3_Base) then
SPI3_Clock_Enable;
elsif This'Address = System'To_Address (SPI4_Base) then
SPI4_Clock_Enable;
elsif This'Address = System'To_Address (SPI5_Base) then
SPI5_Clock_Enable;
elsif This'Address = System'To_Address (SPI6_Base) then
SPI6_Clock_Enable;
else
raise Program_Error;
end if;
end Reset;
------------------
-- Enable_Clock --
------------------
procedure Enable_Clock (This : in out Timer) is
begin
if This'Address = System'To_Address (TIM1_Base) then
TIM1_Clock_Enable;
elsif This'Address = System'To_Address (TIM2_Base) then
TIM2_Clock_Enable;
elsif This'Address = System'To_Address (TIM3_Base) then
TIM3_Clock_Enable;
elsif This'Address = System'To_Address (TIM4_Base) then
TIM4_Clock_Enable;
elsif This'Address = System'To_Address (TIM5_Base) then
TIM5_Clock_Enable;
elsif This'Address = System'To_Address (TIM6_Base) then
TIM6_Clock_Enable;
elsif This'Address = System'To_Address (TIM7_Base) then
TIM7_Clock_Enable;
elsif This'Address = System'To_Address (TIM8_Base) then
TIM8_Clock_Enable;
elsif This'Address = System'To_Address (TIM9_Base) then
TIM9_Clock_Enable;
elsif This'Address = System'To_Address (TIM10_Base) then
TIM10_Clock_Enable;
elsif This'Address = System'To_Address (TIM11_Base) then
TIM11_Clock_Enable;
elsif This'Address = System'To_Address (TIM12_Base) then
TIM12_Clock_Enable;
elsif This'Address = System'To_Address (TIM13_Base) then
TIM13_Clock_Enable;
elsif This'Address = System'To_Address (TIM14_Base) then
TIM14_Clock_Enable;
else
raise Program_Error;
end if;
end Enable_Clock;
-----------
-- Reset --
-----------
procedure Reset (This : in out Timer) is
begin
if This'Address = System'To_Address (TIM1_Base) then
TIM1_Force_Reset;
TIM1_Release_Reset;
elsif This'Address = System'To_Address (TIM2_Base) then
TIM2_Force_Reset;
TIM2_Release_Reset;
elsif This'Address = System'To_Address (TIM3_Base) then
TIM3_Force_Reset;
TIM3_Release_Reset;
elsif This'Address = System'To_Address (TIM4_Base) then
TIM4_Force_Reset;
TIM4_Release_Reset;
elsif This'Address = System'To_Address (TIM5_Base) then
TIM5_Force_Reset;
TIM5_Release_Reset;
elsif This'Address = System'To_Address (TIM6_Base) then
TIM6_Force_Reset;
TIM6_Release_Reset;
elsif This'Address = System'To_Address (TIM7_Base) then
TIM7_Force_Reset;
TIM7_Release_Reset;
elsif This'Address = System'To_Address (TIM8_Base) then
TIM8_Force_Reset;
TIM8_Release_Reset;
elsif This'Address = System'To_Address (TIM9_Base) then
TIM9_Force_Reset;
TIM9_Release_Reset;
elsif This'Address = System'To_Address (TIM10_Base) then
TIM10_Force_Reset;
TIM10_Release_Reset;
elsif This'Address = System'To_Address (TIM11_Base) then
TIM11_Force_Reset;
TIM11_Release_Reset;
elsif This'Address = System'To_Address (TIM12_Base) then
TIM12_Force_Reset;
TIM12_Release_Reset;
elsif This'Address = System'To_Address (TIM13_Base) then
TIM13_Force_Reset;
TIM13_Release_Reset;
elsif This'Address = System'To_Address (TIM14_Base) then
TIM14_Force_Reset;
TIM14_Release_Reset;
else
raise Program_Error;
end if;
end Reset;
end STM32F429_Discovery;
|
zhmu/ananas | Ada | 100,313 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- L I B . X R E F --
-- --
-- B o d y --
-- --
-- Copyright (C) 1998-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 Csets; use Csets;
with Einfo; use Einfo;
with Einfo.Utils; use Einfo.Utils;
with Elists; use Elists;
with Errout; use Errout;
with Lib.Util; use Lib.Util;
with Nlists; use Nlists;
with Opt; use Opt;
with Restrict; use Restrict;
with Rident; use Rident;
with Sem; use Sem;
with Sem_Aux; use Sem_Aux;
with Sem_Prag; use Sem_Prag;
with Sem_Util; use Sem_Util;
with Sem_Warn; use Sem_Warn;
with Sinfo; use Sinfo;
with Sinfo.Nodes; use Sinfo.Nodes;
with Sinfo.Utils; use Sinfo.Utils;
with Sinput; use Sinput;
with Snames; use Snames;
with Stringt; use Stringt;
with Stand; use Stand;
with Table; use Table;
with GNAT.Heap_Sort_G;
with GNAT.HTable;
package body Lib.Xref is
------------------
-- Declarations --
------------------
package Deferred_References is new Table.Table (
Table_Component_Type => Deferred_Reference_Entry,
Table_Index_Type => Int,
Table_Low_Bound => 0,
Table_Initial => 512,
Table_Increment => 200,
Table_Name => "Name_Deferred_References");
-- The Xref table is used to record references. The Loc field is set
-- to No_Location for a definition entry.
subtype Xref_Entry_Number is Int;
type Xref_Key is record
-- These are the components of Xref_Entry that participate in hash
-- lookups.
Ent : Entity_Id;
-- Entity referenced (E parameter to Generate_Reference)
Loc : Source_Ptr;
-- Location of reference (Original_Location (Sloc field of N parameter
-- to Generate_Reference)). Set to No_Location for the case of a
-- defining occurrence.
Typ : Character;
-- Reference type (Typ param to Generate_Reference)
Eun : Unit_Number_Type;
-- Unit number corresponding to Ent
Lun : Unit_Number_Type;
-- Unit number corresponding to Loc. Value is undefined and not
-- referenced if Loc is set to No_Location.
-- The following components are only used for SPARK cross-references
Ref_Scope : Entity_Id;
-- Entity of the closest subprogram or package enclosing the reference
Ent_Scope : Entity_Id;
-- Entity of the closest subprogram or package enclosing the definition,
-- which should be located in the same file as the definition itself.
end record;
type Xref_Entry is record
Key : Xref_Key;
Ent_Scope_File : Unit_Number_Type;
-- File for entity Ent_Scope
Def : Source_Ptr;
-- Original source location for entity being referenced. Note that these
-- values are used only during the output process, they are not set when
-- the entries are originally built. This is because private entities
-- can be swapped when the initial call is made.
HTable_Next : Xref_Entry_Number;
-- For use only by Static_HTable
end record;
package Xrefs is new Table.Table (
Table_Component_Type => Xref_Entry,
Table_Index_Type => Xref_Entry_Number,
Table_Low_Bound => 1,
Table_Initial => Alloc.Xrefs_Initial,
Table_Increment => Alloc.Xrefs_Increment,
Table_Name => "Xrefs");
--------------
-- Xref_Set --
--------------
-- We keep a set of xref entries, in order to avoid inserting duplicate
-- entries into the above Xrefs table. An entry is in Xref_Set if and only
-- if it is in Xrefs.
Num_Buckets : constant := 2**16;
subtype Header_Num is Integer range 0 .. Num_Buckets - 1;
type Null_Type is null record;
pragma Unreferenced (Null_Type);
function Hash (F : Xref_Entry_Number) return Header_Num;
function Equal (F1, F2 : Xref_Entry_Number) return Boolean;
procedure HT_Set_Next (E : Xref_Entry_Number; Next : Xref_Entry_Number);
function HT_Next (E : Xref_Entry_Number) return Xref_Entry_Number;
function Get_Key (E : Xref_Entry_Number) return Xref_Entry_Number;
pragma Inline (Hash, Equal, HT_Set_Next, HT_Next, Get_Key);
package Xref_Set is new GNAT.HTable.Static_HTable (
Header_Num,
Element => Xref_Entry,
Elmt_Ptr => Xref_Entry_Number,
Null_Ptr => 0,
Set_Next => HT_Set_Next,
Next => HT_Next,
Key => Xref_Entry_Number,
Get_Key => Get_Key,
Hash => Hash,
Equal => Equal);
-----------------------------
-- SPARK Xrefs Information --
-----------------------------
package body SPARK_Specific is separate;
------------------------
-- Local Subprograms --
------------------------
procedure Add_Entry (Key : Xref_Key; Ent_Scope_File : Unit_Number_Type);
-- Add an entry to the tables of Xref_Entries, avoiding duplicates
procedure Generate_Prim_Op_References (Typ : Entity_Id);
-- For a tagged type, generate implicit references to its primitive
-- operations, for source navigation. This is done right before emitting
-- cross-reference information rather than at the freeze point of the type
-- in order to handle late bodies that are primitive operations.
function Lt (T1, T2 : Xref_Entry) return Boolean;
-- Order cross-references
---------------
-- Add_Entry --
---------------
procedure Add_Entry (Key : Xref_Key; Ent_Scope_File : Unit_Number_Type) is
begin
Xrefs.Increment_Last; -- tentative
Xrefs.Table (Xrefs.Last).Key := Key;
-- Set the entry in Xref_Set, and if newly set, keep the above
-- tentative increment.
if Xref_Set.Set_If_Not_Present (Xrefs.Last) then
Xrefs.Table (Xrefs.Last).Ent_Scope_File := Ent_Scope_File;
-- Leave Def and HTable_Next uninitialized
Set_Has_Xref_Entry (Key.Ent);
-- It was already in Xref_Set, so throw away the tentatively-added entry
else
Xrefs.Decrement_Last;
end if;
end Add_Entry;
---------------------
-- Defer_Reference --
---------------------
procedure Defer_Reference (Deferred_Reference : Deferred_Reference_Entry) is
begin
-- If Get_Ignore_Errors, then we are in Preanalyze_Without_Errors, and
-- we should not record cross references, because that will cause
-- duplicates when we call Analyze.
if not Get_Ignore_Errors then
Deferred_References.Append (Deferred_Reference);
end if;
end Defer_Reference;
-----------
-- Equal --
-----------
function Equal (F1, F2 : Xref_Entry_Number) return Boolean is
Result : constant Boolean :=
Xrefs.Table (F1).Key = Xrefs.Table (F2).Key;
begin
return Result;
end Equal;
-------------------------
-- Generate_Definition --
-------------------------
procedure Generate_Definition (E : Entity_Id) is
begin
pragma Assert (Nkind (E) in N_Entity);
-- Note that we do not test Xref_Entity_Letters here. It is too early
-- to do so, since we are often called before the entity is fully
-- constructed, so that the Ekind is still E_Void.
if Opt.Xref_Active
-- Definition must come from source
-- We make an exception for subprogram child units that have no spec.
-- For these we generate a subprogram declaration for library use,
-- and the corresponding entity does not come from source.
-- Nevertheless, all references will be attached to it and we have
-- to treat is as coming from user code.
and then (Comes_From_Source (E) or else Is_Child_Unit (E))
-- And must have a reasonable source location that is not
-- within an instance (all entities in instances are ignored)
and then Sloc (E) > No_Location
and then Instantiation_Location (Sloc (E)) = No_Location
-- And must be a non-internal name from the main source unit
and then In_Extended_Main_Source_Unit (E)
and then not Is_Internal_Name (Chars (E))
then
Add_Entry
((Ent => E,
Loc => No_Location,
Typ => ' ',
Eun => Get_Source_Unit (Original_Location (Sloc (E))),
Lun => No_Unit,
Ref_Scope => Empty,
Ent_Scope => Empty),
Ent_Scope_File => No_Unit);
if In_Inlined_Body then
Set_Referenced (E);
end if;
end if;
end Generate_Definition;
---------------------------------
-- Generate_Operator_Reference --
---------------------------------
procedure Generate_Operator_Reference
(N : Node_Id;
T : Entity_Id)
is
begin
if not In_Extended_Main_Source_Unit (N) then
return;
end if;
-- If the operator is not a Standard operator, then we generate a real
-- reference to the user defined operator.
if Sloc (Entity (N)) /= Standard_Location then
Generate_Reference (Entity (N), N);
-- A reference to an implicit inequality operator is also a reference
-- to the user-defined equality.
if Nkind (N) = N_Op_Ne
and then not Comes_From_Source (Entity (N))
and then Present (Corresponding_Equality (Entity (N)))
then
Generate_Reference (Corresponding_Equality (Entity (N)), N);
end if;
-- For the case of Standard operators, we mark the result type as
-- referenced. This ensures that in the case where we are using a
-- derived operator, we mark an entity of the unit that implicitly
-- defines this operator as used. Otherwise we may think that no entity
-- of the unit is used. The actual entity marked as referenced is the
-- first subtype, which is the relevant user defined entity.
-- Note: we only do this for operators that come from source. The
-- generated code sometimes reaches for entities that do not need to be
-- explicitly visible (for example, when we expand the code for
-- comparing two record objects, the fields of the record may not be
-- visible).
elsif Comes_From_Source (N) then
Set_Referenced (First_Subtype (T));
end if;
end Generate_Operator_Reference;
---------------------------------
-- Generate_Prim_Op_References --
---------------------------------
procedure Generate_Prim_Op_References (Typ : Entity_Id) is
Base_T : Entity_Id;
Prim : Elmt_Id;
Prim_List : Elist_Id;
begin
-- Handle subtypes of synchronized types
if Ekind (Typ) = E_Protected_Subtype
or else Ekind (Typ) = E_Task_Subtype
then
Base_T := Etype (Typ);
else
Base_T := Typ;
end if;
-- References to primitive operations are only relevant for tagged types
if not Is_Tagged_Type (Base_T)
or else Is_Class_Wide_Type (Base_T)
then
return;
end if;
-- Ada 2005 (AI-345): For synchronized types generate reference to the
-- wrapper that allow us to dispatch calls through their implemented
-- abstract interface types.
-- The check for Present here is to protect against previously reported
-- critical errors.
Prim_List := Primitive_Operations (Base_T);
if No (Prim_List) then
return;
end if;
Prim := First_Elmt (Prim_List);
while Present (Prim) loop
-- If the operation is derived, get the original for cross-reference
-- reference purposes (it is the original for which we want the xref
-- and for which the comes_from_source test must be performed).
Generate_Reference
(Typ, Ultimate_Alias (Node (Prim)), 'p', Set_Ref => False);
Next_Elmt (Prim);
end loop;
end Generate_Prim_Op_References;
------------------------
-- Generate_Reference --
------------------------
procedure Generate_Reference
(E : Entity_Id;
N : Node_Id;
Typ : Character := 'r';
Set_Ref : Boolean := True;
Force : Boolean := False)
is
Actual_Typ : Character := Typ;
Call : Node_Id;
Def : Source_Ptr;
Ent : Entity_Id;
Ent_Scope : Entity_Id;
Formal : Entity_Id;
Kind : Entity_Kind;
Nod : Node_Id;
Ref : Source_Ptr;
Ref_Scope : Entity_Id;
function Get_Through_Renamings (E : Entity_Id) return Entity_Id;
-- Get the enclosing entity through renamings, which may come from
-- source or from the translation of generic instantiations.
function OK_To_Set_Referenced return Boolean;
-- Returns True if the Referenced flag can be set. There are a few
-- exceptions where we do not want to set this flag, see body for
-- details of these exceptional cases.
---------------------------
-- Get_Through_Renamings --
---------------------------
function Get_Through_Renamings (E : Entity_Id) return Entity_Id is
begin
case Ekind (E) is
-- For subprograms we just need to check once if they are have a
-- Renamed_Entity, because Renamed_Entity is set transitively.
when Subprogram_Kind =>
declare
Renamed : constant Entity_Id := Renamed_Entity (E);
begin
if Present (Renamed) then
return Renamed;
else
return E;
end if;
end;
-- For objects we need to repeatedly call Renamed_Object, because
-- it is not transitive.
when Object_Kind =>
declare
Obj : Entity_Id := E;
begin
loop
pragma Assert (Present (Obj));
declare
Renamed : constant Entity_Id := Renamed_Object (Obj);
begin
if Present (Renamed) then
Obj := Get_Enclosing_Object (Renamed);
-- The renamed expression denotes a non-object,
-- e.g. function call, slicing of a function call,
-- pointer dereference, etc.
if No (Obj)
or else Ekind (Obj) = E_Enumeration_Literal
then
return Empty;
end if;
else
return Obj;
end if;
end;
end loop;
end;
when others =>
return E;
end case;
end Get_Through_Renamings;
---------------------------
-- OK_To_Set_Referenced --
---------------------------
function OK_To_Set_Referenced return Boolean is
P : Node_Id;
begin
-- A reference from a pragma Unreferenced or pragma Unmodified or
-- pragma Warnings does not cause the Referenced flag to be set.
-- This avoids silly warnings about things being referenced and
-- not assigned when the only reference is from the pragma.
if Nkind (N) = N_Identifier then
P := Parent (N);
if Nkind (P) = N_Pragma_Argument_Association then
P := Parent (P);
if Nkind (P) = N_Pragma then
if Pragma_Name_Unmapped (P) in Name_Warnings
| Name_Unmodified
| Name_Unreferenced
then
return False;
end if;
end if;
-- A reference to a formal in a named parameter association does
-- not make the formal referenced. Formals that are unused in the
-- subprogram body are properly flagged as such, even if calls
-- elsewhere use named notation.
elsif Nkind (P) = N_Parameter_Association
and then N = Selector_Name (P)
then
return False;
end if;
end if;
return True;
end OK_To_Set_Referenced;
-- Start of processing for Generate_Reference
begin
-- If Get_Ignore_Errors, then we are in Preanalyze_Without_Errors, and
-- we should not record cross references, because that will cause
-- duplicates when we call Analyze.
if Get_Ignore_Errors then
return;
end if;
-- May happen in case of severe errors
if Nkind (E) not in N_Entity then
return;
end if;
Find_Actual (N, Formal, Call);
if Present (Formal) then
Kind := Ekind (Formal);
else
Kind := E_Void;
end if;
-- Check for obsolescent reference to package ASCII. GNAT treats this
-- element of annex J specially since in practice, programs make a lot
-- of use of this feature, so we don't include it in the set of features
-- diagnosed when Warn_On_Obsolescent_Features mode is set. However we
-- are required to note it as a violation of the RM defined restriction.
if E = Standard_ASCII then
Check_Restriction (No_Obsolescent_Features, N);
end if;
-- Check for reference to entity marked with Is_Obsolescent
-- Note that we always allow obsolescent references in the compiler
-- itself and the run time, since we assume that we know what we are
-- doing in such cases. For example the calls in Ada.Characters.Handling
-- to its own obsolescent subprograms are just fine.
-- In any case we only generate warnings if we are in the extended main
-- source unit, and the entity itself is not in the extended main source
-- unit, since we assume the source unit itself knows what is going on
-- (and for sure we do not want silly warnings, e.g. on the end line of
-- an obsolescent procedure body).
if Is_Obsolescent (E)
and then not GNAT_Mode
and then not In_Extended_Main_Source_Unit (E)
and then In_Extended_Main_Source_Unit (N)
then
Check_Restriction (No_Obsolescent_Features, N);
if Warn_On_Obsolescent_Feature then
Output_Obsolescent_Entity_Warnings (N, E);
end if;
end if;
-- Warn if reference to Ada 2005 entity not in Ada 2005 mode. We only
-- detect real explicit references (modifications and references).
if Comes_From_Source (N)
and then Is_Ada_2005_Only (E)
and then Ada_Version < Ada_2005
and then Warn_On_Ada_2005_Compatibility
and then (Typ = 'm' or else Typ = 'r' or else Typ = 's')
then
Error_Msg_NE ("& is only defined in Ada 2005?y?", N, E);
end if;
-- Warn if reference to Ada 2012 entity not in Ada 2012 mode. We only
-- detect real explicit references (modifications and references).
if Comes_From_Source (N)
and then Is_Ada_2012_Only (E)
and then Ada_Version < Ada_2012
and then Warn_On_Ada_2012_Compatibility
and then (Typ = 'm' or else Typ = 'r')
then
Error_Msg_NE ("& is only defined in Ada 2012?y?", N, E);
end if;
-- Warn if reference to Ada 2022 entity not in Ada 2022 mode. We only
-- detect real explicit references (modifications and references).
if Comes_From_Source (N)
and then Is_Ada_2022_Only (E)
and then not Is_Subprogram (E)
and then Ada_Version < Ada_2022
and then Warn_On_Ada_2022_Compatibility
and then (Typ = 'm' or else Typ = 'r')
then
Error_Msg_NE ("& is only defined in Ada 2022?y?", N, E);
-- Error on static and dispatching calls to Ada 2022 subprograms that
-- require overriding if we are not in Ada 2022 mode (since overriding
-- was skipped); warn if the subprogram does not require overriding.
elsif Comes_From_Source (N)
and then Is_Ada_2022_Only (E)
and then Ada_Version < Ada_2022
and then Is_Subprogram (E)
and then (Typ = 'r' or else Typ = 's' or else Typ = 'R')
then
if Requires_Overriding (E) then
Error_Msg_NE
("& is only defined in Ada 2022 and requires overriding", N, E);
elsif Warn_On_Ada_2022_Compatibility then
Error_Msg_NE ("& is only defined in Ada 2022?y?", N, E);
end if;
end if;
-- Do not generate references if we are within a postcondition sub-
-- program, because the reference does not comes from source, and the
-- preanalysis of the aspect has already created an entry for the ALI
-- file at the proper source location.
if Chars (Current_Scope) = Name_uPostconditions then
return;
end if;
-- Never collect references if not in main source unit. However, we omit
-- this test if Typ is 'e' or 'k', since these entries are structural,
-- and it is useful to have them in units that reference packages as
-- well as units that define packages. We also omit the test for the
-- case of 'p' since we want to include inherited primitive operations
-- from other packages.
-- We also omit this test is this is a body reference for a subprogram
-- instantiation. In this case the reference is to the generic body,
-- which clearly need not be in the main unit containing the instance.
-- For the same reason we accept an implicit reference generated for
-- a default in an instance.
-- We also set the referenced flag in a generic package that is not in
-- then main source unit, when the variable is of a formal private type,
-- to warn in the instance if the corresponding type is not a fully
-- initialized type.
if not In_Extended_Main_Source_Unit (N) then
if Typ = 'e' or else
Typ = 'I' or else
Typ = 'p' or else
Typ = 'i' or else
Typ = 'k'
or else (Typ = 'b' and then Is_Generic_Instance (E))
-- Allow the generation of references to reads, writes and calls
-- in SPARK mode when the related context comes from an instance.
or else
(GNATprove_Mode
and then In_Extended_Main_Code_Unit (N)
and then (Typ = 'm' or else Typ = 'r' or else Typ = 's'))
then
null;
elsif In_Instance_Body
and then In_Extended_Main_Code_Unit (N)
and then Is_Generic_Type (Etype (E))
then
Set_Referenced (E);
return;
elsif Inside_A_Generic
and then Is_Generic_Type (Etype (E))
then
Set_Referenced (E);
return;
else
return;
end if;
end if;
-- For reference type p, the entity must be in main source unit
if Typ = 'p' and then not In_Extended_Main_Source_Unit (E) then
return;
end if;
-- Unless the reference is forced, we ignore references where the
-- reference itself does not come from source.
if not Force and then not Comes_From_Source (N) then
return;
end if;
-- Deal with setting entity as referenced, unless suppressed. Note that
-- we still do Set_Referenced on entities that do not come from source.
-- This situation arises when we have a source reference to a derived
-- operation, where the derived operation itself does not come from
-- source, but we still want to mark it as referenced, since we really
-- are referencing an entity in the corresponding package (this avoids
-- wrong complaints that the package contains no referenced entities).
if Set_Ref then
-- When E itself is an IN OUT parameter mark it referenced
if Is_Assignable (E)
and then Ekind (E) = E_In_Out_Parameter
and then Known_To_Be_Assigned (N)
then
Set_Referenced (E);
-- For the case where the entity is on the left hand side of an
-- assignment statment, we do nothing here.
-- The processing for Analyze_Assignment_Statement will set the
-- Referenced_As_LHS flag.
elsif Is_Assignable (E)
and then Known_To_Be_Assigned (N, Only_LHS => True)
then
null;
-- For objects that are renamings, just set as simply referenced.
-- We do not try to do assignment type tracking in this case.
elsif Is_Assignable (E)
and then Present (Renamed_Object (E))
then
Set_Referenced (E);
-- Check for a reference in a pragma that should not count as a
-- making the variable referenced for warning purposes.
elsif Is_Non_Significant_Pragma_Reference (N) then
null;
-- A reference in an attribute definition clause does not count as a
-- reference except for the case of Address. The reason that 'Address
-- is an exception is that it creates an alias through which the
-- variable may be referenced.
elsif Nkind (Parent (N)) = N_Attribute_Definition_Clause
and then Chars (Parent (N)) /= Name_Address
and then N = Name (Parent (N))
then
null;
-- Constant completion does not count as a reference
elsif Typ = 'c'
and then Ekind (E) = E_Constant
then
null;
-- Record representation clause does not count as a reference
elsif Nkind (N) = N_Identifier
and then Nkind (Parent (N)) = N_Record_Representation_Clause
then
null;
-- Discriminants do not need to produce a reference to record type
elsif Typ = 'd'
and then Nkind (Parent (N)) = N_Discriminant_Specification
then
null;
-- Out parameter case
elsif Kind = E_Out_Parameter
and then Is_Assignable (E)
then
-- If warning mode for all out parameters is set, or this is
-- the only warning parameter, then we want to mark this for
-- later warning logic by setting Referenced_As_Out_Parameter
if Warn_On_Modified_As_Out_Parameter (Formal) then
Set_Referenced_As_Out_Parameter (E, True);
Set_Referenced_As_LHS (E, False);
-- For OUT parameter not covered by the above cases, we simply
-- regard it as a non-reference.
else
Set_Referenced_As_Out_Parameter (E);
Set_Referenced (E);
end if;
-- Special processing for IN OUT parameters, where we have an
-- implicit assignment to a simple variable.
elsif Kind = E_In_Out_Parameter
and then Is_Assignable (E)
then
-- For sure this counts as a normal read reference
Set_Referenced (E);
Set_Last_Assignment (E, Empty);
-- We count it as being referenced as an out parameter if the
-- option is set to warn on all out parameters, except that we
-- have a special exclusion for an intrinsic subprogram, which
-- is most likely an instantiation of Unchecked_Deallocation
-- which we do not want to consider as an assignment since it
-- generates false positives. We also exclude the case of an
-- IN OUT parameter if the name of the procedure is Free,
-- since we suspect similar semantics.
if Warn_On_All_Unread_Out_Parameters
and then Is_Entity_Name (Name (Call))
and then not Is_Intrinsic_Subprogram (Entity (Name (Call)))
and then Chars (Name (Call)) /= Name_Free
then
Set_Referenced_As_Out_Parameter (E, True);
Set_Referenced_As_LHS (E, False);
end if;
-- Don't count a recursive reference within a subprogram as a
-- reference (that allows detection of a recursive subprogram
-- whose only references are recursive calls as unreferenced).
elsif Is_Subprogram (E)
and then E = Nearest_Dynamic_Scope (Current_Scope)
then
null;
-- Any other occurrence counts as referencing the entity
elsif OK_To_Set_Referenced then
Set_Referenced (E);
-- If variable, this is an OK reference after an assignment
-- so we can clear the Last_Assignment indication.
if Is_Assignable (E) then
Set_Last_Assignment (E, Empty);
end if;
end if;
-- Check for pragma Unreferenced given and reference is within
-- this source unit (occasion for possible warning to be issued).
-- Note that the entity may be marked as unreferenced by pragma
-- Unused.
if Has_Unreferenced (E)
and then In_Same_Extended_Unit (E, N)
then
-- A reference as a named parameter in a call does not count as a
-- violation of pragma Unreferenced for this purpose.
if Nkind (N) = N_Identifier
and then Nkind (Parent (N)) = N_Parameter_Association
and then Selector_Name (Parent (N)) = N
then
null;
-- Neither does a reference to a variable on the left side of
-- an assignment or use of an out parameter with warnings for
-- unread out parameters specified (via -gnatw.o).
-- The reason for treating unread out parameters in a special
-- way is so that when pragma Unreferenced is specified on such
-- an out parameter we do not want to issue a warning about the
-- pragma being unnecessary - because the purpose of the flag
-- is to warn about them not being read (e.g. unreferenced)
-- after use.
elsif (Known_To_Be_Assigned (N, Only_LHS => True)
or else (Present (Formal)
and then Ekind (Formal) = E_Out_Parameter
and then Warn_On_All_Unread_Out_Parameters))
and then not (Ekind (E) = E_In_Out_Parameter
and then Known_To_Be_Assigned (N))
then
null;
-- Do not consider F'Result as a violation of pragma Unreferenced
-- since the attribute acts as an anonymous alias of the function
-- result and not as a real reference to the function.
elsif Ekind (E) in E_Function | E_Generic_Function
and then Is_Entity_Name (N)
and then Is_Attribute_Result (Parent (N))
then
null;
-- No warning if the reference is in a call that does not come
-- from source (e.g. a call to a controlled type primitive).
elsif not Comes_From_Source (Parent (N))
and then Nkind (Parent (N)) = N_Procedure_Call_Statement
then
null;
-- For entry formals, we want to place the warning message on the
-- corresponding entity in the accept statement. The current scope
-- is the body of the accept, so we find the formal whose name
-- matches that of the entry formal (there is no link between the
-- two entities, and the one in the accept statement is only used
-- for conformance checking).
elsif Ekind (Scope (E)) = E_Entry then
declare
BE : Entity_Id;
begin
BE := First_Entity (Current_Scope);
while Present (BE) loop
if Chars (BE) = Chars (E) then
if Has_Pragma_Unused (E) then
Error_Msg_NE -- CODEFIX
("??pragma Unused given for&!", N, BE);
else
Error_Msg_NE -- CODEFIX
("??pragma Unreferenced given for&!", N, BE);
end if;
exit;
end if;
Next_Entity (BE);
end loop;
end;
-- Here we issue the warning, since this is a real reference
elsif Has_Pragma_Unused (E) then
Error_Msg_NE -- CODEFIX
("??pragma Unused given for&!", N, E);
else
Error_Msg_NE -- CODEFIX
("??pragma Unreferenced given for&!", N, E);
end if;
end if;
-- If this is a subprogram instance, mark as well the internal
-- subprogram in the wrapper package, which may be a visible
-- compilation unit.
if Is_Overloadable (E)
and then Is_Generic_Instance (E)
and then Present (Alias (E))
then
Set_Referenced (Alias (E));
end if;
end if;
-- Generate reference if all conditions are met:
if
-- Cross referencing must be active
Opt.Xref_Active
-- The entity must be one for which we collect references
and then Xref_Entity_Letters (Ekind (E)) /= ' '
-- Both Sloc values must be set to something sensible
and then Sloc (E) > No_Location
and then Sloc (N) > No_Location
-- Ignore references from within an instance. The only exceptions to
-- this are default subprograms, for which we generate an implicit
-- reference and compilations in SPARK mode.
and then
(Instantiation_Location (Sloc (N)) = No_Location
or else Typ = 'i'
or else GNATprove_Mode)
-- Ignore dummy references
and then Typ /= ' '
then
if Nkind (N) in N_Identifier
| N_Defining_Identifier
| N_Defining_Operator_Symbol
| N_Operator_Symbol
| N_Defining_Character_Literal
| N_Op
or else (Nkind (N) = N_Character_Literal
and then Sloc (Entity (N)) /= Standard_Location)
then
Nod := N;
elsif Nkind (N) in N_Expanded_Name | N_Selected_Component then
Nod := Selector_Name (N);
else
return;
end if;
-- Normal case of source entity comes from source
if Comes_From_Source (E) then
Ent := E;
-- Because a declaration may be generated for a subprogram body
-- without declaration in GNATprove mode, for inlining, some
-- parameters may end up being marked as not coming from source
-- although they are. Take these into account specially.
elsif GNATprove_Mode and then Is_Formal (E) then
Ent := E;
-- Entity does not come from source, but is a derived subprogram and
-- the derived subprogram comes from source (after one or more
-- derivations) in which case the reference is to parent subprogram.
elsif Is_Overloadable (E)
and then Present (Alias (E))
then
Ent := Alias (E);
while not Comes_From_Source (Ent) loop
if No (Alias (Ent)) then
return;
end if;
Ent := Alias (Ent);
end loop;
-- The internally created defining entity for a child subprogram
-- that has no previous spec has valid references.
elsif Is_Overloadable (E)
and then Is_Child_Unit (E)
then
Ent := E;
-- Ditto for the formals of such a subprogram
elsif Is_Overloadable (Scope (E))
and then Is_Child_Unit (Scope (E))
then
Ent := E;
-- Record components of discriminated subtypes or derived types must
-- be treated as references to the original component.
elsif Ekind (E) = E_Component
and then Comes_From_Source (Original_Record_Component (E))
then
Ent := Original_Record_Component (E);
-- If this is an expanded reference to a discriminant, recover the
-- original discriminant, which gets the reference.
elsif Ekind (E) = E_In_Parameter
and then Present (Discriminal_Link (E))
then
Ent := Discriminal_Link (E);
Set_Referenced (Ent);
-- Ignore reference to any other entity that is not from source
else
return;
end if;
-- In SPARK mode, consider the underlying entity renamed instead of
-- the renaming, which is needed to compute a valid set of effects
-- (reads, writes) for the enclosing subprogram.
if GNATprove_Mode then
Ent := Get_Through_Renamings (Ent);
-- If no enclosing object, then it could be a reference to any
-- location not tracked individually, like heap-allocated data.
-- Conservatively approximate this possibility by generating a
-- dereference, and return.
if No (Ent) then
if Actual_Typ = 'w' then
SPARK_Specific.Generate_Dereference (Nod, 'r');
SPARK_Specific.Generate_Dereference (Nod, 'w');
else
SPARK_Specific.Generate_Dereference (Nod, 'r');
end if;
return;
end if;
end if;
-- Record reference to entity
if Actual_Typ = 'p'
and then Is_Subprogram (Nod)
and then Present (Overridden_Operation (Nod))
then
Actual_Typ := 'P';
end if;
-- Comment needed here for special SPARK code ???
if GNATprove_Mode then
-- Ignore references to an entity which is a Part_Of single
-- concurrent object. Ideally we would prefer to add it as a
-- reference to the corresponding concurrent type, but it is quite
-- difficult (as such references are not currently added even for)
-- reads/writes of private protected components) and not worth the
-- effort.
if Ekind (Ent) in E_Abstract_State | E_Constant | E_Variable
and then Present (Encapsulating_State (Ent))
and then Is_Single_Concurrent_Object (Encapsulating_State (Ent))
then
return;
end if;
Ref := Sloc (Nod);
Def := Sloc (Ent);
Ref_Scope :=
SPARK_Specific.Enclosing_Subprogram_Or_Library_Package (Nod);
Ent_Scope :=
SPARK_Specific.Enclosing_Subprogram_Or_Library_Package (Ent);
-- Since we are reaching through renamings in SPARK mode, we may
-- end up with standard constants. Ignore those.
if Sloc (Ent_Scope) <= Standard_Location
or else Def <= Standard_Location
then
return;
end if;
Add_Entry
((Ent => Ent,
Loc => Ref,
Typ => Actual_Typ,
Eun => Get_Top_Level_Code_Unit (Def),
Lun => Get_Top_Level_Code_Unit (Ref),
Ref_Scope => Ref_Scope,
Ent_Scope => Ent_Scope),
Ent_Scope_File => Get_Top_Level_Code_Unit (Ent));
else
Ref := Original_Location (Sloc (Nod));
Def := Original_Location (Sloc (Ent));
-- If this is an operator symbol, skip the initial quote for
-- navigation purposes. This is not done for the end label,
-- where we want the actual position after the closing quote.
if Typ = 't' then
null;
elsif Nkind (N) = N_Defining_Operator_Symbol
or else Nkind (Nod) = N_Operator_Symbol
then
Ref := Ref + 1;
end if;
Add_Entry
((Ent => Ent,
Loc => Ref,
Typ => Actual_Typ,
Eun => Get_Source_Unit (Def),
Lun => Get_Source_Unit (Ref),
Ref_Scope => Empty,
Ent_Scope => Empty),
Ent_Scope_File => No_Unit);
-- Generate reference to the first private entity
if Typ = 'e'
and then Comes_From_Source (E)
and then Nkind (Ent) = N_Defining_Identifier
and then (Is_Package_Or_Generic_Package (Ent)
or else Is_Concurrent_Type (Ent))
and then Present (First_Private_Entity (E))
and then In_Extended_Main_Source_Unit (N)
then
-- Handle case in which the full-view and partial-view of the
-- first private entity are swapped.
declare
First_Private : Entity_Id := First_Private_Entity (E);
begin
if Is_Private_Type (First_Private)
and then Present (Full_View (First_Private))
then
First_Private := Full_View (First_Private);
end if;
Add_Entry
((Ent => Ent,
Loc => Sloc (First_Private),
Typ => 'E',
Eun => Get_Source_Unit (Def),
Lun => Get_Source_Unit (Ref),
Ref_Scope => Empty,
Ent_Scope => Empty),
Ent_Scope_File => No_Unit);
end;
end if;
end if;
end if;
end Generate_Reference;
-----------------------------------
-- Generate_Reference_To_Formals --
-----------------------------------
procedure Generate_Reference_To_Formals (E : Entity_Id) is
Formal : Entity_Id;
begin
if Is_Access_Subprogram_Type (E) then
Formal := First_Formal (Designated_Type (E));
else
Formal := First_Formal (E);
end if;
while Present (Formal) loop
if Ekind (Formal) = E_In_Parameter then
if Nkind (Parameter_Type (Parent (Formal))) = N_Access_Definition
then
Generate_Reference (E, Formal, '^', False);
else
Generate_Reference (E, Formal, '>', False);
end if;
elsif Ekind (Formal) = E_In_Out_Parameter then
Generate_Reference (E, Formal, '=', False);
else
Generate_Reference (E, Formal, '<', False);
end if;
Next_Formal (Formal);
end loop;
end Generate_Reference_To_Formals;
-------------------------------------------
-- Generate_Reference_To_Generic_Formals --
-------------------------------------------
procedure Generate_Reference_To_Generic_Formals (E : Entity_Id) is
Formal : Entity_Id;
begin
Formal := First_Entity (E);
while Present (Formal) loop
if Comes_From_Source (Formal) then
Generate_Reference (E, Formal, 'z', False);
end if;
Next_Entity (Formal);
end loop;
end Generate_Reference_To_Generic_Formals;
-------------
-- Get_Key --
-------------
function Get_Key (E : Xref_Entry_Number) return Xref_Entry_Number is
begin
return E;
end Get_Key;
----------------------------
-- Has_Deferred_Reference --
----------------------------
function Has_Deferred_Reference (Ent : Entity_Id) return Boolean is
begin
for J in Deferred_References.First .. Deferred_References.Last loop
if Deferred_References.Table (J).E = Ent then
return True;
end if;
end loop;
return False;
end Has_Deferred_Reference;
----------
-- Hash --
----------
function Hash (F : Xref_Entry_Number) return Header_Num is
-- It is unlikely to have two references to the same entity at the same
-- source location, so the hash function depends only on the Ent and Loc
-- fields.
XE : Xref_Entry renames Xrefs.Table (F);
type M is mod 2**32;
H : constant M := M (XE.Key.Ent) + 2 ** 7 * M (abs XE.Key.Loc);
-- It would be more natural to write:
--
-- H : constant M := M'Mod (XE.Key.Ent) + 2**7 * M'Mod (XE.Key.Loc);
--
-- But we can't use M'Mod, because it prevents bootstrapping with older
-- compilers. Loc can be negative, so we do "abs" before converting.
-- One day this can be cleaned up ???
begin
return Header_Num (H mod Num_Buckets);
end Hash;
-----------------
-- HT_Set_Next --
-----------------
procedure HT_Set_Next (E : Xref_Entry_Number; Next : Xref_Entry_Number) is
begin
Xrefs.Table (E).HTable_Next := Next;
end HT_Set_Next;
-------------
-- HT_Next --
-------------
function HT_Next (E : Xref_Entry_Number) return Xref_Entry_Number is
begin
return Xrefs.Table (E).HTable_Next;
end HT_Next;
----------------
-- Initialize --
----------------
procedure Initialize is
begin
Xrefs.Init;
end Initialize;
--------
-- Lt --
--------
function Lt (T1, T2 : Xref_Entry) return Boolean is
begin
-- First test: if entity is in different unit, sort by unit
if T1.Key.Eun /= T2.Key.Eun then
return Dependency_Num (T1.Key.Eun) < Dependency_Num (T2.Key.Eun);
-- Second test: within same unit, sort by entity Sloc
elsif T1.Def /= T2.Def then
return T1.Def < T2.Def;
-- Third test: sort definitions ahead of references
elsif T1.Key.Loc = No_Location then
return True;
elsif T2.Key.Loc = No_Location then
return False;
-- Fourth test: for same entity, sort by reference location unit
elsif T1.Key.Lun /= T2.Key.Lun then
return Dependency_Num (T1.Key.Lun) < Dependency_Num (T2.Key.Lun);
-- Fifth test: order of location within referencing unit
elsif T1.Key.Loc /= T2.Key.Loc then
return T1.Key.Loc < T2.Key.Loc;
-- Finally, for two locations at the same address, we prefer
-- the one that does NOT have the type 'r' so that a modification
-- or extension takes preference, when there are more than one
-- reference at the same location. As a result, in the case of
-- entities that are in-out actuals, the read reference follows
-- the modify reference.
else
return T2.Key.Typ = 'r';
end if;
end Lt;
-----------------------
-- Output_References --
-----------------------
procedure Output_References is
procedure Get_Type_Reference
(Ent : Entity_Id;
Tref : out Entity_Id;
Left : out Character;
Right : out Character);
-- Given an Entity_Id Ent, determines whether a type reference is
-- required. If so, Tref is set to the entity for the type reference
-- and Left and Right are set to the left/right brackets to be output
-- for the reference. If no type reference is required, then Tref is
-- set to Empty, and Left/Right are set to space.
procedure Output_Import_Export_Info (Ent : Entity_Id);
-- Output language and external name information for an interfaced
-- entity, using the format <language, external_name>.
------------------------
-- Get_Type_Reference --
------------------------
procedure Get_Type_Reference
(Ent : Entity_Id;
Tref : out Entity_Id;
Left : out Character;
Right : out Character)
is
Sav : Entity_Id;
begin
-- See if we have a type reference
Tref := Ent;
Left := '{';
Right := '}';
loop
Sav := Tref;
-- Processing for types
if Is_Type (Tref) then
-- Case of base type
if Base_Type (Tref) = Tref then
-- If derived, then get first subtype
if Tref /= Etype (Tref) then
Tref := First_Subtype (Etype (Tref));
-- Set brackets for derived type, but don't override
-- pointer case since the fact that something is a
-- pointer is more important.
if Left /= '(' then
Left := '<';
Right := '>';
end if;
-- If the completion of a private type is itself a derived
-- type, we need the parent of the full view.
elsif Is_Private_Type (Tref)
and then Present (Full_View (Tref))
and then Etype (Full_View (Tref)) /= Full_View (Tref)
then
Tref := Etype (Full_View (Tref));
if Left /= '(' then
Left := '<';
Right := '>';
end if;
-- If non-derived pointer, get directly designated type.
-- If the type has a full view, all references are on the
-- partial view that is seen first.
elsif Is_Access_Type (Tref) then
Tref := Directly_Designated_Type (Tref);
Left := '(';
Right := ')';
elsif Is_Private_Type (Tref)
and then Present (Full_View (Tref))
then
if Is_Access_Type (Full_View (Tref)) then
Tref := Directly_Designated_Type (Full_View (Tref));
Left := '(';
Right := ')';
-- If the full view is an array type, we also retrieve
-- the corresponding component type, because the ali
-- entry already indicates that this is an array.
elsif Is_Array_Type (Full_View (Tref)) then
Tref := Component_Type (Full_View (Tref));
Left := '(';
Right := ')';
end if;
-- If non-derived array, get component type. Skip component
-- type for case of String or Wide_String, saves worthwhile
-- space.
elsif Is_Array_Type (Tref)
and then Tref /= Standard_String
and then Tref /= Standard_Wide_String
then
Tref := Component_Type (Tref);
Left := '(';
Right := ')';
-- For other non-derived base types, nothing
else
exit;
end if;
-- For a subtype, go to ancestor subtype
else
Tref := Ancestor_Subtype (Tref);
-- If no ancestor subtype, go to base type
if No (Tref) then
Tref := Base_Type (Sav);
end if;
end if;
-- For objects, functions, enum literals, just get type from
-- Etype field.
elsif Is_Object (Tref)
or else Ekind (Tref) = E_Enumeration_Literal
or else Ekind (Tref) = E_Function
or else Ekind (Tref) = E_Operator
then
Tref := Etype (Tref);
-- Another special case: an object of a classwide type
-- initialized with a tag-indeterminate call gets a subtype
-- of the classwide type during expansion. See if the original
-- type in the declaration is named, and return it instead
-- of going to the root type. The expression may be a class-
-- wide function call whose result is on the secondary stack,
-- which forces the declaration to be rewritten as a renaming,
-- so examine the source declaration.
if Ekind (Tref) = E_Class_Wide_Subtype then
declare
Decl : constant Node_Id := Original_Node (Parent (Ent));
begin
if Nkind (Decl) = N_Object_Declaration
and then Is_Entity_Name
(Original_Node (Object_Definition (Decl)))
then
Tref :=
Entity (Original_Node (Object_Definition (Decl)));
end if;
end;
-- For a function that returns a class-wide type, Tref is
-- already correct.
elsif Is_Overloadable (Ent)
and then Is_Class_Wide_Type (Tref)
then
return;
end if;
-- For anything else, exit
else
exit;
end if;
-- Exit if no type reference, or we are stuck in some loop trying
-- to find the type reference, or if the type is standard void
-- type (the latter is an implementation artifact that should not
-- show up in the generated cross-references).
exit when No (Tref)
or else Tref = Sav
or else Tref = Standard_Void_Type;
-- If we have a usable type reference, return, otherwise keep
-- looking for something useful (we are looking for something
-- that either comes from source or standard)
if Sloc (Tref) = Standard_Location
or else Comes_From_Source (Tref)
then
-- If the reference is a subtype created for a generic actual,
-- go actual directly, the inner subtype is not user visible.
if Nkind (Parent (Tref)) = N_Subtype_Declaration
and then not Comes_From_Source (Parent (Tref))
and then
(Is_Wrapper_Package (Scope (Tref))
or else Is_Generic_Instance (Scope (Tref)))
then
Tref := First_Subtype (Base_Type (Tref));
end if;
return;
end if;
end loop;
-- If we fall through the loop, no type reference
Tref := Empty;
Left := ' ';
Right := ' ';
end Get_Type_Reference;
-------------------------------
-- Output_Import_Export_Info --
-------------------------------
procedure Output_Import_Export_Info (Ent : Entity_Id) is
Language_Name : Name_Id;
Conv : constant Convention_Id := Convention (Ent);
begin
-- Generate language name from convention
if Conv = Convention_C or else Conv in Convention_C_Variadic then
Language_Name := Name_C;
elsif Conv = Convention_CPP then
Language_Name := Name_CPP;
elsif Conv = Convention_Ada then
Language_Name := Name_Ada;
else
-- For the moment we ignore all other cases ???
return;
end if;
Write_Info_Char ('<');
Get_Unqualified_Name_String (Language_Name);
for J in 1 .. Name_Len loop
Write_Info_Char (Name_Buffer (J));
end loop;
if Present (Interface_Name (Ent)) then
Write_Info_Char (',');
String_To_Name_Buffer (Strval (Interface_Name (Ent)));
for J in 1 .. Name_Len loop
Write_Info_Char (Name_Buffer (J));
end loop;
end if;
Write_Info_Char ('>');
end Output_Import_Export_Info;
-- Start of processing for Output_References
begin
-- First we add references to the primitive operations of tagged types
-- declared in the main unit.
Handle_Prim_Ops : declare
Ent : Entity_Id;
begin
for J in 1 .. Xrefs.Last loop
Ent := Xrefs.Table (J).Key.Ent;
if Is_Type (Ent)
and then Is_Tagged_Type (Ent)
and then Is_Base_Type (Ent)
and then In_Extended_Main_Source_Unit (Ent)
then
Generate_Prim_Op_References (Ent);
end if;
end loop;
end Handle_Prim_Ops;
-- Before we go ahead and output the references we have a problem
-- that needs dealing with. So far we have captured things that are
-- definitely referenced by the main unit, or defined in the main
-- unit. That's because we don't want to clutter up the ali file
-- for this unit with definition lines for entities in other units
-- that are not referenced.
-- But there is a glitch. We may reference an entity in another unit,
-- and it may have a type reference to an entity that is not directly
-- referenced in the main unit, which may mean that there is no xref
-- entry for this entity yet in the list of references.
-- If we don't do something about this, we will end with an orphan type
-- reference, i.e. it will point to an entity that does not appear
-- within the generated references in the ali file. That is not good for
-- tools using the xref information.
-- To fix this, we go through the references adding definition entries
-- for any unreferenced entities that can be referenced in a type
-- reference. There is a recursion problem here, and that is dealt with
-- by making sure that this traversal also traverses any entries that
-- get added by the traversal.
Handle_Orphan_Type_References : declare
J : Nat;
Tref : Entity_Id;
Ent : Entity_Id;
L, R : Character;
pragma Warnings (Off, L);
pragma Warnings (Off, R);
procedure New_Entry (E : Entity_Id);
-- Make an additional entry into the Xref table for a type entity
-- that is related to the current entity (parent, type ancestor,
-- progenitor, etc.).
----------------
-- New_Entry --
----------------
procedure New_Entry (E : Entity_Id) is
begin
pragma Assert (Present (E));
if not Has_Xref_Entry (Implementation_Base_Type (E))
and then Sloc (E) > No_Location
then
Add_Entry
((Ent => E,
Loc => No_Location,
Typ => Character'First,
Eun => Get_Source_Unit (Original_Location (Sloc (E))),
Lun => No_Unit,
Ref_Scope => Empty,
Ent_Scope => Empty),
Ent_Scope_File => No_Unit);
end if;
end New_Entry;
-- Start of processing for Handle_Orphan_Type_References
begin
-- Note that this is not a for loop for a very good reason. The
-- processing of items in the table can add new items to the table,
-- and they must be processed as well.
J := 1;
while J <= Xrefs.Last loop
Ent := Xrefs.Table (J).Key.Ent;
-- Do not generate reference information for an ignored Ghost
-- entity because neither the entity nor its references will
-- appear in the final tree.
if Is_Ignored_Ghost_Entity (Ent) then
goto Orphan_Continue;
end if;
Get_Type_Reference (Ent, Tref, L, R);
if Present (Tref)
and then not Has_Xref_Entry (Tref)
and then Sloc (Tref) > No_Location
then
New_Entry (Tref);
if Is_Record_Type (Ent)
and then Present (Interfaces (Ent))
then
-- Add an entry for each one of the given interfaces
-- implemented by type Ent.
declare
Elmt : Elmt_Id := First_Elmt (Interfaces (Ent));
begin
while Present (Elmt) loop
New_Entry (Node (Elmt));
Next_Elmt (Elmt);
end loop;
end;
end if;
end if;
-- Collect inherited primitive operations that may be declared in
-- another unit and have no visible reference in the current one.
if Is_Type (Ent)
and then Is_Tagged_Type (Ent)
and then Is_Derived_Type (Ent)
and then Is_Base_Type (Ent)
and then In_Extended_Main_Source_Unit (Ent)
then
declare
Op_List : constant Elist_Id := Primitive_Operations (Ent);
Op : Elmt_Id;
Prim : Entity_Id;
function Parent_Op (E : Entity_Id) return Entity_Id;
-- Find original operation, which may be inherited through
-- several derivations.
function Parent_Op (E : Entity_Id) return Entity_Id is
Orig_Op : constant Entity_Id := Alias (E);
begin
if No (Orig_Op) then
return Empty;
elsif not Comes_From_Source (E)
and then not Has_Xref_Entry (Orig_Op)
and then Comes_From_Source (Orig_Op)
then
return Orig_Op;
else
return Parent_Op (Orig_Op);
end if;
end Parent_Op;
begin
Op := First_Elmt (Op_List);
while Present (Op) loop
Prim := Parent_Op (Node (Op));
if Present (Prim) then
Add_Entry
((Ent => Prim,
Loc => No_Location,
Typ => Character'First,
Eun => Get_Source_Unit (Sloc (Prim)),
Lun => No_Unit,
Ref_Scope => Empty,
Ent_Scope => Empty),
Ent_Scope_File => No_Unit);
end if;
Next_Elmt (Op);
end loop;
end;
end if;
<<Orphan_Continue>>
J := J + 1;
end loop;
end Handle_Orphan_Type_References;
-- Now we have all the references, including those for any embedded type
-- references, so we can sort them, and output them.
Output_Refs : declare
Nrefs : constant Nat := Xrefs.Last;
-- Number of references in table
Rnums : array (0 .. Nrefs) of Nat;
-- This array contains numbers of references in the Xrefs table.
-- This list is sorted in output order. The extra 0'th entry is
-- convenient for the call to sort. When we sort the table, we
-- move the entries in Rnums around, but we do not move the
-- original table entries.
Curxu : Unit_Number_Type;
-- Current xref unit
Curru : Unit_Number_Type;
-- Current reference unit for one entity
Curent : Entity_Id;
-- Current entity
Curnam : String (1 .. Name_Buffer'Length);
Curlen : Natural;
-- Simple name and length of current entity
Curdef : Source_Ptr;
-- Original source location for current entity
Crloc : Source_Ptr;
-- Current reference location
Ctyp : Character;
-- Entity type character
Prevt : Character;
-- reference kind of previous reference
Tref : Entity_Id;
-- Type reference
Rref : Node_Id;
-- Renaming reference
Trunit : Unit_Number_Type;
-- Unit number for type reference
function Lt (Op1, Op2 : Natural) return Boolean;
-- Comparison function for Sort call
function Name_Change (X : Entity_Id) return Boolean;
-- Determines if entity X has a different simple name from Curent
procedure Move (From : Natural; To : Natural);
-- Move procedure for Sort call
package Sorting is new GNAT.Heap_Sort_G (Move, Lt);
--------
-- Lt --
--------
function Lt (Op1, Op2 : Natural) return Boolean is
T1 : Xref_Entry renames Xrefs.Table (Rnums (Nat (Op1)));
T2 : Xref_Entry renames Xrefs.Table (Rnums (Nat (Op2)));
begin
return Lt (T1, T2);
end Lt;
----------
-- Move --
----------
procedure Move (From : Natural; To : Natural) is
begin
Rnums (Nat (To)) := Rnums (Nat (From));
end Move;
-----------------
-- Name_Change --
-----------------
-- Why a string comparison here??? Why not compare Name_Id values???
function Name_Change (X : Entity_Id) return Boolean is
begin
Get_Unqualified_Name_String (Chars (X));
if Name_Len /= Curlen then
return True;
else
return Name_Buffer (1 .. Curlen) /= Curnam (1 .. Curlen);
end if;
end Name_Change;
-- Start of processing for Output_Refs
begin
-- Capture the definition Sloc values. We delay doing this till now,
-- since at the time the reference or definition is made, private
-- types may be swapped, and the Sloc value may be incorrect. We
-- also set up the pointer vector for the sort.
-- For user-defined operators we need to skip the initial quote and
-- point to the first character of the name, for navigation purposes.
for J in 1 .. Nrefs loop
declare
E : constant Entity_Id := Xrefs.Table (J).Key.Ent;
Loc : constant Source_Ptr := Original_Location (Sloc (E));
begin
Rnums (J) := J;
if Nkind (E) = N_Defining_Operator_Symbol then
Xrefs.Table (J).Def := Loc + 1;
else
Xrefs.Table (J).Def := Loc;
end if;
end;
end loop;
-- Sort the references
Sorting.Sort (Integer (Nrefs));
-- Initialize loop through references
Curxu := No_Unit;
Curent := Empty;
Curdef := No_Location;
Curru := No_Unit;
Crloc := No_Location;
Prevt := 'm';
-- Loop to output references
for Refno in 1 .. Nrefs loop
Output_One_Ref : declare
Ent : Entity_Id;
XE : Xref_Entry renames Xrefs.Table (Rnums (Refno));
-- The current entry to be accessed
Left : Character;
Right : Character;
-- Used for {} or <> or () for type reference
procedure Check_Type_Reference
(Ent : Entity_Id;
List_Interface : Boolean;
Is_Component : Boolean := False);
-- Find whether there is a meaningful type reference for
-- Ent, and display it accordingly. If List_Interface is
-- true, then Ent is a progenitor interface of the current
-- type entity being listed. In that case list it as is,
-- without looking for a type reference for it. Flag is also
-- used for index types of an array type, where the caller
-- supplies the intended type reference. Is_Component serves
-- the same purpose, to display the component type of a
-- derived array type, for which only the parent type has
-- ben displayed so far.
procedure Output_Instantiation_Refs (Loc : Source_Ptr);
-- Recursive procedure to output instantiation references for
-- the given source ptr in [file|line[...]] form. No output
-- if the given location is not a generic template reference.
procedure Output_Overridden_Op (Old_E : Entity_Id);
-- For a subprogram that is overriding, display information
-- about the inherited operation that it overrides.
--------------------------
-- Check_Type_Reference --
--------------------------
procedure Check_Type_Reference
(Ent : Entity_Id;
List_Interface : Boolean;
Is_Component : Boolean := False)
is
begin
if List_Interface then
-- This is a progenitor interface of the type for which
-- xref information is being generated.
Tref := Ent;
Left := '<';
Right := '>';
-- The following is not documented in lib-xref.ads ???
elsif Is_Component then
Tref := Ent;
Left := '(';
Right := ')';
else
Get_Type_Reference (Ent, Tref, Left, Right);
end if;
if Present (Tref) then
-- Case of standard entity, output name
if Sloc (Tref) = Standard_Location then
Write_Info_Char (Left);
Write_Info_Name (Chars (Tref));
Write_Info_Char (Right);
-- Case of source entity, output location
else
Write_Info_Char (Left);
Trunit := Get_Source_Unit (Sloc (Tref));
if Trunit /= Curxu then
Write_Info_Nat (Dependency_Num (Trunit));
Write_Info_Char ('|');
end if;
Write_Info_Nat
(Int (Get_Logical_Line_Number (Sloc (Tref))));
declare
Ent : Entity_Id;
Ctyp : Character;
begin
Ent := Tref;
Ctyp := Xref_Entity_Letters (Ekind (Ent));
if Ctyp = '+'
and then Present (Full_View (Ent))
then
Ent := Underlying_Type (Ent);
if Present (Ent) then
Ctyp := Xref_Entity_Letters (Ekind (Ent));
end if;
end if;
Write_Info_Char (Ctyp);
end;
Write_Info_Nat
(Int (Get_Column_Number (Sloc (Tref))));
-- If the type comes from an instantiation, add the
-- corresponding info.
Output_Instantiation_Refs (Sloc (Tref));
Write_Info_Char (Right);
end if;
end if;
end Check_Type_Reference;
-------------------------------
-- Output_Instantiation_Refs --
-------------------------------
procedure Output_Instantiation_Refs (Loc : Source_Ptr) is
Iloc : constant Source_Ptr := Instantiation_Location (Loc);
Lun : Unit_Number_Type;
Cu : constant Unit_Number_Type := Curru;
begin
-- Nothing to do if this is not an instantiation
if Iloc = No_Location then
return;
end if;
-- Output instantiation reference
Write_Info_Char ('[');
Lun := Get_Source_Unit (Iloc);
if Lun /= Curru then
Curru := Lun;
Write_Info_Nat (Dependency_Num (Curru));
Write_Info_Char ('|');
end if;
Write_Info_Nat (Int (Get_Logical_Line_Number (Iloc)));
-- Recursive call to get nested instantiations
Output_Instantiation_Refs (Iloc);
-- Output final ] after call to get proper nesting
Write_Info_Char (']');
Curru := Cu;
return;
end Output_Instantiation_Refs;
--------------------------
-- Output_Overridden_Op --
--------------------------
procedure Output_Overridden_Op (Old_E : Entity_Id) is
Op : Entity_Id;
begin
-- The overridden operation has an implicit declaration
-- at the point of derivation. What we want to display
-- is the original operation, which has the actual body
-- (or abstract declaration) that is being overridden.
-- The overridden operation is not always set, e.g. when
-- it is a predefined operator.
if No (Old_E) then
return;
-- Follow alias chain if one is present
elsif Present (Alias (Old_E)) then
-- The subprogram may have been implicitly inherited
-- through several levels of derivation, so find the
-- ultimate (source) ancestor.
Op := Ultimate_Alias (Old_E);
-- Normal case of no alias present. We omit generated
-- primitives like tagged equality, that have no source
-- representation.
else
Op := Old_E;
end if;
if Present (Op)
and then Sloc (Op) /= Standard_Location
and then Comes_From_Source (Op)
then
declare
Loc : constant Source_Ptr := Sloc (Op);
Par_Unit : constant Unit_Number_Type :=
Get_Source_Unit (Loc);
begin
Write_Info_Char ('<');
if Par_Unit /= Curxu then
Write_Info_Nat (Dependency_Num (Par_Unit));
Write_Info_Char ('|');
end if;
Write_Info_Nat (Int (Get_Logical_Line_Number (Loc)));
Write_Info_Char ('p');
Write_Info_Nat (Int (Get_Column_Number (Loc)));
Write_Info_Char ('>');
end;
end if;
end Output_Overridden_Op;
-- Start of processing for Output_One_Ref
begin
Ent := XE.Key.Ent;
-- Do not generate reference information for an ignored Ghost
-- entity because neither the entity nor its references will
-- appear in the final tree.
if Is_Ignored_Ghost_Entity (Ent) then
goto Continue;
end if;
Ctyp := Xref_Entity_Letters (Ekind (Ent));
-- Skip reference if it is the only reference to an entity,
-- and it is an END line reference, and the entity is not in
-- the current extended source. This prevents junk entries
-- consisting only of packages with END lines, where no
-- entity from the package is actually referenced.
if XE.Key.Typ = 'e'
and then Ent /= Curent
and then (Refno = Nrefs
or else
Ent /= Xrefs.Table (Rnums (Refno + 1)).Key.Ent)
and then not In_Extended_Main_Source_Unit (Ent)
then
goto Continue;
end if;
-- For private type, get full view type
if Ctyp = '+'
and then Present (Full_View (XE.Key.Ent))
then
Ent := Underlying_Type (Ent);
if Present (Ent) then
Ctyp := Xref_Entity_Letters (Ekind (Ent));
end if;
end if;
-- Special exception for Boolean
if Ctyp = 'E' and then Is_Boolean_Type (Ent) then
Ctyp := 'B';
end if;
-- For variable reference, get corresponding type
if Ctyp = '*' then
Ent := Etype (XE.Key.Ent);
Ctyp := Fold_Lower (Xref_Entity_Letters (Ekind (Ent)));
-- If variable is private type, get full view type
if Ctyp = '+'
and then Present (Full_View (Etype (XE.Key.Ent)))
then
Ent := Underlying_Type (Etype (XE.Key.Ent));
if Present (Ent) then
Ctyp := Fold_Lower (Xref_Entity_Letters (Ekind (Ent)));
end if;
elsif Is_Generic_Type (Ent) then
-- If the type of the entity is a generic private type,
-- there is no usable full view, so retain the indication
-- that this is an object.
Ctyp := '*';
end if;
-- Special handling for access parameters and objects and
-- components of an anonymous access type.
if Ekind (Etype (XE.Key.Ent)) in
E_Anonymous_Access_Type
| E_Anonymous_Access_Subprogram_Type
| E_Anonymous_Access_Protected_Subprogram_Type
then
if Is_Formal (XE.Key.Ent)
or else
Ekind (XE.Key.Ent) in
E_Variable | E_Constant | E_Component
then
Ctyp := 'p';
end if;
-- Special handling for Boolean
elsif Ctyp = 'e' and then Is_Boolean_Type (Ent) then
Ctyp := 'b';
end if;
end if;
-- Special handling for abstract types and operations
if Is_Overloadable (XE.Key.Ent)
and then Is_Abstract_Subprogram (XE.Key.Ent)
then
if Ctyp = 'U' then
Ctyp := 'x'; -- Abstract procedure
elsif Ctyp = 'V' then
Ctyp := 'y'; -- Abstract function
end if;
elsif Is_Type (XE.Key.Ent)
and then Is_Abstract_Type (XE.Key.Ent)
then
if Is_Interface (XE.Key.Ent) then
Ctyp := 'h';
elsif Ctyp = 'R' then
Ctyp := 'H'; -- Abstract type
end if;
end if;
-- Only output reference if interesting type of entity
if Ctyp = ' '
-- Suppress references to object definitions, used for local
-- references.
or else XE.Key.Typ = 'D'
or else XE.Key.Typ = 'I'
-- Suppress self references, except for bodies that act as
-- specs.
or else (XE.Key.Loc = XE.Def
and then
(XE.Key.Typ /= 'b'
or else not Is_Subprogram (XE.Key.Ent)))
-- Also suppress definitions of body formals (we only
-- treat these as references, and the references were
-- separately recorded).
or else (Is_Formal (XE.Key.Ent)
and then Present (Spec_Entity (XE.Key.Ent)))
then
null;
else
-- Start new Xref section if new xref unit
if XE.Key.Eun /= Curxu then
if Write_Info_Col > 1 then
Write_Info_EOL;
end if;
Curxu := XE.Key.Eun;
Write_Info_Initiate ('X');
Write_Info_Char (' ');
Write_Info_Nat (Dependency_Num (XE.Key.Eun));
Write_Info_Char (' ');
Write_Info_Name
(Reference_Name (Source_Index (XE.Key.Eun)));
end if;
-- Start new Entity line if new entity. Note that we
-- consider two entities the same if they have the same
-- name and source location. This causes entities in
-- instantiations to be treated as though they referred
-- to the template.
if No (Curent)
or else
(XE.Key.Ent /= Curent
and then
(Name_Change (XE.Key.Ent) or else XE.Def /= Curdef))
then
Curent := XE.Key.Ent;
Curdef := XE.Def;
Get_Unqualified_Name_String (Chars (XE.Key.Ent));
Curlen := Name_Len;
Curnam (1 .. Curlen) := Name_Buffer (1 .. Curlen);
if Write_Info_Col > 1 then
Write_Info_EOL;
end if;
-- Write column number information
Write_Info_Nat (Int (Get_Logical_Line_Number (XE.Def)));
Write_Info_Char (Ctyp);
Write_Info_Nat (Int (Get_Column_Number (XE.Def)));
-- Write level information
Write_Level_Info : declare
function Is_Visible_Generic_Entity
(E : Entity_Id) return Boolean;
-- Check whether E is declared in the visible part
-- of a generic package. For source navigation
-- purposes, treat this as a visible entity.
function Is_Private_Record_Component
(E : Entity_Id) return Boolean;
-- Check whether E is a non-inherited component of a
-- private extension. Even if the enclosing record is
-- public, we want to treat the component as private
-- for navigation purposes.
---------------------------------
-- Is_Private_Record_Component --
---------------------------------
function Is_Private_Record_Component
(E : Entity_Id) return Boolean
is
S : constant Entity_Id := Scope (E);
begin
return
Ekind (E) = E_Component
and then Nkind (Declaration_Node (S)) =
N_Private_Extension_Declaration
and then Original_Record_Component (E) = E;
end Is_Private_Record_Component;
-------------------------------
-- Is_Visible_Generic_Entity --
-------------------------------
function Is_Visible_Generic_Entity
(E : Entity_Id) return Boolean
is
Par : Node_Id;
begin
-- The Present check here is an error defense
if Present (Scope (E))
and then Ekind (Scope (E)) /= E_Generic_Package
then
return False;
end if;
Par := Parent (E);
while Present (Par) loop
if
Nkind (Par) = N_Generic_Package_Declaration
then
-- Entity is a generic formal
return False;
elsif
Nkind (Parent (Par)) = N_Package_Specification
then
return
Is_List_Member (Par)
and then List_Containing (Par) =
Visible_Declarations (Parent (Par));
else
Par := Parent (Par);
end if;
end loop;
return False;
end Is_Visible_Generic_Entity;
-- Start of processing for Write_Level_Info
begin
if Is_Hidden (Curent)
or else Is_Private_Record_Component (Curent)
then
Write_Info_Char (' ');
elsif
Is_Public (Curent)
or else Is_Visible_Generic_Entity (Curent)
then
Write_Info_Char ('*');
else
Write_Info_Char (' ');
end if;
end Write_Level_Info;
-- Output entity name. We use the occurrence from the
-- actual source program at the definition point.
declare
Ent_Name : constant String :=
Exact_Source_Name (Sloc (XE.Key.Ent));
begin
for C in Ent_Name'Range loop
Write_Info_Char (Ent_Name (C));
end loop;
end;
-- See if we have a renaming reference
if Is_Object (XE.Key.Ent)
and then Present (Renamed_Object (XE.Key.Ent))
then
Rref := Renamed_Object (XE.Key.Ent);
elsif Is_Overloadable (XE.Key.Ent)
and then Nkind (Parent (Declaration_Node (XE.Key.Ent)))
= N_Subprogram_Renaming_Declaration
then
Rref := Name (Parent (Declaration_Node (XE.Key.Ent)));
elsif Ekind (XE.Key.Ent) = E_Package
and then Nkind (Declaration_Node (XE.Key.Ent)) =
N_Package_Renaming_Declaration
then
Rref := Name (Declaration_Node (XE.Key.Ent));
else
Rref := Empty;
end if;
if Present (Rref) then
if Nkind (Rref) = N_Expanded_Name then
Rref := Selector_Name (Rref);
end if;
if Nkind (Rref) = N_Identifier
or else Nkind (Rref) = N_Operator_Symbol
then
null;
-- For renamed array components, use the array name
-- for the renamed entity, which reflect the fact that
-- in general the whole array is aliased.
elsif Nkind (Rref) = N_Indexed_Component then
if Nkind (Prefix (Rref)) = N_Identifier then
Rref := Prefix (Rref);
elsif Nkind (Prefix (Rref)) = N_Expanded_Name then
Rref := Selector_Name (Prefix (Rref));
else
Rref := Empty;
end if;
else
Rref := Empty;
end if;
end if;
-- Write out renaming reference if we have one
if Present (Rref) then
Write_Info_Char ('=');
Write_Info_Nat
(Int (Get_Logical_Line_Number (Sloc (Rref))));
Write_Info_Char (':');
Write_Info_Nat
(Int (Get_Column_Number (Sloc (Rref))));
end if;
-- Indicate that the entity is in the unit of the current
-- xref section.
Curru := Curxu;
-- Write out information about generic parent, if entity
-- is an instance.
if Is_Generic_Instance (XE.Key.Ent) then
declare
Gen_Par : constant Entity_Id :=
Generic_Parent
(Specification
(Unit_Declaration_Node
(XE.Key.Ent)));
Loc : constant Source_Ptr := Sloc (Gen_Par);
Gen_U : constant Unit_Number_Type :=
Get_Source_Unit (Loc);
begin
Write_Info_Char ('[');
if Curru /= Gen_U then
Write_Info_Nat (Dependency_Num (Gen_U));
Write_Info_Char ('|');
end if;
Write_Info_Nat
(Int (Get_Logical_Line_Number (Loc)));
Write_Info_Char (']');
end;
end if;
-- See if we have a type reference and if so output
Check_Type_Reference (XE.Key.Ent, False);
-- Additional information for types with progenitors,
-- including synchronized tagged types.
declare
Typ : constant Entity_Id := XE.Key.Ent;
Elmt : Elmt_Id;
begin
if Is_Record_Type (Typ)
and then Present (Interfaces (Typ))
then
Elmt := First_Elmt (Interfaces (Typ));
elsif Is_Concurrent_Type (Typ)
and then Present (Corresponding_Record_Type (Typ))
and then Present (
Interfaces (Corresponding_Record_Type (Typ)))
then
Elmt :=
First_Elmt (
Interfaces (Corresponding_Record_Type (Typ)));
else
Elmt := No_Elmt;
end if;
while Present (Elmt) loop
Check_Type_Reference (Node (Elmt), True);
Next_Elmt (Elmt);
end loop;
end;
-- For array types, list index types as well. (This is
-- not C, indexes have distinct types).
if Is_Array_Type (XE.Key.Ent) then
declare
A_Typ : constant Entity_Id := XE.Key.Ent;
Indx : Node_Id;
begin
-- If this is a derived array type, we have
-- output the parent type, so add the component
-- type now.
if Is_Derived_Type (A_Typ) then
Check_Type_Reference
(Component_Type (A_Typ), False, True);
end if;
-- Add references to index types.
Indx := First_Index (XE.Key.Ent);
while Present (Indx) loop
Check_Type_Reference
(First_Subtype (Etype (Indx)), True);
Next_Index (Indx);
end loop;
end;
end if;
-- If the entity is an overriding operation, write info
-- on operation that was overridden.
if Is_Subprogram (XE.Key.Ent)
and then Present (Overridden_Operation (XE.Key.Ent))
then
Output_Overridden_Op
(Overridden_Operation (XE.Key.Ent));
end if;
-- End of processing for entity output
Crloc := No_Location;
end if;
-- Output the reference if it is not as the same location
-- as the previous one, or it is a read-reference that
-- indicates that the entity is an in-out actual in a call.
if XE.Key.Loc /= No_Location
and then
(XE.Key.Loc /= Crloc
or else (Prevt = 'm' and then XE.Key.Typ = 'r'))
then
Crloc := XE.Key.Loc;
Prevt := XE.Key.Typ;
-- Start continuation if line full, else blank
if Write_Info_Col > 72 then
Write_Info_EOL;
Write_Info_Initiate ('.');
end if;
Write_Info_Char (' ');
-- Output file number if changed
if XE.Key.Lun /= Curru then
Curru := XE.Key.Lun;
Write_Info_Nat (Dependency_Num (Curru));
Write_Info_Char ('|');
end if;
Write_Info_Nat
(Int (Get_Logical_Line_Number (XE.Key.Loc)));
Write_Info_Char (XE.Key.Typ);
if Is_Overloadable (XE.Key.Ent) then
if (Is_Imported (XE.Key.Ent) and then XE.Key.Typ = 'b')
or else
(Is_Exported (XE.Key.Ent) and then XE.Key.Typ = 'i')
then
Output_Import_Export_Info (XE.Key.Ent);
end if;
end if;
Write_Info_Nat (Int (Get_Column_Number (XE.Key.Loc)));
Output_Instantiation_Refs (Sloc (XE.Key.Ent));
end if;
end if;
end Output_One_Ref;
<<Continue>>
null;
end loop;
Write_Info_EOL;
end Output_Refs;
end Output_References;
---------------------------------
-- Process_Deferred_References --
---------------------------------
procedure Process_Deferred_References is
begin
for J in Deferred_References.First .. Deferred_References.Last loop
declare
D : Deferred_Reference_Entry renames Deferred_References.Table (J);
begin
case Known_To_Be_Assigned (D.N) is
when True =>
Generate_Reference (D.E, D.N, 'm');
when False =>
Generate_Reference (D.E, D.N, 'r');
end case;
end;
end loop;
-- Clear processed entries from table
Deferred_References.Init;
end Process_Deferred_References;
-- Start of elaboration for Lib.Xref
begin
-- Reset is necessary because Elmt_Ptr does not default to Null_Ptr,
-- because it's not an access type.
Xref_Set.Reset;
end Lib.Xref;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.