repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
mgrojo/smk | Ada | 1,583 | ads | -- -----------------------------------------------------------------------------
-- smk, the smart make
-- © 2018 Lionel Draghi <[email protected]>
-- SPDX-License-Identifier: APSL-2.0
-- -----------------------------------------------------------------------------
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
-- http://www.apache.org/licenses/LICENSE-2.0
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-- -----------------------------------------------------------------------------
-- -----------------------------------------------------------------------------
-- Package: smk specification
--
-- Purpose:
-- This package is empty. Child units do the real job :
--
-- procedure <Smk.Main> - is in charge of
-- controlling the execution flow according to the command line
-- package <Smk.Cmd_Line> - do the command line analysis
-- package <Smk.Settings> - global settings, resulting mainly from
-- cmd line analysis (and env. variables in the future)
-- ...
--
-- Effects:
--
-- Limitations:
--
-- Performance:
--
-- -----------------------------------------------------------------------------
package Smk is
pragma Pure;
end Smk;
|
damaki/libkeccak | Ada | 19,927 | adb | -------------------------------------------------------------------------------
-- Copyright (c) 2019, Daniel King
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
-- * Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * The name of the copyright holder may not be used to endorse or promote
-- Products derived from this software without specific prior written
-- permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------
with Interfaces; use Interfaces;
package body Keccak.Generic_KeccakF.Optimized_Permutation
is
-- This implementation is ported from the Optimized implementation by
-- the Keccak, Keyak, and Ketje teams provided in the Keccak Code Package.
procedure Permute (S : in out State)
is
type Round_Constants is array (Round_Index) of Interfaces.Unsigned_64;
Max_Rounds : constant Positive := 12 + (Lane_Size_Log * 2);
First_Round : constant Round_Index := Round_Index (Max_Rounds - 1)
- Round_Index (Num_Rounds - 1);
RC : constant Round_Constants :=
(
16#0000_0000_0000_0001#,
16#0000_0000_0000_8082#,
16#8000_0000_0000_808A#,
16#8000_0000_8000_8000#,
16#0000_0000_0000_808B#,
16#0000_0000_8000_0001#,
16#8000_0000_8000_8081#,
16#8000_0000_0000_8009#,
16#0000_0000_0000_008A#,
16#0000_0000_0000_0088#,
16#0000_0000_8000_8009#,
16#0000_0000_8000_000A#,
16#0000_0000_8000_808B#,
16#8000_0000_0000_008B#,
16#8000_0000_0000_8089#,
16#8000_0000_0000_8003#,
16#8000_0000_0000_8002#,
16#8000_0000_0000_0080#,
16#0000_0000_0000_800A#,
16#8000_0000_8000_000A#,
16#8000_0000_8000_8081#,
16#8000_0000_0000_8080#,
16#0000_0000_8000_0001#,
16#8000_0000_8000_8008#
);
Aba, Abe, Abi, Abo, Abu : Lane_Type;
Aga, Age, Agi, Ago, Agu : Lane_Type;
Aka, Ake, Aki, Ako, Aku : Lane_Type;
Ama, Ame, Ami, Amo, Amu : Lane_Type;
Asa, Ase, Asi, Aso, Asu : Lane_Type;
Ca, Ce, Ci, Co, Cu : Lane_Type;
Eba, Ebe, Ebi, Ebo, Ebu : Lane_Type;
Ega, Ege, Egi, Ego, Egu : Lane_Type;
Eka, Eke, Eki, Eko, Eku : Lane_Type;
Ema, Eme, Emi, Emo, Emu : Lane_Type;
Esa, Ese, Esi, Eso, Esu : Lane_Type;
procedure Copy_From_State
with Inline,
Global => (Input => S,
Output => (Aba, Abe, Abi, Abo, Abu,
Aga, Age, Agi, Ago, Agu,
Aka, Ake, Aki, Ako, Aku,
Ama, Ame, Ami, Amo, Amu,
Asa, Ase, Asi, Aso, Asu));
procedure Copy_To_State_From_A
with Inline,
Global => (Input => (Aba, Abe, Abi, Abo, Abu,
Aga, Age, Agi, Ago, Agu,
Aka, Ake, Aki, Ako, Aku,
Ama, Ame, Ami, Amo, Amu,
Asa, Ase, Asi, Aso, Asu),
Output => S);
procedure Copy_To_State_From_E
with Inline,
Global => (Input => (Eba, Ebe, Ebi, Ebo, Ebu,
Ega, Ege, Egi, Ego, Egu,
Eka, Eke, Eki, Eko, Eku,
Ema, Eme, Emi, Emo, Emu,
Esa, Ese, Esi, Eso, Esu),
Output => S);
procedure Prepare_Theta
with Inline,
Global => (Input => (Aba, Abe, Abi, Abo, Abu,
Aga, Age, Agi, Ago, Agu,
Aka, Ake, Aki, Ako, Aku,
Ama, Ame, Ami, Amo, Amu,
Asa, Ase, Asi, Aso, Asu),
Output => (Ca, Ce, Ci, Co, Cu));
procedure Theta_Rho_Pi_Chi_Iota_Prepare_Theta_AtoE (RI : in Round_Index)
with Inline,
Global => (In_Out => (Aba, Abe, Abi, Abo, Abu,
Aga, Age, Agi, Ago, Agu,
Aka, Ake, Aki, Ako, Aku,
Ama, Ame, Ami, Amo, Amu,
Asa, Ase, Asi, Aso, Asu,
Ca, Ce, Ci, Co, Cu),
Output => (Eba, Ebe, Ebi, Ebo, Ebu,
Ega, Ege, Egi, Ego, Egu,
Eka, Eke, Eki, Eko, Eku,
Ema, Eme, Emi, Emo, Emu,
Esa, Ese, Esi, Eso, Esu));
procedure Theta_Rho_Pi_Chi_Iota_Prepare_Theta_EtoA (RI : in Round_Index)
with Inline,
Global => (In_Out => (Eba, Ebe, Ebi, Ebo, Ebu,
Ega, Ege, Egi, Ego, Egu,
Eka, Eke, Eki, Eko, Eku,
Ema, Eme, Emi, Emo, Emu,
Esa, Ese, Esi, Eso, Esu,
Ca, Ce, Ci, Co, Cu),
Output => (Aba, Abe, Abi, Abo, Abu,
Aga, Age, Agi, Ago, Agu,
Aka, Ake, Aki, Ako, Aku,
Ama, Ame, Ami, Amo, Amu,
Asa, Ase, Asi, Aso, Asu));
procedure Copy_From_State
is
begin
Aba := S (0, 0);
Abe := S (1, 0);
Abi := S (2, 0);
Abo := S (3, 0);
Abu := S (4, 0);
Aga := S (0, 1);
Age := S (1, 1);
Agi := S (2, 1);
Ago := S (3, 1);
Agu := S (4, 1);
Aka := S (0, 2);
Ake := S (1, 2);
Aki := S (2, 2);
Ako := S (3, 2);
Aku := S (4, 2);
Ama := S (0, 3);
Ame := S (1, 3);
Ami := S (2, 3);
Amo := S (3, 3);
Amu := S (4, 3);
Asa := S (0, 4);
Ase := S (1, 4);
Asi := S (2, 4);
Aso := S (3, 4);
Asu := S (4, 4);
end Copy_From_State;
procedure Copy_To_State_From_A
is
begin
S := (0 => (0 => Aba,
1 => Aga,
2 => Aka,
3 => Ama,
4 => Asa),
1 => (0 => Abe,
1 => Age,
2 => Ake,
3 => Ame,
4 => Ase),
2 => (0 => Abi,
1 => Agi,
2 => Aki,
3 => Ami,
4 => Asi),
3 => (0 => Abo,
1 => Ago,
2 => Ako,
3 => Amo,
4 => Aso),
4 => (0 => Abu,
1 => Agu,
2 => Aku,
3 => Amu,
4 => Asu)
);
end Copy_To_State_From_A;
procedure Copy_To_State_From_E
is
begin
S := (0 => (0 => Eba,
1 => Ega,
2 => Eka,
3 => Ema,
4 => Esa),
1 => (0 => Ebe,
1 => Ege,
2 => Eke,
3 => Eme,
4 => Ese),
2 => (0 => Ebi,
1 => Egi,
2 => Eki,
3 => Emi,
4 => Esi),
3 => (0 => Ebo,
1 => Ego,
2 => Eko,
3 => Emo,
4 => Eso),
4 => (0 => Ebu,
1 => Egu,
2 => Eku,
3 => Emu,
4 => Esu)
);
end Copy_To_State_From_E;
procedure Prepare_Theta
is
begin
Ca := Aba xor Aga xor Aka xor Ama xor Asa;
Ce := Abe xor Age xor Ake xor Ame xor Ase;
Ci := Abi xor Agi xor Aki xor Ami xor Asi;
Co := Abo xor Ago xor Ako xor Amo xor Aso;
Cu := Abu xor Agu xor Aku xor Amu xor Asu;
end Prepare_Theta;
procedure Theta_Rho_Pi_Chi_Iota_Prepare_Theta_AtoE (RI : in Round_Index)
is
Da, De, Di, D0, Du : Lane_Type;
Bba, Bbe, Bbi, Bbo, Bbu : Lane_Type;
Bga, Bge, Bgi, Bgo, Bgu : Lane_Type;
Bka, Bke, Bki, Bko, Bku : Lane_Type;
Bma, Bme, Bmi, Bmo, Bmu : Lane_Type;
Bsa, Bse, Bsi, Bso, Bsu : Lane_Type;
begin
Da := Cu xor Rotate_Left (Ce, 1);
De := Ca xor Rotate_Left (Ci, 1);
Di := Ce xor Rotate_Left (Co, 1);
D0 := Ci xor Rotate_Left (Cu, 1);
Du := Co xor Rotate_Left (Ca, 1);
Aba := Aba xor Da;
Bba := Aba;
Age := Age xor De;
Bbe := Rotate_Left (Age, 300 mod Lane_Size_Bits);
Aki := Aki xor Di;
Bbi := Rotate_Left (Aki, 171 mod Lane_Size_Bits);
Amo := Amo xor D0;
Bbo := Rotate_Left (Amo, 21 mod Lane_Size_Bits);
Asu := Asu xor Du;
Bbu := Rotate_Left (Asu, 78 mod Lane_Size_Bits);
Eba := Bba xor ((not Bbe) and Bbi);
Eba := Eba xor Lane_Type (RC (RI) and (2**Lane_Size_Bits - 1));
Ca := Eba;
Ebe := Bbe xor ((not Bbi) and Bbo);
Ce := Ebe;
Ebi := Bbi xor ((not Bbo) and Bbu);
Ci := Ebi;
Ebo := Bbo xor ((not Bbu) and Bba);
Co := Ebo;
Ebu := Bbu xor ((not Bba) and Bbe);
Cu := Ebu;
Abo := Abo xor D0;
Bga := Rotate_Left (Abo, 28 mod Lane_Size_Bits);
Agu := Agu xor Du;
Bge := Rotate_Left (Agu, 276 mod Lane_Size_Bits);
Aka := Aka xor Da;
Bgi := Rotate_Left (Aka, 3 mod Lane_Size_Bits);
Ame := Ame xor De;
Bgo := Rotate_Left (Ame, 45 mod Lane_Size_Bits);
Asi := Asi xor Di;
Bgu := Rotate_Left (Asi, 253 mod Lane_Size_Bits);
Ega := Bga xor ((not Bge) and Bgi);
Ca := Ca xor Ega;
Ege := Bge xor ((not Bgi) and Bgo);
Ce := Ce xor Ege;
Egi := Bgi xor ((not Bgo) and Bgu);
Ci := Ci xor Egi;
Ego := Bgo xor ((not Bgu) and Bga);
Co := Co xor Ego;
Egu := Bgu xor ((not Bga) and Bge);
Cu := Cu xor Egu;
Abe := Abe xor De;
Bka := Rotate_Left (Abe, 1 mod Lane_Size_Bits);
Agi := Agi xor Di;
Bke := Rotate_Left (Agi, 6 mod Lane_Size_Bits);
Ako := Ako xor D0;
Bki := Rotate_Left (Ako, 153 mod Lane_Size_Bits);
Amu := Amu xor Du;
Bko := Rotate_Left (Amu, 136 mod Lane_Size_Bits);
Asa := Asa xor Da;
Bku := Rotate_Left (Asa, 210 mod Lane_Size_Bits);
Eka := Bka xor ((not Bke) and Bki);
Ca := Ca xor Eka;
Eke := Bke xor ((not Bki) and Bko);
Ce := Ce xor Eke;
Eki := Bki xor ((not Bko) and Bku);
Ci := Ci xor Eki;
Eko := Bko xor ((not Bku) and Bka);
Co := Co xor Eko;
Eku := Bku xor ((not Bka) and Bke);
Cu := Cu xor Eku;
Abu := Abu xor Du;
Bma := Rotate_Left (Abu, 91 mod Lane_Size_Bits);
Aga := Aga xor Da;
Bme := Rotate_Left (Aga, 36 mod Lane_Size_Bits);
Ake := Ake xor De;
Bmi := Rotate_Left (Ake, 10 mod Lane_Size_Bits);
Ami := Ami xor Di;
Bmo := Rotate_Left (Ami, 15 mod Lane_Size_Bits);
Aso := Aso xor D0;
Bmu := Rotate_Left (Aso, 120 mod Lane_Size_Bits);
Ema := Bma xor ((not Bme) and Bmi);
Ca := Ca xor Ema;
Eme := Bme xor ((not Bmi) and Bmo);
Ce := Ce xor Eme;
Emi := Bmi xor ((not Bmo) and Bmu);
Ci := Ci xor Emi;
Emo := Bmo xor ((not Bmu) and Bma);
Co := Co xor Emo;
Emu := Bmu xor ((not Bma) and Bme);
Cu := Cu xor Emu;
Abi := Abi xor Di;
Bsa := Rotate_Left (Abi, 190 mod Lane_Size_Bits);
Ago := Ago xor D0;
Bse := Rotate_Left (Ago, 55 mod Lane_Size_Bits);
Aku := Aku xor Du;
Bsi := Rotate_Left (Aku, 231 mod Lane_Size_Bits);
Ama := Ama xor Da;
Bso := Rotate_Left (Ama, 105 mod Lane_Size_Bits);
Ase := Ase xor De;
Bsu := Rotate_Left (Ase, 66 mod Lane_Size_Bits);
Esa := Bsa xor ((not Bse) and Bsi);
Ca := Ca xor Esa;
Ese := Bse xor ((not Bsi) and Bso);
Ce := Ce xor Ese;
Esi := Bsi xor ((not Bso) and Bsu);
Ci := Ci xor Esi;
Eso := Bso xor ((not Bsu) and Bsa);
Co := Co xor Eso;
Esu := Bsu xor ((not Bsa) and Bse);
Cu := Cu xor Esu;
end Theta_Rho_Pi_Chi_Iota_Prepare_Theta_AtoE;
procedure Theta_Rho_Pi_Chi_Iota_Prepare_Theta_EtoA (RI : in Round_Index)
is
Da, De, Di, D0, Du : Lane_Type;
Bba, Bbe, Bbi, Bbo, Bbu : Lane_Type;
Bga, Bge, Bgi, Bgo, Bgu : Lane_Type;
Bka, Bke, Bki, Bko, Bku : Lane_Type;
Bma, Bme, Bmi, Bmo, Bmu : Lane_Type;
Bsa, Bse, Bsi, Bso, Bsu : Lane_Type;
begin
Da := Cu xor Rotate_Left (Ce, 1);
De := Ca xor Rotate_Left (Ci, 1);
Di := Ce xor Rotate_Left (Co, 1);
D0 := Ci xor Rotate_Left (Cu, 1);
Du := Co xor Rotate_Left (Ca, 1);
Eba := Eba xor Da;
Bba := Eba;
Ege := Ege xor De;
Bbe := Rotate_Left (Ege, 300 mod Lane_Size_Bits);
Eki := Eki xor Di;
Bbi := Rotate_Left (Eki, 171 mod Lane_Size_Bits);
Emo := Emo xor D0;
Bbo := Rotate_Left (Emo, 21 mod Lane_Size_Bits);
Esu := Esu xor Du;
Bbu := Rotate_Left (Esu, 78 mod Lane_Size_Bits);
Aba := Bba xor ((not Bbe) and Bbi);
Aba := Aba xor Lane_Type (RC (RI) and (2**Lane_Size_Bits - 1));
Ca := Aba;
Abe := Bbe xor ((not Bbi) and Bbo);
Ce := Abe;
Abi := Bbi xor ((not Bbo) and Bbu);
Ci := Abi;
Abo := Bbo xor ((not Bbu) and Bba);
Co := Abo;
Abu := Bbu xor ((not Bba) and Bbe);
Cu := Abu;
Ebo := Ebo xor D0;
Bga := Rotate_Left (Ebo, 28 mod Lane_Size_Bits);
Egu := Egu xor Du;
Bge := Rotate_Left (Egu, 276 mod Lane_Size_Bits);
Eka := Eka xor Da;
Bgi := Rotate_Left (Eka, 3 mod Lane_Size_Bits);
Eme := Eme xor De;
Bgo := Rotate_Left (Eme, 45 mod Lane_Size_Bits);
Esi := Esi xor Di;
Bgu := Rotate_Left (Esi, 253 mod Lane_Size_Bits);
Aga := Bga xor ((not Bge) and Bgi);
Ca := Ca xor Aga;
Age := Bge xor ((not Bgi) and Bgo);
Ce := Ce xor Age;
Agi := Bgi xor ((not Bgo) and Bgu);
Ci := Ci xor Agi;
Ago := Bgo xor ((not Bgu) and Bga);
Co := Co xor Ago;
Agu := Bgu xor ((not Bga) and Bge);
Cu := Cu xor Agu;
Ebe := Ebe xor De;
Bka := Rotate_Left (Ebe, 1 mod Lane_Size_Bits);
Egi := Egi xor Di;
Bke := Rotate_Left (Egi, 6 mod Lane_Size_Bits);
Eko := Eko xor D0;
Bki := Rotate_Left (Eko, 153 mod Lane_Size_Bits);
Emu := Emu xor Du;
Bko := Rotate_Left (Emu, 136 mod Lane_Size_Bits);
Esa := Esa xor Da;
Bku := Rotate_Left (Esa, 210 mod Lane_Size_Bits);
Aka := Bka xor ((not Bke) and Bki);
Ca := Ca xor Aka;
Ake := Bke xor ((not Bki) and Bko);
Ce := Ce xor Ake;
Aki := Bki xor ((not Bko) and Bku);
Ci := Ci xor Aki;
Ako := Bko xor ((not Bku) and Bka);
Co := Co xor Ako;
Aku := Bku xor ((not Bka) and Bke);
Cu := Cu xor Aku;
Ebu := Ebu xor Du;
Bma := Rotate_Left (Ebu, 91 mod Lane_Size_Bits);
Ega := Ega xor Da;
Bme := Rotate_Left (Ega, 36 mod Lane_Size_Bits);
Eke := Eke xor De;
Bmi := Rotate_Left (Eke, 10 mod Lane_Size_Bits);
Emi := Emi xor Di;
Bmo := Rotate_Left (Emi, 15 mod Lane_Size_Bits);
Eso := Eso xor D0;
Bmu := Rotate_Left (Eso, 120 mod Lane_Size_Bits);
Ama := Bma xor ((not Bme) and Bmi);
Ca := Ca xor Ama;
Ame := Bme xor ((not Bmi) and Bmo);
Ce := Ce xor Ame;
Ami := Bmi xor ((not Bmo) and Bmu);
Ci := Ci xor Ami;
Amo := Bmo xor ((not Bmu) and Bma);
Co := Co xor Amo;
Amu := Bmu xor ((not Bma) and Bme);
Cu := Cu xor Amu;
Ebi := Ebi xor Di;
Bsa := Rotate_Left (Ebi, 190 mod Lane_Size_Bits);
Ego := Ego xor D0;
Bse := Rotate_Left (Ego, 55 mod Lane_Size_Bits);
Eku := Eku xor Du;
Bsi := Rotate_Left (Eku, 231 mod Lane_Size_Bits);
Ema := Ema xor Da;
Bso := Rotate_Left (Ema, 105 mod Lane_Size_Bits);
Ese := Ese xor De;
Bsu := Rotate_Left (Ese, 66 mod Lane_Size_Bits);
Asa := Bsa xor ((not Bse) and Bsi);
Ca := Ca xor Asa;
Ase := Bse xor ((not Bsi) and Bso);
Ce := Ce xor Ase;
Asi := Bsi xor ((not Bso) and Bsu);
Ci := Ci xor Asi;
Aso := Bso xor ((not Bsu) and Bsa);
Co := Co xor Aso;
Asu := Bsu xor ((not Bsa) and Bse);
Cu := Cu xor Asu;
end Theta_Rho_Pi_Chi_Iota_Prepare_Theta_EtoA;
begin
Copy_From_State;
Prepare_Theta;
for RI in 0 .. (Num_Rounds / 2) - 1 loop
pragma Warnings
(GNATprove, Off,
"unused assignment to ""A",
Reason => "Axx variables are also re-used as temporaries");
Theta_Rho_Pi_Chi_Iota_Prepare_Theta_AtoE (First_Round + Round_Index (RI * 2));
pragma Warnings (GNATprove, On);
pragma Warnings
(GNATprove, Off,
"unused assignment to ""E",
Reason => "Exx variables are also re-used as temporaries");
Theta_Rho_Pi_Chi_Iota_Prepare_Theta_EtoA (First_Round + Round_Index (RI * 2) + 1);
pragma Warnings (GNATprove, On);
end loop;
if Num_Rounds mod 2 /= 0 then
-- Number of rounds is an odd number, so we need to do the final step.
pragma Warnings
(GNATprove, Off,
"unused assignment to ""C",
Reason => "Cx variables are no longer needed");
Theta_Rho_Pi_Chi_Iota_Prepare_Theta_AtoE (First_Round + Round_Index (Num_Rounds - 1));
pragma Warnings (GNATprove, On);
Copy_To_State_From_E;
else
Copy_To_State_From_A;
end if;
end Permute;
end Keccak.Generic_KeccakF.Optimized_Permutation;
|
reznikmm/matreshka | Ada | 7,697 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Tools 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 package provides capability to specify mapping of model's data types
-- into Ada one.
------------------------------------------------------------------------------
private with Ada.Containers.Hashed_Maps;
private with AMF.CMOF.Elements.Hash;
with AMF.CMOF.Enumeration_Literals;
with AMF.CMOF.Types;
package Generator.Type_Mapping is
procedure Load_Mapping;
-- Loads mapping data.
function Public_Ada_Type_Name
(The_Type : not null access AMF.CMOF.Types.CMOF_Type'Class;
Representation : Representation_Kinds)
return League.Strings.Universal_String;
-- Constructs name of the type which is used to represent values of the
-- specified type.
function Public_Ada_Type_Qualified_Name
(The_Type : not null access AMF.CMOF.Types.CMOF_Type'Class;
Representation : Representation_Kinds)
return League.Strings.Universal_String;
-- Returns fully qualified name of Ada type which is used to represent
-- value of the specified type in public API.
function Public_Ada_Package_Name
(The_Type : not null access AMF.CMOF.Types.CMOF_Type'Class;
Representation : Representation_Kinds)
return League.Strings.Universal_String;
-- Constructs name of the package where user visible type is declared.
function Internal_Ada_Type_Qualified_Name
(The_Type : not null access AMF.CMOF.Types.CMOF_Type'Class;
Representation : Representation_Kinds)
return League.Strings.Universal_String;
-- Returns fully qualified name of Ada type which is used to represent
-- value of the specified type in the internal data structures.
function Internal_Ada_Package_Name
(The_Type : not null access AMF.CMOF.Types.CMOF_Type'Class;
Representation : Representation_Kinds)
return League.Strings.Universal_String;
-- Constructs name of the package where user visible type is declared.
function Member_Name
(Element : not null access AMF.CMOF.Elements.CMOF_Element'Class;
Representation : Representation_Kinds)
return League.Strings.Universal_String;
function Member_Kind_Name
(Element : not null access AMF.CMOF.Elements.CMOF_Element'Class;
Representation : Representation_Kinds)
return League.Strings.Universal_String;
function Ada_Enumeration_Literal_Name
(Element : not null access
AMF.CMOF.Enumeration_Literals.CMOF_Enumeration_Literal'Class)
return League.Strings.Universal_String;
function Ada_Enumeration_Literal_Qualified_Name
(Element : not null access
AMF.CMOF.Enumeration_Literals.CMOF_Enumeration_Literal'Class)
return League.Strings.Universal_String;
private
type Representation_Mapping is record
Has_Ada_Package : Boolean := False;
Ada_Package : League.Strings.Universal_String;
Ada_Type : League.Strings.Universal_String;
Has_Internal_Ada_Package : Boolean := False;
Internal_Ada_Package : League.Strings.Universal_String;
Internal_Ada_Type : League.Strings.Universal_String;
Member_Name : League.Strings.Universal_String;
Member_Kind_Name : League.Strings.Universal_String;
end record;
type Representation_Mapping_Access is access all Representation_Mapping;
type Representation_Mappings is
array (Representation_Kinds) of Representation_Mapping_Access;
type Type_Mapping is record
Mapping : Representation_Mappings;
end record;
type Type_Mapping_Access is access all Type_Mapping;
package Mapping_Maps is
new Ada.Containers.Hashed_Maps
(AMF.CMOF.Elements.CMOF_Element_Access,
Type_Mapping_Access,
AMF.CMOF.Elements.Hash,
AMF.CMOF.Elements."=");
type Enumeration_Literal_Mapping is record
Ada_Name : League.Strings.Universal_String;
end record;
type Enumeration_Literal_Mapping_Access is
access all Enumeration_Literal_Mapping;
package Enumeration_Literal_Maps is
new Ada.Containers.Hashed_Maps
(AMF.CMOF.Elements.CMOF_Element_Access,
Enumeration_Literal_Mapping_Access,
AMF.CMOF.Elements.Hash,
AMF.CMOF.Elements."=");
Mapping : Mapping_Maps.Map;
Literal : Enumeration_Literal_Maps.Map;
end Generator.Type_Mapping;
|
reznikmm/matreshka | Ada | 3,734 | 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_List_Level_Style_Image_Elements is
pragma Preelaborate;
type ODF_Text_List_Level_Style_Image is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Text_List_Level_Style_Image_Access is
access all ODF_Text_List_Level_Style_Image'Class
with Storage_Size => 0;
end ODF.DOM.Text_List_Level_Style_Image_Elements;
|
tum-ei-rcs/StratoX | Ada | 486 | ads | -- Institution: Technische Universität München
-- Department: Realtime Computer Systems (RCS)
-- Project: StratoX
-- Module: Software Configuration
--
-- Authors: Martin Becker ([email protected])
with FM25v0x;
-- @summary
-- Target-specific types for the NVRAM in Pixracer V1.
package HIL.Devices.NVRAM with SPARK_Mode is
-- Pixracer has 256kbit FRAM
package FM25v02 is new FM25v0x (2**15);
subtype NVRAM_Address is FM25v02.Address;
end HIL.Devices.NVRAM;
|
sbksba/Concurrence-LI330 | Ada | 2,569 | adb | with ada.text_io,ada.integer_text_io;
use ada.text_io,ada.integer_text_io;
procedure lecteur_ecrivain is
task ordonnanceur is
entry dem_l(id_l : natural);
entry dem_e(id_e : natural);
entry lecture(id_l : natural;value : out natural);
entry ecriture(id_e : natural; value : in natural);
entry fin_l(id_l : natural);
entry fin_e(id_e : natural);
end ordonnanceur;
task body ordonnanceur is
nb_dem_l : natural := 0;
nb_dem_e : natural := 0;
smttr : natural := 0;
shared_v : natural := 0;
begin
while true loop
select
when smttr = 1 and nb_dem_e = 0 and dem_e'count = 0 =>
accept dem_l(id_l : natural) do
nb_dem_l:=nb_dem_l+1;
end dem_l;
or
accept lecture(id_l : natural; value : out natural) do
value := shared_v;
end lecture;
or
accept fin_l(id_l : natural) do
nb_dem_l:=nb_dem_l-1;
end fin_l;
or
when nb_dem_l = 0 and nb_dem_e = 0 =>
accept dem_e(id_e : natural) do
nb_dem_e := nb_dem_e+1;
end dem_e;
or
accept ecriture(id_e : natural; value : in natural) do
shared_v := value;
smttr := 1;
end ecriture;
or
accept fin_e(id_e : natural) do
nb_dem_e := nb_dem_e-1;
end fin_e;
or
terminate;
end select;
end loop;
end ordonnanceur;
task type lecteur(id_l : natural);
task type ecrivain(id_e : natural);
task body lecteur is
value : natural;
begin
for i in 1..id_l loop
ordonnanceur.dem_l(id_l);
put_line("lecture "&natural'image(id_l)&" demande acces "&natural'image(i)&" lecture");
ordonnanceur.lecture(id_l,value);
put_line("lecture "&natural'image(id_l)&" lecture "&natural'image(value));
ordonnanceur.fin_l(id_l);
put_line("lecture "&natural'image(id_l)&" fin acces "&natural'image(i)&" lecture");
end loop;
end lecteur;
task body ecrivain is
begin
for i in 1..id_e loop
ordonnanceur.dem_e(id_e);
put_line("ecrivian "&natural'image(id_e)&" demande acces "&natural'image(i)&" ecriture");
ordonnanceur.ecriture(id_e,i*id_e);
put_line("ecrivain "&natural'image(id_e)&" ecriture : "&natural'image(i*id_e));
ordonnanceur.fin_e(id_e);
put_line("ecrivain "&natural'image(id_e)&" fin acces "&natural'image(i)&" ecriture");
end loop;
end ecrivain;
l1 : lecteur(1);
l2 : lecteur(2);
l3 : lecteur(3);
l4 : lecteur(4);
l5 : lecteur(5);
e1 : ecrivain(1);
e2 : ecrivain(2);
e3 : ecrivain(3);
begin
null;
end lecteur_ecrivain;
|
reznikmm/matreshka | Ada | 3,606 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Elements.Generic_Hash;
function AMF.UML.Constraints.Hash is
new AMF.Elements.Generic_Hash (UML_Constraint, UML_Constraint_Access);
|
reznikmm/matreshka | Ada | 3,659 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Elements;
package ODF.DOM.Anim_Iterate_Elements is
pragma Preelaborate;
type ODF_Anim_Iterate is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Anim_Iterate_Access is
access all ODF_Anim_Iterate'Class
with Storage_Size => 0;
end ODF.DOM.Anim_Iterate_Elements;
|
AdaCore/libadalang | Ada | 45 | adb | procedure Proc1 is
begin
null;
end Proc1;
|
reznikmm/matreshka | Ada | 5,075 | 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.ODF_String_Constants;
package body Matreshka.ODF_Form is
------------------
-- Constructors --
------------------
package body Constructors is
----------------
-- Initialize --
----------------
procedure Initialize
(Self : not null access Abstract_Form_Attribute_Node'Class;
Document : not null Matreshka.DOM_Nodes.Document_Access;
Prefix : League.Strings.Universal_String) is
begin
Matreshka.DOM_Attributes.Constructors.Initialize (Self, Document);
Self.Prefix := Prefix;
end Initialize;
----------------
-- Initialize --
----------------
procedure Initialize
(Self : not null access Abstract_Form_Element_Node'Class;
Document : not null Matreshka.DOM_Nodes.Document_Access;
Prefix : League.Strings.Universal_String) is
begin
Matreshka.DOM_Elements.Constructors.Initialize (Self, Document);
Self.Prefix := Prefix;
end Initialize;
end Constructors;
-----------------------
-- Get_Namespace_URI --
-----------------------
overriding function Get_Namespace_URI
(Self : not null access constant Abstract_Form_Attribute_Node)
return League.Strings.Universal_String is
begin
return Matreshka.ODF_String_Constants.Form_URI;
end Get_Namespace_URI;
-----------------------
-- Get_Namespace_URI --
-----------------------
overriding function Get_Namespace_URI
(Self : not null access constant Abstract_Form_Element_Node)
return League.Strings.Universal_String is
begin
return Matreshka.ODF_String_Constants.Form_URI;
end Get_Namespace_URI;
end Matreshka.ODF_Form;
|
optikos/oasis | Ada | 1,945 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Formal_Type_Definitions;
with Program.Lexical_Elements;
package Program.Elements.Formal_Decimal_Fixed_Point_Definitions is
pragma Pure (Program.Elements.Formal_Decimal_Fixed_Point_Definitions);
type Formal_Decimal_Fixed_Point_Definition is
limited interface
and Program.Elements.Formal_Type_Definitions.Formal_Type_Definition;
type Formal_Decimal_Fixed_Point_Definition_Access is
access all Formal_Decimal_Fixed_Point_Definition'Class
with Storage_Size => 0;
type Formal_Decimal_Fixed_Point_Definition_Text is limited interface;
type Formal_Decimal_Fixed_Point_Definition_Text_Access is
access all Formal_Decimal_Fixed_Point_Definition_Text'Class
with Storage_Size => 0;
not overriding function To_Formal_Decimal_Fixed_Point_Definition_Text
(Self : aliased in out Formal_Decimal_Fixed_Point_Definition)
return Formal_Decimal_Fixed_Point_Definition_Text_Access is abstract;
not overriding function Delta_Token
(Self : Formal_Decimal_Fixed_Point_Definition_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Box_Token
(Self : Formal_Decimal_Fixed_Point_Definition_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Digits_Token
(Self : Formal_Decimal_Fixed_Point_Definition_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Box_Token_2
(Self : Formal_Decimal_Fixed_Point_Definition_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Formal_Decimal_Fixed_Point_Definitions;
|
shaggie76/Aristophanes | Ada | 4,382 | ads | ----------------------------------------------------------------
-- ZLib for Ada thick binding. --
-- --
-- Copyright (C) 2002-2003 Dmitriy Anisimkov --
-- --
-- Open source license information is in the zlib.ads file. --
----------------------------------------------------------------
-- $Id: zlib-streams.ads,v 1.11 2003/08/12 13:15:31 vagul Exp $
package ZLib.Streams is
type Stream_Mode is (In_Stream, Out_Stream, Duplex);
type Stream_Access is access all Ada.Streams.Root_Stream_Type'Class;
type Stream_Type is
new Ada.Streams.Root_Stream_Type with private;
procedure Read
(Stream : in out Stream_Type;
Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset);
procedure Write
(Stream : in out Stream_Type;
Item : in Ada.Streams.Stream_Element_Array);
procedure Flush
(Stream : in out Stream_Type;
Mode : in Flush_Mode := Sync_Flush);
-- Flush the written data to the back stream,
-- all data placed to the compressor is flushing to the Back stream.
-- Should not be used untill necessary, becouse it is decreasing
-- compression.
function Read_Total_In (Stream : in Stream_Type) return Count;
pragma Inline (Read_Total_In);
-- Return total number of bytes read from back stream so far.
function Read_Total_Out (Stream : in Stream_Type) return Count;
pragma Inline (Read_Total_Out);
-- Return total number of bytes read so far.
function Write_Total_In (Stream : in Stream_Type) return Count;
pragma Inline (Write_Total_In);
-- Return total number of bytes written so far.
function Write_Total_Out (Stream : in Stream_Type) return Count;
pragma Inline (Write_Total_Out);
-- Return total number of bytes written to the back stream.
procedure Create
(Stream : out Stream_Type;
Mode : in Stream_Mode;
Back : in Stream_Access;
Back_Compressed : in Boolean;
Level : in Compression_Level := Default_Compression;
Strategy : in Strategy_Type := Default_Strategy;
Header : in Header_Type := Default;
Read_Buffer_Size : in Ada.Streams.Stream_Element_Offset
:= Default_Buffer_Size;
Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset
:= Default_Buffer_Size);
-- Create the Comression/Decompression stream.
-- If mode is In_Stream then Write operation is disabled.
-- If mode is Out_Stream then Read operation is disabled.
-- If Back_Compressed is true then
-- Data written to the Stream is compressing to the Back stream
-- and data read from the Stream is decompressed data from the Back stream.
-- If Back_Compressed is false then
-- Data written to the Stream is decompressing to the Back stream
-- and data read from the Stream is compressed data from the Back stream.
-- !!! When the Need_Header is False ZLib-Ada is using undocumented
-- ZLib 1.1.4 functionality to do not create/wait for ZLib headers.
procedure Close (Stream : in out Stream_Type);
private
use Ada.Streams;
type Buffer_Access is access all Stream_Element_Array;
type Stream_Type
is new Root_Stream_Type with
record
Mode : Stream_Mode;
Buffer : Buffer_Access;
Rest_First : Stream_Element_Offset;
Rest_Last : Stream_Element_Offset;
-- Buffer for Read operation.
-- We need to have this buffer in the record
-- becouse not all read data from back stream
-- could be processed during the read operation.
Buffer_Size : Stream_Element_Offset;
-- Buffer size for write operation.
-- We do not need to have this buffer
-- in the record becouse all data could be
-- processed in the write operation.
Back : Stream_Access;
Reader : Filter_Type;
Writer : Filter_Type;
end record;
end ZLib.Streams;
|
reznikmm/matreshka | Ada | 18,569 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.Elements;
with AMF.Internals.Element_Collections;
with AMF.Internals.Helpers;
with AMF.Internals.Tables.UML_Attributes;
with AMF.Visitors.UML_Iterators;
with AMF.Visitors.UML_Visitors;
with League.Strings.Internals;
with Matreshka.Internals.Strings;
package body AMF.Internals.UML_Instance_Values is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Instance_Value_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Enter_Instance_Value
(AMF.UML.Instance_Values.UML_Instance_Value_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Instance_Value_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Leave_Instance_Value
(AMF.UML.Instance_Values.UML_Instance_Value_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Instance_Value_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then
AMF.Visitors.UML_Iterators.UML_Iterator'Class
(Iterator).Visit_Instance_Value
(Visitor,
AMF.UML.Instance_Values.UML_Instance_Value_Access (Self),
Control);
end if;
end Visit_Element;
------------------
-- Get_Instance --
------------------
overriding function Get_Instance
(Self : not null access constant UML_Instance_Value_Proxy)
return AMF.UML.Instance_Specifications.UML_Instance_Specification_Access is
begin
return
AMF.UML.Instance_Specifications.UML_Instance_Specification_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Instance
(Self.Element)));
end Get_Instance;
------------------
-- Set_Instance --
------------------
overriding procedure Set_Instance
(Self : not null access UML_Instance_Value_Proxy;
To : AMF.UML.Instance_Specifications.UML_Instance_Specification_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Instance
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Instance;
--------------
-- Get_Type --
--------------
overriding function Get_Type
(Self : not null access constant UML_Instance_Value_Proxy)
return AMF.UML.Types.UML_Type_Access is
begin
return
AMF.UML.Types.UML_Type_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Type
(Self.Element)));
end Get_Type;
--------------
-- Set_Type --
--------------
overriding procedure Set_Type
(Self : not null access UML_Instance_Value_Proxy;
To : AMF.UML.Types.UML_Type_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Type
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Type;
---------------------------
-- Get_Client_Dependency --
---------------------------
overriding function Get_Client_Dependency
(Self : not null access constant UML_Instance_Value_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
begin
return
AMF.UML.Dependencies.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency
(Self.Element)));
end Get_Client_Dependency;
-------------------------
-- Get_Name_Expression --
-------------------------
overriding function Get_Name_Expression
(Self : not null access constant UML_Instance_Value_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access is
begin
return
AMF.UML.String_Expressions.UML_String_Expression_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression
(Self.Element)));
end Get_Name_Expression;
-------------------------
-- Set_Name_Expression --
-------------------------
overriding procedure Set_Name_Expression
(Self : not null access UML_Instance_Value_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Name_Expression;
-------------------
-- Get_Namespace --
-------------------
overriding function Get_Namespace
(Self : not null access constant UML_Instance_Value_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
return
AMF.UML.Namespaces.UML_Namespace_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace
(Self.Element)));
end Get_Namespace;
------------------------
-- Get_Qualified_Name --
------------------------
overriding function Get_Qualified_Name
(Self : not null access constant UML_Instance_Value_Proxy)
return AMF.Optional_String is
begin
declare
use type Matreshka.Internals.Strings.Shared_String_Access;
Aux : constant Matreshka.Internals.Strings.Shared_String_Access
:= AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
begin
if Aux = null then
return (Is_Empty => True);
else
return (False, League.Strings.Internals.Create (Aux));
end if;
end;
end Get_Qualified_Name;
-----------------------------------
-- Get_Owning_Template_Parameter --
-----------------------------------
overriding function Get_Owning_Template_Parameter
(Self : not null access constant UML_Instance_Value_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
begin
return
AMF.UML.Template_Parameters.UML_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Template_Parameter
(Self.Element)));
end Get_Owning_Template_Parameter;
-----------------------------------
-- Set_Owning_Template_Parameter --
-----------------------------------
overriding procedure Set_Owning_Template_Parameter
(Self : not null access UML_Instance_Value_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Owning_Template_Parameter;
----------------------------
-- Get_Template_Parameter --
----------------------------
overriding function Get_Template_Parameter
(Self : not null access constant UML_Instance_Value_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
begin
return
AMF.UML.Template_Parameters.UML_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter
(Self.Element)));
end Get_Template_Parameter;
----------------------------
-- Set_Template_Parameter --
----------------------------
overriding procedure Set_Template_Parameter
(Self : not null access UML_Instance_Value_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Template_Parameter;
-------------------
-- Boolean_Value --
-------------------
overriding function Boolean_Value
(Self : not null access constant UML_Instance_Value_Proxy)
return AMF.Optional_Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Boolean_Value unimplemented");
raise Program_Error with "Unimplemented procedure UML_Instance_Value_Proxy.Boolean_Value";
return Boolean_Value (Self);
end Boolean_Value;
-------------------
-- Integer_Value --
-------------------
overriding function Integer_Value
(Self : not null access constant UML_Instance_Value_Proxy)
return AMF.Optional_Integer is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Integer_Value unimplemented");
raise Program_Error with "Unimplemented procedure UML_Instance_Value_Proxy.Integer_Value";
return Integer_Value (Self);
end Integer_Value;
------------------------
-- Is_Compatible_With --
------------------------
overriding function Is_Compatible_With
(Self : not null access constant UML_Instance_Value_Proxy;
P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented");
raise Program_Error with "Unimplemented procedure UML_Instance_Value_Proxy.Is_Compatible_With";
return Is_Compatible_With (Self, P);
end Is_Compatible_With;
-------------------
-- Is_Computable --
-------------------
overriding function Is_Computable
(Self : not null access constant UML_Instance_Value_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Computable unimplemented");
raise Program_Error with "Unimplemented procedure UML_Instance_Value_Proxy.Is_Computable";
return Is_Computable (Self);
end Is_Computable;
-------------
-- Is_Null --
-------------
overriding function Is_Null
(Self : not null access constant UML_Instance_Value_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Null unimplemented");
raise Program_Error with "Unimplemented procedure UML_Instance_Value_Proxy.Is_Null";
return Is_Null (Self);
end Is_Null;
----------------
-- Real_Value --
----------------
overriding function Real_Value
(Self : not null access constant UML_Instance_Value_Proxy)
return AMF.Optional_Real is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Real_Value unimplemented");
raise Program_Error with "Unimplemented procedure UML_Instance_Value_Proxy.Real_Value";
return Real_Value (Self);
end Real_Value;
------------------
-- String_Value --
------------------
overriding function String_Value
(Self : not null access constant UML_Instance_Value_Proxy)
return AMF.Optional_String is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "String_Value unimplemented");
raise Program_Error with "Unimplemented procedure UML_Instance_Value_Proxy.String_Value";
return String_Value (Self);
end String_Value;
---------------------
-- Unlimited_Value --
---------------------
overriding function Unlimited_Value
(Self : not null access constant UML_Instance_Value_Proxy)
return AMF.Optional_Unlimited_Natural is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Unlimited_Value unimplemented");
raise Program_Error with "Unimplemented procedure UML_Instance_Value_Proxy.Unlimited_Value";
return Unlimited_Value (Self);
end Unlimited_Value;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant UML_Instance_Value_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
raise Program_Error with "Unimplemented procedure UML_Instance_Value_Proxy.All_Owning_Packages";
return All_Owning_Packages (Self);
end All_Owning_Packages;
-----------------------------
-- Is_Distinguishable_From --
-----------------------------
overriding function Is_Distinguishable_From
(Self : not null access constant UML_Instance_Value_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
raise Program_Error with "Unimplemented procedure UML_Instance_Value_Proxy.Is_Distinguishable_From";
return Is_Distinguishable_From (Self, N, Ns);
end Is_Distinguishable_From;
---------------
-- Namespace --
---------------
overriding function Namespace
(Self : not null access constant UML_Instance_Value_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
raise Program_Error with "Unimplemented procedure UML_Instance_Value_Proxy.Namespace";
return Namespace (Self);
end Namespace;
---------------------------
-- Is_Template_Parameter --
---------------------------
overriding function Is_Template_Parameter
(Self : not null access constant UML_Instance_Value_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented");
raise Program_Error with "Unimplemented procedure UML_Instance_Value_Proxy.Is_Template_Parameter";
return Is_Template_Parameter (Self);
end Is_Template_Parameter;
end AMF.Internals.UML_Instance_Values;
|
AdaCore/libadalang | Ada | 112 | adb | procedure Foo (X : Missing) is
begin
null;
end Foo;
--% node.p_enclosing_compilation_unit.p_imported_units()
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 1,151 | adb | with System;
with STM32_SVD; use STM32_SVD;
with STM32_SVD.RCC;
with STM32_SVD.NVIC;
with STM32_SVD.GPIO;
with STM32_SVD.USB; use STM32_SVD.USB;
with STM32GD.Startup;
package body STM32GD.Board is
procedure Init is
begin
Clocks.Init;
STM32_SVD.RCC.RCC_Periph.APB2ENR.AFIOEN := 1;
STM32_SVD.RCC.RCC_Periph.APB2ENR.IOPAEN := 1;
STM32_SVD.RCC.RCC_Periph.APB2ENR.IOPBEN := 1;
STM32_SVD.RCC.RCC_Periph.APB2ENR.IOPCEN := 1;
STM32_SVD.RCC.RCC_Periph.APB2ENR.USART1EN := 1;
BUTTON.Init;
LED.Init;
LED2.Init;
TX.Init;
RX.Init;
USART.Init;
RTC.Init;
end Init;
procedure USB_Re_Enumerate is
begin
STM32_SVD.GPIO.GPIOA_Periph.CRH.CNF12 := 0;
STM32_SVD.GPIO.GPIOA_Periph.CRH.MODE12 := 1;
STM32_SVD.GPIO.GPIOA_Periph.BSRR.BR.Arr (12) := 1;
declare
I : UInt32 with volatile;
begin
I := 100000;
while I > 0 loop
I := I - 1;
end loop;
end;
STM32_SVD.GPIO.GPIOA_Periph.CRH.CNF12 := 1;
STM32_SVD.GPIO.GPIOA_Periph.CRH.MODE12 := 0;
end USB_Re_Enumerate;
end STM32GD.Board;
|
Letractively/ada-ado | Ada | 5,064 | adb | -----------------------------------------------------------------------
-- ado-queries -- Database Queries
-- Copyright (C) 2011, 2012, 2013, 2014 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ADO.Queries.Loaders;
package body ADO.Queries is
-- ------------------------------
-- Set the query definition which identifies the SQL query to execute.
-- The query is represented by the <tt>sql</tt> XML entry.
-- ------------------------------
procedure Set_Query (Into : in out Context;
Query : in Query_Definition_Access) is
begin
Into.Query_Def := Query;
Into.Is_Count := False;
end Set_Query;
-- ------------------------------
-- Set the query definition which identifies the SQL query to execute.
-- The query count is represented by the <tt>sql-count</tt> XML entry.
-- ------------------------------
procedure Set_Count_Query (Into : in out Context;
Query : in Query_Definition_Access) is
begin
Into.Query_Def := Query;
Into.Is_Count := True;
end Set_Count_Query;
procedure Set_Query (Into : in out Context;
Name : in String) is
begin
Into.Query_Def := ADO.Queries.Loaders.Find_Query (Name);
end Set_Query;
-- ------------------------------
-- Set the limit for the SQL query.
-- ------------------------------
procedure Set_Limit (Into : in out Context;
First : in Natural;
Last : in Natural) is
begin
Into.First := First;
Into.Last := Last;
end Set_Limit;
-- ------------------------------
-- Get the first row index.
-- ------------------------------
function Get_First_Row_Index (From : in Context) return Natural is
begin
return From.First;
end Get_First_Row_Index;
-- ------------------------------
-- Get the last row index.
-- ------------------------------
function Get_Last_Row_Index (From : in Context) return Natural is
begin
return From.Last_Index;
end Get_Last_Row_Index;
-- ------------------------------
-- Get the maximum number of rows that the SQL query can return.
-- This operation uses the <b>sql-count</b> query.
-- ------------------------------
function Get_Max_Row_Count (From : in Context) return Natural is
begin
return From.Max_Row_Count;
end Get_Max_Row_Count;
-- ------------------------------
-- Get the SQL query that correspond to the query context.
-- ------------------------------
function Get_SQL (From : in Context;
Driver : in ADO.Drivers.Driver_Index) return String is
begin
if From.Query_Def = null then
return "";
else
return Get_SQL (From.Query_Def, Driver, From.Is_Count);
end if;
end Get_SQL;
-- ------------------------------
-- Find the query with the given name.
-- Returns the query definition that matches the name or null if there is none
-- ------------------------------
function Find_Query (File : in Query_File;
Name : in String) return Query_Definition_Access is
Query : Query_Definition_Access := File.Queries;
begin
while Query /= null loop
if Query.Name.all = Name then
return Query;
end if;
Query := Query.Next;
end loop;
return null;
end Find_Query;
function Get_SQL (From : in Query_Definition_Access;
Driver : in ADO.Drivers.Driver_Index;
Use_Count : in Boolean) return String is
Query : Query_Info_Ref.Ref;
begin
ADO.Queries.Loaders.Read_Query (From);
Query := From.Query.Get;
if Query.Is_Null then
return "";
end if;
if Use_Count then
if Length (Query.Value.Count_Query (Driver).SQL) > 0 then
return To_String (Query.Value.Count_Query (Driver).SQL);
else
return To_String (Query.Value.Count_Query (ADO.Drivers.Driver_Index'First).SQL);
end if;
elsif Length (Query.Value.Main_Query (Driver).SQL) > 0 then
return To_String (Query.Value.Main_Query (Driver).SQL);
else
return To_String (Query.Value.Main_Query (ADO.Drivers.Driver_Index'First).SQL);
end if;
end Get_SQL;
end ADO.Queries;
|
faelys/natools | Ada | 14,043 | adb | ------------------------------------------------------------------------------
-- Copyright (c) 2014-2015, 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.Interpreter_Loop;
with Natools.S_Expressions.Templates.Generic_Discrete_Render;
with Natools.S_Expressions.Templates.Integers;
with Natools.Static_Maps.S_Expressions.Templates.Dates;
with Natools.Time_IO.RFC_3339;
package body Natools.S_Expressions.Templates.Dates is
package Commands renames Natools.Static_Maps.S_Expressions.Templates.Dates;
procedure Render_Day_Of_Week
is new Natools.S_Expressions.Templates.Generic_Discrete_Render
(Ada.Calendar.Formatting.Day_Name,
Ada.Calendar.Formatting.Day_Name'Image,
Ada.Calendar.Formatting."=");
procedure Append
(Output : in out Ada.Streams.Root_Stream_Type'Class;
Value : in Split_Time;
Data : in Atom);
procedure Execute
(Output : in out Ada.Streams.Root_Stream_Type'Class;
Value : in Split_Time;
Name : in Atom;
Arguments : in out Lockable.Descriptor'Class);
function Two_Digit_Image (Value : Integer) return Atom
is ((1 => Character'Pos ('0') + Octet (Value / 10),
2 => Character'Pos ('0') + Octet (Value mod 10)))
with Pre => Value in 0 .. 99;
function Four_Digit_Image (Value : Integer) return Atom
is ((1 => Character'Pos ('0') + Octet (Value / 1000),
2 => Character'Pos ('0') + Octet ((Value / 100) mod 10),
3 => Character'Pos ('0') + Octet ((Value / 10) mod 10),
4 => Character'Pos ('0') + Octet (Value mod 10)))
with Pre => Value in 0 .. 9999;
function Parse_Time_Offset
(Image : in String;
Date : in Ada.Calendar.Time)
return Ada.Calendar.Time_Zones.Time_Offset;
procedure Render_Triplet
(Output : in out Ada.Streams.Root_Stream_Type'Class;
Part_1, Part_2, Part_3 : in Atom;
Template : in out Lockable.Descriptor'Class);
procedure Interpreter is new Interpreter_Loop
(Ada.Streams.Root_Stream_Type'Class, Split_Time, Execute, Append);
------------------------------
-- Local Helper Subprograms --
------------------------------
function Parse_Time_Offset
(Image : in String;
Date : in Ada.Calendar.Time)
return Ada.Calendar.Time_Zones.Time_Offset
is
function Value (C : Character)
return Ada.Calendar.Time_Zones.Time_Offset;
function Value (C : Character)
return Ada.Calendar.Time_Zones.Time_Offset is
begin
if C in '0' .. '9' then
return Ada.Calendar.Time_Zones.Time_Offset
(Character'Pos (C) - Character'Pos ('0'));
else
raise Constraint_Error with "Unknown time offset format";
end if;
end Value;
begin
if Image = "system" then
return Ada.Calendar.Time_Zones.UTC_Time_Offset (Date);
end if;
Abbreviation :
begin
return Ada.Calendar.Time_Zones.Time_Offset
(Static_Maps.S_Expressions.Templates.Dates.To_Time_Offset (Image));
exception
when Constraint_Error => null;
end Abbreviation;
Numeric :
declare
use type Ada.Calendar.Time_Zones.Time_Offset;
First : Integer := Image'First;
Length : Natural := Image'Length;
V : Ada.Calendar.Time_Zones.Time_Offset;
Negative : Boolean := False;
begin
if First in Image'Range and then Image (First) in '-' | '+' then
Negative := Image (First) = '-';
First := First + 1;
Length := Length - 1;
end if;
case Length is
when 1 =>
V := Value (Image (First)) * 60;
when 2 =>
V := Value (Image (First)) * 600
+ Value (Image (First + 1)) * 60;
when 4 =>
V := Value (Image (First)) * 600
+ Value (Image (First + 1)) * 60
+ Value (Image (First + 2)) * 10
+ Value (Image (First + 3));
when 5 =>
if Image (First + 2) in '0' .. '9' then
raise Constraint_Error with "Unknown time offset format";
end if;
V := Value (Image (First)) * 600
+ Value (Image (First + 1)) * 60
+ Value (Image (First + 3)) * 10
+ Value (Image (First + 4));
when others =>
raise Constraint_Error with "Unknown time offset format";
end case;
if Negative then
return -V;
else
return V;
end if;
end Numeric;
end Parse_Time_Offset;
procedure Render_Triplet
(Output : in out Ada.Streams.Root_Stream_Type'Class;
Part_1, Part_2, Part_3 : in Atom;
Template : in out Lockable.Descriptor'Class) is
begin
Output.Write (Part_1);
if Template.Current_Event = Events.Add_Atom then
declare
Separator : constant Atom := Template.Current_Atom;
Event : Events.Event;
begin
Template.Next (Event);
Output.Write (Separator);
Output.Write (Part_2);
if Event = Events.Add_Atom then
Output.Write (Template.Current_Atom);
else
Output.Write (Separator);
end if;
end;
else
Output.Write (Part_2);
end if;
Output.Write (Part_3);
end Render_Triplet;
----------------------------
-- Interpreter Components --
----------------------------
procedure Append
(Output : in out Ada.Streams.Root_Stream_Type'Class;
Value : in Split_Time;
Data : in Atom)
is
pragma Unreferenced (Value);
begin
Output.Write (Data);
end Append;
procedure Execute
(Output : in out Ada.Streams.Root_Stream_Type'Class;
Value : in Split_Time;
Name : in Atom;
Arguments : in out Lockable.Descriptor'Class)
is
Format : Integers.Format;
begin
case Commands.Main (To_String (Name)) is
when Commands.Error =>
null;
when Commands.Big_Endian_Date =>
Render_Triplet
(Output,
Four_Digit_Image (Value.Year),
Two_Digit_Image (Value.Month),
Two_Digit_Image (Value.Day),
Arguments);
when Commands.Big_Endian_Time =>
Render_Triplet
(Output,
Two_Digit_Image (Value.Hour),
Two_Digit_Image (Value.Minute),
Two_Digit_Image (Value.Second),
Arguments);
when Commands.Day =>
Format.Set_Image (0, Null_Atom);
Integers.Render (Output, Format, Arguments, Value.Day);
when Commands.Day_Of_Week =>
Render_Day_Of_Week (Output, Arguments, Value.Day_Of_Week);
when Commands.Hour =>
Format.Set_Image (-1, Null_Atom);
Integers.Render (Output, Format, Arguments, Value.Hour);
when Commands.Little_Endian_Date =>
Render_Triplet
(Output,
Two_Digit_Image (Value.Day),
Two_Digit_Image (Value.Month),
Four_Digit_Image (Value.Year),
Arguments);
when Commands.Little_Endian_Time =>
Render_Triplet
(Output,
Two_Digit_Image (Value.Second),
Two_Digit_Image (Value.Minute),
Two_Digit_Image (Value.Hour),
Arguments);
when Commands.Minute =>
Format.Set_Image (-1, Null_Atom);
Integers.Render (Output, Format, Arguments, Value.Minute);
when Commands.Month =>
Format.Set_Image (0, Null_Atom);
Integers.Render (Output, Format, Arguments, Value.Month);
when Commands.Padded_Day =>
Format.Set_Image (0, Null_Atom);
Format.Set_Minimum_Width (2);
Format.Set_Left_Padding ((1 => Character'Pos ('0')));
Format.Set_Align (Integers.Right_Aligned);
Integers.Render (Output, Format, Arguments, Value.Day);
when Commands.Padded_Hour =>
Format.Set_Image (-1, Null_Atom);
Format.Set_Minimum_Width (2);
Format.Set_Left_Padding ((1 => Character'Pos ('0')));
Format.Set_Align (Integers.Right_Aligned);
Integers.Render (Output, Format, Arguments, Value.Hour);
when Commands.Padded_Minute =>
Format.Set_Image (-1, Null_Atom);
Format.Set_Minimum_Width (2);
Format.Set_Left_Padding ((1 => Character'Pos ('0')));
Format.Set_Align (Integers.Right_Aligned);
Integers.Render (Output, Format, Arguments, Value.Minute);
when Commands.Padded_Month =>
Format.Set_Image (0, Null_Atom);
Format.Set_Minimum_Width (2);
Format.Set_Left_Padding ((1 => Character'Pos ('0')));
Format.Set_Align (Integers.Right_Aligned);
Integers.Render (Output, Format, Arguments, Value.Month);
when Commands.Padded_Second =>
Format.Set_Image (-1, Null_Atom);
Format.Set_Minimum_Width (2);
Format.Set_Left_Padding ((1 => Character'Pos ('0')));
Format.Set_Align (Integers.Right_Aligned);
Integers.Render (Output, Format, Arguments, Value.Second);
when Commands.RFC_3339 =>
Output.Write (To_Atom
(Time_IO.RFC_3339.Image (Value.Source, Value.Time_Zone)));
when Commands.Second =>
Format.Set_Image (-1, Null_Atom);
Integers.Render (Output, Format, Arguments, Value.Second);
when Commands.With_Offset =>
if Arguments.Current_Event = Events.Add_Atom then
declare
use type Ada.Calendar.Time_Zones.Time_Offset;
New_Offset : Ada.Calendar.Time_Zones.Time_Offset;
begin
begin
New_Offset := Parse_Time_Offset
(S_Expressions.To_String (Arguments.Current_Atom),
Value.Source);
exception
when Constraint_Error => return;
end;
Arguments.Next;
if New_Offset = Value.Time_Zone then
Interpreter (Arguments, Output, Value);
else
Render (Output, Arguments, Value.Source, New_Offset);
end if;
end;
end if;
when Commands.Year =>
Integers.Render (Output, Arguments, Value.Year);
end case;
end Execute;
----------------------
-- Public Interface --
----------------------
function Split
(Value : Ada.Calendar.Time;
Time_Zone : Ada.Calendar.Time_Zones.Time_Offset)
return Split_Time
is
use type Ada.Calendar.Time_Zones.Time_Offset;
Zone_Offset : constant Ada.Calendar.Time_Zones.Time_Offset
:= Time_Zone - Ada.Calendar.Time_Zones.UTC_Time_Offset (Value);
Year : Ada.Calendar.Year_Number;
Month : Ada.Calendar.Month_Number;
Day : Ada.Calendar.Day_Number;
Hour : Ada.Calendar.Formatting.Hour_Number;
Minute : Ada.Calendar.Formatting.Minute_Number;
Second : Ada.Calendar.Formatting.Second_Number;
Sub_Second : Ada.Calendar.Formatting.Second_Duration;
begin
Ada.Calendar.Formatting.Split
(Value,
Year, Month, Day,
Hour, Minute, Second,
Sub_Second,
Time_Zone);
return Split_Time'
(Source => Value,
Time_Zone => Time_Zone,
Year => Year,
Month => Month,
Day => Day,
Day_Of_Week => Ada.Calendar.Formatting.Day_Of_Week
(Ada.Calendar."+" (Value, 60 * Duration (Zone_Offset))),
Hour => Hour,
Minute => Minute,
Second => Second,
Sub_Second => Sub_Second);
end Split;
procedure Render
(Output : in out Ada.Streams.Root_Stream_Type'Class;
Template : in out Lockable.Descriptor'Class;
Value : in Ada.Calendar.Time) is
begin
Render
(Output,
Template,
Value,
Ada.Calendar.Time_Zones.UTC_Time_Offset (Value));
end Render;
procedure Render
(Output : in out Ada.Streams.Root_Stream_Type'Class;
Template : in out Lockable.Descriptor'Class;
Value : in Ada.Calendar.Time;
Time_Zone : Ada.Calendar.Time_Zones.Time_Offset) is
begin
Render (Output, Template, Split (Value, Time_Zone));
end Render;
procedure Render
(Output : in out Ada.Streams.Root_Stream_Type'Class;
Template : in out Lockable.Descriptor'Class;
Value : in Split_Time) is
begin
Interpreter (Template, Output, Value);
end Render;
end Natools.S_Expressions.Templates.Dates;
|
AdaCore/libadalang | Ada | 603 | adb | procedure Main is
task type Worker is
entry Start;
end Worker;
--% node.p_next_part_for_decl()
task body Worker is
begin
accept Start;
accept Start;
end Worker;
Workers : array (1 .. 4) of Worker;
task Count_Down
--% node.parent.parent.p_next_part_for_decl()
is
entry Start;
end Count_Down;
--% node.p_next_part_for_decl()
task body Count_Down is
begin
accept Start;
for J of Workers loop
J.Start;
delay 1.0;
end loop;
accept Start;
end Count_Down;
begin
Count_Down.Start;
end Main;
|
godunko/adawebpack | Ada | 3,182 | ads | ------------------------------------------------------------------------------
-- --
-- AdaWebPack --
-- --
------------------------------------------------------------------------------
-- Copyright © 2021, Vadim Godunko --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
------------------------------------------------------------------------------
with Web.DOM.Document_Fragments;
with Web.HTML.Elements;
package Web.HTML.Templates is
pragma Preelaborate;
type HTML_Template_Element is
new Web.HTML.Elements.HTML_Element with null record;
function Get_Content
(Self : HTML_Template_Element'Class)
return Web.DOM.Document_Fragments.Document_Fragment;
-- Returns the template contents (a DocumentFragment).
end Web.HTML.Templates;
|
AdaCore/libadalang | Ada | 3,558 | adb | -- Test that Libadalang's project unit provider behaves as expected. First
-- check that unsupported projects are properly rejected, then load a
-- supported one an check that name resolution properly uses it.
with Ada.Exceptions;
with Ada.Text_IO; use Ada.Text_IO;
with GNATCOLL.Projects; use GNATCOLL.Projects;
with GNATCOLL.VFS; use GNATCOLL.VFS;
with Libadalang.Analysis; use Libadalang.Analysis;
with Libadalang.Common; use Libadalang.Common;
with Libadalang.Iterators; use Libadalang.Iterators;
with Libadalang.Project_Provider; use Libadalang.Project_Provider;
procedure Main is
function Load_Project
(File : String; Project : String := "") return Unit_Provider_Reference;
procedure Try_Loading_Project (File : String; Project : String := "");
------------------
-- Load_Project --
------------------
function Load_Project
(File : String; Project : String := "") return Unit_Provider_Reference
is
Env : Project_Environment_Access;
Tree : Project_Tree_Access := new Project_Tree;
Prj : Project_Type := No_Project;
begin
Put_Line ("Loading " & File & "...");
if Project'Length > 0 then
Put_Line (" Targetting subproject " & Project);
end if;
Initialize (Env);
Load (Tree.all, Create (+File), Env);
if Project'Length > 0 then
Prj := Tree.Project_From_Name (Project);
pragma Assert (Prj /= No_Project);
end if;
return Create_Project_Unit_Provider (Tree, Prj, Env, True);
exception
when others =>
Prj := No_Project;
Tree.Unload;
Free (Tree);
Free (Env);
raise;
end Load_Project;
-------------------------
-- Try_Loading_Project --
-------------------------
procedure Try_Loading_Project (File : String; Project : String := "") is
Dummy : Unit_Provider_Reference;
begin
Dummy := Load_Project (File, Project);
Put_Line (" Success");
exception
when Exc : Invalid_Project =>
Put_Line (" Invalid_Project exception: "
& Ada.Exceptions.Exception_Message (Exc));
when Exc : Unsupported_View_Error =>
Put_Line (" Unsupported_View_Error exception: "
& Ada.Exceptions.Exception_Message (Exc));
end Try_Loading_Project;
begin
Try_Loading_Project ("unsupported_aggr.gpr");
Try_Loading_Project ("unsupported_aggr.gpr", "unsupported_aggr");
Try_Loading_Project ("unsupported_aggr.gpr", "p");
Try_Loading_Project ("supported_no_conflict.gpr");
Try_Loading_Project ("supported_simple_aggr.gpr");
Try_Loading_Project ("supported_simple_aggr.gpr", "supported_simple_aggr");
Try_Loading_Project ("supported_chained_aggr.gpr");
Try_Loading_Project ("supported_chained_aggr.gpr",
"supported_chained_aggr");
declare
Ctx : constant Analysis_Context :=
Create_Context (Unit_Provider => Load_Project ("p.gpr"));
Unit : constant Analysis_Unit :=
Get_From_Provider (Ctx, "p2", Unit_Specification);
Root : constant Ada_Node := Unit.Root;
Subtype_Ind : constant Subtype_Indication := Find_First
(Root, Kind_Is (Ada_Subtype_Indication)).As_Subtype_Indication;
Res_Type : constant Ada_Node_Array :=
Subtype_Ind.F_Name.P_Matching_Nodes;
begin
Put_Line (Subtype_Ind.Image & " resolves to:");
for E of Res_Type loop
Put_Line (" " & E.Image);
end loop;
end;
Put_Line ("Done.");
end Main;
|
jscparker/math_packages | Ada | 2,181 | ads |
-------------------------------------------------------------------------------
-- package Gamma, Log of Gamma Function
-- Copyright (C) 1995-2018 Jonathan S. Parker
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-------------------------------------------------------------------------------
-- package Gamma
--
-- Natural logarithm of Gamma function for positive real arguments.
--
-- Uses Stieltjes' Continued Fraction method arg > 14, and rational
-- polynomial approximations for 0 < arg < 16.
--
-- Meant to be good to better than 30 digits (if you can instantiate
-- with a 30 digit Real). That's why the rational
-- polynomial approximations are so complicated at x < 16, and
-- why the order of the Stieltjes' Continued Fraction is so high.
-- But ordinarily you use a 15 digit Real.
generic
type Real is digits <>;
package Gamma is
pragma Pure (Gamma);
function Log_Gamma (x : in Real) return Real;
-- For x > 0 only. Natural logarithm of Gamma function.
--
-- Uses Stieltjes' Continued Fraction method above x=14.
-- For 0 < x < 10 uses simplest rational approx.
-- Probably good to a lot better than 32 digits.
function Log_Gamma_0_to_16 (x : in Real) return Real;
-- This is the part that uses a rational polynomial approx.
-- Only good for 0 < x < 16 !
procedure Test_Stieltjes_Coefficients;
private
Real_Epsilon : constant Real := (+0.125) * Real'Epsilon;
-- have to modify this if Real is abstract extended
end Gamma;
|
tum-ei-rcs/StratoX | Ada | 288 | adb | with Ada.Text_IO; use Ada.Text_IO;
package body mylog with SPARK_Mode is
procedure Print (m : logmsg) is
begin
case m.typ is
when NONE => Put ("NONE");
when GPS => Put ("GPS: ");
when TEXT => Put ("TXT: ");
end case;
end Print;
end mylog;
|
reznikmm/matreshka | Ada | 6,298 | 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 instance specification is a model element that represents an instance
-- in a modeled system.
--
-- An instance specification has the capability of being a deployment target
-- in a deployment relationship, in the case that it is an instance of a
-- node. It is also has the capability of being a deployed artifact, if it is
-- an instance of an artifact.
------------------------------------------------------------------------------
limited with AMF.UML.Classifiers.Collections;
with AMF.UML.Deployed_Artifacts;
with AMF.UML.Deployment_Targets;
with AMF.UML.Packageable_Elements;
limited with AMF.UML.Slots.Collections;
limited with AMF.UML.Value_Specifications;
package AMF.UML.Instance_Specifications is
pragma Preelaborate;
type UML_Instance_Specification is limited interface
and AMF.UML.Deployment_Targets.UML_Deployment_Target
and AMF.UML.Deployed_Artifacts.UML_Deployed_Artifact
and AMF.UML.Packageable_Elements.UML_Packageable_Element;
type UML_Instance_Specification_Access is
access all UML_Instance_Specification'Class;
for UML_Instance_Specification_Access'Storage_Size use 0;
not overriding function Get_Classifier
(Self : not null access constant UML_Instance_Specification)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is abstract;
-- Getter of InstanceSpecification::classifier.
--
-- The classifier or classifiers of the represented instance. If multiple
-- classifiers are specified, the instance is classified by all of them.
not overriding function Get_Slot
(Self : not null access constant UML_Instance_Specification)
return AMF.UML.Slots.Collections.Set_Of_UML_Slot is abstract;
-- Getter of InstanceSpecification::slot.
--
-- A slot giving the value or values of a structural feature of the
-- instance. An instance specification can have one slot per structural
-- feature of its classifiers, including inherited features. It is not
-- necessary to model a slot for each structural feature, in which case
-- the instance specification is a partial description.
not overriding function Get_Specification
(Self : not null access constant UML_Instance_Specification)
return AMF.UML.Value_Specifications.UML_Value_Specification_Access is abstract;
-- Getter of InstanceSpecification::specification.
--
-- A specification of how to compute, derive, or construct the instance.
not overriding procedure Set_Specification
(Self : not null access UML_Instance_Specification;
To : AMF.UML.Value_Specifications.UML_Value_Specification_Access) is abstract;
-- Setter of InstanceSpecification::specification.
--
-- A specification of how to compute, derive, or construct the instance.
end AMF.UML.Instance_Specifications;
|
sungyeon/drake | Ada | 36 | adb | ../machine-apple-darwin/s-ntitco.adb |
AdaCore/Ada_Drivers_Library | Ada | 3,731 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2022, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- A demonstration of a higher-level USART interface, using blocking I/O.
-- The file declares the main procedure for the demonstration.
with Last_Chance_Handler; pragma Unreferenced (Last_Chance_Handler);
-- The "last chance handler" is the user-defined routine that is called when
-- an exception is propagated. We need it in the executable, therefore it
-- must be somewhere in the closure of the context clauses.
with Peripherals_Blocking; use Peripherals_Blocking;
with Serial_IO.Blocking; use Serial_IO.Blocking;
with Message_Buffers; use Message_Buffers;
use Serial_IO;
procedure Demo_Serial_Port_Blocking is
Incoming : aliased Message (Physical_Size => 1024); -- arbitrary size
Outgoing : aliased Message (Physical_Size => 1024); -- arbitrary size
procedure Send (This : String);
procedure Send (This : String) is
begin
Set (Outgoing, To => This);
Blocking.Send (COM, Outgoing'Unchecked_Access);
-- Send won't return until the entire message has been sent
end Send;
begin
Initialize_Hardware (COM);
Configure (COM, Baud_Rate => 115_200);
Incoming.Set_Terminator (To => ASCII.CR);
Send ("Enter text, terminated by CR.");
loop
Blocking.Receive (COM, Incoming'Unchecked_Access);
Send ("Received : " & Incoming.Content);
end loop;
end Demo_Serial_Port_Blocking;
|
reznikmm/matreshka | Ada | 4,609 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Number.Calendar_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Number_Calendar_Attribute_Node is
begin
return Self : Number_Calendar_Attribute_Node do
Matreshka.ODF_Number.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Number_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Number_Calendar_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Calendar_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Number_URI,
Matreshka.ODF_String_Constants.Calendar_Attribute,
Number_Calendar_Attribute_Node'Tag);
end Matreshka.ODF_Number.Calendar_Attributes;
|
reznikmm/matreshka | Ada | 6,960 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Meta.Initial_Creator_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Meta_Initial_Creator_Element_Node is
begin
return Self : Meta_Initial_Creator_Element_Node do
Matreshka.ODF_Meta.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Meta_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Meta_Initial_Creator_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Meta_Initial_Creator
(ODF.DOM.Meta_Initial_Creator_Elements.ODF_Meta_Initial_Creator_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Meta_Initial_Creator_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Initial_Creator_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Meta_Initial_Creator_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Meta_Initial_Creator
(ODF.DOM.Meta_Initial_Creator_Elements.ODF_Meta_Initial_Creator_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Meta_Initial_Creator_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Meta_Initial_Creator
(Visitor,
ODF.DOM.Meta_Initial_Creator_Elements.ODF_Meta_Initial_Creator_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Meta_URI,
Matreshka.ODF_String_Constants.Initial_Creator_Element,
Meta_Initial_Creator_Element_Node'Tag);
end Matreshka.ODF_Meta.Initial_Creator_Elements;
|
reznikmm/matreshka | Ada | 4,209 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Nodes;
with XML.DOM.Attributes.Internals;
package body ODF.DOM.Attributes.Style.Class.Internals is
------------
-- Create --
------------
function Create
(Node : Matreshka.ODF_Attributes.Style.Class.Style_Class_Access)
return ODF.DOM.Attributes.Style.Class.ODF_Style_Class is
begin
return
(XML.DOM.Attributes.Internals.Create
(Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record);
end Create;
----------
-- Wrap --
----------
function Wrap
(Node : Matreshka.ODF_Attributes.Style.Class.Style_Class_Access)
return ODF.DOM.Attributes.Style.Class.ODF_Style_Class is
begin
return
(XML.DOM.Attributes.Internals.Wrap
(Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record);
end Wrap;
end ODF.DOM.Attributes.Style.Class.Internals;
|
mgrojo/bingada | Ada | 1,989 | adb | --*****************************************************************************
--*
--* PROJECT: BINGADA
--*
--* FILE: q_bingo-q_bombo.adb
--*
--* AUTHOR: Javier Fuica Fernandez
--*
--*****************************************************************************
with Q_Gen_Shuffle;
with Q_Sound;
package body Q_Bingo.Q_Bombo is
--==================================================================
V_Index : T_Number;
--==================================================================
package Q_Shuffle is new Q_Gen_Shuffle
(Element_Type => T_Number,
C_Max_Number => T_Number'Last);
V_Bingo_Array : Q_Shuffle.Array_Type;
--==================================================================
procedure P_Init is
begin
for I in 1 .. T_Number'Last loop
V_Bingo_Array (I) := I;
end loop;
Q_Shuffle.P_Shuffle (List => V_Bingo_Array);
V_Index := 1;
end P_Init;
--==================================================================
procedure P_Spin (V_Number : out Positive;
V_Current_Index : out T_Number;
V_Last_Number : out Boolean) is
begin
if V_Index = T_Number'Last then
V_Number := V_Bingo_Array (T_Number'Last);
V_Last_Number := True;
V_Current_Index := V_Index;
else
V_Number := V_Bingo_Array (V_Index);
V_Current_Index := V_Index;
V_Index := V_Index + 1;
V_Last_Number := False;
end if;
Q_Sound.P_Play_Number (V_Bingo_Array (V_Current_Index));
end P_Spin;
--==================================================================
function F_Get_Number (V_Index : T_Number) return T_Number is
(V_Bingo_Array (V_Index));
--==================================================================
function F_Get_Current_Index return T_Number is (V_Index);
--==================================================================
end Q_Bingo.Q_Bombo;
|
reznikmm/matreshka | Ada | 3,631 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Attributes.FO.Font_Size is
type ODF_FO_Font_Size is
new XML.DOM.Attributes.DOM_Attribute with private;
private
type ODF_FO_Font_Size is
new XML.DOM.Attributes.DOM_Attribute with null record;
end ODF.DOM.Attributes.FO.Font_Size;
|
stcarrez/ada-asf | Ada | 2,957 | adb | -----------------------------------------------------------------------
-- asf-lifecycles-default -- Default Lifecycle handler
-- Copyright (C) 2010, 2018, 2022 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ASF.Lifecycles.Restore;
with ASF.Lifecycles.Apply;
with ASF.Lifecycles.Validation;
with ASF.Lifecycles.Update;
with ASF.Lifecycles.Invoke;
with ASF.Lifecycles.Response;
package body ASF.Lifecycles.Default is
-- ------------------------------
-- Creates the phase controllers by invoking the <b>Set_Controller</b>
-- procedure for each phase. This is called by <b>Initialize</b> to build
-- the lifecycle handler.
-- ------------------------------
overriding
procedure Create_Phase_Controllers (Controller : in out Lifecycle) is
use ASF.Events.Phases;
begin
Controller.Set_Controller (Phase => RESTORE_VIEW,
Instance => new Lifecycles.Restore.Restore_Controller);
Controller.Set_Controller (Phase => APPLY_REQUEST_VALUES,
Instance => new Lifecycles.Apply.Apply_Controller);
Controller.Set_Controller (Phase => PROCESS_VALIDATION,
Instance => new Lifecycles.Validation.Validation_Controller);
Controller.Set_Controller (Phase => UPDATE_MODEL_VALUES,
Instance => new Lifecycles.Update.Update_Controller);
Controller.Set_Controller (Phase => INVOKE_APPLICATION,
Instance => new Lifecycles.Invoke.Invoke_Controller);
Controller.Set_Controller (Phase => RENDER_RESPONSE,
Instance => new Lifecycles.Response.Response_Controller);
end Create_Phase_Controllers;
-- ------------------------------
-- Initialize the the lifecycle handler.
-- ------------------------------
overriding
procedure Initialize (Controller : in out Lifecycle;
Views : ASF.Applications.Views.View_Handler_Access) is
begin
Lifecycle'Class (Controller).Create_Phase_Controllers;
for Phase in Controller.Controllers'Range loop
Controller.Controllers (Phase).Initialize (Views);
end loop;
end Initialize;
end ASF.Lifecycles.Default;
|
reznikmm/matreshka | Ada | 3,754 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Text_Visited_Style_Name_Attributes is
pragma Preelaborate;
type ODF_Text_Visited_Style_Name_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Text_Visited_Style_Name_Attribute_Access is
access all ODF_Text_Visited_Style_Name_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Text_Visited_Style_Name_Attributes;
|
zhmu/ananas | Ada | 6,975 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . B I T F I E L D _ U T I L S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2019-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
package System.Bitfield_Utils is
-- This package provides a procedure for copying arbitrarily large and
-- arbitrarily bit-aligned bit fields.
-- Type Val is used to represent small bit fields. Val_2 represents a
-- contiguous pair of Vals. Val_2'Alignment is half of its size in bytes,
-- which is likely not the natural alignment. This is done to ensure that
-- any bit field that fits in a Val can fit in an aligned Val_2, starting
-- somewhere in the first half, and possibly crossing over into the second
-- half. This allows us to isolate a Val value by shifting and masking the
-- Val_2.
--
-- Val can be 8, 16, or 32 bits; larger values are more efficient. It can't
-- be 64 bits, because we need Val_2 to be a double-wide shiftable type,
-- and 128 bits is not supported. Instantiating with an 8-bit Val is useful
-- for testing and debugging; 32 bits should be used for production.
--
-- We use modular types here, not because we want modular arithmetic, but
-- so we can do shifting and masking. The actual for Val_2 should have
-- pragma Provide_Shift_Operators, so that the Shift_Left and Shift_Right
-- intrinsics can be passed in. It is impossible to put that pragma on a
-- generic formal, or on a type derived from a generic formal, so they have
-- to be passed in.
--
-- Endian indicates whether we're on a little- or big-endian machine.
pragma Elaborate_Body;
Little : constant Bit_Order := Low_Order_First;
Big : constant Bit_Order := High_Order_First;
generic
type Val is mod <>;
type Val_2 is mod <>;
with function Shift_Left
(Value : Val_2;
Amount : Natural) return Val_2 is <>;
with function Shift_Right
(Value : Val_2;
Amount : Natural) return Val_2 is <>;
Endian : Bit_Order := Default_Bit_Order;
package G is
-- Assert that Val has one of the allowed sizes, and that Val_2 is twice
-- that.
pragma Assert (Val'Size in 8 | 16 | 32);
pragma Assert (Val_2'Size = Val'Size * 2);
-- Assert that both are aligned the same, to the size in bytes of Val
-- (not Val_2).
pragma Assert (Val'Alignment = Val'Size / Storage_Unit);
pragma Assert (Val_2'Alignment = Val'Alignment);
type Val_Array is array (Positive range <>) of Val;
-- It might make more sense to have:
-- subtype Val is Val_2 range 0 .. 2**Val'Size - 1;
-- But then GNAT gets the component size of Val_Array wrong.
pragma Assert (Val_Array'Alignment = Val'Alignment);
pragma Assert (Val_Array'Component_Size = Val'Size);
subtype Bit_Size is Natural; -- Size in bits of a bit field
subtype Small_Size is Bit_Size range 1 .. Val'Size;
-- Size of a small one
subtype Bit_Offset is Small_Size'Base range 0 .. Val'Size - 1;
-- Starting offset
subtype Bit_Offset_In_Byte is Bit_Offset range 0 .. Storage_Unit - 1;
procedure Copy_Bitfield
(Src_Address : Address;
Src_Offset : Bit_Offset_In_Byte;
Dest_Address : Address;
Dest_Offset : Bit_Offset_In_Byte;
Size : Bit_Size);
-- An Address and a Bit_Offset together form a "bit address". This
-- copies the source bit field to the destination. Size is the size in
-- bits of the bit field. The bit fields can be arbitrarily large, but
-- the starting offsets must be within the first byte that the Addresses
-- point to. The Address values need not be aligned.
--
-- For example, a slice assignment of a packed bit field:
--
-- D (D_First .. D_Last) := S (S_First .. S_Last);
--
-- can be implemented using:
--
-- Copy_Bitfield
-- (S (S_First)'Address, S (S_First)'Bit,
-- D (D_First)'Address, D (D_First)'Bit,
-- Size);
function Fast_Copy_Bitfield
(Src : Val_2;
Src_Offset : Bit_Offset;
Dest : Val_2;
Dest_Offset : Bit_Offset;
Size : Small_Size)
return Val_2 with Inline;
-- Faster version of Copy_Bitfield, with a different calling convention.
-- In particular, we pass by copy rather than passing Addresses. The bit
-- field must fit in Val_Bits. Src and Dest must be properly aligned.
-- The result is supposed to be assigned back into Dest, as in:
--
-- Dest := Fast_Copy_Bitfield (Src, ..., Dest, ..., ...);
end G;
end System.Bitfield_Utils;
|
faelys/natools | Ada | 307 | ads | -- Generated at 2014-06-02 19:12:04 +0000 by Natools.Static_Hash_Maps
-- from ../src/natools-s_expressions-printers-pretty-config-commands.sx
function Natools.S_Expressions.Printers.Pretty.Config.Commands.T
return Boolean;
pragma Preelaborate (Natools.S_Expressions.Printers.Pretty.Config.Commands.T);
|
charlie5/cBound | Ada | 1,440 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces.C;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_glx_get_polygon_stipple_cookie_t is
-- Item
--
type Item is record
sequence : aliased Interfaces.C.unsigned;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_glx_get_polygon_stipple_cookie_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_get_polygon_stipple_cookie_t.Item,
Element_Array => xcb.xcb_glx_get_polygon_stipple_cookie_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_glx_get_polygon_stipple_cookie_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_get_polygon_stipple_cookie_t.Pointer,
Element_Array => xcb.xcb_glx_get_polygon_stipple_cookie_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_glx_get_polygon_stipple_cookie_t;
|
AdaCore/libadalang | Ada | 144 | ads | private with Pkg.Foo.Bar;
with B.Foo;
package Pkg.Test is
use B;
package My_Gen is new Foo.Gen;
pragma Test_Statement;
end Pkg.Test;
|
davidkristola/vole | Ada | 11,559 | adb | with Ada.Unchecked_Deallocation;
with AUnit.Assertions; use AUnit.Assertions;
with kv.avm.Log; use kv.avm.Log;
with kv.avm.Symbol_Tables;
with kv.avm.Registers; use kv.avm.Registers;
with kv.avm.Tree_Rewrite;
with kv.avm.vole_tree;
package body kv.avm.Vole_Tests is
procedure Set_Up (T : in out Base_Test_Case) is
begin
T.Symbols.Initialize;
end;
procedure Tear_Down (T : in out Base_Test_Case) is begin null; end;
----------------------------------------------------------------------------
function Name (T : Test_01) return AUnit.Message_String is
pragma Unreferenced (T);
begin
return AUnit.Format ("test vole 01: Basic kv.avm.Symbol_Tables.");
end Name;
procedure Run_Test (T : in out Test_01) is
S : constant String := "Fred";
begin
T.Symbols.Add(S);
Assert(T.Symbols.Has(S), "Symbol that was just added is not in the collection");
Assert(T.Symbols.Get_Index(S) = 0, "First auto-inxed is not zero");
Assert(T.Symbols.Get_Kind(S) = kv.avm.Registers.Unset, "Default kind does not the expected value");
end Run_Test;
----------------------------------------------------------------------------
function Name (T : Test_02) return AUnit.Message_String is
pragma Unreferenced (T);
begin
return AUnit.Format ("test vole 02: Multi kv.avm.Symbol_Tables.");
end Name;
package Symbol_Names is
-- These have to be in alphabetical order for the tests to pass (while still using a map).
A : constant String := "a_symbol";
B : constant String := "b_symbol";
C : constant String := "c_symbol";
D : constant String := "d_symbol";
end Symbol_Names;
procedure Run_Test (T : in out Test_02) is
use Symbol_Names;
begin
T.Symbols.Add(A);
T.Symbols.Add(B);
T.Symbols.Add(C);
Assert(T.Symbols.Count = 3, "Wrong count");
Assert(T.Symbols.Has(A), "Symbol A missing");
Assert(T.Symbols.Has(B), "Symbol B missing");
Assert(T.Symbols.Has(C), "Symbol C missing");
Assert(T.Symbols.Get_Index(C) = 2, "Third auto-inxed is not two");
T.Symbols.Set_All_Indexes;
Assert(T.Symbols.Get_Index(C) = 3, "Third updated-inxed is not three");
T.Symbols.Set_All_Indexes(5);
Assert(T.Symbols.Get_Index(C) = 3+5-1, "Third updated-inxed is not now 7");
end Run_Test;
----------------------------------------------------------------------------
function Name (T : Test_03) return AUnit.Message_String is
pragma Unreferenced (T);
begin
return AUnit.Format ("test vole 03: Update kv.avm.Symbol_Tables.");
end Name;
procedure Run_Test (T : in out Test_03) is
use Symbol_Names;
begin
T.Symbols.Add(A);
T.Symbols.Add(B);
T.Symbols.Add(C);
T.Symbols.Set_Kind(B, kv.avm.Registers.Tuple);
Assert(T.Symbols.Get_Kind(B) = kv.avm.Registers.Tuple, "Updated kind does not the expected value");
end Run_Test;
procedure Check_Name_Index(Name : in String; Indx : in Natural) is
use Symbol_Names;
begin
case Indx is
when 0 =>
Assert(Name = A, "Wrong symbol name in position 1, expected '" & A & "', got '" & Name & "'.");
when 1 =>
Assert(Name = B, "Wrong symbol name in position 2, expected '" & B & "', got '" & Name & "'.");
when 2 =>
Assert(Name = C, "Wrong symbol name in position 3, expected '" & C & "', got '" & Name & "'.");
when 3 =>
Assert(Name = D, "Wrong symbol name in position 4, expected '" & D & "', got '" & Name & "'.");
when others =>
Assert(False, "Invalid index");
end case;
end Check_Name_Index;
----------------------------------------------------------------------------
function Name (T : Test_04) return AUnit.Message_String is
pragma Unreferenced (T);
begin
return AUnit.Format ("test vole 04: For_Each kv.avm.Symbol_Tables.");
end Name;
procedure Run_Test (T : in out Test_04) is
use Symbol_Names;
Current : Natural := 0;
procedure Check(Name : in String; Kind : in kv.avm.Registers.Data_Kind; Indx : in Natural; Init : in String) is
begin
Assert(Indx = Current, "Wrong index");
case Current is
when 0 =>
Assert(Name = A, "Wrong symbol name in position 1");
when 1 =>
Assert(Kind = Tuple, "Wrong kind in position 2");
when 2 =>
Assert(Init = "omega", "Wrong init in position 3");
when others =>
null;
end case;
Check_Name_Index(Name, Indx);
Current := Current + 1;
end Check;
begin
T.Symbols.Add(A);
T.Symbols.Add(B);
T.Symbols.Add(C);
T.Symbols.Set_Kind(B, kv.avm.Registers.Tuple);
T.Symbols.Set_Init(C, "omega");
T.Symbols.For_Each(Check'ACCESS);
end Run_Test;
----------------------------------------------------------------------------
function Name (T : Test_05) return AUnit.Message_String is
pragma Unreferenced (T);
begin
return AUnit.Format ("test vole 05: Negative kv.avm.Symbol_Tables.");
end Name;
procedure Run_Test (T : in out Test_05) is
Kind : kv.avm.Registers.Data_Kind;
Index : Natural;
begin
Assert(not T.Symbols.Has("Foo"), "Has lied");
begin
Kind := T.Symbols.Get_Kind("Foo");
Assert(False, "Failed to raise exception when accessing missing symbol");
exception
when kv.avm.Symbol_Tables.Missing_Element_Error =>
null;
when others =>
Assert(True, "Unexpected exception raised");
end;
begin
Index := T.Symbols.Get_Index("Foo");
Assert(False, "Failed to raise exception when accessing missing symbol");
exception
when kv.avm.Symbol_Tables.Missing_Element_Error =>
null;
when others =>
Assert(True, "Unexpected exception raised");
end;
end Run_Test;
----------------------------------------------------------------------------
procedure Free is new Ada.Unchecked_Deallocation(kv.avm.Symbol_Tables.Symbol_Table, kv.avm.Symbol_Tables.Symbol_Table_Access);
----------------------------------------------------------------------------
function Name (T : Test_06) return AUnit.Message_String is
pragma Unreferenced (T);
begin
return AUnit.Format ("test vole 06: Link_Superclass_Table.");
end Name;
procedure Run_Test (T : in out Test_06) is
Super_Symbols : kv.avm.Symbol_Tables.Symbol_Table_Access;
use Symbol_Names;
Count : Integer := 0;
procedure Check(Name : in String; Kind : in kv.avm.Registers.Data_Kind; Indx : in Natural; Init : in String) is
begin
Count := Count + 1;
Check_Name_Index(Name, Indx);
end Check;
begin
Super_Symbols := new kv.avm.Symbol_Tables.Symbol_Table;
Super_Symbols.Initialize;
T.Symbols.Link_Superclass_Table(Super_Symbols);
Super_Symbols.Add(A);
Super_Symbols.Add(B);
Super_Symbols.Set_All_Indexes(0);
T.Symbols.Add(C);
T.Symbols.Add(D);
T.Symbols.Set_All_Indexes(Super_Symbols.Count);
T.Symbols.For_Each(Check'ACCESS);
Assert(Count = 4, "Wrong number of symbols in the combined table, expected 4, got " & Integer'IMAGE(Count));
Free(Super_Symbols);
end Run_Test;
----------------------------------------------------------------------------
function Name (T : Test_07) return AUnit.Message_String is
pragma Unreferenced (T);
begin
return AUnit.Format ("test vole 07: rewrite a subclass node.");
end Name;
procedure Run_Test (T : in out Test_07) is
use kv.avm.vole_tree;
use Symbol_Names;
Rewriter : aliased kv.avm.Tree_Rewrite.Rewriter_Class;
SubName_NP : kv.avm.vole_tree.Node_Pointer;
SuperName_NP : kv.avm.vole_tree.Node_Pointer;
Subclass_NP : kv.avm.vole_tree.Node_Pointer;
Superclass_NP : kv.avm.vole_tree.Node_Pointer;
Program_NP : kv.avm.vole_tree.Node_Pointer;
Program_PP : Program_Pointer;
Table : access kv.avm.Symbol_Tables.Symbol_Table;
begin
kv.avm.Log.Verbose := True;
Put_Line("test vole 07");
-- kv.avm.vole_tree uses a singleton to store the parsed program
Build_Id_Node(SubName_NP, 1, "SubClass");
Assert(SubName_NP /= null, "SubName_NP is null");
Build_Id_Node(SuperName_NP, 2, "SuperClass");
Build_Actor_Node(Subclass_NP, 3, SubName_NP, null, null, SuperName_NP);
Table := Actor_Definition_Pointer(Subclass_NP).Get_Symbol_Table(CONSTANT_SYMBOLS);
Table.Add(C);
Table.Add(D);
Table := Actor_Definition_Pointer(Subclass_NP).Get_Symbol_Table(VARIABLE_SYMBOLS);
Table.Add(C);
Table.Add(D);
Build_Actor_Node(Superclass_NP, 4, SuperName_NP, null, null);
Add_Next(Superclass_NP, Subclass_NP);
Table := Actor_Definition_Pointer(Superclass_NP).Get_Symbol_Table(CONSTANT_SYMBOLS);
Table.Add(A);
Table.Add(B);
Table := Actor_Definition_Pointer(Superclass_NP).Get_Symbol_Table(VARIABLE_SYMBOLS);
Table.Add(A);
Table.Add(B);
Build_Program(Program_NP, 5, null, Superclass_NP);
Save_Program(Program_NP);
Assert(Program_NP /= null, "Program_NP is null");
Program_PP := Program_Pointer(Program_NP);
Rewriter.Init;
Put_Line("visit...");
Program_PP.Visit(Rewriter'ACCESS, 0);
Rewriter.Finalize;
Table := Actor_Definition_Pointer(Superclass_NP).Get_Symbol_Table(CONSTANT_SYMBOLS);
Assert(Table.Get_Index(A) = 0, "Super Constant A has wrong index, expected 0, got " & Natural'IMAGE(Table.Get_Index(A)));
Table := Actor_Definition_Pointer(Superclass_NP).Get_Symbol_Table(VARIABLE_SYMBOLS);
Assert(Table.Get_Index(B) = 1, "Super Attribute B has wrong index, expected 1, got " & Natural'IMAGE(Table.Get_Index(B)));
Table := Actor_Definition_Pointer(Subclass_NP).Get_Symbol_Table(CONSTANT_SYMBOLS);
Assert(Table.Get_Index(A) = 0, "Sub Constant A has wrong index, expected 0, got " & Natural'IMAGE(Table.Get_Index(A)));
Assert(Table.Get_Index(B) = 1, "Sub Constant B has wrong index, expected 1, got " & Natural'IMAGE(Table.Get_Index(B)));
Assert(Table.Get_Index(C) = 2, "Sub Constant C has wrong index, expected 2, got " & Natural'IMAGE(Table.Get_Index(C)));
Assert(Table.Get_Index(D) = 3, "Sub Constant D has wrong index, expected 3, got " & Natural'IMAGE(Table.Get_Index(D)));
Table := Actor_Definition_Pointer(Subclass_NP).Get_Symbol_Table(VARIABLE_SYMBOLS);
Assert(Table.Get_Index(A) = 0, "Sub Attribute A has wrong index, expected 0, got " & Natural'IMAGE(Table.Get_Index(A)));
Assert(Table.Get_Index(B) = 1, "Sub Attribute B has wrong index, expected 1, got " & Natural'IMAGE(Table.Get_Index(B)));
Assert(Table.Get_Index(C) = 2, "Sub Attribute C has wrong index, expected 2, got " & Natural'IMAGE(Table.Get_Index(C)));
Assert(Table.Get_Index(D) = 3, "Sub Attribute D has wrong index, expected 3, got " & Natural'IMAGE(Table.Get_Index(D)));
end Run_Test;
----------------------------------------------------------------------------
function Name (T : Test_08) return AUnit.Message_String is
pragma Unreferenced (T);
begin
return AUnit.Format ("test vole 08: XXX.");
end Name;
procedure Run_Test (T : in out Test_08) is
begin
null;
end Run_Test;
end kv.avm.Vole_Tests;
|
DrenfongWong/tkm-rpc | Ada | 954 | ads | with Tkmrpc.Types;
with Tkmrpc.Operations.Cfg;
package Tkmrpc.Request.Cfg.Tkm_Version is
Data_Size : constant := 0;
Padding_Size : constant := Request.Body_Size - Data_Size;
subtype Padding_Range is Natural range 1 .. Padding_Size;
subtype Padding_Type is Types.Byte_Sequence (Padding_Range);
type Request_Type is record
Header : Request.Header_Type;
Padding : Padding_Type;
end record;
for Request_Type use record
Header at 0 range 0 .. (Request.Header_Size * 8) - 1;
Padding at Request.Header_Size + Data_Size range
0 .. (Padding_Size * 8) - 1;
end record;
for Request_Type'Size use Request.Request_Size * 8;
Null_Request : constant Request_Type :=
Request_Type'
(Header =>
Request.Header_Type'(Operation => Operations.Cfg.Tkm_Version,
Request_Id => 0),
Padding => Padding_Type'(others => 0));
end Tkmrpc.Request.Cfg.Tkm_Version;
|
zhmu/ananas | Ada | 6,239 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S E M _ D I S T --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. 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. --
-- --
------------------------------------------------------------------------------
-- Semantic processing for distribution annex facilities
with Snames; use Snames;
with Types; use Types;
package Sem_Dist is
function Get_PCS_Name return PCS_Names;
-- Return the name of a literal of type DSA_Implementation_Name in package
-- System.Partition_Interface indicating what PCS is currently in use.
function Get_PCS_Version return Int;
-- Return the version number of the PCS API implemented by the PCS.
-- The consistency of this version with the one expected by Exp_Dist
-- (Exp_Dist.PCS_Version_Number) in Rtsfind.RTE.Check_RPC.
-- If no PCS version information is available, 0 is returned.
function Is_Valid_Remote_Object_Type (E : Entity_Id) return Boolean;
-- True if tagged type E is a valid candidate as the root type of the
-- designated type for a RACW, i.e. a tagged limited private type, or a
-- limited interface type, or a private extension of such a type.
procedure Add_Stub_Constructs (N : Node_Id);
-- Create the stubs constructs for a remote call interface package
-- specification or body or for a shared passive specification. For caller
-- stubs, expansion takes place directly in the specification and no
-- additional compilation unit is created.
function Build_RAS_Primitive_Specification
(Subp_Spec : Node_Id;
Remote_Object_Type : Node_Id) return Node_Id;
-- Build a subprogram specification for the primitive operation of the
-- Remote_Object_Type used to implement a remote access-to-subprogram
-- type whose parameter profile is given by specification Subp_Spec.
function Is_All_Remote_Call (N : Node_Id) return Boolean;
-- Check whether a function or procedure call should be expanded into
-- a remote call, because the entity is declared in a package decl that
-- is not currently in scope, and the proper pragmas apply.
procedure Process_Partition_Id (N : Node_Id);
-- Replace attribute reference with call to runtime function. The result
-- is converted to the context type, because the attribute yields a
-- universal integer value.
procedure Process_Remote_AST_Attribute (N : Node_Id; New_Type : Entity_Id);
-- Given N, an access attribute reference node whose prefix is a
-- remote subprogram, rewrite N with a call to a conversion function
-- whose return type is New_Type.
procedure Process_Remote_AST_Declaration (N : Node_Id);
-- Given N, an access to subprogram type declaration node in RCI or remote
-- types unit, build a new record (fat pointer) type declaration using the
-- old Defining_Identifier of N and a link to the old declaration node N
-- whose Defining_Identifier is changed. We also construct declarations of
-- two subprograms in the unit specification which handle remote access to
-- subprogram type (fat pointer) dereference and the unit receiver that
-- handles remote calls (from remote access to subprogram type values.)
function Remote_AST_E_Dereference (P : Node_Id) return Boolean;
-- If the prefix of an explicit dereference is a record type that
-- represent the fat pointer for an Remote access to subprogram, in the
-- context of a call, rewrite the enclosing call node into remote call,
-- the first actual of which is the fat pointer. Return true if the
-- context is correct and the transformation took place.
function Remote_AST_I_Dereference (P : Node_Id) return Boolean;
-- If P is a record type that represents the fat pointer for a remote
-- access to subprogram, and P is the prefix of a call, insert an explicit
-- dereference and perform the transformation described for the previous
-- function.
function Remote_AST_Null_Value
(N : Node_Id;
Typ : Entity_Id) return Boolean;
-- If N is a null value and Typ a remote access to subprogram type, this
-- function will check if null needs to be replaced with an aggregate and
-- will return True in this case. Otherwise, it will return False.
function Package_Specification_Of_Scope (E : Entity_Id) return Node_Id;
-- Return the N_Package_Specification corresponding to a scope E
function Is_RACW_Stub_Type_Operation (Op : Entity_Id) return Boolean;
-- True when Op is a primitive operation of an RACW stub type
end Sem_Dist;
|
ekoeppen/MSP430_Generic_Ada_Drivers | Ada | 1,102 | ads | with HAL;
generic
with package Chip_Select is new HAL.Pin (<>);
with package Chip_Enable is new HAL.Pin (<>);
with package IRQ is new HAL.Pin (<>);
with package SPI is new HAL.SPI (<>);
with package Clock is new HAL.Clock (<>);
package Drivers.NRF24 is
pragma Preelaborate;
type Raw_Register_Array is array (0 .. 16#1D#) of Unsigned_8;
subtype Channel_Type is Unsigned_8 range 0 .. 127;
type Address_Type is array (1 .. 5) of Unsigned_8;
type Packet_Type is array (Positive range <>) of Unsigned_8;
procedure Init;
procedure Set_Channel (Channel : Channel_Type);
procedure Set_RX_Address (Address : Address_Type);
procedure Set_TX_Address (Address : Address_Type);
procedure TX_Mode;
procedure RX_Mode;
procedure TX (Packet: Packet_Type);
function Wait_For_RX return Boolean;
procedure RX (Packet : out Packet_Type);
procedure Power_Down;
procedure Cancel;
procedure Read_Registers (Registers : out Raw_Register_Array);
generic
with procedure Put_Line (Line: in string);
procedure Print_Registers;
end Drivers.NRF24;
|
msrLi/portingSources | Ada | 827 | adb | -- Copyright 2014 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package body Pck is
procedure Do_Nothing (A : System.Address) is
begin
null;
end Do_Nothing;
end Pck;
|
reznikmm/gela | Ada | 10,698 | adb | ------------------------------------------------------------------------------
-- G E L A A S I S --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://www.ten15.org/wiki/Ada --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of this file --
------------------------------------------------------------------------------
-- Purpose:
-- Procedural wrapper over Object-Oriented ASIS implementation
with Ada.Exceptions;
with Ada.Characters.Handling;
with Asis.Errors;
with Asis.Exceptions;
with Asis.Implementation;
with League.Application;
with League.Strings;
with League.String_Vectors;
with Gela.Context_Factories;
with Gela.Contexts;
package body Asis.Ada_Environments is
function Assigned (Self : Asis.Context) return Boolean;
--------------
-- Assigned --
--------------
function Assigned (Self : Asis.Context) return Boolean is
use type Gela.Contexts.Context_Access;
begin
return Self.Implementation /= null;
end Assigned;
---------------
-- Associate --
---------------
procedure Associate
(The_Context : in out Asis.Context;
Name : in Wide_String;
Parameters : in Wide_String := Default_Parameters)
is
begin
if not Implementation.Is_Initialized
or Implementation.Is_Finalized
then
Implementation.Set_Status
(Status => Asis.Errors.Initialization_Error,
Diagnosis => "ASIS is not initialized");
raise Exceptions.ASIS_Failed;
end if;
if Is_Open (The_Context) then
Implementation.Set_Status
(Status => Asis.Errors.Value_Error,
Diagnosis => "Context has alredy been opened");
raise Exceptions.ASIS_Inappropriate_Context;
end if;
The_Context :=
(Implementation => null,
Name => League.Strings.From_UTF_16_Wide_String (Name),
Parameters => League.Strings.From_UTF_16_Wide_String (Parameters),
Associated => True);
end Associate;
-----------
-- Close --
-----------
procedure Close (The_Context : in out Asis.Context) is
begin
if not Is_Open (The_Context) then
Implementation.Set_Status
(Status => Asis.Errors.Value_Error,
Diagnosis => "Context is not opened");
raise Exceptions.ASIS_Inappropriate_Context;
end if;
-- Free (The_Context.Implementation); TODO
The_Context.Implementation := null;
end Close;
-----------------
-- Debug_Image --
-----------------
function Debug_Image (The_Context : in Asis.Context) return Wide_String is
begin
return "Name: " & Name (The_Context) &
" Parameters:" & Parameters (The_Context);
end Debug_Image;
------------------
-- Default_Name --
------------------
function Default_Name return Wide_String is
begin
return "";
end Default_Name;
------------------------
-- Default_Parameters --
------------------------
function Default_Parameters return Wide_String is
begin
return "";
end Default_Parameters;
----------------
-- Dissociate --
----------------
procedure Dissociate (The_Context : in out Asis.Context) is
begin
if Is_Open (The_Context) then
Implementation.Set_Status
(Status => Asis.Errors.Value_Error,
Diagnosis => "Context is opened");
raise Exceptions.ASIS_Inappropriate_Context;
end if;
The_Context := Nil_Context;
end Dissociate;
-----------
-- Equal --
-----------
function Equal
(A, B : Gela.Compilation_Unit_Sets.Compilation_Unit_Set_Access;
A_Symbols : Gela.Symbol_Sets.Symbol_Set_Access;
B_Symbols : Gela.Symbol_Sets.Symbol_Set_Access)
return Boolean is
begin
if A.Length /= B.Length then
return False;
end if;
declare
use type League.Strings.Universal_String;
A_Unit : Gela.Compilation_Units.Compilation_Unit_Access;
B_Unit : Gela.Compilation_Units.Compilation_Unit_Access;
A_Cursor : Gela.Compilation_Unit_Sets.Compilation_Unit_Cursor'Class
:= A.First;
B_Cursor : Gela.Compilation_Unit_Sets.Compilation_Unit_Cursor'Class
:= B.First;
begin
while A_Cursor.Has_Element loop
A_Unit := A_Cursor.Element;
B_Unit := B_Cursor.Element;
if A_Symbols.Folded (A_Unit.Name) /=
B_Symbols.Folded (B_Unit.Name)
then
return False;
end if;
A_Cursor.Next;
B_Cursor.Next;
end loop;
end;
return True;
end Equal;
------------
-- Exists --
------------
function Exists (The_Context : in Asis.Context) return Boolean is
begin
return Is_Open (The_Context);
end Exists;
----------------------
-- Has_Associations --
----------------------
function Has_Associations (The_Context : in Asis.Context) return Boolean is
begin
return The_Context.Associated;
end Has_Associations;
--------------
-- Is_Equal --
--------------
function Is_Equal
(Left : in Asis.Context;
Right : in Asis.Context) return Boolean
is
Left_Units : Gela.Compilation_Unit_Sets.Compilation_Unit_Set_Access;
Right_Units : Gela.Compilation_Unit_Sets.Compilation_Unit_Set_Access;
begin
if Is_Open (Left) and Is_Open (Right) then
Left_Units := Left.Implementation.Library_Unit_Declarations;
Right_Units := Left.Implementation.Library_Unit_Declarations;
if not Equal (Left_Units,
Right_Units,
Left.Implementation.Symbols,
Right.Implementation.Symbols)
then
return False;
end if;
Left_Units := Left.Implementation.Compilation_Unit_Bodies;
Right_Units := Left.Implementation.Compilation_Unit_Bodies;
return Equal (Left_Units,
Right_Units,
Left.Implementation.Symbols,
Right.Implementation.Symbols);
else
return Name (Left) = Name (Right) and
Parameters (Left) = Parameters (Right);
end if;
end Is_Equal;
------------------
-- Is_Identical --
------------------
function Is_Identical
(Left : in Asis.Context;
Right : in Asis.Context) return Boolean
is
use type Gela.Contexts.Context_Access;
begin
return Left.Implementation = Right.Implementation;
end Is_Identical;
-------------
-- Is_Open --
-------------
function Is_Open (The_Context : in Asis.Context) return Boolean is
use type Gela.Contexts.Context_Access;
begin
return The_Context.Implementation /= null;
end Is_Open;
----------
-- Name --
----------
function Name (The_Context : in Asis.Context) return Wide_String is
begin
if Assigned (The_Context) then
return The_Context.Name.To_UTF_16_Wide_String;
else
return "";
end if;
end Name;
----------
-- Open --
----------
procedure Open (The_Context : in out Asis.Context) is
use Ada.Exceptions;
use Asis.Exceptions;
use Ada.Characters.Handling;
begin
if Is_Open (The_Context) then
Implementation.Set_Status (
Status => Asis.Errors.Value_Error,
Diagnosis => "Context has alredy been opened");
raise ASIS_Inappropriate_Context;
end if;
if not Has_Associations (The_Context) then
Implementation.Set_Status (
Status => Asis.Errors.Value_Error,
Diagnosis => "Context has no association");
raise ASIS_Inappropriate_Context;
end if;
declare
Gela_Include_Path : constant League.Strings.Universal_String :=
League.Strings.To_Universal_String ("GELA_INCLUDE_PATH");
Env : constant League.Strings.Universal_String :=
League.Application.Environment.Value (Gela_Include_Path);
Args : constant League.String_Vectors.Universal_String_Vector :=
The_Context.Parameters.Split (' ');
begin
The_Context.Implementation :=
Gela.Context_Factories.Create_Context (Args, Env);
exception
when E : others =>
Implementation.Set_Status
(Status => Asis.Errors.Internal_Error,
Diagnosis => "Asis.Ada_Environments.Open: "
& To_Wide_String (Exception_Information (E)));
raise ASIS_Failed;
end;
end Open;
----------------
-- Parameters --
----------------
function Parameters (The_Context : in Asis.Context) return Wide_String is
begin
return The_Context.Parameters.To_UTF_16_Wide_String;
end Parameters;
end Asis.Ada_Environments;
------------------------------------------------------------------------------
-- Copyright (c) 2006-2013, Maxim Reznik
-- 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.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
|
shaggie76/Aristophanes | Ada | 4,549 | adb | ----------------------------------------------------------------
-- ZLib for Ada thick binding. --
-- --
-- Copyright (C) 2002-2003 Dmitriy Anisimkov --
-- --
-- Open source license information is in the zlib.ads file. --
----------------------------------------------------------------
-- Continuous test for ZLib multithreading. If the test is fail
-- Wou should provide thread safe allocation routines for the Z_Stream.
--
-- $Id: mtest.adb,v 1.2 2003/08/12 12:11:05 vagul Exp $
with ZLib;
with Ada.Streams;
with Ada.Numerics.Discrete_Random;
with Ada.Text_IO;
with Ada.Exceptions;
with Ada.Task_Identification;
procedure MTest is
use Ada.Streams;
use ZLib;
Stop : Boolean := False;
pragma Atomic (Stop);
subtype Visible_Symbols is Stream_Element range 16#20# .. 16#7E#;
package Random_Elements is
new Ada.Numerics.Discrete_Random (Visible_Symbols);
task type Test_Task;
task body Test_Task is
Buffer : Stream_Element_Array (1 .. 100_000);
Gen : Random_Elements.Generator;
Buffer_First : Stream_Element_Offset;
Compare_First : Stream_Element_Offset;
Deflate : Filter_Type;
Inflate : Filter_Type;
procedure Further (Item : in Stream_Element_Array);
procedure Read_Buffer
(Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset);
-------------
-- Further --
-------------
procedure Further (Item : in Stream_Element_Array) is
procedure Compare (Item : in Stream_Element_Array);
-------------
-- Compare --
-------------
procedure Compare (Item : in Stream_Element_Array) is
Next_First : Stream_Element_Offset := Compare_First + Item'Length;
begin
if Buffer (Compare_First .. Next_First - 1) /= Item then
raise Program_Error;
end if;
Compare_First := Next_First;
end Compare;
procedure Compare_Write is new ZLib.Write (Write => Compare);
begin
Compare_Write (Inflate, Item, No_Flush);
end Further;
-----------------
-- Read_Buffer --
-----------------
procedure Read_Buffer
(Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset)
is
Buff_Diff : Stream_Element_Offset := Buffer'Last - Buffer_First;
Next_First : Stream_Element_Offset;
begin
if Item'Length <= Buff_Diff then
Last := Item'Last;
Next_First := Buffer_First + Item'Length;
Item := Buffer (Buffer_First .. Next_First - 1);
Buffer_First := Next_First;
else
Last := Item'First + Buff_Diff;
Item (Item'First .. Last) := Buffer (Buffer_First .. Buffer'Last);
Buffer_First := Buffer'Last + 1;
end if;
end Read_Buffer;
procedure Translate is new Generic_Translate
(Data_In => Read_Buffer,
Data_Out => Further);
begin
Random_Elements.Reset (Gen);
Buffer := (others => 20);
Main : loop
for J in Buffer'Range loop
Buffer (J) := Random_Elements.Random (Gen);
Deflate_Init (Deflate);
Inflate_Init (Inflate);
Buffer_First := Buffer'First;
Compare_First := Buffer'First;
Translate (Deflate);
if Compare_First /= Buffer'Last + 1 then
raise Program_Error;
end if;
Ada.Text_IO.Put_Line
(Ada.Task_Identification.Image
(Ada.Task_Identification.Current_Task)
& Stream_Element_Offset'Image (J)
& ZLib.Count'Image (Total_Out (Deflate)));
Close (Deflate);
Close (Inflate);
exit Main when Stop;
end loop;
end loop Main;
exception
when E : others =>
Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Information (E));
Stop := True;
end Test_Task;
Test : array (1 .. 4) of Test_Task;
pragma Unreferenced (Test);
begin
null;
end MTest;
|
Intelligente-sanntidssystemer/Ada-prosjekt | Ada | 239 | adb | with NRF52_DK.IOs; use NRF52_DK.IOs;
with SteeringControl; use SteeringControl;
with NRF52_DK.Buttons; use NRF52_DK.Buttons;
with NRF52_DK.Time;
with car_priorities;
procedure Main is
begin
loop
null;
end loop;
end Main;
|
reznikmm/matreshka | Ada | 4,065 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Draw_Visible_Area_Width_Attributes;
package Matreshka.ODF_Draw.Visible_Area_Width_Attributes is
type Draw_Visible_Area_Width_Attribute_Node is
new Matreshka.ODF_Draw.Abstract_Draw_Attribute_Node
and ODF.DOM.Draw_Visible_Area_Width_Attributes.ODF_Draw_Visible_Area_Width_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Draw_Visible_Area_Width_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Draw_Visible_Area_Width_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Draw.Visible_Area_Width_Attributes;
|
reznikmm/matreshka | Ada | 3,719 | 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_Page_Usage_Attributes is
pragma Preelaborate;
type ODF_Style_Page_Usage_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Style_Page_Usage_Attribute_Access is
access all ODF_Style_Page_Usage_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Style_Page_Usage_Attributes;
|
persan/advent-of-code-2020 | Ada | 132 | adb | with Ada.Text_IO; use Ada.Text_IO;
procedure Adventofcode.Day_7.Main is
begin
Put_Line ("Day-7");
end Adventofcode.Day_7.Main;
|
coopht/axmpp | Ada | 5,899 | ads | ------------------------------------------------------------------------------
-- --
-- AXMPP Project --
-- --
-- XMPP Library for Ada --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011, Alexander Basov <[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 Alexander Basov, 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 GNAT.Sockets;
with GNUTLS;
with XML.SAX.Input_Sources.Streams.Sockets;
with XML.SAX.Input_Sources.Streams.TLS_Sockets;
package XMPP.Networks is
type Notification is limited interface
and XML.SAX.Input_Sources.Streams.TLS_Sockets.Notification;
not overriding
procedure On_Disconnect (Self : not null access Notification) is abstract;
not overriding function Read_Data (Self : not null access Notification)
return Boolean is abstract;
-- This function is called (from Receive) when there is some data in
-- the socket. It should read the data from the socket and return True if
-- ok or False in case of an unrecoverable error.
procedure Initialize;
-- This procedure should be called before use of Network
use GNAT.Sockets;
type Network (Target : not null access Notification'Class) is
tagged limited private;
type Network_Access is access all Network'Class;
procedure Connect (Self : not null access Network'Class;
Host : String;
Port : Natural);
procedure Send (Self : not null access Network'Class;
Data : Ada.Streams.Stream_Element_Array);
-- These two subprograms are called by Idle task
function Recieve (Self : not null access Network'Class) return Boolean;
-- Wait for some data in the socket and read them. Return False is error
procedure Task_Stopped (Self : not null access Network'Class);
-- Close socket and call On_Disconnect
function Get_Socket (Self : not null access Network'Class)
return Socket_Type;
function Is_TLS_Established (Self : Network) return Boolean;
procedure Start_Handshake (Self : in out Network);
function Get_Source (Self : not null access Network)
return not null access XML.SAX.Input_Sources.SAX_Input_Source'Class;
private
type Network (Target : not null access Notification'Class) is tagged limited
record
Addr : Sock_Addr_Type;
Sock : Socket_Type;
Channel : Stream_Access;
Selector : Selector_Type;
WSet : Socket_Set_Type;
RSet : Socket_Set_Type;
Status : Selector_Status;
TLS_Session : GNUTLS.Session;
Credential : GNUTLS.Certificate_Client_Credentials;
Use_TSL : Boolean := False;
Plain_Input :
aliased XML.SAX.Input_Sources.Streams.Sockets.Socket_Input_Source;
TLS_Input :
aliased XML.SAX.Input_Sources.Streams.TLS_Sockets
.TLS_Socket_Input_Source (Target);
end record;
function Read_Data_Wrapper (Self : not null access Network'Class)
return Boolean;
end XMPP.Networks;
|
AdaCore/libadalang | Ada | 112 | adb | separate (Test)
function P (X : Float) return Boolean is
begin
return False;
end;
--% node.p_previous_part()
|
reznikmm/torrent | Ada | 2,321 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with League.IRIs;
with League.Strings;
package Torrent.Trackers is
type Announcement_Kind is
(Started, Completed, Stopped, Regular);
function Event_URL
(Tracker : League.IRIs.IRI;
Info_Hash : SHA1;
Peer_Id : SHA1;
Port : Positive;
Uploaded : Ada.Streams.Stream_Element_Count;
Downloaded : Ada.Streams.Stream_Element_Count;
Left : Ada.Streams.Stream_Element_Count;
Event : Announcement_Kind) return League.IRIs.IRI;
-- Construct an URL to request a tracker.
type Response (<>) is tagged private;
function Parse (Data : Ada.Streams.Stream_Element_Array) return Response;
-- Decode tracker's response. Constraint_Error is raised if it fails.
function Is_Failure (Self : Response'Class) return Boolean;
-- If the query failed.
function Failure_Reason
(Self : Response'Class) return League.Strings.Universal_String;
-- A human readable string which explains why the query failed.
function Interval (Self : Response'Class) return Duration;
-- The number of seconds the downloader should wait between regular
-- rerequests.
function Peer_Count (Self : Response'Class) return Natural;
-- Length of peer lists.
function Peer_Id
(Self : Response'Class;
Index : Positive) return SHA1;
-- The peer's self-selected ID
function Peer_Address
(Self : Response'Class;
Index : Positive) return League.Strings.Universal_String;
-- The peer's IP address or DNS name.
function Peer_Port
(Self : Response'Class;
Index : Positive) return Natural;
-- The peer's port number.
private
type Peer is record
Id : SHA1;
Address : League.Strings.Universal_String;
Port : Natural;
end record;
type Peer_Array is array (Positive range <>) of Peer;
type Response (Peer_Count : Natural) is tagged record
Is_Failure : Boolean;
Failure_Reason : League.Strings.Universal_String;
Interval : Duration;
Peers : Peer_Array (1 .. Peer_Count);
end record;
end Torrent.Trackers;
|
reznikmm/matreshka | Ada | 9,691 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.Elements;
with AMF.Internals.Element_Collections;
with AMF.Internals.Helpers;
with AMF.Internals.Tables.UML_Attributes;
with AMF.Visitors.UMLDI_Iterators;
with AMF.Visitors.UMLDI_Visitors;
package body AMF.Internals.UMLDI_UML_Compartments is
--------------------------------
-- Get_Element_In_Compartment --
--------------------------------
overriding function Get_Element_In_Compartment
(Self : not null access constant UMLDI_UML_Compartment_Proxy)
return AMF.UMLDI.UML_Diagram_Elements.Collections.Ordered_Set_Of_UMLDI_UML_Diagram_Element is
begin
return
AMF.UMLDI.UML_Diagram_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Element_In_Compartment
(Self.Element)));
end Get_Element_In_Compartment;
-----------------
-- Get_Is_Icon --
-----------------
overriding function Get_Is_Icon
(Self : not null access constant UMLDI_UML_Compartment_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Icon
(Self.Element);
end Get_Is_Icon;
-----------------
-- Set_Is_Icon --
-----------------
overriding procedure Set_Is_Icon
(Self : not null access UMLDI_UML_Compartment_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Icon
(Self.Element, To);
end Set_Is_Icon;
---------------------
-- Get_Local_Style --
---------------------
overriding function Get_Local_Style
(Self : not null access constant UMLDI_UML_Compartment_Proxy)
return AMF.UMLDI.UML_Styles.UMLDI_UML_Style_Access is
begin
return
AMF.UMLDI.UML_Styles.UMLDI_UML_Style_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Style
(Self.Element)));
end Get_Local_Style;
---------------------
-- Set_Local_Style --
---------------------
overriding procedure Set_Local_Style
(Self : not null access UMLDI_UML_Compartment_Proxy;
To : AMF.UMLDI.UML_Styles.UMLDI_UML_Style_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Local_Style
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Local_Style;
-----------------------
-- Get_Model_Element --
-----------------------
overriding function Get_Model_Element
(Self : not null access constant UMLDI_UML_Compartment_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element is
begin
raise Program_Error;
return X : AMF.UML.Elements.Collections.Set_Of_UML_Element;
-- return
-- AMF.UML.Elements.Collections.Wrap
-- (AMF.Internals.Element_Collections.Wrap
-- (AMF.Internals.Tables.UML_Attributes.Internal_Get_Model_Element
-- (Self.Element)));
end Get_Model_Element;
-----------------------
-- Get_Model_Element --
-----------------------
overriding function Get_Model_Element
(Self : not null access constant UMLDI_UML_Compartment_Proxy)
return AMF.CMOF.Elements.CMOF_Element_Access is
begin
return
AMF.CMOF.Elements.CMOF_Element_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Model_Element
(Self.Element)));
end Get_Model_Element;
---------------------
-- Get_Local_Style --
---------------------
overriding function Get_Local_Style
(Self : not null access constant UMLDI_UML_Compartment_Proxy)
return AMF.DI.Styles.DI_Style_Access is
begin
return
AMF.DI.Styles.DI_Style_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Style
(Self.Element)));
end Get_Local_Style;
---------------------
-- Set_Local_Style --
---------------------
overriding procedure Set_Local_Style
(Self : not null access UMLDI_UML_Compartment_Proxy;
To : AMF.DI.Styles.DI_Style_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Local_Style
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Local_Style;
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UMLDI_UML_Compartment_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UMLDI_Visitors.UMLDI_Visitor'Class then
AMF.Visitors.UMLDI_Visitors.UMLDI_Visitor'Class
(Visitor).Enter_UML_Compartment
(AMF.UMLDI.UML_Compartments.UMLDI_UML_Compartment_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UMLDI_UML_Compartment_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UMLDI_Visitors.UMLDI_Visitor'Class then
AMF.Visitors.UMLDI_Visitors.UMLDI_Visitor'Class
(Visitor).Leave_UML_Compartment
(AMF.UMLDI.UML_Compartments.UMLDI_UML_Compartment_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UMLDI_UML_Compartment_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Iterator in AMF.Visitors.UMLDI_Iterators.UMLDI_Iterator'Class then
AMF.Visitors.UMLDI_Iterators.UMLDI_Iterator'Class
(Iterator).Visit_UML_Compartment
(Visitor,
AMF.UMLDI.UML_Compartments.UMLDI_UML_Compartment_Access (Self),
Control);
end if;
end Visit_Element;
end AMF.Internals.UMLDI_UML_Compartments;
|
reznikmm/matreshka | Ada | 4,059 | 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_Punctuation_Wrap_Attributes;
package Matreshka.ODF_Style.Punctuation_Wrap_Attributes is
type Style_Punctuation_Wrap_Attribute_Node is
new Matreshka.ODF_Style.Abstract_Style_Attribute_Node
and ODF.DOM.Style_Punctuation_Wrap_Attributes.ODF_Style_Punctuation_Wrap_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Style_Punctuation_Wrap_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Style_Punctuation_Wrap_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Style.Punctuation_Wrap_Attributes;
|
AdaCore/libadalang | Ada | 449 | adb | procedure AccessConst is
type P_ACCESS_CONSTANT is access constant Integer;
Var : P_ACCESS_CONSTANT := new Integer'(1);
--% node.p_is_constant_object
Const_Var_All : Integer renames Var.all;
--% node.p_is_constant_object
type P_ACCESS is access Integer;
Vbr : P_ACCESS := new Integer'(1);
--% node.p_is_constant_object
Vbr_All : Integer renames Vbr.all;
--% node.p_is_constant_object
begin
null;
end AccessConst;
|
msrLi/portingSources | Ada | 760 | ads | -- Copyright 2013-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
I : Integer := 1;
end Pck;
|
Rodeo-McCabe/orka | Ada | 1,879 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2019 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.Text_IO;
with Orka.Loggers.Formatting;
package body Orka.Loggers.Terminal is
protected type Logger_Object (Min_Level : Severity) is new Orka.Loggers.Logger with
overriding
procedure Log
(From : Source;
Kind : Message_Type;
Level : Severity;
ID : Natural;
Message : String);
end Logger_Object;
protected body Logger_Object is
procedure Log
(From : Source;
Kind : Message_Type;
Level : Severity;
ID : Natural;
Message : String)
is
package IO renames Ada.Text_IO;
begin
if Level <= Min_Level then
IO.Put_Line ((if Level = Error then IO.Standard_Error else IO.Standard_Output),
Formatting.Format_Message (From, Kind, Level, ID, Message));
end if;
end Log;
end Logger_Object;
Default_Logger : aliased Logger_Object (Min_Level => Debug);
function Logger return Logger_Ptr is (Default_Logger'Access);
function Create_Logger (Level : Severity := Debug) return Logger_Ptr is
begin
return new Logger_Object (Min_Level => Level);
end Create_Logger;
end Orka.Loggers.Terminal;
|
reznikmm/matreshka | Ada | 3,654 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Elements.Generic_Hash;
function AMF.Standard_Profile_L2.Executables.Hash is
new AMF.Elements.Generic_Hash (Standard_Profile_L2_Executable, Standard_Profile_L2_Executable_Access);
|
zhmu/ananas | Ada | 7,165 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E R R U T I L --
-- --
-- S p e c --
-- --
-- Copyright (C) 2002-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. 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. --
-- --
------------------------------------------------------------------------------
-- This package contains routines to output error messages and the
-- corresponding instantiation of Styleg, suitable to instantiate Scng.
-- It uses the same global variables as Errout, located in packages Atree and
-- Err_Vars. Like Errout, it also uses the common variables and routines
-- in package Erroutc.
-- This package is used by the preprocessor (gprep.adb).
with Styleg;
with Types; use Types;
package Errutil is
---------------------------------------------------------
-- Error Message Text and Message Insertion Characters --
---------------------------------------------------------
-- Error message text strings are composed of lower case letters, digits
-- and the special characters space, comma, period, colon and semicolon,
-- apostrophe and parentheses. Special insertion characters can also
-- appear which cause the error message circuit to modify the given
-- string. For a full list of these, see the spec of errout.
-----------------------------------------------------
-- Format of Messages and Manual Quotation Control --
-----------------------------------------------------
-- Messages are generally all in lower case, except for inserted names
-- and appear in one of the following two forms:
-- error: text
-- warning: text
-- The prefixes error and warning are supplied automatically (depending
-- on the use of the ? insertion character), and the call to the error
-- message routine supplies the text. The "error: " prefix is omitted
-- in brief error message formats.
-- Reserved keywords in the message are in the default keyword case
-- (determined from the given source program), surrounded by quotation
-- marks. This is achieved by spelling the reserved word in upper case
-- letters, which is recognized as a request for insertion of quotation
-- marks by the error text processor. Thus for example:
-- Error_Msg_AP ("IS expected");
-- would result in the output of one of the following:
-- error: "is" expected
-- error: "IS" expected
-- error: "Is" expected
-- the choice between these being made by looking at the casing convention
-- used for keywords (actually the first compilation unit keyword) in the
-- source file.
-- In the case of names, the default mode for the error text processor
-- is to surround the name by quotation marks automatically. The case
-- used for the identifier names is taken from the source program where
-- possible, and otherwise is the default casing convention taken from
-- the source file usage.
-- In some cases, better control over the placement of quote marks is
-- required. This is achieved using manual quotation mode. In this mode,
-- one or more insertion sequences is surrounded by backquote characters.
-- The backquote characters are output as double quote marks, and normal
-- automatic insertion of quotes is suppressed between the double quotes.
-- For example:
-- Error_Msg_AP ("`END &;` expected");
-- generates a message like
-- error: "end Open_Scope;" expected
-- where the node specifying the name Open_Scope has been stored in
-- Error_Msg_Node_1 prior to the call. The great majority of error
-- messages operates in normal quotation mode.
-- Note: the normal automatic insertion of spaces before insertion
-- sequences (such as those that come from & and %) is suppressed in
-- manual quotation mode, so blanks, if needed as in the above example,
-- must be explicitly present.
------------------------------
-- Error Output Subprograms --
------------------------------
procedure Initialize;
-- Initializes for output of error messages. Must be called for each
-- file before using any of the other routines in the package.
procedure Finalize (Source_Type : String := "project");
-- Finalize processing of error messages for one file and output message
-- indicating the number of detected errors.
-- Source_Type is used in verbose mode to indicate the type of the source
-- being parsed (project file, definition file or input file for the
-- preprocessor).
procedure Error_Msg (Msg : String; Flag_Location : Source_Ptr);
-- Output a message at specified location
procedure Error_Msg_S (Msg : String);
-- Output a message at current scan pointer location
procedure Error_Msg_SC (Msg : String);
-- Output a message at the start of the current token, unless we are at
-- the end of file, in which case we always output the message after the
-- last real token in the file.
procedure Error_Msg_SP (Msg : String);
-- Output a message at the start of the previous token
procedure Set_Ignore_Errors (To : Boolean);
-- Indicate, when To = True, that all reported errors should
-- be ignored. By default reported errors are not ignored.
package Style is new Styleg
(Error_Msg => Error_Msg,
Error_Msg_S => Error_Msg_S,
Error_Msg_SC => Error_Msg_SC,
Error_Msg_SP => Error_Msg_SP);
-- Instantiation of the generic style package, suitable for an
-- instantiation of Scng.
end Errutil;
|
leo-brewin/adm-bssn-numerical | Ada | 12,190 | adb | with Support.Clock; use Support.Clock;
with Support.CmdLine; use Support.CmdLine;
with Support.Strings; use Support.Strings;
with ADMBase.Coords; use ADMBase.Coords;
with ADMBase.Constraints; use ADMBase.Constraints;
-- for creation of directories if needed
with Ada.Directories;
package body ADMBase.Text_IO is
data_directory : String := read_command_arg ('D',"data/");
results_directory : String := read_command_arg ('O',"results/");
-- returns 'xx', 'xy' etc. these are the values of type symmetric
-- used when printing indices of symmetric matrices
function str (source : in symmetric) return string is
begin
return lower_case (source'Image);
end str;
procedure write_results (sample_index_list : GridIndexList;
sample_index_num : Integer;
file_name : String)
is
num_data_max : constant := 15;
txt : File_Type;
num_dimen : constant := 3;
num_rows : Integer;
num_cols : Integer;
num_vars : Integer;
the_date : String := get_date;
ijk : Array (1 .. 3) of Integer;
ijk_max : Array (1 .. 3) of Integer;
ijk_min : Array (1 .. 3) of Integer;
xyz : Array (1 .. 3) of Real;
xyz_max : Array (1 .. 3) of Real;
xyz_min : Array (1 .. 3) of Real;
data : Array (1 .. num_data_max) of Real;
data_max : Array (1 .. num_data_max) of Real;
data_min : Array (1 .. num_data_max) of Real;
procedure check_NaN (a : Integer) is
begin
if data (a) /= data (a) then
raise Data_Error with "NaN detected in data ("&str(a,0)&") "&
"at (x,y,z) = ("&
str(xyz(1))&","&
str(xyz(2))&","&
str(xyz(3))&")";
end if;
end check_NaN;
procedure get_data (a : Integer)
is
point : GridPoint;
i, j, k : Integer;
x, y, z : Real;
begin
point := grid_point_list (sample_index_list (a));
i := point.i;
j := point.j;
k := point.k;
x := point.x;
y := point.y;
z := point.z;
-- save selected data
ijk := (i, j, k);
xyz := (x, y, z);
data ( 1) := gab (i,j,k)(xx);
data ( 2) := gab (i,j,k)(yy);
data ( 3) := gab (i,j,k)(zz);
data ( 4) := Kab (i,j,k)(xx);
data ( 5) := Kab (i,j,k)(yy);
data ( 6) := Kab (i,j,k)(zz);
data ( 7) := Ham (i,j,k);
data ( 8) := Mom (i,j,k)(1);
data ( 9) := Mom (i,j,k)(2);
data (10) := Mom (i,j,k)(3);
num_vars := 10; -- number of phyical data in each row
end get_data;
begin
if sample_index_num = 0 then
return;
end if;
-- First pass : get min/max for the data -----------------------------------
ijk_max := (others => -666666);
ijk_min := (others => +666666);
xyz_max := (others => -666.6e66);
xyz_min := (others => +666.6e66);
data_max := (others => -666.6e66);
data_min := (others => +666.6e66);
for a in 1 .. sample_index_num loop
get_data (a);
for b in 1 .. num_vars loop
check_NaN (b);
end loop;
for b in 1 .. 3 loop
ijk_max (b) := max ( ijk_max (b), ijk (b) );
ijk_min (b) := min ( ijk_min (b), ijk (b) );
end loop;
for b in 1 .. 3 loop
xyz_max (b) := max ( xyz_max (b), xyz (b) );
xyz_min (b) := min ( xyz_min (b), xyz (b) );
end loop;
for b in 1 .. num_vars loop
data_max (b) := max ( data_max (b), data (b) );
data_min (b) := min ( data_min (b), data (b) );
end loop;
end loop;
-- Second pass : save the data ---------------------------------------------
Create (txt, Out_File, cut(file_name));
Put_Line (txt, "# 7 more lines before the data");
-- dimensions of the grid, number of vars, time & date
num_cols := 3 + 3 + num_vars; -- number of columns in body of data
num_rows := sample_index_num; -- number of rows in body of data
Put_Line (txt, "# " & str (num_rows, 0) & " rows of data");
Put_Line (txt, "# " & str (num_cols, 0) & " columns of data");
Put_Line (txt, "# " & str (the_time, 15) & " cauchy time");
Put_Line (txt, "# " & (the_date) & " today's date");
-- max and min values for each variable
Put (txt,"# ");
for i in 1 .. 3 loop
Put (txt, str(ijk_max(i),3) & spc (1));
end loop;
for i in 1 .. 3 loop
Put (txt, str(xyz_max(i),10) & spc (1));
end loop;
for i in 1 .. num_vars loop
Put (txt, str(data_max(i),15) & spc (1));
end loop;
Put_Line (txt," : max");
Put (txt,"# ");
for i in 1 .. 3 loop
Put (txt, str(ijk_min(i),3) & spc (1));
end loop;
for i in 1 .. 3 loop
Put (txt, str(xyz_min(i),10) & spc (1));
end loop;
for i in 1 .. num_vars loop
Put (txt, str(data_min(i),15) & spc (1));
end loop;
Put_Line (txt," : min");
-- the data names
Put (txt,"# ");
Put (txt, centre ("i",4,1));
Put (txt, centre ("j",4,1));
Put (txt, centre ("k",4,1));
Put (txt, centre ("x",11));
Put (txt, centre ("y",11));
Put (txt, centre ("z",11));
Put (txt, centre ("gxx",16));
Put (txt, centre ("gyy",16));
Put (txt, centre ("gzz",16));
Put (txt, centre ("Kxx",16));
Put (txt, centre ("Kyy",16));
Put (txt, centre ("Kzz",16));
Put (txt, centre ("Ham",16));
Put (txt, centre ("Mom(x)",16));
Put (txt, centre ("Mom(y)",16));
Put (txt, centre ("Mom(z)",16));
New_Line (txt);
-- the data on the grid
for a in 1 .. num_rows loop
get_data (a);
Put (txt, spc (2));
for b in 1 .. 3 loop
Put (txt, str (ijk (b), 3) & spc (1));
end loop;
for b in 1 .. 3 loop
Put (txt, str (xyz (b), 10) & spc (1));
end loop;
for b in 1 .. num_vars loop
Put (txt, str (data (b), 15) & spc (1));
end loop;
New_Line (txt);
end loop;
Close (txt);
end write_results;
procedure write_results is
num_loop_str : String := fill_str (num_loop, 5, '0');
begin
set_constraints;
Ada.Directories.create_path (results_directory & "/xy/");
Ada.Directories.create_path (results_directory & "/xz/");
Ada.Directories.create_path (results_directory & "/yz/");
write_results (xy_index_list, xy_index_num, results_directory & "/xy/" & num_loop_str & ".txt");
write_results (xz_index_list, xz_index_num, results_directory & "/xz/" & num_loop_str & ".txt");
write_results (yz_index_list, yz_index_num, results_directory & "/yz/" & num_loop_str & ".txt");
end write_results;
procedure write_history (point : GridPoint;
file_name : String)
is
txt : File_Type;
i, j, k : Integer;
x, y, z : Real;
begin
i := sample_point.i;
j := sample_point.j;
k := sample_point.k;
x := sample_point.x;
y := sample_point.y;
z := sample_point.z;
begin
Open (txt, Append_File, file_name);
exception when Name_Error =>
Create (txt, Out_File, file_name);
Put_Line (txt, "# 4 more lines before the data");
Put_Line (txt, "# 11 columns of data");
Put_Line (txt,"# (" & str (i,0) & ", " &
str (j,0) & ", " &
str (k,0) & ") = grid indices of target");
Put_Line (txt,"# (" & str (x,10) & ", " &
str (y,10) & ", " &
str (z,10) & ") = grid coords of target");
Put_Line (txt, "# " &
centre ("Time",10) &
centre ("gxx",11) &
centre ("gyy",11) &
centre ("gzz",11) &
centre ("Kxx",11) &
centre ("Kyy",11) &
centre ("Kzz",11) &
centre ("Ham",11) &
centre ("Mom(x)",11) &
centre ("Mom(y)",11) &
centre ("Mom(z)",11));
end;
-- ADM data
Put (txt, spc (1) & str (the_time));
Put (txt, spc (1) & str (gab (i,j,k)(xx)));
Put (txt, spc (1) & str (gab (i,j,k)(yy)));
Put (txt, spc (1) & str (gab (i,j,k)(zz)));
Put (txt, spc (1) & str (Kab (i,j,k)(xx)));
Put (txt, spc (1) & str (Kab (i,j,k)(yy)));
Put (txt, spc (1) & str (Kab (i,j,k)(zz)));
Put (txt, spc (1) & str (Ham (i,j,k)));
Put (txt, spc (1) & str (Mom (i,j,k)(1)));
Put (txt, spc (1) & str (Mom (i,j,k)(2)));
Put (txt, spc (1) & str (Mom (i,j,k)(3)));
New_Line (txt);
Close (txt);
end write_history;
procedure write_history is
begin
write_history (sample_point,results_directory & "/history.txt");
end write_history;
procedure write_summary is
i, j, k : Integer;
begin
i := sample_point.i;
j := sample_point.j;
k := sample_point.k;
set_constraints;
Put (spc(1) & str(num_loop,4));
Put (spc(1) & str(the_time,10));
Put (spc(1) & str(time_step,10));
Put (spc(1) & str(gab (i,j,k)(xx),10));
Put (spc(1) & str(gab (i,j,k)(zz),10));
Put (spc(1) & str(Kab (i,j,k)(xx),10));
Put (spc(1) & str(Kab (i,j,k)(zz),10));
Put (spc(1) & str(Ham (i,j,k),10));
New_Line;
end write_summary;
summary_dashes : String (1..83) := (others => '-');
procedure write_summary_header is
begin
Put_Line (summary_dashes);
Put (" ");
Put (centre("loop",5));
Put (centre("time",11));
Put (centre("step",11));
Put (centre("gxx",11));
Put (centre("gzz",11));
Put (centre("Kxx",11));
Put (centre("Kzz",11));
Put (centre("Ham.",11));
New_Line;
Put_Line (summary_dashes);
end write_summary_header;
procedure write_summary_trailer is
begin
Put_Line (summary_dashes);
end write_summary_trailer;
procedure create_text_io_lists is
a : Integer := 0;
num_xy : Integer := 0;
num_xz : Integer := 0;
num_yz : Integer := 0;
x, y, z : Real;
begin
a := 0;
num_xy := 0;
num_xz := 0;
num_yz := 0;
for i in 1 .. num_x loop
for j in 1 .. num_y loop
for k in 1 .. num_y loop
x := x_coord (i);
y := y_coord (j);
z := z_coord (k);
a := a + 1;
-- xy plane
if abs (z) < dz/2.0 then
num_xy := num_xy + 1;
xy_index_list (num_xy) := a;
end if;
-- xz plane
if abs (y) < dy/2.0 then
num_xz := num_xz + 1;
xz_index_list (num_xz) := a;
end if;
-- yz plane
if abs (x) < dx/2.0 then
num_yz := num_yz + 1;
yz_index_list (num_yz) := a;
end if;
-- the sample point = the origin, used in write_history
if abs (x) < dx/2.0 and
abs (y) < dy/2.0 and
abs (z) < dz/2.0 then
sample_point := (i,j,k,0.0,0.0,0.0);
end if;
end loop;
end loop;
end loop;
xy_index_num := num_xy;
xz_index_num := num_xz;
yz_index_num := num_yz;
end create_text_io_lists;
end ADMBase.Text_IO;
|
onox/orka | Ada | 9,891 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2023 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.Characters.Latin_1;
with Ada.Numerics;
with Orka.Rendering.Textures;
with Orka.Resources.Textures.KTX;
with Orka.Features.Terrain.Spheres;
with Orka.Transforms.Doubles.Matrices;
with Orka.Transforms.Doubles.Matrix_Conversions;
with Orka.Transforms.Doubles.Quaternions;
with Orka.Transforms.Doubles.Vectors;
with Orka.Transforms.Doubles.Vector_Conversions;
package body Orka.Features.Terrain.Helpers is
Count : constant := 6;
function Render_Modules (Object : Terrain_Planet)
return Rendering.Programs.Modules.Module_Array
is (Object.Modules_Terrain_Render);
function Height_Map (Object : Terrain_Planet) return GL.Objects.Textures.Texture is
(Object.DMap);
function Slope_Map (Object : Terrain_Planet) return GL.Objects.Textures.Texture is
(Object.SMap);
function Create_Terrain_Planet
(Data : aliased Orka.Features.Atmosphere.Model_Data;
Parameters : Features.Atmosphere.Rendering.Model_Parameters;
Atmosphere : Orka.Features.Atmosphere.Cache.Cached_Atmosphere;
Location_Data : Orka.Resources.Locations.Location_Ptr;
Location_Shaders : Orka.Resources.Locations.Location_Ptr) return Terrain_Planet
is
use Orka.Rendering.Buffers;
Planet_Radius : constant Orka.Float_64 :=
Parameters.Semi_Major_Axis / Data.Length_Unit_In_Meters;
Terrain_Sphere_Side : constant Orka.Features.Terrain.Spheroid_Parameters :=
Orka.Features.Terrain.Get_Spheroid_Parameters
(Orka.Float_32 (Planet_Radius),
Orka.Float_32 (Parameters.Flattening), True);
Terrain_Sphere_Top : constant Orka.Features.Terrain.Spheroid_Parameters :=
Orka.Features.Terrain.Get_Spheroid_Parameters
(Orka.Float_32 (Planet_Radius),
Orka.Float_32 (Parameters.Flattening), False);
Terrain_Spheres : constant Orka.Float_32_Array :=
Terrain_Sphere_Side &
Terrain_Sphere_Side &
Terrain_Sphere_Side &
Terrain_Sphere_Side &
Terrain_Sphere_Top &
Terrain_Sphere_Top;
-------------------------------------------------------------------------
package MC renames Orka.Transforms.Doubles.Matrix_Conversions;
package Quaternions renames Orka.Transforms.Doubles.Quaternions;
Q_Rotate_90 : constant Quaternions.Quaternion :=
Quaternions.R (Orka.Transforms.Doubles.Vectors.Normalize ((0.0, 0.0, 1.0, 0.0)),
-2.0 * Ada.Numerics.Pi * 0.25);
Q_Rotate_180 : constant Quaternions.Quaternion :=
Quaternions.R (Orka.Transforms.Doubles.Vectors.Normalize ((0.0, 0.0, 1.0, 0.0)),
-2.0 * Ada.Numerics.Pi * 0.50);
Q_Rotate_270 : constant Quaternions.Quaternion :=
Quaternions.R (Orka.Transforms.Doubles.Vectors.Normalize ((0.0, 0.0, 1.0, 0.0)),
-2.0 * Ada.Numerics.Pi * 0.75);
Q_Rotate_90_Up : constant Quaternions.Quaternion :=
Quaternions.R (Orka.Transforms.Doubles.Vectors.Normalize ((0.0, 1.0, 0.0, 0.0)),
2.0 * Ada.Numerics.Pi * 0.25);
Q_Rotate_90_Down : constant Quaternions.Quaternion :=
Quaternions.R (Orka.Transforms.Doubles.Vectors.Normalize ((0.0, 1.0, 0.0, 0.0)),
-2.0 * Ada.Numerics.Pi * 0.25);
package Matrices renames Orka.Transforms.Doubles.Matrices;
package Transforms renames Orka.Cameras.Transforms;
Rotate_90 : constant Transforms.Matrix4 :=
MC.Convert (Matrices.R (Matrices.Vector4 (Q_Rotate_90)));
Rotate_180 : constant Transforms.Matrix4 :=
MC.Convert (Matrices.R (Matrices.Vector4 (Q_Rotate_180)));
Rotate_270 : constant Transforms.Matrix4 :=
MC.Convert (Matrices.R (Matrices.Vector4 (Q_Rotate_270)));
Rotate_90_Up : constant Transforms.Matrix4 :=
MC.Convert (Matrices.R (Matrices.Vector4 (Q_Rotate_90_Up)));
Rotate_90_Down : constant Transforms.Matrix4 :=
MC.Convert (Matrices.R (Matrices.Vector4 (Q_Rotate_90_Down)));
-------------------------------------------------------------------------
DMap : constant GL.Objects.Textures.Texture :=
Orka.Resources.Textures.KTX.Read_Texture (Location_Data, "terrain/texture4k-dmap.ktx");
SMap : constant GL.Objects.Textures.Texture :=
Orka.Resources.Textures.KTX.Read_Texture (Location_Data, "terrain/texture4k-smap.ktx");
-- FIXME Should be separate textures for each tile
Terrain_GLSL : constant String
:= Orka.Resources.Convert (Orka.Resources.Byte_Array'(Location_Data.Read_Data
("terrain/terrain-render-atmosphere.frag").Get));
use Ada.Characters.Latin_1;
use Orka.Rendering.Programs;
use Orka.Features.Atmosphere;
Terrain_FS_Shader : constant String :=
"#version 420" & LF &
"#extension GL_ARB_shader_storage_buffer_object : require" & LF &
(if Data.Luminance /= Orka.Features.Atmosphere.None then
"#define USE_LUMINANCE" & LF
else "") &
"const float kLengthUnitInMeters = " &
Data.Length_Unit_In_Meters'Image & ";" & LF &
Terrain_GLSL & LF;
Modules_Terrain_Render : constant Modules.Module_Array := Modules.Module_Array'
(Atmosphere.Shader_Module,
Modules.Create_Module_From_Sources (FS => Terrain_FS_Shader));
begin
return
(Terrain_Transforms =>
Create_Buffer
((Dynamic_Storage => True, others => False), Orka.Types.Single_Matrix_Type,
Length => Count),
Terrain_Sphere_Params =>
Create_Buffer ((others => False), Terrain_Spheres),
Terrain_Spheroid_Parameters => Terrain_Sphere_Side,
Rotate_90 => Rotate_90,
Rotate_180 => Rotate_180,
Rotate_270 => Rotate_270,
Rotate_90_Up => Rotate_90_Up,
Rotate_90_Down => Rotate_90_Down,
Planet_Radius => Planet_Radius,
Planet_Unit_Length => Data.Length_Unit_In_Meters,
Modules_Terrain_Render => Modules_Terrain_Render,
DMap => DMap,
SMap => SMap);
end Create_Terrain_Planet;
procedure Render
(Object : in out Terrain_Planet;
Terrain : in out Orka.Features.Terrain.Terrain;
Parameters : Orka.Features.Terrain.Subdivision_Parameters;
Visible_Tiles : out Natural;
Camera : Orka.Cameras.Camera_Ptr;
Planet, Star : Orka.Behaviors.Behavior_Ptr;
Rotation : Orka.Types.Singles.Matrix4;
Center : Orka.Cameras.Transforms.Matrix4;
Freeze : Boolean;
Wires : Boolean;
Timer_Update : in out Orka.Timers.Timer;
Timer_Render : in out Orka.Timers.Timer)
is
procedure Update_Atmosphere_Terrain
(Program : Orka.Rendering.Programs.Program)
is
use Orka.Transforms.Doubles.Vectors;
package VC renames Orka.Transforms.Doubles.Vector_Conversions;
CP : constant Orka.Types.Singles.Vector4 :=
VC.Convert (Camera.View_Position * (1.0 / Object.Planet_Unit_Length));
Binding_Texture_SMap : constant := 5;
begin
Program.Uniform ("camera_pos").Set_Vector (CP);
Program.Uniform ("earth_radius").Set_Single
(Orka.Float_32 (Object.Planet_Radius));
Program.Uniform ("sun_direction").Set_Vector
(Orka.Types.Singles.Vector4'(VC.Convert
(Normalize (Star.Position - Planet.Position))));
Orka.Rendering.Textures.Bind
(Object.SMap,
Orka.Rendering.Textures.Texture, Binding_Texture_SMap);
end Update_Atmosphere_Terrain;
use Orka.Cameras.Transforms;
Tile_Transforms : constant Orka.Types.Singles.Matrix4_Array :=
(1 => Rotation,
2 => Rotation * Object.Rotate_90,
3 => Rotation * Object.Rotate_180,
4 => Rotation * Object.Rotate_270,
5 => Rotation * Object.Rotate_90_Up,
6 => Rotation * Object.Rotate_90_Down);
Sphere_Visibilities : constant Orka.Float_32_Array :=
Orka.Features.Terrain.Spheres.Get_Sphere_Visibilities
(Object.Terrain_Spheroid_Parameters,
Tile_Transforms (1), Tile_Transforms (3), Center, Camera.View_Matrix);
Visible_Buffers : constant Orka.Features.Terrain.Visible_Tile_Array :=
Orka.Features.Terrain.Spheres.Get_Visible_Tiles (Sphere_Visibilities);
pragma Assert (Visible_Buffers'Length = Terrain.Count);
begin
Visible_Tiles := 0;
for Visible of Visible_Buffers loop
if Visible then
Visible_Tiles := Visible_Tiles + 1;
end if;
end loop;
Object.Terrain_Transforms.Set_Data (Tile_Transforms);
Terrain.Render
(Transforms => Object.Terrain_Transforms,
Spheres => Object.Terrain_Sphere_Params,
Center => Center,
Camera => Camera,
Parameters => Parameters,
Visible_Tiles => Visible_Buffers,
Update_Render => Update_Atmosphere_Terrain'Access,
Height_Map => Object.DMap,
Freeze => Freeze,
Wires => Wires,
Timer_Update => Timer_Update,
Timer_Render => Timer_Render);
end Render;
end Orka.Features.Terrain.Helpers;
|
reznikmm/matreshka | Ada | 3,977 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Draw_Z_Index_Attributes;
package Matreshka.ODF_Draw.Z_Index_Attributes is
type Draw_Z_Index_Attribute_Node is
new Matreshka.ODF_Draw.Abstract_Draw_Attribute_Node
and ODF.DOM.Draw_Z_Index_Attributes.ODF_Draw_Z_Index_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Draw_Z_Index_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Draw_Z_Index_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Draw.Z_Index_Attributes;
|
reznikmm/matreshka | Ada | 7,525 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- Definition of data structures of FastCGI protocol.
------------------------------------------------------------------------------
with Ada.Streams;
package Matreshka.FastCGI.Protocol is
pragma Preelaborate;
type FCGI_Version is mod 2 ** 8;
Supported_FCGI_Version : constant FCGI_Version := 1;
type FCGI_Packet_Type is mod 2 ** 8;
FCGI_Begin_Request : constant FCGI_Packet_Type := 1;
FCGI_Abort_Request : constant FCGI_Packet_Type := 2;
FCGI_End_Request : constant FCGI_Packet_Type := 3;
FCGI_Params : constant FCGI_Packet_Type := 4;
FCGI_Stdin : constant FCGI_Packet_Type := 5;
FCGI_Stdout : constant FCGI_Packet_Type := 6;
FCGI_Stderr : constant FCGI_Packet_Type := 7;
FCGI_Data : constant FCGI_Packet_Type := 8;
FCGI_Get_Values : constant FCGI_Packet_Type := 9;
FCGI_Get_Values_Result : constant FCGI_Packet_Type := 10;
FCGI_Unknown_Type : constant FCGI_Packet_Type := 11;
subtype FCGI_Content_Length is Ada.Streams.Stream_Element_Offset
range 0 .. 65_535;
subtype FCGI_Padding_Length is Ada.Streams.Stream_Element_Offset
range 0 .. 65_535;
type FCGI_Role is mod 2 ** 16;
FCGI_Responder : constant FCGI_Role := 1;
FCGI_Authorizer : constant FCGI_Role := 2;
FCGI_Filter : constant FCGI_Role := 3;
type FCGI_Flags is record
FCGI_Keep_Conn : Boolean;
Reserved_1 : Boolean;
Reserved_2 : Boolean;
Reserved_3 : Boolean;
Reserved_4 : Boolean;
Reserved_5 : Boolean;
Reserved_6 : Boolean;
Reserved_7 : Boolean;
end record;
pragma Pack (FCGI_Flags);
for FCGI_Flags'Size use 8;
-----------------
-- FCGI_Header --
-----------------
type FCGI_Header is private;
subtype Raw_FCGI_Header is Ada.Streams.Stream_Element_Array (0 .. 7);
function Get_Version (Header : FCGI_Header) return FCGI_Version;
pragma Inline (Get_Version);
function Get_Packet_Type (Header : FCGI_Header) return FCGI_Packet_Type;
pragma Inline (Get_Packet_Type);
function Get_Request_Id
(Header : FCGI_Header) return FCGI_Request_Identifier;
pragma Inline (Get_Request_Id);
function Get_Content_Length
(Header : FCGI_Header) return FCGI_Content_Length;
pragma Inline (Get_Content_Length);
function Get_Padding_Length
(Header : FCGI_Header) return FCGI_Padding_Length;
pragma Inline (Get_Padding_Length);
procedure Initialize
(Header : out FCGI_Header;
Packet_Type : FCGI_Packet_Type;
Request_Id : FCGI_Request_Identifier;
Content_Length : FCGI_Content_Length;
Padding_Length : FCGI_Padding_Length);
-------------------------------
-- FCGI_Begin_Request_Record --
-------------------------------
type FCGI_Begin_Request_Record is private;
subtype Raw_FCGI_Begin_Request_Record
is Ada.Streams.Stream_Element_Array (0 .. 7);
function Get_Role (Item : FCGI_Begin_Request_Record) return FCGI_Role;
pragma Inline (Get_Role);
function Get_Flags (Item : FCGI_Begin_Request_Record) return FCGI_Flags;
pragma Inline (Get_Flags);
private
type FCGI_Header is record
Version : Ada.Streams.Stream_Element;
Packet_Type : Ada.Streams.Stream_Element;
Request_Id_Byte_1 : Ada.Streams.Stream_Element;
Request_Id_Byte_0 : Ada.Streams.Stream_Element;
Content_Length_Byte_1 : Ada.Streams.Stream_Element;
Content_Length_Byte_0 : Ada.Streams.Stream_Element;
Padding_Length : Ada.Streams.Stream_Element;
Reserved : Ada.Streams.Stream_Element;
end record;
type FCGI_Begin_Request_Record is record
Role_Byte_1 : Ada.Streams.Stream_Element;
Role_Byte_0 : Ada.Streams.Stream_Element;
Flags : Ada.Streams.Stream_Element;
Reserved_1 : Ada.Streams.Stream_Element;
Reserved_2 : Ada.Streams.Stream_Element;
Reserved_3 : Ada.Streams.Stream_Element;
Reserved_4 : Ada.Streams.Stream_Element;
Reserved_5 : Ada.Streams.Stream_Element;
end record;
end Matreshka.FastCGI.Protocol;
|
reznikmm/matreshka | Ada | 40 | ads | package IRC is
pragma Pure;
end IRC;
|
oxidecomputer/openapi-generator | Ada | 4,800 | ads | -- OpenAPI Petstore
-- This is a sample server Petstore server. For this sample, you can use the api key `special_key` to test the authorization filters.
--
-- The version of the OpenAPI document: 1.0.0
--
--
-- NOTE: This package is auto generated by OpenAPI-Generator 5.0.0-SNAPSHOT.
-- https://openapi-generator.tech
-- Do not edit the class manually.
with Samples.Petstore.Models;
with Swagger.Clients;
package Samples.Petstore.Clients is
type Client_Type is new Swagger.Clients.Client_Type with null record;
-- Add a new pet to the store
procedure Add_Pet
(Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.Pet_Type);
-- Deletes a pet
procedure Delete_Pet
(Client : in out Client_Type;
Pet_Id : in Swagger.Long;
Api_Key : in Swagger.Nullable_UString);
-- Finds Pets by status
-- Multiple status values can be provided with comma separated strings
procedure Find_Pets_By_Status
(Client : in out Client_Type;
Status : in Swagger.UString_Vectors.Vector;
Result : out Samples.Petstore.Models.Pet_Type_Vectors.Vector);
-- Finds Pets by tags
-- Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
procedure Find_Pets_By_Tags
(Client : in out Client_Type;
Tags : in Swagger.UString_Vectors.Vector;
Result : out Samples.Petstore.Models.Pet_Type_Vectors.Vector);
-- Find pet by ID
-- Returns a single pet
procedure Get_Pet_By_Id
(Client : in out Client_Type;
Pet_Id : in Swagger.Long;
Result : out Samples.Petstore.Models.Pet_Type);
-- Update an existing pet
procedure Update_Pet
(Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.Pet_Type);
-- Updates a pet in the store with form data
procedure Update_Pet_With_Form
(Client : in out Client_Type;
Pet_Id : in Swagger.Long;
Name : in Swagger.Nullable_UString;
Status : in Swagger.Nullable_UString);
-- uploads an image
procedure Upload_File
(Client : in out Client_Type;
Pet_Id : in Swagger.Long;
Additional_Metadata : in Swagger.Nullable_UString;
File : in Swagger.File_Part_Type;
Result : out Samples.Petstore.Models.ApiResponse_Type);
-- Delete purchase order by ID
-- For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
procedure Delete_Order
(Client : in out Client_Type;
Order_Id : in Swagger.UString);
-- Returns pet inventories by status
-- Returns a map of status codes to quantities
procedure Get_Inventory
(Client : in out Client_Type;
Result : out Swagger.Integer_Map);
-- Find purchase order by ID
-- For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
procedure Get_Order_By_Id
(Client : in out Client_Type;
Order_Id : in Swagger.Long;
Result : out Samples.Petstore.Models.Order_Type);
-- Place an order for a pet
procedure Place_Order
(Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.Order_Type;
Result : out Samples.Petstore.Models.Order_Type);
-- Create user
-- This can only be done by the logged in user.
procedure Create_User
(Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.User_Type);
-- Creates list of users with given input array
procedure Create_Users_With_Array_Input
(Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.User_Type_Vectors.Vector);
-- Creates list of users with given input array
procedure Create_Users_With_List_Input
(Client : in out Client_Type;
P_Body : in Samples.Petstore.Models.User_Type_Vectors.Vector);
-- Delete user
-- This can only be done by the logged in user.
procedure Delete_User
(Client : in out Client_Type;
Username : in Swagger.UString);
-- Get user by user name
procedure Get_User_By_Name
(Client : in out Client_Type;
Username : in Swagger.UString;
Result : out Samples.Petstore.Models.User_Type);
-- Logs user into the system
procedure Login_User
(Client : in out Client_Type;
Username : in Swagger.UString;
Password : in Swagger.UString;
Result : out Swagger.UString);
-- Logs out current logged in user session
procedure Logout_User
(Client : in out Client_Type);
-- Updated user
-- This can only be done by the logged in user.
procedure Update_User
(Client : in out Client_Type;
Username : in Swagger.UString;
P_Body : in Samples.Petstore.Models.User_Type);
end Samples.Petstore.Clients;
|
reznikmm/matreshka | Ada | 4,625 | 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.Db_Keys_Elements;
package Matreshka.ODF_Db.Keys_Elements is
type Db_Keys_Element_Node is
new Matreshka.ODF_Db.Abstract_Db_Element_Node
and ODF.DOM.Db_Keys_Elements.ODF_Db_Keys
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Db_Keys_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Db_Keys_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Db_Keys_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 Db_Keys_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 Db_Keys_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_Db.Keys_Elements;
|
AdaCore/Ada_Drivers_Library | Ada | 8,924 | adb | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- This program demonstrates use of the LIS3DSH accelerometer and a timer to
-- drive the brightness of the LEDs.
-- Note that this demonstration program is specific to the STM32F4 Discovery
-- boards because it references the specific accelerometer used on (later
-- versions of) those boards and because it references the four user LEDs
-- on those boards. (The LIS3DSH accelerometer is used on board versions
-- designated by the number MB997C printed on the top of the board.)
--
-- The idea is that the person holding the board will "pitch" it up and down
-- and "roll" it left and right around the Z axis running through the center
-- of the chip. As the board is moved, the brightness of the four LEDs
-- surrounding the accelerometer will vary with the accelerations experienced
-- by the board. In particular, as the angles increase the LEDs corresponding
-- to those sides of the board will become brighter. The LEDs will thus become
-- brightest as the board is held with any one side down, pointing toward the
-- ground.
with Last_Chance_Handler; pragma Unreferenced (Last_Chance_Handler);
with HAL; use HAL;
with Ada.Real_Time; use Ada.Real_Time;
with STM32.Board; use STM32.Board;
with LIS3DSH; use LIS3DSH; -- on the F4 Disco board
with STM32.GPIO; use STM32.GPIO;
with STM32.Timers; use STM32.Timers;
with STM32.PWM; use STM32.PWM;
use STM32;
with Demo_PWM_Settings; use Demo_PWM_Settings;
procedure Demo_LIS3DSH_PWM is
Next_Release : Time := Clock;
Period : constant Time_Span := Milliseconds (100); -- arbitrary
function Brightness (Acceleration : Axis_Acceleration) return Percentage;
-- Computes the output for the PWM. The approach is to compute the
-- percentage of the given acceleration relative to a maximum acceleration
-- of 1 G.
procedure Drive_LEDs;
-- Sets the pulse width for the two axes read from the accelerometer so
-- that the brightness varies with the angle of the board.
procedure Initialize_PWM_Outputs;
-- Set up all the PWM output modulators tied to the LEDs
procedure Panic with No_Return;
-- indicate that there is a fatal problem (accelerometer not found)
-----------
-- Panic --
-----------
procedure Panic is
begin
loop
All_LEDs_On;
delay until Clock + Milliseconds (250);
All_LEDs_Off;
delay until Clock + Milliseconds (250);
end loop;
end Panic;
----------------
-- Brightness --
----------------
function Brightness (Acceleration : Axis_Acceleration) return Percentage is
Result : Percentage;
Bracketed_Value : Axis_Acceleration;
Max_1g : constant Axis_Acceleration := 1000;
-- The approximate reading from the accelerometer for 1g, in
-- milligravities, used because this demo is for a person holding the
-- board and rotating it, so at most approximately 1g will be seen on
-- any axis.
--
-- We bracket the value to the range -Max_1g .. Max_1g in order
-- to filter out any movement beyond that of simply "pitching" and
-- "rolling" around the Z axis running through the center of the chip.
-- A person could move the board beyond the parameters intended for this
-- demo simply by jerking the board laterally, for example.
begin
if Acceleration > 0 then
Bracketed_Value := Axis_Acceleration'Min (Acceleration, Max_1g);
else
Bracketed_Value := Axis_Acceleration'Max (Acceleration, -Max_1g);
end if;
Result := Percentage
((Float (abs (Bracketed_Value)) / Float (Max_1g)) * 100.0);
return Result;
end Brightness;
----------------
-- Drive_LEDs --
----------------
procedure Drive_LEDs is
Axes : Axes_Accelerations;
High_Threshold : constant Axis_Acceleration := 30; -- arbitrary
Low_Threshold : constant Axis_Acceleration := -30; -- arbitrary
Off : constant Percentage := 0;
begin
Accelerometer.Get_Accelerations (Axes);
if Axes.X < Low_Threshold then
Set_Duty_Cycle (PWM_Output_Green, Brightness (Axes.X));
else
Set_Duty_Cycle (PWM_Output_Green, Off);
end if;
if Axes.X > High_Threshold then
Set_Duty_Cycle (PWM_Output_Red, Brightness (Axes.X));
else
Set_Duty_Cycle (PWM_Output_Red, Off);
end if;
if Axes.Y > High_Threshold then
Set_Duty_Cycle (PWM_Output_Orange, Brightness (Axes.Y));
else
Set_Duty_Cycle (PWM_Output_Orange, Off);
end if;
if Axes.Y < Low_Threshold then
Set_Duty_Cycle (PWM_Output_Blue, Brightness (Axes.Y));
else
Set_Duty_Cycle (PWM_Output_Blue, Off);
end if;
end Drive_LEDs;
----------------------------
-- Initialize_PWM_Outputs --
----------------------------
procedure Initialize_PWM_Outputs is
begin
Configure_PWM_Timer (PWM_Output_Timer'Access, PWM_Frequency);
PWM_Output_Green.Attach_PWM_Channel
(Generator => PWM_Output_Timer'Access,
Channel => Channel_1,
Point => Green_LED,
PWM_AF => PWM_Output_AF);
PWM_Output_Orange.Attach_PWM_Channel
(Generator => PWM_Output_Timer'Access,
Channel => Channel_2,
Point => Orange_LED,
PWM_AF => PWM_Output_AF);
PWM_Output_Red.Attach_PWM_Channel
(Generator => PWM_Output_Timer'Access,
Channel => Channel_3,
Point => Red_LED,
PWM_AF => PWM_Output_AF);
PWM_Output_Blue.Attach_PWM_Channel
(Generator => PWM_Output_Timer'Access,
Channel => Channel_4,
Point => Blue_LED,
PWM_AF => PWM_Output_AF);
PWM_Output_Green.Enable_Output;
PWM_Output_Orange.Enable_Output;
PWM_Output_Red.Enable_Output;
PWM_Output_Blue.Enable_Output;
end Initialize_PWM_Outputs;
begin
Initialize_Accelerometer;
Accelerometer.Configure
(Output_DataRate => Data_Rate_100Hz,
Axes_Enable => XYZ_Enabled,
SPI_Wire => Serial_Interface_4Wire,
Self_Test => Self_Test_Normal,
Full_Scale => Fullscale_2g,
Filter_BW => Filter_800Hz);
if Accelerometer.Device_Id /= I_Am_LIS3DSH then
Panic;
end if;
Initialize_PWM_Outputs;
loop
Drive_LEDs;
Next_Release := Next_Release + Period;
delay until Next_Release;
end loop;
end Demo_LIS3DSH_PWM;
|
reznikmm/matreshka | Ada | 3,714 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Elements;
package ODF.DOM.Meta_Document_Statistic_Elements is
pragma Preelaborate;
type ODF_Meta_Document_Statistic is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Meta_Document_Statistic_Access is
access all ODF_Meta_Document_Statistic'Class
with Storage_Size => 0;
end ODF.DOM.Meta_Document_Statistic_Elements;
|
AdaCore/gpr | Ada | 3,518 | adb | with Ada.Exceptions;
with Ada.Text_IO;
with GPR2.Context;
with GPR2.Path_Name;
with GPR2.Project.Attribute;
with GPR2.Project.Attribute.Set;
with GPR2.Project.Registry;
with GPR2.Project.Registry.Attribute;
with GPR2.Project.Tree;
with GPR2.Project.View;
with GPR2.Log;
with GPR2.Source_Reference;
with GPR2.Source_Reference.Value;
procedure Main is
use GPR2;
procedure Test (Filename : GPR2.Filename_Type) is
Tree : GPR2.Project.Tree.Object;
Context : GPR2.Context.Object;
procedure Print_Attributes (Name : Q_Attribute_Id) is
Attributes : GPR2.Project.Attribute.Set.Object;
use GPR2;
Header : String := (if Name.Pack = Project_Level_Scope
then Image (Name.Attr)
else Image (Name.Pack) & "."
& Image (Name.Attr));
begin
Attributes := Tree.Root_Project.Attributes
(Name => Name,
With_Defaults => False,
With_Config => False);
for A of Attributes loop
declare
Attribute : GPR2.Project.Attribute.Object := A;
use GPR2.Project.Registry.Attribute;
begin
Ada.Text_IO.Put (Header);
if Attribute.Has_Index then
Ada.Text_IO.Put ( "(" & Attribute.Index.Text & ")");
end if;
Ada.Text_IO.Put ("=");
if Attribute.Kind = GPR2.Project.Registry.Attribute.Single then
Ada.Text_IO.Put ("""");
Ada.Text_IO.Put (String (Attribute.Value.Text));
Ada.Text_IO.Put ("""");
else
declare
Separator : Boolean := False;
Value : GPR2.Source_Reference.Value.Object;
begin
Ada.Text_IO.Put ("(");
for V of Attribute.Values loop
Value := V;
if Separator then
Ada.Text_IO.Put (",");
end if;
Separator := True;
Ada.Text_IO.Put ("""");
Ada.Text_IO.Put (String (Value.Text));
Ada.Text_IO.Put ("""");
end loop;
Ada.Text_IO.Put (")");
end;
end if;
Ada.Text_IO.Put_Line ("");
end;
end loop;
end Print_Attributes;
begin
begin
Ada.Text_IO.Put_Line (String (Filename));
Tree.Load_Autoconf
(Filename => GPR2.Path_Name.Create_File (Filename),
Context => Context);
exception
when E : others =>
Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Message (E));
end;
Print_Attributes ((+"", +"Runtime"));
Print_Attributes ((+"Compiler", +"Switches"));
if Tree.Has_Messages then
for C in Tree.Log_Messages.Iterate
(False, True, True, True, True)
loop
Ada.Text_IO.Put_Line (GPR2.Log.Element (C).Format);
end loop;
end if;
end Test;
begin
Test ("check1.gpr");
Test ("check2a.gpr");
Test ("check2b.gpr");
Test ("check2c.gpr");
Test ("check3a.gpr");
Test ("check3b.gpr");
Test ("check4a.gpr");
Test ("check4b.gpr");
Test ("check5a.gpr");
Test ("check5b.gpr");
Test ("check6.gpr");
end main;
|
optikos/oasis | Ada | 2,935 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Elements.Others_Choices;
with Program.Element_Visitors;
package Program.Nodes.Others_Choices is
pragma Preelaborate;
type Others_Choice is
new Program.Nodes.Node and Program.Elements.Others_Choices.Others_Choice
and Program.Elements.Others_Choices.Others_Choice_Text
with private;
function Create
(Others_Token : not null Program.Lexical_Elements.Lexical_Element_Access)
return Others_Choice;
type Implicit_Others_Choice is
new Program.Nodes.Node and Program.Elements.Others_Choices.Others_Choice
with private;
function Create
(Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Others_Choice
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Others_Choice is
abstract new Program.Nodes.Node
and Program.Elements.Others_Choices.Others_Choice
with null record;
procedure Initialize (Self : aliased in out Base_Others_Choice'Class);
overriding procedure Visit
(Self : not null access Base_Others_Choice;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Is_Others_Choice_Element
(Self : Base_Others_Choice)
return Boolean;
overriding function Is_Definition_Element
(Self : Base_Others_Choice)
return Boolean;
type Others_Choice is
new Base_Others_Choice
and Program.Elements.Others_Choices.Others_Choice_Text
with record
Others_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Others_Choice_Text
(Self : aliased in out Others_Choice)
return Program.Elements.Others_Choices.Others_Choice_Text_Access;
overriding function Others_Token
(Self : Others_Choice)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Others_Choice is
new Base_Others_Choice
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Others_Choice_Text
(Self : aliased in out Implicit_Others_Choice)
return Program.Elements.Others_Choices.Others_Choice_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Others_Choice)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Others_Choice)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Others_Choice)
return Boolean;
end Program.Nodes.Others_Choices;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 6,027 | ads | with STM32_SVD; use STM32_SVD;
with Drivers.Text_IO;
with HAL;
generic
with package Chip_Select is new HAL.Pin (<>);
with package IRQ is new HAL.Pin (<>);
with package SPI is new HAL.SPI (<>);
AES_Enabled : Boolean := False;
Frequency : Positive;
TX_PA_Boost : Boolean := False;
Channel : Byte := 0;
package Drivers.RFM69 is
type Register_Type is (
FIFO,
OPMODE,
DATAMODUL,
BITRATEMSB,
BITRATELSB,
FDEVMSB,
FDEVLSB,
FRFMSB,
FRFMID,
FRFLSB,
OSC1,
AFCCTRL,
LOWBAT,
LISTEN1,
LISTEN2,
LISTEN3,
VERSION,
PALEVEL,
PARAMP,
OCP,
AGCREF,
AGCTHRESH1,
AGCTHRESH2,
AGCTHRESH3,
LNA,
RXBW,
AFCBW,
OOKPEAK,
OOKAVG,
OOKFIX,
AFCFEI,
AFCMSB,
AFCLSB,
FEIMSB,
FEILSB,
RSSICONFIG,
RSSIVALUE,
DIOMAPPING1,
DIOMAPPING2,
IRQFLAGS1,
IRQFLAGS2,
RSSITHRESH,
RXTIMEOUT1,
RXTIMEOUT2,
PREAMBLEMSB,
PREAMBLELSB,
SYNCCONFIG,
SYNCVALUE1,
SYNCVALUE2,
SYNCVALUE3,
SYNCVALUE4,
SYNCVALUE5,
SYNCVALUE6,
SYNCVALUE7,
SYNCVALUE8,
PACKETCONFIG1,
PAYLOADLENGTH,
NODEADRS,
BROADCASTADRS,
AUTOMODES,
FIFOTHRESH,
PACKETCONFIG2,
AESKEY1,
AESKEY2,
AESKEY3,
AESKEY4,
AESKEY5,
AESKEY6,
AESKEY7,
AESKEY8,
AESKEY9,
AESKEY10,
AESKEY11,
AESKEY12,
AESKEY13,
AESKEY14,
AESKEY15,
AESKEY16,
TEMP1,
TEMP2,
TESTPA1,
TESTPA2,
TESTPIIBW);
for Register_Type use (
FIFO => 16#00#,
OPMODE => 16#01#,
DATAMODUL => 16#02#,
BITRATEMSB => 16#03#,
BITRATELSB => 16#04#,
FDEVMSB => 16#05#,
FDEVLSB => 16#06#,
FRFMSB => 16#07#,
FRFMID => 16#08#,
FRFLSB => 16#09#,
OSC1 => 16#0A#,
AFCCTRL => 16#0B#,
LOWBAT => 16#0C#,
LISTEN1 => 16#0D#,
LISTEN2 => 16#0E#,
LISTEN3 => 16#0F#,
VERSION => 16#10#,
PALEVEL => 16#11#,
PARAMP => 16#12#,
OCP => 16#13#,
AGCREF => 16#14#,
AGCTHRESH1 => 16#15#,
AGCTHRESH2 => 16#16#,
AGCTHRESH3 => 16#17#,
LNA => 16#18#,
RXBW => 16#19#,
AFCBW => 16#1A#,
OOKPEAK => 16#1B#,
OOKAVG => 16#1C#,
OOKFIX => 16#1D#,
AFCFEI => 16#1E#,
AFCMSB => 16#1F#,
AFCLSB => 16#20#,
FEIMSB => 16#21#,
FEILSB => 16#22#,
RSSICONFIG => 16#23#,
RSSIVALUE => 16#24#,
DIOMAPPING1 => 16#25#,
DIOMAPPING2 => 16#26#,
IRQFLAGS1 => 16#27#,
IRQFLAGS2 => 16#28#,
RSSITHRESH => 16#29#,
RXTIMEOUT1 => 16#2A#,
RXTIMEOUT2 => 16#2B#,
PREAMBLEMSB => 16#2C#,
PREAMBLELSB => 16#2D#,
SYNCCONFIG => 16#2E#,
SYNCVALUE1 => 16#2F#,
SYNCVALUE2 => 16#30#,
SYNCVALUE3 => 16#31#,
SYNCVALUE4 => 16#32#,
SYNCVALUE5 => 16#33#,
SYNCVALUE6 => 16#34#,
SYNCVALUE7 => 16#35#,
SYNCVALUE8 => 16#36#,
PACKETCONFIG1 => 16#37#,
PAYLOADLENGTH => 16#38#,
NODEADRS => 16#39#,
BROADCASTADRS => 16#3A#,
AUTOMODES => 16#3B#,
FIFOTHRESH => 16#3C#,
PACKETCONFIG2 => 16#3D#,
AESKEY1 => 16#3E#,
AESKEY2 => 16#3F#,
AESKEY3 => 16#40#,
AESKEY4 => 16#41#,
AESKEY5 => 16#42#,
AESKEY6 => 16#43#,
AESKEY7 => 16#44#,
AESKEY8 => 16#45#,
AESKEY9 => 16#46#,
AESKEY10 => 16#47#,
AESKEY11 => 16#48#,
AESKEY12 => 16#49#,
AESKEY13 => 16#4A#,
AESKEY14 => 16#4B#,
AESKEY15 => 16#4C#,
AESKEY16 => 16#4D#,
TEMP1 => 16#4E#,
TEMP2 => 16#4F#,
TESTPA1 => 16#5A#,
TESTPA2 => 16#5C#,
TESTPIIBW => 16#5F#);
type OPMODE_Mode_Type is (SLEEP, STDBY, FS, TX, RX) with Size => 3;
for OPMODE_Mode_Type use (
SLEEP => 2#000#,
STDBY => 2#001#,
FS => 2#010#,
TX => 2#011#,
RX => 2#100#);
subtype Address_Type is Byte;
type Sync_Word_Type is array (Byte range <>) of Byte
with Dynamic_Predicate => Sync_Word_Type'Length <= 8;
type Packet_Type is array (Byte range <>) of Byte;
type AES_Key_Type is array (Byte range 1 .. 16) of Byte;
type Raw_Register_Array is array (0 .. 16#4D#) of Byte;
subtype Output_Power_Range is Integer range -18 .. 17;
procedure Init;
procedure Set_Sync_Word (Sync_Word : Sync_Word_Type);
procedure Get_Sync_Word (Sync_Word : out Sync_Word_Type);
procedure Set_Frequency (Frequency : Positive);
procedure Set_Bitrate (Bitrate : Positive);
procedure Set_Broadcast_Address (Address : Address_Type);
procedure Set_RX_Address (Address : Address_Type);
procedure Set_TX_Address (Address : Address_Type);
procedure Set_Output_Power (Power : Output_Power_Range);
procedure TX_Mode;
procedure RX_Mode;
function Get_Mode return OPMODE_Mode_Type;
procedure TX (Packet: Packet_Type);
procedure TX (Packet: Packet_Type; Length: Byte);
function RX_Available return Boolean;
function RX_Available_Reg return Boolean;
function TX_Complete return Boolean;
function Wait_For_RX return Boolean;
procedure RX (Packet : out Packet_Type; Length : out Byte);
procedure Clear_IRQ;
procedure Power_Down;
procedure Cancel;
procedure Read_Registers (Registers : out Raw_Register_Array);
generic
with procedure Put_Line (Line: in string);
procedure Print_Registers;
end Drivers.RFM69;
|
shintakezou/drake | Ada | 18,819 | adb | with Ada.Containers.Array_Sorting;
with System.Long_Long_Integer_Types;
package body Ada.Containers.Generic_Array_Access_Types is
subtype Word_Integer is System.Long_Long_Integer_Types.Word_Integer;
-- implementation
function Length (Container : Array_Access) return Count_Type is
begin
if Container = null then
return 0;
else
return Container'Length;
end if;
end Length;
procedure Set_Length (
Container : in out Array_Access;
Length : Count_Type) is
begin
if Container = null then
if Length > 0 then
Container :=
new Array_Type (
Index_Type'First ..
Index_Type'First + Index_Type'Base (Length) - 1);
end if;
elsif Length = 0 then
Free (Container);
else
declare
Old_Length : constant Count_Type := Container'Length;
begin
if Length < Old_Length then
declare
S : Array_Access := Container;
begin
Container :=
new Array_Type'(
S (S'First .. S'First + Index_Type'Base (Length) - 1));
Free (S);
end;
elsif Length > Old_Length then
declare
S : Array_Access := Container;
begin
Container :=
new Array_Type (
S'First .. S'First + Index_Type'Base (Length) - 1);
Container (S'Range) := S.all;
Free (S);
end;
end if;
end;
end if;
end Set_Length;
procedure Assign (Target : in out Array_Access; Source : Array_Access) is
begin
if Target /= Source then
Free (Target);
if Source /= null and then Source'Length > 0 then
Target := new Array_Type'(Source.all);
end if;
end if;
end Assign;
procedure Move (
Target : in out Array_Access;
Source : in out Array_Access) is
begin
if Target /= Source then
Free (Target);
Target := Source;
Source := null;
end if;
end Move;
procedure Insert (
Container : in out Array_Access;
Before : Extended_Index;
New_Item : Array_Type)
is
pragma Check (Pre,
Check =>
Before in First_Index (Container) .. Last_Index (Container) + 1
or else raise Constraint_Error);
begin
if New_Item'Length > 0 then
if Container = null then
declare
subtype T is
Array_Type (Before .. Before + (New_Item'Length - 1));
begin
Container := new Array_Type'(T (New_Item));
end;
else
declare
New_Item_Length : constant Index_Type'Base := New_Item'Length;
Following : constant Index_Type := Before + New_Item_Length;
S : Array_Access := Container;
begin
Container :=
new Array_Type (S'First .. S'Last + New_Item_Length);
Container (S'First .. Before - 1) := S (S'First .. Before - 1);
Container (Before .. Following - 1) := New_Item;
Container (Following .. Container'Last) := S (Before .. S'Last);
Free (S);
end;
end if;
end if;
end Insert;
procedure Insert (
Container : in out Array_Access;
Before : Extended_Index;
New_Item : Array_Access)
is
pragma Check (Pre,
Check =>
Before in First_Index (Container) .. Last_Index (Container) + 1
or else raise Constraint_Error);
begin
if New_Item /= null then
Insert (Container, Before, New_Item.all);
end if;
end Insert;
procedure Insert (
Container : in out Array_Access;
Before : Extended_Index;
New_Item : Element_Type;
Count : Count_Type := 1) is
begin
Insert (
Container,
Before, -- checking Constraint_Error
Count);
for I in Before .. Before + Index_Type'Base (Count) - 1 loop
Container (I) := New_Item;
end loop;
end Insert;
procedure Insert (
Container : in out Array_Access;
Before : Extended_Index;
Count : Count_Type := 1)
is
pragma Check (Pre,
Check =>
Before in First_Index (Container) .. Last_Index (Container) + 1
or else raise Constraint_Error);
begin
if Count > 0 then
if Container = null then
Container :=
new Array_Type (Before .. Before + Index_Type'Base (Count) - 1);
else
declare
Following : constant Index_Type :=
Before + Index_Type'Base (Count);
S : Array_Access := Container;
begin
Container :=
new Array_Type (S'First .. S'Last + Index_Type'Base (Count));
Container (S'First .. Before - 1) := S (S'First .. Before - 1);
Container (Following .. Container'Last) := S (Before .. S'Last);
Free (S);
end;
end if;
end if;
end Insert;
procedure Prepend (
Container : in out Array_Access;
New_Item : Array_Type) is
begin
Insert (Container, First_Index (Container), New_Item);
end Prepend;
procedure Prepend (
Container : in out Array_Access;
New_Item : Array_Access) is
begin
Insert (Container, First_Index (Container), New_Item);
end Prepend;
procedure Prepend (
Container : in out Array_Access;
New_Item : Element_Type;
Count : Count_Type := 1) is
begin
Insert (Container, First_Index (Container), New_Item, Count);
end Prepend;
procedure Prepend (
Container : in out Array_Access;
Count : Count_Type := 1) is
begin
Insert (Container, First_Index (Container), Count);
end Prepend;
procedure Append (
Container : in out Array_Access;
New_Item : Array_Type) is
begin
Insert (Container, Last_Index (Container) + 1, New_Item);
end Append;
procedure Append (
Container : in out Array_Access;
New_Item : Array_Access) is
begin
Insert (Container, Last_Index (Container) + 1, New_Item);
end Append;
procedure Append (
Container : in out Array_Access;
New_Item : Element_Type;
Count : Count_Type := 1) is
begin
Insert (Container, Last_Index (Container) + 1, New_Item, Count);
end Append;
procedure Append (
Container : in out Array_Access;
Count : Count_Type := 1) is
begin
Insert (Container, Last_Index (Container) + 1, Count);
end Append;
procedure Delete (
Container : in out Array_Access;
Index : Extended_Index;
Count : Count_Type := 1)
is
pragma Check (Pre,
Check =>
(Index >= First_Index (Container)
and then Index + Index_Type'Base (Count) - 1 <=
Last_Index (Container))
or else raise Constraint_Error);
begin
if Count > 0 then
if Index = Container'First and then Count = Container'Length then
Free (Container);
else
declare
Following : constant Index_Type :=
Index + Index_Type'Base (Count);
S : Array_Access := Container;
begin
Container :=
new Array_Type (S'First .. S'Last - Index_Type'Base (Count));
Container (S'First .. Index - 1) := S (S'First .. Index - 1);
Container (Index .. Container'Last) := S (Following .. S'Last);
Free (S);
end;
end if;
end if;
end Delete;
procedure Delete_First (
Container : in out Array_Access;
Count : Count_Type := 1) is
begin
Delete (Container, Container'First, Count);
end Delete_First;
procedure Delete_Last (
Container : in out Array_Access;
Count : Count_Type := 1) is
begin
Delete (Container, Container'Last - Index_Type'Base (Count) + 1, Count);
end Delete_Last;
procedure Swap (Container : in out Array_Access; I, J : Index_Type) is
pragma Check (Pre,
Check =>
(I in First_Index (Container) .. Last_Index (Container)
and then J in First_Index (Container) .. Last_Index (Container))
or else raise Constraint_Error);
pragma Unmodified (Container);
begin
if I /= J then
declare
Temp : constant Element_Type := Container (I);
begin
Container.all (I) := Container (J);
Container.all (J) := Temp;
end;
end if;
end Swap;
function First_Index (Container : Array_Access) return Index_Type is
begin
if Container = null then
return Index_Type'First;
else
return Container'First;
end if;
end First_Index;
function Last_Index (Container : Array_Access) return Extended_Index is
begin
if Container = null then
return Index_Type'First - 1;
else
return Container'Last;
end if;
end Last_Index;
package body Generic_Reversing is
type Context_Type is limited record
Container : Array_Access;
end record;
pragma Suppress_Initialization (Context_Type);
procedure Swap (I, J : Word_Integer; Params : System.Address);
procedure Swap (I, J : Word_Integer; Params : System.Address) is
Context : Context_Type;
for Context'Address use Params;
begin
Swap (Context.Container, Index_Type'Val (I), Index_Type'Val (J));
end Swap;
-- implementation
procedure Reverse_Elements (Container : in out Array_Access) is
pragma Unmodified (Container);
Context : Context_Type :=
(Container => Container);
begin
if Container /= null then
Array_Sorting.In_Place_Reverse (
Index_Type'Pos (Container'First),
Index_Type'Pos (Container'Last),
Context'Address,
Swap => Swap'Access);
end if;
end Reverse_Elements;
procedure Reverse_Rotate_Elements (
Container : in out Array_Access;
Before : Extended_Index)
is
pragma Check (Pre,
Check =>
Before in First_Index (Container) .. Last_Index (Container) + 1
or else raise Constraint_Error);
pragma Unmodified (Container);
Context : Context_Type :=
(Container => Container);
begin
if Container /= null then
Array_Sorting.Reverse_Rotate (
Index_Type'Pos (Container'First),
Index_Type'Pos (Before),
Index_Type'Pos (Container'Last),
Context'Address,
Swap => Swap'Access);
end if;
end Reverse_Rotate_Elements;
procedure Juggling_Rotate_Elements (
Container : in out Array_Access;
Before : Extended_Index)
is
pragma Check (Pre,
Check =>
Before in First_Index (Container) .. Last_Index (Container) + 1
or else raise Constraint_Error);
pragma Unmodified (Container);
Context : Context_Type :=
(Container => Container);
begin
if Container /= null then
Array_Sorting.Juggling_Rotate (
Index_Type'Pos (Container'First),
Index_Type'Pos (Before),
Index_Type'Pos (Container'Last),
Context'Address,
Swap => Swap'Access);
end if;
end Juggling_Rotate_Elements;
end Generic_Reversing;
package body Generic_Sorting is
type Context_Type is limited record
Container : Array_Access;
end record;
pragma Suppress_Initialization (Context_Type);
function LT (Left, Right : Word_Integer; Params : System.Address)
return Boolean;
function LT (Left, Right : Word_Integer; Params : System.Address)
return Boolean
is
Context : Context_Type;
for Context'Address use Params;
begin
return Context.Container (Index_Type'Val (Left)) <
Context.Container (Index_Type'Val (Right));
end LT;
procedure Swap (I, J : Word_Integer; Params : System.Address);
procedure Swap (I, J : Word_Integer; Params : System.Address) is
Context : Context_Type;
for Context'Address use Params;
begin
Swap (Context.Container, Index_Type'Val (I), Index_Type'Val (J));
end Swap;
-- implementation
function Is_Sorted (Container : Array_Access) return Boolean is
Context : Context_Type :=
(Container => Container);
begin
return Container = null
or else Array_Sorting.Is_Sorted (
Index_Type'Pos (Container'First),
Index_Type'Pos (Container'Last),
Context'Address,
LT => LT'Access);
end Is_Sorted;
procedure Insertion_Sort (Container : in out Array_Access) is
pragma Unmodified (Container);
Context : Context_Type :=
(Container => Container);
begin
if Container /= null then
Array_Sorting.Insertion_Sort (
Index_Type'Pos (Container'First),
Index_Type'Pos (Container'Last),
Context'Address,
LT => LT'Access,
Swap => Swap'Access);
end if;
end Insertion_Sort;
procedure Merge_Sort (Container : in out Array_Access) is
pragma Unmodified (Container);
Context : Context_Type :=
(Container => Container);
begin
if Container /= null then
Array_Sorting.In_Place_Merge_Sort (
Index_Type'Pos (Container'First),
Index_Type'Pos (Container'Last),
Context'Address,
LT => LT'Access,
Swap => Swap'Access);
end if;
end Merge_Sort;
procedure Merge (
Target : in out Array_Access;
Source : in out Array_Access) is
begin
if Target = null then
Move (Target, Source);
else
declare
Before : constant Index_Type'Base := Target'Last + 1;
begin
Insert (Target, Before, Source);
Free (Source);
declare
Context : Context_Type := (Container => Target);
begin
Array_Sorting.In_Place_Merge (
Index_Type'Pos (Target'First),
Index_Type'Pos (Before),
Index_Type'Pos (Target'Last),
Context'Address,
LT => LT'Access,
Swap => Swap'Access);
end;
end;
end if;
end Merge;
end Generic_Sorting;
procedure Assign (Target : in out Array_Access; Source : New_Array) is
begin
Free (Target);
Target := Array_Access (Source);
end Assign;
package body Operators is
function Start (
Left : Array_Access;
Right : Element_Type;
Space : Count_Type)
return New_Array_1;
function Start (
Left : Array_Access;
Right : Element_Type;
Space : Count_Type)
return New_Array_1
is
Data : Array_Access;
Last : Extended_Index;
begin
if Left = null then
Data :=
new Array_Type (
Index_Type'First ..
Index_Type'First + Index_Type'Base (Space));
Last := Index_Type'First;
Data (Last) := Right;
else
Data :=
new Array_Type (
Left'First .. Left'Last + 1 + Index_Type'Base (Space));
Last := Left'Last + 1;
Data (Left'Range) := Left.all;
Data (Last) := Right;
end if;
return (Data => Data, Last => Last);
end Start;
function Step (
Left : New_Array_1;
Right : Element_Type;
Space : Count_Type)
return New_Array_1;
function Step (
Left : New_Array_1;
Right : Element_Type;
Space : Count_Type)
return New_Array_1
is
Data : Array_Access;
Last : Extended_Index;
begin
if Left.Last + 1 <= Left.Data'Last then
Data := Left.Data;
Last := Left.Last + 1;
Left.Data (Last) := Right;
else
Data := new Array_Type (
Left.Data'First .. Left.Last + 1 + Index_Type'Base (Space));
Last := Left.Last + 1;
Data (Left.Data'Range) := Left.Data.all;
Data (Last) := Right;
declare
Left_Data : Array_Access := Left.Data;
begin
Free (Left_Data);
end;
end if;
return (Data => Data, Last => Last);
end Step;
-- implementation
function "&" (Left : Array_Access; Right : Element_Type)
return New_Array is
begin
return New_Array (Start (Left, Right, Space => 0).Data);
end "&";
function "&" (Left : New_Array_1; Right : Element_Type)
return New_Array
is
Data : Array_Access := Left.Data;
begin
if Left.Last + 1 = Data'Last then
Data (Data'Last) := Right;
return New_Array (Data);
else
declare
Result : constant New_Array :=
new Array_Type (Data'First .. Data'Last + 1);
begin
Result (Data'Range) := Data.all;
Result (Data'Last + 1) := Right;
Free (Data);
return Result;
end;
end if;
end "&";
function "&" (Left : Array_Access; Right : Element_Type)
return New_Array_1 is
begin
return Start (Left, Right, Space => 1);
end "&";
function "&" (Left : New_Array_2; Right : Element_Type)
return New_Array_1 is
begin
return Step (New_Array_1 (Left), Right, Space => 1);
end "&";
function "&" (Left : Array_Access; Right : Element_Type)
return New_Array_2 is
begin
return New_Array_2 (Start (Left, Right, Space => 2));
end "&";
end Operators;
end Ada.Containers.Generic_Array_Access_Types;
|
ytomino/vampire | Ada | 226 | ads | -- The Village of Vampire by YT, このソースコードはNYSLです
with Ada.Calendar;
package Tabula.Debug is
procedure Hook (
Name : not null Static_String_Access;
Time : in Ada.Calendar.Time);
end Tabula.Debug;
|
AdaCore/Ada-IntelliJ | Ada | 1,240 | adb |
with AWS.Config.Set;
with AWS.Services.Dispatchers.URI;
with AWS.Server;
with @[email protected];
procedure @[email protected] is
use AWS;
Web_Server : Server.HTTP;
Web_Config : Config.Object;
Web_Dispatcher : Services.Dispatchers.URI.Handler;
Default_Dispatcher : Dispatchers.Default;
CSS_Dispatcher : Dispatchers.CSS;
Image_Dispatcher : Dispatchers.Image;
begin
-- Setup server
Config.Set.Server_Host (Web_Config, Host);
Config.Set.Server_Port (Web_Config, Port);
-- Setup dispatchers
Dispatchers.Initialize (Web_Config);
Services.Dispatchers.URI.Register
(Web_Dispatcher,
URI => "/css",
Action => CSS_Dispatcher,
Prefix => True);
Services.Dispatchers.URI.Register
(Web_Dispatcher,
URI => "/img",
Action => Image_Dispatcher,
Prefix => True);
Services.Dispatchers.URI.Register_Default_Callback
(Web_Dispatcher,
Action => Default_Dispatcher);
-- Start the server
Server.Start (Web_Server, Web_Dispatcher, Web_Config);
-- Wait for the Q key
Server.Wait (Server.Q_Key_Pressed);
-- Stop the server
Server.Shutdown (Web_Server);
end @[email protected];
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 1,063 | adb | with STM32_SVD; use STM32_SVD;
with STM32_SVD.SCB; use STM32_SVD.SCB;
with System.Machine_Code; use System.Machine_Code;
package body STM32GD is
procedure Wait_For_Interrupt is
begin
Asm ("WFI", Volatile => True);
end Wait_For_Interrupt;
procedure Clear_Event is
begin
Asm ("SEV", Volatile => True);
Asm ("WFE", Volatile => True);
end Clear_Event;
procedure Wait_For_Event is
begin
SCB_Periph.SCR.SEVEONPEND := 1;
Asm ("WFE", Volatile => True);
end Wait_For_Event;
function UID return UID_Type is
UID_F3 : aliased UID_Type with Import, Address => System'To_Address (16#1FFFF7E8#);
UID_Fx : aliased UID_Type with Import, Address => System'To_Address (16#1FFFF7AC#);
UID_Lx : aliased UID_Type with Import, Address => System'To_Address (16#1FF80050#);
begin
if SCB_Periph.CPUID.PartNo = 16#C23# then
return UID_F3;
elsif SCB_Periph.CPUID.PartNo = 16#C60# then
return UID_Lx;
else
return UID_Fx;
end if;
end UID;
end STM32GD;
|
LaplaceKorea/coinapi-sdk | Ada | 34,740 | adb | -- OEML _ REST API
-- This section will provide necessary information about the `CoinAPI OEML REST API` protocol. This API is also available in the Postman application: <a href=\"https://postman.coinapi.io/\" target=\"_blank\">https://postman.coinapi.io/</a>
--
-- The version of the OpenAPI document: v1
-- Contact: [email protected]
--
-- NOTE: This package is auto generated by OpenAPI-Generator 5.2.1.
-- https://openapi-generator.tech
-- Do not edit the class manually.
package body .Models is
pragma Style_Checks ("-mr");
pragma Warnings (Off, "*use clause for package*");
use Swagger.Streams;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in RejectReason_Type) is
begin
Into.Start_Entity (Name);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in RejectReason_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out RejectReason_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out RejectReason_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : RejectReason_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in MessageReject_Type) is
begin
Into.Start_Entity (Name);
Into.Write_Entity ("type", Value.P_Type);
Serialize (Into, "reject_reason", Value.Reject_Reason);
Into.Write_Entity ("exchange_id", Value.Exchange_Id);
Into.Write_Entity ("message", Value.Message);
Into.Write_Entity ("rejected_message", Value.Rejected_Message);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in MessageReject_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out MessageReject_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "type", Value.P_Type);
Deserialize (Object, "reject_reason", Value.Reject_Reason);
Swagger.Streams.Deserialize (Object, "exchange_id", Value.Exchange_Id);
Swagger.Streams.Deserialize (Object, "message", Value.Message);
Swagger.Streams.Deserialize (Object, "rejected_message", Value.Rejected_Message);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out MessageReject_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : MessageReject_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ValidationError_Type) is
begin
Into.Start_Entity (Name);
Into.Write_Entity ("type", Value.P_Type);
Into.Write_Entity ("title", Value.Title);
Serialize (Into, "status", Value.Status);
Into.Write_Entity ("traceId", Value.Trace_Id);
Into.Write_Entity ("errors", Value.Errors);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ValidationError_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ValidationError_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "type", Value.P_Type);
Swagger.Streams.Deserialize (Object, "title", Value.Title);
Swagger.Streams.Deserialize (Object, "status", Value.Status);
Swagger.Streams.Deserialize (Object, "traceId", Value.Trace_Id);
Swagger.Streams.Deserialize (Object, "errors", Value.Errors);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ValidationError_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : ValidationError_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in OrdType_Type) is
begin
Into.Start_Entity (Name);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in OrdType_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out OrdType_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out OrdType_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : OrdType_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in OrdStatus_Type) is
begin
Into.Start_Entity (Name);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in OrdStatus_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out OrdStatus_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out OrdStatus_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : OrdStatus_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in OrderCancelAllRequest_Type) is
begin
Into.Start_Entity (Name);
Into.Write_Entity ("exchange_id", Value.Exchange_Id);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in OrderCancelAllRequest_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out OrderCancelAllRequest_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "exchange_id", Value.Exchange_Id);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out OrderCancelAllRequest_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : OrderCancelAllRequest_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in OrderCancelSingleRequest_Type) is
begin
Into.Start_Entity (Name);
Into.Write_Entity ("exchange_id", Value.Exchange_Id);
Into.Write_Entity ("exchange_order_id", Value.Exchange_Order_Id);
Into.Write_Entity ("client_order_id", Value.Client_Order_Id);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in OrderCancelSingleRequest_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out OrderCancelSingleRequest_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "exchange_id", Value.Exchange_Id);
Swagger.Streams.Deserialize (Object, "exchange_order_id", Value.Exchange_Order_Id);
Swagger.Streams.Deserialize (Object, "client_order_id", Value.Client_Order_Id);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out OrderCancelSingleRequest_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : OrderCancelSingleRequest_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in OrdSide_Type) is
begin
Into.Start_Entity (Name);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in OrdSide_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out OrdSide_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out OrdSide_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : OrdSide_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in TimeInForce_Type) is
begin
Into.Start_Entity (Name);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in TimeInForce_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out TimeInForce_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out TimeInForce_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : TimeInForce_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in OrderNewSingleRequest_Type) is
begin
Into.Start_Entity (Name);
Into.Write_Entity ("exchange_id", Value.Exchange_Id);
Into.Write_Entity ("client_order_id", Value.Client_Order_Id);
Into.Write_Entity ("symbol_id_exchange", Value.Symbol_Id_Exchange);
Into.Write_Entity ("symbol_id_coinapi", Value.Symbol_Id_Coinapi);
Serialize (Into, "amount_order", Value.Amount_Order);
Serialize (Into, "price", Value.Price);
Serialize (Into, "side", Value.Side);
Serialize (Into, "order_type", Value.Order_Type);
Serialize (Into, "time_in_force", Value.Time_In_Force);
Serialize (Into, "expire_time", Value.Expire_Time);
Serialize (Into, "exec_inst", Value.Exec_Inst);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in OrderNewSingleRequest_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out OrderNewSingleRequest_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "exchange_id", Value.Exchange_Id);
Swagger.Streams.Deserialize (Object, "client_order_id", Value.Client_Order_Id);
Swagger.Streams.Deserialize (Object, "symbol_id_exchange", Value.Symbol_Id_Exchange);
Swagger.Streams.Deserialize (Object, "symbol_id_coinapi", Value.Symbol_Id_Coinapi);
Swagger.Streams.Deserialize (Object, "amount_order", Value.Amount_Order);
Swagger.Streams.Deserialize (Object, "price", Value.Price);
Deserialize (Object, "side", Value.Side);
Deserialize (Object, "order_type", Value.Order_Type);
Deserialize (Object, "time_in_force", Value.Time_In_Force);
Swagger.Streams.Deserialize (Object, "expire_time", Value.Expire_Time);
Swagger.Streams.Deserialize (Object, "exec_inst", Value.Exec_Inst);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out OrderNewSingleRequest_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : OrderNewSingleRequest_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Fills_Type) is
begin
Into.Start_Entity (Name);
Serialize (Into, "time", Value.Time);
Serialize (Into, "price", Value.Price);
Serialize (Into, "amount", Value.Amount);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Fills_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Fills_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "time", Value.Time);
Swagger.Streams.Deserialize (Object, "price", Value.Price);
Swagger.Streams.Deserialize (Object, "amount", Value.Amount);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Fills_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : Fills_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in OrderExecutionReport_Type) is
begin
Into.Start_Entity (Name);
Into.Write_Entity ("exchange_id", Value.Exchange_Id);
Into.Write_Entity ("client_order_id", Value.Client_Order_Id);
Into.Write_Entity ("symbol_id_exchange", Value.Symbol_Id_Exchange);
Into.Write_Entity ("symbol_id_coinapi", Value.Symbol_Id_Coinapi);
Serialize (Into, "amount_order", Value.Amount_Order);
Serialize (Into, "price", Value.Price);
Serialize (Into, "side", Value.Side);
Serialize (Into, "order_type", Value.Order_Type);
Serialize (Into, "time_in_force", Value.Time_In_Force);
Serialize (Into, "expire_time", Value.Expire_Time);
Serialize (Into, "exec_inst", Value.Exec_Inst);
Into.Write_Entity ("client_order_id_format_exchange", Value.Client_Order_Id_Format_Exchange);
Into.Write_Entity ("exchange_order_id", Value.Exchange_Order_Id);
Serialize (Into, "amount_open", Value.Amount_Open);
Serialize (Into, "amount_filled", Value.Amount_Filled);
Serialize (Into, "avg_px", Value.Avg_Px);
Serialize (Into, "status", Value.Status);
Serialize (Into, "status_history", Value.Status_History);
Into.Write_Entity ("error_message", Value.Error_Message);
Serialize (Into, "fills", Value.Fills);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in OrderExecutionReport_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out OrderExecutionReport_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "exchange_id", Value.Exchange_Id);
Swagger.Streams.Deserialize (Object, "client_order_id", Value.Client_Order_Id);
Swagger.Streams.Deserialize (Object, "symbol_id_exchange", Value.Symbol_Id_Exchange);
Swagger.Streams.Deserialize (Object, "symbol_id_coinapi", Value.Symbol_Id_Coinapi);
Swagger.Streams.Deserialize (Object, "amount_order", Value.Amount_Order);
Swagger.Streams.Deserialize (Object, "price", Value.Price);
Deserialize (Object, "side", Value.Side);
Deserialize (Object, "order_type", Value.Order_Type);
Deserialize (Object, "time_in_force", Value.Time_In_Force);
Swagger.Streams.Deserialize (Object, "expire_time", Value.Expire_Time);
Swagger.Streams.Deserialize (Object, "exec_inst", Value.Exec_Inst);
Swagger.Streams.Deserialize (Object, "client_order_id_format_exchange", Value.Client_Order_Id_Format_Exchange);
Swagger.Streams.Deserialize (Object, "exchange_order_id", Value.Exchange_Order_Id);
Swagger.Streams.Deserialize (Object, "amount_open", Value.Amount_Open);
Swagger.Streams.Deserialize (Object, "amount_filled", Value.Amount_Filled);
Swagger.Streams.Deserialize (Object, "avg_px", Value.Avg_Px);
Deserialize (Object, "status", Value.Status);
Swagger.Streams.Deserialize (Object, "status_history", Value.Status_History);
Swagger.Streams.Deserialize (Object, "error_message", Value.Error_Message);
Deserialize (Object, "fills", Value.Fills);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out OrderExecutionReport_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : OrderExecutionReport_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in OrderExecutionReportAllOf_Type) is
begin
Into.Start_Entity (Name);
Into.Write_Entity ("client_order_id_format_exchange", Value.Client_Order_Id_Format_Exchange);
Into.Write_Entity ("exchange_order_id", Value.Exchange_Order_Id);
Serialize (Into, "amount_open", Value.Amount_Open);
Serialize (Into, "amount_filled", Value.Amount_Filled);
Serialize (Into, "avg_px", Value.Avg_Px);
Serialize (Into, "status", Value.Status);
Serialize (Into, "status_history", Value.Status_History);
Into.Write_Entity ("error_message", Value.Error_Message);
Serialize (Into, "fills", Value.Fills);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in OrderExecutionReportAllOf_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out OrderExecutionReportAllOf_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "client_order_id_format_exchange", Value.Client_Order_Id_Format_Exchange);
Swagger.Streams.Deserialize (Object, "exchange_order_id", Value.Exchange_Order_Id);
Swagger.Streams.Deserialize (Object, "amount_open", Value.Amount_Open);
Swagger.Streams.Deserialize (Object, "amount_filled", Value.Amount_Filled);
Swagger.Streams.Deserialize (Object, "avg_px", Value.Avg_Px);
Deserialize (Object, "status", Value.Status);
Swagger.Streams.Deserialize (Object, "status_history", Value.Status_History);
Swagger.Streams.Deserialize (Object, "error_message", Value.Error_Message);
Deserialize (Object, "fills", Value.Fills);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out OrderExecutionReportAllOf_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : OrderExecutionReportAllOf_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in BalanceData_Type) is
begin
Into.Start_Entity (Name);
Into.Write_Entity ("asset_id_exchange", Value.Asset_Id_Exchange);
Into.Write_Entity ("asset_id_coinapi", Value.Asset_Id_Coinapi);
Serialize (Into, "balance", Value.Balance);
Serialize (Into, "available", Value.Available);
Serialize (Into, "locked", Value.Locked);
Into.Write_Entity ("last_updated_by", Value.Last_Updated_By);
Serialize (Into, "rate_usd", Value.Rate_Usd);
Serialize (Into, "traded", Value.Traded);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in BalanceData_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out BalanceData_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "asset_id_exchange", Value.Asset_Id_Exchange);
Swagger.Streams.Deserialize (Object, "asset_id_coinapi", Value.Asset_Id_Coinapi);
Swagger.Streams.Deserialize (Object, "balance", Value.Balance);
Swagger.Streams.Deserialize (Object, "available", Value.Available);
Swagger.Streams.Deserialize (Object, "locked", Value.Locked);
Swagger.Streams.Deserialize (Object, "last_updated_by", Value.Last_Updated_By);
Swagger.Streams.Deserialize (Object, "rate_usd", Value.Rate_Usd);
Swagger.Streams.Deserialize (Object, "traded", Value.Traded);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out BalanceData_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : BalanceData_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Balance_Type) is
begin
Into.Start_Entity (Name);
Into.Write_Entity ("exchange_id", Value.Exchange_Id);
Serialize (Into, "data", Value.Data);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Balance_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Balance_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "exchange_id", Value.Exchange_Id);
Deserialize (Object, "data", Value.Data);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Balance_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : Balance_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Position_Type) is
begin
Into.Start_Entity (Name);
Into.Write_Entity ("exchange_id", Value.Exchange_Id);
Serialize (Into, "data", Value.Data);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Position_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Position_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "exchange_id", Value.Exchange_Id);
Deserialize (Object, "data", Value.Data);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Position_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : Position_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PositionData_Type) is
begin
Into.Start_Entity (Name);
Into.Write_Entity ("symbol_id_exchange", Value.Symbol_Id_Exchange);
Into.Write_Entity ("symbol_id_coinapi", Value.Symbol_Id_Coinapi);
Serialize (Into, "avg_entry_price", Value.Avg_Entry_Price);
Serialize (Into, "quantity", Value.Quantity);
Serialize (Into, "side", Value.Side);
Serialize (Into, "unrealized_pnl", Value.Unrealized_Pnl);
Serialize (Into, "leverage", Value.Leverage);
Into.Write_Entity ("cross_margin", Value.Cross_Margin);
Serialize (Into, "liquidation_price", Value.Liquidation_Price);
Into.Write_Entity ("raw_data", Value.Raw_Data);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in PositionData_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
Serialize (Into, "", Item);
end loop;
Into.End_Array (Name);
end Serialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PositionData_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "symbol_id_exchange", Value.Symbol_Id_Exchange);
Swagger.Streams.Deserialize (Object, "symbol_id_coinapi", Value.Symbol_Id_Coinapi);
Swagger.Streams.Deserialize (Object, "avg_entry_price", Value.Avg_Entry_Price);
Swagger.Streams.Deserialize (Object, "quantity", Value.Quantity);
Deserialize (Object, "side", Value.Side);
Swagger.Streams.Deserialize (Object, "unrealized_pnl", Value.Unrealized_Pnl);
Swagger.Streams.Deserialize (Object, "leverage", Value.Leverage);
Swagger.Streams.Deserialize (Object, "cross_margin", Value.Cross_Margin);
Swagger.Streams.Deserialize (Object, "liquidation_price", Value.Liquidation_Price);
Deserialize (Object, "raw_data", Value.Raw_Data);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out PositionData_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : PositionData_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
for Data of List loop
Deserialize (Data, "", Item);
Value.Append (Item);
end loop;
end Deserialize;
end .Models;
|
cborao/Ada-P3 | Ada | 7,752 | adb |
--PRÁCTICA 3: CÉSAR BORAO MORATINOS (Chat_Procedures.adb)
with Ada.Text_IO;
with Chat_Messages;
with Gnat.Calendar.Time_IO;
with Ada.Strings.Unbounded;
package body Chat_Procedures is
package CM renames Chat_Messages;
use type Ada.Calendar.Time;
function Max_Valid (Max_Clients: Natural) return Boolean is
begin
if Max_Clients >= 2 and Max_Clients <= 50 then
return True;
else
return False;
end if;
end Max_Valid;
procedure Send_To_Readers (Automatic: Boolean;
Nick: in out ASU.Unbounded_String;
Comment: ASU.Unbounded_String;
O_Buffer: access LLU.Buffer_Type) is
C: Active_Clients.Cursor := Active_Clients.First(Active_Map);
begin
if Automatic then
Nick := ASU.To_Unbounded_String("server");
end if;
while Active_Clients.Has_Element(C) loop
if Active_Clients.Element(C).Key /= Nick then
CM.Server_Message (Active_Clients.Element(C).Value.Client_EP,
Nick,Comment,O_Buffer);
end if;
Active_Clients.Next(C);
end loop;
end Send_To_Readers;
function Time_Image (T: Ada.Calendar.Time) return String is
begin
return Gnat.Calendar.Time_IO.Image(T, "%d-%b-%y %T.%i");
end Time_Image;
function Format_EP (EP_Image: in out ASU.Unbounded_String) return ASU.Unbounded_String is
IP_Image: ASU.Unbounded_String;
Port_Image: ASU.Unbounded_String;
Position: Integer;
Delimiter: String := " ";
Result: ASU.Unbounded_String;
begin
for I in 1..2 loop
Position := ASU.Index(EP_Image, Delimiter);
ASU.Tail(EP_Image, ASU.Length(EP_Image) - Position);
end loop;
Position := ASU.Index(EP_Image, Delimiter);
IP_Image := ASU.Head (EP_Image, Position - 2);
ASU.Tail(EP_Image, ASU.Length(EP_Image) - Position);
Position := ASU.Index(EP_Image, Delimiter);
Port_Image := ASU.Tail(EP_Image, ASU.Length(EP_Image) - Position - 1);
Result := "(" & IP_Image & ":" & Port_Image & ")";
return Result;
end Format_EP;
procedure Print_Active_Map is
C: Active_Clients.Cursor := Active_Clients.First(Active_Map);
EP_Image: ASU.Unbounded_String;
begin
Ada.Text_IO.Put_Line ("ACTIVE CLIENTS");
Ada.Text_IO.Put_Line ("==============");
while Active_Clients.Has_Element(C) loop
EP_Image := ASU.To_Unbounded_String(LLU.Image(Active_Clients.Element
(C).Value.Client_EP));
Ada.Text_IO.Put_Line (ASU.To_String(Active_Clients.Element(C).Key) &
" " &
ASU.To_String(Format_EP(EP_Image)) & " " &
Time_Image(Active_Clients.Element(C).Value.Time));
Active_Clients.Next(C);
end loop;
ATI.New_Line;
end Print_Active_Map;
procedure Print_Old_Map is
C: Old_Clients.Cursor := Old_Clients.First(Old_Map);
begin
Ada.Text_IO.Put_Line ("OLD CLIENTS");
Ada.Text_IO.Put_Line ("===========");
while Old_Clients.Has_Element(C) loop
Ada.Text_IO.Put_Line (ASU.To_String(Old_Clients.Element(C).Key) &
": " & Time_Image(Old_Clients.Element(C).Value));
Old_Clients.Next(C);
end loop;
ATI.New_Line;
end Print_Old_Map;
function Client_To_Ban (Active_Map: Active_Clients.Map) return ASU.Unbounded_String is
C: Active_Clients.Cursor := Active_Clients.First(Active_Map);
Min_Time: Ada.Calendar.Time;
Nick: ASU.Unbounded_String;
begin
Min_Time := Active_Clients.Element(C).Value.Time;
Nick := Active_Clients.Element(C).Key;
while Active_Clients.Has_Element(C) loop
if Active_Clients.Element(C).Value.Time < Min_Time then
Nick := Active_Clients.Element(C).Key;
end if;
Active_Clients.Next(C);
end loop;
return Nick;
end Client_To_Ban;
procedure Server_To_All (Comment: ASU.Unbounded_String;
O_Buffer: access LLU.Buffer_Type) is
C: Active_Clients.Cursor := Active_Clients.First(Active_Map);
Nick: ASU.Unbounded_String := ASU.To_Unbounded_String("Server");
begin
while Active_Clients.Has_Element(C) loop
CM.Server_Message (Active_Clients.Element(C).Value.Client_EP,
Nick,Comment,O_Buffer);
Active_Clients.Next(C);
end loop;
end Server_To_All;
procedure Case_Init (I_Buffer: access LLU.Buffer_Type;
O_Buffer: access LLU.Buffer_Type) is
Client_EP_Receive: LLU.End_Point_Type;
Client_EP_Handler: LLU.End_Point_Type;
Nick: ASU.Unbounded_String;
Ban_Nick: ASU.Unbounded_String;
Comment: ASU.Unbounded_String;
Logout_Time: Ada.Calendar.Time;
Client_Data: Data;
Accepted: Boolean;
Success: Boolean;
begin
Client_EP_Receive := LLU.End_Point_Type'Input (I_Buffer);
Client_EP_Handler := LLU.End_Point_Type'Input (I_Buffer);
Nick := ASU.Unbounded_String'Input (I_Buffer);
Active_Clients.Get(Active_Map,Nick,Client_Data,Success);
if Success then
Accepted := False;
ATI.Put_Line("INIT received from " & ASU.To_String(Nick)
& ": IGNORED. nick already used");
else
ATI.Put_Line("INIT received from " & ASU.To_String(Nick)
& ": ACCEPTED");
begin
Accepted := True;
Client_Data.Client_EP := Client_EP_Handler;
Client_Data.Time := Ada.Calendar.Clock;
Active_Clients.Put (Active_Map,Nick,Client_Data);
exception
when Active_Clients.Full_Map =>
Ban_Nick := Client_To_Ban(Active_Map);
Logout_Time := Ada.Calendar.Clock;
Old_Clients.Put (Old_Map,Ban_Nick,Logout_Time);
Comment := ASU.To_Unbounded_String(ASU.To_String(Ban_Nick)
& " banned for being idle too long");
Server_To_All (Comment,O_Buffer);
Active_Clients.Delete (Active_Map,Ban_Nick,Success);
Active_Clients.Put (Active_Map,Nick,Client_Data);
end;
Comment := ASU.To_Unbounded_String(ASU.To_String(Nick) &
" joins the chat");
--Automatic := True
Send_To_Readers (True,Nick,Comment,O_Buffer);
end if;
CM.Welcome_Message(Client_EP_Receive,Accepted,
O_Buffer);
end Case_Init;
procedure Case_Writer (I_Buffer: Access LLU.Buffer_Type;
O_Buffer: Access LLU.Buffer_Type) is
Client_EP_Handler: LLU.End_Point_Type;
Nick: ASU.Unbounded_String;
Comment: ASU.Unbounded_String;
Success: Boolean;
Client_Data: Data;
begin
Client_EP_Handler := LLU.End_Point_Type'Input (I_Buffer);
Nick := ASU.Unbounded_String'Input (I_Buffer);
Comment := ASU.Unbounded_String'Input (I_Buffer);
Active_Clients.Get(Active_Map,Nick,Client_Data,Success);
if Success and LLU."="(Client_Data.Client_EP,Client_EP_Handler) then
ATI.Put_Line("WRITER received from " & ASU.To_String(Nick) & ": " &
ASU.To_String(Comment));
Client_Data.Time := Ada.Calendar.Clock;
Active_Clients.Put(Active_Map,Nick,Client_Data);
--Automatic := False
Send_To_Readers (False,Nick,Comment,O_Buffer);
else
ATI.Put_Line("WRITER received from unknown client. IGNORED");
end if;
end Case_Writer;
procedure Case_Logout (I_Buffer: access LLU.Buffer_Type;
O_Buffer: access LLU.Buffer_Type) is
Client_EP_Handler: LLU.End_Point_Type;
Nick: ASU.Unbounded_String;
Comment: ASU.Unbounded_String;
Success: Boolean;
Client_Data: Data;
begin
Client_EP_Handler := LLU.End_Point_Type'Input (I_Buffer);
Nick := ASU.Unbounded_String'Input (I_Buffer);
Active_Clients.Get(Active_Map,Nick,Client_Data,Success);
if Success and LLU."="(Client_Data.Client_EP,Client_EP_Handler) then
ATI.Put_Line("LOGOUT received from " & ASU.To_String(Nick));
Active_Clients.Delete (Active_Map,Nick,Success);
Client_Data.Time := Ada.Calendar.Clock;
Old_Clients.Put (Old_Map,Nick,Client_Data.Time);
Comment := ASU.To_Unbounded_String(ASU.To_String(Nick) &
" leaves the chat");
--Automatic := True
Send_To_Readers (True,Nick,Comment,O_Buffer);
else
ATI.Put_Line("LOGOUT received from banned " & ASU.To_String(Nick));
end if;
end Case_Logout;
end Chat_Procedures;
|
reznikmm/matreshka | Ada | 3,689 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with League.Strings;
package Matreshka.ODF_Elements.Office is
type Office_Node_Base is
abstract new Matreshka.ODF_Elements.ODF_Element_Node with null record;
overriding function Get_Namespace_URI
(Self : not null access constant Office_Node_Base)
return League.Strings.Universal_String;
end Matreshka.ODF_Elements.Office;
|
AdaCore/libadalang | Ada | 70 | ads | with Types; use Types;
package Pkg is
procedure Subunit;
end Pkg;
|
reznikmm/matreshka | Ada | 3,704 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Elements;
package ODF.DOM.Anim_AnimateTransform_Elements is
pragma Preelaborate;
type ODF_Anim_AnimateTransform is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Anim_AnimateTransform_Access is
access all ODF_Anim_AnimateTransform'Class
with Storage_Size => 0;
end ODF.DOM.Anim_AnimateTransform_Elements;
|
clairvoyant/anagram | Ada | 1,029 | adb | -- Copyright (c) 2010-2017 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Anagram.String_Sources is
--------------
-- Get_Next --
--------------
overriding function Get_Next
(Self : not null access String_Source)
return Anagram.Abstract_Sources.Code_Unit_32
is
begin
if Self.Cursor.Has_Element then
return Result : Anagram.Abstract_Sources.Code_Unit_32 do
Result := Wide_Wide_Character'Pos
(Self.Cursor.Element);
Self.Cursor.Next;
end return;
else
return Anagram.Abstract_Sources.End_Of_Input;
end if;
end Get_Next;
------------
-- Create --
------------
procedure Create
(Self : out String_Source;
Text : League.Strings.Universal_String) is
begin
Self.Text := Text;
Self.Cursor.First (Self.Text);
end Create;
end Anagram.String_Sources;
|
burratoo/Acton | Ada | 4,209 | adb | ------------------------------------------------------------------------------
-- --
-- OAK CORE SUPPORT PACKAGE --
-- ATMEL ARM7TDMI --
-- --
-- ISA.ARM.ARM7TDMI --
-- --
-- B o d y --
-- --
-- Copyright (C) 2014-2014, Patrick Bernardi --
------------------------------------------------------------------------------
with System.Machine_Code; use System.Machine_Code;
package body ISA.ARM.ARM7TDMI is
-------------------------------------
-- Current_Program_Status_Register --
-------------------------------------
function Current_Program_Status_Register return Status_Type is
CPSR : Status_Type;
begin
Asm ("mrs %0, cpsr",
Outputs => Status_Type'Asm_Output ("=r", CPSR),
Volatile => True);
return CPSR;
end Current_Program_Status_Register;
-------------------------------------
-- Saved_Program_Status_Register --
-------------------------------------
function Saved_Program_Status_Register return Status_Type is
SPSR : Status_Type;
begin
Asm ("mrs %0, spsr",
Outputs => Status_Type'Asm_Output ("=r", SPSR),
Volatile => True);
return SPSR;
end Saved_Program_Status_Register;
-----------------------------------------
-- Set_Current_Program_Status_Register --
-----------------------------------------
procedure Set_Current_Program_Status_Register
(New_Value : in Status_Type) is
begin
Asm ("msr cpsr, %0",
Inputs => Status_Type'Asm_Input ("r", New_Value),
Volatile => True);
end Set_Current_Program_Status_Register;
--------------
-- Set_Mode --
--------------
procedure Set_Mode (New_Mode : Mode_Bits) is
CPSR : Status_Type := Current_Program_Status_Register;
begin
CPSR.Mode := New_Mode;
Set_Current_Program_Status_Register (CPSR);
end Set_Mode;
---------------------------
-- Switch_To_System_Mode --
---------------------------
procedure Switch_To_System_Mode is
begin
Asm ("msr cpsr_c, #0x9F", Volatile => True);
-- IRQ disabled, FIQ Enabled System Mode
end Switch_To_System_Mode;
-------------------------------
-- Switch_To_Supervisor_Mode --
-------------------------------
procedure Switch_To_Supervisor_Mode is
begin
Asm ("msr cpsr_c, #0xD3", Volatile => True);
-- Interrupts disabled, System Mode
end Switch_To_Supervisor_Mode;
------------------------
-- Switch_To_IRQ_Mode --
------------------------
procedure Switch_To_IRQ_Mode is
begin
Asm ("msr cpsr_c, #0xD2", Volatile => True);
-- Interrupts disabled, IRQ Mode
end Switch_To_IRQ_Mode;
------------------------
-- Switch_To_FIQ_Mode --
------------------------
procedure Switch_To_FIQ_Mode is
begin
Asm ("msr cpsr_c, #0xD1", Volatile => True);
-- Interrupts disabled, FIQ Mode
end Switch_To_FIQ_Mode;
----------------------------
-- Disable_All_Interrupts --
----------------------------
procedure Disable_All_Interrupts is
CPSR : Status_Type := Current_Program_Status_Register;
begin
CPSR := (IRQ_Disable => True, FIQ_Disable => True, others => <>);
Set_Current_Program_Status_Register (CPSR);
end Disable_All_Interrupts;
---------------------------
-- Enable_All_Interrupts --
---------------------------
procedure Enable_All_Interrupts is
CPSR : Status_Type := Current_Program_Status_Register;
begin
CPSR := (IRQ_Disable => False, FIQ_Disable => False, others => <>);
Set_Current_Program_Status_Register (CPSR);
end Enable_All_Interrupts;
end ISA.ARM.ARM7TDMI;
|
onox/orka | Ada | 9,268 | 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.
with Ada.Numerics.Generic_Elementary_Functions;
with Orka.Transforms.Singles.Matrices;
package body Orka.Features.Terrain.Spheres is
function Plane_To_Sphere
(Vertex : Orka.Transforms.Singles.Vectors.Vector4;
Parameters : Orka.Features.Terrain.Spheroid_Parameters)
return Orka.Transforms.Singles.Vectors.Vector4
is
package EF is new Ada.Numerics.Generic_Elementary_Functions (Float_32);
use Orka.Transforms.Singles.Vectors;
Axis : Float_32 renames Parameters (1);
E2 : Float_32 renames Parameters (2);
Y_Mask : Float_32 renames Parameters (3);
Z_Mask : Float_32 renames Parameters (4);
Unit : Vector4 := Vertex * (2.0, 2.0, 1.0, 1.0) - (1.0, 1.0, 0.0, 0.0);
-- Centers the plane
begin
-- World matrix assumes ECEF, meaning:
--
-- z
-- |
-- o--y
-- /
-- x
--
-- So the 3rd element (1.0) must be moved to the 'x' position,
-- and the first two elements (H and V) must be moved to 'y' and 'z'.
Unit := Normalize ((Unit (Z), Unit (X), Unit (Y), 0.0));
Unit (W) := 1.0;
declare
Height : constant Float_32 :=
Norm ((Unit (Y), Unit (Z), 0.0, 0.0) * (Y_Mask, Z_Mask, 0.0, 0.0));
N : constant Float_32 :=
Axis / EF.Sqrt (1.0 - E2 * Height * Height);
Scale : Vector4 := ((1.0, 1.0, 1.0, 1.0) - E2 * (0.0, Y_Mask, Z_Mask, 0.0)) * N;
begin
Scale (W) := 1.0;
return Scale * Unit;
end;
end Plane_To_Sphere;
function Get_Sphere_Visibilities
(Parameters : Spheroid_Parameters;
Front, Back, World, View : Orka.Types.Singles.Matrix4)
return Float_32_Array is
use Orka.Transforms.Singles.Matrices;
World_View : constant Orka.Types.Singles.Matrix4 := View * World;
Vertices : constant array (Size range 0 .. 3) of Orka.Types.Singles.Vector4 :=
(Plane_To_Sphere ((0.0, 0.0, 1.0, 1.0), Parameters),
Plane_To_Sphere ((1.0, 0.0, 1.0, 1.0), Parameters),
Plane_To_Sphere ((0.0, 1.0, 1.0, 1.0), Parameters),
Plane_To_Sphere ((1.0, 1.0, 1.0, 1.0), Parameters));
Faces : constant array (Size range 0 .. 1) of Orka.Types.Singles.Matrix4 :=
(Front, Back);
Result : Float_32_Array (0 .. 7);
use Orka.Transforms.Singles.Vectors;
begin
for Index in Result'Range loop
declare
V : Orka.Types.Singles.Vector4 renames Vertices (Index mod 4);
F : Orka.Types.Singles.Matrix4 renames Faces (Index / 4);
-- Vector pointing to vertex from camera or sphere
V_From_C : constant Orka.Types.Singles.Vector4 := World_View * (F * V);
V_From_S : constant Orka.Types.Singles.Vector4 := View * (F * V);
begin
Result (Index) := Dot (Normalize (V_From_C), Normalize (V_From_S));
end;
end loop;
return Result;
end Get_Sphere_Visibilities;
-----------------------------------------------------------------------------
subtype Tile_Index is Positive range 1 .. 6;
subtype Vertex_Index is Size range 0 .. 7;
type Edge_Index is range 1 .. 12;
type Edge_Index_Array is array (Positive range 1 .. 4) of Edge_Index;
type Vertex_Index_Array is array (Positive range 1 .. 2) of Vertex_Index;
type Tile_Index_Array is array (Positive range <>) of Tile_Index;
type Tile_3_Array is array (Vertex_Index) of Tile_Index_Array (1 .. 3);
type Tile_2_Array is array (Edge_Index) of Tile_Index_Array (1 .. 2);
type Edges_Array is array (Tile_Index) of Edge_Index_Array;
type Vertices_Array is array (Edge_Index) of Vertex_Index_Array;
-- The three tiles that are visible when a particular
-- vertex is visible
Vertex_Buffer_Indices : constant Tile_3_Array :=
(0 => (1, 4, 6),
1 => (1, 2, 6),
2 => (1, 4, 5),
3 => (1, 2, 5),
4 => (2, 3, 6),
5 => (3, 4, 6),
6 => (2, 3, 5),
7 => (3, 4, 5));
-- The vertices that form each edge
Edge_Vertex_Indices : constant Vertices_Array :=
(1 => (0, 2),
2 => (1, 3),
3 => (2, 3),
4 => (0, 1),
5 => (4, 6),
6 => (5, 7),
7 => (6, 7),
8 => (4, 5),
9 => (2, 7),
10 => (3, 6),
11 => (0, 5),
12 => (1, 4));
-- The two tiles to which each edge belongs
Edge_Tiles_Indices : constant Tile_2_Array :=
(1 => (1, 4),
2 => (1, 2),
3 => (1, 5),
4 => (1, 6),
5 => (3, 2),
6 => (3, 4),
7 => (3, 5),
8 => (3, 6),
9 => (4, 5),
10 => (2, 5),
11 => (4, 6),
12 => (2, 6));
-- The four edges of each tile
Tile_Edge_Indices : constant Edges_Array :=
(1 => (1, 2, 3, 4),
2 => (2, 5, 10, 12),
3 => (5, 6, 7, 8),
4 => (1, 6, 9, 11),
5 => (3, 7, 9, 10),
6 => (4, 8, 11, 12));
Threshold_A : constant := 0.55;
Threshold_B : constant := 0.25;
function Get_Visible_Tiles
(Visibilities : Float_32_Array) return Visible_Tile_Array
is
Visible_Tile_Count : array (Tile_Index) of Natural := (others => 0);
Vertex_Visible : Boolean := False;
Result : Visible_Tile_Array := (Tile_Index => False);
begin
-- Heuristic 1: a tile is visible if it surrounds a vertex that is
-- pointing towards the camera
for Vertex in Vertex_Buffer_Indices'Range loop
if Visibilities (Vertex) < 0.0 then
for Tile of Vertex_Buffer_Indices (Vertex) loop
Result (Tile) := True;
end loop;
Vertex_Visible := True;
end if;
end loop;
-- If all vertices point away from the camera, the camera is usually
-- close to some of the tiles
if not Vertex_Visible then
-- Heuristic 2: an edge is visible if the maximum vertex visibility
-- is less than some threshold
for Edge in Edge_Vertex_Indices'Range loop
if (for all Vertex of Edge_Vertex_Indices (Edge) =>
Visibilities (Vertex) < Threshold_A)
then
for Tile of Edge_Tiles_Indices (Edge) loop
Visible_Tile_Count (Tile) := Visible_Tile_Count (Tile) + 1;
end loop;
end if;
end loop;
declare
Max_Count : Natural := 0;
function Average_Visibility (Vertices : Vertex_Index_Array) return Float_32 is
Sum : Float_32 := 0.0;
begin
for Vertex of Vertices loop
Sum := Sum + Visibilities (Vertex);
end loop;
return Sum / Float_32 (Vertices'Length);
end Average_Visibility;
begin
for Tile in Visible_Tile_Count'Range loop
Max_Count := Natural'Max (Max_Count, Visible_Tile_Count (Tile));
end loop;
-- A tile is visible if it has the highest number (1, 2, or 4)
-- of visible edges
--
-- For example, tile 1 might have a count of 4, while its surrounding
-- tiles (2, 4, 5, and 6) have a count of 1. In that case choose to
-- display tile 1.
for Tile in Visible_Tile_Count'Range loop
if Visible_Tile_Count (Tile) = Max_Count then
Result (Tile) := True;
end if;
end loop;
-- Sometimes the camera might be positioned above a tile with count 4
-- and looking at some of its edges. In that case we should render the
-- adjacent tiles as well if those tiles are 'likely' to be visible.
if Max_Count in 2 | 4 then
for Tile in Tile_Edge_Indices'Range loop
if Result (Tile) then
-- Heuristic 3: all tiles that surround an edge of a visible tile
-- with an average vertex visibility less than some threshold
-- are visible as well
for Edge of Tile_Edge_Indices (Tile) loop
if Average_Visibility (Edge_Vertex_Indices (Edge)) < Threshold_B then
for Tile of Edge_Tiles_Indices (Edge) loop
Result (Tile) := True;
end loop;
end if;
end loop;
end if;
end loop;
end if;
end;
end if;
return Result;
end Get_Visible_Tiles;
end Orka.Features.Terrain.Spheres;
|
persan/protobuf-ada | Ada | 198 | ads | with Google.Protobuf.Buffered_Byte_Stream;
package Protocol_Buffers.Buffered_Byte_Stream renames Google.Protobuf.Buffered_Byte_Stream with Obsolescent => "use Google.Protobuf.Buffered_Byte_Stream";
|
reznikmm/matreshka | Ada | 3,801 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.Constants;
package body Matreshka.ODF_Attributes.Style.Font_Weight_Complex is
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Style_Font_Weight_Complex_Node)
return League.Strings.Universal_String is
begin
return ODF.Constants.Font_Weight_Complex_Name;
end Get_Local_Name;
end Matreshka.ODF_Attributes.Style.Font_Weight_Complex;
|
fengjixuchui/ewok-kernel | Ada | 4,154 | 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 m4.mpu;
with types;
package soc.layout
with spark_mode => on
is
FLASH_BASE : constant system_address := 16#0800_0000#;
FLASH_SIZE : constant := 1 * MBYTE;
SRAM_BASE : constant system_address := 16#1000_0000#;
SRAM_SIZE : constant := 64 * KBYTE;
BOOTROM_BASE : constant system_address := 16#1FFF_0000#;
RAM_BASE : constant system_address := 16#2000_0000#; -- SRAM
RAM_SIZE : constant := 128 * KBYTE;
USER_RAM_BASE : constant system_address := 16#2000_0000#; -- SRAM
USER_RAM_SIZE : constant := 128 * KBYTE;
KERNEL_RAM_BASE : constant system_address := 16#1000_0000#;
KERNEL_RAM_SIZE : constant := 64 * KBYTE;
PERIPH_BASE : constant system_address := 16#4000_0000#;
MEMORY_BANK1_BASE : constant system_address := 16#6000_0000#;
MEMORY_BANK2_BASE : constant system_address := MEMORY_BANK1_BASE;
APB1PERIPH_BASE : constant system_address := PERIPH_BASE;
APB2PERIPH_BASE : constant system_address := PERIPH_BASE + 16#0001_0000#;
AHB1PERIPH_BASE : constant system_address := PERIPH_BASE + 16#0002_0000#;
AHB2PERIPH_BASE : constant system_address := PERIPH_BASE + 16#1000_0000#;
--
-- AHB1 peripherals
--
GPIOA_BASE : constant system_address := AHB1PERIPH_BASE + 16#0000#;
GPIOB_BASE : constant system_address := AHB1PERIPH_BASE + 16#0400#;
GPIOC_BASE : constant system_address := AHB1PERIPH_BASE + 16#0800#;
GPIOD_BASE : constant system_address := AHB1PERIPH_BASE + 16#0C00#;
GPIOE_BASE : constant system_address := AHB1PERIPH_BASE + 16#1000#;
GPIOF_BASE : constant system_address := AHB1PERIPH_BASE + 16#1400#;
GPIOG_BASE : constant system_address := AHB1PERIPH_BASE + 16#1800#;
GPIOH_BASE : constant system_address := AHB1PERIPH_BASE + 16#1C00#;
GPIOI_BASE : constant system_address := AHB1PERIPH_BASE + 16#2000#;
DMA1_BASE : constant system_address := AHB1PERIPH_BASE + 16#6000#;
DMA2_BASE : constant system_address := AHB1PERIPH_BASE + 16#6400#;
--
-- APB2 peripherals
--
SYSCFG_BASE : constant system_address := APB2PERIPH_BASE + 16#3800#;
--
-- Flash and firmware structure
--
--
-- Flip bank
FW1_SIZE : constant unsigned_32 := 576*1024;
FW1_KERN_BASE : constant unsigned_32 := 16#08020000#;
FW1_KERN_SIZE : constant unsigned_32 := 64*1024;
FW1_KERN_REGION_SIZE : constant m4.mpu.t_region_size := m4.mpu.REGION_SIZE_64KB;
FW1_USER_BASE : constant unsigned_32 := 16#08080000#;
FW1_USER_SIZE : constant unsigned_32 := 512*1024;
FW1_USER_REGION_SIZE : constant m4.mpu.t_region_size := m4.mpu.REGION_SIZE_512KB;
-- DFU 1
DFU1_SIZE : constant unsigned_32 := 320*1024;
DFU1_KERN_BASE : constant unsigned_32 := 16#08030000#;
DFU1_USER_BASE : constant unsigned_32 := 16#08040000#;
DFU1_KERN_SIZE : constant unsigned_32 := 64*1024;
DFU1_KERN_REGION_SIZE: constant m4.mpu.t_region_size := m4.mpu.REGION_SIZE_64KB;
DFU1_USER_SIZE : constant unsigned_32 := 256*1024;
DFU1_USER_REGION_SIZE: constant m4.mpu.t_region_size := m4.mpu.REGION_SIZE_256KB;
-- STM32F407 has 1MB flash that can be mapped at a time, which forbid
-- the usage of efficient dual banking.
-- This layout does not declare the complete dual bank
end soc.layout;
|
zhmu/ananas | Ada | 7,226 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S I N P U T . L --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. 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. --
-- --
------------------------------------------------------------------------------
-- This child package contains the routines used to actually load a source
-- file and create entries in the source file table. It also contains the
-- routines to create virtual entries for instantiations. This is separated
-- off into a child package to avoid a dependence of Sinput on Osint which
-- would cause trouble in the tree read/write routines.
package Sinput.L is
------------------------------------------
-- Subprograms for Loading Source Files --
------------------------------------------
function Load_Source_File (N : File_Name_Type) return Source_File_Index;
-- Given a source file name, returns the index of the corresponding entry
-- in the source file table. If the file is not currently loaded, then
-- this is the call that causes the source file to be read and an entry
-- made in the table. A new entry in the table has the file name and time
-- stamp entries set and the Casing entries set to Unknown. Version is set
-- to all blanks, and the lines table is initialized but only the first
-- entry is set (and Last_Line is set to 1). If the given source file
-- cannot be opened, then the value returned is No_Source_File.
function Load_Config_File (N : File_Name_Type) return Source_File_Index;
-- Similar to Load_Source_File, except that the file name is always
-- interpreted in the context of the current working directory.
-- The file is never preprocessed.
function Load_Definition_File
(N : File_Name_Type) return Source_File_Index;
-- Loads preprocessing definition file. Similar to Load_Source_File
-- except that this file is not itself preprocessed.
function Load_Preprocessing_Data_File
(N : File_Name_Type) return Source_File_Index;
-- Loads preprocessing data file. Similar to Load_Source_File except
-- that this file is not itself preprocessed.
procedure Complete_Source_File_Entry;
-- Called on completing the parsing of a source file. This call completes
-- the source file table entry for the current source file.
function Source_File_Is_Body (X : Source_File_Index) return Boolean;
-- Returns true if the designated source file contains a subprogram body
-- or a package body. This is a limited scan just to determine the answer
-- to this question.
function Source_File_Is_No_Body (X : Source_File_Index) return Boolean;
-- Returns true if the designated source file contains pragma No_Body;
-- and no other tokens. If the source file contains anything other than
-- this sequence of three tokens, then False is returned.
-------------------------------------------------
-- Subprograms for Dealing With Instantiations --
-------------------------------------------------
type Sloc_Adjustment is private;
-- Type returned by Create_Instantiation_Source for use in subsequent calls
-- to Adjust_Instantiation_Sloc.
procedure Adjust_Instantiation_Sloc
(N : Node_Id;
Factor : Sloc_Adjustment);
-- The instantiation tree is created by copying the tree of the generic
-- template (including the original Sloc values), and then applying
-- Adjust_Instantiation_Sloc to each copied node to adjust the Sloc to
-- reference the source entry for the instantiation.
procedure Create_Instantiation_Source
(Inst_Node : Entity_Id;
Template_Id : Entity_Id;
Factor : out Sloc_Adjustment;
Inlined_Body : Boolean := False;
Inherited_Pragma : Boolean := False);
-- This procedure creates the source table entry for an instantiation.
-- Inst_Node is the instantiation node, and Template_Id is the defining
-- identifier of the generic declaration or body unit as appropriate.
-- Factor is set to an adjustment factor to be used in subsequent calls to
-- Adjust_Instantiation_Sloc. Template_Id can also be a subunit body that
-- replaces a stub in a generic unit.
--
-- The instantiation mechanism is also used for inlined function and
-- procedure calls. The parameter Inlined_Body is set to True in such
-- cases. This is used for generating error messages that distinguish these
-- two cases, otherwise the two cases are handled identically. Similarly,
-- the instantiation mechanism is also used for inherited class-wide pre-
-- and postconditions. Parameter Inherited_Pragma is set to True in such
-- cases.
private
type Sloc_Adjustment is record
Adjust : Source_Ptr;
-- Adjustment factor. To be added to source location values in the
-- source table entry for the template to get corresponding sloc
-- values for the instantiation image of the template. This is not
-- really a Source_Ptr value, but rather an offset, but it is more
-- convenient to represent it as a Source_Ptr value and this is a
-- private type anyway.
Lo, Hi : Source_Ptr;
-- Lo and hi values to which adjustment factor can legitimately
-- be applied, used to ensure that no incorrect adjustments are
-- made. Really it is a bug if anyone ever tries to adjust outside
-- this range, but since we are only doing this anyway for getting
-- better error messages, it is not critical.
end record;
end Sinput.L;
|
likai3g/afmt | Ada | 4,902 | adb | with Interfaces;
package body Fmt.Generic_Decimal_Fixed_Point_Argument is
subtype uint64_t is Interfaces.Unsigned_64;
Scale : constant Long_Long_Integer := 10 ** Fixed_Point_Type'Scale;
To_Char : constant array(uint64_t range 0..9) of Character := "0123456789";
function To_Long_Long_Integer (X : Fixed_Point_Type) return Long_Long_Integer
is
use Interfaces;
begin
case Fixed_Point_Type'Size is
when 0 .. 8 =>
declare
i : Integer_8 with Address => X'Address;
begin
return Long_Long_Integer(i);
end;
when 9 .. 16 =>
declare
i : Integer_16 with Address => X'Address;
begin
return Long_Long_Integer(i);
end;
when 17 .. 32 =>
declare
i : Integer_32 with Address => X'Address;
begin
return Long_Long_Integer(i);
end;
when others =>
declare
i : Integer_64 with Address => X'Address;
begin
return Long_Long_Integer(i);
end;
end case;
end To_Long_Long_Integer;
function To_Argument (X : Fixed_Point_Type) return Argument_Type'Class
is
begin
return Fixed_Point_Argument_Type'(Value => X, others => <>);
end To_Argument;
function "&" (Args : Arguments; X : Fixed_Point_Type) return Arguments
is
begin
return Args & To_Argument(X);
end "&";
overriding
procedure Parse (Self : in out Fixed_Point_Argument_Type; Edit : String)
is
procedure Conf (K, V : String)
is
begin
if K'Length /= 1 or else V'Length = 0 then
return;
end if;
case K(K'First) is
when 'a' =>
if Is_Decimal_Number(V) then
Self.Aft := Natural'Value(V);
end if;
when 'w' =>
if Is_Decimal_Number(V) then
Self.Width := Natural'Value(V);
end if;
when others =>
null;
end case;
end Conf;
begin
Parse_KV_Edit(Edit, Conf'Access);
end Parse;
overriding
function Get_Length (Self : in out Fixed_Point_Argument_Type) return Natural
is
use Interfaces;
begin
if Self.Width /= 0 then
return Self.Width;
else
declare
X : constant Long_Long_Integer := To_Long_Long_Integer(Self.Value);
Y : Unsigned_64 := Safe_Abs(X);
L : Natural := 1 + Self.Aft;
begin
for I in 1 .. Self.Aft loop
exit when Y = 0;
Y := Y / 10;
end loop;
for I in 1 .. Self.Fore loop
Y := Y / 10;
L := L + 1;
exit when Y = 0;
end loop;
if X < 0 then
L := L + 1;
end if;
return L;
end;
end if;
end Get_Length;
overriding
procedure Put (
Self : in out Fixed_Point_Argument_Type;
Edit : String;
To : in out String)
is
use Interfaces;
T : constant Natural := To'Last + 1;
H : constant Natural := To'First;
X : constant Long_Long_Integer := To_Long_Long_Integer(Self.Value);
Y : Unsigned_64 := Safe_Abs(X);
L : Natural := To'Last;
A : Natural;
begin
-- output aft
-- if user defined aft > real aft, padding with 0
if Self.Aft > Fixed_Point_Type'Aft then
-- padding exceed aft with '0'
for I in Fixed_Point_Type'Aft + 1 .. Self.AFt loop
To(L) := '0';
L := L - 1;
if L < H then
return;
end if;
end loop;
A := Fixed_Point_Type'Aft;
else
-- skip invisiable digits
for I in Self.Aft + 1 .. Fixed_Point_Type'Aft loop
Y := Y / 10;
end loop;
A := Self.Aft;
end if;
for I in 1 .. A loop
To(L) := To_Char(Y mod 10);
Y := Y / 10;
L := L - 1;
if L < H then
return;
end if;
exit when Y = 0;
end loop;
-- output decimal point
To(L) := '.';
L := L - 1;
if L < H then
return;
end if;
-- output fore
for I in Natural range 1 .. Self.Fore loop
To(L) := To_Char(Y mod 10);
Y := Y / 10;
L := L - 1;
if L < H then
return;
end if;
exit when Y = 0;
end loop;
-- output sign
if L < H then
return;
end if;
if X < 0 then
To(L) := '-';
L := L - 1;
end if;
if L >= To'First then
To(To'First .. L) := (others => Self.Fill);
end if;
end Put;
end Fmt.Generic_Decimal_Fixed_Point_Argument;
|
AdaCore/Ada_Drivers_Library | Ada | 4,054 | ads | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with HAL; use HAL;
with HAL.Time;
package MicroBit.Time is
subtype Time_Ms is UInt64;
function Clock return Time_Ms;
procedure Delay_Ms (Milliseconds : UInt64);
procedure Sleep (Milliseconds : UInt64) renames Delay_Ms;
function Tick_Period return Time_Ms;
type Tick_Callback is access procedure;
function Tick_Subscriber (Callback : not null Tick_Callback) return Boolean;
-- Return True if callback is already a tick event subscriber
function Tick_Subscribe (Callback : not null Tick_Callback) return Boolean
with Pre => not Tick_Subscriber (Callback),
Post => (if Tick_Subscribe'Result then Tick_Subscriber (Callback));
-- Subscribe a callback to the tick event. The function return True on
-- success, False if there's no more room for subscribers.
function Tick_Unsubscribe (Callback : not null Tick_Callback) return Boolean
with Pre => Tick_Subscriber (Callback),
Post => (if Tick_Unsubscribe'Result then not Tick_Subscriber (Callback));
-- Unsubscribe a callback to the tick event. The function return True on
-- success, False if the callback was not a subscriber.
function HAL_Delay return not null HAL.Time.Any_Delays;
private
type MB_Delays is new HAL.Time.Delays with null record;
overriding
procedure Delay_Microseconds (This : in out MB_Delays;
Us : Integer);
overriding
procedure Delay_Milliseconds (This : in out MB_Delays;
Ms : Integer);
overriding
procedure Delay_Seconds (This : in out MB_Delays;
S : Integer);
end MicroBit.Time;
|
stcarrez/ada-util | Ada | 2,289 | ads | -- Generated by utildgen.c from system includes
with Interfaces.C;
package Util.Systems.Types is
subtype dev_t is Long_Long_Integer;
subtype ino_t is Long_Long_Integer;
subtype off_t is Long_Long_Integer;
subtype blksize_t is Interfaces.C.int;
subtype blkcnt_t is Long_Long_Integer;
subtype uid_t is Interfaces.C.unsigned;
subtype gid_t is Interfaces.C.unsigned;
subtype nlink_t is Interfaces.C.unsigned;
subtype mode_t is Interfaces.C.unsigned;
S_IFMT : constant mode_t := 8#00170000#;
S_IFDIR : constant mode_t := 8#00040000#;
S_IFCHR : constant mode_t := 8#00020000#;
S_IFBLK : constant mode_t := 8#00060000#;
S_IFREG : constant mode_t := 8#00100000#;
S_IFIFO : constant mode_t := 8#00010000#;
S_IFLNK : constant mode_t := 8#00120000#;
S_IFSOCK : constant mode_t := 8#00140000#;
S_ISUID : constant mode_t := 8#00004000#;
S_ISGID : constant mode_t := 8#00002000#;
S_IREAD : constant mode_t := 8#00000400#;
S_IWRITE : constant mode_t := 8#00000200#;
S_IEXEC : constant mode_t := 8#00000100#;
type File_Type is new Interfaces.C.int;
subtype Time_Type is Long_Long_Integer;
type Timespec is record
tv_sec : Time_Type;
tv_nsec : Interfaces.C.int;
end record;
pragma Convention (C_Pass_By_Copy, Timespec);
type Seek_Mode is (SEEK_SET, SEEK_CUR, SEEK_END);
for Seek_Mode use (SEEK_SET => 0, SEEK_CUR => 1, SEEK_END => 2);
STAT_NAME : constant String := "__stat50";
FSTAT_NAME : constant String := "__fstat50";
LSTAT_NAME : constant String := "__lstat50";
type Stat_Type is record
st_dev : dev_t;
st_mode : mode_t;
st_ino : ino_t;
st_nlink : nlink_t;
st_uid : uid_t;
st_gid : gid_t;
st_rdev : dev_t;
st_atim : Timespec;
st_mtim : Timespec;
st_ctim : Timespec;
st_birthtime : Timespec;
st_size : off_t;
st_blocks : blkcnt_t;
st_blksize : blksize_t;
st_flags : Interfaces.C.unsigned;
st_gen : Interfaces.C.unsigned;
st_spare1 : Interfaces.C.unsigned;
st_spare2 : Interfaces.C.unsigned;
end record;
pragma Convention (C_Pass_By_Copy, Stat_Type);
end Util.Systems.Types;
|
charlie5/cBound | Ada | 1,395 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces.C;
with xcb.xcb_point_t;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_point_iterator_t is
-- Item
--
type Item is record
data : access xcb.xcb_point_t.Item;
the_rem : aliased Interfaces.C.int;
index : aliased Interfaces.C.int;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C.size_t range <>) of aliased xcb.xcb_point_iterator_t.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_point_iterator_t.Item,
Element_Array => xcb.xcb_point_iterator_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_point_iterator_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_point_iterator_t.Pointer,
Element_Array => xcb.xcb_point_iterator_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_point_iterator_t;
|
micahwelf/FLTK-Ada | Ada | 831 | ads |
package FLTK.Widgets.Valuators.Dials.Fill is
type Fill_Dial is new Dial with private;
type Fill_Dial_Reference (Data : not null access Fill_Dial'Class) is
limited null record with Implicit_Dereference => Data;
package Forge is
function Create
(X, Y, W, H : in Integer;
Text : in String)
return Fill_Dial;
end Forge;
procedure Draw
(This : in out Fill_Dial);
function Handle
(This : in out Fill_Dial;
Event : in Event_Kind)
return Event_Outcome;
private
type Fill_Dial is new Dial with null record;
overriding procedure Finalize
(This : in out Fill_Dial);
pragma Inline (Draw);
pragma Inline (Handle);
end FLTK.Widgets.Valuators.Dials.Fill;
|
Asier98/AdaCar | Ada | 1,461 | adb | with Ada.Real_Time; use type Ada.Real_Time.Time; use Ada;
with AdaCar.Parametros;
package body AdaCar.Alarmas is
type Lista_Alarmas is array(Tipo_Alarmas) of Estado_Alarma;
protected Alarmas_PO
with Priority => Parametros.Techo_Alarmas_PO
is
procedure Notificar_Alarma(Alarma: Tipo_Alarmas);
function Leer_Listado_Alarmas return Lista_Alarmas;
private
Listado_Alarmas: Lista_Alarmas:= (Tipo_Alarmas'Range=>
Estado_Alarma'(Desactivada));
end Alarmas_PO;
----------------------
-- Notificar_Alarma --
----------------------
procedure Notificar_Alarma (Alarma : Tipo_Alarmas) is
begin
Alarmas_PO.Notificar_Alarma(Alarma);
end Notificar_Alarma;
task Alarmas_Task with Priority => Parametros.Prioridad_Alarmas_Task;
protected body Alarmas_PO is
procedure Notificar_Alarma(Alarma: Tipo_Alarmas) is
begin
Listado_Alarmas(Alarma):= Estado_Alarma'(Activada);
end Notificar_Alarma;
function Leer_Listado_Alarmas return Lista_Alarmas is
begin
return Listado_Alarmas;
end Leer_Listado_Alarmas;
end Alarmas_PO;
task body Alarmas_Task is
Tseg: constant Duration:= Parametros.Periodo_Alarmas_Task;
Periodo: constant Real_Time.Time_Span:= Real_Time.To_Time_Span(Tseg);
Next: Real_Time.Time:= Real_Time.Clock;
begin
null;
end Alarmas_Task;
end AdaCar.Alarmas;
|
damaki/SPARKNaCl | Ada | 5,327 | adb | with SPARKNaCl; use SPARKNaCl;
with SPARKNaCl.Core; use SPARKNaCl.Core;
with SPARKNaCl.Debug; use SPARKNaCl.Debug;
with SPARKNaCl.Secretbox; use SPARKNaCl.Secretbox;
with SPARKNaCl.Stream;
with Ada.Text_IO; use Ada.Text_IO;
procedure Secretbox10
is
--------------------------------------------------------
-- Test Cases from RFC 8439
--------------------------------------------------------
-- Case 1: Message encryption and generation of tag
-- From RFC 8439 section 2.8.2
Key_1 : constant Core.ChaCha20_Key := Construct ((
16#80#, 16#81#, 16#82#, 16#83#, 16#84#, 16#85#, 16#86#, 16#87#,
16#88#, 16#89#, 16#8a#, 16#8b#, 16#8c#, 16#8d#, 16#8e#, 16#8f#,
16#90#, 16#91#, 16#92#, 16#93#, 16#94#, 16#95#, 16#96#, 16#97#,
16#98#, 16#99#, 16#9a#, 16#9b#, 16#9c#, 16#9d#, 16#9e#, 16#9f#
));
-- In AEAD, nonce := constant & iv
-- constant: 07 00 00 00
-- IV: 40 41 42 43 44 45 46 47
Nonce_1 : constant Core.ChaCha20_IETF_Nonce := (
16#07#, 16#00#, 16#00#, 16#00#, 16#40#, 16#41#, 16#42#, 16#43#,
16#44#, 16#45#, 16#46#, 16#47#);
M_1 : constant Byte_Seq (0 .. 113) := SPARKNaCl.To_Byte_Seq (
"Ladies and Gentlemen of the class of '99: If I could offer you only" &
" one tip for the future, sunscreen would be it.");
AAD_1 : Byte_Seq := (
16#50#, 16#51#, 16#52#, 16#53#, 16#C0#, 16#C1#, 16#C2#, 16#C3#,
16#C4#, 16#C5#, 16#C6#, 16#C7#);
C_1 : Byte_Seq (0 .. 113);
T_1 : Bytes_16;
-- Case 2: Verification of tag and message decryption
-- From RFC 8439 section A.5
Key_2 : constant Core.ChaCha20_Key := Construct ((
16#1C#, 16#92#, 16#40#, 16#A5#, 16#EB#, 16#55#, 16#D3#, 16#8A#,
16#F3#, 16#33#, 16#88#, 16#86#, 16#04#, 16#F6#, 16#B5#, 16#F0#,
16#47#, 16#39#, 16#17#, 16#C1#, 16#40#, 16#2B#, 16#80#, 16#09#,
16#9D#, 16#CA#, 16#5C#, 16#BC#, 16#20#, 16#70#, 16#75#, 16#C0#
));
C_2 : constant Byte_Seq := (
16#64#, 16#A0#, 16#86#, 16#15#, 16#75#, 16#86#, 16#1A#, 16#F4#,
16#60#, 16#F0#, 16#62#, 16#C7#, 16#9B#, 16#E6#, 16#43#, 16#BD#,
16#5E#, 16#80#, 16#5C#, 16#FD#, 16#34#, 16#5C#, 16#F3#, 16#89#,
16#F1#, 16#08#, 16#67#, 16#0A#, 16#C7#, 16#6C#, 16#8C#, 16#B2#,
16#4C#, 16#6C#, 16#FC#, 16#18#, 16#75#, 16#5D#, 16#43#, 16#EE#,
16#A0#, 16#9E#, 16#E9#, 16#4E#, 16#38#, 16#2D#, 16#26#, 16#B0#,
16#BD#, 16#B7#, 16#B7#, 16#3C#, 16#32#, 16#1B#, 16#01#, 16#00#,
16#D4#, 16#F0#, 16#3B#, 16#7F#, 16#35#, 16#58#, 16#94#, 16#CF#,
16#33#, 16#2F#, 16#83#, 16#0E#, 16#71#, 16#0B#, 16#97#, 16#CE#,
16#98#, 16#C8#, 16#A8#, 16#4A#, 16#BD#, 16#0B#, 16#94#, 16#81#,
16#14#, 16#AD#, 16#17#, 16#6E#, 16#00#, 16#8D#, 16#33#, 16#BD#,
16#60#, 16#F9#, 16#82#, 16#B1#, 16#FF#, 16#37#, 16#C8#, 16#55#,
16#97#, 16#97#, 16#A0#, 16#6E#, 16#F4#, 16#F0#, 16#EF#, 16#61#,
16#C1#, 16#86#, 16#32#, 16#4E#, 16#2B#, 16#35#, 16#06#, 16#38#,
16#36#, 16#06#, 16#90#, 16#7B#, 16#6A#, 16#7C#, 16#02#, 16#B0#,
16#F9#, 16#F6#, 16#15#, 16#7B#, 16#53#, 16#C8#, 16#67#, 16#E4#,
16#B9#, 16#16#, 16#6C#, 16#76#, 16#7B#, 16#80#, 16#4D#, 16#46#,
16#A5#, 16#9B#, 16#52#, 16#16#, 16#CD#, 16#E7#, 16#A4#, 16#E9#,
16#90#, 16#40#, 16#C5#, 16#A4#, 16#04#, 16#33#, 16#22#, 16#5E#,
16#E2#, 16#82#, 16#A1#, 16#B0#, 16#A0#, 16#6C#, 16#52#, 16#3E#,
16#AF#, 16#45#, 16#34#, 16#D7#, 16#F8#, 16#3F#, 16#A1#, 16#15#,
16#5B#, 16#00#, 16#47#, 16#71#, 16#8C#, 16#BC#, 16#54#, 16#6A#,
16#0D#, 16#07#, 16#2B#, 16#04#, 16#B3#, 16#56#, 16#4E#, 16#EA#,
16#1B#, 16#42#, 16#22#, 16#73#, 16#F5#, 16#48#, 16#27#, 16#1A#,
16#0B#, 16#B2#, 16#31#, 16#60#, 16#53#, 16#FA#, 16#76#, 16#99#,
16#19#, 16#55#, 16#EB#, 16#D6#, 16#31#, 16#59#, 16#43#, 16#4E#,
16#CE#, 16#BB#, 16#4E#, 16#46#, 16#6D#, 16#AE#, 16#5A#, 16#10#,
16#73#, 16#A6#, 16#72#, 16#76#, 16#27#, 16#09#, 16#7A#, 16#10#,
16#49#, 16#E6#, 16#17#, 16#D9#, 16#1D#, 16#36#, 16#10#, 16#94#,
16#FA#, 16#68#, 16#F0#, 16#FF#, 16#77#, 16#98#, 16#71#, 16#30#,
16#30#, 16#5B#, 16#EA#, 16#BA#, 16#2E#, 16#DA#, 16#04#, 16#DF#,
16#99#, 16#7B#, 16#71#, 16#4D#, 16#6C#, 16#6F#, 16#2C#, 16#29#,
16#A6#, 16#AD#, 16#5C#, 16#B4#, 16#02#, 16#2B#, 16#02#, 16#70#,
16#9B# );
N_2 : constant Core.ChaCha20_IETF_Nonce := (
16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#02#, 16#03#, 16#04#,
16#05#, 16#06#, 16#07#, 16#08#
);
AAD_2 : constant Byte_Seq := (
16#F3#, 16#33#, 16#88#, 16#86#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#4E#, 16#91#
);
Tag_2 : constant Byte_Seq := (
16#EE#, 16#AD#, 16#9D#, 16#67#, 16#89#, 16#0C#, 16#BB#, 16#22#,
16#39#, 16#23#, 16#36#, 16#FE#, 16#A1#, 16#85#, 16#1F#, 16#38#
);
-- Test tag verification (not part of the RFC test suite)
Bad_Tag_2 : constant Bytes_16 := (others => 16#AA#);
M_2 : Byte_Seq (C_2'Range);
S_2 : Boolean;
begin
Create (C_1, T_1, M_1, Nonce_1, Key_1, AAD_1);
DH ("C_1 is", C_1);
DH ("T_1 is", T_1);
Open (M_2, S_2, Tag_2, C_2, N_2, Key_2, AAD_2);
Ada.Text_IO.Put_Line ("Verified: " & S_2'Image);
DH ("M_2 is", M_2);
Open (M_2, S_2, Bad_Tag_2, C_2, N_2, Key_2, AAD_2);
Ada.Text_IO.Put_Line ("Verified: " & S_2'Image);
end Secretbox10;
|
AdaCore/gpr | Ada | 73 | adb | -- unix version
package body Pck is
procedure Call is null;
end Pck;
|
tum-ei-rcs/StratoX | Ada | 8,566 | ads | -- Generic Kalman Filter Package
-- Author: Emanuel Regnath ([email protected])
with Ada.Real_Time;
with Units; use Units;
with Units.Vectors; use Units.Vectors;
with Units.Navigation; use Units.Navigation;
package Kalman with
SPARK_Mode,
Abstract_State => State
is
-- the states: everything that needs to be estimated for a solution
type State_Vector_Index_Name_Type is
( X_LON,
X_LAT,
X_ALT,
X_GROUND_SPEED_X, -- NORTH => + lat
X_GROUND_SPEED_Y, -- EAST => + lon
X_GROUND_SPEED_Z, -- DOWN => - alt
X_ROLL,
X_PITCH,
X_YAW,
X_ROLL_RATE,
X_PITCH_RATE,
X_YAW_RATE,
X_ROLL_BIAS,
X_PITCH_BIAS,
X_YAW_BIAS,
X_AIR_SPEED_X,
X_AIR_SPEED_Y,
X_AIR_SPEED_Z
);
subtype State_Vector_Index_Type is Natural range 1 .. State_Vector_Index_Name_Type'Range_Length;
type State_Vector is record -- 16 states
pos : GPS_Loacation_Type;
ground_speed : Linear_Velocity_Vector;
orientation : Orientation_Type;
rates : Angular_Velocity_Vector;
bias : Angular_Velocity_Vector;
air_speed : Linear_Velocity_Vector;
end record;
-- the inputs: everything that you can control
type Input_Vector_Index_Name_Type is
( U_ELEVATOR,
U_AILERON
--U_RUDDER
);
subtype Input_Vector_Index_Type is Natural range 1 .. Input_Vector_Index_Name_Type'Range_Length;
type Input_Vector is record
Elevator : Angle_Type;
Aileron : Angle_Type;
--Rudder : Angle_Type;
end record;
-- the observations: everything that can be observed
type Observation_Vector_Index_Name_Type is
( Z_LON,
Z_LAT,
Z_ALT,
Z_BARO_ALT,
Z_ROLL,
Z_PITCH,
Z_YAW,
Z_ROLL_RATE,
Z_PITCH_RATE,
Z_YAW_RATE,
Z_ACC_LENGTH
);
subtype Observation_Vector_Index_Type is Natural range 1 .. Observation_Vector_Index_Name_Type'Range_Length;
type Observation_Vector is record
gps_pos : GPS_Loacation_Type;
baro_alt : Altitude_Type;
acc_ori : Orientation_Type;
gyr_rates : Angular_Velocity_Vector;
acc_length : Linear_Acceleration_Type;
--mag_ori : Magnetic_Flux_Density_Vector;
end record;
-- Kalman Equations
-- 1. predict
-- x = Ax + Bu
-- P = APA' + Q
--
-- 2. update
-- y = z - Hx
-- S = HPH' + R
-- K = PH' / S
-- x = x + Ky'
-- P = (1 - KH)P
-- Sensor Fusion:
-- 1. Each time a new measurement becomes available a new estimate will be computed z_i, H_i
-- 2. observation matrix with M lines for M sensors
-- 3. Calculate Mean
function map( index : State_Vector_Index_Name_Type ) return State_Vector_Index_Type is
( State_Vector_Index_Type( State_Vector_Index_Name_Type'Pos( index ) + 1 ) );
function map( index : Input_Vector_Index_Name_Type ) return Input_Vector_Index_Type is
( Input_Vector_Index_Type( Input_Vector_Index_Name_Type'Pos( index ) + 1 ) );
function map( index : Observation_Vector_Index_Name_Type ) return Observation_Vector_Index_Type is
( Observation_Vector_Index_Type( Observation_Vector_Index_Name_Type'Pos( index ) + 1 ) );
-- k states, l inputs, m observations
--type kk_Matrix is array( 1 .. k, 1 .. k ) of Float;
subtype kk_Matrix is Unit_Matrix( State_Vector_Index_Type, State_Vector_Index_Type);
subtype kl_Matrix is Unit_Matrix( State_Vector_Index_Type, Input_Vector_Index_Type);
subtype mk_Matrix is Unit_Matrix( Observation_Vector_Index_Type, State_Vector_Index_Type);
subtype km_Matrix is Unit_Matrix( State_Vector_Index_Type, Observation_Vector_Index_Type);
subtype mm_Matrix is Unit_Matrix( Observation_Vector_Index_Type, Observation_Vector_Index_Type);
subtype State_Transition_Matrix is kk_Matrix;
subtype Input_Transition_Matrix is kl_Matrix;
subtype Observation_Transition_Matrix is mk_Matrix;
subtype State_Covariance_Matrix is kk_Matrix;
-- is record
-- orientation : Unit_Matrix3D;
-- rates : Unit_Matrix3D;
-- end record;
type Innovation_Vector is record
delta_gps_pos : GPS_Translation_Type;
delta_baro_alt : Altitude_Type;
delta_acc_ori : Rotation_Vector;
delta_gyr_rates : Angular_Velocity_Vector;
end record;
subtype Innovation_Covariance_Matrix is mm_Matrix;
subtype Kalman_Gain_Matrix is km_Matrix;
subtype State_Noise_Covariance_Matrix is kk_Matrix;
subtype Observation_Noise_Covariance_Matrix is mm_Matrix;
DEFAULT_INIT_STATES : State_Vector := ( pos => (0.0*Degree, 0.0*Degree, 0.0*Meter),
ground_speed => (0.0*Meter/Second, 0.0*Meter/Second, 0.0*Meter/Second),
orientation => (0.0*Degree, 0.0*Degree, 0.0*Degree),
rates => (0.0*Degree/Second, 0.0*Degree/Second, 0.0*Degree/Second),
bias => (0.0*Degree/Second, 0.0*Degree/Second, 0.0*Degree/Second),
air_speed => (0.0*Meter/Second, 0.0*Meter/Second, 0.0*Meter/Second) );
procedure reset( init_states : State_Vector := DEFAULT_INIT_STATES );
-- perform one full cycle (predict & update)
procedure perform_Filter_Step( u : in Input_Vector; z : in Observation_Vector );
-- 1. step
procedure predict( u : in Input_Vector; dt : Time_Type);
-- 2. step
procedure update( z : in Observation_Vector; dt : Time_Type );
-- get the estimated states
function get_States return State_Vector;
private
-- Prediction
procedure predict_state( state : in out State_Vector; input : Input_Vector; dt : Time_Type );
procedure predict_cov( P : in out State_Covariance_Matrix; Q : State_Noise_Covariance_Matrix );
-- Update
-- estimates the covariance of the accelerometer. If the length of the
-- acceleration vector deviates from the gravity vector length the sensor
-- is subject to additional forces and we should increase the assumed
-- measurement variance (less trust)
procedure estimate_observation_noise_cov( R : in out Observation_Noise_Covariance_Matrix;
states : State_Vector;
samples : Observation_Vector
);
procedure calculate_gain( states : State_Vector;
samples : Observation_Vector;
dt : Time_Type;
K : out Kalman_Gain_Matrix;
residual : out Innovation_Vector);
procedure uptate_state( states : in out State_Vector;
K : Kalman_Gain_Matrix;
residual : Innovation_Vector;
dt : Time_Type );
procedure update_cov( P : in out State_Covariance_Matrix; K : Kalman_Gain_Matrix );
function "-"(Left, Right : Observation_Vector) return Innovation_Vector;
-- calculate the jacobi matrix of the dynamic state model
procedure calculate_A( A : out State_Transition_Matrix; dt : Time_Type );
-- input2state, state, A, Au PHP
-- function State_Prediction( u : Input_Vector; dt : Time_Type ) return State_Vector;
-- function State_Prediction( x : State_Vector; dt : Time_Type ) return State_Vector;
-- function Observation_Prediction( x : State_Vector; dt : Time_Type ) return Observation_Vector;
--
--
-- function Cov_Prediction( P : State_Covariance_Matrix; dt : Time_Type);
-- function Cov_Innovation( P : State_Covariance_Matrix; dt : Time_Type);
--
-- Matrix calculations
-- function "*"( A : State_Transition_Matrix; x : State_Vector ) return State_Vector;
-- function "*"( B : Input_Transition_Matrix; u : Input_Vector ) return State_Vector;
-- function "+"( Left : State_Vector; Right : State_Vector) return State_Vector;
--
-- function "*"( Left : State_Transition_Matrix; Right : State_Covariance_Matrix) return State_Covariance_Matrix;
--
-- function "*"( Left : Observation_Transition_Matrix; Right : State_Vector) return Observation_Vector;
-- function "-"( Left : Observation_Vector; Right : Observation_Vector) return Observation_Vector;
end Kalman;
|
alynnefs/STRTF | Ada | 1,582 | adb | With Ada.Integer_Text_IO, Ada.Text_IO, Ada.Calendar;
Use Ada.Integer_Text_IO, Ada.Text_IO, Ada.Calendar;
procedure trabalho04 is
X:Integer;
indice: Integer:= 1;
i: Integer:= 1;
flag1: Integer:=1; -- flag para Mostra1
flag2: Integer:=0; -- flag para Mostra2
flag3: Integer:=0; -- flag para Mostra
vetor: array(1..30) of Character;
task type Mostra1 is
--entry mostra(Item: in Integer);
end Mostra1;
task body Mostra1 is
begin
delay 2.0;
while indice < 29 loop
while flag1 = 0 loop
X:=X+1; -- só para não deixar em branco
end loop;
vetor(indice):='a';
indice:=indice+1;
flag1:=0;
flag2:=1;
end loop;
end Mostra1;
task type Mostra2 is
-- entry mostra(Item: in Integer);
end Mostra2;
task body Mostra2 is
begin
delay 2.0;
while indice < 30 loop
while flag2 = 0 loop
X:=X+1; -- só para não deixar em branco
end loop;
vetor(indice):='b';
indice:=indice+1;
flag2:=0;
flag3:=1;
end loop;
end Mostra2;
task type Mostra3 is
--entry mostra(Item: in Integer);
end Mostra3;
task body Mostra3 is
begin
delay 2.0;
while indice < 31 loop
while flag3 = 0 loop
X:=X+1; -- só para não deixar em branco
end loop;
vetor(indice):='c';
indice:=indice+1;
flag3:=0;
flag1:=1;
end loop;
for i in 1..30 loop
Put(vetor(i));
end loop;
end Mostra3;
A : Mostra1;
B : Mostra2;
C : Mostra3;
begin
null;
end trabalho04;
|
reznikmm/matreshka | Ada | 7,320 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Text.Alphabetical_Index_Auto_Mark_File_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Text_Alphabetical_Index_Auto_Mark_File_Element_Node is
begin
return Self : Text_Alphabetical_Index_Auto_Mark_File_Element_Node do
Matreshka.ODF_Text.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Text_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Text_Alphabetical_Index_Auto_Mark_File_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Text_Alphabetical_Index_Auto_Mark_File
(ODF.DOM.Text_Alphabetical_Index_Auto_Mark_File_Elements.ODF_Text_Alphabetical_Index_Auto_Mark_File_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Text_Alphabetical_Index_Auto_Mark_File_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Alphabetical_Index_Auto_Mark_File_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Text_Alphabetical_Index_Auto_Mark_File_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Text_Alphabetical_Index_Auto_Mark_File
(ODF.DOM.Text_Alphabetical_Index_Auto_Mark_File_Elements.ODF_Text_Alphabetical_Index_Auto_Mark_File_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Text_Alphabetical_Index_Auto_Mark_File_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Text_Alphabetical_Index_Auto_Mark_File
(Visitor,
ODF.DOM.Text_Alphabetical_Index_Auto_Mark_File_Elements.ODF_Text_Alphabetical_Index_Auto_Mark_File_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Text_URI,
Matreshka.ODF_String_Constants.Alphabetical_Index_Auto_Mark_File_Element,
Text_Alphabetical_Index_Auto_Mark_File_Element_Node'Tag);
end Matreshka.ODF_Text.Alphabetical_Index_Auto_Mark_File_Elements;
|
damaki/libkeccak | Ada | 2,582 | ads | -------------------------------------------------------------------------------
-- Copyright (c) 2019, Daniel King
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
-- * Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * The name of the copyright holder may not be used to endorse or promote
-- Products derived from this software without specific prior written
-- permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------
with Keccak.Generic_KeccakF;
with Keccak.Generic_KeccakF.Bit_Lanes;
with Keccak.Generic_KeccakF.Lane_Complementing_Permutation;
with Keccak.Types;
pragma Elaborate_All (Keccak.Generic_KeccakF);
pragma Elaborate_All (Keccak.Generic_KeccakF.Bit_Lanes);
pragma Elaborate_All (Keccak.Generic_KeccakF.Lane_Complementing_Permutation);
-- @summary
-- Instantiation of Keccak with a state size of 50 bits (2-bit lanes).
package Keccak.Keccak_50
with SPARK_Mode => On
is
package KeccakF_50 is new Keccak.Generic_KeccakF
(Lane_Size_Log => 1,
Lane_Type => Keccak.Types.Unsigned_2);
subtype State is KeccakF_50.Lane_Complemented_State;
package KeccakF_50_Permutation is new KeccakF_50.Lane_Complementing_Permutation
(Rotate_Left => Keccak.Types.Rotate_Left_2);
package KeccakF_50_Lanes is new KeccakF_50.Bit_Lanes;
end Keccak.Keccak_50;
|
AdaCore/libadalang | Ada | 507 | adb | procedure Main is
type R is record
X : Integer;
end record;
type R_Access is access all R;
X : R;
I : Integer;
begin
I := R'Size;
pragma Test_Statement;
I := X'Size;
pragma Test_Statement;
I := R'Object_Size;
pragma Test_Statement;
I := R'Value_Size;
pragma Test_Statement;
I := R'Max_Size_In_Storage_Elements;
pragma Test_Statement;
I := R'VADS_Size;
pragma Test_Statement;
I := R_Access'Storage_Size;
pragma Test_Statement;
end Main;
|
reznikmm/matreshka | Ada | 8,793 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013-2020, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
package body Matreshka.JSON_Types is
-----------------
-- Dereference --
-----------------
procedure Dereference (Self : in out Shared_JSON_Array_Access) is
procedure Free is
new Ada.Unchecked_Deallocation
(Shared_JSON_Array, Shared_JSON_Array_Access);
begin
if Self /= Empty_Shared_JSON_Array'Access
and then Matreshka.Atomics.Counters.Decrement (Self.Counter)
then
for Value of Self.Values loop
Dereference (Value);
end loop;
Free (Self);
else
Self := null;
end if;
end Dereference;
-----------------
-- Dereference --
-----------------
procedure Dereference (Self : in out Shared_JSON_Object_Access) is
procedure Free is
new Ada.Unchecked_Deallocation
(Shared_JSON_Object, Shared_JSON_Object_Access);
begin
if Self /= Empty_Shared_JSON_Object'Access
and then Matreshka.Atomics.Counters.Decrement (Self.Counter)
then
for Value of Self.Values loop
Dereference (Value);
end loop;
Free (Self);
else
Self := null;
end if;
end Dereference;
-----------------
-- Dereference --
-----------------
procedure Dereference (Self : in out Shared_JSON_Value_Access) is
procedure Free is
new Ada.Unchecked_Deallocation
(Shared_JSON_Value, Shared_JSON_Value_Access);
begin
if Self /= Empty_Shared_JSON_Value'Access
and then Self /= Null_Shared_JSON_Value'Access
and then Matreshka.Atomics.Counters.Decrement (Self.Counter)
then
case Self.Value.Kind is
when Empty_Value =>
null;
when Boolean_Value =>
null;
when Integer_Value =>
null;
when Float_Value =>
null;
when String_Value =>
Matreshka.Internals.Strings.Dereference (Self.Value.String_Value);
when Array_Value =>
Dereference (Self.Value.Array_Value);
when Object_Value =>
Dereference (Self.Value.Object_Value);
when Null_Value =>
null;
end case;
Free (Self);
else
Self := null;
end if;
end Dereference;
------------
-- Mutate --
------------
procedure Mutate (Self : in out not null Shared_JSON_Array_Access) is
Source : Shared_JSON_Array_Access := Self;
begin
if Self = Empty_Shared_JSON_Array'Access
or else not Matreshka.Atomics.Counters.Is_One (Self.Counter)
then
Self :=
new Shared_JSON_Array'(Counter => <>, Values => Source.Values);
-- Update reference counters for values.
for Value of Self.Values loop
Reference (Value);
end loop;
-- Release source shared object.
Dereference (Source);
end if;
end Mutate;
------------
-- Mutate --
------------
procedure Mutate (Self : in out not null Shared_JSON_Object_Access) is
Source : Shared_JSON_Object_Access := Self;
begin
if Self = Empty_Shared_JSON_Object'Access
or else not Matreshka.Atomics.Counters.Is_One (Self.Counter)
then
Self :=
new Shared_JSON_Object'(Counter => <>, Values => Source.Values);
-- Update reference counters for values.
for Value of Self.Values loop
Reference (Value);
end loop;
-- Release source shared object.
Dereference (Source);
end if;
end Mutate;
------------
-- Mutate --
------------
procedure Mutate (Self : in out not null Shared_JSON_Value_Access) is
begin
-- Mutate object: new shared object is allocated when reference counter
-- is greater than one, reference counter of original object is
-- decremented and original value is copied. Otherwise, shared object is
-- unchanged.
null;
end Mutate;
------------
-- Mutate --
------------
procedure Mutate
(Self : in out not null Shared_JSON_Value_Access;
Kind : Value_Kinds) is
begin
-- Mutate object: allocate new shared then reference counter is greater
-- than one, and decrement reference counter of original object. Value
-- of the object is reset to default value of specifid kind.
null;
end Mutate;
---------------
-- Reference --
---------------
procedure Reference (Self : not null Shared_JSON_Array_Access) is
begin
if Self /= Empty_Shared_JSON_Array'Access then
Matreshka.Atomics.Counters.Increment (Self.Counter);
end if;
end Reference;
---------------
-- Reference --
---------------
procedure Reference (Self : not null Shared_JSON_Object_Access) is
begin
if Self /= Empty_Shared_JSON_Object'Access then
Matreshka.Atomics.Counters.Increment (Self.Counter);
end if;
end Reference;
---------------
-- Reference --
---------------
procedure Reference (Self : not null Shared_JSON_Value_Access) is
begin
if Self /= Empty_Shared_JSON_Value'Access
and Self /= Null_Shared_JSON_Value'Access
then
Matreshka.Atomics.Counters.Increment (Self.Counter);
end if;
end Reference;
end Matreshka.JSON_Types;
|
Lucretia/pc_tut | Ada | 2,464 | ads | with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Containers.Doubly_Linked_Lists;
with Ada.Containers.Indefinite_Doubly_Linked_Lists;
with Ada.Containers.Indefinite_Holders;
package Parsing is
package Char_List is new Ada.Containers.Indefinite_Doubly_Linked_Lists (Element_Type => Character);
package List_Of_Char_Lists is new Ada.Containers.Doubly_Linked_Lists (Element_Type => Char_List.List, "=" => Char_List."=");
type Result is interface;
type Failure is new Result with record
Message : Ada.Strings.Unbounded.Unbounded_String;
end record;
type Success is new Result with record
Matched : List_Of_Char_Lists.List;
Remaining : Ada.Strings.Unbounded.Unbounded_String;
end record;
type Root_Parser is interface;
function Parse (Parser : in Root_Parser; Input : in String) return Result'Class is abstract;
package PH is new Ada.Containers.Indefinite_Holders (Element_Type => Root_Parser'Class);
type Holder is new PH.Holder with null record;
type Parse_Character (Match : Character) is new Root_Parser with null record;
function Parse (Parser : in Parse_Character; Input : in String) return Result'Class;
type Parse_Character_Range (Match_From, Match_To : Character) is new Root_Parser with null record;
function Parse (Parser : in Parse_Character_Range; Input : in String) return Result'Class;
type Parse_And_Then is new Root_Parser with record
Parser_A, Parser_B : Holder;
end record;
function Parse (Parser : in Parse_And_Then; Input : in String) return Result'Class;
type Parse_Or_Else is new Root_Parser with record
Parser_A, Parser_B : Holder;
end record;
function Parse (Parser : in Parse_Or_Else; Input : in String) return Result'Class;
-- Creators
function Character_Parser (Match : Character) return Holder is (To_Holder (Parse_Character'(Match => Match)));
function Character_Parser (Match_From, Match_To : Character) return Holder is
(To_Holder (Parse_Character_Range'(Match_From => Match_From, Match_To => Match_To)));
-- These have to go into a child packae as we cannot dispatch on multiple tagged types.
package Operators is
function "or" (Parser_A, Parser_B : Holder) return Parse_Or_Else is (Parse_Or_Else'(Parser_A, Parser_B));
function "and" (Parser_A, Parser_B : Holder) return Parse_And_Then is (Parse_And_Then'(Parser_A, Parser_B));
end Operators;
end Parsing;
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.