repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
msrLi/portingSources | Ada | 949 | ads | -- Copyright 2012-2014 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with System;
package Pck is
type Char_Table is array (Character range Character'First .. Character'Last)
of Natural;
Global_Char_Table : Char_Table := (others => 0);
procedure Do_Nothing (A : System.Address);
end Pck;
|
tum-ei-rcs/StratoX | Ada | 12,835 | 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 STMicroelectronics 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 file is based on: --
-- --
-- @file stm32f7xx_hal_sai.h --
-- @author MCD Application Team --
-- @version V1.0.2 --
-- @date 21-September-2015 --
-- @brief This file provides firmware functions to manage the following --
-- functionalities of the Serial Audio Interface (SAI) --
-- peripheral: --
-- + Initialization/de-initialization functions --
-- + I/O operation functions --
-- + Peripheral Control functions --
-- + Peripheral State functions --
-- --
-- COPYRIGHT(c) 2015 STMicroelectronics --
------------------------------------------------------------------------------
with STM32.Device;
package STM32.SAI is
subtype SAI_Controller is STM32.Device.SAI_Port;
type SAI_Block is (Block_A, Block_B);
subtype Audio_Frequency is Word;
type SAI_Mono_Stereo_Mode is
(Stereo,
Mono)
with Size => 1;
type SAI_Audio_Mode is
(Master_Transmitter,
Master_Receiver,
Slave_Transmitter,
Slave_Receiver)
with Size => 2;
-- When the audio mode is configured in SPDIF mode, the master transmitter
-- mode is forced. In Master transmitter mode, the audio block starts
-- generating the FS and the clocks immediately.
type SAI_Protocol_Configuration is
(Free_Protocol,
SPDIF_Protocol,
AC97_Protocol)
with Size => 2;
-- The Free protocol allows to use the powerful configuration of the
-- audio block to address a specific audio protocol (such as I2S, LSB/MSB
-- justified, TDM, PCM/DSP...) by setting most of the configuration
-- register bits as well as frame configuration register.
for SAI_Protocol_Configuration use
(Free_Protocol => 0,
SPDIF_Protocol => 1,
AC97_Protocol => 2);
type SAI_Data_Size is
(Data_8b,
Data_10b,
Data_16b,
Data_20b,
Data_24b,
Data_32b)
with Size => 3;
-- These bits are ignored when the SPDIF protocols are selected (bit
-- PRTCFG[1:0]), because the frame and the data size are fixed in such
-- case. When the companding mode is selected through COMP[1:0] bits,
-- DS[1:0] are ignored since the data size is fixed to 8 bits by the
-- algorithm.
for SAI_Data_Size use
(Data_8b => 2,
Data_10b => 3,
Data_16b => 4,
Data_20b => 5,
Data_24b => 6,
Data_32b => 7);
type SAI_Endianness is
(Data_MSB_First,
Data_LSB_First)
with Size => 1;
type SAI_Clock_Strobing_Edge is
(Clock_Strobing_Falling_Edge,
Clock_Strobing_Rising_Edge)
with Size => 1;
-- This has no meanings in SPDIF audio mode,
--
-- Clock_Strobing_Falling_Edge:
-- Signals generated by the SAI change on SCK rising edge, while
-- signals received by the SAI are sampled on the SCK falling edge.
--
-- Clock_Strobing_Rising_Edge:
-- Signals generated by the SAI change on SCK falling edge, while signals
-- received by the SAI are sampled on the SCK rising edge.
type SAI_Synchronization is
(Asynchronous_Mode,
Synchronous_Mode,
Synchronous_Ext_Mode)
with Size => 2;
-- Asynchronous_Mode:
-- audio sub-block in asynchronous mode.
-- Synchronous_Mode:
-- audio sub-block is synchronous with the other internal audio sub-block.
-- In this case, the audio sub-block must be configured in slave mode.
-- Synchronous_Ext_Mode:
-- audio sub-block is synchronous with an external SAI embedded peripheral.
-- In this case the audio sub-block should be configured in Slave mode.
type SAI_Output_Drive is
(Drive_On_SAI_Enabled,
Drive_Immediate)
with Size => 1;
-- To be set before enabling the Audio Block and after the audio block
-- configuration
type SAI_Master_Clock_Divider is new UInt4;
-- Meaningless when the audio block operates in slave mode. They have to be
-- configured when the audio block is disabled.
-- 2#0000#: Divides by 1 the master clock input
-- Others: the master clock frequency is calculated according to the
-- following formula:
-- F_SCK = F_SAI_CK / (Master_Clock_Divider x 2)
type SAI_FIFO_Threshold is
(FIFO_Empty,
FIFO_1_Quarter_Full,
FIFO_Half_Full,
FIFO_3_Quarters_Full,
FIFO_Full)
with Size => 3;
type SAI_Tristate_Management is
(SD_Line_Driven,
SD_Line_Released);
-- Meaningful only if the audio block is configured as a transmitter. This
-- bit is not used when the audio block is configured in SPDIF mode. It
-- should be configured when SAI is disabled.
-- SD_Line_Driven:
-- SD output line is still driven by the SAI when a slot is inactive.
-- SD_Line_Released:
-- SD output line is released (HI-Z) at the end of the last data bit of the
-- last active slot if the next one is inactive.
type SAI_Companding_Mode is
(No_Companding,
M_Law_Algorithm,
A_Law_Algorithm);
-- Telecommunication applications can require to process the data to be
-- transmitted or received using a data companding algorithm. The two
-- companding modes supported are the μ-Law and the A-Law log which are
-- a part of the CCITT G.711 recommendation.
--
type SAI_Frame_Synchronization is
(FS_Frame,
FS_Frame_And_Channel_Identification)
with Size => 1;
-- Meaningless and is not used in AC’97 or SPDIF audio block
-- configuration. It must be configured when the audio block is disabled.
--
-- In case of FS_Frame_And_Channel_Identification, the number of slots
-- defined in the SAI_xSLOTR register has to be even. It means that half of
-- this number of slots will be dedicated to the left channel and the other
-- slots for the right channel (e.g: this bit has to be set for I2S or
-- MSB/LSB-justified protocols...).
--
-- FS_Frame: FS signal is a start frame signal.
-- FS_Frame_And_Channel_Identification: FS signal is a start of frame
-- signal + channel side identification.
type SAI_Frame_Sync_Polarity is
(FS_Active_Low,
FS_Active_High)
with Size => 1;
-- It is used to configure the level of the start of frame on the FS
-- signal. It is meaningless and is not used in AC’97 or SPDIF audio
-- block configuration.
--
-- FS_Active_Low: FS is active low (falling edge)
-- FS_Active_High: FS is active high (rising edge)
type SAI_Frame_Sync_Offset is
(First_Bit,
Before_First_Bit)
with Size => 1;
-- Meaningless and is not used in AC’97 or SPDIF audio block
-- configuration. This bit must be configured when the audio block
-- is disabled.
-- First_Bit: FS is asserted on the first bit of the slot 0.
-- Before_First_Bit: FS is asserted one bit before the first bit of the
-- slot 0.
type SAI_Slot_Size is
(Data_Size,
Slot_16b,
Slot_32b)
with Size => 2;
-- The slot size must be higher or equal to the data size. If this
-- condition is not respected, the behavior of the SAI will be
-- undetermined.
-- Ignored in AC’97 or SPDIF mode.
-- Data_Size: The slot size is equivalent to the data size (specified in
-- DS[3:0] in the SAI_xCR1 register).
type Slots_Number is range 1 .. 16;
type SAI_Slots is new Short;
Slot_0 : constant SAI_Slots := 2 ** 0;
Slot_1 : constant SAI_Slots := 2 ** 1;
Slot_2 : constant SAI_Slots := 2 ** 2;
Slot_3 : constant SAI_Slots := 2 ** 3;
Slot_4 : constant SAI_Slots := 2 ** 4;
Slot_5 : constant SAI_Slots := 2 ** 5;
Slot_6 : constant SAI_Slots := 2 ** 6;
Slot_7 : constant SAI_Slots := 2 ** 7;
Slot_8 : constant SAI_Slots := 2 ** 8;
Slot_9 : constant SAI_Slots := 2 ** 9;
Slot_10 : constant SAI_Slots := 2 ** 10;
Slot_11 : constant SAI_Slots := 2 ** 11;
Slot_12 : constant SAI_Slots := 2 ** 12;
Slot_13 : constant SAI_Slots := 2 ** 13;
Slot_14 : constant SAI_Slots := 2 ** 14;
Slot_15 : constant SAI_Slots := 2 ** 15;
procedure Deinitialize
(Periph : SAI_Controller;
Block : SAI_Block);
function Enabled
(Periph : SAI_Controller;
Block : SAI_Block) return Boolean
with Inline;
procedure Enable
(Periph : SAI_Controller;
Block : SAI_Block)
with Inline;
procedure Disable
(Periph : SAI_Controller;
Block : SAI_Block)
with Inline;
procedure Enable_DMA
(Periph : SAI_Controller;
Block : SAI_Block)
with Inline;
procedure Configure_Audio_Block
(Periph : SAI_Controller;
Block : SAI_Block;
Frequency : Audio_Frequency;
Stereo_Mode : SAI_Mono_Stereo_Mode;
Mode : SAI_Audio_Mode;
MCD_Enabled : Boolean;
Protocol : SAI_Protocol_Configuration;
Data_Size : SAI_Data_Size;
Endianness : SAI_Endianness;
Clock_Strobing : SAI_Clock_Strobing_Edge;
Synchronization : SAI_Synchronization;
Output_Drive : SAI_Output_Drive;
FIFO_Threshold : SAI_FIFO_Threshold;
Tristate_Mgt : SAI_Tristate_Management := SD_Line_Driven;
Companding_Mode : SAI_Companding_Mode := No_Companding);
procedure Configure_Block_Frame
(Periph : SAI_Controller;
Block : SAI_Block;
Frame_Length : Byte;
Frame_Active : UInt7;
Frame_Sync : SAI_Frame_Synchronization;
FS_Polarity : SAI_Frame_Sync_Polarity;
FS_Offset : SAI_Frame_Sync_Offset);
procedure Configure_Block_Slot
(Periph : SAI_Controller;
Block : SAI_Block;
First_Bit_Offset : UInt5;
Slot_Size : SAI_Slot_Size;
Number_Of_Slots : Slots_Number;
Enabled_Slots : SAI_Slots);
end STM32.SAI;
|
leo-brewin/ada-lapack | Ada | 3,820 | adb | with Ada.Text_IO;
with Ada.Text_IO.Complex_IO;
with Ada.Numerics.Generic_Real_Arrays;
with Ada.Numerics.Generic_Complex_Types;
with Ada.Numerics.Generic_Complex_Arrays;
with Ada.Numerics.Generic_Elementary_Functions;
with Ada.Numerics.Generic_Complex_Elementary_Functions;
with Ada_Lapack;
use Ada.Text_IO;
procedure tdsysv is
type Real is digits 18;
package Real_Arrays is new Ada.Numerics.Generic_Real_Arrays (Real);
package Complex_Types is new Ada.Numerics.Generic_Complex_Types (Real);
package Complex_Arrays is new Ada.Numerics.Generic_Complex_Arrays (Real_Arrays, Complex_Types);
package Real_Maths is new Ada.Numerics.Generic_Elementary_Functions (Real);
package Complex_Maths is new Ada.Numerics.Generic_Complex_Elementary_Functions (Complex_Types);
package Real_IO is new Ada.Text_IO.Float_IO (Real);
package Integer_IO is new Ada.Text_IO.Integer_IO (Integer);
package Complex_IO is new Ada.Text_IO.Complex_IO (Complex_Types);
package Lapack is new Ada_Lapack(Real, Complex_Types, Real_Arrays, Complex_Arrays);
use Lapack;
use Real_Arrays;
use Complex_Types;
use Complex_Arrays;
use Real_IO;
use Integer_IO;
use Complex_IO;
use Real_Maths;
use Complex_Maths;
matrix : Real_Matrix (1..5,1..5);
matrix_rows : Integer := Matrix'Length (1);
matrix_cols : Integer := Matrix'Length (2);
rhs : Real_Matrix (1..5,1..3);
rhs_rows : Integer := rhs'Length (1);
rhs_cols : Integer := rhs'Length (2);
pivots : Integer_Vector (1..matrix_rows);
short_vector : Real_Vector (1..1);
return_code : Integer;
begin
matrix:= (( -5.86, 3.99, -5.93, -2.82, 7.69 ),
( 3.99, 4.46, 2.58, 4.42, 4.61 ),
( -5.93, 2.58, -8.52, 8.57, 7.69 ),
( -2.82, 4.42, 8.57, 3.72, 8.07 ),
( 7.69, 4.61, 7.69, 8.07, 9.83 ));
rhs:= (( 1.32, -6.33, -8.77 ),
( 2.22, 1.69, -8.33 ),
( 0.12, -1.56, 9.54 ),
( -6.41, -9.49, 9.56 ),
( 6.33, -3.67, 7.48 ));
SYSV ( UPLO => 'L',
A => matrix,
LDA => matrix_rows,
N => matrix_cols,
B => rhs,
LDB => rhs_rows,
NRHS => rhs_cols,
IPIV => pivots,
WORK => short_vector,
LWORK => -1,
INFO => return_code );
declare
work_vector_max : Constant Integer := Integer( short_vector(1) );
work_vector : Real_Vector (1 .. work_vector_max);
begin
SYSV ( UPLO => 'L',
A => matrix,
LDA => matrix_rows,
N => matrix_cols,
B => rhs,
LDB => rhs_rows,
NRHS => rhs_cols,
IPIV => pivots,
WORK => work_vector,
LWORK => work_vector_max,
INFO => return_code );
end;
if (return_code /= 0) then
Put ("DSYSV failed, the return code was : ");
Put ( return_code );
New_line;
else
Put_line ("Solution");
for i in rhs'range(1) loop
for j in rhs'range(2) loop
put(" ");
put(rhs(i,j),3,3,0);
end loop;
new_line;
end loop;
new_line;
Put_line ("The matrix factorization");
for i in matrix'range(1) loop
for j in matrix'range(2) loop
put(" ");
put(matrix(i,j),3,3,0);
end loop;
new_line;
end loop;
new_line;
Put_line ("The pivot indices");
put("(");
for i in pivots'range loop
put(pivots(i),3);
end loop;
put_line(" )");
end if;
end tdsysv;
|
AdaCore/Ada_Drivers_Library | Ada | 3,271 | ads | -- This spec has been automatically generated from STM32F7x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.WWDG is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CR_T_Field is HAL.UInt7;
-- Control register
type CR_Register is record
-- 7-bit counter (MSB to LSB)
T : CR_T_Field := 16#7F#;
-- Activation bit
WDGA : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
T at 0 range 0 .. 6;
WDGA at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype CFR_W_Field is HAL.UInt7;
-- CFR_WDGTB array
type CFR_WDGTB_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for CFR_WDGTB
type CFR_WDGTB_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- WDGTB as a value
Val : HAL.UInt2;
when True =>
-- WDGTB as an array
Arr : CFR_WDGTB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for CFR_WDGTB_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Configuration register
type CFR_Register is record
-- 7-bit window value
W : CFR_W_Field := 16#7F#;
-- Timer base
WDGTB : CFR_WDGTB_Field := (As_Array => False, Val => 16#0#);
-- Early wakeup interrupt
EWI : Boolean := False;
-- unspecified
Reserved_10_31 : HAL.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CFR_Register use record
W at 0 range 0 .. 6;
WDGTB at 0 range 7 .. 8;
EWI at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-- Status register
type SR_Register is record
-- Early wakeup interrupt flag
EWIF : Boolean := False;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
EWIF at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Window watchdog
type WWDG_Peripheral is record
-- Control register
CR : aliased CR_Register;
-- Configuration register
CFR : aliased CFR_Register;
-- Status register
SR : aliased SR_Register;
end record
with Volatile;
for WWDG_Peripheral use record
CR at 16#0# range 0 .. 31;
CFR at 16#4# range 0 .. 31;
SR at 16#8# range 0 .. 31;
end record;
-- Window watchdog
WWDG_Periph : aliased WWDG_Peripheral
with Import, Address => System'To_Address (16#40002C00#);
end STM32_SVD.WWDG;
|
RepoBackup/ledesoft | Ada | 32 | ads | address=/govjiangsu.cn/127.0.0.1 |
mirror/ncurses | Ada | 3,159 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- ncurses --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright 2020 Thomas E. Dickey --
-- Copyright 2000 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Eugene V. Melaragno <[email protected]> 2000
-- Version Control
-- $Revision: 1.2 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Terminal_Interface.Curses;
procedure ncurses2.flushinp_test (win : Terminal_Interface.Curses.Window);
|
gerr135/ada_composition | Ada | 3,425 | adb | -- with Ada.Text_IO; use Ada.Text_IO;
package body Lists.Vectors is
overriding
function Element_Constant_Reference (Container : aliased in List; Index : Index_Type) return Constant_Reference_Type is
VCR : ACV.Constant_Reference_Type := ACV.Vector(Container).Constant_Reference(Index);
CR : Constant_Reference_Type(VCR.Element);
begin
-- Put_Line("Element_Constant_Reference (LD, " & Index'Img & ");");
return CR;
end;
overriding
function Element_Constant_Reference (Container : aliased in List; Position : Cursor) return Constant_Reference_Type is
begin
-- Put_Line("Element_Constant_Reference (CLD, " & Position.Index'Img & ");");
return Element_Constant_Reference(Container, Position.Index);
end;
overriding
function Element_Reference (Container : aliased in out List; Index : Index_Type) return Reference_Type is
VR : ACV.Reference_Type := ACV.Vector(Container).Reference(Index);
R : Reference_Type(VR.Element);
begin
-- Put_Line("Element_Reference (LD, " & Index'Img & ");");
return R;
end;
overriding
function Element_Reference (Container : aliased in out List; Position : Cursor) return Reference_Type is
begin
-- Put_Line("Element_Reference (CLD, " & Position.Index'Img & ");");
return Element_Reference(Container, Position.Index);
end;
overriding
function Iterate (Container : in List) return Iterator_Interface'Class is
It : Iterator := (Container'Unrestricted_Access, Index_Base'First);
begin
return It;
end;
function Has_Element (L : List; Position : Index_Base) return Boolean is
-- here we pass the check to the underlying Vector
begin
return ACV.Has_Element(L.To_Cursor(Position));
end;
overriding
function First (Object : Iterator) return Cursor is
C : Cursor := (Object.Container, Index_Type'First);
begin
-- Put_Line("First (Iterator) = " & C.Index'Img & ";");
return C;
end;
overriding
function Last (Object : Iterator) return Cursor is
C : Cursor := (Object.Container, List(Object.Container.all).Last_Index);
begin
-- Put_Line("Last (Iterator) = " & C.Index'Img & ";");
return C;
end;
overriding
function Next (Object : Iterator; Position : Cursor) return Cursor is
C : Cursor := (Object.Container, Position.Index + 1);
begin
-- Put_Line("Next (Iterator) = " & C.Index'Img & ";");
return C;
end;
overriding
function Previous (Object : Iterator; Position : Cursor) return Cursor is
C : Cursor := (Object.Container, Position.Index - 1);
begin
-- Put_Line("Prev (Iterator) = " & C.Index'Img & ";");
return C;
end;
---- conversion glue to reroute calls to ACV.Vector methods
overriding
function Length (Container : aliased in out List) return Index_Base is
begin
return Index_Base(ACV.Vector(Container).Length);
end;
overriding
function First_Index(Container : aliased in out List) return Index_Type is
begin
return Index_Type'First;
end;
overriding
function Last_Index (Container : aliased in out List) return Index_Type is
begin
return Index_Type'First + Index_Base(ACV.Vector(Container).Length) - 1;
end;
end Lists.Vectors;
|
reznikmm/matreshka | Ada | 3,749 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Draw_Visible_Area_Left_Attributes is
pragma Preelaborate;
type ODF_Draw_Visible_Area_Left_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Draw_Visible_Area_Left_Attribute_Access is
access all ODF_Draw_Visible_Area_Left_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Draw_Visible_Area_Left_Attributes;
|
stahta01/emulator_8080 | Ada | 3,202 | adb | with Ada.Directories;
with Ada.Sequential_IO;
with Ada.Text_IO;
with GNAT.Current_Exception;
with Emulator_8080.Processor;
with Emulator_8080.Disassembler;
with Emulator_8080.Vram_Sender;
procedure Emulator_Main is
package Rom_IO is new Ada.Sequential_IO(Element_Type => Emulator_8080.Byte_Type);
Rom_Directory_Path : constant String := Ada.Directories.Current_Directory & "/rom/";
Rom_File_Size : constant Natural :=
Natural(Ada.Directories.Size(Rom_Directory_Path & "invaders.h")) +
Natural(Ada.Directories.Size(Rom_Directory_Path & "invaders.g")) +
Natural(Ada.Directories.Size(Rom_Directory_Path & "invaders.f")) +
Natural(Ada.Directories.Size(Rom_Directory_Path & "invaders.e"));
Rom_File : Rom_IO.File_Type;
Rom_File_Content : Emulator_8080.Byte_Array_Type( 0 .. Rom_File_Size);
Rom_Byte_Index : Natural := 0;
Processor : Emulator_8080.Processor.Processor_Type;
procedure Read_Rom_File(Rom_File_Path : in String) is
Current_Rom_Byte : Emulator_8080.Byte_Type := 0;
begin
Rom_IO.Open(File => Rom_File, Mode => Rom_IO.In_File, Name => Rom_File_Path);
while not Rom_IO.End_Of_File(Rom_File) loop
Rom_IO.Read(File => Rom_File, Item => Current_Rom_Byte);
Rom_File_Content(Rom_Byte_Index) := Current_Rom_Byte;
Rom_Byte_Index := Rom_Byte_Index + 1;
end loop;
Rom_IO.Close(Rom_File);
end Read_Rom_File;
procedure Write_Invaders_Rom(Rom_File_Path : in String) is
begin
Rom_IO.Open(File => Rom_File, Mode => Rom_IO.Out_File, Name => Rom_File_Path);
for I in Rom_File_Content'Range loop
Rom_IO.Write(File => Rom_File, Item => Rom_File_Content(I));
end loop;
Rom_IO.Close(Rom_File);
end Write_Invaders_Rom;
begin
Ada.Text_IO.Put_Line("Starting emulator_8080.");
Ada.Text_IO.Put_Line("Reading Rom...");
Read_Rom_File(Rom_Directory_Path & "invaders.h");
Read_Rom_File(Rom_Directory_Path & "invaders.g");
Read_Rom_File(Rom_Directory_Path & "invaders.f");
Read_Rom_File(Rom_Directory_Path & "invaders.e");
if not Ada.Directories.Exists(Rom_Directory_Path & "invaders.rom") then
Write_Invaders_Rom(Rom_Directory_Path & "invaders.rom");
end if;
Ada.Text_IO.Put_Line("File read successfully.");
Ada.Text_IO.Put_Line("--> File size: " & Rom_File_Size'Img);
Ada.Text_IO.Put_Line("--> last Index: " & Rom_Byte_Index'Img);
Ada.Text_IO.Put_Line("Initializing CPU");
Emulator_8080.Vram_Sender.Initialize(Port => 4242,
Ip_Address => "192.168.178.32");
Processor := Emulator_8080.Processor.Initialize(Rom_File_Content);
Ada.Text_IO.Put_Line("Running emulation...");
Emulator_8080.Disassembler.Read_Rom(Render_Step_Callback => Emulator_8080.Vram_Sender.Send_Vram'Access,
Execution_Mode => Emulator_8080.Disassembler.Execute_And_Print,
Processor => Processor);
Emulator_8080.Vram_Sender.Close;
exception
when others =>
Ada.Text_IO.Put_Line("EXCEPTION CAUGHT IN MAIN");
Ada.Text_IO.Put_Line(GNAT.Current_Exception.Exception_Information);
end Emulator_Main;
|
AdaCore/gpr | Ada | 643 | adb | with Test_GPR;
with Test_Assert;
with GPR2.Project.Tree;
with GPR2.View_Ids;
function Test return Integer is
package TGPR renames Test_GPR;
package A renames Test_Assert;
use type GPR2.Optional_Name_Type;
use type GPR2.View_Ids.View_Id;
Tree : GPR2.Project.Tree.Object;
begin
-- Ensure that nested aggregate projects are loaded correctly
TGPR.Load_With_No_Errors (Tree, "./data/root_project.gpr");
-- Ensure that the right context is used in the leaf project
for V of Tree.Ordered_Views loop
A.Assert (V.Id = GPR2.View_Ids.Import (GPR2.View_Ids.Image (V.Id)));
end loop;
return A.Report;
end Test;
|
reznikmm/matreshka | Ada | 4,624 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Chart.Symbol_Name_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Chart_Symbol_Name_Attribute_Node is
begin
return Self : Chart_Symbol_Name_Attribute_Node do
Matreshka.ODF_Chart.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Chart_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Chart_Symbol_Name_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Symbol_Name_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Chart_URI,
Matreshka.ODF_String_Constants.Symbol_Name_Attribute,
Chart_Symbol_Name_Attribute_Node'Tag);
end Matreshka.ODF_Chart.Symbol_Name_Attributes;
|
AdaDoom3/wayland_ada_binding | Ada | 5,031 | adb | ------------------------------------------------------------------------------
-- Copyright (C) 2015-2016, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 3, or (at your option) any later --
-- version. This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
------------------------------------------------------------------------------
pragma Ada_2012;
with Ada.Unchecked_Deallocation;
package body Conts.Lists.Storage.Unbounded with SPARK_Mode => Off is
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Node, Node_Access);
--------------
-- Allocate --
--------------
procedure Allocate
(Self : in out Nodes_Container'Class;
Element : Elements.Stored_Type;
N : out Node_Access)
is
pragma Unreferenced (Self);
begin
N := new Node;
N.Element := Element;
end Allocate;
------------------
-- Release_Node --
------------------
procedure Release_Node
(Self : in out Nodes_Container'Class; N : in out Node_Access)
is
pragma Unreferenced (Self);
begin
Unchecked_Free (N);
end Release_Node;
-----------------
-- Get_Element --
-----------------
function Get_Element (Self : Nodes_Container'Class; N : Node_Access)
return Elements.Stored_Type
is
pragma Unreferenced (Self);
begin
return N.Element;
end Get_Element;
--------------
-- Get_Next --
--------------
function Get_Next
(Self : Nodes_Container'Class; N : Node_Access) return Node_Access
is
pragma Unreferenced (Self);
begin
return N.Next;
end Get_Next;
------------------
-- Get_Previous --
------------------
function Get_Previous
(Self : Nodes_Container'Class; N : Node_Access) return Node_Access
is
pragma Unreferenced (Self);
begin
return N.Previous;
end Get_Previous;
------------------
-- Set_Previous --
------------------
procedure Set_Previous
(Self : in out Nodes_Container'Class; N, Previous : Node_Access)
is
pragma Unreferenced (Self);
begin
N.Previous := Previous;
end Set_Previous;
--------------
-- Set_Next --
--------------
procedure Set_Next
(Self : in out Nodes_Container'Class; N, Next : Node_Access)
is
pragma Unreferenced (Self);
begin
N.Next := Next;
end Set_Next;
-----------------
-- Set_Element --
-----------------
procedure Set_Element
(Self : in out Nodes_Container'Class;
N : Node_Access;
E : Elements.Stored_Type)
is
pragma Unreferenced (Self);
begin
N.Element := E;
end Set_Element;
------------
-- Assign --
------------
procedure Assign
(Nodes : in out Nodes_Container'Class;
Source : Nodes_Container'Class;
New_Head : out Node_Access;
Old_Head : Node_Access;
New_Tail : out Node_Access;
Old_Tail : Node_Access)
is
pragma Unreferenced (Source, Old_Tail);
N, Tmp, Tmp2 : Node_Access;
begin
if Old_Head = null then
New_Head := null;
New_Tail := null;
return;
end if;
Tmp2 := Old_Head;
if Elements.Copyable then
Allocate (Nodes, Tmp2.Element, Tmp);
else
Allocate (Nodes, Elements.Copy (Tmp2.Element), Tmp);
end if;
New_Head := Tmp;
loop
Tmp2 := Tmp2.Next;
exit when Tmp2 = null;
if Elements.Copyable then
Allocate (Nodes, Tmp2.Element, N);
else
Allocate (Nodes, Elements.Copy (Tmp2.Element), N);
end if;
Tmp.Next := N;
N.Previous := Tmp;
Tmp := N;
end loop;
New_Tail := N;
end Assign;
end Conts.Lists.Storage.Unbounded;
|
rogermc2/GA_Ada | Ada | 794 | adb | -- Program Circle
-- Author Roger Mc Murtrie
-- Created 21 February 2018
with Ada.Exceptions; use Ada.Exceptions;
with Ada.Text_IO; use Ada.Text_IO;
with Glfw;
with Glfw.Windows;
with Initialize;
with Main_Loop;
procedure Removal is
Main_Window : Glfw.Windows.Window;
Window_Title : String :=
"GA for Computer Scientists Chapter 2, Example 2: Hidden Surface Removal";
begin
Glfw.Init;
Initialize (Main_Window, Window_Title);
Main_Loop (Main_Window);
Glfw.Shutdown;
exception
when anError : Constraint_Error =>
Put ("Removal returned constraint error: ");
Put_Line (Exception_Information (anError));
when anError : others =>
Put_Line ("An exception occurred in Removal.");
Put_Line (Exception_Information (anError));
end Removal;
|
PhiTheta/ADLAS_Ada_System | Ada | 1,920 | adb | ------------------------------------------------------------------------------------------------------------------------
--
-- Project: Project_System
-- File name: Project_Main.adb
-- Description: Main file that includes calls to start the project running
--
--
--
------------------------------------------------------------------------------------------------------------------------
-- Change History:
-- Version Date Author Description
-- ------- ---- ------ -----------
-- 1.0 07/10/17 S.Crowther Initial version
------------------------------------------------------------------------------------------------------------------------
--
-- Parameters:
-- Name Direction Description
-- ---- --------- ----
--
------------------------------------------------------------------------------------------------------------------------
-- Function name: Procedure Project Main
-- Description: Calls first phase project file
--
--
-- Equation Logic:
------------------------------------------------------------------------------------------------------------------------
-- Return:
-- Boolean Value
------------------------------------------------------------------------------------------------------------------------
<<<<<<< HEAD
with ada.text_IO;
with write_File;
procedure controller is
Complete : Boolean := False;
begin
write_File;
=======
with ada.text_IO; use Ada.Text_IO;
with Output;
procedure controller is
file_name : String := "20180604_log_file.txt";
file_Output: File_Type;
begin
Output.Write_File(Output => file_Output,
file_name => file_name);
>>>>>>> 69f69bc261da4a8489896c1cdee2a7aab20a4053
end controller;
|
reznikmm/matreshka | Ada | 7,623 | ads | -- Copyright (c) 1990 Regents of the University of California.
-- All rights reserved.
--
-- The primary authors of ayacc were David Taback and Deepak Tolani.
-- Enhancements were made by Ronald J. Schmalz.
--
-- Send requests for ayacc information to [email protected]
-- Send bug reports for ayacc to [email protected]
--
-- Redistribution and use in source and binary forms are permitted
-- provided that the above copyright notice and this paragraph are
-- duplicated in all such forms and that any documentation,
-- advertising materials, and other materials related to such
-- distribution and use acknowledge that the software was developed
-- by the University of California, Irvine. The name of the
-- University may not be used to endorse or promote products derived
-- from this software without specific prior written permission.
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-- Module : command_line_interface_.ada
-- Component of : common_library
-- Version : 1.2
-- Date : 11/21/86 16:03:08
-- SCCS File : disk21~/rschm/hasee/sccs/common_library/sccs/sxcommand_line_interface_.ada
with String_Lists; use String_Lists;
with String_pkg; use String_pkg;
--------------------------------------------------------------------
Package command_line_interface is
--| Provides primitives for getting at the command line arguments.
--| Overview
--| This package provides a universal and portable interface to
--| the arguments typed on a command line when a program is invoked.
--| Each command line argument is either a Word (sequence of non-blank
--| characters) or a quoted string, with embedded quotes doubled.
--|
--| Both named and positional arguments may be given on the command
--| line. However, once a named parameter is used, all the subseqent
--| parameters on the command line must be named parameters. For example,
--| the commands
--|-
--| compile abc pqr xyz library => plib
--| compile abc,pqr,unit=>xyz,library=>plib
--|+
--| have one named argument and three positional arguments. This
--| package separates the named parameters from the positional
--| parameters, ignores spaces around the "bound to" (=>) symbol, and
--| allows parameters to be separated by either spaces or commas,
--| so these command lines are indistinguishable.
--|
--| At program elaboration time, the command line string is automatically
--| obtained from the host operating system and parsed into
--| individual arguments. The following operations may then be used:
--|-
--| Named_arg_count() Returns number of named arguments entered
--| Positional_arg_count() Returns number of positional arguments
--| Positional_arg_value(N) Returns the Nth positional argument
--| Named_arg_value(Name, Dflt) Returns value of a named argument
--| Arguments() Returns the entire command line
--|+
----------------------------------------------------------------
max_args: constant := 255;
--| Maximum number of command line arguments (arbitrary).
subtype Argument_count is integer range 0..max_args;
--| For number of arguments
subtype Argument_index is Argument_count range 1..Argument_count'last;
--| Used to number the command line arguments.
no_arg: exception;
--| Raised when request made for nonexistent argument
missing_positional_arg: exception;
--| Raised when command line is missing positional argument (A,,B)
invalid_named_association: exception;
--| Raised when command line is missing named argument value (output=> ,A,B)
unreferenced_named_arg: exception;
--| Raised when not all named parameters have been retrieved
invalid_parameter_order: exception;
--| Raised when a positional parameter occurs after a named parameter
-- in the command line
--Invalid_Aggregate : exception;
--| Raised when an aggregate does not begin and end with parentheses
-- in Parse_Aggregate.
Unbalanced_Parentheses : exception;
--| Raised when the number of left paren's does not match the number
--| of right paren's.
Invalid_Parameter : exception;
--| Raised when the conversion of a string to a parameter type is not
--| possible.
----------------------------------------------------------------
procedure Initialize (Tool_Name : in String);
--| Initializes command_line_interface
--| N/A: modifies, errors, raises
---------------------------------------------------------------------
function Named_arg_count --| Return number of named arguments
return Argument_count;
--| N/A: modifies, errors, raises
function Positional_arg_count --| Return number of positional arguments
return Argument_count;
--| N/A: modifies, errors, raises
----------------------------------------------------------------
function Positional_arg_value( --| Return an argument value
N: Argument_index --| Position of desired argument
) return string; --| Raises: no_arg
--| Effects: Return the Nth argument. If there is no argument at
--| position N, no_arg is raised.
--| N/A: modifies, errors
function Positional_arg_value( --| Return an argument value
N: Argument_index --| Position of desired argument
) return String_type; --| Raises: no_arg
--| Effects: Return the Nth argument. If there is no argument at
--| position N, no_arg is raised.
--| N/A: modifies, errors
--------------------------------------------------------------------
function Named_arg_value(--| Return a named argument value
Name: string;
Default: string
) return string;
--| Effects: Return the value associated with Name on the command
--| line. If there was none, return Default.
--| N/A: modifies, errors
function Named_arg_value(--| Return a named argument value
Name: string;
Default: string
) return String_Type;
--| Effects: Return the value associated with Name on the command
--| line. If there was none, return Default.
--| N/A: modifies, errors
function Named_arg_value(--| Return a named argument value
Name: string;
Default: String_type
) return String_type;
--| Effects: Return the value associated with Name on the command
--| line. If there was none, return Default.
--| N/A: modifies, errors
----------------------------------------------------------------
function Arguments --| Return the entire argument string
return string;
--| Effects: Return the entire command line, except for the name
--| of the command itself.
--| N/A: modifies, errors, raises
----------------------------------------------------------------
function Parse_Aggregate (Aggregate_Text : in String_Type)
return String_Lists.List;
function Parse_Aggregate (Aggregate_Text : in String)
return String_Lists.List;
--| Effects: Returns components of Aggregate_Text as a String_List.
--| Raises : Invalid_Aggregate
----------------------------------------------------------------
generic
type Parameter_Type is (<>);
Type_Name : in String;
function Convert (Parameter_Text : in String) return Parameter_Type;
--| Raises: Invalid_Parameter
----------------------------------------------------------------
procedure Finalize ; --| Raises: unrecognized parameters
--| Effects: If not all named parameters have been retrieved
--| unrecognized parameters is raised.
--| N/A: modifies, errors
end command_line_interface;
----------------------------------------------------------------
|
optikos/oasis | Ada | 5,396 | adb | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Program.Nodes.Protected_Definitions is
function Create
(Visible_Declarations : Program.Element_Vectors.Element_Vector_Access;
Private_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Private_Declarations : Program.Element_Vectors.Element_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Name : Program.Elements.Identifiers.Identifier_Access)
return Protected_Definition is
begin
return Result : Protected_Definition :=
(Visible_Declarations => Visible_Declarations,
Private_Token => Private_Token,
Private_Declarations => Private_Declarations, End_Token => End_Token,
End_Name => End_Name, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Visible_Declarations : Program.Element_Vectors.Element_Vector_Access;
Private_Declarations : Program.Element_Vectors.Element_Vector_Access;
End_Name : Program.Elements.Identifiers.Identifier_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Protected_Definition is
begin
return Result : Implicit_Protected_Definition :=
(Visible_Declarations => Visible_Declarations,
Private_Declarations => Private_Declarations, End_Name => End_Name,
Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Visible_Declarations
(Self : Base_Protected_Definition)
return Program.Element_Vectors.Element_Vector_Access is
begin
return Self.Visible_Declarations;
end Visible_Declarations;
overriding function Private_Declarations
(Self : Base_Protected_Definition)
return Program.Element_Vectors.Element_Vector_Access is
begin
return Self.Private_Declarations;
end Private_Declarations;
overriding function End_Name
(Self : Base_Protected_Definition)
return Program.Elements.Identifiers.Identifier_Access is
begin
return Self.End_Name;
end End_Name;
overriding function Private_Token
(Self : Protected_Definition)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Private_Token;
end Private_Token;
overriding function End_Token
(Self : Protected_Definition)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.End_Token;
end End_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Protected_Definition)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Protected_Definition)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Protected_Definition)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize
(Self : aliased in out Base_Protected_Definition'Class) is
begin
for Item in Self.Visible_Declarations.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
for Item in Self.Private_Declarations.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
if Self.End_Name.Assigned then
Set_Enclosing_Element (Self.End_Name, Self'Unchecked_Access);
end if;
null;
end Initialize;
overriding function Is_Protected_Definition_Element
(Self : Base_Protected_Definition)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Protected_Definition_Element;
overriding function Is_Definition_Element
(Self : Base_Protected_Definition)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Definition_Element;
overriding procedure Visit
(Self : not null access Base_Protected_Definition;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Protected_Definition (Self);
end Visit;
overriding function To_Protected_Definition_Text
(Self : aliased in out Protected_Definition)
return Program.Elements.Protected_Definitions
.Protected_Definition_Text_Access is
begin
return Self'Unchecked_Access;
end To_Protected_Definition_Text;
overriding function To_Protected_Definition_Text
(Self : aliased in out Implicit_Protected_Definition)
return Program.Elements.Protected_Definitions
.Protected_Definition_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Protected_Definition_Text;
end Program.Nodes.Protected_Definitions;
|
tum-ei-rcs/StratoX | Ada | 5,061 | ads | -- This spec has been automatically generated from STM32F427x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
with System;
with HAL;
package STM32_SVD.PWR is
pragma Preelaborate;
---------------
-- Registers --
---------------
-----------------
-- CR_Register --
-----------------
subtype CR_PLS_Field is HAL.UInt3;
subtype CR_VOS_Field is HAL.UInt2;
subtype CR_UDEN_Field is HAL.UInt2;
-- power control register
type CR_Register is record
-- Low-power deep sleep
LPDS : Boolean := False;
-- Power down deepsleep
PDDS : Boolean := False;
-- Clear wakeup flag
CWUF : Boolean := False;
-- Clear standby flag
CSBF : Boolean := False;
-- Power voltage detector enable
PVDE : Boolean := False;
-- PVD level selection
PLS : CR_PLS_Field := 16#0#;
-- Disable backup domain write protection
DBP : Boolean := False;
-- Flash power down in Stop mode
FPDS : Boolean := False;
-- Low-Power Regulator Low Voltage in deepsleep
LPLVDS : Boolean := False;
-- Main regulator low voltage in deepsleep mode
MRLVDS : Boolean := False;
-- unspecified
Reserved_12_13 : HAL.UInt2 := 16#0#;
-- Regulator voltage scaling output selection
VOS : CR_VOS_Field := 16#3#;
-- Over-drive enable
ODEN : Boolean := False;
-- Over-drive switching enabled
ODSWEN : Boolean := False;
-- Under-drive enable in stop mode
UDEN : CR_UDEN_Field := 16#0#;
-- unspecified
Reserved_20_31 : HAL.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
LPDS at 0 range 0 .. 0;
PDDS at 0 range 1 .. 1;
CWUF at 0 range 2 .. 2;
CSBF at 0 range 3 .. 3;
PVDE at 0 range 4 .. 4;
PLS at 0 range 5 .. 7;
DBP at 0 range 8 .. 8;
FPDS at 0 range 9 .. 9;
LPLVDS at 0 range 10 .. 10;
MRLVDS at 0 range 11 .. 11;
Reserved_12_13 at 0 range 12 .. 13;
VOS at 0 range 14 .. 15;
ODEN at 0 range 16 .. 16;
ODSWEN at 0 range 17 .. 17;
UDEN at 0 range 18 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
------------------
-- CSR_Register --
------------------
subtype CSR_UDRDY_Field is HAL.UInt2;
-- power control/status register
type CSR_Register is record
-- Read-only. Wakeup flag
WUF : Boolean := False;
-- Read-only. Standby flag
SBF : Boolean := False;
-- Read-only. PVD output
PVDO : Boolean := False;
-- Read-only. Backup regulator ready
BRR : Boolean := False;
-- unspecified
Reserved_4_7 : HAL.UInt4 := 16#0#;
-- Enable WKUP pin
EWUP : Boolean := False;
-- Backup regulator enable
BRE : Boolean := False;
-- unspecified
Reserved_10_13 : HAL.UInt4 := 16#0#;
-- Regulator voltage scaling output selection ready bit
VOSRDY : Boolean := False;
-- unspecified
Reserved_15_15 : HAL.Bit := 16#0#;
-- Read-only. Over-drive mode ready
ODRDY : Boolean := False;
-- Read-only. Over-drive mode switching ready
ODSWRDY : Boolean := False;
-- Under-drive ready flag
UDRDY : CSR_UDRDY_Field := 16#0#;
-- unspecified
Reserved_20_31 : HAL.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CSR_Register use record
WUF at 0 range 0 .. 0;
SBF at 0 range 1 .. 1;
PVDO at 0 range 2 .. 2;
BRR at 0 range 3 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
EWUP at 0 range 8 .. 8;
BRE at 0 range 9 .. 9;
Reserved_10_13 at 0 range 10 .. 13;
VOSRDY at 0 range 14 .. 14;
Reserved_15_15 at 0 range 15 .. 15;
ODRDY at 0 range 16 .. 16;
ODSWRDY at 0 range 17 .. 17;
UDRDY at 0 range 18 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Power control
type PWR_Peripheral is record
-- power control register
CR : CR_Register;
-- power control/status register
CSR : CSR_Register;
end record
with Volatile;
for PWR_Peripheral use record
CR at 0 range 0 .. 31;
CSR at 4 range 0 .. 31;
end record;
-- Power control
PWR_Periph : aliased PWR_Peripheral
with Import, Address => PWR_Base;
end STM32_SVD.PWR;
|
faelys/natools | Ada | 18,825 | adb | ------------------------------------------------------------------------------
-- Copyright (c) 2016, Natacha Porté --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
package body Natools.Smaz_Generic.Tools is
function Image (B : Boolean) return String;
-- Return correctly-cased image of B
------------------------------
-- Local Helper Subprograms --
------------------------------
function Image (B : Boolean) return String is
begin
if B then
return "True";
else
return "False";
end if;
end Image;
----------------------
-- Public Interface --
----------------------
function Append_String
(Dict : in Dictionary;
Value : in String)
return Dictionary is
begin
return Dictionary'
(Last_Code => Dictionary_Code'Succ (Dict.Last_Code),
Values_Last => Dict.Values_Last + Value'Length,
Variable_Length_Verbatim => Dict.Variable_Length_Verbatim,
Max_Word_Length => Positive'Max (Dict.Max_Word_Length, Value'Length),
Offsets => Dict.Offsets
& (Dictionary_Code'First => Dict.Values_Last + 1),
Values => Dict.Values & Value,
Hash => Smaz_Tools.Dummy_Hash'Access);
end Append_String;
procedure Print_Dictionary_In_Ada
(Dict : in Dictionary;
Hash_Image : in String := "TODO";
Max_Width : in Positive := 70;
First_Prefix : in String := " := (";
Prefix : in String := " ";
Half_Indent : in String := " ")
is
procedure Append_Entity
(Buffer : in out String;
Last : in out Natural;
Entity : in String);
function Double_Quote (S : String; Count : Natural) return String;
function Offsets_Suffix (I : Dictionary_Code) return String;
function Strip_Image (S : String) return String;
function Values_Separator (I : Positive) return String;
procedure Append_Entity
(Buffer : in out String;
Last : in out Natural;
Entity : in String) is
begin
if Last + 1 + Entity'Length <= Buffer'Last then
Buffer (Last + 1) := ' ';
Buffer (Last + 2 .. Last + 1 + Entity'Length) := Entity;
Last := Last + 1 + Entity'Length;
else
Put_Line (Buffer (Buffer'First .. Last));
Last := Buffer'First + Prefix'Length - 1;
Buffer (Last + 1 .. Last + Half_Indent'Length) := Half_Indent;
Last := Last + Half_Indent'Length;
Buffer (Last + 1 .. Last + Entity'Length) := Entity;
Last := Last + Entity'Length;
end if;
end Append_Entity;
function Double_Quote (S : String; Count : Natural) return String is
begin
if Count = 0 then
return S;
else
return Quoted : String (1 .. S'Length + Count) do
declare
O : Positive := Quoted'First;
begin
for I in S'Range loop
Quoted (O) := S (I);
O := O + 1;
if S (I) = '"' then
Quoted (O) := S (I);
O := O + 1;
end if;
end loop;
end;
end return;
end if;
end Double_Quote;
function Offsets_Suffix (I : Dictionary_Code) return String is
begin
if I < Dict.Offsets'Last then
return ",";
else
return "),";
end if;
end Offsets_Suffix;
function Strip_Image (S : String) return String is
begin
if S'Length > 0 and then S (S'First) = ' ' then
return S (S'First + 1 .. S'Last);
else
return S;
end if;
end Strip_Image;
function Values_Separator (I : Positive) return String is
begin
if I > Dict.Values'First then
return "& ";
else
return "";
end if;
end Values_Separator;
Line_Buffer : String (1 .. Max_Width + Prefix'Length);
Buffer_Last : Natural;
begin
Put_Line (First_Prefix & "Last_Code =>"
& Dictionary_Code'Image (Dict.Last_Code) & ',');
Put_Line (Prefix & "Values_Last =>"
& Natural'Image (Dict.Values_Last) & ',');
Put_Line (Prefix & "Variable_Length_Verbatim => "
& Image (Dict.Variable_Length_Verbatim) & ',');
Put_Line (Prefix & "Max_Word_Length =>"
& Natural'Image (Dict.Max_Word_Length) & ',');
Line_Buffer (1 .. Prefix'Length) := Prefix;
Line_Buffer (Prefix'Length + 1 .. Prefix'Length + 11) := "Offsets => ";
Buffer_Last := Prefix'Length + 11;
for I in Dict.Offsets'Range loop
Append_Entity (Line_Buffer, Buffer_Last, Strip_Image
(Positive'Image (Dict.Offsets (I)) & Offsets_Suffix (I)));
if I = Dict.Offsets'First then
Line_Buffer (Prefix'Length + 12) := '(';
end if;
end loop;
Put_Line (Line_Buffer (Line_Buffer'First .. Buffer_Last));
Line_Buffer (Prefix'Length + 1 .. Prefix'Length + 9) := "Values =>";
Buffer_Last := Prefix'Length + 9;
declare
I : Positive := Dict.Values'First;
First, Last : Positive;
Quote_Count : Natural;
begin
Values_Loop :
while I <= Dict.Values'Last loop
Add_Unprintable :
while Dict.Values (I) not in ' ' .. '~' loop
Append_Entity
(Line_Buffer, Buffer_Last,
Values_Separator (I) & Character'Image (Dict.Values (I)));
I := I + 1;
exit Values_Loop when I > Dict.Values'Last;
end loop Add_Unprintable;
First := I;
Quote_Count := 0;
Find_Printable_Substring :
loop
if Dict.Values (I) = '"' then
Quote_Count := Quote_Count + 1;
end if;
I := I + 1;
exit Find_Printable_Substring when I > Dict.Values'Last
or else Dict.Values (I) not in ' ' .. '~';
end loop Find_Printable_Substring;
Last := I - 1;
Split_Lines :
loop
declare
Partial_Quote_Count : Natural := 0;
Partial_Width : Natural := 0;
Partial_Last : Natural := First - 1;
Sep : constant String := Values_Separator (First);
Available_Length : constant Natural
:= (if Line_Buffer'Last > Buffer_Last + Sep'Length + 4
then Line_Buffer'Last - Buffer_Last - Sep'Length - 4
else Line_Buffer'Length - Prefix'Length
- Half_Indent'Length - Sep'Length - 3);
begin
if 1 + Last - First + Quote_Count < Available_Length then
Append_Entity
(Line_Buffer, Buffer_Last,
Sep & '"' & Double_Quote
(Dict.Values (First .. Last), Quote_Count) & '"');
exit Split_Lines;
else
Count_Quotes :
loop
if Dict.Values (Partial_Last + 1) = '"' then
exit Count_Quotes
when Partial_Width + 2 > Available_Length;
Partial_Width := Partial_Width + 1;
Partial_Quote_Count := Partial_Quote_Count + 1;
else
exit Count_Quotes
when Partial_Width + 1 > Available_Length;
end if;
Partial_Width := Partial_Width + 1;
Partial_Last := Partial_Last + 1;
end loop Count_Quotes;
Append_Entity
(Line_Buffer, Buffer_Last, Sep & '"'
& Double_Quote
(Dict.Values (First .. Partial_Last),
Partial_Quote_Count)
& '"');
First := Partial_Last + 1;
Quote_Count := Quote_Count - Partial_Quote_Count;
end if;
end;
end loop Split_Lines;
end loop Values_Loop;
Put_Line (Line_Buffer (Line_Buffer'First .. Buffer_Last) & ',');
end;
Line_Buffer (Prefix'Length + 1 .. Prefix'Length + 7) := "Hash =>";
Buffer_Last := Prefix'Length + 7;
Append_Entity (Line_Buffer, Buffer_Last, Hash_Image & ");");
Put_Line (Line_Buffer (Line_Buffer'First .. Buffer_Last));
end Print_Dictionary_In_Ada;
function Remove_Element
(Dict : in Dictionary;
Index : in Dictionary_Code)
return Dictionary
is
Removed_Length : constant Positive := Dict_Entry_Length (Dict, Index);
function New_Offsets return Offset_Array;
function New_Values return String;
function New_Offsets return Offset_Array is
Result : Offset_Array
(Dict.Offsets'First .. Dictionary_Code'Pred (Dict.Last_Code));
begin
for I in Result'Range loop
if I < Index then
Result (I) := Dict.Offsets (I);
else
Result (I) := Dict.Offsets (Dictionary_Code'Succ (I))
- Removed_Length;
end if;
end loop;
return Result;
end New_Offsets;
function New_Values return String is
begin
if Index = Dictionary_Code'First then
return Dict.Values
(Dict.Offsets (Dictionary_Code'Succ (Index))
.. Dict.Values'Last);
elsif Index < Dict.Last_Code then
return Dict.Values (1 .. Dict.Offsets (Index) - 1)
& Dict.Values (Dict.Offsets (Dictionary_Code'Succ (Index))
.. Dict.Values'Last);
else
return Dict.Values (1 .. Dict.Offsets (Index) - 1);
end if;
end New_Values;
New_Max_Word_Length : Positive := Dict.Max_Word_Length;
begin
if Removed_Length = Dict.Max_Word_Length then
New_Max_Word_Length := 1;
for I in Dict.Offsets'Range loop
if I /= Index
and then Dict_Entry_Length (Dict, I) > New_Max_Word_Length
then
New_Max_Word_Length := Dict_Entry_Length (Dict, I);
end if;
end loop;
end if;
return Dictionary'
(Last_Code => Dictionary_Code'Pred (Dict.Last_Code),
Values_Last => Dict.Values_Last - Removed_Length,
Variable_Length_Verbatim => Dict.Variable_Length_Verbatim,
Max_Word_Length => New_Max_Word_Length,
Offsets => New_Offsets,
Values => New_Values,
Hash => Smaz_Tools.Dummy_Hash'Access);
end Remove_Element;
function Replace_Element
(Dict : in Dictionary;
Index : in Dictionary_Code;
Value : in String)
return Dictionary
is
Removed_Length : constant Positive := Dict_Entry_Length (Dict, Index);
Length_Delta : constant Integer := Value'Length - Removed_Length;
function New_Offsets return Offset_Array;
function New_Values return String;
function New_Offsets return Offset_Array is
Result : Offset_Array (Dict.Offsets'First .. Dict.Last_Code);
begin
for I in Result'Range loop
if I <= Index then
Result (I) := Dict.Offsets (I);
else
Result (I) := Dict.Offsets (I) + Length_Delta;
end if;
end loop;
return Result;
end New_Offsets;
function New_Values return String is
begin
if Index = Dictionary_Code'First then
return Value & Dict.Values
(Dict.Offsets (Dictionary_Code'Succ (Index))
.. Dict.Values'Last);
elsif Index < Dict.Last_Code then
return Dict.Values (1 .. Dict.Offsets (Index) - 1)
& Value
& Dict.Values (Dict.Offsets (Dictionary_Code'Succ (Index))
.. Dict.Values'Last);
else
return Dict.Values (1 .. Dict.Offsets (Index) - 1) & Value;
end if;
end New_Values;
New_Max_Word_Length : Positive := Dict.Max_Word_Length;
begin
if Removed_Length = Dict.Max_Word_Length then
New_Max_Word_Length := 1;
for I in Dict.Offsets'Range loop
if I /= Index
and then Dict_Entry_Length (Dict, I) > New_Max_Word_Length
then
New_Max_Word_Length := Dict_Entry_Length (Dict, I);
end if;
end loop;
end if;
if New_Max_Word_Length < Value'Length then
New_Max_Word_Length := Value'Length;
end if;
return Dictionary'
(Last_Code => Dict.Last_Code,
Values_Last => Dict.Values_Last + Length_Delta,
Variable_Length_Verbatim => Dict.Variable_Length_Verbatim,
Max_Word_Length => New_Max_Word_Length,
Offsets => New_Offsets,
Values => New_Values,
Hash => Smaz_Tools.Dummy_Hash'Access);
end Replace_Element;
function To_Dictionary
(List : in String_Lists.List;
Variable_Length_Verbatim : in Boolean)
return Dictionary
is
Code_After_Last : Dictionary_Code := Dictionary_Code'First;
String_Size : Natural := 0;
Max_Word_Length : Positive := 1;
begin
for S of List loop
Code_After_Last := Dictionary_Code'Succ (Code_After_Last);
String_Size := String_Size + S'Length;
if S'Length > Max_Word_Length then
Max_Word_Length := S'Length;
end if;
end loop;
declare
Last_Code : constant Dictionary_Code
:= Dictionary_Code'Pred (Code_After_Last);
Offsets : Offset_Array
(Dictionary_Code'Succ (Dictionary_Code'First) .. Last_Code);
Values : String (1 .. String_Size);
Current_Offset : Positive := 1;
Current_Index : Dictionary_Code := Dictionary_Code'First;
Next_Offset : Positive;
begin
for S of List loop
if Current_Index in Offsets'Range then
Offsets (Current_Index) := Current_Offset;
end if;
Next_Offset := Current_Offset + S'Length;
Values (Current_Offset .. Next_Offset - 1) := S;
Current_Offset := Next_Offset;
Current_Index := Dictionary_Code'Succ (Current_Index);
end loop;
pragma Assert (Current_Index = Code_After_Last);
pragma Assert (Current_Offset = String_Size + 1);
return
(Last_Code => Last_Code,
Values_Last => String_Size,
Variable_Length_Verbatim => Variable_Length_Verbatim,
Max_Word_Length => Max_Word_Length,
Offsets => Offsets,
Values => Values,
Hash => Smaz_Tools.Dummy_Hash'Access);
end;
end To_Dictionary;
function To_String_List (Dict : in Dictionary) return String_Lists.List is
Result : String_Lists.List;
begin
for Code in Dictionary_Code'First .. Dict.Last_Code loop
String_Lists.Append (Result, Dict_Entry (Dict, Code));
end loop;
return Result;
end To_String_List;
---------------------------
-- Dictionary Evaluation --
---------------------------
procedure Evaluate_Dictionary
(Dict : in Dictionary;
Corpus : in String_Lists.List;
Compressed_Size : out Ada.Streams.Stream_Element_Count;
Counts : out Dictionary_Counts) is
begin
Compressed_Size := 0;
Counts := (others => 0);
for S of Corpus loop
Evaluate_Dictionary_Partial
(Dict, S, Compressed_Size, Counts);
end loop;
end Evaluate_Dictionary;
procedure Evaluate_Dictionary_Partial
(Dict : in Dictionary;
Corpus_Entry : in String;
Compressed_Size : in out Ada.Streams.Stream_Element_Count;
Counts : in out Dictionary_Counts)
is
use type Ada.Streams.Stream_Element_Offset;
use type Smaz_Tools.String_Count;
Verbatim_Length : Natural;
Code : Dictionary_Code;
Compressed : constant Ada.Streams.Stream_Element_Array
:= Compress (Dict, Corpus_Entry);
Index : Ada.Streams.Stream_Element_Offset := Compressed'First;
begin
Compressed_Size := Compressed_Size + Compressed'Length;
while Index in Compressed'Range loop
Read_Code
(Compressed, Index,
Code, Verbatim_Length,
Dict.Last_Code, Dict.Variable_Length_Verbatim);
if Verbatim_Length > 0 then
Skip_Verbatim (Compressed, Index, Verbatim_Length);
else
Counts (Code) := Counts (Code) + 1;
end if;
end loop;
end Evaluate_Dictionary_Partial;
function Worst_Index
(Dict : in Dictionary;
Counts : in Dictionary_Counts;
Method : in Smaz_Tools.Methods.Enum;
First, Last : in Dictionary_Code)
return Dictionary_Code
is
use type Smaz_Tools.Score_Value;
Result : Dictionary_Code := First;
Worst_Score : Smaz_Tools.Score_Value
:= Score (Dict, Counts, Result, Method);
S : Smaz_Tools.Score_Value;
begin
for I in Dictionary_Code'Succ (First) .. Last loop
S := Score (Dict, Counts, I, Method);
if S < Worst_Score then
Result := I;
Worst_Score := S;
end if;
end loop;
return Result;
end Worst_Index;
end Natools.Smaz_Generic.Tools;
|
reznikmm/matreshka | Ada | 4,239 | 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.Text.Increment.Internals is
------------
-- Create --
------------
function Create
(Node : Matreshka.ODF_Attributes.Text.Increment.Text_Increment_Access)
return ODF.DOM.Attributes.Text.Increment.ODF_Text_Increment 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.Text.Increment.Text_Increment_Access)
return ODF.DOM.Attributes.Text.Increment.ODF_Text_Increment is
begin
return
(XML.DOM.Attributes.Internals.Wrap
(Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record);
end Wrap;
end ODF.DOM.Attributes.Text.Increment.Internals;
|
reznikmm/matreshka | Ada | 4,932 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Generic_Collections;
package AMF.Utp.Test_Cases.Collections is
pragma Preelaborate;
package Utp_Test_Case_Collections is
new AMF.Generic_Collections
(Utp_Test_Case,
Utp_Test_Case_Access);
type Set_Of_Utp_Test_Case is
new Utp_Test_Case_Collections.Set with null record;
Empty_Set_Of_Utp_Test_Case : constant Set_Of_Utp_Test_Case;
type Ordered_Set_Of_Utp_Test_Case is
new Utp_Test_Case_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_Utp_Test_Case : constant Ordered_Set_Of_Utp_Test_Case;
type Bag_Of_Utp_Test_Case is
new Utp_Test_Case_Collections.Bag with null record;
Empty_Bag_Of_Utp_Test_Case : constant Bag_Of_Utp_Test_Case;
type Sequence_Of_Utp_Test_Case is
new Utp_Test_Case_Collections.Sequence with null record;
Empty_Sequence_Of_Utp_Test_Case : constant Sequence_Of_Utp_Test_Case;
private
Empty_Set_Of_Utp_Test_Case : constant Set_Of_Utp_Test_Case
:= (Utp_Test_Case_Collections.Set with null record);
Empty_Ordered_Set_Of_Utp_Test_Case : constant Ordered_Set_Of_Utp_Test_Case
:= (Utp_Test_Case_Collections.Ordered_Set with null record);
Empty_Bag_Of_Utp_Test_Case : constant Bag_Of_Utp_Test_Case
:= (Utp_Test_Case_Collections.Bag with null record);
Empty_Sequence_Of_Utp_Test_Case : constant Sequence_Of_Utp_Test_Case
:= (Utp_Test_Case_Collections.Sequence with null record);
end AMF.Utp.Test_Cases.Collections;
|
stcarrez/ada-util | Ada | 4,036 | adb | -----------------------------------------------------------------------
-- util-encoders-quoted_printable -- Encode/Decode a stream in quoted-printable
-- Copyright (C) 2020 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Characters.Handling;
with Util.Encoders.Base16;
package body Util.Encoders.Quoted_Printable is
use Ada.Characters.Handling;
-- ------------------------------
-- Decode the Quoted-Printable string and return the result.
-- When Strict is true, raises the Encoding_Error exception if the
-- format is invalid. Otherwise, ignore invalid encoding.
-- ------------------------------
function Decode (Content : in String;
Strict : in Boolean := True) return String is
Result : String (1 .. Content'Length);
Read_Pos : Natural := Content'First;
Write_Pos : Natural := Result'First - 1;
C : Character;
C2 : Character;
begin
while Read_Pos <= Content'Last loop
C := Content (Read_Pos);
if C = '=' then
exit when Read_Pos = Content'Last;
if Read_Pos + 2 > Content'Last then
exit when not Strict;
raise Encoding_Error;
end if;
Read_Pos := Read_Pos + 1;
C := Content (Read_Pos);
if not Is_Hexadecimal_Digit (C) then
exit when not Strict;
raise Encoding_Error;
end if;
C2 := Content (Read_Pos + 1);
if not Is_Hexadecimal_Digit (C) then
exit when not Strict;
raise Encoding_Error;
end if;
Write_Pos := Write_Pos + 1;
Result (Write_Pos) := Base16.From_Hex (C, C2);
Read_Pos := Read_Pos + 1;
else
Write_Pos := Write_Pos + 1;
Result (Write_Pos) := C;
end if;
Read_Pos := Read_Pos + 1;
end loop;
return Result (1 .. Write_Pos);
end Decode;
-- ------------------------------
-- Decode the "Q" encoding, similar to Quoted-Printable but with
-- spaces that can be replaced by '_'.
-- See RFC 2047.
-- ------------------------------
function Q_Decode (Content : in String) return String is
Result : String (1 .. Content'Length);
Read_Pos : Natural := Content'First;
Write_Pos : Natural := Result'First - 1;
C : Character;
C2 : Character;
begin
while Read_Pos <= Content'Last loop
C := Content (Read_Pos);
if C = '=' then
exit when Read_Pos = Content'Last or else Read_Pos + 2 > Content'Last;
Read_Pos := Read_Pos + 1;
C := Content (Read_Pos);
exit when not Is_Hexadecimal_Digit (C);
C2 := Content (Read_Pos + 1);
exit when not Is_Hexadecimal_Digit (C);
Write_Pos := Write_Pos + 1;
Result (Write_Pos) := Base16.From_Hex (C, C2);
Read_Pos := Read_Pos + 1;
elsif C = '_' then
Write_Pos := Write_Pos + 1;
Result (Write_Pos) := ' ';
else
Write_Pos := Write_Pos + 1;
Result (Write_Pos) := C;
end if;
Read_Pos := Read_Pos + 1;
end loop;
return Result (1 .. Write_Pos);
end Q_Decode;
end Util.Encoders.Quoted_Printable;
|
fmqa/simulatedannealing-ada | Ada | 63 | ads | package Bitmaps is
type Luminance is mod 2**8;
end Bitmaps;
|
charlie5/aIDE | Ada | 1,334 | ads | with
AdaM.Any,
AdaM.library_Unit,
Ada.Containers.Vectors,
Ada.Streams;
package AdaM.library_Item
is
type Item is new Any.item with private;
-- View
--
type View is access all Item'Class;
procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in View);
procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out View);
for View'write use View_write;
for View'read use View_read;
-- Vector
--
package Vectors is new ada.Containers.Vectors (Positive, View);
subtype Vector is Vectors.Vector;
-- Forge
--
function new_Item (Unit : in AdaM.library_Unit.view) return library_Item.view;
procedure free (Self : in out library_Item.view);
procedure destruct (Self : in out library_Item.item);
-- Attributes
--
overriding
function Id (Self : access Item) return AdaM.Id;
procedure Unit_is (Self : in out Item; Now : AdaM.library_Unit.view);
function Unit (Self : in Item) return AdaM.library_Unit.view;
private
type Item is new Any.item with
record
library_Unit : AdaM.library_Unit.view;
end record;
end AdaM.library_Item;
|
Lucretia/so | Ada | 509 | ads | ------------------------------------------------------------------------------------------------------------------------
-- See COPYING for licence information.
------------------------------------------------------------------------------------------------------------------------
-- Oberon.Files
-- This is the root package for file handling.
package Oberon.Files is
subtype File is String;
type File_Access is access all File;
function Open (File_Name : String) return File;
end Oberon.Files;
|
AdaCore/libadalang | Ada | 45 | adb | procedure Proc4 is
begin
null;
end Proc4;
|
zhmu/ananas | Ada | 3,619 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S I N P U T . D --
-- --
-- S p e c --
-- --
-- Copyright (C) 2001-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 write debug source
-- files. These routines are not in Sinput.L, because they are used only
-- by the compiler, while Sinput.L is also used by gnatmake.
package Sinput.D is
------------------------------------------------
-- Subprograms for Writing Debug Source Files --
------------------------------------------------
procedure Create_Debug_Source
(Source : Source_File_Index;
Loc : out Source_Ptr);
-- Given a source file, creates a new source file table entry to be used
-- for the debug source file output (Debug_Generated_Code switch set).
-- Loc is set to the initial Sloc value for the first line. This call
-- also creates the debug source output file (using Create_Debug_File).
procedure Write_Debug_Line (Str : String; Loc : in out Source_Ptr);
-- This procedure is called to write a line to the debug source file
-- previously created by Create_Debug_Source using Write_Debug_Info.
-- Str is the source line to be written to the file (it does not include
-- an end of line character). On entry Loc is the Sloc value previously
-- returned by Create_Debug_Source or Write_Debug_Line, and on exit,
-- Sloc is updated to point to the start of the next line to be written,
-- taking into account the length of the terminator that was written by
-- Write_Debug_Info.
procedure Close_Debug_Source;
-- This procedure completes the source table entry for the debug file
-- previously created by Create_Debug_Source, and written using the
-- Write_Debug_Line procedure. It then calls Close_Debug_File to
-- complete the writing of the file itself.
end Sinput.D;
|
reznikmm/matreshka | Ada | 3,960 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Testsuite 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$
------------------------------------------------------------------------------
-- Checkh whether finalization of JSON_Object and JSON_Value doesn't result in
-- memory corruption.
------------------------------------------------------------------------------
with League.JSON.Objects;
with League.JSON.Values;
with League.Strings;
procedure Test_331 is
Object : League.JSON.Objects.JSON_Object;
Value : League.JSON.Values.JSON_Value;
begin
Object.Insert
(League.Strings.To_Universal_String ("name"),
League.JSON.Values.To_JSON_Value
(League.Strings.To_Universal_String ("peter")));
Value := Object.Value (League.Strings.To_Universal_String ("name"));
end Test_331;
|
Backup-eric645/fork-bomb | Ada | 232 | adb | with POSIX.Process_Identification,
POSIX.Unsafe_Process_Primitives;
procedure Forkbomb is
unused : POSIX.Process_Identification.Process_ID;
begin
unused := POSIX.Unsafe_Process_Primitives.Fork;
Forkbomb;
end Forkbomb;
|
davidkristola/vole | Ada | 381 | ads | package kv.avm.Log is
Verbose : Boolean := False;
procedure Put(Str : String);
procedure Put_Line(Str : String);
procedure Log_If(Callback : access function return String);
procedure Put_Error(Str : String);
procedure New_Line(Count : Positive := 1);
function Get_Last_Log_Line return String;
function Get_Last_Error_Line return String;
end kv.avm.Log;
|
sungyeon/drake | Ada | 19,112 | adb | with Ada.Exceptions.Finally;
with Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation;
with System;
package body Ada.Containers.Indefinite_Hashed_Maps is
use type Hash_Tables.Table_Access;
use type Copy_On_Write.Data_Access;
function Upcast is
new Unchecked_Conversion (Cursor, Hash_Tables.Node_Access);
function Downcast is
new Unchecked_Conversion (Hash_Tables.Node_Access, Cursor);
function Upcast is
new Unchecked_Conversion (Data_Access, Copy_On_Write.Data_Access);
function Downcast is
new Unchecked_Conversion (Copy_On_Write.Data_Access, Data_Access);
procedure Free is new Unchecked_Deallocation (Key_Type, Key_Access);
procedure Free is new Unchecked_Deallocation (Element_Type, Element_Access);
procedure Free is new Unchecked_Deallocation (Node, Cursor);
type Context_Type is limited record
Left : not null access Key_Type;
end record;
pragma Suppress_Initialization (Context_Type);
function Equivalent_Key (
Position : not null Hash_Tables.Node_Access;
Params : System.Address)
return Boolean;
function Equivalent_Key (
Position : not null Hash_Tables.Node_Access;
Params : System.Address)
return Boolean
is
Context : Context_Type;
for Context'Address use Params;
begin
return Equivalent_Keys (
Context.Left.all,
Downcast (Position).Key.all);
end Equivalent_Key;
procedure Allocate_Element (
Item : out Element_Access;
New_Item : Element_Type);
procedure Allocate_Element (
Item : out Element_Access;
New_Item : Element_Type) is
begin
Item := new Element_Type'(New_Item);
end Allocate_Element;
procedure Allocate_Node (
Item : out Cursor;
Key : Key_Type;
New_Item : Element_Type);
procedure Allocate_Node (
Item : out Cursor;
Key : Key_Type;
New_Item : Element_Type)
is
procedure Finally (X : in out Cursor);
procedure Finally (X : in out Cursor) is
begin
Free (X.Key);
Free (X);
end Finally;
package Holder is
new Exceptions.Finally.Scoped_Holder (Cursor, Finally);
X : aliased Cursor := new Node;
begin
Holder.Assign (X);
X.Key := new Key_Type'(Key);
Allocate_Element (X.Element, New_Item);
Holder.Clear;
Item := X;
end Allocate_Node;
procedure Copy_Node (
Target : out Hash_Tables.Node_Access;
Source : not null Hash_Tables.Node_Access);
procedure Copy_Node (
Target : out Hash_Tables.Node_Access;
Source : not null Hash_Tables.Node_Access)
is
Source_Node : constant Cursor := Downcast (Source);
New_Node : Cursor;
begin
Allocate_Node (New_Node, Source_Node.Key.all, Source_Node.Element.all);
Target := Upcast (New_Node);
end Copy_Node;
procedure Free_Node (Object : in out Hash_Tables.Node_Access);
procedure Free_Node (Object : in out Hash_Tables.Node_Access) is
X : Cursor := Downcast (Object);
begin
Free (X.Key);
Free (X.Element);
Free (X);
Object := null;
end Free_Node;
procedure Allocate_Data (
Target : out not null Copy_On_Write.Data_Access;
New_Length : Count_Type;
Capacity : Count_Type);
procedure Allocate_Data (
Target : out not null Copy_On_Write.Data_Access;
New_Length : Count_Type;
Capacity : Count_Type)
is
pragma Unreferenced (New_Length);
New_Data : constant Data_Access :=
new Data'(Super => <>, Table => null, Length => 0);
begin
Hash_Tables.Rebuild (New_Data.Table, Capacity);
Target := Upcast (New_Data);
end Allocate_Data;
procedure Copy_Data (
Target : out not null Copy_On_Write.Data_Access;
Source : not null Copy_On_Write.Data_Access;
Length : Count_Type;
New_Length : Count_Type;
Capacity : Count_Type);
procedure Copy_Data (
Target : out not null Copy_On_Write.Data_Access;
Source : not null Copy_On_Write.Data_Access;
Length : Count_Type;
New_Length : Count_Type;
Capacity : Count_Type)
is
pragma Unreferenced (Length);
pragma Unreferenced (New_Length);
New_Data : constant Data_Access :=
new Data'(Super => <>, Table => null, Length => 0);
begin
Hash_Tables.Copy (
New_Data.Table,
New_Data.Length,
Downcast (Source).Table,
Capacity,
Copy => Copy_Node'Access);
Target := Upcast (New_Data);
end Copy_Data;
procedure Free is new Unchecked_Deallocation (Data, Data_Access);
procedure Free_Data (Data : in out Copy_On_Write.Data_Access);
procedure Free_Data (Data : in out Copy_On_Write.Data_Access) is
X : Data_Access := Downcast (Data);
begin
Hash_Tables.Free (X.Table, X.Length, Free => Free_Node'Access);
Free (X);
Data := null;
end Free_Data;
procedure Reallocate (
Container : in out Map;
Capacity : Count_Type;
To_Update : Boolean);
procedure Reallocate (
Container : in out Map;
Capacity : Count_Type;
To_Update : Boolean) is
begin
Copy_On_Write.Unique (
Target => Container.Super'Access,
Target_Length => 0, -- Length is unused
Target_Capacity => Indefinite_Hashed_Maps.Capacity (Container),
New_Length => 0,
New_Capacity => Capacity,
To_Update => To_Update,
Allocate => Allocate_Data'Access,
Move => Copy_Data'Access,
Copy => Copy_Data'Access,
Free => Free_Data'Access,
Max_Length => Copy_On_Write.Zero'Access);
end Reallocate;
procedure Unique (Container : in out Map; To_Update : Boolean);
procedure Unique (Container : in out Map; To_Update : Boolean) is
begin
if Copy_On_Write.Shared (Container.Super.Data) then
Reallocate (
Container,
Capacity (Container), -- not shrinking
To_Update);
end if;
end Unique;
function Find (Container : Map; Hash : Hash_Type; Key : Key_Type)
return Cursor;
function Find (Container : Map; Hash : Hash_Type; Key : Key_Type)
return Cursor is
begin
if Is_Empty (Container) then
return null;
else
Unique (Container'Unrestricted_Access.all, False);
declare
Context : aliased Context_Type :=
(Left => Key'Unrestricted_Access);
begin
return Downcast (Hash_Tables.Find (
Downcast (Container.Super.Data).Table,
Hash,
Context'Address,
Equivalent => Equivalent_Key'Access));
end;
end if;
end Find;
-- implementation
function Empty_Map return Map is
begin
return (Finalization.Controlled with Super => (null, null));
end Empty_Map;
function Has_Element (Position : Cursor) return Boolean is
begin
return Position /= null;
end Has_Element;
overriding function "=" (Left, Right : Map) return Boolean is
function Equivalent (Left, Right : not null Hash_Tables.Node_Access)
return Boolean;
function Equivalent (Left, Right : not null Hash_Tables.Node_Access)
return Boolean is
begin
return Equivalent_Keys (
Downcast (Left).Key.all,
Downcast (Right).Key.all)
and then Downcast (Left).Element.all =
Downcast (Right).Element.all;
end Equivalent;
Left_Length : constant Count_Type := Length (Left);
Right_Length : constant Count_Type := Length (Right);
begin
if Left_Length /= Right_Length then
return False;
elsif Left_Length = 0 or else Left.Super.Data = Right.Super.Data then
return True;
else
Unique (Left'Unrestricted_Access.all, False); -- private
Unique (Right'Unrestricted_Access.all, False); -- private
declare
Left_Data : constant Data_Access := Downcast (Left.Super.Data);
Right_Data : constant Data_Access := Downcast (Right.Super.Data);
begin
return Hash_Tables.Equivalent (
Left_Data.Table,
Left_Data.Length,
Right_Data.Table,
Right_Data.Length,
Equivalent => Equivalent'Access);
end;
end if;
end "=";
function Capacity (Container : Map) return Count_Type is
Data : constant Data_Access := Downcast (Container.Super.Data);
begin
if Data = null then
return 0;
else
return Hash_Tables.Capacity (Data.Table);
end if;
end Capacity;
procedure Reserve_Capacity (
Container : in out Map;
Capacity : Count_Type)
is
New_Capacity : constant Count_Type :=
Count_Type'Max (Capacity, Length (Container));
begin
Reallocate (Container, New_Capacity, True);
end Reserve_Capacity;
function Length (Container : Map) return Count_Type is
Data : constant Data_Access := Downcast (Container.Super.Data);
begin
if Data = null then
return 0;
else
return Data.Length;
end if;
end Length;
function Is_Empty (Container : Map) return Boolean is
Data : constant Data_Access := Downcast (Container.Super.Data);
begin
return Data = null or else Data.Length = 0;
end Is_Empty;
procedure Clear (Container : in out Map) is
begin
Copy_On_Write.Clear (Container.Super'Access, Free => Free_Data'Access);
end Clear;
function Key (Position : Cursor) return Key_Type is
begin
return Position.Key.all;
end Key;
function Element (Position : Cursor) return Element_Type is
begin
return Position.Element.all;
end Element;
procedure Replace_Element (
Container : in out Map;
Position : Cursor;
New_Item : Element_Type) is
begin
Unique (Container, True);
Free (Position.Element);
Allocate_Element (Position.Element, New_Item);
end Replace_Element;
procedure Query_Element (
Position : Cursor;
Process : not null access procedure (
Key : Key_Type;
Element : Element_Type)) is
begin
Process (Position.Key.all, Position.Element.all);
end Query_Element;
procedure Update_Element (
Container : in out Map'Class;
Position : Cursor;
Process : not null access procedure (
Key : Key_Type;
Element : in out Element_Type)) is
begin
Process (
Position.Key.all,
Reference (Map (Container), Position).Element.all);
end Update_Element;
function Constant_Reference (Container : aliased Map; Position : Cursor)
return Constant_Reference_Type
is
pragma Unreferenced (Container);
begin
return (Element => Position.Element.all'Access);
end Constant_Reference;
function Reference (Container : aliased in out Map; Position : Cursor)
return Reference_Type is
begin
Unique (Container, True);
-- diff
return (Element => Position.Element.all'Access);
end Reference;
function Constant_Reference (Container : aliased Map; Key : Key_Type)
return Constant_Reference_Type is
begin
return Constant_Reference (Container, Find (Container, Key));
end Constant_Reference;
function Reference (Container : aliased in out Map; Key : Key_Type)
return Reference_Type is
begin
return Reference (Container, Find (Container, Key));
end Reference;
procedure Assign (Target : in out Map; Source : Map) is
begin
Copy_On_Write.Assign (
Target.Super'Access,
Source.Super'Access,
Free => Free_Data'Access);
end Assign;
function Copy (Source : Map; Capacity : Count_Type := 0) return Map is
begin
return Result : Map do
Copy_On_Write.Copy (
Result.Super'Access,
Source.Super'Access,
0, -- Length is unused
Count_Type'Max (Capacity, Length (Source)),
Allocate => Allocate_Data'Access,
Copy => Copy_Data'Access);
end return;
end Copy;
procedure Move (Target : in out Map; Source : in out Map) is
begin
Copy_On_Write.Move (
Target.Super'Access,
Source.Super'Access,
Free => Free_Data'Access);
-- diff
end Move;
procedure Insert (
Container : in out Map;
Key : Key_Type;
New_Item : Element_Type;
Position : out Cursor;
Inserted : out Boolean)
is
-- diff
-- diff
-- diff
-- diff
-- diff
-- diff
-- diff
-- diff
-- diff
-- diff
-- diff
-- diff
-- diff
-- diff
New_Hash : constant Hash_Type := Hash (Key);
begin
-- diff
-- diff
Position := Find (Container, New_Hash, Key);
Inserted := Position = null;
if Inserted then
Unique (Container, True);
Allocate_Node (Position, Key, New_Item);
declare
Data : constant Data_Access := Downcast (Container.Super.Data);
begin
Hash_Tables.Insert (
Data.Table,
Data.Length,
New_Hash,
Upcast (Position));
end;
end if;
end Insert;
-- diff (Insert)
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
procedure Insert (
Container : in out Map;
Key : Key_Type;
New_Item : Element_Type)
is
Position : Cursor;
Inserted : Boolean;
begin
Insert (Container, Key, New_Item, Position, Inserted);
if not Inserted then
raise Constraint_Error;
end if;
end Insert;
procedure Include (
Container : in out Map;
Key : Key_Type;
New_Item : Element_Type)
is
Position : Cursor;
Inserted : Boolean;
begin
Insert (Container, Key, New_Item, Position, Inserted);
if not Inserted then
Replace_Element (Container, Position, New_Item);
end if;
end Include;
procedure Replace (
Container : in out Map;
Key : Key_Type;
New_Item : Element_Type) is
begin
Replace_Element (Container, Find (Container, Key), New_Item);
end Replace;
procedure Exclude (Container : in out Map; Key : Key_Type) is
Position : Cursor := Find (Container, Key);
begin
if Position /= null then
Delete (Container, Position);
end if;
end Exclude;
procedure Delete (Container : in out Map; Key : Key_Type) is
Position : Cursor := Find (Container, Key);
begin
Delete (Container, Position);
end Delete;
procedure Delete (Container : in out Map; Position : in out Cursor) is
Position_2 : Hash_Tables.Node_Access := Upcast (Position);
begin
Unique (Container, True);
declare
Data : constant Data_Access := Downcast (Container.Super.Data);
begin
Hash_Tables.Remove (Data.Table, Data.Length, Position_2);
end;
Free_Node (Position_2);
Position := null;
end Delete;
function First (Container : Map) return Cursor is
begin
if Is_Empty (Container) then
return null;
else
Unique (Container'Unrestricted_Access.all, False);
return Downcast (Hash_Tables.First (
Downcast (Container.Super.Data).Table));
end if;
end First;
function Next (Position : Cursor) return Cursor is
begin
return Downcast (Position.Super.Next);
end Next;
procedure Next (Position : in out Cursor) is
begin
Position := Downcast (Position.Super.Next);
end Next;
function Find (Container : Map; Key : Key_Type) return Cursor is
begin
return Find (Container, Hash (Key), Key);
end Find;
function Element (
Container : Map'Class;
Key : Key_Type)
return Element_Type is
begin
return Element (Find (Map (Container), Key));
end Element;
function Contains (Container : Map; Key : Key_Type) return Boolean is
begin
return Find (Container, Key) /= null;
end Contains;
function Equivalent_Keys (Left, Right : Cursor) return Boolean is
begin
return Equivalent_Keys (Left.Key.all, Right.Key.all);
end Equivalent_Keys;
function Equivalent_Keys (Left : Cursor; Right : Key_Type) return Boolean is
begin
return Equivalent_Keys (Left.Key.all, Right);
end Equivalent_Keys;
function Equivalent_Keys (Left : Key_Type; Right : Cursor) return Boolean is
begin
return Equivalent_Keys (Left, Right.Key.all);
end Equivalent_Keys;
procedure Iterate (
Container : Map'Class;
Process : not null access procedure (Position : Cursor))
is
type P1 is access procedure (Position : Cursor);
type P2 is access procedure (Position : Hash_Tables.Node_Access);
function Cast is new Unchecked_Conversion (P1, P2);
begin
if not Is_Empty (Map (Container)) then
Unique (Map (Container)'Unrestricted_Access.all, False);
Hash_Tables.Iterate (
Downcast (Container.Super.Data).Table,
Cast (Process));
end if;
end Iterate;
function Iterate (Container : Map'Class)
return Map_Iterator_Interfaces.Forward_Iterator'Class is
begin
return Map_Iterator'(First => First (Map (Container)));
end Iterate;
overriding procedure Adjust (Object : in out Map) is
begin
Copy_On_Write.Adjust (Object.Super'Access);
end Adjust;
overriding function First (Object : Map_Iterator) return Cursor is
begin
return Object.First;
end First;
overriding function Next (Object : Map_Iterator; Position : Cursor)
return Cursor
is
pragma Unreferenced (Object);
begin
return Next (Position);
end Next;
package body Streaming is
procedure Read (
Stream : not null access Streams.Root_Stream_Type'Class;
Item : out Map)
is
Length : Count_Type'Base;
begin
Count_Type'Base'Read (Stream, Length);
Clear (Item);
for I in 1 .. Length loop
declare
Key : constant Key_Type := Key_Type'Input (Stream);
Element : constant Element_Type := Element_Type'Input (Stream);
begin
Include (Item, Key, Element);
-- diff
-- diff
-- diff
end;
end loop;
end Read;
procedure Write (
Stream : not null access Streams.Root_Stream_Type'Class;
Item : Map)
is
Length : constant Count_Type := Indefinite_Hashed_Maps.Length (Item);
begin
Count_Type'Write (Stream, Item.Length);
if Length > 0 then
declare
Position : Cursor := First (Item);
begin
while Position /= null loop
Key_Type'Output (Stream, Position.Key.all);
Element_Type'Output (Stream, Position.Element.all);
Next (Position);
end loop;
end;
end if;
end Write;
end Streaming;
end Ada.Containers.Indefinite_Hashed_Maps;
|
SayCV/rtems-addon-packages | Ada | 6,838 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- ncurses --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 2000-2004,2011 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Eugene V. Melaragno <[email protected]> 2000
-- Version Control
-- $Revision$
-- $Date$
-- Binding Version 01.00
------------------------------------------------------------------------------
with ncurses2.util; use ncurses2.util;
with Terminal_Interface.Curses; use Terminal_Interface.Curses;
-- test effects of overlapping windows
procedure ncurses2.overlap_test is
procedure fillwin (win : Window; ch : Character);
procedure crosswin (win : Window; ch : Character);
procedure fillwin (win : Window; ch : Character) is
y1 : Line_Position;
x1 : Column_Position;
begin
Get_Size (win, y1, x1);
for y in 0 .. y1 - 1 loop
Move_Cursor (win, y, 0);
for x in 0 .. x1 - 1 loop
Add (win, Ch => ch);
end loop;
end loop;
exception
when Curses_Exception => null;
-- write to lower right corner
end fillwin;
procedure crosswin (win : Window; ch : Character) is
y1 : Line_Position;
x1 : Column_Position;
begin
Get_Size (win, y1, x1);
for y in 0 .. y1 - 1 loop
for x in 0 .. x1 - 1 loop
if ((x > (x1 - 1) / 3) and (x <= (2 * (x1 - 1)) / 3))
or (((y > (y1 - 1) / 3) and (y <= (2 * (y1 - 1)) / 3))) then
Move_Cursor (win, y, x);
Add (win, Ch => ch);
end if;
end loop;
end loop;
end crosswin;
-- In a 24x80 screen like some xterms are, the instructions will
-- be overwritten.
ch : Character;
win1 : Window := New_Window (9, 20, 3, 3);
win2 : Window := New_Window (9, 20, 9, 16);
begin
Set_Raw_Mode (SwitchOn => True);
Refresh;
Move_Cursor (Line => 0, Column => 0);
Add (Str => "This test shows the behavior of wnoutrefresh() with " &
"respect to");
Add (Ch => newl);
Add (Str => "the shared region of two overlapping windows A and B. "&
"The cross");
Add (Ch => newl);
Add (Str => "pattern in each window does not overlap the other.");
Add (Ch => newl);
Move_Cursor (Line => 18, Column => 0);
Add (Str => "a = refresh A, then B, then doupdate. b = refresh B, " &
"then A, then doupdate");
Add (Ch => newl);
Add (Str => "c = fill window A with letter A. d = fill window B " &
"with letter B.");
Add (Ch => newl);
Add (Str => "e = cross pattern in window A. f = cross pattern " &
"in window B.");
Add (Ch => newl);
Add (Str => "g = clear window A. h = clear window B.");
Add (Ch => newl);
Add (Str => "i = overwrite A onto B. j = overwrite " &
"B onto A.");
Add (Ch => newl);
Add (Str => "^Q/ESC = terminate test.");
loop
ch := Code_To_Char (Getchar);
exit when ch = CTRL ('Q') or ch = CTRL ('['); -- QUIT or ESCAPE
case ch is
when 'a' => -- refresh window A first, then B
Refresh_Without_Update (win1);
Refresh_Without_Update (win2);
Update_Screen;
when 'b' => -- refresh window B first, then A
Refresh_Without_Update (win2);
Refresh_Without_Update (win1);
Update_Screen;
when 'c' => -- fill window A so it's visible
fillwin (win1, 'A');
when 'd' => -- fill window B so it's visible
fillwin (win2, 'B');
when 'e' => -- cross test pattern in window A
crosswin (win1, 'A');
when 'f' => -- cross test pattern in window B
crosswin (win2, 'B');
when 'g' => -- clear window A
Clear (win1);
Move_Cursor (win1, 0, 0);
when 'h' => -- clear window B
Clear (win2);
Move_Cursor (win2, 0, 0);
when 'i' => -- overwrite A onto B
Overwrite (win1, win2);
when 'j' => -- overwrite B onto A
Overwrite (win2, win1);
when others => null;
end case;
end loop;
Delete (win2);
Delete (win1);
Erase;
End_Windows;
end ncurses2.overlap_test;
|
zhmu/ananas | Ada | 2,883 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . M A N T I S S A --
-- --
-- B o d y --
-- --
-- Copyright (C) 1996-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body System.Mantissa is
--------------------
-- Mantissa_Value --
--------------------
function Mantissa_Value (First, Last : Integer) return Natural is
Result : Natural := 0;
Val : Integer := Integer'Max (abs First - 1, abs Last);
-- Note: First-1 allows for twos complement largest neg number
begin
while Val /= 0 loop
Val := Val / 2;
Result := Result + 1;
end loop;
return Result;
end Mantissa_Value;
end System.Mantissa;
|
shibayan/openapi-generator | Ada | 11,742 | adb | -- 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 6.0.0-SNAPSHOT.
-- https://openapi-generator.tech
-- Do not edit the class manually.
package body Samples.Petstore.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 ApiResponse_Type) is
begin
Into.Start_Entity (Name);
Into.Write_Entity ("code", Value.Code);
Into.Write_Entity ("type", Value.P_Type);
Into.Write_Entity ("message", Value.Message);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in ApiResponse_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 ApiResponse_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "code", Value.Code);
Swagger.Streams.Deserialize (Object, "type", Value.P_Type);
Swagger.Streams.Deserialize (Object, "message", Value.Message);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out ApiResponse_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : ApiResponse_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 Tag_Type) is
begin
Into.Start_Entity (Name);
Into.Write_Entity ("id", Value.Id);
Into.Write_Entity ("name", Value.Name);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Tag_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 Tag_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "id", Value.Id);
Swagger.Streams.Deserialize (Object, "name", Value.Name);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Tag_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : Tag_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 Category_Type) is
begin
Into.Start_Entity (Name);
Into.Write_Entity ("id", Value.Id);
Into.Write_Entity ("name", Value.Name);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Category_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 Category_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "id", Value.Id);
Swagger.Streams.Deserialize (Object, "name", Value.Name);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Category_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : Category_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 Pet_Type) is
begin
Into.Start_Entity (Name);
Into.Write_Entity ("id", Value.Id);
Serialize (Into, "category", Value.Category);
Into.Write_Entity ("name", Value.Name);
Serialize (Into, "photoUrls", Value.Photo_Urls);
Serialize (Into, "tags", Value.Tags);
Into.Write_Entity ("status", Value.Status);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Pet_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 Pet_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "id", Value.Id);
Deserialize (Object, "category", Value.Category);
Swagger.Streams.Deserialize (Object, "name", Value.Name);
Swagger.Streams.Deserialize (Object, "photoUrls", Value.Photo_Urls);
Deserialize (Object, "tags", Value.Tags);
Swagger.Streams.Deserialize (Object, "status", Value.Status);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Pet_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : Pet_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 Order_Type) is
begin
Into.Start_Entity (Name);
Into.Write_Entity ("id", Value.Id);
Into.Write_Entity ("petId", Value.Pet_Id);
Into.Write_Entity ("quantity", Value.Quantity);
Into.Write_Entity ("shipDate", Value.Ship_Date);
Into.Write_Entity ("status", Value.Status);
Into.Write_Entity ("complete", Value.Complete);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in Order_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 Order_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "id", Value.Id);
Swagger.Streams.Deserialize (Object, "petId", Value.Pet_Id);
Swagger.Streams.Deserialize (Object, "quantity", Value.Quantity);
Swagger.Streams.Deserialize (Object, "shipDate", Value.Ship_Date);
Swagger.Streams.Deserialize (Object, "status", Value.Status);
Swagger.Streams.Deserialize (Object, "complete", Value.Complete);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out Order_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : Order_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 User_Type) is
begin
Into.Start_Entity (Name);
Into.Write_Entity ("id", Value.Id);
Into.Write_Entity ("username", Value.Username);
Into.Write_Entity ("firstName", Value.First_Name);
Into.Write_Entity ("lastName", Value.Last_Name);
Into.Write_Entity ("email", Value.Email);
Into.Write_Entity ("password", Value.Password);
Into.Write_Entity ("phone", Value.Phone);
Into.Write_Entity ("userStatus", Value.User_Status);
Into.End_Entity (Name);
end Serialize;
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
Value : in User_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 User_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "id", Value.Id);
Swagger.Streams.Deserialize (Object, "username", Value.Username);
Swagger.Streams.Deserialize (Object, "firstName", Value.First_Name);
Swagger.Streams.Deserialize (Object, "lastName", Value.Last_Name);
Swagger.Streams.Deserialize (Object, "email", Value.Email);
Swagger.Streams.Deserialize (Object, "password", Value.Password);
Swagger.Streams.Deserialize (Object, "phone", Value.Phone);
Swagger.Streams.Deserialize (Object, "userStatus", Value.User_Status);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
Value : out User_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
Item : User_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 Samples.Petstore.Models;
|
optikos/oasis | Ada | 4,168 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Element_Vectors;
with Program.Elements.Record_Definitions;
with Program.Element_Visitors;
package Program.Nodes.Record_Definitions is
pragma Preelaborate;
type Record_Definition is
new Program.Nodes.Node
and Program.Elements.Record_Definitions.Record_Definition
and Program.Elements.Record_Definitions.Record_Definition_Text
with private;
function Create
(Record_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Components : not null Program.Element_Vectors.Element_Vector_Access;
End_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Record_Token_2 : not null Program.Lexical_Elements.Lexical_Element_Access)
return Record_Definition;
type Implicit_Record_Definition is
new Program.Nodes.Node
and Program.Elements.Record_Definitions.Record_Definition
with private;
function Create
(Components : not null Program.Element_Vectors
.Element_Vector_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Record_Definition
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Record_Definition is
abstract new Program.Nodes.Node
and Program.Elements.Record_Definitions.Record_Definition
with record
Components : not null Program.Element_Vectors.Element_Vector_Access;
end record;
procedure Initialize (Self : aliased in out Base_Record_Definition'Class);
overriding procedure Visit
(Self : not null access Base_Record_Definition;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Components
(Self : Base_Record_Definition)
return not null Program.Element_Vectors.Element_Vector_Access;
overriding function Is_Record_Definition_Element
(Self : Base_Record_Definition)
return Boolean;
overriding function Is_Definition_Element
(Self : Base_Record_Definition)
return Boolean;
type Record_Definition is
new Base_Record_Definition
and Program.Elements.Record_Definitions.Record_Definition_Text
with record
Record_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Record_Token_2 : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Record_Definition_Text
(Self : aliased in out Record_Definition)
return Program.Elements.Record_Definitions.Record_Definition_Text_Access;
overriding function Record_Token
(Self : Record_Definition)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function End_Token
(Self : Record_Definition)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Record_Token_2
(Self : Record_Definition)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Record_Definition is
new Base_Record_Definition
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Record_Definition_Text
(Self : aliased in out Implicit_Record_Definition)
return Program.Elements.Record_Definitions.Record_Definition_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Record_Definition)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Record_Definition)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Record_Definition)
return Boolean;
end Program.Nodes.Record_Definitions;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 3,141 | ads | -- This spec has been automatically generated from STM32L0x1.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package STM32_SVD.WWDG is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Control register
type CR_Register is record
-- 7-bit counter (MSB to LSB)
T : STM32_SVD.UInt7;
-- Activation bit
WDGA : STM32_SVD.Bit;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
T at 0 range 0 .. 6;
WDGA at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- CFR_WDGTB array
type CFR_WDGTB_Field_Array is array (0 .. 1) of STM32_SVD.Bit
with Component_Size => 1, Size => 2;
-- Type definition for CFR_WDGTB
type CFR_WDGTB_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- WDGTB as a value
Val : STM32_SVD.UInt2;
when True =>
-- WDGTB as an array
Arr : CFR_WDGTB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for CFR_WDGTB_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Configuration register
type CFR_Register is record
-- 7-bit window value
W : STM32_SVD.UInt7;
-- WDGTB0
WDGTB : CFR_WDGTB_Field;
-- Early wakeup interrupt
EWI : STM32_SVD.Bit;
-- unspecified
Reserved_10_31 : STM32_SVD.UInt22;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CFR_Register use record
W at 0 range 0 .. 6;
WDGTB at 0 range 7 .. 8;
EWI at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-- Status register
type SR_Register is record
-- Early wakeup interrupt flag
EWIF : STM32_SVD.Bit;
-- unspecified
Reserved_1_31 : STM32_SVD.UInt31;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
EWIF at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- System window watchdog
type WWDG_Peripheral is record
-- Control register
CR : aliased CR_Register;
-- Configuration register
CFR : aliased CFR_Register;
-- Status register
SR : aliased SR_Register;
end record
with Volatile;
for WWDG_Peripheral use record
CR at 16#0# range 0 .. 31;
CFR at 16#4# range 0 .. 31;
SR at 16#8# range 0 .. 31;
end record;
-- System window watchdog
WWDG_Periph : aliased WWDG_Peripheral
with Import, Address => WWDG_Base;
end STM32_SVD.WWDG;
|
persan/midnightsun-ctf-LoveLacedLetter | Ada | 4,474 | adb | package body Posix is
procedure Open
(File : in out Posix.File;
File_Name : in C_String;
Flags : in O_FLag;
S_Flags : in S_FLag)
is
begin
File.My_File_Descriptor := Px_Thin.Open (File_Name, Flags, S_Flags);
File.My_Is_Open := File.My_File_Descriptor /= 0;
end Open;
procedure Close (File : in out Posix.File) is
begin
Px_Thin.Close (File.My_File_Descriptor);
File.My_Is_Open := False;
end Close;
procedure Get_File_Status
(File : in Posix.File;
Status : in out File_Status)
is
Result : constant Integer :=
Px_Thin.Get_File_Status
(Fd => File.My_File_Descriptor,
Status => Status.My_Status'Access);
begin
Status.My_Is_Valid := Result = 0;
end Get_File_Status;
procedure Write (File : Posix.File; Bytes : Byte_Array) is
SSize : SSize_Type with Unreferenced;
begin
SSize :=
Px_Thin.Write
(File_Descriptor => File.My_File_Descriptor,
Buffer => Bytes,
Count => Bytes'Length);
end Write;
function Read (File : Posix.File; Bytes : in out Byte_Array) return SSize_Type is
begin
return Px_Thin.Read (File.My_File_Descriptor, Bytes, Bytes'Length);
end Read;
procedure Map_Memory
(File : in Posix.File;
Address : Void_Ptr;
Len : Size_Type;
Prot : Prot_FLag;
Flags : int;
Offset : Posix.Offset;
Memory_Map : in out Posix.Memory_Map) is
begin
Memory_Map.My_Mapping := Px_Thin.Mmap (Address,
Len,
Prot,
Flags,
File.My_File_Descriptor,
Offset);
Memory_Map.My_Length := Len;
end Map_Memory;
function Unmap_Memory (Map : in out Posix.Memory_Map) return Integer is
R : Integer;
begin
R := Px_Thin.Munmap (Map.My_Mapping, Map.My_Length);
if R = 0 then
Map.My_Mapping := MAP_FAILED;
end if;
return R;
end Unmap_Memory;
function Memory_Unmap (Address : Void_Ptr;
Length : Size_Type) return Integer is
begin
return Px_Thin.Munmap (Address, Length);
end Memory_Unmap;
New_Line : constant String := (1 => Character'Val (10));
procedure Put_Line (Text : String) is
SSize : SSize_Type;
pragma Unreferenced (SSize);
begin
SSize := Px_Thin.Write (File_Descriptor => Px_Thin.STDOUT_FILENO,
Buffer => Text,
Count => Text'Length);
SSize := Px_Thin.Write (File_Descriptor => Px_Thin.STDOUT_FILENO,
Buffer => New_Line,
Count => 1);
end Put_Line;
procedure Put (Text : String) is
SSize : SSize_Type;
pragma Unreferenced (SSize);
begin
SSize := Px_Thin.Write (File_Descriptor => Px_Thin.STDOUT_FILENO,
Buffer => Text,
Count => Text'Length);
end Put;
Max_Line_Length : constant := 1000;
function Get_Line return String is
SSize : SSize_Type with Unreferenced;
B : Byte_Array (1 .. Max_Line_Length);
Cursor : System.Storage_Elements.Storage_Offset := B 'First;
use all type System.Storage_Elements.Storage_Offset;
begin
while True loop
SSize := Px_Thin.Read (File_Descriptor => Px_Thin.STDIN_FILENO,
Buffer => B (Cursor .. Cursor),
Count => 1);
exit when B (Cursor) in Character'Pos (ASCII.LF) | Character'Pos (ASCII.CR);
Cursor := Cursor + 1;
end loop;
Cursor := Cursor - 1;
return S : String (1..Integer (Cursor)) do
for I in Integer range 1..Integer (Cursor) loop
S (I) := Character'Val (B (System.Storage_Elements.Storage_Offset (I)));
end loop;
end return;
end Get_Line;
function "-" (Text : C_String) return String is
begin
return String (Text (Text'First .. Text'Last - 1));
end "-";
function "+" (Text : String) return C_String is
begin
return C_String (Text & Nul);
end "+";
end Posix;
|
charlie5/lace | Ada | 8,781 | ads | with
GL_Types,
Interfaces.C;
package GL
--
-- Provides types and constants common to all openGL profiles.
--
is
pragma Pure;
use Interfaces;
---------
-- Types
--
-- GLvoid
--
subtype GLvoid is GL_Types.GLvoid;
type GLvoid_array is array (C.size_t range <>) of aliased GLvoid;
-- GLenum
--
subtype GLenum is GL_Types.GLenum;
type GLenum_array is array (C.size_t range <>) of aliased GLenum;
-- GLboolean
--
subtype GLboolean is GL_Types.GLboolean;
type GLboolean_array is array (C.size_t range <>) of aliased GLboolean;
-- GLbitfield
--
subtype GLbitfield is GL_Types.GLbitfield;
type GLbitfield_array is array (C.size_t range <>) of aliased GLbitfield;
-- GLshort
--
subtype GLshort is GL_Types.GLshort;
type GLshort_array is array (C.size_t range <>) of aliased GLshort;
-- GLint
--
subtype GLint is GL_Types.GLint;
type GLint_array is array (C.size_t range <>) of aliased GLint;
-- GLsizei
--
subtype GLsizei is GL_Types.GLsizei;
type GLsizei_array is array (C.size_t range <>) of aliased GLsizei;
-- GLushort
--
subtype GLushort is GL_Types.GLushort;
type GLushort_array is array (C.size_t range <>) of aliased GLushort;
-- GLuint
--
subtype GLuint is GL_Types.GLuint;
type GLuint_array is array (C.size_t range <>) of aliased GLuint;
-- GLbyte
--
subtype GLbyte is GL_Types.GLbyte;
type GLbyte_array is array (C.size_t range <>) of aliased GLbyte;
-- GLubyte
--
subtype GLubyte is GL_Types.GLubyte;
type GLubyte_array is array (C.size_t range <>) of aliased GLubyte;
-- GLfloat
--
subtype GLfloat is GL_Types.GLfloat;
type GLfloat_array is array (C.size_t range <>) of aliased GLfloat;
-- GLclampf
--
subtype GLclampf is GL_Types.GLclampf;
type GLclampf_array is array (C.size_t range <>) of aliased GLclampf;
-------------
-- Constants
--
-- ClearBufferMask
GL_DEPTH_BUFFER_BIT : constant := 16#100#;
GL_STENCIL_BUFFER_BIT : constant := 16#400#;
GL_COLOR_BUFFER_BIT : constant := 16#4000#;
-- Boolean
GL_FALSE : constant := 0;
GL_TRUE : constant := 1;
-- BeginMode
GL_POINTS : constant := 16#0#;
GL_LINES : constant := 16#1#;
GL_LINE_LOOP : constant := 16#2#;
GL_LINE_STRIP : constant := 16#3#;
GL_TRIANGLES : constant := 16#4#;
GL_TRIANGLE_STRIP : constant := 16#5#;
GL_TRIANGLE_FAN : constant := 16#6#;
-- BlendingFactorDest
GL_ZERO : constant := 0;
GL_ONE : constant := 1;
GL_ONE_MINUS_SRC_ALPHA : constant := 16#303#;
-- BlendingFactorSrc
GL_SRC_ALPHA : constant := 16#302#;
GL_SRC_ALPHA_SATURATE : constant := 16#308#;
-- CullFaceMode
GL_FRONT : constant := 16#404#;
GL_BACK : constant := 16#405#;
GL_FRONT_AND_BACK : constant := 16#408#;
-- EnableCap
GL_TEXTURE_2D : constant := 16#de1#;
GL_CULL_FACE : constant := 16#b44#;
GL_BLEND : constant := 16#be2#;
GL_STENCIL_TEST : constant := 16#b90#;
GL_DEPTH_TEST : constant := 16#b71#;
GL_SCISSOR_TEST : constant := 16#c11#;
GL_POLYGON_OFFSET_FILL : constant := 16#8037#;
-- ErrorCode
GL_NO_ERROR : constant := 0;
GL_INVALID_ENUM : constant := 16#500#;
GL_INVALID_VALUE : constant := 16#501#;
GL_INVALID_OPERATION : constant := 16#502#;
GL_OUT_OF_MEMORY : constant := 16#505#;
-- FrontFaceDirection
GL_CW : constant := 16#900#;
GL_CCW : constant := 16#901#;
-- TODO: As above, categorise and add category comment for the following ...
--
GL_LINE_WIDTH : constant := 16#b21#;
GL_ALIASED_POINT_SIZE_RANGE : constant := 16#846d#;
GL_ALIASED_LINE_WIDTH_RANGE : constant := 16#846e#;
GL_CULL_FACE_MODE : constant := 16#b45#;
GL_FRONT_FACE : constant := 16#b46#;
GL_DEPTH_RANGE : constant := 16#b70#;
GL_DEPTH_WRITEMASK : constant := 16#b72#;
GL_DEPTH_CLEAR_VALUE : constant := 16#b73#;
GL_DEPTH_FUNC : constant := 16#b74#;
GL_STENCIL_CLEAR_VALUE : constant := 16#b91#;
GL_STENCIL_FUNC : constant := 16#b92#;
GL_STENCIL_FAIL : constant := 16#b94#;
GL_STENCIL_PASS_DEPTH_FAIL : constant := 16#b95#;
GL_STENCIL_PASS_DEPTH_PASS : constant := 16#b96#;
GL_STENCIL_REF : constant := 16#b97#;
GL_STENCIL_VALUE_MASK : constant := 16#b93#;
GL_STENCIL_WRITEMASK : constant := 16#b98#;
GL_VIEWPORT : constant := 16#ba2#;
GL_SCISSOR_BOX : constant := 16#c10#;
GL_COLOR_CLEAR_VALUE : constant := 16#c22#;
GL_COLOR_WRITEMASK : constant := 16#c23#;
GL_UNPACK_ALIGNMENT : constant := 16#cf5#;
GL_PACK_ALIGNMENT : constant := 16#d05#;
GL_MAX_TEXTURE_SIZE : constant := 16#d33#;
GL_MAX_VIEWPORT_DIMS : constant := 16#d3a#;
GL_SUBPIXEL_BITS : constant := 16#d50#;
GL_RED_BITS : constant := 16#d52#;
GL_GREEN_BITS : constant := 16#d53#;
GL_BLUE_BITS : constant := 16#d54#;
GL_ALPHA_BITS : constant := 16#d55#;
GL_DEPTH_BITS : constant := 16#d56#;
GL_STENCIL_BITS : constant := 16#d57#;
GL_POLYGON_OFFSET_UNITS : constant := 16#2a00#;
GL_POLYGON_OFFSET_FACTOR : constant := 16#8038#;
GL_TEXTURE_BINDING_2D : constant := 16#8069#;
GL_DONT_CARE : constant := 16#1100#;
GL_FASTEST : constant := 16#1101#;
GL_NICEST : constant := 16#1102#;
GL_BYTE : constant := 16#1400#;
GL_UNSIGNED_BYTE : constant := 16#1401#;
GL_INT : constant := 16#1404#;
GL_UNSIGNED_INT : constant := 16#1405#;
GL_FLOAT : constant := 16#1406#;
GL_ALPHA : constant := 16#1906#;
GL_RGB : constant := 16#1907#;
GL_RGBA : constant := 16#1908#;
GL_LUMINANCE : constant := 16#1909#;
GL_LUMINANCE_ALPHA : constant := 16#190a#;
GL_NEVER : constant := 16#200#;
GL_LESS : constant := 16#201#;
GL_EQUAL : constant := 16#202#;
GL_LEQUAL : constant := 16#203#;
GL_GREATER : constant := 16#204#;
GL_NOTEQUAL : constant := 16#205#;
GL_GEQUAL : constant := 16#206#;
GL_ALWAYS : constant := 16#207#;
GL_KEEP : constant := 16#1e00#;
GL_REPLACE : constant := 16#1e01#;
GL_INCR : constant := 16#1e02#;
GL_DECR : constant := 16#1e03#;
GL_INVERT : constant := 16#150a#;
GL_VENDOR : constant := 16#1f00#;
GL_RENDERER : constant := 16#1f01#;
GL_VERSION : constant := 16#1f02#;
GL_EXTENSIONS : constant := 16#1f03#;
GL_MAJOR_VERSION : constant := 16#821B#;
GL_MINOR_VERSION : constant := 16#821C#;
GL_NEAREST : constant := 16#2600#;
GL_LINEAR : constant := 16#2601#;
GL_NEAREST_MIPMAP_NEAREST : constant := 16#2700#;
GL_LINEAR_MIPMAP_NEAREST : constant := 16#2701#;
GL_NEAREST_MIPMAP_LINEAR : constant := 16#2702#;
GL_LINEAR_MIPMAP_LINEAR : constant := 16#2703#;
GL_TEXTURE_MAG_FILTER : constant := 16#2800#;
GL_TEXTURE_MIN_FILTER : constant := 16#2801#;
GL_TEXTURE_WRAP_S : constant := 16#2802#;
GL_TEXTURE_WRAP_T : constant := 16#2803#;
GL_TEXTURE0 : constant := 16#84c0#;
GL_TEXTURE1 : constant := 16#84c1#;
GL_TEXTURE2 : constant := 16#84c2#;
GL_TEXTURE3 : constant := 16#84c3#;
GL_TEXTURE4 : constant := 16#84c4#;
GL_TEXTURE5 : constant := 16#84c5#;
GL_TEXTURE6 : constant := 16#84c6#;
GL_TEXTURE7 : constant := 16#84c7#;
GL_TEXTURE8 : constant := 16#84c8#;
GL_TEXTURE9 : constant := 16#84c9#;
GL_TEXTURE10 : constant := 16#84ca#;
GL_TEXTURE11 : constant := 16#84cb#;
GL_TEXTURE12 : constant := 16#84cc#;
GL_TEXTURE13 : constant := 16#84cd#;
GL_TEXTURE14 : constant := 16#84ce#;
GL_TEXTURE15 : constant := 16#84cf#;
GL_TEXTURE16 : constant := 16#84d0#;
GL_TEXTURE17 : constant := 16#84d1#;
GL_TEXTURE18 : constant := 16#84d2#;
GL_TEXTURE19 : constant := 16#84d3#;
GL_TEXTURE20 : constant := 16#84d4#;
GL_TEXTURE21 : constant := 16#84d5#;
GL_TEXTURE22 : constant := 16#84d6#;
GL_TEXTURE23 : constant := 16#84d7#;
GL_TEXTURE24 : constant := 16#84d8#;
GL_TEXTURE25 : constant := 16#84d9#;
GL_TEXTURE26 : constant := 16#84da#;
GL_TEXTURE27 : constant := 16#84db#;
GL_TEXTURE28 : constant := 16#84dc#;
GL_TEXTURE29 : constant := 16#84dd#;
GL_TEXTURE30 : constant := 16#84de#;
GL_TEXTURE31 : constant := 16#84df#;
GL_ACTIVE_TEXTURE : constant := 16#84e0#;
GL_REPEAT : constant := 16#2901#;
GL_CLAMP_TO_EDGE : constant := 16#812f#;
end GL;
|
reznikmm/matreshka | Ada | 3,665 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2015, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Asis;
with Engines.Contexts;
with League.Strings;
package Properties.Statements.If_Statement is
function Code
(Engine : access Engines.Contexts.Context;
Element : Asis.Expression;
Name : Engines.Text_Property) return League.Strings.Universal_String;
end Properties.Statements.If_Statement;
|
DrenfongWong/tkm-rpc | Ada | 1,313 | ads | with Tkmrpc.Types;
with Tkmrpc.Operations.Ike;
package Tkmrpc.Request.Ike.Esa_Reset is
Data_Size : constant := 8;
type Data_Type is record
Esa_Id : Types.Esa_Id_Type;
end record;
for Data_Type use record
Esa_Id at 0 range 0 .. (8 * 8) - 1;
end record;
for Data_Type'Size use Data_Size * 8;
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;
Data : Data_Type;
Padding : Padding_Type;
end record;
for Request_Type use record
Header at 0 range 0 .. (Request.Header_Size * 8) - 1;
Data at Request.Header_Size range 0 .. (Data_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.Ike.Esa_Reset,
Request_Id => 0),
Data => Data_Type'(Esa_Id => Types.Esa_Id_Type'First),
Padding => Padding_Type'(others => 0));
end Tkmrpc.Request.Ike.Esa_Reset;
|
reznikmm/matreshka | Ada | 4,601 | 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.Country_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Number_Country_Attribute_Node is
begin
return Self : Number_Country_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_Country_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Country_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Number_URI,
Matreshka.ODF_String_Constants.Country_Attribute,
Number_Country_Attribute_Node'Tag);
end Matreshka.ODF_Number.Country_Attributes;
|
RREE/ada-util | Ada | 6,196 | adb | -----------------------------------------------------------------------
-- util-serialize-tools -- Tools to Serialize objects in various formats
-- Copyright (C) 2012, 2016, 2017 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Containers;
with Util.Streams.Texts;
with Util.Serialize.Mappers.Record_Mapper;
package body Util.Serialize.Tools is
type Object_Field is (FIELD_NAME, FIELD_VALUE);
type Object_Map_Access is access all Util.Beans.Objects.Maps.Map'Class;
type Object_Mapper_Context is record
Map : Object_Map_Access;
Name : Util.Beans.Objects.Object;
end record;
type Object_Mapper_Context_Access is access all Object_Mapper_Context;
procedure Set_Member (Into : in out Object_Mapper_Context;
Field : in Object_Field;
Value : in Util.Beans.Objects.Object);
procedure Set_Member (Into : in out Object_Mapper_Context;
Field : in Object_Field;
Value : in Util.Beans.Objects.Object) is
begin
case Field is
when FIELD_NAME =>
Into.Name := Value;
when FIELD_VALUE =>
Into.Map.Include (Util.Beans.Objects.To_String (Into.Name), Value);
Into.Name := Util.Beans.Objects.Null_Object;
end case;
end Set_Member;
package Object_Mapper is new
Util.Serialize.Mappers.Record_Mapper (Element_Type => Object_Mapper_Context,
Element_Type_Access => Object_Mapper_Context_Access,
Fields => Object_Field,
Set_Member => Set_Member);
JSON_Mapping : aliased Object_Mapper.Mapper;
-- -----------------------
-- Serialize the objects defined in the object map <b>Map</b> into the <b>Output</b>
-- JSON stream. Use the <b>Name</b> as the name of the JSON object.
-- -----------------------
procedure To_JSON (Output : in out Util.Serialize.IO.JSON.Output_Stream'Class;
Name : in String;
Map : in Util.Beans.Objects.Maps.Map) is
use type Ada.Containers.Count_Type;
procedure Write (Name : in String;
Value : in Util.Beans.Objects.Object);
procedure Write (Name : in String;
Value : in Util.Beans.Objects.Object) is
begin
Output.Start_Entity (Name => "");
Output.Write_Attribute (Name => "name",
Value => Util.Beans.Objects.To_Object (Name));
Output.Write_Attribute (Name => "value",
Value => Value);
Output.End_Entity (Name => "");
end Write;
begin
if Map.Length > 0 then
declare
Iter : Util.Beans.Objects.Maps.Cursor := Map.First;
begin
Output.Start_Array (Name => Name);
while Util.Beans.Objects.Maps.Has_Element (Iter) loop
Util.Beans.Objects.Maps.Query_Element (Iter, Write'Access);
Util.Beans.Objects.Maps.Next (Iter);
end loop;
Output.End_Array (Name => Name);
end;
end if;
end To_JSON;
-- -----------------------
-- Serialize the objects defined in the object map <b>Map</b> into an XML stream.
-- Returns the JSON string that contains a serialization of the object maps.
-- -----------------------
function To_JSON (Map : in Util.Beans.Objects.Maps.Map) return String is
use type Ada.Containers.Count_Type;
begin
if Map.Length = 0 then
return "";
end if;
declare
Buffer : aliased Util.Streams.Texts.Print_Stream;
Output : Util.Serialize.IO.JSON.Output_Stream;
begin
Buffer.Initialize (Size => 10000);
Output.Initialize (Buffer'Unchecked_Access);
Output.Start_Document;
To_JSON (Output, "params", Map);
Output.End_Document;
return Util.Streams.Texts.To_String (Buffer);
end;
end To_JSON;
-- -----------------------
-- Deserializes the JSON content passed in <b>Content</b> and restore the object map
-- with their values. The object map passed in <b>Map</b> can contain existing values.
-- They will be overriden by the JSON values.
-- -----------------------
procedure From_JSON (Content : in String;
Map : in out Util.Beans.Objects.Maps.Map) is
Parser : Util.Serialize.IO.JSON.Parser;
Mapper : Util.Serialize.Mappers.Processing;
Context : aliased Object_Mapper_Context;
begin
if Content'Length > 0 then
Context.Map := Map'Unchecked_Access;
Mapper.Add_Mapping ("**", JSON_Mapping'Access);
Object_Mapper.Set_Context (Mapper, Context'Unchecked_Access);
Parser.Parse_String (Content, Mapper);
end if;
end From_JSON;
-- -----------------------
-- Deserializes the JSON content passed in <b>Content</b> and restore the object map
-- with their values.
-- Returns the object map that was restored.
-- -----------------------
function From_JSON (Content : in String) return Util.Beans.Objects.Maps.Map is
Result : Util.Beans.Objects.Maps.Map;
begin
From_JSON (Content, Result);
return Result;
end From_JSON;
begin
JSON_Mapping.Add_Mapping ("name", FIELD_NAME);
JSON_Mapping.Add_Mapping ("value", FIELD_VALUE);
end Util.Serialize.Tools;
|
AdaCore/libadalang | Ada | 230 | adb | procedure Test is
type Mod24 is mod 2 ** 24;
Time_Dif : Mod24;
Seconds_Now : Integer := 0;
Seconds_Nonce : Mod24 := 0;
begin
Time_Dif := Mod24'Mod (Seconds_Now) - Seconds_Nonce;
pragma Test_Statement;
end Test;
|
reznikmm/matreshka | Ada | 4,796 | 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.Style_Background_Image_Elements;
package Matreshka.ODF_Style.Background_Image_Elements is
type Style_Background_Image_Element_Node is
new Matreshka.ODF_Style.Abstract_Style_Element_Node
and ODF.DOM.Style_Background_Image_Elements.ODF_Style_Background_Image
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Style_Background_Image_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Style_Background_Image_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Style_Background_Image_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Leave_Node
(Self : not null access Style_Background_Image_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Visit_Node
(Self : not null access Style_Background_Image_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
end Matreshka.ODF_Style.Background_Image_Elements;
|
charlie5/lace | Ada | 16,006 | adb | with
ada.Text_IO,
ada.Integer_Text_IO,
ada.Strings.fixed,
ada.Strings.unbounded;
package body openGL.IO.wavefront
is
package real_Text_IO is new Ada.Text_IO.Float_IO (openGL.Real);
function to_Text (Self : in String) return Text
is
begin
return ada.Strings.unbounded.to_unbounded_String (Self);
end to_Text;
function to_Vector_3 (Self : in String) return Vector_3
is
use real_Text_IO;
X, Y, Z : Real;
Last : Natural;
begin
get (Self, X, Last);
get (Self (Last + 1 .. Self'Last), Y, Last);
get (Self (Last + 1 .. Self'Last), Z, Last);
return [X, Y, Z];
end to_Vector_3;
function to_Coordinate (Self : in String) return Coordinate_2D
is
use real_Text_IO;
U, V : Real;
Last : Natural;
begin
get (Self, U, Last);
get (Self (Last + 1 .. Self'Last), V, Last);
return (U, V);
end to_Coordinate;
function to_Facet (Self : in String) return IO.Face
is
use ada.Integer_Text_IO;
site_Id,
coord_Id,
normal_Id : Integer;
the_Vertices : Vertices (1 .. 5_000);
vertex_Count : long_Index_t := 0;
Last : Natural := Self'First - 1;
begin
loop
get (Self (Last + 1 .. Self'Last),
site_Id,
Last);
if Last = Self'Last
or else Self (Last + 1) = ' '
then -- Both texture coord and normal are absent.
coord_Id := Integer (null_Id);
normal_Id := Integer (null_Id);
elsif Self (Last + 1) = '/'
then
if Self (Last + 2) = '/'
then -- Texture coord is absent.
coord_Id := Integer (null_Id);
get (Self (Last + 3 .. Self'Last),
normal_Id,
Last);
else
get (Self (Last + 2 .. Self'Last),
coord_Id,
Last);
if Last = Self'Last
or else Self (Last + 1) = ' '
then -- Lighting normal is absent.
normal_Id := Integer (null_Id);
elsif Self (Last + 1) = '/'
then
get (Self (Last + 2 .. Self'Last),
normal_Id,
Last);
else
raise Constraint_Error with "Invalid indices: " & Self & ".";
end if;
end if;
else
raise Constraint_Error with "Invalid indices: " & Self & ".";
end if;
if site_Id < 0
or else coord_Id < 0
or else normal_Id < 0
then
raise Constraint_Error with "Negative indices not implemented: " & Self & ".";
end if;
vertex_Count := vertex_Count + 1;
the_Vertices (vertex_Count) := (long_Index_t ( site_Id),
long_Index_t ( coord_Id),
long_Index_t (normal_Id),
null_Id);
exit when Last + 1 >= Self'Last;
end loop;
case vertex_Count
is
when 3 => return (Triangle, the_Vertices (1 .. 3));
when 4 => return (Quad, the_Vertices (1 .. 4));
when others => return (Polygon, new Vertices' (the_Vertices (1 .. vertex_Count)));
end case;
end to_Facet;
function to_Model (model_File : in String) return IO.Model
is
use ada.Strings.fixed,
ada.Text_IO;
the_File : File_Type;
max_Elements : constant := 200_000;
the_Sites : many_Sites_view := new many_Sites (1 .. max_Elements);
the_Coords : many_Coords_view := new many_Coordinates_2D (1 .. max_Elements);
the_Normals : many_Normals_view := new many_Normals (1 .. max_Elements);
the_Faces : IO.Faces_view := new IO.Faces' (1 .. max_Elements => <>);
site_Count : long_Index_t := 0;
coord_Count : long_Index_t := 0;
normal_Count : long_Index_t := 0;
face_Count : long_Index_t := 0;
begin
open (the_File, In_File, model_File);
while not end_of_File (the_File)
loop
declare
the_Line : constant String := get_Line (the_File);
begin
if the_Line'Length = 0 or else the_Line (1) = '#'
then
null;
elsif Head (the_Line, 6) = "mtllib"
then
null; -- TODO
elsif Head (the_Line, 2) = "f "
then
face_Count := face_Count + 1;
the_Faces (face_Count) := to_Facet (the_Line (3 .. the_Line'Last));
elsif Head (the_Line, 2) = "v "
then
site_Count := site_Count + 1;
the_Sites (site_Count) := to_Vector_3 (the_Line (3 .. the_Line'Last));
elsif Head (the_Line, 3) = "vt "
then
coord_Count := coord_Count + 1;
the_Coords (coord_Count) := to_Coordinate (the_Line (4 .. the_Line'Last));
elsif Head (the_Line, 3) = "vn "
then
normal_Count := normal_Count + 1;
the_Normals (normal_Count) := to_Vector_3 (the_Line (4 .. the_Line'Last));
elsif Head (the_Line, 2) = "o "
then
null; -- Currently ignored. TODO
elsif Head (the_Line, 2) = "g "
then
null; -- Currently ignored. TODO
elsif Head (the_Line, 2) = "s "
then
null; -- Currently ignored. TODO
else
null; -- Currently ignored. TODO
end if;
end;
end loop;
close (the_File);
declare
used_Sites : constant IO. many_Sites_view := new many_Sites' (the_Sites (1 .. site_Count));
used_Coords : constant IO. many_Coords_view := new many_Coordinates_2D' (the_Coords (1 .. coord_Count));
used_Normals : constant IO.many_Normals_view := new many_Normals' (the_Normals (1 .. normal_Count));
used_Faces : constant IO. Faces_view := new IO.Faces' (the_Faces (1 .. face_Count));
begin
free (the_Sites);
free (the_Coords);
free (the_Normals);
free (the_Faces);
return (Sites => used_Sites,
Coords => used_Coords,
Normals => used_Normals,
Weights => null,
Faces => used_Faces);
end;
end to_Model;
----------
--- Images
--
function Image (Self : in IO.Face) return String
is
use ada.Strings.unbounded;
the_Vertices : Vertices renames Vertices_of (Self);
the_Image : unbounded_String := to_unbounded_String ("f ");
function id_Image (Self : in long_Index_t) return String
is
use ada.Strings.fixed;
begin
return Trim (long_Index_t'Image (Self),
ada.Strings.left);
end id_Image;
begin
for i in the_Vertices'Range
loop
append (the_Image,
id_Image (the_Vertices (i).site_Id));
if the_Vertices (i).coord_Id = null_Id
then
if the_Vertices (i).normal_Id /= null_Id
then
append (the_Image, "/");
end if;
else
append (the_Image, "/" & id_Image (the_Vertices (i).coord_Id));
end if;
-- if the_Vertices (i).normal_Id /= null_Id
-- then
-- append (the_Image,
-- "/" & id_Image (the_Vertices (i).normal_Id));
-- end if;
append (the_Image, " ");
end loop;
return to_String (the_Image);
end Image;
function Image (Self : in wavefront.Group) return String
is
use ada.Strings.unbounded;
begin
case Self.Kind
is
when object_Name => return "o " & to_String (Self.object_Name);
when group_Name => return "g " & to_String (Self. group_Name);
when smoothing_Group => return "s" & Self.smooth_group_Id'Image;
when merging_Group => return ""; -- TODO
end case;
end Image;
function Image (Self : in wavefront.Face) return String
is
begin
case Self.Kind
is
when a_Group => return Image (Self.Group);
when a_Facet => return Image (Self.Facet);
end case;
end Image;
type wf_Faces_view is access all wavefront.Faces;
function to_Model (model_Path : in String) return wavefront.Model
is
use ada.Strings.fixed,
ada.Text_IO;
the_material_Library : Text;
the_material_Name : Text;
the_object_Name : Text;
the_group_Name : Text;
the_Sites : Sites (1 .. 50_000);
site_Count : Index_t := 0;
the_Coords : Coordinates_2D (1 .. 50_000);
coord_Count : Index_t := 0;
the_Normals : Normals (1 .. 50_000);
normal_Count : Index_t := 0;
the_Faces : wf_Faces_view := new Faces' (1 .. 100_000 => <>);
face_Count : long_Index_t := 0;
the_File : File_Type;
begin
Open (the_File, In_File, model_Path);
while not End_Of_File (the_File)
loop
declare
use ada.Strings.unbounded;
the_Line : constant String := Get_Line (the_File);
begin
if the_Line'Length = 0 or else the_Line (1) = '#' then
null;
elsif Head (the_Line, 6) = "mtllib" then
the_material_Library := to_unbounded_String (the_Line (8 .. the_Line'Last));
elsif Head (the_Line, 6) = "usemtl" then
the_material_Name := to_unbounded_String (the_Line (8 .. the_Line'Last));
elsif Head (the_Line, 2) = "f " then
face_Count := face_Count + 1;
the_Faces (face_Count) := (a_Facet,
to_Facet (the_Line (3 .. the_Line'Last)));
elsif Head (the_Line, 2) = "v " then
site_Count := site_Count + 1;
the_Sites (site_Count) := to_Vector_3 (the_Line (3 .. the_Line'Last));
elsif Head (the_Line, 3) = "vt " then
coord_Count := coord_Count + 1;
the_Coords (coord_Count) := to_Coordinate (the_Line (4 .. the_Line'Last));
elsif Head (the_Line, 3) = "vn " then
normal_Count := normal_Count + 1;
the_Normals (normal_Count) := to_Vector_3 (the_Line (4 .. the_Line'Last));
elsif Head (the_Line, 2) = "o " then
the_object_Name := to_unbounded_String (the_Line (3 .. the_Line'Last));
-- face_Count := face_Count + 1;
-- the_Faces (face_Count) := (a_Group,
-- (object_Name,
-- object_Name => to_Text (the_Line (3 .. the_Line'Last))));
elsif Head (the_Line, 2) = "g " then
the_group_Name := to_unbounded_String (the_Line (3 .. the_Line'Last));
-- face_Count := face_Count + 1;
-- the_Faces (face_Count) := (a_Group,
-- (group_Name,
-- group_Name => to_Text (the_Line (3 .. the_Line'Last))));
elsif Head (the_Line, 2) = "s " then
declare
use Ada.Integer_Text_IO;
the_Id : Natural;
Last : Natural;
begin
if Head (the_Line, 5) = "s off" then
the_Id := 0;
else
Get (the_Line (3 .. the_Line'Last), the_Id, Last);
end if;
face_Count := face_Count + 1;
the_Faces (face_Count) := (a_Group,
(smoothing_Group,
smooth_group_Id => the_Id));
end;
else
put_Line ("openGL.io.wavefront ~ Unhandled line in " & model_Path & ": '" & the_Line & "'");
end if;
end;
end loop;
Close (the_File);
declare
procedure free is new Ada.Unchecked_Deallocation (Faces, wf_Faces_view);
used_Faces : constant wf_Faces_view := new wavefront.Faces'(the_Faces (1 .. face_Count));
begin
free (the_Faces);
return (material_Library => the_material_Library,
material_Name => the_material_Name,
object_Name => the_object_Name,
group_Name => the_group_Name,
Sites => new openGL.Sites' (the_Sites (1 .. site_Count)),
Coords => new Coordinates_2D' (the_Coords (1 .. coord_Count)),
Normals => new openGL.Normals' (the_Normals (1 .. normal_Count)),
Faces => used_Faces);
end;
end to_Model;
procedure write (the_Model : in wavefront.Model; to_File : in String)
is
use ada.Strings.unbounded,
ada.Text_IO;
the_File : File_type;
use Real_text_IO;
begin
Create (the_File, Out_File, Name => to_File);
if the_Model.material_Library /= ""
then
put_Line (the_File, "mtllib " & to_String (the_Model.material_Library));
new_Line (the_File);
end if;
if the_Model.object_Name /= ""
then
put_Line (the_File, "o " & to_String (the_Model.object_Name));
new_Line (the_File);
end if;
-- Write sites.
--
for Each in the_Model.Sites'Range
loop
Put (the_File, "v ");
Put (the_File, the_Model.Sites (Each) (1), Aft => 19, Exp => 0);
Put (the_File, " ");
Put (the_File, the_Model.Sites (Each) (2), Aft => 19, Exp => 0);
Put (the_File, " ");
Put (the_File, the_Model.Sites (Each) (3), Aft => 19, Exp => 0);
New_Line (the_File);
end loop;
New_Line (the_File);
-- Write texture coords.
--
for Each in the_Model.Coords'Range
loop
Put (the_File, "vt ");
Put (the_File, the_Model.Coords (Each).S, Aft => 19, Exp => 0);
Put (the_File, " ");
Put (the_File, the_Model.Coords (Each).T, Aft => 19, Exp => 0);
New_Line (the_File);
end loop;
-- New_Line (the_File);
-- Write normals.
--
-- for Each in the_Model.Normals'Range
-- loop
-- Put (the_File, "vn ");
-- Put (the_File, the_Model.Normals (Each) (1), Aft => 19, Exp => 0);
-- Put (the_File, " ");
-- Put (the_File, the_Model.Normals (Each) (2), Aft => 19, Exp => 0);
-- Put (the_File, " ");
-- Put (the_File, the_Model.Normals (Each) (3), Aft => 19, Exp => 0);
--
-- New_Line (the_File);
-- end loop;
New_Line (the_File);
-- Write faces.
--
if the_Model.group_Name /= ""
then
put_Line (the_File, "g " & to_String (the_Model.group_Name));
new_Line (the_File);
end if;
if the_Model.material_Name /= ""
then
put_Line (the_File, "usemtl " & to_String (the_Model.material_Name));
new_Line (the_File);
end if;
for Each in the_Model.Faces'Range
loop
Put_Line (the_File, Image (the_Model.Faces (Each)));
end loop;
Close (the_File);
end write;
end openGL.IO.wavefront;
|
srunr/Continued-Fractions | Ada | 20,299 | adb | with Ada.Text_IO;
with Ada.Numerics;
with Ada.Numerics.Generic_Elementary_Functions;
with Ada.Real_Time; use Ada.Real_Time;
with Extended_Real;
with Extended_Real.IO;
with Extended_Real.Elementary_Functions;
procedure Contfrac7 is
type Real is digits 15;
Start_time, End_time : Time;
Exec_time : Time_Span;
-- https://en.wikipedia.org/wiki/Continued_fraction
generic
type Scalar is digits <>;
nr_of_digits : Integer;
with function A (N : in Natural) return Scalar;
with function B (N : in Positive) return Scalar;
with package Ext_Real is new Extended_Real(Scalar,nr_of_digits);
Package Generic_Continued_Fraction is
function Estimate (Steps : in Natural) return Ext_Real.e_Real;
function e_Real_Value( str : in String) return Ext_Real.e_Real;
function delta_convergent( Step : in Natural) return Ext_Real.e_Real;
package Generic_Continued_Fraction_IO is new Ext_Real.IO;
end Generic_Continued_Fraction;
Package body Generic_Continued_Fraction is
function Estimate (Steps : in Natural) return Ext_Real.e_Real is
use Ext_Real;
function A (N : in Natural) return e_Real is (Make_Extended(A(N)));
function B (N : in Positive) return e_Real is (Make_Extended(B(N)));
Fraction : e_Real := Make_Extended(0.0);
begin
for N in reverse Natural range 1 .. Steps loop
Fraction := B(N) / (A(N) + Fraction);
end loop;
return A (0) + Fraction;
end Estimate;
function e_Real_Value( str : in String) return Ext_Real.e_Real is
rval : Ext_Real.e_Real := Ext_Real."+"(0);
Last : Natural := 0;
begin
Generic_Continued_Fraction_IO.e_Real_Val(str, rval, Last);
return rval;
end e_Real_Value;
function delta_convergent( Step : in Natural) return Ext_Real.e_Real is
use Ext_Real;
begin
return Estimate(Step) - Estimate(Step-1);
end delta_convergent;
end Generic_Continued_Fraction;
generic
type Scalar is digits <>;
nr_of_digits : Integer;
CF_Steps : Natural;
with package Ext_Real is new Extended_Real(Scalar,nr_of_digits);
with function A (N : in Natural; x : in Ext_Real.e_Real) return Ext_Real.e_Real;
with function B (N : in Positive; x : in Ext_Real.e_Real) return Ext_Real.e_Real;
Package Generic_Continued_Fraction_eReal_Functions is
function Estimate (x : in Ext_Real.e_Real; Steps : in Natural := CF_Steps) return Ext_Real.e_Real;
function e_Real_Value( str : in String) return Ext_Real.e_Real;
function delta_convergent( x : in Ext_Real.e_Real; Step : in Natural) return Ext_Real.e_Real;
package Generic_Continued_Fraction_IO is new Ext_Real.IO;
end Generic_Continued_Fraction_eReal_Functions;
Package body Generic_Continued_Fraction_eReal_Functions is
function Estimate (x : in Ext_Real.e_Real; Steps : in Natural := CF_Steps) return Ext_Real.e_Real is
use Ext_Real;
Fraction : e_Real := Make_Extended(0.0);
begin
for N in reverse Natural range 1 .. Steps loop
Fraction := B(N,x) / (A(N,x) + Fraction);
end loop;
return A (0,x) + Fraction;
end Estimate;
function e_Real_Value( str : in String) return Ext_Real.e_Real is
rval : Ext_Real.e_Real := Ext_Real."+"(0);
Last : Natural := 0;
begin
Generic_Continued_Fraction_IO.e_Real_Val(str, rval, Last);
return rval;
end e_Real_Value;
function delta_convergent( x : in Ext_Real.e_Real; Step : in Natural) return Ext_Real.e_Real is
use Ext_Real;
begin
return Estimate(x,Step) - Estimate(x,Step-1);
end delta_convergent;
end Generic_Continued_Fraction_eReal_Functions;
generic
type Scalar is digits <>;
nr_of_digits : Integer;
with package Ext_Real is new Extended_Real(Scalar,nr_of_digits);
package Pi is
function A (N : in Natural) return Scalar is (Scalar(if N = 0 then 3 else 6));
function B (N : in Positive) return Scalar is (Scalar(((2 * N - 1) ** 2)));
package Ext_Real_Continued_Fraction is new Generic_Continued_Fraction(Scalar, nr_of_digits, A, B, Ext_Real);
end Pi;
generic
type Scalar is digits <>;
nr_of_digits : Integer;
with package Ext_Real is new Extended_Real(Scalar,nr_of_digits);
package Pi2 is -- See https://en.wikipedia.org/wiki/Generalized_continued_fraction
function A (N : in Natural) return Scalar is (Scalar((if N = 0 then 0 else 2 * N - 1)));
function B (N : in Positive) return Scalar is (Scalar(if N = 0 then 0 else (if N = 1 then 4 else (N - 1)**2)));
-- converges linearly to pi with at least 3 decimal digits per 4 terms.
package Ext_Real_Continued_Fraction is new Generic_Continued_Fraction(Scalar, nr_of_digits, A, B, Ext_Real);
end Pi2;
generic
type Scalar is digits <>;
nr_of_digits : Integer;
FracIter : Integer;
with package Ext_Real is new Extended_Real(Scalar, nr_of_digits);
package sinus is
function AA (N : in Natural; x : in Ext_Real.e_Real) return Ext_Real.e_Real;
function BB (N : in Positive; x : in Ext_Real.e_Real) return Ext_Real.e_Real;
package Ext_Real_Continued_Fraction_Function is new Generic_Continued_Fraction_eReal_Functions(Scalar, nr_of_digits, FracIter, Ext_Real, AA, BB);
package Ext_Pi2 is new Pi2(Scalar, nr_of_digits, Ext_Real);
end sinus;
package body sinus is
pi : Ext_Real.e_Real := Ext_Pi2.Ext_Real_Continued_Fraction.Estimate(FracIter);
function AA (N : in Natural; x : in Ext_Real.e_Real) return Ext_Real.e_Real is
use Ext_Real;
x1 : Ext_Real.e_Real := x - (+2.0)*pi*Make_Extended(Scalar(Scalar'Floor(Make_Real(x/((+2.0)*pi)))));
x2 : Ext_Real.e_Real := x1*x1;
rval : Ext_Real.e_Real;
begin
if N = 0 then rval := +0;
elsif N = 1 then rval := +1;
elsif N = 2 then rval := +6 - x2;
else
rval := +Scalar((N+(N-2))*(N+(N-1))) - x2;
end if;
return rval;
end AA;
function BB (N : in Positive; x : in Ext_Real.e_Real) return Ext_Real.e_Real is
use Ext_Real;
-- pi : Ext_Real.e_Real := Ext_Pi2.Ext_Real_Continued_Fraction.Estimate(Integer(4*nr_of_digits/3));
x1 : Ext_Real.e_Real := x - (+2.0)*pi*Make_Extended(Scalar(Scalar'Floor(Make_Real(x/((+2.0)*pi)))));
x2 : Ext_Real.e_Real := x1*x1;
rval : Ext_Real.e_Real;
begin
if N = 1 then rval := x1;
elsif N = 2 then rval := x2;
elsif N = 3 then rval := (+6)*x2;
else rval := Make_Extended(Scalar((N+(N-2))*(N+(N-1))))*x2;
end if;
return rval;
end BB;
end sinus;
generic
type Scalar is digits <>;
nr_of_digits : Integer;
with package Ext_Real is new Extended_Real(Scalar, nr_of_digits);
package Square_Root_Of_2 is
function A (N : in Natural) return Scalar is (Scalar((if N = 0 then 1 else 2)));
function B (N : in Positive) return Scalar is (Scalar(1));
package Ext_Real_Continued_Fraction is new Generic_Continued_Fraction(Scalar, nr_of_digits, A, B, Ext_Real);
end Square_Root_Of_2;
generic
type Scalar is digits <>;
nr_of_digits : Integer;
with package Ext_Real is new Extended_Real(Scalar, nr_of_digits);
package Napiers_Constant is
function A (N : in Natural) return Scalar is (Scalar(if N = 0 then 2 else N));
function B (N : in Positive) return Scalar is (Scalar(if N = 1 then 1 else N-1));
package Ext_Real_Continued_Fraction is new Generic_Continued_Fraction(Scalar, nr_of_digits, A, B, Ext_Real);
end Napiers_Constant;
generic
type Scalar is digits <>;
nr_of_digits : Integer;
with package Ext_Real is new Extended_Real(Scalar,nr_of_digits);
package Golden_Ratio is
function A (N : in Natural) return Scalar is (Scalar(1));
function B (N : in Positive) return Scalar is (Scalar(1));
package Ext_Real_Continued_Fraction is new Generic_Continued_Fraction(Scalar, nr_of_digits, A, B, Ext_Real);
end Golden_Ratio;
use Ada.Text_IO;
begin -- Contfrac
declare
Dec_digits : Natural := 30;
Fraction_iterations : Natural := 100;
package Ext_Real_Square_Root_Of_2 is new Extended_Real(Real,Dec_digits); use Ext_Real_Square_Root_Of_2;
package Ext_Real_Square_Root_Of_2_IO is new Ext_Real_Square_Root_Of_2.IO; use Ext_Real_Square_Root_Of_2_IO;
package Ext_Square_Root_Of_2 is new Square_Root_Of_2(Real, Dec_digits, Ext_Real_Square_Root_Of_2); use Ext_Square_Root_Of_2;
SquareRootOf2_30 : constant String := "1.41421356237309504880168872421";
-- source : https://www.wolframalpha.com/input/?i=sqr%282%29+30+digits
begin
Put("Square_Root_Of_2(digits: " & Ext_Real_Square_Root_Of_2.Desired_Decimal_Digit_Precision'Image & ") = ");
Start_time := clock;
Put(e_Real_Image(Ext_Square_Root_Of_2.Ext_Real_Continued_Fraction.Estimate(Fraction_iterations)));
End_time := clock;
Exec_Time := End_Time - Start_Time;
Put_Line(" Execution time : " & Duration'Image (To_Duration(Exec_Time)) & " seconds ");
Put_line("SquareRootOf2 constant = " & SquareRootOf2_30);
Put_Line("SquareRootOf2_30error : " & Ext_Real_Square_Root_Of_2_IO.e_Real_Image(Ext_Square_Root_Of_2.Ext_Real_Continued_Fraction.Estimate(Fraction_iterations) -
Ext_Square_Root_Of_2.Ext_Real_Continued_Fraction.e_Real_Value(SquareRootOf2_30)));
Put_Line("Delta Convergent(" & Fraction_iterations'Image & ") = " & e_Real_Image(Ext_Square_Root_Of_2.Ext_Real_Continued_Fraction.delta_convergent(Fraction_iterations)));
new_line;
end;
declare
Dec_digits : Natural := 60;
Fraction_iterations : Natural := 100;
package Ext_Real_Napiers_Constant is new Extended_Real(Real, Dec_digits); use Ext_Real_Napiers_Constant;
package Ext_Real_Napiers_Constant_IO is new Ext_Real_Napiers_Constant.IO; use Ext_Real_Napiers_Constant_IO;
package Ext_Napiers_Constant is new Napiers_Constant(Real, Dec_digits, Ext_Real_Napiers_Constant); use Ext_Napiers_Constant;
NapiersConstant60 : constant String := "2.71828182845904523536028747135266249775724709369995957496697";
-- source : https://www.wolframalpha.com/input/?i=exp%281%29+60+digits
begin
Put("Napiers_Constant(digits: " & Ext_Real_Napiers_Constant.Desired_Decimal_Digit_Precision'Image & ") = ");
Start_time := clock;
Put (e_Real_Image(Ext_Napiers_Constant.Ext_Real_Continued_Fraction.Estimate(Fraction_iterations)));
End_time := clock;
Exec_Time := End_Time - Start_Time;
Put_Line (" Execution time : " & Duration'Image (To_Duration(Exec_Time)) & " seconds ");
Put_line("NapiersConstant constant = " & NapiersConstant60);
Put_Line("NapiersConstant60error : " & Ext_Real_Napiers_Constant_IO.e_Real_Image(Ext_Napiers_Constant.Ext_Real_Continued_Fraction.Estimate(Fraction_iterations) -
Ext_Napiers_Constant.Ext_Real_Continued_Fraction.e_Real_Value(NapiersConstant60)));
Put_Line("Delta Convergent(" & Fraction_iterations'Image & ") = " & e_Real_Image(Ext_Napiers_Constant.Ext_Real_Continued_Fraction.delta_convergent(Fraction_iterations)));
new_line;
end;
declare
Dec_digits : Natural := 90;
Fraction_iterations : Natural := 100;
package Ext_Real_Pi is new Extended_Real(Real,Dec_digits); use Ext_Real_Pi;
package Ext_Real_Pi_IO is new Ext_Real_Pi.IO; use Ext_Real_Pi_IO;
package Ext_Pi is new Pi(Real, Dec_digits, Ext_Real_Pi); use Ext_Pi;
Pi90 : constant String := "3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803483";
-- source : https://www.wolframalpha.com/input/?i=N%5BPi%2C+90%5D
begin
Put("Pi(digits: " & Ext_Real_Pi.Desired_Decimal_Digit_Precision'Image & ") = ");
Start_time := clock;
Put (e_Real_Image(Ext_Pi.Ext_Real_Continued_Fraction.Estimate (Fraction_iterations)));
End_time := clock;
Exec_Time := End_Time - Start_Time;
Put_Line (" Execution time : " & Duration'Image (To_Duration(Exec_Time)) & " seconds ");
Put_line("Pi constant = " & Pi90);
Put_Line("Pi90error : " & Ext_Real_Pi_IO.e_Real_Image(Ext_Pi.Ext_Real_Continued_Fraction.Estimate(Fraction_iterations) -
Ext_Pi.Ext_Real_Continued_Fraction.e_Real_Value(Pi90)));
Put_Line("Delta Convergent(" & Fraction_iterations'Image & ") = " & e_Real_Image(Ext_Pi.Ext_Real_Continued_Fraction.delta_convergent(Fraction_iterations)));
new_line;
end;
declare
use Ada.Numerics;
Dec_digits : Natural := 90;
Fraction_iterations : Natural := 100;
package Pi2_Real_Elementary_Functions is new Generic_Elementary_Functions(Real); use Pi2_Real_Elementary_Functions;
package Ext_Real_Pi2 is new Extended_Real(Real,Dec_digits); use Ext_Real_Pi2;
Package Ext_Real_Pi2_Elementary_Functions is new Ext_Real_Pi2.Elementary_Functions( Sqrt => Pi2_Real_Elementary_Functions.Sqrt,
Log => Pi2_Real_Elementary_Functions.Log,
Exp => Pi2_Real_Elementary_Functions.Exp,
Arcsin =>Pi2_Real_Elementary_Functions.Arcsin,
Arctan => Pi2_Real_Elementary_Functions.Arctan); use Ext_Real_Pi2_Elementary_Functions;
package Ext_Real_Pi2_IO is new Ext_Real_Pi2.IO; use Ext_Real_Pi2_IO;
package Ext_Pi2 is new Pi2(Real, Dec_digits, Ext_Real_Pi2); use Ext_Pi2;
Pi90 : constant String := "3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803483";
-- source : https://www.wolframalpha.com/input/?i=N%5BPi%2C+90%5D
begin
Put("Pi2(digits: " & Ext_Real_Pi2.Desired_Decimal_Digit_Precision'Image & ") = ");
Start_time := clock;
Put (e_Real_Image(Ext_Pi2.Ext_Real_Continued_Fraction.Estimate(Fraction_iterations)));
End_time := clock;
Exec_Time := End_Time - Start_Time;
Put_Line (" Execution time : " & Duration'Image (To_Duration(Exec_Time)) & " seconds ");
Put_line("Pi constant = " & Pi90);
Put_Line("Pi290error : " & Ext_Real_Pi2_IO.e_Real_Image(Ext_Pi2.Ext_Real_Continued_Fraction.Estimate(Fraction_iterations) -
Ext_Pi2.Ext_Real_Continued_Fraction.e_Real_Value(Pi90)));
Put_Line("Delta Convergent(" & Fraction_iterations'Image & ") = " & e_Real_Image(Ext_Pi2.Ext_Real_Continued_Fraction.delta_convergent(Fraction_iterations)));
Put_Line("Pi2 - e_Pi = " & Ext_Real_Pi2_IO.e_Real_Image(Ext_Pi2.Ext_Real_Continued_Fraction.Estimate(Fraction_iterations) - e_Pi));
new_line;
end;
declare
Dec_digits : Natural := 50;
Fraction_iterations : Natural := 100;
package Ext_Real_Golden_Ratio is new Extended_Real(Real,Dec_digits); use Ext_Real_Golden_Ratio;
package Ext_Real_Golden_Ratio_IO is new Ext_Real_Golden_Ratio.IO; use Ext_Real_Golden_Ratio_IO;
package Ext_Golden_Ratio is new Golden_Ratio(Real, Dec_digits, Ext_Real_Golden_Ratio); use Ext_Golden_Ratio;
GoldenRatio50 : constant String := "1.6180339887498948482045868343656381177203091798058";
-- source: https://www.wolframalpha.com/input/?i=N%5BGoldenRatio%2C+50%5D
begin
Put("Golden_Ratio(digits: " & Ext_Real_Golden_Ratio.Desired_Decimal_Digit_Precision'Image & ") = ");
Start_time := clock;
Put (e_Real_Image(Ext_Golden_Ratio.Ext_Real_Continued_Fraction.Estimate(Fraction_iterations)));
End_time := clock;
Exec_Time := End_Time - Start_Time;
Put_Line (" Execution time : " & Duration'Image (To_Duration(Exec_Time)) & " seconds ");
Put_line("Golden_Ratio constant = " & GoldenRatio50);
Put_Line("GoldenRatio50error : " & Ext_Real_Golden_Ratio_IO.e_Real_Image(Ext_Golden_Ratio.Ext_Real_Continued_Fraction.Estimate(Fraction_iterations) -
Ext_Golden_Ratio.Ext_Real_Continued_Fraction.e_Real_Value(GoldenRatio50)));
Put_Line("Delta Convergent(" & Fraction_iterations'Image & ") = " & e_Real_Image(Ext_Golden_Ratio.Ext_Real_Continued_Fraction.delta_convergent(Fraction_iterations)));
new_line;
end;
declare
use Ada.Numerics;
Dec_digits : Natural := 90;
Fraction_iterations : Natural := 100;
package Sin_Real_Elementary_Functions is new Generic_Elementary_Functions(Real); use Sin_Real_Elementary_Functions;
package Ext_Real_Sin is new Extended_Real(Real,Dec_digits); use Ext_Real_Sin;
Package Ext_Real_Sin_Elementary_Functions is new Ext_Real_Sin.Elementary_Functions( Sqrt => Sin_Real_Elementary_Functions.Sqrt,
Log => Sin_Real_Elementary_Functions.Log,
Exp => Sin_Real_Elementary_Functions.Exp,
Arcsin => Sin_Real_Elementary_Functions.Arcsin,
Arctan => Sin_Real_Elementary_Functions.Arctan); use Ext_Real_Sin_Elementary_Functions;
package Ext_Real_Sin_IO is new Ext_Real_Sin.IO; use Ext_Real_Sin_IO;
package Ext_Sin is new sinus(Real, Dec_digits, Fraction_iterations, Ext_Real_Sin); use Ext_Sin;
-- x : Real := Ada.Numerics.pi/2.0;
Pi90 : constant String := "3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803483";
-- source : https://www.wolframalpha.com/input/?i=N%5BPi%2C+90%5D
x : e_Real := Ext_Sin.Ext_Real_Continued_Fraction_Function.e_Real_Value(Pi90)/(+6.0);
begin
Put("Sinus_ContFrac(digits: " & Ext_Real_Sin.Desired_Decimal_Digit_Precision'Image & ")( x = " & e_Real_Image(x) & ") = ");
Start_time := clock;
Put (e_Real_Image(Ext_Sin.Ext_Real_Continued_Fraction_Function.Estimate(x)));
End_time := clock;
Exec_Time := End_Time - Start_Time;
Put_Line(" Execution time : " & Duration'Image (To_Duration(Exec_Time)) & " seconds ");
Put_Line("Sinus90error : " & Ext_Real_Sin_IO.e_Real_Image(Ext_Sin.Ext_Real_Continued_Fraction_Function.Estimate(x) -
Ext_Real_Sin_Elementary_Functions.Sin(Ext_Real_Sin_Elementary_Functions.e_Pi/(+6.0),(+2.0)*Ext_Real_Sin_Elementary_Functions.e_Pi)));
Put_Line("Delta Convergent(" & Fraction_iterations'Image & ") = " & e_Real_Image(Ext_Sin.Ext_Real_Continued_Fraction_Function.delta_convergent(x,Fraction_iterations)));
Put_Line("Ext_Real_Sin.Elementary_Functions.sin(" & Ext_Real_Sin_IO.e_Real_Image(Ext_Real_Sin_Elementary_Functions.e_Pi/(+6.0)) &") = " &
Ext_Real_Sin_IO.e_Real_Image(Ext_Real_Sin_Elementary_Functions.Sin(Ext_Real_Sin_Elementary_Functions.e_Pi/(+6.0),(+2.0)*Ext_Real_Sin_Elementary_Functions.e_Pi)));
Start_time := clock;
Put("Ext_Real_Sin.Elementary_Functions.sin(pi/6) - 1/2 = " & Ext_Real_Sin_IO.e_Real_Image(
Ext_Real_Sin_Elementary_Functions.Sin(Ext_Real_Sin_Elementary_Functions.e_Pi/(+6.0),(+2.0)*Ext_Real_Sin_Elementary_Functions.e_Pi) - (+1.0)/(+2.0)));
End_time := clock;
Exec_Time := End_Time - Start_Time;
Put_Line(" Execution time : " & Duration'Image (To_Duration(Exec_Time)) & " seconds ");
Put_Line("Ext_Real_Sin.Elementary_Functions.Arcsin(1/2) * 6.0 = " &
Ext_Real_Sin_IO.e_Real_Image((+6.0)*Ext_Real_Sin_Elementary_Functions.Arcsin((+1.0)/(+2.0))));
Put_Line("Ext_Real_Sin.Elementary_Functions.Arcsin(1/2) * 6.0 - Pi90 = " &
Ext_Real_Sin_IO.e_Real_Image((+6.0)*Ext_Real_Sin_Elementary_Functions.Arcsin((+1.0)/(+2.0)) - Ext_Sin.Ext_Real_Continued_Fraction_Function.e_Real_Value(Pi90)));
new_line;
end;
end Contfrac7;
|
MinimSecure/unum-sdk | Ada | 951 | adb | -- Copyright 2018-2019 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
procedure Foo_H731_021 is
Procedure C_Func;
Procedure C_FuncNoDebug;
pragma Import (C, C_Func, "MixedCaseFunc");
pragma Import (C, C_FuncNoDebug, "NoDebugMixedCaseFunc");
begin
C_Func;
C_FuncNoDebug;
end Foo_H731_021;
|
io7m/coreland-sdl-ada | Ada | 4,554 | ads | with Interfaces.C_Streams;
with Interfaces.C.Strings;
package SDL.RWops is
package C_Streams renames Interfaces.C_Streams;
package CS renames Interfaces.C.Strings;
type Stdio_File_t is new C_Streams.FILEs;
type RWops_t;
type RWops_Access_t is access all RWops_t;
type Seek_Callback_t is access function
(Context : RWops_Access_t;
Off : C.int;
Whence : C.int)
return C.int;
type Read_Callback_t is access function
(Context : RWops_Access_t;
Ptr : Void_Ptr_t;
Size : C.int;
Maxnum : C.int)
return C.int;
type Write_Callback_t is access function
(Context : RWops_Access_t;
Ptr : Void_Ptr_t;
Size : C.int;
Num : C.int)
return C.int;
type Close_Callback_t is access function (Context : RWops_Access_t) return C.int;
pragma Convention (C, Seek_Callback_t);
pragma Convention (C, Read_Callback_t);
pragma Convention (C, Write_Callback_t);
pragma Convention (C, Close_Callback_t);
type Io_Stdio_t is record
Auto_Close : C.int;
Fp : Stdio_File_t;
end record;
pragma Convention (C, Io_Stdio_t);
type Io_Mem_t is record
Base : Uint8_Ptr_t;
Here : Uint8_Ptr_t;
Stop : Uint8_Ptr_t;
end record;
pragma Convention (C, Io_Mem_t);
type Io_Unknown_t is record
Data : Void_Ptr_t;
end record;
pragma Convention (C, Io_Unknown_t);
type Type_Selector is (T_Stdio, T_Mem, T_Unknown);
type Io_Union_t (Selector : Type_Selector := T_Stdio) is record
case Selector is
when T_Stdio =>
Stdio : Io_Stdio_t;
when T_Mem =>
Mem : Io_Mem_t;
when T_Unknown =>
Unknown : Io_Unknown_t;
end case;
end record;
pragma Convention (C, Io_Union_t);
pragma Unchecked_Union (Io_Union_t);
type RWops_t is record
Seek : Seek_Callback_t;
Read : Read_Callback_t;
Write : Write_Callback_t;
Close : Close_Callback_t;
Type_Union : Uint32_t;
Hidden : Io_Union_t;
end record;
pragma Convention (C, RWops_t);
Seek_Set : constant C.int := 0;
Seek_Cur : constant C.int := 1;
Seek_End : constant C.int := 2;
function RWFromFile (File : CS.chars_ptr; Mode : CS.chars_ptr) return RWops_Access_t;
function RW_From_File (File : CS.chars_ptr; Mode : CS.chars_ptr) return RWops_Access_t renames RWFromFile;
pragma Import (C, RWFromFile, "SDL_RWFromFile");
function RWFromFile (File : String; Mode : String) return RWops_Access_t;
function RW_From_File (File : String; Mode : String) return RWops_Access_t renames RWFromFile;
pragma Inline (RWFromFile);
function RWFromFP (File : Stdio_File_t; Auto_Close : C.int) return RWops_Access_t;
function RW_From_Fp (File : Stdio_File_t; Auto_Close : C.int) return RWops_Access_t renames RWFromFP;
pragma Import (C, RWFromFP, "SDL_RWFromFP");
function RWFromMem (Mem : Void_Ptr_t; Size : C.int) return RWops_Access_t;
function RW_From_Mem (Mem : Void_Ptr_t; Size : C.int) return RWops_Access_t renames RWFromMem;
pragma Import (C, RWFromMem, "SDL_RWFromMem");
function AllocRW return RWops_Access_t;
function Alloc_RW return RWops_Access_t renames AllocRW;
pragma Import (C, AllocRW, "SDL_AllocRW");
procedure FreeRW (Area : RWops_Access_t);
procedure Free_RW (Area : RWops_Access_t) renames FreeRW;
pragma Import (C, FreeRW, "SDL_FreeRW");
function RWSeek
(Context : RWops_Access_t;
Offset : C.int;
Whence : C.int)
return C.int;
function RW_Seek
(Context : RWops_Access_t;
Offset : C.int;
Whence : C.int)
return C.int renames RWSeek;
pragma Inline (RWSeek);
function RWTell (Context : RWops_Access_t) return C.int;
function RW_Tell (Context : RWops_Access_t) return C.int renames RWTell;
pragma Inline (RWTell);
function RWRead
(Context : RWops_Access_t;
Ptr : Void_Ptr_t;
Size : C.int;
Num : C.int)
return C.int;
function RW_Read
(Context : RWops_Access_t;
Ptr : Void_Ptr_t;
Size : C.int;
Num : C.int)
return C.int renames RWRead;
pragma Inline (RWRead);
function RWWrite
(Context : RWops_Access_t;
Ptr : Void_Ptr_t;
Size : C.int;
Num : C.int)
return C.int;
function RW_Write
(Context : RWops_Access_t;
Ptr : Void_Ptr_t;
Size : C.int;
Num : C.int)
return C.int renames RWWrite;
pragma Inline (RWWrite);
function RWClose (Context : RWops_Access_t) return C.int;
function RW_Close (Context : RWops_Access_t) return C.int renames RWClose;
pragma Inline (RWClose);
end SDL.RWops;
|
reznikmm/matreshka | Ada | 6,820 | 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.Template_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Meta_Template_Element_Node is
begin
return Self : Meta_Template_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_Template_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_Template
(ODF.DOM.Meta_Template_Elements.ODF_Meta_Template_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_Template_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Template_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Meta_Template_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_Template
(ODF.DOM.Meta_Template_Elements.ODF_Meta_Template_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_Template_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_Template
(Visitor,
ODF.DOM.Meta_Template_Elements.ODF_Meta_Template_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.Template_Element,
Meta_Template_Element_Node'Tag);
end Matreshka.ODF_Meta.Template_Elements;
|
Fabien-Chouteau/lvgl-ada | Ada | 282 | ads |
package Lv.Strings is
function New_String (Str : String) return Lv.C_String_Ptr;
procedure Free (Ptr : in out Lv.C_String_Ptr);
function To_String_Array_Ptr (Arr : access constant String_Array)
return String_Array_Ptr;
end Lv.Strings;
|
stcarrez/ada-wiki | Ada | 7,565 | adb | -----------------------------------------------------------------------
-- wiki-attributes -- Wiki document attributes
-- Copyright (C) 2015, 2016, 2022 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package body Wiki.Attributes is
-- ------------------------------
-- Get the attribute name.
-- ------------------------------
function Get_Name (Position : in Cursor) return String is
Attr : constant Attribute_Ref := Attribute_Vectors.Element (Position.Pos);
begin
return Attr.Value.Name;
end Get_Name;
-- ------------------------------
-- Get the attribute value.
-- ------------------------------
function Get_Value (Position : in Cursor) return String is
Attr : constant Attribute_Ref := Attribute_Vectors.Element (Position.Pos);
begin
return Wiki.Strings.To_String (Attr.Value.Value);
end Get_Value;
-- ------------------------------
-- Get the attribute wide value.
-- ------------------------------
function Get_Wide_Value (Position : in Cursor) return Wiki.Strings.WString is
Attr : constant Attribute_Ref := Attribute_Vectors.Element (Position.Pos);
begin
return Attr.Value.Value;
end Get_Wide_Value;
-- ------------------------------
-- Returns True if the cursor has a valid attribute.
-- ------------------------------
function Has_Element (Position : in Cursor) return Boolean is
begin
return Attribute_Vectors.Has_Element (Position.Pos);
end Has_Element;
-- ------------------------------
-- Move the cursor to the next attribute.
-- ------------------------------
procedure Next (Position : in out Cursor) is
begin
Attribute_Vectors.Next (Position.Pos);
end Next;
-- ------------------------------
-- Find the attribute with the given name.
-- ------------------------------
function Find (List : in Attribute_List;
Name : in String) return Cursor is
Iter : Attribute_Vectors.Cursor := List.List.First;
begin
while Attribute_Vectors.Has_Element (Iter) loop
declare
Attr : constant Attribute_Ref := Attribute_Vectors.Element (Iter);
begin
if Attr.Value.Name = Name then
return Cursor '(Pos => Iter);
end if;
end;
Attribute_Vectors.Next (Iter);
end loop;
return Cursor '(Pos => Iter);
end Find;
-- ------------------------------
-- Find the attribute with the given name and return its value.
-- ------------------------------
function Get_Attribute (List : in Attribute_List;
Name : in String) return Wiki.Strings.WString is
Attr : constant Cursor := Find (List, Name);
begin
if Has_Element (Attr) then
return Get_Wide_Value (Attr);
else
return "";
end if;
end Get_Attribute;
-- ------------------------------
-- Append the attribute to the attribute list.
-- ------------------------------
procedure Append (List : in out Attribute_List;
Name : in Wiki.Strings.WString;
Value : in Wiki.Strings.WString) is
Attr : constant Attribute_Access
:= new Attribute '(Util.Refs.Ref_Entity with
Name_Length => Name'Length,
Value_Length => Value'Length,
Name => Wiki.Strings.To_String (Name),
Value => Value);
begin
List.List.Append (Attribute_Refs.Create (Attr));
end Append;
-- ------------------------------
-- Append the attribute to the attribute list.
-- ------------------------------
procedure Append (List : in out Attribute_List;
Name : in String;
Value : in Wiki.Strings.WString) is
Attr : constant Attribute_Access
:= new Attribute '(Util.Refs.Ref_Entity with
Name_Length => Name'Length,
Value_Length => Value'Length,
Name => Name,
Value => Value);
begin
List.List.Append (Attribute_Refs.Create (Attr));
end Append;
-- ------------------------------
-- Append the attribute to the attribute list.
-- ------------------------------
procedure Append (List : in out Attribute_List;
Name : in String;
Value : in Wiki.Strings.UString) is
Val : constant Wiki.Strings.WString := Wiki.Strings.To_WString (Value);
begin
Append (List, Name, Val);
end Append;
procedure Append (List : in out Attribute_List;
Name : in String;
Value : in Wiki.Strings.BString) is
procedure Append (Content : in Wiki.Strings.WString);
procedure Append (Content : in Wiki.Strings.WString) is
begin
Append (List, Name, Content);
end Append;
procedure Append_Attribute is
new Wiki.Strings.Wide_Wide_Builders.Get (Append);
begin
Append_Attribute (Value);
end Append;
-- ------------------------------
-- Get the cursor to get access to the first attribute.
-- ------------------------------
function First (List : in Attribute_List) return Cursor is
begin
return Cursor '(Pos => List.List.First);
end First;
-- ------------------------------
-- Get the number of attributes in the list.
-- ------------------------------
function Length (List : in Attribute_List) return Natural is
begin
return Natural (List.List.Length);
end Length;
-- ------------------------------
-- Clear the list and remove all existing attributes.
-- ------------------------------
procedure Clear (List : in out Attribute_List) is
begin
List.List.Clear;
end Clear;
-- ------------------------------
-- Iterate over the list attributes and call the <tt>Process</tt> procedure.
-- ------------------------------
procedure Iterate (List : in Attribute_List;
Process : not null access procedure (Name : in String;
Value : in Wiki.Strings.WString)) is
Iter : Attribute_Vectors.Cursor := List.List.First;
Item : Attribute_Ref;
begin
while Attribute_Vectors.Has_Element (Iter) loop
Item := Attribute_Vectors.Element (Iter);
Process (Item.Value.Name, Item.Value.Value);
Attribute_Vectors.Next (Iter);
end loop;
end Iterate;
-- ------------------------------
-- Finalize the attribute list releasing any storage.
-- ------------------------------
overriding
procedure Finalize (List : in out Attribute_List) is
begin
List.Clear;
end Finalize;
end Wiki.Attributes;
|
psyomn/ash | Ada | 1,290 | ads | -- Copyright 2019 Simon Symeonidis (psyomn)
--
-- 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 Listeners is
type Listener is record
Port_Number : Integer range 0 .. 16#ffff#;
Shutdown : Boolean := False;
WS_Root_Path : String (1 .. 256) :=
(others => Character'Val (0));
Host_Name : String (1 .. 256) :=
(others => Character'Val (0));
end record;
task type Launch_Listener is
entry Construct (The_Listener : in Listeners.Listener);
entry Start;
entry Stop;
end Launch_Listener;
function Make_Listener
(Port : Integer;
Root : String;
Host : String) return Listeners.Listener;
procedure Print_Info (L : Listener);
procedure Listen (L : Listener);
end Listeners;
|
reznikmm/matreshka | Ada | 14,720 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-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.XML_Schema.AST.Attribute_Uses;
with Matreshka.XML_Schema.AST.Complex_Types;
with Matreshka.XML_Schema.AST.Objects;
with Matreshka.XML_Schema.AST.Simple_Types;
with Matreshka.XML_Schema.AST.Types;
with Matreshka.XML_Schema.AST.Element_Declarations;
with Matreshka.XML_Schema.AST.Model_Groups;
with Matreshka.XML_Schema.AST.Particles;
with XML.Schema.Namespace_Items;
with XML.Schema.Objects.Attribute_Uses.Internals;
with XML.Schema.Objects.Particles.Internals;
with XML.Schema.Objects.Terms.Element_Declarations.Internals;
with XML.Schema.Objects.Terms.Model_Groups.Internals;
with XML.Schema.Objects.Type_Definitions.Internals;
with XML.Schema.Objects.Type_Definitions.Complex_Type_Definitions.Internals;
with XML.Schema.Objects.Type_Definitions.Simple_Type_Definitions.Internals;
package body XML.Schema.Objects is
use type Matreshka.XML_Schema.AST.Object_Access;
---------
-- "=" --
---------
function "=" (Left : XS_Object; Right : XS_Object) return Boolean is
begin
return Left.Node = Right.Node;
end "=";
--------------
-- Get_Name --
--------------
function Get_Name
(Self : XS_Object'Class) return League.Strings.Universal_String is
begin
if not Self.Is_Null then
return Self.Node.Get_Name;
else
return League.Strings.Empty_Universal_String;
end if;
end Get_Name;
--------------
-- Get_Name --
--------------
function Get_Namespace
(Self : XS_Object'Class) return League.Strings.Universal_String is
begin
if not Self.Is_Null then
return Self.Node.Get_Target_Namespace;
else
return League.Strings.Empty_Universal_String;
end if;
end Get_Namespace;
------------------------
-- Get_Namespace_Item --
------------------------
function Get_Namespace_Item
(Self : XS_Object'Class)
return XML.Schema.Namespace_Items.XS_Namespace_Item is
begin
raise Program_Error;
return X : XML.Schema.Namespace_Items.XS_Namespace_Item;
end Get_Namespace_Item;
--------------
-- Get_Type --
--------------
function Get_Type
(Self : XS_Object'Class) return XML.Schema.Component_Type is
begin
if Self.Node = null then
return None;
else
return Self.Node.Get_Type;
end if;
end Get_Type;
-------------------
-- Is_Annotation --
-------------------
function Is_Annotation (Self : XS_Object'Class) return Boolean is
begin
return Self.Get_Type = Annotation;
end Is_Annotation;
------------------------------
-- Is_Attribute_Declaration --
------------------------------
function Is_Attribute_Declaration (Self : XS_Object'Class) return Boolean is
begin
return Self.Get_Type = Attribute_Declaration;
end Is_Attribute_Declaration;
------------------------
-- Is_Attribute_Group --
------------------------
function Is_Attribute_Group (Self : XS_Object'Class) return Boolean is
begin
return Self.Get_Type = Attribute_Group;
end Is_Attribute_Group;
----------------------
-- Is_Attribute_Use --
----------------------
function Is_Attribute_Use (Self : XS_Object'Class) return Boolean is
begin
return Self.Get_Type = Attribute_Use;
end Is_Attribute_Use;
--------------------------------
-- Is_Complex_Type_Definition --
--------------------------------
function Is_Complex_Type_Definition
(Self : XS_Object'Class) return Boolean is
begin
return
Self.Get_Type = Type_Definition
and then Self.Node.all
in Matreshka.XML_Schema.AST.Complex_Types
.Complex_Type_Definition_Node'Class;
end Is_Complex_Type_Definition;
----------------------------
-- Is_Element_Declaration --
----------------------------
function Is_Element_Declaration (Self : XS_Object'Class) return Boolean is
begin
return Self.Get_Type = Element_Declaration;
end Is_Element_Declaration;
--------------
-- Is_Equal --
--------------
function Is_Equal
(Left : XS_Object; Right : XS_Object'Class) return Boolean is
begin
return Left.Node = Right.Node;
end Is_Equal;
--------------
-- Is_Facet --
--------------
function Is_Facet (Self : XS_Object'Class) return Boolean is
begin
return Self.Get_Type = Facet;
end Is_Facet;
----------------------------
-- Is_Identity_Constraint --
----------------------------
function Is_Identity_Constraint (Self : XS_Object'Class) return Boolean is
begin
return Self.Get_Type = Identity_Constraint;
end Is_Identity_Constraint;
--------------------
-- Is_Model_Group --
--------------------
function Is_Model_Group (Self : XS_Object'Class) return Boolean is
begin
return Self.Get_Type = Model_Group;
end Is_Model_Group;
-------------------------------
-- Is_Model_Group_Definition --
-------------------------------
function Is_Model_Group_Definition
(Self : XS_Object'Class) return Boolean is
begin
return Self.Get_Type = Model_Group_Definition;
end Is_Model_Group_Definition;
-------------------------
-- Is_Multivalue_Facet --
-------------------------
function Is_Multivalue_Facet (Self : XS_Object'Class) return Boolean is
begin
return Self.Get_Type = Multivalue_Facet;
end Is_Multivalue_Facet;
-----------------------------
-- Is_Notation_Declaration --
-----------------------------
function Is_Notation_Declaration (Self : XS_Object'Class) return Boolean is
begin
return Self.Get_Type = Notation_Declaration;
end Is_Notation_Declaration;
-------------
-- Is_Null --
-------------
function Is_Null (Self : XS_Object'Class) return Boolean is
begin
return Self.Node = null;
end Is_Null;
-----------------
-- Is_Particle --
-----------------
function Is_Particle (Self : XS_Object'Class) return Boolean is
begin
return Self.Get_Type = Particle;
end Is_Particle;
-------------------------------
-- Is_Simple_Type_Definition --
-------------------------------
function Is_Simple_Type_Definition
(Self : XS_Object'Class) return Boolean is
begin
return
Self.Get_Type = Type_Definition
and then Self.Node.all
in Matreshka.XML_Schema.AST.Simple_Types
.Simple_Type_Definition_Node'Class;
end Is_Simple_Type_Definition;
------------------------
-- Is_Type_Definition --
------------------------
function Is_Type_Definition (Self : XS_Object'Class) return Boolean is
begin
return Self.Get_Type = Type_Definition;
end Is_Type_Definition;
-----------------
-- Is_Wildcard --
-----------------
function Is_Wildcard (Self : XS_Object'Class) return Boolean is
begin
return Self.Get_Type = Wildcard;
end Is_Wildcard;
----------------------
-- To_Attribute_Use --
----------------------
function To_Attribute_Use
(Self : XS_Object'Class)
return XML.Schema.Objects.Attribute_Uses.XS_Attribute_Use is
begin
if Self.Is_Null or else not Self.Is_Attribute_Use then
return XML.Schema.Objects.Attribute_Uses.Null_XS_Attribute_Use;
else
return
XML.Schema.Objects.Attribute_Uses.Internals.Create
(Matreshka.XML_Schema.AST.Attribute_Use_Access (Self.Node));
end if;
end To_Attribute_Use;
--------------------------------
-- To_Complex_Type_Definition --
--------------------------------
function To_Complex_Type_Definition
(Self : XS_Object'Class)
return
XML.Schema.Objects.Type_Definitions.Complex_Type_Definitions
.XS_Complex_Type_Definition is
begin
if Self.Is_Null or else not Self.Is_Complex_Type_Definition then
return
XML.Schema.Objects.Type_Definitions.Complex_Type_Definitions
.Null_XS_Complex_Type_Definition;
else
return
XML.Schema.Objects.Type_Definitions.Complex_Type_Definitions
.Internals.Create
(Matreshka.XML_Schema.AST.Complex_Type_Definition_Access
(Self.Node));
end if;
end To_Complex_Type_Definition;
----------------------------
-- To_Element_Declaration --
----------------------------
function To_Element_Declaration
(Self : XS_Object'Class)
return
XML.Schema.Objects.Terms.Element_Declarations.XS_Element_Declaration
is
begin
if Self.Is_Null or else not Self.Is_Element_Declaration then
return
XML.Schema.Objects.Terms.Element_Declarations
.Null_XS_Element_Declaration;
else
return
XML.Schema.Objects.Terms.Element_Declarations.Internals.Create
(Matreshka.XML_Schema.AST.Element_Declaration_Access (Self.Node));
end if;
end To_Element_Declaration;
--------------------
-- To_Model_Group --
--------------------
function To_Model_Group
(Self : XS_Object'Class)
return XML.Schema.Objects.Terms.Model_Groups.XS_Model_Group is
begin
if Self.Is_Null or else not Self.Is_Model_Group then
return XML.Schema.Objects.Terms.Model_Groups.Null_XS_Model_Group;
else
return
XML.Schema.Objects.Terms.Model_Groups.Internals.Create
(Matreshka.XML_Schema.AST.Model_Group_Access (Self.Node));
end if;
end To_Model_Group;
-----------------
-- To_Particle --
-----------------
function To_Particle
(Self : XS_Object'Class)
return XML.Schema.Objects.Particles.XS_Particle is
begin
if Self.Is_Null or else not Self.Is_Particle then
return XML.Schema.Objects.Particles.Null_XS_Particle;
else
return
XML.Schema.Objects.Particles.Internals.Create
(Matreshka.XML_Schema.AST.Particle_Access (Self.Node));
end if;
end To_Particle;
-------------------------------
-- To_Simple_Type_Definition --
-------------------------------
function To_Simple_Type_Definition
(Self : XS_Object'Class)
return
XML.Schema.Objects.Type_Definitions.Simple_Type_Definitions
.XS_Simple_Type_Definition is
begin
if Self.Is_Null or else not Self.Is_Simple_Type_Definition then
return
XML.Schema.Objects.Type_Definitions.Simple_Type_Definitions
.Null_XS_Simple_Type_Definition;
else
return
XML.Schema.Objects.Type_Definitions.Simple_Type_Definitions
.Internals.Create
(Matreshka.XML_Schema.AST.Simple_Type_Definition_Access
(Self.Node));
end if;
end To_Simple_Type_Definition;
------------------------
-- To_Type_Definition --
------------------------
function To_Type_Definition
(Self : XS_Object'Class)
return XML.Schema.Objects.Type_Definitions.XS_Type_Definition is
begin
if Self.Is_Null then
return XML.Schema.Objects.Type_Definitions.Null_XS_Type_Definition;
else
return
XML.Schema.Objects.Type_Definitions.Internals.Create
(Matreshka.XML_Schema.AST.Type_Definition_Access (Self.Node));
end if;
end To_Type_Definition;
end XML.Schema.Objects;
|
AdaCore/Ada_Drivers_Library | Ada | 14,301 | ads | -- This spec has been automatically generated from STM32F7x9.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.SPI is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CR1_BR_Field is HAL.UInt3;
-- control register 1
type CR1_Register is record
-- Clock phase
CPHA : Boolean := False;
-- Clock polarity
CPOL : Boolean := False;
-- Master selection
MSTR : Boolean := False;
-- Baud rate control
BR : CR1_BR_Field := 16#0#;
-- SPI enable
SPE : Boolean := False;
-- Frame format
LSBFIRST : Boolean := False;
-- Internal slave select
SSI : Boolean := False;
-- Software slave management
SSM : Boolean := False;
-- Receive only
RXONLY : Boolean := False;
-- Data frame format
DFF : Boolean := False;
-- CRC transfer next
CRCNEXT : Boolean := False;
-- Hardware CRC calculation enable
CRCEN : Boolean := False;
-- Output enable in bidirectional mode
BIDIOE : Boolean := False;
-- Bidirectional data mode enable
BIDIMODE : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR1_Register use record
CPHA at 0 range 0 .. 0;
CPOL at 0 range 1 .. 1;
MSTR at 0 range 2 .. 2;
BR at 0 range 3 .. 5;
SPE at 0 range 6 .. 6;
LSBFIRST at 0 range 7 .. 7;
SSI at 0 range 8 .. 8;
SSM at 0 range 9 .. 9;
RXONLY at 0 range 10 .. 10;
DFF at 0 range 11 .. 11;
CRCNEXT at 0 range 12 .. 12;
CRCEN at 0 range 13 .. 13;
BIDIOE at 0 range 14 .. 14;
BIDIMODE at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- Data size
type CR2_DS_Field is
(
Size_4Bit,
Size_5Bit,
Size_6Bit,
Size_7Bit,
Size_8Bit,
Size_9Bit,
Size_10Bit,
Size_11Bit,
Size_12Bit,
Size_13Bit,
Size_14Bit,
Size_15Bit,
Size_16Bit)
with Size => 4;
for CR2_DS_Field use
(Size_4Bit => 3,
Size_5Bit => 4,
Size_6Bit => 5,
Size_7Bit => 6,
Size_8Bit => 7,
Size_9Bit => 8,
Size_10Bit => 9,
Size_11Bit => 10,
Size_12Bit => 11,
Size_13Bit => 12,
Size_14Bit => 13,
Size_15Bit => 14,
Size_16Bit => 15);
-- FIFO reception threshold
type CR2_FRXTH_Field is
(
-- RXNE event is generated if the FIFO level is greater than or equal to
-- 1/2 (16-bit).
Half,
-- RXNE event is generated if the FIFO level is greater than or equal to
-- 1/4 (8-bit).
Quarter)
with Size => 1;
for CR2_FRXTH_Field use
(Half => 0,
Quarter => 1);
-- Last DMA transfer for reception
type CR2_LDMA_RX_Field is
(
-- Number of data to transfer is even.
Even,
-- Number of data is odd.
Odd)
with Size => 1;
for CR2_LDMA_RX_Field use
(Even => 0,
Odd => 1);
-- Last DMA transfer for transmission
type CR2_LDMA_TX_Field is
(
-- Number of data to transfer is even.
Even,
-- Number of data is odd.
Odd)
with Size => 1;
for CR2_LDMA_TX_Field use
(Even => 0,
Odd => 1);
-- control register 2
type CR2_Register is record
-- Rx buffer DMA enable
RXDMAEN : Boolean := False;
-- Tx buffer DMA enable
TXDMAEN : Boolean := False;
-- SS output enable
SSOE : Boolean := False;
-- NSS pulse management
NSSP : Boolean := False;
-- Frame format
FRF : Boolean := False;
-- Error interrupt enable
ERRIE : Boolean := False;
-- RX buffer not empty interrupt enable
RXNEIE : Boolean := False;
-- Tx buffer empty interrupt enable
TXEIE : Boolean := False;
-- Data size
DS : CR2_DS_Field := STM32_SVD.SPI.Size_8Bit;
-- FIFO reception threshold
FRXTH : CR2_FRXTH_Field := STM32_SVD.SPI.Half;
-- Last DMA transfer for reception
LDMA_RX : CR2_LDMA_RX_Field := STM32_SVD.SPI.Even;
-- Last DMA transfer for transmission
LDMA_TX : CR2_LDMA_TX_Field := STM32_SVD.SPI.Even;
-- unspecified
Reserved_15_31 : HAL.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR2_Register use record
RXDMAEN at 0 range 0 .. 0;
TXDMAEN at 0 range 1 .. 1;
SSOE at 0 range 2 .. 2;
NSSP at 0 range 3 .. 3;
FRF at 0 range 4 .. 4;
ERRIE at 0 range 5 .. 5;
RXNEIE at 0 range 6 .. 6;
TXEIE at 0 range 7 .. 7;
DS at 0 range 8 .. 11;
FRXTH at 0 range 12 .. 12;
LDMA_RX at 0 range 13 .. 13;
LDMA_TX at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
-- FIFO reception level
type SR_FRLVL_Field is
(
-- FIFO is empty.
Fifo_Empty,
-- 1/4 FIFO.
Fifo_Quarter,
-- 1/2 FIFO.
Fifo_Half,
-- FIFO full.
Fifo_Full)
with Size => 2;
for SR_FRLVL_Field use
(Fifo_Empty => 0,
Fifo_Quarter => 1,
Fifo_Half => 2,
Fifo_Full => 3);
-- FIFO transmission level
type SR_FTLVL_Field is
(
-- FIFO is empty.
Fifo_Empty,
-- 1/4 FIFO.
Fifo_Quarter,
-- 1/2 FIFO.
Fifo_Half,
-- FIFO full.
Fifo_Full)
with Size => 2;
for SR_FTLVL_Field use
(Fifo_Empty => 0,
Fifo_Quarter => 1,
Fifo_Half => 2,
Fifo_Full => 3);
-- status register
type SR_Register is record
-- Read-only. Receive buffer not empty
RXNE : Boolean := False;
-- Read-only. Transmit buffer empty
TXE : Boolean := True;
-- Read-only. Channel side
CHSIDE : Boolean := False;
-- Read-only. Underrun flag
UDR : Boolean := False;
-- CRC error flag
CRCERR : Boolean := False;
-- Read-only. Mode fault
MODF : Boolean := False;
-- Read-only. Overrun flag
OVR : Boolean := False;
-- Read-only. Busy flag
BSY : Boolean := False;
-- Read-only. TI frame format error
TIFRFE : Boolean := False;
-- Read-only. FIFO reception level
FRLVL : SR_FRLVL_Field := STM32_SVD.SPI.Fifo_Empty;
-- Read-only. FIFO transmission level
FTLVL : SR_FTLVL_Field := STM32_SVD.SPI.Fifo_Empty;
-- unspecified
Reserved_13_31 : HAL.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
RXNE at 0 range 0 .. 0;
TXE at 0 range 1 .. 1;
CHSIDE at 0 range 2 .. 2;
UDR at 0 range 3 .. 3;
CRCERR at 0 range 4 .. 4;
MODF at 0 range 5 .. 5;
OVR at 0 range 6 .. 6;
BSY at 0 range 7 .. 7;
TIFRFE at 0 range 8 .. 8;
FRLVL at 0 range 9 .. 10;
FTLVL at 0 range 11 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
subtype DR_DR_Field is HAL.UInt16;
-- data register
type DR_Register is record
-- Data register
DR : DR_DR_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR_Register use record
DR at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype CRCPR_CRCPOLY_Field is HAL.UInt16;
-- CRC polynomial register
type CRCPR_Register is record
-- CRC polynomial register
CRCPOLY : CRCPR_CRCPOLY_Field := 16#7#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CRCPR_Register use record
CRCPOLY at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype RXCRCR_RxCRC_Field is HAL.UInt16;
-- RX CRC register
type RXCRCR_Register is record
-- Read-only. Rx CRC register
RxCRC : RXCRCR_RxCRC_Field;
-- unspecified
Reserved_16_31 : HAL.UInt16;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RXCRCR_Register use record
RxCRC at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype TXCRCR_TxCRC_Field is HAL.UInt16;
-- TX CRC register
type TXCRCR_Register is record
-- Read-only. Tx CRC register
TxCRC : TXCRCR_TxCRC_Field;
-- unspecified
Reserved_16_31 : HAL.UInt16;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TXCRCR_Register use record
TxCRC at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype I2SCFGR_DATLEN_Field is HAL.UInt2;
subtype I2SCFGR_I2SSTD_Field is HAL.UInt2;
subtype I2SCFGR_I2SCFG_Field is HAL.UInt2;
-- I2S configuration register
type I2SCFGR_Register is record
-- Channel length (number of bits per audio channel)
CHLEN : Boolean := False;
-- Data length to be transferred
DATLEN : I2SCFGR_DATLEN_Field := 16#0#;
-- Steady state clock polarity
CKPOL : Boolean := False;
-- I2S standard selection
I2SSTD : I2SCFGR_I2SSTD_Field := 16#0#;
-- unspecified
Reserved_6_6 : HAL.Bit := 16#0#;
-- PCM frame synchronization
PCMSYNC : Boolean := False;
-- I2S configuration mode
I2SCFG : I2SCFGR_I2SCFG_Field := 16#0#;
-- I2S Enable
I2SE : Boolean := False;
-- I2S mode selection
I2SMOD : Boolean := False;
-- Asynchronous start enable
ASTRTEN : Boolean := False;
-- unspecified
Reserved_13_31 : HAL.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for I2SCFGR_Register use record
CHLEN at 0 range 0 .. 0;
DATLEN at 0 range 1 .. 2;
CKPOL at 0 range 3 .. 3;
I2SSTD at 0 range 4 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
PCMSYNC at 0 range 7 .. 7;
I2SCFG at 0 range 8 .. 9;
I2SE at 0 range 10 .. 10;
I2SMOD at 0 range 11 .. 11;
ASTRTEN at 0 range 12 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
subtype I2SPR_I2SDIV_Field is HAL.UInt8;
-- I2S prescaler register
type I2SPR_Register is record
-- I2S Linear prescaler
I2SDIV : I2SPR_I2SDIV_Field := 16#A#;
-- Odd factor for the prescaler
ODD : Boolean := False;
-- Master clock output enable
MCKOE : Boolean := False;
-- unspecified
Reserved_10_31 : HAL.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for I2SPR_Register use record
I2SDIV at 0 range 0 .. 7;
ODD at 0 range 8 .. 8;
MCKOE at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Serial peripheral interface
type SPI_Peripheral is record
-- control register 1
CR1 : aliased CR1_Register;
-- control register 2
CR2 : aliased CR2_Register;
-- status register
SR : aliased SR_Register;
-- data register
DR : aliased DR_Register;
-- CRC polynomial register
CRCPR : aliased CRCPR_Register;
-- RX CRC register
RXCRCR : aliased RXCRCR_Register;
-- TX CRC register
TXCRCR : aliased TXCRCR_Register;
-- I2S configuration register
I2SCFGR : aliased I2SCFGR_Register;
-- I2S prescaler register
I2SPR : aliased I2SPR_Register;
end record
with Volatile;
for SPI_Peripheral use record
CR1 at 16#0# range 0 .. 31;
CR2 at 16#4# range 0 .. 31;
SR at 16#8# range 0 .. 31;
DR at 16#C# range 0 .. 31;
CRCPR at 16#10# range 0 .. 31;
RXCRCR at 16#14# range 0 .. 31;
TXCRCR at 16#18# range 0 .. 31;
I2SCFGR at 16#1C# range 0 .. 31;
I2SPR at 16#20# range 0 .. 31;
end record;
-- Serial peripheral interface
SPI1_Periph : aliased SPI_Peripheral
with Import, Address => System'To_Address (16#40013000#);
-- Serial peripheral interface
SPI2_Periph : aliased SPI_Peripheral
with Import, Address => System'To_Address (16#40003800#);
-- Serial peripheral interface
SPI3_Periph : aliased SPI_Peripheral
with Import, Address => System'To_Address (16#40003C00#);
-- Serial peripheral interface
SPI4_Periph : aliased SPI_Peripheral
with Import, Address => System'To_Address (16#40013400#);
-- Serial peripheral interface
SPI5_Periph : aliased SPI_Peripheral
with Import, Address => System'To_Address (16#40015000#);
-- Serial peripheral interface
SPI6_Periph : aliased SPI_Peripheral
with Import, Address => System'To_Address (16#40015400#);
end STM32_SVD.SPI;
|
sungyeon/drake | Ada | 442 | adb | with C.bits.confname;
with C.unistd;
package body System.Multiprocessors is
use type C.signed_long;
function Number_Of_CPUs return CPU is
Result : C.signed_long;
begin
Result :=
C.unistd.sysconf (
C.bits.confname.Cast (C.unistd.SC_NPROCESSORS_ONLN));
if Result < 0 then
raise Program_Error;
end if;
return CPU (Result);
end Number_Of_CPUs;
end System.Multiprocessors;
|
reznikmm/matreshka | Ada | 4,640 | 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.Anim_Seq_Elements;
package Matreshka.ODF_Anim.Seq_Elements is
type Anim_Seq_Element_Node is
new Matreshka.ODF_Anim.Abstract_Anim_Element_Node
and ODF.DOM.Anim_Seq_Elements.ODF_Anim_Seq
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Anim_Seq_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Anim_Seq_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Anim_Seq_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 Anim_Seq_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 Anim_Seq_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_Anim.Seq_Elements;
|
reznikmm/matreshka | Ada | 4,686 | 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.Chart_Legend_Elements;
package Matreshka.ODF_Chart.Legend_Elements is
type Chart_Legend_Element_Node is
new Matreshka.ODF_Chart.Abstract_Chart_Element_Node
and ODF.DOM.Chart_Legend_Elements.ODF_Chart_Legend
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Chart_Legend_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Chart_Legend_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Chart_Legend_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 Chart_Legend_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 Chart_Legend_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_Chart.Legend_Elements;
|
charlie5/lace | Ada | 11,734 | adb | with
float_Math.Algebra.linear.D3,
ada.unchecked_Deallocation;
package body collada.Library.visual_scenes
is
-------------
--- Transform
--
function to_Matrix (Self : in Transform) return collada.Matrix_4x4
is
use Math,
math.Algebra.linear,
math.Algebra.linear.D3;
begin
case Self.Kind
is
when Translate =>
return Transpose (to_translate_Matrix (Self.Vector)); -- Transpose converts from math Row vectors to collada Col vectors.
when Rotate =>
declare
the_Rotation : constant Matrix_3x3 := Transpose (to_Rotation (Self.Axis (1), -- Transpose converts from math Row vectors to collada Col vectors.
Self.Axis (2),
Self.Axis (3),
Self.Angle));
begin
return to_rotate_Matrix (the_Rotation);
end;
when Scale =>
return to_scale_Matrix (Self.Scale);
when full_Transform =>
return Self.Matrix;
end case;
end to_Matrix;
--------
--- Node
--
function Sid (Self : in Node) return Text
is
begin
return Self.Sid;
end Sid;
function Id (Self : in Node) return Text
is
begin
return Self.Id;
end Id;
function Name (Self : in Node) return Text
is
begin
return Self.Name;
end Name;
--------------
--- Transforms
--
function Transforms (Self : in Node) return Transform_array
is
begin
return Self.Transforms.all;
end Transforms;
function fetch_Transform (Self : access Node; transform_Sid : in String) return access Transform
is
use type ada.Strings.unbounded.unbounded_String;
begin
for i in Self.Transforms'Range
loop
if Self.Transforms (i).Sid = transform_Sid
then
return Self.Transforms (i)'Access;
end if;
end loop;
return null;
end fetch_Transform;
procedure add (Self : in out Node; the_Transform : in Transform)
is
Old : Transform_array_view := Self.Transforms;
procedure deallocate is new ada.unchecked_Deallocation (Transform_array, Transform_array_view);
begin
if Old = null
then Self.Transforms := new Transform_array' (1 => the_Transform);
else Self.Transforms := new Transform_array' (Old.all & the_Transform);
deallocate (Old);
end if;
end add;
function local_Transform (Self : in Node) return Matrix_4x4
is
begin
if Self.Transforms = null
then
return Identity_4x4;
end if;
declare
use Math;
all_Transforms : Transform_array renames Self.Transforms.all;
the_Result : Matrix_4x4 := math.Identity_4x4;
begin
for i in all_Transforms'Range
loop
the_Result := the_Result * to_Matrix (all_Transforms (i));
end loop;
return the_Result;
end;
end local_Transform;
function global_Transform (Self : in Node) return Matrix_4x4
is
use Math;
begin
if Self.Parent = null
then
return Self.local_Transform;
else
return Self.Parent.global_Transform * Self.local_Transform; -- Recurse.
end if;
end global_Transform;
function find_Transform (Self : in Node; of_Kind : in transform_Kind;
Sid : in String) return Positive
is
use type Text;
begin
for i in Self.Transforms'Range
loop
if Self.Transforms (i).Kind = of_Kind
and then Self.Transforms (i).Sid = Sid
then
return i;
end if;
end loop;
raise Transform_not_found with "No " & transform_Kind'Image (of_Kind) & " transform found with sid: " & Sid & ".";
end find_Transform;
function fetch_Transform (Self : in Node; of_Kind : in transform_Kind;
Sid : in String) return Transform
is
begin
return Self.Transforms (find_Transform (Self, of_Kind, Sid));
end fetch_Transform;
function find_Transform (Self : in Node; of_Kind : in transform_Kind) return Positive
is
begin
for i in Self.Transforms'Range
loop
if Self.Transforms (i).Kind = of_Kind
then
return i;
end if;
end loop;
raise Transform_not_found with "No " & of_Kind'Image & " transform found";
end find_Transform;
function fetch_Transform (Self : in Node; of_Kind : in transform_Kind) return Transform
is
begin
return Self.Transforms (find_Transform (Self, of_Kind));
end fetch_Transform;
function full_Transform (Self : in Node) return Matrix_4x4
is
the_Transform : constant Transform := fetch_Transform (Self, full_Transform);
begin
return the_Transform.Matrix;
end full_Transform;
function Translation (Self : in Node) return Vector_3
is
the_Translation : constant Transform := fetch_Transform (Self, Translate);
begin
return the_Translation.Vector;
end Translation;
function Rotate_Z (Self : in Node) return Vector_4
is
use Math;
the_Rotation : Transform;
begin
the_Rotation := fetch_Transform (Self, Rotate, "rotationZ");
return Vector_4 (the_Rotation.Axis & the_Rotation.Angle);
exception
when Transform_not_found =>
the_Rotation := fetch_Transform (Self, Rotate, "rotateZ");
return Vector_4 (the_Rotation.Axis & the_Rotation.Angle);
end Rotate_Z;
procedure set_Location (Self : in out Node; To : in math.Vector_3)
is
Id : constant Positive := find_Transform (Self, Translate, "location");
begin
Self.Transforms (Id).Vector := To;
end set_Location;
procedure set_Location_x (Self : in out Node; To : in math.Real)
is
Id : constant Positive := find_Transform (Self, Translate, "location");
begin
Self.Transforms (Id).Vector (1) := To;
end set_Location_x;
procedure set_Location_y (Self : in out Node; To : in math.Real)
is
Id : constant Positive := find_Transform (Self, Translate, "location");
begin
Self.Transforms (Id).Vector (2) := To;
end set_Location_y;
procedure set_Location_z (Self : in out Node; To : in math.Real)
is
Id : constant Positive := find_Transform (Self, Translate, "location");
begin
Self.Transforms (Id).Vector (3) := To;
end set_Location_z;
procedure set_Transform (Self : in out Node; To : in math.Matrix_4x4)
is
Id : constant Positive := find_Transform (Self, full_Transform, "transform");
begin
Self.Transforms (Id).Matrix := To;
end set_Transform;
procedure set_x_rotation_Angle (Self : in out Node; To : in math.Real)
is
Id : Positive;
begin
Id := find_Transform (Self, Rotate, "rotationX");
Self.Transforms (Id).Angle := To;
exception
when Transform_not_found =>
Id := find_Transform (Self, Rotate, "rotateX");
Self.Transforms (Id).Angle := To;
end set_x_rotation_Angle;
procedure set_y_rotation_Angle (Self : in out Node; To : in math.Real)
is
Id : Positive;
begin
Id := find_Transform (Self, Rotate, "rotationY");
Self.Transforms (Id).Angle := To;
exception
when Transform_not_found =>
Id := find_Transform (Self, Rotate, "rotateY");
Self.Transforms (Id).Angle := To;
end set_y_rotation_Angle;
procedure set_z_rotation_Angle (Self : in out Node; To : in math.Real)
is
Id : Positive;
begin
Id := find_Transform (Self, Rotate, "rotationZ");
Self.Transforms (Id).Angle := To;
exception
when Transform_not_found =>
Id := find_Transform (Self, Rotate, "rotateZ");
Self.Transforms (Id).Angle := To;
end set_z_rotation_Angle;
function Rotate_Y (Self : in Node) return Vector_4
is
use Math;
the_Rotation : Transform;
begin
the_Rotation := fetch_Transform (Self, Rotate, "rotationY");
return Vector_4 (the_Rotation.Axis & the_Rotation.Angle);
exception
when Transform_not_found =>
the_Rotation := fetch_Transform (Self, Rotate, "rotateY");
return Vector_4 (the_Rotation.Axis & the_Rotation.Angle);
end Rotate_Y;
function Rotate_X (Self : in Node) return Vector_4
is
use Math;
the_Rotation : Transform;
begin
the_Rotation := fetch_Transform (Self, Rotate, "rotationX");
return Vector_4 (the_Rotation.Axis & the_Rotation.Angle);
exception
when Transform_not_found =>
the_Rotation := fetch_Transform (Self, Rotate, "rotateX");
return Vector_4 (the_Rotation.Axis & the_Rotation.Angle);
end Rotate_X;
function Scale (Self : in Node) return Vector_3
is
the_Translation : constant Transform := fetch_Transform (Self, Scale, "scale");
begin
return the_Translation.Scale;
end Scale;
procedure Sid_is (Self : in out Node; Now : in Text)
is
begin
Self.Sid := Now;
end Sid_is;
procedure Id_is (Self : in out Node; Now : in Text)
is
begin
Self.Id := Now;
end Id_is;
procedure Name_is (Self : in out Node; Now : in Text)
is
begin
Self.Name := Now;
end Name_is;
------------
--- Hierachy
--
function Parent (Self : in Node) return Node_view
is
begin
return Self.Parent;
end Parent;
procedure Parent_is (Self : in out Node; Now : Node_view)
is
begin
Self.Parent := Now;
end Parent_is;
function Children (Self : in Node) return Nodes
is
begin
if Self.Children = null
then
return Nodes' (1 .. 0 => <>); -- No Nodes.
end if;
return Self.Children.all;
end Children;
function Child (Self : in Node; Which : in Positive) return Node_view
is
begin
if Self.Children = null
then
raise constraint_Error with "No children found.";
end if;
return Self.Children (Which);
end Child;
function Child (Self : in Node; Named : in String) return Node_view
is
use ada.Strings.unbounded;
begin
if Self.Children = null
then
raise constraint_Error with "Child not found.";
end if;
declare
the_Children : constant Nodes_view := Self.Children;
begin
for i in the_Children'Range
loop
if the_Children (i).Name = Named
then
return the_Children (i);
else
begin
return the_Children (i).Child (named => Named);
exception
when constraint_Error => null;
end;
end if;
end loop;
end;
raise constraint_Error with "Child not found.";
end Child;
procedure add (Self : in out Node; the_Child : in Node_view)
is
begin
if Self.Children = null
then
Self.Children := new Nodes' (1 => the_Child);
else
declare
old_Children : Nodes_view := Self.Children;
procedure deallocate is new ada.Unchecked_Deallocation (Nodes, Nodes_view);
begin
Self.Children := new Nodes' (old_Children.all & the_Child);
deallocate (old_Children);
end;
end if;
end add;
end collada.Library.visual_scenes;
|
AdaCore/Ada_Drivers_Library | Ada | 5,824 | ads | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015, 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 STMicroelectronics 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 file is based on: --
-- --
-- @file stm32f429i_discovery_lcd.h --
-- @author MCD Application Team --
-- @version V1.1.0 --
-- @date 19-June-2014 --
-- @brief This file contains all the functions prototypes for the --
-- stm32f429i_discovery_lcd.c driver. --
-- --
-- COPYRIGHT(c) 2014 STMicroelectronics --
------------------------------------------------------------------------------
with System;
with STM32.Device; use STM32.Device;
with HAL.Framebuffer;
package STM32.LTDC is
type LCD_Layer is (Layer1, Layer2);
-- These bits defines the color format
type Pixel_Format is
(Pixel_Fmt_ARGB8888,
Pixel_Fmt_RGB888,
Pixel_Fmt_RGB565,
Pixel_Fmt_ARGB1555,
Pixel_Fmt_ARGB4444,
Pixel_Fmt_L8, -- 8bit luminance
Pixel_Fmt_AL44, -- 4-bit Alpha, 4-bit Luniunance
Pixel_Fmt_AL88) -- 8-bit Alpha, 8-bit Luniunance
with Size => 3;
function Bytes_Per_Pixel (Fmt : Pixel_Format) return Natural
with Inline;
subtype Frame_Buffer_Access is System.Address;
type Blending_Factor is
(BF_Constant_Alpha,
BF_Pixel_Alpha_X_Constant_Alpha);
procedure Initialize (Width : Positive;
Height : Positive;
H_Sync : Natural;
H_Back_Porch : Natural;
H_Front_Porch : Natural;
V_Sync : Natural;
V_Back_Porch : Natural;
V_Front_Porch : Natural;
PLLSAI_N : UInt9;
PLLSAI_R : UInt3;
DivR : Natural);
function Initialized return Boolean;
procedure Start;
procedure Stop;
procedure Set_Background (R, G, B : UInt8);
procedure Layer_Init
(Layer : LCD_Layer;
Config : Pixel_Format;
Buffer : System.Address;
X, Y : Natural;
W, H : Positive;
Constant_Alpha : UInt8 := 255;
BF : Blending_Factor := BF_Pixel_Alpha_X_Constant_Alpha);
procedure Set_Layer_State
(Layer : LCD_Layer;
Enabled : Boolean);
procedure Set_Frame_Buffer
(Layer : LCD_Layer; Addr : Frame_Buffer_Access);
function Get_Frame_Buffer
(Layer : LCD_Layer)
return Frame_Buffer_Access;
procedure Reload_Config (Immediate : Boolean := False);
function To_LTDC_Mode (HAL_Mode : HAL.Framebuffer.FB_Color_Mode)
return STM32.LTDC.Pixel_Format;
-- Convert HAL.Framebuffer color mode to LTDC color mode
private
function Bytes_Per_Pixel (Fmt : Pixel_Format) return Natural
is (case Fmt is
when Pixel_Fmt_ARGB8888 => 4,
when Pixel_Fmt_RGB888 => 3,
when Pixel_Fmt_RGB565 | Pixel_Fmt_ARGB1555 | Pixel_Fmt_ARGB4444 => 2,
when Pixel_Fmt_L8 | Pixel_Fmt_AL44 => 1,
when Pixel_Fmt_AL88 => 2);
end STM32.LTDC;
|
reznikmm/matreshka | Ada | 3,927 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Svg_Fy_Attributes;
package Matreshka.ODF_Svg.Fy_Attributes is
type Svg_Fy_Attribute_Node is
new Matreshka.ODF_Svg.Abstract_Svg_Attribute_Node
and ODF.DOM.Svg_Fy_Attributes.ODF_Svg_Fy_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Svg_Fy_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Svg_Fy_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Svg.Fy_Attributes;
|
reznikmm/matreshka | Ada | 3,684 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Elements;
package ODF.DOM.Db_Auto_Increment_Elements is
pragma Preelaborate;
type ODF_Db_Auto_Increment is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Db_Auto_Increment_Access is
access all ODF_Db_Auto_Increment'Class
with Storage_Size => 0;
end ODF.DOM.Db_Auto_Increment_Elements;
|
HackInvent/Ada_Drivers_Library | Ada | 9,106 | ads | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2018, 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 file provides declarations for devices on the STM32F7 Discovery kits
-- manufactured by ST Microelectronics.
with Ada.Interrupts.Names; use Ada.Interrupts;
with System;
with STM32.Device; use STM32.Device;
with STM32.DMA; use STM32.DMA;
with STM32.DMA.Interrupts; use STM32.DMA.Interrupts;
with STM32.FMC; use STM32.FMC;
with STM32.GPIO; use STM32.GPIO;
with STM32.I2C; use STM32.I2C;
use STM32;
with Audio;
with Touch_Panel_FT5336;
with Framebuffer_RK043FN48H;
with SDCard;
package STM32.Board is
pragma Elaborate_Body;
subtype User_LED is GPIO_Point;
Blue_LED : User_LED renames PB7;
LED1 : User_LED renames Blue_LED;
LCH_LED : User_LED renames Blue_LED;
All_LEDs : GPIO_Points := (1 => Blue_LED);
procedure Initialize_LEDs;
-- MUST be called prior to any use of the LEDs
procedure Turn_On (This : in out User_LED) renames STM32.GPIO.Set;
procedure Turn_Off (This : in out User_LED) renames STM32.GPIO.Clear;
procedure Toggle (This : in out User_LED) renames STM32.GPIO.Toggle;
procedure All_LEDs_Off with Inline;
procedure All_LEDs_On with Inline;
procedure Toggle_LEDs (These : in out GPIO_Points)
renames STM32.GPIO.Toggle;
-- GPIO Pins for FMC
FMC_A : constant GPIO_Points :=
(PF0, PF1, PF2, PF3, PF4, PF5, PF12, PF13, PF14, PF15, PG0, PG1);
FMC_D : constant GPIO_Points :=
(PD14, PD15, PD0, PD1, PE7, PE8, PE9, PE10,
PE11, PE12, PE13, PE14, PE15, PD8, PD9, PD10);
FMC_SDNWE : GPIO_Point renames PH5;
FMC_SDNRAS : GPIO_Point renames PF11;
FMC_SDNCAS : GPIO_Point renames PG15;
FMC_SDCLK : GPIO_Point renames PG8;
FMC_BA0 : GPIO_Point renames PG4;
FMC_BA1 : GPIO_Point renames PG5;
FMC_SDNE0 : GPIO_Point renames PH3;
FMC_SDCKE0 : GPIO_Point renames PC3;
FMC_NBL0 : GPIO_Point renames PE0;
FMC_NBL1 : GPIO_Point renames PE1;
SDRAM_PINS : constant GPIO_Points :=
FMC_A & FMC_D & FMC_SDNWE & FMC_SDNRAS & FMC_SDNCAS &
FMC_SDCLK & FMC_BA0 & FMC_BA1 & FMC_SDNE0 & FMC_SDCKE0 &
FMC_NBL0 & FMC_NBL1;
-- SDRAM CONFIGURATION Parameters
SDRAM_Base : constant := 16#C0000000#;
SDRAM_Size : constant := 16#800000#;
SDRAM_Bank : constant STM32.FMC.FMC_SDRAM_Cmd_Target_Bank :=
STM32.FMC.FMC_Bank1_SDRAM;
SDRAM_Mem_Width : constant STM32.FMC.FMC_SDRAM_Memory_Bus_Width :=
STM32.FMC.FMC_SDMemory_Width_16b;
SDRAM_Row_Bits : constant STM32.FMC.FMC_SDRAM_Row_Address_Bits :=
STM32.FMC.FMC_RowBits_Number_12b;
SDRAM_CAS_Latency : constant STM32.FMC.FMC_SDRAM_CAS_Latency :=
STM32.FMC.FMC_CAS_Latency_2;
SDRAM_CLOCK_Period : constant STM32.FMC.FMC_SDRAM_Clock_Configuration :=
STM32.FMC.FMC_SDClock_Period_2;
SDRAM_Read_Burst : constant STM32.FMC.FMC_SDRAM_Burst_Read :=
STM32.FMC.FMC_Read_Burst_Disable;
SDRAM_Read_Pipe : constant STM32.FMC.FMC_SDRAM_Read_Pipe_Delay :=
STM32.FMC.FMC_ReadPipe_Delay_0;
SDRAM_Refresh_Cnt : constant := 1539;
SDRAM_Min_Delay_In_ns : constant := 60;
---------
-- I2C --
---------
procedure Initialize_I2C_GPIO (Port : in out I2C_Port)
with
-- I2C_2 and I2C_4 are not accessible on this board
Pre => As_Port_Id (Port) = I2C_Id_1
or else
As_Port_Id (Port) = I2C_Id_3;
--------------------------------
-- Screen/Touch panel devices --
--------------------------------
LCD_Natural_Width : constant := Framebuffer_RK043FN48H.LCD_Natural_Width;
LCD_Natural_Height : constant := Framebuffer_RK043FN48H.LCD_Natural_Height;
Display : Framebuffer_RK043FN48H.Frame_Buffer;
Touch_Panel : Touch_Panel_FT5336.Touch_Panel;
-----------
-- Audio --
-----------
Audio_I2C : I2C_Port renames I2C_3;
Audio_I2C_SDA : STM32.GPIO.GPIO_Point renames STM32.Device.PH7;
Audio_I2C_SCL : STM32.GPIO.GPIO_Point renames STM32.Device.PH8;
Audio_I2C_AF : STM32.GPIO_Alternate_Function renames STM32.Device.GPIO_AF_I2C3_4;
Audio_INT : GPIO_Point renames PD6;
-- Audio DMA configuration
Audio_DMA : DMA_Controller renames DMA_2;
Audio_Out_DMA_Interrupt : Ada.Interrupts.Interrupt_ID renames
Ada.Interrupts.Names.DMA2_Stream4_Interrupt;
Audio_DMA_Out_Stream : DMA_Stream_Selector renames Stream_4;
Audio_DMA_Out_Channel : DMA_Channel_Selector renames Channel_3;
Audio_Device : aliased Audio.WM8994_Audio_Device (Audio_I2C'Access);
--------------------------
-- micro SD card reader --
--------------------------
SD_Detect_Pin : STM32.GPIO.GPIO_Point renames PC13;
SD_DMA : DMA_Controller renames DMA_2;
SD_DMA_Rx_Stream : DMA_Stream_Selector renames Stream_3;
SD_DMA_Rx_Channel : DMA_Channel_Selector renames Channel_4;
SD_DMA_Tx_Stream : DMA_Stream_Selector renames Stream_6;
SD_DMA_Tx_Channel : DMA_Channel_Selector renames Channel_4;
SD_Pins : constant GPIO_Points :=
(PC8, PC9, PC10, PC11, PC12, PD2);
SD_Pins_AF : constant GPIO_Alternate_Function := GPIO_AF_SDMMC1_12;
SD_Pins_2 : constant GPIO_Points := (1 .. 0 => <>);
SD_Pins_AF_2 : constant GPIO_Alternate_Function := GPIO_AF_SDMMC1_12;
SD_Interrupt : Ada.Interrupts.Interrupt_ID renames
Ada.Interrupts.Names.SDMMC1_Interrupt;
DMA2_Stream3 : aliased DMA_Interrupt_Controller
(DMA_2'Access, Stream_3,
Ada.Interrupts.Names.DMA2_Stream3_Interrupt,
System.Interrupt_Priority'Last);
DMA2_Stream6 : aliased DMA_Interrupt_Controller
(DMA_2'Access, Stream_6,
Ada.Interrupts.Names.DMA2_Stream6_Interrupt,
System.Interrupt_Priority'Last);
SD_Rx_DMA_Int : DMA_Interrupt_Controller renames DMA2_Stream3;
SD_Tx_DMA_Int : DMA_Interrupt_Controller renames DMA2_Stream6;
SDCard_Device : aliased SDCard.SDCard_Controller (SDMMC_1'Access);
------------------
-- User button --
------------------
User_Button_Point : GPIO_Point renames PI11;
User_Button_Interrupt : constant Interrupt_ID := Names.EXTI15_10_Interrupt;
procedure Configure_User_Button_GPIO;
-- Configures the GPIO port/pin for the blue user button. Sufficient
-- for polling the button, and necessary for having the button generate
-- interrupts.
sqdf
end STM32.Board;
|
zhmu/ananas | Ada | 2,747 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . L O N G _ L O N G _ F L O A T _ E X P O N --
-- --
-- S p e c --
-- --
-- Copyright (C) 2011-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains an instantiation of the exponentiation operator
-- between two long long floats.
with Ada.Numerics.Long_Long_Elementary_Functions;
package System.Long_Long_Float_Expon is
function Expon_LLF (Left, Right : Long_Long_Float) return Long_Long_Float
renames Ada.Numerics.Long_Long_Elementary_Functions."**";
end System.Long_Long_Float_Expon;
|
zrmyers/VulkanAda | Ada | 3,977 | adb | --------------------------------------------------------------------------------
-- MIT License
--
-- Copyright (c) 2021 Zane Myers
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
--------------------------------------------------------------------------------
with Ada.Text_IO;
with Vulkan.Test.Framework;
with Vulkan.Math.Vec3;
use Ada.Text_IO;
use Vulkan.Math.Vec3;
use Vulkan.Test.Framework;
--------------------------------------------------------------------------------
--< @group Vulkan Math Basic Types
--------------------------------------------------------------------------------
--< @summary
--< This package provides tests for single precision floating point Vec3.
--------------------------------------------------------------------------------
package body Vulkan.Math.Vec3.Test is
-- Test Vec3
procedure Test_Vec3 is
vector_1 : constant Vkm_Vec3 :=
Make_Vec3(1.0, 2.0, 3.0);
vector_2 : constant Vkm_Vec3 :=
Make_Vec3;
vector_3 : constant Vkm_Vec3 :=
Make_Vec3(vector_1);
begin
Put_Line("Testing Vec3 Constructors...");
Put_Line("vector_1 " & Image(vector_1));
Assert_Vec3_Equals(vector_1, 1.0, 2.0, 3.0);
Put_Line("vector_2 " & Image(vector_2));
Assert_Vec3_Equals(vector_2, 0.0, 0.0, 0.0);
Put_Line("vector_3 " & Image(vector_3));
Assert_Vec3_Equals(vector_3, 1.0, 2.0, 3.0);
Put_Line("Testing '=' operator...");
Put_Line(" vector_1 != vector_2");
Assert_Vkm_Bool_Equals(vector_1 = vector_2, False);
Put_Line(" vector_1 != vector_2");
Assert_Vkm_Bool_Equals(vector_1 = vector_2, False);
Put_Line(" vector_1 = vector_3");
Assert_Vkm_Bool_Equals(vector_1 = vector_3, True);
Put_Line(" Testing unary '+/-' operator");
Put_Line(" + vector_1 = " & Image(+ vector_1));
Assert_Vec3_Equals(+vector_1, 1.0, 2.0, 3.0);
Put_Line(" - vector_1 = " & Image(- vector_1));
Assert_Vec3_Equals(-vector_1, -1.0, -2.0, -3.0);
Put_Line("+ ( - vector_1) = " & Image(+(- vector_1)));
Assert_Vec3_Equals(-vector_1, -1.0, -2.0, -3.0);
Put_Line("Testing 'abs' operator...");
Put_Line(" abs( - vector_1) = " & Image(abs(-vector_1)));
Assert_Vec3_Equals(abs(-vector_1), 1.0, 2.0, 3.0);
Put_Line("Testing '+' operator...");
Put_Line(" vector_1 + vector_3 = " & Image(vector_1 + vector_3));
Assert_Vec3_Equals(vector_1 + vector_3, 2.0, 4.0, 6.0);
Put_Line("Testing '-' operator...");
Put_Line(" vector_1 - vector_3 = " & Image(-vector_1 -vector_3));
Assert_Vec3_Equals(-vector_1 -vector_3, -2.0, -4.0, -6.0);
Put_Line("Testing '*' operator...");
Put_Line(" vector_1 * vector_3 = " & Image(vector_1 * vector_3));
Assert_Vec3_Equals(vector_1 * vector_3, 1.0, 4.0, 9.0);
--Put_Line(" mat4 * vec1 = " & Image(mat4 * vec1));
end Test_Vec3;
end Vulkan.Math.Vec3.Test;
|
faelys/natools | Ada | 31,152 | adb | ------------------------------------------------------------------------------
-- Copyright (c) 2011, 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 Ada.Containers.Indefinite_Vectors;
with Ada.Exceptions;
with Ada.Strings.Unbounded;
with Natools.Getopt_Long;
package body Natools.Getopt_Long_Tests is
package US renames Ada.Strings.Unbounded;
----------------------------------------
-- Dynamic command line argument list --
----------------------------------------
package String_Vectors is new Ada.Containers.Indefinite_Vectors
(Index_Type => Positive, Element_Type => String);
Command_Line : String_Vectors.Vector;
function Argument_Count return Natural;
function Argument (Number : Positive) return String;
function Argument_Count return Natural is
begin
return Natural (Command_Line.Length);
end Argument_Count;
function Argument (Number : Positive) return String is
begin
return Command_Line.Element (Number);
end Argument;
--------------------------------
-- Arguments used for testing --
--------------------------------
type Option_Id is
(Short_No_Arg, Short_No_Arg_2, Short_Opt_Arg, Short_Arg,
Long_No_Arg, Long_Opt_Arg, Long_Arg, Long_Ambiguous,
Mixed_No_Arg, Mixed_Opt_Arg, Mixed_Arg,
Command_Argument);
type Flag_Seen_Array is array (Option_Id) of Boolean;
type Flag_Argument_Array is array (Option_Id) of US.Unbounded_String;
Separator : constant Character := ';';
package Getopt is new Natools.Getopt_Long (Option_Id);
function Getopt_Config
(Posixly_Correct, Long_Only : Boolean)
return Getopt.Configuration;
-- Create the Getopt.Configuration object used for these tests.
function Getopt_Config
(Posixly_Correct, Long_Only : Boolean)
return Getopt.Configuration is
begin
return OD : Getopt.Configuration do
OD.Add_Option ('a', Getopt.No_Argument, Short_No_Arg);
OD.Add_Option ('q', Getopt.No_Argument, Short_No_Arg_2);
OD.Add_Option ('f', Getopt.Required_Argument, Short_Arg);
OD.Add_Option ('v', Getopt.Optional_Argument, Short_Opt_Arg);
OD.Add_Option ("aq", Getopt.No_Argument, Long_Ambiguous);
OD.Add_Option ("aquatic", Getopt.No_Argument, Long_No_Arg);
OD.Add_Option ("color", Getopt.Optional_Argument, Long_Opt_Arg);
OD.Add_Option ("input", Getopt.Required_Argument, Long_Arg);
OD.Add_Option ("execute", 'e', Getopt.Required_Argument, Mixed_Arg);
OD.Add_Option ("ignore-case", 'i', Getopt.No_Argument, Mixed_No_Arg);
OD.Add_Option ("write", 'w', Getopt.Optional_Argument, Mixed_Opt_Arg);
OD.Posixly_Correct (Posixly_Correct);
OD.Use_Long_Only (Long_Only);
end return;
end Getopt_Config;
-------------------
-- Test Handlers --
-------------------
package Handlers is
type Basic is new Getopt.Handlers.Callback with record
Flag_Seen : Flag_Seen_Array := (others => False);
Flag_Argument : Flag_Argument_Array;
Flag_Error : String_Vectors.Vector;
end record;
overriding
procedure Option (Handler : in out Basic;
Id : Option_Id;
Argument : String);
-- Process the given option, by recording it as seen in Flag_Seen
-- and appending the argument to Flag_Argument.
overriding
procedure Argument (Handler : in out Basic;
Argument : String);
-- Process the given argument, by recording it
-- in Flag_Seen (Command_Argument) and appending it
-- to Flag_Argument (Command_Argument).
not overriding
procedure Dump (Handler : Basic;
Report : in out NT.Reporter'Class);
-- Dump the current state (Flag_* variables) into the Report.
type Error_Count is record
Missing_Argument_Long : Natural := 0;
Missing_Argument_Short : Natural := 0;
Unexpected_Argument : Natural := 0;
Unknown_Long_Option : Natural := 0;
Unknown_Short_Option : Natural := 0;
end record;
type Recovering is new Basic with record
Count : Error_Count;
end record;
procedure Increment (Number : in out Natural);
overriding
procedure Missing_Argument
(Handler : in out Recovering;
Id : Option_Id;
Name : Getopt.Any_Name);
overriding
procedure Unexpected_Argument
(Handler : in out Recovering;
Id : Option_Id;
Name : Getopt.Any_Name;
Argument : String);
overriding
procedure Unknown_Option
(Handler : in out Recovering;
Name : Getopt.Any_Name);
end Handlers;
package body Handlers is
overriding
procedure Option (Handler : in out Basic;
Id : Option_Id;
Argument : String) is
begin
Handler.Flag_Seen (Id) := True;
US.Append (Handler.Flag_Argument (Id), Argument & Separator);
end Option;
overriding
procedure Argument (Handler : in out Basic;
Argument : String) is
begin
Option (Handler, Command_Argument, Argument);
end Argument;
not overriding
procedure Dump (Handler : Basic;
Report : in out NT.Reporter'Class)
is
procedure Process (Position : String_Vectors.Cursor);
function Seen_String (Seen : Boolean) return String;
procedure Process (Position : String_Vectors.Cursor) is
begin
Report.Info ("Error """ & String_Vectors.Element (Position) & '"');
end Process;
function Seen_String (Seen : Boolean) return String is
begin
if Seen then
return "Seen";
else
return "Not seen";
end if;
end Seen_String;
begin
Report.Info ("Flags:");
for Id in Option_Id loop
Report.Info (" "
& Option_Id'Image (Id) & ": "
& Seen_String (Handler.Flag_Seen (Id)) & ", """
& US.To_String (Handler.Flag_Argument (Id)) & '"');
end loop;
Handler.Flag_Error.Iterate (Process'Access);
end Dump;
procedure Increment (Number : in out Natural) is
begin
Number := Number + 1;
end Increment;
overriding
procedure Missing_Argument
(Handler : in out Recovering;
Id : Option_Id;
Name : Getopt.Any_Name)
is
pragma Unreferenced (Id);
begin
case Name.Style is
when Getopt.Short =>
Increment (Handler.Count.Missing_Argument_Short);
when Getopt.Long =>
Increment (Handler.Count.Missing_Argument_Long);
end case;
end Missing_Argument;
overriding
procedure Unexpected_Argument
(Handler : in out Recovering;
Id : Option_Id;
Name : Getopt.Any_Name;
Argument : String)
is
pragma Unreferenced (Id);
pragma Unreferenced (Name);
pragma Unreferenced (Argument);
begin
Increment (Handler.Count.Unexpected_Argument);
end Unexpected_Argument;
overriding
procedure Unknown_Option
(Handler : in out Recovering;
Name : Getopt.Any_Name) is
begin
case Name.Style is
when Getopt.Short =>
Increment (Handler.Count.Unknown_Short_Option);
when Getopt.Long =>
Increment (Handler.Count.Unknown_Long_Option);
end case;
end Unknown_Option;
end Handlers;
----------------------------
-- Generic test procedure --
----------------------------
procedure Test
(Report : in out NT.Reporter'Class;
Name : String;
Expected_Seen : Flag_Seen_Array;
Expected_Argument : Flag_Argument_Array;
Expected_Error : String_Vectors.Vector := String_Vectors.Empty_Vector;
Posixly_Correct : Boolean := True;
Long_Only : Boolean := False);
procedure Test
(Report : in out NT.Reporter'Class;
Name : String;
Expected_Seen : Flag_Seen_Array;
Expected_Argument : Flag_Argument_Array;
Expected_Error : String_Vectors.Vector := String_Vectors.Empty_Vector;
Posixly_Correct : Boolean := True;
Long_Only : Boolean := False)
is
use type String_Vectors.Vector;
Config : constant Getopt.Configuration
:= Getopt_Config (Posixly_Correct, Long_Only);
Handler : Handlers.Basic;
begin
begin
Getopt.Process
(Config => Config,
Handler => Handler,
Argument_Count => Argument_Count'Access,
Argument => Argument'Access);
exception
when Error : Getopt.Option_Error =>
Handler.Flag_Error.Append
(Ada.Exceptions.Exception_Message (Error));
end;
if Handler.Flag_Seen = Expected_Seen and
Handler.Flag_Argument = Expected_Argument and
Handler.Flag_Error = Expected_Error
then
Report.Item (Name, NT.Success);
else
Report.Item (Name, NT.Fail);
Handler.Dump (Report);
end if;
exception
when Error : others =>
Report.Report_Exception (Name, Error);
Handler.Dump (Report);
end Test;
---------------------------
-- Public test functions --
---------------------------
procedure All_Tests (Report : in out NT.Reporter'Class) is
begin
Test_Arguments (Report);
Test_Empty (Report);
Test_Error_Callbacks (Report);
Test_Everything (Report);
Test_Long (Report);
Test_Long_Only (Report);
Test_Long_Partial (Report);
Test_Long_Partial_Ambiguous (Report);
Test_Missing_Argument_Long (Report);
Test_Missing_Argument_Short (Report);
Test_Mixed_Arg (Report);
Test_Mixed_No_Arg (Report);
Test_Posixly_Correct (Report);
Test_Short_Argument (Report);
Test_Short_Compact (Report);
Test_Short_Expanded (Report);
Test_Unexpected_Argument (Report);
Test_Unknown_Long (Report);
Test_Unknown_Short (Report);
end All_Tests;
procedure Test_Arguments (Report : in out NT.Reporter'Class) is
begin
Command_Line.Clear;
Command_Line.Append ("Argument 1");
Command_Line.Append ("Argument 2");
Command_Line.Append ("Argument 3");
Test (Report, "Arguments without flag",
(Command_Argument => True,
others => False),
(Command_Argument
=> US.To_Unbounded_String ("Argument 1;Argument 2;Argument 3;"),
others => US.Null_Unbounded_String));
end Test_Arguments;
procedure Test_Empty (Report : in out NT.Reporter'Class) is
begin
Command_Line.Clear;
Test (Report, "Empty command line",
(others => False),
(others => US.Null_Unbounded_String));
end Test_Empty;
procedure Test_Error_Callbacks (Report : in out NT.Reporter'Class) is
procedure Local_Test
(Name : String;
Expected_Seen : Flag_Seen_Array;
Expected_Argument : Flag_Argument_Array;
Expected_Count : Handlers.Error_Count);
procedure Local_Test
(Name : String;
Expected_Seen : Flag_Seen_Array;
Expected_Argument : Flag_Argument_Array;
Expected_Count : Handlers.Error_Count)
is
use type Handlers.Error_Count;
Config : constant Getopt.Configuration := Getopt_Config (True, False);
Handler : Handlers.Recovering;
begin
Getopt.Process
(Config => Config,
Handler => Handler,
Argument_Count => Argument_Count'Access,
Argument => Argument'Access);
if Handler.Count /= Expected_Count then
Report.Item (Name, NT.Fail);
if Handler.Count.Missing_Argument_Long
/= Expected_Count.Missing_Argument_Long
then
Report.Info ("Missing argument to long option callback called"
& Natural'Image (Handler.Count.Missing_Argument_Long)
& " times, expected"
& Natural'Image (Expected_Count.Missing_Argument_Long));
end if;
if Handler.Count.Missing_Argument_Short
/= Expected_Count.Missing_Argument_Short
then
Report.Info ("Missing argument to short option callback called"
& Natural'Image (Handler.Count.Missing_Argument_Short)
& " times, expected"
& Natural'Image (Expected_Count.Missing_Argument_Short));
end if;
if Handler.Count.Unexpected_Argument
/= Expected_Count.Unexpected_Argument
then
Report.Info ("Unexpected argument callback called"
& Natural'Image (Handler.Count.Unexpected_Argument)
& " times, expected"
& Natural'Image (Expected_Count.Unexpected_Argument));
end if;
if Handler.Count.Unknown_Long_Option
/= Expected_Count.Unknown_Long_Option
then
Report.Info ("Unknown long option callback called"
& Natural'Image (Handler.Count.Unknown_Long_Option)
& " times, expected"
& Natural'Image (Expected_Count.Unknown_Long_Option));
end if;
if Handler.Count.Unknown_Short_Option
/= Expected_Count.Unknown_Short_Option
then
Report.Info ("Unknown short option callback called"
& Natural'Image (Handler.Count.Unknown_Short_Option)
& " times, expected"
& Natural'Image (Expected_Count.Unknown_Short_Option));
end if;
elsif Handler.Flag_Seen /= Expected_Seen or
Handler.Flag_Argument /= Expected_Argument
then
Report.Item (Name, NT.Fail);
Handler.Dump (Report);
else
Report.Item (Name, NT.Success);
end if;
exception
when Error : others =>
Report.Report_Exception (Name, Error);
Handler.Dump (Report);
end Local_Test;
begin
Report.Section ("Error-handling callbacks");
Command_Line.Clear;
Command_Line.Append ("-af");
Local_Test ("Missing argument for short option",
(Short_No_Arg => True, others => False),
(Short_No_Arg => US.To_Unbounded_String (";"),
others => US.Null_Unbounded_String),
(Missing_Argument_Short => 1, others => 0));
Command_Line.Clear;
Command_Line.Append ("--color");
Command_Line.Append ("--input");
Local_Test ("Missing argument for long option",
(Long_Opt_Arg => True, others => False),
(Long_Opt_Arg => US.To_Unbounded_String (";"),
others => US.Null_Unbounded_String),
(Missing_Argument_Long => 1, others => 0));
Command_Line.Clear;
Command_Line.Append ("--aquatic=extra");
Local_Test ("Unexpected argument",
(others => False),
(others => US.Null_Unbounded_String),
(Unexpected_Argument => 1, others => 0));
Command_Line.Clear;
Command_Line.Append ("-a");
Command_Line.Append ("--ignore-case=true");
Command_Line.Append ("--execute");
Command_Line.Append ("command");
Command_Line.Append ("file");
Local_Test ("Process continues after caught unexpected argument",
(Short_No_Arg | Mixed_Arg | Command_Argument => True,
others => False),
(Short_No_Arg => US.To_Unbounded_String (";"),
Mixed_Arg => US.To_Unbounded_String ("command;"),
Command_Argument => US.To_Unbounded_String ("file;"),
others => US.Null_Unbounded_String),
(Unexpected_Argument => 1, others => 0));
Command_Line.Clear;
Command_Line.Append ("-abqffoo");
Local_Test ("Unknown short option",
(Short_No_Arg | Short_No_Arg_2 | Short_Arg => True,
others => False),
(Short_No_Arg => US.To_Unbounded_String (";"),
Short_No_Arg_2 => US.To_Unbounded_String (";"),
Short_Arg => US.To_Unbounded_String ("foo;"),
others => US.Null_Unbounded_String),
(Unknown_Short_Option => 1, others => 0));
Command_Line.Clear;
Command_Line.Append ("--execute");
Command_Line.Append ("command");
Command_Line.Append ("--unknown=argument");
Command_Line.Append ("file");
Local_Test ("Unknown long option",
(Mixed_Arg | Command_Argument => True, others => False),
(Mixed_Arg => US.To_Unbounded_String ("command;"),
Command_Argument => US.To_Unbounded_String ("file;"),
others => US.Null_Unbounded_String),
(Unknown_Long_Option => 1, others => 0));
Command_Line.Clear;
Command_Line.Append ("--ignore-case");
Command_Line.Append ("-bffoo");
Command_Line.Append ("--aq=unexpected");
Command_Line.Append ("-ecommand");
Command_Line.Append ("--unknown");
Command_Line.Append ("--input");
Local_Test ("All errors simultaneously",
(Short_Arg | Mixed_No_Arg | Mixed_Arg => True,
others => False),
(Short_Arg => US.To_Unbounded_String ("foo;"),
Mixed_Arg => US.To_Unbounded_String ("command;"),
Mixed_No_Arg => US.To_Unbounded_String (";"),
others => US.Null_Unbounded_String),
(Missing_Argument_Long => 1,
Missing_Argument_Short => 0,
Unexpected_Argument => 1,
Unknown_Long_Option => 1,
Unknown_Short_Option => 1));
Report.End_Section;
end Test_Error_Callbacks;
procedure Test_Everything (Report : in out NT.Reporter'Class) is
begin
Command_Line.Clear;
Command_Line.Append ("--write=arg 1");
Command_Line.Append ("-awvfarg 2");
Command_Line.Append ("--aq");
Command_Line.Append ("-e");
Command_Line.Append ("arg 3");
Command_Line.Append ("--ignore-case");
Command_Line.Append ("--color=arg 4");
Command_Line.Append ("-iv");
Command_Line.Append ("--execute=arg 5");
Command_Line.Append ("--color");
Command_Line.Append ("--input");
Command_Line.Append ("arg 6");
Command_Line.Append ("arg 7");
Command_Line.Append ("arg 8");
Test (Report, "Everything together",
(Short_No_Arg_2 | Long_No_Arg => False, others => True),
(Short_No_Arg => US.To_Unbounded_String (";"),
Short_No_Arg_2 => US.Null_Unbounded_String,
Short_Arg => US.To_Unbounded_String ("arg 2;"),
Short_Opt_Arg => US.To_Unbounded_String (";;"),
Long_Ambiguous => US.To_Unbounded_String (";"),
Long_No_Arg => US.Null_Unbounded_String,
Long_Opt_Arg => US.To_Unbounded_String ("arg 4;;"),
Long_Arg => US.To_Unbounded_String ("arg 6;"),
Mixed_Arg => US.To_Unbounded_String ("arg 3;arg 5;"),
Mixed_No_Arg => US.To_Unbounded_String (";;"),
Mixed_Opt_Arg => US.To_Unbounded_String ("arg 1;;"),
Command_Argument => US.To_Unbounded_String ("arg 7;arg 8;")));
end Test_Everything;
procedure Test_Long (Report : in out NT.Reporter'Class) is
begin
Command_Line.Clear;
Command_Line.Append ("--aquatic");
Command_Line.Append ("--input=i equal");
Command_Line.Append ("--color=c equal");
Command_Line.Append ("--input");
Command_Line.Append ("i space");
Command_Line.Append ("--color");
Command_Line.Append ("c space");
Command_Line.Append ("top level");
Test (Report, "Long flags",
(Long_No_Arg | Long_Opt_Arg | Long_Arg | Command_Argument => True,
others => False),
(Long_No_Arg => US.To_Unbounded_String (";"),
Long_Opt_Arg => US.To_Unbounded_String ("c equal;;"),
Long_Arg => US.To_Unbounded_String ("i equal;i space;"),
Command_Argument => US.To_Unbounded_String ("c space;top level;"),
others => US.Null_Unbounded_String));
end Test_Long;
procedure Test_Long_Only (Report : in out NT.Reporter'Class) is
begin
Command_Line.Clear;
Command_Line.Append ("-aq");
-- Can be either 'a' and 'q' short flags or "aq" long flag, depending
-- on Long_Only parameter
-- Without Long_Only (default)
Test (Report, "Long_Only disabled (default)",
(Short_No_Arg | Short_No_Arg_2 => True, others => False),
(Short_No_Arg | Short_No_Arg_2 => US.To_Unbounded_String (";"),
others => US.Null_Unbounded_String),
Long_Only => False);
-- With Long_Only
Test (Report, "Long_Only enabled",
(Long_Ambiguous => True, others => False),
(Long_Ambiguous => US.To_Unbounded_String (";"),
others => US.Null_Unbounded_String),
Long_Only => True);
end Test_Long_Only;
procedure Test_Long_Partial (Report : in out NT.Reporter'Class) is
begin
Command_Line.Clear;
Command_Line.Append ("--aqu");
Command_Line.Append ("--co=foo");
Command_Line.Append ("--in");
Command_Line.Append ("bar");
Test (Report, "Partial matches for long flags",
(Long_No_Arg | Long_Opt_Arg | Long_Arg => True, others => False),
(Long_No_Arg => US.To_Unbounded_String (";"),
Long_Opt_Arg => US.To_Unbounded_String ("foo;"),
Long_Arg => US.To_Unbounded_String ("bar;"),
others => US.Null_Unbounded_String));
end Test_Long_Partial;
procedure Test_Long_Partial_Ambiguous (Report : in out NT.Reporter'Class) is
begin
Command_Line.Clear;
Command_Line.Append ("--i");
-- partial match for both "input" and "ignore-case" long flags
Test (Report, "Ambiguous partial match for long flags",
(others => False),
(others => US.Null_Unbounded_String),
String_Vectors.To_Vector ("Unknown option --i", 1));
Command_Line.Clear;
Command_Line.Append ("--aq");
-- partial match for both "aq" and "aquatic" long flags
-- but exact match is preferred
Test (Report, "Ambiguous exact match for long flags",
(Long_Ambiguous => True, others => False),
(Long_Ambiguous => US.To_Unbounded_String (";"),
others => US.Null_Unbounded_String));
end Test_Long_Partial_Ambiguous;
procedure Test_Missing_Argument_Long (Report : in out NT.Reporter'Class) is
begin
Command_Line.Clear;
Command_Line.Append ("--color");
Command_Line.Append ("--input");
Test (Report, "Missing argument for long option",
(Long_Opt_Arg => True, others => False),
(Long_Opt_Arg => US.To_Unbounded_String (";"),
others => US.Null_Unbounded_String),
String_Vectors.To_Vector
("Missing argument to option --input", 1));
end Test_Missing_Argument_Long;
procedure Test_Missing_Argument_Short (Report : in out NT.Reporter'Class) is
begin
Command_Line.Clear;
Command_Line.Append ("-v");
Command_Line.Append ("-f");
Test (Report, "Missing argument for long option",
(Short_Opt_Arg => True, others => False),
(Short_Opt_Arg => US.To_Unbounded_String (";"),
others => US.Null_Unbounded_String),
String_Vectors.To_Vector ("Missing argument to option -f", 1));
end Test_Missing_Argument_Short;
procedure Test_Mixed_Arg (Report : in out NT.Reporter'Class) is
begin
Command_Line.Clear;
Command_Line.Append ("-efoo");
Command_Line.Append ("-qe");
Command_Line.Append ("bar");
Command_Line.Append ("-aebaz");
Command_Line.Append ("--execute=long");
Test (Report, "Short and long options with arguments",
(Mixed_Arg | Short_No_Arg | Short_No_Arg_2 => True,
others => False),
(Mixed_Arg => US.To_Unbounded_String ("foo;bar;baz;long;"),
Short_No_Arg | Short_No_Arg_2 => US.To_Unbounded_String (";"),
others => US.Null_Unbounded_String));
end Test_Mixed_Arg;
procedure Test_Mixed_No_Arg (Report : in out NT.Reporter'Class) is
begin
Command_Line.Clear;
Command_Line.Append ("-ai");
Command_Line.Append ("--ignore-case");
Test (Report, "Short and long options without arguments",
(Mixed_No_Arg | Short_No_Arg => True, others => False),
(Mixed_No_Arg => US.To_Unbounded_String (";;"),
Short_No_Arg => US.To_Unbounded_String (";"),
others => US.Null_Unbounded_String));
end Test_Mixed_No_Arg;
procedure Test_Posixly_Correct (Report : in out NT.Reporter'Class) is
begin
Command_Line.Clear;
Command_Line.Append ("-a");
Command_Line.Append ("top level");
Command_Line.Append ("-q");
-- Posixly_Correct defines whether this "-q" is a top-level argument
-- or a short flag
-- With the flag
Test (Report, "Posixly correct behavior",
(Short_No_Arg | Command_Argument => True,
others => False),
(Short_No_Arg => US.To_Unbounded_String (";"),
Command_Argument => US.To_Unbounded_String ("top level;-q;"),
others => US.Null_Unbounded_String),
Posixly_Correct => True);
-- Without the flag
Test (Report, "GNU (posixly incorrect) behavior",
(Short_No_Arg | Short_No_Arg_2 | Command_Argument => True,
others => False),
(Short_No_Arg | Short_No_Arg_2 => US.To_Unbounded_String (";"),
Command_Argument => US.To_Unbounded_String ("top level;"),
others => US.Null_Unbounded_String),
Posixly_Correct => False);
end Test_Posixly_Correct;
procedure Test_Short_Argument (Report : in out NT.Reporter'Class) is
begin
Command_Line.Clear;
Command_Line.Append ("-faq");
-- "aq" is argument for 'f' short flag, not 'a' and 'q' short flags
Command_Line.Append ("-f");
Command_Line.Append ("-a");
-- "-a" is argument for 'f' short flag, not 'a' short flag
Command_Line.Append ("-v");
Command_Line.Append ("bar");
-- "bar" is top level argument, because optional argument for short
-- flags are never set
Test (Report, "Arguments to short flags",
(Short_Arg | Short_Opt_Arg | Command_Argument => True,
others => False),
(Short_Arg => US.To_Unbounded_String ("aq;-a;"),
Short_Opt_Arg => US.To_Unbounded_String (";"),
Command_Argument => US.To_Unbounded_String ("bar;"),
others => US.Null_Unbounded_String));
end Test_Short_Argument;
procedure Test_Short_Compact (Report : in out NT.Reporter'Class) is
begin
Command_Line.Clear;
Command_Line.Append ("-avq");
-- "q" is not argument to 'v' short flag, but a short flag itself
Test (Report, "Argumentless compact short flags",
(Short_No_Arg | Short_No_Arg_2 | Short_Opt_Arg => True,
others => False),
(Short_No_Arg | Short_No_Arg_2 | Short_Opt_Arg =>
US.To_Unbounded_String (";"),
others => US.Null_Unbounded_String));
end Test_Short_Compact;
procedure Test_Short_Expanded (Report : in out NT.Reporter'Class) is
begin
Command_Line.Clear;
Command_Line.Append ("-a");
Command_Line.Append ("-v");
Command_Line.Append ("-q");
Test (Report, "Argumentless expanded short flags",
(Short_No_Arg | Short_No_Arg_2 | Short_Opt_Arg => True,
others => False),
(Short_No_Arg | Short_No_Arg_2 | Short_Opt_Arg =>
US.To_Unbounded_String (";"),
others => US.Null_Unbounded_String));
end Test_Short_Expanded;
procedure Test_Unexpected_Argument (Report : in out NT.Reporter'Class) is
begin
Command_Line.Clear;
Command_Line.Append ("--color=foo");
Command_Line.Append ("--aq=bar");
Test (Report, "Unexpected argument to long option",
(Long_Opt_Arg => True, others => False),
(Long_Opt_Arg => US.To_Unbounded_String ("foo;"),
others => US.Null_Unbounded_String),
String_Vectors.To_Vector
("Unexpected argument ""bar"" to option --aq", 1));
end Test_Unexpected_Argument;
procedure Test_Unknown_Long (Report : in out NT.Reporter'Class) is
begin
Command_Line.Clear;
Command_Line.Append ("--long-flag");
Test (Report, "Unknown long flag",
(others => False), (others => US.Null_Unbounded_String),
String_Vectors.To_Vector ("Unknown option --long-flag", 1));
end Test_Unknown_Long;
procedure Test_Unknown_Short (Report : in out NT.Reporter'Class) is
begin
Command_Line.Clear;
Command_Line.Append ("-g");
Test (Report, "Unknown short flag",
(others => False), (others => US.Null_Unbounded_String),
String_Vectors.To_Vector ("Unknown option -g", 1));
end Test_Unknown_Short;
end Natools.Getopt_Long_Tests;
|
zhmu/ananas | Ada | 865 | adb | -- { dg-do compile { target { lp64 || llp64 } } }
-- { dg-options "-O2 -gnatws" }
procedure Main is
subtype Int64 is Long_Long_Integer;
type Arr is array (Int64 range <>) of Boolean;
Pow : constant := 10;
procedure Compute (B : in out Arr) is
Factor : Int64 := 3;
Num : Int64;
begin
while Factor <= 10 ** (Pow / 2) loop
Num := Factor;
while Num < 10 ** Pow loop
if B (Num) then
Factor := Num;
exit;
end if;
Num := Num + 2;
end loop;
Num := Factor * Factor;
while Num < 10 ** Pow loop
B (Num) := False;
Num := Num + Factor * 2;
end loop;
Factor := Factor + 2;
end loop;
end;
B : Arr (1 .. 10 ** Pow) := (others => True);
begin
Compute (B);
end;
|
jwarwick/aoc_2020 | Ada | 986 | adb | with AUnit.Assertions; use AUnit.Assertions;
package body Day.Test is
procedure Test_Part1 (T : in out AUnit.Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
t1 : constant Natural := count_tiles("test1.txt");
begin
Assert(t1 = 10, "Wrong number, expected 10, got" & t1'IMAGE);
end Test_Part1;
procedure Test_Part2 (T : in out AUnit.Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
t1 : constant Natural := evolve_tiles("test1.txt", 100);
begin
Assert(t1 = 2208, "Wrong number, expected 2208, got" & t1'IMAGE);
end Test_Part2;
function Name (T : Test) return AUnit.Message_String is
pragma Unreferenced (T);
begin
return AUnit.Format ("Test Day package");
end Name;
procedure Register_Tests (T : in out Test) is
use AUnit.Test_Cases.Registration;
begin
Register_Routine (T, Test_Part1'Access, "Test Part 1");
Register_Routine (T, Test_Part2'Access, "Test Part 2");
end Register_Tests;
end Day.Test;
|
reznikmm/matreshka | Ada | 4,145 | 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.Presentation_Background_Visible_Attributes;
package Matreshka.ODF_Presentation.Background_Visible_Attributes is
type Presentation_Background_Visible_Attribute_Node is
new Matreshka.ODF_Presentation.Abstract_Presentation_Attribute_Node
and ODF.DOM.Presentation_Background_Visible_Attributes.ODF_Presentation_Background_Visible_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Presentation_Background_Visible_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Presentation_Background_Visible_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Presentation.Background_Visible_Attributes;
|
reznikmm/matreshka | Ada | 8,742 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with League.Strings.Internals;
with AMF.Internals.Extents;
with AMF.Internals.Helpers;
with AMF.Internals.Links;
with AMF.Internals.Tables.AMF_Link_Table;
with AMF.Internals.Tables.AMF_Tables;
package body AMF.Internals.AMF_URI_Extents is
use AMF.Internals.Tables;
-----------------
-- Add_Element --
-----------------
overriding procedure Add_Element
(Self : not null access AMF_URI_Extent;
Element : not null AMF.Elements.Element_Access) is
begin
null;
end Add_Element;
-----------------
-- Context_URI --
-----------------
overriding function Context_URI
(Self : not null access constant AMF_URI_Extent)
return League.Strings.Universal_String is
begin
return
League.Strings.Internals.Create
(AMF.Internals.Tables.AMF_Tables.Extents.Table (Self.Id).Context_URI);
end Context_URI;
-------------------
-- Delete_Extent --
-------------------
overriding procedure Delete_Extent (Self : not null access AMF_URI_Extent) is
begin
null;
end Delete_Extent;
-------------
-- Element --
-------------
overriding function Element
(Self : not null access constant AMF_URI_Extent;
URI : League.Strings.Universal_String)
return AMF.Elements.Element_Access is
begin
return
AMF.Internals.Helpers.To_Element
(AMF.Internals.Extents.Element (Self.Id, URI));
end Element;
--------------
-- Elements --
--------------
overriding function Elements
(Self : not null access constant AMF_URI_Extent)
return AMF.Elements.Collections.Set_Of_Element is
begin
return
AMF.Elements.Collections.Wrap
(AMF.Internals.Extents.All_Elements (Self.Id));
end Elements;
----------------------
-- Elements_Of_Type --
----------------------
overriding function Elements_Of_Type
(Self : not null access constant AMF_URI_Extent;
The_Type : not null AMF.CMOF.Classes.CMOF_Class_Access;
Include_Subtypes : Boolean)
return AMF.Elements.Collections.Set_Of_Element is
begin
return Result : AMF.Elements.Collections.Set_Of_Element do
raise Program_Error;
end return;
end Elements_Of_Type;
-----------------
-- Link_Exists --
-----------------
overriding function Link_Exists
(Self : not null access constant AMF_URI_Extent;
Association : not null AMF.CMOF.Associations.CMOF_Association_Access;
First_Element : not null AMF.Elements.Element_Access;
Second_Element : not null AMF.Elements.Element_Access)
return Boolean is
begin
raise Program_Error;
return False;
end Link_Exists;
---------------------
-- Linked_Elements --
---------------------
overriding function Linked_Elements
(Self : not null access constant AMF_URI_Extent;
Association :
not null AMF.CMOF.Associations.CMOF_Association_Access;
End_Element : not null AMF.Elements.Element_Access;
End_1_To_End_2_Direction : Boolean)
return AMF.Elements.Collections.Set_Of_Element is
begin
return Result : AMF.Elements.Collections.Set_Of_Element do
raise Program_Error;
end return;
end Linked_Elements;
-------------------
-- Links_Of_Type --
-------------------
overriding function Links_Of_Type
(Self : not null access constant AMF_URI_Extent;
The_Type : not null AMF.CMOF.Associations.CMOF_Association_Access)
return AMF.Links.Collections.Set_Of_Link
is
Association : constant AMF_Element
:= AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (The_Type));
begin
return Result : AMF.Links.Collections.Set_Of_Link do
for J in AMF_Link_Table.First .. AMF_Link_Table.Last loop
if AMF_Link_Table.Table (J).Association = Association then
Result.Append
(AMF.Links.Link_Access (AMF.Internals.Links.Proxy (J)));
end if;
end loop;
end return;
end Links_Of_Type;
------------------
-- Move_Element --
------------------
overriding procedure Move_Element
(Self : not null access AMF_URI_Extent;
Element : not null AMF.Elements.Element_Access;
Target : not null access AMF.Extents.Extent'Class) is
begin
null;
end Move_Element;
--------------------
-- Remove_Element --
--------------------
overriding procedure Remove_Element
(Self : not null access AMF_URI_Extent;
Element : not null AMF.Elements.Element_Access) is
begin
null;
end Remove_Element;
---------
-- URI --
---------
overriding function URI
(Self : not null access constant AMF_URI_Extent;
Element : not null access constant AMF.Elements.Abstract_Element'Class)
return League.Strings.Universal_String is
begin
return
AMF.Internals.Extents.URI
(Self.Id, AMF.Internals.Helpers.To_Element (Element));
end URI;
---------------------
-- Use_Containment --
---------------------
overriding function Use_Containment
(Self : not null access constant AMF_URI_Extent) return Boolean
is
pragma Unreferenced (Self);
begin
return True;
end Use_Containment;
end AMF.Internals.AMF_URI_Extents;
|
reznikmm/matreshka | Ada | 4,001 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Meta_Draw_Count_Attributes;
package Matreshka.ODF_Meta.Draw_Count_Attributes is
type Meta_Draw_Count_Attribute_Node is
new Matreshka.ODF_Meta.Abstract_Meta_Attribute_Node
and ODF.DOM.Meta_Draw_Count_Attributes.ODF_Meta_Draw_Count_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Meta_Draw_Count_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Meta_Draw_Count_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Meta.Draw_Count_Attributes;
|
Rodeo-McCabe/orka | Ada | 4,049 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2016 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with GL.Buffers;
with GL.Objects.Buffers;
with GL.Types.Indirect;
with Orka.Buffers.MDI;
with Orka.Vertex_Formats;
with Orka.Programs.Modules;
with GL_Test.Display_Backend;
procedure Orka_Test.Test_4_MDI is
Initialized : constant Boolean := GL_Test.Display_Backend.Init
(Major => 3, Minor => 2, Width => 500, Height => 500, Resizable => False);
pragma Unreferenced (Initialized);
use Orka.Vertex_Formats;
use Orka.Programs;
use GL.Objects.Buffers;
function Load_Mesh (Program : Orka.Programs.Program;
MDI_Buffers : out Orka.Buffers.MDI.MDI_Buffers) return Vertex_Format is
use GL.Types;
Vertices_1 : constant Indirect.Single_Array_Access
:= new Single_Array'(-0.3, 0.5, -1.0,
-0.8, -0.5, -1.0,
0.2, -0.5, -1.0);
Vertices_2 : constant Indirect.Single_Array_Access
:= new Single_Array'(-0.2, 0.5, -1.0,
0.3, -0.5, -1.0,
0.8, 0.5, -1.0);
Indices_1 : constant Indirect.UInt_Array_Access
:= new UInt_Array'(0, 1, 2);
Indices_2 : constant Indirect.UInt_Array_Access
:= new UInt_Array'(0, 1, 2);
MDI : Orka.Buffers.MDI.Batch := Orka.Buffers.MDI.Create_Batch (3);
Instance_ID : Natural;
procedure Add_Position_Attribute (Buffer : in out Orka.Vertex_Formats.Attribute_Buffer) is
begin
Buffer.Add_Attribute (Program.Attribute_Location ("in_Position"), 3);
end Add_Position_Attribute;
procedure Add_Instance_Attribute (Buffer : in out Orka.Vertex_Formats.Attribute_Buffer) is
begin
Buffer.Add_Attribute (Program.Attribute_Location ("in_InstanceID"), 1);
Buffer.Set_Per_Instance (True);
end Add_Instance_Attribute;
begin
-- Create one VBO, one IBO, and a buffer containing the draw commands
MDI.Append (Vertices_1, Indices_1, Instance_ID);
MDI.Append (Vertices_2, Indices_2, Instance_ID);
pragma Assert (MDI.Length = 2);
MDI_Buffers := MDI.Create_Buffers (Storage_Bits'(others => False));
-- Create mesh and its attributes
return Result : Vertex_Format := Orka.Vertex_Formats.Create_Vertex_Format (Triangles, UInt_Type) do
Result.Add_Attribute_Buffer (Half_Type, Add_Position_Attribute'Access);
Result.Add_Attribute_Buffer (UInt_Type, Add_Instance_Attribute'Access);
Result.Set_Vertex_Buffer (1, MDI_Buffers.Vertex_Buffer);
Result.Set_Vertex_Buffer (2, MDI_Buffers.Instances_Buffer);
Result.Set_Index_Buffer (MDI_Buffers.Index_Buffer);
end return;
end Load_Mesh;
use GL.Buffers;
MDI_Buffers : Orka.Buffers.MDI.MDI_Buffers;
Program_1 : Program := Orka.Programs.Create_Program (Modules.Create_Module
(VS => "../examples/orka/shaders/test-4-module-1.vert",
FS => "../examples/orka/shaders/test-4-module-1.frag"));
Mesh_1 : constant Vertex_Format := Load_Mesh (Program_1, MDI_Buffers);
begin
Program_1.Use_Program;
while not GL_Test.Display_Backend.Get_Window.Should_Close loop
Clear (Buffer_Bits'(Color => True, Depth => True, others => False));
Mesh_1.Draw_Indirect (MDI_Buffers.Command_Buffer);
GL_Test.Display_Backend.Swap_Buffers_And_Poll_Events;
end loop;
GL_Test.Display_Backend.Shutdown;
end Orka_Test.Test_4_MDI;
|
Tim-Tom/project-euler | Ada | 479 | ads | -- There are exactly ten ways of selecting three from five, 12345:
--
-- 123, 124, 125, 134, 135, 145, 234, 235, 245, and 345
--
-- In combinatorics, we use the notation, 5C3 = 10.
--
-- In general,nCr = n!/(r!(n-r)!) ,where r < n
--
-- It is not until n = 23, that a value exceeds one-million: 23C10 = 1,144,066.
--
-- How many, not necessarily distinct, values of nCr, for 1 <= n <= 100, are greater than one-million?
package Problem_53 is
procedure Solve;
end Problem_53;
|
burratoo/Acton | Ada | 1,106 | adb | ------------------------------------------------------------------------------------------
-- --
-- OAKLAND COMPONENTS --
-- --
-- ADA.EXECUTION_SERVER --
-- --
-- Copyright (C) 2013-2021, Patrick Bernardi --
-- --
------------------------------------------------------------------------------------------
package body Ada.Execution_Server is
procedure Remove_Execution_Server (Server : in out Execution_Server) is
begin
raise Program_Error;
-- Remove_Agent_From_Scheduler (Server.Server_Object'Unchecked_Access);
end Remove_Execution_Server;
end Ada.Execution_Server;
|
zhmu/ananas | Ada | 7,642 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M --
-- --
-- S p e c --
-- (AIX/PPC Version) --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package System is
pragma Pure;
-- Note that we take advantage of the implementation permission to make
-- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada
-- 2005, this is Pure in any case (AI-362).
pragma No_Elaboration_Code_All;
-- Allow the use of that restriction in units that WITH this unit
type Name is (SYSTEM_NAME_GNAT);
System_Name : constant Name := SYSTEM_NAME_GNAT;
-- System-Dependent Named Numbers
Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
Max_Digits : constant := Long_Long_Float'Digits;
Max_Mantissa : constant := Standard'Max_Integer_Size - 1;
Fine_Delta : constant := 2.0 ** (-Max_Mantissa);
Tick : constant := 0.01;
-- Storage-related Declarations
type Address is private;
pragma Preelaborable_Initialization (Address);
Null_Address : constant Address;
Storage_Unit : constant := 8;
Word_Size : constant := Standard'Word_Size;
Memory_Size : constant := 2 ** Word_Size;
-- Address comparison
function "<" (Left, Right : Address) return Boolean;
function "<=" (Left, Right : Address) return Boolean;
function ">" (Left, Right : Address) return Boolean;
function ">=" (Left, Right : Address) return Boolean;
function "=" (Left, Right : Address) return Boolean;
pragma Import (Intrinsic, "<");
pragma Import (Intrinsic, "<=");
pragma Import (Intrinsic, ">");
pragma Import (Intrinsic, ">=");
pragma Import (Intrinsic, "=");
-- Other System-Dependent Declarations
type Bit_Order is (High_Order_First, Low_Order_First);
Default_Bit_Order : constant Bit_Order := High_Order_First;
pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning
-- Priority-related Declarations (RM D.1)
-- 0 .. 126 corresponds to the system priority range 1 .. 127.
--
-- If the scheduling policy is SCHED_FIFO or SCHED_RR the runtime makes use
-- of the entire range provided by the system.
--
-- If the scheduling policy is SCHED_OTHER the only valid system priority
-- is 1 and that is the only value ever passed to the system, regardless of
-- how priorities are set by user programs.
Max_Priority : constant Positive := 125;
Max_Interrupt_Priority : constant Positive := 126;
subtype Any_Priority is Integer range 0 .. 126;
subtype Priority is Any_Priority range 0 .. 125;
subtype Interrupt_Priority is Any_Priority range 126 .. 126;
Default_Priority : constant Priority :=
(Priority'First + Priority'Last) / 2;
private
type Address is mod Memory_Size;
Null_Address : constant Address := 0;
--------------------------------------
-- System Implementation Parameters --
--------------------------------------
-- These parameters provide information about the target that is used
-- by the compiler. They are in the private part of System, where they
-- can be accessed using the special circuitry in the Targparm unit
-- whose source should be consulted for more detailed descriptions
-- of the individual switch values.
Backend_Divide_Checks : constant Boolean := False;
Backend_Overflow_Checks : constant Boolean := True;
Command_Line_Args : constant Boolean := True;
Configurable_Run_Time : constant Boolean := False;
Denorm : constant Boolean := True;
Duration_32_Bits : constant Boolean := False;
Exit_Status_Supported : constant Boolean := True;
Machine_Overflows : constant Boolean := False;
Machine_Rounds : constant Boolean := True;
Preallocated_Stacks : constant Boolean := False;
Signed_Zeros : constant Boolean := True;
Stack_Check_Default : constant Boolean := False;
Stack_Check_Probes : constant Boolean := True;
Stack_Check_Limits : constant Boolean := False;
Support_Aggregates : constant Boolean := True;
Support_Atomic_Primitives : constant Boolean := True;
Support_Composite_Assign : constant Boolean := True;
Support_Composite_Compare : constant Boolean := True;
Support_Long_Shifts : constant Boolean := True;
Always_Compatible_Rep : constant Boolean := False;
Suppress_Standard_Library : constant Boolean := False;
Use_Ada_Main_Program_Name : constant Boolean := False;
Frontend_Exceptions : constant Boolean := False;
ZCX_By_Default : constant Boolean := True;
end System;
|
Tim-Tom/project-euler | Ada | 58 | ads | package Problem_17 is
procedure Solve;
end Problem_17;
|
reznikmm/matreshka | Ada | 4,663 | 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.Bibliography_Type_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Text_Bibliography_Type_Attribute_Node is
begin
return Self : Text_Bibliography_Type_Attribute_Node do
Matreshka.ODF_Text.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Text_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Text_Bibliography_Type_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Bibliography_Type_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Text_URI,
Matreshka.ODF_String_Constants.Bibliography_Type_Attribute,
Text_Bibliography_Type_Attribute_Node'Tag);
end Matreshka.ODF_Text.Bibliography_Type_Attributes;
|
onox/json-ada | Ada | 17,219 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2016 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Characters.Handling;
with Ada.Characters.Latin_1;
with Ada.Strings.Bounded;
with Ada.Strings.Unbounded;
package body JSON.Types is
package SU renames Ada.Strings.Unbounded;
function "+" (Text : String) return SU.Unbounded_String
renames SU.To_Unbounded_String;
function "+" (Text : SU.Unbounded_String) return String
renames SU.To_String;
function Unescape (Text : String) return String is
-- Add 1 so that the length is always positive
package SB is new Ada.Strings.Bounded.Generic_Bounded_Length (Max => Text'Length + 1);
Value : SB.Bounded_String;
Escaped : Boolean := False;
use Ada.Characters.Latin_1;
begin
for C of Text loop
if Escaped then
case C is
when '"' | '\' | '/' =>
SB.Append (Value, C);
when 'b' =>
SB.Append (Value, BS);
when 'f' =>
SB.Append (Value, FF);
when 'n' =>
SB.Append (Value, LF);
when 'r' =>
SB.Append (Value, CR);
when 't' =>
SB.Append (Value, HT);
when others =>
raise Program_Error;
end case;
elsif C = '"' then
raise Program_Error;
elsif C /= '\' then
if Ada.Characters.Handling.Is_Control (C) then
raise Program_Error;
end if;
SB.Append (Value, C);
end if;
Escaped := not Escaped and C = '\';
end loop;
return SB.To_String (Value);
end Unescape;
-----------------------------------------------------------------------------
-- Memory allocator --
-----------------------------------------------------------------------------
function Create_Array
(Object : Memory_Allocator;
Depth : Positive) return Array_Offset is
begin
if Depth > Object.Maximum_Depth then
raise Constraint_Error with
"Maximum depth (" & Object.Maximum_Depth'Image & ") exceeded";
end if;
return Array_Offset (Object.Array_Levels (Depth).Length);
end Create_Array;
function Create_Object
(Object : Memory_Allocator;
Depth : Positive) return Array_Offset is
begin
if Depth > Object.Maximum_Depth then
raise Constraint_Error with
"Maximum depth (" & Object.Maximum_Depth'Image & ") exceeded";
end if;
return Array_Offset (Object.Object_Levels (Depth).Length);
end Create_Object;
-----------------------------------------------------------------------------
-- Constructors --
-----------------------------------------------------------------------------
function Create_String
(Stream : Streams.Stream_Ptr;
Offset, Length : Streams.AS.Stream_Element_Offset) return JSON_Value is
begin
return (Kind => String_Kind, Stream => Stream,
String_Offset => Offset, String_Length => Length);
end Create_String;
function Create_Integer (Value : Integer_Type) return JSON_Value is
begin
return (Kind => Integer_Kind, Integer_Value => Value);
end Create_Integer;
function Create_Float (Value : Float_Type) return JSON_Value is
begin
return (Kind => Float_Kind, Float_Value => Value);
end Create_Float;
function Create_Boolean (Value : Boolean) return JSON_Value is
begin
return (Kind => Boolean_Kind, Boolean_Value => Value);
end Create_Boolean;
function Create_Null return JSON_Value is
begin
return (Kind => Null_Kind);
end Create_Null;
function Create_Array
(Allocator : Memory_Allocator_Ptr;
Depth : Positive) return JSON_Value is
begin
return (Kind => Array_Kind,
Allocator => Allocator,
Depth => Depth,
Offset => Create_Array (Allocator.all, Depth),
Length => 0);
end Create_Array;
function Create_Object
(Allocator : Memory_Allocator_Ptr;
Depth : Positive) return JSON_Value is
begin
return (Kind => Object_Kind,
Allocator => Allocator,
Depth => Depth,
Offset => Create_Object (Allocator.all, Depth),
Length => 0);
end Create_Object;
-----------------------------------------------------------------------------
-- Value --
-----------------------------------------------------------------------------
function "=" (Left : String; Right : JSON_Value) return Boolean is
(if Right.Kind = String_Kind then
Right.Stream.Is_Equal_String (Right.String_Offset, Right.String_Length, Left)
else
False);
function Value (Object : JSON_Value) return String is
begin
if Object.Kind = String_Kind then
return Unescape (Object.Stream.Get_String
(Object.String_Offset, Object.String_Length));
else
raise Invalid_Type_Error with "Value not a string";
end if;
end Value;
function Value (Object : JSON_Value) return Boolean is
begin
if Object.Kind = Boolean_Kind then
return Object.Boolean_Value;
else
raise Invalid_Type_Error with "Value not a boolean";
end if;
end Value;
function Value (Object : JSON_Value) return Integer_Type is
begin
if Object.Kind = Integer_Kind then
return Object.Integer_Value;
else
raise Invalid_Type_Error with "Value not a integer";
end if;
end Value;
function Value (Object : JSON_Value) return Float_Type is
begin
if Object.Kind = Float_Kind then
return Object.Float_Value;
elsif Object.Kind = Integer_Kind then
return Float_Type (Object.Integer_Value);
else
raise Invalid_Type_Error with "Value not a float";
end if;
end Value;
-----------------------------------------------------------------------------
function Length (Object : JSON_Value) return Natural is
begin
if Object.Kind in Array_Kind | Object_Kind then
return Object.Length;
else
raise Invalid_Type_Error with "Value not an object or array";
end if;
end Length;
function Contains (Object : JSON_Value; Key : String) return Boolean is
begin
if Object.Kind = Object_Kind then
for Index in 1 .. Object.Length loop
declare
Pair : Key_Value_Pair renames Object.Allocator.Object_Levels
(Object.Depth).Element (Object.Offset + Index);
begin
if Key = Pair.Key then
return True;
end if;
end;
end loop;
return False;
else
raise Invalid_Type_Error with "Value not an object";
end if;
end Contains;
function Get (Object : JSON_Value; Index : Positive) return JSON_Value is
begin
if Object.Kind = Array_Kind then
return Object.Allocator.Array_Levels (Object.Depth).Element
(Object.Offset + Index).Value;
else
raise Invalid_Type_Error with "Value not an array";
end if;
exception
when Constraint_Error =>
raise Constraint_Error with "JSON array has no element at index" & Index'Image;
end Get;
function Get (Object : JSON_Value; Key : String) return JSON_Value is
begin
if Object.Kind = Object_Kind then
for Index in 1 .. Object.Length loop
declare
Pair : constant Key_Value_Pair := Object.Allocator.Object_Levels
(Object.Depth).Element (Object.Offset + Index);
begin
if Key = Pair.Key then
return Pair.Element;
end if;
end;
end loop;
raise Constraint_Error with "JSON object has no key '" & Key & "'";
else
raise Invalid_Type_Error with "Value not an object";
end if;
end Get;
procedure Append (Object : in out JSON_Value; Value : JSON_Value) is
begin
if Object.Kind = Array_Kind then
declare
Length : constant Natural
:= Natural (Object.Allocator.Array_Levels (Object.Depth).Length);
begin
-- Assert that Object is the last array in a particular level
-- so that its elements form a continuous array
pragma Assert (Length = Object.Offset + Object.Length);
end;
Object.Allocator.Array_Levels (Object.Depth).Append
(Array_Value'(Kind => Value.Kind, Value => Value));
Object.Length := Object.Length + 1;
else
raise Invalid_Type_Error with "Value not an array";
end if;
end Append;
procedure Insert
(Object : in out JSON_Value;
Key : JSON_Value;
Value : JSON_Value;
Check_Duplicate_Keys : Boolean) is
begin
if Object.Kind = Object_Kind then
if Check_Duplicate_Keys and then Object.Contains (Key.Value) then
raise Constraint_Error with "JSON object already has key '" & Key.Value & "'";
end if;
declare
Length : constant Natural
:= Natural (Object.Allocator.Object_Levels (Object.Depth).Length);
begin
-- Assert that Object is the last object in a particular level
-- so that its key-value pairs form a continuous array
pragma Assert (Length = Object.Offset + Object.Length);
end;
pragma Assert (Key.Kind = String_Kind);
Object.Allocator.Object_Levels (Object.Depth).Append
(Key_Value_Pair'(Kind => Value.Kind, Key => Key, Element => Value));
Object.Length := Object.Length + 1;
else
raise Invalid_Type_Error with "Value not an object";
end if;
end Insert;
-----------------------------------------------------------------------------
function Constant_Reference (Object : JSON_Value; Index : Positive)
return JSON_Value renames Get;
function Constant_Reference (Object : JSON_Value; Key : String)
return JSON_Value renames Get;
function Constant_Reference (Object : aliased JSON_Value; Position : Cursor)
return JSON_Value is
begin
case Position.Kind is
when Array_Kind =>
return Object.Allocator.Array_Levels (Position.Data.Depth).Element
(Position.Data.Offset + Position.Index).Value;
when Object_Kind =>
return Object.Allocator.Object_Levels (Position.Data.Depth).Element
(Position.Data.Offset + Position.Index).Key;
end case;
end Constant_Reference;
function Has_Element (Position : Cursor) return Boolean is
(Position.Index <= Position.Data.Length);
overriding
function First (Object : Iterator) return Cursor is
begin
return (Kind => Object.Kind, Data => Object.Data, Index => 1);
end First;
overriding
function Next
(Object : Iterator;
Position : Cursor) return Cursor is
begin
return (Kind => Position.Kind, Data => Position.Data, Index => Position.Index + 1);
end Next;
function Iterate (Object : JSON_Value)
return Value_Iterator_Interfaces.Forward_Iterator'Class is
begin
if Object.Kind in Array_Kind | Object_Kind then
return Iterator'(Kind => Object.Kind, Data => Object);
else
raise Program_Error with "Can only iterate over an array or object";
end if;
end Iterate;
-----------------------------------------------------------------------------
-- Helpers --
-----------------------------------------------------------------------------
function Get_Array_Or_Empty
(Object : JSON_Value; Key : String) return JSON_Value is
begin
if Object.Contains (Key) then
return Object.Get (Key);
else
return
(Kind => Array_Kind,
Allocator => Object.Allocator,
Depth => Object.Allocator.Array_Levels'First,
Offset => 0,
Length => 0);
end if;
end Get_Array_Or_Empty;
function Get_Object_Or_Empty
(Object : JSON_Value; Key : String) return JSON_Value is
begin
if Object.Contains (Key) then
return Object.Get (Key);
else
return
(Kind => Object_Kind,
Allocator => Object.Allocator,
Depth => Object.Allocator.Object_Levels'First,
Offset => 0,
Length => 0);
end if;
end Get_Object_Or_Empty;
function Get
(Object : JSON_Value;
Key : String;
Default : Integer_Type) return JSON_Value is
begin
if Object.Contains (Key) then
return Object.Get (Key);
else
return Create_Integer (Default);
end if;
end Get;
function Get
(Object : JSON_Value;
Key : String;
Default : Float_Type) return JSON_Value is
begin
if Object.Contains (Key) then
return Object.Get (Key);
else
return Create_Float (Default);
end if;
end Get;
function Get
(Object : JSON_Value;
Key : String;
Default : Boolean) return JSON_Value is
begin
if Object.Contains (Key) then
return Object.Get (Key);
else
return Create_Boolean (Default);
end if;
end Get;
-----------------------------------------------------------------------------
-- Image -
-----------------------------------------------------------------------------
function Image_String (Object : JSON_Value) return String is
Text : String renames Object.Stream.Get_String
(Object.String_Offset, Object.String_Length);
begin
-- A string backed by a stream is always escaped. The tokenizer
-- will verify that the string does not contain unexpected characters
return '"' & Text & '"';
end Image_String;
function Image_Integer (Object : JSON_Value) return String is
Result : constant String := Integer_Type'Image (Object.Integer_Value);
begin
if Object.Integer_Value < 0 then
return Result;
else
return Result (2 .. Result'Last);
end if;
end Image_Integer;
function Image_Float (Object : JSON_Value) return String is
Result : constant String := Float_Type'Image (Object.Float_Value);
begin
if Object.Float_Value < 0.0 then
return Result;
else
return Result (2 .. Result'Last);
end if;
end Image_Float;
function Image_Boolean (Object : JSON_Value) return String is
(if Object.Boolean_Value then "true" else "false");
function Image_Array (Object : JSON_Value) return String is
Index : Natural := 0;
Result : SU.Unbounded_String := +"[";
begin
for Element of Object loop
Index := Index + 1;
if Index > 1 then
SU.Append (Result, ",");
end if;
SU.Append (Result, Element.Image);
end loop;
SU.Append (Result, "]");
return +Result;
end Image_Array;
function Image_Object (Object : JSON_Value) return String is
Index : Natural := 0;
Result : SU.Unbounded_String := +"{";
begin
for Key of Object loop
Index := Index + 1;
if Index > 1 then
SU.Append (Result, ',');
end if;
SU.Append (Result, '"' & Key.Value & '"');
SU.Append (Result, ':');
SU.Append (Result, Object.Get (Key.Value).Image);
end loop;
SU.Append (Result, '}');
return +Result;
end Image_Object;
function Image (Object : JSON_Value) return String is
begin
case Object.Kind is
when Array_Kind =>
return Image_Array (Object);
when Object_Kind =>
return Image_Object (Object);
when String_Kind =>
return Image_String (Object);
when Integer_Kind =>
return Image_Integer (Object);
when Float_Kind =>
return Image_Float (Object);
when Boolean_Kind =>
return Image_Boolean (Object);
when Null_Kind =>
return "null";
end case;
end Image;
end JSON.Types;
|
jscparker/math_packages | Ada | 3,599 | ads |
-- PACKAGE Crout_LU
--
-- LU decomposition and linear equation solving, with partial pivoting,
-- for square, real valued matrices.
--
-- A square (N X N) matrix with elements of generic type Real
-- is input as "A" and returned in LU form, along with an array
-- containing information on the permutation of the rows of the
-- matrix that occurred during pivoting.
--
-- The decomposition can be performed on arbitrary diagonal blocks of A.
--
-- If Scaling_Desired = True, then matrices are scaled prior to LU
-- decomposition. First all the columns are scaled to near unity (in
-- 1-norm). Then the process is repeated for the rows. It's not fast
-- but occasionally improves the decomposition.
--
-- The LU form of A can then be used to solve simultaneous linear
-- equations of the form A X = B. Column vector B is input
-- into procedure Solve, and the solution is returned as X.
--
generic
type Real is digits <>;
type Index is range <>;
-- Defines the maximum size of the matrix: (N X N) where
-- N = Index'Last - Index'First + 1. This is storage
-- set aside for the matrix, but the routines operate on
-- arbitrary diagonal blocks of the Matrix.
type Matrix is array(Index, Index) of Real;
package Crout_LU is
type Row_Vector is array(Index) of Real;
subtype Col_Vector is Row_Vector;
type Rearrangement is array(Index) of Index;
type Scale_id is (Diag_Inverse, For_Rows, For_Cols);
type Scale_Vectors is array (Scale_id) of Row_Vector;
procedure LU_Decompose
(A : in out Matrix; -- A is overwritten with L and U
Scalings : out Scale_Vectors;
Row_Permutation : out Rearrangement;
Final_Index : in Index := Index'Last;
Starting_Index : in Index := Index'First;
Scaling_Desired : in Boolean := False);
-- In the output matrix A, the lower triangular matrix L is stored
-- in the lower triangular region of A, and the upper, U, is stored
-- in the upper triangular region of A.
-- The diagonal of L is assumed to be entirely 1.0, so the output
-- matrix A stores the diagonal elements of U along its diagonal.
-- The matrix to be decomposed is (M X M) where
-- M = Final_Index - Index'First + 1. The Matrix A can be much larger
-- than M X M, but all values of A with row or column
-- greater than Final_Index are ignored.
procedure LU_Solve
(X : out Row_Vector;
B : in Row_Vector;
A_LU : in Matrix;
Scalings : in Scale_Vectors;
Row_Permutation : in Rearrangement;
Final_Index : in Index := Index'Last;
Starting_Index : in Index := Index'First);
-- Solve for X in the equation A X = B. The matrix LU_of_A is the LU decomp
-- of matrix A. Its top triangular part is U, and its lower triangular
-- is L, where L*U = A.
-- The output of LU_Decompose is in suitable form for "Solve".
function Product
(A : Matrix;
V : Row_Vector;
Final_Index : Index := Index'Last;
Starting_Index : Index := Index'First)
return Row_Vector;
function "-"(A, B : in Col_Vector) return Col_Vector;
procedure Scale_Cols_Then_Rows
(A : in out Matrix;
Scalings : out Scale_Vectors;
Final_Index : in Index := Index'Last;
Starting_Index : in Index := Index'First);
-- Returns the matrix A in its scaled form. The only purpose
-- is for testing.
end Crout_LU;
|
tum-ei-rcs/StratoX | Ada | 4,243 | ads | -- Generic Buffer
-- Author: Emanuel Regnath ([email protected])
-- Can be used as ring buffer or queue
-- Note: Since this used OO features (class-wide types), the Liskov Subsitution Principle (LSP)
-- applies. That is, all contracts on primitives of the derived types must be *weaker*
-- than the contracts given here, so that the derived types can always safely be substituted
-- with the base type.
-- For that reason, all contracts given here must apply to the class-wide type (denoted by
-- Pre'Class, Post'Class, etc.)
-- To avoid this, remove "tagged".
generic
type Index_Type is mod <>;
type Element_Type is private;
package Generic_Queue with SPARK_Mode is
subtype Length_Type is Natural range 0 .. Integer( Index_Type'Last ) + 1;
type Element_Array is array (Length_Type range <>) of Element_Type;
type Mode_Type is (RING, QUEUE);
type Buffer_Element_Array is private;
type Buffer_Tag is tagged private;
procedure clear( Self : in out Buffer_Tag )
with Post'Class => Self.Empty;
-- remove all elements
procedure fill( Self : in out Buffer_Tag );
procedure push_back( Self : in out Buffer_Tag; element : Element_Type )
with Post => not Self.Empty;
-- append new element at back
procedure push_front( Self : in out Buffer_Tag; element : Element_Type )
with Post'Class => not Self.Empty;
-- prepend new element at front
procedure pop_front( Self : in out Buffer_Tag; element : out Element_Type )
with Pre'Class => not Self.Empty,
Post'Class => not Self.Full;
-- read and remove element at front
procedure pop_front( Self : in out Buffer_Tag; elements : out Element_Array )
with Pre'Class => elements'Length <= Self.Length;
-- entry pop_front_blocking( Self : in out Buffer_Tag; element : out Element_Type );
-- wait until buffer is not empty then read and remove element at front
procedure pop_back( Self : in out Buffer_Tag; element : out Element_Type)
with Pre'Class => not Self.Empty,
Post'Class => not Self.Full;
-- read and remove element at back
procedure pop_all( Self : in out Buffer_Tag; elements : out Element_Array )
with Post'Class => Self.Empty;
-- read and remove all elements, front first
procedure get_front( Self : in Buffer_Tag; element : out Element_Type )
with Pre'Class => not Self.Empty;
-- read element at front
procedure get_front( Self : in Buffer_Tag; elements : out Element_Array )
with Pre'Class => elements'Length <= Self.Length;
-- read element at front
procedure get_back( Self : in Buffer_Tag; element : out Element_Type )
with Pre'Class => not Self.Empty;
-- read element at back
procedure get_all( Self : in Buffer_Tag; elements : out Element_Array )
with Pre'Class => elements'Length = Self.Length;
-- read all elements, front first
--function get_at( index : Index_Type ) return Element_Type;
procedure get_nth_first( Self : in Buffer_Tag; nth : Index_Type; element : out Element_Type);
-- read nth element, nth = 0 is front
procedure get_nth_last( Self : in Buffer_Tag; nth : Index_Type; element : out Element_Type);
-- read nth element, nth = 0 is back
function Length( Self : in Buffer_Tag) return Length_Type;
-- number of elements in buffer
function Empty( Self : in Buffer_Tag) return Boolean;
-- true if buffer is empty
function hasElements( Self : in Buffer_Tag) return Boolean;
-- true if buffer has elements
function Full( Self : in Buffer_Tag) return Boolean;
-- true if buffer is full
function Overflows( Self : in Buffer_Tag) return Natural;
-- number of buffer overflows
private
type Buffer_Element_Array is array (Index_Type) of Element_Type;
type Buffer_Tag is tagged record
mode : Mode_Type := RING;
buffer : Buffer_Element_Array;-- := (others => Element_Type'First);
index_head : Index_Type := 0;
index_tail : Index_Type := 0;
hasElements : Boolean := False;
Num_Overflows : Natural := 0;
end record;
procedure p_get_all( Self : in Buffer_Tag; elements : out Element_Array );
procedure p_get( Self : in Buffer_Tag; elements : out Element_Array );
end Generic_Queue;
|
zhmu/ananas | Ada | 3,848 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . O S _ P R I M I T I V E S. T I M E D _ D E L A Y --
-- --
-- B o d y --
-- --
-- Copyright (C) 2012-2022, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This is the Posix, Posix2008, and LynxOS version of this procedure.
separate (System.OS_Primitives)
procedure Timed_Delay
(Time : Duration;
Mode : Integer)
is
Request : aliased timespec;
Remaind : aliased timespec;
Rel_Time : Duration;
Abs_Time : Duration;
Base_Time : constant Duration := Clock;
Check_Time : Duration := Base_Time;
Time_Chunk : Duration;
Result : Integer;
pragma Unreferenced (Result);
begin
if Mode = Relative then
Rel_Time := Time;
Abs_Time := Time + Check_Time;
else
Rel_Time := Time - Check_Time;
Abs_Time := Time;
end if;
-- To keep a sensible Max_Sensible_Delay on a target whose system
-- maximum is less than sensible, we split the delay into manageable
-- chunks of time less than or equal to the Max_System_Delay.
if Rel_Time > 0.0 then
Time_Chunk := Rel_Time;
loop
pragma Warnings (Off, "condition is always *");
if Max_System_Delay < Max_Sensible_Delay and then
Time_Chunk > Max_System_Delay
then
Time_Chunk := Max_System_Delay;
end if;
pragma Warnings (On);
Request := To_Timespec (Time_Chunk);
Result := nanosleep (Request'Access, Remaind'Access);
Check_Time := Clock;
exit when Abs_Time <= Check_Time or else Check_Time < Base_Time;
Time_Chunk := Abs_Time - Check_Time;
end loop;
end if;
end Timed_Delay;
|
reznikmm/matreshka | Ada | 4,615 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Draw.Start_Color_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Draw_Start_Color_Attribute_Node is
begin
return Self : Draw_Start_Color_Attribute_Node do
Matreshka.ODF_Draw.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Draw_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Draw_Start_Color_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Start_Color_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Draw_URI,
Matreshka.ODF_String_Constants.Start_Color_Attribute,
Draw_Start_Color_Attribute_Node'Tag);
end Matreshka.ODF_Draw.Start_Color_Attributes;
|
stcarrez/ada-asf | Ada | 2,891 | ads | -----------------------------------------------------------------------
-- components-widgets-tabs -- Tab views, tabs and accordion
-- Copyright (C) 2013 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ASF.Components.Html;
with ASF.Contexts.Faces;
package ASF.Components.Widgets.Tabs is
COLLAPSIBLE_ATTR_NAME : constant String := "collapsible";
EFFECT_ATTR_NAME : constant String := "effect";
DURATION_ATTR_NAME : constant String := "duration";
-- ------------------------------
-- UITab
-- ------------------------------
-- The <b>UITab</b> component displays a tab component within a tab view.
type UITab is new ASF.Components.Html.UIHtmlComponent with null record;
-- Render the tab start.
overriding
procedure Encode_Begin (UI : in UITab;
Context : in out ASF.Contexts.Faces.Faces_Context'Class);
-- Render the tab close.
overriding
procedure Encode_End (UI : in UITab;
Context : in out ASF.Contexts.Faces.Faces_Context'Class);
-- ------------------------------
-- UITabView
-- ------------------------------
-- The <b>UITabView</b> component displays a tab selection panel.
type UITabView is new ASF.Components.Html.UIHtmlComponent with null record;
-- Render the tab list and prepare to render the tab contents.
overriding
procedure Encode_Begin (UI : in UITabView;
Context : in out ASF.Contexts.Faces.Faces_Context'Class);
-- Render the tab view close.
overriding
procedure Encode_End (UI : in UITabView;
Context : in out ASF.Contexts.Faces.Faces_Context'Class);
-- ------------------------------
-- UIAccordion
-- ------------------------------
-- The <b>UIAccordion</b> component displays a tab selection panel.
type UIAccordion is new ASF.Components.Html.UIHtmlComponent with null record;
-- Render the accordion list and prepare to render the tab contents.
overriding
procedure Encode_Children (UI : in UIAccordion;
Context : in out ASF.Contexts.Faces.Faces_Context'Class);
end ASF.Components.Widgets.Tabs;
|
reznikmm/matreshka | Ada | 11,623 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web 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 XML.SAX.Attributes;
package body AWF.HTML_Writers is
HTML_Namespace : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("http://www.w3.org/1999/xhtml");
Body_Element : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("body");
Div_Element : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("div");
Head_Element : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("head");
HTML_Element : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("html");
Script_Element : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("script");
Table_Element : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("table");
Td_Element : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("td");
Title_Element : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("title");
Tr_Element : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("tr");
Id_Attribute : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("id");
On_Click_Attribute : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("onclick");
Src_Attribute : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("src");
Style_Attribute : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("style");
----------------
-- Characters --
----------------
not overriding procedure Characters
(Self : in out HTML_Writer;
Text : League.Strings.Universal_String) is
begin
Self.Writer.Characters (Text);
end Characters;
--------------
-- End_Body --
--------------
not overriding procedure End_Body (Self : in out HTML_Writer) is
begin
Self.Writer.End_Element
(Namespace_URI => HTML_Namespace, Local_Name => Body_Element);
end End_Body;
-------------
-- End_Div --
-------------
not overriding procedure End_Div (Self : in out HTML_Writer) is
begin
Self.Writer.End_Element
(Namespace_URI => HTML_Namespace, Local_Name => Div_Element);
end End_Div;
--------------
-- End_Head --
--------------
not overriding procedure End_Head (Self : in out HTML_Writer) is
begin
Self.Writer.End_Element
(Namespace_URI => HTML_Namespace, Local_Name => Head_Element);
end End_Head;
--------------
-- End_HTML --
--------------
not overriding procedure End_HTML (Self : in out HTML_Writer) is
begin
-- End 'html' element and end XHTML namespace.
Self.Writer.End_Element
(Namespace_URI => HTML_Namespace, Local_Name => HTML_Element);
Self.Writer.End_Prefix_Mapping;
-- End XML document.
Self.Writer.End_Document;
end End_HTML;
----------------
-- End_Script --
----------------
not overriding procedure End_Script (Self : in out HTML_Writer) is
begin
Self.Writer.End_Element
(Namespace_URI => HTML_Namespace, Local_Name => Script_Element);
end End_Script;
---------------
-- End_Table --
---------------
not overriding procedure End_Table (Self : in out HTML_Writer) is
begin
Self.Writer.End_Element
(Namespace_URI => HTML_Namespace, Local_Name => Table_Element);
end End_Table;
------------
-- End_Td --
------------
not overriding procedure End_Td (Self : in out HTML_Writer) is
begin
Self.Writer.End_Element
(Namespace_URI => HTML_Namespace, Local_Name => Td_Element);
end End_Td;
---------------
-- End_Title --
---------------
not overriding procedure End_Title (Self : in out HTML_Writer) is
begin
Self.Writer.End_Element
(Namespace_URI => HTML_Namespace, Local_Name => Title_Element);
end End_Title;
------------
-- End_Tr --
------------
not overriding procedure End_Tr (Self : in out HTML_Writer) is
begin
Self.Writer.End_Element
(Namespace_URI => HTML_Namespace, Local_Name => Tr_Element);
end End_Tr;
----------------
-- Start_Body --
----------------
not overriding procedure Start_Body (Self : in out HTML_Writer) is
begin
Self.Writer.Start_Element
(Namespace_URI => HTML_Namespace, Local_Name => Body_Element);
end Start_Body;
---------------
-- Start_Div --
---------------
not overriding procedure Start_Div
(Self : in out HTML_Writer;
Id : League.Strings.Universal_String
:= League.Strings.Empty_Universal_String;
Style : League.Strings.Universal_String
:= League.Strings.Empty_Universal_String;
On_Click : League.Strings.Universal_String
:= League.Strings.Empty_Universal_String)
is
Attributes : XML.SAX.Attributes.SAX_Attributes;
begin
if not Id.Is_Empty then
Attributes.Set_Value (Id_Attribute, Id);
end if;
if not Style.Is_Empty then
Attributes.Set_Value (Style_Attribute, Style);
end if;
if not On_Click.Is_Empty then
Attributes.Set_Value (On_Click_Attribute, On_Click);
end if;
Self.Writer.Start_Element
(Namespace_URI => HTML_Namespace,
Local_Name => Div_Element,
Attributes => Attributes);
end Start_Div;
----------------
-- Start_Head --
----------------
not overriding procedure Start_Head (Self : in out HTML_Writer) is
begin
Self.Writer.Start_Element
(Namespace_URI => HTML_Namespace, Local_Name => Head_Element);
end Start_Head;
----------------
-- Start_HTML --
----------------
not overriding procedure Start_HTML (Self : in out HTML_Writer) is
begin
Self.Writer.Set_Offset (2);
-- Start XML document.
Self.Writer.Start_Document;
-- Declare document type.
Self.Writer.Start_DTD (Name => HTML_Element);
Self.Writer.End_DTD;
-- Declare XHTML namespace and start 'html' element.
Self.Writer.Start_Prefix_Mapping (Namespace_URI => HTML_Namespace);
Self.Writer.Start_Element
(Namespace_URI => HTML_Namespace, Local_Name => HTML_Element);
end Start_HTML;
------------------
-- Start_Script --
------------------
not overriding procedure Start_Script
(Self : in out HTML_Writer;
Src : League.Strings.Universal_String
:= League.Strings.Empty_Universal_String)
is
Attributes : XML.SAX.Attributes.SAX_Attributes;
begin
if not Src.Is_Empty then
Attributes.Set_Value (Src_Attribute, Src);
end if;
Self.Writer.Start_Element
(Namespace_URI => HTML_Namespace,
Local_Name => Script_Element,
Attributes => Attributes);
end Start_Script;
-----------------
-- Start_Table --
-----------------
not overriding procedure Start_Table (Self : in out HTML_Writer) is
begin
Self.Writer.Start_Element
(Namespace_URI => HTML_Namespace, Local_Name => Table_Element);
end Start_Table;
--------------
-- Start_Td --
--------------
not overriding procedure Start_Td (Self : in out HTML_Writer) is
begin
Self.Writer.Start_Element
(Namespace_URI => HTML_Namespace, Local_Name => Td_Element);
end Start_Td;
-----------------
-- Start_Title --
-----------------
not overriding procedure Start_Title (Self : in out HTML_Writer) is
begin
Self.Writer.Start_Element
(Namespace_URI => HTML_Namespace, Local_Name => Title_Element);
end Start_Title;
--------------
-- Start_Tr --
--------------
not overriding procedure Start_Tr (Self : in out HTML_Writer) is
begin
Self.Writer.Start_Element
(Namespace_URI => HTML_Namespace, Local_Name => Tr_Element);
end Start_Tr;
----------
-- Text --
----------
not overriding function Text
(Self : HTML_Writer) return League.Strings.Universal_String is
begin
return Self.Writer.Text;
end Text;
end AWF.HTML_Writers;
|
AdaCore/langkit | Ada | 1,857 | adb | -- Test that lookups on grouped lexical envs works correctly
with Ada.Exceptions;
with Ada.Text_IO; use Ada.Text_IO;
with Langkit_Support.Errors; use Langkit_Support.Errors;
with Langkit_Support.Lexical_Envs; use Langkit_Support.Lexical_Envs;
with Langkit_Support.Symbols; use Langkit_Support.Symbols;
with Support; use Support;
use Support.Envs;
procedure Main is
Symbols : Symbol_Table := Create_Symbol_Table;
Key_X : constant Symbol_Type := Find (Symbols, "X");
New_Env : Lexical_Env := Create_Lexical_Env
(Null_Lexical_Env, 'N', Owner => No_Generic_Unit);
Root : Lexical_Env := Create_Lexical_Env
(Null_Lexical_Env, 'R', Owner => No_Generic_Unit);
Child : Lexical_Env := Create_Lexical_Env
(Root, 'R', Owner => No_Generic_Unit);
Grandchild : Lexical_Env := Create_Lexical_Env
(Child, 'O', Owner => No_Generic_Unit);
Rebindings : Env_Rebindings := Append (null, Child, New_Env);
Rebound : Lexical_Env := Rebind_Env (Grandchild, Rebindings);
begin
Add (Root, Key_X, '1');
Add (New_Env, Key_X, '2');
Add (Grandchild, Key_X, '3');
Put_Line ("Looking in Rebound:");
Put_Line (Get (Rebound, Key_X));
declare
Dummy : Env_Rebindings;
begin
Dummy := Append (Rebindings, Child, New_Env);
Put_Line ("Double rebinding: no error raised...");
exception
when Exc : Property_Error =>
Put_Line ("Got a Property_Error:");
Put_Line (Ada.Exceptions.Exception_Message (Exc));
end;
Dec_Ref (Rebound);
Destroy (Grandchild);
Destroy (New_Env);
Destroy (Root);
Destroy (Child);
for Child of Rebindings.Children loop
declare
C : Env_Rebindings := Child;
begin
Destroy (C);
end;
end loop;
Rebindings.Children.Destroy;
Destroy (Rebindings);
Destroy (Symbols);
end Main;
|
zhmu/ananas | Ada | 7,886 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T . S O C K E T S . T H I N . C _ S O C K E T P A I R --
-- --
-- B o d y --
-- --
-- Copyright (C) 2001-2022, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Portable sockets-based implementation of the C_Socketpair used for
-- platforms that do not support UNIX socketpair system call.
-- Note: this code is only for non-UNIX platforms.
separate (GNAT.Sockets.Thin)
function C_Socketpair
(Domain : C.int;
Typ : C.int;
Protocol : C.int;
Fds : not null access Fd_Pair) return C.int
is
use type C.char_array;
L_Sock, C_Sock, P_Sock : C.int := Failure;
-- Listening socket, client socket and peer socket
Family : constant Family_Type :=
(case Domain is
when SOSC.AF_INET => Family_Inet,
when SOSC.AF_INET6 => Family_Inet6,
when others => Family_Unspec);
Len : aliased C.int := C.int (Lengths (Family));
C_Sin : aliased Sockaddr;
C_Bin : aliased C.char_array (1 .. C.size_t (Len));
for C_Bin'Address use C_Sin'Address;
-- Address of listening and client socket and it's binary representation.
-- We need binary representation because Ada does not allow to compare
-- unchecked union if either of the operands lacks inferable discriminants.
-- RM-B-3-3 23/2.
P_Sin : aliased Sockaddr;
P_Bin : aliased C.char_array (1 .. C.size_t (Len));
for P_Bin'Address use P_Sin'Address;
-- Address of peer socket and it's binary representation
T_Sin : aliased Sockaddr;
T_Bin : aliased C.char_array (1 .. C.size_t (Len));
for T_Bin'Address use T_Sin'Address;
-- Temporary address to compare and check that address and port of the
-- socket equal to peer address and port of the opposite connected socket.
Res : C.int with Warnings => Off;
begin
Set_Family (C_Sin.Sin_Family, Family);
case Family is
when Family_Inet =>
C_Sin.Sin_Addr.S_B1 := 127;
C_Sin.Sin_Addr.S_B4 := 1;
when Family_Inet6 =>
C_Sin.Sin6_Addr (C_Sin.Sin6_Addr'Last) := 1;
when others =>
Set_Socket_Errno (SOSC.EAFNOSUPPORT);
return Failure;
end case;
for J in 1 .. 10 loop
-- Retry loop, in case the C_Connect below fails
C_Sin.Sin_Port := 0;
-- Create a listening socket
L_Sock := C_Socket (Domain, Typ, Protocol);
exit when L_Sock = Failure;
-- Bind the socket to an available port on localhost
Res := C_Bind (L_Sock, C_Sin'Address, Len);
exit when Res = Failure;
-- Get assigned port
Res := C_Getsockname (L_Sock, C_Sin'Address, Len'Access);
exit when Res = Failure;
-- Set socket to listen mode, with a backlog of 1 to guarantee that
-- exactly one call to connect(2) succeeds.
Res := C_Listen (L_Sock, 1);
exit when Res = Failure;
-- Create read end (client) socket
C_Sock := C_Socket (Domain, Typ, Protocol);
exit when C_Sock = Failure;
-- Connect listening socket
Res := C_Connect (C_Sock, C_Sin'Address, Len);
if Res = Failure then
-- In rare cases, the above C_Bind chooses a port that is still
-- marked "in use", even though it has been closed (perhaps by some
-- other process that has already exited). This causes the above
-- C_Connect to fail with EADDRINUSE. In this case, we close the
-- ports, and loop back to try again. This mysterious Windows
-- behavior is documented. See, for example:
-- http://msdn2.microsoft.com/en-us/library/ms737625.aspx
-- In an experiment with 2000 calls, 21 required exactly one retry, 7
-- required two, and none required three or more. Note that no delay
-- is needed between retries; retrying C_Bind will typically produce
-- a different port.
exit when Socket_Errno /= SOSC.EADDRINUSE;
goto Repeat;
end if;
-- Since the call to connect(2) has succeeded and the backlog limit
-- on the listening socket is 1, we know that there is now exactly
-- one pending connection on L_Sock, which is the one from R_Sock.
P_Sin.Sun_Path := (others => C.nul);
P_Sock := C_Accept (L_Sock, P_Sin'Address, Len'Access);
exit when P_Sock = Failure;
-- Address and port of the socket equal to peer address and port of the
-- opposite connected socket.
Res := C_Getsockname (P_Sock, T_Sin'Address, Len'Access);
exit when Res = Failure;
if T_Bin /= C_Bin then
goto Repeat;
end if;
-- Address and port of the socket equal to peer address and port of the
-- opposite connected socket.
Res := C_Getsockname (C_Sock, T_Sin'Address, Len'Access);
exit when Res = Failure;
if T_Bin /= P_Bin then
goto Repeat;
end if;
-- Close listening socket (ignore exit status)
Res := C_Close (L_Sock);
Fds.all := (Read_End => C_Sock, Write_End => P_Sock);
return Thin_Common.Success;
<<Repeat>>
Res := C_Close (C_Sock);
C_Sock := Failure;
Res := C_Close (P_Sock);
P_Sock := Failure;
Res := C_Close (L_Sock);
L_Sock := Failure;
end loop;
declare
Saved_Errno : constant Integer := Socket_Errno;
begin
if P_Sock /= Failure then
Res := C_Close (P_Sock);
end if;
if C_Sock /= Failure then
Res := C_Close (C_Sock);
end if;
if L_Sock /= Failure then
Res := C_Close (L_Sock);
end if;
Set_Socket_Errno (Saved_Errno);
end;
return Failure;
end C_Socketpair;
|
stcarrez/babel | Ada | 6,135 | adb | with GNAT.Command_Line; use GNAT.Command_Line;
with GNAT.IO; use GNAT.IO;
with GNAT.Traceback.Symbolic;
with Ada.Exceptions;
with Ada.Command_Line;
with Ada.Text_IO;
with Babel;
with Babel.Files;
with Ada.Directories;
with Ada.Strings.Unbounded;
with Util.Encoders;
with Util.Encoders.Base16;
with Util.Log.Loggers;
with Babel.Filters;
with Babel.Files.Buffers;
with Babel.Files.Queues;
with Babel.Stores.Local;
with Babel.Strategies.Default;
with Babel.Strategies.Workers;
with Babel.Base.Text;
with Babel.Base.Users;
with Babel.Streams;
with Babel.Streams.XZ;
with Babel.Streams.Cached;
with Babel.Streams.Files;
with Tar;
procedure babel_main is
use Ada.Strings.Unbounded;
Out_Dir : Ada.Strings.Unbounded.Unbounded_String;
Dir : Babel.Files.Directory_Type;
Hex_Encoder : Util.Encoders.Base16.Encoder;
Exclude : aliased Babel.Filters.Exclude_Directory_Filter_Type;
Local : aliased Babel.Stores.Local.Local_Store_Type;
Backup : aliased Babel.Strategies.Default.Default_Strategy_Type;
Buffers : aliased Babel.Files.Buffers.Buffer_Pool;
Store : aliased Babel.Stores.Local.Local_Store_Type;
Database : aliased Babel.Base.Text.Text_Database;
Queue : aliased Babel.Files.Queues.File_Queue;
Debug : Boolean := False;
Task_Count : Positive := 2;
--
-- procedure Print_Sha (Path : in String;
-- File : in out Babel.Files.File) is
-- Sha : constant String := Hex_Encoder.Transform (File.SHA1);
-- begin
-- Put_Line (Path & "/" & To_String (File.Name) & " => " & Sha);
-- end Print_Sha;
procedure Usage is
begin
Ada.Text_IO.Put_Line ("babel [-d] [-t count] {command} [options]");
Ada.Text_IO.Put_Line (" -d Debug mode");
Ada.Text_IO.Put_Line (" -t count Number of tasks to create");
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("Commands:");
Ada.Text_IO.Put_Line (" copy <dst-dir> <src-dir>");
Ada.Text_IO.Put_Line (" scan <src-dir>");
Ada.Command_Line.Set_Exit_Status (2);
end Usage;
package Backup_Workers is
new Babel.Strategies.Workers (Babel.Strategies.Default.Default_Strategy_Type);
procedure Do_Backup (Count : in Positive) is
Workers : Backup_Workers.Worker_Type (Count);
Container : Babel.Files.Default_Container;
Dir_Queue : Babel.Files.Queues.Directory_Queue;
procedure Configure (Strategy : in out Babel.Strategies.Default.Default_Strategy_Type) is
begin
Strategy.Set_Filters (Exclude'Unchecked_Access);
Strategy.Set_Stores (Read => Local'Unchecked_Access, Write => Store'Unchecked_Access);
Strategy.Set_Buffers (Buffers'Unchecked_Access);
Strategy.Set_Queue (Queue'Unchecked_Access);
end Configure;
begin
Babel.Files.Queues.Add_Directory (Dir_Queue, Dir);
Configure (Backup);
Backup_Workers.Configure (Workers, Configure'Access);
Backup_Workers.Start (Workers);
Backup.Scan (Dir_Queue, Container);
Backup_Workers.Finish (Workers, Database);
end Do_Backup;
procedure Do_Copy is
Dst : constant String := GNAT.Command_Line.Get_Argument;
Src : constant String := GNAT.Command_Line.Get_Argument;
begin
Dir := Babel.Files.Allocate (Name => Src,
Dir => Babel.Files.NO_DIRECTORY);
Store.Set_Root_Directory (Dst);
Local.Set_Root_Directory ("");
Do_Backup (Task_Count);
Database.Save ("database.txt");
end Do_Copy;
procedure Do_Scan is
Src : constant String := GNAT.Command_Line.Get_Argument;
Workers : Backup_Workers.Worker_Type (Task_Count);
Container : Babel.Files.Default_Container;
Dir_Queue : Babel.Files.Queues.Directory_Queue;
procedure Configure (Strategy : in out Babel.Strategies.Default.Default_Strategy_Type) is
begin
Strategy.Set_Filters (Exclude'Unchecked_Access);
Strategy.Set_Stores (Read => Local'Unchecked_Access, Write => null);
Strategy.Set_Buffers (Buffers'Unchecked_Access);
Strategy.Set_Queue (Queue'Unchecked_Access);
end Configure;
begin
Dir := Babel.Files.Allocate (Name => Src,
Dir => Babel.Files.NO_DIRECTORY);
Local.Set_Root_Directory ("");
Babel.Files.Queues.Add_Directory (Dir_Queue, Dir);
Configure (Backup);
Backup_Workers.Configure (Workers, Configure'Access);
Backup_Workers.Start (Workers);
Backup.Scan (Dir_Queue, Container);
Backup_Workers.Finish (Workers, Database);
Database.Save ("database-scan.txt");
end Do_Scan;
begin
Util.Log.Loggers.Initialize ("babel.properties");
Initialize_Option_Scan (Stop_At_First_Non_Switch => True, Section_Delimiters => "targs");
-- Parse the command line
loop
case Getopt ("* v o: t:") is
when ASCII.NUL =>
exit;
when 'o' =>
Out_Dir := To_Unbounded_String (Parameter & "/");
when 'd' =>
Debug := True;
when 't' =>
Task_Count := Positive'Value (Parameter);
when '*' =>
exit;
when others =>
null;
end case;
end loop;
if Ada.Command_Line.Argument_Count = 0 then
Usage;
return;
end if;
Babel.Files.Buffers.Create_Pool (Into => Buffers, Count => 100, Size => 64 * 1024);
Store.Set_Buffers (Buffers'Unchecked_Access);
Local.Set_Buffers (Buffers'Unchecked_Access);
declare
Cmd_Name : constant String := Full_Switch;
begin
if Cmd_Name = "copy" then
Do_Copy;
elsif Cmd_Name = "scan" then
Do_Scan;
else
Usage;
end if;
end;
exception
when E : Invalid_Switch =>
Ada.Text_IO.Put_Line ("Invalid option: " & Ada.Exceptions.Exception_Message (E));
Usage;
when E : others =>
Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Message (E));
Ada.Text_IO.Put_Line (GNAT.Traceback.Symbolic.Symbolic_Traceback (E));
Ada.Command_Line.Set_Exit_Status (1);
end babel_main;
|
reznikmm/matreshka | Ada | 5,361 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Generic_Collections;
package AMF.Standard_Profile_L2.Refines.Collections is
pragma Preelaborate;
package Standard_Profile_L2_Refine_Collections is
new AMF.Generic_Collections
(Standard_Profile_L2_Refine,
Standard_Profile_L2_Refine_Access);
type Set_Of_Standard_Profile_L2_Refine is
new Standard_Profile_L2_Refine_Collections.Set with null record;
Empty_Set_Of_Standard_Profile_L2_Refine : constant Set_Of_Standard_Profile_L2_Refine;
type Ordered_Set_Of_Standard_Profile_L2_Refine is
new Standard_Profile_L2_Refine_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_Standard_Profile_L2_Refine : constant Ordered_Set_Of_Standard_Profile_L2_Refine;
type Bag_Of_Standard_Profile_L2_Refine is
new Standard_Profile_L2_Refine_Collections.Bag with null record;
Empty_Bag_Of_Standard_Profile_L2_Refine : constant Bag_Of_Standard_Profile_L2_Refine;
type Sequence_Of_Standard_Profile_L2_Refine is
new Standard_Profile_L2_Refine_Collections.Sequence with null record;
Empty_Sequence_Of_Standard_Profile_L2_Refine : constant Sequence_Of_Standard_Profile_L2_Refine;
private
Empty_Set_Of_Standard_Profile_L2_Refine : constant Set_Of_Standard_Profile_L2_Refine
:= (Standard_Profile_L2_Refine_Collections.Set with null record);
Empty_Ordered_Set_Of_Standard_Profile_L2_Refine : constant Ordered_Set_Of_Standard_Profile_L2_Refine
:= (Standard_Profile_L2_Refine_Collections.Ordered_Set with null record);
Empty_Bag_Of_Standard_Profile_L2_Refine : constant Bag_Of_Standard_Profile_L2_Refine
:= (Standard_Profile_L2_Refine_Collections.Bag with null record);
Empty_Sequence_Of_Standard_Profile_L2_Refine : constant Sequence_Of_Standard_Profile_L2_Refine
:= (Standard_Profile_L2_Refine_Collections.Sequence with null record);
end AMF.Standard_Profile_L2.Refines.Collections;
|
optikos/oasis | Ada | 290,486 | adb | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Storage_Pools;
with Program.Nodes.Pragmas;
with Program.Nodes.Defining_Identifiers;
with Program.Nodes.Defining_Character_Literals;
with Program.Nodes.Defining_Operator_Symbols;
with Program.Nodes.Defining_Expanded_Names;
with Program.Nodes.Type_Declarations;
with Program.Nodes.Task_Type_Declarations;
with Program.Nodes.Protected_Type_Declarations;
with Program.Nodes.Subtype_Declarations;
with Program.Nodes.Object_Declarations;
with Program.Nodes.Single_Task_Declarations;
with Program.Nodes.Single_Protected_Declarations;
with Program.Nodes.Number_Declarations;
with Program.Nodes.Enumeration_Literal_Specifications;
with Program.Nodes.Discriminant_Specifications;
with Program.Nodes.Component_Declarations;
with Program.Nodes.Loop_Parameter_Specifications;
with Program.Nodes.Generalized_Iterator_Specifications;
with Program.Nodes.Element_Iterator_Specifications;
with Program.Nodes.Procedure_Declarations;
with Program.Nodes.Function_Declarations;
with Program.Nodes.Parameter_Specifications;
with Program.Nodes.Procedure_Body_Declarations;
with Program.Nodes.Function_Body_Declarations;
with Program.Nodes.Return_Object_Specifications;
with Program.Nodes.Package_Declarations;
with Program.Nodes.Package_Body_Declarations;
with Program.Nodes.Object_Renaming_Declarations;
with Program.Nodes.Exception_Renaming_Declarations;
with Program.Nodes.Procedure_Renaming_Declarations;
with Program.Nodes.Function_Renaming_Declarations;
with Program.Nodes.Package_Renaming_Declarations;
with Program.Nodes.Generic_Package_Renaming_Declarations;
with Program.Nodes.Generic_Procedure_Renaming_Declarations;
with Program.Nodes.Generic_Function_Renaming_Declarations;
with Program.Nodes.Task_Body_Declarations;
with Program.Nodes.Protected_Body_Declarations;
with Program.Nodes.Entry_Declarations;
with Program.Nodes.Entry_Body_Declarations;
with Program.Nodes.Entry_Index_Specifications;
with Program.Nodes.Procedure_Body_Stubs;
with Program.Nodes.Function_Body_Stubs;
with Program.Nodes.Package_Body_Stubs;
with Program.Nodes.Task_Body_Stubs;
with Program.Nodes.Protected_Body_Stubs;
with Program.Nodes.Exception_Declarations;
with Program.Nodes.Choice_Parameter_Specifications;
with Program.Nodes.Generic_Package_Declarations;
with Program.Nodes.Generic_Procedure_Declarations;
with Program.Nodes.Generic_Function_Declarations;
with Program.Nodes.Package_Instantiations;
with Program.Nodes.Procedure_Instantiations;
with Program.Nodes.Function_Instantiations;
with Program.Nodes.Formal_Object_Declarations;
with Program.Nodes.Formal_Type_Declarations;
with Program.Nodes.Formal_Procedure_Declarations;
with Program.Nodes.Formal_Function_Declarations;
with Program.Nodes.Formal_Package_Declarations;
with Program.Nodes.Subtype_Indications;
with Program.Nodes.Component_Definitions;
with Program.Nodes.Discrete_Subtype_Indications;
with Program.Nodes.Discrete_Range_Attribute_References;
with Program.Nodes.Discrete_Simple_Expression_Ranges;
with Program.Nodes.Unknown_Discriminant_Parts;
with Program.Nodes.Known_Discriminant_Parts;
with Program.Nodes.Record_Definitions;
with Program.Nodes.Null_Components;
with Program.Nodes.Variant_Parts;
with Program.Nodes.Variants;
with Program.Nodes.Others_Choices;
with Program.Nodes.Anonymous_Access_To_Objects;
with Program.Nodes.Anonymous_Access_To_Procedures;
with Program.Nodes.Anonymous_Access_To_Functions;
with Program.Nodes.Private_Type_Definitions;
with Program.Nodes.Private_Extension_Definitions;
with Program.Nodes.Incomplete_Type_Definitions;
with Program.Nodes.Task_Definitions;
with Program.Nodes.Protected_Definitions;
with Program.Nodes.Aspect_Specifications;
with Program.Nodes.Real_Range_Specifications;
with Program.Nodes.Numeric_Literals;
with Program.Nodes.String_Literals;
with Program.Nodes.Identifiers;
with Program.Nodes.Operator_Symbols;
with Program.Nodes.Character_Literals;
with Program.Nodes.Explicit_Dereferences;
with Program.Nodes.Infix_Operators;
with Program.Nodes.Function_Calls;
with Program.Nodes.Indexed_Components;
with Program.Nodes.Slices;
with Program.Nodes.Selected_Components;
with Program.Nodes.Attribute_References;
with Program.Nodes.Record_Aggregates;
with Program.Nodes.Extension_Aggregates;
with Program.Nodes.Array_Aggregates;
with Program.Nodes.Short_Circuit_Operations;
with Program.Nodes.Membership_Tests;
with Program.Nodes.Null_Literals;
with Program.Nodes.Parenthesized_Expressions;
with Program.Nodes.Raise_Expressions;
with Program.Nodes.Type_Conversions;
with Program.Nodes.Qualified_Expressions;
with Program.Nodes.Allocators;
with Program.Nodes.Case_Expressions;
with Program.Nodes.If_Expressions;
with Program.Nodes.Quantified_Expressions;
with Program.Nodes.Discriminant_Associations;
with Program.Nodes.Record_Component_Associations;
with Program.Nodes.Array_Component_Associations;
with Program.Nodes.Parameter_Associations;
with Program.Nodes.Formal_Package_Associations;
with Program.Nodes.Null_Statements;
with Program.Nodes.Assignment_Statements;
with Program.Nodes.If_Statements;
with Program.Nodes.Case_Statements;
with Program.Nodes.Loop_Statements;
with Program.Nodes.While_Loop_Statements;
with Program.Nodes.For_Loop_Statements;
with Program.Nodes.Block_Statements;
with Program.Nodes.Exit_Statements;
with Program.Nodes.Goto_Statements;
with Program.Nodes.Call_Statements;
with Program.Nodes.Simple_Return_Statements;
with Program.Nodes.Extended_Return_Statements;
with Program.Nodes.Accept_Statements;
with Program.Nodes.Requeue_Statements;
with Program.Nodes.Delay_Statements;
with Program.Nodes.Terminate_Alternative_Statements;
with Program.Nodes.Select_Statements;
with Program.Nodes.Abort_Statements;
with Program.Nodes.Raise_Statements;
with Program.Nodes.Code_Statements;
with Program.Nodes.Elsif_Paths;
with Program.Nodes.Case_Paths;
with Program.Nodes.Select_Paths;
with Program.Nodes.Case_Expression_Paths;
with Program.Nodes.Elsif_Expression_Paths;
with Program.Nodes.Use_Clauses;
with Program.Nodes.With_Clauses;
with Program.Nodes.Component_Clauses;
with Program.Nodes.Derived_Types;
with Program.Nodes.Derived_Record_Extensions;
with Program.Nodes.Enumeration_Types;
with Program.Nodes.Signed_Integer_Types;
with Program.Nodes.Modular_Types;
with Program.Nodes.Root_Types;
with Program.Nodes.Floating_Point_Types;
with Program.Nodes.Ordinary_Fixed_Point_Types;
with Program.Nodes.Decimal_Fixed_Point_Types;
with Program.Nodes.Unconstrained_Array_Types;
with Program.Nodes.Constrained_Array_Types;
with Program.Nodes.Record_Types;
with Program.Nodes.Interface_Types;
with Program.Nodes.Object_Access_Types;
with Program.Nodes.Procedure_Access_Types;
with Program.Nodes.Function_Access_Types;
with Program.Nodes.Formal_Private_Type_Definitions;
with Program.Nodes.Formal_Derived_Type_Definitions;
with Program.Nodes.Formal_Discrete_Type_Definitions;
with Program.Nodes.Formal_Signed_Integer_Type_Definitions;
with Program.Nodes.Formal_Modular_Type_Definitions;
with Program.Nodes.Formal_Floating_Point_Definitions;
with Program.Nodes.Formal_Ordinary_Fixed_Point_Definitions;
with Program.Nodes.Formal_Decimal_Fixed_Point_Definitions;
with Program.Nodes.Formal_Unconstrained_Array_Types;
with Program.Nodes.Formal_Constrained_Array_Types;
with Program.Nodes.Formal_Object_Access_Types;
with Program.Nodes.Formal_Procedure_Access_Types;
with Program.Nodes.Formal_Function_Access_Types;
with Program.Nodes.Formal_Interface_Types;
with Program.Nodes.Range_Attribute_References;
with Program.Nodes.Simple_Expression_Ranges;
with Program.Nodes.Digits_Constraints;
with Program.Nodes.Delta_Constraints;
with Program.Nodes.Index_Constraints;
with Program.Nodes.Discriminant_Constraints;
with Program.Nodes.Attribute_Definition_Clauses;
with Program.Nodes.Enumeration_Representation_Clauses;
with Program.Nodes.Record_Representation_Clauses;
with Program.Nodes.At_Clauses;
with Program.Nodes.Exception_Handlers;
package body Program.Element_Factories is
type Pragma_Access is not null access Program.Nodes.Pragmas.Pragma_Element
with Storage_Pool => Program.Storage_Pools.Pool;
type Defining_Identifier_Access is
not null access Program.Nodes.Defining_Identifiers.Defining_Identifier
with Storage_Pool => Program.Storage_Pools.Pool;
type Defining_Character_Literal_Access is
not null access Program.Nodes.Defining_Character_Literals
.Defining_Character_Literal
with Storage_Pool => Program.Storage_Pools.Pool;
type Defining_Operator_Symbol_Access is
not null access Program.Nodes.Defining_Operator_Symbols
.Defining_Operator_Symbol
with Storage_Pool => Program.Storage_Pools.Pool;
type Defining_Expanded_Name_Access is
not null access Program.Nodes.Defining_Expanded_Names
.Defining_Expanded_Name with Storage_Pool => Program.Storage_Pools.Pool;
type Type_Declaration_Access is
not null access Program.Nodes.Type_Declarations.Type_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Task_Type_Declaration_Access is
not null access Program.Nodes.Task_Type_Declarations.Task_Type_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Protected_Type_Declaration_Access is
not null access Program.Nodes.Protected_Type_Declarations
.Protected_Type_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Subtype_Declaration_Access is
not null access Program.Nodes.Subtype_Declarations.Subtype_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Object_Declaration_Access is
not null access Program.Nodes.Object_Declarations.Object_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Single_Task_Declaration_Access is
not null access Program.Nodes.Single_Task_Declarations
.Single_Task_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Single_Protected_Declaration_Access is
not null access Program.Nodes.Single_Protected_Declarations
.Single_Protected_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Number_Declaration_Access is
not null access Program.Nodes.Number_Declarations.Number_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Enumeration_Literal_Specification_Access is
not null access Program.Nodes.Enumeration_Literal_Specifications
.Enumeration_Literal_Specification
with Storage_Pool => Program.Storage_Pools.Pool;
type Discriminant_Specification_Access is
not null access Program.Nodes.Discriminant_Specifications
.Discriminant_Specification
with Storage_Pool => Program.Storage_Pools.Pool;
type Component_Declaration_Access is
not null access Program.Nodes.Component_Declarations.Component_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Loop_Parameter_Specification_Access is
not null access Program.Nodes.Loop_Parameter_Specifications
.Loop_Parameter_Specification
with Storage_Pool => Program.Storage_Pools.Pool;
type Generalized_Iterator_Specification_Access is
not null access Program.Nodes.Generalized_Iterator_Specifications
.Generalized_Iterator_Specification
with Storage_Pool => Program.Storage_Pools.Pool;
type Element_Iterator_Specification_Access is
not null access Program.Nodes.Element_Iterator_Specifications
.Element_Iterator_Specification
with Storage_Pool => Program.Storage_Pools.Pool;
type Procedure_Declaration_Access is
not null access Program.Nodes.Procedure_Declarations.Procedure_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Function_Declaration_Access is
not null access Program.Nodes.Function_Declarations.Function_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Parameter_Specification_Access is
not null access Program.Nodes.Parameter_Specifications
.Parameter_Specification
with Storage_Pool => Program.Storage_Pools.Pool;
type Procedure_Body_Declaration_Access is
not null access Program.Nodes.Procedure_Body_Declarations
.Procedure_Body_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Function_Body_Declaration_Access is
not null access Program.Nodes.Function_Body_Declarations
.Function_Body_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Return_Object_Specification_Access is
not null access Program.Nodes.Return_Object_Specifications
.Return_Object_Specification
with Storage_Pool => Program.Storage_Pools.Pool;
type Package_Declaration_Access is
not null access Program.Nodes.Package_Declarations.Package_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Package_Body_Declaration_Access is
not null access Program.Nodes.Package_Body_Declarations
.Package_Body_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Object_Renaming_Declaration_Access is
not null access Program.Nodes.Object_Renaming_Declarations
.Object_Renaming_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Exception_Renaming_Declaration_Access is
not null access Program.Nodes.Exception_Renaming_Declarations
.Exception_Renaming_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Procedure_Renaming_Declaration_Access is
not null access Program.Nodes.Procedure_Renaming_Declarations
.Procedure_Renaming_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Function_Renaming_Declaration_Access is
not null access Program.Nodes.Function_Renaming_Declarations
.Function_Renaming_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Package_Renaming_Declaration_Access is
not null access Program.Nodes.Package_Renaming_Declarations
.Package_Renaming_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Generic_Package_Renaming_Declaration_Access is
not null access Program.Nodes.Generic_Package_Renaming_Declarations
.Generic_Package_Renaming_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Generic_Procedure_Renaming_Declaration_Access is
not null access Program.Nodes.Generic_Procedure_Renaming_Declarations
.Generic_Procedure_Renaming_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Generic_Function_Renaming_Declaration_Access is
not null access Program.Nodes.Generic_Function_Renaming_Declarations
.Generic_Function_Renaming_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Task_Body_Declaration_Access is
not null access Program.Nodes.Task_Body_Declarations.Task_Body_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Protected_Body_Declaration_Access is
not null access Program.Nodes.Protected_Body_Declarations
.Protected_Body_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Entry_Declaration_Access is
not null access Program.Nodes.Entry_Declarations.Entry_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Entry_Body_Declaration_Access is
not null access Program.Nodes.Entry_Body_Declarations
.Entry_Body_Declaration with Storage_Pool => Program.Storage_Pools.Pool;
type Entry_Index_Specification_Access is
not null access Program.Nodes.Entry_Index_Specifications
.Entry_Index_Specification
with Storage_Pool => Program.Storage_Pools.Pool;
type Procedure_Body_Stub_Access is
not null access Program.Nodes.Procedure_Body_Stubs.Procedure_Body_Stub
with Storage_Pool => Program.Storage_Pools.Pool;
type Function_Body_Stub_Access is
not null access Program.Nodes.Function_Body_Stubs.Function_Body_Stub
with Storage_Pool => Program.Storage_Pools.Pool;
type Package_Body_Stub_Access is
not null access Program.Nodes.Package_Body_Stubs.Package_Body_Stub
with Storage_Pool => Program.Storage_Pools.Pool;
type Task_Body_Stub_Access is
not null access Program.Nodes.Task_Body_Stubs.Task_Body_Stub
with Storage_Pool => Program.Storage_Pools.Pool;
type Protected_Body_Stub_Access is
not null access Program.Nodes.Protected_Body_Stubs.Protected_Body_Stub
with Storage_Pool => Program.Storage_Pools.Pool;
type Exception_Declaration_Access is
not null access Program.Nodes.Exception_Declarations.Exception_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Choice_Parameter_Specification_Access is
not null access Program.Nodes.Choice_Parameter_Specifications
.Choice_Parameter_Specification
with Storage_Pool => Program.Storage_Pools.Pool;
type Generic_Package_Declaration_Access is
not null access Program.Nodes.Generic_Package_Declarations
.Generic_Package_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Generic_Procedure_Declaration_Access is
not null access Program.Nodes.Generic_Procedure_Declarations
.Generic_Procedure_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Generic_Function_Declaration_Access is
not null access Program.Nodes.Generic_Function_Declarations
.Generic_Function_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Package_Instantiation_Access is
not null access Program.Nodes.Package_Instantiations.Package_Instantiation
with Storage_Pool => Program.Storage_Pools.Pool;
type Procedure_Instantiation_Access is
not null access Program.Nodes.Procedure_Instantiations
.Procedure_Instantiation
with Storage_Pool => Program.Storage_Pools.Pool;
type Function_Instantiation_Access is
not null access Program.Nodes.Function_Instantiations
.Function_Instantiation with Storage_Pool => Program.Storage_Pools.Pool;
type Formal_Object_Declaration_Access is
not null access Program.Nodes.Formal_Object_Declarations
.Formal_Object_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Formal_Type_Declaration_Access is
not null access Program.Nodes.Formal_Type_Declarations
.Formal_Type_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Formal_Procedure_Declaration_Access is
not null access Program.Nodes.Formal_Procedure_Declarations
.Formal_Procedure_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Formal_Function_Declaration_Access is
not null access Program.Nodes.Formal_Function_Declarations
.Formal_Function_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Formal_Package_Declaration_Access is
not null access Program.Nodes.Formal_Package_Declarations
.Formal_Package_Declaration
with Storage_Pool => Program.Storage_Pools.Pool;
type Subtype_Indication_Access is
not null access Program.Nodes.Subtype_Indications.Subtype_Indication
with Storage_Pool => Program.Storage_Pools.Pool;
type Component_Definition_Access is
not null access Program.Nodes.Component_Definitions.Component_Definition
with Storage_Pool => Program.Storage_Pools.Pool;
type Discrete_Subtype_Indication_Access is
not null access Program.Nodes.Discrete_Subtype_Indications
.Discrete_Subtype_Indication
with Storage_Pool => Program.Storage_Pools.Pool;
type Discrete_Range_Attribute_Reference_Access is
not null access Program.Nodes.Discrete_Range_Attribute_References
.Discrete_Range_Attribute_Reference
with Storage_Pool => Program.Storage_Pools.Pool;
type Discrete_Simple_Expression_Range_Access is
not null access Program.Nodes.Discrete_Simple_Expression_Ranges
.Discrete_Simple_Expression_Range
with Storage_Pool => Program.Storage_Pools.Pool;
type Unknown_Discriminant_Part_Access is
not null access Program.Nodes.Unknown_Discriminant_Parts
.Unknown_Discriminant_Part
with Storage_Pool => Program.Storage_Pools.Pool;
type Known_Discriminant_Part_Access is
not null access Program.Nodes.Known_Discriminant_Parts
.Known_Discriminant_Part
with Storage_Pool => Program.Storage_Pools.Pool;
type Record_Definition_Access is
not null access Program.Nodes.Record_Definitions.Record_Definition
with Storage_Pool => Program.Storage_Pools.Pool;
type Null_Component_Access is
not null access Program.Nodes.Null_Components.Null_Component
with Storage_Pool => Program.Storage_Pools.Pool;
type Variant_Part_Access is
not null access Program.Nodes.Variant_Parts.Variant_Part
with Storage_Pool => Program.Storage_Pools.Pool;
type Variant_Access is not null access Program.Nodes.Variants.Variant
with Storage_Pool => Program.Storage_Pools.Pool;
type Others_Choice_Access is
not null access Program.Nodes.Others_Choices.Others_Choice
with Storage_Pool => Program.Storage_Pools.Pool;
type Anonymous_Access_To_Object_Access is
not null access Program.Nodes.Anonymous_Access_To_Objects
.Anonymous_Access_To_Object
with Storage_Pool => Program.Storage_Pools.Pool;
type Anonymous_Access_To_Procedure_Access is
not null access Program.Nodes.Anonymous_Access_To_Procedures
.Anonymous_Access_To_Procedure
with Storage_Pool => Program.Storage_Pools.Pool;
type Anonymous_Access_To_Function_Access is
not null access Program.Nodes.Anonymous_Access_To_Functions
.Anonymous_Access_To_Function
with Storage_Pool => Program.Storage_Pools.Pool;
type Private_Type_Definition_Access is
not null access Program.Nodes.Private_Type_Definitions
.Private_Type_Definition
with Storage_Pool => Program.Storage_Pools.Pool;
type Private_Extension_Definition_Access is
not null access Program.Nodes.Private_Extension_Definitions
.Private_Extension_Definition
with Storage_Pool => Program.Storage_Pools.Pool;
type Incomplete_Type_Definition_Access is
not null access Program.Nodes.Incomplete_Type_Definitions
.Incomplete_Type_Definition
with Storage_Pool => Program.Storage_Pools.Pool;
type Task_Definition_Access is
not null access Program.Nodes.Task_Definitions.Task_Definition
with Storage_Pool => Program.Storage_Pools.Pool;
type Protected_Definition_Access is
not null access Program.Nodes.Protected_Definitions.Protected_Definition
with Storage_Pool => Program.Storage_Pools.Pool;
type Aspect_Specification_Access is
not null access Program.Nodes.Aspect_Specifications.Aspect_Specification
with Storage_Pool => Program.Storage_Pools.Pool;
type Real_Range_Specification_Access is
not null access Program.Nodes.Real_Range_Specifications
.Real_Range_Specification
with Storage_Pool => Program.Storage_Pools.Pool;
type Numeric_Literal_Access is
not null access Program.Nodes.Numeric_Literals.Numeric_Literal
with Storage_Pool => Program.Storage_Pools.Pool;
type String_Literal_Access is
not null access Program.Nodes.String_Literals.String_Literal
with Storage_Pool => Program.Storage_Pools.Pool;
type Identifier_Access is
not null access Program.Nodes.Identifiers.Identifier
with Storage_Pool => Program.Storage_Pools.Pool;
type Operator_Symbol_Access is
not null access Program.Nodes.Operator_Symbols.Operator_Symbol
with Storage_Pool => Program.Storage_Pools.Pool;
type Character_Literal_Access is
not null access Program.Nodes.Character_Literals.Character_Literal
with Storage_Pool => Program.Storage_Pools.Pool;
type Explicit_Dereference_Access is
not null access Program.Nodes.Explicit_Dereferences.Explicit_Dereference
with Storage_Pool => Program.Storage_Pools.Pool;
type Infix_Operator_Access is
not null access Program.Nodes.Infix_Operators.Infix_Operator
with Storage_Pool => Program.Storage_Pools.Pool;
type Function_Call_Access is
not null access Program.Nodes.Function_Calls.Function_Call
with Storage_Pool => Program.Storage_Pools.Pool;
type Indexed_Component_Access is
not null access Program.Nodes.Indexed_Components.Indexed_Component
with Storage_Pool => Program.Storage_Pools.Pool;
type Slice_Access is not null access Program.Nodes.Slices.Slice
with Storage_Pool => Program.Storage_Pools.Pool;
type Selected_Component_Access is
not null access Program.Nodes.Selected_Components.Selected_Component
with Storage_Pool => Program.Storage_Pools.Pool;
type Attribute_Reference_Access is
not null access Program.Nodes.Attribute_References.Attribute_Reference
with Storage_Pool => Program.Storage_Pools.Pool;
type Record_Aggregate_Access is
not null access Program.Nodes.Record_Aggregates.Record_Aggregate
with Storage_Pool => Program.Storage_Pools.Pool;
type Extension_Aggregate_Access is
not null access Program.Nodes.Extension_Aggregates.Extension_Aggregate
with Storage_Pool => Program.Storage_Pools.Pool;
type Array_Aggregate_Access is
not null access Program.Nodes.Array_Aggregates.Array_Aggregate
with Storage_Pool => Program.Storage_Pools.Pool;
type Short_Circuit_Operation_Access is
not null access Program.Nodes.Short_Circuit_Operations
.Short_Circuit_Operation
with Storage_Pool => Program.Storage_Pools.Pool;
type Membership_Test_Access is
not null access Program.Nodes.Membership_Tests.Membership_Test
with Storage_Pool => Program.Storage_Pools.Pool;
type Null_Literal_Access is
not null access Program.Nodes.Null_Literals.Null_Literal
with Storage_Pool => Program.Storage_Pools.Pool;
type Parenthesized_Expression_Access is
not null access Program.Nodes.Parenthesized_Expressions
.Parenthesized_Expression
with Storage_Pool => Program.Storage_Pools.Pool;
type Raise_Expression_Access is
not null access Program.Nodes.Raise_Expressions.Raise_Expression
with Storage_Pool => Program.Storage_Pools.Pool;
type Type_Conversion_Access is
not null access Program.Nodes.Type_Conversions.Type_Conversion
with Storage_Pool => Program.Storage_Pools.Pool;
type Qualified_Expression_Access is
not null access Program.Nodes.Qualified_Expressions.Qualified_Expression
with Storage_Pool => Program.Storage_Pools.Pool;
type Allocator_Access is not null access Program.Nodes.Allocators.Allocator
with Storage_Pool => Program.Storage_Pools.Pool;
type Case_Expression_Access is
not null access Program.Nodes.Case_Expressions.Case_Expression
with Storage_Pool => Program.Storage_Pools.Pool;
type If_Expression_Access is
not null access Program.Nodes.If_Expressions.If_Expression
with Storage_Pool => Program.Storage_Pools.Pool;
type Quantified_Expression_Access is
not null access Program.Nodes.Quantified_Expressions.Quantified_Expression
with Storage_Pool => Program.Storage_Pools.Pool;
type Discriminant_Association_Access is
not null access Program.Nodes.Discriminant_Associations
.Discriminant_Association
with Storage_Pool => Program.Storage_Pools.Pool;
type Record_Component_Association_Access is
not null access Program.Nodes.Record_Component_Associations
.Record_Component_Association
with Storage_Pool => Program.Storage_Pools.Pool;
type Array_Component_Association_Access is
not null access Program.Nodes.Array_Component_Associations
.Array_Component_Association
with Storage_Pool => Program.Storage_Pools.Pool;
type Parameter_Association_Access is
not null access Program.Nodes.Parameter_Associations.Parameter_Association
with Storage_Pool => Program.Storage_Pools.Pool;
type Formal_Package_Association_Access is
not null access Program.Nodes.Formal_Package_Associations
.Formal_Package_Association
with Storage_Pool => Program.Storage_Pools.Pool;
type Null_Statement_Access is
not null access Program.Nodes.Null_Statements.Null_Statement
with Storage_Pool => Program.Storage_Pools.Pool;
type Assignment_Statement_Access is
not null access Program.Nodes.Assignment_Statements.Assignment_Statement
with Storage_Pool => Program.Storage_Pools.Pool;
type If_Statement_Access is
not null access Program.Nodes.If_Statements.If_Statement
with Storage_Pool => Program.Storage_Pools.Pool;
type Case_Statement_Access is
not null access Program.Nodes.Case_Statements.Case_Statement
with Storage_Pool => Program.Storage_Pools.Pool;
type Loop_Statement_Access is
not null access Program.Nodes.Loop_Statements.Loop_Statement
with Storage_Pool => Program.Storage_Pools.Pool;
type While_Loop_Statement_Access is
not null access Program.Nodes.While_Loop_Statements.While_Loop_Statement
with Storage_Pool => Program.Storage_Pools.Pool;
type For_Loop_Statement_Access is
not null access Program.Nodes.For_Loop_Statements.For_Loop_Statement
with Storage_Pool => Program.Storage_Pools.Pool;
type Block_Statement_Access is
not null access Program.Nodes.Block_Statements.Block_Statement
with Storage_Pool => Program.Storage_Pools.Pool;
type Exit_Statement_Access is
not null access Program.Nodes.Exit_Statements.Exit_Statement
with Storage_Pool => Program.Storage_Pools.Pool;
type Goto_Statement_Access is
not null access Program.Nodes.Goto_Statements.Goto_Statement
with Storage_Pool => Program.Storage_Pools.Pool;
type Call_Statement_Access is
not null access Program.Nodes.Call_Statements.Call_Statement
with Storage_Pool => Program.Storage_Pools.Pool;
type Simple_Return_Statement_Access is
not null access Program.Nodes.Simple_Return_Statements
.Simple_Return_Statement
with Storage_Pool => Program.Storage_Pools.Pool;
type Extended_Return_Statement_Access is
not null access Program.Nodes.Extended_Return_Statements
.Extended_Return_Statement
with Storage_Pool => Program.Storage_Pools.Pool;
type Accept_Statement_Access is
not null access Program.Nodes.Accept_Statements.Accept_Statement
with Storage_Pool => Program.Storage_Pools.Pool;
type Requeue_Statement_Access is
not null access Program.Nodes.Requeue_Statements.Requeue_Statement
with Storage_Pool => Program.Storage_Pools.Pool;
type Delay_Statement_Access is
not null access Program.Nodes.Delay_Statements.Delay_Statement
with Storage_Pool => Program.Storage_Pools.Pool;
type Terminate_Alternative_Statement_Access is
not null access Program.Nodes.Terminate_Alternative_Statements
.Terminate_Alternative_Statement
with Storage_Pool => Program.Storage_Pools.Pool;
type Select_Statement_Access is
not null access Program.Nodes.Select_Statements.Select_Statement
with Storage_Pool => Program.Storage_Pools.Pool;
type Abort_Statement_Access is
not null access Program.Nodes.Abort_Statements.Abort_Statement
with Storage_Pool => Program.Storage_Pools.Pool;
type Raise_Statement_Access is
not null access Program.Nodes.Raise_Statements.Raise_Statement
with Storage_Pool => Program.Storage_Pools.Pool;
type Code_Statement_Access is
not null access Program.Nodes.Code_Statements.Code_Statement
with Storage_Pool => Program.Storage_Pools.Pool;
type Elsif_Path_Access is
not null access Program.Nodes.Elsif_Paths.Elsif_Path
with Storage_Pool => Program.Storage_Pools.Pool;
type Case_Path_Access is not null access Program.Nodes.Case_Paths.Case_Path
with Storage_Pool => Program.Storage_Pools.Pool;
type Select_Path_Access is
not null access Program.Nodes.Select_Paths.Select_Path
with Storage_Pool => Program.Storage_Pools.Pool;
type Case_Expression_Path_Access is
not null access Program.Nodes.Case_Expression_Paths.Case_Expression_Path
with Storage_Pool => Program.Storage_Pools.Pool;
type Elsif_Expression_Path_Access is
not null access Program.Nodes.Elsif_Expression_Paths.Elsif_Expression_Path
with Storage_Pool => Program.Storage_Pools.Pool;
type Use_Clause_Access is
not null access Program.Nodes.Use_Clauses.Use_Clause
with Storage_Pool => Program.Storage_Pools.Pool;
type With_Clause_Access is
not null access Program.Nodes.With_Clauses.With_Clause
with Storage_Pool => Program.Storage_Pools.Pool;
type Component_Clause_Access is
not null access Program.Nodes.Component_Clauses.Component_Clause
with Storage_Pool => Program.Storage_Pools.Pool;
type Derived_Type_Access is
not null access Program.Nodes.Derived_Types.Derived_Type
with Storage_Pool => Program.Storage_Pools.Pool;
type Derived_Record_Extension_Access is
not null access Program.Nodes.Derived_Record_Extensions
.Derived_Record_Extension
with Storage_Pool => Program.Storage_Pools.Pool;
type Enumeration_Type_Access is
not null access Program.Nodes.Enumeration_Types.Enumeration_Type
with Storage_Pool => Program.Storage_Pools.Pool;
type Signed_Integer_Type_Access is
not null access Program.Nodes.Signed_Integer_Types.Signed_Integer_Type
with Storage_Pool => Program.Storage_Pools.Pool;
type Modular_Type_Access is
not null access Program.Nodes.Modular_Types.Modular_Type
with Storage_Pool => Program.Storage_Pools.Pool;
type Root_Type_Access is not null access Program.Nodes.Root_Types.Root_Type
with Storage_Pool => Program.Storage_Pools.Pool;
type Floating_Point_Type_Access is
not null access Program.Nodes.Floating_Point_Types.Floating_Point_Type
with Storage_Pool => Program.Storage_Pools.Pool;
type Ordinary_Fixed_Point_Type_Access is
not null access Program.Nodes.Ordinary_Fixed_Point_Types
.Ordinary_Fixed_Point_Type
with Storage_Pool => Program.Storage_Pools.Pool;
type Decimal_Fixed_Point_Type_Access is
not null access Program.Nodes.Decimal_Fixed_Point_Types
.Decimal_Fixed_Point_Type
with Storage_Pool => Program.Storage_Pools.Pool;
type Unconstrained_Array_Type_Access is
not null access Program.Nodes.Unconstrained_Array_Types
.Unconstrained_Array_Type
with Storage_Pool => Program.Storage_Pools.Pool;
type Constrained_Array_Type_Access is
not null access Program.Nodes.Constrained_Array_Types
.Constrained_Array_Type with Storage_Pool => Program.Storage_Pools.Pool;
type Record_Type_Access is
not null access Program.Nodes.Record_Types.Record_Type
with Storage_Pool => Program.Storage_Pools.Pool;
type Interface_Type_Access is
not null access Program.Nodes.Interface_Types.Interface_Type
with Storage_Pool => Program.Storage_Pools.Pool;
type Object_Access_Type_Access is
not null access Program.Nodes.Object_Access_Types.Object_Access_Type
with Storage_Pool => Program.Storage_Pools.Pool;
type Procedure_Access_Type_Access is
not null access Program.Nodes.Procedure_Access_Types.Procedure_Access_Type
with Storage_Pool => Program.Storage_Pools.Pool;
type Function_Access_Type_Access is
not null access Program.Nodes.Function_Access_Types.Function_Access_Type
with Storage_Pool => Program.Storage_Pools.Pool;
type Formal_Private_Type_Definition_Access is
not null access Program.Nodes.Formal_Private_Type_Definitions
.Formal_Private_Type_Definition
with Storage_Pool => Program.Storage_Pools.Pool;
type Formal_Derived_Type_Definition_Access is
not null access Program.Nodes.Formal_Derived_Type_Definitions
.Formal_Derived_Type_Definition
with Storage_Pool => Program.Storage_Pools.Pool;
type Formal_Discrete_Type_Definition_Access is
not null access Program.Nodes.Formal_Discrete_Type_Definitions
.Formal_Discrete_Type_Definition
with Storage_Pool => Program.Storage_Pools.Pool;
type Formal_Signed_Integer_Type_Definition_Access is
not null access Program.Nodes.Formal_Signed_Integer_Type_Definitions
.Formal_Signed_Integer_Type_Definition
with Storage_Pool => Program.Storage_Pools.Pool;
type Formal_Modular_Type_Definition_Access is
not null access Program.Nodes.Formal_Modular_Type_Definitions
.Formal_Modular_Type_Definition
with Storage_Pool => Program.Storage_Pools.Pool;
type Formal_Floating_Point_Definition_Access is
not null access Program.Nodes.Formal_Floating_Point_Definitions
.Formal_Floating_Point_Definition
with Storage_Pool => Program.Storage_Pools.Pool;
type Formal_Ordinary_Fixed_Point_Definition_Access is
not null access Program.Nodes.Formal_Ordinary_Fixed_Point_Definitions
.Formal_Ordinary_Fixed_Point_Definition
with Storage_Pool => Program.Storage_Pools.Pool;
type Formal_Decimal_Fixed_Point_Definition_Access is
not null access Program.Nodes.Formal_Decimal_Fixed_Point_Definitions
.Formal_Decimal_Fixed_Point_Definition
with Storage_Pool => Program.Storage_Pools.Pool;
type Formal_Unconstrained_Array_Type_Access is
not null access Program.Nodes.Formal_Unconstrained_Array_Types
.Formal_Unconstrained_Array_Type
with Storage_Pool => Program.Storage_Pools.Pool;
type Formal_Constrained_Array_Type_Access is
not null access Program.Nodes.Formal_Constrained_Array_Types
.Formal_Constrained_Array_Type
with Storage_Pool => Program.Storage_Pools.Pool;
type Formal_Object_Access_Type_Access is
not null access Program.Nodes.Formal_Object_Access_Types
.Formal_Object_Access_Type
with Storage_Pool => Program.Storage_Pools.Pool;
type Formal_Procedure_Access_Type_Access is
not null access Program.Nodes.Formal_Procedure_Access_Types
.Formal_Procedure_Access_Type
with Storage_Pool => Program.Storage_Pools.Pool;
type Formal_Function_Access_Type_Access is
not null access Program.Nodes.Formal_Function_Access_Types
.Formal_Function_Access_Type
with Storage_Pool => Program.Storage_Pools.Pool;
type Formal_Interface_Type_Access is
not null access Program.Nodes.Formal_Interface_Types.Formal_Interface_Type
with Storage_Pool => Program.Storage_Pools.Pool;
type Range_Attribute_Reference_Access is
not null access Program.Nodes.Range_Attribute_References
.Range_Attribute_Reference
with Storage_Pool => Program.Storage_Pools.Pool;
type Simple_Expression_Range_Access is
not null access Program.Nodes.Simple_Expression_Ranges
.Simple_Expression_Range
with Storage_Pool => Program.Storage_Pools.Pool;
type Digits_Constraint_Access is
not null access Program.Nodes.Digits_Constraints.Digits_Constraint
with Storage_Pool => Program.Storage_Pools.Pool;
type Delta_Constraint_Access is
not null access Program.Nodes.Delta_Constraints.Delta_Constraint
with Storage_Pool => Program.Storage_Pools.Pool;
type Index_Constraint_Access is
not null access Program.Nodes.Index_Constraints.Index_Constraint
with Storage_Pool => Program.Storage_Pools.Pool;
type Discriminant_Constraint_Access is
not null access Program.Nodes.Discriminant_Constraints
.Discriminant_Constraint
with Storage_Pool => Program.Storage_Pools.Pool;
type Attribute_Definition_Clause_Access is
not null access Program.Nodes.Attribute_Definition_Clauses
.Attribute_Definition_Clause
with Storage_Pool => Program.Storage_Pools.Pool;
type Enumeration_Representation_Clause_Access is
not null access Program.Nodes.Enumeration_Representation_Clauses
.Enumeration_Representation_Clause
with Storage_Pool => Program.Storage_Pools.Pool;
type Record_Representation_Clause_Access is
not null access Program.Nodes.Record_Representation_Clauses
.Record_Representation_Clause
with Storage_Pool => Program.Storage_Pools.Pool;
type At_Clause_Access is not null access Program.Nodes.At_Clauses.At_Clause
with Storage_Pool => Program.Storage_Pools.Pool;
type Exception_Handler_Access is
not null access Program.Nodes.Exception_Handlers.Exception_Handler
with Storage_Pool => Program.Storage_Pools.Pool;
not overriding function Create_Pragma
(Self : Element_Factory;
Pragma_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Identifiers
.Identifier_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Arguments : Program.Elements.Parameter_Associations
.Parameter_Association_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Pragmas.Pragma_Access is
Result : constant Pragma_Access :=
new (Self.Subpool) Program.Nodes.Pragmas.Pragma_Element'
(Program.Nodes.Pragmas.Create
(Pragma_Token => Pragma_Token, Name => Name,
Left_Bracket_Token => Left_Bracket_Token,
Arguments => Arguments,
Right_Bracket_Token => Right_Bracket_Token,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Pragmas.Pragma_Access (Result);
end Create_Pragma;
not overriding function Create_Defining_Identifier
(Self : Element_Factory;
Identifier_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access is
Result : constant Defining_Identifier_Access :=
new (Self.Subpool) Program.Nodes.Defining_Identifiers
.Defining_Identifier'
(Program.Nodes.Defining_Identifiers.Create
(Identifier_Token => Identifier_Token));
begin
return Program.Elements.Defining_Identifiers.Defining_Identifier_Access
(Result);
end Create_Defining_Identifier;
not overriding function Create_Defining_Character_Literal
(Self : Element_Factory;
Character_Literal_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Defining_Character_Literals
.Defining_Character_Literal_Access is
Result : constant Defining_Character_Literal_Access :=
new (Self.Subpool) Program.Nodes.Defining_Character_Literals
.Defining_Character_Literal'
(Program.Nodes.Defining_Character_Literals.Create
(Character_Literal_Token => Character_Literal_Token));
begin
return Program.Elements.Defining_Character_Literals
.Defining_Character_Literal_Access
(Result);
end Create_Defining_Character_Literal;
not overriding function Create_Defining_Operator_Symbol
(Self : Element_Factory;
Operator_Symbol_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Defining_Operator_Symbols
.Defining_Operator_Symbol_Access is
Result : constant Defining_Operator_Symbol_Access :=
new (Self.Subpool) Program.Nodes.Defining_Operator_Symbols
.Defining_Operator_Symbol'
(Program.Nodes.Defining_Operator_Symbols.Create
(Operator_Symbol_Token => Operator_Symbol_Token));
begin
return Program.Elements.Defining_Operator_Symbols
.Defining_Operator_Symbol_Access
(Result);
end Create_Defining_Operator_Symbol;
not overriding function Create_Defining_Expanded_Name
(Self : Element_Factory;
Prefix : not null Program.Elements.Expressions.Expression_Access;
Dot_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Selector : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access)
return not null Program.Elements.Defining_Expanded_Names
.Defining_Expanded_Name_Access is
Result : constant Defining_Expanded_Name_Access :=
new (Self.Subpool) Program.Nodes.Defining_Expanded_Names
.Defining_Expanded_Name'
(Program.Nodes.Defining_Expanded_Names.Create
(Prefix => Prefix, Dot_Token => Dot_Token,
Selector => Selector));
begin
return Program.Elements.Defining_Expanded_Names
.Defining_Expanded_Name_Access
(Result);
end Create_Defining_Expanded_Name;
not overriding function Create_Type_Declaration
(Self : Element_Factory;
Type_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Discriminant_Part : Program.Elements.Definitions.Definition_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Definition : not null Program.Elements.Definitions
.Definition_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Type_Declarations
.Type_Declaration_Access is
Result : constant Type_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Type_Declarations.Type_Declaration'
(Program.Nodes.Type_Declarations.Create
(Type_Token => Type_Token, Name => Name,
Discriminant_Part => Discriminant_Part, Is_Token => Is_Token,
Definition => Definition, With_Token => With_Token,
Aspects => Aspects, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Type_Declarations.Type_Declaration_Access
(Result);
end Create_Type_Declaration;
not overriding function Create_Task_Type_Declaration
(Self : Element_Factory;
Task_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Type_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Discriminant_Part : Program.Elements.Known_Discriminant_Parts
.Known_Discriminant_Part_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
New_Token : Program.Lexical_Elements.Lexical_Element_Access;
Progenitors : Program.Elements.Expressions.Expression_Vector_Access;
With_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
Definition : not null Program.Elements.Task_Definitions
.Task_Definition_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Task_Type_Declarations
.Task_Type_Declaration_Access is
Result : constant Task_Type_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Task_Type_Declarations
.Task_Type_Declaration'
(Program.Nodes.Task_Type_Declarations.Create
(Task_Token => Task_Token, Type_Token => Type_Token,
Name => Name, Discriminant_Part => Discriminant_Part,
With_Token => With_Token, Aspects => Aspects,
Is_Token => Is_Token, New_Token => New_Token,
Progenitors => Progenitors, With_Token_2 => With_Token_2,
Definition => Definition, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Task_Type_Declarations
.Task_Type_Declaration_Access
(Result);
end Create_Task_Type_Declaration;
not overriding function Create_Protected_Type_Declaration
(Self : Element_Factory;
Protected_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Type_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Discriminant_Part : Program.Elements.Known_Discriminant_Parts
.Known_Discriminant_Part_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
New_Token : Program.Lexical_Elements.Lexical_Element_Access;
Progenitors : Program.Elements.Expressions.Expression_Vector_Access;
With_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
Definition : not null Program.Elements.Protected_Definitions
.Protected_Definition_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Protected_Type_Declarations
.Protected_Type_Declaration_Access is
Result : constant Protected_Type_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Protected_Type_Declarations
.Protected_Type_Declaration'
(Program.Nodes.Protected_Type_Declarations.Create
(Protected_Token => Protected_Token, Type_Token => Type_Token,
Name => Name, Discriminant_Part => Discriminant_Part,
With_Token => With_Token, Aspects => Aspects,
Is_Token => Is_Token, New_Token => New_Token,
Progenitors => Progenitors, With_Token_2 => With_Token_2,
Definition => Definition, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Protected_Type_Declarations
.Protected_Type_Declaration_Access
(Result);
end Create_Protected_Type_Declaration;
not overriding function Create_Subtype_Declaration
(Self : Element_Factory;
Subtype_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Subtype_Indication : not null Program.Elements.Subtype_Indications
.Subtype_Indication_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Subtype_Declarations
.Subtype_Declaration_Access is
Result : constant Subtype_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Subtype_Declarations
.Subtype_Declaration'
(Program.Nodes.Subtype_Declarations.Create
(Subtype_Token => Subtype_Token, Name => Name,
Is_Token => Is_Token, Subtype_Indication => Subtype_Indication,
With_Token => With_Token, Aspects => Aspects,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Subtype_Declarations.Subtype_Declaration_Access
(Result);
end Create_Subtype_Declaration;
not overriding function Create_Object_Declaration
(Self : Element_Factory;
Names : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Vector_Access;
Colon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Aliased_Token : Program.Lexical_Elements
.Lexical_Element_Access;
Constant_Token : Program.Lexical_Elements
.Lexical_Element_Access;
Object_Subtype : not null Program.Elements.Definitions
.Definition_Access;
Assignment_Token : Program.Lexical_Elements
.Lexical_Element_Access;
Initialization_Expression : Program.Elements.Expressions
.Expression_Access;
With_Token : Program.Lexical_Elements
.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Object_Declarations
.Object_Declaration_Access is
Result : constant Object_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Object_Declarations
.Object_Declaration'
(Program.Nodes.Object_Declarations.Create
(Names => Names, Colon_Token => Colon_Token,
Aliased_Token => Aliased_Token,
Constant_Token => Constant_Token,
Object_Subtype => Object_Subtype,
Assignment_Token => Assignment_Token,
Initialization_Expression => Initialization_Expression,
With_Token => With_Token, Aspects => Aspects,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Object_Declarations.Object_Declaration_Access
(Result);
end Create_Object_Declaration;
not overriding function Create_Single_Task_Declaration
(Self : Element_Factory;
Task_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
New_Token : Program.Lexical_Elements.Lexical_Element_Access;
Progenitors : Program.Elements.Expressions.Expression_Vector_Access;
With_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
Definition : not null Program.Elements.Task_Definitions
.Task_Definition_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Single_Task_Declarations
.Single_Task_Declaration_Access is
Result : constant Single_Task_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Single_Task_Declarations
.Single_Task_Declaration'
(Program.Nodes.Single_Task_Declarations.Create
(Task_Token => Task_Token, Name => Name,
With_Token => With_Token, Aspects => Aspects,
Is_Token => Is_Token, New_Token => New_Token,
Progenitors => Progenitors, With_Token_2 => With_Token_2,
Definition => Definition, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Single_Task_Declarations
.Single_Task_Declaration_Access
(Result);
end Create_Single_Task_Declaration;
not overriding function Create_Single_Protected_Declaration
(Self : Element_Factory;
Protected_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
New_Token : Program.Lexical_Elements.Lexical_Element_Access;
Progenitors : Program.Elements.Expressions.Expression_Vector_Access;
With_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
Definition : not null Program.Elements.Protected_Definitions
.Protected_Definition_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Single_Protected_Declarations
.Single_Protected_Declaration_Access is
Result : constant Single_Protected_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Single_Protected_Declarations
.Single_Protected_Declaration'
(Program.Nodes.Single_Protected_Declarations.Create
(Protected_Token => Protected_Token, Name => Name,
With_Token => With_Token, Aspects => Aspects,
Is_Token => Is_Token, New_Token => New_Token,
Progenitors => Progenitors, With_Token_2 => With_Token_2,
Definition => Definition, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Single_Protected_Declarations
.Single_Protected_Declaration_Access
(Result);
end Create_Single_Protected_Declaration;
not overriding function Create_Number_Declaration
(Self : Element_Factory;
Names : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Vector_Access;
Colon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Constant_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Assignment_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Expression : not null Program.Elements.Expressions
.Expression_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Number_Declarations
.Number_Declaration_Access is
Result : constant Number_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Number_Declarations
.Number_Declaration'
(Program.Nodes.Number_Declarations.Create
(Names => Names, Colon_Token => Colon_Token,
Constant_Token => Constant_Token,
Assignment_Token => Assignment_Token, Expression => Expression,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Number_Declarations.Number_Declaration_Access
(Result);
end Create_Number_Declaration;
not overriding function Create_Enumeration_Literal_Specification
(Self : Element_Factory;
Name : not null Program.Elements.Defining_Names.Defining_Name_Access)
return not null Program.Elements.Enumeration_Literal_Specifications
.Enumeration_Literal_Specification_Access is
Result : constant Enumeration_Literal_Specification_Access :=
new (Self.Subpool) Program.Nodes.Enumeration_Literal_Specifications
.Enumeration_Literal_Specification'
(Program.Nodes.Enumeration_Literal_Specifications.Create
(Name => Name));
begin
return Program.Elements.Enumeration_Literal_Specifications
.Enumeration_Literal_Specification_Access
(Result);
end Create_Enumeration_Literal_Specification;
not overriding function Create_Discriminant_Specification
(Self : Element_Factory;
Names : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Vector_Access;
Colon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Object_Subtype : not null Program.Elements.Element_Access;
Assignment_Token : Program.Lexical_Elements.Lexical_Element_Access;
Default_Expression : Program.Elements.Expressions.Expression_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Discriminant_Specifications
.Discriminant_Specification_Access is
Result : constant Discriminant_Specification_Access :=
new (Self.Subpool) Program.Nodes.Discriminant_Specifications
.Discriminant_Specification'
(Program.Nodes.Discriminant_Specifications.Create
(Names => Names, Colon_Token => Colon_Token,
Not_Token => Not_Token, Null_Token => Null_Token,
Object_Subtype => Object_Subtype,
Assignment_Token => Assignment_Token,
Default_Expression => Default_Expression,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Discriminant_Specifications
.Discriminant_Specification_Access
(Result);
end Create_Discriminant_Specification;
not overriding function Create_Component_Declaration
(Self : Element_Factory;
Names : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Vector_Access;
Colon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Object_Subtype : not null Program.Elements.Component_Definitions
.Component_Definition_Access;
Assignment_Token : Program.Lexical_Elements.Lexical_Element_Access;
Default_Expression : Program.Elements.Expressions.Expression_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Component_Declarations
.Component_Declaration_Access is
Result : constant Component_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Component_Declarations
.Component_Declaration'
(Program.Nodes.Component_Declarations.Create
(Names => Names, Colon_Token => Colon_Token,
Object_Subtype => Object_Subtype,
Assignment_Token => Assignment_Token,
Default_Expression => Default_Expression,
With_Token => With_Token, Aspects => Aspects,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Component_Declarations
.Component_Declaration_Access
(Result);
end Create_Component_Declaration;
not overriding function Create_Loop_Parameter_Specification
(Self : Element_Factory;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
In_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Reverse_Token : Program.Lexical_Elements.Lexical_Element_Access;
Definition : not null Program.Elements.Discrete_Ranges
.Discrete_Range_Access)
return not null Program.Elements.Loop_Parameter_Specifications
.Loop_Parameter_Specification_Access is
Result : constant Loop_Parameter_Specification_Access :=
new (Self.Subpool) Program.Nodes.Loop_Parameter_Specifications
.Loop_Parameter_Specification'
(Program.Nodes.Loop_Parameter_Specifications.Create
(Name => Name, In_Token => In_Token,
Reverse_Token => Reverse_Token, Definition => Definition));
begin
return Program.Elements.Loop_Parameter_Specifications
.Loop_Parameter_Specification_Access
(Result);
end Create_Loop_Parameter_Specification;
not overriding function Create_Generalized_Iterator_Specification
(Self : Element_Factory;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
In_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Reverse_Token : Program.Lexical_Elements.Lexical_Element_Access;
Iterator_Name : not null Program.Elements.Expressions.Expression_Access)
return not null Program.Elements.Generalized_Iterator_Specifications
.Generalized_Iterator_Specification_Access is
Result : constant Generalized_Iterator_Specification_Access :=
new (Self.Subpool) Program.Nodes.Generalized_Iterator_Specifications
.Generalized_Iterator_Specification'
(Program.Nodes.Generalized_Iterator_Specifications.Create
(Name => Name, In_Token => In_Token,
Reverse_Token => Reverse_Token,
Iterator_Name => Iterator_Name));
begin
return Program.Elements.Generalized_Iterator_Specifications
.Generalized_Iterator_Specification_Access
(Result);
end Create_Generalized_Iterator_Specification;
not overriding function Create_Element_Iterator_Specification
(Self : Element_Factory;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Colon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Subtype_Indication : not null Program.Elements.Subtype_Indications
.Subtype_Indication_Access;
Of_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Reverse_Token : Program.Lexical_Elements.Lexical_Element_Access;
Iterable_Name : not null Program.Elements.Expressions
.Expression_Access)
return not null Program.Elements.Element_Iterator_Specifications
.Element_Iterator_Specification_Access is
Result : constant Element_Iterator_Specification_Access :=
new (Self.Subpool) Program.Nodes.Element_Iterator_Specifications
.Element_Iterator_Specification'
(Program.Nodes.Element_Iterator_Specifications.Create
(Name => Name, Colon_Token => Colon_Token,
Subtype_Indication => Subtype_Indication, Of_Token => Of_Token,
Reverse_Token => Reverse_Token,
Iterable_Name => Iterable_Name));
begin
return Program.Elements.Element_Iterator_Specifications
.Element_Iterator_Specification_Access
(Result);
end Create_Element_Iterator_Specification;
not overriding function Create_Procedure_Declaration
(Self : Element_Factory;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access;
Procedure_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Is_Token : Program.Lexical_Elements.Lexical_Element_Access;
Abstract_Token : Program.Lexical_Elements.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Procedure_Declarations
.Procedure_Declaration_Access is
Result : constant Procedure_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Procedure_Declarations
.Procedure_Declaration'
(Program.Nodes.Procedure_Declarations.Create
(Not_Token => Not_Token, Overriding_Token => Overriding_Token,
Procedure_Token => Procedure_Token, Name => Name,
Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token,
Is_Token => Is_Token, Abstract_Token => Abstract_Token,
With_Token => With_Token, Aspects => Aspects,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Procedure_Declarations
.Procedure_Declaration_Access
(Result);
end Create_Procedure_Declaration;
not overriding function Create_Function_Declaration
(Self : Element_Factory;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access;
Function_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Return_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Not_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Result_Subtype : not null Program.Elements.Element_Access;
Is_Token : Program.Lexical_Elements.Lexical_Element_Access;
Result_Expression : Program.Elements.Parenthesized_Expressions
.Parenthesized_Expression_Access;
Abstract_Token : Program.Lexical_Elements.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Function_Declarations
.Function_Declaration_Access is
Result : constant Function_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Function_Declarations
.Function_Declaration'
(Program.Nodes.Function_Declarations.Create
(Not_Token => Not_Token, Overriding_Token => Overriding_Token,
Function_Token => Function_Token, Name => Name,
Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token,
Return_Token => Return_Token, Not_Token_2 => Not_Token_2,
Null_Token => Null_Token, Result_Subtype => Result_Subtype,
Is_Token => Is_Token, Result_Expression => Result_Expression,
Abstract_Token => Abstract_Token, With_Token => With_Token,
Aspects => Aspects, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Function_Declarations.Function_Declaration_Access
(Result);
end Create_Function_Declaration;
not overriding function Create_Parameter_Specification
(Self : Element_Factory;
Names : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Vector_Access;
Colon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Aliased_Token : Program.Lexical_Elements.Lexical_Element_Access;
In_Token : Program.Lexical_Elements.Lexical_Element_Access;
Out_Token : Program.Lexical_Elements.Lexical_Element_Access;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameter_Subtype : not null Program.Elements.Element_Access;
Assignment_Token : Program.Lexical_Elements.Lexical_Element_Access;
Default_Expression : Program.Elements.Expressions.Expression_Access)
return not null Program.Elements.Parameter_Specifications
.Parameter_Specification_Access is
Result : constant Parameter_Specification_Access :=
new (Self.Subpool) Program.Nodes.Parameter_Specifications
.Parameter_Specification'
(Program.Nodes.Parameter_Specifications.Create
(Names => Names, Colon_Token => Colon_Token,
Aliased_Token => Aliased_Token, In_Token => In_Token,
Out_Token => Out_Token, Not_Token => Not_Token,
Null_Token => Null_Token,
Parameter_Subtype => Parameter_Subtype,
Assignment_Token => Assignment_Token,
Default_Expression => Default_Expression));
begin
return Program.Elements.Parameter_Specifications
.Parameter_Specification_Access
(Result);
end Create_Parameter_Specification;
not overriding function Create_Procedure_Body_Declaration
(Self : Element_Factory;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access;
Procedure_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Declarations : Program.Element_Vectors.Element_Vector_Access;
Begin_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Statements : not null Program.Element_Vectors
.Element_Vector_Access;
Exception_Token : Program.Lexical_Elements.Lexical_Element_Access;
Exception_Handlers : Program.Elements.Exception_Handlers
.Exception_Handler_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Name : Program.Elements.Expressions.Expression_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Procedure_Body_Declarations
.Procedure_Body_Declaration_Access is
Result : constant Procedure_Body_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Procedure_Body_Declarations
.Procedure_Body_Declaration'
(Program.Nodes.Procedure_Body_Declarations.Create
(Not_Token => Not_Token, Overriding_Token => Overriding_Token,
Procedure_Token => Procedure_Token, Name => Name,
Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token,
With_Token => With_Token, Aspects => Aspects,
Is_Token => Is_Token, Declarations => Declarations,
Begin_Token => Begin_Token, Statements => Statements,
Exception_Token => Exception_Token,
Exception_Handlers => Exception_Handlers,
End_Token => End_Token, End_Name => End_Name,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Procedure_Body_Declarations
.Procedure_Body_Declaration_Access
(Result);
end Create_Procedure_Body_Declaration;
not overriding function Create_Function_Body_Declaration
(Self : Element_Factory;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access;
Function_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Return_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Not_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Result_Subtype : not null Program.Elements.Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Declarations : Program.Element_Vectors.Element_Vector_Access;
Begin_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Statements : not null Program.Element_Vectors
.Element_Vector_Access;
Exception_Token : Program.Lexical_Elements.Lexical_Element_Access;
Exception_Handlers : Program.Elements.Exception_Handlers
.Exception_Handler_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Name : Program.Elements.Expressions.Expression_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Function_Body_Declarations
.Function_Body_Declaration_Access is
Result : constant Function_Body_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Function_Body_Declarations
.Function_Body_Declaration'
(Program.Nodes.Function_Body_Declarations.Create
(Not_Token => Not_Token, Overriding_Token => Overriding_Token,
Function_Token => Function_Token, Name => Name,
Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token,
Return_Token => Return_Token, Not_Token_2 => Not_Token_2,
Null_Token => Null_Token, Result_Subtype => Result_Subtype,
With_Token => With_Token, Aspects => Aspects,
Is_Token => Is_Token, Declarations => Declarations,
Begin_Token => Begin_Token, Statements => Statements,
Exception_Token => Exception_Token,
Exception_Handlers => Exception_Handlers,
End_Token => End_Token, End_Name => End_Name,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Function_Body_Declarations
.Function_Body_Declaration_Access
(Result);
end Create_Function_Body_Declaration;
not overriding function Create_Return_Object_Specification
(Self : Element_Factory;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Colon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Aliased_Token : Program.Lexical_Elements.Lexical_Element_Access;
Constant_Token : Program.Lexical_Elements.Lexical_Element_Access;
Object_Subtype : not null Program.Elements.Element_Access;
Assignment_Token : Program.Lexical_Elements.Lexical_Element_Access;
Expression : Program.Elements.Expressions.Expression_Access)
return not null Program.Elements.Return_Object_Specifications
.Return_Object_Specification_Access is
Result : constant Return_Object_Specification_Access :=
new (Self.Subpool) Program.Nodes.Return_Object_Specifications
.Return_Object_Specification'
(Program.Nodes.Return_Object_Specifications.Create
(Name => Name, Colon_Token => Colon_Token,
Aliased_Token => Aliased_Token,
Constant_Token => Constant_Token,
Object_Subtype => Object_Subtype,
Assignment_Token => Assignment_Token,
Expression => Expression));
begin
return Program.Elements.Return_Object_Specifications
.Return_Object_Specification_Access
(Result);
end Create_Return_Object_Specification;
not overriding function Create_Package_Declaration
(Self : Element_Factory;
Package_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Visible_Declarations : Program.Element_Vectors.Element_Vector_Access;
Private_Token : Program.Lexical_Elements.Lexical_Element_Access;
Private_Declarations : Program.Element_Vectors.Element_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Name : Program.Elements.Expressions.Expression_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Package_Declarations
.Package_Declaration_Access is
Result : constant Package_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Package_Declarations
.Package_Declaration'
(Program.Nodes.Package_Declarations.Create
(Package_Token => Package_Token, Name => Name,
With_Token => With_Token, Aspects => Aspects,
Is_Token => Is_Token,
Visible_Declarations => Visible_Declarations,
Private_Token => Private_Token,
Private_Declarations => Private_Declarations,
End_Token => End_Token, End_Name => End_Name,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Package_Declarations.Package_Declaration_Access
(Result);
end Create_Package_Declaration;
not overriding function Create_Package_Body_Declaration
(Self : Element_Factory;
Package_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Body_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Declarations : Program.Element_Vectors.Element_Vector_Access;
Begin_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Statements : not null Program.Element_Vectors
.Element_Vector_Access;
Exception_Token : Program.Lexical_Elements.Lexical_Element_Access;
Exception_Handlers : Program.Elements.Exception_Handlers
.Exception_Handler_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Name : Program.Elements.Expressions.Expression_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Package_Body_Declarations
.Package_Body_Declaration_Access is
Result : constant Package_Body_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Package_Body_Declarations
.Package_Body_Declaration'
(Program.Nodes.Package_Body_Declarations.Create
(Package_Token => Package_Token, Body_Token => Body_Token,
Name => Name, With_Token => With_Token, Aspects => Aspects,
Is_Token => Is_Token, Declarations => Declarations,
Begin_Token => Begin_Token, Statements => Statements,
Exception_Token => Exception_Token,
Exception_Handlers => Exception_Handlers,
End_Token => End_Token, End_Name => End_Name,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Package_Body_Declarations
.Package_Body_Declaration_Access
(Result);
end Create_Package_Body_Declaration;
not overriding function Create_Object_Renaming_Declaration
(Self : Element_Factory;
Names : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Vector_Access;
Colon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Object_Subtype : not null Program.Elements.Element_Access;
Renames_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Renamed_Object : not null Program.Elements.Expressions.Expression_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Object_Renaming_Declarations
.Object_Renaming_Declaration_Access is
Result : constant Object_Renaming_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Object_Renaming_Declarations
.Object_Renaming_Declaration'
(Program.Nodes.Object_Renaming_Declarations.Create
(Names => Names, Colon_Token => Colon_Token,
Not_Token => Not_Token, Null_Token => Null_Token,
Object_Subtype => Object_Subtype,
Renames_Token => Renames_Token,
Renamed_Object => Renamed_Object, With_Token => With_Token,
Aspects => Aspects, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Object_Renaming_Declarations
.Object_Renaming_Declaration_Access
(Result);
end Create_Object_Renaming_Declaration;
not overriding function Create_Exception_Renaming_Declaration
(Self : Element_Factory;
Names : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Vector_Access;
Colon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Exception_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Renames_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Renamed_Exception : not null Program.Elements.Expressions
.Expression_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Exception_Renaming_Declarations
.Exception_Renaming_Declaration_Access is
Result : constant Exception_Renaming_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Exception_Renaming_Declarations
.Exception_Renaming_Declaration'
(Program.Nodes.Exception_Renaming_Declarations.Create
(Names => Names, Colon_Token => Colon_Token,
Exception_Token => Exception_Token,
Renames_Token => Renames_Token,
Renamed_Exception => Renamed_Exception,
With_Token => With_Token, Aspects => Aspects,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Exception_Renaming_Declarations
.Exception_Renaming_Declaration_Access
(Result);
end Create_Exception_Renaming_Declaration;
not overriding function Create_Procedure_Renaming_Declaration
(Self : Element_Factory;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access;
Procedure_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Renames_Token : Program.Lexical_Elements.Lexical_Element_Access;
Renamed_Procedure : Program.Elements.Expressions.Expression_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Procedure_Renaming_Declarations
.Procedure_Renaming_Declaration_Access is
Result : constant Procedure_Renaming_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Procedure_Renaming_Declarations
.Procedure_Renaming_Declaration'
(Program.Nodes.Procedure_Renaming_Declarations.Create
(Not_Token => Not_Token, Overriding_Token => Overriding_Token,
Procedure_Token => Procedure_Token, Name => Name,
Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token,
Renames_Token => Renames_Token,
Renamed_Procedure => Renamed_Procedure,
With_Token => With_Token, Aspects => Aspects,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Procedure_Renaming_Declarations
.Procedure_Renaming_Declaration_Access
(Result);
end Create_Procedure_Renaming_Declaration;
not overriding function Create_Function_Renaming_Declaration
(Self : Element_Factory;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access;
Function_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Return_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Not_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Result_Subtype : not null Program.Elements.Element_Access;
Renames_Token : Program.Lexical_Elements.Lexical_Element_Access;
Renamed_Function : Program.Elements.Expressions.Expression_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Function_Renaming_Declarations
.Function_Renaming_Declaration_Access is
Result : constant Function_Renaming_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Function_Renaming_Declarations
.Function_Renaming_Declaration'
(Program.Nodes.Function_Renaming_Declarations.Create
(Not_Token => Not_Token, Overriding_Token => Overriding_Token,
Function_Token => Function_Token, Name => Name,
Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token,
Return_Token => Return_Token, Not_Token_2 => Not_Token_2,
Null_Token => Null_Token, Result_Subtype => Result_Subtype,
Renames_Token => Renames_Token,
Renamed_Function => Renamed_Function, With_Token => With_Token,
Aspects => Aspects, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Function_Renaming_Declarations
.Function_Renaming_Declaration_Access
(Result);
end Create_Function_Renaming_Declaration;
not overriding function Create_Package_Renaming_Declaration
(Self : Element_Factory;
Package_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Renames_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Renamed_Package : not null Program.Elements.Expressions.Expression_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Package_Renaming_Declarations
.Package_Renaming_Declaration_Access is
Result : constant Package_Renaming_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Package_Renaming_Declarations
.Package_Renaming_Declaration'
(Program.Nodes.Package_Renaming_Declarations.Create
(Package_Token => Package_Token, Name => Name,
Renames_Token => Renames_Token,
Renamed_Package => Renamed_Package, With_Token => With_Token,
Aspects => Aspects, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Package_Renaming_Declarations
.Package_Renaming_Declaration_Access
(Result);
end Create_Package_Renaming_Declaration;
not overriding function Create_Generic_Package_Renaming_Declaration
(Self : Element_Factory;
Generic_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Package_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Renames_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Renamed_Package : not null Program.Elements.Expressions.Expression_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Generic_Package_Renaming_Declarations
.Generic_Package_Renaming_Declaration_Access is
Result : constant Generic_Package_Renaming_Declaration_Access :=
new (Self.Subpool) Program.Nodes
.Generic_Package_Renaming_Declarations
.Generic_Package_Renaming_Declaration'
(Program.Nodes.Generic_Package_Renaming_Declarations.Create
(Generic_Token => Generic_Token, Package_Token => Package_Token,
Name => Name, Renames_Token => Renames_Token,
Renamed_Package => Renamed_Package, With_Token => With_Token,
Aspects => Aspects, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Generic_Package_Renaming_Declarations
.Generic_Package_Renaming_Declaration_Access
(Result);
end Create_Generic_Package_Renaming_Declaration;
not overriding function Create_Generic_Procedure_Renaming_Declaration
(Self : Element_Factory;
Generic_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Procedure_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Renames_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Renamed_Procedure : not null Program.Elements.Expressions
.Expression_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Generic_Procedure_Renaming_Declarations
.Generic_Procedure_Renaming_Declaration_Access is
Result : constant Generic_Procedure_Renaming_Declaration_Access :=
new (Self.Subpool) Program.Nodes
.Generic_Procedure_Renaming_Declarations
.Generic_Procedure_Renaming_Declaration'
(Program.Nodes.Generic_Procedure_Renaming_Declarations.Create
(Generic_Token => Generic_Token,
Procedure_Token => Procedure_Token, Name => Name,
Renames_Token => Renames_Token,
Renamed_Procedure => Renamed_Procedure,
With_Token => With_Token, Aspects => Aspects,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Generic_Procedure_Renaming_Declarations
.Generic_Procedure_Renaming_Declaration_Access
(Result);
end Create_Generic_Procedure_Renaming_Declaration;
not overriding function Create_Generic_Function_Renaming_Declaration
(Self : Element_Factory;
Generic_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Function_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Renames_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Renamed_Function : not null Program.Elements.Expressions
.Expression_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Generic_Function_Renaming_Declarations
.Generic_Function_Renaming_Declaration_Access is
Result : constant Generic_Function_Renaming_Declaration_Access :=
new (Self.Subpool) Program.Nodes
.Generic_Function_Renaming_Declarations
.Generic_Function_Renaming_Declaration'
(Program.Nodes.Generic_Function_Renaming_Declarations.Create
(Generic_Token => Generic_Token,
Function_Token => Function_Token, Name => Name,
Renames_Token => Renames_Token,
Renamed_Function => Renamed_Function, With_Token => With_Token,
Aspects => Aspects, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Generic_Function_Renaming_Declarations
.Generic_Function_Renaming_Declaration_Access
(Result);
end Create_Generic_Function_Renaming_Declaration;
not overriding function Create_Task_Body_Declaration
(Self : Element_Factory;
Task_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Body_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Declarations : Program.Element_Vectors.Element_Vector_Access;
Begin_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Statements : not null Program.Element_Vectors
.Element_Vector_Access;
Exception_Token : Program.Lexical_Elements.Lexical_Element_Access;
Exception_Handlers : Program.Elements.Exception_Handlers
.Exception_Handler_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Name : Program.Elements.Identifiers.Identifier_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Task_Body_Declarations
.Task_Body_Declaration_Access is
Result : constant Task_Body_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Task_Body_Declarations
.Task_Body_Declaration'
(Program.Nodes.Task_Body_Declarations.Create
(Task_Token => Task_Token, Body_Token => Body_Token,
Name => Name, With_Token => With_Token, Aspects => Aspects,
Is_Token => Is_Token, Declarations => Declarations,
Begin_Token => Begin_Token, Statements => Statements,
Exception_Token => Exception_Token,
Exception_Handlers => Exception_Handlers,
End_Token => End_Token, End_Name => End_Name,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Task_Body_Declarations
.Task_Body_Declaration_Access
(Result);
end Create_Task_Body_Declaration;
not overriding function Create_Protected_Body_Declaration
(Self : Element_Factory;
Protected_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Body_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Protected_Operations : not null Program.Element_Vectors
.Element_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Name : Program.Elements.Identifiers.Identifier_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Protected_Body_Declarations
.Protected_Body_Declaration_Access is
Result : constant Protected_Body_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Protected_Body_Declarations
.Protected_Body_Declaration'
(Program.Nodes.Protected_Body_Declarations.Create
(Protected_Token => Protected_Token, Body_Token => Body_Token,
Name => Name, With_Token => With_Token, Aspects => Aspects,
Is_Token => Is_Token,
Protected_Operations => Protected_Operations,
End_Token => End_Token, End_Name => End_Name,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Protected_Body_Declarations
.Protected_Body_Declaration_Access
(Result);
end Create_Protected_Body_Declaration;
not overriding function Create_Entry_Declaration
(Self : Element_Factory;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access;
Entry_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Entry_Family_Definition : Program.Elements.Discrete_Ranges
.Discrete_Range_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Left_Bracket_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Entry_Declarations
.Entry_Declaration_Access is
Result : constant Entry_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Entry_Declarations
.Entry_Declaration'
(Program.Nodes.Entry_Declarations.Create
(Not_Token => Not_Token, Overriding_Token => Overriding_Token,
Entry_Token => Entry_Token, Name => Name,
Left_Bracket_Token => Left_Bracket_Token,
Entry_Family_Definition => Entry_Family_Definition,
Right_Bracket_Token => Right_Bracket_Token,
Left_Bracket_Token_2 => Left_Bracket_Token_2,
Parameters => Parameters,
Right_Bracket_Token_2 => Right_Bracket_Token_2,
With_Token => With_Token, Aspects => Aspects,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Entry_Declarations.Entry_Declaration_Access
(Result);
end Create_Entry_Declaration;
not overriding function Create_Entry_Body_Declaration
(Self : Element_Factory;
Entry_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Entry_Index : not null Program.Elements
.Entry_Index_Specifications.Entry_Index_Specification_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Left_Bracket_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
When_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Entry_Barrier : not null Program.Elements.Expressions
.Expression_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Declarations : Program.Element_Vectors.Element_Vector_Access;
Begin_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Statements : not null Program.Element_Vectors
.Element_Vector_Access;
Exception_Token : Program.Lexical_Elements.Lexical_Element_Access;
Exception_Handlers : Program.Elements.Exception_Handlers
.Exception_Handler_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Name : Program.Elements.Identifiers.Identifier_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Entry_Body_Declarations
.Entry_Body_Declaration_Access is
Result : constant Entry_Body_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Entry_Body_Declarations
.Entry_Body_Declaration'
(Program.Nodes.Entry_Body_Declarations.Create
(Entry_Token => Entry_Token, Name => Name,
Left_Bracket_Token => Left_Bracket_Token,
Entry_Index => Entry_Index,
Right_Bracket_Token => Right_Bracket_Token,
Left_Bracket_Token_2 => Left_Bracket_Token_2,
Parameters => Parameters,
Right_Bracket_Token_2 => Right_Bracket_Token_2,
When_Token => When_Token, Entry_Barrier => Entry_Barrier,
Is_Token => Is_Token, Declarations => Declarations,
Begin_Token => Begin_Token, Statements => Statements,
Exception_Token => Exception_Token,
Exception_Handlers => Exception_Handlers,
End_Token => End_Token, End_Name => End_Name,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Entry_Body_Declarations
.Entry_Body_Declaration_Access
(Result);
end Create_Entry_Body_Declaration;
not overriding function Create_Entry_Index_Specification
(Self : Element_Factory;
For_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
In_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Entry_Index_Subtype : not null Program.Elements.Discrete_Ranges
.Discrete_Range_Access)
return not null Program.Elements.Entry_Index_Specifications
.Entry_Index_Specification_Access is
Result : constant Entry_Index_Specification_Access :=
new (Self.Subpool) Program.Nodes.Entry_Index_Specifications
.Entry_Index_Specification'
(Program.Nodes.Entry_Index_Specifications.Create
(For_Token => For_Token, Name => Name, In_Token => In_Token,
Entry_Index_Subtype => Entry_Index_Subtype));
begin
return Program.Elements.Entry_Index_Specifications
.Entry_Index_Specification_Access
(Result);
end Create_Entry_Index_Specification;
not overriding function Create_Procedure_Body_Stub
(Self : Element_Factory;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access;
Procedure_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Separate_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Procedure_Body_Stubs
.Procedure_Body_Stub_Access is
Result : constant Procedure_Body_Stub_Access :=
new (Self.Subpool) Program.Nodes.Procedure_Body_Stubs
.Procedure_Body_Stub'
(Program.Nodes.Procedure_Body_Stubs.Create
(Not_Token => Not_Token, Overriding_Token => Overriding_Token,
Procedure_Token => Procedure_Token, Name => Name,
Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token,
Is_Token => Is_Token, Separate_Token => Separate_Token,
With_Token => With_Token, Aspects => Aspects,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Procedure_Body_Stubs.Procedure_Body_Stub_Access
(Result);
end Create_Procedure_Body_Stub;
not overriding function Create_Function_Body_Stub
(Self : Element_Factory;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access;
Function_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Return_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Not_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Result_Subtype : not null Program.Elements.Element_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Separate_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Function_Body_Stubs
.Function_Body_Stub_Access is
Result : constant Function_Body_Stub_Access :=
new (Self.Subpool) Program.Nodes.Function_Body_Stubs
.Function_Body_Stub'
(Program.Nodes.Function_Body_Stubs.Create
(Not_Token => Not_Token, Overriding_Token => Overriding_Token,
Function_Token => Function_Token, Name => Name,
Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token,
Return_Token => Return_Token, Not_Token_2 => Not_Token_2,
Null_Token => Null_Token, Result_Subtype => Result_Subtype,
Is_Token => Is_Token, Separate_Token => Separate_Token,
With_Token => With_Token, Aspects => Aspects,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Function_Body_Stubs.Function_Body_Stub_Access
(Result);
end Create_Function_Body_Stub;
not overriding function Create_Package_Body_Stub
(Self : Element_Factory;
Package_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Body_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Separate_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Package_Body_Stubs
.Package_Body_Stub_Access is
Result : constant Package_Body_Stub_Access :=
new (Self.Subpool) Program.Nodes.Package_Body_Stubs
.Package_Body_Stub'
(Program.Nodes.Package_Body_Stubs.Create
(Package_Token => Package_Token, Body_Token => Body_Token,
Name => Name, Is_Token => Is_Token,
Separate_Token => Separate_Token, With_Token => With_Token,
Aspects => Aspects, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Package_Body_Stubs.Package_Body_Stub_Access
(Result);
end Create_Package_Body_Stub;
not overriding function Create_Task_Body_Stub
(Self : Element_Factory;
Task_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Body_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Separate_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Task_Body_Stubs.Task_Body_Stub_Access is
Result : constant Task_Body_Stub_Access :=
new (Self.Subpool) Program.Nodes.Task_Body_Stubs.Task_Body_Stub'
(Program.Nodes.Task_Body_Stubs.Create
(Task_Token => Task_Token, Body_Token => Body_Token,
Name => Name, Is_Token => Is_Token,
Separate_Token => Separate_Token, With_Token => With_Token,
Aspects => Aspects, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Task_Body_Stubs.Task_Body_Stub_Access (Result);
end Create_Task_Body_Stub;
not overriding function Create_Protected_Body_Stub
(Self : Element_Factory;
Protected_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Body_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Separate_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Protected_Body_Stubs
.Protected_Body_Stub_Access is
Result : constant Protected_Body_Stub_Access :=
new (Self.Subpool) Program.Nodes.Protected_Body_Stubs
.Protected_Body_Stub'
(Program.Nodes.Protected_Body_Stubs.Create
(Protected_Token => Protected_Token, Body_Token => Body_Token,
Name => Name, Is_Token => Is_Token,
Separate_Token => Separate_Token, With_Token => With_Token,
Aspects => Aspects, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Protected_Body_Stubs.Protected_Body_Stub_Access
(Result);
end Create_Protected_Body_Stub;
not overriding function Create_Exception_Declaration
(Self : Element_Factory;
Names : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Vector_Access;
Colon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Exception_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Exception_Declarations
.Exception_Declaration_Access is
Result : constant Exception_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Exception_Declarations
.Exception_Declaration'
(Program.Nodes.Exception_Declarations.Create
(Names => Names, Colon_Token => Colon_Token,
Exception_Token => Exception_Token, With_Token => With_Token,
Aspects => Aspects, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Exception_Declarations
.Exception_Declaration_Access
(Result);
end Create_Exception_Declaration;
not overriding function Create_Choice_Parameter_Specification
(Self : Element_Factory;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Colon_Token : not null Program.Lexical_Elements.Lexical_Element_Access)
return not null Program.Elements.Choice_Parameter_Specifications
.Choice_Parameter_Specification_Access is
Result : constant Choice_Parameter_Specification_Access :=
new (Self.Subpool) Program.Nodes.Choice_Parameter_Specifications
.Choice_Parameter_Specification'
(Program.Nodes.Choice_Parameter_Specifications.Create
(Name => Name, Colon_Token => Colon_Token));
begin
return Program.Elements.Choice_Parameter_Specifications
.Choice_Parameter_Specification_Access
(Result);
end Create_Choice_Parameter_Specification;
not overriding function Create_Generic_Package_Declaration
(Self : Element_Factory;
Generic_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Formal_Parameters : Program.Element_Vectors.Element_Vector_Access;
Package_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Visible_Declarations : Program.Element_Vectors.Element_Vector_Access;
Private_Token : Program.Lexical_Elements.Lexical_Element_Access;
Private_Declarations : Program.Element_Vectors.Element_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Name : Program.Elements.Expressions.Expression_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Generic_Package_Declarations
.Generic_Package_Declaration_Access is
Result : constant Generic_Package_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Generic_Package_Declarations
.Generic_Package_Declaration'
(Program.Nodes.Generic_Package_Declarations.Create
(Generic_Token => Generic_Token,
Formal_Parameters => Formal_Parameters,
Package_Token => Package_Token, Name => Name,
With_Token => With_Token, Aspects => Aspects,
Is_Token => Is_Token,
Visible_Declarations => Visible_Declarations,
Private_Token => Private_Token,
Private_Declarations => Private_Declarations,
End_Token => End_Token, End_Name => End_Name,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Generic_Package_Declarations
.Generic_Package_Declaration_Access
(Result);
end Create_Generic_Package_Declaration;
not overriding function Create_Generic_Procedure_Declaration
(Self : Element_Factory;
Generic_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Formal_Parameters : Program.Element_Vectors.Element_Vector_Access;
Procedure_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Generic_Procedure_Declarations
.Generic_Procedure_Declaration_Access is
Result : constant Generic_Procedure_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Generic_Procedure_Declarations
.Generic_Procedure_Declaration'
(Program.Nodes.Generic_Procedure_Declarations.Create
(Generic_Token => Generic_Token,
Formal_Parameters => Formal_Parameters,
Procedure_Token => Procedure_Token, Name => Name,
Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token,
With_Token => With_Token, Aspects => Aspects,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Generic_Procedure_Declarations
.Generic_Procedure_Declaration_Access
(Result);
end Create_Generic_Procedure_Declaration;
not overriding function Create_Generic_Function_Declaration
(Self : Element_Factory;
Generic_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Formal_Parameters : Program.Element_Vectors.Element_Vector_Access;
Function_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Return_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Result_Subtype : not null Program.Elements.Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Generic_Function_Declarations
.Generic_Function_Declaration_Access is
Result : constant Generic_Function_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Generic_Function_Declarations
.Generic_Function_Declaration'
(Program.Nodes.Generic_Function_Declarations.Create
(Generic_Token => Generic_Token,
Formal_Parameters => Formal_Parameters,
Function_Token => Function_Token, Name => Name,
Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token,
Return_Token => Return_Token, Not_Token => Not_Token,
Null_Token => Null_Token, Result_Subtype => Result_Subtype,
With_Token => With_Token, Aspects => Aspects,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Generic_Function_Declarations
.Generic_Function_Declaration_Access
(Result);
end Create_Generic_Function_Declaration;
not overriding function Create_Package_Instantiation
(Self : Element_Factory;
Package_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
New_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Generic_Package_Name : not null Program.Elements.Expressions
.Expression_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Associations
.Parameter_Association_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Package_Instantiations
.Package_Instantiation_Access is
Result : constant Package_Instantiation_Access :=
new (Self.Subpool) Program.Nodes.Package_Instantiations
.Package_Instantiation'
(Program.Nodes.Package_Instantiations.Create
(Package_Token => Package_Token, Name => Name,
Is_Token => Is_Token, New_Token => New_Token,
Generic_Package_Name => Generic_Package_Name,
Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token,
With_Token => With_Token, Aspects => Aspects,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Package_Instantiations
.Package_Instantiation_Access
(Result);
end Create_Package_Instantiation;
not overriding function Create_Procedure_Instantiation
(Self : Element_Factory;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access;
Procedure_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
New_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Generic_Procedure_Name : not null Program.Elements.Expressions
.Expression_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Associations
.Parameter_Association_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Procedure_Instantiations
.Procedure_Instantiation_Access is
Result : constant Procedure_Instantiation_Access :=
new (Self.Subpool) Program.Nodes.Procedure_Instantiations
.Procedure_Instantiation'
(Program.Nodes.Procedure_Instantiations.Create
(Not_Token => Not_Token, Overriding_Token => Overriding_Token,
Procedure_Token => Procedure_Token, Name => Name,
Is_Token => Is_Token, New_Token => New_Token,
Generic_Procedure_Name => Generic_Procedure_Name,
Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token,
With_Token => With_Token, Aspects => Aspects,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Procedure_Instantiations
.Procedure_Instantiation_Access
(Result);
end Create_Procedure_Instantiation;
not overriding function Create_Function_Instantiation
(Self : Element_Factory;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access;
Function_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
New_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Generic_Function_Name : not null Program.Elements.Expressions
.Expression_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Associations
.Parameter_Association_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Function_Instantiations
.Function_Instantiation_Access is
Result : constant Function_Instantiation_Access :=
new (Self.Subpool) Program.Nodes.Function_Instantiations
.Function_Instantiation'
(Program.Nodes.Function_Instantiations.Create
(Not_Token => Not_Token, Overriding_Token => Overriding_Token,
Function_Token => Function_Token, Name => Name,
Is_Token => Is_Token, New_Token => New_Token,
Generic_Function_Name => Generic_Function_Name,
Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token,
With_Token => With_Token, Aspects => Aspects,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Function_Instantiations
.Function_Instantiation_Access
(Result);
end Create_Function_Instantiation;
not overriding function Create_Formal_Object_Declaration
(Self : Element_Factory;
Names : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Vector_Access;
Colon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
In_Token : Program.Lexical_Elements.Lexical_Element_Access;
Out_Token : Program.Lexical_Elements.Lexical_Element_Access;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Object_Subtype : not null Program.Elements.Element_Access;
Assignment_Token : Program.Lexical_Elements.Lexical_Element_Access;
Default_Expression : Program.Elements.Expressions.Expression_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Formal_Object_Declarations
.Formal_Object_Declaration_Access is
Result : constant Formal_Object_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Formal_Object_Declarations
.Formal_Object_Declaration'
(Program.Nodes.Formal_Object_Declarations.Create
(Names => Names, Colon_Token => Colon_Token,
In_Token => In_Token, Out_Token => Out_Token,
Not_Token => Not_Token, Null_Token => Null_Token,
Object_Subtype => Object_Subtype,
Assignment_Token => Assignment_Token,
Default_Expression => Default_Expression,
With_Token => With_Token, Aspects => Aspects,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Formal_Object_Declarations
.Formal_Object_Declaration_Access
(Result);
end Create_Formal_Object_Declaration;
not overriding function Create_Formal_Type_Declaration
(Self : Element_Factory;
Type_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Discriminant_Part : Program.Elements.Definitions.Definition_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Definition : not null Program.Elements.Formal_Type_Definitions
.Formal_Type_Definition_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Formal_Type_Declarations
.Formal_Type_Declaration_Access is
Result : constant Formal_Type_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Formal_Type_Declarations
.Formal_Type_Declaration'
(Program.Nodes.Formal_Type_Declarations.Create
(Type_Token => Type_Token, Name => Name,
Discriminant_Part => Discriminant_Part, Is_Token => Is_Token,
Definition => Definition, With_Token => With_Token,
Aspects => Aspects, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Formal_Type_Declarations
.Formal_Type_Declaration_Access
(Result);
end Create_Formal_Type_Declaration;
not overriding function Create_Formal_Procedure_Declaration
(Self : Element_Factory;
With_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Procedure_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Is_Token : Program.Lexical_Elements.Lexical_Element_Access;
Abstract_Token : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Subprogram_Default : Program.Elements.Expressions.Expression_Access;
Box_Token : Program.Lexical_Elements.Lexical_Element_Access;
With_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Formal_Procedure_Declarations
.Formal_Procedure_Declaration_Access is
Result : constant Formal_Procedure_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Formal_Procedure_Declarations
.Formal_Procedure_Declaration'
(Program.Nodes.Formal_Procedure_Declarations.Create
(With_Token => With_Token, Procedure_Token => Procedure_Token,
Name => Name, Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token,
Is_Token => Is_Token, Abstract_Token => Abstract_Token,
Null_Token => Null_Token,
Subprogram_Default => Subprogram_Default,
Box_Token => Box_Token, With_Token_2 => With_Token_2,
Aspects => Aspects, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Formal_Procedure_Declarations
.Formal_Procedure_Declaration_Access
(Result);
end Create_Formal_Procedure_Declaration;
not overriding function Create_Formal_Function_Declaration
(Self : Element_Factory;
With_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Function_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Return_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Result_Subtype : not null Program.Elements.Element_Access;
Is_Token : Program.Lexical_Elements.Lexical_Element_Access;
Abstract_Token : Program.Lexical_Elements.Lexical_Element_Access;
Subprogram_Default : Program.Elements.Expressions.Expression_Access;
Box_Token : Program.Lexical_Elements.Lexical_Element_Access;
With_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Formal_Function_Declarations
.Formal_Function_Declaration_Access is
Result : constant Formal_Function_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Formal_Function_Declarations
.Formal_Function_Declaration'
(Program.Nodes.Formal_Function_Declarations.Create
(With_Token => With_Token, Function_Token => Function_Token,
Name => Name, Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token,
Return_Token => Return_Token, Not_Token => Not_Token,
Null_Token => Null_Token, Result_Subtype => Result_Subtype,
Is_Token => Is_Token, Abstract_Token => Abstract_Token,
Subprogram_Default => Subprogram_Default,
Box_Token => Box_Token, With_Token_2 => With_Token_2,
Aspects => Aspects, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Formal_Function_Declarations
.Formal_Function_Declaration_Access
(Result);
end Create_Formal_Function_Declaration;
not overriding function Create_Formal_Package_Declaration
(Self : Element_Factory;
With_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Package_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
New_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Generic_Package_Name : not null Program.Elements.Expressions
.Expression_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Formal_Package_Associations
.Formal_Package_Association_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
With_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Formal_Package_Declarations
.Formal_Package_Declaration_Access is
Result : constant Formal_Package_Declaration_Access :=
new (Self.Subpool) Program.Nodes.Formal_Package_Declarations
.Formal_Package_Declaration'
(Program.Nodes.Formal_Package_Declarations.Create
(With_Token => With_Token, Package_Token => Package_Token,
Name => Name, Is_Token => Is_Token, New_Token => New_Token,
Generic_Package_Name => Generic_Package_Name,
Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token,
With_Token_2 => With_Token_2, Aspects => Aspects,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Formal_Package_Declarations
.Formal_Package_Declaration_Access
(Result);
end Create_Formal_Package_Declaration;
not overriding function Create_Subtype_Indication
(Self : Element_Factory;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Subtype_Mark : not null Program.Elements.Expressions.Expression_Access;
Constraint : Program.Elements.Constraints.Constraint_Access)
return not null Program.Elements.Subtype_Indications
.Subtype_Indication_Access is
Result : constant Subtype_Indication_Access :=
new (Self.Subpool) Program.Nodes.Subtype_Indications
.Subtype_Indication'
(Program.Nodes.Subtype_Indications.Create
(Not_Token => Not_Token, Null_Token => Null_Token,
Subtype_Mark => Subtype_Mark, Constraint => Constraint));
begin
return Program.Elements.Subtype_Indications.Subtype_Indication_Access
(Result);
end Create_Subtype_Indication;
not overriding function Create_Component_Definition
(Self : Element_Factory;
Aliased_Token : Program.Lexical_Elements.Lexical_Element_Access;
Subtype_Indication : not null Program.Elements.Element_Access)
return not null Program.Elements.Component_Definitions
.Component_Definition_Access is
Result : constant Component_Definition_Access :=
new (Self.Subpool) Program.Nodes.Component_Definitions
.Component_Definition'
(Program.Nodes.Component_Definitions.Create
(Aliased_Token => Aliased_Token,
Subtype_Indication => Subtype_Indication));
begin
return Program.Elements.Component_Definitions.Component_Definition_Access
(Result);
end Create_Component_Definition;
not overriding function Create_Discrete_Subtype_Indication
(Self : Element_Factory;
Subtype_Mark : not null Program.Elements.Expressions
.Expression_Access;
Constraint : Program.Elements.Constraints
.Constraint_Access;
Is_Discrete_Subtype_Definition : Boolean := False)
return not null Program.Elements.Discrete_Subtype_Indications
.Discrete_Subtype_Indication_Access is
Result : constant Discrete_Subtype_Indication_Access :=
new (Self.Subpool) Program.Nodes.Discrete_Subtype_Indications
.Discrete_Subtype_Indication'
(Program.Nodes.Discrete_Subtype_Indications.Create
(Subtype_Mark => Subtype_Mark, Constraint => Constraint,
Is_Discrete_Subtype_Definition =>
Is_Discrete_Subtype_Definition));
begin
return Program.Elements.Discrete_Subtype_Indications
.Discrete_Subtype_Indication_Access
(Result);
end Create_Discrete_Subtype_Indication;
not overriding function Create_Discrete_Range_Attribute_Reference
(Self : Element_Factory;
Range_Attribute : not null Program.Elements
.Attribute_References.Attribute_Reference_Access;
Is_Discrete_Subtype_Definition : Boolean := False)
return not null Program.Elements.Discrete_Range_Attribute_References
.Discrete_Range_Attribute_Reference_Access is
Result : constant Discrete_Range_Attribute_Reference_Access :=
new (Self.Subpool) Program.Nodes.Discrete_Range_Attribute_References
.Discrete_Range_Attribute_Reference'
(Program.Nodes.Discrete_Range_Attribute_References.Create
(Range_Attribute => Range_Attribute,
Is_Discrete_Subtype_Definition =>
Is_Discrete_Subtype_Definition));
begin
return Program.Elements.Discrete_Range_Attribute_References
.Discrete_Range_Attribute_Reference_Access
(Result);
end Create_Discrete_Range_Attribute_Reference;
not overriding function Create_Discrete_Simple_Expression_Range
(Self : Element_Factory;
Lower_Bound : not null Program.Elements.Expressions
.Expression_Access;
Double_Dot_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Upper_Bound : not null Program.Elements.Expressions
.Expression_Access;
Is_Discrete_Subtype_Definition : Boolean := False)
return not null Program.Elements.Discrete_Simple_Expression_Ranges
.Discrete_Simple_Expression_Range_Access is
Result : constant Discrete_Simple_Expression_Range_Access :=
new (Self.Subpool) Program.Nodes.Discrete_Simple_Expression_Ranges
.Discrete_Simple_Expression_Range'
(Program.Nodes.Discrete_Simple_Expression_Ranges.Create
(Lower_Bound => Lower_Bound,
Double_Dot_Token => Double_Dot_Token,
Upper_Bound => Upper_Bound,
Is_Discrete_Subtype_Definition =>
Is_Discrete_Subtype_Definition));
begin
return Program.Elements.Discrete_Simple_Expression_Ranges
.Discrete_Simple_Expression_Range_Access
(Result);
end Create_Discrete_Simple_Expression_Range;
not overriding function Create_Unknown_Discriminant_Part
(Self : Element_Factory;
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Box_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Unknown_Discriminant_Parts
.Unknown_Discriminant_Part_Access is
Result : constant Unknown_Discriminant_Part_Access :=
new (Self.Subpool) Program.Nodes.Unknown_Discriminant_Parts
.Unknown_Discriminant_Part'
(Program.Nodes.Unknown_Discriminant_Parts.Create
(Left_Bracket_Token => Left_Bracket_Token,
Box_Token => Box_Token,
Right_Bracket_Token => Right_Bracket_Token));
begin
return Program.Elements.Unknown_Discriminant_Parts
.Unknown_Discriminant_Part_Access
(Result);
end Create_Unknown_Discriminant_Part;
not overriding function Create_Known_Discriminant_Part
(Self : Element_Factory;
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Discriminants : Program.Elements.Discriminant_Specifications
.Discriminant_Specification_Vector_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Known_Discriminant_Parts
.Known_Discriminant_Part_Access is
Result : constant Known_Discriminant_Part_Access :=
new (Self.Subpool) Program.Nodes.Known_Discriminant_Parts
.Known_Discriminant_Part'
(Program.Nodes.Known_Discriminant_Parts.Create
(Left_Bracket_Token => Left_Bracket_Token,
Discriminants => Discriminants,
Right_Bracket_Token => Right_Bracket_Token));
begin
return Program.Elements.Known_Discriminant_Parts
.Known_Discriminant_Part_Access
(Result);
end Create_Known_Discriminant_Part;
not overriding function Create_Record_Definition
(Self : Element_Factory;
Record_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Components : not null Program.Element_Vectors.Element_Vector_Access;
End_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Record_Token_2 : not null Program.Lexical_Elements.Lexical_Element_Access)
return not null Program.Elements.Record_Definitions
.Record_Definition_Access is
Result : constant Record_Definition_Access :=
new (Self.Subpool) Program.Nodes.Record_Definitions
.Record_Definition'
(Program.Nodes.Record_Definitions.Create
(Record_Token => Record_Token, Components => Components,
End_Token => End_Token, Record_Token_2 => Record_Token_2));
begin
return Program.Elements.Record_Definitions.Record_Definition_Access
(Result);
end Create_Record_Definition;
not overriding function Create_Null_Component
(Self : Element_Factory;
Null_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Null_Components.Null_Component_Access is
Result : constant Null_Component_Access :=
new (Self.Subpool) Program.Nodes.Null_Components.Null_Component'
(Program.Nodes.Null_Components.Create
(Null_Token => Null_Token, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Null_Components.Null_Component_Access (Result);
end Create_Null_Component;
not overriding function Create_Variant_Part
(Self : Element_Factory;
Case_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Discriminant : not null Program.Elements.Identifiers.Identifier_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Variants : not null Program.Elements.Variants
.Variant_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Case_Token_2 : not null Program.Lexical_Elements
.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Variant_Parts.Variant_Part_Access is
Result : constant Variant_Part_Access :=
new (Self.Subpool) Program.Nodes.Variant_Parts.Variant_Part'
(Program.Nodes.Variant_Parts.Create
(Case_Token => Case_Token, Discriminant => Discriminant,
Is_Token => Is_Token, Variants => Variants,
End_Token => End_Token, Case_Token_2 => Case_Token_2,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Variant_Parts.Variant_Part_Access (Result);
end Create_Variant_Part;
not overriding function Create_Variant
(Self : Element_Factory;
When_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Choices : not null Program.Element_Vectors.Element_Vector_Access;
Arrow_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Components : not null Program.Element_Vectors.Element_Vector_Access)
return not null Program.Elements.Variants.Variant_Access is
Result : constant Variant_Access :=
new (Self.Subpool) Program.Nodes.Variants.Variant'
(Program.Nodes.Variants.Create
(When_Token => When_Token, Choices => Choices,
Arrow_Token => Arrow_Token, Components => Components));
begin
return Program.Elements.Variants.Variant_Access (Result);
end Create_Variant;
not overriding function Create_Others_Choice
(Self : Element_Factory;
Others_Token : not null Program.Lexical_Elements.Lexical_Element_Access)
return not null Program.Elements.Others_Choices.Others_Choice_Access is
Result : constant Others_Choice_Access :=
new (Self.Subpool) Program.Nodes.Others_Choices.Others_Choice'
(Program.Nodes.Others_Choices.Create
(Others_Token => Others_Token));
begin
return Program.Elements.Others_Choices.Others_Choice_Access (Result);
end Create_Others_Choice;
not overriding function Create_Anonymous_Access_To_Object
(Self : Element_Factory;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Access_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
All_Token : Program.Lexical_Elements.Lexical_Element_Access;
Constant_Token : Program.Lexical_Elements.Lexical_Element_Access;
Subtype_Indication : not null Program.Elements.Subtype_Indications
.Subtype_Indication_Access)
return not null Program.Elements.Anonymous_Access_To_Objects
.Anonymous_Access_To_Object_Access is
Result : constant Anonymous_Access_To_Object_Access :=
new (Self.Subpool) Program.Nodes.Anonymous_Access_To_Objects
.Anonymous_Access_To_Object'
(Program.Nodes.Anonymous_Access_To_Objects.Create
(Not_Token => Not_Token, Null_Token => Null_Token,
Access_Token => Access_Token, All_Token => All_Token,
Constant_Token => Constant_Token,
Subtype_Indication => Subtype_Indication));
begin
return Program.Elements.Anonymous_Access_To_Objects
.Anonymous_Access_To_Object_Access
(Result);
end Create_Anonymous_Access_To_Object;
not overriding function Create_Anonymous_Access_To_Procedure
(Self : Element_Factory;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Access_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Protected_Token : Program.Lexical_Elements.Lexical_Element_Access;
Procedure_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access)
return not null Program.Elements.Anonymous_Access_To_Procedures
.Anonymous_Access_To_Procedure_Access is
Result : constant Anonymous_Access_To_Procedure_Access :=
new (Self.Subpool) Program.Nodes.Anonymous_Access_To_Procedures
.Anonymous_Access_To_Procedure'
(Program.Nodes.Anonymous_Access_To_Procedures.Create
(Not_Token => Not_Token, Null_Token => Null_Token,
Access_Token => Access_Token,
Protected_Token => Protected_Token,
Procedure_Token => Procedure_Token,
Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token));
begin
return Program.Elements.Anonymous_Access_To_Procedures
.Anonymous_Access_To_Procedure_Access
(Result);
end Create_Anonymous_Access_To_Procedure;
not overriding function Create_Anonymous_Access_To_Function
(Self : Element_Factory;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Access_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Protected_Token : Program.Lexical_Elements.Lexical_Element_Access;
Function_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Return_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Not_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
Result_Subtype : not null Program.Elements.Element_Access)
return not null Program.Elements.Anonymous_Access_To_Functions
.Anonymous_Access_To_Function_Access is
Result : constant Anonymous_Access_To_Function_Access :=
new (Self.Subpool) Program.Nodes.Anonymous_Access_To_Functions
.Anonymous_Access_To_Function'
(Program.Nodes.Anonymous_Access_To_Functions.Create
(Not_Token => Not_Token, Null_Token => Null_Token,
Access_Token => Access_Token,
Protected_Token => Protected_Token,
Function_Token => Function_Token,
Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token,
Return_Token => Return_Token, Not_Token_2 => Not_Token_2,
Null_Token_2 => Null_Token_2,
Result_Subtype => Result_Subtype));
begin
return Program.Elements.Anonymous_Access_To_Functions
.Anonymous_Access_To_Function_Access
(Result);
end Create_Anonymous_Access_To_Function;
not overriding function Create_Private_Type_Definition
(Self : Element_Factory;
Abstract_Token : Program.Lexical_Elements.Lexical_Element_Access;
Tagged_Token : Program.Lexical_Elements.Lexical_Element_Access;
Limited_Token : Program.Lexical_Elements.Lexical_Element_Access;
Private_Token : not null Program.Lexical_Elements.Lexical_Element_Access)
return not null Program.Elements.Private_Type_Definitions
.Private_Type_Definition_Access is
Result : constant Private_Type_Definition_Access :=
new (Self.Subpool) Program.Nodes.Private_Type_Definitions
.Private_Type_Definition'
(Program.Nodes.Private_Type_Definitions.Create
(Abstract_Token => Abstract_Token, Tagged_Token => Tagged_Token,
Limited_Token => Limited_Token,
Private_Token => Private_Token));
begin
return Program.Elements.Private_Type_Definitions
.Private_Type_Definition_Access
(Result);
end Create_Private_Type_Definition;
not overriding function Create_Private_Extension_Definition
(Self : Element_Factory;
Abstract_Token : Program.Lexical_Elements.Lexical_Element_Access;
Limited_Token : Program.Lexical_Elements.Lexical_Element_Access;
Synchronized_Token : Program.Lexical_Elements.Lexical_Element_Access;
New_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Ancestor : not null Program.Elements.Subtype_Indications
.Subtype_Indication_Access;
And_Token : Program.Lexical_Elements.Lexical_Element_Access;
Progenitors : Program.Elements.Expressions
.Expression_Vector_Access;
With_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Private_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Private_Extension_Definitions
.Private_Extension_Definition_Access is
Result : constant Private_Extension_Definition_Access :=
new (Self.Subpool) Program.Nodes.Private_Extension_Definitions
.Private_Extension_Definition'
(Program.Nodes.Private_Extension_Definitions.Create
(Abstract_Token => Abstract_Token,
Limited_Token => Limited_Token,
Synchronized_Token => Synchronized_Token,
New_Token => New_Token, Ancestor => Ancestor,
And_Token => And_Token, Progenitors => Progenitors,
With_Token => With_Token, Private_Token => Private_Token));
begin
return Program.Elements.Private_Extension_Definitions
.Private_Extension_Definition_Access
(Result);
end Create_Private_Extension_Definition;
not overriding function Create_Incomplete_Type_Definition
(Self : Element_Factory;
Tagged_Token : Program.Lexical_Elements.Lexical_Element_Access)
return not null Program.Elements.Incomplete_Type_Definitions
.Incomplete_Type_Definition_Access is
Result : constant Incomplete_Type_Definition_Access :=
new (Self.Subpool) Program.Nodes.Incomplete_Type_Definitions
.Incomplete_Type_Definition'
(Program.Nodes.Incomplete_Type_Definitions.Create
(Tagged_Token => Tagged_Token));
begin
return Program.Elements.Incomplete_Type_Definitions
.Incomplete_Type_Definition_Access
(Result);
end Create_Incomplete_Type_Definition;
not overriding function Create_Task_Definition
(Self : Element_Factory;
Visible_Declarations : Program.Element_Vectors.Element_Vector_Access;
Private_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Private_Declarations : Program.Element_Vectors.Element_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Name : Program.Elements.Identifiers.Identifier_Access)
return not null Program.Elements.Task_Definitions
.Task_Definition_Access is
Result : constant Task_Definition_Access :=
new (Self.Subpool) Program.Nodes.Task_Definitions.Task_Definition'
(Program.Nodes.Task_Definitions.Create
(Visible_Declarations => Visible_Declarations,
Private_Token => Private_Token,
Private_Declarations => Private_Declarations,
End_Token => End_Token, End_Name => End_Name));
begin
return Program.Elements.Task_Definitions.Task_Definition_Access (Result);
end Create_Task_Definition;
not overriding function Create_Protected_Definition
(Self : Element_Factory;
Visible_Declarations : Program.Element_Vectors.Element_Vector_Access;
Private_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Private_Declarations : Program.Element_Vectors.Element_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Name : Program.Elements.Identifiers.Identifier_Access)
return not null Program.Elements.Protected_Definitions
.Protected_Definition_Access is
Result : constant Protected_Definition_Access :=
new (Self.Subpool) Program.Nodes.Protected_Definitions
.Protected_Definition'
(Program.Nodes.Protected_Definitions.Create
(Visible_Declarations => Visible_Declarations,
Private_Token => Private_Token,
Private_Declarations => Private_Declarations,
End_Token => End_Token, End_Name => End_Name));
begin
return Program.Elements.Protected_Definitions.Protected_Definition_Access
(Result);
end Create_Protected_Definition;
not overriding function Create_Aspect_Specification
(Self : Element_Factory;
Aspect_Mark : not null Program.Elements.Expressions
.Expression_Access;
Arrow_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Aspect_Definition : not null Program.Elements.Expressions
.Expression_Access)
return not null Program.Elements.Aspect_Specifications
.Aspect_Specification_Access is
Result : constant Aspect_Specification_Access :=
new (Self.Subpool) Program.Nodes.Aspect_Specifications
.Aspect_Specification'
(Program.Nodes.Aspect_Specifications.Create
(Aspect_Mark => Aspect_Mark, Arrow_Token => Arrow_Token,
Aspect_Definition => Aspect_Definition));
begin
return Program.Elements.Aspect_Specifications.Aspect_Specification_Access
(Result);
end Create_Aspect_Specification;
not overriding function Create_Real_Range_Specification
(Self : Element_Factory;
Range_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Lower_Bound : not null Program.Elements.Expressions
.Expression_Access;
Double_Dot_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Upper_Bound : not null Program.Elements.Expressions
.Expression_Access)
return not null Program.Elements.Real_Range_Specifications
.Real_Range_Specification_Access is
Result : constant Real_Range_Specification_Access :=
new (Self.Subpool) Program.Nodes.Real_Range_Specifications
.Real_Range_Specification'
(Program.Nodes.Real_Range_Specifications.Create
(Range_Token => Range_Token, Lower_Bound => Lower_Bound,
Double_Dot_Token => Double_Dot_Token,
Upper_Bound => Upper_Bound));
begin
return Program.Elements.Real_Range_Specifications
.Real_Range_Specification_Access
(Result);
end Create_Real_Range_Specification;
not overriding function Create_Numeric_Literal
(Self : Element_Factory;
Numeric_Literal_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Numeric_Literals
.Numeric_Literal_Access is
Result : constant Numeric_Literal_Access :=
new (Self.Subpool) Program.Nodes.Numeric_Literals.Numeric_Literal'
(Program.Nodes.Numeric_Literals.Create
(Numeric_Literal_Token => Numeric_Literal_Token));
begin
return Program.Elements.Numeric_Literals.Numeric_Literal_Access (Result);
end Create_Numeric_Literal;
not overriding function Create_String_Literal
(Self : Element_Factory;
String_Literal_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.String_Literals.String_Literal_Access is
Result : constant String_Literal_Access :=
new (Self.Subpool) Program.Nodes.String_Literals.String_Literal'
(Program.Nodes.String_Literals.Create
(String_Literal_Token => String_Literal_Token));
begin
return Program.Elements.String_Literals.String_Literal_Access (Result);
end Create_String_Literal;
not overriding function Create_Identifier
(Self : Element_Factory;
Identifier_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Identifiers.Identifier_Access is
Result : constant Identifier_Access :=
new (Self.Subpool) Program.Nodes.Identifiers.Identifier'
(Program.Nodes.Identifiers.Create
(Identifier_Token => Identifier_Token));
begin
return Program.Elements.Identifiers.Identifier_Access (Result);
end Create_Identifier;
not overriding function Create_Operator_Symbol
(Self : Element_Factory;
Operator_Symbol_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Operator_Symbols
.Operator_Symbol_Access is
Result : constant Operator_Symbol_Access :=
new (Self.Subpool) Program.Nodes.Operator_Symbols.Operator_Symbol'
(Program.Nodes.Operator_Symbols.Create
(Operator_Symbol_Token => Operator_Symbol_Token));
begin
return Program.Elements.Operator_Symbols.Operator_Symbol_Access (Result);
end Create_Operator_Symbol;
not overriding function Create_Character_Literal
(Self : Element_Factory;
Character_Literal_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Character_Literals
.Character_Literal_Access is
Result : constant Character_Literal_Access :=
new (Self.Subpool) Program.Nodes.Character_Literals
.Character_Literal'
(Program.Nodes.Character_Literals.Create
(Character_Literal_Token => Character_Literal_Token));
begin
return Program.Elements.Character_Literals.Character_Literal_Access
(Result);
end Create_Character_Literal;
not overriding function Create_Explicit_Dereference
(Self : Element_Factory;
Prefix : not null Program.Elements.Expressions.Expression_Access;
Dot_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
All_Token : not null Program.Lexical_Elements.Lexical_Element_Access)
return not null Program.Elements.Explicit_Dereferences
.Explicit_Dereference_Access is
Result : constant Explicit_Dereference_Access :=
new (Self.Subpool) Program.Nodes.Explicit_Dereferences
.Explicit_Dereference'
(Program.Nodes.Explicit_Dereferences.Create
(Prefix => Prefix, Dot_Token => Dot_Token,
All_Token => All_Token));
begin
return Program.Elements.Explicit_Dereferences.Explicit_Dereference_Access
(Result);
end Create_Explicit_Dereference;
not overriding function Create_Infix_Operator
(Self : Element_Factory;
Left : Program.Elements.Expressions.Expression_Access;
Operator : not null Program.Elements.Operator_Symbols
.Operator_Symbol_Access;
Right : not null Program.Elements.Expressions.Expression_Access)
return not null Program.Elements.Infix_Operators.Infix_Operator_Access is
Result : constant Infix_Operator_Access :=
new (Self.Subpool) Program.Nodes.Infix_Operators.Infix_Operator'
(Program.Nodes.Infix_Operators.Create
(Left => Left, Operator => Operator, Right => Right));
begin
return Program.Elements.Infix_Operators.Infix_Operator_Access (Result);
end Create_Infix_Operator;
not overriding function Create_Function_Call
(Self : Element_Factory;
Prefix : not null Program.Elements.Expressions
.Expression_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Associations
.Parameter_Association_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access)
return not null Program.Elements.Function_Calls.Function_Call_Access is
Result : constant Function_Call_Access :=
new (Self.Subpool) Program.Nodes.Function_Calls.Function_Call'
(Program.Nodes.Function_Calls.Create
(Prefix => Prefix, Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token));
begin
return Program.Elements.Function_Calls.Function_Call_Access (Result);
end Create_Function_Call;
not overriding function Create_Indexed_Component
(Self : Element_Factory;
Prefix : not null Program.Elements.Expressions
.Expression_Access;
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Expressions : Program.Elements.Expressions
.Expression_Vector_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Indexed_Components
.Indexed_Component_Access is
Result : constant Indexed_Component_Access :=
new (Self.Subpool) Program.Nodes.Indexed_Components
.Indexed_Component'
(Program.Nodes.Indexed_Components.Create
(Prefix => Prefix, Left_Bracket_Token => Left_Bracket_Token,
Expressions => Expressions,
Right_Bracket_Token => Right_Bracket_Token));
begin
return Program.Elements.Indexed_Components.Indexed_Component_Access
(Result);
end Create_Indexed_Component;
not overriding function Create_Slice
(Self : Element_Factory;
Prefix : not null Program.Elements.Expressions
.Expression_Access;
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Slice_Range : not null Program.Elements.Discrete_Ranges
.Discrete_Range_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Slices.Slice_Access is
Result : constant Slice_Access :=
new (Self.Subpool) Program.Nodes.Slices.Slice'
(Program.Nodes.Slices.Create
(Prefix => Prefix, Left_Bracket_Token => Left_Bracket_Token,
Slice_Range => Slice_Range,
Right_Bracket_Token => Right_Bracket_Token));
begin
return Program.Elements.Slices.Slice_Access (Result);
end Create_Slice;
not overriding function Create_Selected_Component
(Self : Element_Factory;
Prefix : not null Program.Elements.Expressions.Expression_Access;
Dot_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Selector : not null Program.Elements.Expressions.Expression_Access)
return not null Program.Elements.Selected_Components
.Selected_Component_Access is
Result : constant Selected_Component_Access :=
new (Self.Subpool) Program.Nodes.Selected_Components
.Selected_Component'
(Program.Nodes.Selected_Components.Create
(Prefix => Prefix, Dot_Token => Dot_Token,
Selector => Selector));
begin
return Program.Elements.Selected_Components.Selected_Component_Access
(Result);
end Create_Selected_Component;
not overriding function Create_Attribute_Reference
(Self : Element_Factory;
Prefix : not null Program.Elements.Expressions
.Expression_Access;
Apostrophe_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Attribute_Designator : not null Program.Elements.Identifiers
.Identifier_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Expressions : Program.Elements.Expressions.Expression_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access)
return not null Program.Elements.Attribute_References
.Attribute_Reference_Access is
Result : constant Attribute_Reference_Access :=
new (Self.Subpool) Program.Nodes.Attribute_References
.Attribute_Reference'
(Program.Nodes.Attribute_References.Create
(Prefix => Prefix, Apostrophe_Token => Apostrophe_Token,
Attribute_Designator => Attribute_Designator,
Left_Bracket_Token => Left_Bracket_Token,
Expressions => Expressions,
Right_Bracket_Token => Right_Bracket_Token));
begin
return Program.Elements.Attribute_References.Attribute_Reference_Access
(Result);
end Create_Attribute_Reference;
not overriding function Create_Record_Aggregate
(Self : Element_Factory;
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Components : Program.Elements.Record_Component_Associations
.Record_Component_Association_Vector_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Record_Aggregates
.Record_Aggregate_Access is
Result : constant Record_Aggregate_Access :=
new (Self.Subpool) Program.Nodes.Record_Aggregates.Record_Aggregate'
(Program.Nodes.Record_Aggregates.Create
(Left_Bracket_Token => Left_Bracket_Token,
Components => Components,
Right_Bracket_Token => Right_Bracket_Token));
begin
return Program.Elements.Record_Aggregates.Record_Aggregate_Access
(Result);
end Create_Record_Aggregate;
not overriding function Create_Extension_Aggregate
(Self : Element_Factory;
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Ancestor : not null Program.Elements.Expressions
.Expression_Access;
With_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Components : Program.Elements.Record_Component_Associations
.Record_Component_Association_Vector_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Extension_Aggregates
.Extension_Aggregate_Access is
Result : constant Extension_Aggregate_Access :=
new (Self.Subpool) Program.Nodes.Extension_Aggregates
.Extension_Aggregate'
(Program.Nodes.Extension_Aggregates.Create
(Left_Bracket_Token => Left_Bracket_Token, Ancestor => Ancestor,
With_Token => With_Token, Components => Components,
Right_Bracket_Token => Right_Bracket_Token));
begin
return Program.Elements.Extension_Aggregates.Extension_Aggregate_Access
(Result);
end Create_Extension_Aggregate;
not overriding function Create_Array_Aggregate
(Self : Element_Factory;
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Components : Program.Elements.Array_Component_Associations
.Array_Component_Association_Vector_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Array_Aggregates
.Array_Aggregate_Access is
Result : constant Array_Aggregate_Access :=
new (Self.Subpool) Program.Nodes.Array_Aggregates.Array_Aggregate'
(Program.Nodes.Array_Aggregates.Create
(Left_Bracket_Token => Left_Bracket_Token,
Components => Components,
Right_Bracket_Token => Right_Bracket_Token));
begin
return Program.Elements.Array_Aggregates.Array_Aggregate_Access (Result);
end Create_Array_Aggregate;
not overriding function Create_Short_Circuit_Operation
(Self : Element_Factory;
Left : not null Program.Elements.Expressions.Expression_Access;
And_Token : Program.Lexical_Elements.Lexical_Element_Access;
Then_Token : Program.Lexical_Elements.Lexical_Element_Access;
Or_Token : Program.Lexical_Elements.Lexical_Element_Access;
Else_Token : Program.Lexical_Elements.Lexical_Element_Access;
Right : not null Program.Elements.Expressions.Expression_Access)
return not null Program.Elements.Short_Circuit_Operations
.Short_Circuit_Operation_Access is
Result : constant Short_Circuit_Operation_Access :=
new (Self.Subpool) Program.Nodes.Short_Circuit_Operations
.Short_Circuit_Operation'
(Program.Nodes.Short_Circuit_Operations.Create
(Left => Left, And_Token => And_Token, Then_Token => Then_Token,
Or_Token => Or_Token, Else_Token => Else_Token,
Right => Right));
begin
return Program.Elements.Short_Circuit_Operations
.Short_Circuit_Operation_Access
(Result);
end Create_Short_Circuit_Operation;
not overriding function Create_Membership_Test
(Self : Element_Factory;
Expression : not null Program.Elements.Expressions.Expression_Access;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
In_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Choices : not null Program.Element_Vectors.Element_Vector_Access)
return not null Program.Elements.Membership_Tests
.Membership_Test_Access is
Result : constant Membership_Test_Access :=
new (Self.Subpool) Program.Nodes.Membership_Tests.Membership_Test'
(Program.Nodes.Membership_Tests.Create
(Expression => Expression, Not_Token => Not_Token,
In_Token => In_Token, Choices => Choices));
begin
return Program.Elements.Membership_Tests.Membership_Test_Access (Result);
end Create_Membership_Test;
not overriding function Create_Null_Literal
(Self : Element_Factory;
Null_Literal_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Null_Literals.Null_Literal_Access is
Result : constant Null_Literal_Access :=
new (Self.Subpool) Program.Nodes.Null_Literals.Null_Literal'
(Program.Nodes.Null_Literals.Create
(Null_Literal_Token => Null_Literal_Token));
begin
return Program.Elements.Null_Literals.Null_Literal_Access (Result);
end Create_Null_Literal;
not overriding function Create_Parenthesized_Expression
(Self : Element_Factory;
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Expression : not null Program.Elements.Expressions
.Expression_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Parenthesized_Expressions
.Parenthesized_Expression_Access is
Result : constant Parenthesized_Expression_Access :=
new (Self.Subpool) Program.Nodes.Parenthesized_Expressions
.Parenthesized_Expression'
(Program.Nodes.Parenthesized_Expressions.Create
(Left_Bracket_Token => Left_Bracket_Token,
Expression => Expression,
Right_Bracket_Token => Right_Bracket_Token));
begin
return Program.Elements.Parenthesized_Expressions
.Parenthesized_Expression_Access
(Result);
end Create_Parenthesized_Expression;
not overriding function Create_Raise_Expression
(Self : Element_Factory;
Raise_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Exception_Name : not null Program.Elements.Expressions
.Expression_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Associated_Message : Program.Elements.Expressions.Expression_Access)
return not null Program.Elements.Raise_Expressions
.Raise_Expression_Access is
Result : constant Raise_Expression_Access :=
new (Self.Subpool) Program.Nodes.Raise_Expressions.Raise_Expression'
(Program.Nodes.Raise_Expressions.Create
(Raise_Token => Raise_Token, Exception_Name => Exception_Name,
With_Token => With_Token,
Associated_Message => Associated_Message));
begin
return Program.Elements.Raise_Expressions.Raise_Expression_Access
(Result);
end Create_Raise_Expression;
not overriding function Create_Type_Conversion
(Self : Element_Factory;
Subtype_Mark : not null Program.Elements.Expressions
.Expression_Access;
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Operand : not null Program.Elements.Expressions
.Expression_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Type_Conversions
.Type_Conversion_Access is
Result : constant Type_Conversion_Access :=
new (Self.Subpool) Program.Nodes.Type_Conversions.Type_Conversion'
(Program.Nodes.Type_Conversions.Create
(Subtype_Mark => Subtype_Mark,
Left_Bracket_Token => Left_Bracket_Token, Operand => Operand,
Right_Bracket_Token => Right_Bracket_Token));
begin
return Program.Elements.Type_Conversions.Type_Conversion_Access (Result);
end Create_Type_Conversion;
not overriding function Create_Qualified_Expression
(Self : Element_Factory;
Subtype_Mark : not null Program.Elements.Expressions
.Expression_Access;
Apostrophe_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Operand : not null Program.Elements.Expressions
.Expression_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Qualified_Expressions
.Qualified_Expression_Access is
Result : constant Qualified_Expression_Access :=
new (Self.Subpool) Program.Nodes.Qualified_Expressions
.Qualified_Expression'
(Program.Nodes.Qualified_Expressions.Create
(Subtype_Mark => Subtype_Mark,
Apostrophe_Token => Apostrophe_Token,
Left_Bracket_Token => Left_Bracket_Token, Operand => Operand,
Right_Bracket_Token => Right_Bracket_Token));
begin
return Program.Elements.Qualified_Expressions.Qualified_Expression_Access
(Result);
end Create_Qualified_Expression;
not overriding function Create_Allocator
(Self : Element_Factory;
New_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Subpool_Name : Program.Elements.Expressions.Expression_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Subtype_Indication : Program.Elements.Subtype_Indications
.Subtype_Indication_Access;
Qualified_Expression : Program.Elements.Qualified_Expressions
.Qualified_Expression_Access)
return not null Program.Elements.Allocators.Allocator_Access is
Result : constant Allocator_Access :=
new (Self.Subpool) Program.Nodes.Allocators.Allocator'
(Program.Nodes.Allocators.Create
(New_Token => New_Token,
Left_Bracket_Token => Left_Bracket_Token,
Subpool_Name => Subpool_Name,
Right_Bracket_Token => Right_Bracket_Token,
Subtype_Indication => Subtype_Indication,
Qualified_Expression => Qualified_Expression));
begin
return Program.Elements.Allocators.Allocator_Access (Result);
end Create_Allocator;
not overriding function Create_Case_Expression
(Self : Element_Factory;
Case_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Selecting_Expression : not null Program.Elements.Expressions
.Expression_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Paths : not null Program.Elements.Case_Expression_Paths
.Case_Expression_Path_Vector_Access)
return not null Program.Elements.Case_Expressions
.Case_Expression_Access is
Result : constant Case_Expression_Access :=
new (Self.Subpool) Program.Nodes.Case_Expressions.Case_Expression'
(Program.Nodes.Case_Expressions.Create
(Case_Token => Case_Token,
Selecting_Expression => Selecting_Expression,
Is_Token => Is_Token, Paths => Paths));
begin
return Program.Elements.Case_Expressions.Case_Expression_Access (Result);
end Create_Case_Expression;
not overriding function Create_If_Expression
(Self : Element_Factory;
If_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Condition : not null Program.Elements.Expressions.Expression_Access;
Then_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Then_Expression : not null Program.Elements.Expressions.Expression_Access;
Elsif_Paths : Program.Elements.Elsif_Paths.Elsif_Path_Vector_Access;
Else_Token : Program.Lexical_Elements.Lexical_Element_Access;
Else_Expression : Program.Elements.Expressions.Expression_Access)
return not null Program.Elements.If_Expressions.If_Expression_Access is
Result : constant If_Expression_Access :=
new (Self.Subpool) Program.Nodes.If_Expressions.If_Expression'
(Program.Nodes.If_Expressions.Create
(If_Token => If_Token, Condition => Condition,
Then_Token => Then_Token, Then_Expression => Then_Expression,
Elsif_Paths => Elsif_Paths, Else_Token => Else_Token,
Else_Expression => Else_Expression));
begin
return Program.Elements.If_Expressions.If_Expression_Access (Result);
end Create_If_Expression;
not overriding function Create_Quantified_Expression
(Self : Element_Factory;
For_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
All_Token : Program.Lexical_Elements.Lexical_Element_Access;
Some_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameter : Program.Elements.Loop_Parameter_Specifications
.Loop_Parameter_Specification_Access;
Generalized_Iterator : Program.Elements
.Generalized_Iterator_Specifications
.Generalized_Iterator_Specification_Access;
Element_Iterator : Program.Elements.Element_Iterator_Specifications
.Element_Iterator_Specification_Access;
Arrow_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Predicate : not null Program.Elements.Expressions
.Expression_Access)
return not null Program.Elements.Quantified_Expressions
.Quantified_Expression_Access is
Result : constant Quantified_Expression_Access :=
new (Self.Subpool) Program.Nodes.Quantified_Expressions
.Quantified_Expression'
(Program.Nodes.Quantified_Expressions.Create
(For_Token => For_Token, All_Token => All_Token,
Some_Token => Some_Token, Parameter => Parameter,
Generalized_Iterator => Generalized_Iterator,
Element_Iterator => Element_Iterator,
Arrow_Token => Arrow_Token, Predicate => Predicate));
begin
return Program.Elements.Quantified_Expressions
.Quantified_Expression_Access
(Result);
end Create_Quantified_Expression;
not overriding function Create_Discriminant_Association
(Self : Element_Factory;
Selector_Names : Program.Elements.Identifiers.Identifier_Vector_Access;
Arrow_Token : Program.Lexical_Elements.Lexical_Element_Access;
Expression : not null Program.Elements.Expressions.Expression_Access)
return not null Program.Elements.Discriminant_Associations
.Discriminant_Association_Access is
Result : constant Discriminant_Association_Access :=
new (Self.Subpool) Program.Nodes.Discriminant_Associations
.Discriminant_Association'
(Program.Nodes.Discriminant_Associations.Create
(Selector_Names => Selector_Names, Arrow_Token => Arrow_Token,
Expression => Expression));
begin
return Program.Elements.Discriminant_Associations
.Discriminant_Association_Access
(Result);
end Create_Discriminant_Association;
not overriding function Create_Record_Component_Association
(Self : Element_Factory;
Choices : Program.Element_Vectors.Element_Vector_Access;
Arrow_Token : Program.Lexical_Elements.Lexical_Element_Access;
Expression : Program.Elements.Expressions.Expression_Access;
Box_Token : Program.Lexical_Elements.Lexical_Element_Access)
return not null Program.Elements.Record_Component_Associations
.Record_Component_Association_Access is
Result : constant Record_Component_Association_Access :=
new (Self.Subpool) Program.Nodes.Record_Component_Associations
.Record_Component_Association'
(Program.Nodes.Record_Component_Associations.Create
(Choices => Choices, Arrow_Token => Arrow_Token,
Expression => Expression, Box_Token => Box_Token));
begin
return Program.Elements.Record_Component_Associations
.Record_Component_Association_Access
(Result);
end Create_Record_Component_Association;
not overriding function Create_Array_Component_Association
(Self : Element_Factory;
Choices : Program.Element_Vectors.Element_Vector_Access;
Arrow_Token : Program.Lexical_Elements.Lexical_Element_Access;
Expression : Program.Elements.Expressions.Expression_Access;
Box_Token : Program.Lexical_Elements.Lexical_Element_Access)
return not null Program.Elements.Array_Component_Associations
.Array_Component_Association_Access is
Result : constant Array_Component_Association_Access :=
new (Self.Subpool) Program.Nodes.Array_Component_Associations
.Array_Component_Association'
(Program.Nodes.Array_Component_Associations.Create
(Choices => Choices, Arrow_Token => Arrow_Token,
Expression => Expression, Box_Token => Box_Token));
begin
return Program.Elements.Array_Component_Associations
.Array_Component_Association_Access
(Result);
end Create_Array_Component_Association;
not overriding function Create_Parameter_Association
(Self : Element_Factory;
Formal_Parameter : Program.Elements.Expressions.Expression_Access;
Arrow_Token : Program.Lexical_Elements.Lexical_Element_Access;
Actual_Parameter : not null Program.Elements.Expressions
.Expression_Access)
return not null Program.Elements.Parameter_Associations
.Parameter_Association_Access is
Result : constant Parameter_Association_Access :=
new (Self.Subpool) Program.Nodes.Parameter_Associations
.Parameter_Association'
(Program.Nodes.Parameter_Associations.Create
(Formal_Parameter => Formal_Parameter,
Arrow_Token => Arrow_Token,
Actual_Parameter => Actual_Parameter));
begin
return Program.Elements.Parameter_Associations
.Parameter_Association_Access
(Result);
end Create_Parameter_Association;
not overriding function Create_Formal_Package_Association
(Self : Element_Factory;
Formal_Parameter : Program.Elements.Expressions.Expression_Access;
Arrow_Token : Program.Lexical_Elements.Lexical_Element_Access;
Actual_Parameter : Program.Elements.Expressions.Expression_Access;
Box_Token : Program.Lexical_Elements.Lexical_Element_Access)
return not null Program.Elements.Formal_Package_Associations
.Formal_Package_Association_Access is
Result : constant Formal_Package_Association_Access :=
new (Self.Subpool) Program.Nodes.Formal_Package_Associations
.Formal_Package_Association'
(Program.Nodes.Formal_Package_Associations.Create
(Formal_Parameter => Formal_Parameter,
Arrow_Token => Arrow_Token,
Actual_Parameter => Actual_Parameter, Box_Token => Box_Token));
begin
return Program.Elements.Formal_Package_Associations
.Formal_Package_Association_Access
(Result);
end Create_Formal_Package_Association;
not overriding function Create_Null_Statement
(Self : Element_Factory;
Null_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Null_Statements.Null_Statement_Access is
Result : constant Null_Statement_Access :=
new (Self.Subpool) Program.Nodes.Null_Statements.Null_Statement'
(Program.Nodes.Null_Statements.Create
(Null_Token => Null_Token, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Null_Statements.Null_Statement_Access (Result);
end Create_Null_Statement;
not overriding function Create_Assignment_Statement
(Self : Element_Factory;
Variable_Name : not null Program.Elements.Expressions
.Expression_Access;
Assignment_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Expression : not null Program.Elements.Expressions
.Expression_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Assignment_Statements
.Assignment_Statement_Access is
Result : constant Assignment_Statement_Access :=
new (Self.Subpool) Program.Nodes.Assignment_Statements
.Assignment_Statement'
(Program.Nodes.Assignment_Statements.Create
(Variable_Name => Variable_Name,
Assignment_Token => Assignment_Token, Expression => Expression,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Assignment_Statements.Assignment_Statement_Access
(Result);
end Create_Assignment_Statement;
not overriding function Create_If_Statement
(Self : Element_Factory;
If_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Condition : not null Program.Elements.Expressions.Expression_Access;
Then_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Then_Statements : not null Program.Element_Vectors.Element_Vector_Access;
Elsif_Paths : Program.Elements.Elsif_Paths.Elsif_Path_Vector_Access;
Else_Token : Program.Lexical_Elements.Lexical_Element_Access;
Else_Statements : Program.Element_Vectors.Element_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
If_Token_2 : not null Program.Lexical_Elements
.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.If_Statements.If_Statement_Access is
Result : constant If_Statement_Access :=
new (Self.Subpool) Program.Nodes.If_Statements.If_Statement'
(Program.Nodes.If_Statements.Create
(If_Token => If_Token, Condition => Condition,
Then_Token => Then_Token, Then_Statements => Then_Statements,
Elsif_Paths => Elsif_Paths, Else_Token => Else_Token,
Else_Statements => Else_Statements, End_Token => End_Token,
If_Token_2 => If_Token_2, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.If_Statements.If_Statement_Access (Result);
end Create_If_Statement;
not overriding function Create_Case_Statement
(Self : Element_Factory;
Case_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Selecting_Expression : not null Program.Elements.Expressions
.Expression_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Paths : not null Program.Elements.Case_Paths
.Case_Path_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Case_Token_2 : not null Program.Lexical_Elements
.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Case_Statements.Case_Statement_Access is
Result : constant Case_Statement_Access :=
new (Self.Subpool) Program.Nodes.Case_Statements.Case_Statement'
(Program.Nodes.Case_Statements.Create
(Case_Token => Case_Token,
Selecting_Expression => Selecting_Expression,
Is_Token => Is_Token, Paths => Paths, End_Token => End_Token,
Case_Token_2 => Case_Token_2,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Case_Statements.Case_Statement_Access (Result);
end Create_Case_Statement;
not overriding function Create_Loop_Statement
(Self : Element_Factory;
Statement_Identifier : Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Colon_Token : Program.Lexical_Elements
.Lexical_Element_Access;
Loop_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Statements : not null Program.Element_Vectors
.Element_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Loop_Token_2 : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Statement_Identifier : Program.Elements.Identifiers.Identifier_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Loop_Statements.Loop_Statement_Access is
Result : constant Loop_Statement_Access :=
new (Self.Subpool) Program.Nodes.Loop_Statements.Loop_Statement'
(Program.Nodes.Loop_Statements.Create
(Statement_Identifier => Statement_Identifier,
Colon_Token => Colon_Token, Loop_Token => Loop_Token,
Statements => Statements, End_Token => End_Token,
Loop_Token_2 => Loop_Token_2,
End_Statement_Identifier => End_Statement_Identifier,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Loop_Statements.Loop_Statement_Access (Result);
end Create_Loop_Statement;
not overriding function Create_While_Loop_Statement
(Self : Element_Factory;
Statement_Identifier : Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Colon_Token : Program.Lexical_Elements
.Lexical_Element_Access;
While_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Condition : not null Program.Elements.Expressions
.Expression_Access;
Loop_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Statements : not null Program.Element_Vectors
.Element_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Loop_Token_2 : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Statement_Identifier : Program.Elements.Identifiers.Identifier_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.While_Loop_Statements
.While_Loop_Statement_Access is
Result : constant While_Loop_Statement_Access :=
new (Self.Subpool) Program.Nodes.While_Loop_Statements
.While_Loop_Statement'
(Program.Nodes.While_Loop_Statements.Create
(Statement_Identifier => Statement_Identifier,
Colon_Token => Colon_Token, While_Token => While_Token,
Condition => Condition, Loop_Token => Loop_Token,
Statements => Statements, End_Token => End_Token,
Loop_Token_2 => Loop_Token_2,
End_Statement_Identifier => End_Statement_Identifier,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.While_Loop_Statements.While_Loop_Statement_Access
(Result);
end Create_While_Loop_Statement;
not overriding function Create_For_Loop_Statement
(Self : Element_Factory;
Statement_Identifier : Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Colon_Token : Program.Lexical_Elements
.Lexical_Element_Access;
For_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Loop_Parameter : Program.Elements.Loop_Parameter_Specifications
.Loop_Parameter_Specification_Access;
Generalized_Iterator : Program.Elements
.Generalized_Iterator_Specifications
.Generalized_Iterator_Specification_Access;
Element_Iterator : Program.Elements
.Element_Iterator_Specifications
.Element_Iterator_Specification_Access;
Loop_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Statements : not null Program.Element_Vectors
.Element_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Loop_Token_2 : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Statement_Identifier : Program.Elements.Identifiers.Identifier_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.For_Loop_Statements
.For_Loop_Statement_Access is
Result : constant For_Loop_Statement_Access :=
new (Self.Subpool) Program.Nodes.For_Loop_Statements
.For_Loop_Statement'
(Program.Nodes.For_Loop_Statements.Create
(Statement_Identifier => Statement_Identifier,
Colon_Token => Colon_Token, For_Token => For_Token,
Loop_Parameter => Loop_Parameter,
Generalized_Iterator => Generalized_Iterator,
Element_Iterator => Element_Iterator, Loop_Token => Loop_Token,
Statements => Statements, End_Token => End_Token,
Loop_Token_2 => Loop_Token_2,
End_Statement_Identifier => End_Statement_Identifier,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.For_Loop_Statements.For_Loop_Statement_Access
(Result);
end Create_For_Loop_Statement;
not overriding function Create_Block_Statement
(Self : Element_Factory;
Statement_Identifier : Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Colon_Token : Program.Lexical_Elements
.Lexical_Element_Access;
Declare_Token : Program.Lexical_Elements
.Lexical_Element_Access;
Declarations : Program.Element_Vectors.Element_Vector_Access;
Begin_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Statements : not null Program.Element_Vectors
.Element_Vector_Access;
Exception_Token : Program.Lexical_Elements
.Lexical_Element_Access;
Exception_Handlers : Program.Elements.Exception_Handlers
.Exception_Handler_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Statement_Identifier : Program.Elements.Identifiers.Identifier_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Block_Statements
.Block_Statement_Access is
Result : constant Block_Statement_Access :=
new (Self.Subpool) Program.Nodes.Block_Statements.Block_Statement'
(Program.Nodes.Block_Statements.Create
(Statement_Identifier => Statement_Identifier,
Colon_Token => Colon_Token, Declare_Token => Declare_Token,
Declarations => Declarations, Begin_Token => Begin_Token,
Statements => Statements, Exception_Token => Exception_Token,
Exception_Handlers => Exception_Handlers,
End_Token => End_Token,
End_Statement_Identifier => End_Statement_Identifier,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Block_Statements.Block_Statement_Access (Result);
end Create_Block_Statement;
not overriding function Create_Exit_Statement
(Self : Element_Factory;
Exit_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Exit_Loop_Name : Program.Elements.Expressions.Expression_Access;
When_Token : Program.Lexical_Elements.Lexical_Element_Access;
Condition : Program.Elements.Expressions.Expression_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Exit_Statements.Exit_Statement_Access is
Result : constant Exit_Statement_Access :=
new (Self.Subpool) Program.Nodes.Exit_Statements.Exit_Statement'
(Program.Nodes.Exit_Statements.Create
(Exit_Token => Exit_Token, Exit_Loop_Name => Exit_Loop_Name,
When_Token => When_Token, Condition => Condition,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Exit_Statements.Exit_Statement_Access (Result);
end Create_Exit_Statement;
not overriding function Create_Goto_Statement
(Self : Element_Factory;
Goto_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Goto_Label : not null Program.Elements.Expressions.Expression_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Goto_Statements.Goto_Statement_Access is
Result : constant Goto_Statement_Access :=
new (Self.Subpool) Program.Nodes.Goto_Statements.Goto_Statement'
(Program.Nodes.Goto_Statements.Create
(Goto_Token => Goto_Token, Goto_Label => Goto_Label,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Goto_Statements.Goto_Statement_Access (Result);
end Create_Goto_Statement;
not overriding function Create_Call_Statement
(Self : Element_Factory;
Called_Name : not null Program.Elements.Expressions
.Expression_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Associations
.Parameter_Association_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Call_Statements.Call_Statement_Access is
Result : constant Call_Statement_Access :=
new (Self.Subpool) Program.Nodes.Call_Statements.Call_Statement'
(Program.Nodes.Call_Statements.Create
(Called_Name => Called_Name,
Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Call_Statements.Call_Statement_Access (Result);
end Create_Call_Statement;
not overriding function Create_Simple_Return_Statement
(Self : Element_Factory;
Return_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Expression : Program.Elements.Expressions.Expression_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Simple_Return_Statements
.Simple_Return_Statement_Access is
Result : constant Simple_Return_Statement_Access :=
new (Self.Subpool) Program.Nodes.Simple_Return_Statements
.Simple_Return_Statement'
(Program.Nodes.Simple_Return_Statements.Create
(Return_Token => Return_Token, Expression => Expression,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Simple_Return_Statements
.Simple_Return_Statement_Access
(Result);
end Create_Simple_Return_Statement;
not overriding function Create_Extended_Return_Statement
(Self : Element_Factory;
Return_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Return_Object : not null Program.Elements
.Return_Object_Specifications.Return_Object_Specification_Access;
Do_Token : Program.Lexical_Elements.Lexical_Element_Access;
Statements : Program.Element_Vectors.Element_Vector_Access;
Exception_Token : Program.Lexical_Elements.Lexical_Element_Access;
Exception_Handlers : Program.Elements.Exception_Handlers
.Exception_Handler_Vector_Access;
End_Token : Program.Lexical_Elements.Lexical_Element_Access;
Return_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Extended_Return_Statements
.Extended_Return_Statement_Access is
Result : constant Extended_Return_Statement_Access :=
new (Self.Subpool) Program.Nodes.Extended_Return_Statements
.Extended_Return_Statement'
(Program.Nodes.Extended_Return_Statements.Create
(Return_Token => Return_Token, Return_Object => Return_Object,
Do_Token => Do_Token, Statements => Statements,
Exception_Token => Exception_Token,
Exception_Handlers => Exception_Handlers,
End_Token => End_Token, Return_Token_2 => Return_Token_2,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Extended_Return_Statements
.Extended_Return_Statement_Access
(Result);
end Create_Extended_Return_Statement;
not overriding function Create_Accept_Statement
(Self : Element_Factory;
Accept_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Entry_Name : not null Program.Elements.Identifiers
.Identifier_Access;
Left_Bracket_Token : Program.Lexical_Elements
.Lexical_Element_Access;
Entry_Index : Program.Elements.Expressions.Expression_Access;
Right_Bracket_Token : Program.Lexical_Elements
.Lexical_Element_Access;
Left_Bracket_Token_2 : Program.Lexical_Elements
.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token_2 : Program.Lexical_Elements
.Lexical_Element_Access;
Do_Token : Program.Lexical_Elements
.Lexical_Element_Access;
Statements : Program.Element_Vectors.Element_Vector_Access;
Exception_Token : Program.Lexical_Elements
.Lexical_Element_Access;
Exception_Handlers : Program.Elements.Exception_Handlers
.Exception_Handler_Vector_Access;
End_Token : Program.Lexical_Elements
.Lexical_Element_Access;
End_Statement_Identifier : Program.Elements.Identifiers.Identifier_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Accept_Statements
.Accept_Statement_Access is
Result : constant Accept_Statement_Access :=
new (Self.Subpool) Program.Nodes.Accept_Statements.Accept_Statement'
(Program.Nodes.Accept_Statements.Create
(Accept_Token => Accept_Token, Entry_Name => Entry_Name,
Left_Bracket_Token => Left_Bracket_Token,
Entry_Index => Entry_Index,
Right_Bracket_Token => Right_Bracket_Token,
Left_Bracket_Token_2 => Left_Bracket_Token_2,
Parameters => Parameters,
Right_Bracket_Token_2 => Right_Bracket_Token_2,
Do_Token => Do_Token, Statements => Statements,
Exception_Token => Exception_Token,
Exception_Handlers => Exception_Handlers,
End_Token => End_Token,
End_Statement_Identifier => End_Statement_Identifier,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Accept_Statements.Accept_Statement_Access
(Result);
end Create_Accept_Statement;
not overriding function Create_Requeue_Statement
(Self : Element_Factory;
Requeue_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Entry_Name : not null Program.Elements.Expressions.Expression_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Abort_Token : Program.Lexical_Elements.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Requeue_Statements
.Requeue_Statement_Access is
Result : constant Requeue_Statement_Access :=
new (Self.Subpool) Program.Nodes.Requeue_Statements
.Requeue_Statement'
(Program.Nodes.Requeue_Statements.Create
(Requeue_Token => Requeue_Token, Entry_Name => Entry_Name,
With_Token => With_Token, Abort_Token => Abort_Token,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Requeue_Statements.Requeue_Statement_Access
(Result);
end Create_Requeue_Statement;
not overriding function Create_Delay_Statement
(Self : Element_Factory;
Delay_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Until_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Expression : not null Program.Elements.Expressions.Expression_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Delay_Statements
.Delay_Statement_Access is
Result : constant Delay_Statement_Access :=
new (Self.Subpool) Program.Nodes.Delay_Statements.Delay_Statement'
(Program.Nodes.Delay_Statements.Create
(Delay_Token => Delay_Token, Until_Token => Until_Token,
Expression => Expression, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Delay_Statements.Delay_Statement_Access (Result);
end Create_Delay_Statement;
not overriding function Create_Terminate_Alternative_Statement
(Self : Element_Factory;
Terminate_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Terminate_Alternative_Statements
.Terminate_Alternative_Statement_Access is
Result : constant Terminate_Alternative_Statement_Access :=
new (Self.Subpool) Program.Nodes.Terminate_Alternative_Statements
.Terminate_Alternative_Statement'
(Program.Nodes.Terminate_Alternative_Statements.Create
(Terminate_Token => Terminate_Token,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Terminate_Alternative_Statements
.Terminate_Alternative_Statement_Access
(Result);
end Create_Terminate_Alternative_Statement;
not overriding function Create_Select_Statement
(Self : Element_Factory;
Select_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Paths : not null Program.Elements.Select_Paths
.Select_Path_Vector_Access;
Then_Token : Program.Lexical_Elements.Lexical_Element_Access;
Abort_Token : Program.Lexical_Elements.Lexical_Element_Access;
Then_Abort_Statements : Program.Element_Vectors.Element_Vector_Access;
Else_Token : Program.Lexical_Elements.Lexical_Element_Access;
Else_Statements : Program.Element_Vectors.Element_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Select_Token_2 : not null Program.Lexical_Elements
.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Select_Statements
.Select_Statement_Access is
Result : constant Select_Statement_Access :=
new (Self.Subpool) Program.Nodes.Select_Statements.Select_Statement'
(Program.Nodes.Select_Statements.Create
(Select_Token => Select_Token, Paths => Paths,
Then_Token => Then_Token, Abort_Token => Abort_Token,
Then_Abort_Statements => Then_Abort_Statements,
Else_Token => Else_Token, Else_Statements => Else_Statements,
End_Token => End_Token, Select_Token_2 => Select_Token_2,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Select_Statements.Select_Statement_Access
(Result);
end Create_Select_Statement;
not overriding function Create_Abort_Statement
(Self : Element_Factory;
Abort_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Aborted_Tasks : not null Program.Elements.Expressions
.Expression_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Abort_Statements
.Abort_Statement_Access is
Result : constant Abort_Statement_Access :=
new (Self.Subpool) Program.Nodes.Abort_Statements.Abort_Statement'
(Program.Nodes.Abort_Statements.Create
(Abort_Token => Abort_Token, Aborted_Tasks => Aborted_Tasks,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Abort_Statements.Abort_Statement_Access (Result);
end Create_Abort_Statement;
not overriding function Create_Raise_Statement
(Self : Element_Factory;
Raise_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Raised_Exception : Program.Elements.Expressions.Expression_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Associated_Message : Program.Elements.Expressions.Expression_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Raise_Statements
.Raise_Statement_Access is
Result : constant Raise_Statement_Access :=
new (Self.Subpool) Program.Nodes.Raise_Statements.Raise_Statement'
(Program.Nodes.Raise_Statements.Create
(Raise_Token => Raise_Token,
Raised_Exception => Raised_Exception, With_Token => With_Token,
Associated_Message => Associated_Message,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Raise_Statements.Raise_Statement_Access (Result);
end Create_Raise_Statement;
not overriding function Create_Code_Statement
(Self : Element_Factory;
Expression : not null Program.Elements.Qualified_Expressions
.Qualified_Expression_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Code_Statements.Code_Statement_Access is
Result : constant Code_Statement_Access :=
new (Self.Subpool) Program.Nodes.Code_Statements.Code_Statement'
(Program.Nodes.Code_Statements.Create
(Expression => Expression, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Code_Statements.Code_Statement_Access (Result);
end Create_Code_Statement;
not overriding function Create_Elsif_Path
(Self : Element_Factory;
Elsif_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Condition : not null Program.Elements.Expressions.Expression_Access;
Then_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Statements : not null Program.Element_Vectors.Element_Vector_Access)
return not null Program.Elements.Elsif_Paths.Elsif_Path_Access is
Result : constant Elsif_Path_Access :=
new (Self.Subpool) Program.Nodes.Elsif_Paths.Elsif_Path'
(Program.Nodes.Elsif_Paths.Create
(Elsif_Token => Elsif_Token, Condition => Condition,
Then_Token => Then_Token, Statements => Statements));
begin
return Program.Elements.Elsif_Paths.Elsif_Path_Access (Result);
end Create_Elsif_Path;
not overriding function Create_Case_Path
(Self : Element_Factory;
When_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Choices : not null Program.Element_Vectors.Element_Vector_Access;
Arrow_Token : Program.Lexical_Elements.Lexical_Element_Access;
Statements : not null Program.Element_Vectors.Element_Vector_Access)
return not null Program.Elements.Case_Paths.Case_Path_Access is
Result : constant Case_Path_Access :=
new (Self.Subpool) Program.Nodes.Case_Paths.Case_Path'
(Program.Nodes.Case_Paths.Create
(When_Token => When_Token, Choices => Choices,
Arrow_Token => Arrow_Token, Statements => Statements));
begin
return Program.Elements.Case_Paths.Case_Path_Access (Result);
end Create_Case_Path;
not overriding function Create_Select_Path
(Self : Element_Factory;
When_Token : Program.Lexical_Elements.Lexical_Element_Access;
Guard : Program.Elements.Expressions.Expression_Access;
Arrow_Token : Program.Lexical_Elements.Lexical_Element_Access;
Statements : not null Program.Element_Vectors.Element_Vector_Access)
return not null Program.Elements.Select_Paths.Select_Path_Access is
Result : constant Select_Path_Access :=
new (Self.Subpool) Program.Nodes.Select_Paths.Select_Path'
(Program.Nodes.Select_Paths.Create
(When_Token => When_Token, Guard => Guard,
Arrow_Token => Arrow_Token, Statements => Statements));
begin
return Program.Elements.Select_Paths.Select_Path_Access (Result);
end Create_Select_Path;
not overriding function Create_Case_Expression_Path
(Self : Element_Factory;
When_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Choices : not null Program.Element_Vectors.Element_Vector_Access;
Arrow_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Expression : not null Program.Elements.Expressions.Expression_Access)
return not null Program.Elements.Case_Expression_Paths
.Case_Expression_Path_Access is
Result : constant Case_Expression_Path_Access :=
new (Self.Subpool) Program.Nodes.Case_Expression_Paths
.Case_Expression_Path'
(Program.Nodes.Case_Expression_Paths.Create
(When_Token => When_Token, Choices => Choices,
Arrow_Token => Arrow_Token, Expression => Expression));
begin
return Program.Elements.Case_Expression_Paths.Case_Expression_Path_Access
(Result);
end Create_Case_Expression_Path;
not overriding function Create_Elsif_Expression_Path
(Self : Element_Factory;
Elsif_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Condition : not null Program.Elements.Expressions.Expression_Access;
Then_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Expression : not null Program.Elements.Expressions.Expression_Access)
return not null Program.Elements.Elsif_Expression_Paths
.Elsif_Expression_Path_Access is
Result : constant Elsif_Expression_Path_Access :=
new (Self.Subpool) Program.Nodes.Elsif_Expression_Paths
.Elsif_Expression_Path'
(Program.Nodes.Elsif_Expression_Paths.Create
(Elsif_Token => Elsif_Token, Condition => Condition,
Then_Token => Then_Token, Expression => Expression));
begin
return Program.Elements.Elsif_Expression_Paths
.Elsif_Expression_Path_Access
(Result);
end Create_Elsif_Expression_Path;
not overriding function Create_Use_Clause
(Self : Element_Factory;
Use_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
All_Token : Program.Lexical_Elements.Lexical_Element_Access;
Type_Token : Program.Lexical_Elements.Lexical_Element_Access;
Clause_Names : not null Program.Elements.Expressions
.Expression_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Use_Clauses.Use_Clause_Access is
Result : constant Use_Clause_Access :=
new (Self.Subpool) Program.Nodes.Use_Clauses.Use_Clause'
(Program.Nodes.Use_Clauses.Create
(Use_Token => Use_Token, All_Token => All_Token,
Type_Token => Type_Token, Clause_Names => Clause_Names,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Use_Clauses.Use_Clause_Access (Result);
end Create_Use_Clause;
not overriding function Create_With_Clause
(Self : Element_Factory;
Limited_Token : Program.Lexical_Elements.Lexical_Element_Access;
Private_Token : Program.Lexical_Elements.Lexical_Element_Access;
With_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Clause_Names : not null Program.Elements.Expressions
.Expression_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.With_Clauses.With_Clause_Access is
Result : constant With_Clause_Access :=
new (Self.Subpool) Program.Nodes.With_Clauses.With_Clause'
(Program.Nodes.With_Clauses.Create
(Limited_Token => Limited_Token, Private_Token => Private_Token,
With_Token => With_Token, Clause_Names => Clause_Names,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.With_Clauses.With_Clause_Access (Result);
end Create_With_Clause;
not overriding function Create_Component_Clause
(Self : Element_Factory;
Clause_Name : not null Program.Elements.Identifiers.Identifier_Access;
At_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Position : not null Program.Elements.Expressions.Expression_Access;
Range_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Clause_Range : not null Program.Elements.Simple_Expression_Ranges
.Simple_Expression_Range_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Component_Clauses
.Component_Clause_Access is
Result : constant Component_Clause_Access :=
new (Self.Subpool) Program.Nodes.Component_Clauses.Component_Clause'
(Program.Nodes.Component_Clauses.Create
(Clause_Name => Clause_Name, At_Token => At_Token,
Position => Position, Range_Token => Range_Token,
Clause_Range => Clause_Range,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Component_Clauses.Component_Clause_Access
(Result);
end Create_Component_Clause;
not overriding function Create_Derived_Type
(Self : Element_Factory;
Abstract_Token : Program.Lexical_Elements.Lexical_Element_Access;
Limited_Token : Program.Lexical_Elements.Lexical_Element_Access;
New_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Parent : not null Program.Elements.Expressions.Expression_Access)
return not null Program.Elements.Derived_Types.Derived_Type_Access is
Result : constant Derived_Type_Access :=
new (Self.Subpool) Program.Nodes.Derived_Types.Derived_Type'
(Program.Nodes.Derived_Types.Create
(Abstract_Token => Abstract_Token,
Limited_Token => Limited_Token, New_Token => New_Token,
Parent => Parent));
begin
return Program.Elements.Derived_Types.Derived_Type_Access (Result);
end Create_Derived_Type;
not overriding function Create_Derived_Record_Extension
(Self : Element_Factory;
Abstract_Token : Program.Lexical_Elements.Lexical_Element_Access;
Limited_Token : Program.Lexical_Elements.Lexical_Element_Access;
New_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Parent : not null Program.Elements.Expressions
.Expression_Access;
And_Token : Program.Lexical_Elements.Lexical_Element_Access;
Progenitors : Program.Elements.Expressions.Expression_Vector_Access;
With_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Record_Definition : not null Program.Elements.Definitions
.Definition_Access)
return not null Program.Elements.Derived_Record_Extensions
.Derived_Record_Extension_Access is
Result : constant Derived_Record_Extension_Access :=
new (Self.Subpool) Program.Nodes.Derived_Record_Extensions
.Derived_Record_Extension'
(Program.Nodes.Derived_Record_Extensions.Create
(Abstract_Token => Abstract_Token,
Limited_Token => Limited_Token, New_Token => New_Token,
Parent => Parent, And_Token => And_Token,
Progenitors => Progenitors, With_Token => With_Token,
Record_Definition => Record_Definition));
begin
return Program.Elements.Derived_Record_Extensions
.Derived_Record_Extension_Access
(Result);
end Create_Derived_Record_Extension;
not overriding function Create_Enumeration_Type
(Self : Element_Factory;
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Literals : not null Program.Elements
.Enumeration_Literal_Specifications
.Enumeration_Literal_Specification_Vector_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Enumeration_Types
.Enumeration_Type_Access is
Result : constant Enumeration_Type_Access :=
new (Self.Subpool) Program.Nodes.Enumeration_Types.Enumeration_Type'
(Program.Nodes.Enumeration_Types.Create
(Left_Bracket_Token => Left_Bracket_Token, Literals => Literals,
Right_Bracket_Token => Right_Bracket_Token));
begin
return Program.Elements.Enumeration_Types.Enumeration_Type_Access
(Result);
end Create_Enumeration_Type;
not overriding function Create_Signed_Integer_Type
(Self : Element_Factory;
Range_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Lower_Bound : not null Program.Elements.Expressions
.Expression_Access;
Double_Dot_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Upper_Bound : not null Program.Elements.Expressions
.Expression_Access)
return not null Program.Elements.Signed_Integer_Types
.Signed_Integer_Type_Access is
Result : constant Signed_Integer_Type_Access :=
new (Self.Subpool) Program.Nodes.Signed_Integer_Types
.Signed_Integer_Type'
(Program.Nodes.Signed_Integer_Types.Create
(Range_Token => Range_Token, Lower_Bound => Lower_Bound,
Double_Dot_Token => Double_Dot_Token,
Upper_Bound => Upper_Bound));
begin
return Program.Elements.Signed_Integer_Types.Signed_Integer_Type_Access
(Result);
end Create_Signed_Integer_Type;
not overriding function Create_Modular_Type
(Self : Element_Factory;
Mod_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Modulus : not null Program.Elements.Expressions.Expression_Access)
return not null Program.Elements.Modular_Types.Modular_Type_Access is
Result : constant Modular_Type_Access :=
new (Self.Subpool) Program.Nodes.Modular_Types.Modular_Type'
(Program.Nodes.Modular_Types.Create
(Mod_Token => Mod_Token, Modulus => Modulus));
begin
return Program.Elements.Modular_Types.Modular_Type_Access (Result);
end Create_Modular_Type;
not overriding function Create_Root_Type
(Self : Element_Factory)
return not null Program.Elements.Root_Types.Root_Type_Access is
Result : constant Root_Type_Access :=
new (Self.Subpool) Program.Nodes.Root_Types.Root_Type;
begin
return Program.Elements.Root_Types.Root_Type_Access (Result);
end Create_Root_Type;
not overriding function Create_Floating_Point_Type
(Self : Element_Factory;
Digits_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Digits_Expression : not null Program.Elements.Expressions
.Expression_Access;
Real_Range : Program.Elements.Real_Range_Specifications
.Real_Range_Specification_Access)
return not null Program.Elements.Floating_Point_Types
.Floating_Point_Type_Access is
Result : constant Floating_Point_Type_Access :=
new (Self.Subpool) Program.Nodes.Floating_Point_Types
.Floating_Point_Type'
(Program.Nodes.Floating_Point_Types.Create
(Digits_Token => Digits_Token,
Digits_Expression => Digits_Expression,
Real_Range => Real_Range));
begin
return Program.Elements.Floating_Point_Types.Floating_Point_Type_Access
(Result);
end Create_Floating_Point_Type;
not overriding function Create_Ordinary_Fixed_Point_Type
(Self : Element_Factory;
Delta_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Delta_Expression : not null Program.Elements.Expressions
.Expression_Access;
Real_Range : not null Program.Elements.Real_Range_Specifications
.Real_Range_Specification_Access)
return not null Program.Elements.Ordinary_Fixed_Point_Types
.Ordinary_Fixed_Point_Type_Access is
Result : constant Ordinary_Fixed_Point_Type_Access :=
new (Self.Subpool) Program.Nodes.Ordinary_Fixed_Point_Types
.Ordinary_Fixed_Point_Type'
(Program.Nodes.Ordinary_Fixed_Point_Types.Create
(Delta_Token => Delta_Token,
Delta_Expression => Delta_Expression,
Real_Range => Real_Range));
begin
return Program.Elements.Ordinary_Fixed_Point_Types
.Ordinary_Fixed_Point_Type_Access
(Result);
end Create_Ordinary_Fixed_Point_Type;
not overriding function Create_Decimal_Fixed_Point_Type
(Self : Element_Factory;
Delta_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Delta_Expression : not null Program.Elements.Expressions
.Expression_Access;
Digits_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Digits_Expression : not null Program.Elements.Expressions
.Expression_Access;
Real_Range : Program.Elements.Real_Range_Specifications
.Real_Range_Specification_Access)
return not null Program.Elements.Decimal_Fixed_Point_Types
.Decimal_Fixed_Point_Type_Access is
Result : constant Decimal_Fixed_Point_Type_Access :=
new (Self.Subpool) Program.Nodes.Decimal_Fixed_Point_Types
.Decimal_Fixed_Point_Type'
(Program.Nodes.Decimal_Fixed_Point_Types.Create
(Delta_Token => Delta_Token,
Delta_Expression => Delta_Expression,
Digits_Token => Digits_Token,
Digits_Expression => Digits_Expression,
Real_Range => Real_Range));
begin
return Program.Elements.Decimal_Fixed_Point_Types
.Decimal_Fixed_Point_Type_Access
(Result);
end Create_Decimal_Fixed_Point_Type;
not overriding function Create_Unconstrained_Array_Type
(Self : Element_Factory;
Array_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Index_Subtypes : not null Program.Elements.Expressions
.Expression_Vector_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Of_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Component_Definition : not null Program.Elements.Component_Definitions
.Component_Definition_Access)
return not null Program.Elements.Unconstrained_Array_Types
.Unconstrained_Array_Type_Access is
Result : constant Unconstrained_Array_Type_Access :=
new (Self.Subpool) Program.Nodes.Unconstrained_Array_Types
.Unconstrained_Array_Type'
(Program.Nodes.Unconstrained_Array_Types.Create
(Array_Token => Array_Token,
Left_Bracket_Token => Left_Bracket_Token,
Index_Subtypes => Index_Subtypes,
Right_Bracket_Token => Right_Bracket_Token,
Of_Token => Of_Token,
Component_Definition => Component_Definition));
begin
return Program.Elements.Unconstrained_Array_Types
.Unconstrained_Array_Type_Access
(Result);
end Create_Unconstrained_Array_Type;
not overriding function Create_Constrained_Array_Type
(Self : Element_Factory;
Array_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Index_Subtypes : not null Program.Elements.Discrete_Ranges
.Discrete_Range_Vector_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Of_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Component_Definition : not null Program.Elements.Component_Definitions
.Component_Definition_Access)
return not null Program.Elements.Constrained_Array_Types
.Constrained_Array_Type_Access is
Result : constant Constrained_Array_Type_Access :=
new (Self.Subpool) Program.Nodes.Constrained_Array_Types
.Constrained_Array_Type'
(Program.Nodes.Constrained_Array_Types.Create
(Array_Token => Array_Token,
Left_Bracket_Token => Left_Bracket_Token,
Index_Subtypes => Index_Subtypes,
Right_Bracket_Token => Right_Bracket_Token,
Of_Token => Of_Token,
Component_Definition => Component_Definition));
begin
return Program.Elements.Constrained_Array_Types
.Constrained_Array_Type_Access
(Result);
end Create_Constrained_Array_Type;
not overriding function Create_Record_Type
(Self : Element_Factory;
Abstract_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Tagged_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Limited_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Record_Definition : not null Program.Elements.Definitions
.Definition_Access)
return not null Program.Elements.Record_Types.Record_Type_Access is
Result : constant Record_Type_Access :=
new (Self.Subpool) Program.Nodes.Record_Types.Record_Type'
(Program.Nodes.Record_Types.Create
(Abstract_Token => Abstract_Token, Tagged_Token => Tagged_Token,
Limited_Token => Limited_Token,
Record_Definition => Record_Definition));
begin
return Program.Elements.Record_Types.Record_Type_Access (Result);
end Create_Record_Type;
not overriding function Create_Interface_Type
(Self : Element_Factory;
Limited_Token : Program.Lexical_Elements.Lexical_Element_Access;
Task_Token : Program.Lexical_Elements.Lexical_Element_Access;
Protected_Token : Program.Lexical_Elements.Lexical_Element_Access;
Synchronized_Token : Program.Lexical_Elements.Lexical_Element_Access;
Interface_Token : Program.Lexical_Elements.Lexical_Element_Access;
And_Token : Program.Lexical_Elements.Lexical_Element_Access;
Progenitors : Program.Elements.Expressions
.Expression_Vector_Access)
return not null Program.Elements.Interface_Types.Interface_Type_Access is
Result : constant Interface_Type_Access :=
new (Self.Subpool) Program.Nodes.Interface_Types.Interface_Type'
(Program.Nodes.Interface_Types.Create
(Limited_Token => Limited_Token, Task_Token => Task_Token,
Protected_Token => Protected_Token,
Synchronized_Token => Synchronized_Token,
Interface_Token => Interface_Token, And_Token => And_Token,
Progenitors => Progenitors));
begin
return Program.Elements.Interface_Types.Interface_Type_Access (Result);
end Create_Interface_Type;
not overriding function Create_Object_Access_Type
(Self : Element_Factory;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Access_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
All_Token : Program.Lexical_Elements.Lexical_Element_Access;
Constant_Token : Program.Lexical_Elements.Lexical_Element_Access;
Subtype_Indication : not null Program.Elements.Subtype_Indications
.Subtype_Indication_Access)
return not null Program.Elements.Object_Access_Types
.Object_Access_Type_Access is
Result : constant Object_Access_Type_Access :=
new (Self.Subpool) Program.Nodes.Object_Access_Types
.Object_Access_Type'
(Program.Nodes.Object_Access_Types.Create
(Not_Token => Not_Token, Null_Token => Null_Token,
Access_Token => Access_Token, All_Token => All_Token,
Constant_Token => Constant_Token,
Subtype_Indication => Subtype_Indication));
begin
return Program.Elements.Object_Access_Types.Object_Access_Type_Access
(Result);
end Create_Object_Access_Type;
not overriding function Create_Procedure_Access_Type
(Self : Element_Factory;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Access_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Protected_Token : Program.Lexical_Elements.Lexical_Element_Access;
Procedure_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access)
return not null Program.Elements.Procedure_Access_Types
.Procedure_Access_Type_Access is
Result : constant Procedure_Access_Type_Access :=
new (Self.Subpool) Program.Nodes.Procedure_Access_Types
.Procedure_Access_Type'
(Program.Nodes.Procedure_Access_Types.Create
(Not_Token => Not_Token, Null_Token => Null_Token,
Access_Token => Access_Token,
Protected_Token => Protected_Token,
Procedure_Token => Procedure_Token,
Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token));
begin
return Program.Elements.Procedure_Access_Types
.Procedure_Access_Type_Access
(Result);
end Create_Procedure_Access_Type;
not overriding function Create_Function_Access_Type
(Self : Element_Factory;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Access_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Protected_Token : Program.Lexical_Elements.Lexical_Element_Access;
Function_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Return_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Not_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
Result_Subtype : not null Program.Elements.Element_Access)
return not null Program.Elements.Function_Access_Types
.Function_Access_Type_Access is
Result : constant Function_Access_Type_Access :=
new (Self.Subpool) Program.Nodes.Function_Access_Types
.Function_Access_Type'
(Program.Nodes.Function_Access_Types.Create
(Not_Token => Not_Token, Null_Token => Null_Token,
Access_Token => Access_Token,
Protected_Token => Protected_Token,
Function_Token => Function_Token,
Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token,
Return_Token => Return_Token, Not_Token_2 => Not_Token_2,
Null_Token_2 => Null_Token_2,
Result_Subtype => Result_Subtype));
begin
return Program.Elements.Function_Access_Types.Function_Access_Type_Access
(Result);
end Create_Function_Access_Type;
not overriding function Create_Formal_Private_Type_Definition
(Self : Element_Factory;
Abstract_Token : Program.Lexical_Elements.Lexical_Element_Access;
Tagged_Token : Program.Lexical_Elements.Lexical_Element_Access;
Limited_Token : Program.Lexical_Elements.Lexical_Element_Access;
Private_Token : not null Program.Lexical_Elements.Lexical_Element_Access)
return not null Program.Elements.Formal_Private_Type_Definitions
.Formal_Private_Type_Definition_Access is
Result : constant Formal_Private_Type_Definition_Access :=
new (Self.Subpool) Program.Nodes.Formal_Private_Type_Definitions
.Formal_Private_Type_Definition'
(Program.Nodes.Formal_Private_Type_Definitions.Create
(Abstract_Token => Abstract_Token, Tagged_Token => Tagged_Token,
Limited_Token => Limited_Token,
Private_Token => Private_Token));
begin
return Program.Elements.Formal_Private_Type_Definitions
.Formal_Private_Type_Definition_Access
(Result);
end Create_Formal_Private_Type_Definition;
not overriding function Create_Formal_Derived_Type_Definition
(Self : Element_Factory;
Abstract_Token : Program.Lexical_Elements.Lexical_Element_Access;
Limited_Token : Program.Lexical_Elements.Lexical_Element_Access;
Synchronized_Token : Program.Lexical_Elements.Lexical_Element_Access;
New_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Subtype_Mark : not null Program.Elements.Expressions
.Expression_Access;
And_Token : Program.Lexical_Elements.Lexical_Element_Access;
Progenitors : Program.Elements.Expressions
.Expression_Vector_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Private_Token : Program.Lexical_Elements.Lexical_Element_Access)
return not null Program.Elements.Formal_Derived_Type_Definitions
.Formal_Derived_Type_Definition_Access is
Result : constant Formal_Derived_Type_Definition_Access :=
new (Self.Subpool) Program.Nodes.Formal_Derived_Type_Definitions
.Formal_Derived_Type_Definition'
(Program.Nodes.Formal_Derived_Type_Definitions.Create
(Abstract_Token => Abstract_Token,
Limited_Token => Limited_Token,
Synchronized_Token => Synchronized_Token,
New_Token => New_Token, Subtype_Mark => Subtype_Mark,
And_Token => And_Token, Progenitors => Progenitors,
With_Token => With_Token, Private_Token => Private_Token));
begin
return Program.Elements.Formal_Derived_Type_Definitions
.Formal_Derived_Type_Definition_Access
(Result);
end Create_Formal_Derived_Type_Definition;
not overriding function Create_Formal_Discrete_Type_Definition
(Self : Element_Factory;
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Box_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Formal_Discrete_Type_Definitions
.Formal_Discrete_Type_Definition_Access is
Result : constant Formal_Discrete_Type_Definition_Access :=
new (Self.Subpool) Program.Nodes.Formal_Discrete_Type_Definitions
.Formal_Discrete_Type_Definition'
(Program.Nodes.Formal_Discrete_Type_Definitions.Create
(Left_Bracket_Token => Left_Bracket_Token,
Box_Token => Box_Token,
Right_Bracket_Token => Right_Bracket_Token));
begin
return Program.Elements.Formal_Discrete_Type_Definitions
.Formal_Discrete_Type_Definition_Access
(Result);
end Create_Formal_Discrete_Type_Definition;
not overriding function Create_Formal_Signed_Integer_Type_Definition
(Self : Element_Factory;
Range_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Box_Token : not null Program.Lexical_Elements.Lexical_Element_Access)
return not null Program.Elements.Formal_Signed_Integer_Type_Definitions
.Formal_Signed_Integer_Type_Definition_Access is
Result : constant Formal_Signed_Integer_Type_Definition_Access :=
new (Self.Subpool) Program.Nodes
.Formal_Signed_Integer_Type_Definitions
.Formal_Signed_Integer_Type_Definition'
(Program.Nodes.Formal_Signed_Integer_Type_Definitions.Create
(Range_Token => Range_Token, Box_Token => Box_Token));
begin
return Program.Elements.Formal_Signed_Integer_Type_Definitions
.Formal_Signed_Integer_Type_Definition_Access
(Result);
end Create_Formal_Signed_Integer_Type_Definition;
not overriding function Create_Formal_Modular_Type_Definition
(Self : Element_Factory;
Mod_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Box_Token : not null Program.Lexical_Elements.Lexical_Element_Access)
return not null Program.Elements.Formal_Modular_Type_Definitions
.Formal_Modular_Type_Definition_Access is
Result : constant Formal_Modular_Type_Definition_Access :=
new (Self.Subpool) Program.Nodes.Formal_Modular_Type_Definitions
.Formal_Modular_Type_Definition'
(Program.Nodes.Formal_Modular_Type_Definitions.Create
(Mod_Token => Mod_Token, Box_Token => Box_Token));
begin
return Program.Elements.Formal_Modular_Type_Definitions
.Formal_Modular_Type_Definition_Access
(Result);
end Create_Formal_Modular_Type_Definition;
not overriding function Create_Formal_Floating_Point_Definition
(Self : Element_Factory;
Digits_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Box_Token : not null Program.Lexical_Elements.Lexical_Element_Access)
return not null Program.Elements.Formal_Floating_Point_Definitions
.Formal_Floating_Point_Definition_Access is
Result : constant Formal_Floating_Point_Definition_Access :=
new (Self.Subpool) Program.Nodes.Formal_Floating_Point_Definitions
.Formal_Floating_Point_Definition'
(Program.Nodes.Formal_Floating_Point_Definitions.Create
(Digits_Token => Digits_Token, Box_Token => Box_Token));
begin
return Program.Elements.Formal_Floating_Point_Definitions
.Formal_Floating_Point_Definition_Access
(Result);
end Create_Formal_Floating_Point_Definition;
not overriding function Create_Formal_Ordinary_Fixed_Point_Definition
(Self : Element_Factory;
Delta_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Box_Token : not null Program.Lexical_Elements.Lexical_Element_Access)
return not null Program.Elements.Formal_Ordinary_Fixed_Point_Definitions
.Formal_Ordinary_Fixed_Point_Definition_Access is
Result : constant Formal_Ordinary_Fixed_Point_Definition_Access :=
new (Self.Subpool) Program.Nodes
.Formal_Ordinary_Fixed_Point_Definitions
.Formal_Ordinary_Fixed_Point_Definition'
(Program.Nodes.Formal_Ordinary_Fixed_Point_Definitions.Create
(Delta_Token => Delta_Token, Box_Token => Box_Token));
begin
return Program.Elements.Formal_Ordinary_Fixed_Point_Definitions
.Formal_Ordinary_Fixed_Point_Definition_Access
(Result);
end Create_Formal_Ordinary_Fixed_Point_Definition;
not overriding function Create_Formal_Decimal_Fixed_Point_Definition
(Self : Element_Factory;
Delta_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Box_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Digits_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Box_Token_2 : not null Program.Lexical_Elements.Lexical_Element_Access)
return not null Program.Elements.Formal_Decimal_Fixed_Point_Definitions
.Formal_Decimal_Fixed_Point_Definition_Access is
Result : constant Formal_Decimal_Fixed_Point_Definition_Access :=
new (Self.Subpool) Program.Nodes
.Formal_Decimal_Fixed_Point_Definitions
.Formal_Decimal_Fixed_Point_Definition'
(Program.Nodes.Formal_Decimal_Fixed_Point_Definitions.Create
(Delta_Token => Delta_Token, Box_Token => Box_Token,
Digits_Token => Digits_Token, Box_Token_2 => Box_Token_2));
begin
return Program.Elements.Formal_Decimal_Fixed_Point_Definitions
.Formal_Decimal_Fixed_Point_Definition_Access
(Result);
end Create_Formal_Decimal_Fixed_Point_Definition;
not overriding function Create_Formal_Unconstrained_Array_Type
(Self : Element_Factory;
Array_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Index_Subtypes : not null Program.Elements.Expressions
.Expression_Vector_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Of_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Component_Definition : not null Program.Elements.Component_Definitions
.Component_Definition_Access)
return not null Program.Elements.Formal_Unconstrained_Array_Types
.Formal_Unconstrained_Array_Type_Access is
Result : constant Formal_Unconstrained_Array_Type_Access :=
new (Self.Subpool) Program.Nodes.Formal_Unconstrained_Array_Types
.Formal_Unconstrained_Array_Type'
(Program.Nodes.Formal_Unconstrained_Array_Types.Create
(Array_Token => Array_Token,
Left_Bracket_Token => Left_Bracket_Token,
Index_Subtypes => Index_Subtypes,
Right_Bracket_Token => Right_Bracket_Token,
Of_Token => Of_Token,
Component_Definition => Component_Definition));
begin
return Program.Elements.Formal_Unconstrained_Array_Types
.Formal_Unconstrained_Array_Type_Access
(Result);
end Create_Formal_Unconstrained_Array_Type;
not overriding function Create_Formal_Constrained_Array_Type
(Self : Element_Factory;
Array_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Index_Subtypes : not null Program.Elements.Discrete_Ranges
.Discrete_Range_Vector_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Of_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Component_Definition : not null Program.Elements.Component_Definitions
.Component_Definition_Access)
return not null Program.Elements.Formal_Constrained_Array_Types
.Formal_Constrained_Array_Type_Access is
Result : constant Formal_Constrained_Array_Type_Access :=
new (Self.Subpool) Program.Nodes.Formal_Constrained_Array_Types
.Formal_Constrained_Array_Type'
(Program.Nodes.Formal_Constrained_Array_Types.Create
(Array_Token => Array_Token,
Left_Bracket_Token => Left_Bracket_Token,
Index_Subtypes => Index_Subtypes,
Right_Bracket_Token => Right_Bracket_Token,
Of_Token => Of_Token,
Component_Definition => Component_Definition));
begin
return Program.Elements.Formal_Constrained_Array_Types
.Formal_Constrained_Array_Type_Access
(Result);
end Create_Formal_Constrained_Array_Type;
not overriding function Create_Formal_Object_Access_Type
(Self : Element_Factory;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Access_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
All_Token : Program.Lexical_Elements.Lexical_Element_Access;
Constant_Token : Program.Lexical_Elements.Lexical_Element_Access;
Subtype_Indication : not null Program.Elements.Subtype_Indications
.Subtype_Indication_Access)
return not null Program.Elements.Formal_Object_Access_Types
.Formal_Object_Access_Type_Access is
Result : constant Formal_Object_Access_Type_Access :=
new (Self.Subpool) Program.Nodes.Formal_Object_Access_Types
.Formal_Object_Access_Type'
(Program.Nodes.Formal_Object_Access_Types.Create
(Not_Token => Not_Token, Null_Token => Null_Token,
Access_Token => Access_Token, All_Token => All_Token,
Constant_Token => Constant_Token,
Subtype_Indication => Subtype_Indication));
begin
return Program.Elements.Formal_Object_Access_Types
.Formal_Object_Access_Type_Access
(Result);
end Create_Formal_Object_Access_Type;
not overriding function Create_Formal_Procedure_Access_Type
(Self : Element_Factory;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Access_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Protected_Token : Program.Lexical_Elements.Lexical_Element_Access;
Procedure_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access)
return not null Program.Elements.Formal_Procedure_Access_Types
.Formal_Procedure_Access_Type_Access is
Result : constant Formal_Procedure_Access_Type_Access :=
new (Self.Subpool) Program.Nodes.Formal_Procedure_Access_Types
.Formal_Procedure_Access_Type'
(Program.Nodes.Formal_Procedure_Access_Types.Create
(Not_Token => Not_Token, Null_Token => Null_Token,
Access_Token => Access_Token,
Protected_Token => Protected_Token,
Procedure_Token => Procedure_Token,
Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token));
begin
return Program.Elements.Formal_Procedure_Access_Types
.Formal_Procedure_Access_Type_Access
(Result);
end Create_Formal_Procedure_Access_Type;
not overriding function Create_Formal_Function_Access_Type
(Self : Element_Factory;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Access_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Protected_Token : Program.Lexical_Elements.Lexical_Element_Access;
Function_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Return_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Not_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
Result_Subtype : not null Program.Elements.Element_Access)
return not null Program.Elements.Formal_Function_Access_Types
.Formal_Function_Access_Type_Access is
Result : constant Formal_Function_Access_Type_Access :=
new (Self.Subpool) Program.Nodes.Formal_Function_Access_Types
.Formal_Function_Access_Type'
(Program.Nodes.Formal_Function_Access_Types.Create
(Not_Token => Not_Token, Null_Token => Null_Token,
Access_Token => Access_Token,
Protected_Token => Protected_Token,
Function_Token => Function_Token,
Left_Bracket_Token => Left_Bracket_Token,
Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token,
Return_Token => Return_Token, Not_Token_2 => Not_Token_2,
Null_Token_2 => Null_Token_2,
Result_Subtype => Result_Subtype));
begin
return Program.Elements.Formal_Function_Access_Types
.Formal_Function_Access_Type_Access
(Result);
end Create_Formal_Function_Access_Type;
not overriding function Create_Formal_Interface_Type
(Self : Element_Factory;
Limited_Token : Program.Lexical_Elements.Lexical_Element_Access;
Task_Token : Program.Lexical_Elements.Lexical_Element_Access;
Protected_Token : Program.Lexical_Elements.Lexical_Element_Access;
Synchronized_Token : Program.Lexical_Elements.Lexical_Element_Access;
Interface_Token : Program.Lexical_Elements.Lexical_Element_Access;
And_Token : Program.Lexical_Elements.Lexical_Element_Access;
Progenitors : Program.Elements.Expressions
.Expression_Vector_Access)
return not null Program.Elements.Formal_Interface_Types
.Formal_Interface_Type_Access is
Result : constant Formal_Interface_Type_Access :=
new (Self.Subpool) Program.Nodes.Formal_Interface_Types
.Formal_Interface_Type'
(Program.Nodes.Formal_Interface_Types.Create
(Limited_Token => Limited_Token, Task_Token => Task_Token,
Protected_Token => Protected_Token,
Synchronized_Token => Synchronized_Token,
Interface_Token => Interface_Token, And_Token => And_Token,
Progenitors => Progenitors));
begin
return Program.Elements.Formal_Interface_Types
.Formal_Interface_Type_Access
(Result);
end Create_Formal_Interface_Type;
not overriding function Create_Range_Attribute_Reference
(Self : Element_Factory;
Range_Attribute : not null Program.Elements.Attribute_References
.Attribute_Reference_Access)
return not null Program.Elements.Range_Attribute_References
.Range_Attribute_Reference_Access is
Result : constant Range_Attribute_Reference_Access :=
new (Self.Subpool) Program.Nodes.Range_Attribute_References
.Range_Attribute_Reference'
(Program.Nodes.Range_Attribute_References.Create
(Range_Attribute => Range_Attribute));
begin
return Program.Elements.Range_Attribute_References
.Range_Attribute_Reference_Access
(Result);
end Create_Range_Attribute_Reference;
not overriding function Create_Simple_Expression_Range
(Self : Element_Factory;
Lower_Bound : not null Program.Elements.Expressions
.Expression_Access;
Double_Dot_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Upper_Bound : not null Program.Elements.Expressions
.Expression_Access)
return not null Program.Elements.Simple_Expression_Ranges
.Simple_Expression_Range_Access is
Result : constant Simple_Expression_Range_Access :=
new (Self.Subpool) Program.Nodes.Simple_Expression_Ranges
.Simple_Expression_Range'
(Program.Nodes.Simple_Expression_Ranges.Create
(Lower_Bound => Lower_Bound,
Double_Dot_Token => Double_Dot_Token,
Upper_Bound => Upper_Bound));
begin
return Program.Elements.Simple_Expression_Ranges
.Simple_Expression_Range_Access
(Result);
end Create_Simple_Expression_Range;
not overriding function Create_Digits_Constraint
(Self : Element_Factory;
Digits_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Digits_Expression : not null Program.Elements.Expressions
.Expression_Access;
Range_Token : Program.Lexical_Elements.Lexical_Element_Access;
Real_Range_Constraint : Program.Elements.Constraints.Constraint_Access)
return not null Program.Elements.Digits_Constraints
.Digits_Constraint_Access is
Result : constant Digits_Constraint_Access :=
new (Self.Subpool) Program.Nodes.Digits_Constraints
.Digits_Constraint'
(Program.Nodes.Digits_Constraints.Create
(Digits_Token => Digits_Token,
Digits_Expression => Digits_Expression,
Range_Token => Range_Token,
Real_Range_Constraint => Real_Range_Constraint));
begin
return Program.Elements.Digits_Constraints.Digits_Constraint_Access
(Result);
end Create_Digits_Constraint;
not overriding function Create_Delta_Constraint
(Self : Element_Factory;
Delta_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Delta_Expression : not null Program.Elements.Expressions
.Expression_Access;
Range_Token : Program.Lexical_Elements.Lexical_Element_Access;
Real_Range_Constraint : Program.Elements.Constraints.Constraint_Access)
return not null Program.Elements.Delta_Constraints
.Delta_Constraint_Access is
Result : constant Delta_Constraint_Access :=
new (Self.Subpool) Program.Nodes.Delta_Constraints.Delta_Constraint'
(Program.Nodes.Delta_Constraints.Create
(Delta_Token => Delta_Token,
Delta_Expression => Delta_Expression,
Range_Token => Range_Token,
Real_Range_Constraint => Real_Range_Constraint));
begin
return Program.Elements.Delta_Constraints.Delta_Constraint_Access
(Result);
end Create_Delta_Constraint;
not overriding function Create_Index_Constraint
(Self : Element_Factory;
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Ranges : not null Program.Elements.Discrete_Ranges
.Discrete_Range_Vector_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Index_Constraints
.Index_Constraint_Access is
Result : constant Index_Constraint_Access :=
new (Self.Subpool) Program.Nodes.Index_Constraints.Index_Constraint'
(Program.Nodes.Index_Constraints.Create
(Left_Bracket_Token => Left_Bracket_Token, Ranges => Ranges,
Right_Bracket_Token => Right_Bracket_Token));
begin
return Program.Elements.Index_Constraints.Index_Constraint_Access
(Result);
end Create_Index_Constraint;
not overriding function Create_Discriminant_Constraint
(Self : Element_Factory;
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Discriminants : not null Program.Elements.Discriminant_Associations
.Discriminant_Association_Vector_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Discriminant_Constraints
.Discriminant_Constraint_Access is
Result : constant Discriminant_Constraint_Access :=
new (Self.Subpool) Program.Nodes.Discriminant_Constraints
.Discriminant_Constraint'
(Program.Nodes.Discriminant_Constraints.Create
(Left_Bracket_Token => Left_Bracket_Token,
Discriminants => Discriminants,
Right_Bracket_Token => Right_Bracket_Token));
begin
return Program.Elements.Discriminant_Constraints
.Discriminant_Constraint_Access
(Result);
end Create_Discriminant_Constraint;
not overriding function Create_Attribute_Definition_Clause
(Self : Element_Factory;
For_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Expressions.Expression_Access;
Use_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Expression : not null Program.Elements.Expressions.Expression_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Attribute_Definition_Clauses
.Attribute_Definition_Clause_Access is
Result : constant Attribute_Definition_Clause_Access :=
new (Self.Subpool) Program.Nodes.Attribute_Definition_Clauses
.Attribute_Definition_Clause'
(Program.Nodes.Attribute_Definition_Clauses.Create
(For_Token => For_Token, Name => Name, Use_Token => Use_Token,
Expression => Expression, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Attribute_Definition_Clauses
.Attribute_Definition_Clause_Access
(Result);
end Create_Attribute_Definition_Clause;
not overriding function Create_Enumeration_Representation_Clause
(Self : Element_Factory;
For_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Expressions.Expression_Access;
Use_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Expression : not null Program.Elements.Array_Aggregates
.Array_Aggregate_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Enumeration_Representation_Clauses
.Enumeration_Representation_Clause_Access is
Result : constant Enumeration_Representation_Clause_Access :=
new (Self.Subpool) Program.Nodes.Enumeration_Representation_Clauses
.Enumeration_Representation_Clause'
(Program.Nodes.Enumeration_Representation_Clauses.Create
(For_Token => For_Token, Name => Name, Use_Token => Use_Token,
Expression => Expression, Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Enumeration_Representation_Clauses
.Enumeration_Representation_Clause_Access
(Result);
end Create_Enumeration_Representation_Clause;
not overriding function Create_Record_Representation_Clause
(Self : Element_Factory;
For_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Expressions
.Expression_Access;
Use_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Record_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
At_Token : Program.Lexical_Elements.Lexical_Element_Access;
Mod_Token : Program.Lexical_Elements.Lexical_Element_Access;
Mod_Clause_Expression : Program.Elements.Expressions.Expression_Access;
Mod_Semicolon_Token : Program.Lexical_Elements.Lexical_Element_Access;
Component_Clauses : not null Program.Elements.Component_Clauses
.Component_Clause_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.Record_Representation_Clauses
.Record_Representation_Clause_Access is
Result : constant Record_Representation_Clause_Access :=
new (Self.Subpool) Program.Nodes.Record_Representation_Clauses
.Record_Representation_Clause'
(Program.Nodes.Record_Representation_Clauses.Create
(For_Token => For_Token, Name => Name, Use_Token => Use_Token,
Record_Token => Record_Token, At_Token => At_Token,
Mod_Token => Mod_Token,
Mod_Clause_Expression => Mod_Clause_Expression,
Mod_Semicolon_Token => Mod_Semicolon_Token,
Component_Clauses => Component_Clauses,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.Record_Representation_Clauses
.Record_Representation_Clause_Access
(Result);
end Create_Record_Representation_Clause;
not overriding function Create_At_Clause
(Self : Element_Factory;
For_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Identifiers.Identifier_Access;
Use_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
At_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Expression : not null Program.Elements.Expressions.Expression_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return not null Program.Elements.At_Clauses.At_Clause_Access is
Result : constant At_Clause_Access :=
new (Self.Subpool) Program.Nodes.At_Clauses.At_Clause'
(Program.Nodes.At_Clauses.Create
(For_Token => For_Token, Name => Name, Use_Token => Use_Token,
At_Token => At_Token, Expression => Expression,
Semicolon_Token => Semicolon_Token));
begin
return Program.Elements.At_Clauses.At_Clause_Access (Result);
end Create_At_Clause;
not overriding function Create_Exception_Handler
(Self : Element_Factory;
When_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Choice_Parameter : Program.Elements.Choice_Parameter_Specifications
.Choice_Parameter_Specification_Access;
Choices : not null Program.Element_Vectors.Element_Vector_Access;
Arrow_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Statements : not null Program.Element_Vectors.Element_Vector_Access)
return not null Program.Elements.Exception_Handlers
.Exception_Handler_Access is
Result : constant Exception_Handler_Access :=
new (Self.Subpool) Program.Nodes.Exception_Handlers
.Exception_Handler'
(Program.Nodes.Exception_Handlers.Create
(When_Token => When_Token, Choice_Parameter => Choice_Parameter,
Choices => Choices, Arrow_Token => Arrow_Token,
Statements => Statements));
begin
return Program.Elements.Exception_Handlers.Exception_Handler_Access
(Result);
end Create_Exception_Handler;
end Program.Element_Factories;
|
flyx/OpenGLAda | Ada | 5,766 | adb | -- part of OpenGLAda, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "COPYING"
with Ada.Strings.Fixed;
with Interfaces.C.Strings;
with GL.API;
with GL.Enums.Getter;
with GL.Errors;
package body GL.Context is
function Major_Version return Int is
Result : aliased Int;
begin
API.Get_Integer (Enums.Getter.Major_Version, Result'Access);
Raise_Exception_On_OpenGL_Error;
return Result;
end Major_Version;
function Minor_Version return Int is
Result : aliased Int;
begin
API.Get_Integer (Enums.Getter.Minor_Version, Result'Access);
Raise_Exception_On_OpenGL_Error;
return Result;
end Minor_Version;
function Version_String return String is
begin
return C.Strings.Value (API.Get_String (Enums.Getter.Version));
end Version_String;
function Vendor return String is
begin
return C.Strings.Value (API.Get_String (Enums.Getter.Vendor));
end Vendor;
function Renderer return String is
begin
return C.Strings.Value (API.Get_String (Enums.Getter.Renderer));
end Renderer;
function Extensions return String_List is
use Ada.Strings.Unbounded;
use type Errors.Error_Code;
Count : aliased Int;
begin
API.Get_Integer (Enums.Getter.Num_Extensions, Count'Access);
if API.Get_Error = Errors.No_Error then
-- we are on OpenGL 3
return List : String_List (1 .. Positive (Count)) do
for I in List'Range loop
List (I) := To_Unbounded_String
(C.Strings.Value (API.Get_String_I
(Enums.Getter.Extensions, UInt (I - 1))));
end loop;
end return;
else
-- OpenGL 2 fallback
declare
Raw : constant String := C.Strings.Value
(API.Get_String (Enums.Getter.Extensions));
Cur_Pos : Positive := Raw'First;
Next_Space : Natural;
begin
if Raw'Length = 0 then
return Null_String_List;
end if;
return List : String_List
(1 .. Ada.Strings.Fixed.Count (Raw, " ") + 1) do
for I in List'Range loop
Next_Space := Ada.Strings.Fixed.Index (Raw, " ", Cur_Pos);
if Next_Space = 0 then
-- this is the last token, there is no space behind it.
Next_Space := Raw'Last + 1;
end if;
List (I) := To_Unbounded_String
(Raw (Cur_Pos .. Next_Space - 1));
Cur_Pos := Next_Space + 1;
end loop;
end return;
end;
end if;
end Extensions;
function Has_Extension (Name : String) return Boolean is
use type Errors.Error_Code;
Count : aliased Int;
begin
API.Get_Integer (Enums.Getter.Num_Extensions, Count'Access);
if API.Get_Error = Errors.No_Error then
-- we are on OpenGL 3
for I in 1 .. Count loop
declare
Extension : constant String := C.Strings.Value
(API.Get_String_I (Enums.Getter.Extensions, UInt (I - 1)));
begin
if Extension = Name then
return True;
end if;
end;
end loop;
else
-- OpenGL 2 fallback
declare
Raw : constant String := C.Strings.Value
(API.Get_String (Enums.Getter.Extensions));
Cur_Pos : Positive := Raw'First;
Next_Space : Natural;
begin
if Raw'Length = 0 then
return False;
end if;
for I in 1 .. Ada.Strings.Fixed.Count (Raw, " ") + 1 loop
Next_Space := Ada.Strings.Fixed.Index (Raw, " ", Cur_Pos);
if Next_Space = 0 then
Next_Space := Raw'Last + 1;
end if;
if Raw (Cur_Pos .. Next_Space - 1) = Name then
return True;
end if;
Cur_Pos := Next_Space + 1;
end loop;
end;
end if;
return False;
end Has_Extension;
function Primary_Shading_Language_Version return String is
Result : constant String := C.Strings.Value
(API.Get_String (Enums.Getter.Shading_Language_Version));
begin
Raise_Exception_On_OpenGL_Error;
return Result;
end Primary_Shading_Language_Version;
function Supported_Shading_Language_Versions return String_List is
use Ada.Strings.Unbounded;
use type Errors.Error_Code;
Count : aliased Int;
begin
API.Get_Integer (Enums.Getter.Num_Shading_Language_Versions, Count'Access);
if API.Get_Error = Errors.Invalid_Enum then
raise Feature_Not_Supported_Exception;
end if;
return List : String_List (1 .. Positive (Count)) do
for I in List'Range loop
List (I) := To_Unbounded_String
(C.Strings.Value (API.Get_String_I (
Enums.Getter.Shading_Language_Version, UInt (I - 1))));
end loop;
end return;
end Supported_Shading_Language_Versions;
function Supports_Shading_Language_Version (Name : String) return Boolean is
Count : aliased Int;
begin
API.Get_Integer (Enums.Getter.Num_Shading_Language_Versions, Count'Access);
Raise_Exception_On_OpenGL_Error;
for I in 1 .. Count loop
if C.Strings.Value
(API.Get_String_I (Enums.Getter.Shading_Language_Version,
UInt (I - 1))) = Name then
return True;
end if;
end loop;
return False;
end Supports_Shading_Language_Version;
end GL.Context;
|
io7m/coreland-opengl-ada | Ada | 2,499 | ads | with OpenGL.Thin;
with OpenGL.Vertex;
package OpenGL.Vertex_Array is
type Attribute_Index_t is new Thin.Unsigned_Integer_t;
type Attribute_Count_t is new Thin.Size_t range 0 .. Thin.Size_t'Last;
-- proc_map : glEnableVertexAttribArray
procedure Enable_Attribute_Array
(Index : in Attribute_Index_t);
pragma Inline (Enable_Attribute_Array);
-- proc_map : glDisableVertexAttribArray
procedure Disable_Attribute_Array
(Index : in Attribute_Index_t);
pragma Inline (Disable_Attribute_Array);
--
-- Array name management.
--
type Array_Index_t is new Thin.Unsigned_Integer_t;
type Array_Index_Array_t is array (Natural range <>) of aliased Array_Index_t;
pragma Convention (C, Array_Index_Array_t);
-- proc_map : glGenVertexArrays
procedure Generate_Arrays
(Arrays : in out Array_Index_Array_t);
pragma Inline (Generate_Arrays);
-- proc_map : glDeleteVertexArrays
procedure Delete_Arrays
(Arrays : in Array_Index_Array_t);
pragma Inline (Delete_Arrays);
--
-- Array binding.
--
-- proc_map : glBindVertexArray
procedure Bind_Array
(Index : in Array_Index_t);
pragma Inline (Bind_Array);
--
-- Render arrays.
--
-- proc_map : glDrawArrays
procedure Draw_Arrays
(Mode : in OpenGL.Vertex.Primitive_Type_t;
First : in Attribute_Index_t;
Count : in Attribute_Count_t);
pragma Inline (Draw_Arrays);
--
-- Pointer
--
type Coords_Per_Vertex_t is range 2 .. 4;
type Integer_Coordinate_Type_t is (Integer, Short);
generic
Vertex_Type : Integer_Coordinate_Type_t;
type Vertex_Element_t is range <>;
type Vertex_Array_Index_t is range <>;
type Vertex_Array_t is array (Vertex_Array_Index_t range <>) of aliased Vertex_Element_t;
-- proc_map : glVertexPointer
procedure Pointer_Integer
(Data : in Vertex_Array_t;
Coords_Per_Vertex : in Coords_Per_Vertex_t;
Stride : in Natural);
type Float_Coordinate_Type_t is (Float, Double);
generic
Vertex_Type : Float_Coordinate_Type_t;
type Vertex_Element_t is digits <>;
type Vertex_Array_Index_t is range <>;
type Vertex_Array_t is array (Vertex_Array_Index_t range <>) of aliased Vertex_Element_t;
-- proc_map : glVertexPointer
procedure Pointer_Float
(Data : in Vertex_Array_t;
Coords_Per_Vertex : in Coords_Per_Vertex_t;
Stride : in Natural);
end OpenGL.Vertex_Array;
|
AdaCore/gpr | Ada | 955 | adb | with p7_1; use p7_1;
package body p7_0 is
function p7_0_0 (Item : Integer) return Integer is
Result : Long_Long_Integer;
begin
if Item < 0 then
return -Item;
end if;
Result := Long_Long_Integer (p7_1_0 (Item - 1)) + 700;
return Integer (Result rem Long_Long_Integer (Integer'Last));
end p7_0_0;
function p7_0_1 (Item : Integer) return Integer is
Result : Long_Long_Integer;
begin
if Item < 0 then
return -Item;
end if;
Result := Long_Long_Integer (p7_1_1 (Item - 1)) + 701;
return Integer (Result rem Long_Long_Integer (Integer'Last));
end p7_0_1;
function p7_0_2 (Item : Integer) return Integer is
Result : Long_Long_Integer;
begin
if Item < 0 then
return -Item;
end if;
Result := Long_Long_Integer (p7_1_2 (Item - 1)) + 702;
return Integer (Result rem Long_Long_Integer (Integer'Last));
end p7_0_2;
end p7_0;
|
AdaCore/libadalang | Ada | 2,289 | ads | --
-- Copyright (C) 2014-2022, AdaCore
-- SPDX-License-Identifier: Apache-2.0
--
with GNATCOLL.GMP.Integers;
with GNATCOLL.GMP.Rational_Numbers;
with Langkit_Support.Symbols; use Langkit_Support.Symbols;
-- General helpers to deal with sources text decoding
package Libadalang.Sources is
use Support.Text;
procedure Decode_Brackets
(Pattern : Text_Type;
Error : out Boolean;
Result : out Wide_Wide_Character)
with Inline;
-- Assuming Pattern is a bracket encoding for a character of the form:
-- ["DIGITS"]
-- where DIGITS is a sequence of 2, 4, 6 or 8 hexadecimal characters,
-- return the corresponding character. Raise a
-- Libadalang.Lexer.Invalid_Input if Pattern is invalid.
function Canonicalize (Name : Text_Type) return Symbolization_Result
with Inline;
-- Return a canonicalized name for Name. This performs case folding and
-- brackets decoding.
function Decode_Character_Literal (Text : Text_Type) return Character_Type;
-- Turn Text, a valid Ada character literal, into the signified character.
-- Raise a Libadalang.Common.Property_Error if Text is not a valid
-- literal.
function Decode_String_Literal (Text : Text_Type) return Text_Type;
-- Turn Text, a valid Ada string literal, into the signified string. Raise
-- a Libadalang.Common.Property_Error if Text is not a valid literal.
-------------------------------
-- Numeric literals handling --
-------------------------------
procedure Decode_Integer_Literal
(Text : Text_Type;
Result : out GNATCOLL.GMP.Integers.Big_Integer);
-- Turn Text, a valid Ada integer literal, into the signified integer
-- (arbitrary precision). Raise a Libadalang.Analysis.Property_Error if
-- Text is not a valid literal.
--
-- TODO(T206-025): use an OUT parameter instead of a function return type
-- to workaround a GNAT finalization bug when the function raises an
-- exception.
procedure Decode_Real_Literal
(Text : Text_Type;
Result : out GNATCOLL.GMP.Rational_Numbers.Rational);
-- Turn Text, a valid Ada real literal, into a rational number. Raise a
-- Libadalang.Analysis.Property_Error if Text is not a valid literal.
end Libadalang.Sources;
|
onox/orka | Ada | 5,407 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2018 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.Iterator_Interfaces;
generic
type Index_Type is new Natural;
type Element_Type is private;
package Orka.Containers.Bounded_Vectors is
pragma Pure;
subtype Length_Type is Index_Type'Base range 0 .. Index_Type'Last;
type Vector (Capacity : Length_Type) is tagged private
with Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
Default_Iterator => Iterate,
Iterator_Element => Reference_Type;
pragma Preelaborable_Initialization (Vector);
procedure Append (Container : in out Vector; Elements : Vector)
with Pre => Container.Length + Elements.Length <= Container.Capacity,
Post => Container.Length = Container'Old.Length + Elements.Length;
procedure Append (Container : in out Vector; Element : Element_Type)
with Pre => Container.Length < Container.Capacity,
Post => Container.Length = Container'Old.Length + 1;
-- Add the element to the end of the vector
procedure Remove_Last (Container : in out Vector; Element : out Element_Type)
with Pre => Container.Length > 0,
Post => Container.Length = Container'Old.Length - 1;
procedure Clear (Container : in out Vector)
with Post => Container.Length = 0;
type Element_Array is array (Index_Type range <>) of aliased Element_Type;
procedure Query
(Container : Vector;
Process : not null access procedure (Elements : Element_Array));
procedure Update
(Container : in out Vector;
Index : Index_Type;
Process : not null access procedure (Element : in out Element_Type))
with Pre => Index <= Container.Length;
-----------------------------------------------------------------------------
function Element (Container : Vector; Index : Index_Type) return Element_Type;
type Constant_Reference_Type (Value : not null access constant Element_Type) is limited private
with Implicit_Dereference => Value;
type Reference_Type (Value : not null access Element_Type) is limited private
with Implicit_Dereference => Value;
function Constant_Reference
(Container : aliased Vector;
Index : Index_Type) return Constant_Reference_Type;
function Reference
(Container : aliased in out Vector;
Index : Index_Type) return Reference_Type;
type Cursor is private;
No_Element : constant Cursor;
function Has_Element (Position : Cursor) return Boolean is
(Position /= No_Element);
package Vector_Iterator_Interfaces is new Ada.Iterator_Interfaces (Cursor, Has_Element);
function Iterate (Container : Vector)
return Vector_Iterator_Interfaces.Reversible_Iterator'Class;
-----------------------------------------------------------------------------
function Length (Container : Vector) return Length_Type
with Inline;
function Is_Empty (Container : Vector) return Boolean
with Inline;
function Is_Full (Container : Vector) return Boolean
with Inline;
private
type Vector_Access is access constant Vector;
type Cursor is record
Object : Vector_Access;
Index : Length_Type;
end record;
No_Element : constant Cursor := Cursor'(null, 0);
-----------------------------------------------------------------------------
function Element
(Container : aliased Vector;
Position : Cursor) return Element_Type;
type Constant_Reference_Type
(Value : not null access constant Element_Type) is limited null record;
type Reference_Type (Value : not null access Element_Type) is limited null record;
function Constant_Reference
(Container : aliased Vector;
Position : Cursor) return Constant_Reference_Type;
function Reference
(Container : aliased in out Vector;
Position : Cursor) return Reference_Type;
-----------------------------------------------------------------------------
type Vector (Capacity : Length_Type) is tagged record
Elements : Element_Array (Index_Type'First .. Capacity) := (others => <>);
Length : Length_Type := 0;
end record;
pragma Preelaborable_Initialization (Vector);
-----------------------------------------------------------------------------
type Iterator is limited new
Vector_Iterator_Interfaces.Reversible_Iterator with
record
Container : Vector_Access;
end record;
overriding function First (Object : Iterator) return Cursor;
overriding function Last (Object : Iterator) return Cursor;
overriding function Next
(Object : Iterator;
Position : Cursor) return Cursor;
overriding function Previous
(Object : Iterator;
Position : Cursor) return Cursor;
end Orka.Containers.Bounded_Vectors;
|
stcarrez/ada-ado | Ada | 2,462 | adb | -----------------------------------------------------------------------
-- ADO Databases -- Database Connections
-- Copyright (C) 2010, 2011, 2012, 2013, 2017, 2018 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package body ADO.Sessions.Sources is
-- ------------------------------
-- Set the master data source
-- ------------------------------
procedure Set_Master (Controller : in out Replicated_DataSource;
Master : in Data_Source_Access) is
begin
Controller.Master := Master;
end Set_Master;
-- ------------------------------
-- Get the master data source
-- ------------------------------
function Get_Master (Controller : in Replicated_DataSource)
return Data_Source_Access is
begin
return Controller.Master;
end Get_Master;
-- ------------------------------
-- Set the slave data source
-- ------------------------------
procedure Set_Slave (Controller : in out Replicated_DataSource;
Slave : in Data_Source_Access) is
begin
Controller.Slave := Slave;
end Set_Slave;
-- ------------------------------
-- Get the slave data source
-- ------------------------------
function Get_Slave (Controller : in Replicated_DataSource)
return Data_Source_Access is
begin
return Controller.Slave;
end Get_Slave;
-- ------------------------------
-- Get a slave database connection
-- ------------------------------
-- function Get_Slave_Connection (Controller : in Replicated_DataSource)
-- return Connection'Class is
-- begin
-- return Controller.Slave.Get_Connection;
-- end Get_Slave_Connection;
end ADO.Sessions.Sources;
|
reznikmm/matreshka | Ada | 24,480 | 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_Create_Object_Actions is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Create_Object_Action_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Enter_Create_Object_Action
(AMF.UML.Create_Object_Actions.UML_Create_Object_Action_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Create_Object_Action_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Leave_Create_Object_Action
(AMF.UML.Create_Object_Actions.UML_Create_Object_Action_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Create_Object_Action_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then
AMF.Visitors.UML_Iterators.UML_Iterator'Class
(Iterator).Visit_Create_Object_Action
(Visitor,
AMF.UML.Create_Object_Actions.UML_Create_Object_Action_Access (Self),
Control);
end if;
end Visit_Element;
--------------------
-- Get_Classifier --
--------------------
overriding function Get_Classifier
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Classifiers.UML_Classifier_Access is
begin
return
AMF.UML.Classifiers.UML_Classifier_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Classifier
(Self.Element)));
end Get_Classifier;
--------------------
-- Set_Classifier --
--------------------
overriding procedure Set_Classifier
(Self : not null access UML_Create_Object_Action_Proxy;
To : AMF.UML.Classifiers.UML_Classifier_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Classifier
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Classifier;
----------------
-- Get_Result --
----------------
overriding function Get_Result
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Output_Pins.UML_Output_Pin_Access is
begin
return
AMF.UML.Output_Pins.UML_Output_Pin_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Result
(Self.Element)));
end Get_Result;
----------------
-- Set_Result --
----------------
overriding procedure Set_Result
(Self : not null access UML_Create_Object_Action_Proxy;
To : AMF.UML.Output_Pins.UML_Output_Pin_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Result
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Result;
-----------------
-- Get_Context --
-----------------
overriding function Get_Context
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Classifiers.UML_Classifier_Access is
begin
return
AMF.UML.Classifiers.UML_Classifier_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Context
(Self.Element)));
end Get_Context;
---------------
-- Get_Input --
---------------
overriding function Get_Input
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Input_Pins.Collections.Ordered_Set_Of_UML_Input_Pin is
begin
return
AMF.UML.Input_Pins.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Input
(Self.Element)));
end Get_Input;
------------------------------
-- Get_Is_Locally_Reentrant --
------------------------------
overriding function Get_Is_Locally_Reentrant
(Self : not null access constant UML_Create_Object_Action_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Locally_Reentrant
(Self.Element);
end Get_Is_Locally_Reentrant;
------------------------------
-- Set_Is_Locally_Reentrant --
------------------------------
overriding procedure Set_Is_Locally_Reentrant
(Self : not null access UML_Create_Object_Action_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Locally_Reentrant
(Self.Element, To);
end Set_Is_Locally_Reentrant;
-----------------------------
-- Get_Local_Postcondition --
-----------------------------
overriding function Get_Local_Postcondition
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is
begin
return
AMF.UML.Constraints.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Postcondition
(Self.Element)));
end Get_Local_Postcondition;
----------------------------
-- Get_Local_Precondition --
----------------------------
overriding function Get_Local_Precondition
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is
begin
return
AMF.UML.Constraints.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Precondition
(Self.Element)));
end Get_Local_Precondition;
----------------
-- Get_Output --
----------------
overriding function Get_Output
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Output_Pins.Collections.Ordered_Set_Of_UML_Output_Pin is
begin
return
AMF.UML.Output_Pins.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Output
(Self.Element)));
end Get_Output;
-----------------
-- Get_Handler --
-----------------
overriding function Get_Handler
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Exception_Handlers.Collections.Set_Of_UML_Exception_Handler is
begin
return
AMF.UML.Exception_Handlers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Handler
(Self.Element)));
end Get_Handler;
------------------
-- Get_Activity --
------------------
overriding function Get_Activity
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Activities.UML_Activity_Access is
begin
return
AMF.UML.Activities.UML_Activity_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Activity
(Self.Element)));
end Get_Activity;
------------------
-- Set_Activity --
------------------
overriding procedure Set_Activity
(Self : not null access UML_Create_Object_Action_Proxy;
To : AMF.UML.Activities.UML_Activity_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Activity
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Activity;
------------------
-- Get_In_Group --
------------------
overriding function Get_In_Group
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Activity_Groups.Collections.Set_Of_UML_Activity_Group is
begin
return
AMF.UML.Activity_Groups.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Group
(Self.Element)));
end Get_In_Group;
---------------------------------
-- Get_In_Interruptible_Region --
---------------------------------
overriding function Get_In_Interruptible_Region
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Interruptible_Activity_Regions.Collections.Set_Of_UML_Interruptible_Activity_Region is
begin
return
AMF.UML.Interruptible_Activity_Regions.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Interruptible_Region
(Self.Element)));
end Get_In_Interruptible_Region;
----------------------
-- Get_In_Partition --
----------------------
overriding function Get_In_Partition
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Activity_Partitions.Collections.Set_Of_UML_Activity_Partition is
begin
return
AMF.UML.Activity_Partitions.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Partition
(Self.Element)));
end Get_In_Partition;
----------------------------
-- Get_In_Structured_Node --
----------------------------
overriding function Get_In_Structured_Node
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access is
begin
return
AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Structured_Node
(Self.Element)));
end Get_In_Structured_Node;
----------------------------
-- Set_In_Structured_Node --
----------------------------
overriding procedure Set_In_Structured_Node
(Self : not null access UML_Create_Object_Action_Proxy;
To : AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_In_Structured_Node
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_In_Structured_Node;
------------------
-- Get_Incoming --
------------------
overriding function Get_Incoming
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is
begin
return
AMF.UML.Activity_Edges.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Incoming
(Self.Element)));
end Get_Incoming;
------------------
-- Get_Outgoing --
------------------
overriding function Get_Outgoing
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is
begin
return
AMF.UML.Activity_Edges.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Outgoing
(Self.Element)));
end Get_Outgoing;
------------------------
-- Get_Redefined_Node --
------------------------
overriding function Get_Redefined_Node
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Activity_Nodes.Collections.Set_Of_UML_Activity_Node is
begin
return
AMF.UML.Activity_Nodes.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Node
(Self.Element)));
end Get_Redefined_Node;
-----------------
-- Get_Is_Leaf --
-----------------
overriding function Get_Is_Leaf
(Self : not null access constant UML_Create_Object_Action_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf
(Self.Element);
end Get_Is_Leaf;
-----------------
-- Set_Is_Leaf --
-----------------
overriding procedure Set_Is_Leaf
(Self : not null access UML_Create_Object_Action_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Leaf
(Self.Element, To);
end Set_Is_Leaf;
---------------------------
-- Get_Redefined_Element --
---------------------------
overriding function Get_Redefined_Element
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is
begin
return
AMF.UML.Redefinable_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Element
(Self.Element)));
end Get_Redefined_Element;
------------------------------
-- Get_Redefinition_Context --
------------------------------
overriding function Get_Redefinition_Context
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
begin
return
AMF.UML.Classifiers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefinition_Context
(Self.Element)));
end Get_Redefinition_Context;
---------------------------
-- Get_Client_Dependency --
---------------------------
overriding function Get_Client_Dependency
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
begin
return
AMF.UML.Dependencies.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency
(Self.Element)));
end Get_Client_Dependency;
-------------------------
-- Get_Name_Expression --
-------------------------
overriding function Get_Name_Expression
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access is
begin
return
AMF.UML.String_Expressions.UML_String_Expression_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression
(Self.Element)));
end Get_Name_Expression;
-------------------------
-- Set_Name_Expression --
-------------------------
overriding procedure Set_Name_Expression
(Self : not null access UML_Create_Object_Action_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Name_Expression;
-------------------
-- Get_Namespace --
-------------------
overriding function Get_Namespace
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
return
AMF.UML.Namespaces.UML_Namespace_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace
(Self.Element)));
end Get_Namespace;
------------------------
-- Get_Qualified_Name --
------------------------
overriding function Get_Qualified_Name
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.Optional_String is
begin
declare
use type Matreshka.Internals.Strings.Shared_String_Access;
Aux : constant Matreshka.Internals.Strings.Shared_String_Access
:= AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
begin
if Aux = null then
return (Is_Empty => True);
else
return (False, League.Strings.Internals.Create (Aux));
end if;
end;
end Get_Qualified_Name;
-------------
-- Context --
-------------
overriding function Context
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Classifiers.UML_Classifier_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Context unimplemented");
raise Program_Error with "Unimplemented procedure UML_Create_Object_Action_Proxy.Context";
return Context (Self);
end Context;
------------------------
-- Is_Consistent_With --
------------------------
overriding function Is_Consistent_With
(Self : not null access constant UML_Create_Object_Action_Proxy;
Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented");
raise Program_Error with "Unimplemented procedure UML_Create_Object_Action_Proxy.Is_Consistent_With";
return Is_Consistent_With (Self, Redefinee);
end Is_Consistent_With;
-----------------------------------
-- Is_Redefinition_Context_Valid --
-----------------------------------
overriding function Is_Redefinition_Context_Valid
(Self : not null access constant UML_Create_Object_Action_Proxy;
Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented");
raise Program_Error with "Unimplemented procedure UML_Create_Object_Action_Proxy.Is_Redefinition_Context_Valid";
return Is_Redefinition_Context_Valid (Self, Redefined);
end Is_Redefinition_Context_Valid;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
raise Program_Error with "Unimplemented procedure UML_Create_Object_Action_Proxy.All_Owning_Packages";
return All_Owning_Packages (Self);
end All_Owning_Packages;
-----------------------------
-- Is_Distinguishable_From --
-----------------------------
overriding function Is_Distinguishable_From
(Self : not null access constant UML_Create_Object_Action_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
raise Program_Error with "Unimplemented procedure UML_Create_Object_Action_Proxy.Is_Distinguishable_From";
return Is_Distinguishable_From (Self, N, Ns);
end Is_Distinguishable_From;
---------------
-- Namespace --
---------------
overriding function Namespace
(Self : not null access constant UML_Create_Object_Action_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
raise Program_Error with "Unimplemented procedure UML_Create_Object_Action_Proxy.Namespace";
return Namespace (Self);
end Namespace;
end AMF.Internals.UML_Create_Object_Actions;
|
reznikmm/matreshka | Ada | 4,656 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Chart.Legend_Position_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Chart_Legend_Position_Attribute_Node is
begin
return Self : Chart_Legend_Position_Attribute_Node do
Matreshka.ODF_Chart.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Chart_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Chart_Legend_Position_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Legend_Position_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Chart_URI,
Matreshka.ODF_String_Constants.Legend_Position_Attribute,
Chart_Legend_Position_Attribute_Node'Tag);
end Matreshka.ODF_Chart.Legend_Position_Attributes;
|
tum-ei-rcs/StratoX | Ada | 160 | ads | package calc with SPARK_Mode is
function calc (f1, f2: Float) return Float with
Pre => f1 in -1000.0 .. 1000.0 and f2 in -1000.0 .. 1000.0;
end calc;
|
eqcola/ada-ado | Ada | 8,412 | ads | -----------------------------------------------------------------------
-- ADO SQL -- Basic SQL Generation
-- Copyright (C) 2010, 2011, 2012, 2015 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings.Unbounded;
with Ada.Calendar;
with ADO.Parameters;
with ADO.Drivers.Dialects;
-- Utilities for creating SQL queries and statements.
package ADO.SQL is
use Ada.Strings.Unbounded;
-- --------------------
-- Buffer
-- --------------------
-- The <b>Buffer</b> type allows to build easily an SQL statement.
--
type Buffer is private;
type Buffer_Access is access all Buffer;
-- Clear the SQL buffer.
procedure Clear (Target : in out Buffer);
-- Append an SQL extract into the buffer.
procedure Append (Target : in out Buffer;
SQL : in String);
-- Append a name in the buffer and escape that
-- name if this is a reserved keyword.
procedure Append_Name (Target : in out Buffer;
Name : in String);
-- Append a string value in the buffer and
-- escape any special character if necessary.
procedure Append_Value (Target : in out Buffer;
Value : in String);
-- Append a string value in the buffer and
-- escape any special character if necessary.
procedure Append_Value (Target : in out Buffer;
Value : in Unbounded_String);
-- Append the integer value in the buffer.
procedure Append_Value (Target : in out Buffer;
Value : in Long_Integer);
-- Append the integer value in the buffer.
procedure Append_Value (Target : in out Buffer;
Value : in Integer);
-- Append the identifier value in the buffer.
procedure Append_Value (Target : in out Buffer;
Value : in Identifier);
-- Get the SQL string that was accumulated in the buffer.
function To_String (From : in Buffer) return String;
-- --------------------
-- Query
-- --------------------
-- The <b>Query</b> type contains the elements for building and
-- executing the request. This includes:
-- <ul>
-- <li>The SQL request (full request or a fragment)</li>
-- <li>The SQL request parameters </li>
-- <li>An SQL filter condition</li>
-- </ul>
--
type Query is new ADO.Parameters.List with record
SQL : Buffer;
Filter : Buffer;
Join : Buffer;
end record;
type Query_Access is access all Query'Class;
-- Clear the query object.
overriding
procedure Clear (Target : in out Query);
-- Set the SQL dialect description object.
procedure Set_Dialect (Target : in out Query;
D : in ADO.Drivers.Dialects.Dialect_Access);
procedure Set_Filter (Target : in out Query;
Filter : in String);
function Has_Filter (Source : in Query) return Boolean;
function Get_Filter (Source : in Query) return String;
-- Set the join condition.
procedure Set_Join (Target : in out Query;
Join : in String);
-- Returns true if there is a join condition
function Has_Join (Source : in Query) return Boolean;
-- Get the join condition
function Get_Join (Source : in Query) return String;
-- Set the parameters from another parameter list.
-- If the parameter list is a query object, also copy the filter part.
procedure Set_Parameters (Params : in out Query;
From : in ADO.Parameters.Abstract_List'Class);
-- Expand the parameters into the query and return the expanded SQL query.
function Expand (Source : in Query) return String;
-- --------------------
-- Update Query
-- --------------------
-- The <b>Update_Query</b> provides additional helper functions to construct
-- and <i>insert</i> or an <i>update</i> statement.
type Update_Query is new Query with private;
type Update_Query_Access is access all Update_Query'Class;
-- Set the SQL dialect description object.
procedure Set_Dialect (Target : in out Update_Query;
D : in ADO.Drivers.Dialects.Dialect_Access);
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
procedure Save_Field (Update : in out Update_Query;
Name : in String;
Value : in Boolean);
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
procedure Save_Field (Update : in out Update_Query;
Name : in String;
Value : in Integer);
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
procedure Save_Field (Update : in out Update_Query;
Name : in String;
Value : in Long_Long_Integer);
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
procedure Save_Field (Update : in out Update_Query;
Name : in String;
Value : in Identifier);
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
procedure Save_Field (Update : in out Update_Query;
Name : in String;
Value : in Entity_Type);
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
procedure Save_Field (Update : in out Update_Query;
Name : in String;
Value : in Ada.Calendar.Time);
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
procedure Save_Field (Update : in out Update_Query;
Name : in String;
Value : in String);
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
procedure Save_Field (Update : in out Update_Query;
Name : in String;
Value : in Unbounded_String);
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to the <b>Value</b>.
procedure Save_Field (Update : in out Update_Query;
Name : in String;
Value : in ADO.Blob_Ref);
-- Prepare the update/insert query to save the table field
-- identified by <b>Name</b> and set it to NULL.
procedure Save_Null_Field (Update : in out Update_Query;
Name : in String);
-- Check if the update/insert query has some fields to update.
function Has_Save_Fields (Update : in Update_Query) return Boolean;
procedure Set_Insert_Mode (Update : in out Update_Query);
procedure Append_Fields (Update : in out Update_Query;
Mode : in Boolean := False);
private
type Buffer is new ADO.Parameters.List with record
Buf : Unbounded_String;
end record;
type Update_Query is new Query with record
Pos : Natural := 0;
Set_Fields : Buffer;
Fields : Buffer;
Is_Update_Stmt : Boolean := True;
end record;
procedure Add_Field (Update : in out Update_Query'Class;
Name : in String);
end ADO.SQL;
|
1Crazymoney/LearnAda | Ada | 7,652 | adb | pragma Ada_95;
pragma Source_File_Name (ada_main, Spec_File_Name => "b__factorial.ads");
pragma Source_File_Name (ada_main, Body_File_Name => "b__factorial.adb");
pragma Suppress (Overflow_Check);
with Ada.Exceptions;
package body ada_main is
pragma Warnings (Off);
E074 : Short_Integer; pragma Import (Ada, E074, "system__os_lib_E");
E013 : Short_Integer; pragma Import (Ada, E013, "system__soft_links_E");
E023 : Short_Integer; pragma Import (Ada, E023, "system__exception_table_E");
E048 : Short_Integer; pragma Import (Ada, E048, "ada__io_exceptions_E");
E050 : Short_Integer; pragma Import (Ada, E050, "ada__tags_E");
E047 : Short_Integer; pragma Import (Ada, E047, "ada__streams_E");
E072 : Short_Integer; pragma Import (Ada, E072, "interfaces__c_E");
E025 : Short_Integer; pragma Import (Ada, E025, "system__exceptions_E");
E077 : Short_Integer; pragma Import (Ada, E077, "system__file_control_block_E");
E066 : Short_Integer; pragma Import (Ada, E066, "system__file_io_E");
E070 : Short_Integer; pragma Import (Ada, E070, "system__finalization_root_E");
E068 : Short_Integer; pragma Import (Ada, E068, "ada__finalization_E");
E017 : Short_Integer; pragma Import (Ada, E017, "system__secondary_stack_E");
E045 : Short_Integer; pragma Import (Ada, E045, "ada__text_io_E");
E099 : Short_Integer; pragma Import (Ada, E099, "mat_E");
Local_Priority_Specific_Dispatching : constant String := "";
Local_Interrupt_States : constant String := "";
Is_Elaborated : Boolean := False;
procedure finalize_library is
begin
E045 := E045 - 1;
declare
procedure F1;
pragma Import (Ada, F1, "ada__text_io__finalize_spec");
begin
F1;
end;
declare
procedure F2;
pragma Import (Ada, F2, "system__file_io__finalize_body");
begin
E066 := E066 - 1;
F2;
end;
declare
procedure Reraise_Library_Exception_If_Any;
pragma Import (Ada, Reraise_Library_Exception_If_Any, "__gnat_reraise_library_exception_if_any");
begin
Reraise_Library_Exception_If_Any;
end;
end finalize_library;
procedure adafinal is
procedure s_stalib_adafinal;
pragma Import (C, s_stalib_adafinal, "system__standard_library__adafinal");
procedure Runtime_Finalize;
pragma Import (C, Runtime_Finalize, "__gnat_runtime_finalize");
begin
if not Is_Elaborated then
return;
end if;
Is_Elaborated := False;
Runtime_Finalize;
s_stalib_adafinal;
end adafinal;
type No_Param_Proc is access procedure;
procedure adainit is
Main_Priority : Integer;
pragma Import (C, Main_Priority, "__gl_main_priority");
Time_Slice_Value : Integer;
pragma Import (C, Time_Slice_Value, "__gl_time_slice_val");
WC_Encoding : Character;
pragma Import (C, WC_Encoding, "__gl_wc_encoding");
Locking_Policy : Character;
pragma Import (C, Locking_Policy, "__gl_locking_policy");
Queuing_Policy : Character;
pragma Import (C, Queuing_Policy, "__gl_queuing_policy");
Task_Dispatching_Policy : Character;
pragma Import (C, Task_Dispatching_Policy, "__gl_task_dispatching_policy");
Priority_Specific_Dispatching : System.Address;
pragma Import (C, Priority_Specific_Dispatching, "__gl_priority_specific_dispatching");
Num_Specific_Dispatching : Integer;
pragma Import (C, Num_Specific_Dispatching, "__gl_num_specific_dispatching");
Main_CPU : Integer;
pragma Import (C, Main_CPU, "__gl_main_cpu");
Interrupt_States : System.Address;
pragma Import (C, Interrupt_States, "__gl_interrupt_states");
Num_Interrupt_States : Integer;
pragma Import (C, Num_Interrupt_States, "__gl_num_interrupt_states");
Unreserve_All_Interrupts : Integer;
pragma Import (C, Unreserve_All_Interrupts, "__gl_unreserve_all_interrupts");
Detect_Blocking : Integer;
pragma Import (C, Detect_Blocking, "__gl_detect_blocking");
Default_Stack_Size : Integer;
pragma Import (C, Default_Stack_Size, "__gl_default_stack_size");
Leap_Seconds_Support : Integer;
pragma Import (C, Leap_Seconds_Support, "__gl_leap_seconds_support");
procedure Runtime_Initialize (Install_Handler : Integer);
pragma Import (C, Runtime_Initialize, "__gnat_runtime_initialize");
Finalize_Library_Objects : No_Param_Proc;
pragma Import (C, Finalize_Library_Objects, "__gnat_finalize_library_objects");
begin
if Is_Elaborated then
return;
end if;
Is_Elaborated := True;
Main_Priority := -1;
Time_Slice_Value := -1;
WC_Encoding := 'b';
Locking_Policy := ' ';
Queuing_Policy := ' ';
Task_Dispatching_Policy := ' ';
Priority_Specific_Dispatching :=
Local_Priority_Specific_Dispatching'Address;
Num_Specific_Dispatching := 0;
Main_CPU := -1;
Interrupt_States := Local_Interrupt_States'Address;
Num_Interrupt_States := 0;
Unreserve_All_Interrupts := 0;
Detect_Blocking := 0;
Default_Stack_Size := -1;
Leap_Seconds_Support := 0;
Runtime_Initialize (1);
Finalize_Library_Objects := finalize_library'access;
System.Soft_Links'Elab_Spec;
System.Exception_Table'Elab_Body;
E023 := E023 + 1;
Ada.Io_Exceptions'Elab_Spec;
E048 := E048 + 1;
Ada.Tags'Elab_Spec;
Ada.Streams'Elab_Spec;
E047 := E047 + 1;
Interfaces.C'Elab_Spec;
System.Exceptions'Elab_Spec;
E025 := E025 + 1;
System.File_Control_Block'Elab_Spec;
E077 := E077 + 1;
System.Finalization_Root'Elab_Spec;
E070 := E070 + 1;
Ada.Finalization'Elab_Spec;
E068 := E068 + 1;
System.File_Io'Elab_Body;
E066 := E066 + 1;
E072 := E072 + 1;
Ada.Tags'Elab_Body;
E050 := E050 + 1;
System.Soft_Links'Elab_Body;
E013 := E013 + 1;
System.Os_Lib'Elab_Body;
E074 := E074 + 1;
System.Secondary_Stack'Elab_Body;
E017 := E017 + 1;
Ada.Text_Io'Elab_Spec;
Ada.Text_Io'Elab_Body;
E045 := E045 + 1;
E099 := E099 + 1;
end adainit;
procedure Ada_Main_Program;
pragma Import (Ada, Ada_Main_Program, "_ada_factorial");
function main
(argc : Integer;
argv : System.Address;
envp : System.Address)
return Integer
is
procedure Initialize (Addr : System.Address);
pragma Import (C, Initialize, "__gnat_initialize");
procedure Finalize;
pragma Import (C, Finalize, "__gnat_finalize");
SEH : aliased array (1 .. 2) of Integer;
Ensure_Reference : aliased System.Address := Ada_Main_Program_Name'Address;
pragma Volatile (Ensure_Reference);
begin
gnat_argc := argc;
gnat_argv := argv;
gnat_envp := envp;
Initialize (SEH'Address);
adainit;
Ada_Main_Program;
adafinal;
Finalize;
return (gnat_exit_status);
end;
-- BEGIN Object file/option list
-- C:\Users\Soba95\Desktop\ada\mat.o
-- C:\Users\Soba95\Desktop\ada\factorial.o
-- -LC:\Users\Soba95\Desktop\ada\
-- -LC:\Users\Soba95\Desktop\ada\
-- -LC:/gnat/2015/lib/gcc/i686-pc-mingw32/4.9.3/adalib/
-- -static
-- -lgnat
-- -Wl,--stack=0x2000000
-- END Object file/option list
end ada_main;
|
optikos/oasis | Ada | 9,182 | adb | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Program.Nodes.Formal_Object_Declarations is
function Create
(Names : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Vector_Access;
Colon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
In_Token : Program.Lexical_Elements.Lexical_Element_Access;
Out_Token : Program.Lexical_Elements.Lexical_Element_Access;
Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Object_Subtype : not null Program.Elements.Element_Access;
Assignment_Token : Program.Lexical_Elements.Lexical_Element_Access;
Default_Expression : Program.Elements.Expressions.Expression_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Formal_Object_Declaration is
begin
return Result : Formal_Object_Declaration :=
(Names => Names, Colon_Token => Colon_Token, In_Token => In_Token,
Out_Token => Out_Token, Not_Token => Not_Token,
Null_Token => Null_Token, Object_Subtype => Object_Subtype,
Assignment_Token => Assignment_Token,
Default_Expression => Default_Expression, With_Token => With_Token,
Aspects => Aspects, Semicolon_Token => Semicolon_Token,
Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Names : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Vector_Access;
Object_Subtype : not null Program.Elements.Element_Access;
Default_Expression : Program.Elements.Expressions.Expression_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False;
Has_In : Boolean := False;
Has_Out : Boolean := False;
Has_Not_Null : Boolean := False)
return Implicit_Formal_Object_Declaration is
begin
return Result : Implicit_Formal_Object_Declaration :=
(Names => Names, Object_Subtype => Object_Subtype,
Default_Expression => Default_Expression, Aspects => Aspects,
Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Has_In => Has_In,
Has_Out => Has_Out, Has_Not_Null => Has_Not_Null,
Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Names
(Self : Base_Formal_Object_Declaration)
return not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Vector_Access is
begin
return Self.Names;
end Names;
overriding function Object_Subtype
(Self : Base_Formal_Object_Declaration)
return not null Program.Elements.Element_Access is
begin
return Self.Object_Subtype;
end Object_Subtype;
overriding function Default_Expression
(Self : Base_Formal_Object_Declaration)
return Program.Elements.Expressions.Expression_Access is
begin
return Self.Default_Expression;
end Default_Expression;
overriding function Aspects
(Self : Base_Formal_Object_Declaration)
return Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access is
begin
return Self.Aspects;
end Aspects;
overriding function Colon_Token
(Self : Formal_Object_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Colon_Token;
end Colon_Token;
overriding function In_Token
(Self : Formal_Object_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.In_Token;
end In_Token;
overriding function Out_Token
(Self : Formal_Object_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Out_Token;
end Out_Token;
overriding function Not_Token
(Self : Formal_Object_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Not_Token;
end Not_Token;
overriding function Null_Token
(Self : Formal_Object_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Null_Token;
end Null_Token;
overriding function Assignment_Token
(Self : Formal_Object_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Assignment_Token;
end Assignment_Token;
overriding function With_Token
(Self : Formal_Object_Declaration)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.With_Token;
end With_Token;
overriding function Semicolon_Token
(Self : Formal_Object_Declaration)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Semicolon_Token;
end Semicolon_Token;
overriding function Has_In
(Self : Formal_Object_Declaration)
return Boolean is
begin
return Self.In_Token.Assigned;
end Has_In;
overriding function Has_Out
(Self : Formal_Object_Declaration)
return Boolean is
begin
return Self.Out_Token.Assigned;
end Has_Out;
overriding function Has_Not_Null
(Self : Formal_Object_Declaration)
return Boolean is
begin
return Self.Null_Token.Assigned;
end Has_Not_Null;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Formal_Object_Declaration)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Formal_Object_Declaration)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Formal_Object_Declaration)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
overriding function Has_In
(Self : Implicit_Formal_Object_Declaration)
return Boolean is
begin
return Self.Has_In;
end Has_In;
overriding function Has_Out
(Self : Implicit_Formal_Object_Declaration)
return Boolean is
begin
return Self.Has_Out;
end Has_Out;
overriding function Has_Not_Null
(Self : Implicit_Formal_Object_Declaration)
return Boolean is
begin
return Self.Has_Not_Null;
end Has_Not_Null;
procedure Initialize
(Self : aliased in out Base_Formal_Object_Declaration'Class) is
begin
for Item in Self.Names.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
Set_Enclosing_Element (Self.Object_Subtype, Self'Unchecked_Access);
if Self.Default_Expression.Assigned then
Set_Enclosing_Element
(Self.Default_Expression, Self'Unchecked_Access);
end if;
for Item in Self.Aspects.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
null;
end Initialize;
overriding function Is_Formal_Object_Declaration_Element
(Self : Base_Formal_Object_Declaration)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Formal_Object_Declaration_Element;
overriding function Is_Declaration_Element
(Self : Base_Formal_Object_Declaration)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Declaration_Element;
overriding procedure Visit
(Self : not null access Base_Formal_Object_Declaration;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Formal_Object_Declaration (Self);
end Visit;
overriding function To_Formal_Object_Declaration_Text
(Self : aliased in out Formal_Object_Declaration)
return Program.Elements.Formal_Object_Declarations
.Formal_Object_Declaration_Text_Access is
begin
return Self'Unchecked_Access;
end To_Formal_Object_Declaration_Text;
overriding function To_Formal_Object_Declaration_Text
(Self : aliased in out Implicit_Formal_Object_Declaration)
return Program.Elements.Formal_Object_Declarations
.Formal_Object_Declaration_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Formal_Object_Declaration_Text;
end Program.Nodes.Formal_Object_Declarations;
|
AaronC98/PlaneSystem | Ada | 9,550 | ads | ------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2000-2017, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
------------------------------------------------------------------------------
--
-- This unit implements an API to send email messages. It is possible to send
-- simple email [RFC 821] and email with MIME attachments [RFC 2045 & 2049].
--
-- How to send an email:
--
-- 1) Initialize a Server to send the messages.
--
-- Wanadoo : SMTP.Receiver := SMTP.Client.Initialize ("smtp.wanadoo.fr");
--
-- Optionally, request Authentication
--
-- Auth : aliased SMTP.Authentication.Credential :=
-- SMTP.Authentication.Plain.Initialize ("id", "password");
--
-- Wanadoo : SMTP.Receiver :=
-- SMTP.Client.Initialize
-- ("smtp.wanadoo.fr", Credential => Auth'Access);
--
-- 2) Send a message via the server.
--
-- Result : SMTP.Status;
--
-- SMTP.Client.Send
-- (Server => Wanadoo,
-- From => SMTP.E_Mail ("Pascal Obry", "[email protected]"),
-- To => SMTP.E_Mail
-- ("Dmitriy Anisimkov", "[email protected]"),
-- Subject => "Latest Ada news",
-- Message => "now Ada can send SMTP mail!",
-- Status => Result);
with AWS.Attachments;
package AWS.SMTP.Client is
Server_Error : exception renames SMTP.Server_Error;
function Initialize
(Server_Name : String;
Port : Positive := Default_SMTP_Port;
Secure : Boolean := False;
Family : Net.Family_Type := Net.Family_Unspec;
Credential : access constant Authentication.Credential'Class := null;
Timeout : Duration := Net.Forever)
return Receiver renames SMTP.Initialize;
procedure Send
(Server : Receiver;
From : E_Mail_Data;
To : E_Mail_Data;
Subject : String;
Message : String;
Status : out SMTP.Status;
CC : Recipients := No_Recipient;
BCC : Recipients := No_Recipient;
To_All : Boolean := True);
-- Send a message via Server. The email is a simple message composed of a
-- subject and a text message body. Raise Server_Error in case of an
-- unrecoverable error (e.g. can't contact the server).
-- If To_All is False email is sent even if some email addresses
-- in recipient list are not correct.
type Attachment is private;
-- This is an attachment object, either a File or some Base64 encoded
-- content.
-- only simple attachments are supported. For full attachment support use
-- AWS.Attachments with the corresponding Send routine below.
function File (Filename : String) return Attachment;
-- Returns a file attachment. Filename point to a file on the file system
function Base64_Data (Name, Content : String) return Attachment;
-- Returns a base64 encoded attachment. Content must already be Base64
-- encoded data. The attachment is named Name.
-- This is a way to send a file attachment from in-memory data.
type Attachment_Set is array (Positive range <>) of Attachment;
-- A set of file attachments
procedure Send
(Server : Receiver;
From : E_Mail_Data;
To : E_Mail_Data;
Subject : String;
Message : String := "";
Attachments : Attachment_Set;
Status : out SMTP.Status;
CC : Recipients := No_Recipient;
BCC : Recipients := No_Recipient;
To_All : Boolean := True);
-- Send a message via Server. The email is a MIME message composed of a
-- subject, a message and a set of MIME encoded files. Raise Server_Error
-- in case of an unrecoverable error (e.g. can't contact the server).
-- Raises Constraint_Error if a file attachment cannot be opened.
-- If To_All is False email is sent even if some email addresses in
-- recipient list are not correct.
type Message_File is new String;
procedure Send
(Server : Receiver;
From : E_Mail_Data;
To : E_Mail_Data;
Subject : String;
Filename : Message_File;
Status : out SMTP.Status;
CC : Recipients := No_Recipient;
BCC : Recipients := No_Recipient;
To_All : Boolean := True);
-- Send filename content via Server. The email is a message composed of a
-- subject and a message body coming from a file. Raises Server_Error in
-- case of an unrecoverable error (e.g. can't contact the server). Raises
-- Constraint_Error if Filename cannot be opened.
--
-- Extentded interfaces to send a message to many recipients
--
procedure Send
(Server : Receiver;
From : E_Mail_Data;
To : Recipients;
Subject : String;
Message : String;
Status : out SMTP.Status;
CC : Recipients := No_Recipient;
BCC : Recipients := No_Recipient;
To_All : Boolean := True);
-- Send a message via Server. The mail is a simple message composed of a
-- subject and a text message body. Raise Server_Error in case of an
-- unrecoverable error (e.g. can't contact the server).
-- If To_All is False email is sent even if some email addresses
-- in recipient list are not correct.
procedure Send
(Server : Receiver;
From : E_Mail_Data;
To : Recipients;
Source : String;
Status : out SMTP.Status;
CC : Recipients := No_Recipient;
BCC : Recipients := No_Recipient;
To_All : Boolean := True);
-- Send a message via Server. The email Source has already been composed by
-- other means, such as the GNATcoll email facilities.
-- Raise Server_Error in case of an unrecoverable error, e.g. can't contact
-- the server.
-- If To_All is False email is sent even if some email addresses in
-- recipient list are not correct.
procedure Send
(Server : Receiver;
From : E_Mail_Data;
To : Recipients;
Subject : String;
Message : String := "";
Attachments : Attachment_Set;
Status : out SMTP.Status;
CC : Recipients := No_Recipient;
BCC : Recipients := No_Recipient;
To_All : Boolean := True);
-- Send a message via Server. The email is a MIME message composed of a
-- subject, a message and a set of files MIME encoded. Raise Server_Error
-- in case of an unrecoverable error (e.g. can't contact the server).
-- Raises Constraint_Error if a file attachment cannot be opened.
-- If To_All is False email is sent even if some email addresses in
-- recipient list are not correct.
procedure Send
(Server : Receiver;
From : E_Mail_Data;
To : Recipients;
Subject : String;
Attachments : AWS.Attachments.List;
Status : out SMTP.Status;
CC : Recipients := No_Recipient;
BCC : Recipients := No_Recipient;
To_All : Boolean := True);
-- As above but takes an attachment list which support complex attachments
-- like multiplart/alternative.
private
use Ada;
type Attachment_Mode is (File, Base64_Data);
type Attachment (Kind : Attachment_Mode := File) is record
Name : Unbounded_String;
case Kind is
when File =>
null;
when Base64_Data =>
Data : Unbounded_String;
end case;
end record;
end AWS.SMTP.Client;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.