CombinedText stringlengths 4 3.42M |
|---|
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- with STM32.RCC; use STM32.RCC;
with STM32_SVD.DMA2D; use STM32_SVD.DMA2D;
with STM32_SVD.RCC; use STM32_SVD.RCC;
package body STM32.DMA2D is
use type System.Address;
function To_Word is new Ada.Unchecked_Conversion (System.Address, UInt32);
function Offset (Buffer : DMA2D_Buffer;
X, Y : Integer) return UInt32 with Inline_Always;
DMA2D_Init_Transfer_Int : DMA2D_Sync_Procedure := null;
DMA2D_Wait_Transfer_Int : DMA2D_Sync_Procedure := null;
------------------
-- DMA2D_DeInit --
------------------
procedure DMA2D_DeInit is
begin
RCC_Periph.AHB3ENR.DMA2DEN := False;
DMA2D_Init_Transfer_Int := null;
DMA2D_Wait_Transfer_Int := null;
end DMA2D_DeInit;
----------------
-- DMA2D_Init --
----------------
procedure DMA2D_Init
(Init : DMA2D_Sync_Procedure;
Wait : DMA2D_Sync_Procedure)
is
begin
if DMA2D_Init_Transfer_Int = Init then
return;
end if;
DMA2D_DeInit;
DMA2D_Init_Transfer_Int := Init;
DMA2D_Wait_Transfer_Int := Wait;
RCC_Periph.AHB3ENR.DMA2DEN := True;
RCC_Periph.AHB3RSTR.DMA2DRST := True;
RCC_Periph.AHB3RSTR.DMA2DRST := False;
end DMA2D_Init;
------------
-- Offset --
------------
function Offset (Buffer : DMA2D_Buffer;
X, Y : Integer) return UInt32
is
Off : constant UInt32 := UInt32 (X + Buffer.Width * Y);
begin
case Buffer.Color_Mode is
when ARGB8888 =>
return 4 * Off;
when RGB888 =>
return 3 * Off;
when ARGB1555 | ARGB4444 | RGB565 | AL88 =>
return 2 * Off;
when L8 | AL44 | A8 =>
return Off;
when L4 | A4 =>
return Off / 2;
end case;
end Offset;
----------------
-- DMA2D_Fill --
----------------
procedure DMA2D_Fill
(Buffer : DMA2D_Buffer;
Color : UInt32;
Synchronous : Boolean := False)
is
function Conv is new Ada.Unchecked_Conversion (UInt32, OCOLR_Register);
begin
DMA2D_Wait_Transfer_Int.all;
DMA2D_Periph.CR.MODE := DMA2D_MODE'Enum_Rep (R2M);
DMA2D_Periph.OPFCCR.CM := As_UInt3 (Buffer.Color_Mode);
DMA2D_Periph.OCOLR := Conv (Color);
DMA2D_Periph.OMAR := To_Word (Buffer.Addr);
DMA2D_Periph.OOR := (LO => 0, others => <>);
DMA2D_Periph.NLR := (NL => UInt16 (Buffer.Height),
PL => UInt14 (Buffer.Width),
others => <>);
DMA2D_Init_Transfer_Int.all;
if Synchronous then
DMA2D_Wait_Transfer_Int.all;
end if;
end DMA2D_Fill;
---------------------
-- DMA2D_Fill_Rect --
---------------------
procedure DMA2D_Fill_Rect
(Buffer : DMA2D_Buffer;
Color : UInt32;
X : Integer;
Y : Integer;
Width : Integer;
Height : Integer;
Synchronous : Boolean := False)
is
function Conv is new Ada.Unchecked_Conversion (UInt32, OCOLR_Register);
Off : constant UInt32 := Offset (Buffer, X, Y);
begin
DMA2D_Wait_Transfer_Int.all;
DMA2D_Periph.CR.MODE := DMA2D_MODE'Enum_Rep (R2M);
DMA2D_Periph.OPFCCR :=
(CM => DMA2D_Color_Mode'Enum_Rep (Buffer.Color_Mode),
others => <>);
DMA2D_Periph.OCOLR := Conv (Color);
DMA2D_Periph.OMAR := To_Word (Buffer.Addr) + Off;
DMA2D_Periph.OOR.LO := UInt14 (Buffer.Width - Width);
DMA2D_Periph.NLR :=
(NL => UInt16 (Height), PL => UInt14 (Width), others => <>);
DMA2D_Init_Transfer_Int.all;
if Synchronous then
DMA2D_Wait_Transfer_Int.all;
end if;
end DMA2D_Fill_Rect;
---------------------
-- DMA2D_Draw_Rect --
---------------------
procedure DMA2D_Draw_Rect
(Buffer : DMA2D_Buffer;
Color : UInt32;
X : Integer;
Y : Integer;
Width : Integer;
Height : Integer)
is
begin
DMA2D_Draw_Horizontal_Line (Buffer, Color, X, Y, Width);
DMA2D_Draw_Horizontal_Line (Buffer, Color, X, Y + Height - 1, Width);
DMA2D_Draw_Vertical_Line (Buffer, Color, X, Y, Height);
DMA2D_Draw_Vertical_Line (Buffer, Color, X + Width - 1, Y, Height, True);
end DMA2D_Draw_Rect;
---------------------
-- DMA2D_Copy_Rect --
---------------------
procedure DMA2D_Copy_Rect
(Src_Buffer : DMA2D_Buffer;
X_Src : Natural;
Y_Src : Natural;
Dst_Buffer : DMA2D_Buffer;
X_Dst : Natural;
Y_Dst : Natural;
Bg_Buffer : DMA2D_Buffer;
X_Bg : Natural;
Y_Bg : Natural;
Width : Natural;
Height : Natural;
Synchronous : Boolean := False)
is
Src_Off : constant UInt32 := Offset (Src_Buffer, X_Src, Y_Src);
Dst_Off : constant UInt32 := Offset (Dst_Buffer, X_Dst, Y_Dst);
begin
DMA2D_Wait_Transfer_Int.all;
if Bg_Buffer /= Null_Buffer then
-- PFC and blending
DMA2D_Periph.CR.MODE := DMA2D_MODE'Enum_Rep (M2M_BLEND);
elsif Src_Buffer.Color_Mode = Dst_Buffer.Color_Mode then
-- Direct memory transfer
DMA2D_Periph.CR.MODE := DMA2D_MODE'Enum_Rep (M2M);
else
DMA2D_Periph.CR.MODE := DMA2D_MODE'Enum_Rep (M2M_PFC);
end if;
-- SOURCE CONFIGURATION
DMA2D_Periph.FGPFCCR :=
(CM => DMA2D_Color_Mode'Enum_Rep (Src_Buffer.Color_Mode),
AM => DMA2D_AM'Enum_Rep (NO_MODIF),
ALPHA => 255,
others => <>);
if Src_Buffer.Color_Mode = L8 or else Src_Buffer.Color_Mode = L4 then
if Src_Buffer.CLUT_Addr = System.Null_Address then
raise Program_Error with "Source CLUT address required";
end if;
DMA2D_Periph.FGCMAR := To_Word (Src_Buffer.CLUT_Addr);
DMA2D_Periph.FGCMAR := To_Word (Src_Buffer.CLUT_Addr);
DMA2D_Periph.FGPFCCR.CS := (case Src_Buffer.Color_Mode is
when L8 => 2**8 - 1,
when L4 => 2**4 - 1,
when others => 0);
-- Set CLUT mode to RGB888
DMA2D_Periph.FGPFCCR.CCM := Src_Buffer.CLUT_Color_Mode = RGB888;
-- Start loading the CLUT
DMA2D_Periph.FGPFCCR.START := True;
while DMA2D_Periph.FGPFCCR.START loop
-- Wait for CLUT loading...
null;
end loop;
end if;
DMA2D_Periph.FGOR := (LO => UInt14 (Src_Buffer.Width - Width),
others => <>);
DMA2D_Periph.FGMAR := To_Word (Src_Buffer.Addr) + Src_Off;
if Bg_Buffer /= Null_Buffer then
declare
Bg_Off : constant UInt32 := Offset (Bg_Buffer, X_Bg, Y_Bg);
begin
DMA2D_Periph.BGPFCCR.CM :=
DMA2D_Color_Mode'Enum_Rep (Bg_Buffer.Color_Mode);
DMA2D_Periph.BGMAR := To_Word (Bg_Buffer.Addr) + Bg_Off;
DMA2D_Periph.BGPFCCR.CS := 0;
DMA2D_Periph.BGPFCCR.START := False;
DMA2D_Periph.BGOR :=
(LO => UInt14 (Bg_Buffer.Width - Width), others => <>);
if Bg_Buffer.Color_Mode = L8 or else Bg_Buffer.Color_Mode = L4 then
if Bg_Buffer.CLUT_Addr = System.Null_Address then
raise Program_Error with "Background CLUT address required";
end if;
DMA2D_Periph.BGCMAR := To_Word (Bg_Buffer.CLUT_Addr);
DMA2D_Periph.BGPFCCR.CS := (case Bg_Buffer.Color_Mode is
when L8 => 2**8 - 1,
when L4 => 2**4 - 1,
when others => 0);
-- Set CLUT mode to RGB888
DMA2D_Periph.BGPFCCR.CCM := Bg_Buffer.CLUT_Color_Mode = RGB888;
-- Start loading the CLUT
DMA2D_Periph.BGPFCCR.START := True;
while DMA2D_Periph.BGPFCCR.START loop
-- Wait for CLUT loading...
null;
end loop;
end if;
end;
end if;
-- DST CONFIGURATION
DMA2D_Periph.OPFCCR.CM :=
DMA2D_Color_Mode'Enum_Rep (Dst_Buffer.Color_Mode);
DMA2D_Periph.OMAR := To_Word (Dst_Buffer.Addr) + Dst_Off;
DMA2D_Periph.OOR := (LO => UInt14 (Dst_Buffer.Width - Width),
others => <>);
DMA2D_Periph.NLR := (NL => UInt16 (Height),
PL => UInt14 (Width),
others => <>);
DMA2D_Init_Transfer_Int.all;
if Synchronous then
DMA2D_Wait_Transfer_Int.all;
end if;
end DMA2D_Copy_Rect;
------------------------------
-- DMA2D_Draw_Vertical_Line --
------------------------------
procedure DMA2D_Draw_Vertical_Line
(Buffer : DMA2D_Buffer;
Color : UInt32;
X : Integer;
Y : Integer;
Height : Integer;
Synchronous : Boolean := False)
is
NY, NH : Integer;
begin
if Y >= Buffer.Height
or else X not in 0 .. Buffer.Width - 1
then
return;
end if;
if Y < 0 then
NY := 0;
NH := Height + Y;
else
NY := Y;
NH := Height;
end if;
NH := Integer'Min (NH, Buffer.Height - NY - 1);
DMA2D_Fill_Rect (Buffer, Color, X, NY, 1, NH, Synchronous);
end DMA2D_Draw_Vertical_Line;
--------------------------------
-- DMA2D_Draw_Horizontal_Line --
--------------------------------
procedure DMA2D_Draw_Horizontal_Line
(Buffer : DMA2D_Buffer;
Color : UInt32;
X : Integer;
Y : Integer;
Width : Integer;
Synchronous : Boolean := False)
is
NX, NW : Integer;
begin
if X >= Buffer.Width
or else Y not in 0 .. Buffer.Height - 1
then
return;
end if;
if X < 0 then
NX := 0;
NW := Width + X;
else
NX := X;
NW := Width;
end if;
NW := Integer'Min (NW, Buffer.Width - NX - 1);
DMA2D_Fill_Rect (Buffer, Color, NX, Y, NW, 1, Synchronous);
end DMA2D_Draw_Horizontal_Line;
---------------------
-- DMA2D_Set_Pixel --
---------------------
procedure DMA2D_Set_Pixel
(Buffer : DMA2D_Buffer;
X, Y : Integer;
Color : UInt32;
Synchronous : Boolean := False)
is
function Conv is new Ada.Unchecked_Conversion (UInt32, OCOLR_Register);
Off : constant UInt32 := Offset (Buffer, X, Y);
Dead : Boolean := False with Unreferenced;
begin
if X < 0 or else Y < 0
or else X >= Buffer.Width or else Y >= Buffer.Height
then
return;
end if;
DMA2D_Wait_Transfer_Int.all;
DMA2D_Periph.CR.MODE := DMA2D_MODE'Enum_Rep (R2M);
DMA2D_Periph.OPFCCR.CM := As_UInt3 (Buffer.Color_Mode);
DMA2D_Periph.OCOLR := Conv (Color);
DMA2D_Periph.OMAR := To_Word (Buffer.Addr) + Off;
DMA2D_Periph.OOR := (LO => 1, others => <>);
DMA2D_Periph.NLR := (NL => 1, PL => 1, others => <>);
DMA2D_Init_Transfer_Int.all;
if Synchronous then
DMA2D_Wait_Transfer_Int.all;
end if;
end DMA2D_Set_Pixel;
---------------------------
-- DMA2D_Set_Pixel_Blend --
---------------------------
procedure DMA2D_Set_Pixel_Blend
(Buffer : DMA2D_Buffer;
X, Y : Integer;
Color : DMA2D_Color;
Synchronous : Boolean := False)
is
Off : constant UInt32 := Offset (Buffer, X, Y);
Dead : Boolean := False with Unreferenced;
begin
if X < 0 or else Y < 0
or else X >= Buffer.Width or else Y >= Buffer.Height
then
return;
end if;
DMA2D_Wait_Transfer_Int.all;
-- PFC and blending
DMA2D_Periph.CR.MODE := DMA2D_MODE'Enum_Rep (M2M_BLEND);
-- SOURCE CONFIGURATION
DMA2D_Periph.FGPFCCR.CM := ARGB8888'Enum_Rep;
DMA2D_Periph.FGMAR := To_Word (Color'Address);
DMA2D_Periph.FGPFCCR.AM := DMA2D_AM'Enum_Rep (NO_MODIF);
DMA2D_Periph.FGPFCCR.ALPHA := 255;
DMA2D_Periph.FGPFCCR.CS := 0;
DMA2D_Periph.FGPFCCR.START := False;
DMA2D_Periph.FGOR := (LO => 0, others => <>);
DMA2D_Periph.FGPFCCR.CCM := False; -- Disable CLUT color mode
-- Setup the Background buffer to the destination buffer
DMA2D_Periph.BGPFCCR.CM :=
DMA2D_Color_Mode'Enum_Rep (Buffer.Color_Mode);
DMA2D_Periph.BGMAR := To_Word (Buffer.Addr) + Off;
DMA2D_Periph.BGPFCCR.CS := 0;
DMA2D_Periph.BGPFCCR.START := False;
DMA2D_Periph.BGOR := (LO => UInt14 (Buffer.Width - 1),
others => <>);
DMA2D_Periph.BGPFCCR.CCM := False; -- Disable CLUT color mode
-- DST CONFIGURATION
DMA2D_Periph.OPFCCR.CM :=
DMA2D_Color_Mode'Enum_Rep (Buffer.Color_Mode);
DMA2D_Periph.OMAR := To_Word (Buffer.Addr) + Off;
DMA2D_Periph.OOR := (LO => UInt14 (Buffer.Width - 1),
others => <>);
DMA2D_Periph.NLR := (NL => 1,
PL => 1,
others => <>);
DMA2D_Init_Transfer_Int.all;
if Synchronous then
DMA2D_Wait_Transfer_Int.all;
end if;
end DMA2D_Set_Pixel_Blend;
-------------------------
-- DMA2D_Wait_Transfer --
-------------------------
procedure DMA2D_Wait_Transfer is
begin
DMA2D_Wait_Transfer_Int.all;
end DMA2D_Wait_Transfer;
end STM32.DMA2D;
|
-- Copyright 2017-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.with Interfaces; use Interfaces;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Exceptions; use Ada.Exceptions;
with Identify;
procedure Main is
Argument_Error : exception;
Arg_Count : constant Natural := Argument_Count;
procedure Print_Help;
procedure Print_Help is
begin
Put_Line ("usage: ");
Put_Line (" afile <file>+");
end Print_Help;
begin
if Arg_Count < 1 then
raise Argument_Error with "you need to provide more than one parameter";
else
for I in 1 .. Arg_Count loop
Identify.Identify_File (Argument (I));
end loop;
end if;
exception
when E : Argument_Error =>
Put_Line ("Error: " & Exception_Name (E) &
": " & Exception_Message (E));
Print_Help;
when E : others =>
Put_Line ("Unknown Error: " & Exception_Name (E) &
": " & Exception_Message (E));
end Main;
|
--
-- Copyright 2018 The wookey project team <wookey@ssi.gouv.fr>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
package body soc.syscfg
with spark_mode => off
is
function get_exti_port
(pin : soc.gpio.t_gpio_pin_index)
return soc.gpio.t_gpio_port_index
is
begin
case pin is
when 0 .. 3 =>
return SYSCFG.EXTICR1.exti(pin);
when 4 .. 7 =>
return SYSCFG.EXTICR2.exti(pin);
when 8 .. 11 =>
return SYSCFG.EXTICR3.exti(pin);
when 12 .. 15 =>
return SYSCFG.EXTICR4.exti(pin);
end case;
end get_exti_port;
procedure set_exti_port
(pin : in soc.gpio.t_gpio_pin_index;
port : in soc.gpio.t_gpio_port_index)
is
begin
case pin is
when 0 .. 3 =>
SYSCFG.EXTICR1.exti(pin) := port;
when 4 .. 7 =>
SYSCFG.EXTICR2.exti(pin) := port;
when 8 .. 11 =>
SYSCFG.EXTICR3.exti(pin) := port;
when 12 .. 15 =>
SYSCFG.EXTICR4.exti(pin) := port;
end case;
end set_exti_port;
end soc.syscfg;
|
-- Copyright 2017-2021 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 Str is new String (1 .. 4);
procedure Do_Nothing (A : System.Address);
end pck;
|
package body Julia_Set is
procedure Calculate_Pixel (Re : Real;
Im : Real;
Z_Escape : out Real;
Iter_Escape : out Natural)
is
Re_Mod : Real := Re;
Im_Mod : Real := Im;
begin
for I in 1 .. IT.Max_Iterations loop
declare
ReS : constant Real := Re_Mod * Re_Mod;
ImS : constant Real := Im_Mod * Im_Mod;
begin
if (ReS + ImS) >= Escape_Threshold then
Iter_Escape := I;
Z_Escape := ReS + ImS;
return;
end if;
Im_Mod := (To_Real (2) * Re_Mod * Im_Mod) + Im;
Re_Mod := (ReS - ImS) + Re;
end;
end loop;
Iter_Escape := IT.Max_Iterations;
Z_Escape := Re_Mod * Re_Mod + Im_Mod * Im_Mod;
end Calculate_Pixel;
end Julia_Set;
|
-- CB1010A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT STORAGE_ERROR IS RAISED WHEN STORAGE ALLOCATED TO A TASK
-- IS EXCEEDED.
-- PNH 8/26/85
-- JRK 8/30/85
WITH REPORT; USE REPORT;
PROCEDURE CB1010A IS
N : INTEGER := IDENT_INT (1);
M : INTEGER := IDENT_INT (0);
PROCEDURE OVERFLOW_STACK IS
A : ARRAY (1 .. 1000) OF INTEGER;
BEGIN
N := N + M;
A (N) := M;
IF N > M THEN -- ALWAYS TRUE.
OVERFLOW_STACK;
END IF;
M := A (N); -- TO PREVENT TAIL RECURSION OPTIMIZATION.
END OVERFLOW_STACK;
BEGIN
TEST ("CB1010A", "CHECK THAT STORAGE_ERROR IS RAISED WHEN " &
"STORAGE ALLOCATED TO A TASK IS EXCEEDED");
--------------------------------------------------
COMMENT ("CHECK TASKS THAT DO NOT HANDLE STORAGE_ERROR " &
"PRIOR TO RENDEZVOUS");
DECLARE
TASK T1 IS
ENTRY E1;
END T1;
TASK BODY T1 IS
BEGIN
OVERFLOW_STACK;
FAILED ("TASK T1 NOT TERMINATED BY STACK OVERFLOW");
END T1;
BEGIN
T1.E1;
FAILED ("NO EXCEPTION RAISED BY ENTRY CALL T1.E1");
EXCEPTION
WHEN TASKING_ERROR =>
IF N /= 1 OR M /= 0 THEN
FAILED ("VALUES OF VARIABLES N OR M ALTERED - 1");
END IF;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED BY CALL OF ENTRY E1 " &
"OF TERMINATED TASK T1");
END;
--------------------------------------------------
COMMENT ("CHECK TASKS THAT DO HANDLE STORAGE_ERROR PRIOR TO " &
"RENDEZVOUS");
N := IDENT_INT (1);
M := IDENT_INT (0);
DECLARE
TASK T2 IS
ENTRY E2;
END T2;
TASK BODY T2 IS
BEGIN
OVERFLOW_STACK;
FAILED ("EXCEPTION NOT RAISED BY STACK OVERFLOW IN " &
"TASK T2");
EXCEPTION
WHEN STORAGE_ERROR =>
ACCEPT E2;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED IN TASK T2 BY " &
"STACK OVERFLOW");
END T2;
BEGIN
T2.E2;
IF N /= 1 OR M /= 0 THEN
FAILED ("VALUES OF VARIABLES N OR M ALTERED - 2");
END IF;
EXCEPTION
WHEN OTHERS =>
FAILED ("EXCEPTION RAISED BY ENTRY CALL T2.E2");
ABORT T2;
END;
--------------------------------------------------
COMMENT ("CHECK TASKS THAT DO NOT HANDLE STORAGE_ERROR " &
"DURING RENDEZVOUS");
N := IDENT_INT (1);
M := IDENT_INT (0);
DECLARE
TASK T3 IS
ENTRY E3A;
ENTRY E3B;
END T3;
TASK BODY T3 IS
BEGIN
ACCEPT E3A DO
OVERFLOW_STACK;
FAILED ("EXCEPTION NOT RAISED IN ACCEPT E3A BY " &
"STACK OVERFLOW");
END E3A;
FAILED ("EXCEPTION NOT PROPOGATED CORRECTLY IN TASK T3");
EXCEPTION
WHEN STORAGE_ERROR =>
ACCEPT E3B;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED IN TASK T3 BY " &
"STACK OVERFLOW");
END T3;
BEGIN
T3.E3A;
FAILED ("NO EXCEPTION RAISED BY ENTRY CALL T3.E3A");
EXCEPTION
WHEN STORAGE_ERROR =>
T3.E3B;
IF N /= 1 OR M /= 0 THEN
FAILED ("VALUES OF VARIABLES N OR M ALTERED - 3");
END IF;
WHEN TASKING_ERROR =>
FAILED ("TASKING_ERROR RAISED BY ENTRY CALL T3.E3A " &
"INSTEAD OF STORAGE_ERROR");
ABORT T3;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED BY ENTRY CALL T3.E3A");
ABORT T3;
END;
--------------------------------------------------
RESULT;
END CB1010A;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <vgodunko@gmail.com> --
-- 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;
limited with Matreshka.DOM_Documents;
limited with Matreshka.DOM_Elements;
with XML.DOM.Documents;
with XML.DOM.Nodes;
with XML.DOM.Visitors;
package Matreshka.DOM_Nodes is
pragma Preelaborate;
type Node is tagged;
type Node_Access is access all Node'Class;
type Document_Access is
access all Matreshka.DOM_Documents.Document_Node'Class;
type Element_Access is
access all Matreshka.DOM_Elements.Abstract_Element_Node'Class;
type Node is abstract limited new XML.DOM.Nodes.DOM_Node with record
Document : Document_Access;
Parent : Node_Access;
First : Node_Access;
Last : Node_Access;
Previous : Node_Access;
Next : Node_Access;
-- Previous and next nodes in the doubly linked list of nodes. Each
-- node, except document node, is member of one of three lists:
-- - parent's list of children nodes;
-- - element's list of attribute nodes;
-- - document's list of detached nodes.
end record;
not overriding procedure Enter_Node
(Self : not null access Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is abstract;
-- Dispatch call to corresponding subprogram of visitor interface.
not overriding procedure Leave_Node
(Self : not null access Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is abstract;
-- Dispatch call to corresponding subprogram of visitor interface.
not overriding procedure Visit_Node
(Self : not null access 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 abstract;
-- Dispatch call to corresponding subprogram of iterator interface.
procedure Check_Wrong_Document
(Self : not null access Node'Class;
Node : not null access XML.DOM.Nodes.DOM_Node'Class);
-- Checks whether both nodes belongs to the same document and raise
-- Wrong_Document_Error otherwise.
procedure Raise_Index_Size_Error
(Self : not null access Node'Class)
with Inline => True,
No_Return => True;
procedure Raise_DOMString_Size_Error
(Self : not null access Node'Class)
with Inline => True,
No_Return => True;
procedure Raise_Hierarchy_Request_Error
(Self : not null access Node'Class)
with Inline => True,
No_Return => True;
procedure Raise_Wrong_Document_Error
(Self : not null access Node'Class)
with Inline => True,
No_Return => True;
procedure Raise_Invalid_Character_Error
(Self : not null access Node'Class)
with Inline => True,
No_Return => True;
procedure Raise_No_Data_Allowed_Error
(Self : not null access Node'Class)
with Inline => True,
No_Return => True;
procedure Raise_No_Modification_Allowed_Error
(Self : not null access Node'Class)
with Inline => True,
No_Return => True;
procedure Raise_Not_Found_Error
(Self : not null access Node'Class)
with Inline => True,
No_Return => True;
procedure Raise_Not_Supported_Error
(Self : not null access Node'Class)
with Inline => True,
No_Return => True;
procedure Raise_Inuse_Attribute_Error
(Self : not null access Node'Class)
with Inline => True,
No_Return => True;
procedure Raise_Invalid_State_Error
(Self : not null access Node'Class)
with Inline => True,
No_Return => True;
procedure Raise_Syntax_Error
(Self : not null access Node'Class)
with Inline => True,
No_Return => True;
procedure Raise_Invalid_Modification_Error
(Self : not null access Node'Class)
with Inline => True,
No_Return => True;
procedure Raise_Namespace_Error
(Self : not null access Node'Class)
with Inline => True,
No_Return => True;
procedure Raise_Invalid_Access_Error
(Self : not null access Node'Class)
with Inline => True,
No_Return => True;
procedure Raise_Validation_Error
(Self : not null access Node'Class)
with Inline => True,
No_Return => True;
procedure Raise_Type_Mismatch_Error
(Self : not null access Node'Class)
with Inline => True,
No_Return => True;
overriding function Append_Child
(Self : not null access Node;
New_Child : not null XML.DOM.Nodes.DOM_Node_Access)
return not null XML.DOM.Nodes.DOM_Node_Access;
-- Generic implementation of appending child node. Specialized nodes must
-- override it to add required checks.
overriding function Get_First_Child
(Self : not null access constant Node)
return XML.DOM.Nodes.DOM_Node_Access;
overriding function Get_Last_Child
(Self : not null access constant Node)
return XML.DOM.Nodes.DOM_Node_Access;
overriding function Get_Local_Name
(Self : not null access constant Node)
return League.Strings.Universal_String;
overriding function Get_Namespace_URI
(Self : not null access constant Node)
return League.Strings.Universal_String;
overriding function Get_Next_Sibling
(Self : not null access constant Node)
return XML.DOM.Nodes.DOM_Node_Access;
overriding function Get_Node_Value
(Self : not null access constant Node)
return League.Strings.Universal_String;
overriding function Get_Owner_Document
(Self : not null access constant Node)
return XML.DOM.Documents.DOM_Document_Access;
overriding function Get_Parent_Node
(Self : not null access constant Node)
return XML.DOM.Nodes.DOM_Node_Access;
overriding function Get_Previous_Sibling
(Self : not null access constant Node)
return XML.DOM.Nodes.DOM_Node_Access;
overriding function Remove_Child
(Self : not null access Node;
Old_Child : not null XML.DOM.Nodes.DOM_Node_Access)
return not null XML.DOM.Nodes.DOM_Node_Access;
overriding procedure Set_Node_Value
(Self : not null access Node;
New_Value : League.Strings.Universal_String);
package Constructors is
procedure Initialize
(Self : not null access Node'Class;
Document : not null Document_Access);
end Constructors;
end Matreshka.DOM_Nodes;
|
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Program.Nodes.Component_Definitions is
function Create
(Aliased_Token : Program.Lexical_Elements.Lexical_Element_Access;
Subtype_Indication : not null Program.Elements.Element_Access)
return Component_Definition is
begin
return Result : Component_Definition :=
(Aliased_Token => Aliased_Token,
Subtype_Indication => Subtype_Indication, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Subtype_Indication : not null Program.Elements.Element_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False;
Has_Aliased : Boolean := False)
return Implicit_Component_Definition is
begin
return Result : Implicit_Component_Definition :=
(Subtype_Indication => Subtype_Indication,
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_Aliased => Has_Aliased, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Subtype_Indication
(Self : Base_Component_Definition)
return not null Program.Elements.Element_Access is
begin
return Self.Subtype_Indication;
end Subtype_Indication;
overriding function Aliased_Token
(Self : Component_Definition)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Aliased_Token;
end Aliased_Token;
overriding function Has_Aliased
(Self : Component_Definition)
return Boolean is
begin
return Self.Aliased_Token.Assigned;
end Has_Aliased;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Component_Definition)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Component_Definition)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Component_Definition)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
overriding function Has_Aliased
(Self : Implicit_Component_Definition)
return Boolean is
begin
return Self.Has_Aliased;
end Has_Aliased;
procedure Initialize
(Self : aliased in out Base_Component_Definition'Class) is
begin
Set_Enclosing_Element (Self.Subtype_Indication, Self'Unchecked_Access);
null;
end Initialize;
overriding function Is_Component_Definition_Element
(Self : Base_Component_Definition)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Component_Definition_Element;
overriding function Is_Definition_Element
(Self : Base_Component_Definition)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Definition_Element;
overriding procedure Visit
(Self : not null access Base_Component_Definition;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Component_Definition (Self);
end Visit;
overriding function To_Component_Definition_Text
(Self : aliased in out Component_Definition)
return Program.Elements.Component_Definitions
.Component_Definition_Text_Access is
begin
return Self'Unchecked_Access;
end To_Component_Definition_Text;
overriding function To_Component_Definition_Text
(Self : aliased in out Implicit_Component_Definition)
return Program.Elements.Component_Definitions
.Component_Definition_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Component_Definition_Text;
end Program.Nodes.Component_Definitions;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . S T A C K _ C H E C K I N G . O P E R A T I O N S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1999-2009, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
-- This is the RTEMS version of this package.
-- This file should be kept synchronized with the general implementation
-- provided by s-stchop.adb.
pragma Restrictions (No_Elaboration_Code);
-- We want to guarantee the absence of elaboration code because the
-- binder does not handle references to this package.
with Ada.Exceptions;
with Interfaces.C; use Interfaces.C;
package body System.Stack_Checking.Operations is
----------------------------
-- Invalidate_Stack_Cache --
----------------------------
procedure Invalidate_Stack_Cache (Any_Stack : Stack_Access) is
pragma Warnings (Off, Any_Stack);
begin
Cache := Null_Stack;
end Invalidate_Stack_Cache;
-----------------------------
-- Notify_Stack_Attributes --
-----------------------------
procedure Notify_Stack_Attributes
(Initial_SP : System.Address;
Size : System.Storage_Elements.Storage_Offset)
is
-- RTEMS keeps all the information we need.
pragma Unreferenced (Size);
pragma Unreferenced (Initial_SP);
begin
null;
end Notify_Stack_Attributes;
-----------------
-- Stack_Check --
-----------------
function Stack_Check
(Stack_Address : System.Address) return Stack_Access
is
pragma Unreferenced (Stack_Address);
-- RTEMS has a routine to check if the stack is blown.
-- It returns a C99 bool.
function rtems_stack_checker_is_blown return Interfaces.C.unsigned_char;
pragma Import (C,
rtems_stack_checker_is_blown, "rtems_stack_checker_is_blown");
begin
-- RTEMS has a routine to check this. So use it.
if rtems_stack_checker_is_blown /= 0 then
Ada.Exceptions.Raise_Exception
(E => Storage_Error'Identity,
Message => "stack overflow detected");
end if;
return null;
end Stack_Check;
------------------------
-- Update_Stack_Cache --
------------------------
procedure Update_Stack_Cache (Stack : Stack_Access) is
begin
if not Multi_Processor then
Cache := Stack;
end if;
end Update_Stack_Cache;
end System.Stack_Checking.Operations;
|
with Interfaces.C.Strings;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Characters.Handling;
with Ada.Command_Line;
with GNAT.OS_Lib;
with SDL.Video;
with SDL.Events;
with SDL.Error;
with SDL.Joystick;
with SDL.Types; use SDL.Types;
with SDL.Keysym;
procedure TestJoystick is
package C renames Interfaces.C;
use type C.int;
use type C.unsigned;
package CS renames Interfaces.C.Strings;
use type CS.chars_ptr;
package CH renames Ada.Characters.Handling;
package CL renames Ada.Command_Line;
use type SDL.Init_Flags;
package V renames SDL.Video;
use type V.Surface_ptr;
package Ev renames SDL.Events;
package Er renames SDL.Error;
package Jy renames SDL.Joystick;
use type Jy.HAT_State;
use type Jy.Joy_Button_State;
use type Jy.Joystick_ptr;
package Ks renames SDL.Keysym;
use type Ks.Key;
SCREEN_WIDTH : constant := 640;
SCREEN_HEIGHT : constant := 480;
-- ======================================
procedure WatchJoystick (joystick : Jy.Joystick_ptr) is
screen : V.Surface_ptr;
name : CS.chars_ptr;
done : Boolean;
event : Ev.Event;
x, y : C.int;
draw : C.unsigned range 0 .. 1;
axis_area : V.Rects_Array (0 .. 1);
PollEvent_Result : C.int;
begin
-- Set a video mode to display joystick axis position
screen := V.SetVideoMode (SCREEN_WIDTH, SCREEN_HEIGHT, 16, 0);
if screen = null then
Put_Line ("couldn't set video mode: " & Er.Get_Error);
return;
end if;
-- Print info about the joystick we are watching
name := Jy.JoystickName (Jy.JoystickIndex (joystick));
Put ("Watching joystick " & C.int'Image (Jy.JoystickIndex (joystick)) & ": (");
if name /= CS.Null_Ptr then
Put_Line (CS.Value (name) & ")");
else
Put_Line ("Unknown Joystick)");
end if;
Put_Line ("Joystick has " &
C.int'Image (Jy.JoystickNumAxes (joystick)) & " axes, " &
C.int'Image (Jy.JoystickNumHats (joystick)) & " hats" &
C.int'Image (Jy.JoystickNumBalls (joystick)) & " balls, and " &
C.int'Image (Jy.JoystickNumButtons (joystick)) & " buttons");
-- Initialize drawing rectangles
axis_area := (others => (0,0,0,0));
draw := 0;
-- Loop, getting joystick events
done := False;
while not done loop
loop
Ev.PollEventVP (PollEvent_Result, event);
exit when PollEvent_Result =0;
Put_Line ("DEBUG2");
case event.the_type is
when Ev.JOYAXISMOTION =>
Put_Line ("Joystick " &
Uint8'Image (event.jaxis.which) &
Uint8'Image (event.jaxis.axis) &
Sint16'Image (event.jaxis.value));
when Ev.JOYHATMOTION =>
Put_Line ("Joystick " &
Uint8'Image (event.jhat.which) &
Uint8'Image (event.jhat.hat));
if event.jhat.value = Jy.HAT_CENTERED then
Put (" centered");
end if;
if (event.jhat.value and Jy.HAT_UP) /= 0 then
Put (" up");
end if;
if (event.jhat.value and Jy.HAT_RIGHT) /= 0 then
Put (" right");
end if;
if (event.jhat.value and Jy.HAT_DOWN) /= 0 then
Put (" down");
end if;
if (event.jhat.value and Jy.HAT_LEFT) /= 0 then
Put (" left");
end if;
New_Line;
when Ev.JOYBALLMOTION =>
Put_Line ("Joystick " &
Uint8'Image (event.jball.which) & " ball " &
Uint8'Image (event.jball.ball) & " delta: (" &
Sint16'Image (event.jball.xrel) & "," &
Sint16'Image (event.jball.yrel) & ")");
when Ev.JOYBUTTONDOWN =>
Put_Line ("Joystick " &
Uint8'Image (event.jbutton.which) & " button " &
Uint8'Image (event.jbutton.button) & " down");
when Ev.JOYBUTTONUP =>
Put_Line ("Joystick " &
Uint8'Image (event.jbutton.which) & " button " &
Uint8'Image (event.jbutton.button) & " up");
when Ev.KEYDOWN =>
if event.key.keysym.sym = Ks.K_ESCAPE then
done := True;
end if;
when Ev.QUIT =>
done := True;
when others => null;
end case;
end loop;
-- Update visual joystick state
for i in C.int range 0 .. Jy.JoystickNumButtons (joystick) - 1 loop
declare
area : V.Rects_Array (0..0);
begin
area (0) := (Sint16 (i * 34), SCREEN_HEIGHT - 34, 32, 32);
if Jy.JoystickGetButton (joystick, i) = Jy.PRESSED then
V.FillRect (screen, area (0), 16#FFFF#);
else
V.FillRect (screen, area (0), 16#0000#);
end if;
V.UpdateRects (screen, area'Length, area);
end;
end loop;
-- Erase previous axes
V.FillRect (screen, axis_area (draw), 16#0000#);
-- Draw the X/Y axis
draw := 1 - draw;
x := C.int (Jy.JoystickGetAxis (joystick, 0)) + 32768;
x := x * SCREEN_WIDTH;
x := x / 65535;
if x < 0 then
x := 0;
elsif x > SCREEN_WIDTH - 16 then
x := SCREEN_WIDTH - 16;
end if;
y := C.int (Jy.JoystickGetAxis (joystick, 1)) + 32768;
y := y / 65535;
if y < 0 then
y := 0;
elsif y > SCREEN_HEIGHT - 16 then
y := SCREEN_HEIGHT - 16;
end if;
axis_area (draw).x := Sint16 (x);
axis_area (draw).y := Sint16 (y);
axis_area (draw).w := 16;
axis_area (draw).h := 16;
V.FillRect (screen, axis_area (draw), 16#FFFF#);
V.UpdateRects (screen, axis_area'Length, axis_area);
end loop;
end WatchJoystick;
-- ======================================
name : CS.chars_ptr;
joystick : Jy.Joystick_ptr;
argv_1 : C.int;
begin
-- Initialize SDL (Note: video is required to start event loop)
if SDL.Init (SDL.INIT_VIDEO or SDL.INIT_JOYSTICK) < 0 then
Put_Line ("Could't initialize SDL: " & Er.Get_Error);
GNAT.OS_Lib.OS_Exit (1);
end if;
-- Print information about the joysticks
Put_Line ("There are " & C.int'Image (Jy.NumJoysticks) & " joysticks attached");
for i in C.int range 0 .. Jy.NumJoysticks - 1 loop
name := Jy.JoystickName (i);
Put ("Joystick " & C.int'Image (i) & ": ");
if name /= CS.Null_Ptr then
Put_Line (CS.Value (name));
else
Put_Line ("Unknown Joystick");
end if;
end loop;
if CL.Argument_Count > 0 and then
CH.Is_Digit (CL.Argument (1) (1)) then
declare
package int_IO is new Ada.Text_IO.Integer_IO (C.int);
use int_IO;
last : Positive;
begin
Get (CL.Argument (1), argv_1, last);
end;
joystick := Jy.JoystickOpen (argv_1);
if joystick = Jy.Null_Joystick_ptr then
Put_Line ("Couldn't open joystick " & C.int'Image (argv_1) &
": " & Er.Get_Error);
else
WatchJoystick (joystick);
Jy.JoystickClose (joystick);
end if;
end if;
SDL.QuitSubSystem (SDL.INIT_VIDEO or SDL.INIT_JOYSTICK);
GNAT.OS_Lib.OS_Exit (0);
end TestJoystick;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T . B Y T E _ O R D E R _ M A R K --
-- --
-- S p e c --
-- --
-- Copyright (C) 2006-2020, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides a procedure for reading and interpreting the BOM
-- (byte order mark) used to publish the encoding method for a string (for
-- example, a UTF-8 encoded file in windows will start with the appropriate
-- BOM sequence to signal UTF-8 encoding).
-- There are two cases
-- Case 1. UTF encodings for Unicode files
-- Here the convention is to have the first character of the file be a
-- non-breaking zero width space character (16#0000_FEFF#). For the UTF
-- encodings, the representation of this character can be used to uniquely
-- determine the encoding. Furthermore, the possibility of any confusion
-- with unencoded files is minimal, since for example the UTF-8 encoding
-- of this character looks like the sequence:
-- LC_I_Diaeresis
-- Right_Angle_Quotation
-- Fraction_One_Half
-- which is so unlikely to occur legitimately in normal use that it can
-- safely be ignored in most cases (for example, no legitimate Ada source
-- file could start with this sequence of characters).
-- Case 2. Specialized XML encodings
-- The XML standard defines a number of other possible encodings and also
-- defines standardized sequences for marking these encodings. This package
-- can also optionally handle these XML defined BOM sequences. These XML
-- cases depend on the first character of the XML file being < so that the
-- encoding of this character can be recognized.
pragma Compiler_Unit_Warning;
package GNAT.Byte_Order_Mark is
type BOM_Kind is
(UTF8_All, -- UTF8-encoding
UTF16_LE, -- UTF16 little-endian encoding
UTF16_BE, -- UTF16 big-endian encoding
UTF32_LE, -- UTF32 little-endian encoding
UTF32_BE, -- UTF32 big-endian encoding
-- The following cases are for XML only
UCS4_BE, -- UCS-4, big endian machine (1234 order)
UCS4_LE, -- UCS-4, little endian machine (4321 order)
UCS4_2143, -- UCS-4, unusual byte order (2143 order)
UCS4_3412, -- UCS-4, unusual byte order (3412 order)
-- Value returned if no BOM recognized
Unknown); -- Unknown, assumed to be ASCII compatible
procedure Read_BOM
(Str : String;
Len : out Natural;
BOM : out BOM_Kind;
XML_Support : Boolean := False);
-- This is the routine to read the BOM from the start of the given string
-- Str. On return BOM is set to the appropriate BOM_Kind and Len is set to
-- its length. The caller will typically skip the first Len characters in
-- the string to ignore the BOM sequence. The special XML possibilities are
-- recognized only if flag XML_Support is set to True. Note that for the
-- XML cases, Len is always set to zero on return (not to the length of the
-- relevant sequence) since in the XML cases, the sequence recognized is
-- for the first real character in the file (<) which is not to be skipped.
end GNAT.Byte_Order_Mark;
|
------------------------------------------------------------------------------
-- ZLib for Ada thick binding. --
-- --
-- Copyright (C) 2002-2004 Dmitriy Anisimkov --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under the terms of the GNU General Public License as published by --
-- the Free Software Foundation; either version 2 of the License, or (at --
-- your option) any later version. --
-- --
-- This library is distributed in the hope that it will be useful, but --
-- WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public License --
-- along with this library; if not, write to the Free Software Foundation, --
-- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
------------------------------------------------------------------------------
-- $Id: zlib.ads $
with Ada.Streams;
with Interfaces;
package ZLib is
ZLib_Error : exception;
Status_Error : exception;
type Compression_Level is new Integer range -1 .. 9;
type Flush_Mode is private;
type Compression_Method is private;
type Window_Bits_Type is new Integer range 8 .. 15;
type Memory_Level_Type is new Integer range 1 .. 9;
type Unsigned_32 is new Interfaces.Unsigned_32;
type Strategy_Type is private;
type Header_Type is (None, Auto, Default, GZip);
-- Header type usage have a some limitation for inflate.
-- See comment for Inflate_Init.
subtype Count is Ada.Streams.Stream_Element_Count;
Default_Memory_Level : constant Memory_Level_Type := 8;
Default_Window_Bits : constant Window_Bits_Type := 15;
----------------------------------
-- Compression method constants --
----------------------------------
Deflated : constant Compression_Method;
-- Only one method allowed in this ZLib version
---------------------------------
-- Compression level constants --
---------------------------------
No_Compression : constant Compression_Level := 0;
Best_Speed : constant Compression_Level := 1;
Best_Compression : constant Compression_Level := 9;
Default_Compression : constant Compression_Level := -1;
--------------------------
-- Flush mode constants --
--------------------------
No_Flush : constant Flush_Mode;
-- Regular way for compression, no flush
Partial_Flush : constant Flush_Mode;
-- Will be removed, use Z_SYNC_FLUSH instead
Sync_Flush : constant Flush_Mode;
-- All pending output is flushed to the output buffer and the output
-- is aligned on a byte boundary, so that the decompressor can get all
-- input data available so far. (In particular avail_in is zero after the
-- call if enough output space has been provided before the call.)
-- Flushing may degrade compression for some compression algorithms and so
-- it should be used only when necessary.
Block_Flush : constant Flush_Mode;
-- Z_BLOCK requests that inflate() stop
-- if and when it get to the next deflate block boundary. When decoding the
-- zlib or gzip format, this will cause inflate() to return immediately
-- after the header and before the first block. When doing a raw inflate,
-- inflate() will go ahead and process the first block, and will return
-- when it gets to the end of that block, or when it runs out of data.
Full_Flush : constant Flush_Mode;
-- All output is flushed as with SYNC_FLUSH, and the compression state
-- is reset so that decompression can restart from this point if previous
-- compressed data has been damaged or if random access is desired. Using
-- Full_Flush too often can seriously degrade the compression.
Finish : constant Flush_Mode;
-- Just for tell the compressor that input data is complete.
------------------------------------
-- Compression strategy constants --
------------------------------------
-- RLE stategy could be used only in version 1.2.0 and later.
Filtered : constant Strategy_Type;
Huffman_Only : constant Strategy_Type;
RLE : constant Strategy_Type;
Default_Strategy : constant Strategy_Type;
Default_Buffer_Size : constant := 4096;
type Filter_Type is tagged limited private;
-- The filter is for compression and for decompression.
-- The usage of the type is depend of its initialization.
function Version return String;
pragma Inline (Version);
-- Return string representation of the ZLib version.
procedure Deflate_Init
(Filter : in out Filter_Type;
Level : in Compression_Level := Default_Compression;
Strategy : in Strategy_Type := Default_Strategy;
Method : in Compression_Method := Deflated;
Window_Bits : in Window_Bits_Type := Default_Window_Bits;
Memory_Level : in Memory_Level_Type := Default_Memory_Level;
Header : in Header_Type := Default);
-- Compressor initialization.
-- When Header parameter is Auto or Default, then default zlib header
-- would be provided for compressed data.
-- When Header is GZip, then gzip header would be set instead of
-- default header.
-- When Header is None, no header would be set for compressed data.
procedure Inflate_Init
(Filter : in out Filter_Type;
Window_Bits : in Window_Bits_Type := Default_Window_Bits;
Header : in Header_Type := Default);
-- Decompressor initialization.
-- Default header type mean that ZLib default header is expecting in the
-- input compressed stream.
-- Header type None mean that no header is expecting in the input stream.
-- GZip header type mean that GZip header is expecting in the
-- input compressed stream.
-- Auto header type mean that header type (GZip or Native) would be
-- detected automatically in the input stream.
-- Note that header types parameter values None, GZip and Auto are
-- supported for inflate routine only in ZLib versions 1.2.0.2 and later.
-- Deflate_Init is supporting all header types.
function Is_Open (Filter : in Filter_Type) return Boolean;
pragma Inline (Is_Open);
-- Is the filter opened for compression or decompression.
procedure Close
(Filter : in out Filter_Type;
Ignore_Error : in Boolean := False);
-- Closing the compression or decompressor.
-- If stream is closing before the complete and Ignore_Error is False,
-- The exception would be raised.
generic
with procedure Data_In
(Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset);
with procedure Data_Out
(Item : in Ada.Streams.Stream_Element_Array);
procedure Generic_Translate
(Filter : in out Filter_Type;
In_Buffer_Size : in Integer := Default_Buffer_Size;
Out_Buffer_Size : in Integer := Default_Buffer_Size);
-- Compress/decompress data fetch from Data_In routine and pass the result
-- to the Data_Out routine. User should provide Data_In and Data_Out
-- for compression/decompression data flow.
-- Compression or decompression depend on Filter initialization.
function Total_In (Filter : in Filter_Type) return Count;
pragma Inline (Total_In);
-- Returns total number of input bytes read so far
function Total_Out (Filter : in Filter_Type) return Count;
pragma Inline (Total_Out);
-- Returns total number of bytes output so far
function CRC32
(CRC : in Unsigned_32;
Data : in Ada.Streams.Stream_Element_Array)
return Unsigned_32;
pragma Inline (CRC32);
-- Compute CRC32, it could be necessary for make gzip format
procedure CRC32
(CRC : in out Unsigned_32;
Data : in Ada.Streams.Stream_Element_Array);
pragma Inline (CRC32);
-- Compute CRC32, it could be necessary for make gzip format
-------------------------------------------------
-- Below is more complex low level routines. --
-------------------------------------------------
procedure Translate
(Filter : in out Filter_Type;
In_Data : in Ada.Streams.Stream_Element_Array;
In_Last : out Ada.Streams.Stream_Element_Offset;
Out_Data : out Ada.Streams.Stream_Element_Array;
Out_Last : out Ada.Streams.Stream_Element_Offset;
Flush : in Flush_Mode);
-- Compress/decompress the In_Data buffer and place the result into
-- Out_Data. In_Last is the index of last element from In_Data accepted by
-- the Filter. Out_Last is the last element of the received data from
-- Filter. To tell the filter that incoming data are complete put the
-- Flush parameter to Finish.
function Stream_End (Filter : in Filter_Type) return Boolean;
pragma Inline (Stream_End);
-- Return the true when the stream is complete.
procedure Flush
(Filter : in out Filter_Type;
Out_Data : out Ada.Streams.Stream_Element_Array;
Out_Last : out Ada.Streams.Stream_Element_Offset;
Flush : in Flush_Mode);
pragma Inline (Flush);
-- Flushing the data from the compressor.
generic
with procedure Write
(Item : in Ada.Streams.Stream_Element_Array);
-- User should provide this routine for accept
-- compressed/decompressed data.
Buffer_Size : in Ada.Streams.Stream_Element_Offset
:= Default_Buffer_Size;
-- Buffer size for Write user routine.
procedure Write
(Filter : in out Filter_Type;
Item : in Ada.Streams.Stream_Element_Array;
Flush : in Flush_Mode := No_Flush);
-- Compress/Decompress data from Item to the generic parameter procedure
-- Write. Output buffer size could be set in Buffer_Size generic parameter.
generic
with procedure Read
(Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset);
-- User should provide data for compression/decompression
-- thru this routine.
Buffer : in out Ada.Streams.Stream_Element_Array;
-- Buffer for keep remaining data from the previous
-- back read.
Rest_First, Rest_Last : in out Ada.Streams.Stream_Element_Offset;
-- Rest_First have to be initialized to Buffer'Last + 1
-- Rest_Last have to be initialized to Buffer'Last
-- before usage.
Allow_Read_Some : in Boolean := False;
-- Is it allowed to return Last < Item'Last before end of data.
procedure Read
(Filter : in out Filter_Type;
Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
Flush : in Flush_Mode := No_Flush);
-- Compress/Decompress data from generic parameter procedure Read to the
-- Item. User should provide Buffer and initialized Rest_First, Rest_Last
-- indicators. If Allow_Read_Some is True, Read routines could return
-- Last < Item'Last only at end of stream.
private
use Ada.Streams;
pragma Assert (Ada.Streams.Stream_Element'Size = 8);
pragma Assert (Ada.Streams.Stream_Element'Modulus = 2**8);
type Flush_Mode is new Integer range 0 .. 5;
type Compression_Method is new Integer range 8 .. 8;
type Strategy_Type is new Integer range 0 .. 3;
No_Flush : constant Flush_Mode := 0;
Partial_Flush : constant Flush_Mode := 1;
Sync_Flush : constant Flush_Mode := 2;
Full_Flush : constant Flush_Mode := 3;
Finish : constant Flush_Mode := 4;
Block_Flush : constant Flush_Mode := 5;
Filtered : constant Strategy_Type := 1;
Huffman_Only : constant Strategy_Type := 2;
RLE : constant Strategy_Type := 3;
Default_Strategy : constant Strategy_Type := 0;
Deflated : constant Compression_Method := 8;
type Z_Stream;
type Z_Stream_Access is access all Z_Stream;
type Filter_Type is tagged limited record
Strm : Z_Stream_Access;
Compression : Boolean;
Stream_End : Boolean;
Header : Header_Type;
CRC : Unsigned_32;
Offset : Stream_Element_Offset;
-- Offset for gzip header/footer output.
end record;
end ZLib;
|
-- C52008A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT A RECORD VARIABLE CONSTRAINED BY A SPECIFIED DISCRIMINANT
-- VALUE CANNOT HAVE ITS DISCRIMINANT VALUE ALTERED BY ASSIGNMENT.
-- ASSIGNING AN ENTIRE RECORD VALUE WITH A DIFFERENT DISCRIMINANT VALUE
-- SHOULD RAISE CONSTRAINT_ERROR AND LEAVE THE TARGET VARIABLE
-- UNALTERED. THIS TEST USES STATIC DISCRIMINANT VALUES.
-- ASL 6/25/81
-- SPS 3/21/83
WITH REPORT;
PROCEDURE C52008A IS
USE REPORT;
TYPE REC(DISC : INTEGER) IS
RECORD
COMP : INTEGER;
END RECORD;
R : REC(5) := (5,0);
BEGIN
TEST ("C52008A", "CANNOT ASSIGN RECORD VARIABLE WITH SPECIFIED " &
"DISCRIMINANT VALUE A VALUE WITH A DIFFERENT " &
"STATIC DISCRIMINANT VALUE");
BEGIN
R := (DISC => 5, COMP => 3);
IF R /= (5,3) THEN
FAILED ("LEGAL ASSIGNMENT FAILED");
END IF;
R := (DISC => 4, COMP => 2);
FAILED ("RECORD ASSIGNED VALUE WITH DIFFERENT DISCRIMINANT " &
"VALUE");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
IF R /= (5,3) THEN
FAILED ("TARGET RECORD VALUE ALTERED BY " &
"ASSIGNMENT TO VALUE WITH DIFFERENT " &
"DISCRIMINANT VALUE EVEN AFTER " &
"CONSTRAINT_ERROR RAISED");
END IF;
WHEN OTHERS => FAILED ("WRONG EXCEPTION");
END;
RESULT;
END C52008A;
|
-------------------------------------------------------------------------------
-- This file is part of libsparkcrypto.
--
-- Copyright (C) 2010, Alexander Senier
-- Copyright (C) 2010, secunet Security Networks AG
-- 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 nor the names of its contributors may be used
-- to endorse or promote products derived from this software without
-- specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
-- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------
with LSC.Internal.Byteswap32;
with LSC.Internal.Byteswap64;
with AUnit.Assertions; use AUnit.Assertions;
with Interfaces;
use type Interfaces.Unsigned_32;
use type Interfaces.Unsigned_64;
pragma Style_Checks ("-s");
pragma Warnings (Off, "formal parameter ""T"" is not referenced");
package body LSC_Internal_Test_Shadow
is
procedure Test_Byteswap32 (T : in out Test_Cases.Test_Case'Class)
is
begin
Assert (LSC.Internal.Byteswap32.Swap (16#aabbccdd#) = 16#ddccbbaa#, "Invalid result");
end Test_Byteswap32;
---------------------------------------------------------------------------
procedure Test_Byteswap64 (T : in out Test_Cases.Test_Case'Class)
is
begin
Assert (LSC.Internal.Byteswap64.Swap (16#aabbccddeeff0011#) = 16#1100ffeeddccbbaa#, "Invalid result");
end Test_Byteswap64;
---------------------------------------------------------------------------
procedure Register_Tests (T : in out Test_Case) is
use AUnit.Test_Cases.Registration;
begin
Register_Routine (T, Test_Byteswap32'Access, "Byte swap (32-bit)");
Register_Routine (T, Test_Byteswap64'Access, "Byte swap (64-bit)");
end Register_Tests;
---------------------------------------------------------------------------
function Name (T : Test_Case) return Test_String is
begin
return Format ("Shadow");
end Name;
end LSC_Internal_Test_Shadow;
|
with ada.text_io, ada.Integer_text_IO, Ada.Text_IO.Text_Streams, Ada.Strings.Fixed, Interfaces.C;
use ada.text_io, ada.Integer_text_IO, Ada.Strings, Ada.Strings.Fixed, Interfaces.C;
procedure euler45 is
type stringptr is access all char_array;
procedure PString(s : stringptr) is
begin
String'Write (Text_Streams.Stream (Current_Output), To_Ada(s.all));
end;
procedure PInt(i : in Integer) is
begin
String'Write (Text_Streams.Stream (Current_Output), Trim(Integer'Image(i), Left));
end;
function triangle(n : in Integer) return Integer is
begin
if n rem 2 = 0
then
return (n / 2) * (n + 1);
else
return n * ((n + 1) / 2);
end if;
end;
function penta(n : in Integer) return Integer is
begin
if n rem 2 = 0
then
return (n / 2) * (3 * n - 1);
else
return ((3 * n - 1) / 2) * n;
end if;
end;
function hexa(n : in Integer) return Integer is
begin
return n * (2 * n - 1);
end;
function findPenta2(n : in Integer; a : in Integer; b : in Integer) return Boolean is
p : Integer;
c : Integer;
begin
if b = a + 1
then
return penta(a) = n or else penta(b) = n;
end if;
c := (a + b) / 2;
p := penta(c);
if p = n
then
return TRUE;
else
if p < n
then
return findPenta2(n, c, b);
else
return findPenta2(n, a, c);
end if;
end if;
end;
function findHexa2(n : in Integer; a : in Integer; b : in Integer) return Boolean is
p : Integer;
c : Integer;
begin
if b = a + 1
then
return hexa(a) = n or else hexa(b) = n;
end if;
c := (a + b) / 2;
p := hexa(c);
if p = n
then
return TRUE;
else
if p < n
then
return findHexa2(n, c, b);
else
return findHexa2(n, a, c);
end if;
end if;
end;
t : Integer;
begin
for n in integer range 285..55385 loop
t := triangle(n);
if findPenta2(t, n / 5, n) and then findHexa2(t, n / 5, n / 2 + 10)
then
PInt(n);
PString(new char_array'( To_C("" & Character'Val(10))));
PInt(t);
PString(new char_array'( To_C("" & Character'Val(10))));
end if;
end loop;
end;
|
------------------------------------------------------------------------------
-- Copyright (C) 2020 by Heisenbug Ltd. (gh+spat@heisenbug.eu)
--
-- This work is free. You can redistribute it and/or modify it under the
-- terms of the Do What The Fuck You Want To Public License, Version 2,
-- as published by Sam Hocevar. See the LICENSE file for more details.
------------------------------------------------------------------------------
pragma License (Unrestricted);
------------------------------------------------------------------------------
--
-- SPARK Proof Analysis Tool
--
-- S.P.A.T. - A tree holding descendant objects of Entity.T.
--
------------------------------------------------------------------------------
with Ada.Containers.Indefinite_Multiway_Trees;
package SPAT.Entity.Tree is
package Implementation is
package Trees is new
Ada.Containers.Indefinite_Multiway_Trees (Element_Type => T'Class);
end Implementation;
type T is new Implementation.Trees.Tree with private;
subtype Forward_Iterator is
Implementation.Trees.Tree_Iterator_Interfaces.Forward_Iterator;
subtype Cursor is Implementation.Trees.Cursor;
No_Element : Cursor renames Implementation.Trees.No_Element;
function "=" (Left : in Cursor;
Right : in Cursor) return Boolean
renames Implementation.Trees."=";
function Child_Count (Parent : in Cursor) return Ada.Containers.Count_Type
renames Implementation.Trees.Child_Count;
function Child_Depth (Parent : in Cursor;
Child : in Cursor) return Ada.Containers.Count_Type
renames Implementation.Trees.Child_Depth;
function Element (Position : in Cursor) return Entity.T'Class
renames Implementation.Trees.Element;
function First_Child (Position : in Cursor) return Cursor
renames Implementation.Trees.First_Child;
function Last_Child (Position : in Cursor) return Cursor
renames Implementation.Trees.Last_Child;
function Next_Sibling (Position : in Cursor) return Cursor
renames Implementation.Trees.Next_Sibling;
procedure Next_Sibling (Position : in out Cursor)
renames Implementation.Trees.Next_Sibling;
function Previous_Sibling (Position : in Cursor) return Cursor
renames Implementation.Trees.Previous_Sibling;
procedure Previous_Sibling (Position : in out Cursor)
renames Implementation.Trees.Previous_Sibling;
function Iterate_Subtree (Position : Cursor) return Forward_Iterator'Class
renames Implementation.Trees.Iterate_Subtree;
-- Sort a subtree by sorting criteria of elements contained.
generic
with function Before (Left : in Entity.T'Class;
Right : in Entity.T'Class) return Boolean;
package Generic_Sorting is
procedure Sort (Tree : in out T;
Parent : in Cursor);
end Generic_Sorting;
private
type T is new Implementation.Trees.Tree with null record;
end SPAT.Entity.Tree;
|
with Varsize3_Pkg2;
with Varsize3_Pkg3;
package Varsize3_Pkg1 is
type Arr is array (Positive range 1 .. Varsize3_Pkg2.Last_Index) of Boolean;
package My_G is new Varsize3_Pkg3 (Arr);
type Object is new My_G.Object;
end Varsize3_Pkg1;
|
with SPARKNaCl; use SPARKNaCl;
with SPARKNaCl.Debug; use SPARKNaCl.Debug;
with SPARKNaCl.Scalar; use SPARKNaCl.Scalar;
procedure Scalarmult
is
AliceSK : constant Bytes_32 :=
(16#77#, 16#07#, 16#6d#, 16#0a#, 16#73#, 16#18#, 16#a5#, 16#7d#,
16#3c#, 16#16#, 16#c1#, 16#72#, 16#51#, 16#b2#, 16#66#, 16#45#,
16#df#, 16#4c#, 16#2f#, 16#87#, 16#eb#, 16#c0#, 16#99#, 16#2a#,
16#b1#, 16#77#, 16#fb#, 16#a5#, 16#1d#, 16#b9#, 16#2c#, 16#2a#);
AlicePK : Bytes_32;
begin
AlicePK := Mult_Base (AliceSK);
DH ("AlicePK is", AlicePK);
end Scalarmult;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 3 4 --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.Storage_Elements;
with System.Unsigned_Types;
package body System.Pack_34 is
subtype Bit_Order is System.Bit_Order;
Reverse_Bit_Order : constant Bit_Order :=
Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
subtype Ofs is System.Storage_Elements.Storage_Offset;
subtype Uns is System.Unsigned_Types.Unsigned;
subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
use type System.Storage_Elements.Storage_Offset;
use type System.Unsigned_Types.Unsigned;
type Cluster is record
E0, E1, E2, E3, E4, E5, E6, E7 : Bits_34;
end record;
for Cluster use record
E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
end record;
for Cluster'Size use Bits * 8;
for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
1 +
1 * Boolean'Pos (Bits mod 2 = 0) +
2 * Boolean'Pos (Bits mod 4 = 0));
-- Use maximum possible alignment, given the bit field size, since this
-- will result in the most efficient code possible for the field.
type Cluster_Ref is access Cluster;
type Rev_Cluster is new Cluster
with Bit_Order => Reverse_Bit_Order,
Scalar_Storage_Order => Reverse_Bit_Order;
type Rev_Cluster_Ref is access Rev_Cluster;
-- The following declarations are for the case where the address
-- passed to GetU_34 or SetU_34 is not guaranteed to be aligned.
-- These routines are used when the packed array is itself a
-- component of a packed record, and therefore may not be aligned.
type ClusterU is new Cluster;
for ClusterU'Alignment use 1;
type ClusterU_Ref is access ClusterU;
type Rev_ClusterU is new ClusterU
with Bit_Order => Reverse_Bit_Order,
Scalar_Storage_Order => Reverse_Bit_Order;
type Rev_ClusterU_Ref is access Rev_ClusterU;
------------
-- Get_34 --
------------
function Get_34
(Arr : System.Address;
N : Natural;
Rev_SSO : Boolean) return Bits_34
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : Cluster_Ref with Address => A'Address, Import;
RC : Rev_Cluster_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => return RC.E0;
when 1 => return RC.E1;
when 2 => return RC.E2;
when 3 => return RC.E3;
when 4 => return RC.E4;
when 5 => return RC.E5;
when 6 => return RC.E6;
when 7 => return RC.E7;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
when 1 => return C.E1;
when 2 => return C.E2;
when 3 => return C.E3;
when 4 => return C.E4;
when 5 => return C.E5;
when 6 => return C.E6;
when 7 => return C.E7;
end case;
end if;
end Get_34;
-------------
-- GetU_34 --
-------------
function GetU_34
(Arr : System.Address;
N : Natural;
Rev_SSO : Boolean) return Bits_34
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : ClusterU_Ref with Address => A'Address, Import;
RC : Rev_ClusterU_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => return RC.E0;
when 1 => return RC.E1;
when 2 => return RC.E2;
when 3 => return RC.E3;
when 4 => return RC.E4;
when 5 => return RC.E5;
when 6 => return RC.E6;
when 7 => return RC.E7;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
when 1 => return C.E1;
when 2 => return C.E2;
when 3 => return C.E3;
when 4 => return C.E4;
when 5 => return C.E5;
when 6 => return C.E6;
when 7 => return C.E7;
end case;
end if;
end GetU_34;
------------
-- Set_34 --
------------
procedure Set_34
(Arr : System.Address;
N : Natural;
E : Bits_34;
Rev_SSO : Boolean)
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : Cluster_Ref with Address => A'Address, Import;
RC : Rev_Cluster_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => RC.E0 := E;
when 1 => RC.E1 := E;
when 2 => RC.E2 := E;
when 3 => RC.E3 := E;
when 4 => RC.E4 := E;
when 5 => RC.E5 := E;
when 6 => RC.E6 := E;
when 7 => RC.E7 := E;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
when 1 => C.E1 := E;
when 2 => C.E2 := E;
when 3 => C.E3 := E;
when 4 => C.E4 := E;
when 5 => C.E5 := E;
when 6 => C.E6 := E;
when 7 => C.E7 := E;
end case;
end if;
end Set_34;
-------------
-- SetU_34 --
-------------
procedure SetU_34
(Arr : System.Address;
N : Natural;
E : Bits_34;
Rev_SSO : Boolean)
is
A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
C : ClusterU_Ref with Address => A'Address, Import;
RC : Rev_ClusterU_Ref with Address => A'Address, Import;
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is
when 0 => RC.E0 := E;
when 1 => RC.E1 := E;
when 2 => RC.E2 := E;
when 3 => RC.E3 := E;
when 4 => RC.E4 := E;
when 5 => RC.E5 := E;
when 6 => RC.E6 := E;
when 7 => RC.E7 := E;
end case;
else
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
when 1 => C.E1 := E;
when 2 => C.E2 := E;
when 3 => C.E3 := E;
when 4 => C.E4 := E;
when 5 => C.E5 := E;
when 6 => C.E6 := E;
when 7 => C.E7 := E;
end case;
end if;
end SetU_34;
end System.Pack_34;
|
-- SPDX-FileCopyrightText: 2021 Max Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Ada.Containers;
with LLVM.Types;
with Lace.Contexts;
with Lace.Generic_Engines;
package Lace.LLVM_Contexts is
-- pragma Preelaborate;
type LLVM_Context;
type LLVM_Type_Property is (LLVM_Type);
subtype Dummy_Variant is Ada.Containers.Hash_Type;
type Integer_Property is (Done);
package Integer_Engines is new Lace.Generic_Engines
(Property_Name => Integer_Property,
Property_Value => Integer,
Abstract_Context => LLVM_Context,
Variant_Kind => Dummy_Variant,
Hash => Dummy_Variant'Mod);
package LLVM_Type_Engines is new Lace.Generic_Engines
(Property_Name => LLVM_Type_Property,
Property_Value => LLVM.Types.Type_T,
Abstract_Context => LLVM_Context,
Variant_Kind => Dummy_Variant,
Hash => Dummy_Variant'Mod);
type LLVM_Value_Property is (LLVM_Value);
package LLVM_Value_Engines is new Lace.Generic_Engines
(Property_Name => LLVM_Value_Property,
Property_Value => LLVM.Types.Value_T,
Abstract_Context => LLVM_Context,
Variant_Kind => Dummy_Variant,
Hash => Dummy_Variant'Mod);
type LLVM_Block_Property is (LLVM_Block);
package LLVM_Block_Engines is new Lace.Generic_Engines
(Property_Name => LLVM_Block_Property,
Property_Value => LLVM.Types.Basic_Block_T,
Abstract_Context => LLVM_Context,
Variant_Kind => Dummy_Variant,
Hash => Dummy_Variant'Mod);
type LLVM_Meta_Property is (LLVM_Meta);
package LLVM_Meta_Engines is new Lace.Generic_Engines
(Property_Name => LLVM_Meta_Property,
Property_Value => LLVM.Types.Metadata_T,
Abstract_Context => LLVM_Context,
Variant_Kind => Dummy_Variant,
Hash => Dummy_Variant'Mod);
type LLVM_Context is new Lace.Contexts.Context with record
LLVM_Int : aliased Integer_Engines.Engine
(LLVM_Context'Unchecked_Access);
LLVM_Type : aliased LLVM_Type_Engines.Engine
(LLVM_Context'Unchecked_Access);
LLVM_Value : aliased LLVM_Value_Engines.Engine
(LLVM_Context'Unchecked_Access);
LLVM_Block : aliased LLVM_Block_Engines.Engine
(LLVM_Context'Unchecked_Access);
LLVM_Meta : aliased LLVM_Meta_Engines.Engine
(LLVM_Context'Unchecked_Access);
Context : LLVM.Types.Context_T;
Module : LLVM.Types.Module_T;
Builder : LLVM.Types.Builder_T;
end record;
end Lace.LLVM_Contexts;
|
-- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_glx_get_separable_filter_request_t is
-- Item
--
type Item is record
major_opcode : aliased Interfaces.Unsigned_8;
minor_opcode : aliased Interfaces.Unsigned_8;
length : aliased Interfaces.Unsigned_16;
context_tag : aliased xcb.xcb_glx_context_tag_t;
target : aliased Interfaces.Unsigned_32;
format : aliased Interfaces.Unsigned_32;
the_type : aliased Interfaces.Unsigned_32;
swap_bytes : aliased Interfaces.Unsigned_8;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb
.xcb_glx_get_separable_filter_request_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_get_separable_filter_request_t.Item,
Element_Array => xcb.xcb_glx_get_separable_filter_request_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb
.xcb_glx_get_separable_filter_request_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_get_separable_filter_request_t.Pointer,
Element_Array =>
xcb.xcb_glx_get_separable_filter_request_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_glx_get_separable_filter_request_t;
|
-- ----------------------------------------------------------------- --
-- AdaSDL --
-- Binding to Simple Direct Media Layer --
-- Copyright (C) 2001 A.M.F.Vargas --
-- Antonio M. F. Vargas --
-- Ponta Delgada - Azores - Portugal --
-- http://www.adapower.net/~avargas --
-- E-mail: avargas@adapower.net --
-- ----------------------------------------------------------------- --
-- --
-- This library is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public --
-- License as published by the Free Software Foundation; either --
-- version 2 of the License, or (at your option) any later version. --
-- --
-- This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public --
-- License along with this library; if not, write to the --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330, --
-- Boston, MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-- ----------------------------------------------------------------- --
-- **************************************************************** --
-- This is an Ada binding to SDL ( Simple DirectMedia Layer from --
-- Sam Lantinga - www.libsld.org ) --
-- **************************************************************** --
-- In order to help the Ada programmer, the comments in this file --
-- are, in great extent, a direct copy of the original text in the --
-- SDL header files. --
-- **************************************************************** --
----------------------------------------------
-- This package is here for compatibility --
-- with SDL. The Ada programming language --
-- has far better portable multithread and --
-- sincronization mechanisms. --
----------------------------------------------
with SDL.Types; use SDL.Types;
with Interfaces.C;
with System;
package SDL.Mutex is
package C renames Interfaces.C;
MUTEX_TIMEDOUT : constant := 1;
MUTEX_MAXWAIT : constant := 16#FFFFFFFF#;
------------------------
-- Mutex subprograms --
------------------------
-- A pointer to the SDL mutex structure defined
-- in SDL_mutex.c
type mutex_ptr is new System.Address;
null_mutex_ptr : constant mutex_ptr := mutex_ptr (System.Null_Address);
-- Create a mutex, initialized unlocked
function CreateMutex return mutex_ptr;
pragma Import (C, CreateMutex, "SDL_CreateMutex");
-- Lock the mutex (Returns 0 or -1 on error)
function mutexP (mutex : mutex_ptr) return C.int;
pragma Import (C, mutexP, "SDL_mutexP");
-- The same as MutexP
function LockMutex (mutex : mutex_ptr) return C.int;
pragma Inline (LockMutex);
-- Unlock the mutex (Returns 0 or -1 on error)
function mutexV (mutex : mutex_ptr) return C.int;
pragma Import (C, mutexV, "SDL_mutexV");
-- The same as MutexV
function UnlockMutex (mutex : mutex_ptr) return C.int;
pragma Inline (UnlockMutex);
-- Destroy a mutex
procedure DestroyMutex (mutex : mutex_ptr);
pragma Import (C, DestroyMutex, "SDL_DestroyMutex");
---------------------------
-- Semaphore subprograms --
---------------------------
-- A pointer to the SDL semaphore structure defined
-- in SDL_sem.c
type sem_ptr is new System.Address;
-- Create a semaphore, initialized with value, returns
-- NULL on failure.
function CreateSemaphore (initial_value : Uint32)
return sem_ptr;
pragma Import (C, CreateSemaphore, "SDL_CreateSemaphore");
-- Destroy a semaphore
procedure DestroySemaphore (sem : sem_ptr);
pragma Import (C, DestroySemaphore, "SDL_DestroySemaphore");
-- This function suspends the calling thread until the semaphore
-- pointed to by sem has a positive count. It then atomically
-- decreases the semaphore count.
function SemWait (sem : sem_ptr) return C.int;
procedure SemWait (sem : sem_ptr);
pragma Import (C, SemWait, "SDL_SemWait");
-- Non-blocking variant of Sem_Wait, returns 0 if the wait
-- succeeds, SDL_MUTEX_TIMEDOUT if the wait would block, and -1
-- on error.
function SemTryWait (sem : sem_ptr) return C.int;
pragma Import (C, SemTryWait, "SDL_SemTryWait");
-- Varian of Sem_Wait with timeout in miliseconds, returns 0
-- if the wait succeeds, SDL_MUTEX_TIMEDOUT if the whait does
-- not succeed in the allotted time, and -1 in error.
-- On some platforms this function is implemented by looping
-- with a delay of 1 ms, and so should be avoided if possible.
function SemWaitTimeout (sem : sem_ptr; ms : Uint32)
return C.int;
pragma Import (C, SemWaitTimeout, "SDL_SemWaitTimeout");
-- Atomically increases the semaphore's count (not blocking),
-- returns 0, or -1 on error.
function SemPost (sem : sem_ptr) return C.int;
procedure SemPost (sem : sem_ptr);
pragma Import (C, SemPost, "SDL_SemPost");
-- Returns the current count of the semaphore
function SemValue (sem : sem_ptr) return Uint32;
pragma Import (C, SemValue, "SDL_SemValue");
------------------------------------
-- Condition variable functions --
------------------------------------
-- The SDL condition variable structure, defined in SDL_cond.c
type cond_ptr is new System.Address;
-- Create a condition variable
function CreateCond return cond_ptr;
pragma Import (C, CreateCond, "SDL_CreateCond");
-- Destroy a condition variable
procedure DestroyCond (cond : cond_ptr);
pragma Import (C, DestroyCond, "SDL_DestroyCond");
-- Restart one of the threads that are waiting on the
-- condition variable, returns 0, or -1 on error.
function CondSignal (cond : cond_ptr) return C.int;
pragma Import (C, CondSignal, "SDL_CondSignal");
-- Restart all threads that are waiting on the condition
-- variable, returns 0, or -1 on error.
function CondBroadcast (cond : cond_ptr) return C.int;
pragma Import (C, CondBroadcast, "SDL_CondBroadcast");
-- Wait on the condition variable, unlocking the provided
-- mutex. The mutex must be locked before entering this
-- function! returns 0 when it is signaled, or -1 on error.
function CondWait (cond : cond_ptr; mut : mutex_ptr)
return C.int;
pragma Import (C, CondWait, "SDL_CondWait");
-- Waits for at most 'ms' milliseconds, and returns 0 if the
-- condition variable is signaled, SDL_MUTEX_TIMEDOUT if the
-- condition is not signaled in the allocated time, and -1
-- on error.
-- On some platforms this function is implemented by looping
-- with a delay of 1 ms, and so should be avoided if possible.
function CondWaitTimeout (
cond : cond_ptr;
mut : mutex_ptr;
ms : Uint32)
return C.int;
pragma Import (C, CondWaitTimeout, "SDL_CondWaitTimeout");
end SDL.Mutex;
|
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="15">
<syndb class_id="0" tracking_level="0" version="0">
<userIPLatency>-1</userIPLatency>
<userIPName/>
<cdfg class_id="1" tracking_level="1" version="0" object_id="_0">
<name>memRead</name>
<ret_bitwidth>0</ret_bitwidth>
<ports class_id="2" tracking_level="0" version="0">
<count>5</count>
<item_version>0</item_version>
<item class_id="3" tracking_level="1" version="0" object_id="_1">
<Value class_id="4" tracking_level="0" version="0">
<Obj class_id="5" tracking_level="0" version="0">
<type>1</type>
<id>1</id>
<name>memRdCtrl_V</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo class_id="6" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>memRdCtrl.V</originalName>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>40</bitwidth>
</Value>
<direction>1</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs class_id="7" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_2">
<Value>
<Obj>
<type>1</type>
<id>3</id>
<name>cc2memReadMd_V</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName>FIFO</coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<direction>0</direction>
<if_type>3</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_3">
<Value>
<Obj>
<type>1</type>
<id>4</id>
<name>cc2memRead_V</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName>FIFO</coreName>
</Obj>
<bitwidth>130</bitwidth>
</Value>
<direction>0</direction>
<if_type>3</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_4">
<Value>
<Obj>
<type>1</type>
<id>5</id>
<name>memRd2comp_V</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName>FIFO</coreName>
</Obj>
<bitwidth>130</bitwidth>
</Value>
<direction>1</direction>
<if_type>3</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_5">
<Value>
<Obj>
<type>1</type>
<id>6</id>
<name>memRd2compMd_V</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName>FIFO</coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<direction>1</direction>
<if_type>3</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
</ports>
<nodes class_id="8" tracking_level="0" version="0">
<count>54</count>
<item_version>0</item_version>
<item class_id="9" tracking_level="1" version="0" object_id="_6">
<Value>
<Obj>
<type>0</type>
<id>13</id>
<name>memRdState_load</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>42</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item class_id="10" tracking_level="0" version="0">
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second class_id="11" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="12" tracking_level="0" version="0">
<first class_id="13" tracking_level="0" version="0">
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>42</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>80</item>
</oprand_edges>
<opcode>load</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_7">
<Value>
<Obj>
<type>0</type>
<id>14</id>
<name/>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>42</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>42</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>81</item>
<item>82</item>
<item>83</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_8">
<Value>
<Obj>
<type>0</type>
<id>16</id>
<name>tmp</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>tmp</originalName>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>85</item>
<item>86</item>
<item>88</item>
</oprand_edges>
<opcode>nbreadreq</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_9">
<Value>
<Obj>
<type>0</type>
<id>17</id>
<name/>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>45</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>45</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>89</item>
<item>90</item>
<item>91</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_10">
<Value>
<Obj>
<type>0</type>
<id>19</id>
<name>tmp_29</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>tmp</originalName>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>93</item>
<item>94</item>
<item>95</item>
</oprand_edges>
<opcode>nbreadreq</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_11">
<Value>
<Obj>
<type>0</type>
<id>20</id>
<name/>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>45</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>45</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>96</item>
<item>97</item>
<item>98</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_12">
<Value>
<Obj>
<type>0</type>
<id>22</id>
<name>tmp27</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>tmp27</originalName>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>100</item>
<item>101</item>
<item>386</item>
</oprand_edges>
<opcode>read</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>2.39</m_delay>
</item>
<item class_id_reference="9" object_id="_13">
<Value>
<Obj>
<type>0</type>
<id>23</id>
<name>tmp_operation_V</name>
<fileName>sources/hashTable/../globals.h</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>136</lineNumber>
<contextFuncName>operator=</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>
<first>/home/pratik0509/xillinx/Vivado/2018.2/common/technology/autopilot/hls_stream.h</first>
<second>read</second>
</first>
<second>127</second>
</item>
<item>
<first>
<first>sources/hashTable/../globals.h</first>
<second>operator=</second>
</first>
<second>136</second>
</item>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>46</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>tmp.operation.V</originalName>
<rtlName>tmp_operation_V_fu_213_p1</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>102</item>
</oprand_edges>
<opcode>trunc</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_14">
<Value>
<Obj>
<type>0</type>
<id>24</id>
<name>tmp_keyLength_V</name>
<fileName>sources/hashTable/../globals.h</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>136</lineNumber>
<contextFuncName>operator=</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>
<first>/home/pratik0509/xillinx/Vivado/2018.2/common/technology/autopilot/hls_stream.h</first>
<second>read</second>
</first>
<second>127</second>
</item>
<item>
<first>
<first>sources/hashTable/../globals.h</first>
<second>operator=</second>
</first>
<second>136</second>
</item>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>46</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>tmp.keyLength.V</originalName>
<rtlName>tmp_keyLength_V_fu_217_p4</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>4</count>
<item_version>0</item_version>
<item>104</item>
<item>105</item>
<item>107</item>
<item>109</item>
</oprand_edges>
<opcode>partselect</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_15">
<Value>
<Obj>
<type>0</type>
<id>25</id>
<name>tmp_1</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>tmp.1</originalName>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>130</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>111</item>
<item>112</item>
<item>387</item>
</oprand_edges>
<opcode>read</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>2.39</m_delay>
</item>
<item class_id_reference="9" object_id="_16">
<Value>
<Obj>
<type>0</type>
<id>26</id>
<name>p_Val2_s</name>
<fileName>sources/hashTable/../globals.h</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>120</lineNumber>
<contextFuncName>operator=</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>
<first>/home/pratik0509/xillinx/Vivado/2018.2/common/technology/autopilot/hls_stream.h</first>
<second>read</second>
</first>
<second>127</second>
</item>
<item>
<first>
<first>sources/hashTable/../globals.h</first>
<second>operator=</second>
</first>
<second>120</second>
</item>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>47</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>__Val2__</originalName>
<rtlName>p_Val2_s_fu_227_p1</rtlName>
<coreName/>
</Obj>
<bitwidth>128</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>113</item>
</oprand_edges>
<opcode>trunc</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_17">
<Value>
<Obj>
<type>0</type>
<id>27</id>
<name>tmp_EOP_V_4</name>
<fileName>sources/hashTable/../globals.h</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>120</lineNumber>
<contextFuncName>operator=</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>
<first>/home/pratik0509/xillinx/Vivado/2018.2/common/technology/autopilot/hls_stream.h</first>
<second>read</second>
</first>
<second>127</second>
</item>
<item>
<first>
<first>sources/hashTable/../globals.h</first>
<second>operator=</second>
</first>
<second>120</second>
</item>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>47</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>tmp.EOP.V</originalName>
<rtlName>grp_fu_201_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>115</item>
<item>116</item>
<item>118</item>
</oprand_edges>
<opcode>bitselect</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_18">
<Value>
<Obj>
<type>0</type>
<id>28</id>
<name>tmp_i</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>49</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>49</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>tmp_i_fu_231_p2</rtlName>
<coreName/>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>119</item>
<item>121</item>
</oprand_edges>
<opcode>icmp</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.86</m_delay>
</item>
<item class_id_reference="9" object_id="_19">
<Value>
<Obj>
<type>0</type>
<id>29</id>
<name/>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>49</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>49</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>122</item>
<item>123</item>
<item>124</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_20">
<Value>
<Obj>
<type>0</type>
<id>31</id>
<name>p_Result_i</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>52</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>52</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>p_Result_i_fu_359_p4</rtlName>
<coreName/>
</Obj>
<bitwidth>7</bitwidth>
</Value>
<oprand_edges>
<count>4</count>
<item_version>0</item_version>
<item>126</item>
<item>127</item>
<item>129</item>
<item>131</item>
</oprand_edges>
<opcode>partselect</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_21">
<Value>
<Obj>
<type>0</type>
<id>32</id>
<name>tmp_30</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>53</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>53</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>tmp_30_reg_434</rtlName>
<coreName/>
</Obj>
<bitwidth>4</bitwidth>
</Value>
<oprand_edges>
<count>4</count>
<item_version>0</item_version>
<item>133</item>
<item>134</item>
<item>136</item>
<item>137</item>
</oprand_edges>
<opcode>partselect</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_22">
<Value>
<Obj>
<type>0</type>
<id>33</id>
<name>memData_count_V_cast</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>53</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>53</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>memData_count_V_cast_fu_368_p1</rtlName>
<coreName/>
</Obj>
<bitwidth>5</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>138</item>
</oprand_edges>
<opcode>zext</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_23">
<Value>
<Obj>
<type>0</type>
<id>34</id>
<name>r_V</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>54</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>54</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>r.V</originalName>
<rtlName>r_V_fu_247_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>140</item>
<item>141</item>
<item>143</item>
</oprand_edges>
<opcode>bitconcatenate</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_24">
<Value>
<Obj>
<type>0</type>
<id>35</id>
<name>tmp_128_i</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>54</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>54</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>tmp_128_i_fu_255_p2</rtlName>
<coreName/>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>144</item>
<item>145</item>
</oprand_edges>
<opcode>icmp</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.86</m_delay>
</item>
<item class_id_reference="9" object_id="_25">
<Value>
<Obj>
<type>0</type>
<id>36</id>
<name>p_0184_1_0_v_cast_i_c</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>54</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>54</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>p_0184_1_0_v_cast_i_c_fu_371_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>5</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>146</item>
<item>148</item>
<item>150</item>
</oprand_edges>
<opcode>select</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_26">
<Value>
<Obj>
<type>0</type>
<id>37</id>
<name>memData_count_V</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>54</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>54</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>memData.count.V</originalName>
<rtlName>memData_count_V_fu_378_p2</rtlName>
<coreName/>
</Obj>
<bitwidth>5</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>151</item>
<item>152</item>
</oprand_edges>
<opcode>add</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>1.01</m_delay>
</item>
<item class_id_reference="9" object_id="_27">
<Value>
<Obj>
<type>0</type>
<id>38</id>
<name>tmp_s</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>54</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>54</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>tmp_s_fu_384_p5</rtlName>
<coreName/>
</Obj>
<bitwidth>37</bitwidth>
</Value>
<oprand_edges>
<count>5</count>
<item_version>0</item_version>
<item>154</item>
<item>155</item>
<item>157</item>
<item>158</item>
<item>160</item>
</oprand_edges>
<opcode>bitconcatenate</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_28">
<Value>
<Obj>
<type>0</type>
<id>39</id>
<name>tmp_2</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>58</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>58</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>tmp.2</originalName>
<rtlName>tmp_2_fu_396_p1</rtlName>
<coreName/>
</Obj>
<bitwidth>40</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>161</item>
</oprand_edges>
<opcode>zext</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_29">
<Value>
<Obj>
<type>0</type>
<id>40</id>
<name/>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>58</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>58</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>163</item>
<item>164</item>
<item>165</item>
</oprand_edges>
<opcode>write</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_30">
<Value>
<Obj>
<type>0</type>
<id>41</id>
<name/>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>59</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>59</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>166</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_31">
<Value>
<Obj>
<type>0</type>
<id>43</id>
<name>tmp_129_i</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>60</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>60</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>tmp_129_i_fu_261_p2</rtlName>
<coreName/>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>167</item>
<item>169</item>
</oprand_edges>
<opcode>icmp</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.86</m_delay>
</item>
<item class_id_reference="9" object_id="_32">
<Value>
<Obj>
<type>0</type>
<id>44</id>
<name>tmp_31</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName>tmp_31_fu_267_p4</rtlName>
<coreName/>
</Obj>
<bitwidth>5</bitwidth>
</Value>
<oprand_edges>
<count>4</count>
<item_version>0</item_version>
<item>171</item>
<item>172</item>
<item>173</item>
<item>174</item>
</oprand_edges>
<opcode>partselect</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_33">
<Value>
<Obj>
<type>0</type>
<id>45</id>
<name>tmp_131_i</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>62</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>62</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>tmp_131_i_fu_277_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>176</item>
<item>177</item>
<item>178</item>
</oprand_edges>
<opcode>bitconcatenate</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_34">
<Value>
<Obj>
<type>0</type>
<id>46</id>
<name>tmp_336</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>62</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>62</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>tmp_336_fu_285_p2</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>180</item>
<item>181</item>
</oprand_edges>
<opcode>sub</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>1.35</m_delay>
</item>
<item class_id_reference="9" object_id="_35">
<Value>
<Obj>
<type>0</type>
<id>47</id>
<name>tmp_337</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>62</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>62</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>tmp_337_fu_291_p1</rtlName>
<coreName/>
</Obj>
<bitwidth>128</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>182</item>
</oprand_edges>
<opcode>zext</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_36">
<Value>
<Obj>
<type>0</type>
<id>48</id>
<name>tmp_338</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>62</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>62</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>tmp_338_fu_295_p2</rtlName>
<coreName/>
</Obj>
<bitwidth>128</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>184</item>
<item>185</item>
</oprand_edges>
<opcode>lshr</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_37">
<Value>
<Obj>
<type>0</type>
<id>49</id>
<name>p_Result_s</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>62</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>62</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>__Result__</originalName>
<rtlName>p_Result_s_fu_301_p2</rtlName>
<coreName/>
</Obj>
<bitwidth>128</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>186</item>
<item>187</item>
</oprand_edges>
<opcode>and</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_38">
<Value>
<Obj>
<type>0</type>
<id>50</id>
<name>tmp_340</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>62</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>62</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>tmp_340_fu_307_p2</rtlName>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>188</item>
<item>189</item>
</oprand_edges>
<opcode>sub</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>1.35</m_delay>
</item>
<item class_id_reference="9" object_id="_39">
<Value>
<Obj>
<type>0</type>
<id>51</id>
<name>tmp_341</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>62</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>62</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>tmp_341_fu_313_p1</rtlName>
<coreName/>
</Obj>
<bitwidth>128</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>190</item>
</oprand_edges>
<opcode>zext</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_40">
<Value>
<Obj>
<type>0</type>
<id>52</id>
<name>tmp_342</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>62</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>62</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>tmp_342_fu_317_p2</rtlName>
<coreName/>
</Obj>
<bitwidth>128</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>191</item>
<item>192</item>
</oprand_edges>
<opcode>lshr</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_41">
<Value>
<Obj>
<type>0</type>
<id>53</id>
<name>p_Result_23</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>62</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>62</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>__Result__</originalName>
<rtlName>p_Result_23_fu_323_p2</rtlName>
<coreName/>
</Obj>
<bitwidth>128</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>193</item>
<item>194</item>
</oprand_edges>
<opcode>and</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_42">
<Value>
<Obj>
<type>0</type>
<id>54</id>
<name>tmp_data_V</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>65</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>65</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>tmp.data.V</originalName>
<rtlName>tmp_data_V_fu_329_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>128</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>195</item>
<item>196</item>
<item>197</item>
</oprand_edges>
<opcode>select</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>1.62</m_delay>
</item>
<item class_id_reference="9" object_id="_43">
<Value>
<Obj>
<type>0</type>
<id>55</id>
<name>tmp_43_i</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>65</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>65</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>tmp_43_i_reg_449</rtlName>
<coreName/>
</Obj>
<bitwidth>2</bitwidth>
</Value>
<oprand_edges>
<count>4</count>
<item_version>0</item_version>
<item>199</item>
<item>200</item>
<item>202</item>
<item>203</item>
</oprand_edges>
<opcode>partselect</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_44">
<Value>
<Obj>
<type>0</type>
<id>56</id>
<name>tmp_3</name>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>65</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>65</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>tmp.3</originalName>
<rtlName>tmp_3_fu_401_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>130</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>205</item>
<item>206</item>
<item>207</item>
</oprand_edges>
<opcode>bitconcatenate</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_45">
<Value>
<Obj>
<type>0</type>
<id>57</id>
<name/>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>65</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>65</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>209</item>
<item>210</item>
<item>211</item>
</oprand_edges>
<opcode>write</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>2.39</m_delay>
</item>
<item class_id_reference="9" object_id="_46">
<Value>
<Obj>
<type>0</type>
<id>58</id>
<name/>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>213</item>
<item>214</item>
<item>215</item>
</oprand_edges>
<opcode>write</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>2.39</m_delay>
</item>
<item class_id_reference="9" object_id="_47">
<Value>
<Obj>
<type>0</type>
<id>59</id>
<name/>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>67</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>67</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>216</item>
<item>217</item>
<item>218</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_48">
<Value>
<Obj>
<type>0</type>
<id>61</id>
<name/>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>68</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>68</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>220</item>
<item>221</item>
<item>385</item>
</oprand_edges>
<opcode>store</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.85</m_delay>
</item>
<item class_id_reference="9" object_id="_49">
<Value>
<Obj>
<type>0</type>
<id>62</id>
<name/>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>68</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>68</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>222</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_50">
<Value>
<Obj>
<type>0</type>
<id>64</id>
<name/>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>69</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>69</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>223</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_51">
<Value>
<Obj>
<type>0</type>
<id>66</id>
<name/>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>70</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>70</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>224</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_52">
<Value>
<Obj>
<type>0</type>
<id>68</id>
<name>tmp_5</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>tmp.5</originalName>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>130</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>225</item>
<item>226</item>
</oprand_edges>
<opcode>read</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>2.39</m_delay>
</item>
<item class_id_reference="9" object_id="_53">
<Value>
<Obj>
<type>0</type>
<id>69</id>
<name>tmp_EOP_V</name>
<fileName>sources/hashTable/../globals.h</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>120</lineNumber>
<contextFuncName>operator=</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>
<first>/home/pratik0509/xillinx/Vivado/2018.2/common/technology/autopilot/hls_stream.h</first>
<second>read</second>
</first>
<second>127</second>
</item>
<item>
<first>
<first>sources/hashTable/../globals.h</first>
<second>operator=</second>
</first>
<second>120</second>
</item>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>74</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>tmp.EOP.V</originalName>
<rtlName>grp_fu_201_p3</rtlName>
<coreName/>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>227</item>
<item>228</item>
<item>229</item>
</oprand_edges>
<opcode>bitselect</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_54">
<Value>
<Obj>
<type>0</type>
<id>70</id>
<name/>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>230</item>
<item>231</item>
<item>232</item>
</oprand_edges>
<opcode>write</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>2.39</m_delay>
</item>
<item class_id_reference="9" object_id="_55">
<Value>
<Obj>
<type>0</type>
<id>71</id>
<name/>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>76</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>76</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>233</item>
<item>234</item>
<item>235</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_56">
<Value>
<Obj>
<type>0</type>
<id>73</id>
<name/>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>77</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>77</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>237</item>
<item>238</item>
<item>384</item>
</oprand_edges>
<opcode>store</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.85</m_delay>
</item>
<item class_id_reference="9" object_id="_57">
<Value>
<Obj>
<type>0</type>
<id>74</id>
<name/>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>77</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>77</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>239</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_58">
<Value>
<Obj>
<type>0</type>
<id>76</id>
<name/>
<fileName>sources/hashTable/memRead.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>78</lineNumber>
<contextFuncName>memRead</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/pratik0509/Projects/HLx_Examples/Acceleration/memcached/hls</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>sources/hashTable/memRead.cpp</first>
<second>memRead</second>
</first>
<second>78</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>240</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
<item class_id_reference="9" object_id="_59">
<Value>
<Obj>
<type>0</type>
<id>78</id>
<name/>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>0</count>
<item_version>0</item_version>
</oprand_edges>
<opcode>ret</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_delay>0.00</m_delay>
</item>
</nodes>
<consts class_id="15" tracking_level="0" version="0">
<count>19</count>
<item_version>0</item_version>
<item class_id="16" tracking_level="1" version="0" object_id="_60">
<Value>
<Obj>
<type>2</type>
<id>87</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>1</content>
</item>
<item class_id_reference="16" object_id="_61">
<Value>
<Obj>
<type>2</type>
<id>106</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>40</content>
</item>
<item class_id_reference="16" object_id="_62">
<Value>
<Obj>
<type>2</type>
<id>108</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>47</content>
</item>
<item class_id_reference="16" object_id="_63">
<Value>
<Obj>
<type>2</type>
<id>117</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>129</content>
</item>
<item class_id_reference="16" object_id="_64">
<Value>
<Obj>
<type>2</type>
<id>120</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<const_type>0</const_type>
<content>8</content>
</item>
<item class_id_reference="16" object_id="_65">
<Value>
<Obj>
<type>2</type>
<id>128</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>8</content>
</item>
<item class_id_reference="16" object_id="_66">
<Value>
<Obj>
<type>2</type>
<id>130</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>14</content>
</item>
<item class_id_reference="16" object_id="_67">
<Value>
<Obj>
<type>2</type>
<id>135</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>44</content>
</item>
<item class_id_reference="16" object_id="_68">
<Value>
<Obj>
<type>2</type>
<id>142</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>4</bitwidth>
</Value>
<const_type>0</const_type>
<content>0</content>
</item>
<item class_id_reference="16" object_id="_69">
<Value>
<Obj>
<type>2</type>
<id>147</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>5</bitwidth>
</Value>
<const_type>0</const_type>
<content>2</content>
</item>
<item class_id_reference="16" object_id="_70">
<Value>
<Obj>
<type>2</type>
<id>149</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>5</bitwidth>
</Value>
<const_type>0</const_type>
<content>1</content>
</item>
<item class_id_reference="16" object_id="_71">
<Value>
<Obj>
<type>2</type>
<id>156</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>22</bitwidth>
</Value>
<const_type>0</const_type>
<content>0</content>
</item>
<item class_id_reference="16" object_id="_72">
<Value>
<Obj>
<type>2</type>
<id>159</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>3</bitwidth>
</Value>
<const_type>0</const_type>
<content>0</content>
</item>
<item class_id_reference="16" object_id="_73">
<Value>
<Obj>
<type>2</type>
<id>168</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<const_type>0</const_type>
<content>17</content>
</item>
<item class_id_reference="16" object_id="_74">
<Value>
<Obj>
<type>2</type>
<id>179</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<const_type>0</const_type>
<content>128</content>
</item>
<item class_id_reference="16" object_id="_75">
<Value>
<Obj>
<type>2</type>
<id>183</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>128</bitwidth>
</Value>
<const_type>0</const_type>
<content>340282366920938463463374607431768211455</content>
</item>
<item class_id_reference="16" object_id="_76">
<Value>
<Obj>
<type>2</type>
<id>201</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>128</content>
</item>
<item class_id_reference="16" object_id="_77">
<Value>
<Obj>
<type>2</type>
<id>219</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<const_type>0</const_type>
<content>1</content>
</item>
<item class_id_reference="16" object_id="_78">
<Value>
<Obj>
<type>2</type>
<id>236</id>
<name>empty</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<const_type>0</const_type>
<content>0</content>
</item>
</consts>
<blocks class_id="17" tracking_level="0" version="0">
<count>13</count>
<item_version>0</item_version>
<item class_id="18" tracking_level="1" version="0" object_id="_79">
<Obj>
<type>3</type>
<id>15</id>
<name>entry</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<node_objs>
<count>2</count>
<item_version>0</item_version>
<item>13</item>
<item>14</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_80">
<Obj>
<type>3</type>
<id>18</id>
<name/>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<node_objs>
<count>2</count>
<item_version>0</item_version>
<item>16</item>
<item>17</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_81">
<Obj>
<type>3</type>
<id>21</id>
<name/>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<node_objs>
<count>2</count>
<item_version>0</item_version>
<item>19</item>
<item>20</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_82">
<Obj>
<type>3</type>
<id>30</id>
<name/>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<node_objs>
<count>8</count>
<item_version>0</item_version>
<item>22</item>
<item>23</item>
<item>24</item>
<item>25</item>
<item>26</item>
<item>27</item>
<item>28</item>
<item>29</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_83">
<Obj>
<type>3</type>
<id>42</id>
<name/>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<node_objs>
<count>11</count>
<item_version>0</item_version>
<item>31</item>
<item>32</item>
<item>33</item>
<item>34</item>
<item>35</item>
<item>36</item>
<item>37</item>
<item>38</item>
<item>39</item>
<item>40</item>
<item>41</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_84">
<Obj>
<type>3</type>
<id>60</id>
<name>._crit_edge3.i_ifconv</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<node_objs>
<count>17</count>
<item_version>0</item_version>
<item>43</item>
<item>44</item>
<item>45</item>
<item>46</item>
<item>47</item>
<item>48</item>
<item>49</item>
<item>50</item>
<item>51</item>
<item>52</item>
<item>53</item>
<item>54</item>
<item>55</item>
<item>56</item>
<item>57</item>
<item>58</item>
<item>59</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_85">
<Obj>
<type>3</type>
<id>63</id>
<name/>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<node_objs>
<count>2</count>
<item_version>0</item_version>
<item>61</item>
<item>62</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_86">
<Obj>
<type>3</type>
<id>65</id>
<name>._crit_edge5.i</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<node_objs>
<count>1</count>
<item_version>0</item_version>
<item>64</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_87">
<Obj>
<type>3</type>
<id>67</id>
<name>._crit_edge1.i</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<node_objs>
<count>1</count>
<item_version>0</item_version>
<item>66</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_88">
<Obj>
<type>3</type>
<id>72</id>
<name/>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<node_objs>
<count>4</count>
<item_version>0</item_version>
<item>68</item>
<item>69</item>
<item>70</item>
<item>71</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_89">
<Obj>
<type>3</type>
<id>75</id>
<name/>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<node_objs>
<count>2</count>
<item_version>0</item_version>
<item>73</item>
<item>74</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_90">
<Obj>
<type>3</type>
<id>77</id>
<name>._crit_edge6.i</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<node_objs>
<count>1</count>
<item_version>0</item_version>
<item>76</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_91">
<Obj>
<type>3</type>
<id>79</id>
<name>memRead.exit</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<node_objs>
<count>1</count>
<item_version>0</item_version>
<item>78</item>
</node_objs>
</item>
</blocks>
<edges class_id="19" tracking_level="0" version="0">
<count>127</count>
<item_version>0</item_version>
<item class_id="20" tracking_level="1" version="0" object_id="_92">
<id>80</id>
<edge_type>1</edge_type>
<source_obj>2</source_obj>
<sink_obj>13</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_93">
<id>81</id>
<edge_type>1</edge_type>
<source_obj>13</source_obj>
<sink_obj>14</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_94">
<id>82</id>
<edge_type>2</edge_type>
<source_obj>18</source_obj>
<sink_obj>14</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_95">
<id>83</id>
<edge_type>2</edge_type>
<source_obj>72</source_obj>
<sink_obj>14</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_96">
<id>86</id>
<edge_type>1</edge_type>
<source_obj>3</source_obj>
<sink_obj>16</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_97">
<id>88</id>
<edge_type>1</edge_type>
<source_obj>87</source_obj>
<sink_obj>16</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_98">
<id>89</id>
<edge_type>1</edge_type>
<source_obj>16</source_obj>
<sink_obj>17</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_99">
<id>90</id>
<edge_type>2</edge_type>
<source_obj>67</source_obj>
<sink_obj>17</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_100">
<id>91</id>
<edge_type>2</edge_type>
<source_obj>21</source_obj>
<sink_obj>17</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_101">
<id>94</id>
<edge_type>1</edge_type>
<source_obj>4</source_obj>
<sink_obj>19</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_102">
<id>95</id>
<edge_type>1</edge_type>
<source_obj>87</source_obj>
<sink_obj>19</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_103">
<id>96</id>
<edge_type>1</edge_type>
<source_obj>19</source_obj>
<sink_obj>20</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_104">
<id>97</id>
<edge_type>2</edge_type>
<source_obj>67</source_obj>
<sink_obj>20</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_105">
<id>98</id>
<edge_type>2</edge_type>
<source_obj>30</source_obj>
<sink_obj>20</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_106">
<id>101</id>
<edge_type>1</edge_type>
<source_obj>3</source_obj>
<sink_obj>22</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_107">
<id>102</id>
<edge_type>1</edge_type>
<source_obj>22</source_obj>
<sink_obj>23</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_108">
<id>105</id>
<edge_type>1</edge_type>
<source_obj>22</source_obj>
<sink_obj>24</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_109">
<id>107</id>
<edge_type>1</edge_type>
<source_obj>106</source_obj>
<sink_obj>24</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_110">
<id>109</id>
<edge_type>1</edge_type>
<source_obj>108</source_obj>
<sink_obj>24</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_111">
<id>112</id>
<edge_type>1</edge_type>
<source_obj>4</source_obj>
<sink_obj>25</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_112">
<id>113</id>
<edge_type>1</edge_type>
<source_obj>25</source_obj>
<sink_obj>26</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_113">
<id>116</id>
<edge_type>1</edge_type>
<source_obj>25</source_obj>
<sink_obj>27</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_114">
<id>118</id>
<edge_type>1</edge_type>
<source_obj>117</source_obj>
<sink_obj>27</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_115">
<id>119</id>
<edge_type>1</edge_type>
<source_obj>23</source_obj>
<sink_obj>28</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_116">
<id>121</id>
<edge_type>1</edge_type>
<source_obj>120</source_obj>
<sink_obj>28</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_117">
<id>122</id>
<edge_type>1</edge_type>
<source_obj>28</source_obj>
<sink_obj>29</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_118">
<id>123</id>
<edge_type>2</edge_type>
<source_obj>42</source_obj>
<sink_obj>29</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_119">
<id>124</id>
<edge_type>2</edge_type>
<source_obj>60</source_obj>
<sink_obj>29</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_120">
<id>127</id>
<edge_type>1</edge_type>
<source_obj>22</source_obj>
<sink_obj>31</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_121">
<id>129</id>
<edge_type>1</edge_type>
<source_obj>128</source_obj>
<sink_obj>31</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_122">
<id>131</id>
<edge_type>1</edge_type>
<source_obj>130</source_obj>
<sink_obj>31</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_123">
<id>134</id>
<edge_type>1</edge_type>
<source_obj>22</source_obj>
<sink_obj>32</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_124">
<id>136</id>
<edge_type>1</edge_type>
<source_obj>135</source_obj>
<sink_obj>32</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_125">
<id>137</id>
<edge_type>1</edge_type>
<source_obj>108</source_obj>
<sink_obj>32</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_126">
<id>138</id>
<edge_type>1</edge_type>
<source_obj>32</source_obj>
<sink_obj>33</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_127">
<id>141</id>
<edge_type>1</edge_type>
<source_obj>32</source_obj>
<sink_obj>34</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_128">
<id>143</id>
<edge_type>1</edge_type>
<source_obj>142</source_obj>
<sink_obj>34</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_129">
<id>144</id>
<edge_type>1</edge_type>
<source_obj>24</source_obj>
<sink_obj>35</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_130">
<id>145</id>
<edge_type>1</edge_type>
<source_obj>34</source_obj>
<sink_obj>35</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_131">
<id>146</id>
<edge_type>1</edge_type>
<source_obj>35</source_obj>
<sink_obj>36</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_132">
<id>148</id>
<edge_type>1</edge_type>
<source_obj>147</source_obj>
<sink_obj>36</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_133">
<id>150</id>
<edge_type>1</edge_type>
<source_obj>149</source_obj>
<sink_obj>36</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_134">
<id>151</id>
<edge_type>1</edge_type>
<source_obj>36</source_obj>
<sink_obj>37</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_135">
<id>152</id>
<edge_type>1</edge_type>
<source_obj>33</source_obj>
<sink_obj>37</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_136">
<id>155</id>
<edge_type>1</edge_type>
<source_obj>37</source_obj>
<sink_obj>38</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_137">
<id>157</id>
<edge_type>1</edge_type>
<source_obj>156</source_obj>
<sink_obj>38</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_138">
<id>158</id>
<edge_type>1</edge_type>
<source_obj>31</source_obj>
<sink_obj>38</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_139">
<id>160</id>
<edge_type>1</edge_type>
<source_obj>159</source_obj>
<sink_obj>38</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_140">
<id>161</id>
<edge_type>1</edge_type>
<source_obj>38</source_obj>
<sink_obj>39</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_141">
<id>164</id>
<edge_type>1</edge_type>
<source_obj>1</source_obj>
<sink_obj>40</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_142">
<id>165</id>
<edge_type>1</edge_type>
<source_obj>39</source_obj>
<sink_obj>40</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_143">
<id>166</id>
<edge_type>2</edge_type>
<source_obj>60</source_obj>
<sink_obj>41</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_144">
<id>167</id>
<edge_type>1</edge_type>
<source_obj>24</source_obj>
<sink_obj>43</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_145">
<id>169</id>
<edge_type>1</edge_type>
<source_obj>168</source_obj>
<sink_obj>43</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_146">
<id>172</id>
<edge_type>1</edge_type>
<source_obj>22</source_obj>
<sink_obj>44</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_147">
<id>173</id>
<edge_type>1</edge_type>
<source_obj>106</source_obj>
<sink_obj>44</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_148">
<id>174</id>
<edge_type>1</edge_type>
<source_obj>135</source_obj>
<sink_obj>44</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_149">
<id>177</id>
<edge_type>1</edge_type>
<source_obj>44</source_obj>
<sink_obj>45</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_150">
<id>178</id>
<edge_type>1</edge_type>
<source_obj>159</source_obj>
<sink_obj>45</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_151">
<id>180</id>
<edge_type>1</edge_type>
<source_obj>179</source_obj>
<sink_obj>46</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_152">
<id>181</id>
<edge_type>1</edge_type>
<source_obj>45</source_obj>
<sink_obj>46</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_153">
<id>182</id>
<edge_type>1</edge_type>
<source_obj>46</source_obj>
<sink_obj>47</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_154">
<id>184</id>
<edge_type>1</edge_type>
<source_obj>183</source_obj>
<sink_obj>48</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_155">
<id>185</id>
<edge_type>1</edge_type>
<source_obj>47</source_obj>
<sink_obj>48</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_156">
<id>186</id>
<edge_type>1</edge_type>
<source_obj>26</source_obj>
<sink_obj>49</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_157">
<id>187</id>
<edge_type>1</edge_type>
<source_obj>48</source_obj>
<sink_obj>49</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_158">
<id>188</id>
<edge_type>1</edge_type>
<source_obj>179</source_obj>
<sink_obj>50</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_159">
<id>189</id>
<edge_type>1</edge_type>
<source_obj>45</source_obj>
<sink_obj>50</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_160">
<id>190</id>
<edge_type>1</edge_type>
<source_obj>50</source_obj>
<sink_obj>51</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_161">
<id>191</id>
<edge_type>1</edge_type>
<source_obj>183</source_obj>
<sink_obj>52</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_162">
<id>192</id>
<edge_type>1</edge_type>
<source_obj>51</source_obj>
<sink_obj>52</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_163">
<id>193</id>
<edge_type>1</edge_type>
<source_obj>49</source_obj>
<sink_obj>53</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_164">
<id>194</id>
<edge_type>1</edge_type>
<source_obj>52</source_obj>
<sink_obj>53</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_165">
<id>195</id>
<edge_type>1</edge_type>
<source_obj>43</source_obj>
<sink_obj>54</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_166">
<id>196</id>
<edge_type>1</edge_type>
<source_obj>53</source_obj>
<sink_obj>54</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_167">
<id>197</id>
<edge_type>1</edge_type>
<source_obj>26</source_obj>
<sink_obj>54</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_168">
<id>200</id>
<edge_type>1</edge_type>
<source_obj>25</source_obj>
<sink_obj>55</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_169">
<id>202</id>
<edge_type>1</edge_type>
<source_obj>201</source_obj>
<sink_obj>55</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_170">
<id>203</id>
<edge_type>1</edge_type>
<source_obj>117</source_obj>
<sink_obj>55</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_171">
<id>206</id>
<edge_type>1</edge_type>
<source_obj>55</source_obj>
<sink_obj>56</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_172">
<id>207</id>
<edge_type>1</edge_type>
<source_obj>54</source_obj>
<sink_obj>56</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_173">
<id>210</id>
<edge_type>1</edge_type>
<source_obj>5</source_obj>
<sink_obj>57</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_174">
<id>211</id>
<edge_type>1</edge_type>
<source_obj>56</source_obj>
<sink_obj>57</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_175">
<id>214</id>
<edge_type>1</edge_type>
<source_obj>6</source_obj>
<sink_obj>58</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_176">
<id>215</id>
<edge_type>1</edge_type>
<source_obj>22</source_obj>
<sink_obj>58</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_177">
<id>216</id>
<edge_type>1</edge_type>
<source_obj>27</source_obj>
<sink_obj>59</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_178">
<id>217</id>
<edge_type>2</edge_type>
<source_obj>63</source_obj>
<sink_obj>59</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_179">
<id>218</id>
<edge_type>2</edge_type>
<source_obj>65</source_obj>
<sink_obj>59</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_180">
<id>220</id>
<edge_type>1</edge_type>
<source_obj>219</source_obj>
<sink_obj>61</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_181">
<id>221</id>
<edge_type>1</edge_type>
<source_obj>2</source_obj>
<sink_obj>61</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_182">
<id>222</id>
<edge_type>2</edge_type>
<source_obj>65</source_obj>
<sink_obj>62</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_183">
<id>223</id>
<edge_type>2</edge_type>
<source_obj>67</source_obj>
<sink_obj>64</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_184">
<id>224</id>
<edge_type>2</edge_type>
<source_obj>79</source_obj>
<sink_obj>66</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_185">
<id>226</id>
<edge_type>1</edge_type>
<source_obj>4</source_obj>
<sink_obj>68</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_186">
<id>228</id>
<edge_type>1</edge_type>
<source_obj>68</source_obj>
<sink_obj>69</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_187">
<id>229</id>
<edge_type>1</edge_type>
<source_obj>117</source_obj>
<sink_obj>69</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_188">
<id>231</id>
<edge_type>1</edge_type>
<source_obj>5</source_obj>
<sink_obj>70</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_189">
<id>232</id>
<edge_type>1</edge_type>
<source_obj>68</source_obj>
<sink_obj>70</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_190">
<id>233</id>
<edge_type>1</edge_type>
<source_obj>69</source_obj>
<sink_obj>71</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_191">
<id>234</id>
<edge_type>2</edge_type>
<source_obj>77</source_obj>
<sink_obj>71</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_192">
<id>235</id>
<edge_type>2</edge_type>
<source_obj>75</source_obj>
<sink_obj>71</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_193">
<id>237</id>
<edge_type>1</edge_type>
<source_obj>236</source_obj>
<sink_obj>73</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_194">
<id>238</id>
<edge_type>1</edge_type>
<source_obj>2</source_obj>
<sink_obj>73</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_195">
<id>239</id>
<edge_type>2</edge_type>
<source_obj>77</source_obj>
<sink_obj>74</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_196">
<id>240</id>
<edge_type>2</edge_type>
<source_obj>79</source_obj>
<sink_obj>76</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_197">
<id>366</id>
<edge_type>2</edge_type>
<source_obj>15</source_obj>
<sink_obj>72</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_198">
<id>367</id>
<edge_type>2</edge_type>
<source_obj>15</source_obj>
<sink_obj>18</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_199">
<id>368</id>
<edge_type>2</edge_type>
<source_obj>18</source_obj>
<sink_obj>21</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_200">
<id>369</id>
<edge_type>2</edge_type>
<source_obj>18</source_obj>
<sink_obj>67</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_201">
<id>370</id>
<edge_type>2</edge_type>
<source_obj>21</source_obj>
<sink_obj>30</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_202">
<id>371</id>
<edge_type>2</edge_type>
<source_obj>21</source_obj>
<sink_obj>67</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_203">
<id>372</id>
<edge_type>2</edge_type>
<source_obj>30</source_obj>
<sink_obj>60</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_204">
<id>373</id>
<edge_type>2</edge_type>
<source_obj>30</source_obj>
<sink_obj>42</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_205">
<id>374</id>
<edge_type>2</edge_type>
<source_obj>42</source_obj>
<sink_obj>60</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_206">
<id>375</id>
<edge_type>2</edge_type>
<source_obj>60</source_obj>
<sink_obj>65</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_207">
<id>376</id>
<edge_type>2</edge_type>
<source_obj>60</source_obj>
<sink_obj>63</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_208">
<id>377</id>
<edge_type>2</edge_type>
<source_obj>63</source_obj>
<sink_obj>65</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_209">
<id>378</id>
<edge_type>2</edge_type>
<source_obj>65</source_obj>
<sink_obj>67</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_210">
<id>379</id>
<edge_type>2</edge_type>
<source_obj>67</source_obj>
<sink_obj>79</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_211">
<id>380</id>
<edge_type>2</edge_type>
<source_obj>72</source_obj>
<sink_obj>75</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_212">
<id>381</id>
<edge_type>2</edge_type>
<source_obj>72</source_obj>
<sink_obj>77</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_213">
<id>382</id>
<edge_type>2</edge_type>
<source_obj>75</source_obj>
<sink_obj>77</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_214">
<id>383</id>
<edge_type>2</edge_type>
<source_obj>77</source_obj>
<sink_obj>79</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_215">
<id>384</id>
<edge_type>4</edge_type>
<source_obj>13</source_obj>
<sink_obj>73</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_216">
<id>385</id>
<edge_type>4</edge_type>
<source_obj>13</source_obj>
<sink_obj>61</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_217">
<id>386</id>
<edge_type>4</edge_type>
<source_obj>16</source_obj>
<sink_obj>22</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_218">
<id>387</id>
<edge_type>4</edge_type>
<source_obj>19</source_obj>
<sink_obj>25</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
</edges>
</cdfg>
<cdfg_regions class_id="21" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="22" tracking_level="1" version="0" object_id="_219">
<mId>1</mId>
<mTag>memRead</mTag>
<mType>0</mType>
<sub_regions>
<count>0</count>
<item_version>0</item_version>
</sub_regions>
<basic_blocks>
<count>13</count>
<item_version>0</item_version>
<item>15</item>
<item>18</item>
<item>21</item>
<item>30</item>
<item>42</item>
<item>60</item>
<item>63</item>
<item>65</item>
<item>67</item>
<item>72</item>
<item>75</item>
<item>77</item>
<item>79</item>
</basic_blocks>
<mII>1</mII>
<mDepth>3</mDepth>
<mMinTripCount>-1</mMinTripCount>
<mMaxTripCount>-1</mMaxTripCount>
<mMinLatency>2</mMinLatency>
<mMaxLatency>2</mMaxLatency>
<mIsDfPipe>0</mIsDfPipe>
<mDfPipe class_id="-1"/>
</item>
</cdfg_regions>
<fsm class_id="24" tracking_level="1" version="0" object_id="_220">
<states class_id="25" tracking_level="0" version="0">
<count>3</count>
<item_version>0</item_version>
<item class_id="26" tracking_level="1" version="0" object_id="_221">
<id>1</id>
<operations class_id="27" tracking_level="0" version="0">
<count>35</count>
<item_version>0</item_version>
<item class_id="28" tracking_level="1" version="0" object_id="_222">
<id>13</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_223">
<id>14</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_224">
<id>16</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_225">
<id>17</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_226">
<id>19</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_227">
<id>22</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_228">
<id>23</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_229">
<id>24</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_230">
<id>25</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_231">
<id>26</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_232">
<id>27</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_233">
<id>28</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_234">
<id>29</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_235">
<id>32</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_236">
<id>34</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_237">
<id>35</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_238">
<id>43</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_239">
<id>44</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_240">
<id>45</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_241">
<id>46</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_242">
<id>47</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_243">
<id>48</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_244">
<id>49</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_245">
<id>50</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_246">
<id>51</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_247">
<id>52</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_248">
<id>53</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_249">
<id>54</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_250">
<id>55</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_251">
<id>59</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_252">
<id>61</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_253">
<id>68</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_254">
<id>69</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_255">
<id>71</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_256">
<id>73</id>
<stage>1</stage>
<latency>1</latency>
</item>
</operations>
</item>
<item class_id_reference="26" object_id="_257">
<id>2</id>
<operations>
<count>12</count>
<item_version>0</item_version>
<item class_id_reference="28" object_id="_258">
<id>20</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_259">
<id>31</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_260">
<id>33</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_261">
<id>36</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_262">
<id>37</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_263">
<id>38</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_264">
<id>39</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_265">
<id>40</id>
<stage>2</stage>
<latency>2</latency>
</item>
<item class_id_reference="28" object_id="_266">
<id>56</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_267">
<id>57</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_268">
<id>58</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_269">
<id>70</id>
<stage>1</stage>
<latency>1</latency>
</item>
</operations>
</item>
<item class_id_reference="26" object_id="_270">
<id>3</id>
<operations>
<count>14</count>
<item_version>0</item_version>
<item class_id_reference="28" object_id="_271">
<id>7</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_272">
<id>8</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_273">
<id>9</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_274">
<id>10</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_275">
<id>11</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_276">
<id>12</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_277">
<id>40</id>
<stage>1</stage>
<latency>2</latency>
</item>
<item class_id_reference="28" object_id="_278">
<id>41</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_279">
<id>62</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_280">
<id>64</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_281">
<id>66</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_282">
<id>74</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_283">
<id>76</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_284">
<id>78</id>
<stage>1</stage>
<latency>1</latency>
</item>
</operations>
</item>
</states>
<transitions class_id="29" tracking_level="0" version="0">
<count>2</count>
<item_version>0</item_version>
<item class_id="30" tracking_level="1" version="0" object_id="_285">
<inState>1</inState>
<outState>2</outState>
<condition class_id="31" tracking_level="0" version="0">
<id>74</id>
<sop class_id="32" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="33" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</item>
</sop>
</condition>
</item>
<item class_id_reference="30" object_id="_286">
<inState>2</inState>
<outState>3</outState>
<condition>
<id>75</id>
<sop>
<count>1</count>
<item_version>0</item_version>
<item>
<count>0</count>
<item_version>0</item_version>
</item>
</sop>
</condition>
</item>
</transitions>
</fsm>
<res class_id="34" tracking_level="1" version="0" object_id="_287">
<dp_component_resource class_id="35" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_component_resource>
<dp_expression_resource>
<count>26</count>
<item_version>0</item_version>
<item class_id="36" tracking_level="0" version="0">
<first>ap_block_state1_pp0_stage0_iter0 ( or ) </first>
<second class_id="37" tracking_level="0" version="0">
<count>4</count>
<item_version>0</item_version>
<item class_id="38" tracking_level="0" version="0">
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>ap_block_state2_io ( and ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>ap_block_state2_pp0_stage0_iter1 ( or ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>ap_block_state3_io ( and ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>ap_condition_149 ( and ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>ap_condition_295 ( and ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>ap_condition_299 ( and ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>ap_predicate_op46_write_state2 ( and ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>ap_predicate_op48_write_state2 ( and ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>ap_predicate_op57_write_state3 ( and ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>ap_predicate_op9_read_state1 ( and ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>memData_count_V_fu_378_p2 ( + ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>5</second>
</item>
<item>
<first>(1P1)</first>
<second>5</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>15</second>
</item>
</second>
</item>
<item>
<first>memRdCtrl_V_1_load_A ( and ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>memRdCtrl_V_1_load_B ( and ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>memRdCtrl_V_1_state_cmp_full ( icmp ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>2</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>8</second>
</item>
</second>
</item>
<item>
<first>p_0184_1_0_v_cast_i_c_fu_371_p3 ( select ) </first>
<second>
<count>5</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>2</second>
</item>
<item>
<first>(2P2)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>p_Result_23_fu_323_p2 ( and ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>128</second>
</item>
<item>
<first>(1P1)</first>
<second>128</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>128</second>
</item>
</second>
</item>
<item>
<first>p_Result_s_fu_301_p2 ( and ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>128</second>
</item>
<item>
<first>(1P1)</first>
<second>128</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>128</second>
</item>
</second>
</item>
<item>
<first>tmp_128_i_fu_255_p2 ( icmp ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>8</second>
</item>
<item>
<first>(1P1)</first>
<second>8</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>11</second>
</item>
</second>
</item>
<item>
<first>tmp_129_i_fu_261_p2 ( icmp ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>8</second>
</item>
<item>
<first>(1P1)</first>
<second>5</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>11</second>
</item>
</second>
</item>
<item>
<first>tmp_336_fu_285_p2 ( - ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>9</second>
</item>
<item>
<first>(1P1)</first>
<second>8</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>16</second>
</item>
</second>
</item>
<item>
<first>tmp_338_fu_295_p2 ( lshr ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>2</second>
</item>
<item>
<first>(1P1)</first>
<second>128</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>423</second>
</item>
</second>
</item>
<item>
<first>tmp_340_fu_307_p2 ( - ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>9</second>
</item>
<item>
<first>(1P1)</first>
<second>8</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>16</second>
</item>
</second>
</item>
<item>
<first>tmp_342_fu_317_p2 ( lshr ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>2</second>
</item>
<item>
<first>(1P1)</first>
<second>128</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>423</second>
</item>
</second>
</item>
<item>
<first>tmp_data_V_fu_329_p3 ( select ) </first>
<second>
<count>5</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>128</second>
</item>
<item>
<first>(2P2)</first>
<second>128</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>128</second>
</item>
</second>
</item>
<item>
<first>tmp_i_fu_231_p2 ( icmp ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>8</second>
</item>
<item>
<first>(1P1)</first>
<second>4</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>11</second>
</item>
</second>
</item>
</dp_expression_resource>
<dp_fifo_resource>
<count>0</count>
<item_version>0</item_version>
</dp_fifo_resource>
<dp_memory_resource>
<count>0</count>
<item_version>0</item_version>
</dp_memory_resource>
<dp_multiplexer_resource>
<count>11</count>
<item_version>0</item_version>
<item>
<first>ap_NS_iter1_fsm</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0Size)</first>
<second>3</second>
</item>
<item>
<first>(1Bits)</first>
<second>2</second>
</item>
<item>
<first>(2Count)</first>
<second>6</second>
</item>
<item>
<first>LUT</first>
<second>15</second>
</item>
</second>
</item>
<item>
<first>ap_NS_iter2_fsm</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0Size)</first>
<second>3</second>
</item>
<item>
<first>(1Bits)</first>
<second>2</second>
</item>
<item>
<first>(2Count)</first>
<second>6</second>
</item>
<item>
<first>LUT</first>
<second>15</second>
</item>
</second>
</item>
<item>
<first>ap_done</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0Size)</first>
<second>2</second>
</item>
<item>
<first>(1Bits)</first>
<second>1</second>
</item>
<item>
<first>(2Count)</first>
<second>2</second>
</item>
<item>
<first>LUT</first>
<second>9</second>
</item>
</second>
</item>
<item>
<first>cc2memReadMd_V_blk_n</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0Size)</first>
<second>2</second>
</item>
<item>
<first>(1Bits)</first>
<second>1</second>
</item>
<item>
<first>(2Count)</first>
<second>2</second>
</item>
<item>
<first>LUT</first>
<second>9</second>
</item>
</second>
</item>
<item>
<first>cc2memRead_V_blk_n</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0Size)</first>
<second>2</second>
</item>
<item>
<first>(1Bits)</first>
<second>1</second>
</item>
<item>
<first>(2Count)</first>
<second>2</second>
</item>
<item>
<first>LUT</first>
<second>9</second>
</item>
</second>
</item>
<item>
<first>memRd2compMd_V_blk_n</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0Size)</first>
<second>2</second>
</item>
<item>
<first>(1Bits)</first>
<second>1</second>
</item>
<item>
<first>(2Count)</first>
<second>2</second>
</item>
<item>
<first>LUT</first>
<second>9</second>
</item>
</second>
</item>
<item>
<first>memRd2comp_V_blk_n</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0Size)</first>
<second>2</second>
</item>
<item>
<first>(1Bits)</first>
<second>1</second>
</item>
<item>
<first>(2Count)</first>
<second>2</second>
</item>
<item>
<first>LUT</first>
<second>9</second>
</item>
</second>
</item>
<item>
<first>memRd2comp_V_din</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0Size)</first>
<second>3</second>
</item>
<item>
<first>(1Bits)</first>
<second>130</second>
</item>
<item>
<first>(2Count)</first>
<second>390</second>
</item>
<item>
<first>LUT</first>
<second>15</second>
</item>
</second>
</item>
<item>
<first>memRdCtrl_V_1_data_out</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0Size)</first>
<second>2</second>
</item>
<item>
<first>(1Bits)</first>
<second>40</second>
</item>
<item>
<first>(2Count)</first>
<second>80</second>
</item>
<item>
<first>LUT</first>
<second>9</second>
</item>
</second>
</item>
<item>
<first>memRdCtrl_V_1_state</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0Size)</first>
<second>3</second>
</item>
<item>
<first>(1Bits)</first>
<second>2</second>
</item>
<item>
<first>(2Count)</first>
<second>6</second>
</item>
<item>
<first>LUT</first>
<second>15</second>
</item>
</second>
</item>
<item>
<first>memRdCtrl_V_TDATA_blk_n</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0Size)</first>
<second>2</second>
</item>
<item>
<first>(1Bits)</first>
<second>1</second>
</item>
<item>
<first>(2Count)</first>
<second>2</second>
</item>
<item>
<first>LUT</first>
<second>9</second>
</item>
</second>
</item>
</dp_multiplexer_resource>
<dp_register_resource>
<count>24</count>
<item_version>0</item_version>
<item>
<first>ap_CS_iter0_fsm</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>1</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>ap_CS_iter1_fsm</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>2</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>ap_CS_iter2_fsm</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>2</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>ap_done_reg</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>1</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>memRdCtrl_V_1_payload_A</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>40</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>40</second>
</item>
</second>
</item>
<item>
<first>memRdCtrl_V_1_payload_B</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>40</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>40</second>
</item>
</second>
</item>
<item>
<first>memRdCtrl_V_1_sel_rd</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>1</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>memRdCtrl_V_1_sel_wr</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>1</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>memRdCtrl_V_1_state</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>2</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>memRdState</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>1</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>memRdState_load_reg_408</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>1</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>memRdState_load_reg_408_pp0_iter1_reg</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>1</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>tmp27_reg_420</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>64</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>64</second>
</item>
</second>
</item>
<item>
<first>tmp_128_i_reg_439</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>1</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>tmp_29_reg_416</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>1</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>tmp_29_reg_416_pp0_iter1_reg</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>1</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>tmp_30_reg_434</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>4</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>4</second>
</item>
</second>
</item>
<item>
<first>tmp_43_i_reg_449</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>2</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>tmp_5_reg_454</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>130</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>130</second>
</item>
</second>
</item>
<item>
<first>tmp_data_V_reg_444</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>128</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>128</second>
</item>
</second>
</item>
<item>
<first>tmp_i_reg_430</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>1</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>tmp_i_reg_430_pp0_iter1_reg</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>1</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>tmp_reg_412</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>1</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>1</second>
</item>
</second>
</item>
<item>
<first>tmp_reg_412_pp0_iter1_reg</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>1</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>1</second>
</item>
</second>
</item>
</dp_register_resource>
<dp_dsp_resource>
<count>0</count>
<item_version>0</item_version>
</dp_dsp_resource>
<dp_component_map class_id="39" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_component_map>
<dp_expression_map>
<count>12</count>
<item_version>0</item_version>
<item class_id="40" tracking_level="0" version="0">
<first>memData_count_V_fu_378_p2 ( + ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>37</item>
</second>
</item>
<item>
<first>p_0184_1_0_v_cast_i_c_fu_371_p3 ( select ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>36</item>
</second>
</item>
<item>
<first>p_Result_23_fu_323_p2 ( and ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>53</item>
</second>
</item>
<item>
<first>p_Result_s_fu_301_p2 ( and ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>49</item>
</second>
</item>
<item>
<first>tmp_128_i_fu_255_p2 ( icmp ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>35</item>
</second>
</item>
<item>
<first>tmp_129_i_fu_261_p2 ( icmp ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>43</item>
</second>
</item>
<item>
<first>tmp_336_fu_285_p2 ( - ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>46</item>
</second>
</item>
<item>
<first>tmp_338_fu_295_p2 ( lshr ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>48</item>
</second>
</item>
<item>
<first>tmp_340_fu_307_p2 ( - ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>50</item>
</second>
</item>
<item>
<first>tmp_342_fu_317_p2 ( lshr ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>52</item>
</second>
</item>
<item>
<first>tmp_data_V_fu_329_p3 ( select ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>54</item>
</second>
</item>
<item>
<first>tmp_i_fu_231_p2 ( icmp ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>28</item>
</second>
</item>
</dp_expression_map>
<dp_fifo_map>
<count>0</count>
<item_version>0</item_version>
</dp_fifo_map>
<dp_memory_map>
<count>0</count>
<item_version>0</item_version>
</dp_memory_map>
</res>
<node_label_latency class_id="41" tracking_level="0" version="0">
<count>54</count>
<item_version>0</item_version>
<item class_id="42" tracking_level="0" version="0">
<first>13</first>
<second class_id="43" tracking_level="0" version="0">
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>14</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>16</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>17</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>19</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>20</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>22</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>23</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>24</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>25</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>26</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>27</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>28</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>29</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>31</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>32</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>33</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>34</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>35</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>36</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>37</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>38</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>39</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>40</first>
<second>
<first>1</first>
<second>1</second>
</second>
</item>
<item>
<first>41</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>43</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>44</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>45</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>46</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>47</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>48</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>49</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>50</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>51</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>52</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>53</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>54</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>55</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>56</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>57</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>58</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>59</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>61</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>62</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>64</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>66</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>68</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>69</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>70</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>71</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>73</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>74</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>76</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>78</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
</node_label_latency>
<bblk_ent_exit class_id="44" tracking_level="0" version="0">
<count>13</count>
<item_version>0</item_version>
<item class_id="45" tracking_level="0" version="0">
<first>15</first>
<second class_id="46" tracking_level="0" version="0">
<first>0</first>
<second>2</second>
</second>
</item>
<item>
<first>18</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>21</first>
<second>
<first>0</first>
<second>1</second>
</second>
</item>
<item>
<first>30</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>42</first>
<second>
<first>0</first>
<second>2</second>
</second>
</item>
<item>
<first>60</first>
<second>
<first>0</first>
<second>1</second>
</second>
</item>
<item>
<first>63</first>
<second>
<first>0</first>
<second>2</second>
</second>
</item>
<item>
<first>65</first>
<second>
<first>2</first>
<second>2</second>
</second>
</item>
<item>
<first>67</first>
<second>
<first>2</first>
<second>2</second>
</second>
</item>
<item>
<first>72</first>
<second>
<first>0</first>
<second>1</second>
</second>
</item>
<item>
<first>75</first>
<second>
<first>0</first>
<second>2</second>
</second>
</item>
<item>
<first>77</first>
<second>
<first>2</first>
<second>2</second>
</second>
</item>
<item>
<first>79</first>
<second>
<first>2</first>
<second>2</second>
</second>
</item>
</bblk_ent_exit>
<regions class_id="47" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="48" tracking_level="1" version="0" object_id="_288">
<region_name>memRead</region_name>
<basic_blocks>
<count>13</count>
<item_version>0</item_version>
<item>15</item>
<item>18</item>
<item>21</item>
<item>30</item>
<item>42</item>
<item>60</item>
<item>63</item>
<item>65</item>
<item>67</item>
<item>72</item>
<item>75</item>
<item>77</item>
<item>79</item>
</basic_blocks>
<nodes>
<count>0</count>
<item_version>0</item_version>
</nodes>
<anchor_node>-1</anchor_node>
<region_type>8</region_type>
<interval>1</interval>
<pipe_depth>3</pipe_depth>
</item>
</regions>
<dp_fu_nodes class_id="49" tracking_level="0" version="0">
<count>38</count>
<item_version>0</item_version>
<item class_id="50" tracking_level="0" version="0">
<first>152</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>16</item>
</second>
</item>
<item>
<first>160</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>19</item>
</second>
</item>
<item>
<first>168</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>22</item>
</second>
</item>
<item>
<first>174</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>25</item>
<item>68</item>
</second>
</item>
<item>
<first>180</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>40</item>
<item>40</item>
</second>
</item>
<item>
<first>187</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>57</item>
<item>70</item>
</second>
</item>
<item>
<first>194</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>58</item>
</second>
</item>
<item>
<first>201</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>27</item>
<item>69</item>
</second>
</item>
<item>
<first>209</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>13</item>
</second>
</item>
<item>
<first>213</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>23</item>
</second>
</item>
<item>
<first>217</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>24</item>
</second>
</item>
<item>
<first>227</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>26</item>
</second>
</item>
<item>
<first>231</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>28</item>
</second>
</item>
<item>
<first>237</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>32</item>
</second>
</item>
<item>
<first>247</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>34</item>
</second>
</item>
<item>
<first>255</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>35</item>
</second>
</item>
<item>
<first>261</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>43</item>
</second>
</item>
<item>
<first>267</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>44</item>
</second>
</item>
<item>
<first>277</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>45</item>
</second>
</item>
<item>
<first>285</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>46</item>
</second>
</item>
<item>
<first>291</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>47</item>
</second>
</item>
<item>
<first>295</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>48</item>
</second>
</item>
<item>
<first>301</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>49</item>
</second>
</item>
<item>
<first>307</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>50</item>
</second>
</item>
<item>
<first>313</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>51</item>
</second>
</item>
<item>
<first>317</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>52</item>
</second>
</item>
<item>
<first>323</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>53</item>
</second>
</item>
<item>
<first>329</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>54</item>
</second>
</item>
<item>
<first>337</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>55</item>
</second>
</item>
<item>
<first>347</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>61</item>
</second>
</item>
<item>
<first>353</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>73</item>
</second>
</item>
<item>
<first>359</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>31</item>
</second>
</item>
<item>
<first>368</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>33</item>
</second>
</item>
<item>
<first>371</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>36</item>
</second>
</item>
<item>
<first>378</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>37</item>
</second>
</item>
<item>
<first>384</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>38</item>
</second>
</item>
<item>
<first>396</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>39</item>
</second>
</item>
<item>
<first>401</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>56</item>
</second>
</item>
</dp_fu_nodes>
<dp_fu_nodes_expression class_id="52" tracking_level="0" version="0">
<count>28</count>
<item_version>0</item_version>
<item class_id="53" tracking_level="0" version="0">
<first>grp_fu_201</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>27</item>
<item>69</item>
</second>
</item>
<item>
<first>memData_count_V_cast_fu_368</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>33</item>
</second>
</item>
<item>
<first>memData_count_V_fu_378</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>37</item>
</second>
</item>
<item>
<first>p_0184_1_0_v_cast_i_c_fu_371</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>36</item>
</second>
</item>
<item>
<first>p_Result_23_fu_323</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>53</item>
</second>
</item>
<item>
<first>p_Result_i_fu_359</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>31</item>
</second>
</item>
<item>
<first>p_Result_s_fu_301</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>49</item>
</second>
</item>
<item>
<first>p_Val2_s_fu_227</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>26</item>
</second>
</item>
<item>
<first>r_V_fu_247</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>34</item>
</second>
</item>
<item>
<first>tmp_128_i_fu_255</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>35</item>
</second>
</item>
<item>
<first>tmp_129_i_fu_261</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>43</item>
</second>
</item>
<item>
<first>tmp_131_i_fu_277</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>45</item>
</second>
</item>
<item>
<first>tmp_2_fu_396</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>39</item>
</second>
</item>
<item>
<first>tmp_30_fu_237</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>32</item>
</second>
</item>
<item>
<first>tmp_31_fu_267</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>44</item>
</second>
</item>
<item>
<first>tmp_336_fu_285</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>46</item>
</second>
</item>
<item>
<first>tmp_337_fu_291</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>47</item>
</second>
</item>
<item>
<first>tmp_338_fu_295</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>48</item>
</second>
</item>
<item>
<first>tmp_340_fu_307</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>50</item>
</second>
</item>
<item>
<first>tmp_341_fu_313</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>51</item>
</second>
</item>
<item>
<first>tmp_342_fu_317</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>52</item>
</second>
</item>
<item>
<first>tmp_3_fu_401</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>56</item>
</second>
</item>
<item>
<first>tmp_43_i_fu_337</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>55</item>
</second>
</item>
<item>
<first>tmp_data_V_fu_329</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>54</item>
</second>
</item>
<item>
<first>tmp_i_fu_231</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>28</item>
</second>
</item>
<item>
<first>tmp_keyLength_V_fu_217</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>24</item>
</second>
</item>
<item>
<first>tmp_operation_V_fu_213</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>23</item>
</second>
</item>
<item>
<first>tmp_s_fu_384</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>38</item>
</second>
</item>
</dp_fu_nodes_expression>
<dp_fu_nodes_module>
<count>0</count>
<item_version>0</item_version>
</dp_fu_nodes_module>
<dp_fu_nodes_io>
<count>10</count>
<item_version>0</item_version>
<item>
<first>StgValue_34_store_fu_347</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>61</item>
</second>
</item>
<item>
<first>StgValue_38_store_fu_353</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>73</item>
</second>
</item>
<item>
<first>StgValue_49_write_fu_194</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>58</item>
</second>
</item>
<item>
<first>grp_read_fu_174</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>25</item>
<item>68</item>
</second>
</item>
<item>
<first>grp_write_fu_180</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>40</item>
<item>40</item>
</second>
</item>
<item>
<first>grp_write_fu_187</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>57</item>
<item>70</item>
</second>
</item>
<item>
<first>memRdState_load_load_fu_209</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>13</item>
</second>
</item>
<item>
<first>tmp27_read_fu_168</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>22</item>
</second>
</item>
<item>
<first>tmp_29_nbreadreq_fu_160</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>19</item>
</second>
</item>
<item>
<first>tmp_nbreadreq_fu_152</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>16</item>
</second>
</item>
</dp_fu_nodes_io>
<return_ports>
<count>0</count>
<item_version>0</item_version>
</return_ports>
<dp_mem_port_nodes class_id="54" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_mem_port_nodes>
<dp_reg_nodes>
<count>13</count>
<item_version>0</item_version>
<item>
<first>408</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>13</item>
</second>
</item>
<item>
<first>412</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>16</item>
</second>
</item>
<item>
<first>416</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>19</item>
</second>
</item>
<item>
<first>420</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>22</item>
</second>
</item>
<item>
<first>426</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>27</item>
</second>
</item>
<item>
<first>430</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>28</item>
</second>
</item>
<item>
<first>434</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>32</item>
</second>
</item>
<item>
<first>439</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>35</item>
</second>
</item>
<item>
<first>444</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>54</item>
</second>
</item>
<item>
<first>449</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>55</item>
</second>
</item>
<item>
<first>454</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>68</item>
</second>
</item>
<item>
<first>459</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>69</item>
</second>
</item>
<item>
<first>463</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>39</item>
</second>
</item>
</dp_reg_nodes>
<dp_regname_nodes>
<count>13</count>
<item_version>0</item_version>
<item>
<first>memRdState_load_reg_408</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>13</item>
</second>
</item>
<item>
<first>tmp27_reg_420</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>22</item>
</second>
</item>
<item>
<first>tmp_128_i_reg_439</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>35</item>
</second>
</item>
<item>
<first>tmp_29_reg_416</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>19</item>
</second>
</item>
<item>
<first>tmp_2_reg_463</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>39</item>
</second>
</item>
<item>
<first>tmp_30_reg_434</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>32</item>
</second>
</item>
<item>
<first>tmp_43_i_reg_449</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>55</item>
</second>
</item>
<item>
<first>tmp_5_reg_454</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>68</item>
</second>
</item>
<item>
<first>tmp_EOP_V_4_reg_426</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>27</item>
</second>
</item>
<item>
<first>tmp_EOP_V_reg_459</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>69</item>
</second>
</item>
<item>
<first>tmp_data_V_reg_444</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>54</item>
</second>
</item>
<item>
<first>tmp_i_reg_430</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>28</item>
</second>
</item>
<item>
<first>tmp_reg_412</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>16</item>
</second>
</item>
</dp_regname_nodes>
<dp_reg_phi>
<count>0</count>
<item_version>0</item_version>
</dp_reg_phi>
<dp_regname_phi>
<count>0</count>
<item_version>0</item_version>
</dp_regname_phi>
<dp_port_io_nodes class_id="55" tracking_level="0" version="0">
<count>5</count>
<item_version>0</item_version>
<item class_id="56" tracking_level="0" version="0">
<first>cc2memReadMd_V</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>
<first>nbreadreq</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>16</item>
</second>
</item>
<item>
<first>read</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>22</item>
</second>
</item>
</second>
</item>
<item>
<first>cc2memRead_V</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>
<first>nbreadreq</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>19</item>
</second>
</item>
<item>
<first>read</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>25</item>
<item>68</item>
</second>
</item>
</second>
</item>
<item>
<first>memRd2compMd_V</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>write</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>58</item>
</second>
</item>
</second>
</item>
<item>
<first>memRd2comp_V</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>write</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>57</item>
<item>70</item>
</second>
</item>
</second>
</item>
<item>
<first>memRdCtrl_V</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>write</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>40</item>
</second>
</item>
</second>
</item>
</dp_port_io_nodes>
<port2core class_id="57" tracking_level="0" version="0">
<count>4</count>
<item_version>0</item_version>
<item class_id="58" tracking_level="0" version="0">
<first>3</first>
<second>FIFO</second>
</item>
<item>
<first>4</first>
<second>FIFO</second>
</item>
<item>
<first>5</first>
<second>FIFO</second>
</item>
<item>
<first>6</first>
<second>FIFO</second>
</item>
</port2core>
<node2core>
<count>0</count>
<item_version>0</item_version>
</node2core>
</syndb>
</boost_serialization>
|
with Trendy_Test;
package Trendy_Terminal.Histories.Tests is
function All_Tests return Trendy_Test.Test_Group;
end Trendy_Terminal.Histories.Tests;
|
-- 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/>.
package body Pck is
My_Hidden_Variable : Integer := 0;
procedure Do_Something (I : in out Integer) is
begin
if My_Hidden_Variable > 10 then
My_Hidden_Variable := 0;
end if;
I := I + My_Hidden_Variable;
My_Hidden_Variable := My_Hidden_Variable + 1;
end Do_Something;
end Pck;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . O S _ I N T E R F A C E --
-- --
-- S p e c --
-- --
-- Copyright (C) 1991-2017, Florida State University --
-- Copyright (C) 1995-2020, 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/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
-- This is a AIX (Native THREADS) version of this package
-- This package encapsulates all direct interfaces to OS services that are
-- needed by the tasking run-time (libgnarl).
-- PLEASE DO NOT add any with-clauses to this package or remove the pragma
-- Preelaborate. This package is designed to be a bottom-level (leaf) package.
with Ada.Unchecked_Conversion;
with Interfaces.C;
with Interfaces.C.Extensions;
package System.OS_Interface is
pragma Preelaborate;
pragma Linker_Options ("-pthread");
-- This implies -lpthreads + other things depending on the GCC
-- configuration, such as the selection of a proper libgcc variant
-- for table-based exception handling when it is available.
pragma Linker_Options ("-lc_r");
subtype int is Interfaces.C.int;
subtype short is Interfaces.C.short;
subtype long is Interfaces.C.long;
subtype long_long is Interfaces.C.Extensions.long_long;
subtype unsigned is Interfaces.C.unsigned;
subtype unsigned_short is Interfaces.C.unsigned_short;
subtype unsigned_long is Interfaces.C.unsigned_long;
subtype unsigned_char is Interfaces.C.unsigned_char;
subtype plain_char is Interfaces.C.plain_char;
subtype size_t is Interfaces.C.size_t;
-----------
-- Errno --
-----------
function errno return int;
pragma Import (C, errno, "__get_errno");
EAGAIN : constant := 11;
EINTR : constant := 4;
EINVAL : constant := 22;
ENOMEM : constant := 12;
ETIMEDOUT : constant := 78;
-------------
-- Signals --
-------------
Max_Interrupt : constant := 63;
type Signal is new int range 0 .. Max_Interrupt;
for Signal'Size use int'Size;
SIGHUP : constant := 1; -- hangup
SIGINT : constant := 2; -- interrupt (rubout)
SIGQUIT : constant := 3; -- quit (ASCD FS)
SIGILL : constant := 4; -- illegal instruction (not reset)
SIGTRAP : constant := 5; -- trace trap (not reset)
SIGIOT : constant := 6; -- IOT instruction
SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future
SIGEMT : constant := 7; -- EMT instruction
SIGFPE : constant := 8; -- floating point exception
SIGKILL : constant := 9; -- kill (cannot be caught or ignored)
SIGBUS : constant := 10; -- bus error
SIGSEGV : constant := 11; -- segmentation violation
SIGSYS : constant := 12; -- bad argument to system call
SIGPIPE : constant := 13; -- write on a pipe with no one to read it
SIGALRM : constant := 14; -- alarm clock
SIGTERM : constant := 15; -- software termination signal from kill
SIGUSR1 : constant := 30; -- user defined signal 1
SIGUSR2 : constant := 31; -- user defined signal 2
SIGCLD : constant := 20; -- alias for SIGCHLD
SIGCHLD : constant := 20; -- child status change
SIGPWR : constant := 29; -- power-fail restart
SIGWINCH : constant := 28; -- window size change
SIGURG : constant := 16; -- urgent condition on IO channel
SIGPOLL : constant := 23; -- pollable event occurred
SIGIO : constant := 23; -- I/O possible (Solaris SIGPOLL alias)
SIGSTOP : constant := 17; -- stop (cannot be caught or ignored)
SIGTSTP : constant := 18; -- user stop requested from tty
SIGCONT : constant := 19; -- stopped process has been continued
SIGTTIN : constant := 21; -- background tty read attempted
SIGTTOU : constant := 22; -- background tty write attempted
SIGVTALRM : constant := 34; -- virtual timer expired
SIGPROF : constant := 32; -- profiling timer expired
SIGXCPU : constant := 24; -- CPU time limit exceeded
SIGXFSZ : constant := 25; -- filesize limit exceeded
SIGWAITING : constant := 39; -- m:n scheduling
-- The following signals are AIX specific
SIGMSG : constant := 27; -- input data is in the ring buffer
SIGDANGER : constant := 33; -- system crash imminent
SIGMIGRATE : constant := 35; -- migrate process
SIGPRE : constant := 36; -- programming exception
SIGVIRT : constant := 37; -- AIX virtual time alarm
SIGALRM1 : constant := 38; -- m:n condition variables
SIGCPUFAIL : constant := 59; -- Predictive De-configuration of Processors
SIGKAP : constant := 60; -- keep alive poll from native keyboard
SIGGRANT : constant := SIGKAP; -- monitor mode granted
SIGRETRACT : constant := 61; -- monitor mode should be relinquished
SIGSOUND : constant := 62; -- sound control has completed
SIGSAK : constant := 63; -- secure attention key
SIGADAABORT : constant := SIGEMT;
-- Note: on other targets, we usually use SIGABRT, but on AIX, it appears
-- that SIGABRT can't be used in sigwait(), so we use SIGEMT.
-- SIGEMT is "Emulator Trap Instruction" from the PDP-11, and does not
-- have a standardized usage.
type Signal_Set is array (Natural range <>) of Signal;
Unmasked : constant Signal_Set :=
(SIGTRAP, SIGTTIN, SIGTTOU, SIGTSTP, SIGPROF);
Reserved : constant Signal_Set :=
(SIGABRT, SIGKILL, SIGSTOP, SIGALRM1, SIGWAITING, SIGCPUFAIL);
type sigset_t is private;
function sigaddset (set : access sigset_t; sig : Signal) return int;
pragma Import (C, sigaddset, "sigaddset");
function sigdelset (set : access sigset_t; sig : Signal) return int;
pragma Import (C, sigdelset, "sigdelset");
function sigfillset (set : access sigset_t) return int;
pragma Import (C, sigfillset, "sigfillset");
function sigismember (set : access sigset_t; sig : Signal) return int;
pragma Import (C, sigismember, "sigismember");
function sigemptyset (set : access sigset_t) return int;
pragma Import (C, sigemptyset, "sigemptyset");
type struct_sigaction is record
sa_handler : System.Address;
sa_mask : sigset_t;
sa_flags : int;
end record;
pragma Convention (C, struct_sigaction);
type struct_sigaction_ptr is access all struct_sigaction;
SA_SIGINFO : constant := 16#0100#;
SA_ONSTACK : constant := 16#0001#;
SIG_BLOCK : constant := 0;
SIG_UNBLOCK : constant := 1;
SIG_SETMASK : constant := 2;
SIG_DFL : constant := 0;
SIG_IGN : constant := 1;
function sigaction
(sig : Signal;
act : struct_sigaction_ptr;
oact : struct_sigaction_ptr) return int;
pragma Import (C, sigaction, "sigaction");
----------
-- Time --
----------
Time_Slice_Supported : constant Boolean := True;
-- Indicates whether time slicing is supported
type timespec is private;
type clockid_t is new long_long;
function clock_gettime
(clock_id : clockid_t;
tp : access timespec) return int;
pragma Import (C, clock_gettime, "clock_gettime");
function clock_getres
(clock_id : clockid_t;
res : access timespec) return int;
pragma Import (C, clock_getres, "clock_getres");
function To_Duration (TS : timespec) return Duration;
pragma Inline (To_Duration);
function To_Timespec (D : Duration) return timespec;
pragma Inline (To_Timespec);
type struct_timezone is record
tz_minuteswest : int;
tz_dsttime : int;
end record;
pragma Convention (C, struct_timezone);
type struct_timezone_ptr is access all struct_timezone;
-------------------------
-- Priority Scheduling --
-------------------------
SCHED_FIFO : constant := 1;
SCHED_RR : constant := 2;
SCHED_OTHER : constant := 0;
function To_Target_Priority
(Prio : System.Any_Priority) return Interfaces.C.int;
-- Maps System.Any_Priority to a POSIX priority
-------------
-- Process --
-------------
type pid_t is private;
function kill (pid : pid_t; sig : Signal) return int;
pragma Import (C, kill, "kill");
function getpid return pid_t;
pragma Import (C, getpid, "getpid");
---------
-- LWP --
---------
function lwp_self return System.Address;
pragma Import (C, lwp_self, "thread_self");
-------------
-- Threads --
-------------
type Thread_Body is access
function (arg : System.Address) return System.Address;
pragma Convention (C, Thread_Body);
function Thread_Body_Access is new
Ada.Unchecked_Conversion (System.Address, Thread_Body);
type pthread_t is private;
subtype Thread_Id is pthread_t;
type pthread_mutex_t is limited private;
type pthread_cond_t is limited private;
type pthread_attr_t is limited private;
type pthread_mutexattr_t is limited private;
type pthread_condattr_t is limited private;
type pthread_key_t is private;
PTHREAD_CREATE_DETACHED : constant := 1;
PTHREAD_SCOPE_PROCESS : constant := 1;
PTHREAD_SCOPE_SYSTEM : constant := 0;
-- Read/Write lock not supported on AIX. To add support both types
-- pthread_rwlock_t and pthread_rwlockattr_t must properly be defined
-- with the associated routines pthread_rwlock_[init/destroy] and
-- pthread_rwlock_[rdlock/wrlock/unlock].
subtype pthread_rwlock_t is pthread_mutex_t;
subtype pthread_rwlockattr_t is pthread_mutexattr_t;
-----------
-- Stack --
-----------
type stack_t is record
ss_sp : System.Address;
ss_size : size_t;
ss_flags : int;
end record;
pragma Convention (C, stack_t);
function sigaltstack
(ss : not null access stack_t;
oss : access stack_t) return int;
pragma Import (C, sigaltstack, "sigaltstack");
Alternate_Stack : aliased System.Address;
-- This is a dummy definition, never used (Alternate_Stack_Size is null)
Alternate_Stack_Size : constant := 0;
-- No alternate signal stack is used on this platform
Stack_Base_Available : constant Boolean := False;
-- Indicates whether the stack base is available on this target
function Get_Stack_Base (thread : pthread_t) return Address;
pragma Inline (Get_Stack_Base);
-- Returns the stack base of the specified thread. Only call this function
-- when Stack_Base_Available is True.
function Get_Page_Size return int;
pragma Import (C, Get_Page_Size, "getpagesize");
-- Returns the size of a page
PROT_NONE : constant := 0;
PROT_READ : constant := 1;
PROT_WRITE : constant := 2;
PROT_EXEC : constant := 4;
PROT_ALL : constant := PROT_READ + PROT_WRITE + PROT_EXEC;
PROT_ON : constant := PROT_READ;
PROT_OFF : constant := PROT_ALL;
function mprotect (addr : Address; len : size_t; prot : int) return int;
pragma Import (C, mprotect);
---------------------------------------
-- Nonstandard Thread Initialization --
---------------------------------------
-- Though not documented, pthread_init *must* be called before any other
-- pthread call.
procedure pthread_init;
pragma Import (C, pthread_init, "pthread_init");
-------------------------
-- POSIX.1c Section 3 --
-------------------------
function sigwait
(set : access sigset_t;
sig : access Signal) return int;
pragma Import (C, sigwait, "sigwait");
function pthread_kill
(thread : pthread_t;
sig : Signal) return int;
pragma Import (C, pthread_kill, "pthread_kill");
function pthread_sigmask
(how : int;
set : access sigset_t;
oset : access sigset_t) return int;
pragma Import (C, pthread_sigmask, "sigthreadmask");
--------------------------
-- POSIX.1c Section 11 --
--------------------------
function pthread_mutexattr_init
(attr : access pthread_mutexattr_t) return int;
pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init");
function pthread_mutexattr_destroy
(attr : access pthread_mutexattr_t) return int;
pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy");
function pthread_mutex_init
(mutex : access pthread_mutex_t;
attr : access pthread_mutexattr_t) return int;
pragma Import (C, pthread_mutex_init, "pthread_mutex_init");
function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int;
pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy");
function pthread_mutex_lock (mutex : access pthread_mutex_t) return int;
pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock");
function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int;
pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock");
function pthread_condattr_init
(attr : access pthread_condattr_t) return int;
pragma Import (C, pthread_condattr_init, "pthread_condattr_init");
function pthread_condattr_destroy
(attr : access pthread_condattr_t) return int;
pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy");
function pthread_cond_init
(cond : access pthread_cond_t;
attr : access pthread_condattr_t) return int;
pragma Import (C, pthread_cond_init, "pthread_cond_init");
function pthread_cond_destroy (cond : access pthread_cond_t) return int;
pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy");
function pthread_cond_signal (cond : access pthread_cond_t) return int;
pragma Import (C, pthread_cond_signal, "pthread_cond_signal");
function pthread_cond_wait
(cond : access pthread_cond_t;
mutex : access pthread_mutex_t) return int;
pragma Import (C, pthread_cond_wait, "pthread_cond_wait");
function pthread_cond_timedwait
(cond : access pthread_cond_t;
mutex : access pthread_mutex_t;
abstime : access timespec) return int;
pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait");
--------------------------
-- POSIX.1c Section 13 --
--------------------------
PTHREAD_PRIO_PROTECT : constant := 2;
function PTHREAD_PRIO_INHERIT return int;
-- Return value of C macro PTHREAD_PRIO_INHERIT. This function is needed
-- since the value is different between AIX versions.
function pthread_mutexattr_setprotocol
(attr : access pthread_mutexattr_t;
protocol : int) return int;
pragma Import (C, pthread_mutexattr_setprotocol);
function pthread_mutexattr_setprioceiling
(attr : access pthread_mutexattr_t;
prioceiling : int) return int;
pragma Import (C, pthread_mutexattr_setprioceiling);
type Array_5_Int is array (0 .. 5) of int;
type struct_sched_param is record
sched_priority : int;
sched_policy : int;
sched_reserved : Array_5_Int;
end record;
function pthread_setschedparam
(thread : pthread_t;
policy : int;
param : access struct_sched_param) return int;
pragma Import (C, pthread_setschedparam, "pthread_setschedparam");
function pthread_attr_setscope
(attr : access pthread_attr_t;
contentionscope : int) return int;
pragma Import (C, pthread_attr_setscope, "pthread_attr_setscope");
function pthread_attr_setinheritsched
(attr : access pthread_attr_t;
inheritsched : int) return int;
pragma Import (C, pthread_attr_setinheritsched);
function pthread_attr_setschedpolicy
(attr : access pthread_attr_t;
policy : int) return int;
pragma Import (C, pthread_attr_setschedpolicy);
function pthread_attr_setschedparam
(attr : access pthread_attr_t;
sched_param : int) return int;
pragma Import (C, pthread_attr_setschedparam);
function sched_yield return int;
-- AIX have a nonstandard sched_yield
--------------------------
-- P1003.1c Section 16 --
--------------------------
function pthread_attr_init (attributes : access pthread_attr_t) return int;
pragma Import (C, pthread_attr_init, "pthread_attr_init");
function pthread_attr_destroy
(attributes : access pthread_attr_t) return int;
pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy");
function pthread_attr_setdetachstate
(attr : access pthread_attr_t;
detachstate : int) return int;
pragma Import (C, pthread_attr_setdetachstate);
function pthread_attr_setstacksize
(attr : access pthread_attr_t;
stacksize : size_t) return int;
pragma Import (C, pthread_attr_setstacksize);
function pthread_create
(thread : access pthread_t;
attributes : access pthread_attr_t;
start_routine : Thread_Body;
arg : System.Address)
return int;
pragma Import (C, pthread_create, "pthread_create");
procedure pthread_exit (status : System.Address);
pragma Import (C, pthread_exit, "pthread_exit");
function pthread_self return pthread_t;
pragma Import (C, pthread_self, "pthread_self");
--------------------------
-- POSIX.1c Section 17 --
--------------------------
function pthread_setspecific
(key : pthread_key_t;
value : System.Address) return int;
pragma Import (C, pthread_setspecific, "pthread_setspecific");
function pthread_getspecific (key : pthread_key_t) return System.Address;
pragma Import (C, pthread_getspecific, "pthread_getspecific");
type destructor_pointer is access procedure (arg : System.Address);
pragma Convention (C, destructor_pointer);
function pthread_key_create
(key : access pthread_key_t;
destructor : destructor_pointer) return int;
pragma Import (C, pthread_key_create, "pthread_key_create");
private
type sigset_t is record
losigs : unsigned_long;
hisigs : unsigned_long;
end record;
pragma Convention (C_Pass_By_Copy, sigset_t);
type pid_t is new int;
type time_t is new long;
type timespec is record
tv_sec : time_t;
tv_nsec : long;
end record;
pragma Convention (C, timespec);
type pthread_attr_t is new System.Address;
pragma Convention (C, pthread_attr_t);
-- typedef struct __pt_attr *pthread_attr_t;
type pthread_condattr_t is new System.Address;
pragma Convention (C, pthread_condattr_t);
-- typedef struct __pt_attr *pthread_condattr_t;
type pthread_mutexattr_t is new System.Address;
pragma Convention (C, pthread_mutexattr_t);
-- typedef struct __pt_attr *pthread_mutexattr_t;
type pthread_t is new System.Address;
pragma Convention (C, pthread_t);
-- typedef void *pthread_t;
type ptq_queue;
type ptq_queue_ptr is access all ptq_queue;
type ptq_queue is record
ptq_next : ptq_queue_ptr;
ptq_prev : ptq_queue_ptr;
end record;
type Array_3_Int is array (0 .. 3) of int;
type pthread_mutex_t is record
link : ptq_queue;
ptmtx_lock : int;
ptmtx_flags : long;
protocol : int;
prioceiling : int;
ptmtx_owner : pthread_t;
mtx_id : int;
attr : pthread_attr_t;
mtx_kind : int;
lock_cpt : int;
reserved : Array_3_Int;
end record;
pragma Convention (C, pthread_mutex_t);
type pthread_mutex_t_ptr is access pthread_mutex_t;
type pthread_cond_t is record
link : ptq_queue;
ptcv_lock : int;
ptcv_flags : long;
ptcv_waiters : ptq_queue;
cv_id : int;
attr : pthread_attr_t;
mutex : pthread_mutex_t_ptr;
cptwait : int;
reserved : int;
end record;
pragma Convention (C, pthread_cond_t);
type pthread_key_t is new unsigned;
end System.OS_Interface;
|
-- Parallel and Distributed Computing
-- RGR. Ada Rendezvous
-- Task: Z = X*(MA*MS) + min(Q)*(R*MF)
-- Koval Rostyslav IO-71
with Ada.Text_IO, Ada.Integer_text_iO, Ada.Synchronous_Task_Control, Data;
use Ada.Text_IO, Ada.Integer_text_iO, Ada.Synchronous_Task_Control;
with Ada.Real_Time;
use Ada.Real_Time;
procedure main is
Value : Integer := 1;
N : Natural := 8;
P : Natural := 4;
H : Natural := N/P;
firstTime: Ada.Real_Time.Time;
secondTime: Ada.Real_Time.Time_Span;
function Calc_Time return Ada.Real_Time.Time_Span is
begin
return Ada.Real_Time.Clock - firstTime;
end Calc_Time;
measure : Duration;
package DataN is new Data(N, H);
use DataN;
procedure StartTasks is
task T1 is
pragma Storage_Size(1024*1024*1024);
entry DATA_X(X: in VectorN);
entry DATA_Q(q: in Integer);
entry DATA_R_MSH(R: in VectorN; MSH: in MatrixH);
entry DATA_QH_MFH(QH: in VectorH; MFH: in MatrixH);
entry RESULT_T1(Z11 : out VectorH);
end T1;
task T2 is
pragma Storage_Size(1024*1024*1024);
entry DATA_MA(MA: in MatrixN);
entry DATA_Q1(q1: in Integer);
entry DATA_Q3(q3: in Integer);
entry DATA_Q4(q4: in Integer);
entry DATA_R_MSH(R: in VectorN; MSH: in MatrixH);
entry DATA_QH_MFH(QH: in VectorH; MFH: in MatrixH);
end T2;
task T3 is
pragma Storage_Size(1024*1024*1024);
entry DATA_X(X: in VectorN);
entry DATA_MA(MA: in MatrixN);
entry DATA_Q(q: in Integer);
entry DATA_QH_MFH(QH: in VectorH; MFH: in MatrixH);
entry RESULT_T3(Z33 : out VectorH);
end T3;
task T4 is
pragma Storage_Size(1024*1024*1024);
entry DATA_X(X: in VectorN);
entry DATA_MA(MA: in MatrixN);
entry DATA_Q(q: in Integer);
entry DATA_R_MSH(R: in VectorN; MSH: in MatrixH);
entry RESULT_T4(Z44 : out VectorH);
end T4;
task body T1 is
MA1: MatrixN;
X1: VectorN;
Q1 : VectorH;
q11: Integer := 0;
q_1: Integer := 0;
MF1: MatrixH;
MS1: MatrixH;
R1: VectorN;
Z1: VectorH;
begin
Put_Line("T1 started");
Input(MA1,1);
T2.DATA_MA(MA1);
T3.DATA_MA(MA1);
T4.DATA_MA(MA1);
accept DATA_X (X : in VectorN) do
X1 := X;
end DATA_X;
accept DATA_R_MSH (R : in VectorN; MSH : in MatrixH) do
R1 := R;
MS1 := MSH;
end DATA_R_MSH;
accept DATA_QH_MFH (QH : in VectorH; MFH : in MatrixH) do
Q1 := QH;
MF1 := MFH;
end DATA_QH_MFH;
FindMinZ(Q1,q11);
T2.DATA_Q1(q11);
accept DATA_Q (q : in Integer) do
q_1 := q;
end DATA_Q;
Z1:=Calculation(X1,MA1,MS1,q_1,R1,MF1);
accept RESULT_T1 (Z11 : out VectorH) do
Z11:=Z1;
end RESULT_T1;
Put_Line("T1 finished");
end T1;
task body T2 is
MA2: MatrixN;
X2: VectorN;
Q2 : VectorH;
q22: Integer := 0;
q_2: Integer := 0;
q2_1: Integer := 0;
q2_3: Integer := 0;
q2_4: Integer := 0;
MF2: MatrixH;
MS2: MatrixH;
R2: VectorN;
Z2: VectorH;
Z1:VectorH;
Z3:VectorH;
Z4:VectorH;
Z: VectorN;
begin
Put_Line("T2 started");
Input(X2,1);
accept DATA_MA (MA : in MatrixN) do
MA2 := MA;
end DATA_MA;
T1.DATA_X(X2);
T3.DATA_X(X2);
T4.DATA_X(X2);
accept DATA_R_MSH (R : in VectorN; MSH : in MatrixH) do
R2 := R;
MS2 := MSH;
end DATA_R_MSH;
accept DATA_QH_MFH (QH : in VectorH; MFH : in MatrixH) do
Q2 := QH;
MF2 := MFH;
end DATA_QH_MFH;
FindMinZ(Q2,q22);
accept DATA_Q1 (q1 : in Integer) do
q2_1 := q1;
end DATA_Q1;
q22 := Min(q22, q2_1);
accept DATA_Q3 (q3 : in Integer) do
q2_3 := q3;
end DATA_Q3;
q22 := Min(q22, q2_3);
accept DATA_Q4 (q4 : in Integer) do
q2_4 := q4;
end DATA_Q4;
q22 := Min(q22, q2_4);
T1.DATA_Q(q22);
T3.DATA_Q(q22);
T4.DATA_Q(q22);
Z2:=Calculation(X2,MA2,MS2,q22,R2,MF2);
T1.RESULT_T1(Z1);
T3.RESULT_T3(Z3);
T4.RESULT_T4(Z4);
for j in 1..H loop
Z(j) := Z1(j);
Z(H+j) := Z2(j);
Z(2*H+j) := Z3(j);
Z(3*H+j) := Z4(j);
end loop;
Output(Z);
Put_Line("T2 finished");
end T2;
task body T3 is
MA3: MatrixN;
X3: VectorN;
Q3 : VectorH;
q33: Integer := 0;
q_3: Integer := 0;
MF3: MatrixH;
MS3: MatrixN;
R3: VectorN;
Z3: VectorH;
MT: MatrixH;
begin
Put_Line("T3 started");
Input(MS3,1);
Input(R3,1);
accept DATA_MA (MA : in MatrixN) do
MA3 := MA;
end DATA_MA;
accept DATA_X (X : in VectorN) do
X3 := X;
end DATA_X;
T1.DATA_R_MSH(R3, MS3(1..H));
T2.DATA_R_MSH(R3, MS3(H+1..2*H));
T4.DATA_R_MSH(R3, MS3(3*H+1..4*H));
accept DATA_QH_MFH (QH : in VectorH; MFH : in MatrixH) do
Q3 := QH;
MF3 := MFH;
end DATA_QH_MFH;
FindMinZ(Q3,q33);
T2.DATA_Q3(q33);
accept DATA_Q (q : in Integer) do
q_3 := q;
end DATA_Q;
for j in 1..H loop
for i in 1..N loop
MT(j)(i) := MS3(2*H+j)(i);
end loop;
end loop;
Z3:=Calculation(X3,MA3,MT,q_3,R3,MF3);
accept RESULT_T3 (Z33 : out VectorH) do
Z33:=Z3;
end RESULT_T3;
Put_Line("T3 finished");
end T3;
task body T4 is
MA4: MatrixN;
X4: VectorN;
Q4 : VectorN;
q44: Integer := 0;
q_4: Integer := 0;
MF4: MatrixN;
MS4: MatrixH;
R4: VectorN;
Z4: VectorH;
MK: MatrixH;
K: VectorH;
begin
Put_Line("T4 started");
Input(MF4,1);
Input(Q4,1);
accept DATA_MA (MA : in MatrixN) do
MA4 := MA;
end DATA_MA;
accept DATA_X (X : in VectorN) do
X4 := X;
end DATA_X;
accept DATA_R_MSH (R : in VectorN; MSH : in MatrixH) do
R4 := R;
MS4 := MSH;
end DATA_R_MSH;
T1.DATA_QH_MFH(Q4(1..H),MF4(1..H));
T2.DATA_QH_MFH(Q4(H+1..2*H),MF4(H+1..2*H));
T3.DATA_QH_MFH(Q4(2*H+1..3*H),MF4(2*H+1..3*H));
for i in 1..H loop
K(i) := Q4(3*H+i);
end loop;
FindMinZ(K,q44);
T2.DATA_Q4(q44);
accept DATA_Q (q : in Integer) do
q_4 := q;
end DATA_Q;
for j in 1..H loop
for i in 1..N loop
MK(j)(i) := MF4(3*H+j)(i);
end loop;
end loop;
Z4:=Calculation(X4,MA4,MS4,q_4,R4,MK);
accept RESULT_T4 (Z44 : out VectorH) do
Z44:=Z4;
end RESULT_T4;
Put_Line("T4 finished");
end T4;
begin
null;
end StartTasks;
begin
firstTime := Ada.Real_Time.Clock;
Put_Line ("Lab4 started");
StartTasks;
Put_Line ("Lab4 finished");
secondTime:=Calc_Time;
measure:=Ada.Real_Time.To_Duration(secondTime);
Put(Duration'Image(measure));
end main;
|
pragma License (Unrestricted);
with Ada.Strings.Maps.Constants;
private with Ada.Strings.Maps.Naked;
private with Ada.Strings.Naked_Maps.Set_Constants;
package Ada.Strings.Wide_Wide_Maps.Wide_Wide_Constants is
pragma Preelaborate;
-- extended
-- There are sets of unicode category.
function Unassigned_Set return Wide_Wide_Character_Set
renames Maps.Constants.Unassigned_Set;
function Uppercase_Letter_Set return Wide_Wide_Character_Set
renames Maps.Constants.Uppercase_Letter_Set;
function Lowercase_Letter_Set return Wide_Wide_Character_Set
renames Maps.Constants.Lowercase_Letter_Set;
function Titlecase_Letter_Set return Wide_Wide_Character_Set
renames Maps.Constants.Titlecase_Letter_Set;
function Modifier_Letter_Set return Wide_Wide_Character_Set
renames Maps.Constants.Modifier_Letter_Set;
function Other_Letter_Set return Wide_Wide_Character_Set
renames Maps.Constants.Other_Letter_Set;
function Decimal_Number_Set return Wide_Wide_Character_Set
renames Maps.Constants.Decimal_Number_Set;
function Letter_Number_Set return Wide_Wide_Character_Set
renames Maps.Constants.Letter_Number_Set;
function Other_Number_Set return Wide_Wide_Character_Set
renames Maps.Constants.Other_Number_Set;
function Line_Separator_Set return Wide_Wide_Character_Set
renames Maps.Constants.Line_Separator_Set;
function Paragraph_Separator_Set return Wide_Wide_Character_Set
renames Maps.Constants.Paragraph_Separator_Set;
function Control_Set return Wide_Wide_Character_Set
renames Maps.Constants.Control_Set;
function Format_Set return Wide_Wide_Character_Set
renames Maps.Constants.Format_Set;
function Private_Use_Set return Wide_Wide_Character_Set
renames Maps.Constants.Private_Use_Set;
function Surrogate_Set return Wide_Wide_Character_Set
renames Maps.Constants.Surrogate_Set;
-- extended
function Base_Set return Wide_Wide_Character_Set
renames Maps.Constants.Base_Set;
-- Control_Set : constant Wide_Wide_Character_Set;
-- Control_Set is declared as unicode category in above.
-- Graphic_Set : constant Wide_Wide_Character_Set;
function Graphic_Set return Wide_Wide_Character_Set
renames Maps.Constants.Graphic_Set;
-- Letter_Set : constant Wide_Wide_Character_Set;
function Letter_Set return Wide_Wide_Character_Set
renames Maps.Constants.Letter_Set;
-- Lower_Set : constant Wide_Wide_Character_Set;
function Lower_Set return Wide_Wide_Character_Set
renames Lowercase_Letter_Set;
-- Note: Lower_Set is extended for all unicode characters.
-- Upper_Set : constant Wide_Wide_Character_Set;
function Upper_Set return Wide_Wide_Character_Set
renames Uppercase_Letter_Set;
-- Note: Upper_Set is extended for all unicode characters.
-- Basic_Set : constant Wide_Wide_Character_Set;
function Basic_Set return Wide_Wide_Character_Set
renames Maps.Constants.Basic_Set;
-- Note: Basic_Set is extended for all unicode characters.
-- Decimal_Digit_Set : constant Wide_Wide_Character_Set;
function Decimal_Digit_Set return Wide_Wide_Character_Set
renames Maps.Constants.Decimal_Digit_Set;
-- Note: Decimal_Digit_Set is NOT extended for parsing.
-- Hexadecimal_Digit_Set : constant Wide_Wide_Character_Set;
function Hexadecimal_Digit_Set return Wide_Wide_Character_Set
renames Maps.Constants.Hexadecimal_Digit_Set;
-- Note: Hexadecimal_Digit_Set is NOT extended for parsing.
-- Alphanumeric_Set : constant Wide_Wide_Character_Set;
function Alphanumeric_Set return Wide_Wide_Character_Set
renames Maps.Constants.Alphanumeric_Set;
-- Special_Set : constant Wide_Wide_Character_Set;
function Special_Set return Wide_Wide_Character_Set
renames Maps.Constants.Special_Set;
-- ISO_646_Set : constant Wide_Wide_Character_Set;
function ISO_646_Set return Wide_Wide_Character_Set
renames Maps.Constants.ISO_646_Set;
-- Lower_Case_Map : constant Wide_Wide_Character_Mapping;
function Lower_Case_Map return Wide_Wide_Character_Mapping
renames Maps.Constants.Lower_Case_Map;
-- Maps to lower case for letters, else identity
-- Note: Lower_Case_Map is extended for all unicode characters.
-- Upper_Case_Map : constant Wide_Wide_Character_Mapping;
function Upper_Case_Map return Wide_Wide_Character_Mapping
renames Maps.Constants.Upper_Case_Map;
-- Maps to upper case for letters, else identity
-- Note: Upper_Case_Map is extended for all unicode characters.
-- extended from here
function Case_Folding_Map return Wide_Wide_Character_Mapping
renames Maps.Constants.Case_Folding_Map;
-- to here
-- Basic_Map : constant Wide_Wide_Character_Mapping;
function Basic_Map return Wide_Wide_Character_Mapping
renames Maps.Constants.Basic_Map;
-- Maps to basic letter for letters, else identity
-- Note: Basic_Map is extended for all unicode characters, and not
-- limited to letters.
-- RM A.4.8
-- Character_Set : constant Wide_Wide_Maps.Wide_Wide_Character_Set;
function Character_Set return Wide_Wide_Character_Set
renames ISO_646_Set;
-- Contains each Wide_Wide_Character value WWC such that
-- Characters.Conversions.Is_Character(WWC) is True
-- Note: (16#7F# .. 16#FF#) is excluded from Character_Set.
-- Wide_Character_Set : constant Wide_Wide_Maps.Wide_Wide_Character_Set;
function Wide_Character_Set return Wide_Wide_Character_Set;
-- Contains each Wide_Wide_Character value WWC such that
-- Characters.Conversions.Is_Wide_Character(WWC) is True
-- Note: The range of surrogate pair is excluded
-- from Wide_Character_Set.
pragma Inline (Wide_Character_Set);
private
function Wide_Character_Set_Body is
new Maps.Naked.To_Set (Naked_Maps.Set_Constants.Wide_Character_Set);
function Wide_Character_Set return Wide_Wide_Character_Set
renames Wide_Character_Set_Body;
end Ada.Strings.Wide_Wide_Maps.Wide_Wide_Constants;
|
with Ada.Text_IO, Ada.Command_Line, Crypto.Types.Big_Numbers;
procedure Mod_Exp is
A: String :=
"2988348162058574136915891421498819466320163312926952423791023078876139";
B: String :=
"2351399303373464486466122544523690094744975233415544072992656881240319";
D: constant Positive := Positive'Max(Positive'Max(A'Length, B'Length), 40);
-- the number of decimals to store A, B, and result
Bits: constant Positive := (34*D)/10;
-- (slightly more than) the number of bits to store A, B, and result
package LN is new Crypto.Types.Big_Numbers (Bits + (32 - Bits mod 32));
-- the actual number of bits has to be a multiple of 32
use type LN.Big_Unsigned;
function "+"(S: String) return LN.Big_Unsigned
renames LN.Utils.To_Big_Unsigned;
M: LN.Big_Unsigned := (+"10") ** (+"40");
begin
Ada.Text_IO.Put("A**B (mod 10**40) = ");
Ada.Text_IO.Put_Line(LN.Utils.To_String(LN.Mod_Utils.Pow((+A), (+B), M)));
end Mod_Exp;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S E M _ C H 1 3 --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Aspects; use Aspects;
with Atree; use Atree;
with Checks; use Checks;
with Debug; use Debug;
with Einfo; use Einfo;
with Elists; use Elists;
with Errout; use Errout;
with Expander; use Expander;
with Exp_Disp; use Exp_Disp;
with Exp_Tss; use Exp_Tss;
with Exp_Util; use Exp_Util;
with Freeze; use Freeze;
with Ghost; use Ghost;
with Lib; use Lib;
with Lib.Xref; use Lib.Xref;
with Namet; use Namet;
with Nlists; use Nlists;
with Nmake; use Nmake;
with Opt; use Opt;
with Restrict; use Restrict;
with Rident; use Rident;
with Rtsfind; use Rtsfind;
with Sem; use Sem;
with Sem_Aux; use Sem_Aux;
with Sem_Case; use Sem_Case;
with Sem_Ch3; use Sem_Ch3;
with Sem_Ch6; use Sem_Ch6;
with Sem_Ch8; use Sem_Ch8;
with Sem_Dim; use Sem_Dim;
with Sem_Disp; use Sem_Disp;
with Sem_Eval; use Sem_Eval;
with Sem_Prag; use Sem_Prag;
with Sem_Res; use Sem_Res;
with Sem_Type; use Sem_Type;
with Sem_Util; use Sem_Util;
with Sem_Warn; use Sem_Warn;
with Sinfo; use Sinfo;
with Sinput; use Sinput;
with Snames; use Snames;
with Stand; use Stand;
with Targparm; use Targparm;
with Ttypes; use Ttypes;
with Tbuild; use Tbuild;
with Urealp; use Urealp;
with Warnsw; use Warnsw;
with GNAT.Heap_Sort_G;
package body Sem_Ch13 is
SSU : constant Pos := System_Storage_Unit;
-- Convenient short hand for commonly used constant
-----------------------
-- Local Subprograms --
-----------------------
procedure Adjust_Record_For_Reverse_Bit_Order_Ada_95 (R : Entity_Id);
-- Helper routine providing the original (pre-AI95-0133) behavior for
-- Adjust_Record_For_Reverse_Bit_Order.
procedure Alignment_Check_For_Size_Change (Typ : Entity_Id; Size : Uint);
-- This routine is called after setting one of the sizes of type entity
-- Typ to Size. The purpose is to deal with the situation of a derived
-- type whose inherited alignment is no longer appropriate for the new
-- size value. In this case, we reset the Alignment to unknown.
procedure Build_Discrete_Static_Predicate
(Typ : Entity_Id;
Expr : Node_Id;
Nam : Name_Id);
-- Given a predicated type Typ, where Typ is a discrete static subtype,
-- whose predicate expression is Expr, tests if Expr is a static predicate,
-- and if so, builds the predicate range list. Nam is the name of the one
-- argument to the predicate function. Occurrences of the type name in the
-- predicate expression have been replaced by identifier references to this
-- name, which is unique, so any identifier with Chars matching Nam must be
-- a reference to the type. If the predicate is non-static, this procedure
-- returns doing nothing. If the predicate is static, then the predicate
-- list is stored in Static_Discrete_Predicate (Typ), and the Expr is
-- rewritten as a canonicalized membership operation.
function Build_Export_Import_Pragma
(Asp : Node_Id;
Id : Entity_Id) return Node_Id;
-- Create the corresponding pragma for aspect Export or Import denoted by
-- Asp. Id is the related entity subject to the aspect. Return Empty when
-- the expression of aspect Asp evaluates to False or is erroneous.
function Build_Predicate_Function_Declaration
(Typ : Entity_Id) return Node_Id;
-- Build the declaration for a predicate function. The declaration is built
-- at the end of the declarative part containing the type definition, which
-- may be before the freeze point of the type. The predicate expression is
-- pre-analyzed at this point, to catch visibility errors.
procedure Build_Predicate_Functions (Typ : Entity_Id; N : Node_Id);
-- If Typ has predicates (indicated by Has_Predicates being set for Typ),
-- then either there are pragma Predicate entries on the rep chain for the
-- type (note that Predicate aspects are converted to pragma Predicate), or
-- there are inherited aspects from a parent type, or ancestor subtypes.
-- This procedure builds body for the Predicate function that tests these
-- predicates. N is the freeze node for the type. The spec of the function
-- is inserted before the freeze node, and the body of the function is
-- inserted after the freeze node. If the predicate expression has a least
-- one Raise_Expression, then this procedure also builds the M version of
-- the predicate function for use in membership tests.
procedure Check_Pool_Size_Clash (Ent : Entity_Id; SP, SS : Node_Id);
-- Called if both Storage_Pool and Storage_Size attribute definition
-- clauses (SP and SS) are present for entity Ent. Issue error message.
procedure Freeze_Entity_Checks (N : Node_Id);
-- Called from Analyze_Freeze_Entity and Analyze_Generic_Freeze Entity
-- to generate appropriate semantic checks that are delayed until this
-- point (they had to be delayed this long for cases of delayed aspects,
-- e.g. analysis of statically predicated subtypes in choices, for which
-- we have to be sure the subtypes in question are frozen before checking).
function Get_Alignment_Value (Expr : Node_Id) return Uint;
-- Given the expression for an alignment value, returns the corresponding
-- Uint value. If the value is inappropriate, then error messages are
-- posted as required, and a value of No_Uint is returned.
procedure Get_Interfacing_Aspects
(Iface_Asp : Node_Id;
Conv_Asp : out Node_Id;
EN_Asp : out Node_Id;
Expo_Asp : out Node_Id;
Imp_Asp : out Node_Id;
LN_Asp : out Node_Id;
Do_Checks : Boolean := False);
-- Given a single interfacing aspect Iface_Asp, retrieve other interfacing
-- aspects that apply to the same related entity. The aspects considered by
-- this routine are as follows:
--
-- Conv_Asp - aspect Convention
-- EN_Asp - aspect External_Name
-- Expo_Asp - aspect Export
-- Imp_Asp - aspect Import
-- LN_Asp - aspect Link_Name
--
-- When flag Do_Checks is set, this routine will flag duplicate uses of
-- aspects.
function Is_Operational_Item (N : Node_Id) return Boolean;
-- A specification for a stream attribute is allowed before the full type
-- is declared, as explained in AI-00137 and the corrigendum. Attributes
-- that do not specify a representation characteristic are operational
-- attributes.
function Is_Predicate_Static
(Expr : Node_Id;
Nam : Name_Id) return Boolean;
-- Given predicate expression Expr, tests if Expr is predicate-static in
-- the sense of the rules in (RM 3.2.4 (15-24)). Occurrences of the type
-- name in the predicate expression have been replaced by references to
-- an identifier whose Chars field is Nam. This name is unique, so any
-- identifier with Chars matching Nam must be a reference to the type.
-- Returns True if the expression is predicate-static and False otherwise,
-- but is not in the business of setting flags or issuing error messages.
--
-- Only scalar types can have static predicates, so False is always
-- returned for non-scalar types.
--
-- Note: the RM seems to suggest that string types can also have static
-- predicates. But that really makes lttle sense as very few useful
-- predicates can be constructed for strings. Remember that:
--
-- "ABC" < "DEF"
--
-- is not a static expression. So even though the clearly faulty RM wording
-- allows the following:
--
-- subtype S is String with Static_Predicate => S < "DEF"
--
-- We can't allow this, otherwise we have predicate-static applying to a
-- larger class than static expressions, which was never intended.
procedure New_Stream_Subprogram
(N : Node_Id;
Ent : Entity_Id;
Subp : Entity_Id;
Nam : TSS_Name_Type);
-- Create a subprogram renaming of a given stream attribute to the
-- designated subprogram and then in the tagged case, provide this as a
-- primitive operation, or in the untagged case make an appropriate TSS
-- entry. This is more properly an expansion activity than just semantics,
-- but the presence of user-defined stream functions for limited types
-- is a legality check, which is why this takes place here rather than in
-- exp_ch13, where it was previously. Nam indicates the name of the TSS
-- function to be generated.
--
-- To avoid elaboration anomalies with freeze nodes, for untagged types
-- we generate both a subprogram declaration and a subprogram renaming
-- declaration, so that the attribute specification is handled as a
-- renaming_as_body. For tagged types, the specification is one of the
-- primitive specs.
procedure Resolve_Iterable_Operation
(N : Node_Id;
Cursor : Entity_Id;
Typ : Entity_Id;
Nam : Name_Id);
-- If the name of a primitive operation for an Iterable aspect is
-- overloaded, resolve according to required signature.
procedure Set_Biased
(E : Entity_Id;
N : Node_Id;
Msg : String;
Biased : Boolean := True);
-- If Biased is True, sets Has_Biased_Representation flag for E, and
-- outputs a warning message at node N if Warn_On_Biased_Representation is
-- is True. This warning inserts the string Msg to describe the construct
-- causing biasing.
---------------------------------------------------
-- Table for Validate_Compile_Time_Warning_Error --
---------------------------------------------------
-- The following table collects pragmas Compile_Time_Error and Compile_
-- Time_Warning for validation. Entries are made by calls to subprogram
-- Validate_Compile_Time_Warning_Error, and the call to the procedure
-- Validate_Compile_Time_Warning_Errors does the actual error checking
-- and posting of warning and error messages. The reason for this delayed
-- processing is to take advantage of back-annotations of attributes size
-- and alignment values performed by the back end.
-- Note: the reason we store a Source_Ptr value instead of a Node_Id is
-- that by the time Validate_Unchecked_Conversions is called, Sprint will
-- already have modified all Sloc values if the -gnatD option is set.
type CTWE_Entry is record
Eloc : Source_Ptr;
-- Source location used in warnings and error messages
Prag : Node_Id;
-- Pragma Compile_Time_Error or Compile_Time_Warning
Scope : Node_Id;
-- The scope which encloses the pragma
end record;
package Compile_Time_Warnings_Errors is new Table.Table (
Table_Component_Type => CTWE_Entry,
Table_Index_Type => Int,
Table_Low_Bound => 1,
Table_Initial => 50,
Table_Increment => 200,
Table_Name => "Compile_Time_Warnings_Errors");
----------------------------------------------
-- Table for Validate_Unchecked_Conversions --
----------------------------------------------
-- The following table collects unchecked conversions for validation.
-- Entries are made by Validate_Unchecked_Conversion and then the call
-- to Validate_Unchecked_Conversions does the actual error checking and
-- posting of warnings. The reason for this delayed processing is to take
-- advantage of back-annotations of size and alignment values performed by
-- the back end.
-- Note: the reason we store a Source_Ptr value instead of a Node_Id is
-- that by the time Validate_Unchecked_Conversions is called, Sprint will
-- already have modified all Sloc values if the -gnatD option is set.
type UC_Entry is record
Eloc : Source_Ptr; -- node used for posting warnings
Source : Entity_Id; -- source type for unchecked conversion
Target : Entity_Id; -- target type for unchecked conversion
Act_Unit : Entity_Id; -- actual function instantiated
end record;
package Unchecked_Conversions is new Table.Table (
Table_Component_Type => UC_Entry,
Table_Index_Type => Int,
Table_Low_Bound => 1,
Table_Initial => 50,
Table_Increment => 200,
Table_Name => "Unchecked_Conversions");
----------------------------------------
-- Table for Validate_Address_Clauses --
----------------------------------------
-- If an address clause has the form
-- for X'Address use Expr
-- where Expr has a value known at compile time or is of the form Y'Address
-- or recursively is a reference to a constant initialized with either of
-- these forms, and the value of Expr is not a multiple of X's alignment,
-- or if Y has a smaller alignment than X, then that merits a warning about
-- possible bad alignment. The following table collects address clauses of
-- this kind. We put these in a table so that they can be checked after the
-- back end has completed annotation of the alignments of objects, since we
-- can catch more cases that way.
type Address_Clause_Check_Record is record
N : Node_Id;
-- The address clause
X : Entity_Id;
-- The entity of the object subject to the address clause
A : Uint;
-- The value of the address in the first case
Y : Entity_Id;
-- The entity of the object being overlaid in the second case
Off : Boolean;
-- Whether the address is offset within Y in the second case
end record;
package Address_Clause_Checks is new Table.Table (
Table_Component_Type => Address_Clause_Check_Record,
Table_Index_Type => Int,
Table_Low_Bound => 1,
Table_Initial => 20,
Table_Increment => 200,
Table_Name => "Address_Clause_Checks");
-----------------------------------------
-- Adjust_Record_For_Reverse_Bit_Order --
-----------------------------------------
procedure Adjust_Record_For_Reverse_Bit_Order (R : Entity_Id) is
Max_Machine_Scalar_Size : constant Uint :=
UI_From_Int
(Standard_Long_Long_Integer_Size);
-- We use this as the maximum machine scalar size
SSU : constant Uint := UI_From_Int (System_Storage_Unit);
CC : Node_Id;
Comp : Node_Id;
Num_CC : Natural;
begin
-- Processing here used to depend on Ada version: the behavior was
-- changed by AI95-0133. However this AI is a Binding interpretation,
-- so we now implement it even in Ada 95 mode. The original behavior
-- from unamended Ada 95 is still available for compatibility under
-- debugging switch -gnatd.
if Ada_Version < Ada_2005 and then Debug_Flag_Dot_P then
Adjust_Record_For_Reverse_Bit_Order_Ada_95 (R);
return;
end if;
-- For Ada 2005, we do machine scalar processing, as fully described In
-- AI-133. This involves gathering all components which start at the
-- same byte offset and processing them together. Same approach is still
-- valid in later versions including Ada 2012.
-- This first loop through components does two things. First it deals
-- with the case of components with component clauses whose length is
-- greater than the maximum machine scalar size (either accepting them
-- or rejecting as needed). Second, it counts the number of components
-- with component clauses whose length does not exceed this maximum for
-- later processing.
Num_CC := 0;
Comp := First_Component_Or_Discriminant (R);
while Present (Comp) loop
CC := Component_Clause (Comp);
if Present (CC) then
declare
Fbit : constant Uint := Static_Integer (First_Bit (CC));
Lbit : constant Uint := Static_Integer (Last_Bit (CC));
begin
-- Case of component with last bit >= max machine scalar
if Lbit >= Max_Machine_Scalar_Size then
-- This is allowed only if first bit is zero, and last bit
-- + 1 is a multiple of storage unit size.
if Fbit = 0 and then (Lbit + 1) mod SSU = 0 then
-- This is the case to give a warning if enabled
if Warn_On_Reverse_Bit_Order then
Error_Msg_N
("info: multi-byte field specified with "
& "non-standard Bit_Order?V?", CC);
if Bytes_Big_Endian then
Error_Msg_N
("\bytes are not reversed "
& "(component is big-endian)?V?", CC);
else
Error_Msg_N
("\bytes are not reversed "
& "(component is little-endian)?V?", CC);
end if;
end if;
-- Give error message for RM 13.5.1(10) violation
else
Error_Msg_FE
("machine scalar rules not followed for&",
First_Bit (CC), Comp);
Error_Msg_Uint_1 := Lbit + 1;
Error_Msg_Uint_2 := Max_Machine_Scalar_Size;
Error_Msg_F
("\last bit + 1 (^) exceeds maximum machine scalar "
& "size (^)", First_Bit (CC));
if (Lbit + 1) mod SSU /= 0 then
Error_Msg_Uint_1 := SSU;
Error_Msg_F
("\and is not a multiple of Storage_Unit (^) "
& "(RM 13.5.1(10))", First_Bit (CC));
else
Error_Msg_Uint_1 := Fbit;
Error_Msg_F
("\and first bit (^) is non-zero "
& "(RM 13.4.1(10))", First_Bit (CC));
end if;
end if;
-- OK case of machine scalar related component clause. For now,
-- just count them.
else
Num_CC := Num_CC + 1;
end if;
end;
end if;
Next_Component_Or_Discriminant (Comp);
end loop;
-- We need to sort the component clauses on the basis of the Position
-- values in the clause, so we can group clauses with the same Position
-- together to determine the relevant machine scalar size.
Sort_CC : declare
Comps : array (0 .. Num_CC) of Entity_Id;
-- Array to collect component and discriminant entities. The data
-- starts at index 1, the 0'th entry is for the sort routine.
function CP_Lt (Op1, Op2 : Natural) return Boolean;
-- Compare routine for Sort
procedure CP_Move (From : Natural; To : Natural);
-- Move routine for Sort
package Sorting is new GNAT.Heap_Sort_G (CP_Move, CP_Lt);
MaxL : Uint;
-- Maximum last bit value of any component in this set
MSS : Uint;
-- Corresponding machine scalar size
Start : Natural;
Stop : Natural;
-- Start and stop positions in the component list of the set of
-- components with the same starting position (that constitute
-- components in a single machine scalar).
-----------
-- CP_Lt --
-----------
function CP_Lt (Op1, Op2 : Natural) return Boolean is
begin
return
Position (Component_Clause (Comps (Op1))) <
Position (Component_Clause (Comps (Op2)));
end CP_Lt;
-------------
-- CP_Move --
-------------
procedure CP_Move (From : Natural; To : Natural) is
begin
Comps (To) := Comps (From);
end CP_Move;
-- Start of processing for Sort_CC
begin
-- Collect the machine scalar relevant component clauses
Num_CC := 0;
Comp := First_Component_Or_Discriminant (R);
while Present (Comp) loop
declare
CC : constant Node_Id := Component_Clause (Comp);
begin
-- Collect only component clauses whose last bit is less than
-- machine scalar size. Any component clause whose last bit
-- exceeds this value does not take part in machine scalar
-- layout considerations. The test for Error_Posted makes sure
-- we exclude component clauses for which we already posted an
-- error.
if Present (CC)
and then not Error_Posted (Last_Bit (CC))
and then Static_Integer (Last_Bit (CC)) <
Max_Machine_Scalar_Size
then
Num_CC := Num_CC + 1;
Comps (Num_CC) := Comp;
end if;
end;
Next_Component_Or_Discriminant (Comp);
end loop;
-- Sort by ascending position number
Sorting.Sort (Num_CC);
-- We now have all the components whose size does not exceed the max
-- machine scalar value, sorted by starting position. In this loop we
-- gather groups of clauses starting at the same position, to process
-- them in accordance with AI-133.
Stop := 0;
while Stop < Num_CC loop
Start := Stop + 1;
Stop := Start;
MaxL :=
Static_Integer
(Last_Bit (Component_Clause (Comps (Start))));
while Stop < Num_CC loop
if Static_Integer
(Position (Component_Clause (Comps (Stop + 1)))) =
Static_Integer
(Position (Component_Clause (Comps (Stop))))
then
Stop := Stop + 1;
MaxL :=
UI_Max
(MaxL,
Static_Integer
(Last_Bit
(Component_Clause (Comps (Stop)))));
else
exit;
end if;
end loop;
-- Now we have a group of component clauses from Start to Stop
-- whose positions are identical, and MaxL is the maximum last
-- bit value of any of these components.
-- We need to determine the corresponding machine scalar size.
-- This loop assumes that machine scalar sizes are even, and that
-- each possible machine scalar has twice as many bits as the next
-- smaller one.
MSS := Max_Machine_Scalar_Size;
while MSS mod 2 = 0
and then (MSS / 2) >= SSU
and then (MSS / 2) > MaxL
loop
MSS := MSS / 2;
end loop;
-- Here is where we fix up the Component_Bit_Offset value to
-- account for the reverse bit order. Some examples of what needs
-- to be done for the case of a machine scalar size of 8 are:
-- First_Bit .. Last_Bit Component_Bit_Offset
-- old new old new
-- 0 .. 0 7 .. 7 0 7
-- 0 .. 1 6 .. 7 0 6
-- 0 .. 2 5 .. 7 0 5
-- 0 .. 7 0 .. 7 0 4
-- 1 .. 1 6 .. 6 1 6
-- 1 .. 4 3 .. 6 1 3
-- 4 .. 7 0 .. 3 4 0
-- The rule is that the first bit is obtained by subtracting the
-- old ending bit from machine scalar size - 1.
for C in Start .. Stop loop
declare
Comp : constant Entity_Id := Comps (C);
CC : constant Node_Id := Component_Clause (Comp);
LB : constant Uint := Static_Integer (Last_Bit (CC));
NFB : constant Uint := MSS - Uint_1 - LB;
NLB : constant Uint := NFB + Esize (Comp) - 1;
Pos : constant Uint := Static_Integer (Position (CC));
begin
if Warn_On_Reverse_Bit_Order then
Error_Msg_Uint_1 := MSS;
Error_Msg_N
("info: reverse bit order in machine scalar of "
& "length^?V?", First_Bit (CC));
Error_Msg_Uint_1 := NFB;
Error_Msg_Uint_2 := NLB;
if Bytes_Big_Endian then
Error_Msg_NE
("\big-endian range for component & is ^ .. ^?V?",
First_Bit (CC), Comp);
else
Error_Msg_NE
("\little-endian range for component & is ^ .. ^?V?",
First_Bit (CC), Comp);
end if;
end if;
Set_Component_Bit_Offset (Comp, Pos * SSU + NFB);
Set_Normalized_First_Bit (Comp, NFB mod SSU);
end;
end loop;
end loop;
end Sort_CC;
end Adjust_Record_For_Reverse_Bit_Order;
------------------------------------------------
-- Adjust_Record_For_Reverse_Bit_Order_Ada_95 --
------------------------------------------------
procedure Adjust_Record_For_Reverse_Bit_Order_Ada_95 (R : Entity_Id) is
CC : Node_Id;
Comp : Node_Id;
begin
-- For Ada 95, we just renumber bits within a storage unit. We do the
-- same for Ada 83 mode, since we recognize the Bit_Order attribute in
-- Ada 83, and are free to add this extension.
Comp := First_Component_Or_Discriminant (R);
while Present (Comp) loop
CC := Component_Clause (Comp);
-- If component clause is present, then deal with the non-default
-- bit order case for Ada 95 mode.
-- We only do this processing for the base type, and in fact that
-- is important, since otherwise if there are record subtypes, we
-- could reverse the bits once for each subtype, which is wrong.
if Present (CC) and then Ekind (R) = E_Record_Type then
declare
CFB : constant Uint := Component_Bit_Offset (Comp);
CSZ : constant Uint := Esize (Comp);
CLC : constant Node_Id := Component_Clause (Comp);
Pos : constant Node_Id := Position (CLC);
FB : constant Node_Id := First_Bit (CLC);
Storage_Unit_Offset : constant Uint :=
CFB / System_Storage_Unit;
Start_Bit : constant Uint :=
CFB mod System_Storage_Unit;
begin
-- Cases where field goes over storage unit boundary
if Start_Bit + CSZ > System_Storage_Unit then
-- Allow multi-byte field but generate warning
if Start_Bit mod System_Storage_Unit = 0
and then CSZ mod System_Storage_Unit = 0
then
Error_Msg_N
("info: multi-byte field specified with non-standard "
& "Bit_Order?V?", CLC);
if Bytes_Big_Endian then
Error_Msg_N
("\bytes are not reversed "
& "(component is big-endian)?V?", CLC);
else
Error_Msg_N
("\bytes are not reversed "
& "(component is little-endian)?V?", CLC);
end if;
-- Do not allow non-contiguous field
else
Error_Msg_N
("attempt to specify non-contiguous field not "
& "permitted", CLC);
Error_Msg_N
("\caused by non-standard Bit_Order specified in "
& "legacy Ada 95 mode", CLC);
end if;
-- Case where field fits in one storage unit
else
-- Give warning if suspicious component clause
if Intval (FB) >= System_Storage_Unit
and then Warn_On_Reverse_Bit_Order
then
Error_Msg_N
("info: Bit_Order clause does not affect byte "
& "ordering?V?", Pos);
Error_Msg_Uint_1 :=
Intval (Pos) + Intval (FB) /
System_Storage_Unit;
Error_Msg_N
("info: position normalized to ^ before bit order "
& "interpreted?V?", Pos);
end if;
-- Here is where we fix up the Component_Bit_Offset value
-- to account for the reverse bit order. Some examples of
-- what needs to be done are:
-- First_Bit .. Last_Bit Component_Bit_Offset
-- old new old new
-- 0 .. 0 7 .. 7 0 7
-- 0 .. 1 6 .. 7 0 6
-- 0 .. 2 5 .. 7 0 5
-- 0 .. 7 0 .. 7 0 4
-- 1 .. 1 6 .. 6 1 6
-- 1 .. 4 3 .. 6 1 3
-- 4 .. 7 0 .. 3 4 0
-- The rule is that the first bit is is obtained by
-- subtracting the old ending bit from storage_unit - 1.
Set_Component_Bit_Offset (Comp,
(Storage_Unit_Offset * System_Storage_Unit) +
(System_Storage_Unit - 1) -
(Start_Bit + CSZ - 1));
Set_Normalized_First_Bit (Comp,
Component_Bit_Offset (Comp) mod System_Storage_Unit);
end if;
end;
end if;
Next_Component_Or_Discriminant (Comp);
end loop;
end Adjust_Record_For_Reverse_Bit_Order_Ada_95;
-------------------------------------
-- Alignment_Check_For_Size_Change --
-------------------------------------
procedure Alignment_Check_For_Size_Change (Typ : Entity_Id; Size : Uint) is
begin
-- If the alignment is known, and not set by a rep clause, and is
-- inconsistent with the size being set, then reset it to unknown,
-- we assume in this case that the size overrides the inherited
-- alignment, and that the alignment must be recomputed.
if Known_Alignment (Typ)
and then not Has_Alignment_Clause (Typ)
and then Size mod (Alignment (Typ) * SSU) /= 0
then
Init_Alignment (Typ);
end if;
end Alignment_Check_For_Size_Change;
-------------------------------------
-- Analyze_Aspects_At_Freeze_Point --
-------------------------------------
procedure Analyze_Aspects_At_Freeze_Point (E : Entity_Id) is
procedure Analyze_Aspect_Default_Value (ASN : Node_Id);
-- This routine analyzes an Aspect_Default_[Component_]Value denoted by
-- the aspect specification node ASN.
procedure Inherit_Delayed_Rep_Aspects (ASN : Node_Id);
-- As discussed in the spec of Aspects (see Aspect_Delay declaration),
-- a derived type can inherit aspects from its parent which have been
-- specified at the time of the derivation using an aspect, as in:
--
-- type A is range 1 .. 10
-- with Size => Not_Defined_Yet;
-- ..
-- type B is new A;
-- ..
-- Not_Defined_Yet : constant := 64;
--
-- In this example, the Size of A is considered to be specified prior
-- to the derivation, and thus inherited, even though the value is not
-- known at the time of derivation. To deal with this, we use two entity
-- flags. The flag Has_Derived_Rep_Aspects is set in the parent type (A
-- here), and then the flag May_Inherit_Delayed_Rep_Aspects is set in
-- the derived type (B here). If this flag is set when the derived type
-- is frozen, then this procedure is called to ensure proper inheritance
-- of all delayed aspects from the parent type. The derived type is E,
-- the argument to Analyze_Aspects_At_Freeze_Point. ASN is the first
-- aspect specification node in the Rep_Item chain for the parent type.
procedure Make_Pragma_From_Boolean_Aspect (ASN : Node_Id);
-- Given an aspect specification node ASN whose expression is an
-- optional Boolean, this routines creates the corresponding pragma
-- at the freezing point.
----------------------------------
-- Analyze_Aspect_Default_Value --
----------------------------------
procedure Analyze_Aspect_Default_Value (ASN : Node_Id) is
A_Id : constant Aspect_Id := Get_Aspect_Id (ASN);
Ent : constant Entity_Id := Entity (ASN);
Expr : constant Node_Id := Expression (ASN);
Id : constant Node_Id := Identifier (ASN);
begin
Error_Msg_Name_1 := Chars (Id);
if not Is_Type (Ent) then
Error_Msg_N ("aspect% can only apply to a type", Id);
return;
elsif not Is_First_Subtype (Ent) then
Error_Msg_N ("aspect% cannot apply to subtype", Id);
return;
elsif A_Id = Aspect_Default_Value
and then not Is_Scalar_Type (Ent)
then
Error_Msg_N ("aspect% can only be applied to scalar type", Id);
return;
elsif A_Id = Aspect_Default_Component_Value then
if not Is_Array_Type (Ent) then
Error_Msg_N ("aspect% can only be applied to array type", Id);
return;
elsif not Is_Scalar_Type (Component_Type (Ent)) then
Error_Msg_N ("aspect% requires scalar components", Id);
return;
end if;
end if;
Set_Has_Default_Aspect (Base_Type (Ent));
if Is_Scalar_Type (Ent) then
Set_Default_Aspect_Value (Base_Type (Ent), Expr);
else
Set_Default_Aspect_Component_Value (Base_Type (Ent), Expr);
end if;
end Analyze_Aspect_Default_Value;
---------------------------------
-- Inherit_Delayed_Rep_Aspects --
---------------------------------
procedure Inherit_Delayed_Rep_Aspects (ASN : Node_Id) is
A_Id : constant Aspect_Id := Get_Aspect_Id (ASN);
P : constant Entity_Id := Entity (ASN);
-- Entithy for parent type
N : Node_Id;
-- Item from Rep_Item chain
A : Aspect_Id;
begin
-- Loop through delayed aspects for the parent type
N := ASN;
while Present (N) loop
if Nkind (N) = N_Aspect_Specification then
exit when Entity (N) /= P;
if Is_Delayed_Aspect (N) then
A := Get_Aspect_Id (Chars (Identifier (N)));
-- Process delayed rep aspect. For Boolean attributes it is
-- not possible to cancel an attribute once set (the attempt
-- to use an aspect with xxx => False is an error) for a
-- derived type. So for those cases, we do not have to check
-- if a clause has been given for the derived type, since it
-- is harmless to set it again if it is already set.
case A is
-- Alignment
when Aspect_Alignment =>
if not Has_Alignment_Clause (E) then
Set_Alignment (E, Alignment (P));
end if;
-- Atomic
when Aspect_Atomic =>
if Is_Atomic (P) then
Set_Is_Atomic (E);
end if;
-- Atomic_Components
when Aspect_Atomic_Components =>
if Has_Atomic_Components (P) then
Set_Has_Atomic_Components (Base_Type (E));
end if;
-- Bit_Order
when Aspect_Bit_Order =>
if Is_Record_Type (E)
and then No (Get_Attribute_Definition_Clause
(E, Attribute_Bit_Order))
and then Reverse_Bit_Order (P)
then
Set_Reverse_Bit_Order (Base_Type (E));
end if;
-- Component_Size
when Aspect_Component_Size =>
if Is_Array_Type (E)
and then not Has_Component_Size_Clause (E)
then
Set_Component_Size
(Base_Type (E), Component_Size (P));
end if;
-- Machine_Radix
when Aspect_Machine_Radix =>
if Is_Decimal_Fixed_Point_Type (E)
and then not Has_Machine_Radix_Clause (E)
then
Set_Machine_Radix_10 (E, Machine_Radix_10 (P));
end if;
-- Object_Size (also Size which also sets Object_Size)
when Aspect_Object_Size
| Aspect_Size
=>
if not Has_Size_Clause (E)
and then
No (Get_Attribute_Definition_Clause
(E, Attribute_Object_Size))
then
Set_Esize (E, Esize (P));
end if;
-- Pack
when Aspect_Pack =>
if not Is_Packed (E) then
Set_Is_Packed (Base_Type (E));
if Is_Bit_Packed_Array (P) then
Set_Is_Bit_Packed_Array (Base_Type (E));
Set_Packed_Array_Impl_Type
(E, Packed_Array_Impl_Type (P));
end if;
end if;
-- Scalar_Storage_Order
when Aspect_Scalar_Storage_Order =>
if (Is_Record_Type (E) or else Is_Array_Type (E))
and then No (Get_Attribute_Definition_Clause
(E, Attribute_Scalar_Storage_Order))
and then Reverse_Storage_Order (P)
then
Set_Reverse_Storage_Order (Base_Type (E));
-- Clear default SSO indications, since the aspect
-- overrides the default.
Set_SSO_Set_Low_By_Default (Base_Type (E), False);
Set_SSO_Set_High_By_Default (Base_Type (E), False);
end if;
-- Small
when Aspect_Small =>
if Is_Fixed_Point_Type (E)
and then not Has_Small_Clause (E)
then
Set_Small_Value (E, Small_Value (P));
end if;
-- Storage_Size
when Aspect_Storage_Size =>
if (Is_Access_Type (E) or else Is_Task_Type (E))
and then not Has_Storage_Size_Clause (E)
then
Set_Storage_Size_Variable
(Base_Type (E), Storage_Size_Variable (P));
end if;
-- Value_Size
when Aspect_Value_Size =>
-- Value_Size is never inherited, it is either set by
-- default, or it is explicitly set for the derived
-- type. So nothing to do here.
null;
-- Volatile
when Aspect_Volatile =>
if Is_Volatile (P) then
Set_Is_Volatile (E);
end if;
-- Volatile_Full_Access
when Aspect_Volatile_Full_Access =>
if Is_Volatile_Full_Access (P) then
Set_Is_Volatile_Full_Access (E);
end if;
-- Volatile_Components
when Aspect_Volatile_Components =>
if Has_Volatile_Components (P) then
Set_Has_Volatile_Components (Base_Type (E));
end if;
-- That should be all the Rep Aspects
when others =>
pragma Assert (Aspect_Delay (A_Id) /= Rep_Aspect);
null;
end case;
end if;
end if;
N := Next_Rep_Item (N);
end loop;
end Inherit_Delayed_Rep_Aspects;
-------------------------------------
-- Make_Pragma_From_Boolean_Aspect --
-------------------------------------
procedure Make_Pragma_From_Boolean_Aspect (ASN : Node_Id) is
Ident : constant Node_Id := Identifier (ASN);
A_Name : constant Name_Id := Chars (Ident);
A_Id : constant Aspect_Id := Get_Aspect_Id (A_Name);
Ent : constant Entity_Id := Entity (ASN);
Expr : constant Node_Id := Expression (ASN);
Loc : constant Source_Ptr := Sloc (ASN);
procedure Check_False_Aspect_For_Derived_Type;
-- This procedure checks for the case of a false aspect for a derived
-- type, which improperly tries to cancel an aspect inherited from
-- the parent.
-----------------------------------------
-- Check_False_Aspect_For_Derived_Type --
-----------------------------------------
procedure Check_False_Aspect_For_Derived_Type is
Par : Node_Id;
begin
-- We are only checking derived types
if not Is_Derived_Type (E) then
return;
end if;
Par := Nearest_Ancestor (E);
case A_Id is
when Aspect_Atomic
| Aspect_Shared
=>
if not Is_Atomic (Par) then
return;
end if;
when Aspect_Atomic_Components =>
if not Has_Atomic_Components (Par) then
return;
end if;
when Aspect_Discard_Names =>
if not Discard_Names (Par) then
return;
end if;
when Aspect_Pack =>
if not Is_Packed (Par) then
return;
end if;
when Aspect_Unchecked_Union =>
if not Is_Unchecked_Union (Par) then
return;
end if;
when Aspect_Volatile =>
if not Is_Volatile (Par) then
return;
end if;
when Aspect_Volatile_Components =>
if not Has_Volatile_Components (Par) then
return;
end if;
when Aspect_Volatile_Full_Access =>
if not Is_Volatile_Full_Access (Par) then
return;
end if;
when others =>
return;
end case;
-- Fall through means we are canceling an inherited aspect
Error_Msg_Name_1 := A_Name;
Error_Msg_NE
("derived type& inherits aspect%, cannot cancel", Expr, E);
end Check_False_Aspect_For_Derived_Type;
-- Local variables
Prag : Node_Id;
-- Start of processing for Make_Pragma_From_Boolean_Aspect
begin
-- Note that we know Expr is present, because for a missing Expr
-- argument, we knew it was True and did not need to delay the
-- evaluation to the freeze point.
if Is_False (Static_Boolean (Expr)) then
Check_False_Aspect_For_Derived_Type;
else
Prag :=
Make_Pragma (Loc,
Pragma_Identifier =>
Make_Identifier (Sloc (Ident), Chars (Ident)),
Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Ident),
Expression => New_Occurrence_Of (Ent, Sloc (Ident)))));
Set_From_Aspect_Specification (Prag, True);
Set_Corresponding_Aspect (Prag, ASN);
Set_Aspect_Rep_Item (ASN, Prag);
Set_Is_Delayed_Aspect (Prag);
Set_Parent (Prag, ASN);
end if;
end Make_Pragma_From_Boolean_Aspect;
-- Local variables
A_Id : Aspect_Id;
ASN : Node_Id;
Ritem : Node_Id;
-- Start of processing for Analyze_Aspects_At_Freeze_Point
begin
-- Must be visible in current scope
if not Scope_Within_Or_Same (Current_Scope, Scope (E)) then
return;
end if;
-- Look for aspect specification entries for this entity
ASN := First_Rep_Item (E);
while Present (ASN) loop
if Nkind (ASN) = N_Aspect_Specification then
exit when Entity (ASN) /= E;
if Is_Delayed_Aspect (ASN) then
A_Id := Get_Aspect_Id (ASN);
case A_Id is
-- For aspects whose expression is an optional Boolean, make
-- the corresponding pragma at the freeze point.
when Boolean_Aspects
| Library_Unit_Aspects
=>
-- Aspects Export and Import require special handling.
-- Both are by definition Boolean and may benefit from
-- forward references, however their expressions are
-- treated as static. In addition, the syntax of their
-- corresponding pragmas requires extra "pieces" which
-- may also contain forward references. To account for
-- all of this, the corresponding pragma is created by
-- Analyze_Aspect_Export_Import, but is not analyzed as
-- the complete analysis must happen now.
if A_Id = Aspect_Export or else A_Id = Aspect_Import then
null;
-- Otherwise create a corresponding pragma
else
Make_Pragma_From_Boolean_Aspect (ASN);
end if;
-- Special handling for aspects that don't correspond to
-- pragmas/attributes.
when Aspect_Default_Value
| Aspect_Default_Component_Value
=>
-- Do not inherit aspect for anonymous base type of a
-- scalar or array type, because they apply to the first
-- subtype of the type, and will be processed when that
-- first subtype is frozen.
if Is_Derived_Type (E)
and then not Comes_From_Source (E)
and then E /= First_Subtype (E)
then
null;
else
Analyze_Aspect_Default_Value (ASN);
end if;
-- Ditto for iterator aspects, because the corresponding
-- attributes may not have been analyzed yet.
when Aspect_Constant_Indexing
| Aspect_Default_Iterator
| Aspect_Iterator_Element
| Aspect_Variable_Indexing
=>
Analyze (Expression (ASN));
if Etype (Expression (ASN)) = Any_Type then
Error_Msg_NE
("\aspect must be fully defined before & is frozen",
ASN, E);
end if;
when Aspect_Iterable =>
Validate_Iterable_Aspect (E, ASN);
when others =>
null;
end case;
Ritem := Aspect_Rep_Item (ASN);
if Present (Ritem) then
Analyze (Ritem);
end if;
end if;
end if;
Next_Rep_Item (ASN);
end loop;
-- This is where we inherit delayed rep aspects from our parent. Note
-- that if we fell out of the above loop with ASN non-empty, it means
-- we hit an aspect for an entity other than E, and it must be the
-- type from which we were derived.
if May_Inherit_Delayed_Rep_Aspects (E) then
Inherit_Delayed_Rep_Aspects (ASN);
end if;
end Analyze_Aspects_At_Freeze_Point;
-----------------------------------
-- Analyze_Aspect_Specifications --
-----------------------------------
procedure Analyze_Aspect_Specifications (N : Node_Id; E : Entity_Id) is
procedure Decorate (Asp : Node_Id; Prag : Node_Id);
-- Establish linkages between an aspect and its corresponding pragma
procedure Insert_Pragma
(Prag : Node_Id;
Is_Instance : Boolean := False);
-- Subsidiary to the analysis of aspects
-- Abstract_State
-- Attach_Handler
-- Contract_Cases
-- Depends
-- Ghost
-- Global
-- Initial_Condition
-- Initializes
-- Post
-- Pre
-- Refined_Depends
-- Refined_Global
-- Refined_State
-- SPARK_Mode
-- Warnings
-- Insert pragma Prag such that it mimics the placement of a source
-- pragma of the same kind. Flag Is_Generic should be set when the
-- context denotes a generic instance.
--------------
-- Decorate --
--------------
procedure Decorate (Asp : Node_Id; Prag : Node_Id) is
begin
Set_Aspect_Rep_Item (Asp, Prag);
Set_Corresponding_Aspect (Prag, Asp);
Set_From_Aspect_Specification (Prag);
Set_Parent (Prag, Asp);
end Decorate;
-------------------
-- Insert_Pragma --
-------------------
procedure Insert_Pragma
(Prag : Node_Id;
Is_Instance : Boolean := False)
is
Aux : Node_Id;
Decl : Node_Id;
Decls : List_Id;
Def : Node_Id;
Inserted : Boolean := False;
begin
-- When the aspect appears on an entry, package, protected unit,
-- subprogram, or task unit body, insert the generated pragma at the
-- top of the body declarations to emulate the behavior of a source
-- pragma.
-- package body Pack with Aspect is
-- package body Pack is
-- pragma Prag;
if Nkind_In (N, N_Entry_Body,
N_Package_Body,
N_Protected_Body,
N_Subprogram_Body,
N_Task_Body)
then
Decls := Declarations (N);
if No (Decls) then
Decls := New_List;
Set_Declarations (N, Decls);
end if;
Prepend_To (Decls, Prag);
-- When the aspect is associated with a [generic] package declaration
-- insert the generated pragma at the top of the visible declarations
-- to emulate the behavior of a source pragma.
-- package Pack with Aspect is
-- package Pack is
-- pragma Prag;
elsif Nkind_In (N, N_Generic_Package_Declaration,
N_Package_Declaration)
then
Decls := Visible_Declarations (Specification (N));
if No (Decls) then
Decls := New_List;
Set_Visible_Declarations (Specification (N), Decls);
end if;
-- The visible declarations of a generic instance have the
-- following structure:
-- <renamings of generic formals>
-- <renamings of internally-generated spec and body>
-- <first source declaration>
-- Insert the pragma before the first source declaration by
-- skipping the instance "header" to ensure proper visibility of
-- all formals.
if Is_Instance then
Decl := First (Decls);
while Present (Decl) loop
if Comes_From_Source (Decl) then
Insert_Before (Decl, Prag);
Inserted := True;
exit;
else
Next (Decl);
end if;
end loop;
-- The pragma is placed after the instance "header"
if not Inserted then
Append_To (Decls, Prag);
end if;
-- Otherwise this is not a generic instance
else
Prepend_To (Decls, Prag);
end if;
-- When the aspect is associated with a protected unit declaration,
-- insert the generated pragma at the top of the visible declarations
-- the emulate the behavior of a source pragma.
-- protected [type] Prot with Aspect is
-- protected [type] Prot is
-- pragma Prag;
elsif Nkind (N) = N_Protected_Type_Declaration then
Def := Protected_Definition (N);
if No (Def) then
Def :=
Make_Protected_Definition (Sloc (N),
Visible_Declarations => New_List,
End_Label => Empty);
Set_Protected_Definition (N, Def);
end if;
Decls := Visible_Declarations (Def);
if No (Decls) then
Decls := New_List;
Set_Visible_Declarations (Def, Decls);
end if;
Prepend_To (Decls, Prag);
-- When the aspect is associated with a task unit declaration, insert
-- insert the generated pragma at the top of the visible declarations
-- the emulate the behavior of a source pragma.
-- task [type] Prot with Aspect is
-- task [type] Prot is
-- pragma Prag;
elsif Nkind (N) = N_Task_Type_Declaration then
Def := Task_Definition (N);
if No (Def) then
Def :=
Make_Task_Definition (Sloc (N),
Visible_Declarations => New_List,
End_Label => Empty);
Set_Task_Definition (N, Def);
end if;
Decls := Visible_Declarations (Def);
if No (Decls) then
Decls := New_List;
Set_Visible_Declarations (Def, Decls);
end if;
Prepend_To (Decls, Prag);
-- When the context is a library unit, the pragma is added to the
-- Pragmas_After list.
elsif Nkind (Parent (N)) = N_Compilation_Unit then
Aux := Aux_Decls_Node (Parent (N));
if No (Pragmas_After (Aux)) then
Set_Pragmas_After (Aux, New_List);
end if;
Prepend (Prag, Pragmas_After (Aux));
-- Default, the pragma is inserted after the context
else
Insert_After (N, Prag);
end if;
end Insert_Pragma;
-- Local variables
Aspect : Node_Id;
Aitem : Node_Id;
Ent : Node_Id;
L : constant List_Id := Aspect_Specifications (N);
Ins_Node : Node_Id := N;
-- Insert pragmas/attribute definition clause after this node when no
-- delayed analysis is required.
-- Start of processing for Analyze_Aspect_Specifications
begin
-- The general processing involves building an attribute definition
-- clause or a pragma node that corresponds to the aspect. Then in order
-- to delay the evaluation of this aspect to the freeze point, we attach
-- the corresponding pragma/attribute definition clause to the aspect
-- specification node, which is then placed in the Rep Item chain. In
-- this case we mark the entity by setting the flag Has_Delayed_Aspects
-- and we evaluate the rep item at the freeze point. When the aspect
-- doesn't have a corresponding pragma/attribute definition clause, then
-- its analysis is simply delayed at the freeze point.
-- Some special cases don't require delay analysis, thus the aspect is
-- analyzed right now.
-- Note that there is a special handling for Pre, Post, Test_Case,
-- Contract_Cases aspects. In these cases, we do not have to worry
-- about delay issues, since the pragmas themselves deal with delay
-- of visibility for the expression analysis. Thus, we just insert
-- the pragma after the node N.
pragma Assert (Present (L));
-- Loop through aspects
Aspect := First (L);
Aspect_Loop : while Present (Aspect) loop
Analyze_One_Aspect : declare
Expr : constant Node_Id := Expression (Aspect);
Id : constant Node_Id := Identifier (Aspect);
Loc : constant Source_Ptr := Sloc (Aspect);
Nam : constant Name_Id := Chars (Id);
A_Id : constant Aspect_Id := Get_Aspect_Id (Nam);
Anod : Node_Id;
Delay_Required : Boolean;
-- Set False if delay is not required
Eloc : Source_Ptr := No_Location;
-- Source location of expression, modified when we split PPC's. It
-- is set below when Expr is present.
procedure Analyze_Aspect_Convention;
-- Perform analysis of aspect Convention
procedure Analyze_Aspect_Export_Import;
-- Perform analysis of aspects Export or Import
procedure Analyze_Aspect_External_Link_Name;
-- Perform analysis of aspects External_Name or Link_Name
procedure Analyze_Aspect_Implicit_Dereference;
-- Perform analysis of the Implicit_Dereference aspects
procedure Make_Aitem_Pragma
(Pragma_Argument_Associations : List_Id;
Pragma_Name : Name_Id);
-- This is a wrapper for Make_Pragma used for converting aspects
-- to pragmas. It takes care of Sloc (set from Loc) and building
-- the pragma identifier from the given name. In addition the
-- flags Class_Present and Split_PPC are set from the aspect
-- node, as well as Is_Ignored. This routine also sets the
-- From_Aspect_Specification in the resulting pragma node to
-- True, and sets Corresponding_Aspect to point to the aspect.
-- The resulting pragma is assigned to Aitem.
-------------------------------
-- Analyze_Aspect_Convention --
-------------------------------
procedure Analyze_Aspect_Convention is
Conv : Node_Id;
Dummy_1 : Node_Id;
Dummy_2 : Node_Id;
Dummy_3 : Node_Id;
Expo : Node_Id;
Imp : Node_Id;
begin
-- Obtain all interfacing aspects that apply to the related
-- entity.
Get_Interfacing_Aspects
(Iface_Asp => Aspect,
Conv_Asp => Dummy_1,
EN_Asp => Dummy_2,
Expo_Asp => Expo,
Imp_Asp => Imp,
LN_Asp => Dummy_3,
Do_Checks => True);
-- The related entity is subject to aspect Export or Import.
-- Do not process Convention now because it must be analysed
-- as part of Export or Import.
if Present (Expo) or else Present (Imp) then
return;
-- Otherwise Convention appears by itself
else
-- The aspect specifies a particular convention
if Present (Expr) then
Conv := New_Copy_Tree (Expr);
-- Otherwise assume convention Ada
else
Conv := Make_Identifier (Loc, Name_Ada);
end if;
-- Generate:
-- pragma Convention (<Conv>, <E>);
Make_Aitem_Pragma
(Pragma_Name => Name_Convention,
Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Conv),
Make_Pragma_Argument_Association (Loc,
Expression => New_Occurrence_Of (E, Loc))));
Decorate (Aspect, Aitem);
Insert_Pragma (Aitem);
end if;
end Analyze_Aspect_Convention;
----------------------------------
-- Analyze_Aspect_Export_Import --
----------------------------------
procedure Analyze_Aspect_Export_Import is
Dummy_1 : Node_Id;
Dummy_2 : Node_Id;
Dummy_3 : Node_Id;
Expo : Node_Id;
Imp : Node_Id;
begin
-- Obtain all interfacing aspects that apply to the related
-- entity.
Get_Interfacing_Aspects
(Iface_Asp => Aspect,
Conv_Asp => Dummy_1,
EN_Asp => Dummy_2,
Expo_Asp => Expo,
Imp_Asp => Imp,
LN_Asp => Dummy_3,
Do_Checks => True);
-- The related entity cannot be subject to both aspects Export
-- and Import.
if Present (Expo) and then Present (Imp) then
Error_Msg_N
("incompatible interfacing aspects given for &", E);
Error_Msg_Sloc := Sloc (Expo);
Error_Msg_N ("\aspect `Export` #", E);
Error_Msg_Sloc := Sloc (Imp);
Error_Msg_N ("\aspect `Import` #", E);
end if;
-- A variable is most likely modified from the outside. Take
-- Take the optimistic approach to avoid spurious errors.
if Ekind (E) = E_Variable then
Set_Never_Set_In_Source (E, False);
end if;
-- Resolve the expression of an Import or Export here, and
-- require it to be of type Boolean and static. This is not
-- quite right, because in general this should be delayed,
-- but that seems tricky for these, because normally Boolean
-- aspects are replaced with pragmas at the freeze point in
-- Make_Pragma_From_Boolean_Aspect.
if not Present (Expr)
or else Is_True (Static_Boolean (Expr))
then
if A_Id = Aspect_Import then
Set_Has_Completion (E);
Set_Is_Imported (E);
-- An imported object cannot be explicitly initialized
if Nkind (N) = N_Object_Declaration
and then Present (Expression (N))
then
Error_Msg_N
("imported entities cannot be initialized "
& "(RM B.1(24))", Expression (N));
end if;
else
pragma Assert (A_Id = Aspect_Export);
Set_Is_Exported (E);
end if;
-- Create the proper form of pragma Export or Import taking
-- into account Conversion, External_Name, and Link_Name.
Aitem := Build_Export_Import_Pragma (Aspect, E);
-- Otherwise the expression is either False or erroneous. There
-- is no corresponding pragma.
else
Aitem := Empty;
end if;
end Analyze_Aspect_Export_Import;
---------------------------------------
-- Analyze_Aspect_External_Link_Name --
---------------------------------------
procedure Analyze_Aspect_External_Link_Name is
Dummy_1 : Node_Id;
Dummy_2 : Node_Id;
Dummy_3 : Node_Id;
Expo : Node_Id;
Imp : Node_Id;
begin
-- Obtain all interfacing aspects that apply to the related
-- entity.
Get_Interfacing_Aspects
(Iface_Asp => Aspect,
Conv_Asp => Dummy_1,
EN_Asp => Dummy_2,
Expo_Asp => Expo,
Imp_Asp => Imp,
LN_Asp => Dummy_3,
Do_Checks => True);
-- Ensure that aspect External_Name applies to aspect Export or
-- Import.
if A_Id = Aspect_External_Name then
if No (Expo) and then No (Imp) then
Error_Msg_N
("aspect `External_Name` requires aspect `Import` or "
& "`Export`", Aspect);
end if;
-- Otherwise ensure that aspect Link_Name applies to aspect
-- Export or Import.
else
pragma Assert (A_Id = Aspect_Link_Name);
if No (Expo) and then No (Imp) then
Error_Msg_N
("aspect `Link_Name` requires aspect `Import` or "
& "`Export`", Aspect);
end if;
end if;
end Analyze_Aspect_External_Link_Name;
-----------------------------------------
-- Analyze_Aspect_Implicit_Dereference --
-----------------------------------------
procedure Analyze_Aspect_Implicit_Dereference is
Disc : Entity_Id;
Parent_Disc : Entity_Id;
begin
if not Is_Type (E) or else not Has_Discriminants (E) then
Error_Msg_N
("aspect must apply to a type with discriminants", Expr);
elsif not Is_Entity_Name (Expr) then
Error_Msg_N
("aspect must name a discriminant of current type", Expr);
else
-- Discriminant type be an anonymous access type or an
-- anonymous access to subprogram.
-- Missing synchronized types???
Disc := First_Discriminant (E);
while Present (Disc) loop
if Chars (Expr) = Chars (Disc)
and then Ekind_In (Etype (Disc),
E_Anonymous_Access_Subprogram_Type,
E_Anonymous_Access_Type)
then
Set_Has_Implicit_Dereference (E);
Set_Has_Implicit_Dereference (Disc);
exit;
end if;
Next_Discriminant (Disc);
end loop;
-- Error if no proper access discriminant
if No (Disc) then
Error_Msg_NE ("not an access discriminant of&", Expr, E);
return;
end if;
end if;
-- For a type extension, check whether parent has a
-- reference discriminant, to verify that use is proper.
if Is_Derived_Type (E)
and then Has_Discriminants (Etype (E))
then
Parent_Disc := Get_Reference_Discriminant (Etype (E));
if Present (Parent_Disc)
and then Corresponding_Discriminant (Disc) /= Parent_Disc
then
Error_Msg_N
("reference discriminant does not match discriminant "
& "of parent type", Expr);
end if;
end if;
end Analyze_Aspect_Implicit_Dereference;
-----------------------
-- Make_Aitem_Pragma --
-----------------------
procedure Make_Aitem_Pragma
(Pragma_Argument_Associations : List_Id;
Pragma_Name : Name_Id)
is
Args : List_Id := Pragma_Argument_Associations;
begin
-- We should never get here if aspect was disabled
pragma Assert (not Is_Disabled (Aspect));
-- Certain aspects allow for an optional name or expression. Do
-- not generate a pragma with empty argument association list.
if No (Args) or else No (Expression (First (Args))) then
Args := No_List;
end if;
-- Build the pragma
Aitem :=
Make_Pragma (Loc,
Pragma_Argument_Associations => Args,
Pragma_Identifier =>
Make_Identifier (Sloc (Id), Pragma_Name),
Class_Present => Class_Present (Aspect),
Split_PPC => Split_PPC (Aspect));
-- Set additional semantic fields
if Is_Ignored (Aspect) then
Set_Is_Ignored (Aitem);
elsif Is_Checked (Aspect) then
Set_Is_Checked (Aitem);
end if;
Set_Corresponding_Aspect (Aitem, Aspect);
Set_From_Aspect_Specification (Aitem);
end Make_Aitem_Pragma;
-- Start of processing for Analyze_One_Aspect
begin
-- Skip aspect if already analyzed, to avoid looping in some cases
if Analyzed (Aspect) then
goto Continue;
end if;
-- Skip looking at aspect if it is totally disabled. Just mark it
-- as such for later reference in the tree. This also sets the
-- Is_Ignored and Is_Checked flags appropriately.
Check_Applicable_Policy (Aspect);
if Is_Disabled (Aspect) then
goto Continue;
end if;
-- Set the source location of expression, used in the case of
-- a failed precondition/postcondition or invariant. Note that
-- the source location of the expression is not usually the best
-- choice here. For example, it gets located on the last AND
-- keyword in a chain of boolean expressiond AND'ed together.
-- It is best to put the message on the first character of the
-- assertion, which is the effect of the First_Node call here.
if Present (Expr) then
Eloc := Sloc (First_Node (Expr));
end if;
-- Check restriction No_Implementation_Aspect_Specifications
if Implementation_Defined_Aspect (A_Id) then
Check_Restriction
(No_Implementation_Aspect_Specifications, Aspect);
end if;
-- Check restriction No_Specification_Of_Aspect
Check_Restriction_No_Specification_Of_Aspect (Aspect);
-- Mark aspect analyzed (actual analysis is delayed till later)
Set_Analyzed (Aspect);
Set_Entity (Aspect, E);
-- Build the reference to E that will be used in the built pragmas
Ent := New_Occurrence_Of (E, Sloc (Id));
if A_Id = Aspect_Attach_Handler
or else A_Id = Aspect_Interrupt_Handler
then
-- Decorate the reference as comming from the sources and force
-- its reanalysis to generate the reference to E; required to
-- avoid reporting spurious warning on E as unreferenced entity
-- (because aspects are not fully analyzed).
Set_Comes_From_Source (Ent, Comes_From_Source (Id));
Set_Entity (Ent, Empty);
Analyze (Ent);
end if;
-- Check for duplicate aspect. Note that the Comes_From_Source
-- test allows duplicate Pre/Post's that we generate internally
-- to escape being flagged here.
if No_Duplicates_Allowed (A_Id) then
Anod := First (L);
while Anod /= Aspect loop
if Comes_From_Source (Aspect)
and then Same_Aspect (A_Id, Get_Aspect_Id (Anod))
then
Error_Msg_Name_1 := Nam;
Error_Msg_Sloc := Sloc (Anod);
-- Case of same aspect specified twice
if Class_Present (Anod) = Class_Present (Aspect) then
if not Class_Present (Anod) then
Error_Msg_NE
("aspect% for & previously given#",
Id, E);
else
Error_Msg_NE
("aspect `%''Class` for & previously given#",
Id, E);
end if;
end if;
end if;
Next (Anod);
end loop;
end if;
-- Check some general restrictions on language defined aspects
if not Implementation_Defined_Aspect (A_Id) then
Error_Msg_Name_1 := Nam;
-- Not allowed for renaming declarations. Examine the original
-- node because a subprogram renaming may have been rewritten
-- as a body.
if Nkind (Original_Node (N)) in N_Renaming_Declaration then
Error_Msg_N
("aspect % not allowed for renaming declaration",
Aspect);
end if;
-- Not allowed for formal type declarations
if Nkind (N) = N_Formal_Type_Declaration then
Error_Msg_N
("aspect % not allowed for formal type declaration",
Aspect);
end if;
end if;
-- Copy expression for later processing by the procedures
-- Check_Aspect_At_[Freeze_Point | End_Of_Declarations]
Set_Entity (Id, New_Copy_Tree (Expr));
-- Set Delay_Required as appropriate to aspect
case Aspect_Delay (A_Id) is
when Always_Delay =>
Delay_Required := True;
when Never_Delay =>
Delay_Required := False;
when Rep_Aspect =>
-- If expression has the form of an integer literal, then
-- do not delay, since we know the value cannot change.
-- This optimization catches most rep clause cases.
-- For Boolean aspects, don't delay if no expression
if A_Id in Boolean_Aspects and then No (Expr) then
Delay_Required := False;
-- For non-Boolean aspects, don't delay if integer literal,
-- unless the aspect is Alignment, which affects the
-- freezing of an initialized object.
elsif A_Id not in Boolean_Aspects
and then A_Id /= Aspect_Alignment
and then Present (Expr)
and then Nkind (Expr) = N_Integer_Literal
then
Delay_Required := False;
-- All other cases are delayed
else
Delay_Required := True;
Set_Has_Delayed_Rep_Aspects (E);
end if;
end case;
-- Processing based on specific aspect
case A_Id is
when Aspect_Unimplemented =>
null; -- ??? temp for now
-- No_Aspect should be impossible
when No_Aspect =>
raise Program_Error;
-- Case 1: Aspects corresponding to attribute definition
-- clauses.
when Aspect_Address
| Aspect_Alignment
| Aspect_Bit_Order
| Aspect_Component_Size
| Aspect_Constant_Indexing
| Aspect_Default_Iterator
| Aspect_Dispatching_Domain
| Aspect_External_Tag
| Aspect_Input
| Aspect_Iterable
| Aspect_Iterator_Element
| Aspect_Machine_Radix
| Aspect_Object_Size
| Aspect_Output
| Aspect_Read
| Aspect_Scalar_Storage_Order
| Aspect_Secondary_Stack_Size
| Aspect_Simple_Storage_Pool
| Aspect_Size
| Aspect_Small
| Aspect_Storage_Pool
| Aspect_Stream_Size
| Aspect_Value_Size
| Aspect_Variable_Indexing
| Aspect_Write
=>
-- Indexing aspects apply only to tagged type
if (A_Id = Aspect_Constant_Indexing
or else
A_Id = Aspect_Variable_Indexing)
and then not (Is_Type (E)
and then Is_Tagged_Type (E))
then
Error_Msg_N
("indexing aspect can only apply to a tagged type",
Aspect);
goto Continue;
end if;
-- For the case of aspect Address, we don't consider that we
-- know the entity is never set in the source, since it is
-- is likely aliasing is occurring.
-- Note: one might think that the analysis of the resulting
-- attribute definition clause would take care of that, but
-- that's not the case since it won't be from source.
if A_Id = Aspect_Address then
Set_Never_Set_In_Source (E, False);
end if;
-- Correctness of the profile of a stream operation is
-- verified at the freeze point, but we must detect the
-- illegal specification of this aspect for a subtype now,
-- to prevent malformed rep_item chains.
if A_Id = Aspect_Input or else
A_Id = Aspect_Output or else
A_Id = Aspect_Read or else
A_Id = Aspect_Write
then
if not Is_First_Subtype (E) then
Error_Msg_N
("local name must be a first subtype", Aspect);
goto Continue;
-- If stream aspect applies to the class-wide type,
-- the generated attribute definition applies to the
-- class-wide type as well.
elsif Class_Present (Aspect) then
Ent :=
Make_Attribute_Reference (Loc,
Prefix => Ent,
Attribute_Name => Name_Class);
end if;
end if;
-- Construct the attribute definition clause
Aitem :=
Make_Attribute_Definition_Clause (Loc,
Name => Ent,
Chars => Chars (Id),
Expression => Relocate_Node (Expr));
-- If the address is specified, then we treat the entity as
-- referenced, to avoid spurious warnings. This is analogous
-- to what is done with an attribute definition clause, but
-- here we don't want to generate a reference because this
-- is the point of definition of the entity.
if A_Id = Aspect_Address then
Set_Referenced (E);
end if;
-- Case 2: Aspects corresponding to pragmas
-- Case 2a: Aspects corresponding to pragmas with two
-- arguments, where the first argument is a local name
-- referring to the entity, and the second argument is the
-- aspect definition expression.
-- Linker_Section/Suppress/Unsuppress
when Aspect_Linker_Section
| Aspect_Suppress
| Aspect_Unsuppress
=>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => New_Occurrence_Of (E, Loc)),
Make_Pragma_Argument_Association (Sloc (Expr),
Expression => Relocate_Node (Expr))),
Pragma_Name => Chars (Id));
-- Synchronization
-- Corresponds to pragma Implemented, construct the pragma
when Aspect_Synchronization =>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => New_Occurrence_Of (E, Loc)),
Make_Pragma_Argument_Association (Sloc (Expr),
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Implemented);
-- Attach_Handler
when Aspect_Attach_Handler =>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Ent),
Expression => Ent),
Make_Pragma_Argument_Association (Sloc (Expr),
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Attach_Handler);
-- We need to insert this pragma into the tree to get proper
-- processing and to look valid from a placement viewpoint.
Insert_Pragma (Aitem);
goto Continue;
-- Dynamic_Predicate, Predicate, Static_Predicate
when Aspect_Dynamic_Predicate
| Aspect_Predicate
| Aspect_Static_Predicate
=>
-- These aspects apply only to subtypes
if not Is_Type (E) then
Error_Msg_N
("predicate can only be specified for a subtype",
Aspect);
goto Continue;
elsif Is_Incomplete_Type (E) then
Error_Msg_N
("predicate cannot apply to incomplete view", Aspect);
goto Continue;
end if;
-- Construct the pragma (always a pragma Predicate, with
-- flags recording whether it is static/dynamic). We also
-- set flags recording this in the type itself.
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Ent),
Expression => Ent),
Make_Pragma_Argument_Association (Sloc (Expr),
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Predicate);
-- Mark type has predicates, and remember what kind of
-- aspect lead to this predicate (we need this to access
-- the right set of check policies later on).
Set_Has_Predicates (E);
if A_Id = Aspect_Dynamic_Predicate then
Set_Has_Dynamic_Predicate_Aspect (E);
-- If the entity has a dynamic predicate, any inherited
-- static predicate becomes dynamic as well, and the
-- predicate function includes the conjunction of both.
Set_Has_Static_Predicate_Aspect (E, False);
elsif A_Id = Aspect_Static_Predicate then
Set_Has_Static_Predicate_Aspect (E);
end if;
-- If the type is private, indicate that its completion
-- has a freeze node, because that is the one that will
-- be visible at freeze time.
if Is_Private_Type (E) and then Present (Full_View (E)) then
Set_Has_Predicates (Full_View (E));
if A_Id = Aspect_Dynamic_Predicate then
Set_Has_Dynamic_Predicate_Aspect (Full_View (E));
elsif A_Id = Aspect_Static_Predicate then
Set_Has_Static_Predicate_Aspect (Full_View (E));
end if;
Set_Has_Delayed_Aspects (Full_View (E));
Ensure_Freeze_Node (Full_View (E));
end if;
-- Predicate_Failure
when Aspect_Predicate_Failure =>
-- This aspect applies only to subtypes
if not Is_Type (E) then
Error_Msg_N
("predicate can only be specified for a subtype",
Aspect);
goto Continue;
elsif Is_Incomplete_Type (E) then
Error_Msg_N
("predicate cannot apply to incomplete view", Aspect);
goto Continue;
end if;
-- Construct the pragma
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Ent),
Expression => Ent),
Make_Pragma_Argument_Association (Sloc (Expr),
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Predicate_Failure);
Set_Has_Predicates (E);
-- If the type is private, indicate that its completion
-- has a freeze node, because that is the one that will
-- be visible at freeze time.
if Is_Private_Type (E) and then Present (Full_View (E)) then
Set_Has_Predicates (Full_View (E));
Set_Has_Delayed_Aspects (Full_View (E));
Ensure_Freeze_Node (Full_View (E));
end if;
-- Case 2b: Aspects corresponding to pragmas with two
-- arguments, where the second argument is a local name
-- referring to the entity, and the first argument is the
-- aspect definition expression.
-- Convention
when Aspect_Convention =>
Analyze_Aspect_Convention;
goto Continue;
-- External_Name, Link_Name
when Aspect_External_Name
| Aspect_Link_Name
=>
Analyze_Aspect_External_Link_Name;
goto Continue;
-- CPU, Interrupt_Priority, Priority
-- These three aspects can be specified for a subprogram spec
-- or body, in which case we analyze the expression and export
-- the value of the aspect.
-- Previously, we generated an equivalent pragma for bodies
-- (note that the specs cannot contain these pragmas). The
-- pragma was inserted ahead of local declarations, rather than
-- after the body. This leads to a certain duplication between
-- the processing performed for the aspect and the pragma, but
-- given the straightforward handling required it is simpler
-- to duplicate than to translate the aspect in the spec into
-- a pragma in the declarative part of the body.
when Aspect_CPU
| Aspect_Interrupt_Priority
| Aspect_Priority
=>
if Nkind_In (N, N_Subprogram_Body,
N_Subprogram_Declaration)
then
-- Analyze the aspect expression
Analyze_And_Resolve (Expr, Standard_Integer);
-- Interrupt_Priority aspect not allowed for main
-- subprograms. RM D.1 does not forbid this explicitly,
-- but RM J.15.11(6/3) does not permit pragma
-- Interrupt_Priority for subprograms.
if A_Id = Aspect_Interrupt_Priority then
Error_Msg_N
("Interrupt_Priority aspect cannot apply to "
& "subprogram", Expr);
-- The expression must be static
elsif not Is_OK_Static_Expression (Expr) then
Flag_Non_Static_Expr
("aspect requires static expression!", Expr);
-- Check whether this is the main subprogram. Issue a
-- warning only if it is obviously not a main program
-- (when it has parameters or when the subprogram is
-- within a package).
elsif Present (Parameter_Specifications
(Specification (N)))
or else not Is_Compilation_Unit (Defining_Entity (N))
then
-- See RM D.1(14/3) and D.16(12/3)
Error_Msg_N
("aspect applied to subprogram other than the "
& "main subprogram has no effect??", Expr);
-- Otherwise check in range and export the value
-- For the CPU aspect
elsif A_Id = Aspect_CPU then
if Is_In_Range (Expr, RTE (RE_CPU_Range)) then
-- Value is correct so we export the value to make
-- it available at execution time.
Set_Main_CPU
(Main_Unit, UI_To_Int (Expr_Value (Expr)));
else
Error_Msg_N
("main subprogram CPU is out of range", Expr);
end if;
-- For the Priority aspect
elsif A_Id = Aspect_Priority then
if Is_In_Range (Expr, RTE (RE_Priority)) then
-- Value is correct so we export the value to make
-- it available at execution time.
Set_Main_Priority
(Main_Unit, UI_To_Int (Expr_Value (Expr)));
-- Ignore pragma if Relaxed_RM_Semantics to support
-- other targets/non GNAT compilers.
elsif not Relaxed_RM_Semantics then
Error_Msg_N
("main subprogram priority is out of range",
Expr);
end if;
end if;
-- Load an arbitrary entity from System.Tasking.Stages
-- or System.Tasking.Restricted.Stages (depending on
-- the supported profile) to make sure that one of these
-- packages is implicitly with'ed, since we need to have
-- the tasking run time active for the pragma Priority to
-- have any effect. Previously we with'ed the package
-- System.Tasking, but this package does not trigger the
-- required initialization of the run-time library.
declare
Discard : Entity_Id;
begin
if Restricted_Profile then
Discard := RTE (RE_Activate_Restricted_Tasks);
else
Discard := RTE (RE_Activate_Tasks);
end if;
end;
-- Handling for these aspects in subprograms is complete
goto Continue;
-- For tasks pass the aspect as an attribute
else
Aitem :=
Make_Attribute_Definition_Clause (Loc,
Name => Ent,
Chars => Chars (Id),
Expression => Relocate_Node (Expr));
end if;
-- Warnings
when Aspect_Warnings =>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Expr),
Expression => Relocate_Node (Expr)),
Make_Pragma_Argument_Association (Loc,
Expression => New_Occurrence_Of (E, Loc))),
Pragma_Name => Chars (Id));
Decorate (Aspect, Aitem);
Insert_Pragma (Aitem);
goto Continue;
-- Case 2c: Aspects corresponding to pragmas with three
-- arguments.
-- Invariant aspects have a first argument that references the
-- entity, a second argument that is the expression and a third
-- argument that is an appropriate message.
-- Invariant, Type_Invariant
when Aspect_Invariant
| Aspect_Type_Invariant
=>
-- Analysis of the pragma will verify placement legality:
-- an invariant must apply to a private type, or appear in
-- the private part of a spec and apply to a completion.
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Ent),
Expression => Ent),
Make_Pragma_Argument_Association (Sloc (Expr),
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Invariant);
-- Add message unless exception messages are suppressed
if not Opt.Exception_Locations_Suppressed then
Append_To (Pragma_Argument_Associations (Aitem),
Make_Pragma_Argument_Association (Eloc,
Chars => Name_Message,
Expression =>
Make_String_Literal (Eloc,
Strval => "failed invariant from "
& Build_Location_String (Eloc))));
end if;
-- For Invariant case, insert immediately after the entity
-- declaration. We do not have to worry about delay issues
-- since the pragma processing takes care of this.
Delay_Required := False;
-- Case 2d : Aspects that correspond to a pragma with one
-- argument.
-- Abstract_State
-- Aspect Abstract_State introduces implicit declarations for
-- all state abstraction entities it defines. To emulate this
-- behavior, insert the pragma at the beginning of the visible
-- declarations of the related package so that it is analyzed
-- immediately.
when Aspect_Abstract_State => Abstract_State : declare
Context : Node_Id := N;
begin
-- When aspect Abstract_State appears on a generic package,
-- it is propageted to the package instance. The context in
-- this case is the instance spec.
if Nkind (Context) = N_Package_Instantiation then
Context := Instance_Spec (Context);
end if;
if Nkind_In (Context, N_Generic_Package_Declaration,
N_Package_Declaration)
then
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Abstract_State);
Decorate (Aspect, Aitem);
Insert_Pragma
(Prag => Aitem,
Is_Instance =>
Is_Generic_Instance (Defining_Entity (Context)));
else
Error_Msg_NE
("aspect & must apply to a package declaration",
Aspect, Id);
end if;
goto Continue;
end Abstract_State;
-- Aspect Async_Readers is never delayed because it is
-- equivalent to a source pragma which appears after the
-- related object declaration.
when Aspect_Async_Readers =>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Async_Readers);
Decorate (Aspect, Aitem);
Insert_Pragma (Aitem);
goto Continue;
-- Aspect Async_Writers is never delayed because it is
-- equivalent to a source pragma which appears after the
-- related object declaration.
when Aspect_Async_Writers =>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Async_Writers);
Decorate (Aspect, Aitem);
Insert_Pragma (Aitem);
goto Continue;
-- Aspect Constant_After_Elaboration is never delayed because
-- it is equivalent to a source pragma which appears after the
-- related object declaration.
when Aspect_Constant_After_Elaboration =>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name =>
Name_Constant_After_Elaboration);
Decorate (Aspect, Aitem);
Insert_Pragma (Aitem);
goto Continue;
-- Aspect Default_Internal_Condition is never delayed because
-- it is equivalent to a source pragma which appears after the
-- related private type. To deal with forward references, the
-- generated pragma is stored in the rep chain of the related
-- private type as types do not carry contracts. The pragma is
-- wrapped inside of a procedure at the freeze point of the
-- private type's full view.
when Aspect_Default_Initial_Condition =>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name =>
Name_Default_Initial_Condition);
Decorate (Aspect, Aitem);
Insert_Pragma (Aitem);
goto Continue;
-- Default_Storage_Pool
when Aspect_Default_Storage_Pool =>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name =>
Name_Default_Storage_Pool);
Decorate (Aspect, Aitem);
Insert_Pragma (Aitem);
goto Continue;
-- Depends
-- Aspect Depends is never delayed because it is equivalent to
-- a source pragma which appears after the related subprogram.
-- To deal with forward references, the generated pragma is
-- stored in the contract of the related subprogram and later
-- analyzed at the end of the declarative region. See routine
-- Analyze_Depends_In_Decl_Part for details.
when Aspect_Depends =>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Depends);
Decorate (Aspect, Aitem);
Insert_Pragma (Aitem);
goto Continue;
-- Aspect Effecitve_Reads is never delayed because it is
-- equivalent to a source pragma which appears after the
-- related object declaration.
when Aspect_Effective_Reads =>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Effective_Reads);
Decorate (Aspect, Aitem);
Insert_Pragma (Aitem);
goto Continue;
-- Aspect Effective_Writes is never delayed because it is
-- equivalent to a source pragma which appears after the
-- related object declaration.
when Aspect_Effective_Writes =>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Effective_Writes);
Decorate (Aspect, Aitem);
Insert_Pragma (Aitem);
goto Continue;
-- Aspect Extensions_Visible is never delayed because it is
-- equivalent to a source pragma which appears after the
-- related subprogram.
when Aspect_Extensions_Visible =>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Extensions_Visible);
Decorate (Aspect, Aitem);
Insert_Pragma (Aitem);
goto Continue;
-- Aspect Ghost is never delayed because it is equivalent to a
-- source pragma which appears at the top of [generic] package
-- declarations or after an object, a [generic] subprogram, or
-- a type declaration.
when Aspect_Ghost =>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Ghost);
Decorate (Aspect, Aitem);
Insert_Pragma (Aitem);
goto Continue;
-- Global
-- Aspect Global is never delayed because it is equivalent to
-- a source pragma which appears after the related subprogram.
-- To deal with forward references, the generated pragma is
-- stored in the contract of the related subprogram and later
-- analyzed at the end of the declarative region. See routine
-- Analyze_Global_In_Decl_Part for details.
when Aspect_Global =>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Global);
Decorate (Aspect, Aitem);
Insert_Pragma (Aitem);
goto Continue;
-- Initial_Condition
-- Aspect Initial_Condition is never delayed because it is
-- equivalent to a source pragma which appears after the
-- related package. To deal with forward references, the
-- generated pragma is stored in the contract of the related
-- package and later analyzed at the end of the declarative
-- region. See routine Analyze_Initial_Condition_In_Decl_Part
-- for details.
when Aspect_Initial_Condition => Initial_Condition : declare
Context : Node_Id := N;
begin
-- When aspect Initial_Condition appears on a generic
-- package, it is propageted to the package instance. The
-- context in this case is the instance spec.
if Nkind (Context) = N_Package_Instantiation then
Context := Instance_Spec (Context);
end if;
if Nkind_In (Context, N_Generic_Package_Declaration,
N_Package_Declaration)
then
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name =>
Name_Initial_Condition);
Decorate (Aspect, Aitem);
Insert_Pragma
(Prag => Aitem,
Is_Instance =>
Is_Generic_Instance (Defining_Entity (Context)));
-- Otherwise the context is illegal
else
Error_Msg_NE
("aspect & must apply to a package declaration",
Aspect, Id);
end if;
goto Continue;
end Initial_Condition;
-- Initializes
-- Aspect Initializes is never delayed because it is equivalent
-- to a source pragma appearing after the related package. To
-- deal with forward references, the generated pragma is stored
-- in the contract of the related package and later analyzed at
-- the end of the declarative region. For details, see routine
-- Analyze_Initializes_In_Decl_Part.
when Aspect_Initializes => Initializes : declare
Context : Node_Id := N;
begin
-- When aspect Initializes appears on a generic package,
-- it is propageted to the package instance. The context
-- in this case is the instance spec.
if Nkind (Context) = N_Package_Instantiation then
Context := Instance_Spec (Context);
end if;
if Nkind_In (Context, N_Generic_Package_Declaration,
N_Package_Declaration)
then
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Initializes);
Decorate (Aspect, Aitem);
Insert_Pragma
(Prag => Aitem,
Is_Instance =>
Is_Generic_Instance (Defining_Entity (Context)));
-- Otherwise the context is illegal
else
Error_Msg_NE
("aspect & must apply to a package declaration",
Aspect, Id);
end if;
goto Continue;
end Initializes;
-- Max_Queue_Length
when Aspect_Max_Queue_Length =>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Max_Queue_Length);
Decorate (Aspect, Aitem);
Insert_Pragma (Aitem);
goto Continue;
-- Obsolescent
when Aspect_Obsolescent => declare
Args : List_Id;
begin
if No (Expr) then
Args := No_List;
else
Args := New_List (
Make_Pragma_Argument_Association (Sloc (Expr),
Expression => Relocate_Node (Expr)));
end if;
Make_Aitem_Pragma
(Pragma_Argument_Associations => Args,
Pragma_Name => Chars (Id));
end;
-- Part_Of
when Aspect_Part_Of =>
if Nkind_In (N, N_Object_Declaration,
N_Package_Instantiation)
or else Is_Single_Concurrent_Type_Declaration (N)
then
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Part_Of);
Decorate (Aspect, Aitem);
Insert_Pragma (Aitem);
else
Error_Msg_NE
("aspect & must apply to package instantiation, "
& "object, single protected type or single task type",
Aspect, Id);
end if;
goto Continue;
-- SPARK_Mode
when Aspect_SPARK_Mode =>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_SPARK_Mode);
Decorate (Aspect, Aitem);
Insert_Pragma (Aitem);
goto Continue;
-- Refined_Depends
-- Aspect Refined_Depends is never delayed because it is
-- equivalent to a source pragma which appears in the
-- declarations of the related subprogram body. To deal with
-- forward references, the generated pragma is stored in the
-- contract of the related subprogram body and later analyzed
-- at the end of the declarative region. For details, see
-- routine Analyze_Refined_Depends_In_Decl_Part.
when Aspect_Refined_Depends =>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Refined_Depends);
Decorate (Aspect, Aitem);
Insert_Pragma (Aitem);
goto Continue;
-- Refined_Global
-- Aspect Refined_Global is never delayed because it is
-- equivalent to a source pragma which appears in the
-- declarations of the related subprogram body. To deal with
-- forward references, the generated pragma is stored in the
-- contract of the related subprogram body and later analyzed
-- at the end of the declarative region. For details, see
-- routine Analyze_Refined_Global_In_Decl_Part.
when Aspect_Refined_Global =>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Refined_Global);
Decorate (Aspect, Aitem);
Insert_Pragma (Aitem);
goto Continue;
-- Refined_Post
when Aspect_Refined_Post =>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Refined_Post);
Decorate (Aspect, Aitem);
Insert_Pragma (Aitem);
goto Continue;
-- Refined_State
when Aspect_Refined_State =>
-- The corresponding pragma for Refined_State is inserted in
-- the declarations of the related package body. This action
-- synchronizes both the source and from-aspect versions of
-- the pragma.
if Nkind (N) = N_Package_Body then
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Refined_State);
Decorate (Aspect, Aitem);
Insert_Pragma (Aitem);
-- Otherwise the context is illegal
else
Error_Msg_NE
("aspect & must apply to a package body", Aspect, Id);
end if;
goto Continue;
-- Relative_Deadline
when Aspect_Relative_Deadline =>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Relative_Deadline);
-- If the aspect applies to a task, the corresponding pragma
-- must appear within its declarations, not after.
if Nkind (N) = N_Task_Type_Declaration then
declare
Def : Node_Id;
V : List_Id;
begin
if No (Task_Definition (N)) then
Set_Task_Definition (N,
Make_Task_Definition (Loc,
Visible_Declarations => New_List,
End_Label => Empty));
end if;
Def := Task_Definition (N);
V := Visible_Declarations (Def);
if not Is_Empty_List (V) then
Insert_Before (First (V), Aitem);
else
Set_Visible_Declarations (Def, New_List (Aitem));
end if;
goto Continue;
end;
end if;
-- Aspect Volatile_Function is never delayed because it is
-- equivalent to a source pragma which appears after the
-- related subprogram.
when Aspect_Volatile_Function =>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Volatile_Function);
Decorate (Aspect, Aitem);
Insert_Pragma (Aitem);
goto Continue;
-- Case 2e: Annotate aspect
when Aspect_Annotate =>
declare
Args : List_Id;
Pargs : List_Id;
Arg : Node_Id;
begin
-- The argument can be a single identifier
if Nkind (Expr) = N_Identifier then
-- One level of parens is allowed
if Paren_Count (Expr) > 1 then
Error_Msg_F ("extra parentheses ignored", Expr);
end if;
Set_Paren_Count (Expr, 0);
-- Add the single item to the list
Args := New_List (Expr);
-- Otherwise we must have an aggregate
elsif Nkind (Expr) = N_Aggregate then
-- Must be positional
if Present (Component_Associations (Expr)) then
Error_Msg_F
("purely positional aggregate required", Expr);
goto Continue;
end if;
-- Must not be parenthesized
if Paren_Count (Expr) /= 0 then
Error_Msg_F ("extra parentheses ignored", Expr);
end if;
-- List of arguments is list of aggregate expressions
Args := Expressions (Expr);
-- Anything else is illegal
else
Error_Msg_F ("wrong form for Annotate aspect", Expr);
goto Continue;
end if;
-- Prepare pragma arguments
Pargs := New_List;
Arg := First (Args);
while Present (Arg) loop
Append_To (Pargs,
Make_Pragma_Argument_Association (Sloc (Arg),
Expression => Relocate_Node (Arg)));
Next (Arg);
end loop;
Append_To (Pargs,
Make_Pragma_Argument_Association (Sloc (Ent),
Chars => Name_Entity,
Expression => Ent));
Make_Aitem_Pragma
(Pragma_Argument_Associations => Pargs,
Pragma_Name => Name_Annotate);
end;
-- Case 3 : Aspects that don't correspond to pragma/attribute
-- definition clause.
-- Case 3a: The aspects listed below don't correspond to
-- pragmas/attributes but do require delayed analysis.
-- Default_Value can only apply to a scalar type
when Aspect_Default_Value =>
if not Is_Scalar_Type (E) then
Error_Msg_N
("aspect Default_Value must apply to a scalar type", N);
end if;
Aitem := Empty;
-- Default_Component_Value can only apply to an array type
-- with scalar components.
when Aspect_Default_Component_Value =>
if not (Is_Array_Type (E)
and then Is_Scalar_Type (Component_Type (E)))
then
Error_Msg_N
("aspect Default_Component_Value can only apply to an "
& "array of scalar components", N);
end if;
Aitem := Empty;
-- Case 3b: The aspects listed below don't correspond to
-- pragmas/attributes and don't need delayed analysis.
-- Implicit_Dereference
-- For Implicit_Dereference, External_Name and Link_Name, only
-- the legality checks are done during the analysis, thus no
-- delay is required.
when Aspect_Implicit_Dereference =>
Analyze_Aspect_Implicit_Dereference;
goto Continue;
-- Dimension
when Aspect_Dimension =>
Analyze_Aspect_Dimension (N, Id, Expr);
goto Continue;
-- Dimension_System
when Aspect_Dimension_System =>
Analyze_Aspect_Dimension_System (N, Id, Expr);
goto Continue;
-- Case 4: Aspects requiring special handling
-- Pre/Post/Test_Case/Contract_Cases whose corresponding
-- pragmas take care of the delay.
-- Pre/Post
-- Aspects Pre/Post generate Precondition/Postcondition pragmas
-- with a first argument that is the expression, and a second
-- argument that is an informative message if the test fails.
-- This is inserted right after the declaration, to get the
-- required pragma placement. The processing for the pragmas
-- takes care of the required delay.
when Pre_Post_Aspects => Pre_Post : declare
Pname : Name_Id;
begin
if A_Id = Aspect_Pre or else A_Id = Aspect_Precondition then
Pname := Name_Precondition;
else
Pname := Name_Postcondition;
end if;
-- Check that the class-wide predicate cannot be applied to
-- an operation of a synchronized type that is not a tagged
-- type. Other legality checks are performed when analyzing
-- the contract of the operation.
if Class_Present (Aspect)
and then Is_Concurrent_Type (Current_Scope)
and then not Is_Tagged_Type (Current_Scope)
and then Ekind_In (E, E_Entry, E_Function, E_Procedure)
then
Error_Msg_Name_1 := Original_Aspect_Pragma_Name (Aspect);
Error_Msg_N
("aspect % can only be specified for a primitive "
& "operation of a tagged type", Aspect);
goto Continue;
end if;
-- If the expressions is of the form A and then B, then
-- we generate separate Pre/Post aspects for the separate
-- clauses. Since we allow multiple pragmas, there is no
-- problem in allowing multiple Pre/Post aspects internally.
-- These should be treated in reverse order (B first and
-- A second) since they are later inserted just after N in
-- the order they are treated. This way, the pragma for A
-- ends up preceding the pragma for B, which may have an
-- importance for the error raised (either constraint error
-- or precondition error).
-- We do not do this for Pre'Class, since we have to put
-- these conditions together in a complex OR expression.
-- We do not do this in ASIS mode, as ASIS relies on the
-- original node representing the complete expression, when
-- retrieving it through the source aspect table.
if not ASIS_Mode
and then (Pname = Name_Postcondition
or else not Class_Present (Aspect))
then
while Nkind (Expr) = N_And_Then loop
Insert_After (Aspect,
Make_Aspect_Specification (Sloc (Left_Opnd (Expr)),
Identifier => Identifier (Aspect),
Expression => Relocate_Node (Left_Opnd (Expr)),
Class_Present => Class_Present (Aspect),
Split_PPC => True));
Rewrite (Expr, Relocate_Node (Right_Opnd (Expr)));
Eloc := Sloc (Expr);
end loop;
end if;
-- Build the precondition/postcondition pragma
-- Add note about why we do NOT need Copy_Tree here???
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Eloc,
Chars => Name_Check,
Expression => Relocate_Node (Expr))),
Pragma_Name => Pname);
-- Add message unless exception messages are suppressed
if not Opt.Exception_Locations_Suppressed then
Append_To (Pragma_Argument_Associations (Aitem),
Make_Pragma_Argument_Association (Eloc,
Chars => Name_Message,
Expression =>
Make_String_Literal (Eloc,
Strval => "failed "
& Get_Name_String (Pname)
& " from "
& Build_Location_String (Eloc))));
end if;
Set_Is_Delayed_Aspect (Aspect);
-- For Pre/Post cases, insert immediately after the entity
-- declaration, since that is the required pragma placement.
-- Note that for these aspects, we do not have to worry
-- about delay issues, since the pragmas themselves deal
-- with delay of visibility for the expression analysis.
Insert_Pragma (Aitem);
goto Continue;
end Pre_Post;
-- Test_Case
when Aspect_Test_Case => Test_Case : declare
Args : List_Id;
Comp_Expr : Node_Id;
Comp_Assn : Node_Id;
New_Expr : Node_Id;
begin
Args := New_List;
if Nkind (Parent (N)) = N_Compilation_Unit then
Error_Msg_Name_1 := Nam;
Error_Msg_N ("incorrect placement of aspect `%`", E);
goto Continue;
end if;
if Nkind (Expr) /= N_Aggregate then
Error_Msg_Name_1 := Nam;
Error_Msg_NE
("wrong syntax for aspect `%` for &", Id, E);
goto Continue;
end if;
-- Make pragma expressions refer to the original aspect
-- expressions through the Original_Node link. This is used
-- in semantic analysis for ASIS mode, so that the original
-- expression also gets analyzed.
Comp_Expr := First (Expressions (Expr));
while Present (Comp_Expr) loop
New_Expr := Relocate_Node (Comp_Expr);
Append_To (Args,
Make_Pragma_Argument_Association (Sloc (Comp_Expr),
Expression => New_Expr));
Next (Comp_Expr);
end loop;
Comp_Assn := First (Component_Associations (Expr));
while Present (Comp_Assn) loop
if List_Length (Choices (Comp_Assn)) /= 1
or else
Nkind (First (Choices (Comp_Assn))) /= N_Identifier
then
Error_Msg_Name_1 := Nam;
Error_Msg_NE
("wrong syntax for aspect `%` for &", Id, E);
goto Continue;
end if;
Append_To (Args,
Make_Pragma_Argument_Association (Sloc (Comp_Assn),
Chars => Chars (First (Choices (Comp_Assn))),
Expression =>
Relocate_Node (Expression (Comp_Assn))));
Next (Comp_Assn);
end loop;
-- Build the test-case pragma
Make_Aitem_Pragma
(Pragma_Argument_Associations => Args,
Pragma_Name => Nam);
end Test_Case;
-- Contract_Cases
when Aspect_Contract_Cases =>
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Nam);
Decorate (Aspect, Aitem);
Insert_Pragma (Aitem);
goto Continue;
-- Case 5: Special handling for aspects with an optional
-- boolean argument.
-- In the delayed case, the corresponding pragma cannot be
-- generated yet because the evaluation of the boolean needs
-- to be delayed till the freeze point.
when Boolean_Aspects
| Library_Unit_Aspects
=>
Set_Is_Boolean_Aspect (Aspect);
-- Lock_Free aspect only apply to protected objects
if A_Id = Aspect_Lock_Free then
if Ekind (E) /= E_Protected_Type then
Error_Msg_Name_1 := Nam;
Error_Msg_N
("aspect % only applies to a protected object",
Aspect);
else
-- Set the Uses_Lock_Free flag to True if there is no
-- expression or if the expression is True. The
-- evaluation of this aspect should be delayed to the
-- freeze point (why???)
if No (Expr)
or else Is_True (Static_Boolean (Expr))
then
Set_Uses_Lock_Free (E);
end if;
Record_Rep_Item (E, Aspect);
end if;
goto Continue;
elsif A_Id = Aspect_Export or else A_Id = Aspect_Import then
Analyze_Aspect_Export_Import;
-- Disable_Controlled
elsif A_Id = Aspect_Disable_Controlled then
if Ekind (E) /= E_Record_Type
or else not Is_Controlled (E)
then
Error_Msg_N
("aspect % requires controlled record type", Aspect);
goto Continue;
end if;
-- If we're in a generic template, we don't want to try
-- to disable controlled types, because typical usage is
-- "Disable_Controlled => not <some_check>'Enabled", and
-- the value of Enabled is not known until we see a
-- particular instance. In such a context, we just need
-- to preanalyze the expression for legality.
if Expander_Active then
Analyze_And_Resolve (Expr, Standard_Boolean);
if not Present (Expr)
or else Is_True (Static_Boolean (Expr))
then
Set_Disable_Controlled (E);
end if;
elsif Serious_Errors_Detected = 0 then
Preanalyze_And_Resolve (Expr, Standard_Boolean);
end if;
goto Continue;
end if;
-- Library unit aspects require special handling in the case
-- of a package declaration, the pragma needs to be inserted
-- in the list of declarations for the associated package.
-- There is no issue of visibility delay for these aspects.
if A_Id in Library_Unit_Aspects
and then
Nkind_In (N, N_Package_Declaration,
N_Generic_Package_Declaration)
and then Nkind (Parent (N)) /= N_Compilation_Unit
-- Aspect is legal on a local instantiation of a library-
-- level generic unit.
and then not Is_Generic_Instance (Defining_Entity (N))
then
Error_Msg_N
("incorrect context for library unit aspect&", Id);
goto Continue;
end if;
-- Cases where we do not delay, includes all cases where the
-- expression is missing other than the above cases.
if not Delay_Required or else No (Expr) then
-- Exclude aspects Export and Import because their pragma
-- syntax does not map directly to a Boolean aspect.
if A_Id /= Aspect_Export
and then A_Id /= Aspect_Import
then
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Ent),
Expression => Ent)),
Pragma_Name => Chars (Id));
end if;
Delay_Required := False;
-- In general cases, the corresponding pragma/attribute
-- definition clause will be inserted later at the freezing
-- point, and we do not need to build it now.
else
Aitem := Empty;
end if;
-- Storage_Size
-- This is special because for access types we need to generate
-- an attribute definition clause. This also works for single
-- task declarations, but it does not work for task type
-- declarations, because we have the case where the expression
-- references a discriminant of the task type. That can't use
-- an attribute definition clause because we would not have
-- visibility on the discriminant. For that case we must
-- generate a pragma in the task definition.
when Aspect_Storage_Size =>
-- Task type case
if Ekind (E) = E_Task_Type then
declare
Decl : constant Node_Id := Declaration_Node (E);
begin
pragma Assert (Nkind (Decl) = N_Task_Type_Declaration);
-- If no task definition, create one
if No (Task_Definition (Decl)) then
Set_Task_Definition (Decl,
Make_Task_Definition (Loc,
Visible_Declarations => Empty_List,
End_Label => Empty));
end if;
-- Create a pragma and put it at the start of the task
-- definition for the task type declaration.
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Storage_Size);
Prepend
(Aitem,
Visible_Declarations (Task_Definition (Decl)));
goto Continue;
end;
-- All other cases, generate attribute definition
else
Aitem :=
Make_Attribute_Definition_Clause (Loc,
Name => Ent,
Chars => Chars (Id),
Expression => Relocate_Node (Expr));
end if;
end case;
-- Attach the corresponding pragma/attribute definition clause to
-- the aspect specification node.
if Present (Aitem) then
Set_From_Aspect_Specification (Aitem);
end if;
-- In the context of a compilation unit, we directly put the
-- pragma in the Pragmas_After list of the N_Compilation_Unit_Aux
-- node (no delay is required here) except for aspects on a
-- subprogram body (see below) and a generic package, for which we
-- need to introduce the pragma before building the generic copy
-- (see sem_ch12), and for package instantiations, where the
-- library unit pragmas are better handled early.
if Nkind (Parent (N)) = N_Compilation_Unit
and then (Present (Aitem) or else Is_Boolean_Aspect (Aspect))
then
declare
Aux : constant Node_Id := Aux_Decls_Node (Parent (N));
begin
pragma Assert (Nkind (Aux) = N_Compilation_Unit_Aux);
-- For a Boolean aspect, create the corresponding pragma if
-- no expression or if the value is True.
if Is_Boolean_Aspect (Aspect) and then No (Aitem) then
if Is_True (Static_Boolean (Expr)) then
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Ent),
Expression => Ent)),
Pragma_Name => Chars (Id));
Set_From_Aspect_Specification (Aitem, True);
Set_Corresponding_Aspect (Aitem, Aspect);
else
goto Continue;
end if;
end if;
-- If the aspect is on a subprogram body (relevant aspect
-- is Inline), add the pragma in front of the declarations.
if Nkind (N) = N_Subprogram_Body then
if No (Declarations (N)) then
Set_Declarations (N, New_List);
end if;
Prepend (Aitem, Declarations (N));
elsif Nkind (N) = N_Generic_Package_Declaration then
if No (Visible_Declarations (Specification (N))) then
Set_Visible_Declarations (Specification (N), New_List);
end if;
Prepend (Aitem,
Visible_Declarations (Specification (N)));
elsif Nkind (N) = N_Package_Instantiation then
declare
Spec : constant Node_Id :=
Specification (Instance_Spec (N));
begin
if No (Visible_Declarations (Spec)) then
Set_Visible_Declarations (Spec, New_List);
end if;
Prepend (Aitem, Visible_Declarations (Spec));
end;
else
if No (Pragmas_After (Aux)) then
Set_Pragmas_After (Aux, New_List);
end if;
Append (Aitem, Pragmas_After (Aux));
end if;
goto Continue;
end;
end if;
-- The evaluation of the aspect is delayed to the freezing point.
-- The pragma or attribute clause if there is one is then attached
-- to the aspect specification which is put in the rep item list.
if Delay_Required then
if Present (Aitem) then
Set_Is_Delayed_Aspect (Aitem);
Set_Aspect_Rep_Item (Aspect, Aitem);
Set_Parent (Aitem, Aspect);
end if;
Set_Is_Delayed_Aspect (Aspect);
-- In the case of Default_Value, link the aspect to base type
-- as well, even though it appears on a first subtype. This is
-- mandated by the semantics of the aspect. Do not establish
-- the link when processing the base type itself as this leads
-- to a rep item circularity. Verify that we are dealing with
-- a scalar type to prevent cascaded errors.
if A_Id = Aspect_Default_Value
and then Is_Scalar_Type (E)
and then Base_Type (E) /= E
then
Set_Has_Delayed_Aspects (Base_Type (E));
Record_Rep_Item (Base_Type (E), Aspect);
end if;
Set_Has_Delayed_Aspects (E);
Record_Rep_Item (E, Aspect);
-- When delay is not required and the context is a package or a
-- subprogram body, insert the pragma in the body declarations.
elsif Nkind_In (N, N_Package_Body, N_Subprogram_Body) then
if No (Declarations (N)) then
Set_Declarations (N, New_List);
end if;
-- The pragma is added before source declarations
Prepend_To (Declarations (N), Aitem);
-- When delay is not required and the context is not a compilation
-- unit, we simply insert the pragma/attribute definition clause
-- in sequence.
elsif Present (Aitem) then
Insert_After (Ins_Node, Aitem);
Ins_Node := Aitem;
end if;
end Analyze_One_Aspect;
<<Continue>>
Next (Aspect);
end loop Aspect_Loop;
if Has_Delayed_Aspects (E) then
Ensure_Freeze_Node (E);
end if;
end Analyze_Aspect_Specifications;
---------------------------------------------------
-- Analyze_Aspect_Specifications_On_Body_Or_Stub --
---------------------------------------------------
procedure Analyze_Aspect_Specifications_On_Body_Or_Stub (N : Node_Id) is
Body_Id : constant Entity_Id := Defining_Entity (N);
procedure Diagnose_Misplaced_Aspects (Spec_Id : Entity_Id);
-- Body [stub] N has aspects, but they are not properly placed. Emit an
-- error message depending on the aspects involved. Spec_Id denotes the
-- entity of the corresponding spec.
--------------------------------
-- Diagnose_Misplaced_Aspects --
--------------------------------
procedure Diagnose_Misplaced_Aspects (Spec_Id : Entity_Id) is
procedure Misplaced_Aspect_Error
(Asp : Node_Id;
Ref_Nam : Name_Id);
-- Emit an error message concerning misplaced aspect Asp. Ref_Nam is
-- the name of the refined version of the aspect.
----------------------------
-- Misplaced_Aspect_Error --
----------------------------
procedure Misplaced_Aspect_Error
(Asp : Node_Id;
Ref_Nam : Name_Id)
is
Asp_Nam : constant Name_Id := Chars (Identifier (Asp));
Asp_Id : constant Aspect_Id := Get_Aspect_Id (Asp_Nam);
begin
-- The corresponding spec already contains the aspect in question
-- and the one appearing on the body must be the refined form:
-- procedure P with Global ...;
-- procedure P with Global ... is ... end P;
-- ^
-- Refined_Global
if Has_Aspect (Spec_Id, Asp_Id) then
Error_Msg_Name_1 := Asp_Nam;
-- Subunits cannot carry aspects that apply to a subprogram
-- declaration.
if Nkind (Parent (N)) = N_Subunit then
Error_Msg_N ("aspect % cannot apply to a subunit", Asp);
-- Otherwise suggest the refined form
else
Error_Msg_Name_2 := Ref_Nam;
Error_Msg_N ("aspect % should be %", Asp);
end if;
-- Otherwise the aspect must appear on the spec, not on the body
-- procedure P;
-- procedure P with Global ... is ... end P;
else
Error_Msg_N
("aspect specification must appear on initial declaration",
Asp);
end if;
end Misplaced_Aspect_Error;
-- Local variables
Asp : Node_Id;
Asp_Nam : Name_Id;
-- Start of processing for Diagnose_Misplaced_Aspects
begin
-- Iterate over the aspect specifications and emit specific errors
-- where applicable.
Asp := First (Aspect_Specifications (N));
while Present (Asp) loop
Asp_Nam := Chars (Identifier (Asp));
-- Do not emit errors on aspects that can appear on a subprogram
-- body. This scenario occurs when the aspect specification list
-- contains both misplaced and properly placed aspects.
if Aspect_On_Body_Or_Stub_OK (Get_Aspect_Id (Asp_Nam)) then
null;
-- Special diagnostics for SPARK aspects
elsif Asp_Nam = Name_Depends then
Misplaced_Aspect_Error (Asp, Name_Refined_Depends);
elsif Asp_Nam = Name_Global then
Misplaced_Aspect_Error (Asp, Name_Refined_Global);
elsif Asp_Nam = Name_Post then
Misplaced_Aspect_Error (Asp, Name_Refined_Post);
-- Otherwise a language-defined aspect is misplaced
else
Error_Msg_N
("aspect specification must appear on initial declaration",
Asp);
end if;
Next (Asp);
end loop;
end Diagnose_Misplaced_Aspects;
-- Local variables
Spec_Id : constant Entity_Id := Unique_Defining_Entity (N);
-- Start of processing for Analyze_Aspects_On_Body_Or_Stub
begin
-- Language-defined aspects cannot be associated with a subprogram body
-- [stub] if the subprogram has a spec. Certain implementation defined
-- aspects are allowed to break this rule (for all applicable cases, see
-- table Aspects.Aspect_On_Body_Or_Stub_OK).
if Spec_Id /= Body_Id and then not Aspects_On_Body_Or_Stub_OK (N) then
Diagnose_Misplaced_Aspects (Spec_Id);
else
Analyze_Aspect_Specifications (N, Body_Id);
end if;
end Analyze_Aspect_Specifications_On_Body_Or_Stub;
-----------------------
-- Analyze_At_Clause --
-----------------------
-- An at clause is replaced by the corresponding Address attribute
-- definition clause that is the preferred approach in Ada 95.
procedure Analyze_At_Clause (N : Node_Id) is
CS : constant Boolean := Comes_From_Source (N);
begin
-- This is an obsolescent feature
Check_Restriction (No_Obsolescent_Features, N);
if Warn_On_Obsolescent_Feature then
Error_Msg_N
("?j?at clause is an obsolescent feature (RM J.7(2))", N);
Error_Msg_N
("\?j?use address attribute definition clause instead", N);
end if;
-- Rewrite as address clause
Rewrite (N,
Make_Attribute_Definition_Clause (Sloc (N),
Name => Identifier (N),
Chars => Name_Address,
Expression => Expression (N)));
-- We preserve Comes_From_Source, since logically the clause still comes
-- from the source program even though it is changed in form.
Set_Comes_From_Source (N, CS);
-- Analyze rewritten clause
Analyze_Attribute_Definition_Clause (N);
end Analyze_At_Clause;
-----------------------------------------
-- Analyze_Attribute_Definition_Clause --
-----------------------------------------
procedure Analyze_Attribute_Definition_Clause (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Nam : constant Node_Id := Name (N);
Attr : constant Name_Id := Chars (N);
Expr : constant Node_Id := Expression (N);
Id : constant Attribute_Id := Get_Attribute_Id (Attr);
Ent : Entity_Id;
-- The entity of Nam after it is analyzed. In the case of an incomplete
-- type, this is the underlying type.
U_Ent : Entity_Id;
-- The underlying entity to which the attribute applies. Generally this
-- is the Underlying_Type of Ent, except in the case where the clause
-- applies to the full view of an incomplete or private type, in which
-- case U_Ent is just a copy of Ent.
FOnly : Boolean := False;
-- Reset to True for subtype specific attribute (Alignment, Size)
-- and for stream attributes, i.e. those cases where in the call to
-- Rep_Item_Too_Late, FOnly is set True so that only the freezing rules
-- are checked. Note that the case of stream attributes is not clear
-- from the RM, but see AI95-00137. Also, the RM seems to disallow
-- Storage_Size for derived task types, but that is also clearly
-- unintentional.
procedure Analyze_Stream_TSS_Definition (TSS_Nam : TSS_Name_Type);
-- Common processing for 'Read, 'Write, 'Input and 'Output attribute
-- definition clauses.
function Duplicate_Clause return Boolean;
-- This routine checks if the aspect for U_Ent being given by attribute
-- definition clause N is for an aspect that has already been specified,
-- and if so gives an error message. If there is a duplicate, True is
-- returned, otherwise if there is no error, False is returned.
procedure Check_Indexing_Functions;
-- Check that the function in Constant_Indexing or Variable_Indexing
-- attribute has the proper type structure. If the name is overloaded,
-- check that some interpretation is legal.
procedure Check_Iterator_Functions;
-- Check that there is a single function in Default_Iterator attribute
-- has the proper type structure.
function Check_Primitive_Function (Subp : Entity_Id) return Boolean;
-- Common legality check for the previous two
-----------------------------------
-- Analyze_Stream_TSS_Definition --
-----------------------------------
procedure Analyze_Stream_TSS_Definition (TSS_Nam : TSS_Name_Type) is
Subp : Entity_Id := Empty;
I : Interp_Index;
It : Interp;
Pnam : Entity_Id;
Is_Read : constant Boolean := (TSS_Nam = TSS_Stream_Read);
-- True for Read attribute, False for other attributes
function Has_Good_Profile
(Subp : Entity_Id;
Report : Boolean := False) return Boolean;
-- Return true if the entity is a subprogram with an appropriate
-- profile for the attribute being defined. If result is False and
-- Report is True, function emits appropriate error.
----------------------
-- Has_Good_Profile --
----------------------
function Has_Good_Profile
(Subp : Entity_Id;
Report : Boolean := False) return Boolean
is
Expected_Ekind : constant array (Boolean) of Entity_Kind :=
(False => E_Procedure, True => E_Function);
Is_Function : constant Boolean := (TSS_Nam = TSS_Stream_Input);
F : Entity_Id;
Typ : Entity_Id;
begin
if Ekind (Subp) /= Expected_Ekind (Is_Function) then
return False;
end if;
F := First_Formal (Subp);
if No (F)
or else Ekind (Etype (F)) /= E_Anonymous_Access_Type
or else Designated_Type (Etype (F)) /=
Class_Wide_Type (RTE (RE_Root_Stream_Type))
then
return False;
end if;
if not Is_Function then
Next_Formal (F);
declare
Expected_Mode : constant array (Boolean) of Entity_Kind :=
(False => E_In_Parameter,
True => E_Out_Parameter);
begin
if Parameter_Mode (F) /= Expected_Mode (Is_Read) then
return False;
end if;
end;
Typ := Etype (F);
-- If the attribute specification comes from an aspect
-- specification for a class-wide stream, the parameter must be
-- a class-wide type of the entity to which the aspect applies.
if From_Aspect_Specification (N)
and then Class_Present (Parent (N))
and then Is_Class_Wide_Type (Typ)
then
Typ := Etype (Typ);
end if;
else
Typ := Etype (Subp);
end if;
-- Verify that the prefix of the attribute and the local name for
-- the type of the formal match, or one is the class-wide of the
-- other, in the case of a class-wide stream operation.
if Base_Type (Typ) = Base_Type (Ent)
or else (Is_Class_Wide_Type (Typ)
and then Typ = Class_Wide_Type (Base_Type (Ent)))
or else (Is_Class_Wide_Type (Ent)
and then Ent = Class_Wide_Type (Base_Type (Typ)))
then
null;
else
return False;
end if;
if Present (Next_Formal (F)) then
return False;
elsif not Is_Scalar_Type (Typ)
and then not Is_First_Subtype (Typ)
and then not Is_Class_Wide_Type (Typ)
then
if Report and not Is_First_Subtype (Typ) then
Error_Msg_N
("subtype of formal in stream operation must be a first "
& "subtype", Parameter_Type (Parent (F)));
end if;
return False;
else
return True;
end if;
end Has_Good_Profile;
-- Start of processing for Analyze_Stream_TSS_Definition
begin
FOnly := True;
if not Is_Type (U_Ent) then
Error_Msg_N ("local name must be a subtype", Nam);
return;
elsif not Is_First_Subtype (U_Ent) then
Error_Msg_N ("local name must be a first subtype", Nam);
return;
end if;
Pnam := TSS (Base_Type (U_Ent), TSS_Nam);
-- If Pnam is present, it can be either inherited from an ancestor
-- type (in which case it is legal to redefine it for this type), or
-- be a previous definition of the attribute for the same type (in
-- which case it is illegal).
-- In the first case, it will have been analyzed already, and we
-- can check that its profile does not match the expected profile
-- for a stream attribute of U_Ent. In the second case, either Pnam
-- has been analyzed (and has the expected profile), or it has not
-- been analyzed yet (case of a type that has not been frozen yet
-- and for which the stream attribute has been set using Set_TSS).
if Present (Pnam)
and then (No (First_Entity (Pnam)) or else Has_Good_Profile (Pnam))
then
Error_Msg_Sloc := Sloc (Pnam);
Error_Msg_Name_1 := Attr;
Error_Msg_N ("% attribute already defined #", Nam);
return;
end if;
Analyze (Expr);
if Is_Entity_Name (Expr) then
if not Is_Overloaded (Expr) then
if Has_Good_Profile (Entity (Expr), Report => True) then
Subp := Entity (Expr);
end if;
else
Get_First_Interp (Expr, I, It);
while Present (It.Nam) loop
if Has_Good_Profile (It.Nam) then
Subp := It.Nam;
exit;
end if;
Get_Next_Interp (I, It);
end loop;
end if;
end if;
if Present (Subp) then
if Is_Abstract_Subprogram (Subp) then
Error_Msg_N ("stream subprogram must not be abstract", Expr);
return;
-- A stream subprogram for an interface type must be a null
-- procedure (RM 13.13.2 (38/3)). Note that the class-wide type
-- of an interface is not an interface type (3.9.4 (6.b/2)).
elsif Is_Interface (U_Ent)
and then not Is_Class_Wide_Type (U_Ent)
and then not Inside_A_Generic
and then
(Ekind (Subp) = E_Function
or else
not Null_Present
(Specification
(Unit_Declaration_Node (Ultimate_Alias (Subp)))))
then
Error_Msg_N
("stream subprogram for interface type must be null "
& "procedure", Expr);
end if;
Set_Entity (Expr, Subp);
Set_Etype (Expr, Etype (Subp));
New_Stream_Subprogram (N, U_Ent, Subp, TSS_Nam);
else
Error_Msg_Name_1 := Attr;
Error_Msg_N ("incorrect expression for% attribute", Expr);
end if;
end Analyze_Stream_TSS_Definition;
------------------------------
-- Check_Indexing_Functions --
------------------------------
procedure Check_Indexing_Functions is
Indexing_Found : Boolean := False;
procedure Check_Inherited_Indexing;
-- For a derived type, check that no indexing aspect is specified
-- for the type if it is also inherited
procedure Check_One_Function (Subp : Entity_Id);
-- Check one possible interpretation. Sets Indexing_Found True if a
-- legal indexing function is found.
procedure Illegal_Indexing (Msg : String);
-- Diagnose illegal indexing function if not overloaded. In the
-- overloaded case indicate that no legal interpretation exists.
------------------------------
-- Check_Inherited_Indexing --
------------------------------
procedure Check_Inherited_Indexing is
Inherited : Node_Id;
begin
if Attr = Name_Constant_Indexing then
Inherited :=
Find_Aspect (Etype (Ent), Aspect_Constant_Indexing);
else pragma Assert (Attr = Name_Variable_Indexing);
Inherited :=
Find_Aspect (Etype (Ent), Aspect_Variable_Indexing);
end if;
if Present (Inherited) then
if Debug_Flag_Dot_XX then
null;
-- OK if current attribute_definition_clause is expansion of
-- inherited aspect.
elsif Aspect_Rep_Item (Inherited) = N then
null;
-- Indicate the operation that must be overridden, rather than
-- redefining the indexing aspect.
else
Illegal_Indexing
("indexing function already inherited from parent type");
Error_Msg_NE
("!override & instead",
N, Entity (Expression (Inherited)));
end if;
end if;
end Check_Inherited_Indexing;
------------------------
-- Check_One_Function --
------------------------
procedure Check_One_Function (Subp : Entity_Id) is
Default_Element : Node_Id;
Ret_Type : constant Entity_Id := Etype (Subp);
begin
if not Is_Overloadable (Subp) then
Illegal_Indexing ("illegal indexing function for type&");
return;
elsif Scope (Subp) /= Scope (Ent) then
if Nkind (Expr) = N_Expanded_Name then
-- Indexing function can't be declared elsewhere
Illegal_Indexing
("indexing function must be declared in scope of type&");
end if;
return;
elsif No (First_Formal (Subp)) then
Illegal_Indexing
("Indexing requires a function that applies to type&");
return;
elsif No (Next_Formal (First_Formal (Subp))) then
Illegal_Indexing
("indexing function must have at least two parameters");
return;
elsif Is_Derived_Type (Ent) then
Check_Inherited_Indexing;
end if;
if not Check_Primitive_Function (Subp) then
Illegal_Indexing
("Indexing aspect requires a function that applies to type&");
return;
end if;
-- If partial declaration exists, verify that it is not tagged.
if Ekind (Current_Scope) = E_Package
and then Has_Private_Declaration (Ent)
and then From_Aspect_Specification (N)
and then
List_Containing (Parent (Ent)) =
Private_Declarations
(Specification (Unit_Declaration_Node (Current_Scope)))
and then Nkind (N) = N_Attribute_Definition_Clause
then
declare
Decl : Node_Id;
begin
Decl :=
First (Visible_Declarations
(Specification
(Unit_Declaration_Node (Current_Scope))));
while Present (Decl) loop
if Nkind (Decl) = N_Private_Type_Declaration
and then Ent = Full_View (Defining_Identifier (Decl))
and then Tagged_Present (Decl)
and then No (Aspect_Specifications (Decl))
then
Illegal_Indexing
("Indexing aspect cannot be specified on full view "
& "if partial view is tagged");
return;
end if;
Next (Decl);
end loop;
end;
end if;
-- An indexing function must return either the default element of
-- the container, or a reference type. For variable indexing it
-- must be the latter.
Default_Element :=
Find_Value_Of_Aspect
(Etype (First_Formal (Subp)), Aspect_Iterator_Element);
if Present (Default_Element) then
Analyze (Default_Element);
if Is_Entity_Name (Default_Element)
and then not Covers (Entity (Default_Element), Ret_Type)
and then False
then
Illegal_Indexing
("wrong return type for indexing function");
return;
end if;
end if;
-- For variable_indexing the return type must be a reference type
if Attr = Name_Variable_Indexing then
if not Has_Implicit_Dereference (Ret_Type) then
Illegal_Indexing
("variable indexing must return a reference type");
return;
elsif Is_Access_Constant
(Etype (First_Discriminant (Ret_Type)))
then
Illegal_Indexing
("variable indexing must return an access to variable");
return;
end if;
else
if Has_Implicit_Dereference (Ret_Type)
and then not
Is_Access_Constant (Etype (First_Discriminant (Ret_Type)))
then
Illegal_Indexing
("constant indexing must return an access to constant");
return;
elsif Is_Access_Type (Etype (First_Formal (Subp)))
and then not Is_Access_Constant (Etype (First_Formal (Subp)))
then
Illegal_Indexing
("constant indexing must apply to an access to constant");
return;
end if;
end if;
-- All checks succeeded.
Indexing_Found := True;
end Check_One_Function;
-----------------------
-- Illegal_Indexing --
-----------------------
procedure Illegal_Indexing (Msg : String) is
begin
Error_Msg_NE (Msg, N, Ent);
end Illegal_Indexing;
-- Start of processing for Check_Indexing_Functions
begin
if In_Instance then
Check_Inherited_Indexing;
end if;
Analyze (Expr);
if not Is_Overloaded (Expr) then
Check_One_Function (Entity (Expr));
else
declare
I : Interp_Index;
It : Interp;
begin
Indexing_Found := False;
Get_First_Interp (Expr, I, It);
while Present (It.Nam) loop
-- Note that analysis will have added the interpretation
-- that corresponds to the dereference. We only check the
-- subprogram itself.
if Is_Overloadable (It.Nam) then
Check_One_Function (It.Nam);
end if;
Get_Next_Interp (I, It);
end loop;
end;
end if;
if not Indexing_Found and then not Error_Posted (N) then
Error_Msg_NE
("aspect Indexing requires a local function that "
& "applies to type&", Expr, Ent);
end if;
end Check_Indexing_Functions;
------------------------------
-- Check_Iterator_Functions --
------------------------------
procedure Check_Iterator_Functions is
function Valid_Default_Iterator (Subp : Entity_Id) return Boolean;
-- Check one possible interpretation for validity
----------------------------
-- Valid_Default_Iterator --
----------------------------
function Valid_Default_Iterator (Subp : Entity_Id) return Boolean is
Root_T : constant Entity_Id := Root_Type (Etype (Etype (Subp)));
Formal : Entity_Id;
begin
if not Check_Primitive_Function (Subp) then
return False;
-- The return type must be derived from a type in an instance
-- of Iterator.Interfaces, and thus its root type must have a
-- predefined name.
elsif Chars (Root_T) /= Name_Forward_Iterator
and then Chars (Root_T) /= Name_Reversible_Iterator
then
return False;
else
Formal := First_Formal (Subp);
end if;
-- False if any subsequent formal has no default expression
Formal := Next_Formal (Formal);
while Present (Formal) loop
if No (Expression (Parent (Formal))) then
return False;
end if;
Next_Formal (Formal);
end loop;
-- True if all subsequent formals have default expressions
return True;
end Valid_Default_Iterator;
-- Start of processing for Check_Iterator_Functions
begin
Analyze (Expr);
if not Is_Entity_Name (Expr) then
Error_Msg_N ("aspect Iterator must be a function name", Expr);
end if;
if not Is_Overloaded (Expr) then
if not Check_Primitive_Function (Entity (Expr)) then
Error_Msg_NE
("aspect Indexing requires a function that applies to type&",
Entity (Expr), Ent);
end if;
-- Flag the default_iterator as well as the denoted function.
if not Valid_Default_Iterator (Entity (Expr)) then
Error_Msg_N ("improper function for default iterator!", Expr);
end if;
else
declare
Default : Entity_Id := Empty;
I : Interp_Index;
It : Interp;
begin
Get_First_Interp (Expr, I, It);
while Present (It.Nam) loop
if not Check_Primitive_Function (It.Nam)
or else not Valid_Default_Iterator (It.Nam)
then
Remove_Interp (I);
elsif Present (Default) then
-- An explicit one should override an implicit one
if Comes_From_Source (Default) =
Comes_From_Source (It.Nam)
then
Error_Msg_N ("default iterator must be unique", Expr);
Error_Msg_Sloc := Sloc (Default);
Error_Msg_N ("\\possible interpretation#", Expr);
Error_Msg_Sloc := Sloc (It.Nam);
Error_Msg_N ("\\possible interpretation#", Expr);
elsif Comes_From_Source (It.Nam) then
Default := It.Nam;
end if;
else
Default := It.Nam;
end if;
Get_Next_Interp (I, It);
end loop;
if Present (Default) then
Set_Entity (Expr, Default);
Set_Is_Overloaded (Expr, False);
else
Error_Msg_N
("no interpretation is a valid default iterator!", Expr);
end if;
end;
end if;
end Check_Iterator_Functions;
-------------------------------
-- Check_Primitive_Function --
-------------------------------
function Check_Primitive_Function (Subp : Entity_Id) return Boolean is
Ctrl : Entity_Id;
begin
if Ekind (Subp) /= E_Function then
return False;
end if;
if No (First_Formal (Subp)) then
return False;
else
Ctrl := Etype (First_Formal (Subp));
end if;
-- To be a primitive operation subprogram has to be in same scope.
if Scope (Ctrl) /= Scope (Subp) then
return False;
end if;
-- Type of formal may be the class-wide type, an access to such,
-- or an incomplete view.
if Ctrl = Ent
or else Ctrl = Class_Wide_Type (Ent)
or else
(Ekind (Ctrl) = E_Anonymous_Access_Type
and then (Designated_Type (Ctrl) = Ent
or else
Designated_Type (Ctrl) = Class_Wide_Type (Ent)))
or else
(Ekind (Ctrl) = E_Incomplete_Type
and then Full_View (Ctrl) = Ent)
then
null;
else
return False;
end if;
return True;
end Check_Primitive_Function;
----------------------
-- Duplicate_Clause --
----------------------
function Duplicate_Clause return Boolean is
A : Node_Id;
begin
-- Nothing to do if this attribute definition clause comes from
-- an aspect specification, since we could not be duplicating an
-- explicit clause, and we dealt with the case of duplicated aspects
-- in Analyze_Aspect_Specifications.
if From_Aspect_Specification (N) then
return False;
end if;
-- Otherwise current clause may duplicate previous clause, or a
-- previously given pragma or aspect specification for the same
-- aspect.
A := Get_Rep_Item (U_Ent, Chars (N), Check_Parents => False);
if Present (A) then
Error_Msg_Name_1 := Chars (N);
Error_Msg_Sloc := Sloc (A);
Error_Msg_NE ("aspect% for & previously given#", N, U_Ent);
return True;
end if;
return False;
end Duplicate_Clause;
-- Start of processing for Analyze_Attribute_Definition_Clause
begin
-- The following code is a defense against recursion. Not clear that
-- this can happen legitimately, but perhaps some error situations can
-- cause it, and we did see this recursion during testing.
if Analyzed (N) then
return;
else
Set_Analyzed (N, True);
end if;
Check_Restriction_No_Use_Of_Attribute (N);
-- Ignore some selected attributes in CodePeer mode since they are not
-- relevant in this context.
if CodePeer_Mode then
case Id is
-- Ignore Component_Size in CodePeer mode, to avoid changing the
-- internal representation of types by implicitly packing them.
when Attribute_Component_Size =>
Rewrite (N, Make_Null_Statement (Sloc (N)));
return;
when others =>
null;
end case;
end if;
-- Process Ignore_Rep_Clauses option
if Ignore_Rep_Clauses then
case Id is
-- The following should be ignored. They do not affect legality
-- and may be target dependent. The basic idea of -gnatI is to
-- ignore any rep clauses that may be target dependent but do not
-- affect legality (except possibly to be rejected because they
-- are incompatible with the compilation target).
when Attribute_Alignment
| Attribute_Bit_Order
| Attribute_Component_Size
| Attribute_Machine_Radix
| Attribute_Object_Size
| Attribute_Size
| Attribute_Small
| Attribute_Stream_Size
| Attribute_Value_Size
=>
Kill_Rep_Clause (N);
return;
-- The following should not be ignored, because in the first place
-- they are reasonably portable, and should not cause problems
-- in compiling code from another target, and also they do affect
-- legality, e.g. failing to provide a stream attribute for a type
-- may make a program illegal.
when Attribute_External_Tag
| Attribute_Input
| Attribute_Output
| Attribute_Read
| Attribute_Simple_Storage_Pool
| Attribute_Storage_Pool
| Attribute_Storage_Size
| Attribute_Write
=>
null;
-- We do not do anything here with address clauses, they will be
-- removed by Freeze later on, but for now, it works better to
-- keep then in the tree.
when Attribute_Address =>
null;
-- Other cases are errors ("attribute& cannot be set with
-- definition clause"), which will be caught below.
when others =>
null;
end case;
end if;
Analyze (Nam);
Ent := Entity (Nam);
if Rep_Item_Too_Early (Ent, N) then
return;
end if;
-- Rep clause applies to full view of incomplete type or private type if
-- we have one (if not, this is a premature use of the type). However,
-- certain semantic checks need to be done on the specified entity (i.e.
-- the private view), so we save it in Ent.
if Is_Private_Type (Ent)
and then Is_Derived_Type (Ent)
and then not Is_Tagged_Type (Ent)
and then No (Full_View (Ent))
then
-- If this is a private type whose completion is a derivation from
-- another private type, there is no full view, and the attribute
-- belongs to the type itself, not its underlying parent.
U_Ent := Ent;
elsif Ekind (Ent) = E_Incomplete_Type then
-- The attribute applies to the full view, set the entity of the
-- attribute definition accordingly.
Ent := Underlying_Type (Ent);
U_Ent := Ent;
Set_Entity (Nam, Ent);
else
U_Ent := Underlying_Type (Ent);
end if;
-- Avoid cascaded error
if Etype (Nam) = Any_Type then
return;
-- Must be declared in current scope or in case of an aspect
-- specification, must be visible in current scope.
elsif Scope (Ent) /= Current_Scope
and then
not (From_Aspect_Specification (N)
and then Scope_Within_Or_Same (Current_Scope, Scope (Ent)))
then
Error_Msg_N ("entity must be declared in this scope", Nam);
return;
-- Must not be a source renaming (we do have some cases where the
-- expander generates a renaming, and those cases are OK, in such
-- cases any attribute applies to the renamed object as well).
elsif Is_Object (Ent)
and then Present (Renamed_Object (Ent))
then
-- Case of renamed object from source, this is an error
if Comes_From_Source (Renamed_Object (Ent)) then
Get_Name_String (Chars (N));
Error_Msg_Strlen := Name_Len;
Error_Msg_String (1 .. Name_Len) := Name_Buffer (1 .. Name_Len);
Error_Msg_N
("~ clause not allowed for a renaming declaration "
& "(RM 13.1(6))", Nam);
return;
-- For the case of a compiler generated renaming, the attribute
-- definition clause applies to the renamed object created by the
-- expander. The easiest general way to handle this is to create a
-- copy of the attribute definition clause for this object.
elsif Is_Entity_Name (Renamed_Object (Ent)) then
Insert_Action (N,
Make_Attribute_Definition_Clause (Loc,
Name =>
New_Occurrence_Of (Entity (Renamed_Object (Ent)), Loc),
Chars => Chars (N),
Expression => Duplicate_Subexpr (Expression (N))));
-- If the renamed object is not an entity, it must be a dereference
-- of an unconstrained function call, and we must introduce a new
-- declaration to capture the expression. This is needed in the case
-- of 'Alignment, where the original declaration must be rewritten.
else
pragma Assert
(Nkind (Renamed_Object (Ent)) = N_Explicit_Dereference);
null;
end if;
-- If no underlying entity, use entity itself, applies to some
-- previously detected error cases ???
elsif No (U_Ent) then
U_Ent := Ent;
-- Cannot specify for a subtype (exception Object/Value_Size)
elsif Is_Type (U_Ent)
and then not Is_First_Subtype (U_Ent)
and then Id /= Attribute_Object_Size
and then Id /= Attribute_Value_Size
and then not From_At_Mod (N)
then
Error_Msg_N ("cannot specify attribute for subtype", Nam);
return;
end if;
Set_Entity (N, U_Ent);
-- Switch on particular attribute
case Id is
-------------
-- Address --
-------------
-- Address attribute definition clause
when Attribute_Address => Address : begin
-- A little error check, catch for X'Address use X'Address;
if Nkind (Nam) = N_Identifier
and then Nkind (Expr) = N_Attribute_Reference
and then Attribute_Name (Expr) = Name_Address
and then Nkind (Prefix (Expr)) = N_Identifier
and then Chars (Nam) = Chars (Prefix (Expr))
then
Error_Msg_NE
("address for & is self-referencing", Prefix (Expr), Ent);
return;
end if;
-- Not that special case, carry on with analysis of expression
Analyze_And_Resolve (Expr, RTE (RE_Address));
-- Even when ignoring rep clauses we need to indicate that the
-- entity has an address clause and thus it is legal to declare
-- it imported. Freeze will get rid of the address clause later.
if Ignore_Rep_Clauses then
if Ekind_In (U_Ent, E_Variable, E_Constant) then
Record_Rep_Item (U_Ent, N);
end if;
return;
end if;
if Duplicate_Clause then
null;
-- Case of address clause for subprogram
elsif Is_Subprogram (U_Ent) then
if Has_Homonym (U_Ent) then
Error_Msg_N
("address clause cannot be given for overloaded "
& "subprogram", Nam);
return;
end if;
-- For subprograms, all address clauses are permitted, and we
-- mark the subprogram as having a deferred freeze so that Gigi
-- will not elaborate it too soon.
-- Above needs more comments, what is too soon about???
Set_Has_Delayed_Freeze (U_Ent);
-- Case of address clause for entry
elsif Ekind (U_Ent) = E_Entry then
if Nkind (Parent (N)) = N_Task_Body then
Error_Msg_N
("entry address must be specified in task spec", Nam);
return;
end if;
-- For entries, we require a constant address
Check_Constant_Address_Clause (Expr, U_Ent);
-- Special checks for task types
if Is_Task_Type (Scope (U_Ent))
and then Comes_From_Source (Scope (U_Ent))
then
Error_Msg_N
("??entry address declared for entry in task type", N);
Error_Msg_N
("\??only one task can be declared of this type", N);
end if;
-- Entry address clauses are obsolescent
Check_Restriction (No_Obsolescent_Features, N);
if Warn_On_Obsolescent_Feature then
Error_Msg_N
("?j?attaching interrupt to task entry is an obsolescent "
& "feature (RM J.7.1)", N);
Error_Msg_N
("\?j?use interrupt procedure instead", N);
end if;
-- Case of an address clause for a controlled object, which we
-- consider to be erroneous.
elsif Is_Controlled (Etype (U_Ent))
or else Has_Controlled_Component (Etype (U_Ent))
then
Error_Msg_NE
("??controlled object & must not be overlaid", Nam, U_Ent);
Error_Msg_N
("\??Program_Error will be raised at run time", Nam);
Insert_Action (Declaration_Node (U_Ent),
Make_Raise_Program_Error (Loc,
Reason => PE_Overlaid_Controlled_Object));
return;
-- Case of an address clause for a class-wide object, which is
-- considered erroneous.
elsif Is_Class_Wide_Type (Etype (U_Ent)) then
Error_Msg_NE
("??class-wide object & must not be overlaid", Nam, U_Ent);
Error_Msg_N
("\??Program_Error will be raised at run time", Nam);
Insert_Action (Declaration_Node (U_Ent),
Make_Raise_Program_Error (Loc,
Reason => PE_Overlaid_Controlled_Object));
return;
-- Case of address clause for a (non-controlled) object
elsif Ekind_In (U_Ent, E_Variable, E_Constant) then
declare
Expr : constant Node_Id := Expression (N);
O_Ent : Entity_Id;
Off : Boolean;
begin
-- Exported variables cannot have an address clause, because
-- this cancels the effect of the pragma Export.
if Is_Exported (U_Ent) then
Error_Msg_N
("cannot export object with address clause", Nam);
return;
end if;
Find_Overlaid_Entity (N, O_Ent, Off);
if Present (O_Ent) then
-- If the object overlays a constant object, mark it so
if Is_Constant_Object (O_Ent) then
Set_Overlays_Constant (U_Ent);
end if;
-- If the address clause is of the form:
-- for X'Address use Y'Address;
-- or
-- C : constant Address := Y'Address;
-- ...
-- for X'Address use C;
-- then we make an entry in the table to check the size
-- and alignment of the overlaying variable. But we defer
-- this check till after code generation to take full
-- advantage of the annotation done by the back end.
-- If the entity has a generic type, the check will be
-- performed in the instance if the actual type justifies
-- it, and we do not insert the clause in the table to
-- prevent spurious warnings.
-- Note: we used to test Comes_From_Source and only give
-- this warning for source entities, but we have removed
-- this test. It really seems bogus to generate overlays
-- that would trigger this warning in generated code.
-- Furthermore, by removing the test, we handle the
-- aspect case properly.
if Is_Object (O_Ent)
and then not Is_Generic_Type (Etype (U_Ent))
and then Address_Clause_Overlay_Warnings
then
Address_Clause_Checks.Append
((N, U_Ent, No_Uint, O_Ent, Off));
end if;
else
-- If this is not an overlay, mark a variable as being
-- volatile to prevent unwanted optimizations. It's a
-- conservative interpretation of RM 13.3(19) for the
-- cases where the compiler cannot detect potential
-- aliasing issues easily and it also covers the case
-- of an absolute address where the volatile aspect is
-- kind of implicit.
if Ekind (U_Ent) = E_Variable then
Set_Treat_As_Volatile (U_Ent);
end if;
-- Make an entry in the table for an absolute address as
-- above to check that the value is compatible with the
-- alignment of the object.
declare
Addr : constant Node_Id := Address_Value (Expr);
begin
if Compile_Time_Known_Value (Addr)
and then Address_Clause_Overlay_Warnings
then
Address_Clause_Checks.Append
((N, U_Ent, Expr_Value (Addr), Empty, False));
end if;
end;
end if;
-- Overlaying controlled objects is erroneous. Emit warning
-- but continue analysis because program is itself legal,
-- and back end must see address clause.
if Present (O_Ent)
and then (Has_Controlled_Component (Etype (O_Ent))
or else Is_Controlled (Etype (O_Ent)))
and then not Inside_A_Generic
then
Error_Msg_N
("??cannot use overlays with controlled objects", Expr);
Error_Msg_N
("\??Program_Error will be raised at run time", Expr);
Insert_Action (Declaration_Node (U_Ent),
Make_Raise_Program_Error (Loc,
Reason => PE_Overlaid_Controlled_Object));
-- Issue an unconditional warning for a constant overlaying
-- a variable. For the reverse case, we will issue it only
-- if the variable is modified.
elsif Ekind (U_Ent) = E_Constant
and then Present (O_Ent)
and then not Overlays_Constant (U_Ent)
and then Address_Clause_Overlay_Warnings
then
Error_Msg_N ("??constant overlays a variable", Expr);
-- Imported variables can have an address clause, but then
-- the import is pretty meaningless except to suppress
-- initializations, so we do not need such variables to
-- be statically allocated (and in fact it causes trouble
-- if the address clause is a local value).
elsif Is_Imported (U_Ent) then
Set_Is_Statically_Allocated (U_Ent, False);
end if;
-- We mark a possible modification of a variable with an
-- address clause, since it is likely aliasing is occurring.
Note_Possible_Modification (Nam, Sure => False);
-- Legality checks on the address clause for initialized
-- objects is deferred until the freeze point, because
-- a subsequent pragma might indicate that the object
-- is imported and thus not initialized. Also, the address
-- clause might involve entities that have yet to be
-- elaborated.
Set_Has_Delayed_Freeze (U_Ent);
-- If an initialization call has been generated for this
-- object, it needs to be deferred to after the freeze node
-- we have just now added, otherwise GIGI will see a
-- reference to the variable (as actual to the IP call)
-- before its definition.
declare
Init_Call : constant Node_Id :=
Remove_Init_Call (U_Ent, N);
begin
if Present (Init_Call) then
Append_Freeze_Action (U_Ent, Init_Call);
-- Reset Initialization_Statements pointer so that
-- if there is a pragma Import further down, it can
-- clear any default initialization.
Set_Initialization_Statements (U_Ent, Init_Call);
end if;
end;
-- Entity has delayed freeze, so we will generate an
-- alignment check at the freeze point unless suppressed.
if not Range_Checks_Suppressed (U_Ent)
and then not Alignment_Checks_Suppressed (U_Ent)
then
Set_Check_Address_Alignment (N);
end if;
-- Kill the size check code, since we are not allocating
-- the variable, it is somewhere else.
Kill_Size_Check_Code (U_Ent);
end;
-- Not a valid entity for an address clause
else
Error_Msg_N ("address cannot be given for &", Nam);
end if;
end Address;
---------------
-- Alignment --
---------------
-- Alignment attribute definition clause
when Attribute_Alignment => Alignment : declare
Align : constant Uint := Get_Alignment_Value (Expr);
Max_Align : constant Uint := UI_From_Int (Maximum_Alignment);
begin
FOnly := True;
if not Is_Type (U_Ent)
and then Ekind (U_Ent) /= E_Variable
and then Ekind (U_Ent) /= E_Constant
then
Error_Msg_N ("alignment cannot be given for &", Nam);
elsif Duplicate_Clause then
null;
elsif Align /= No_Uint then
Set_Has_Alignment_Clause (U_Ent);
-- Tagged type case, check for attempt to set alignment to a
-- value greater than Max_Align, and reset if so. This error
-- is suppressed in ASIS mode to allow for different ASIS
-- back ends or ASIS-based tools to query the illegal clause.
if Is_Tagged_Type (U_Ent)
and then Align > Max_Align
and then not ASIS_Mode
then
Error_Msg_N
("alignment for & set to Maximum_Aligment??", Nam);
Set_Alignment (U_Ent, Max_Align);
-- All other cases
else
Set_Alignment (U_Ent, Align);
end if;
-- For an array type, U_Ent is the first subtype. In that case,
-- also set the alignment of the anonymous base type so that
-- other subtypes (such as the itypes for aggregates of the
-- type) also receive the expected alignment.
if Is_Array_Type (U_Ent) then
Set_Alignment (Base_Type (U_Ent), Align);
end if;
end if;
end Alignment;
---------------
-- Bit_Order --
---------------
-- Bit_Order attribute definition clause
when Attribute_Bit_Order =>
if not Is_Record_Type (U_Ent) then
Error_Msg_N
("Bit_Order can only be defined for record type", Nam);
elsif Duplicate_Clause then
null;
else
Analyze_And_Resolve (Expr, RTE (RE_Bit_Order));
if Etype (Expr) = Any_Type then
return;
elsif not Is_OK_Static_Expression (Expr) then
Flag_Non_Static_Expr
("Bit_Order requires static expression!", Expr);
else
if (Expr_Value (Expr) = 0) /= Bytes_Big_Endian then
Set_Reverse_Bit_Order (Base_Type (U_Ent), True);
end if;
end if;
end if;
--------------------
-- Component_Size --
--------------------
-- Component_Size attribute definition clause
when Attribute_Component_Size => Component_Size_Case : declare
Csize : constant Uint := Static_Integer (Expr);
Ctyp : Entity_Id;
Btype : Entity_Id;
Biased : Boolean;
New_Ctyp : Entity_Id;
Decl : Node_Id;
begin
if not Is_Array_Type (U_Ent) then
Error_Msg_N ("component size requires array type", Nam);
return;
end if;
Btype := Base_Type (U_Ent);
Ctyp := Component_Type (Btype);
if Duplicate_Clause then
null;
elsif Rep_Item_Too_Early (Btype, N) then
null;
elsif Csize /= No_Uint then
Check_Size (Expr, Ctyp, Csize, Biased);
-- For the biased case, build a declaration for a subtype that
-- will be used to represent the biased subtype that reflects
-- the biased representation of components. We need the subtype
-- to get proper conversions on referencing elements of the
-- array.
if Biased then
New_Ctyp :=
Make_Defining_Identifier (Loc,
Chars =>
New_External_Name (Chars (U_Ent), 'C', 0, 'T'));
Decl :=
Make_Subtype_Declaration (Loc,
Defining_Identifier => New_Ctyp,
Subtype_Indication =>
New_Occurrence_Of (Component_Type (Btype), Loc));
Set_Parent (Decl, N);
Analyze (Decl, Suppress => All_Checks);
Set_Has_Delayed_Freeze (New_Ctyp, False);
Set_Esize (New_Ctyp, Csize);
Set_RM_Size (New_Ctyp, Csize);
Init_Alignment (New_Ctyp);
Set_Is_Itype (New_Ctyp, True);
Set_Associated_Node_For_Itype (New_Ctyp, U_Ent);
Set_Component_Type (Btype, New_Ctyp);
Set_Biased (New_Ctyp, N, "component size clause");
end if;
Set_Component_Size (Btype, Csize);
-- Deal with warning on overridden size
if Warn_On_Overridden_Size
and then Has_Size_Clause (Ctyp)
and then RM_Size (Ctyp) /= Csize
then
Error_Msg_NE
("component size overrides size clause for&?S?", N, Ctyp);
end if;
Set_Has_Component_Size_Clause (Btype, True);
Set_Has_Non_Standard_Rep (Btype, True);
end if;
end Component_Size_Case;
-----------------------
-- Constant_Indexing --
-----------------------
when Attribute_Constant_Indexing =>
Check_Indexing_Functions;
---------
-- CPU --
---------
when Attribute_CPU =>
-- CPU attribute definition clause not allowed except from aspect
-- specification.
if From_Aspect_Specification (N) then
if not Is_Task_Type (U_Ent) then
Error_Msg_N ("CPU can only be defined for task", Nam);
elsif Duplicate_Clause then
null;
else
-- The expression must be analyzed in the special manner
-- described in "Handling of Default and Per-Object
-- Expressions" in sem.ads.
-- The visibility to the discriminants must be restored
Push_Scope_And_Install_Discriminants (U_Ent);
Preanalyze_Spec_Expression (Expr, RTE (RE_CPU_Range));
Uninstall_Discriminants_And_Pop_Scope (U_Ent);
if not Is_OK_Static_Expression (Expr) then
Check_Restriction (Static_Priorities, Expr);
end if;
end if;
else
Error_Msg_N
("attribute& cannot be set with definition clause", N);
end if;
----------------------
-- Default_Iterator --
----------------------
when Attribute_Default_Iterator => Default_Iterator : declare
Func : Entity_Id;
Typ : Entity_Id;
begin
-- If target type is untagged, further checks are irrelevant
if not Is_Tagged_Type (U_Ent) then
Error_Msg_N
("aspect Default_Iterator applies to tagged type", Nam);
return;
end if;
Check_Iterator_Functions;
Analyze (Expr);
if not Is_Entity_Name (Expr)
or else Ekind (Entity (Expr)) /= E_Function
then
Error_Msg_N ("aspect Iterator must be a function", Expr);
return;
else
Func := Entity (Expr);
end if;
-- The type of the first parameter must be T, T'class, or a
-- corresponding access type (5.5.1 (8/3). If function is
-- parameterless label type accordingly.
if No (First_Formal (Func)) then
Typ := Any_Type;
else
Typ := Etype (First_Formal (Func));
end if;
if Typ = U_Ent
or else Typ = Class_Wide_Type (U_Ent)
or else (Is_Access_Type (Typ)
and then Designated_Type (Typ) = U_Ent)
or else (Is_Access_Type (Typ)
and then Designated_Type (Typ) =
Class_Wide_Type (U_Ent))
then
null;
else
Error_Msg_NE
("Default Iterator must be a primitive of&", Func, U_Ent);
end if;
end Default_Iterator;
------------------------
-- Dispatching_Domain --
------------------------
when Attribute_Dispatching_Domain =>
-- Dispatching_Domain attribute definition clause not allowed
-- except from aspect specification.
if From_Aspect_Specification (N) then
if not Is_Task_Type (U_Ent) then
Error_Msg_N
("Dispatching_Domain can only be defined for task", Nam);
elsif Duplicate_Clause then
null;
else
-- The expression must be analyzed in the special manner
-- described in "Handling of Default and Per-Object
-- Expressions" in sem.ads.
-- The visibility to the discriminants must be restored
Push_Scope_And_Install_Discriminants (U_Ent);
Preanalyze_Spec_Expression
(Expr, RTE (RE_Dispatching_Domain));
Uninstall_Discriminants_And_Pop_Scope (U_Ent);
end if;
else
Error_Msg_N
("attribute& cannot be set with definition clause", N);
end if;
------------------
-- External_Tag --
------------------
when Attribute_External_Tag =>
if not Is_Tagged_Type (U_Ent) then
Error_Msg_N ("should be a tagged type", Nam);
end if;
if Duplicate_Clause then
null;
else
Analyze_And_Resolve (Expr, Standard_String);
if not Is_OK_Static_Expression (Expr) then
Flag_Non_Static_Expr
("static string required for tag name!", Nam);
end if;
if not Is_Library_Level_Entity (U_Ent) then
Error_Msg_NE
("??non-unique external tag supplied for &", N, U_Ent);
Error_Msg_N
("\??same external tag applies to all subprogram calls",
N);
Error_Msg_N
("\??corresponding internal tag cannot be obtained", N);
end if;
end if;
--------------------------
-- Implicit_Dereference --
--------------------------
when Attribute_Implicit_Dereference =>
-- Legality checks already performed at the point of the type
-- declaration, aspect is not delayed.
null;
-----------
-- Input --
-----------
when Attribute_Input =>
Analyze_Stream_TSS_Definition (TSS_Stream_Input);
Set_Has_Specified_Stream_Input (Ent);
------------------------
-- Interrupt_Priority --
------------------------
when Attribute_Interrupt_Priority =>
-- Interrupt_Priority attribute definition clause not allowed
-- except from aspect specification.
if From_Aspect_Specification (N) then
if not Is_Concurrent_Type (U_Ent) then
Error_Msg_N
("Interrupt_Priority can only be defined for task and "
& "protected object", Nam);
elsif Duplicate_Clause then
null;
else
-- The expression must be analyzed in the special manner
-- described in "Handling of Default and Per-Object
-- Expressions" in sem.ads.
-- The visibility to the discriminants must be restored
Push_Scope_And_Install_Discriminants (U_Ent);
Preanalyze_Spec_Expression
(Expr, RTE (RE_Interrupt_Priority));
Uninstall_Discriminants_And_Pop_Scope (U_Ent);
-- Check the No_Task_At_Interrupt_Priority restriction
if Is_Task_Type (U_Ent) then
Check_Restriction (No_Task_At_Interrupt_Priority, N);
end if;
end if;
else
Error_Msg_N
("attribute& cannot be set with definition clause", N);
end if;
--------------
-- Iterable --
--------------
when Attribute_Iterable =>
Analyze (Expr);
if Nkind (Expr) /= N_Aggregate then
Error_Msg_N ("aspect Iterable must be an aggregate", Expr);
end if;
declare
Assoc : Node_Id;
begin
Assoc := First (Component_Associations (Expr));
while Present (Assoc) loop
if not Is_Entity_Name (Expression (Assoc)) then
Error_Msg_N ("value must be a function", Assoc);
end if;
Next (Assoc);
end loop;
end;
----------------------
-- Iterator_Element --
----------------------
when Attribute_Iterator_Element =>
Analyze (Expr);
if not Is_Entity_Name (Expr)
or else not Is_Type (Entity (Expr))
then
Error_Msg_N ("aspect Iterator_Element must be a type", Expr);
end if;
-------------------
-- Machine_Radix --
-------------------
-- Machine radix attribute definition clause
when Attribute_Machine_Radix => Machine_Radix : declare
Radix : constant Uint := Static_Integer (Expr);
begin
if not Is_Decimal_Fixed_Point_Type (U_Ent) then
Error_Msg_N ("decimal fixed-point type expected for &", Nam);
elsif Duplicate_Clause then
null;
elsif Radix /= No_Uint then
Set_Has_Machine_Radix_Clause (U_Ent);
Set_Has_Non_Standard_Rep (Base_Type (U_Ent));
if Radix = 2 then
null;
elsif Radix = 10 then
Set_Machine_Radix_10 (U_Ent);
-- The following error is suppressed in ASIS mode to allow for
-- different ASIS back ends or ASIS-based tools to query the
-- illegal clause.
elsif not ASIS_Mode then
Error_Msg_N ("machine radix value must be 2 or 10", Expr);
end if;
end if;
end Machine_Radix;
-----------------
-- Object_Size --
-----------------
-- Object_Size attribute definition clause
when Attribute_Object_Size => Object_Size : declare
Size : constant Uint := Static_Integer (Expr);
Biased : Boolean;
pragma Warnings (Off, Biased);
begin
if not Is_Type (U_Ent) then
Error_Msg_N ("Object_Size cannot be given for &", Nam);
elsif Duplicate_Clause then
null;
else
Check_Size (Expr, U_Ent, Size, Biased);
-- The following errors are suppressed in ASIS mode to allow
-- for different ASIS back ends or ASIS-based tools to query
-- the illegal clause.
if ASIS_Mode then
null;
elsif Is_Scalar_Type (U_Ent) then
if Size /= 8 and then Size /= 16 and then Size /= 32
and then UI_Mod (Size, 64) /= 0
then
Error_Msg_N
("Object_Size must be 8, 16, 32, or multiple of 64",
Expr);
end if;
elsif Size mod 8 /= 0 then
Error_Msg_N ("Object_Size must be a multiple of 8", Expr);
end if;
Set_Esize (U_Ent, Size);
Set_Has_Object_Size_Clause (U_Ent);
Alignment_Check_For_Size_Change (U_Ent, Size);
end if;
end Object_Size;
------------
-- Output --
------------
when Attribute_Output =>
Analyze_Stream_TSS_Definition (TSS_Stream_Output);
Set_Has_Specified_Stream_Output (Ent);
--------------
-- Priority --
--------------
when Attribute_Priority =>
-- Priority attribute definition clause not allowed except from
-- aspect specification.
if From_Aspect_Specification (N) then
if not (Is_Concurrent_Type (U_Ent)
or else Ekind (U_Ent) = E_Procedure)
then
Error_Msg_N
("Priority can only be defined for task and protected "
& "object", Nam);
elsif Duplicate_Clause then
null;
else
-- The expression must be analyzed in the special manner
-- described in "Handling of Default and Per-Object
-- Expressions" in sem.ads.
-- The visibility to the discriminants must be restored
Push_Scope_And_Install_Discriminants (U_Ent);
Preanalyze_Spec_Expression (Expr, Standard_Integer);
Uninstall_Discriminants_And_Pop_Scope (U_Ent);
if not Is_OK_Static_Expression (Expr) then
Check_Restriction (Static_Priorities, Expr);
end if;
end if;
else
Error_Msg_N
("attribute& cannot be set with definition clause", N);
end if;
----------
-- Read --
----------
when Attribute_Read =>
Analyze_Stream_TSS_Definition (TSS_Stream_Read);
Set_Has_Specified_Stream_Read (Ent);
--------------------------
-- Scalar_Storage_Order --
--------------------------
-- Scalar_Storage_Order attribute definition clause
when Attribute_Scalar_Storage_Order =>
if not (Is_Record_Type (U_Ent) or else Is_Array_Type (U_Ent)) then
Error_Msg_N
("Scalar_Storage_Order can only be defined for record or "
& "array type", Nam);
elsif Duplicate_Clause then
null;
else
Analyze_And_Resolve (Expr, RTE (RE_Bit_Order));
if Etype (Expr) = Any_Type then
return;
elsif not Is_OK_Static_Expression (Expr) then
Flag_Non_Static_Expr
("Scalar_Storage_Order requires static expression!", Expr);
elsif (Expr_Value (Expr) = 0) /= Bytes_Big_Endian then
-- Here for the case of a non-default (i.e. non-confirming)
-- Scalar_Storage_Order attribute definition.
if Support_Nondefault_SSO_On_Target then
Set_Reverse_Storage_Order (Base_Type (U_Ent), True);
else
Error_Msg_N
("non-default Scalar_Storage_Order not supported on "
& "target", Expr);
end if;
end if;
-- Clear SSO default indications since explicit setting of the
-- order overrides the defaults.
Set_SSO_Set_Low_By_Default (Base_Type (U_Ent), False);
Set_SSO_Set_High_By_Default (Base_Type (U_Ent), False);
end if;
--------------------------
-- Secondary_Stack_Size --
--------------------------
when Attribute_Secondary_Stack_Size =>
-- Secondary_Stack_Size attribute definition clause not allowed
-- except from aspect specification.
if From_Aspect_Specification (N) then
if not Is_Task_Type (U_Ent) then
Error_Msg_N
("Secondary Stack Size can only be defined for task", Nam);
elsif Duplicate_Clause then
null;
else
Check_Restriction (No_Secondary_Stack, Expr);
-- The expression must be analyzed in the special manner
-- described in "Handling of Default and Per-Object
-- Expressions" in sem.ads.
-- The visibility to the discriminants must be restored
Push_Scope_And_Install_Discriminants (U_Ent);
Preanalyze_Spec_Expression (Expr, Any_Integer);
Uninstall_Discriminants_And_Pop_Scope (U_Ent);
if not Is_OK_Static_Expression (Expr) then
Check_Restriction (Static_Storage_Size, Expr);
end if;
end if;
else
Error_Msg_N
("attribute& cannot be set with definition clause", N);
end if;
----------
-- Size --
----------
-- Size attribute definition clause
when Attribute_Size => Size : declare
Size : constant Uint := Static_Integer (Expr);
Etyp : Entity_Id;
Biased : Boolean;
begin
FOnly := True;
if Duplicate_Clause then
null;
elsif not Is_Type (U_Ent)
and then Ekind (U_Ent) /= E_Variable
and then Ekind (U_Ent) /= E_Constant
then
Error_Msg_N ("size cannot be given for &", Nam);
elsif Is_Array_Type (U_Ent)
and then not Is_Constrained (U_Ent)
then
Error_Msg_N
("size cannot be given for unconstrained array", Nam);
elsif Size /= No_Uint then
if Is_Type (U_Ent) then
Etyp := U_Ent;
else
Etyp := Etype (U_Ent);
end if;
-- Check size, note that Gigi is in charge of checking that the
-- size of an array or record type is OK. Also we do not check
-- the size in the ordinary fixed-point case, since it is too
-- early to do so (there may be subsequent small clause that
-- affects the size). We can check the size if a small clause
-- has already been given.
if not Is_Ordinary_Fixed_Point_Type (U_Ent)
or else Has_Small_Clause (U_Ent)
then
Check_Size (Expr, Etyp, Size, Biased);
Set_Biased (U_Ent, N, "size clause", Biased);
end if;
-- For types set RM_Size and Esize if possible
if Is_Type (U_Ent) then
Set_RM_Size (U_Ent, Size);
-- For elementary types, increase Object_Size to power of 2,
-- but not less than a storage unit in any case (normally
-- this means it will be byte addressable).
-- For all other types, nothing else to do, we leave Esize
-- (object size) unset, the back end will set it from the
-- size and alignment in an appropriate manner.
-- In both cases, we check whether the alignment must be
-- reset in the wake of the size change.
if Is_Elementary_Type (U_Ent) then
if Size <= System_Storage_Unit then
Init_Esize (U_Ent, System_Storage_Unit);
elsif Size <= 16 then
Init_Esize (U_Ent, 16);
elsif Size <= 32 then
Init_Esize (U_Ent, 32);
else
Set_Esize (U_Ent, (Size + 63) / 64 * 64);
end if;
Alignment_Check_For_Size_Change (U_Ent, Esize (U_Ent));
else
Alignment_Check_For_Size_Change (U_Ent, Size);
end if;
-- For objects, set Esize only
else
-- The following error is suppressed in ASIS mode to allow
-- for different ASIS back ends or ASIS-based tools to query
-- the illegal clause.
if Is_Elementary_Type (Etyp)
and then Size /= System_Storage_Unit
and then Size /= System_Storage_Unit * 2
and then Size /= System_Storage_Unit * 4
and then Size /= System_Storage_Unit * 8
and then not ASIS_Mode
then
Error_Msg_Uint_1 := UI_From_Int (System_Storage_Unit);
Error_Msg_Uint_2 := Error_Msg_Uint_1 * 8;
Error_Msg_N
("size for primitive object must be a power of 2 in "
& "the range ^-^", N);
end if;
Set_Esize (U_Ent, Size);
end if;
Set_Has_Size_Clause (U_Ent);
end if;
end Size;
-----------
-- Small --
-----------
-- Small attribute definition clause
when Attribute_Small => Small : declare
Implicit_Base : constant Entity_Id := Base_Type (U_Ent);
Small : Ureal;
begin
Analyze_And_Resolve (Expr, Any_Real);
if Etype (Expr) = Any_Type then
return;
elsif not Is_OK_Static_Expression (Expr) then
Flag_Non_Static_Expr
("small requires static expression!", Expr);
return;
else
Small := Expr_Value_R (Expr);
if Small <= Ureal_0 then
Error_Msg_N ("small value must be greater than zero", Expr);
return;
end if;
end if;
if not Is_Ordinary_Fixed_Point_Type (U_Ent) then
Error_Msg_N
("small requires an ordinary fixed point type", Nam);
elsif Has_Small_Clause (U_Ent) then
Error_Msg_N ("small already given for &", Nam);
elsif Small > Delta_Value (U_Ent) then
Error_Msg_N
("small value must not be greater than delta value", Nam);
else
Set_Small_Value (U_Ent, Small);
Set_Small_Value (Implicit_Base, Small);
Set_Has_Small_Clause (U_Ent);
Set_Has_Small_Clause (Implicit_Base);
Set_Has_Non_Standard_Rep (Implicit_Base);
end if;
end Small;
------------------
-- Storage_Pool --
------------------
-- Storage_Pool attribute definition clause
when Attribute_Simple_Storage_Pool
| Attribute_Storage_Pool
=>
Storage_Pool : declare
Pool : Entity_Id;
T : Entity_Id;
begin
if Ekind (U_Ent) = E_Access_Subprogram_Type then
Error_Msg_N
("storage pool cannot be given for access-to-subprogram type",
Nam);
return;
elsif not Ekind_In (U_Ent, E_Access_Type, E_General_Access_Type)
then
Error_Msg_N
("storage pool can only be given for access types", Nam);
return;
elsif Is_Derived_Type (U_Ent) then
Error_Msg_N
("storage pool cannot be given for a derived access type",
Nam);
elsif Duplicate_Clause then
return;
elsif Present (Associated_Storage_Pool (U_Ent)) then
Error_Msg_N ("storage pool already given for &", Nam);
return;
end if;
-- Check for Storage_Size previously given
declare
SS : constant Node_Id :=
Get_Attribute_Definition_Clause
(U_Ent, Attribute_Storage_Size);
begin
if Present (SS) then
Check_Pool_Size_Clash (U_Ent, N, SS);
end if;
end;
-- Storage_Pool case
if Id = Attribute_Storage_Pool then
Analyze_And_Resolve
(Expr, Class_Wide_Type (RTE (RE_Root_Storage_Pool)));
-- In the Simple_Storage_Pool case, we allow a variable of any
-- simple storage pool type, so we Resolve without imposing an
-- expected type.
else
Analyze_And_Resolve (Expr);
if not Present (Get_Rep_Pragma
(Etype (Expr), Name_Simple_Storage_Pool_Type))
then
Error_Msg_N
("expression must be of a simple storage pool type", Expr);
end if;
end if;
if not Denotes_Variable (Expr) then
Error_Msg_N ("storage pool must be a variable", Expr);
return;
end if;
if Nkind (Expr) = N_Type_Conversion then
T := Etype (Expression (Expr));
else
T := Etype (Expr);
end if;
-- The Stack_Bounded_Pool is used internally for implementing
-- access types with a Storage_Size. Since it only work properly
-- when used on one specific type, we need to check that it is not
-- hijacked improperly:
-- type T is access Integer;
-- for T'Storage_Size use n;
-- type Q is access Float;
-- for Q'Storage_Size use T'Storage_Size; -- incorrect
if RTE_Available (RE_Stack_Bounded_Pool)
and then Base_Type (T) = RTE (RE_Stack_Bounded_Pool)
then
Error_Msg_N ("non-shareable internal Pool", Expr);
return;
end if;
-- If the argument is a name that is not an entity name, then
-- we construct a renaming operation to define an entity of
-- type storage pool.
if not Is_Entity_Name (Expr)
and then Is_Object_Reference (Expr)
then
Pool := Make_Temporary (Loc, 'P', Expr);
declare
Rnode : constant Node_Id :=
Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Pool,
Subtype_Mark =>
New_Occurrence_Of (Etype (Expr), Loc),
Name => Expr);
begin
-- If the attribute definition clause comes from an aspect
-- clause, then insert the renaming before the associated
-- entity's declaration, since the attribute clause has
-- not yet been appended to the declaration list.
if From_Aspect_Specification (N) then
Insert_Before (Parent (Entity (N)), Rnode);
else
Insert_Before (N, Rnode);
end if;
Analyze (Rnode);
Set_Associated_Storage_Pool (U_Ent, Pool);
end;
elsif Is_Entity_Name (Expr) then
Pool := Entity (Expr);
-- If pool is a renamed object, get original one. This can
-- happen with an explicit renaming, and within instances.
while Present (Renamed_Object (Pool))
and then Is_Entity_Name (Renamed_Object (Pool))
loop
Pool := Entity (Renamed_Object (Pool));
end loop;
if Present (Renamed_Object (Pool))
and then Nkind (Renamed_Object (Pool)) = N_Type_Conversion
and then Is_Entity_Name (Expression (Renamed_Object (Pool)))
then
Pool := Entity (Expression (Renamed_Object (Pool)));
end if;
Set_Associated_Storage_Pool (U_Ent, Pool);
elsif Nkind (Expr) = N_Type_Conversion
and then Is_Entity_Name (Expression (Expr))
and then Nkind (Original_Node (Expr)) = N_Attribute_Reference
then
Pool := Entity (Expression (Expr));
Set_Associated_Storage_Pool (U_Ent, Pool);
else
Error_Msg_N ("incorrect reference to a Storage Pool", Expr);
return;
end if;
end Storage_Pool;
------------------
-- Storage_Size --
------------------
-- Storage_Size attribute definition clause
when Attribute_Storage_Size => Storage_Size : declare
Btype : constant Entity_Id := Base_Type (U_Ent);
begin
if Is_Task_Type (U_Ent) then
-- Check obsolescent (but never obsolescent if from aspect)
if not From_Aspect_Specification (N) then
Check_Restriction (No_Obsolescent_Features, N);
if Warn_On_Obsolescent_Feature then
Error_Msg_N
("?j?storage size clause for task is an obsolescent "
& "feature (RM J.9)", N);
Error_Msg_N ("\?j?use Storage_Size pragma instead", N);
end if;
end if;
FOnly := True;
end if;
if not Is_Access_Type (U_Ent)
and then Ekind (U_Ent) /= E_Task_Type
then
Error_Msg_N ("storage size cannot be given for &", Nam);
elsif Is_Access_Type (U_Ent) and Is_Derived_Type (U_Ent) then
Error_Msg_N
("storage size cannot be given for a derived access type",
Nam);
elsif Duplicate_Clause then
null;
else
Analyze_And_Resolve (Expr, Any_Integer);
if Is_Access_Type (U_Ent) then
-- Check for Storage_Pool previously given
declare
SP : constant Node_Id :=
Get_Attribute_Definition_Clause
(U_Ent, Attribute_Storage_Pool);
begin
if Present (SP) then
Check_Pool_Size_Clash (U_Ent, SP, N);
end if;
end;
-- Special case of for x'Storage_Size use 0
if Is_OK_Static_Expression (Expr)
and then Expr_Value (Expr) = 0
then
Set_No_Pool_Assigned (Btype);
end if;
end if;
Set_Has_Storage_Size_Clause (Btype);
end if;
end Storage_Size;
-----------------
-- Stream_Size --
-----------------
when Attribute_Stream_Size => Stream_Size : declare
Size : constant Uint := Static_Integer (Expr);
begin
if Ada_Version <= Ada_95 then
Check_Restriction (No_Implementation_Attributes, N);
end if;
if Duplicate_Clause then
null;
elsif Is_Elementary_Type (U_Ent) then
-- The following errors are suppressed in ASIS mode to allow
-- for different ASIS back ends or ASIS-based tools to query
-- the illegal clause.
if ASIS_Mode then
null;
elsif Size /= System_Storage_Unit
and then Size /= System_Storage_Unit * 2
and then Size /= System_Storage_Unit * 4
and then Size /= System_Storage_Unit * 8
then
Error_Msg_Uint_1 := UI_From_Int (System_Storage_Unit);
Error_Msg_N
("stream size for elementary type must be a power of 2 "
& "and at least ^", N);
elsif RM_Size (U_Ent) > Size then
Error_Msg_Uint_1 := RM_Size (U_Ent);
Error_Msg_N
("stream size for elementary type must be a power of 2 "
& "and at least ^", N);
end if;
Set_Has_Stream_Size_Clause (U_Ent);
else
Error_Msg_N ("Stream_Size cannot be given for &", Nam);
end if;
end Stream_Size;
----------------
-- Value_Size --
----------------
-- Value_Size attribute definition clause
when Attribute_Value_Size => Value_Size : declare
Size : constant Uint := Static_Integer (Expr);
Biased : Boolean;
begin
if not Is_Type (U_Ent) then
Error_Msg_N ("Value_Size cannot be given for &", Nam);
elsif Duplicate_Clause then
null;
elsif Is_Array_Type (U_Ent)
and then not Is_Constrained (U_Ent)
then
Error_Msg_N
("Value_Size cannot be given for unconstrained array", Nam);
else
if Is_Elementary_Type (U_Ent) then
Check_Size (Expr, U_Ent, Size, Biased);
Set_Biased (U_Ent, N, "value size clause", Biased);
end if;
Set_RM_Size (U_Ent, Size);
end if;
end Value_Size;
-----------------------
-- Variable_Indexing --
-----------------------
when Attribute_Variable_Indexing =>
Check_Indexing_Functions;
-----------
-- Write --
-----------
when Attribute_Write =>
Analyze_Stream_TSS_Definition (TSS_Stream_Write);
Set_Has_Specified_Stream_Write (Ent);
-- All other attributes cannot be set
when others =>
Error_Msg_N
("attribute& cannot be set with definition clause", N);
end case;
-- The test for the type being frozen must be performed after any
-- expression the clause has been analyzed since the expression itself
-- might cause freezing that makes the clause illegal.
if Rep_Item_Too_Late (U_Ent, N, FOnly) then
return;
end if;
end Analyze_Attribute_Definition_Clause;
----------------------------
-- Analyze_Code_Statement --
----------------------------
procedure Analyze_Code_Statement (N : Node_Id) is
HSS : constant Node_Id := Parent (N);
SBody : constant Node_Id := Parent (HSS);
Subp : constant Entity_Id := Current_Scope;
Stmt : Node_Id;
Decl : Node_Id;
StmtO : Node_Id;
DeclO : Node_Id;
begin
-- Accept foreign code statements for CodePeer. The analysis is skipped
-- to avoid rejecting unrecognized constructs.
if CodePeer_Mode then
Set_Analyzed (N);
return;
end if;
-- Analyze and check we get right type, note that this implements the
-- requirement (RM 13.8(1)) that Machine_Code be with'ed, since that is
-- the only way that Asm_Insn could possibly be visible.
Analyze_And_Resolve (Expression (N));
if Etype (Expression (N)) = Any_Type then
return;
elsif Etype (Expression (N)) /= RTE (RE_Asm_Insn) then
Error_Msg_N ("incorrect type for code statement", N);
return;
end if;
Check_Code_Statement (N);
-- Make sure we appear in the handled statement sequence of a subprogram
-- (RM 13.8(3)).
if Nkind (HSS) /= N_Handled_Sequence_Of_Statements
or else Nkind (SBody) /= N_Subprogram_Body
then
Error_Msg_N
("code statement can only appear in body of subprogram", N);
return;
end if;
-- Do remaining checks (RM 13.8(3)) if not already done
if not Is_Machine_Code_Subprogram (Subp) then
Set_Is_Machine_Code_Subprogram (Subp);
-- No exception handlers allowed
if Present (Exception_Handlers (HSS)) then
Error_Msg_N
("exception handlers not permitted in machine code subprogram",
First (Exception_Handlers (HSS)));
end if;
-- No declarations other than use clauses and pragmas (we allow
-- certain internally generated declarations as well).
Decl := First (Declarations (SBody));
while Present (Decl) loop
DeclO := Original_Node (Decl);
if Comes_From_Source (DeclO)
and not Nkind_In (DeclO, N_Pragma,
N_Use_Package_Clause,
N_Use_Type_Clause,
N_Implicit_Label_Declaration)
then
Error_Msg_N
("this declaration not allowed in machine code subprogram",
DeclO);
end if;
Next (Decl);
end loop;
-- No statements other than code statements, pragmas, and labels.
-- Again we allow certain internally generated statements.
-- In Ada 2012, qualified expressions are names, and the code
-- statement is initially parsed as a procedure call.
Stmt := First (Statements (HSS));
while Present (Stmt) loop
StmtO := Original_Node (Stmt);
-- A procedure call transformed into a code statement is OK
if Ada_Version >= Ada_2012
and then Nkind (StmtO) = N_Procedure_Call_Statement
and then Nkind (Name (StmtO)) = N_Qualified_Expression
then
null;
elsif Comes_From_Source (StmtO)
and then not Nkind_In (StmtO, N_Pragma,
N_Label,
N_Code_Statement)
then
Error_Msg_N
("this statement is not allowed in machine code subprogram",
StmtO);
end if;
Next (Stmt);
end loop;
end if;
end Analyze_Code_Statement;
-----------------------------------------------
-- Analyze_Enumeration_Representation_Clause --
-----------------------------------------------
procedure Analyze_Enumeration_Representation_Clause (N : Node_Id) is
Ident : constant Node_Id := Identifier (N);
Aggr : constant Node_Id := Array_Aggregate (N);
Enumtype : Entity_Id;
Elit : Entity_Id;
Expr : Node_Id;
Assoc : Node_Id;
Choice : Node_Id;
Val : Uint;
Err : Boolean := False;
-- Set True to avoid cascade errors and crashes on incorrect source code
Lo : constant Uint := Expr_Value (Type_Low_Bound (Universal_Integer));
Hi : constant Uint := Expr_Value (Type_High_Bound (Universal_Integer));
-- Allowed range of universal integer (= allowed range of enum lit vals)
Min : Uint;
Max : Uint;
-- Minimum and maximum values of entries
Max_Node : Node_Id;
-- Pointer to node for literal providing max value
begin
if Ignore_Rep_Clauses then
Kill_Rep_Clause (N);
return;
end if;
-- Ignore enumeration rep clauses by default in CodePeer mode,
-- unless -gnatd.I is specified, as a work around for potential false
-- positive messages.
if CodePeer_Mode and not Debug_Flag_Dot_II then
return;
end if;
-- First some basic error checks
Find_Type (Ident);
Enumtype := Entity (Ident);
if Enumtype = Any_Type
or else Rep_Item_Too_Early (Enumtype, N)
then
return;
else
Enumtype := Underlying_Type (Enumtype);
end if;
if not Is_Enumeration_Type (Enumtype) then
Error_Msg_NE
("enumeration type required, found}",
Ident, First_Subtype (Enumtype));
return;
end if;
-- Ignore rep clause on generic actual type. This will already have
-- been flagged on the template as an error, and this is the safest
-- way to ensure we don't get a junk cascaded message in the instance.
if Is_Generic_Actual_Type (Enumtype) then
return;
-- Type must be in current scope
elsif Scope (Enumtype) /= Current_Scope then
Error_Msg_N ("type must be declared in this scope", Ident);
return;
-- Type must be a first subtype
elsif not Is_First_Subtype (Enumtype) then
Error_Msg_N ("cannot give enumeration rep clause for subtype", N);
return;
-- Ignore duplicate rep clause
elsif Has_Enumeration_Rep_Clause (Enumtype) then
Error_Msg_N ("duplicate enumeration rep clause ignored", N);
return;
-- Don't allow rep clause for standard [wide_[wide_]]character
elsif Is_Standard_Character_Type (Enumtype) then
Error_Msg_N ("enumeration rep clause not allowed for this type", N);
return;
-- Check that the expression is a proper aggregate (no parentheses)
elsif Paren_Count (Aggr) /= 0 then
Error_Msg
("extra parentheses surrounding aggregate not allowed",
First_Sloc (Aggr));
return;
-- All tests passed, so set rep clause in place
else
Set_Has_Enumeration_Rep_Clause (Enumtype);
Set_Has_Enumeration_Rep_Clause (Base_Type (Enumtype));
end if;
-- Now we process the aggregate. Note that we don't use the normal
-- aggregate code for this purpose, because we don't want any of the
-- normal expansion activities, and a number of special semantic
-- rules apply (including the component type being any integer type)
Elit := First_Literal (Enumtype);
-- First the positional entries if any
if Present (Expressions (Aggr)) then
Expr := First (Expressions (Aggr));
while Present (Expr) loop
if No (Elit) then
Error_Msg_N ("too many entries in aggregate", Expr);
return;
end if;
Val := Static_Integer (Expr);
-- Err signals that we found some incorrect entries processing
-- the list. The final checks for completeness and ordering are
-- skipped in this case.
if Val = No_Uint then
Err := True;
elsif Val < Lo or else Hi < Val then
Error_Msg_N ("value outside permitted range", Expr);
Err := True;
end if;
Set_Enumeration_Rep (Elit, Val);
Set_Enumeration_Rep_Expr (Elit, Expr);
Next (Expr);
Next (Elit);
end loop;
end if;
-- Now process the named entries if present
if Present (Component_Associations (Aggr)) then
Assoc := First (Component_Associations (Aggr));
while Present (Assoc) loop
Choice := First (Choices (Assoc));
if Present (Next (Choice)) then
Error_Msg_N
("multiple choice not allowed here", Next (Choice));
Err := True;
end if;
if Nkind (Choice) = N_Others_Choice then
Error_Msg_N ("others choice not allowed here", Choice);
Err := True;
elsif Nkind (Choice) = N_Range then
-- ??? should allow zero/one element range here
Error_Msg_N ("range not allowed here", Choice);
Err := True;
else
Analyze_And_Resolve (Choice, Enumtype);
if Error_Posted (Choice) then
Err := True;
end if;
if not Err then
if Is_Entity_Name (Choice)
and then Is_Type (Entity (Choice))
then
Error_Msg_N ("subtype name not allowed here", Choice);
Err := True;
-- ??? should allow static subtype with zero/one entry
elsif Etype (Choice) = Base_Type (Enumtype) then
if not Is_OK_Static_Expression (Choice) then
Flag_Non_Static_Expr
("non-static expression used for choice!", Choice);
Err := True;
else
Elit := Expr_Value_E (Choice);
if Present (Enumeration_Rep_Expr (Elit)) then
Error_Msg_Sloc :=
Sloc (Enumeration_Rep_Expr (Elit));
Error_Msg_NE
("representation for& previously given#",
Choice, Elit);
Err := True;
end if;
Set_Enumeration_Rep_Expr (Elit, Expression (Assoc));
Expr := Expression (Assoc);
Val := Static_Integer (Expr);
if Val = No_Uint then
Err := True;
elsif Val < Lo or else Hi < Val then
Error_Msg_N ("value outside permitted range", Expr);
Err := True;
end if;
Set_Enumeration_Rep (Elit, Val);
end if;
end if;
end if;
end if;
Next (Assoc);
end loop;
end if;
-- Aggregate is fully processed. Now we check that a full set of
-- representations was given, and that they are in range and in order.
-- These checks are only done if no other errors occurred.
if not Err then
Min := No_Uint;
Max := No_Uint;
Elit := First_Literal (Enumtype);
while Present (Elit) loop
if No (Enumeration_Rep_Expr (Elit)) then
Error_Msg_NE ("missing representation for&!", N, Elit);
else
Val := Enumeration_Rep (Elit);
if Min = No_Uint then
Min := Val;
end if;
if Val /= No_Uint then
if Max /= No_Uint and then Val <= Max then
Error_Msg_NE
("enumeration value for& not ordered!",
Enumeration_Rep_Expr (Elit), Elit);
end if;
Max_Node := Enumeration_Rep_Expr (Elit);
Max := Val;
end if;
-- If there is at least one literal whose representation is not
-- equal to the Pos value, then note that this enumeration type
-- has a non-standard representation.
if Val /= Enumeration_Pos (Elit) then
Set_Has_Non_Standard_Rep (Base_Type (Enumtype));
end if;
end if;
Next (Elit);
end loop;
-- Now set proper size information
declare
Minsize : Uint := UI_From_Int (Minimum_Size (Enumtype));
begin
if Has_Size_Clause (Enumtype) then
-- All OK, if size is OK now
if RM_Size (Enumtype) >= Minsize then
null;
else
-- Try if we can get by with biasing
Minsize :=
UI_From_Int (Minimum_Size (Enumtype, Biased => True));
-- Error message if even biasing does not work
if RM_Size (Enumtype) < Minsize then
Error_Msg_Uint_1 := RM_Size (Enumtype);
Error_Msg_Uint_2 := Max;
Error_Msg_N
("previously given size (^) is too small "
& "for this value (^)", Max_Node);
-- If biasing worked, indicate that we now have biased rep
else
Set_Biased
(Enumtype, Size_Clause (Enumtype), "size clause");
end if;
end if;
else
Set_RM_Size (Enumtype, Minsize);
Set_Enum_Esize (Enumtype);
end if;
Set_RM_Size (Base_Type (Enumtype), RM_Size (Enumtype));
Set_Esize (Base_Type (Enumtype), Esize (Enumtype));
Set_Alignment (Base_Type (Enumtype), Alignment (Enumtype));
end;
end if;
-- We repeat the too late test in case it froze itself
if Rep_Item_Too_Late (Enumtype, N) then
null;
end if;
end Analyze_Enumeration_Representation_Clause;
----------------------------
-- Analyze_Free_Statement --
----------------------------
procedure Analyze_Free_Statement (N : Node_Id) is
begin
Analyze (Expression (N));
end Analyze_Free_Statement;
---------------------------
-- Analyze_Freeze_Entity --
---------------------------
procedure Analyze_Freeze_Entity (N : Node_Id) is
begin
Freeze_Entity_Checks (N);
end Analyze_Freeze_Entity;
-----------------------------------
-- Analyze_Freeze_Generic_Entity --
-----------------------------------
procedure Analyze_Freeze_Generic_Entity (N : Node_Id) is
E : constant Entity_Id := Entity (N);
begin
if not Is_Frozen (E) and then Has_Delayed_Aspects (E) then
Analyze_Aspects_At_Freeze_Point (E);
end if;
Freeze_Entity_Checks (N);
end Analyze_Freeze_Generic_Entity;
------------------------------------------
-- Analyze_Record_Representation_Clause --
------------------------------------------
-- Note: we check as much as we can here, but we can't do any checks
-- based on the position values (e.g. overlap checks) until freeze time
-- because especially in Ada 2005 (machine scalar mode), the processing
-- for non-standard bit order can substantially change the positions.
-- See procedure Check_Record_Representation_Clause (called from Freeze)
-- for the remainder of this processing.
procedure Analyze_Record_Representation_Clause (N : Node_Id) is
Ident : constant Node_Id := Identifier (N);
Biased : Boolean;
CC : Node_Id;
Comp : Entity_Id;
Fbit : Uint;
Hbit : Uint := Uint_0;
Lbit : Uint;
Ocomp : Entity_Id;
Posit : Uint;
Rectype : Entity_Id;
Recdef : Node_Id;
function Is_Inherited (Comp : Entity_Id) return Boolean;
-- True if Comp is an inherited component in a record extension
------------------
-- Is_Inherited --
------------------
function Is_Inherited (Comp : Entity_Id) return Boolean is
Comp_Base : Entity_Id;
begin
if Ekind (Rectype) = E_Record_Subtype then
Comp_Base := Original_Record_Component (Comp);
else
Comp_Base := Comp;
end if;
return Comp_Base /= Original_Record_Component (Comp_Base);
end Is_Inherited;
-- Local variables
Is_Record_Extension : Boolean;
-- True if Rectype is a record extension
CR_Pragma : Node_Id := Empty;
-- Points to N_Pragma node if Complete_Representation pragma present
-- Start of processing for Analyze_Record_Representation_Clause
begin
if Ignore_Rep_Clauses then
Kill_Rep_Clause (N);
return;
end if;
Find_Type (Ident);
Rectype := Entity (Ident);
if Rectype = Any_Type or else Rep_Item_Too_Early (Rectype, N) then
return;
else
Rectype := Underlying_Type (Rectype);
end if;
-- First some basic error checks
if not Is_Record_Type (Rectype) then
Error_Msg_NE
("record type required, found}", Ident, First_Subtype (Rectype));
return;
elsif Scope (Rectype) /= Current_Scope then
Error_Msg_N ("type must be declared in this scope", N);
return;
elsif not Is_First_Subtype (Rectype) then
Error_Msg_N ("cannot give record rep clause for subtype", N);
return;
elsif Has_Record_Rep_Clause (Rectype) then
Error_Msg_N ("duplicate record rep clause ignored", N);
return;
elsif Rep_Item_Too_Late (Rectype, N) then
return;
end if;
-- We know we have a first subtype, now possibly go to the anonymous
-- base type to determine whether Rectype is a record extension.
Recdef := Type_Definition (Declaration_Node (Base_Type (Rectype)));
Is_Record_Extension :=
Nkind (Recdef) = N_Derived_Type_Definition
and then Present (Record_Extension_Part (Recdef));
if Present (Mod_Clause (N)) then
declare
Loc : constant Source_Ptr := Sloc (N);
M : constant Node_Id := Mod_Clause (N);
P : constant List_Id := Pragmas_Before (M);
AtM_Nod : Node_Id;
Mod_Val : Uint;
pragma Warnings (Off, Mod_Val);
begin
Check_Restriction (No_Obsolescent_Features, Mod_Clause (N));
if Warn_On_Obsolescent_Feature then
Error_Msg_N
("?j?mod clause is an obsolescent feature (RM J.8)", N);
Error_Msg_N
("\?j?use alignment attribute definition clause instead", N);
end if;
if Present (P) then
Analyze_List (P);
end if;
-- In ASIS_Mode mode, expansion is disabled, but we must convert
-- the Mod clause into an alignment clause anyway, so that the
-- back end can compute and back-annotate properly the size and
-- alignment of types that may include this record.
-- This seems dubious, this destroys the source tree in a manner
-- not detectable by ASIS ???
if Operating_Mode = Check_Semantics and then ASIS_Mode then
AtM_Nod :=
Make_Attribute_Definition_Clause (Loc,
Name => New_Occurrence_Of (Base_Type (Rectype), Loc),
Chars => Name_Alignment,
Expression => Relocate_Node (Expression (M)));
Set_From_At_Mod (AtM_Nod);
Insert_After (N, AtM_Nod);
Mod_Val := Get_Alignment_Value (Expression (AtM_Nod));
Set_Mod_Clause (N, Empty);
else
-- Get the alignment value to perform error checking
Mod_Val := Get_Alignment_Value (Expression (M));
end if;
end;
end if;
-- For untagged types, clear any existing component clauses for the
-- type. If the type is derived, this is what allows us to override
-- a rep clause for the parent. For type extensions, the representation
-- of the inherited components is inherited, so we want to keep previous
-- component clauses for completeness.
if not Is_Tagged_Type (Rectype) then
Comp := First_Component_Or_Discriminant (Rectype);
while Present (Comp) loop
Set_Component_Clause (Comp, Empty);
Next_Component_Or_Discriminant (Comp);
end loop;
end if;
-- All done if no component clauses
CC := First (Component_Clauses (N));
if No (CC) then
return;
end if;
-- A representation like this applies to the base type
Set_Has_Record_Rep_Clause (Base_Type (Rectype));
Set_Has_Non_Standard_Rep (Base_Type (Rectype));
Set_Has_Specified_Layout (Base_Type (Rectype));
-- Process the component clauses
while Present (CC) loop
-- Pragma
if Nkind (CC) = N_Pragma then
Analyze (CC);
-- The only pragma of interest is Complete_Representation
if Pragma_Name (CC) = Name_Complete_Representation then
CR_Pragma := CC;
end if;
-- Processing for real component clause
else
Posit := Static_Integer (Position (CC));
Fbit := Static_Integer (First_Bit (CC));
Lbit := Static_Integer (Last_Bit (CC));
if Posit /= No_Uint
and then Fbit /= No_Uint
and then Lbit /= No_Uint
then
if Posit < 0 then
Error_Msg_N ("position cannot be negative", Position (CC));
elsif Fbit < 0 then
Error_Msg_N ("first bit cannot be negative", First_Bit (CC));
-- The Last_Bit specified in a component clause must not be
-- less than the First_Bit minus one (RM-13.5.1(10)).
elsif Lbit < Fbit - 1 then
Error_Msg_N
("last bit cannot be less than first bit minus one",
Last_Bit (CC));
-- Values look OK, so find the corresponding record component
-- Even though the syntax allows an attribute reference for
-- implementation-defined components, GNAT does not allow the
-- tag to get an explicit position.
elsif Nkind (Component_Name (CC)) = N_Attribute_Reference then
if Attribute_Name (Component_Name (CC)) = Name_Tag then
Error_Msg_N ("position of tag cannot be specified", CC);
else
Error_Msg_N ("illegal component name", CC);
end if;
else
Comp := First_Entity (Rectype);
while Present (Comp) loop
exit when Chars (Comp) = Chars (Component_Name (CC));
Next_Entity (Comp);
end loop;
if No (Comp) then
-- Maybe component of base type that is absent from
-- statically constrained first subtype.
Comp := First_Entity (Base_Type (Rectype));
while Present (Comp) loop
exit when Chars (Comp) = Chars (Component_Name (CC));
Next_Entity (Comp);
end loop;
end if;
if No (Comp) then
Error_Msg_N
("component clause is for non-existent field", CC);
-- Ada 2012 (AI05-0026): Any name that denotes a
-- discriminant of an object of an unchecked union type
-- shall not occur within a record_representation_clause.
-- The general restriction of using record rep clauses on
-- Unchecked_Union types has now been lifted. Since it is
-- possible to introduce a record rep clause which mentions
-- the discriminant of an Unchecked_Union in non-Ada 2012
-- code, this check is applied to all versions of the
-- language.
elsif Ekind (Comp) = E_Discriminant
and then Is_Unchecked_Union (Rectype)
then
Error_Msg_N
("cannot reference discriminant of unchecked union",
Component_Name (CC));
elsif Is_Record_Extension and then Is_Inherited (Comp) then
Error_Msg_NE
("component clause not allowed for inherited "
& "component&", CC, Comp);
elsif Present (Component_Clause (Comp)) then
-- Diagnose duplicate rep clause, or check consistency
-- if this is an inherited component. In a double fault,
-- there may be a duplicate inconsistent clause for an
-- inherited component.
if Scope (Original_Record_Component (Comp)) = Rectype
or else Parent (Component_Clause (Comp)) = N
then
Error_Msg_Sloc := Sloc (Component_Clause (Comp));
Error_Msg_N ("component clause previously given#", CC);
else
declare
Rep1 : constant Node_Id := Component_Clause (Comp);
begin
if Intval (Position (Rep1)) /=
Intval (Position (CC))
or else Intval (First_Bit (Rep1)) /=
Intval (First_Bit (CC))
or else Intval (Last_Bit (Rep1)) /=
Intval (Last_Bit (CC))
then
Error_Msg_N
("component clause inconsistent with "
& "representation of ancestor", CC);
elsif Warn_On_Redundant_Constructs then
Error_Msg_N
("?r?redundant confirming component clause "
& "for component!", CC);
end if;
end;
end if;
-- Normal case where this is the first component clause we
-- have seen for this entity, so set it up properly.
else
-- Make reference for field in record rep clause and set
-- appropriate entity field in the field identifier.
Generate_Reference
(Comp, Component_Name (CC), Set_Ref => False);
Set_Entity (Component_Name (CC), Comp);
-- Update Fbit and Lbit to the actual bit number
Fbit := Fbit + UI_From_Int (SSU) * Posit;
Lbit := Lbit + UI_From_Int (SSU) * Posit;
if Has_Size_Clause (Rectype)
and then RM_Size (Rectype) <= Lbit
then
Error_Msg_N
("bit number out of range of specified size",
Last_Bit (CC));
else
Set_Component_Clause (Comp, CC);
Set_Component_Bit_Offset (Comp, Fbit);
Set_Esize (Comp, 1 + (Lbit - Fbit));
Set_Normalized_First_Bit (Comp, Fbit mod SSU);
Set_Normalized_Position (Comp, Fbit / SSU);
if Warn_On_Overridden_Size
and then Has_Size_Clause (Etype (Comp))
and then RM_Size (Etype (Comp)) /= Esize (Comp)
then
Error_Msg_NE
("?S?component size overrides size clause for&",
Component_Name (CC), Etype (Comp));
end if;
-- This information is also set in the corresponding
-- component of the base type, found by accessing the
-- Original_Record_Component link if it is present.
Ocomp := Original_Record_Component (Comp);
if Hbit < Lbit then
Hbit := Lbit;
end if;
Check_Size
(Component_Name (CC),
Etype (Comp),
Esize (Comp),
Biased);
Set_Biased
(Comp, First_Node (CC), "component clause", Biased);
if Present (Ocomp) then
Set_Component_Clause (Ocomp, CC);
Set_Component_Bit_Offset (Ocomp, Fbit);
Set_Normalized_First_Bit (Ocomp, Fbit mod SSU);
Set_Normalized_Position (Ocomp, Fbit / SSU);
Set_Esize (Ocomp, 1 + (Lbit - Fbit));
Set_Normalized_Position_Max
(Ocomp, Normalized_Position (Ocomp));
-- Note: we don't use Set_Biased here, because we
-- already gave a warning above if needed, and we
-- would get a duplicate for the same name here.
Set_Has_Biased_Representation
(Ocomp, Has_Biased_Representation (Comp));
end if;
if Esize (Comp) < 0 then
Error_Msg_N ("component size is negative", CC);
end if;
end if;
end if;
end if;
end if;
end if;
Next (CC);
end loop;
-- Check missing components if Complete_Representation pragma appeared
if Present (CR_Pragma) then
Comp := First_Component_Or_Discriminant (Rectype);
while Present (Comp) loop
if No (Component_Clause (Comp)) then
Error_Msg_NE
("missing component clause for &", CR_Pragma, Comp);
end if;
Next_Component_Or_Discriminant (Comp);
end loop;
-- Give missing components warning if required
elsif Warn_On_Unrepped_Components then
declare
Num_Repped_Components : Nat := 0;
Num_Unrepped_Components : Nat := 0;
begin
-- First count number of repped and unrepped components
Comp := First_Component_Or_Discriminant (Rectype);
while Present (Comp) loop
if Present (Component_Clause (Comp)) then
Num_Repped_Components := Num_Repped_Components + 1;
else
Num_Unrepped_Components := Num_Unrepped_Components + 1;
end if;
Next_Component_Or_Discriminant (Comp);
end loop;
-- We are only interested in the case where there is at least one
-- unrepped component, and at least half the components have rep
-- clauses. We figure that if less than half have them, then the
-- partial rep clause is really intentional. If the component
-- type has no underlying type set at this point (as for a generic
-- formal type), we don't know enough to give a warning on the
-- component.
if Num_Unrepped_Components > 0
and then Num_Unrepped_Components < Num_Repped_Components
then
Comp := First_Component_Or_Discriminant (Rectype);
while Present (Comp) loop
if No (Component_Clause (Comp))
and then Comes_From_Source (Comp)
and then Present (Underlying_Type (Etype (Comp)))
and then (Is_Scalar_Type (Underlying_Type (Etype (Comp)))
or else Size_Known_At_Compile_Time
(Underlying_Type (Etype (Comp))))
and then not Has_Warnings_Off (Rectype)
-- Ignore discriminant in unchecked union, since it is
-- not there, and cannot have a component clause.
and then (not Is_Unchecked_Union (Rectype)
or else Ekind (Comp) /= E_Discriminant)
then
Error_Msg_Sloc := Sloc (Comp);
Error_Msg_NE
("?C?no component clause given for & declared #",
N, Comp);
end if;
Next_Component_Or_Discriminant (Comp);
end loop;
end if;
end;
end if;
end Analyze_Record_Representation_Clause;
-------------------------------------
-- Build_Discrete_Static_Predicate --
-------------------------------------
procedure Build_Discrete_Static_Predicate
(Typ : Entity_Id;
Expr : Node_Id;
Nam : Name_Id)
is
Loc : constant Source_Ptr := Sloc (Expr);
Non_Static : exception;
-- Raised if something non-static is found
Btyp : constant Entity_Id := Base_Type (Typ);
BLo : constant Uint := Expr_Value (Type_Low_Bound (Btyp));
BHi : constant Uint := Expr_Value (Type_High_Bound (Btyp));
-- Low bound and high bound value of base type of Typ
TLo : Uint;
THi : Uint;
-- Bounds for constructing the static predicate. We use the bound of the
-- subtype if it is static, otherwise the corresponding base type bound.
-- Note: a non-static subtype can have a static predicate.
type REnt is record
Lo, Hi : Uint;
end record;
-- One entry in a Rlist value, a single REnt (range entry) value denotes
-- one range from Lo to Hi. To represent a single value range Lo = Hi =
-- value.
type RList is array (Nat range <>) of REnt;
-- A list of ranges. The ranges are sorted in increasing order, and are
-- disjoint (there is a gap of at least one value between each range in
-- the table). A value is in the set of ranges in Rlist if it lies
-- within one of these ranges.
False_Range : constant RList :=
RList'(1 .. 0 => REnt'(No_Uint, No_Uint));
-- An empty set of ranges represents a range list that can never be
-- satisfied, since there are no ranges in which the value could lie,
-- so it does not lie in any of them. False_Range is a canonical value
-- for this empty set, but general processing should test for an Rlist
-- with length zero (see Is_False predicate), since other null ranges
-- may appear which must be treated as False.
True_Range : constant RList := RList'(1 => REnt'(BLo, BHi));
-- Range representing True, value must be in the base range
function "and" (Left : RList; Right : RList) return RList;
-- And's together two range lists, returning a range list. This is a set
-- intersection operation.
function "or" (Left : RList; Right : RList) return RList;
-- Or's together two range lists, returning a range list. This is a set
-- union operation.
function "not" (Right : RList) return RList;
-- Returns complement of a given range list, i.e. a range list
-- representing all the values in TLo .. THi that are not in the input
-- operand Right.
function Build_Val (V : Uint) return Node_Id;
-- Return an analyzed N_Identifier node referencing this value, suitable
-- for use as an entry in the Static_Discrte_Predicate list. This node
-- is typed with the base type.
function Build_Range (Lo : Uint; Hi : Uint) return Node_Id;
-- Return an analyzed N_Range node referencing this range, suitable for
-- use as an entry in the Static_Discrete_Predicate list. This node is
-- typed with the base type.
function Get_RList (Exp : Node_Id) return RList;
-- This is a recursive routine that converts the given expression into a
-- list of ranges, suitable for use in building the static predicate.
function Is_False (R : RList) return Boolean;
pragma Inline (Is_False);
-- Returns True if the given range list is empty, and thus represents a
-- False list of ranges that can never be satisfied.
function Is_True (R : RList) return Boolean;
-- Returns True if R trivially represents the True predicate by having a
-- single range from BLo to BHi.
function Is_Type_Ref (N : Node_Id) return Boolean;
pragma Inline (Is_Type_Ref);
-- Returns if True if N is a reference to the type for the predicate in
-- the expression (i.e. if it is an identifier whose Chars field matches
-- the Nam given in the call). N must not be parenthesized, if the type
-- name appears in parens, this routine will return False.
function Lo_Val (N : Node_Id) return Uint;
-- Given an entry from a Static_Discrete_Predicate list that is either
-- a static expression or static range, gets either the expression value
-- or the low bound of the range.
function Hi_Val (N : Node_Id) return Uint;
-- Given an entry from a Static_Discrete_Predicate list that is either
-- a static expression or static range, gets either the expression value
-- or the high bound of the range.
function Membership_Entry (N : Node_Id) return RList;
-- Given a single membership entry (range, value, or subtype), returns
-- the corresponding range list. Raises Static_Error if not static.
function Membership_Entries (N : Node_Id) return RList;
-- Given an element on an alternatives list of a membership operation,
-- returns the range list corresponding to this entry and all following
-- entries (i.e. returns the "or" of this list of values).
function Stat_Pred (Typ : Entity_Id) return RList;
-- Given a type, if it has a static predicate, then return the predicate
-- as a range list, otherwise raise Non_Static.
-----------
-- "and" --
-----------
function "and" (Left : RList; Right : RList) return RList is
FEnt : REnt;
-- First range of result
SLeft : Nat := Left'First;
-- Start of rest of left entries
SRight : Nat := Right'First;
-- Start of rest of right entries
begin
-- If either range is True, return the other
if Is_True (Left) then
return Right;
elsif Is_True (Right) then
return Left;
end if;
-- If either range is False, return False
if Is_False (Left) or else Is_False (Right) then
return False_Range;
end if;
-- Loop to remove entries at start that are disjoint, and thus just
-- get discarded from the result entirely.
loop
-- If no operands left in either operand, result is false
if SLeft > Left'Last or else SRight > Right'Last then
return False_Range;
-- Discard first left operand entry if disjoint with right
elsif Left (SLeft).Hi < Right (SRight).Lo then
SLeft := SLeft + 1;
-- Discard first right operand entry if disjoint with left
elsif Right (SRight).Hi < Left (SLeft).Lo then
SRight := SRight + 1;
-- Otherwise we have an overlapping entry
else
exit;
end if;
end loop;
-- Now we have two non-null operands, and first entries overlap. The
-- first entry in the result will be the overlapping part of these
-- two entries.
FEnt := REnt'(Lo => UI_Max (Left (SLeft).Lo, Right (SRight).Lo),
Hi => UI_Min (Left (SLeft).Hi, Right (SRight).Hi));
-- Now we can remove the entry that ended at a lower value, since its
-- contribution is entirely contained in Fent.
if Left (SLeft).Hi <= Right (SRight).Hi then
SLeft := SLeft + 1;
else
SRight := SRight + 1;
end if;
-- Compute result by concatenating this first entry with the "and" of
-- the remaining parts of the left and right operands. Note that if
-- either of these is empty, "and" will yield empty, so that we will
-- end up with just Fent, which is what we want in that case.
return
FEnt & (Left (SLeft .. Left'Last) and Right (SRight .. Right'Last));
end "and";
-----------
-- "not" --
-----------
function "not" (Right : RList) return RList is
begin
-- Return True if False range
if Is_False (Right) then
return True_Range;
end if;
-- Return False if True range
if Is_True (Right) then
return False_Range;
end if;
-- Here if not trivial case
declare
Result : RList (1 .. Right'Length + 1);
-- May need one more entry for gap at beginning and end
Count : Nat := 0;
-- Number of entries stored in Result
begin
-- Gap at start
if Right (Right'First).Lo > TLo then
Count := Count + 1;
Result (Count) := REnt'(TLo, Right (Right'First).Lo - 1);
end if;
-- Gaps between ranges
for J in Right'First .. Right'Last - 1 loop
Count := Count + 1;
Result (Count) := REnt'(Right (J).Hi + 1, Right (J + 1).Lo - 1);
end loop;
-- Gap at end
if Right (Right'Last).Hi < THi then
Count := Count + 1;
Result (Count) := REnt'(Right (Right'Last).Hi + 1, THi);
end if;
return Result (1 .. Count);
end;
end "not";
----------
-- "or" --
----------
function "or" (Left : RList; Right : RList) return RList is
FEnt : REnt;
-- First range of result
SLeft : Nat := Left'First;
-- Start of rest of left entries
SRight : Nat := Right'First;
-- Start of rest of right entries
begin
-- If either range is True, return True
if Is_True (Left) or else Is_True (Right) then
return True_Range;
end if;
-- If either range is False (empty), return the other
if Is_False (Left) then
return Right;
elsif Is_False (Right) then
return Left;
end if;
-- Initialize result first entry from left or right operand depending
-- on which starts with the lower range.
if Left (SLeft).Lo < Right (SRight).Lo then
FEnt := Left (SLeft);
SLeft := SLeft + 1;
else
FEnt := Right (SRight);
SRight := SRight + 1;
end if;
-- This loop eats ranges from left and right operands that are
-- contiguous with the first range we are gathering.
loop
-- Eat first entry in left operand if contiguous or overlapped by
-- gathered first operand of result.
if SLeft <= Left'Last
and then Left (SLeft).Lo <= FEnt.Hi + 1
then
FEnt.Hi := UI_Max (FEnt.Hi, Left (SLeft).Hi);
SLeft := SLeft + 1;
-- Eat first entry in right operand if contiguous or overlapped by
-- gathered right operand of result.
elsif SRight <= Right'Last
and then Right (SRight).Lo <= FEnt.Hi + 1
then
FEnt.Hi := UI_Max (FEnt.Hi, Right (SRight).Hi);
SRight := SRight + 1;
-- All done if no more entries to eat
else
exit;
end if;
end loop;
-- Obtain result as the first entry we just computed, concatenated
-- to the "or" of the remaining results (if one operand is empty,
-- this will just concatenate with the other
return
FEnt & (Left (SLeft .. Left'Last) or Right (SRight .. Right'Last));
end "or";
-----------------
-- Build_Range --
-----------------
function Build_Range (Lo : Uint; Hi : Uint) return Node_Id is
Result : Node_Id;
begin
Result :=
Make_Range (Loc,
Low_Bound => Build_Val (Lo),
High_Bound => Build_Val (Hi));
Set_Etype (Result, Btyp);
Set_Analyzed (Result);
return Result;
end Build_Range;
---------------
-- Build_Val --
---------------
function Build_Val (V : Uint) return Node_Id is
Result : Node_Id;
begin
if Is_Enumeration_Type (Typ) then
Result := Get_Enum_Lit_From_Pos (Typ, V, Loc);
else
Result := Make_Integer_Literal (Loc, V);
end if;
Set_Etype (Result, Btyp);
Set_Is_Static_Expression (Result);
Set_Analyzed (Result);
return Result;
end Build_Val;
---------------
-- Get_RList --
---------------
function Get_RList (Exp : Node_Id) return RList is
Op : Node_Kind;
Val : Uint;
begin
-- Static expression can only be true or false
if Is_OK_Static_Expression (Exp) then
if Expr_Value (Exp) = 0 then
return False_Range;
else
return True_Range;
end if;
end if;
-- Otherwise test node type
Op := Nkind (Exp);
case Op is
-- And
when N_And_Then
| N_Op_And
=>
return Get_RList (Left_Opnd (Exp))
and
Get_RList (Right_Opnd (Exp));
-- Or
when N_Op_Or
| N_Or_Else
=>
return Get_RList (Left_Opnd (Exp))
or
Get_RList (Right_Opnd (Exp));
-- Not
when N_Op_Not =>
return not Get_RList (Right_Opnd (Exp));
-- Comparisons of type with static value
when N_Op_Compare =>
-- Type is left operand
if Is_Type_Ref (Left_Opnd (Exp))
and then Is_OK_Static_Expression (Right_Opnd (Exp))
then
Val := Expr_Value (Right_Opnd (Exp));
-- Typ is right operand
elsif Is_Type_Ref (Right_Opnd (Exp))
and then Is_OK_Static_Expression (Left_Opnd (Exp))
then
Val := Expr_Value (Left_Opnd (Exp));
-- Invert sense of comparison
case Op is
when N_Op_Gt => Op := N_Op_Lt;
when N_Op_Lt => Op := N_Op_Gt;
when N_Op_Ge => Op := N_Op_Le;
when N_Op_Le => Op := N_Op_Ge;
when others => null;
end case;
-- Other cases are non-static
else
raise Non_Static;
end if;
-- Construct range according to comparison operation
case Op is
when N_Op_Eq =>
return RList'(1 => REnt'(Val, Val));
when N_Op_Ge =>
return RList'(1 => REnt'(Val, BHi));
when N_Op_Gt =>
return RList'(1 => REnt'(Val + 1, BHi));
when N_Op_Le =>
return RList'(1 => REnt'(BLo, Val));
when N_Op_Lt =>
return RList'(1 => REnt'(BLo, Val - 1));
when N_Op_Ne =>
return RList'(REnt'(BLo, Val - 1), REnt'(Val + 1, BHi));
when others =>
raise Program_Error;
end case;
-- Membership (IN)
when N_In =>
if not Is_Type_Ref (Left_Opnd (Exp)) then
raise Non_Static;
end if;
if Present (Right_Opnd (Exp)) then
return Membership_Entry (Right_Opnd (Exp));
else
return Membership_Entries (First (Alternatives (Exp)));
end if;
-- Negative membership (NOT IN)
when N_Not_In =>
if not Is_Type_Ref (Left_Opnd (Exp)) then
raise Non_Static;
end if;
if Present (Right_Opnd (Exp)) then
return not Membership_Entry (Right_Opnd (Exp));
else
return not Membership_Entries (First (Alternatives (Exp)));
end if;
-- Function call, may be call to static predicate
when N_Function_Call =>
if Is_Entity_Name (Name (Exp)) then
declare
Ent : constant Entity_Id := Entity (Name (Exp));
begin
if Is_Predicate_Function (Ent)
or else
Is_Predicate_Function_M (Ent)
then
return Stat_Pred (Etype (First_Formal (Ent)));
end if;
end;
end if;
-- Other function call cases are non-static
raise Non_Static;
-- Qualified expression, dig out the expression
when N_Qualified_Expression =>
return Get_RList (Expression (Exp));
when N_Case_Expression =>
declare
Alt : Node_Id;
Choices : List_Id;
Dep : Node_Id;
begin
if not Is_Entity_Name (Expression (Expr))
or else Etype (Expression (Expr)) /= Typ
then
Error_Msg_N
("expression must denaote subtype", Expression (Expr));
return False_Range;
end if;
-- Collect discrete choices in all True alternatives
Choices := New_List;
Alt := First (Alternatives (Exp));
while Present (Alt) loop
Dep := Expression (Alt);
if not Is_OK_Static_Expression (Dep) then
raise Non_Static;
elsif Is_True (Expr_Value (Dep)) then
Append_List_To (Choices,
New_Copy_List (Discrete_Choices (Alt)));
end if;
Next (Alt);
end loop;
return Membership_Entries (First (Choices));
end;
-- Expression with actions: if no actions, dig out expression
when N_Expression_With_Actions =>
if Is_Empty_List (Actions (Exp)) then
return Get_RList (Expression (Exp));
else
raise Non_Static;
end if;
-- Xor operator
when N_Op_Xor =>
return (Get_RList (Left_Opnd (Exp))
and not Get_RList (Right_Opnd (Exp)))
or (Get_RList (Right_Opnd (Exp))
and not Get_RList (Left_Opnd (Exp)));
-- Any other node type is non-static
when others =>
raise Non_Static;
end case;
end Get_RList;
------------
-- Hi_Val --
------------
function Hi_Val (N : Node_Id) return Uint is
begin
if Is_OK_Static_Expression (N) then
return Expr_Value (N);
else
pragma Assert (Nkind (N) = N_Range);
return Expr_Value (High_Bound (N));
end if;
end Hi_Val;
--------------
-- Is_False --
--------------
function Is_False (R : RList) return Boolean is
begin
return R'Length = 0;
end Is_False;
-------------
-- Is_True --
-------------
function Is_True (R : RList) return Boolean is
begin
return R'Length = 1
and then R (R'First).Lo = BLo
and then R (R'First).Hi = BHi;
end Is_True;
-----------------
-- Is_Type_Ref --
-----------------
function Is_Type_Ref (N : Node_Id) return Boolean is
begin
return Nkind (N) = N_Identifier
and then Chars (N) = Nam
and then Paren_Count (N) = 0;
end Is_Type_Ref;
------------
-- Lo_Val --
------------
function Lo_Val (N : Node_Id) return Uint is
begin
if Is_OK_Static_Expression (N) then
return Expr_Value (N);
else
pragma Assert (Nkind (N) = N_Range);
return Expr_Value (Low_Bound (N));
end if;
end Lo_Val;
------------------------
-- Membership_Entries --
------------------------
function Membership_Entries (N : Node_Id) return RList is
begin
if No (Next (N)) then
return Membership_Entry (N);
else
return Membership_Entry (N) or Membership_Entries (Next (N));
end if;
end Membership_Entries;
----------------------
-- Membership_Entry --
----------------------
function Membership_Entry (N : Node_Id) return RList is
Val : Uint;
SLo : Uint;
SHi : Uint;
begin
-- Range case
if Nkind (N) = N_Range then
if not Is_OK_Static_Expression (Low_Bound (N))
or else
not Is_OK_Static_Expression (High_Bound (N))
then
raise Non_Static;
else
SLo := Expr_Value (Low_Bound (N));
SHi := Expr_Value (High_Bound (N));
return RList'(1 => REnt'(SLo, SHi));
end if;
-- Static expression case
elsif Is_OK_Static_Expression (N) then
Val := Expr_Value (N);
return RList'(1 => REnt'(Val, Val));
-- Identifier (other than static expression) case
else pragma Assert (Nkind (N) = N_Identifier);
-- Type case
if Is_Type (Entity (N)) then
-- If type has predicates, process them
if Has_Predicates (Entity (N)) then
return Stat_Pred (Entity (N));
-- For static subtype without predicates, get range
elsif Is_OK_Static_Subtype (Entity (N)) then
SLo := Expr_Value (Type_Low_Bound (Entity (N)));
SHi := Expr_Value (Type_High_Bound (Entity (N)));
return RList'(1 => REnt'(SLo, SHi));
-- Any other type makes us non-static
else
raise Non_Static;
end if;
-- Any other kind of identifier in predicate (e.g. a non-static
-- expression value) means this is not a static predicate.
else
raise Non_Static;
end if;
end if;
end Membership_Entry;
---------------
-- Stat_Pred --
---------------
function Stat_Pred (Typ : Entity_Id) return RList is
begin
-- Not static if type does not have static predicates
if not Has_Static_Predicate (Typ) then
raise Non_Static;
end if;
-- Otherwise we convert the predicate list to a range list
declare
Spred : constant List_Id := Static_Discrete_Predicate (Typ);
Result : RList (1 .. List_Length (Spred));
P : Node_Id;
begin
P := First (Static_Discrete_Predicate (Typ));
for J in Result'Range loop
Result (J) := REnt'(Lo_Val (P), Hi_Val (P));
Next (P);
end loop;
return Result;
end;
end Stat_Pred;
-- Start of processing for Build_Discrete_Static_Predicate
begin
-- Establish bounds for the predicate
if Compile_Time_Known_Value (Type_Low_Bound (Typ)) then
TLo := Expr_Value (Type_Low_Bound (Typ));
else
TLo := BLo;
end if;
if Compile_Time_Known_Value (Type_High_Bound (Typ)) then
THi := Expr_Value (Type_High_Bound (Typ));
else
THi := BHi;
end if;
-- Analyze the expression to see if it is a static predicate
declare
Ranges : constant RList := Get_RList (Expr);
-- Range list from expression if it is static
Plist : List_Id;
begin
-- Convert range list into a form for the static predicate. In the
-- Ranges array, we just have raw ranges, these must be converted
-- to properly typed and analyzed static expressions or range nodes.
-- Note: here we limit ranges to the ranges of the subtype, so that
-- a predicate is always false for values outside the subtype. That
-- seems fine, such values are invalid anyway, and considering them
-- to fail the predicate seems allowed and friendly, and furthermore
-- simplifies processing for case statements and loops.
Plist := New_List;
for J in Ranges'Range loop
declare
Lo : Uint := Ranges (J).Lo;
Hi : Uint := Ranges (J).Hi;
begin
-- Ignore completely out of range entry
if Hi < TLo or else Lo > THi then
null;
-- Otherwise process entry
else
-- Adjust out of range value to subtype range
if Lo < TLo then
Lo := TLo;
end if;
if Hi > THi then
Hi := THi;
end if;
-- Convert range into required form
Append_To (Plist, Build_Range (Lo, Hi));
end if;
end;
end loop;
-- Processing was successful and all entries were static, so now we
-- can store the result as the predicate list.
Set_Static_Discrete_Predicate (Typ, Plist);
-- The processing for static predicates put the expression into
-- canonical form as a series of ranges. It also eliminated
-- duplicates and collapsed and combined ranges. We might as well
-- replace the alternatives list of the right operand of the
-- membership test with the static predicate list, which will
-- usually be more efficient.
declare
New_Alts : constant List_Id := New_List;
Old_Node : Node_Id;
New_Node : Node_Id;
begin
Old_Node := First (Plist);
while Present (Old_Node) loop
New_Node := New_Copy (Old_Node);
if Nkind (New_Node) = N_Range then
Set_Low_Bound (New_Node, New_Copy (Low_Bound (Old_Node)));
Set_High_Bound (New_Node, New_Copy (High_Bound (Old_Node)));
end if;
Append_To (New_Alts, New_Node);
Next (Old_Node);
end loop;
-- If empty list, replace by False
if Is_Empty_List (New_Alts) then
Rewrite (Expr, New_Occurrence_Of (Standard_False, Loc));
-- Else replace by set membership test
else
Rewrite (Expr,
Make_In (Loc,
Left_Opnd => Make_Identifier (Loc, Nam),
Right_Opnd => Empty,
Alternatives => New_Alts));
-- Resolve new expression in function context
Install_Formals (Predicate_Function (Typ));
Push_Scope (Predicate_Function (Typ));
Analyze_And_Resolve (Expr, Standard_Boolean);
Pop_Scope;
end if;
end;
end;
-- If non-static, return doing nothing
exception
when Non_Static =>
return;
end Build_Discrete_Static_Predicate;
--------------------------------
-- Build_Export_Import_Pragma --
--------------------------------
function Build_Export_Import_Pragma
(Asp : Node_Id;
Id : Entity_Id) return Node_Id
is
Asp_Id : constant Aspect_Id := Get_Aspect_Id (Asp);
Expr : constant Node_Id := Expression (Asp);
Loc : constant Source_Ptr := Sloc (Asp);
Args : List_Id;
Conv : Node_Id;
Conv_Arg : Node_Id;
Dummy_1 : Node_Id;
Dummy_2 : Node_Id;
EN : Node_Id;
LN : Node_Id;
Prag : Node_Id;
Create_Pragma : Boolean := False;
-- This flag is set when the aspect form is such that it warrants the
-- creation of a corresponding pragma.
begin
if Present (Expr) then
if Error_Posted (Expr) then
null;
elsif Is_True (Expr_Value (Expr)) then
Create_Pragma := True;
end if;
-- Otherwise the aspect defaults to True
else
Create_Pragma := True;
end if;
-- Nothing to do when the expression is False or is erroneous
if not Create_Pragma then
return Empty;
end if;
-- Obtain all interfacing aspects that apply to the related entity
Get_Interfacing_Aspects
(Iface_Asp => Asp,
Conv_Asp => Conv,
EN_Asp => EN,
Expo_Asp => Dummy_1,
Imp_Asp => Dummy_2,
LN_Asp => LN);
Args := New_List;
-- Handle the convention argument
if Present (Conv) then
Conv_Arg := New_Copy_Tree (Expression (Conv));
-- Assume convention "Ada' when aspect Convention is missing
else
Conv_Arg := Make_Identifier (Loc, Name_Ada);
end if;
Append_To (Args,
Make_Pragma_Argument_Association (Loc,
Chars => Name_Convention,
Expression => Conv_Arg));
-- Handle the entity argument
Append_To (Args,
Make_Pragma_Argument_Association (Loc,
Chars => Name_Entity,
Expression => New_Occurrence_Of (Id, Loc)));
-- Handle the External_Name argument
if Present (EN) then
Append_To (Args,
Make_Pragma_Argument_Association (Loc,
Chars => Name_External_Name,
Expression => New_Copy_Tree (Expression (EN))));
end if;
-- Handle the Link_Name argument
if Present (LN) then
Append_To (Args,
Make_Pragma_Argument_Association (Loc,
Chars => Name_Link_Name,
Expression => New_Copy_Tree (Expression (LN))));
end if;
-- Generate:
-- pragma Export/Import
-- (Convention => <Conv>/Ada,
-- Entity => <Id>,
-- [External_Name => <EN>,]
-- [Link_Name => <LN>]);
Prag :=
Make_Pragma (Loc,
Pragma_Identifier =>
Make_Identifier (Loc, Chars (Identifier (Asp))),
Pragma_Argument_Associations => Args);
-- Decorate the relevant aspect and the pragma
Set_Aspect_Rep_Item (Asp, Prag);
Set_Corresponding_Aspect (Prag, Asp);
Set_From_Aspect_Specification (Prag);
Set_Parent (Prag, Asp);
if Asp_Id = Aspect_Import and then Is_Subprogram (Id) then
Set_Import_Pragma (Id, Prag);
end if;
return Prag;
end Build_Export_Import_Pragma;
-------------------------------
-- Build_Predicate_Functions --
-------------------------------
-- The procedures that are constructed here have the form:
-- function typPredicate (Ixxx : typ) return Boolean is
-- begin
-- return
-- typ1Predicate (typ1 (Ixxx))
-- and then typ2Predicate (typ2 (Ixxx))
-- and then ...;
-- exp1 and then exp2 and then ...
-- end typPredicate;
-- Here exp1, and exp2 are expressions from Predicate pragmas. Note that
-- this is the point at which these expressions get analyzed, providing the
-- required delay, and typ1, typ2, are entities from which predicates are
-- inherited. Note that we do NOT generate Check pragmas, that's because we
-- use this function even if checks are off, e.g. for membership tests.
-- Note that the inherited predicates are evaluated first, as required by
-- AI12-0071-1.
-- Note that Sem_Eval.Real_Or_String_Static_Predicate_Matches depends on
-- the form of this return expression.
-- If the expression has at least one Raise_Expression, then we also build
-- the typPredicateM version of the function, in which any occurrence of a
-- Raise_Expression is converted to "return False".
-- WARNING: This routine manages Ghost regions. Return statements must be
-- replaced by gotos which jump to the end of the routine and restore the
-- Ghost mode.
procedure Build_Predicate_Functions (Typ : Entity_Id; N : Node_Id) is
Loc : constant Source_Ptr := Sloc (Typ);
Expr : Node_Id;
-- This is the expression for the result of the function. It is
-- is build by connecting the component predicates with AND THEN.
Expr_M : Node_Id;
-- This is the corresponding return expression for the Predicate_M
-- function. It differs in that raise expressions are marked for
-- special expansion (see Process_REs).
Object_Name : Name_Id;
-- Name for argument of Predicate procedure. Note that we use the same
-- name for both predicate functions. That way the reference within the
-- predicate expression is the same in both functions.
Object_Entity : Entity_Id;
-- Entity for argument of Predicate procedure
Object_Entity_M : Entity_Id;
-- Entity for argument of separate Predicate procedure when exceptions
-- are present in expression.
FDecl : Node_Id;
-- The function declaration
SId : Entity_Id;
-- Its entity
Raise_Expression_Present : Boolean := False;
-- Set True if Expr has at least one Raise_Expression
procedure Add_Condition (Cond : Node_Id);
-- Append Cond to Expr using "and then" (or just copy Cond to Expr if
-- Expr is empty).
procedure Add_Predicates;
-- Appends expressions for any Predicate pragmas in the rep item chain
-- Typ to Expr. Note that we look only at items for this exact entity.
-- Inheritance of predicates for the parent type is done by calling the
-- Predicate_Function of the parent type, using Add_Call above.
procedure Add_Call (T : Entity_Id);
-- Includes a call to the predicate function for type T in Expr if T
-- has predicates and Predicate_Function (T) is non-empty.
function Process_RE (N : Node_Id) return Traverse_Result;
-- Used in Process REs, tests if node N is a raise expression, and if
-- so, marks it to be converted to return False.
procedure Process_REs is new Traverse_Proc (Process_RE);
-- Marks any raise expressions in Expr_M to return False
function Test_RE (N : Node_Id) return Traverse_Result;
-- Used in Test_REs, tests one node for being a raise expression, and if
-- so sets Raise_Expression_Present True.
procedure Test_REs is new Traverse_Proc (Test_RE);
-- Tests to see if Expr contains any raise expressions
--------------
-- Add_Call --
--------------
procedure Add_Call (T : Entity_Id) is
Exp : Node_Id;
begin
if Present (T) and then Present (Predicate_Function (T)) then
Set_Has_Predicates (Typ);
-- Build the call to the predicate function of T
Exp :=
Make_Predicate_Call
(T, Convert_To (T, Make_Identifier (Loc, Object_Name)));
-- "and"-in the call to evolving expression
Add_Condition (Exp);
-- Output info message on inheritance if required. Note we do not
-- give this information for generic actual types, since it is
-- unwelcome noise in that case in instantiations. We also
-- generally suppress the message in instantiations, and also
-- if it involves internal names.
if Opt.List_Inherited_Aspects
and then not Is_Generic_Actual_Type (Typ)
and then Instantiation_Depth (Sloc (Typ)) = 0
and then not Is_Internal_Name (Chars (T))
and then not Is_Internal_Name (Chars (Typ))
then
Error_Msg_Sloc := Sloc (Predicate_Function (T));
Error_Msg_Node_2 := T;
Error_Msg_N ("info: & inherits predicate from & #?L?", Typ);
end if;
end if;
end Add_Call;
-------------------
-- Add_Condition --
-------------------
procedure Add_Condition (Cond : Node_Id) is
begin
-- This is the first predicate expression
if No (Expr) then
Expr := Cond;
-- Otherwise concatenate to the existing predicate expressions by
-- using "and then".
else
Expr :=
Make_And_Then (Loc,
Left_Opnd => Relocate_Node (Expr),
Right_Opnd => Cond);
end if;
end Add_Condition;
--------------------
-- Add_Predicates --
--------------------
procedure Add_Predicates is
procedure Add_Predicate (Prag : Node_Id);
-- Concatenate the expression of predicate pragma Prag to Expr by
-- using a short circuit "and then" operator.
-------------------
-- Add_Predicate --
-------------------
procedure Add_Predicate (Prag : Node_Id) is
procedure Replace_Type_Reference (N : Node_Id);
-- Replace a single occurrence N of the subtype name with a
-- reference to the formal of the predicate function. N can be an
-- identifier referencing the subtype, or a selected component,
-- representing an appropriately qualified occurrence of the
-- subtype name.
procedure Replace_Type_References is
new Replace_Type_References_Generic (Replace_Type_Reference);
-- Traverse an expression changing every occurrence of an
-- identifier whose name matches the name of the subtype with a
-- reference to the formal parameter of the predicate function.
----------------------------
-- Replace_Type_Reference --
----------------------------
procedure Replace_Type_Reference (N : Node_Id) is
begin
Rewrite (N, Make_Identifier (Sloc (N), Object_Name));
-- Use the Sloc of the usage name, not the defining name
Set_Etype (N, Typ);
Set_Entity (N, Object_Entity);
-- We want to treat the node as if it comes from source, so
-- that ASIS will not ignore it.
Set_Comes_From_Source (N, True);
end Replace_Type_Reference;
-- Local variables
Asp : constant Node_Id := Corresponding_Aspect (Prag);
Arg1 : Node_Id;
Arg2 : Node_Id;
-- Start of processing for Add_Predicate
begin
-- Extract the arguments of the pragma. The expression itself
-- is copied for use in the predicate function, to preserve the
-- original version for ASIS use.
Arg1 := First (Pragma_Argument_Associations (Prag));
Arg2 := Next (Arg1);
Arg1 := Get_Pragma_Arg (Arg1);
Arg2 := New_Copy_Tree (Get_Pragma_Arg (Arg2));
-- When the predicate pragma applies to the current type or its
-- full view, replace all occurrences of the subtype name with
-- references to the formal parameter of the predicate function.
if Entity (Arg1) = Typ
or else Full_View (Entity (Arg1)) = Typ
then
Replace_Type_References (Arg2, Typ);
-- If the predicate pragma comes from an aspect, replace the
-- saved expression because we need the subtype references
-- replaced for the calls to Preanalyze_Spec_Expression in
-- Check_Aspect_At_xxx routines.
if Present (Asp) then
Set_Entity (Identifier (Asp), New_Copy_Tree (Arg2));
end if;
-- "and"-in the Arg2 condition to evolving expression
Add_Condition (Relocate_Node (Arg2));
end if;
end Add_Predicate;
-- Local variables
Ritem : Node_Id;
-- Start of processing for Add_Predicates
begin
Ritem := First_Rep_Item (Typ);
while Present (Ritem) loop
if Nkind (Ritem) = N_Pragma
and then Pragma_Name (Ritem) = Name_Predicate
then
Add_Predicate (Ritem);
-- If the type is declared in an inner package it may be frozen
-- outside of the package, and the generated pragma has not been
-- analyzed yet, so capture the expression for the predicate
-- function at this point.
elsif Nkind (Ritem) = N_Aspect_Specification
and then Present (Aspect_Rep_Item (Ritem))
and then Scope (Typ) /= Current_Scope
then
declare
Prag : constant Node_Id := Aspect_Rep_Item (Ritem);
begin
if Nkind (Prag) = N_Pragma
and then Pragma_Name (Prag) = Name_Predicate
then
Add_Predicate (Prag);
end if;
end;
end if;
Next_Rep_Item (Ritem);
end loop;
end Add_Predicates;
----------------
-- Process_RE --
----------------
function Process_RE (N : Node_Id) return Traverse_Result is
begin
if Nkind (N) = N_Raise_Expression then
Set_Convert_To_Return_False (N);
return Skip;
else
return OK;
end if;
end Process_RE;
-------------
-- Test_RE --
-------------
function Test_RE (N : Node_Id) return Traverse_Result is
begin
if Nkind (N) = N_Raise_Expression then
Raise_Expression_Present := True;
return Abandon;
else
return OK;
end if;
end Test_RE;
-- Local variables
Mode : Ghost_Mode_Type;
-- Start of processing for Build_Predicate_Functions
begin
-- Return if already built or if type does not have predicates
SId := Predicate_Function (Typ);
if not Has_Predicates (Typ)
or else (Present (SId) and then Has_Completion (SId))
then
return;
end if;
-- The related type may be subject to pragma Ghost. Set the mode now to
-- ensure that the predicate functions are properly marked as Ghost.
Set_Ghost_Mode (Typ, Mode);
-- Prepare to construct predicate expression
Expr := Empty;
if Present (SId) then
FDecl := Unit_Declaration_Node (SId);
else
FDecl := Build_Predicate_Function_Declaration (Typ);
SId := Defining_Entity (FDecl);
end if;
-- Recover name of formal parameter of function that replaces references
-- to the type in predicate expressions.
Object_Entity :=
Defining_Identifier
(First (Parameter_Specifications (Specification (FDecl))));
Object_Name := Chars (Object_Entity);
Object_Entity_M := Make_Defining_Identifier (Loc, Chars => Object_Name);
-- Add predicates for ancestor if present. These must come before the
-- ones for the current type, as required by AI12-0071-1.
declare
Atyp : constant Entity_Id := Nearest_Ancestor (Typ);
begin
if Present (Atyp) then
Add_Call (Atyp);
end if;
end;
-- Add Predicates for the current type
Add_Predicates;
-- Case where predicates are present
if Present (Expr) then
-- Test for raise expression present
Test_REs (Expr);
-- If raise expression is present, capture a copy of Expr for use
-- in building the predicateM function version later on. For this
-- copy we replace references to Object_Entity by Object_Entity_M.
if Raise_Expression_Present then
declare
Map : constant Elist_Id := New_Elmt_List;
New_V : Entity_Id := Empty;
-- The unanalyzed expression will be copied and appear in
-- both functions. Normally expressions do not declare new
-- entities, but quantified expressions do, so we need to
-- create new entities for their bound variables, to prevent
-- multiple definitions in gigi.
function Reset_Loop_Variable (N : Node_Id)
return Traverse_Result;
procedure Collect_Loop_Variables is
new Traverse_Proc (Reset_Loop_Variable);
------------------------
-- Reset_Loop_Variable --
------------------------
function Reset_Loop_Variable (N : Node_Id)
return Traverse_Result
is
begin
if Nkind (N) = N_Iterator_Specification then
New_V := Make_Defining_Identifier
(Sloc (N), Chars (Defining_Identifier (N)));
Set_Defining_Identifier (N, New_V);
end if;
return OK;
end Reset_Loop_Variable;
begin
Append_Elmt (Object_Entity, Map);
Append_Elmt (Object_Entity_M, Map);
Expr_M := New_Copy_Tree (Expr, Map => Map);
Collect_Loop_Variables (Expr_M);
end;
end if;
-- Build the main predicate function
declare
SIdB : constant Entity_Id :=
Make_Defining_Identifier (Loc,
Chars => New_External_Name (Chars (Typ), "Predicate"));
-- The entity for the function body
Spec : Node_Id;
FBody : Node_Id;
begin
-- The predicate function is shared between views of a type
if Is_Private_Type (Typ) and then Present (Full_View (Typ)) then
Set_Predicate_Function (Full_View (Typ), SId);
end if;
-- Build function body
Spec :=
Make_Function_Specification (Loc,
Defining_Unit_Name => SIdB,
Parameter_Specifications => New_List (
Make_Parameter_Specification (Loc,
Defining_Identifier =>
Make_Defining_Identifier (Loc, Object_Name),
Parameter_Type =>
New_Occurrence_Of (Typ, Loc))),
Result_Definition =>
New_Occurrence_Of (Standard_Boolean, Loc));
FBody :=
Make_Subprogram_Body (Loc,
Specification => Spec,
Declarations => Empty_List,
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
Statements => New_List (
Make_Simple_Return_Statement (Loc,
Expression => Expr))));
-- If declaration has not been analyzed yet, Insert declaration
-- before freeze node. Insert body itself after freeze node.
if not Analyzed (FDecl) then
Insert_Before_And_Analyze (N, FDecl);
end if;
Insert_After_And_Analyze (N, FBody);
-- Static predicate functions are always side-effect free, and
-- in most cases dynamic predicate functions are as well. Mark
-- them as such whenever possible, so redundant predicate checks
-- can be optimized. If there is a variable reference within the
-- expression, the function is not pure.
if Expander_Active then
Set_Is_Pure (SId,
Side_Effect_Free (Expr, Variable_Ref => True));
Set_Is_Inlined (SId);
end if;
end;
-- Test for raise expressions present and if so build M version
if Raise_Expression_Present then
declare
SId : constant Entity_Id :=
Make_Defining_Identifier (Loc,
Chars => New_External_Name (Chars (Typ), "PredicateM"));
-- The entity for the function spec
SIdB : constant Entity_Id :=
Make_Defining_Identifier (Loc,
Chars => New_External_Name (Chars (Typ), "PredicateM"));
-- The entity for the function body
Spec : Node_Id;
FBody : Node_Id;
FDecl : Node_Id;
BTemp : Entity_Id;
begin
-- Mark any raise expressions for special expansion
Process_REs (Expr_M);
-- Build function declaration
Set_Ekind (SId, E_Function);
Set_Is_Predicate_Function_M (SId);
Set_Predicate_Function_M (Typ, SId);
-- The predicate function is shared between views of a type
if Is_Private_Type (Typ) and then Present (Full_View (Typ)) then
Set_Predicate_Function_M (Full_View (Typ), SId);
end if;
Spec :=
Make_Function_Specification (Loc,
Defining_Unit_Name => SId,
Parameter_Specifications => New_List (
Make_Parameter_Specification (Loc,
Defining_Identifier => Object_Entity_M,
Parameter_Type => New_Occurrence_Of (Typ, Loc))),
Result_Definition =>
New_Occurrence_Of (Standard_Boolean, Loc));
FDecl :=
Make_Subprogram_Declaration (Loc,
Specification => Spec);
-- Build function body
Spec :=
Make_Function_Specification (Loc,
Defining_Unit_Name => SIdB,
Parameter_Specifications => New_List (
Make_Parameter_Specification (Loc,
Defining_Identifier =>
Make_Defining_Identifier (Loc, Object_Name),
Parameter_Type =>
New_Occurrence_Of (Typ, Loc))),
Result_Definition =>
New_Occurrence_Of (Standard_Boolean, Loc));
-- Build the body, we declare the boolean expression before
-- doing the return, because we are not really confident of
-- what happens if a return appears within a return.
BTemp :=
Make_Defining_Identifier (Loc,
Chars => New_Internal_Name ('B'));
FBody :=
Make_Subprogram_Body (Loc,
Specification => Spec,
Declarations => New_List (
Make_Object_Declaration (Loc,
Defining_Identifier => BTemp,
Constant_Present => True,
Object_Definition =>
New_Occurrence_Of (Standard_Boolean, Loc),
Expression => Expr_M)),
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
Statements => New_List (
Make_Simple_Return_Statement (Loc,
Expression => New_Occurrence_Of (BTemp, Loc)))));
-- Insert declaration before freeze node and body after
Insert_Before_And_Analyze (N, FDecl);
Insert_After_And_Analyze (N, FBody);
end;
end if;
-- See if we have a static predicate. Note that the answer may be
-- yes even if we have an explicit Dynamic_Predicate present.
declare
PS : Boolean;
EN : Node_Id;
begin
if not Is_Scalar_Type (Typ) and then not Is_String_Type (Typ) then
PS := False;
else
PS := Is_Predicate_Static (Expr, Object_Name);
end if;
-- Case where we have a predicate-static aspect
if PS then
-- We don't set Has_Static_Predicate_Aspect, since we can have
-- any of the three cases (Predicate, Dynamic_Predicate, or
-- Static_Predicate) generating a predicate with an expression
-- that is predicate-static. We just indicate that we have a
-- predicate that can be treated as static.
Set_Has_Static_Predicate (Typ);
-- For discrete subtype, build the static predicate list
if Is_Discrete_Type (Typ) then
Build_Discrete_Static_Predicate (Typ, Expr, Object_Name);
-- If we don't get a static predicate list, it means that we
-- have a case where this is not possible, most typically in
-- the case where we inherit a dynamic predicate. We do not
-- consider this an error, we just leave the predicate as
-- dynamic. But if we do succeed in building the list, then
-- we mark the predicate as static.
if No (Static_Discrete_Predicate (Typ)) then
Set_Has_Static_Predicate (Typ, False);
end if;
-- For real or string subtype, save predicate expression
elsif Is_Real_Type (Typ) or else Is_String_Type (Typ) then
Set_Static_Real_Or_String_Predicate (Typ, Expr);
end if;
-- Case of dynamic predicate (expression is not predicate-static)
else
-- Again, we don't set Has_Dynamic_Predicate_Aspect, since that
-- is only set if we have an explicit Dynamic_Predicate aspect
-- given. Here we may simply have a Predicate aspect where the
-- expression happens not to be predicate-static.
-- Emit an error when the predicate is categorized as static
-- but its expression is not predicate-static.
-- First a little fiddling to get a nice location for the
-- message. If the expression is of the form (A and then B),
-- where A is an inherited predicate, then use the right
-- operand for the Sloc. This avoids getting confused by a call
-- to an inherited predicate with a less convenient source
-- location.
EN := Expr;
while Nkind (EN) = N_And_Then
and then Nkind (Left_Opnd (EN)) = N_Function_Call
and then Is_Predicate_Function
(Entity (Name (Left_Opnd (EN))))
loop
EN := Right_Opnd (EN);
end loop;
-- Now post appropriate message
if Has_Static_Predicate_Aspect (Typ) then
if Is_Scalar_Type (Typ) or else Is_String_Type (Typ) then
Error_Msg_F
("expression is not predicate-static (RM 3.2.4(16-22))",
EN);
else
Error_Msg_F
("static predicate requires scalar or string type", EN);
end if;
end if;
end if;
end;
end if;
Restore_Ghost_Mode (Mode);
end Build_Predicate_Functions;
------------------------------------------
-- Build_Predicate_Function_Declaration --
------------------------------------------
-- WARNING: This routine manages Ghost regions. Return statements must be
-- replaced by gotos which jump to the end of the routine and restore the
-- Ghost mode.
function Build_Predicate_Function_Declaration
(Typ : Entity_Id) return Node_Id
is
Loc : constant Source_Ptr := Sloc (Typ);
Func_Decl : Node_Id;
Func_Id : Entity_Id;
Mode : Ghost_Mode_Type;
Spec : Node_Id;
begin
-- The related type may be subject to pragma Ghost. Set the mode now to
-- ensure that the predicate functions are properly marked as Ghost.
Set_Ghost_Mode (Typ, Mode);
Func_Id :=
Make_Defining_Identifier (Loc,
Chars => New_External_Name (Chars (Typ), "Predicate"));
Spec :=
Make_Function_Specification (Loc,
Defining_Unit_Name => Func_Id,
Parameter_Specifications => New_List (
Make_Parameter_Specification (Loc,
Defining_Identifier => Make_Temporary (Loc, 'I'),
Parameter_Type => New_Occurrence_Of (Typ, Loc))),
Result_Definition =>
New_Occurrence_Of (Standard_Boolean, Loc));
Func_Decl := Make_Subprogram_Declaration (Loc, Specification => Spec);
Set_Ekind (Func_Id, E_Function);
Set_Etype (Func_Id, Standard_Boolean);
Set_Is_Internal (Func_Id);
Set_Is_Predicate_Function (Func_Id);
Set_Predicate_Function (Typ, Func_Id);
Insert_After (Parent (Typ), Func_Decl);
Analyze (Func_Decl);
Restore_Ghost_Mode (Mode);
return Func_Decl;
end Build_Predicate_Function_Declaration;
-----------------------------------------
-- Check_Aspect_At_End_Of_Declarations --
-----------------------------------------
procedure Check_Aspect_At_End_Of_Declarations (ASN : Node_Id) is
Ent : constant Entity_Id := Entity (ASN);
Ident : constant Node_Id := Identifier (ASN);
A_Id : constant Aspect_Id := Get_Aspect_Id (Chars (Ident));
End_Decl_Expr : constant Node_Id := Entity (Ident);
-- Expression to be analyzed at end of declarations
Freeze_Expr : constant Node_Id := Expression (ASN);
-- Expression from call to Check_Aspect_At_Freeze_Point.
T : constant Entity_Id := Etype (Original_Node (Freeze_Expr));
-- Type required for preanalyze call. We use the original expression to
-- get the proper type, to prevent cascaded errors when the expression
-- is constant-folded.
Err : Boolean;
-- Set False if error
-- On entry to this procedure, Entity (Ident) contains a copy of the
-- original expression from the aspect, saved for this purpose, and
-- but Expression (Ident) is a preanalyzed copy of the expression,
-- preanalyzed just after the freeze point.
procedure Check_Overloaded_Name;
-- For aspects whose expression is simply a name, this routine checks if
-- the name is overloaded or not. If so, it verifies there is an
-- interpretation that matches the entity obtained at the freeze point,
-- otherwise the compiler complains.
---------------------------
-- Check_Overloaded_Name --
---------------------------
procedure Check_Overloaded_Name is
begin
if not Is_Overloaded (End_Decl_Expr) then
Err := not Is_Entity_Name (End_Decl_Expr)
or else Entity (End_Decl_Expr) /= Entity (Freeze_Expr);
else
Err := True;
declare
Index : Interp_Index;
It : Interp;
begin
Get_First_Interp (End_Decl_Expr, Index, It);
while Present (It.Typ) loop
if It.Nam = Entity (Freeze_Expr) then
Err := False;
exit;
end if;
Get_Next_Interp (Index, It);
end loop;
end;
end if;
end Check_Overloaded_Name;
-- Start of processing for Check_Aspect_At_End_Of_Declarations
begin
-- In an instance we do not perform the consistency check between freeze
-- point and end of declarations, because it was done already in the
-- analysis of the generic. Furthermore, the delayed analysis of an
-- aspect of the instance may produce spurious errors when the generic
-- is a child unit that references entities in the parent (which might
-- not be in scope at the freeze point of the instance).
if In_Instance then
return;
-- Case of aspects Dimension, Dimension_System and Synchronization
elsif A_Id = Aspect_Synchronization then
return;
-- Case of stream attributes, just have to compare entities. However,
-- the expression is just a name (possibly overloaded), and there may
-- be stream operations declared for unrelated types, so we just need
-- to verify that one of these interpretations is the one available at
-- at the freeze point.
elsif A_Id = Aspect_Input or else
A_Id = Aspect_Output or else
A_Id = Aspect_Read or else
A_Id = Aspect_Write
then
Analyze (End_Decl_Expr);
Check_Overloaded_Name;
elsif A_Id = Aspect_Variable_Indexing or else
A_Id = Aspect_Constant_Indexing or else
A_Id = Aspect_Default_Iterator or else
A_Id = Aspect_Iterator_Element
then
-- Make type unfrozen before analysis, to prevent spurious errors
-- about late attributes.
Set_Is_Frozen (Ent, False);
Analyze (End_Decl_Expr);
Set_Is_Frozen (Ent, True);
-- If the end of declarations comes before any other freeze
-- point, the Freeze_Expr is not analyzed: no check needed.
if Analyzed (Freeze_Expr) and then not In_Instance then
Check_Overloaded_Name;
else
Err := False;
end if;
-- All other cases
else
-- Indicate that the expression comes from an aspect specification,
-- which is used in subsequent analysis even if expansion is off.
Set_Parent (End_Decl_Expr, ASN);
-- In a generic context the aspect expressions have not been
-- preanalyzed, so do it now. There are no conformance checks
-- to perform in this case.
if No (T) then
Check_Aspect_At_Freeze_Point (ASN);
return;
-- The default values attributes may be defined in the private part,
-- and the analysis of the expression may take place when only the
-- partial view is visible. The expression must be scalar, so use
-- the full view to resolve.
elsif (A_Id = Aspect_Default_Value
or else
A_Id = Aspect_Default_Component_Value)
and then Is_Private_Type (T)
then
Preanalyze_Spec_Expression (End_Decl_Expr, Full_View (T));
else
Preanalyze_Spec_Expression (End_Decl_Expr, T);
end if;
Err := not Fully_Conformant_Expressions (End_Decl_Expr, Freeze_Expr);
end if;
-- Output error message if error. Force error on aspect specification
-- even if there is an error on the expression itself.
if Err then
Error_Msg_NE
("!visibility of aspect for& changes after freeze point",
ASN, Ent);
Error_Msg_NE
("info: & is frozen here, aspects evaluated at this point??",
Freeze_Node (Ent), Ent);
end if;
end Check_Aspect_At_End_Of_Declarations;
----------------------------------
-- Check_Aspect_At_Freeze_Point --
----------------------------------
procedure Check_Aspect_At_Freeze_Point (ASN : Node_Id) is
Ident : constant Node_Id := Identifier (ASN);
-- Identifier (use Entity field to save expression)
A_Id : constant Aspect_Id := Get_Aspect_Id (Chars (Ident));
T : Entity_Id := Empty;
-- Type required for preanalyze call
begin
-- On entry to this procedure, Entity (Ident) contains a copy of the
-- original expression from the aspect, saved for this purpose.
-- On exit from this procedure Entity (Ident) is unchanged, still
-- containing that copy, but Expression (Ident) is a preanalyzed copy
-- of the expression, preanalyzed just after the freeze point.
-- Make a copy of the expression to be preanalyzed
Set_Expression (ASN, New_Copy_Tree (Entity (Ident)));
-- Find type for preanalyze call
case A_Id is
-- No_Aspect should be impossible
when No_Aspect =>
raise Program_Error;
-- Aspects taking an optional boolean argument
when Boolean_Aspects
| Library_Unit_Aspects
=>
T := Standard_Boolean;
-- Aspects corresponding to attribute definition clauses
when Aspect_Address =>
T := RTE (RE_Address);
when Aspect_Attach_Handler =>
T := RTE (RE_Interrupt_ID);
when Aspect_Bit_Order
| Aspect_Scalar_Storage_Order
=>
T := RTE (RE_Bit_Order);
when Aspect_Convention =>
return;
when Aspect_CPU =>
T := RTE (RE_CPU_Range);
-- Default_Component_Value is resolved with the component type
when Aspect_Default_Component_Value =>
T := Component_Type (Entity (ASN));
when Aspect_Default_Storage_Pool =>
T := Class_Wide_Type (RTE (RE_Root_Storage_Pool));
-- Default_Value is resolved with the type entity in question
when Aspect_Default_Value =>
T := Entity (ASN);
when Aspect_Dispatching_Domain =>
T := RTE (RE_Dispatching_Domain);
when Aspect_External_Tag =>
T := Standard_String;
when Aspect_External_Name =>
T := Standard_String;
when Aspect_Link_Name =>
T := Standard_String;
when Aspect_Interrupt_Priority
| Aspect_Priority
=>
T := Standard_Integer;
when Aspect_Relative_Deadline =>
T := RTE (RE_Time_Span);
when Aspect_Secondary_Stack_Size =>
T := Standard_Integer;
when Aspect_Small =>
T := Universal_Real;
-- For a simple storage pool, we have to retrieve the type of the
-- pool object associated with the aspect's corresponding attribute
-- definition clause.
when Aspect_Simple_Storage_Pool =>
T := Etype (Expression (Aspect_Rep_Item (ASN)));
when Aspect_Storage_Pool =>
T := Class_Wide_Type (RTE (RE_Root_Storage_Pool));
when Aspect_Alignment
| Aspect_Component_Size
| Aspect_Machine_Radix
| Aspect_Object_Size
| Aspect_Size
| Aspect_Storage_Size
| Aspect_Stream_Size
| Aspect_Value_Size
=>
T := Any_Integer;
when Aspect_Linker_Section =>
T := Standard_String;
when Aspect_Synchronization =>
return;
-- Special case, the expression of these aspects is just an entity
-- that does not need any resolution, so just analyze.
when Aspect_Input
| Aspect_Output
| Aspect_Read
| Aspect_Suppress
| Aspect_Unsuppress
| Aspect_Warnings
| Aspect_Write
=>
Analyze (Expression (ASN));
return;
-- Same for Iterator aspects, where the expression is a function
-- name. Legality rules are checked separately.
when Aspect_Constant_Indexing
| Aspect_Default_Iterator
| Aspect_Iterator_Element
| Aspect_Variable_Indexing
=>
Analyze (Expression (ASN));
return;
-- Ditto for Iterable, legality checks in Validate_Iterable_Aspect.
when Aspect_Iterable =>
T := Entity (ASN);
declare
Cursor : constant Entity_Id := Get_Cursor_Type (ASN, T);
Assoc : Node_Id;
Expr : Node_Id;
begin
if Cursor = Any_Type then
return;
end if;
Assoc := First (Component_Associations (Expression (ASN)));
while Present (Assoc) loop
Expr := Expression (Assoc);
Analyze (Expr);
if not Error_Posted (Expr) then
Resolve_Iterable_Operation
(Expr, Cursor, T, Chars (First (Choices (Assoc))));
end if;
Next (Assoc);
end loop;
end;
return;
-- Invariant/Predicate take boolean expressions
when Aspect_Dynamic_Predicate
| Aspect_Invariant
| Aspect_Predicate
| Aspect_Static_Predicate
| Aspect_Type_Invariant
=>
T := Standard_Boolean;
when Aspect_Predicate_Failure =>
T := Standard_String;
-- Here is the list of aspects that don't require delay analysis
when Aspect_Abstract_State
| Aspect_Annotate
| Aspect_Async_Readers
| Aspect_Async_Writers
| Aspect_Constant_After_Elaboration
| Aspect_Contract_Cases
| Aspect_Default_Initial_Condition
| Aspect_Depends
| Aspect_Dimension
| Aspect_Dimension_System
| Aspect_Effective_Reads
| Aspect_Effective_Writes
| Aspect_Extensions_Visible
| Aspect_Ghost
| Aspect_Global
| Aspect_Implicit_Dereference
| Aspect_Initial_Condition
| Aspect_Initializes
| Aspect_Max_Queue_Length
| Aspect_Obsolescent
| Aspect_Part_Of
| Aspect_Post
| Aspect_Postcondition
| Aspect_Pre
| Aspect_Precondition
| Aspect_Refined_Depends
| Aspect_Refined_Global
| Aspect_Refined_Post
| Aspect_Refined_State
| Aspect_SPARK_Mode
| Aspect_Test_Case
| Aspect_Unimplemented
| Aspect_Volatile_Function
=>
raise Program_Error;
end case;
-- Do the preanalyze call
Preanalyze_Spec_Expression (Expression (ASN), T);
end Check_Aspect_At_Freeze_Point;
-----------------------------------
-- Check_Constant_Address_Clause --
-----------------------------------
procedure Check_Constant_Address_Clause
(Expr : Node_Id;
U_Ent : Entity_Id)
is
procedure Check_At_Constant_Address (Nod : Node_Id);
-- Checks that the given node N represents a name whose 'Address is
-- constant (in the same sense as OK_Constant_Address_Clause, i.e. the
-- address value is the same at the point of declaration of U_Ent and at
-- the time of elaboration of the address clause.
procedure Check_Expr_Constants (Nod : Node_Id);
-- Checks that Nod meets the requirements for a constant address clause
-- in the sense of the enclosing procedure.
procedure Check_List_Constants (Lst : List_Id);
-- Check that all elements of list Lst meet the requirements for a
-- constant address clause in the sense of the enclosing procedure.
-------------------------------
-- Check_At_Constant_Address --
-------------------------------
procedure Check_At_Constant_Address (Nod : Node_Id) is
begin
if Is_Entity_Name (Nod) then
if Present (Address_Clause (Entity ((Nod)))) then
Error_Msg_NE
("invalid address clause for initialized object &!",
Nod, U_Ent);
Error_Msg_NE
("address for& cannot depend on another address clause! "
& "(RM 13.1(22))!", Nod, U_Ent);
elsif In_Same_Source_Unit (Entity (Nod), U_Ent)
and then Sloc (U_Ent) < Sloc (Entity (Nod))
then
Error_Msg_NE
("invalid address clause for initialized object &!",
Nod, U_Ent);
Error_Msg_Node_2 := U_Ent;
Error_Msg_NE
("\& must be defined before & (RM 13.1(22))!",
Nod, Entity (Nod));
end if;
elsif Nkind (Nod) = N_Selected_Component then
declare
T : constant Entity_Id := Etype (Prefix (Nod));
begin
if (Is_Record_Type (T)
and then Has_Discriminants (T))
or else
(Is_Access_Type (T)
and then Is_Record_Type (Designated_Type (T))
and then Has_Discriminants (Designated_Type (T)))
then
Error_Msg_NE
("invalid address clause for initialized object &!",
Nod, U_Ent);
Error_Msg_N
("\address cannot depend on component of discriminated "
& "record (RM 13.1(22))!", Nod);
else
Check_At_Constant_Address (Prefix (Nod));
end if;
end;
elsif Nkind (Nod) = N_Indexed_Component then
Check_At_Constant_Address (Prefix (Nod));
Check_List_Constants (Expressions (Nod));
else
Check_Expr_Constants (Nod);
end if;
end Check_At_Constant_Address;
--------------------------
-- Check_Expr_Constants --
--------------------------
procedure Check_Expr_Constants (Nod : Node_Id) is
Loc_U_Ent : constant Source_Ptr := Sloc (U_Ent);
Ent : Entity_Id := Empty;
begin
if Nkind (Nod) in N_Has_Etype
and then Etype (Nod) = Any_Type
then
return;
end if;
case Nkind (Nod) is
when N_Empty
| N_Error
=>
return;
when N_Expanded_Name
| N_Identifier
=>
Ent := Entity (Nod);
-- We need to look at the original node if it is different
-- from the node, since we may have rewritten things and
-- substituted an identifier representing the rewrite.
if Original_Node (Nod) /= Nod then
Check_Expr_Constants (Original_Node (Nod));
-- If the node is an object declaration without initial
-- value, some code has been expanded, and the expression
-- is not constant, even if the constituents might be
-- acceptable, as in A'Address + offset.
if Ekind (Ent) = E_Variable
and then
Nkind (Declaration_Node (Ent)) = N_Object_Declaration
and then
No (Expression (Declaration_Node (Ent)))
then
Error_Msg_NE
("invalid address clause for initialized object &!",
Nod, U_Ent);
-- If entity is constant, it may be the result of expanding
-- a check. We must verify that its declaration appears
-- before the object in question, else we also reject the
-- address clause.
elsif Ekind (Ent) = E_Constant
and then In_Same_Source_Unit (Ent, U_Ent)
and then Sloc (Ent) > Loc_U_Ent
then
Error_Msg_NE
("invalid address clause for initialized object &!",
Nod, U_Ent);
end if;
return;
end if;
-- Otherwise look at the identifier and see if it is OK
if Ekind_In (Ent, E_Named_Integer, E_Named_Real)
or else Is_Type (Ent)
then
return;
elsif Ekind_In (Ent, E_Constant, E_In_Parameter) then
-- This is the case where we must have Ent defined before
-- U_Ent. Clearly if they are in different units this
-- requirement is met since the unit containing Ent is
-- already processed.
if not In_Same_Source_Unit (Ent, U_Ent) then
return;
-- Otherwise location of Ent must be before the location
-- of U_Ent, that's what prior defined means.
elsif Sloc (Ent) < Loc_U_Ent then
return;
else
Error_Msg_NE
("invalid address clause for initialized object &!",
Nod, U_Ent);
Error_Msg_Node_2 := U_Ent;
Error_Msg_NE
("\& must be defined before & (RM 13.1(22))!",
Nod, Ent);
end if;
elsif Nkind (Original_Node (Nod)) = N_Function_Call then
Check_Expr_Constants (Original_Node (Nod));
else
Error_Msg_NE
("invalid address clause for initialized object &!",
Nod, U_Ent);
if Comes_From_Source (Ent) then
Error_Msg_NE
("\reference to variable& not allowed"
& " (RM 13.1(22))!", Nod, Ent);
else
Error_Msg_N
("non-static expression not allowed"
& " (RM 13.1(22))!", Nod);
end if;
end if;
when N_Integer_Literal =>
-- If this is a rewritten unchecked conversion, in a system
-- where Address is an integer type, always use the base type
-- for a literal value. This is user-friendly and prevents
-- order-of-elaboration issues with instances of unchecked
-- conversion.
if Nkind (Original_Node (Nod)) = N_Function_Call then
Set_Etype (Nod, Base_Type (Etype (Nod)));
end if;
when N_Character_Literal
| N_Real_Literal
| N_String_Literal
=>
return;
when N_Range =>
Check_Expr_Constants (Low_Bound (Nod));
Check_Expr_Constants (High_Bound (Nod));
when N_Explicit_Dereference =>
Check_Expr_Constants (Prefix (Nod));
when N_Indexed_Component =>
Check_Expr_Constants (Prefix (Nod));
Check_List_Constants (Expressions (Nod));
when N_Slice =>
Check_Expr_Constants (Prefix (Nod));
Check_Expr_Constants (Discrete_Range (Nod));
when N_Selected_Component =>
Check_Expr_Constants (Prefix (Nod));
when N_Attribute_Reference =>
if Nam_In (Attribute_Name (Nod), Name_Address,
Name_Access,
Name_Unchecked_Access,
Name_Unrestricted_Access)
then
Check_At_Constant_Address (Prefix (Nod));
else
Check_Expr_Constants (Prefix (Nod));
Check_List_Constants (Expressions (Nod));
end if;
when N_Aggregate =>
Check_List_Constants (Component_Associations (Nod));
Check_List_Constants (Expressions (Nod));
when N_Component_Association =>
Check_Expr_Constants (Expression (Nod));
when N_Extension_Aggregate =>
Check_Expr_Constants (Ancestor_Part (Nod));
Check_List_Constants (Component_Associations (Nod));
Check_List_Constants (Expressions (Nod));
when N_Null =>
return;
when N_Binary_Op
| N_Membership_Test
| N_Short_Circuit
=>
Check_Expr_Constants (Left_Opnd (Nod));
Check_Expr_Constants (Right_Opnd (Nod));
when N_Unary_Op =>
Check_Expr_Constants (Right_Opnd (Nod));
when N_Allocator
| N_Qualified_Expression
| N_Type_Conversion
| N_Unchecked_Type_Conversion
=>
Check_Expr_Constants (Expression (Nod));
when N_Function_Call =>
if not Is_Pure (Entity (Name (Nod))) then
Error_Msg_NE
("invalid address clause for initialized object &!",
Nod, U_Ent);
Error_Msg_NE
("\function & is not pure (RM 13.1(22))!",
Nod, Entity (Name (Nod)));
else
Check_List_Constants (Parameter_Associations (Nod));
end if;
when N_Parameter_Association =>
Check_Expr_Constants (Explicit_Actual_Parameter (Nod));
when others =>
Error_Msg_NE
("invalid address clause for initialized object &!",
Nod, U_Ent);
Error_Msg_NE
("\must be constant defined before& (RM 13.1(22))!",
Nod, U_Ent);
end case;
end Check_Expr_Constants;
--------------------------
-- Check_List_Constants --
--------------------------
procedure Check_List_Constants (Lst : List_Id) is
Nod1 : Node_Id;
begin
if Present (Lst) then
Nod1 := First (Lst);
while Present (Nod1) loop
Check_Expr_Constants (Nod1);
Next (Nod1);
end loop;
end if;
end Check_List_Constants;
-- Start of processing for Check_Constant_Address_Clause
begin
-- If rep_clauses are to be ignored, no need for legality checks. In
-- particular, no need to pester user about rep clauses that violate the
-- rule on constant addresses, given that these clauses will be removed
-- by Freeze before they reach the back end. Similarly in CodePeer mode,
-- we want to relax these checks.
if not Ignore_Rep_Clauses and not CodePeer_Mode then
Check_Expr_Constants (Expr);
end if;
end Check_Constant_Address_Clause;
---------------------------
-- Check_Pool_Size_Clash --
---------------------------
procedure Check_Pool_Size_Clash (Ent : Entity_Id; SP, SS : Node_Id) is
Post : Node_Id;
begin
-- We need to find out which one came first. Note that in the case of
-- aspects mixed with pragmas there are cases where the processing order
-- is reversed, which is why we do the check here.
if Sloc (SP) < Sloc (SS) then
Error_Msg_Sloc := Sloc (SP);
Post := SS;
Error_Msg_NE ("Storage_Pool previously given for&#", Post, Ent);
else
Error_Msg_Sloc := Sloc (SS);
Post := SP;
Error_Msg_NE ("Storage_Size previously given for&#", Post, Ent);
end if;
Error_Msg_N
("\cannot have Storage_Size and Storage_Pool (RM 13.11(3))", Post);
end Check_Pool_Size_Clash;
----------------------------------------
-- Check_Record_Representation_Clause --
----------------------------------------
procedure Check_Record_Representation_Clause (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Ident : constant Node_Id := Identifier (N);
Rectype : Entity_Id;
Fent : Entity_Id;
CC : Node_Id;
Fbit : Uint;
Lbit : Uint;
Hbit : Uint := Uint_0;
Comp : Entity_Id;
Pcomp : Entity_Id;
Max_Bit_So_Far : Uint;
-- Records the maximum bit position so far. If all field positions
-- are monotonically increasing, then we can skip the circuit for
-- checking for overlap, since no overlap is possible.
Tagged_Parent : Entity_Id := Empty;
-- This is set in the case of a derived tagged type for which we have
-- Is_Fully_Repped_Tagged_Type True (indicating that all components are
-- positioned by record representation clauses). In this case we must
-- check for overlap between components of this tagged type, and the
-- components of its parent. Tagged_Parent will point to this parent
-- type. For all other cases Tagged_Parent is left set to Empty.
Parent_Last_Bit : Uint;
-- Relevant only if Tagged_Parent is set, Parent_Last_Bit indicates the
-- last bit position for any field in the parent type. We only need to
-- check overlap for fields starting below this point.
Overlap_Check_Required : Boolean;
-- Used to keep track of whether or not an overlap check is required
Overlap_Detected : Boolean := False;
-- Set True if an overlap is detected
Ccount : Natural := 0;
-- Number of component clauses in record rep clause
procedure Check_Component_Overlap (C1_Ent, C2_Ent : Entity_Id);
-- Given two entities for record components or discriminants, checks
-- if they have overlapping component clauses and issues errors if so.
procedure Find_Component;
-- Finds component entity corresponding to current component clause (in
-- CC), and sets Comp to the entity, and Fbit/Lbit to the zero origin
-- start/stop bits for the field. If there is no matching component or
-- if the matching component does not have a component clause, then
-- that's an error and Comp is set to Empty, but no error message is
-- issued, since the message was already given. Comp is also set to
-- Empty if the current "component clause" is in fact a pragma.
-----------------------------
-- Check_Component_Overlap --
-----------------------------
procedure Check_Component_Overlap (C1_Ent, C2_Ent : Entity_Id) is
CC1 : constant Node_Id := Component_Clause (C1_Ent);
CC2 : constant Node_Id := Component_Clause (C2_Ent);
begin
if Present (CC1) and then Present (CC2) then
-- Exclude odd case where we have two tag components in the same
-- record, both at location zero. This seems a bit strange, but
-- it seems to happen in some circumstances, perhaps on an error.
if Nam_In (Chars (C1_Ent), Name_uTag, Name_uTag) then
return;
end if;
-- Here we check if the two fields overlap
declare
S1 : constant Uint := Component_Bit_Offset (C1_Ent);
S2 : constant Uint := Component_Bit_Offset (C2_Ent);
E1 : constant Uint := S1 + Esize (C1_Ent);
E2 : constant Uint := S2 + Esize (C2_Ent);
begin
if E2 <= S1 or else E1 <= S2 then
null;
else
Error_Msg_Node_2 := Component_Name (CC2);
Error_Msg_Sloc := Sloc (Error_Msg_Node_2);
Error_Msg_Node_1 := Component_Name (CC1);
Error_Msg_N
("component& overlaps & #", Component_Name (CC1));
Overlap_Detected := True;
end if;
end;
end if;
end Check_Component_Overlap;
--------------------
-- Find_Component --
--------------------
procedure Find_Component is
procedure Search_Component (R : Entity_Id);
-- Search components of R for a match. If found, Comp is set
----------------------
-- Search_Component --
----------------------
procedure Search_Component (R : Entity_Id) is
begin
Comp := First_Component_Or_Discriminant (R);
while Present (Comp) loop
-- Ignore error of attribute name for component name (we
-- already gave an error message for this, so no need to
-- complain here)
if Nkind (Component_Name (CC)) = N_Attribute_Reference then
null;
else
exit when Chars (Comp) = Chars (Component_Name (CC));
end if;
Next_Component_Or_Discriminant (Comp);
end loop;
end Search_Component;
-- Start of processing for Find_Component
begin
-- Return with Comp set to Empty if we have a pragma
if Nkind (CC) = N_Pragma then
Comp := Empty;
return;
end if;
-- Search current record for matching component
Search_Component (Rectype);
-- If not found, maybe component of base type discriminant that is
-- absent from statically constrained first subtype.
if No (Comp) then
Search_Component (Base_Type (Rectype));
end if;
-- If no component, or the component does not reference the component
-- clause in question, then there was some previous error for which
-- we already gave a message, so just return with Comp Empty.
if No (Comp) or else Component_Clause (Comp) /= CC then
Check_Error_Detected;
Comp := Empty;
-- Normal case where we have a component clause
else
Fbit := Component_Bit_Offset (Comp);
Lbit := Fbit + Esize (Comp) - 1;
end if;
end Find_Component;
-- Start of processing for Check_Record_Representation_Clause
begin
Find_Type (Ident);
Rectype := Entity (Ident);
if Rectype = Any_Type then
return;
else
Rectype := Underlying_Type (Rectype);
end if;
-- See if we have a fully repped derived tagged type
declare
PS : constant Entity_Id := Parent_Subtype (Rectype);
begin
if Present (PS) and then Is_Fully_Repped_Tagged_Type (PS) then
Tagged_Parent := PS;
-- Find maximum bit of any component of the parent type
Parent_Last_Bit := UI_From_Int (System_Address_Size - 1);
Pcomp := First_Entity (Tagged_Parent);
while Present (Pcomp) loop
if Ekind_In (Pcomp, E_Discriminant, E_Component) then
if Component_Bit_Offset (Pcomp) /= No_Uint
and then Known_Static_Esize (Pcomp)
then
Parent_Last_Bit :=
UI_Max
(Parent_Last_Bit,
Component_Bit_Offset (Pcomp) + Esize (Pcomp) - 1);
end if;
else
-- Skip anonymous types generated for constrained array
-- or record components.
null;
end if;
Next_Entity (Pcomp);
end loop;
end if;
end;
-- All done if no component clauses
CC := First (Component_Clauses (N));
if No (CC) then
return;
end if;
-- If a tag is present, then create a component clause that places it
-- at the start of the record (otherwise gigi may place it after other
-- fields that have rep clauses).
Fent := First_Entity (Rectype);
if Nkind (Fent) = N_Defining_Identifier
and then Chars (Fent) = Name_uTag
then
Set_Component_Bit_Offset (Fent, Uint_0);
Set_Normalized_Position (Fent, Uint_0);
Set_Normalized_First_Bit (Fent, Uint_0);
Set_Normalized_Position_Max (Fent, Uint_0);
Init_Esize (Fent, System_Address_Size);
Set_Component_Clause (Fent,
Make_Component_Clause (Loc,
Component_Name => Make_Identifier (Loc, Name_uTag),
Position => Make_Integer_Literal (Loc, Uint_0),
First_Bit => Make_Integer_Literal (Loc, Uint_0),
Last_Bit =>
Make_Integer_Literal (Loc,
UI_From_Int (System_Address_Size))));
Ccount := Ccount + 1;
end if;
Max_Bit_So_Far := Uint_Minus_1;
Overlap_Check_Required := False;
-- Process the component clauses
while Present (CC) loop
Find_Component;
if Present (Comp) then
Ccount := Ccount + 1;
-- We need a full overlap check if record positions non-monotonic
if Fbit <= Max_Bit_So_Far then
Overlap_Check_Required := True;
end if;
Max_Bit_So_Far := Lbit;
-- Check bit position out of range of specified size
if Has_Size_Clause (Rectype)
and then RM_Size (Rectype) <= Lbit
then
Error_Msg_N
("bit number out of range of specified size",
Last_Bit (CC));
-- Check for overlap with tag component
else
if Is_Tagged_Type (Rectype)
and then Fbit < System_Address_Size
then
Error_Msg_NE
("component overlaps tag field of&",
Component_Name (CC), Rectype);
Overlap_Detected := True;
end if;
if Hbit < Lbit then
Hbit := Lbit;
end if;
end if;
-- Check parent overlap if component might overlap parent field
if Present (Tagged_Parent) and then Fbit <= Parent_Last_Bit then
Pcomp := First_Component_Or_Discriminant (Tagged_Parent);
while Present (Pcomp) loop
if not Is_Tag (Pcomp)
and then Chars (Pcomp) /= Name_uParent
then
Check_Component_Overlap (Comp, Pcomp);
end if;
Next_Component_Or_Discriminant (Pcomp);
end loop;
end if;
end if;
Next (CC);
end loop;
-- Now that we have processed all the component clauses, check for
-- overlap. We have to leave this till last, since the components can
-- appear in any arbitrary order in the representation clause.
-- We do not need this check if all specified ranges were monotonic,
-- as recorded by Overlap_Check_Required being False at this stage.
-- This first section checks if there are any overlapping entries at
-- all. It does this by sorting all entries and then seeing if there are
-- any overlaps. If there are none, then that is decisive, but if there
-- are overlaps, they may still be OK (they may result from fields in
-- different variants).
if Overlap_Check_Required then
Overlap_Check1 : declare
OC_Fbit : array (0 .. Ccount) of Uint;
-- First-bit values for component clauses, the value is the offset
-- of the first bit of the field from start of record. The zero
-- entry is for use in sorting.
OC_Lbit : array (0 .. Ccount) of Uint;
-- Last-bit values for component clauses, the value is the offset
-- of the last bit of the field from start of record. The zero
-- entry is for use in sorting.
OC_Count : Natural := 0;
-- Count of entries in OC_Fbit and OC_Lbit
function OC_Lt (Op1, Op2 : Natural) return Boolean;
-- Compare routine for Sort
procedure OC_Move (From : Natural; To : Natural);
-- Move routine for Sort
package Sorting is new GNAT.Heap_Sort_G (OC_Move, OC_Lt);
-----------
-- OC_Lt --
-----------
function OC_Lt (Op1, Op2 : Natural) return Boolean is
begin
return OC_Fbit (Op1) < OC_Fbit (Op2);
end OC_Lt;
-------------
-- OC_Move --
-------------
procedure OC_Move (From : Natural; To : Natural) is
begin
OC_Fbit (To) := OC_Fbit (From);
OC_Lbit (To) := OC_Lbit (From);
end OC_Move;
-- Start of processing for Overlap_Check
begin
CC := First (Component_Clauses (N));
while Present (CC) loop
-- Exclude component clause already marked in error
if not Error_Posted (CC) then
Find_Component;
if Present (Comp) then
OC_Count := OC_Count + 1;
OC_Fbit (OC_Count) := Fbit;
OC_Lbit (OC_Count) := Lbit;
end if;
end if;
Next (CC);
end loop;
Sorting.Sort (OC_Count);
Overlap_Check_Required := False;
for J in 1 .. OC_Count - 1 loop
if OC_Lbit (J) >= OC_Fbit (J + 1) then
Overlap_Check_Required := True;
exit;
end if;
end loop;
end Overlap_Check1;
end if;
-- If Overlap_Check_Required is still True, then we have to do the full
-- scale overlap check, since we have at least two fields that do
-- overlap, and we need to know if that is OK since they are in
-- different variant, or whether we have a definite problem.
if Overlap_Check_Required then
Overlap_Check2 : declare
C1_Ent, C2_Ent : Entity_Id;
-- Entities of components being checked for overlap
Clist : Node_Id;
-- Component_List node whose Component_Items are being checked
Citem : Node_Id;
-- Component declaration for component being checked
begin
C1_Ent := First_Entity (Base_Type (Rectype));
-- Loop through all components in record. For each component check
-- for overlap with any of the preceding elements on the component
-- list containing the component and also, if the component is in
-- a variant, check against components outside the case structure.
-- This latter test is repeated recursively up the variant tree.
Main_Component_Loop : while Present (C1_Ent) loop
if not Ekind_In (C1_Ent, E_Component, E_Discriminant) then
goto Continue_Main_Component_Loop;
end if;
-- Skip overlap check if entity has no declaration node. This
-- happens with discriminants in constrained derived types.
-- Possibly we are missing some checks as a result, but that
-- does not seem terribly serious.
if No (Declaration_Node (C1_Ent)) then
goto Continue_Main_Component_Loop;
end if;
Clist := Parent (List_Containing (Declaration_Node (C1_Ent)));
-- Loop through component lists that need checking. Check the
-- current component list and all lists in variants above us.
Component_List_Loop : loop
-- If derived type definition, go to full declaration
-- If at outer level, check discriminants if there are any.
if Nkind (Clist) = N_Derived_Type_Definition then
Clist := Parent (Clist);
end if;
-- Outer level of record definition, check discriminants
if Nkind_In (Clist, N_Full_Type_Declaration,
N_Private_Type_Declaration)
then
if Has_Discriminants (Defining_Identifier (Clist)) then
C2_Ent :=
First_Discriminant (Defining_Identifier (Clist));
while Present (C2_Ent) loop
exit when C1_Ent = C2_Ent;
Check_Component_Overlap (C1_Ent, C2_Ent);
Next_Discriminant (C2_Ent);
end loop;
end if;
-- Record extension case
elsif Nkind (Clist) = N_Derived_Type_Definition then
Clist := Empty;
-- Otherwise check one component list
else
Citem := First (Component_Items (Clist));
while Present (Citem) loop
if Nkind (Citem) = N_Component_Declaration then
C2_Ent := Defining_Identifier (Citem);
exit when C1_Ent = C2_Ent;
Check_Component_Overlap (C1_Ent, C2_Ent);
end if;
Next (Citem);
end loop;
end if;
-- Check for variants above us (the parent of the Clist can
-- be a variant, in which case its parent is a variant part,
-- and the parent of the variant part is a component list
-- whose components must all be checked against the current
-- component for overlap).
if Nkind (Parent (Clist)) = N_Variant then
Clist := Parent (Parent (Parent (Clist)));
-- Check for possible discriminant part in record, this
-- is treated essentially as another level in the
-- recursion. For this case the parent of the component
-- list is the record definition, and its parent is the
-- full type declaration containing the discriminant
-- specifications.
elsif Nkind (Parent (Clist)) = N_Record_Definition then
Clist := Parent (Parent ((Clist)));
-- If neither of these two cases, we are at the top of
-- the tree.
else
exit Component_List_Loop;
end if;
end loop Component_List_Loop;
<<Continue_Main_Component_Loop>>
Next_Entity (C1_Ent);
end loop Main_Component_Loop;
end Overlap_Check2;
end if;
-- The following circuit deals with warning on record holes (gaps). We
-- skip this check if overlap was detected, since it makes sense for the
-- programmer to fix this illegality before worrying about warnings.
if not Overlap_Detected and Warn_On_Record_Holes then
Record_Hole_Check : declare
Decl : constant Node_Id := Declaration_Node (Base_Type (Rectype));
-- Full declaration of record type
procedure Check_Component_List
(CL : Node_Id;
Sbit : Uint;
DS : List_Id);
-- Check component list CL for holes. The starting bit should be
-- Sbit. which is zero for the main record component list and set
-- appropriately for recursive calls for variants. DS is set to
-- a list of discriminant specifications to be included in the
-- consideration of components. It is No_List if none to consider.
--------------------------
-- Check_Component_List --
--------------------------
procedure Check_Component_List
(CL : Node_Id;
Sbit : Uint;
DS : List_Id)
is
Compl : Integer;
begin
Compl := Integer (List_Length (Component_Items (CL)));
if DS /= No_List then
Compl := Compl + Integer (List_Length (DS));
end if;
declare
Comps : array (Natural range 0 .. Compl) of Entity_Id;
-- Gather components (zero entry is for sort routine)
Ncomps : Natural := 0;
-- Number of entries stored in Comps (starting at Comps (1))
Citem : Node_Id;
-- One component item or discriminant specification
Nbit : Uint;
-- Starting bit for next component
CEnt : Entity_Id;
-- Component entity
Variant : Node_Id;
-- One variant
function Lt (Op1, Op2 : Natural) return Boolean;
-- Compare routine for Sort
procedure Move (From : Natural; To : Natural);
-- Move routine for Sort
package Sorting is new GNAT.Heap_Sort_G (Move, Lt);
--------
-- Lt --
--------
function Lt (Op1, Op2 : Natural) return Boolean is
begin
return Component_Bit_Offset (Comps (Op1))
<
Component_Bit_Offset (Comps (Op2));
end Lt;
----------
-- Move --
----------
procedure Move (From : Natural; To : Natural) is
begin
Comps (To) := Comps (From);
end Move;
begin
-- Gather discriminants into Comp
if DS /= No_List then
Citem := First (DS);
while Present (Citem) loop
if Nkind (Citem) = N_Discriminant_Specification then
declare
Ent : constant Entity_Id :=
Defining_Identifier (Citem);
begin
if Ekind (Ent) = E_Discriminant then
Ncomps := Ncomps + 1;
Comps (Ncomps) := Ent;
end if;
end;
end if;
Next (Citem);
end loop;
end if;
-- Gather component entities into Comp
Citem := First (Component_Items (CL));
while Present (Citem) loop
if Nkind (Citem) = N_Component_Declaration then
Ncomps := Ncomps + 1;
Comps (Ncomps) := Defining_Identifier (Citem);
end if;
Next (Citem);
end loop;
-- Now sort the component entities based on the first bit.
-- Note we already know there are no overlapping components.
Sorting.Sort (Ncomps);
-- Loop through entries checking for holes
Nbit := Sbit;
for J in 1 .. Ncomps loop
CEnt := Comps (J);
declare
CBO : constant Uint := Component_Bit_Offset (CEnt);
begin
-- Skip components with unknown offsets
if CBO /= No_Uint and then CBO >= 0 then
Error_Msg_Uint_1 := CBO - Nbit;
if Error_Msg_Uint_1 > 0 then
Error_Msg_NE
("?H?^-bit gap before component&",
Component_Name (Component_Clause (CEnt)),
CEnt);
end if;
Nbit := CBO + Esize (CEnt);
end if;
end;
end loop;
-- Process variant parts recursively if present
if Present (Variant_Part (CL)) then
Variant := First (Variants (Variant_Part (CL)));
while Present (Variant) loop
Check_Component_List
(Component_List (Variant), Nbit, No_List);
Next (Variant);
end loop;
end if;
end;
end Check_Component_List;
-- Start of processing for Record_Hole_Check
begin
declare
Sbit : Uint;
begin
if Is_Tagged_Type (Rectype) then
Sbit := UI_From_Int (System_Address_Size);
else
Sbit := Uint_0;
end if;
if Nkind (Decl) = N_Full_Type_Declaration
and then Nkind (Type_Definition (Decl)) = N_Record_Definition
then
Check_Component_List
(Component_List (Type_Definition (Decl)),
Sbit,
Discriminant_Specifications (Decl));
end if;
end;
end Record_Hole_Check;
end if;
-- For records that have component clauses for all components, and whose
-- size is less than or equal to 32, we need to know the size in the
-- front end to activate possible packed array processing where the
-- component type is a record.
-- At this stage Hbit + 1 represents the first unused bit from all the
-- component clauses processed, so if the component clauses are
-- complete, then this is the length of the record.
-- For records longer than System.Storage_Unit, and for those where not
-- all components have component clauses, the back end determines the
-- length (it may for example be appropriate to round up the size
-- to some convenient boundary, based on alignment considerations, etc).
if Unknown_RM_Size (Rectype) and then Hbit + 1 <= 32 then
-- Nothing to do if at least one component has no component clause
Comp := First_Component_Or_Discriminant (Rectype);
while Present (Comp) loop
exit when No (Component_Clause (Comp));
Next_Component_Or_Discriminant (Comp);
end loop;
-- If we fall out of loop, all components have component clauses
-- and so we can set the size to the maximum value.
if No (Comp) then
Set_RM_Size (Rectype, Hbit + 1);
end if;
end if;
end Check_Record_Representation_Clause;
----------------
-- Check_Size --
----------------
procedure Check_Size
(N : Node_Id;
T : Entity_Id;
Siz : Uint;
Biased : out Boolean)
is
procedure Size_Too_Small_Error (Min_Siz : Uint);
-- Emit an error concerning illegal size Siz. Min_Siz denotes the
-- minimum size.
--------------------------
-- Size_Too_Small_Error --
--------------------------
procedure Size_Too_Small_Error (Min_Siz : Uint) is
begin
-- This error is suppressed in ASIS mode to allow for different ASIS
-- back ends or ASIS-based tools to query the illegal clause.
if not ASIS_Mode then
Error_Msg_Uint_1 := Min_Siz;
Error_Msg_NE ("size for& too small, minimum allowed is ^", N, T);
end if;
end Size_Too_Small_Error;
-- Local variables
UT : constant Entity_Id := Underlying_Type (T);
M : Uint;
-- Start of processing for Check_Size
begin
Biased := False;
-- Reject patently improper size values
if Is_Elementary_Type (T)
and then Siz > UI_From_Int (Int'Last)
then
Error_Msg_N ("Size value too large for elementary type", N);
if Nkind (Original_Node (N)) = N_Op_Expon then
Error_Msg_N
("\maybe '* was meant, rather than '*'*", Original_Node (N));
end if;
end if;
-- Dismiss generic types
if Is_Generic_Type (T)
or else
Is_Generic_Type (UT)
or else
Is_Generic_Type (Root_Type (UT))
then
return;
-- Guard against previous errors
elsif No (UT) or else UT = Any_Type then
Check_Error_Detected;
return;
-- Check case of bit packed array
elsif Is_Array_Type (UT)
and then Known_Static_Component_Size (UT)
and then Is_Bit_Packed_Array (UT)
then
declare
Asiz : Uint;
Indx : Node_Id;
Ityp : Entity_Id;
begin
Asiz := Component_Size (UT);
Indx := First_Index (UT);
loop
Ityp := Etype (Indx);
-- If non-static bound, then we are not in the business of
-- trying to check the length, and indeed an error will be
-- issued elsewhere, since sizes of non-static array types
-- cannot be set implicitly or explicitly.
if not Is_OK_Static_Subtype (Ityp) then
return;
end if;
-- Otherwise accumulate next dimension
Asiz := Asiz * (Expr_Value (Type_High_Bound (Ityp)) -
Expr_Value (Type_Low_Bound (Ityp)) +
Uint_1);
Next_Index (Indx);
exit when No (Indx);
end loop;
if Asiz <= Siz then
return;
else
Size_Too_Small_Error (Asiz);
Set_Esize (T, Asiz);
Set_RM_Size (T, Asiz);
end if;
end;
-- All other composite types are ignored
elsif Is_Composite_Type (UT) then
return;
-- For fixed-point types, don't check minimum if type is not frozen,
-- since we don't know all the characteristics of the type that can
-- affect the size (e.g. a specified small) till freeze time.
elsif Is_Fixed_Point_Type (UT) and then not Is_Frozen (UT) then
null;
-- Cases for which a minimum check is required
else
-- Ignore if specified size is correct for the type
if Known_Esize (UT) and then Siz = Esize (UT) then
return;
end if;
-- Otherwise get minimum size
M := UI_From_Int (Minimum_Size (UT));
if Siz < M then
-- Size is less than minimum size, but one possibility remains
-- that we can manage with the new size if we bias the type.
M := UI_From_Int (Minimum_Size (UT, Biased => True));
if Siz < M then
Size_Too_Small_Error (M);
Set_Esize (T, M);
Set_RM_Size (T, M);
else
Biased := True;
end if;
end if;
end if;
end Check_Size;
--------------------------
-- Freeze_Entity_Checks --
--------------------------
procedure Freeze_Entity_Checks (N : Node_Id) is
procedure Hide_Non_Overridden_Subprograms (Typ : Entity_Id);
-- Inspect the primitive operations of type Typ and hide all pairs of
-- implicitly declared non-overridden non-fully conformant homographs
-- (Ada RM 8.3 12.3/2).
-------------------------------------
-- Hide_Non_Overridden_Subprograms --
-------------------------------------
procedure Hide_Non_Overridden_Subprograms (Typ : Entity_Id) is
procedure Hide_Matching_Homographs
(Subp_Id : Entity_Id;
Start_Elmt : Elmt_Id);
-- Inspect a list of primitive operations starting with Start_Elmt
-- and find matching implicitly declared non-overridden non-fully
-- conformant homographs of Subp_Id. If found, all matches along
-- with Subp_Id are hidden from all visibility.
function Is_Non_Overridden_Or_Null_Procedure
(Subp_Id : Entity_Id) return Boolean;
-- Determine whether subprogram Subp_Id is implicitly declared non-
-- overridden subprogram or an implicitly declared null procedure.
------------------------------
-- Hide_Matching_Homographs --
------------------------------
procedure Hide_Matching_Homographs
(Subp_Id : Entity_Id;
Start_Elmt : Elmt_Id)
is
Prim : Entity_Id;
Prim_Elmt : Elmt_Id;
begin
Prim_Elmt := Start_Elmt;
while Present (Prim_Elmt) loop
Prim := Node (Prim_Elmt);
-- The current primitive is implicitly declared non-overridden
-- non-fully conformant homograph of Subp_Id. Both subprograms
-- must be hidden from visibility.
if Chars (Prim) = Chars (Subp_Id)
and then Is_Non_Overridden_Or_Null_Procedure (Prim)
and then not Fully_Conformant (Prim, Subp_Id)
then
Set_Is_Hidden_Non_Overridden_Subpgm (Prim);
Set_Is_Immediately_Visible (Prim, False);
Set_Is_Potentially_Use_Visible (Prim, False);
Set_Is_Hidden_Non_Overridden_Subpgm (Subp_Id);
Set_Is_Immediately_Visible (Subp_Id, False);
Set_Is_Potentially_Use_Visible (Subp_Id, False);
end if;
Next_Elmt (Prim_Elmt);
end loop;
end Hide_Matching_Homographs;
-----------------------------------------
-- Is_Non_Overridden_Or_Null_Procedure --
-----------------------------------------
function Is_Non_Overridden_Or_Null_Procedure
(Subp_Id : Entity_Id) return Boolean
is
Alias_Id : Entity_Id;
begin
-- The subprogram is inherited (implicitly declared), it does not
-- override and does not cover a primitive of an interface.
if Ekind_In (Subp_Id, E_Function, E_Procedure)
and then Present (Alias (Subp_Id))
and then No (Interface_Alias (Subp_Id))
and then No (Overridden_Operation (Subp_Id))
then
Alias_Id := Alias (Subp_Id);
if Requires_Overriding (Alias_Id) then
return True;
elsif Nkind (Parent (Alias_Id)) = N_Procedure_Specification
and then Null_Present (Parent (Alias_Id))
then
return True;
end if;
end if;
return False;
end Is_Non_Overridden_Or_Null_Procedure;
-- Local variables
Prim_Ops : constant Elist_Id := Direct_Primitive_Operations (Typ);
Prim : Entity_Id;
Prim_Elmt : Elmt_Id;
-- Start of processing for Hide_Non_Overridden_Subprograms
begin
-- Inspect the list of primitives looking for non-overridden
-- subprograms.
if Present (Prim_Ops) then
Prim_Elmt := First_Elmt (Prim_Ops);
while Present (Prim_Elmt) loop
Prim := Node (Prim_Elmt);
Next_Elmt (Prim_Elmt);
if Is_Non_Overridden_Or_Null_Procedure (Prim) then
Hide_Matching_Homographs
(Subp_Id => Prim,
Start_Elmt => Prim_Elmt);
end if;
end loop;
end if;
end Hide_Non_Overridden_Subprograms;
-- Local variables
E : constant Entity_Id := Entity (N);
Non_Generic_Case : constant Boolean := Nkind (N) = N_Freeze_Entity;
-- True in non-generic case. Some of the processing here is skipped
-- for the generic case since it is not needed. Basically in the
-- generic case, we only need to do stuff that might generate error
-- messages or warnings.
-- Start of processing for Freeze_Entity_Checks
begin
-- Remember that we are processing a freezing entity. Required to
-- ensure correct decoration of internal entities associated with
-- interfaces (see New_Overloaded_Entity).
Inside_Freezing_Actions := Inside_Freezing_Actions + 1;
-- For tagged types covering interfaces add internal entities that link
-- the primitives of the interfaces with the primitives that cover them.
-- Note: These entities were originally generated only when generating
-- code because their main purpose was to provide support to initialize
-- the secondary dispatch tables. They are now generated also when
-- compiling with no code generation to provide ASIS the relationship
-- between interface primitives and tagged type primitives. They are
-- also used to locate primitives covering interfaces when processing
-- generics (see Derive_Subprograms).
-- This is not needed in the generic case
if Ada_Version >= Ada_2005
and then Non_Generic_Case
and then Ekind (E) = E_Record_Type
and then Is_Tagged_Type (E)
and then not Is_Interface (E)
and then Has_Interfaces (E)
then
-- This would be a good common place to call the routine that checks
-- overriding of interface primitives (and thus factorize calls to
-- Check_Abstract_Overriding located at different contexts in the
-- compiler). However, this is not possible because it causes
-- spurious errors in case of late overriding.
Add_Internal_Interface_Entities (E);
end if;
-- After all forms of overriding have been resolved, a tagged type may
-- be left with a set of implicitly declared and possibly erroneous
-- abstract subprograms, null procedures and subprograms that require
-- overriding. If this set contains fully conformant homographs, then
-- one is chosen arbitrarily (already done during resolution), otherwise
-- all remaining non-fully conformant homographs are hidden from
-- visibility (Ada RM 8.3 12.3/2).
if Is_Tagged_Type (E) then
Hide_Non_Overridden_Subprograms (E);
end if;
-- Check CPP types
if Ekind (E) = E_Record_Type
and then Is_CPP_Class (E)
and then Is_Tagged_Type (E)
and then Tagged_Type_Expansion
then
if CPP_Num_Prims (E) = 0 then
-- If the CPP type has user defined components then it must import
-- primitives from C++. This is required because if the C++ class
-- has no primitives then the C++ compiler does not added the _tag
-- component to the type.
if First_Entity (E) /= Last_Entity (E) then
Error_Msg_N
("'C'P'P type must import at least one primitive from C++??",
E);
end if;
end if;
-- Check that all its primitives are abstract or imported from C++.
-- Check also availability of the C++ constructor.
declare
Has_Constructors : constant Boolean := Has_CPP_Constructors (E);
Elmt : Elmt_Id;
Error_Reported : Boolean := False;
Prim : Node_Id;
begin
Elmt := First_Elmt (Primitive_Operations (E));
while Present (Elmt) loop
Prim := Node (Elmt);
if Comes_From_Source (Prim) then
if Is_Abstract_Subprogram (Prim) then
null;
elsif not Is_Imported (Prim)
or else Convention (Prim) /= Convention_CPP
then
Error_Msg_N
("primitives of 'C'P'P types must be imported from C++ "
& "or abstract??", Prim);
elsif not Has_Constructors
and then not Error_Reported
then
Error_Msg_Name_1 := Chars (E);
Error_Msg_N
("??'C'P'P constructor required for type %", Prim);
Error_Reported := True;
end if;
end if;
Next_Elmt (Elmt);
end loop;
end;
end if;
-- Check Ada derivation of CPP type
if Expander_Active -- why? losing errors in -gnatc mode???
and then Present (Etype (E)) -- defend against errors
and then Tagged_Type_Expansion
and then Ekind (E) = E_Record_Type
and then Etype (E) /= E
and then Is_CPP_Class (Etype (E))
and then CPP_Num_Prims (Etype (E)) > 0
and then not Is_CPP_Class (E)
and then not Has_CPP_Constructors (Etype (E))
then
-- If the parent has C++ primitives but it has no constructor then
-- check that all the primitives are overridden in this derivation;
-- otherwise the constructor of the parent is needed to build the
-- dispatch table.
declare
Elmt : Elmt_Id;
Prim : Node_Id;
begin
Elmt := First_Elmt (Primitive_Operations (E));
while Present (Elmt) loop
Prim := Node (Elmt);
if not Is_Abstract_Subprogram (Prim)
and then No (Interface_Alias (Prim))
and then Find_Dispatching_Type (Ultimate_Alias (Prim)) /= E
then
Error_Msg_Name_1 := Chars (Etype (E));
Error_Msg_N
("'C'P'P constructor required for parent type %", E);
exit;
end if;
Next_Elmt (Elmt);
end loop;
end;
end if;
Inside_Freezing_Actions := Inside_Freezing_Actions - 1;
-- If we have a type with predicates, build predicate function. This is
-- not needed in the generic case, nor within TSS subprograms and other
-- predefined primitives.
if Is_Type (E)
and then Non_Generic_Case
and then not Within_Internal_Subprogram
and then Has_Predicates (E)
then
Build_Predicate_Functions (E, N);
end if;
-- If type has delayed aspects, this is where we do the preanalysis at
-- the freeze point, as part of the consistent visibility check. Note
-- that this must be done after calling Build_Predicate_Functions or
-- Build_Invariant_Procedure since these subprograms fix occurrences of
-- the subtype name in the saved expression so that they will not cause
-- trouble in the preanalysis.
-- This is also not needed in the generic case
if Non_Generic_Case
and then Has_Delayed_Aspects (E)
and then Scope (E) = Current_Scope
then
-- Retrieve the visibility to the discriminants in order to properly
-- analyze the aspects.
Push_Scope_And_Install_Discriminants (E);
declare
Ritem : Node_Id;
begin
-- Look for aspect specification entries for this entity
Ritem := First_Rep_Item (E);
while Present (Ritem) loop
if Nkind (Ritem) = N_Aspect_Specification
and then Entity (Ritem) = E
and then Is_Delayed_Aspect (Ritem)
then
Check_Aspect_At_Freeze_Point (Ritem);
end if;
Next_Rep_Item (Ritem);
end loop;
end;
Uninstall_Discriminants_And_Pop_Scope (E);
end if;
-- For a record type, deal with variant parts. This has to be delayed
-- to this point, because of the issue of statically predicated
-- subtypes, which we have to ensure are frozen before checking
-- choices, since we need to have the static choice list set.
if Is_Record_Type (E) then
Check_Variant_Part : declare
D : constant Node_Id := Declaration_Node (E);
T : Node_Id;
C : Node_Id;
VP : Node_Id;
Others_Present : Boolean;
pragma Warnings (Off, Others_Present);
-- Indicates others present, not used in this case
procedure Non_Static_Choice_Error (Choice : Node_Id);
-- Error routine invoked by the generic instantiation below when
-- the variant part has a non static choice.
procedure Process_Declarations (Variant : Node_Id);
-- Processes declarations associated with a variant. We analyzed
-- the declarations earlier (in Sem_Ch3.Analyze_Variant_Part),
-- but we still need the recursive call to Check_Choices for any
-- nested variant to get its choices properly processed. This is
-- also where we expand out the choices if expansion is active.
package Variant_Choices_Processing is new
Generic_Check_Choices
(Process_Empty_Choice => No_OP,
Process_Non_Static_Choice => Non_Static_Choice_Error,
Process_Associated_Node => Process_Declarations);
use Variant_Choices_Processing;
-----------------------------
-- Non_Static_Choice_Error --
-----------------------------
procedure Non_Static_Choice_Error (Choice : Node_Id) is
begin
Flag_Non_Static_Expr
("choice given in variant part is not static!", Choice);
end Non_Static_Choice_Error;
--------------------------
-- Process_Declarations --
--------------------------
procedure Process_Declarations (Variant : Node_Id) is
CL : constant Node_Id := Component_List (Variant);
VP : Node_Id;
begin
-- Check for static predicate present in this variant
if Has_SP_Choice (Variant) then
-- Here we expand. You might expect to find this call in
-- Expand_N_Variant_Part, but that is called when we first
-- see the variant part, and we cannot do this expansion
-- earlier than the freeze point, since for statically
-- predicated subtypes, the predicate is not known till
-- the freeze point.
-- Furthermore, we do this expansion even if the expander
-- is not active, because other semantic processing, e.g.
-- for aggregates, requires the expanded list of choices.
-- If the expander is not active, then we can't just clobber
-- the list since it would invalidate the ASIS -gnatct tree.
-- So we have to rewrite the variant part with a Rewrite
-- call that replaces it with a copy and clobber the copy.
if not Expander_Active then
declare
NewV : constant Node_Id := New_Copy (Variant);
begin
Set_Discrete_Choices
(NewV, New_Copy_List (Discrete_Choices (Variant)));
Rewrite (Variant, NewV);
end;
end if;
Expand_Static_Predicates_In_Choices (Variant);
end if;
-- We don't need to worry about the declarations in the variant
-- (since they were analyzed by Analyze_Choices when we first
-- encountered the variant), but we do need to take care of
-- expansion of any nested variants.
if not Null_Present (CL) then
VP := Variant_Part (CL);
if Present (VP) then
Check_Choices
(VP, Variants (VP), Etype (Name (VP)), Others_Present);
end if;
end if;
end Process_Declarations;
-- Start of processing for Check_Variant_Part
begin
-- Find component list
C := Empty;
if Nkind (D) = N_Full_Type_Declaration then
T := Type_Definition (D);
if Nkind (T) = N_Record_Definition then
C := Component_List (T);
elsif Nkind (T) = N_Derived_Type_Definition
and then Present (Record_Extension_Part (T))
then
C := Component_List (Record_Extension_Part (T));
end if;
end if;
-- Case of variant part present
if Present (C) and then Present (Variant_Part (C)) then
VP := Variant_Part (C);
-- Check choices
Check_Choices
(VP, Variants (VP), Etype (Name (VP)), Others_Present);
-- If the last variant does not contain the Others choice,
-- replace it with an N_Others_Choice node since Gigi always
-- wants an Others. Note that we do not bother to call Analyze
-- on the modified variant part, since its only effect would be
-- to compute the Others_Discrete_Choices node laboriously, and
-- of course we already know the list of choices corresponding
-- to the others choice (it's the list we're replacing).
-- We only want to do this if the expander is active, since
-- we do not want to clobber the ASIS tree.
if Expander_Active then
declare
Last_Var : constant Node_Id :=
Last_Non_Pragma (Variants (VP));
Others_Node : Node_Id;
begin
if Nkind (First (Discrete_Choices (Last_Var))) /=
N_Others_Choice
then
Others_Node := Make_Others_Choice (Sloc (Last_Var));
Set_Others_Discrete_Choices
(Others_Node, Discrete_Choices (Last_Var));
Set_Discrete_Choices
(Last_Var, New_List (Others_Node));
end if;
end;
end if;
end if;
end Check_Variant_Part;
end if;
end Freeze_Entity_Checks;
-------------------------
-- Get_Alignment_Value --
-------------------------
function Get_Alignment_Value (Expr : Node_Id) return Uint is
Align : constant Uint := Static_Integer (Expr);
begin
if Align = No_Uint then
return No_Uint;
elsif Align <= 0 then
-- This error is suppressed in ASIS mode to allow for different ASIS
-- back ends or ASIS-based tools to query the illegal clause.
if not ASIS_Mode then
Error_Msg_N ("alignment value must be positive", Expr);
end if;
return No_Uint;
else
for J in Int range 0 .. 64 loop
declare
M : constant Uint := Uint_2 ** J;
begin
exit when M = Align;
if M > Align then
-- This error is suppressed in ASIS mode to allow for
-- different ASIS back ends or ASIS-based tools to query the
-- illegal clause.
if not ASIS_Mode then
Error_Msg_N ("alignment value must be power of 2", Expr);
end if;
return No_Uint;
end if;
end;
end loop;
return Align;
end if;
end Get_Alignment_Value;
-----------------------------
-- Get_Interfacing_Aspects --
-----------------------------
procedure Get_Interfacing_Aspects
(Iface_Asp : Node_Id;
Conv_Asp : out Node_Id;
EN_Asp : out Node_Id;
Expo_Asp : out Node_Id;
Imp_Asp : out Node_Id;
LN_Asp : out Node_Id;
Do_Checks : Boolean := False)
is
procedure Save_Or_Duplication_Error
(Asp : Node_Id;
To : in out Node_Id);
-- Save the value of aspect Asp in node To. If To already has a value,
-- then this is considered a duplicate use of aspect. Emit an error if
-- flag Do_Checks is set.
-------------------------------
-- Save_Or_Duplication_Error --
-------------------------------
procedure Save_Or_Duplication_Error
(Asp : Node_Id;
To : in out Node_Id)
is
begin
-- Detect an extra aspect and issue an error
if Present (To) then
if Do_Checks then
Error_Msg_Name_1 := Chars (Identifier (Asp));
Error_Msg_Sloc := Sloc (To);
Error_Msg_N ("aspect % previously given #", Asp);
end if;
-- Otherwise capture the aspect
else
To := Asp;
end if;
end Save_Or_Duplication_Error;
-- Local variables
Asp : Node_Id;
Asp_Id : Aspect_Id;
-- The following variables capture each individual aspect
Conv : Node_Id := Empty;
EN : Node_Id := Empty;
Expo : Node_Id := Empty;
Imp : Node_Id := Empty;
LN : Node_Id := Empty;
-- Start of processing for Get_Interfacing_Aspects
begin
-- The input interfacing aspect should reside in an aspect specification
-- list.
pragma Assert (Is_List_Member (Iface_Asp));
-- Examine the aspect specifications of the related entity. Find and
-- capture all interfacing aspects. Detect duplicates and emit errors
-- if applicable.
Asp := First (List_Containing (Iface_Asp));
while Present (Asp) loop
Asp_Id := Get_Aspect_Id (Asp);
if Asp_Id = Aspect_Convention then
Save_Or_Duplication_Error (Asp, Conv);
elsif Asp_Id = Aspect_External_Name then
Save_Or_Duplication_Error (Asp, EN);
elsif Asp_Id = Aspect_Export then
Save_Or_Duplication_Error (Asp, Expo);
elsif Asp_Id = Aspect_Import then
Save_Or_Duplication_Error (Asp, Imp);
elsif Asp_Id = Aspect_Link_Name then
Save_Or_Duplication_Error (Asp, LN);
end if;
Next (Asp);
end loop;
Conv_Asp := Conv;
EN_Asp := EN;
Expo_Asp := Expo;
Imp_Asp := Imp;
LN_Asp := LN;
end Get_Interfacing_Aspects;
-------------------------------------
-- Inherit_Aspects_At_Freeze_Point --
-------------------------------------
procedure Inherit_Aspects_At_Freeze_Point (Typ : Entity_Id) is
function Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item
(Rep_Item : Node_Id) return Boolean;
-- This routine checks if Rep_Item is either a pragma or an aspect
-- specification node whose correponding pragma (if any) is present in
-- the Rep Item chain of the entity it has been specified to.
--------------------------------------------------
-- Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item --
--------------------------------------------------
function Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item
(Rep_Item : Node_Id) return Boolean
is
begin
return
Nkind (Rep_Item) = N_Pragma
or else Present_In_Rep_Item
(Entity (Rep_Item), Aspect_Rep_Item (Rep_Item));
end Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item;
-- Start of processing for Inherit_Aspects_At_Freeze_Point
begin
-- A representation item is either subtype-specific (Size and Alignment
-- clauses) or type-related (all others). Subtype-specific aspects may
-- differ for different subtypes of the same type (RM 13.1.8).
-- A derived type inherits each type-related representation aspect of
-- its parent type that was directly specified before the declaration of
-- the derived type (RM 13.1.15).
-- A derived subtype inherits each subtype-specific representation
-- aspect of its parent subtype that was directly specified before the
-- declaration of the derived type (RM 13.1.15).
-- The general processing involves inheriting a representation aspect
-- from a parent type whenever the first rep item (aspect specification,
-- attribute definition clause, pragma) corresponding to the given
-- representation aspect in the rep item chain of Typ, if any, isn't
-- directly specified to Typ but to one of its parents.
-- ??? Note that, for now, just a limited number of representation
-- aspects have been inherited here so far. Many of them are
-- still inherited in Sem_Ch3. This will be fixed soon. Here is
-- a non- exhaustive list of aspects that likely also need to
-- be moved to this routine: Alignment, Component_Alignment,
-- Component_Size, Machine_Radix, Object_Size, Pack, Predicates,
-- Preelaborable_Initialization, RM_Size and Small.
-- In addition, Convention must be propagated from base type to subtype,
-- because the subtype may have been declared on an incomplete view.
if Nkind (Parent (Typ)) = N_Private_Extension_Declaration then
return;
end if;
-- Ada_05/Ada_2005
if not Has_Rep_Item (Typ, Name_Ada_05, Name_Ada_2005, False)
and then Has_Rep_Item (Typ, Name_Ada_05, Name_Ada_2005)
and then Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item
(Get_Rep_Item (Typ, Name_Ada_05, Name_Ada_2005))
then
Set_Is_Ada_2005_Only (Typ);
end if;
-- Ada_12/Ada_2012
if not Has_Rep_Item (Typ, Name_Ada_12, Name_Ada_2012, False)
and then Has_Rep_Item (Typ, Name_Ada_12, Name_Ada_2012)
and then Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item
(Get_Rep_Item (Typ, Name_Ada_12, Name_Ada_2012))
then
Set_Is_Ada_2012_Only (Typ);
end if;
-- Atomic/Shared
if not Has_Rep_Item (Typ, Name_Atomic, Name_Shared, False)
and then Has_Rep_Pragma (Typ, Name_Atomic, Name_Shared)
and then Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item
(Get_Rep_Item (Typ, Name_Atomic, Name_Shared))
then
Set_Is_Atomic (Typ);
Set_Is_Volatile (Typ);
Set_Treat_As_Volatile (Typ);
end if;
-- Convention
if Is_Record_Type (Typ)
and then Typ /= Base_Type (Typ) and then Is_Frozen (Base_Type (Typ))
then
Set_Convention (Typ, Convention (Base_Type (Typ)));
end if;
-- Default_Component_Value
-- Verify that there is no rep_item declared for the type, and there
-- is one coming from an ancestor.
if Is_Array_Type (Typ)
and then Is_Base_Type (Typ)
and then not Has_Rep_Item (Typ, Name_Default_Component_Value, False)
and then Has_Rep_Item (Typ, Name_Default_Component_Value)
then
Set_Default_Aspect_Component_Value (Typ,
Default_Aspect_Component_Value
(Entity (Get_Rep_Item (Typ, Name_Default_Component_Value))));
end if;
-- Default_Value
if Is_Scalar_Type (Typ)
and then Is_Base_Type (Typ)
and then not Has_Rep_Item (Typ, Name_Default_Value, False)
and then Has_Rep_Item (Typ, Name_Default_Value)
then
Set_Has_Default_Aspect (Typ);
Set_Default_Aspect_Value (Typ,
Default_Aspect_Value
(Entity (Get_Rep_Item (Typ, Name_Default_Value))));
end if;
-- Discard_Names
if not Has_Rep_Item (Typ, Name_Discard_Names, False)
and then Has_Rep_Item (Typ, Name_Discard_Names)
and then Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item
(Get_Rep_Item (Typ, Name_Discard_Names))
then
Set_Discard_Names (Typ);
end if;
-- Volatile
if not Has_Rep_Item (Typ, Name_Volatile, False)
and then Has_Rep_Item (Typ, Name_Volatile)
and then Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item
(Get_Rep_Item (Typ, Name_Volatile))
then
Set_Is_Volatile (Typ);
Set_Treat_As_Volatile (Typ);
end if;
-- Volatile_Full_Access
if not Has_Rep_Item (Typ, Name_Volatile_Full_Access, False)
and then Has_Rep_Pragma (Typ, Name_Volatile_Full_Access)
and then Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item
(Get_Rep_Item (Typ, Name_Volatile_Full_Access))
then
Set_Is_Volatile_Full_Access (Typ);
Set_Is_Volatile (Typ);
Set_Treat_As_Volatile (Typ);
end if;
-- Inheritance for derived types only
if Is_Derived_Type (Typ) then
declare
Bas_Typ : constant Entity_Id := Base_Type (Typ);
Imp_Bas_Typ : constant Entity_Id := Implementation_Base_Type (Typ);
begin
-- Atomic_Components
if not Has_Rep_Item (Typ, Name_Atomic_Components, False)
and then Has_Rep_Item (Typ, Name_Atomic_Components)
and then Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item
(Get_Rep_Item (Typ, Name_Atomic_Components))
then
Set_Has_Atomic_Components (Imp_Bas_Typ);
end if;
-- Volatile_Components
if not Has_Rep_Item (Typ, Name_Volatile_Components, False)
and then Has_Rep_Item (Typ, Name_Volatile_Components)
and then Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item
(Get_Rep_Item (Typ, Name_Volatile_Components))
then
Set_Has_Volatile_Components (Imp_Bas_Typ);
end if;
-- Finalize_Storage_Only
if not Has_Rep_Pragma (Typ, Name_Finalize_Storage_Only, False)
and then Has_Rep_Pragma (Typ, Name_Finalize_Storage_Only)
then
Set_Finalize_Storage_Only (Bas_Typ);
end if;
-- Universal_Aliasing
if not Has_Rep_Item (Typ, Name_Universal_Aliasing, False)
and then Has_Rep_Item (Typ, Name_Universal_Aliasing)
and then Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item
(Get_Rep_Item (Typ, Name_Universal_Aliasing))
then
Set_Universal_Aliasing (Imp_Bas_Typ);
end if;
-- Bit_Order
if Is_Record_Type (Typ) then
if not Has_Rep_Item (Typ, Name_Bit_Order, False)
and then Has_Rep_Item (Typ, Name_Bit_Order)
then
Set_Reverse_Bit_Order (Bas_Typ,
Reverse_Bit_Order (Entity (Name
(Get_Rep_Item (Typ, Name_Bit_Order)))));
end if;
end if;
-- Scalar_Storage_Order
-- Note: the aspect is specified on a first subtype, but recorded
-- in a flag of the base type!
if (Is_Record_Type (Typ) or else Is_Array_Type (Typ))
and then Typ = Bas_Typ
then
-- For a type extension, always inherit from parent; otherwise
-- inherit if no default applies. Note: we do not check for
-- an explicit rep item on the parent type when inheriting,
-- because the parent SSO may itself have been set by default.
if not Has_Rep_Item (First_Subtype (Typ),
Name_Scalar_Storage_Order, False)
and then (Is_Tagged_Type (Bas_Typ)
or else not (SSO_Set_Low_By_Default (Bas_Typ)
or else
SSO_Set_High_By_Default (Bas_Typ)))
then
Set_Reverse_Storage_Order (Bas_Typ,
Reverse_Storage_Order
(Implementation_Base_Type (Etype (Bas_Typ))));
-- Clear default SSO indications, since the inherited aspect
-- which was set explicitly overrides the default.
Set_SSO_Set_Low_By_Default (Bas_Typ, False);
Set_SSO_Set_High_By_Default (Bas_Typ, False);
end if;
end if;
end;
end if;
end Inherit_Aspects_At_Freeze_Point;
----------------
-- Initialize --
----------------
procedure Initialize is
begin
Address_Clause_Checks.Init;
Compile_Time_Warnings_Errors.Init;
Unchecked_Conversions.Init;
if AAMP_On_Target then
Independence_Checks.Init;
end if;
end Initialize;
---------------------------
-- Install_Discriminants --
---------------------------
procedure Install_Discriminants (E : Entity_Id) is
Disc : Entity_Id;
Prev : Entity_Id;
begin
Disc := First_Discriminant (E);
while Present (Disc) loop
Prev := Current_Entity (Disc);
Set_Current_Entity (Disc);
Set_Is_Immediately_Visible (Disc);
Set_Homonym (Disc, Prev);
Next_Discriminant (Disc);
end loop;
end Install_Discriminants;
-------------------------
-- Is_Operational_Item --
-------------------------
function Is_Operational_Item (N : Node_Id) return Boolean is
begin
if Nkind (N) /= N_Attribute_Definition_Clause then
return False;
else
declare
Id : constant Attribute_Id := Get_Attribute_Id (Chars (N));
begin
-- List of operational items is given in AARM 13.1(8.mm/1).
-- It is clearly incomplete, as it does not include iterator
-- aspects, among others.
return Id = Attribute_Constant_Indexing
or else Id = Attribute_Default_Iterator
or else Id = Attribute_Implicit_Dereference
or else Id = Attribute_Input
or else Id = Attribute_Iterator_Element
or else Id = Attribute_Iterable
or else Id = Attribute_Output
or else Id = Attribute_Read
or else Id = Attribute_Variable_Indexing
or else Id = Attribute_Write
or else Id = Attribute_External_Tag;
end;
end if;
end Is_Operational_Item;
-------------------------
-- Is_Predicate_Static --
-------------------------
-- Note: the basic legality of the expression has already been checked, so
-- we don't need to worry about cases or ranges on strings for example.
function Is_Predicate_Static
(Expr : Node_Id;
Nam : Name_Id) return Boolean
is
function All_Static_Case_Alternatives (L : List_Id) return Boolean;
-- Given a list of case expression alternatives, returns True if all
-- the alternatives are static (have all static choices, and a static
-- expression).
function All_Static_Choices (L : List_Id) return Boolean;
-- Returns true if all elements of the list are OK static choices
-- as defined below for Is_Static_Choice. Used for case expression
-- alternatives and for the right operand of a membership test. An
-- others_choice is static if the corresponding expression is static.
-- The staticness of the bounds is checked separately.
function Is_Static_Choice (N : Node_Id) return Boolean;
-- Returns True if N represents a static choice (static subtype, or
-- static subtype indication, or static expression, or static range).
--
-- Note that this is a bit more inclusive than we actually need
-- (in particular membership tests do not allow the use of subtype
-- indications). But that doesn't matter, we have already checked
-- that the construct is legal to get this far.
function Is_Type_Ref (N : Node_Id) return Boolean;
pragma Inline (Is_Type_Ref);
-- Returns True if N is a reference to the type for the predicate in the
-- expression (i.e. if it is an identifier whose Chars field matches the
-- Nam given in the call). N must not be parenthesized, if the type name
-- appears in parens, this routine will return False.
--
-- The routine also returns True for function calls generated during the
-- expansion of comparison operators on strings, which are intended to
-- be legal in static predicates, and are converted into calls to array
-- comparison routines in the body of the corresponding predicate
-- function.
----------------------------------
-- All_Static_Case_Alternatives --
----------------------------------
function All_Static_Case_Alternatives (L : List_Id) return Boolean is
N : Node_Id;
begin
N := First (L);
while Present (N) loop
if not (All_Static_Choices (Discrete_Choices (N))
and then Is_OK_Static_Expression (Expression (N)))
then
return False;
end if;
Next (N);
end loop;
return True;
end All_Static_Case_Alternatives;
------------------------
-- All_Static_Choices --
------------------------
function All_Static_Choices (L : List_Id) return Boolean is
N : Node_Id;
begin
N := First (L);
while Present (N) loop
if not Is_Static_Choice (N) then
return False;
end if;
Next (N);
end loop;
return True;
end All_Static_Choices;
----------------------
-- Is_Static_Choice --
----------------------
function Is_Static_Choice (N : Node_Id) return Boolean is
begin
return Nkind (N) = N_Others_Choice
or else Is_OK_Static_Expression (N)
or else (Is_Entity_Name (N) and then Is_Type (Entity (N))
and then Is_OK_Static_Subtype (Entity (N)))
or else (Nkind (N) = N_Subtype_Indication
and then Is_OK_Static_Subtype (Entity (N)))
or else (Nkind (N) = N_Range and then Is_OK_Static_Range (N));
end Is_Static_Choice;
-----------------
-- Is_Type_Ref --
-----------------
function Is_Type_Ref (N : Node_Id) return Boolean is
begin
return (Nkind (N) = N_Identifier
and then Chars (N) = Nam
and then Paren_Count (N) = 0)
or else Nkind (N) = N_Function_Call;
end Is_Type_Ref;
-- Start of processing for Is_Predicate_Static
begin
-- Predicate_Static means one of the following holds. Numbers are the
-- corresponding paragraph numbers in (RM 3.2.4(16-22)).
-- 16: A static expression
if Is_OK_Static_Expression (Expr) then
return True;
-- 17: A membership test whose simple_expression is the current
-- instance, and whose membership_choice_list meets the requirements
-- for a static membership test.
elsif Nkind (Expr) in N_Membership_Test
and then ((Present (Right_Opnd (Expr))
and then Is_Static_Choice (Right_Opnd (Expr)))
or else
(Present (Alternatives (Expr))
and then All_Static_Choices (Alternatives (Expr))))
then
return True;
-- 18. A case_expression whose selecting_expression is the current
-- instance, and whose dependent expressions are static expressions.
elsif Nkind (Expr) = N_Case_Expression
and then Is_Type_Ref (Expression (Expr))
and then All_Static_Case_Alternatives (Alternatives (Expr))
then
return True;
-- 19. A call to a predefined equality or ordering operator, where one
-- operand is the current instance, and the other is a static
-- expression.
-- Note: the RM is clearly wrong here in not excluding string types.
-- Without this exclusion, we would allow expressions like X > "ABC"
-- to be considered as predicate-static, which is clearly not intended,
-- since the idea is for predicate-static to be a subset of normal
-- static expressions (and "DEF" > "ABC" is not a static expression).
-- However, we do allow internally generated (not from source) equality
-- and inequality operations to be valid on strings (this helps deal
-- with cases where we transform A in "ABC" to A = "ABC).
-- In fact, it appears that the intent of the ARG is to extend static
-- predicates to strings, and that the extension should probably apply
-- to static expressions themselves. The code below accepts comparison
-- operators that apply to static strings.
elsif Nkind (Expr) in N_Op_Compare
and then ((Is_Type_Ref (Left_Opnd (Expr))
and then Is_OK_Static_Expression (Right_Opnd (Expr)))
or else
(Is_Type_Ref (Right_Opnd (Expr))
and then Is_OK_Static_Expression (Left_Opnd (Expr))))
then
return True;
-- 20. A call to a predefined boolean logical operator, where each
-- operand is predicate-static.
elsif (Nkind_In (Expr, N_Op_And, N_Op_Or, N_Op_Xor)
and then Is_Predicate_Static (Left_Opnd (Expr), Nam)
and then Is_Predicate_Static (Right_Opnd (Expr), Nam))
or else
(Nkind (Expr) = N_Op_Not
and then Is_Predicate_Static (Right_Opnd (Expr), Nam))
then
return True;
-- 21. A short-circuit control form where both operands are
-- predicate-static.
elsif Nkind (Expr) in N_Short_Circuit
and then Is_Predicate_Static (Left_Opnd (Expr), Nam)
and then Is_Predicate_Static (Right_Opnd (Expr), Nam)
then
return True;
-- 22. A parenthesized predicate-static expression. This does not
-- require any special test, since we just ignore paren levels in
-- all the cases above.
-- One more test that is an implementation artifact caused by the fact
-- that we are analyzing not the original expression, but the generated
-- expression in the body of the predicate function. This can include
-- references to inherited predicates, so that the expression we are
-- processing looks like:
-- xxPredicate (typ (Inns)) and then expression
-- Where the call is to a Predicate function for an inherited predicate.
-- We simply ignore such a call, which could be to either a dynamic or
-- a static predicate. Note that if the parent predicate is dynamic then
-- eventually this type will be marked as dynamic, but you are allowed
-- to specify a static predicate for a subtype which is inheriting a
-- dynamic predicate, so the static predicate validation here ignores
-- the inherited predicate even if it is dynamic.
-- In all cases, a static predicate can only apply to a scalar type.
elsif Nkind (Expr) = N_Function_Call
and then Is_Predicate_Function (Entity (Name (Expr)))
and then Is_Scalar_Type (Etype (First_Entity (Entity (Name (Expr)))))
then
return True;
-- That's an exhaustive list of tests, all other cases are not
-- predicate-static, so we return False.
else
return False;
end if;
end Is_Predicate_Static;
---------------------
-- Kill_Rep_Clause --
---------------------
procedure Kill_Rep_Clause (N : Node_Id) is
begin
pragma Assert (Ignore_Rep_Clauses);
-- Note: we use Replace rather than Rewrite, because we don't want
-- ASIS to be able to use Original_Node to dig out the (undecorated)
-- rep clause that is being replaced.
Replace (N, Make_Null_Statement (Sloc (N)));
-- The null statement must be marked as not coming from source. This is
-- so that ASIS ignores it, and also the back end does not expect bogus
-- "from source" null statements in weird places (e.g. in declarative
-- regions where such null statements are not allowed).
Set_Comes_From_Source (N, False);
end Kill_Rep_Clause;
------------------
-- Minimum_Size --
------------------
function Minimum_Size
(T : Entity_Id;
Biased : Boolean := False) return Nat
is
Lo : Uint := No_Uint;
Hi : Uint := No_Uint;
LoR : Ureal := No_Ureal;
HiR : Ureal := No_Ureal;
LoSet : Boolean := False;
HiSet : Boolean := False;
B : Uint;
S : Nat;
Ancest : Entity_Id;
R_Typ : constant Entity_Id := Root_Type (T);
begin
-- If bad type, return 0
if T = Any_Type then
return 0;
-- For generic types, just return zero. There cannot be any legitimate
-- need to know such a size, but this routine may be called with a
-- generic type as part of normal processing.
elsif Is_Generic_Type (R_Typ) or else R_Typ = Any_Type then
return 0;
-- Access types (cannot have size smaller than System.Address)
elsif Is_Access_Type (T) then
return System_Address_Size;
-- Floating-point types
elsif Is_Floating_Point_Type (T) then
return UI_To_Int (Esize (R_Typ));
-- Discrete types
elsif Is_Discrete_Type (T) then
-- The following loop is looking for the nearest compile time known
-- bounds following the ancestor subtype chain. The idea is to find
-- the most restrictive known bounds information.
Ancest := T;
loop
if Ancest = Any_Type or else Etype (Ancest) = Any_Type then
return 0;
end if;
if not LoSet then
if Compile_Time_Known_Value (Type_Low_Bound (Ancest)) then
Lo := Expr_Rep_Value (Type_Low_Bound (Ancest));
LoSet := True;
exit when HiSet;
end if;
end if;
if not HiSet then
if Compile_Time_Known_Value (Type_High_Bound (Ancest)) then
Hi := Expr_Rep_Value (Type_High_Bound (Ancest));
HiSet := True;
exit when LoSet;
end if;
end if;
Ancest := Ancestor_Subtype (Ancest);
if No (Ancest) then
Ancest := Base_Type (T);
if Is_Generic_Type (Ancest) then
return 0;
end if;
end if;
end loop;
-- Fixed-point types. We can't simply use Expr_Value to get the
-- Corresponding_Integer_Value values of the bounds, since these do not
-- get set till the type is frozen, and this routine can be called
-- before the type is frozen. Similarly the test for bounds being static
-- needs to include the case where we have unanalyzed real literals for
-- the same reason.
elsif Is_Fixed_Point_Type (T) then
-- The following loop is looking for the nearest compile time known
-- bounds following the ancestor subtype chain. The idea is to find
-- the most restrictive known bounds information.
Ancest := T;
loop
if Ancest = Any_Type or else Etype (Ancest) = Any_Type then
return 0;
end if;
-- Note: In the following two tests for LoSet and HiSet, it may
-- seem redundant to test for N_Real_Literal here since normally
-- one would assume that the test for the value being known at
-- compile time includes this case. However, there is a glitch.
-- If the real literal comes from folding a non-static expression,
-- then we don't consider any non- static expression to be known
-- at compile time if we are in configurable run time mode (needed
-- in some cases to give a clearer definition of what is and what
-- is not accepted). So the test is indeed needed. Without it, we
-- would set neither Lo_Set nor Hi_Set and get an infinite loop.
if not LoSet then
if Nkind (Type_Low_Bound (Ancest)) = N_Real_Literal
or else Compile_Time_Known_Value (Type_Low_Bound (Ancest))
then
LoR := Expr_Value_R (Type_Low_Bound (Ancest));
LoSet := True;
exit when HiSet;
end if;
end if;
if not HiSet then
if Nkind (Type_High_Bound (Ancest)) = N_Real_Literal
or else Compile_Time_Known_Value (Type_High_Bound (Ancest))
then
HiR := Expr_Value_R (Type_High_Bound (Ancest));
HiSet := True;
exit when LoSet;
end if;
end if;
Ancest := Ancestor_Subtype (Ancest);
if No (Ancest) then
Ancest := Base_Type (T);
if Is_Generic_Type (Ancest) then
return 0;
end if;
end if;
end loop;
Lo := UR_To_Uint (LoR / Small_Value (T));
Hi := UR_To_Uint (HiR / Small_Value (T));
-- No other types allowed
else
raise Program_Error;
end if;
-- Fall through with Hi and Lo set. Deal with biased case
if (Biased
and then not Is_Fixed_Point_Type (T)
and then not (Is_Enumeration_Type (T)
and then Has_Non_Standard_Rep (T)))
or else Has_Biased_Representation (T)
then
Hi := Hi - Lo;
Lo := Uint_0;
end if;
-- Null range case, size is always zero. We only do this in the discrete
-- type case, since that's the odd case that came up. Probably we should
-- also do this in the fixed-point case, but doing so causes peculiar
-- gigi failures, and it is not worth worrying about this incredibly
-- marginal case (explicit null-range fixed-point type declarations)???
if Lo > Hi and then Is_Discrete_Type (T) then
S := 0;
-- Signed case. Note that we consider types like range 1 .. -1 to be
-- signed for the purpose of computing the size, since the bounds have
-- to be accommodated in the base type.
elsif Lo < 0 or else Hi < 0 then
S := 1;
B := Uint_1;
-- S = size, B = 2 ** (size - 1) (can accommodate -B .. +(B - 1))
-- Note that we accommodate the case where the bounds cross. This
-- can happen either because of the way the bounds are declared
-- or because of the algorithm in Freeze_Fixed_Point_Type.
while Lo < -B
or else Hi < -B
or else Lo >= B
or else Hi >= B
loop
B := Uint_2 ** S;
S := S + 1;
end loop;
-- Unsigned case
else
-- If both bounds are positive, make sure that both are represen-
-- table in the case where the bounds are crossed. This can happen
-- either because of the way the bounds are declared, or because of
-- the algorithm in Freeze_Fixed_Point_Type.
if Lo > Hi then
Hi := Lo;
end if;
-- S = size, (can accommodate 0 .. (2**size - 1))
S := 0;
while Hi >= Uint_2 ** S loop
S := S + 1;
end loop;
end if;
return S;
end Minimum_Size;
---------------------------
-- New_Stream_Subprogram --
---------------------------
procedure New_Stream_Subprogram
(N : Node_Id;
Ent : Entity_Id;
Subp : Entity_Id;
Nam : TSS_Name_Type)
is
Loc : constant Source_Ptr := Sloc (N);
Sname : constant Name_Id := Make_TSS_Name (Base_Type (Ent), Nam);
Subp_Id : Entity_Id;
Subp_Decl : Node_Id;
F : Entity_Id;
Etyp : Entity_Id;
Defer_Declaration : constant Boolean :=
Is_Tagged_Type (Ent) or else Is_Private_Type (Ent);
-- For a tagged type, there is a declaration for each stream attribute
-- at the freeze point, and we must generate only a completion of this
-- declaration. We do the same for private types, because the full view
-- might be tagged. Otherwise we generate a declaration at the point of
-- the attribute definition clause. If the attribute definition comes
-- from an aspect specification the declaration is part of the freeze
-- actions of the type.
function Build_Spec return Node_Id;
-- Used for declaration and renaming declaration, so that this is
-- treated as a renaming_as_body.
----------------
-- Build_Spec --
----------------
function Build_Spec return Node_Id is
Out_P : constant Boolean := (Nam = TSS_Stream_Read);
Formals : List_Id;
Spec : Node_Id;
T_Ref : constant Node_Id := New_Occurrence_Of (Etyp, Loc);
begin
Subp_Id := Make_Defining_Identifier (Loc, Sname);
-- S : access Root_Stream_Type'Class
Formals := New_List (
Make_Parameter_Specification (Loc,
Defining_Identifier =>
Make_Defining_Identifier (Loc, Name_S),
Parameter_Type =>
Make_Access_Definition (Loc,
Subtype_Mark =>
New_Occurrence_Of (
Designated_Type (Etype (F)), Loc))));
if Nam = TSS_Stream_Input then
Spec :=
Make_Function_Specification (Loc,
Defining_Unit_Name => Subp_Id,
Parameter_Specifications => Formals,
Result_Definition => T_Ref);
else
-- V : [out] T
Append_To (Formals,
Make_Parameter_Specification (Loc,
Defining_Identifier => Make_Defining_Identifier (Loc, Name_V),
Out_Present => Out_P,
Parameter_Type => T_Ref));
Spec :=
Make_Procedure_Specification (Loc,
Defining_Unit_Name => Subp_Id,
Parameter_Specifications => Formals);
end if;
return Spec;
end Build_Spec;
-- Start of processing for New_Stream_Subprogram
begin
F := First_Formal (Subp);
if Ekind (Subp) = E_Procedure then
Etyp := Etype (Next_Formal (F));
else
Etyp := Etype (Subp);
end if;
-- Prepare subprogram declaration and insert it as an action on the
-- clause node. The visibility for this entity is used to test for
-- visibility of the attribute definition clause (in the sense of
-- 8.3(23) as amended by AI-195).
if not Defer_Declaration then
Subp_Decl :=
Make_Subprogram_Declaration (Loc,
Specification => Build_Spec);
-- For a tagged type, there is always a visible declaration for each
-- stream TSS (it is a predefined primitive operation), and the
-- completion of this declaration occurs at the freeze point, which is
-- not always visible at places where the attribute definition clause is
-- visible. So, we create a dummy entity here for the purpose of
-- tracking the visibility of the attribute definition clause itself.
else
Subp_Id :=
Make_Defining_Identifier (Loc, New_External_Name (Sname, 'V'));
Subp_Decl :=
Make_Object_Declaration (Loc,
Defining_Identifier => Subp_Id,
Object_Definition => New_Occurrence_Of (Standard_Boolean, Loc));
end if;
if not Defer_Declaration
and then From_Aspect_Specification (N)
and then Has_Delayed_Freeze (Ent)
then
Append_Freeze_Action (Ent, Subp_Decl);
else
Insert_Action (N, Subp_Decl);
Set_Entity (N, Subp_Id);
end if;
Subp_Decl :=
Make_Subprogram_Renaming_Declaration (Loc,
Specification => Build_Spec,
Name => New_Occurrence_Of (Subp, Loc));
if Defer_Declaration then
Set_TSS (Base_Type (Ent), Subp_Id);
else
if From_Aspect_Specification (N) then
Append_Freeze_Action (Ent, Subp_Decl);
else
Insert_Action (N, Subp_Decl);
end if;
Copy_TSS (Subp_Id, Base_Type (Ent));
end if;
end New_Stream_Subprogram;
------------------------------------------
-- Push_Scope_And_Install_Discriminants --
------------------------------------------
procedure Push_Scope_And_Install_Discriminants (E : Entity_Id) is
begin
if Has_Discriminants (E) then
Push_Scope (E);
-- Make the discriminants visible for type declarations and protected
-- type declarations, not for subtype declarations (RM 13.1.1 (12/3))
if Nkind (Parent (E)) /= N_Subtype_Declaration then
Install_Discriminants (E);
end if;
end if;
end Push_Scope_And_Install_Discriminants;
------------------------
-- Rep_Item_Too_Early --
------------------------
function Rep_Item_Too_Early (T : Entity_Id; N : Node_Id) return Boolean is
begin
-- Cannot apply non-operational rep items to generic types
if Is_Operational_Item (N) then
return False;
elsif Is_Type (T)
and then Is_Generic_Type (Root_Type (T))
and then (Nkind (N) /= N_Pragma
or else Get_Pragma_Id (N) /= Pragma_Convention)
then
Error_Msg_N ("representation item not allowed for generic type", N);
return True;
end if;
-- Otherwise check for incomplete type
if Is_Incomplete_Or_Private_Type (T)
and then No (Underlying_Type (T))
and then
(Nkind (N) /= N_Pragma
or else Get_Pragma_Id (N) /= Pragma_Import)
then
Error_Msg_N
("representation item must be after full type declaration", N);
return True;
-- If the type has incomplete components, a representation clause is
-- illegal but stream attributes and Convention pragmas are correct.
elsif Has_Private_Component (T) then
if Nkind (N) = N_Pragma then
return False;
else
Error_Msg_N
("representation item must appear after type is fully defined",
N);
return True;
end if;
else
return False;
end if;
end Rep_Item_Too_Early;
-----------------------
-- Rep_Item_Too_Late --
-----------------------
function Rep_Item_Too_Late
(T : Entity_Id;
N : Node_Id;
FOnly : Boolean := False) return Boolean
is
S : Entity_Id;
Parent_Type : Entity_Id;
procedure No_Type_Rep_Item;
-- Output message indicating that no type-related aspects can be
-- specified due to some property of the parent type.
procedure Too_Late;
-- Output message for an aspect being specified too late
-- Note that neither of the above errors is considered a serious one,
-- since the effect is simply that we ignore the representation clause
-- in these cases.
-- Is this really true? In any case if we make this change we must
-- document the requirement in the spec of Rep_Item_Too_Late that
-- if True is returned, then the rep item must be completely ignored???
----------------------
-- No_Type_Rep_Item --
----------------------
procedure No_Type_Rep_Item is
begin
Error_Msg_N ("|type-related representation item not permitted!", N);
end No_Type_Rep_Item;
--------------
-- Too_Late --
--------------
procedure Too_Late is
begin
-- Other compilers seem more relaxed about rep items appearing too
-- late. Since analysis tools typically don't care about rep items
-- anyway, no reason to be too strict about this.
if not Relaxed_RM_Semantics then
Error_Msg_N ("|representation item appears too late!", N);
end if;
end Too_Late;
-- Start of processing for Rep_Item_Too_Late
begin
-- First make sure entity is not frozen (RM 13.1(9))
if Is_Frozen (T)
-- Exclude imported types, which may be frozen if they appear in a
-- representation clause for a local type.
and then not From_Limited_With (T)
-- Exclude generated entities (not coming from source). The common
-- case is when we generate a renaming which prematurely freezes the
-- renamed internal entity, but we still want to be able to set copies
-- of attribute values such as Size/Alignment.
and then Comes_From_Source (T)
then
-- A self-referential aspect is illegal if it forces freezing the
-- entity before the corresponding pragma has been analyzed.
if Nkind_In (N, N_Attribute_Definition_Clause, N_Pragma)
and then From_Aspect_Specification (N)
then
Error_Msg_NE
("aspect specification causes premature freezing of&", N, T);
Set_Has_Delayed_Freeze (T, False);
return True;
end if;
Too_Late;
S := First_Subtype (T);
if Present (Freeze_Node (S)) then
if not Relaxed_RM_Semantics then
Error_Msg_NE
("??no more representation items for }", Freeze_Node (S), S);
end if;
end if;
return True;
-- Check for case of untagged derived type whose parent either has
-- primitive operations, or is a by reference type (RM 13.1(10)). In
-- this case we do not output a Too_Late message, since there is no
-- earlier point where the rep item could be placed to make it legal.
elsif Is_Type (T)
and then not FOnly
and then Is_Derived_Type (T)
and then not Is_Tagged_Type (T)
then
Parent_Type := Etype (Base_Type (T));
if Has_Primitive_Operations (Parent_Type) then
No_Type_Rep_Item;
if not Relaxed_RM_Semantics then
Error_Msg_NE
("\parent type & has primitive operations!", N, Parent_Type);
end if;
return True;
elsif Is_By_Reference_Type (Parent_Type) then
No_Type_Rep_Item;
if not Relaxed_RM_Semantics then
Error_Msg_NE
("\parent type & is a by reference type!", N, Parent_Type);
end if;
return True;
end if;
end if;
-- No error, but one more warning to consider. The RM (surprisingly)
-- allows this pattern:
-- type S is ...
-- primitive operations for S
-- type R is new S;
-- rep clause for S
-- Meaning that calls on the primitive operations of S for values of
-- type R may require possibly expensive implicit conversion operations.
-- This is not an error, but is worth a warning.
if not Relaxed_RM_Semantics and then Is_Type (T) then
declare
DTL : constant Entity_Id := Derived_Type_Link (Base_Type (T));
begin
if Present (DTL)
and then Has_Primitive_Operations (Base_Type (T))
-- For now, do not generate this warning for the case of aspect
-- specification using Ada 2012 syntax, since we get wrong
-- messages we do not understand. The whole business of derived
-- types and rep items seems a bit confused when aspects are
-- used, since the aspects are not evaluated till freeze time.
and then not From_Aspect_Specification (N)
then
Error_Msg_Sloc := Sloc (DTL);
Error_Msg_N
("representation item for& appears after derived type "
& "declaration#??", N);
Error_Msg_NE
("\may result in implicit conversions for primitive "
& "operations of&??", N, T);
Error_Msg_NE
("\to change representations when called with arguments "
& "of type&??", N, DTL);
end if;
end;
end if;
-- No error, link item into head of chain of rep items for the entity,
-- but avoid chaining if we have an overloadable entity, and the pragma
-- is one that can apply to multiple overloaded entities.
if Is_Overloadable (T) and then Nkind (N) = N_Pragma then
declare
Pname : constant Name_Id := Pragma_Name (N);
begin
if Nam_In (Pname, Name_Convention, Name_Import, Name_Export,
Name_External, Name_Interface)
then
return False;
end if;
end;
end if;
Record_Rep_Item (T, N);
return False;
end Rep_Item_Too_Late;
-------------------------------------
-- Replace_Type_References_Generic --
-------------------------------------
procedure Replace_Type_References_Generic (N : Node_Id; T : Entity_Id) is
TName : constant Name_Id := Chars (T);
function Replace_Type_Ref (N : Node_Id) return Traverse_Result;
-- Processes a single node in the traversal procedure below, checking
-- if node N should be replaced, and if so, doing the replacement.
function Visible_Component (Comp : Name_Id) return Entity_Id;
-- Given an identifier in the expression, check whether there is a
-- discriminant or component of the type that is directy visible, and
-- rewrite it as the corresponding selected component of the formal of
-- the subprogram. The entity is located by a sequential search, which
-- seems acceptable given the typical size of component lists and check
-- expressions. Possible optimization ???
----------------------
-- Replace_Type_Ref --
----------------------
function Replace_Type_Ref (N : Node_Id) return Traverse_Result is
Loc : constant Source_Ptr := Sloc (N);
procedure Add_Prefix (Ref : Node_Id; Comp : Entity_Id);
-- Add the proper prefix to a reference to a component of the type
-- when it is not already a selected component.
----------------
-- Add_Prefix --
----------------
procedure Add_Prefix (Ref : Node_Id; Comp : Entity_Id) is
begin
Rewrite (Ref,
Make_Selected_Component (Loc,
Prefix => New_Occurrence_Of (T, Loc),
Selector_Name => New_Occurrence_Of (Comp, Loc)));
Replace_Type_Reference (Prefix (Ref));
end Add_Prefix;
-- Local variables
Comp : Entity_Id;
Pref : Node_Id;
Scop : Entity_Id;
-- Start of processing for Replace_Type_Ref
begin
if Nkind (N) = N_Identifier then
-- If not the type name, check whether it is a reference to some
-- other type, which must be frozen before the predicate function
-- is analyzed, i.e. before the freeze node of the type to which
-- the predicate applies.
if Chars (N) /= TName then
if Present (Current_Entity (N))
and then Is_Type (Current_Entity (N))
then
Freeze_Before (Freeze_Node (T), Current_Entity (N));
end if;
-- The components of the type are directly visible and can
-- be referenced without a prefix.
if Nkind (Parent (N)) = N_Selected_Component then
null;
-- In expression C (I), C may be a directly visible function
-- or a visible component that has an array type. Disambiguate
-- by examining the component type.
elsif Nkind (Parent (N)) = N_Indexed_Component
and then N = Prefix (Parent (N))
then
Comp := Visible_Component (Chars (N));
if Present (Comp) and then Is_Array_Type (Etype (Comp)) then
Add_Prefix (N, Comp);
end if;
else
Comp := Visible_Component (Chars (N));
if Present (Comp) then
Add_Prefix (N, Comp);
end if;
end if;
return Skip;
-- Otherwise do the replacement and we are done with this node
else
Replace_Type_Reference (N);
return Skip;
end if;
-- Case of selected component (which is what a qualification looks
-- like in the unanalyzed tree, which is what we have.
elsif Nkind (N) = N_Selected_Component then
-- If selector name is not our type, keeping going (we might still
-- have an occurrence of the type in the prefix).
if Nkind (Selector_Name (N)) /= N_Identifier
or else Chars (Selector_Name (N)) /= TName
then
return OK;
-- Selector name is our type, check qualification
else
-- Loop through scopes and prefixes, doing comparison
Scop := Current_Scope;
Pref := Prefix (N);
loop
-- Continue if no more scopes or scope with no name
if No (Scop) or else Nkind (Scop) not in N_Has_Chars then
return OK;
end if;
-- Do replace if prefix is an identifier matching the scope
-- that we are currently looking at.
if Nkind (Pref) = N_Identifier
and then Chars (Pref) = Chars (Scop)
then
Replace_Type_Reference (N);
return Skip;
end if;
-- Go check scope above us if prefix is itself of the form
-- of a selected component, whose selector matches the scope
-- we are currently looking at.
if Nkind (Pref) = N_Selected_Component
and then Nkind (Selector_Name (Pref)) = N_Identifier
and then Chars (Selector_Name (Pref)) = Chars (Scop)
then
Scop := Scope (Scop);
Pref := Prefix (Pref);
-- For anything else, we don't have a match, so keep on
-- going, there are still some weird cases where we may
-- still have a replacement within the prefix.
else
return OK;
end if;
end loop;
end if;
-- Continue for any other node kind
else
return OK;
end if;
end Replace_Type_Ref;
procedure Replace_Type_Refs is new Traverse_Proc (Replace_Type_Ref);
-----------------------
-- Visible_Component --
-----------------------
function Visible_Component (Comp : Name_Id) return Entity_Id is
E : Entity_Id;
begin
-- Types with nameable components are records and discriminated
-- private types.
if Ekind (T) = E_Record_Type
or else (Is_Private_Type (T) and then Has_Discriminants (T))
then
E := First_Entity (T);
while Present (E) loop
if Comes_From_Source (E) and then Chars (E) = Comp then
return E;
end if;
Next_Entity (E);
end loop;
end if;
-- Nothing by that name, or type has no components.
return Empty;
end Visible_Component;
-- Start of processing for Replace_Type_References_Generic
begin
Replace_Type_Refs (N);
end Replace_Type_References_Generic;
--------------------------------
-- Resolve_Aspect_Expressions --
--------------------------------
procedure Resolve_Aspect_Expressions (E : Entity_Id) is
ASN : Node_Id;
A_Id : Aspect_Id;
Expr : Node_Id;
function Resolve_Name (N : Node_Id) return Traverse_Result;
-- Verify that all identifiers in the expression, with the exception
-- of references to the current entity, denote visible entities. This
-- is done only to detect visibility errors, as the expression will be
-- properly analyzed/expanded during analysis of the predicate function
-- body. We omit quantified expressions from this test, given that they
-- introduce a local identifier that would require proper expansion to
-- handle properly.
-- In ASIS_Mode we preserve the entity in the source because there is
-- no subsequent expansion to decorate the tree.
------------------
-- Resolve_Name --
------------------
function Resolve_Name (N : Node_Id) return Traverse_Result is
begin
if Nkind (N) = N_Selected_Component then
if Nkind (Prefix (N)) = N_Identifier
and then Chars (Prefix (N)) /= Chars (E)
then
Find_Selected_Component (N);
end if;
return Skip;
elsif Nkind (N) = N_Identifier and then Chars (N) /= Chars (E) then
Find_Direct_Name (N);
if True or else not ASIS_Mode then -- ????
Set_Entity (N, Empty);
end if;
elsif Nkind (N) = N_Quantified_Expression then
return Skip;
end if;
return OK;
end Resolve_Name;
procedure Resolve_Aspect_Expression is new Traverse_Proc (Resolve_Name);
-- Start of processing for Resolve_Aspect_Expressions
begin
ASN := First_Rep_Item (E);
while Present (ASN) loop
if Nkind (ASN) = N_Aspect_Specification and then Entity (ASN) = E then
A_Id := Get_Aspect_Id (ASN);
Expr := Expression (ASN);
case A_Id is
-- For now we only deal with aspects that do not generate
-- subprograms, or that may mention current instances of
-- types. These will require special handling (???TBD).
when Aspect_Invariant
| Aspect_Predicate
| Aspect_Predicate_Failure
=>
null;
when Aspect_Dynamic_Predicate
| Aspect_Static_Predicate
=>
-- Build predicate function specification and preanalyze
-- expression after type replacement.
if No (Predicate_Function (E)) then
declare
FDecl : constant Node_Id :=
Build_Predicate_Function_Declaration (E);
pragma Unreferenced (FDecl);
begin
Resolve_Aspect_Expression (Expr);
end;
end if;
when Pre_Post_Aspects =>
null;
when Aspect_Iterable =>
if Nkind (Expr) = N_Aggregate then
declare
Assoc : Node_Id;
begin
Assoc := First (Component_Associations (Expr));
while Present (Assoc) loop
Find_Direct_Name (Expression (Assoc));
Next (Assoc);
end loop;
end;
end if;
when others =>
if Present (Expr) then
case Aspect_Argument (A_Id) is
when Expression
| Optional_Expression
=>
Analyze_And_Resolve (Expression (ASN));
when Name
| Optional_Name
=>
if Nkind (Expr) = N_Identifier then
Find_Direct_Name (Expr);
elsif Nkind (Expr) = N_Selected_Component then
Find_Selected_Component (Expr);
end if;
end case;
end if;
end case;
end if;
ASN := Next_Rep_Item (ASN);
end loop;
end Resolve_Aspect_Expressions;
-------------------------
-- Same_Representation --
-------------------------
function Same_Representation (Typ1, Typ2 : Entity_Id) return Boolean is
T1 : constant Entity_Id := Underlying_Type (Typ1);
T2 : constant Entity_Id := Underlying_Type (Typ2);
begin
-- A quick check, if base types are the same, then we definitely have
-- the same representation, because the subtype specific representation
-- attributes (Size and Alignment) do not affect representation from
-- the point of view of this test.
if Base_Type (T1) = Base_Type (T2) then
return True;
elsif Is_Private_Type (Base_Type (T2))
and then Base_Type (T1) = Full_View (Base_Type (T2))
then
return True;
end if;
-- Tagged types never have differing representations
if Is_Tagged_Type (T1) then
return True;
end if;
-- Representations are definitely different if conventions differ
if Convention (T1) /= Convention (T2) then
return False;
end if;
-- Representations are different if component alignments or scalar
-- storage orders differ.
if (Is_Record_Type (T1) or else Is_Array_Type (T1))
and then
(Is_Record_Type (T2) or else Is_Array_Type (T2))
and then
(Component_Alignment (T1) /= Component_Alignment (T2)
or else Reverse_Storage_Order (T1) /= Reverse_Storage_Order (T2))
then
return False;
end if;
-- For arrays, the only real issue is component size. If we know the
-- component size for both arrays, and it is the same, then that's
-- good enough to know we don't have a change of representation.
if Is_Array_Type (T1) then
if Known_Component_Size (T1)
and then Known_Component_Size (T2)
and then Component_Size (T1) = Component_Size (T2)
then
return True;
end if;
end if;
-- Types definitely have same representation if neither has non-standard
-- representation since default representations are always consistent.
-- If only one has non-standard representation, and the other does not,
-- then we consider that they do not have the same representation. They
-- might, but there is no way of telling early enough.
if Has_Non_Standard_Rep (T1) then
if not Has_Non_Standard_Rep (T2) then
return False;
end if;
else
return not Has_Non_Standard_Rep (T2);
end if;
-- Here the two types both have non-standard representation, and we need
-- to determine if they have the same non-standard representation.
-- For arrays, we simply need to test if the component sizes are the
-- same. Pragma Pack is reflected in modified component sizes, so this
-- check also deals with pragma Pack.
if Is_Array_Type (T1) then
return Component_Size (T1) = Component_Size (T2);
-- Tagged types always have the same representation, because it is not
-- possible to specify different representations for common fields.
elsif Is_Tagged_Type (T1) then
return True;
-- Case of record types
elsif Is_Record_Type (T1) then
-- Packed status must conform
if Is_Packed (T1) /= Is_Packed (T2) then
return False;
-- Otherwise we must check components. Typ2 maybe a constrained
-- subtype with fewer components, so we compare the components
-- of the base types.
else
Record_Case : declare
CD1, CD2 : Entity_Id;
function Same_Rep return Boolean;
-- CD1 and CD2 are either components or discriminants. This
-- function tests whether they have the same representation.
--------------
-- Same_Rep --
--------------
function Same_Rep return Boolean is
begin
if No (Component_Clause (CD1)) then
return No (Component_Clause (CD2));
else
-- Note: at this point, component clauses have been
-- normalized to the default bit order, so that the
-- comparison of Component_Bit_Offsets is meaningful.
return
Present (Component_Clause (CD2))
and then
Component_Bit_Offset (CD1) = Component_Bit_Offset (CD2)
and then
Esize (CD1) = Esize (CD2);
end if;
end Same_Rep;
-- Start of processing for Record_Case
begin
if Has_Discriminants (T1) then
-- The number of discriminants may be different if the
-- derived type has fewer (constrained by values). The
-- invisible discriminants retain the representation of
-- the original, so the discrepancy does not per se
-- indicate a different representation.
CD1 := First_Discriminant (T1);
CD2 := First_Discriminant (T2);
while Present (CD1) and then Present (CD2) loop
if not Same_Rep then
return False;
else
Next_Discriminant (CD1);
Next_Discriminant (CD2);
end if;
end loop;
end if;
CD1 := First_Component (Underlying_Type (Base_Type (T1)));
CD2 := First_Component (Underlying_Type (Base_Type (T2)));
while Present (CD1) loop
if not Same_Rep then
return False;
else
Next_Component (CD1);
Next_Component (CD2);
end if;
end loop;
return True;
end Record_Case;
end if;
-- For enumeration types, we must check each literal to see if the
-- representation is the same. Note that we do not permit enumeration
-- representation clauses for Character and Wide_Character, so these
-- cases were already dealt with.
elsif Is_Enumeration_Type (T1) then
Enumeration_Case : declare
L1, L2 : Entity_Id;
begin
L1 := First_Literal (T1);
L2 := First_Literal (T2);
while Present (L1) loop
if Enumeration_Rep (L1) /= Enumeration_Rep (L2) then
return False;
else
Next_Literal (L1);
Next_Literal (L2);
end if;
end loop;
return True;
end Enumeration_Case;
-- Any other types have the same representation for these purposes
else
return True;
end if;
end Same_Representation;
--------------------------------
-- Resolve_Iterable_Operation --
--------------------------------
procedure Resolve_Iterable_Operation
(N : Node_Id;
Cursor : Entity_Id;
Typ : Entity_Id;
Nam : Name_Id)
is
Ent : Entity_Id;
F1 : Entity_Id;
F2 : Entity_Id;
begin
if not Is_Overloaded (N) then
if not Is_Entity_Name (N)
or else Ekind (Entity (N)) /= E_Function
or else Scope (Entity (N)) /= Scope (Typ)
or else No (First_Formal (Entity (N)))
or else Etype (First_Formal (Entity (N))) /= Typ
then
Error_Msg_N ("iterable primitive must be local function name "
& "whose first formal is an iterable type", N);
return;
end if;
Ent := Entity (N);
F1 := First_Formal (Ent);
if Nam = Name_First then
-- First (Container) => Cursor
if Etype (Ent) /= Cursor then
Error_Msg_N ("primitive for First must yield a curosr", N);
end if;
elsif Nam = Name_Next then
-- Next (Container, Cursor) => Cursor
F2 := Next_Formal (F1);
if Etype (F2) /= Cursor
or else Etype (Ent) /= Cursor
or else Present (Next_Formal (F2))
then
Error_Msg_N ("no match for Next iterable primitive", N);
end if;
elsif Nam = Name_Has_Element then
-- Has_Element (Container, Cursor) => Boolean
F2 := Next_Formal (F1);
if Etype (F2) /= Cursor
or else Etype (Ent) /= Standard_Boolean
or else Present (Next_Formal (F2))
then
Error_Msg_N ("no match for Has_Element iterable primitive", N);
end if;
elsif Nam = Name_Element then
F2 := Next_Formal (F1);
if No (F2)
or else Etype (F2) /= Cursor
or else Present (Next_Formal (F2))
then
Error_Msg_N ("no match for Element iterable primitive", N);
end if;
null;
else
raise Program_Error;
end if;
else
-- Overloaded case: find subprogram with proper signature.
-- Caller will report error if no match is found.
declare
I : Interp_Index;
It : Interp;
begin
Get_First_Interp (N, I, It);
while Present (It.Typ) loop
if Ekind (It.Nam) = E_Function
and then Scope (It.Nam) = Scope (Typ)
and then Etype (First_Formal (It.Nam)) = Typ
then
F1 := First_Formal (It.Nam);
if Nam = Name_First then
if Etype (It.Nam) = Cursor
and then No (Next_Formal (F1))
then
Set_Entity (N, It.Nam);
exit;
end if;
elsif Nam = Name_Next then
F2 := Next_Formal (F1);
if Present (F2)
and then No (Next_Formal (F2))
and then Etype (F2) = Cursor
and then Etype (It.Nam) = Cursor
then
Set_Entity (N, It.Nam);
exit;
end if;
elsif Nam = Name_Has_Element then
F2 := Next_Formal (F1);
if Present (F2)
and then No (Next_Formal (F2))
and then Etype (F2) = Cursor
and then Etype (It.Nam) = Standard_Boolean
then
Set_Entity (N, It.Nam);
F2 := Next_Formal (F1);
exit;
end if;
elsif Nam = Name_Element then
F2 := Next_Formal (F1);
if Present (F2)
and then No (Next_Formal (F2))
and then Etype (F2) = Cursor
then
Set_Entity (N, It.Nam);
exit;
end if;
end if;
end if;
Get_Next_Interp (I, It);
end loop;
end;
end if;
end Resolve_Iterable_Operation;
----------------
-- Set_Biased --
----------------
procedure Set_Biased
(E : Entity_Id;
N : Node_Id;
Msg : String;
Biased : Boolean := True)
is
begin
if Biased then
Set_Has_Biased_Representation (E);
if Warn_On_Biased_Representation then
Error_Msg_NE
("?B?" & Msg & " forces biased representation for&", N, E);
end if;
end if;
end Set_Biased;
--------------------
-- Set_Enum_Esize --
--------------------
procedure Set_Enum_Esize (T : Entity_Id) is
Lo : Uint;
Hi : Uint;
Sz : Nat;
begin
Init_Alignment (T);
-- Find the minimum standard size (8,16,32,64) that fits
Lo := Enumeration_Rep (Entity (Type_Low_Bound (T)));
Hi := Enumeration_Rep (Entity (Type_High_Bound (T)));
if Lo < 0 then
if Lo >= -Uint_2**07 and then Hi < Uint_2**07 then
Sz := Standard_Character_Size; -- May be > 8 on some targets
elsif Lo >= -Uint_2**15 and then Hi < Uint_2**15 then
Sz := 16;
elsif Lo >= -Uint_2**31 and then Hi < Uint_2**31 then
Sz := 32;
else pragma Assert (Lo >= -Uint_2**63 and then Hi < Uint_2**63);
Sz := 64;
end if;
else
if Hi < Uint_2**08 then
Sz := Standard_Character_Size; -- May be > 8 on some targets
elsif Hi < Uint_2**16 then
Sz := 16;
elsif Hi < Uint_2**32 then
Sz := 32;
else pragma Assert (Hi < Uint_2**63);
Sz := 64;
end if;
end if;
-- That minimum is the proper size unless we have a foreign convention
-- and the size required is 32 or less, in which case we bump the size
-- up to 32. This is required for C and C++ and seems reasonable for
-- all other foreign conventions.
if Has_Foreign_Convention (T)
and then Esize (T) < Standard_Integer_Size
-- Don't do this if Short_Enums on target
and then not Target_Short_Enums
then
Init_Esize (T, Standard_Integer_Size);
else
Init_Esize (T, Sz);
end if;
end Set_Enum_Esize;
-----------------------------
-- Uninstall_Discriminants --
-----------------------------
procedure Uninstall_Discriminants (E : Entity_Id) is
Disc : Entity_Id;
Prev : Entity_Id;
Outer : Entity_Id;
begin
-- Discriminants have been made visible for type declarations and
-- protected type declarations, not for subtype declarations.
if Nkind (Parent (E)) /= N_Subtype_Declaration then
Disc := First_Discriminant (E);
while Present (Disc) loop
if Disc /= Current_Entity (Disc) then
Prev := Current_Entity (Disc);
while Present (Prev)
and then Present (Homonym (Prev))
and then Homonym (Prev) /= Disc
loop
Prev := Homonym (Prev);
end loop;
else
Prev := Empty;
end if;
Set_Is_Immediately_Visible (Disc, False);
Outer := Homonym (Disc);
while Present (Outer) and then Scope (Outer) = E loop
Outer := Homonym (Outer);
end loop;
-- Reset homonym link of other entities, but do not modify link
-- between entities in current scope, so that the back end can
-- have a proper count of local overloadings.
if No (Prev) then
Set_Name_Entity_Id (Chars (Disc), Outer);
elsif Scope (Prev) /= Scope (Disc) then
Set_Homonym (Prev, Outer);
end if;
Next_Discriminant (Disc);
end loop;
end if;
end Uninstall_Discriminants;
-------------------------------------------
-- Uninstall_Discriminants_And_Pop_Scope --
-------------------------------------------
procedure Uninstall_Discriminants_And_Pop_Scope (E : Entity_Id) is
begin
if Has_Discriminants (E) then
Uninstall_Discriminants (E);
Pop_Scope;
end if;
end Uninstall_Discriminants_And_Pop_Scope;
------------------------------
-- Validate_Address_Clauses --
------------------------------
procedure Validate_Address_Clauses is
function Offset_Value (Expr : Node_Id) return Uint;
-- Given an Address attribute reference, return the value in bits of its
-- offset from the first bit of the underlying entity, or 0 if it is not
-- known at compile time.
------------------
-- Offset_Value --
------------------
function Offset_Value (Expr : Node_Id) return Uint is
N : Node_Id := Prefix (Expr);
Off : Uint;
Val : Uint := Uint_0;
begin
-- Climb the prefix chain and compute the cumulative offset
loop
if Is_Entity_Name (N) then
return Val;
elsif Nkind (N) = N_Selected_Component then
Off := Component_Bit_Offset (Entity (Selector_Name (N)));
if Off /= No_Uint and then Off >= Uint_0 then
Val := Val + Off;
N := Prefix (N);
else
return Uint_0;
end if;
elsif Nkind (N) = N_Indexed_Component then
Off := Indexed_Component_Bit_Offset (N);
if Off /= No_Uint then
Val := Val + Off;
N := Prefix (N);
else
return Uint_0;
end if;
else
return Uint_0;
end if;
end loop;
end Offset_Value;
-- Start of processing for Validate_Address_Clauses
begin
for J in Address_Clause_Checks.First .. Address_Clause_Checks.Last loop
declare
ACCR : Address_Clause_Check_Record
renames Address_Clause_Checks.Table (J);
Expr : Node_Id;
X_Alignment : Uint;
Y_Alignment : Uint;
X_Size : Uint;
Y_Size : Uint;
X_Offs : Uint;
begin
-- Skip processing of this entry if warning already posted
if not Address_Warning_Posted (ACCR.N) then
Expr := Original_Node (Expression (ACCR.N));
-- Get alignments, sizes and offset, if any
X_Alignment := Alignment (ACCR.X);
X_Size := Esize (ACCR.X);
if Present (ACCR.Y) then
Y_Alignment := Alignment (ACCR.Y);
Y_Size := Esize (ACCR.Y);
end if;
if ACCR.Off
and then Nkind (Expr) = N_Attribute_Reference
and then Attribute_Name (Expr) = Name_Address
then
X_Offs := Offset_Value (Expr);
else
X_Offs := Uint_0;
end if;
-- Check for known value not multiple of alignment
if No (ACCR.Y) then
if not Alignment_Checks_Suppressed (ACCR.X)
and then X_Alignment /= 0
and then ACCR.A mod X_Alignment /= 0
then
Error_Msg_NE
("??specified address for& is inconsistent with "
& "alignment", ACCR.N, ACCR.X);
Error_Msg_N
("\??program execution may be erroneous (RM 13.3(27))",
ACCR.N);
Error_Msg_Uint_1 := X_Alignment;
Error_Msg_NE ("\??alignment of & is ^", ACCR.N, ACCR.X);
end if;
-- Check for large object overlaying smaller one
elsif Y_Size > Uint_0
and then X_Size > Uint_0
and then X_Offs + X_Size > Y_Size
then
Error_Msg_NE ("??& overlays smaller object", ACCR.N, ACCR.X);
Error_Msg_N
("\??program execution may be erroneous", ACCR.N);
Error_Msg_Uint_1 := X_Size;
Error_Msg_NE ("\??size of & is ^", ACCR.N, ACCR.X);
Error_Msg_Uint_1 := Y_Size;
Error_Msg_NE ("\??size of & is ^", ACCR.N, ACCR.Y);
if Y_Size >= X_Size then
Error_Msg_Uint_1 := X_Offs;
Error_Msg_NE ("\??but offset of & is ^", ACCR.N, ACCR.X);
end if;
-- Check for inadequate alignment, both of the base object
-- and of the offset, if any. We only do this check if the
-- run-time Alignment_Check is active. No point in warning
-- if this check has been suppressed (or is suppressed by
-- default in the non-strict alignment machine case).
-- Note: we do not check the alignment if we gave a size
-- warning, since it would likely be redundant.
elsif not Alignment_Checks_Suppressed (ACCR.X)
and then Y_Alignment /= Uint_0
and then
(Y_Alignment < X_Alignment
or else
(ACCR.Off
and then Nkind (Expr) = N_Attribute_Reference
and then Attribute_Name (Expr) = Name_Address
and then Has_Compatible_Alignment
(ACCR.X, Prefix (Expr), True) /=
Known_Compatible))
then
Error_Msg_NE
("??specified address for& may be inconsistent with "
& "alignment", ACCR.N, ACCR.X);
Error_Msg_N
("\??program execution may be erroneous (RM 13.3(27))",
ACCR.N);
Error_Msg_Uint_1 := X_Alignment;
Error_Msg_NE ("\??alignment of & is ^", ACCR.N, ACCR.X);
Error_Msg_Uint_1 := Y_Alignment;
Error_Msg_NE ("\??alignment of & is ^", ACCR.N, ACCR.Y);
if Y_Alignment >= X_Alignment then
Error_Msg_N
("\??but offset is not multiple of alignment", ACCR.N);
end if;
end if;
end if;
end;
end loop;
end Validate_Address_Clauses;
-----------------------------------------
-- Validate_Compile_Time_Warning_Error --
-----------------------------------------
procedure Validate_Compile_Time_Warning_Error (N : Node_Id) is
begin
Compile_Time_Warnings_Errors.Append
(New_Val => CTWE_Entry'(Eloc => Sloc (N),
Scope => Current_Scope,
Prag => N));
end Validate_Compile_Time_Warning_Error;
------------------------------------------
-- Validate_Compile_Time_Warning_Errors --
------------------------------------------
procedure Validate_Compile_Time_Warning_Errors is
procedure Set_Scope (S : Entity_Id);
-- Install all enclosing scopes of S along with S itself
procedure Unset_Scope (S : Entity_Id);
-- Uninstall all enclosing scopes of S along with S itself
---------------
-- Set_Scope --
---------------
procedure Set_Scope (S : Entity_Id) is
begin
if S /= Standard_Standard then
Set_Scope (Scope (S));
end if;
Push_Scope (S);
end Set_Scope;
-----------------
-- Unset_Scope --
-----------------
procedure Unset_Scope (S : Entity_Id) is
begin
if S /= Standard_Standard then
Unset_Scope (Scope (S));
end if;
Pop_Scope;
end Unset_Scope;
-- Start of processing for Validate_Compile_Time_Warning_Errors
begin
Expander_Mode_Save_And_Set (False);
In_Compile_Time_Warning_Or_Error := True;
for N in Compile_Time_Warnings_Errors.First ..
Compile_Time_Warnings_Errors.Last
loop
declare
T : CTWE_Entry renames Compile_Time_Warnings_Errors.Table (N);
begin
Set_Scope (T.Scope);
Reset_Analyzed_Flags (T.Prag);
Process_Compile_Time_Warning_Or_Error (T.Prag, T.Eloc);
Unset_Scope (T.Scope);
end;
end loop;
In_Compile_Time_Warning_Or_Error := False;
Expander_Mode_Restore;
end Validate_Compile_Time_Warning_Errors;
---------------------------
-- Validate_Independence --
---------------------------
procedure Validate_Independence is
SU : constant Uint := UI_From_Int (System_Storage_Unit);
N : Node_Id;
E : Entity_Id;
IC : Boolean;
Comp : Entity_Id;
Addr : Node_Id;
P : Node_Id;
procedure Check_Array_Type (Atyp : Entity_Id);
-- Checks if the array type Atyp has independent components, and
-- if not, outputs an appropriate set of error messages.
procedure No_Independence;
-- Output message that independence cannot be guaranteed
function OK_Component (C : Entity_Id) return Boolean;
-- Checks one component to see if it is independently accessible, and
-- if so yields True, otherwise yields False if independent access
-- cannot be guaranteed. This is a conservative routine, it only
-- returns True if it knows for sure, it returns False if it knows
-- there is a problem, or it cannot be sure there is no problem.
procedure Reason_Bad_Component (C : Entity_Id);
-- Outputs continuation message if a reason can be determined for
-- the component C being bad.
----------------------
-- Check_Array_Type --
----------------------
procedure Check_Array_Type (Atyp : Entity_Id) is
Ctyp : constant Entity_Id := Component_Type (Atyp);
begin
-- OK if no alignment clause, no pack, and no component size
if not Has_Component_Size_Clause (Atyp)
and then not Has_Alignment_Clause (Atyp)
and then not Is_Packed (Atyp)
then
return;
end if;
-- Case of component size is greater than or equal to 64 and the
-- alignment of the array is at least as large as the alignment
-- of the component. We are definitely OK in this situation.
if Known_Component_Size (Atyp)
and then Component_Size (Atyp) >= 64
and then Known_Alignment (Atyp)
and then Known_Alignment (Ctyp)
and then Alignment (Atyp) >= Alignment (Ctyp)
then
return;
end if;
-- Check actual component size
if not Known_Component_Size (Atyp)
or else not (Addressable (Component_Size (Atyp))
and then Component_Size (Atyp) < 64)
or else Component_Size (Atyp) mod Esize (Ctyp) /= 0
then
No_Independence;
-- Bad component size, check reason
if Has_Component_Size_Clause (Atyp) then
P := Get_Attribute_Definition_Clause
(Atyp, Attribute_Component_Size);
if Present (P) then
Error_Msg_Sloc := Sloc (P);
Error_Msg_N ("\because of Component_Size clause#", N);
return;
end if;
end if;
if Is_Packed (Atyp) then
P := Get_Rep_Pragma (Atyp, Name_Pack);
if Present (P) then
Error_Msg_Sloc := Sloc (P);
Error_Msg_N ("\because of pragma Pack#", N);
return;
end if;
end if;
-- No reason found, just return
return;
end if;
-- Array type is OK independence-wise
return;
end Check_Array_Type;
---------------------
-- No_Independence --
---------------------
procedure No_Independence is
begin
if Pragma_Name (N) = Name_Independent then
Error_Msg_NE ("independence cannot be guaranteed for&", N, E);
else
Error_Msg_NE
("independent components cannot be guaranteed for&", N, E);
end if;
end No_Independence;
------------------
-- OK_Component --
------------------
function OK_Component (C : Entity_Id) return Boolean is
Rec : constant Entity_Id := Scope (C);
Ctyp : constant Entity_Id := Etype (C);
begin
-- OK if no component clause, no Pack, and no alignment clause
if No (Component_Clause (C))
and then not Is_Packed (Rec)
and then not Has_Alignment_Clause (Rec)
then
return True;
end if;
-- Here we look at the actual component layout. A component is
-- addressable if its size is a multiple of the Esize of the
-- component type, and its starting position in the record has
-- appropriate alignment, and the record itself has appropriate
-- alignment to guarantee the component alignment.
-- Make sure sizes are static, always assume the worst for any
-- cases where we cannot check static values.
if not (Known_Static_Esize (C)
and then
Known_Static_Esize (Ctyp))
then
return False;
end if;
-- Size of component must be addressable or greater than 64 bits
-- and a multiple of bytes.
if not Addressable (Esize (C)) and then Esize (C) < Uint_64 then
return False;
end if;
-- Check size is proper multiple
if Esize (C) mod Esize (Ctyp) /= 0 then
return False;
end if;
-- Check alignment of component is OK
if not Known_Component_Bit_Offset (C)
or else Component_Bit_Offset (C) < Uint_0
or else Component_Bit_Offset (C) mod Esize (Ctyp) /= 0
then
return False;
end if;
-- Check alignment of record type is OK
if not Known_Alignment (Rec)
or else (Alignment (Rec) * SU) mod Esize (Ctyp) /= 0
then
return False;
end if;
-- All tests passed, component is addressable
return True;
end OK_Component;
--------------------------
-- Reason_Bad_Component --
--------------------------
procedure Reason_Bad_Component (C : Entity_Id) is
Rec : constant Entity_Id := Scope (C);
Ctyp : constant Entity_Id := Etype (C);
begin
-- If component clause present assume that's the problem
if Present (Component_Clause (C)) then
Error_Msg_Sloc := Sloc (Component_Clause (C));
Error_Msg_N ("\because of Component_Clause#", N);
return;
end if;
-- If pragma Pack clause present, assume that's the problem
if Is_Packed (Rec) then
P := Get_Rep_Pragma (Rec, Name_Pack);
if Present (P) then
Error_Msg_Sloc := Sloc (P);
Error_Msg_N ("\because of pragma Pack#", N);
return;
end if;
end if;
-- See if record has bad alignment clause
if Has_Alignment_Clause (Rec)
and then Known_Alignment (Rec)
and then (Alignment (Rec) * SU) mod Esize (Ctyp) /= 0
then
P := Get_Attribute_Definition_Clause (Rec, Attribute_Alignment);
if Present (P) then
Error_Msg_Sloc := Sloc (P);
Error_Msg_N ("\because of Alignment clause#", N);
end if;
end if;
-- Couldn't find a reason, so return without a message
return;
end Reason_Bad_Component;
-- Start of processing for Validate_Independence
begin
for J in Independence_Checks.First .. Independence_Checks.Last loop
N := Independence_Checks.Table (J).N;
E := Independence_Checks.Table (J).E;
IC := Pragma_Name (N) = Name_Independent_Components;
-- Deal with component case
if Ekind (E) = E_Discriminant or else Ekind (E) = E_Component then
if not OK_Component (E) then
No_Independence;
Reason_Bad_Component (E);
goto Continue;
end if;
end if;
-- Deal with record with Independent_Components
if IC and then Is_Record_Type (E) then
Comp := First_Component_Or_Discriminant (E);
while Present (Comp) loop
if not OK_Component (Comp) then
No_Independence;
Reason_Bad_Component (Comp);
goto Continue;
end if;
Next_Component_Or_Discriminant (Comp);
end loop;
end if;
-- Deal with address clause case
if Is_Object (E) then
Addr := Address_Clause (E);
if Present (Addr) then
No_Independence;
Error_Msg_Sloc := Sloc (Addr);
Error_Msg_N ("\because of Address clause#", N);
goto Continue;
end if;
end if;
-- Deal with independent components for array type
if IC and then Is_Array_Type (E) then
Check_Array_Type (E);
end if;
-- Deal with independent components for array object
if IC and then Is_Object (E) and then Is_Array_Type (Etype (E)) then
Check_Array_Type (Etype (E));
end if;
<<Continue>> null;
end loop;
end Validate_Independence;
------------------------------
-- Validate_Iterable_Aspect --
------------------------------
procedure Validate_Iterable_Aspect (Typ : Entity_Id; ASN : Node_Id) is
Assoc : Node_Id;
Expr : Node_Id;
Prim : Node_Id;
Cursor : constant Entity_Id := Get_Cursor_Type (ASN, Typ);
First_Id : Entity_Id;
Next_Id : Entity_Id;
Has_Element_Id : Entity_Id;
Element_Id : Entity_Id;
begin
-- If previous error aspect is unusable
if Cursor = Any_Type then
return;
end if;
First_Id := Empty;
Next_Id := Empty;
Has_Element_Id := Empty;
Element_Id := Empty;
-- Each expression must resolve to a function with the proper signature
Assoc := First (Component_Associations (Expression (ASN)));
while Present (Assoc) loop
Expr := Expression (Assoc);
Analyze (Expr);
Prim := First (Choices (Assoc));
if Nkind (Prim) /= N_Identifier or else Present (Next (Prim)) then
Error_Msg_N ("illegal name in association", Prim);
elsif Chars (Prim) = Name_First then
Resolve_Iterable_Operation (Expr, Cursor, Typ, Name_First);
First_Id := Entity (Expr);
elsif Chars (Prim) = Name_Next then
Resolve_Iterable_Operation (Expr, Cursor, Typ, Name_Next);
Next_Id := Entity (Expr);
elsif Chars (Prim) = Name_Has_Element then
Resolve_Iterable_Operation (Expr, Cursor, Typ, Name_Has_Element);
Has_Element_Id := Entity (Expr);
elsif Chars (Prim) = Name_Element then
Resolve_Iterable_Operation (Expr, Cursor, Typ, Name_Element);
Element_Id := Entity (Expr);
else
Error_Msg_N ("invalid name for iterable function", Prim);
end if;
Next (Assoc);
end loop;
if No (First_Id) then
Error_Msg_N ("match for First primitive not found", ASN);
elsif No (Next_Id) then
Error_Msg_N ("match for Next primitive not found", ASN);
elsif No (Has_Element_Id) then
Error_Msg_N ("match for Has_Element primitive not found", ASN);
elsif No (Element_Id) then
null; -- Optional.
end if;
end Validate_Iterable_Aspect;
-----------------------------------
-- Validate_Unchecked_Conversion --
-----------------------------------
procedure Validate_Unchecked_Conversion
(N : Node_Id;
Act_Unit : Entity_Id)
is
Source : Entity_Id;
Target : Entity_Id;
Vnode : Node_Id;
begin
-- Obtain source and target types. Note that we call Ancestor_Subtype
-- here because the processing for generic instantiation always makes
-- subtypes, and we want the original frozen actual types.
-- If we are dealing with private types, then do the check on their
-- fully declared counterparts if the full declarations have been
-- encountered (they don't have to be visible, but they must exist).
Source := Ancestor_Subtype (Etype (First_Formal (Act_Unit)));
if Is_Private_Type (Source)
and then Present (Underlying_Type (Source))
then
Source := Underlying_Type (Source);
end if;
Target := Ancestor_Subtype (Etype (Act_Unit));
-- If either type is generic, the instantiation happens within a generic
-- unit, and there is nothing to check. The proper check will happen
-- when the enclosing generic is instantiated.
if Is_Generic_Type (Source) or else Is_Generic_Type (Target) then
return;
end if;
if Is_Private_Type (Target)
and then Present (Underlying_Type (Target))
then
Target := Underlying_Type (Target);
end if;
-- Source may be unconstrained array, but not target, except in relaxed
-- semantics mode.
if Is_Array_Type (Target)
and then not Is_Constrained (Target)
and then not Relaxed_RM_Semantics
then
Error_Msg_N
("unchecked conversion to unconstrained array not allowed", N);
return;
end if;
-- Warn if conversion between two different convention pointers
if Is_Access_Type (Target)
and then Is_Access_Type (Source)
and then Convention (Target) /= Convention (Source)
and then Warn_On_Unchecked_Conversion
then
-- Give warnings for subprogram pointers only on most targets
if Is_Access_Subprogram_Type (Target)
or else Is_Access_Subprogram_Type (Source)
then
Error_Msg_N
("?z?conversion between pointers with different conventions!",
N);
end if;
end if;
-- Warn if one of the operands is Ada.Calendar.Time. Do not emit a
-- warning when compiling GNAT-related sources.
if Warn_On_Unchecked_Conversion
and then not In_Predefined_Unit (N)
and then RTU_Loaded (Ada_Calendar)
and then (Chars (Source) = Name_Time
or else
Chars (Target) = Name_Time)
then
-- If Ada.Calendar is loaded and the name of one of the operands is
-- Time, there is a good chance that this is Ada.Calendar.Time.
declare
Calendar_Time : constant Entity_Id := Full_View (RTE (RO_CA_Time));
begin
pragma Assert (Present (Calendar_Time));
if Source = Calendar_Time or else Target = Calendar_Time then
Error_Msg_N
("?z?representation of 'Time values may change between "
& "'G'N'A'T versions", N);
end if;
end;
end if;
-- Make entry in unchecked conversion table for later processing by
-- Validate_Unchecked_Conversions, which will check sizes and alignments
-- (using values set by the back end where possible). This is only done
-- if the appropriate warning is active.
if Warn_On_Unchecked_Conversion then
Unchecked_Conversions.Append
(New_Val => UC_Entry'(Eloc => Sloc (N),
Source => Source,
Target => Target,
Act_Unit => Act_Unit));
-- If both sizes are known statically now, then back-end annotation
-- is not required to do a proper check but if either size is not
-- known statically, then we need the annotation.
if Known_Static_RM_Size (Source)
and then
Known_Static_RM_Size (Target)
then
null;
else
Back_Annotate_Rep_Info := True;
end if;
end if;
-- If unchecked conversion to access type, and access type is declared
-- in the same unit as the unchecked conversion, then set the flag
-- No_Strict_Aliasing (no strict aliasing is implicit here)
if Is_Access_Type (Target) and then
In_Same_Source_Unit (Target, N)
then
Set_No_Strict_Aliasing (Implementation_Base_Type (Target));
end if;
-- Generate N_Validate_Unchecked_Conversion node for back end in case
-- the back end needs to perform special validation checks.
-- Shouldn't this be in Exp_Ch13, since the check only gets done if we
-- have full expansion and the back end is called ???
Vnode :=
Make_Validate_Unchecked_Conversion (Sloc (N));
Set_Source_Type (Vnode, Source);
Set_Target_Type (Vnode, Target);
-- If the unchecked conversion node is in a list, just insert before it.
-- If not we have some strange case, not worth bothering about.
if Is_List_Member (N) then
Insert_After (N, Vnode);
end if;
end Validate_Unchecked_Conversion;
------------------------------------
-- Validate_Unchecked_Conversions --
------------------------------------
procedure Validate_Unchecked_Conversions is
begin
for N in Unchecked_Conversions.First .. Unchecked_Conversions.Last loop
declare
T : UC_Entry renames Unchecked_Conversions.Table (N);
Act_Unit : constant Entity_Id := T.Act_Unit;
Eloc : constant Source_Ptr := T.Eloc;
Source : constant Entity_Id := T.Source;
Target : constant Entity_Id := T.Target;
Source_Siz : Uint;
Target_Siz : Uint;
begin
-- Skip if function marked as warnings off
if Warnings_Off (Act_Unit) then
goto Continue;
end if;
-- This validation check, which warns if we have unequal sizes for
-- unchecked conversion, and thus potentially implementation
-- dependent semantics, is one of the few occasions on which we
-- use the official RM size instead of Esize. See description in
-- Einfo "Handling of Type'Size Values" for details.
if Serious_Errors_Detected = 0
and then Known_Static_RM_Size (Source)
and then Known_Static_RM_Size (Target)
-- Don't do the check if warnings off for either type, note the
-- deliberate use of OR here instead of OR ELSE to get the flag
-- Warnings_Off_Used set for both types if appropriate.
and then not (Has_Warnings_Off (Source)
or
Has_Warnings_Off (Target))
then
Source_Siz := RM_Size (Source);
Target_Siz := RM_Size (Target);
if Source_Siz /= Target_Siz then
Error_Msg
("?z?types for unchecked conversion have different sizes!",
Eloc);
if All_Errors_Mode then
Error_Msg_Name_1 := Chars (Source);
Error_Msg_Uint_1 := Source_Siz;
Error_Msg_Name_2 := Chars (Target);
Error_Msg_Uint_2 := Target_Siz;
Error_Msg ("\size of % is ^, size of % is ^?z?", Eloc);
Error_Msg_Uint_1 := UI_Abs (Source_Siz - Target_Siz);
if Is_Discrete_Type (Source)
and then
Is_Discrete_Type (Target)
then
if Source_Siz > Target_Siz then
Error_Msg
("\?z?^ high order bits of source will "
& "be ignored!", Eloc);
elsif Is_Unsigned_Type (Source) then
Error_Msg
("\?z?source will be extended with ^ high order "
& "zero bits!", Eloc);
else
Error_Msg
("\?z?source will be extended with ^ high order "
& "sign bits!", Eloc);
end if;
elsif Source_Siz < Target_Siz then
if Is_Discrete_Type (Target) then
if Bytes_Big_Endian then
Error_Msg
("\?z?target value will include ^ undefined "
& "low order bits!", Eloc);
else
Error_Msg
("\?z?target value will include ^ undefined "
& "high order bits!", Eloc);
end if;
else
Error_Msg
("\?z?^ trailing bits of target value will be "
& "undefined!", Eloc);
end if;
else pragma Assert (Source_Siz > Target_Siz);
if Is_Discrete_Type (Source) then
if Bytes_Big_Endian then
Error_Msg
("\?z?^ low order bits of source will be "
& "ignored!", Eloc);
else
Error_Msg
("\?z?^ high order bits of source will be "
& "ignored!", Eloc);
end if;
else
Error_Msg
("\?z?^ trailing bits of source will be "
& "ignored!", Eloc);
end if;
end if;
end if;
end if;
end if;
-- If both types are access types, we need to check the alignment.
-- If the alignment of both is specified, we can do it here.
if Serious_Errors_Detected = 0
and then Is_Access_Type (Source)
and then Is_Access_Type (Target)
and then Target_Strict_Alignment
and then Present (Designated_Type (Source))
and then Present (Designated_Type (Target))
then
declare
D_Source : constant Entity_Id := Designated_Type (Source);
D_Target : constant Entity_Id := Designated_Type (Target);
begin
if Known_Alignment (D_Source)
and then
Known_Alignment (D_Target)
then
declare
Source_Align : constant Uint := Alignment (D_Source);
Target_Align : constant Uint := Alignment (D_Target);
begin
if Source_Align < Target_Align
and then not Is_Tagged_Type (D_Source)
-- Suppress warning if warnings suppressed on either
-- type or either designated type. Note the use of
-- OR here instead of OR ELSE. That is intentional,
-- we would like to set flag Warnings_Off_Used in
-- all types for which warnings are suppressed.
and then not (Has_Warnings_Off (D_Source)
or
Has_Warnings_Off (D_Target)
or
Has_Warnings_Off (Source)
or
Has_Warnings_Off (Target))
then
Error_Msg_Uint_1 := Target_Align;
Error_Msg_Uint_2 := Source_Align;
Error_Msg_Node_1 := D_Target;
Error_Msg_Node_2 := D_Source;
Error_Msg
("?z?alignment of & (^) is stricter than "
& "alignment of & (^)!", Eloc);
Error_Msg
("\?z?resulting access value may have invalid "
& "alignment!", Eloc);
end if;
end;
end if;
end;
end if;
end;
<<Continue>>
null;
end loop;
end Validate_Unchecked_Conversions;
end Sem_Ch13;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --
-- 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.Internals.UML_Named_Elements;
with AMF.UML.Activities;
with AMF.UML.Activity_Edges.Collections;
with AMF.UML.Activity_Groups.Collections;
with AMF.UML.Activity_Nodes.Collections;
with AMF.UML.Activity_Partitions.Collections;
with AMF.UML.Classifiers.Collections;
with AMF.UML.Constraints.Collections;
with AMF.UML.Dependencies.Collections;
with AMF.UML.Exception_Handlers.Collections;
with AMF.UML.Input_Pins.Collections;
with AMF.UML.Interruptible_Activity_Regions.Collections;
with AMF.UML.Named_Elements;
with AMF.UML.Namespaces;
with AMF.UML.Output_Pins.Collections;
with AMF.UML.Packages.Collections;
with AMF.UML.Redefinable_Elements.Collections;
with AMF.UML.String_Expressions;
with AMF.UML.Structured_Activity_Nodes;
with AMF.UML.Unmarshall_Actions;
with AMF.Visitors;
package AMF.Internals.UML_Unmarshall_Actions is
type UML_Unmarshall_Action_Proxy is
limited new AMF.Internals.UML_Named_Elements.UML_Named_Element_Proxy
and AMF.UML.Unmarshall_Actions.UML_Unmarshall_Action with null record;
overriding function Get_Object
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Input_Pins.UML_Input_Pin_Access;
-- Getter of UnmarshallAction::object.
--
-- The object to be unmarshalled.
overriding procedure Set_Object
(Self : not null access UML_Unmarshall_Action_Proxy;
To : AMF.UML.Input_Pins.UML_Input_Pin_Access);
-- Setter of UnmarshallAction::object.
--
-- The object to be unmarshalled.
overriding function Get_Result
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Output_Pins.Collections.Set_Of_UML_Output_Pin;
-- Getter of UnmarshallAction::result.
--
-- The values of the structural features of the input object.
overriding function Get_Unmarshall_Type
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Classifiers.UML_Classifier_Access;
-- Getter of UnmarshallAction::unmarshallType.
--
-- The type of the object to be unmarshalled.
overriding procedure Set_Unmarshall_Type
(Self : not null access UML_Unmarshall_Action_Proxy;
To : AMF.UML.Classifiers.UML_Classifier_Access);
-- Setter of UnmarshallAction::unmarshallType.
--
-- The type of the object to be unmarshalled.
overriding function Get_Context
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Classifiers.UML_Classifier_Access;
-- Getter of Action::context.
--
-- The classifier that owns the behavior of which this action is a part.
overriding function Get_Input
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Input_Pins.Collections.Ordered_Set_Of_UML_Input_Pin;
-- Getter of Action::input.
--
-- The ordered set of input pins connected to the Action. These are among
-- the total set of inputs.
overriding function Get_Is_Locally_Reentrant
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return Boolean;
-- Getter of Action::isLocallyReentrant.
--
-- If true, the action can begin a new, concurrent execution, even if
-- there is already another execution of the action ongoing. If false, the
-- action cannot begin a new execution until any previous execution has
-- completed.
overriding procedure Set_Is_Locally_Reentrant
(Self : not null access UML_Unmarshall_Action_Proxy;
To : Boolean);
-- Setter of Action::isLocallyReentrant.
--
-- If true, the action can begin a new, concurrent execution, even if
-- there is already another execution of the action ongoing. If false, the
-- action cannot begin a new execution until any previous execution has
-- completed.
overriding function Get_Local_Postcondition
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint;
-- Getter of Action::localPostcondition.
--
-- Constraint that must be satisfied when executed is completed.
overriding function Get_Local_Precondition
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint;
-- Getter of Action::localPrecondition.
--
-- Constraint that must be satisfied when execution is started.
overriding function Get_Output
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Output_Pins.Collections.Ordered_Set_Of_UML_Output_Pin;
-- Getter of Action::output.
--
-- The ordered set of output pins connected to the Action. The action
-- places its results onto pins in this set.
overriding function Get_Handler
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Exception_Handlers.Collections.Set_Of_UML_Exception_Handler;
-- Getter of ExecutableNode::handler.
--
-- A set of exception handlers that are examined if an uncaught exception
-- propagates to the outer level of the executable node.
overriding function Get_Activity
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Activities.UML_Activity_Access;
-- Getter of ActivityNode::activity.
--
-- Activity containing the node.
overriding procedure Set_Activity
(Self : not null access UML_Unmarshall_Action_Proxy;
To : AMF.UML.Activities.UML_Activity_Access);
-- Setter of ActivityNode::activity.
--
-- Activity containing the node.
overriding function Get_In_Group
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Activity_Groups.Collections.Set_Of_UML_Activity_Group;
-- Getter of ActivityNode::inGroup.
--
-- Groups containing the node.
overriding function Get_In_Interruptible_Region
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Interruptible_Activity_Regions.Collections.Set_Of_UML_Interruptible_Activity_Region;
-- Getter of ActivityNode::inInterruptibleRegion.
--
-- Interruptible regions containing the node.
overriding function Get_In_Partition
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Activity_Partitions.Collections.Set_Of_UML_Activity_Partition;
-- Getter of ActivityNode::inPartition.
--
-- Partitions containing the node.
overriding function Get_In_Structured_Node
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access;
-- Getter of ActivityNode::inStructuredNode.
--
-- Structured activity node containing the node.
overriding procedure Set_In_Structured_Node
(Self : not null access UML_Unmarshall_Action_Proxy;
To : AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access);
-- Setter of ActivityNode::inStructuredNode.
--
-- Structured activity node containing the node.
overriding function Get_Incoming
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge;
-- Getter of ActivityNode::incoming.
--
-- Edges that have the node as target.
overriding function Get_Outgoing
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge;
-- Getter of ActivityNode::outgoing.
--
-- Edges that have the node as source.
overriding function Get_Redefined_Node
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Activity_Nodes.Collections.Set_Of_UML_Activity_Node;
-- Getter of ActivityNode::redefinedNode.
--
-- Inherited nodes replaced by this node in a specialization of the
-- activity.
overriding function Get_Is_Leaf
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return Boolean;
-- Getter of RedefinableElement::isLeaf.
--
-- Indicates whether it is possible to further redefine a
-- RedefinableElement. If the value is true, then it is not possible to
-- further redefine the RedefinableElement. Note that this property is
-- preserved through package merge operations; that is, the capability to
-- redefine a RedefinableElement (i.e., isLeaf=false) must be preserved in
-- the resulting RedefinableElement of a package merge operation where a
-- RedefinableElement with isLeaf=false is merged with a matching
-- RedefinableElement with isLeaf=true: the resulting RedefinableElement
-- will have isLeaf=false. Default value is false.
overriding procedure Set_Is_Leaf
(Self : not null access UML_Unmarshall_Action_Proxy;
To : Boolean);
-- Setter of RedefinableElement::isLeaf.
--
-- Indicates whether it is possible to further redefine a
-- RedefinableElement. If the value is true, then it is not possible to
-- further redefine the RedefinableElement. Note that this property is
-- preserved through package merge operations; that is, the capability to
-- redefine a RedefinableElement (i.e., isLeaf=false) must be preserved in
-- the resulting RedefinableElement of a package merge operation where a
-- RedefinableElement with isLeaf=false is merged with a matching
-- RedefinableElement with isLeaf=true: the resulting RedefinableElement
-- will have isLeaf=false. Default value is false.
overriding function Get_Redefined_Element
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element;
-- Getter of RedefinableElement::redefinedElement.
--
-- The redefinable element that is being redefined by this element.
overriding function Get_Redefinition_Context
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier;
-- Getter of RedefinableElement::redefinitionContext.
--
-- References the contexts that this element may be redefined from.
overriding function Get_Client_Dependency
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency;
-- Getter of NamedElement::clientDependency.
--
-- Indicates the dependencies that reference the client.
overriding function Get_Name_Expression
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access;
-- Getter of NamedElement::nameExpression.
--
-- The string expression used to define the name of this named element.
overriding procedure Set_Name_Expression
(Self : not null access UML_Unmarshall_Action_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access);
-- Setter of NamedElement::nameExpression.
--
-- The string expression used to define the name of this named element.
overriding function Get_Namespace
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access;
-- Getter of NamedElement::namespace.
--
-- Specifies the namespace that owns the NamedElement.
overriding function Get_Qualified_Name
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.Optional_String;
-- Getter of NamedElement::qualifiedName.
--
-- A name which allows the NamedElement to be identified within a
-- hierarchy of nested Namespaces. It is constructed from the names of the
-- containing namespaces starting at the root of the hierarchy and ending
-- with the name of the NamedElement itself.
overriding function Context
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Classifiers.UML_Classifier_Access;
-- Operation Action::context.
--
-- Missing derivation for Action::/context : Classifier
overriding function Is_Consistent_With
(Self : not null access constant UML_Unmarshall_Action_Proxy;
Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean;
-- Operation RedefinableElement::isConsistentWith.
--
-- The query isConsistentWith() specifies, for any two RedefinableElements
-- in a context in which redefinition is possible, whether redefinition
-- would be logically consistent. By default, this is false; this
-- operation must be overridden for subclasses of RedefinableElement to
-- define the consistency conditions.
overriding function Is_Redefinition_Context_Valid
(Self : not null access constant UML_Unmarshall_Action_Proxy;
Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean;
-- Operation RedefinableElement::isRedefinitionContextValid.
--
-- The query isRedefinitionContextValid() specifies whether the
-- redefinition contexts of this RedefinableElement are properly related
-- to the redefinition contexts of the specified RedefinableElement to
-- allow this element to redefine the other. By default at least one of
-- the redefinition contexts of this element must be a specialization of
-- at least one of the redefinition contexts of the specified element.
overriding function All_Owning_Packages
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package;
-- Operation NamedElement::allOwningPackages.
--
-- The query allOwningPackages() returns all the directly or indirectly
-- owning packages.
overriding function Is_Distinguishable_From
(Self : not null access constant UML_Unmarshall_Action_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean;
-- Operation NamedElement::isDistinguishableFrom.
--
-- The query isDistinguishableFrom() determines whether two NamedElements
-- may logically co-exist within a Namespace. By default, two named
-- elements are distinguishable if (a) they have unrelated types or (b)
-- they have related types but different names.
overriding function Namespace
(Self : not null access constant UML_Unmarshall_Action_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access;
-- Operation NamedElement::namespace.
--
-- Missing derivation for NamedElement::/namespace : Namespace
overriding procedure Enter_Element
(Self : not null access constant UML_Unmarshall_Action_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Leave_Element
(Self : not null access constant UML_Unmarshall_Action_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Visit_Element
(Self : not null access constant UML_Unmarshall_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);
-- Dispatch call to corresponding subprogram of iterator interface.
end AMF.Internals.UML_Unmarshall_Actions;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
-- A fork node is a control node that splits a flow into multiple concurrent
-- flows.
------------------------------------------------------------------------------
with AMF.UML.Control_Nodes;
package AMF.UML.Fork_Nodes is
pragma Preelaborate;
type UML_Fork_Node is limited interface
and AMF.UML.Control_Nodes.UML_Control_Node;
type UML_Fork_Node_Access is
access all UML_Fork_Node'Class;
for UML_Fork_Node_Access'Storage_Size use 0;
end AMF.UML.Fork_Nodes;
|
pragma License (Unrestricted);
-- implementation unit required by compiler
with System.Packed_Arrays;
package System.Pack_48 is
pragma Preelaborate;
-- It can not be Pure, subprograms would become __attribute__((const)).
type Bits_48 is mod 2 ** 48;
for Bits_48'Size use 48;
package Indexing is new Packed_Arrays.Indexing (Bits_48);
-- required for accessing arrays by compiler
function Get_48 (
Arr : Address;
N : Natural;
Rev_SSO : Boolean)
return Bits_48
renames Indexing.Get;
procedure Set_48 (
Arr : Address;
N : Natural;
E : Bits_48;
Rev_SSO : Boolean)
renames Indexing.Set;
-- required for accessing unaligned arrays by compiler
function GetU_48 (
Arr : Address;
N : Natural;
Rev_SSO : Boolean)
return Bits_48
renames Indexing.Get;
procedure SetU_48 (
Arr : Address;
N : Natural;
E : Bits_48;
Rev_SSO : Boolean)
renames Indexing.Set;
end System.Pack_48;
|
------------------------------------------------------------------------------
-- G E L A A S I S --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of this file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $:
with Ada.Wide_Text_IO;
with Asis.Elements;
with Asis.Expressions;
with Asis.Statements;
with Asis.Declarations;
with Asis.Gela.Debug;
with Asis.Gela.Element_Utils;
with Asis.Gela.Overloads.Walk.Up;
with Asis.Gela.Overloads.Walk.Down;
with Asis.Gela.Replace;
with XASIS.Types;
with XASIS.Utils;
with Asis.Gela.Classes;
package body Asis.Gela.Overloads.Walk is
use Asis.Elements;
use Asis.Gela.Classes;
package R renames Asis.Gela.Replace;
function Universal_Integer return Asis.Declaration
renames XASIS.Types.Universal_Integer;
function Universal_Real return Asis.Declaration
renames XASIS.Types.Universal_Real;
function Universal_Access return Asis.Declaration
renames XASIS.Types.Universal_Access;
procedure Set_Identifier
(Element : in out Asis.Expression;
Tipe : in Type_Info);
procedure Set_Defining_Name
(Element : in out Asis.Identifier;
Name : in Asis.Defining_Name);
-----------
-- After --
-----------
procedure After
(Element : in out Asis.Element;
Control : in out Traverse_Control;
Resolver : in out Up_Resolver)
is
begin
case Element_Kind (Element) is
when An_Expression =>
case Expression_Kind (Element) is
when A_Box_Expression =>
Up.Push_Single (Resolver, (Kind => A_Box));
when An_Integer_Literal =>
Up.Push_Single (Resolver,
Up_Expression (Universal_Integer, Element));
when A_Real_Literal =>
Up.Push_Single (Resolver,
Up_Expression (Universal_Real, Element));
when A_String_Literal =>
raise Internal_Error; -- go to An_Operator_Symbol
when An_Identifier =>
Up.Push_Single (Resolver, (An_Identifier, Element));
when An_Operator_Symbol =>
Up.Operator_Symbol_Or_String (Resolver, Element);
when A_Character_Literal =>
Up.Push_Single (Resolver, (An_Identifier, Element),
Resolve => True);
when An_Enumeration_Literal =>
raise Internal_Error; -- go to An_Identifier
when An_Explicit_Dereference =>
Up.Explicit_Dereference (Resolver, Element);
when A_Function_Call =>
Up.Function_Call (Resolver, Element);
when An_Indexed_Component =>
raise Internal_Error; -- go to A_Function_Call
when A_Slice =>
raise Internal_Error; -- go to A_Function_Call
when A_Selected_Component =>
Up.Selected_Component (Resolver, Element);
when An_Attribute_Reference =>
Up.Attribute_Reference (Resolver, Element);
when A_Record_Aggregate =>
Up.Aggregate (Resolver, Element);
when An_Extension_Aggregate =>
Up.Aggregate (Resolver, Element, True);
when A_Positional_Array_Aggregate |
A_Named_Array_Aggregate =>
raise Internal_Error; -- go to A_Record_Aggregate
when An_In_Range_Membership_Test |
A_Not_In_Range_Membership_Test |
An_In_Type_Membership_Test |
A_Not_In_Type_Membership_Test =>
Up.Membership (Resolver, Element);
when An_And_Then_Short_Circuit |
An_Or_Else_Short_Circuit =>
Up.Short_Circuit (Resolver, Element);
when A_Null_Literal =>
Up.Push_Single (Resolver,
Up_Expression (Universal_Access, Element));
when A_Parenthesized_Expression =>
null;
when A_Type_Conversion =>
raise Internal_Error; -- go to function call
when A_Qualified_Expression =>
Up.Qualified_Expression (Resolver, Element);
when An_Allocation_From_Subtype =>
Up.Allocation (Resolver, Element);
when An_Allocation_From_Qualified_Expression =>
Up.Allocation (Resolver, Element, True);
when Not_An_Expression =>
raise Internal_Error;
end case;
when An_Association =>
case Association_Kind (Element) is
when A_Record_Component_Association =>
declare
Choises : Asis.Element_List :=
Asis.Expressions.Record_Component_Choices (Element);
begin
for I in reverse Choises'Range loop
case Definition_Kind (Choises (I)) is
when An_Others_Choice =>
null;
when A_Discrete_Range =>
Drop_One (Resolver);
when others =>
Drop_One (Resolver);
end case;
end loop;
end;
when A_Parameter_Association =>
if not Is_Nil (Asis.Expressions.Formal_Parameter (Element))
then
Drop_One (Resolver);
end if;
when others =>
Ada.Wide_Text_IO.Put_Line ("After An_Association : " &
Asis.Elements.Debug_Image (Element));
raise Internal_Error;
end case;
when A_Definition =>
case Definition_Kind (Element) is
when A_Constraint =>
case Constraint_Kind (Element) is
when A_Simple_Expression_Range =>
Up.Simple_Range (Resolver, Element);
when A_Range_Attribute_Reference =>
null;
when others =>
Ada.Wide_Text_IO.Put_Line
("After A_Constraint : " &
Asis.Elements.Debug_Image (Element));
raise Unimplemented;
end case;
-- FIXME: Delete this case (A_Constraint instead)
when A_Discrete_Range | A_Discrete_Subtype_Definition =>
case Discrete_Range_Kind (Element) is
when A_Discrete_Simple_Expression_Range =>
Up.Simple_Range (Resolver, Element);
when A_Discrete_Range_Attribute_Reference =>
null;
when others =>
Ada.Wide_Text_IO.Put_Line
("After A_Discrete_Range : " &
Asis.Elements.Debug_Image (Element));
raise Unimplemented;
end case;
when An_Others_Choice =>
null;
when others =>
Ada.Wide_Text_IO.Put_Line ("After A_Definition : " &
Asis.Elements.Debug_Image (Element) &
Definition_Kinds'Wide_Image
(Definition_Kind (Element)));
raise Unimplemented;
end case;
when A_Statement =>
case Statement_Kind (Element) is
when An_Assignment_Statement =>
Up.Assignment (Resolver, Element);
when A_Procedure_Call_Statement =>
Up.Function_Call (Resolver, Element);
when others =>
raise Unimplemented;
end case;
when A_Defining_Name =>
-- Labels as child of statements
null;
when others =>
Ada.Wide_Text_IO.Put_Line ("After : " &
Asis.Elements.Debug_Image (Element));
raise Unimplemented;
end case;
pragma Assert (Debug.Run (Element, Debug.Overload_Up) or else
Debug.Dump (Types.Image (U.Top (Resolver.Stack))));
end After;
-----------
-- After --
-----------
procedure After
(Element : in out Asis.Element;
Control : in out Traverse_Control;
Resolver : in out Down_Resolver)
is
begin
null;
end After;
------------
-- Before --
------------
procedure Before
(Element : in out Asis.Element;
Control : in out Traverse_Control;
Resolver : in out Up_Resolver)
is
begin
case Element_Kind (Element) is
when An_Expression =>
case Expression_Kind (Element) is
when An_Allocation_From_Subtype =>
Up.Allocation (Resolver, Element);
Control := Abandon_Children;
when others =>
null;
end case;
when others =>
null;
end case;
end Before;
------------
-- Before --
------------
procedure Before
(Element : in out Asis.Element;
Control : in out Traverse_Control;
Resolver : in out Down_Resolver)
is
use Asis.Expressions;
Got : Down_Interpretation;
Next : Down_Interpretation;
begin
Down.Check_Implicit (Resolver, Element, Control);
pragma Assert (Debug.Run (Element, Debug.Overload_Down) or else
Debug.Dump (Types.Image (D.Top (Resolver.Stack))));
if Control = Abandon_Children then
return;
end if;
case Element_Kind (Element) is
when An_Expression =>
case Expression_Kind (Element) is
when A_Box_Expression =>
D.Pop (Resolver.Stack, Next);
if Next.Kind = An_Expression then
Down.Set_Expression_Type (Element, Next.Expression_Type);
end if;
when An_Integer_Literal =>
D.Pop (Resolver.Stack, Next);
if Next.Kind /= An_Expression then
raise Internal_Error;
end if;
Down.Set_Expression_Type (Element, Universal_Integer);
when A_Real_Literal =>
D.Pop (Resolver.Stack, Next);
if Next.Kind /= An_Expression then
raise Internal_Error;
end if;
Down.Set_Expression_Type (Element, Universal_Real);
when A_String_Literal =>
raise Internal_Error; -- go to An_Operator_Symbol
when An_Identifier =>
D.Pop (Resolver.Stack, Next);
-- FIXME function without parameters
case Next.Kind is
when An_Expression =>
Set_Identifier (Element, Next.Expression_Type);
Down.Set_Expression_Type (Element, Next.Expression_Type);
when A_Declaration =>
Set_Declaration (Element, Next.Declaration);
when A_Procedure_Call |
A_Prefixed_View |
A_Family_Member |
A_Subprogram_Reference |
A_Range |
A_Subaggregate |
A_Skip |
An_Attribute_Function |
Up_Only_Kinds =>
raise Internal_Error;
end case;
when An_Operator_Symbol =>
D.Pop (Resolver.Stack, Next);
case Next.Kind is
when An_Expression =>
if Is_String (Next.Expression_Type) then
R.Operator_Symbol_To_String_Literal (Element);
Down.Set_Expression_Type
(Element, Next.Expression_Type);
else
raise Internal_Error;
end if;
when A_Declaration =>
Set_Declaration (Element, Next.Declaration);
when A_Procedure_Call |
A_Prefixed_View |
A_Family_Member |
A_Range |
A_Subprogram_Reference |
Up_Only_Kinds |
A_Subaggregate |
An_Attribute_Function |
A_Skip =>
raise Internal_Error;
end case;
when A_Character_Literal =>
D.Pop (Resolver.Stack, Next);
case Next.Kind is
when An_Expression =>
Set_Identifier (Element, Next.Expression_Type);
Down.Set_Expression_Type
(Element, Next.Expression_Type);
when A_Declaration =>
Set_Declaration (Element, Next.Declaration);
-- Set_Identifier (Element, Next.Declaration);
when A_Procedure_Call |
A_Prefixed_View |
A_Family_Member |
A_Range |
A_Subprogram_Reference |
Up_Only_Kinds |
A_Subaggregate |
An_Attribute_Function |
A_Skip =>
raise Internal_Error;
end case;
when An_Enumeration_Literal =>
raise Internal_Error; -- go to An_Identifier
when An_Explicit_Dereference =>
Down.Explicit_Dereference (Resolver, Element);
when A_Function_Call =>
Down.Function_Call (Resolver, Element);
when An_Indexed_Component =>
null;
-- this is new Element introduced
-- by R.Procedure_To_Indexed_Entry_Call
-- we skip it.
-- actual Indexed_Component goes into A_Function_Call
when A_Slice =>
raise Internal_Error; -- go to A_Function_Call
when A_Selected_Component =>
Down.Selected_Component (Resolver, Element);
when An_Attribute_Reference =>
Down.Attribute_Reference (Resolver, Element);
when A_Record_Aggregate =>
Down.Aggregate (Resolver, Element);
when An_Extension_Aggregate =>
Down.Aggregate (Resolver, Element, True);
when A_Positional_Array_Aggregate | A_Named_Array_Aggregate =>
raise Internal_Error; -- go to A_Record_Aggregate
when An_In_Range_Membership_Test |
A_Not_In_Range_Membership_Test |
An_In_Type_Membership_Test |
A_Not_In_Type_Membership_Test =>
Down.Membership (Resolver, Element);
when An_And_Then_Short_Circuit |
An_Or_Else_Short_Circuit =>
D.Pop (Resolver.Stack, Next);
if Next.Kind /= An_Expression then
raise Internal_Error;
end if;
Down.Set_Expression_Type (Element, Next.Expression_Type);
D.Push (Resolver.Stack, Next);
D.Push (Resolver.Stack, Next);
when A_Null_Literal =>
D.Pop (Resolver.Stack, Next);
if Next.Kind /= An_Expression then
raise Internal_Error;
end if;
Down.Set_Expression_Type (Element, Universal_Access);
when A_Parenthesized_Expression =>
D.Pop (Resolver.Stack, Next);
if Next.Kind = An_Expression then
Down.Set_Expression_Type (Element, Next.Expression_Type);
end if;
D.Push (Resolver.Stack, Next);
when A_Type_Conversion =>
raise Internal_Error; -- go to function call
when A_Qualified_Expression =>
Down.Qualified_Expression (Resolver, Element);
when An_Allocation_From_Subtype =>
D.Pop (Resolver.Stack, Next);
if Next.Kind /= An_Expression then
raise Internal_Error;
end if;
Down.Set_Expression_Type (Element, Next.Expression_Type);
Control := Abandon_Children;
when An_Allocation_From_Qualified_Expression =>
D.Pop (Resolver.Stack, Got);
if Got.Kind /= An_Expression then
raise Internal_Error;
end if;
Down.Set_Expression_Type (Element, Got.Expression_Type);
Next := To_Down_Interpretation
(Dereference (Got.Expression_Type));
D.Push (Resolver.Stack, Next);
when Not_An_Expression =>
raise Internal_Error;
end case; -- End of Expressions
when An_Association =>
case Association_Kind (Element) is
when A_Record_Component_Association =>
Check_Association (Element);
when A_Parameter_Association =>
null; -- FIXME
when others =>
Ada.Wide_Text_IO.Put_Line ("Before2 : " &
Asis.Elements.Debug_Image (Element));
raise Unimplemented;
end case;
when A_Definition =>
case Definition_Kind (Element) is
when A_Constraint =>
case Constraint_Kind (Element) is
when A_Simple_Expression_Range =>
D.Pop (Resolver.Stack, Got);
if Got.Kind = A_Range then
Next := (An_Expression, Got.Range_Type);
elsif Got.Kind /= An_Expression then
Ada.Wide_Text_IO.Put_Line ("Before7");
raise Internal_Error;
else
Next := Got;
end if;
D.Push (Resolver.Stack, Next);
D.Push(Resolver.Stack, Next);
when A_Range_Attribute_Reference =>
null;
when others =>
Ada.Wide_Text_IO.Put_Line ("Before4 : " &
Asis.Elements.Debug_Image (Element));
raise Unimplemented;
end case;
-- FIXME: Delete this case (A_Constraint instead)
when A_Discrete_Range | A_Discrete_Subtype_Definition =>
case Discrete_Range_Kind (Element) is
when A_Discrete_Simple_Expression_Range =>
D.Pop (Resolver.Stack, Got);
if Got.Kind = A_Range then
Next := (An_Expression, Got.Range_Type);
elsif Got.Kind /= An_Expression then
Ada.Wide_Text_IO.Put_Line ("Before6");
raise Internal_Error;
else
Next := Got;
end if;
D.Push (Resolver.Stack, Next);
D.Push(Resolver.Stack, Next);
when A_Discrete_Range_Attribute_Reference =>
null;
when others =>
Ada.Wide_Text_IO.Put_Line ("Before4 : " &
Asis.Elements.Debug_Image (Element));
raise Unimplemented;
end case;
when An_Others_Choice =>
null;
when others =>
Ada.Wide_Text_IO.Put_Line ("Before3 : " &
Asis.Elements.Debug_Image (Element));
raise Unimplemented;
end case;
when A_Statement =>
case Statement_Kind (Element) is
when An_Assignment_Statement =>
Down.Assignment (Resolver, Element);
when A_Procedure_Call_Statement =>
Down.Function_Call (Resolver, Element);
when others =>
raise Unimplemented;
end case;
when A_Defining_Name =>
-- Labels as child of statements
null;
when others =>
Ada.Wide_Text_IO.Put_Line ("Before : " &
Asis.Elements.Debug_Image (Element));
raise Unimplemented;
end case;
end Before;
-----------------------
-- Check_Association --
-----------------------
procedure Check_Association (Element : in out Asis.Element) is
Parent : Asis.Element := Enclosing_Element (Element);
begin
case Expression_Kind (Parent) is
when A_Function_Call =>
R.Record_To_Parameter_Association (Element);
when A_Positional_Array_Aggregate | A_Named_Array_Aggregate =>
R.Record_To_Array_Association (Element);
when A_Record_Aggregate | An_Extension_Aggregate =>
null;
when Not_An_Expression =>
case Statement_Kind (Parent) is
when A_Procedure_Call_Statement
| An_Entry_Call_Statement
=>
R.Record_To_Parameter_Association (Element);
when others =>
Ada.Wide_Text_IO.Put_Line ("Check_Association2");
end case;
when others =>
Ada.Wide_Text_IO.Put_Line ("Check_Association : " &
Asis.Elements.Debug_Image (Parent) & ' ' &
Expression_Kinds'Wide_Image (Expression_Kind (Parent)));
raise Internal_Error;
end case;
end Check_Association;
--------------------
-- Copy_Store_Set --
--------------------
procedure Copy_Store_Set
(Source : in Up_Resolver;
Target : in out Down_Resolver) is
begin
Target.Store := Source.Store;
Target.Implicit := Source.Implicit;
end Copy_Store_Set;
------------------------------------
-- Could_Be_Named_Array_Aggregate --
------------------------------------
function Could_Be_Named_Array_Aggregate
(Item : Asis.Element) return Boolean
is
use Asis.Expressions;
List : Asis.Association_List := Record_Component_Associations (Item);
begin
if List'Length = 0 then -- null record
return False;
end if;
for I in List'Range loop
declare
Choises : Asis.Expression_List :=
Record_Component_Choices (List (I));
begin
if List'Length = 1 and then Choises'Length = 0 then
return False;
end if;
if Element_Kind (Component_Expression (List(I))) /= An_Expression
then
return False;
end if;
end;
end loop;
return True;
end Could_Be_Named_Array_Aggregate;
-----------------------------------------
-- Could_Be_Positional_Array_Aggregate --
-----------------------------------------
function Could_Be_Positional_Array_Aggregate
(Item : Asis.Element) return Boolean
renames R.Could_Be_Positional_Array_Aggregate;
-------------------------------
-- Could_Be_Record_Aggregate --
-------------------------------
function Could_Be_Record_Aggregate
(Item : Asis.Element;
Extension : Boolean) return Boolean
is
use Asis.Expressions;
List : Asis.Association_List := Record_Component_Associations (Item);
begin
for I in List'Range loop
if Element_Kind (Component_Expression (List(I))) /= An_Expression then
return False;
end if;
declare
Choises : Asis.Expression_List :=
Record_Component_Choices (List (I));
begin
if not Extension
and then List'Length = 1
and then Choises'Length = 0
then
return False;
end if;
for J in Choises'Range loop
if Expression_Kind (Choises (J)) /= An_Identifier and then
Definition_Kind (Choises (J)) /= An_Others_Choice
then
return False;
end if;
end loop;
end;
end loop;
return True;
end Could_Be_Record_Aggregate;
-----------------------
-- Destroy_Store_Set --
-----------------------
procedure Destroy_Store_Set (Source : in out Up_Resolver) is
begin
Destroy (Source.Store);
end Destroy_Store_Set;
--------------
-- Drop_One --
--------------
procedure Drop_One (Resolver : in out Up_Resolver) is
Top : Up_Interpretation_Set;
Drop : Up_Interpretation_Set;
begin
U.Pop (Resolver.Stack, Top);
U.Pop (Resolver.Stack, Drop);
U.Push (Resolver.Stack, Top);
Destroy (Drop);
end Drop_One;
-----------------------
-- Find_Formal_Index --
-----------------------
procedure Find_Formal_Index
(Params : in Asis.Association_List;
Actual_Index : in List_Index;
Profile : in Asis.Parameter_Specification_List;
Formal_Index : out List_Index;
Found : out Boolean)
is
Formal : Asis.Identifier := Get_Formal_Parameter (Params, Actual_Index);
Index : List_Index := Actual_Index;
Fake : Boolean :=
Profile'Length = 0 or else
not XASIS.Utils.Is_Parameter_Specification (Profile (1));
begin
if Fake then
Formal_Index := Actual_Index;
Found := Formal_Index <= Profile'Last;
elsif not Is_Nil (Formal) then
Found := False;
Find_Formal :
for I in Profile'Range loop
declare
List : constant Asis.Defining_Name_List :=
Asis.Declarations.Names (Profile (I));
Img : constant Wide_String :=
Asis.Expressions.Name_Image (Formal);
begin
for J in List'Range loop
if XASIS.Utils.Has_Name (List (J), Img) then
Found := True;
Formal_Index := I;
exit Find_Formal;
end if;
end loop;
end;
end loop Find_Formal;
else
Found := False;
Find_Position :
for I in Profile'Range loop
declare
List : constant Asis.Defining_Name_List :=
Asis.Declarations.Names (Profile (I));
begin
for J in List'Range loop
if Index = 1 then
Found := True;
Formal_Index := I;
exit Find_Position;
end if;
Index := Index - 1;
end loop;
end;
end loop Find_Position;
end if;
end Find_Formal_Index;
--------------------------
-- Get_Actual_Parameter --
--------------------------
function Get_Actual_Parameter
(Params : Asis.Association_List;
Index : List_Index) return Asis.Expression
is
use Asis.Expressions;
Result : Asis.Expression;
begin
case Association_Kind (Params (Index)) is
when A_Parameter_Association =>
Result := Actual_Parameter (Params (Index));
when A_Record_Component_Association =>
Result := Component_Expression (Params (Index));
when others =>
raise Internal_Error;
end case;
return Result;
end Get_Actual_Parameter;
-------------------------
-- Get_Call_Parameters --
-------------------------
function Get_Call_Parameters (Element : Asis.Element )
return Asis.Association_List
is
begin
if Expression_Kind (Element) = A_Function_Call then
return Asis.Expressions.Function_Call_Parameters (Element);
elsif Statement_Kind (Element) = A_Procedure_Call_Statement then
return Asis.Statements.Call_Statement_Parameters (Element);
else
raise Internal_Error;
end if;
end Get_Call_Parameters;
--------------------------
-- Get_Formal_Parameter --
--------------------------
function Get_Formal_Parameter
(Params : Asis.Association_List;
Index : List_Index) return Asis.Identifier
is
use Asis.Expressions;
Result : Asis.Identifier;
begin
case Association_Kind (Params (Index)) is
when A_Parameter_Association =>
Result := Formal_Parameter (Params (Index));
when A_Record_Component_Association =>
declare
List : Asis.Expression_List :=
Record_Component_Choices (Params (Index));
begin
if List'Length /= 1 or else
Element_Kind (List (1)) /= An_Expression then
Result := Nil_Element;
else
Result := List (1);
end if;
end;
when others =>
raise Internal_Error;
end case;
return Result;
end Get_Formal_Parameter;
-------------------
-- Get_Implicits --
-------------------
function Get_Implicits
(Resolver : in Up_Resolver) return Implicit_Set
is
begin
return Resolver.Implicit;
end Get_Implicits;
-------------------------
-- Get_Interpretations --
-------------------------
function Get_Interpretations
(Resolver : in Up_Resolver)
return Up_Interpretation_Set
is
begin
return U.Top (Resolver.Stack);
end Get_Interpretations;
----------------------
-- Is_Expanded_Name --
----------------------
function Is_Expanded_Name (Item : Asis.Element) return Boolean is
use Asis.Expressions;
Name : Asis.Expression := Selector (Item);
Def : Asis.Defining_Name := Corresponding_Name_Definition (Name);
begin
return not Is_Nil (Def);
end Is_Expanded_Name;
-------------------
-- Is_Subprogram --
-------------------
function Is_Subprogram (Decl : Asis.Declaration) return Boolean is
Kind : Asis.Declaration_Kinds := Declaration_Kind (Decl);
begin
case Kind is
when A_Procedure_Declaration |
A_Function_Declaration |
A_Procedure_Body_Declaration |
A_Function_Body_Declaration |
A_Procedure_Renaming_Declaration |
A_Function_Renaming_Declaration |
A_Procedure_Instantiation |
A_Function_Instantiation =>
return True;
when others =>
return False;
end case;
end Is_Subprogram;
------------------------
-- Set_Interpretation --
------------------------
procedure Set_Interpretation
(Resolver : in out Down_Resolver;
Item : in Down_Interpretation)
is
begin
D.Push (Resolver.Stack, Item);
end Set_Interpretation;
--------------------
-- Set_Identifier --
--------------------
procedure Set_Identifier
(Element : in out Asis.Expression;
Tipe : in Type_Info)
is
use Asis.Expressions;
List : Asis.Defining_Name_List :=
Corresponding_Name_Definition_List (Element);
Parent : Asis.Declaration;
Found : Asis.Defining_Name;
E_Type : Type_Info;
Count : Natural := 0;
begin
for I in List'Range loop
Parent := Enclosing_Element (List (I));
E_Type := Type_Of_Declaration (Parent, Element);
if not Is_Not_Type (E_Type) and then Is_Expected_Type (E_Type, Tipe)
then
Count := Count + 1;
Found := List (I);
end if;
end loop;
if Count /= 1 then
Ada.Wide_Text_IO.Put_Line ("Set_Identifier: " & Debug_Image (Element)
& " " & Natural'Wide_Image (Count));
Ada.Wide_Text_IO.Put_Line ("Tipe: " & Debug_Image (Tipe));
Ada.Wide_Text_IO.Put_Line ("Found: " & Debug_Image (Found));
else
Set_Defining_Name (Element, Found);
end if;
end Set_Identifier;
---------------------
-- Set_Declaration --
---------------------
procedure Set_Declaration
(Element : in out Asis.Identifier;
Decl : in Asis.Declaration)
is
Img : constant Wide_String :=
Asis.Expressions.Name_Image (Element);
Name : Asis.Defining_Name :=
XASIS.Utils.Get_Defining_Name (Decl, Img);
begin
Set_Defining_Name (Element, Name);
end Set_Declaration;
-----------------------
-- Set_Defining_Name --
-----------------------
procedure Set_Defining_Name
(Element : in out Asis.Identifier;
Name : in Asis.Defining_Name)
is
begin
if Expression_Kind (Element) = An_Identifier and then
Defining_Name_Kind (Name) = A_Defining_Enumeration_Literal
then
R.Identifier_To_Enumeration_Literal (Element);
end if;
Element_Utils.Set_Resolved (Element, (1 => Name));
end Set_Defining_Name;
end Asis.Gela.Overloads.Walk;
------------------------------------------------------------------------------
-- Copyright (c) 2006-2013, Maxim Reznik
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * Neither the name of the Maxim Reznik, 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 OWNER OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
|
-- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_free_colors_request_t is
-- Item
--
type Item is record
major_opcode : aliased Interfaces.Unsigned_8;
pad0 : aliased Interfaces.Unsigned_8;
length : aliased Interfaces.Unsigned_16;
cmap : aliased xcb.xcb_colormap_t;
plane_mask : aliased Interfaces.Unsigned_32;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C.size_t range <>) of aliased xcb.xcb_free_colors_request_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_free_colors_request_t.Item,
Element_Array => xcb.xcb_free_colors_request_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C.size_t range <>) of aliased xcb.xcb_free_colors_request_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_free_colors_request_t.Pointer,
Element_Array => xcb.xcb_free_colors_request_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_free_colors_request_t;
|
-- C64103F.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT, FOR OUT PARAMETERS OF AN ACCESS TYPE,
-- CONSTRAINT_ERROR IS RAISED:
-- AFTER A SUBPROGRAM CALL WHEN THE BOUNDS OR DISCRIMINANTS
-- OF THE FORMAL DESIGNATED PARAMETER ARE DIFFERENT FROM
-- THOSE OF THE ACTUAL DESIGNATED PARAMETER.
-- HISTORY:
-- CPP 07/23/84 CREATED ORIGINAL TEST.
-- VCL 10/27/87 MODIFIED THIS HEADER; ADDED STATEMENTS WHICH
-- REFERENCE THE ACTUAL PARAMETERS.
WITH REPORT; USE REPORT;
PROCEDURE C64103F IS
BEGIN
TEST ("C64103F", "FOR OUT PARAMETERS OF AN ACCESS TYPE, " &
"CONSTRAINT_ERROR IS RAISED: AFTER A " &
"SUBPROGRAM CALL WHEN THE BOUNDS OR " &
"DISCRIMINANTS OF THE FORMAL DESIGNATED " &
"PARAMETER ARE DIFFERENT FROM THOSE OF THE " &
"ACTUAL DESIGNATED PARAMETER");
BEGIN
DECLARE
TYPE AST IS ACCESS STRING;
SUBTYPE AST_3 IS AST(IDENT_INT(1)..IDENT_INT(3));
SUBTYPE AST_5 IS AST(3..5);
X_3 : AST_3 := NEW STRING'(1..IDENT_INT(3) => 'A');
CALLED : BOOLEAN := FALSE;
PROCEDURE P1 (X : OUT AST_5) IS
BEGIN
CALLED := TRUE;
X := NEW STRING'(3..5 => 'C');
END P1;
BEGIN
P1 (AST_5 (X_3));
IF X_3.ALL = STRING'(1 .. 3 => 'A') THEN
FAILED ("EXCEPTION NOT RAISED AFTER CALL -P1 (A1)");
ELSE
FAILED ("EXCEPTION NOT RAISED AFTER CALL -P1 (A2)");
END IF;
EXCEPTION
WHEN CONSTRAINT_ERROR =>
IF NOT CALLED THEN
FAILED ("EXCEPTION RAISED BEFORE CALL " &
"-P1 (A)");
END IF;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED -P1 (A)");
END;
DECLARE
TYPE ARRAY_TYPE IS ARRAY (INTEGER RANGE <>) OF BOOLEAN;
TYPE A_ARRAY IS ACCESS ARRAY_TYPE;
SUBTYPE A1_ARRAY IS A_ARRAY (1..IDENT_INT(3));
TYPE A2_ARRAY IS NEW A_ARRAY (2..4);
A0 : A1_ARRAY := NEW ARRAY_TYPE'(1..3 => TRUE);
CALLED : BOOLEAN := FALSE;
PROCEDURE P2 (X : OUT A2_ARRAY) IS
BEGIN
CALLED := TRUE;
X := NEW ARRAY_TYPE'(2..4 => FALSE);
END P2;
BEGIN
P2 (A2_ARRAY (A0));
IF A0.ALL = ARRAY_TYPE'(1 .. 3 => TRUE) THEN
FAILED ("EXCEPTION NOT RAISED AFTER CALL -P2 (A1)");
ELSE
FAILED ("EXCEPTION NOT RAISED AFTER CALL -P2 (A2)");
END IF;
EXCEPTION
WHEN CONSTRAINT_ERROR =>
IF NOT CALLED THEN
FAILED ("EXCEPTION RAISED BEFORE CALL " &
"-P1 (A)");
END IF;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED -P2 (A)");
END;
DECLARE
TYPE SUBINT IS RANGE 0..8;
TYPE REC1 (DISC : SUBINT := 8) IS
RECORD
FIELD : SUBINT := DISC;
END RECORD;
TYPE A1_REC IS ACCESS REC1;
TYPE A2_REC IS NEW A1_REC (3);
A0 : A1_REC(4) := NEW REC1(4);
CALLED : BOOLEAN := FALSE;
PROCEDURE P3 (X : OUT A2_REC) IS
BEGIN
CALLED := TRUE;
X := NEW REC1(3);
END P3;
BEGIN
P3 (A2_REC (A0));
IF A0.ALL = REC1'(4,4) THEN
FAILED ("EXCEPTION NOT RAISED AFTER CALL -P3 (A1)");
ELSE
FAILED ("EXCEPTION NOT RAISED AFTER CALL -P3 (A2)");
END IF;
EXCEPTION
WHEN CONSTRAINT_ERROR =>
IF NOT CALLED THEN
FAILED ("EXCEPTION RAISED BEFORE CALL " &
"-P1 (A)");
END IF;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED -P3 (A)");
END;
END;
RESULT;
END C64103F;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2017-2020, Vadim Godunko <vgodunko@gmail.com> --
-- 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: 5726 $ $Date: 2017-01-26 00:26:30 +0300 (Thu, 26 Jan 2017) $
------------------------------------------------------------------------------
--with Core.Slots_0;
--private with Core.Slots_0.Emitters;
package Web.UI.Widgets.Buttons is
type Abstract_Button is
abstract new Web.UI.Widgets.Abstract_Widget with private;
-- not overriding function Clicked_Signal
-- (Self : in out Abstract_Button)
-- return not null access Core.Slots_0.Signal'Class;
package Constructors is
procedure Initialize
(Self : in out Abstract_Button'Class;
Element : Web.HTML.Elements.HTML_Element'Class);
end Constructors;
private
type Abstract_Button is
abstract new Web.UI.Widgets.Abstract_Widget with record
null;
-- Clicked : aliased Core.Slots_0.Emitters.Emitter
-- (Abstract_Button'Unchecked_Access);
end record;
-- overriding procedure Click_Event
-- (Self : in out Abstract_Button;
-- Event : in out WUI.Events.Mouse.Click.Click_Event'Class);
end Web.UI.Widgets.Buttons;
|
-- This sample program receives MIDI events from a keyboard and from
-- rotary encoders and outputs audio, like a synthesizer.
-- Call it like this from Linux:
--
-- amidi -p "hw:1,0,0" -r >(./obj/ada_synth | \
-- aplay -f S16_LE -c1 -r44100 --buffer-size=4096)
--
-- The BASH syntax ">(program)" creates a temporary FIFO file, because amidi
-- needs a file where it writes the received MIDI events. In case of problems,
-- you can also create a named FIFO with "mkfifo", then start amidi in the
-- background writing to this file, and then the ada_synth program like this:
--
-- cat midi | ./ada_synth | aplay -f S16_LE -c1 -r44100 --buffer-size=4096)
--
-- where "midi" is the named FIFO file. If it keeps playing a tone when you
-- stop the program with ctrl-c, try this command:
--
-- killall amidi aplay
--
-- You can see the list of available MIDI devices with "amidi -l".
-- For testing it is useful to use the AMIDI "--dump" option.
-- For lower latency, you might need to change the Linux pipe size:
--
-- sudo sysctl fs.pipe-max-size=4096
with GNAT.OS_Lib;
with Interfaces; use Interfaces;
with MIDI_Synthesizer; use MIDI_Synthesizer;
procedure Ada_Synth is
Data : Unsigned_8;
Ignore : Integer;
Main_Synthesizer : constant access Synthesizer'Class := Create_Synthesizer;
task Main_Task is
entry Data_Received (Data : Unsigned_8);
end Main_Task;
task body Main_Task is
Sample : Float;
Int_Smp : Short_Integer := 0;
Ignore : Integer;
begin
loop
select
accept Data_Received (Data : Unsigned_8) do
Main_Synthesizer.Parse_MIDI_Byte (Data);
end Data_Received;
else
Sample := Main_Synthesizer.Next_Sample;
Int_Smp := Short_Integer (Sample * 32767.0);
Ignore := GNAT.OS_Lib.Write
(GNAT.OS_Lib.Standout, Int_Smp'Address, Int_Smp'Size / 8);
end select;
end loop;
end Main_Task;
begin
loop
Ignore :=
GNAT.OS_Lib.Read (GNAT.OS_Lib.Standin, Data'Address, Data'Size / 8);
Main_Task.Data_Received (Data);
end loop;
end Ada_Synth;
|
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2019 onox <denkpadje@gmail.com>
--
-- 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.Types;
with Orka.Rendering.Drawing;
with Orka.Rendering.Programs.Modules;
package body Orka.Rendering.Debug.Coordinate_Axes is
function Create_Coordinate_Axes
(Location : Resources.Locations.Location_Ptr) return Coordinate_Axes
is
use Rendering.Programs;
begin
return Result : Coordinate_Axes :=
(Program => Create_Program (Modules.Create_Module
(Location, VS => "debug/axes.vert", FS => "debug/line.frag")),
others => <>)
do
Result.Uniform_Visible := Result.Program.Uniform ("visible");
Result.Uniform_View := Result.Program.Uniform ("view");
Result.Uniform_Proj := Result.Program.Uniform ("proj");
end return;
end Create_Coordinate_Axes;
procedure Render
(Object : in out Coordinate_Axes;
View, Proj : Transforms.Matrix4;
Transforms, Sizes : Rendering.Buffers.Bindable_Buffer'Class)
is
use all type GL.Types.Compare_Function;
use all type Rendering.Buffers.Indexed_Buffer_Target;
Reverse_Function : constant array (GL.Types.Compare_Function) of GL.Types.Compare_Function :=
(Never => Always,
Always => Never,
Less => GEqual,
Greater => LEqual,
LEqual => Greater,
GEqual => Less,
Equal => Not_Equal,
Not_Equal => Equal);
Original_Function : constant GL.Types.Compare_Function := GL.Buffers.Depth_Function;
Original_Mask : constant Boolean := GL.Buffers.Depth_Mask;
begin
Object.Uniform_View.Set_Matrix (View);
Object.Uniform_Proj.Set_Matrix (Proj);
Object.Program.Use_Program;
Transforms.Bind (Shader_Storage, 0);
Sizes.Bind (Shader_Storage, 1);
-- Visible part of axes
Object.Uniform_Visible.Set_Boolean (True);
Orka.Rendering.Drawing.Draw (GL.Types.Lines, 0, 6, Instances => Transforms.Length);
-- Hidden part of axes
GL.Buffers.Set_Depth_Function (Reverse_Function (Original_Function));
GL.Buffers.Set_Depth_Mask (Enabled => False);
Object.Uniform_Visible.Set_Boolean (False);
Orka.Rendering.Drawing.Draw (GL.Types.Lines, 0, 6, Instances => Transforms.Length);
GL.Buffers.Set_Depth_Function (Original_Function);
GL.Buffers.Set_Depth_Mask (Enabled => Original_Mask);
end Render;
end Orka.Rendering.Debug.Coordinate_Axes;
|
pragma License (Unrestricted);
-- Ada 2005
with Ada.Iterator_Interfaces;
private with Ada.Containers.Binary_Trees;
private with Ada.Containers.Binary_Trees.Arne_Andersson;
private with Ada.Containers.Copy_On_Write;
private with Ada.Finalization;
private with Ada.Streams;
generic
type Element_Type (<>) is private;
with function "<" (Left, Right : Element_Type) return Boolean is <>;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Indefinite_Ordered_Sets is
pragma Preelaborate;
pragma Remote_Types;
function Equivalent_Elements (Left, Right : Element_Type) return Boolean;
type Set is tagged private
with
Constant_Indexing => Constant_Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type;
pragma Preelaborable_Initialization (Set);
type Cursor is private;
pragma Preelaborable_Initialization (Cursor);
-- modified
-- Empty_Set : constant Set;
function Empty_Set return Set;
No_Element : constant Cursor;
function Has_Element (Position : Cursor) return Boolean;
package Set_Iterator_Interfaces is
new Iterator_Interfaces (Cursor, Has_Element);
overriding function "=" (Left, Right : Set) return Boolean;
function Equivalent_Sets (Left, Right : Set) return Boolean;
function To_Set (New_Item : Element_Type) return Set;
-- diff (Generic_Array_To_Set)
--
--
--
--
function Length (Container : Set) return Count_Type;
function Is_Empty (Container : Set) return Boolean;
procedure Clear (Container : in out Set);
function Element (Position : Cursor) return Element_Type;
procedure Replace_Element (
Container : in out Set;
Position : Cursor;
New_Item : Element_Type);
procedure Query_Element (
Position : Cursor;
Process : not null access procedure (Element : Element_Type));
type Constant_Reference_Type (
Element : not null access constant Element_Type) is private
with Implicit_Dereference => Element;
function Constant_Reference (Container : aliased Set; Position : Cursor)
return Constant_Reference_Type;
procedure Assign (Target : in out Set; Source : Set);
function Copy (Source : Set) return Set;
procedure Move (Target : in out Set; Source : in out Set);
procedure Insert (
Container : in out Set;
New_Item : Element_Type;
Position : out Cursor;
Inserted : out Boolean);
procedure Insert (
Container : in out Set;
New_Item : Element_Type);
procedure Include (Container : in out Set; New_Item : Element_Type);
procedure Replace (Container : in out Set; New_Item : Element_Type);
procedure Exclude (Container : in out Set; Item : Element_Type);
procedure Delete (Container : in out Set; Item : Element_Type);
procedure Delete (Container : in out Set; Position : in out Cursor);
-- modified
procedure Delete_First (Container : in out Set'Class); -- not primitive
-- modified
procedure Delete_Last (Container : in out Set'Class); -- not primitive
procedure Union (Target : in out Set; Source : Set);
function Union (Left, Right : Set) return Set;
function "or" (Left, Right : Set) return Set
renames Union;
procedure Intersection (Target : in out Set; Source : Set);
function Intersection (Left, Right : Set) return Set;
function "and" (Left, Right : Set) return Set
renames Intersection;
procedure Difference (Target : in out Set; Source : Set);
function Difference (Left, Right : Set) return Set;
function "-" (Left, Right : Set) return Set
renames Difference;
procedure Symmetric_Difference (Target : in out Set; Source : Set);
function Symmetric_Difference (Left, Right : Set) return Set;
function "xor" (Left, Right : Set) return Set
renames Symmetric_Difference;
function Overlap (Left, Right : Set) return Boolean;
function Is_Subset (Subset : Set; Of_Set : Set) return Boolean;
function First (Container : Set) return Cursor;
-- modified
function First_Element (Container : Set'Class) -- not primitive
return Element_Type;
function Last (Container : Set) return Cursor;
-- modified
function Last_Element (Container : Set'Class) -- not primitive
return Element_Type;
function Next (Position : Cursor) return Cursor;
procedure Next (Position : in out Cursor);
function Previous (Position : Cursor) return Cursor;
procedure Previous (Position : in out Cursor);
function Find (Container : Set; Item : Element_Type) return Cursor;
function Floor (Container : Set; Item : Element_Type) return Cursor;
function Ceiling (Container : Set; Item : Element_Type) return Cursor;
function Contains (Container : Set; Item : Element_Type) return Boolean;
function "<" (Left, Right : Cursor) return Boolean;
function ">" (Left, Right : Cursor) return Boolean;
function "<" (Left : Cursor; Right : Element_Type) return Boolean;
function ">" (Left : Cursor; Right : Element_Type) return Boolean;
function "<" (Left : Element_Type; Right : Cursor) return Boolean;
function ">" (Left : Element_Type; Right : Cursor) return Boolean;
-- modified
procedure Iterate (
Container : Set'Class; -- not primitive
Process : not null access procedure (Position : Cursor));
-- modified
procedure Reverse_Iterate (
Container : Set'Class; -- not primitive
Process : not null access procedure (Position : Cursor));
-- modified
function Iterate (Container : Set'Class) -- not primitive
return Set_Iterator_Interfaces.Reversible_Iterator'Class;
-- extended
function Iterate (Container : Set'Class; First, Last : Cursor)
return Set_Iterator_Interfaces.Reversible_Iterator'Class;
generic
type Key_Type (<>) is private;
with function Key (Element : Element_Type) return Key_Type;
with function "<" (Left, Right : Key_Type) return Boolean is <>;
package Generic_Keys is
function Equivalent_Keys (Left, Right : Key_Type) return Boolean;
function Key (Position : Cursor) return Key_Type;
function Element (Container : Set; Key : Key_Type) return Element_Type;
procedure Replace (
Container : in out Set;
Key : Key_Type;
New_Item : Element_Type);
procedure Exclude (Container : in out Set; Key : Key_Type);
procedure Delete (Container : in out Set; Key : Key_Type);
function Find (Container : Set; Key : Key_Type) return Cursor;
function Floor (Container : Set; Key : Key_Type) return Cursor;
function Ceiling (Container : Set; Key : Key_Type) return Cursor;
function Contains (Container : Set; Key : Key_Type) return Boolean;
procedure Update_Element_Preserving_Key (
Container : in out Set;
Position : Cursor;
Process : not null access procedure (
Element : in out Element_Type));
type Reference_Type (
Element : not null access Element_Type) is private
with Implicit_Dereference => Element;
function Reference_Preserving_Key (
Container : aliased in out Set;
Position : Cursor)
return Reference_Type;
function Constant_Reference (Container : aliased Set; Key : Key_Type)
return Constant_Reference_Type;
function Reference_Preserving_Key (
Container : aliased in out Set;
Key : Key_Type)
return Reference_Type;
private
type Reference_Type (
Element : not null access Element_Type) is null record;
-- dummy 'Read and 'Write
procedure Missing_Read (
Stream : access Streams.Root_Stream_Type'Class;
Item : out Reference_Type)
with Import,
Convention => Ada, External_Name => "__drake_program_error";
procedure Missing_Write (
Stream : access Streams.Root_Stream_Type'Class;
Item : Reference_Type)
with Import,
Convention => Ada, External_Name => "__drake_program_error";
for Reference_Type'Read use Missing_Read;
for Reference_Type'Write use Missing_Write;
end Generic_Keys;
-- diff (Equivalents)
--
--
--
--
--
private
package Base renames Binary_Trees.Arne_Andersson;
type Element_Access is access Element_Type;
type Node is limited record
Super : aliased Base.Node;
Element : Element_Access;
end record;
-- place Super at first whether Element_Type is controlled-type
for Node use record
Super at 0 range 0 .. Base.Node_Size - 1;
end record;
type Data is limited record
Super : aliased Copy_On_Write.Data;
Root : Binary_Trees.Node_Access := null;
Length : Count_Type := 0;
end record;
type Data_Access is access Data;
type Set is new Finalization.Controlled with record
Super : aliased Copy_On_Write.Container;
-- diff
end record;
overriding procedure Adjust (Object : in out Set);
overriding procedure Finalize (Object : in out Set)
renames Clear;
type Cursor is access Node;
type Constant_Reference_Type (
Element : not null access constant Element_Type) is null record;
type Set_Access is access constant Set;
for Set_Access'Storage_Size use 0;
type Set_Iterator is
new Set_Iterator_Interfaces.Reversible_Iterator with
record
First : Cursor;
Last : Cursor;
end record;
overriding function First (Object : Set_Iterator) return Cursor;
overriding function Next (Object : Set_Iterator; Position : Cursor)
return Cursor;
overriding function Last (Object : Set_Iterator) return Cursor;
overriding function Previous (Object : Set_Iterator; Position : Cursor)
return Cursor;
package Streaming is
procedure Read (
Stream : not null access Streams.Root_Stream_Type'Class;
Item : out Set);
procedure Write (
Stream : not null access Streams.Root_Stream_Type'Class;
Item : Set);
procedure Missing_Read (
Stream : access Streams.Root_Stream_Type'Class;
Item : out Cursor)
with Import,
Convention => Ada, External_Name => "__drake_program_error";
procedure Missing_Write (
Stream : access Streams.Root_Stream_Type'Class;
Item : Cursor)
with Import,
Convention => Ada, External_Name => "__drake_program_error";
procedure Missing_Read (
Stream : access Streams.Root_Stream_Type'Class;
Item : out Constant_Reference_Type)
with Import,
Convention => Ada, External_Name => "__drake_program_error";
procedure Missing_Write (
Stream : access Streams.Root_Stream_Type'Class;
Item : Constant_Reference_Type)
with Import,
Convention => Ada, External_Name => "__drake_program_error";
end Streaming;
for Set'Read use Streaming.Read;
for Set'Write use Streaming.Write;
for Cursor'Read use Streaming.Missing_Read;
for Cursor'Write use Streaming.Missing_Write;
for Constant_Reference_Type'Read use Streaming.Missing_Read;
for Constant_Reference_Type'Write use Streaming.Missing_Write;
No_Element : constant Cursor := null;
end Ada.Containers.Indefinite_Ordered_Sets;
|
-- Autogenerated by Generate, do not edit
with System;
with Ada.Unchecked_Conversion;
private with GL.API.Subprogram_Reference;
private with GL.API.Doubles;
private with GL.API.Ints;
private with GL.API.Shorts;
private with GL.API.Singles;
private with GL.API.UInts;
private with GL.API;
procedure GL.Load_Function_Pointers is
use GL.API;
generic
type Function_Reference is private;
function Load (Function_Name : String) return Function_Reference;
pragma Inline (Load);
function Load (Function_Name : String) return Function_Reference is
function As_Function_Reference is new Ada.Unchecked_Conversion (
Source => System.Address, Target => Function_Reference);
use type System.Address;
Raw : System.Address := Subprogram_Reference (Function_Name);
begin
if Raw = System.Null_Address then
Raw := Subprogram_Reference (Function_Name & "ARB");
if Raw = System.Null_Address then
Raw := Subprogram_Reference (Function_Name & "EXT");
end if;
end if;
return As_Function_Reference (Raw);
end Load;
function Load_T1 is new Load (T1);
function Load_T2 is new Load (T2);
function Load_T3 is new Load (T3);
function Load_T4 is new Load (T4);
function Load_T5 is new Load (T5);
function Load_T6 is new Load (T6);
function Load_T7 is new Load (T7);
function Load_T8 is new Load (T8);
function Load_T9 is new Load (T9);
function Load_T10 is new Load (T10);
function Load_T11 is new Load (T11);
function Load_T12 is new Load (T12);
function Load_T13 is new Load (T13);
function Load_T14 is new Load (T14);
function Load_T15 is new Load (T15);
function Load_T16 is new Load (T16);
function Load_T17 is new Load (T17);
function Load_T18 is new Load (T18);
function Load_T19 is new Load (T19);
function Load_T20 is new Load (T20);
function Load_T21 is new Load (T21);
function Load_T22 is new Load (T22);
function Load_T23 is new Load (T23);
function Load_T24 is new Load (T24);
function Load_T25 is new Load (T25);
function Load_T26 is new Load (T26);
function Load_T27 is new Load (T27);
function Load_T28 is new Load (T28);
function Load_T29 is new Load (T29);
function Load_T30 is new Load (T30);
function Load_T31 is new Load (T31);
function Load_T32 is new Load (T32);
function Load_T33 is new Load (T33);
function Load_T34 is new Load (T34);
function Load_T35 is new Load (T35);
function Load_T36 is new Load (T36);
function Load_T37 is new Load (T37);
function Load_T38 is new Load (T38);
function Load_T39 is new Load (T39);
function Load_T40 is new Load (T40);
function Load_T41 is new Load (T41);
function Load_T42 is new Load (T42);
function Load_T43 is new Load (T43);
function Load_T44 is new Load (T44);
function Load_T45 is new Load (T45);
function Load_T46 is new Load (T46);
function Load_T47 is new Load (T47);
function Load_T48 is new Load (T48);
function Load_T49 is new Load (T49);
function Load_T50 is new Load (T50);
function Load_T51 is new Load (T51);
function Load_T52 is new Load (T52);
function Load_T53 is new Load (T53);
function Load_T54 is new Load (T54);
function Load_T55 is new Load (T55);
function Load_T56 is new Load (T56);
function Load_T57 is new Load (T57);
function Load_T58 is new Load (T58);
function Load_T59 is new Load (T59);
function Load_T60 is new Load (T60);
function Load_T61 is new Load (T61);
function Load_T62 is new Load (T62);
function Load_T63 is new Load (T63);
function Load_T64 is new Load (T64);
function Load_T65 is new Load (T65);
function Load_T66 is new Load (T66);
function Load_T67 is new Load (T67);
function Load_T68 is new Load (T68);
function Load_T69 is new Load (T69);
function Load_T70 is new Load (T70);
function Load_T71 is new Load (T71);
function Load_T72 is new Load (T72);
function Load_T73 is new Load (T73);
function Load_T74 is new Load (T74);
function Load_T75 is new Load (T75);
function Load_T76 is new Load (T76);
function Load_T77 is new Load (T77);
function Load_T78 is new Load (T78);
function Load_T79 is new Load (T79);
function Load_T80 is new Load (T80);
function Load_T81 is new Load (T81);
function Load_T82 is new Load (T82);
function Load_T83 is new Load (T83);
function Load_T84 is new Load (T84);
function Load_T85 is new Load (T85);
function Load_T86 is new Load (T86);
function Load_T87 is new Load (T87);
function Load_T88 is new Load (T88);
function Load_T89 is new Load (T89);
function Load_T90 is new Load (T90);
function Load_T91 is new Load (T91);
function Load_T92 is new Load (T92);
function Load_T93 is new Load (T93);
function Load_T94 is new Load (T94);
function Load_T95 is new Load (T95);
function Load_T96 is new Load (T96);
function Load_T97 is new Load (T97);
function Load_T98 is new Load (T98);
function Load_T99 is new Load (T99);
function Load_T100 is new Load (T100);
function Load_T101 is new Load (T101);
function Load_T102 is new Load (T102);
function Load_T103 is new Load (T103);
function Load_T104 is new Load (T104);
function Load_T105 is new Load (T105);
function Load_T106 is new Load (T106);
function Load_T107 is new Load (T107);
function Load_T108 is new Load (T108);
function Load_T109 is new Load (T109);
function Load_T110 is new Load (T110);
function Load_T111 is new Load (T111);
function Load_T112 is new Load (T112);
function Load_T113 is new Load (T113);
function Load_T114 is new Load (T114);
function Load_T115 is new Load (T115);
function Load_T116 is new Load (T116);
function Load_T117 is new Load (T117);
function Load_T118 is new Load (T118);
function Load_T119 is new Load (T119);
function Load_T120 is new Load (T120);
function Load_T121 is new Load (T121);
function Load_T122 is new Load (T122);
function Load_T123 is new Load (T123);
function Load_T124 is new Load (T124);
function Load_T125 is new Load (T125);
function Load_T126 is new Load (T126);
function Load_T127 is new Load (T127);
function Load_T128 is new Load (T128);
function Load_T129 is new Load (T129);
function Load_T130 is new Load (T130);
function Load_T131 is new Load (T131);
function Load_T132 is new Load (T132);
function Load_T133 is new Load (T133);
function Load_T134 is new Load (T134);
function Load_T135 is new Load (T135);
function Load_T136 is new Load (T136);
function Load_T137 is new Load (T137);
function Load_T138 is new Load (T138);
function Load_T139 is new Load (T139);
function Load_T140 is new Load (T140);
function Load_T141 is new Load (T141);
function Load_T142 is new Load (T142);
function Load_T143 is new Load (T143);
function Load_T144 is new Load (T144);
function Load_T145 is new Load (T145);
function Load_T146 is new Load (T146);
function Load_T147 is new Load (T147);
function Load_T148 is new Load (T148);
function Load_T149 is new Load (T149);
function Load_T150 is new Load (T150);
function Load_T151 is new Load (T151);
function Load_T152 is new Load (T152);
function Load_T153 is new Load (T153);
function Load_T154 is new Load (T154);
function Load_T155 is new Load (T155);
function Load_T156 is new Load (T156);
function Load_T157 is new Load (T157);
function Load_T158 is new Load (T158);
function Load_T159 is new Load (T159);
function Load_T160 is new Load (T160);
function Load_T161 is new Load (T161);
function Load_T162 is new Load (T162);
function Load_T163 is new Load (T163);
function Load_T164 is new Load (T164);
function Load_T165 is new Load (T165);
function Load_T166 is new Load (T166);
function Load_T167 is new Load (T167);
function Load_T168 is new Load (T168);
function Load_T169 is new Load (T169);
function Load_T170 is new Load (T170);
function Load_T171 is new Load (T171);
function Load_T172 is new Load (T172);
function Load_T173 is new Load (T173);
function Load_T174 is new Load (T174);
function Load_T175 is new Load (T175);
function Load_T176 is new Load (T176);
function Load_T177 is new Load (T177);
function Load_T178 is new Load (T178);
function Load_T179 is new Load (T179);
function Load_T180 is new Load (T180);
function Load_T181 is new Load (T181);
function Load_T182 is new Load (T182);
function Load_T183 is new Load (T183);
function Load_T184 is new Load (T184);
function Load_T185 is new Load (T185);
function Load_T186 is new Load (T186);
function Load_T187 is new Load (T187);
function Load_T188 is new Load (T188);
function Load_T189 is new Load (T189);
function Load_T190 is new Load (T190);
function Load_T191 is new Load (T191);
function Load_T192 is new Load (T192);
function Load_T193 is new Load (T193);
function Load_T194 is new Load (T194);
begin
GL.API.Doubles.Vertex_Attrib1 := Load_T1 ("glVertexAttribL1d");
GL.API.Doubles.Vertex_Attrib2 := Load_T2 ("glVertexAttribL2d");
GL.API.Doubles.Vertex_Attrib2v := Load_T3 ("glVertexAttribL2dv");
GL.API.Doubles.Vertex_Attrib3 := Load_T4 ("glVertexAttribL3d");
GL.API.Doubles.Vertex_Attrib3v := Load_T5 ("glVertexAttribL3dv");
GL.API.Doubles.Vertex_Attrib4 := Load_T6 ("glVertexAttribL4d");
GL.API.Doubles.Vertex_Attrib4v := Load_T7 ("glVertexAttribL4dv");
GL.API.Ints.Uniform1 := Load_T8 ("glUniform1i");
GL.API.Ints.Uniform1v := Load_T9 ("glUniform1iv");
GL.API.Ints.Uniform2 := Load_T10 ("glUniform2i");
GL.API.Ints.Uniform2v := Load_T11 ("glUniform2iv");
GL.API.Ints.Uniform3 := Load_T12 ("glUniform3i");
GL.API.Ints.Uniform3v := Load_T13 ("glUniform3iv");
GL.API.Ints.Uniform4 := Load_T14 ("glUniform4i");
GL.API.Ints.Uniform4v := Load_T15 ("glUniform4iv");
GL.API.Ints.Uniform_Matrix2 := Load_T16 ("glUniformMatrix2iv");
GL.API.Ints.Uniform_Matrix3 := Load_T17 ("glUniformMatrix3iv");
GL.API.Ints.Uniform_Matrix4 := Load_T18 ("glUniformMatrix4iv");
GL.API.Ints.Vertex_Attrib1 := Load_T19 ("glVertexAttribI1i");
GL.API.Ints.Vertex_Attrib2 := Load_T20 ("glVertexAttribI2i");
GL.API.Ints.Vertex_Attrib2v := Load_T21 ("glVertexAttribI2iv");
GL.API.Ints.Vertex_Attrib3 := Load_T22 ("glVertexAttribI3i");
GL.API.Ints.Vertex_Attrib3v := Load_T23 ("glVertexAttribI3iv");
GL.API.Ints.Vertex_Attrib4 := Load_T24 ("glVertexAttribI4i");
GL.API.Ints.Vertex_Attrib4v := Load_T25 ("glVertexAttrib4Iiv");
GL.API.Shorts.Vertex_Attrib1 := Load_T26 ("glVertexAttrib1s");
GL.API.Shorts.Vertex_Attrib2 := Load_T27 ("glVertexAttrib2s");
GL.API.Shorts.Vertex_Attrib2v := Load_T28 ("glVertexAttrib2sv");
GL.API.Shorts.Vertex_Attrib3 := Load_T29 ("glVertexAttrib3s");
GL.API.Shorts.Vertex_Attrib3v := Load_T30 ("glVertexAttrib3sv");
GL.API.Shorts.Vertex_Attrib4 := Load_T31 ("glVertexAttrib4s");
GL.API.Shorts.Vertex_Attrib4v := Load_T32 ("glVertexAttrib4sv");
GL.API.Singles.Uniform1 := Load_T33 ("glUniform1f");
GL.API.Singles.Uniform1v := Load_T34 ("glUniform1fv");
GL.API.Singles.Uniform2 := Load_T35 ("glUniform2f");
GL.API.Singles.Uniform2v := Load_T36 ("glUniform2fv");
GL.API.Singles.Uniform3 := Load_T37 ("glUniform3f");
GL.API.Singles.Uniform3v := Load_T38 ("glUniform3fv");
GL.API.Singles.Uniform4 := Load_T39 ("glUniform4f");
GL.API.Singles.Uniform4v := Load_T40 ("glUniform4fv");
GL.API.Singles.Uniform_Matrix2 := Load_T41 ("glUniformMatrix2fv");
GL.API.Singles.Uniform_Matrix3 := Load_T42 ("glUniformMatrix3fv");
GL.API.Singles.Uniform_Matrix4 := Load_T43 ("glUniformMatrix4fv");
GL.API.Singles.Vertex_Attrib1 := Load_T44 ("glVertexAttrib1f");
GL.API.Singles.Vertex_Attrib2 := Load_T45 ("glVertexAttrib2f");
GL.API.Singles.Vertex_Attrib2v := Load_T46 ("glVertexAttrib2fv");
GL.API.Singles.Vertex_Attrib3 := Load_T47 ("glVertexAttrib3f");
GL.API.Singles.Vertex_Attrib3v := Load_T48 ("glVertexAttrib3fv");
GL.API.Singles.Vertex_Attrib4 := Load_T49 ("glVertexAttrib4f");
GL.API.Singles.Vertex_Attrib4v := Load_T50 ("glVertexAttrib4fv");
GL.API.UInts.Uniform1 := Load_T51 ("glUniform1ui");
GL.API.UInts.Uniform1v := Load_T52 ("glUniform1uiv");
GL.API.UInts.Uniform2 := Load_T53 ("glUniform2ui");
GL.API.UInts.Uniform2v := Load_T54 ("glUniform2uiv");
GL.API.UInts.Uniform3 := Load_T55 ("glUniform3ui");
GL.API.UInts.Uniform3v := Load_T56 ("glUniform3uiv");
GL.API.UInts.Uniform4 := Load_T57 ("glUniform4ui");
GL.API.UInts.Uniform4v := Load_T58 ("glUniform4uiv");
GL.API.UInts.Uniform_Matrix2 := Load_T59 ("glUniformMatrix2uiv");
GL.API.UInts.Uniform_Matrix3 := Load_T60 ("glUniformMatrix3uiv");
GL.API.UInts.Uniform_Matrix4 := Load_T61 ("glUniformMatrix4uiv");
GL.API.UInts.Vertex_Attrib1 := Load_T62 ("glVertexAttribI1ui");
GL.API.UInts.Vertex_Attrib2 := Load_T63 ("glVertexAttribI2ui");
GL.API.UInts.Vertex_Attrib2v := Load_T64 ("glVertexAttribI2uiv");
GL.API.UInts.Vertex_Attrib3 := Load_T65 ("glVertexAttribI3ui");
GL.API.UInts.Vertex_Attrib3v := Load_T66 ("glVertexAttribI3uiv");
GL.API.UInts.Vertex_Attrib4 := Load_T67 ("glVertexAttribI4ui");
GL.API.UInts.Vertex_Attrib4v := Load_T68 ("glVertexAttrib4Iuiv");
GL.API.Debug_Message_Insert := Load_T69 ("glDebugMessageInsert");
GL.API.Push_Debug_Group := Load_T70 ("glPushDebugGroup");
GL.API.Pop_Debug_Group := Load_T71 ("glPopDebugGroup");
GL.API.Debug_Message_Control := Load_T72 ("glDebugMessageControl");
GL.API.Get_Debug_Message_Log := Load_T73 ("glGetDebugMessageLog");
GL.API.Debug_Message_Callback := Load_T74 ("glDebugMessageCallback");
GL.API.Get_String_I := Load_T75 ("glGetStringi");
GL.API.Secondary_Color := Load_T76 ("glSecondaryColor3dv");
GL.API.Fog_Coord := Load_T77 ("glFogCoordd");
GL.API.Draw_Arrays_Instanced := Load_T78 ("glDrawArraysInstanced");
GL.API.Draw_Elements_Instanced := Load_T79 ("glDrawElementsInstanced");
GL.API.Draw_Elements_Base_Vertex := Load_T80 ("glDrawElementsBaseVertex");
GL.API.Draw_Transform_Feedback := Load_T81 ("glDrawTransformFeedback");
GL.API.Draw_Transform_Feedback_Stream := Load_T82 ("glDrawTransformFeedbackStream");
GL.API.Primitive_Restart_Index := Load_T83 ("glPrimitiveRestartIndex");
GL.API.Vertex_Attrib_Divisor := Load_T84 ("glVertexAttribDivisor");
GL.API.Blend_Func_I := Load_T85 ("glBlendFunci");
GL.API.Blend_Func_Separate := Load_T86 ("glBlendFuncSeparate");
GL.API.Blend_Func_Separate_I := Load_T87 ("glBlendFuncSeparate");
GL.API.Blend_Color := Load_T88 ("glBlendColor");
GL.API.Blend_Equation := Load_T89 ("glBlendEquation");
GL.API.Blend_Equation_I := Load_T90 ("glBlendEquationi");
GL.API.Blend_Equation_Separate := Load_T91 ("glBlendEquationSeparate");
GL.API.Blend_Equation_Separate_I := Load_T92 ("glBlendEquationi");
GL.API.Set_Point_Parameter_Single := Load_T93 ("glPointParameterf");
GL.API.Draw_Buffers := Load_T94 ("glDrawBuffers");
GL.API.Clear_Accum := Load_T88 ("glClearAccum");
GL.API.Clear_Buffer := Load_T95 ("glClearBufferfv");
GL.API.Clear_Draw_Buffer := Load_T96 ("glClearBufferfv");
GL.API.Clear_Buffer_Depth := Load_T97 ("glClearBufferfv");
GL.API.Clear_Buffer_Stencil := Load_T98 ("glClearBufferiv");
GL.API.Clear_Buffer_Depth_Stencil := Load_T99 ("glClearBufferfi");
GL.API.Stencil_Func_Separate := Load_T100 ("glStencilFuncSeparate");
GL.API.Stencil_Op_Separate := Load_T101 ("glStencilOpSeparate");
GL.API.Stencil_Mask_Separate := Load_T102 ("glStencilMaskSeparate");
GL.API.Compressed_Tex_Image_1D := Load_T103 ("glCompressedTexImage1D");
GL.API.Tex_Sub_Image_1D := Load_T104 ("glTexSubImage1D");
GL.API.Tex_Storage_1D := Load_T105 ("glTexStorage1D");
GL.API.Compressed_Tex_Image_2D := Load_T106 ("glCompressedTexImage2D");
GL.API.Tex_Storage_2D := Load_T107 ("glTexStorage2D");
GL.API.Tex_Image_3D := Load_T108 ("glTexImage3D");
GL.API.Compressed_Tex_Image_3D := Load_T109 ("glCompressedTexImage3D");
GL.API.Tex_Sub_Image_3D := Load_T104 ("glTexSubImage3D");
GL.API.Tex_Storage_3D := Load_T110 ("glTexStorage3D");
GL.API.Active_Texture := Load_T111 ("glActiveTexture");
GL.API.Generate_Mipmap := Load_T112 ("glGenerateMipmap");
GL.API.Invalidate_Tex_Image := Load_T113 ("glInvalidateTexImage");
GL.API.Invalidate_Tex_Sub_Image := Load_T114 ("glInvalidateTexSubImage");
GL.API.Gen_Buffers := Load_T115 ("glGenBuffers");
GL.API.Gen_Transform_Feedbacks := Load_T115 ("glGenTransformFeedbacks");
GL.API.Delete_Buffers := Load_T116 ("glDeleteBuffers");
GL.API.Delete_Transform_Feedbacks := Load_T116 ("glDeleteTransformFeedbacks");
GL.API.Bind_Buffer := Load_T117 ("glBindBuffer");
GL.API.Bind_Transform_Feedback := Load_T117 ("glBindTransformFeedback");
GL.API.Bind_Buffer_Base := Load_T118 ("glBindBufferBase");
GL.API.Buffer_Data := Load_T119 ("glBufferData");
GL.API.Texture_Buffer_Data := Load_T120 ("glTexBuffer");
GL.API.Map_Buffer := Load_T121 ("glMapBuffer");
GL.API.Map_Buffer_Range := Load_T122 ("glMapBufferRange");
GL.API.Buffer_Pointer := Load_T123 ("glGetBufferPointerv");
GL.API.Buffer_Sub_Data := Load_T124 ("glBufferSubData");
GL.API.Get_Buffer_Sub_Data := Load_T124 ("glGetBufferSubData");
GL.API.Unmap_Buffer := Load_T125 ("glUnmapBuffer");
GL.API.Get_Buffer_Parameter_Access_Kind := Load_T126 ("glGetBufferParameteriv");
GL.API.Get_Buffer_Parameter_Bool := Load_T127 ("glGetBufferParameteriv");
GL.API.Get_Buffer_Parameter_Size := Load_T128 ("glGetBufferParameteriv");
GL.API.Get_Buffer_Parameter_Usage := Load_T129 ("glGetBufferParameteriv");
GL.API.Invalidate_Buffer_Data := Load_T130 ("glInvalidateBufferData");
GL.API.Invalidate_Buffer_Sub_Data := Load_T131 ("glInvalidateBufferSubData");
GL.API.Flush_Mapped_Buffer_Range := Load_T132 ("glFlushMappedBufferRange");
GL.API.Gen_Vertex_Arrays := Load_T133 ("glGenVertexArrays");
GL.API.Delete_Vertex_Arrays := Load_T134 ("glDeleteVertexArrays");
GL.API.Bind_Vertex_Array := Load_T135 ("glBindVertexArray");
GL.API.Gen_Renderbuffers := Load_T136 ("glGenRenderbuffers");
GL.API.Delete_Renderbuffers := Load_T137 ("glDeleteBuffers");
GL.API.Renderbuffer_Storage := Load_T138 ("glRenderbufferStorage");
GL.API.Renderbuffer_Storage_Multisample := Load_T139 ("glRenderbufferStorageMultisample");
GL.API.Bind_Renderbuffer := Load_T140 ("glBindRenderbuffer");
GL.API.Get_Renderbuffer_Parameter_Int := Load_T141 ("glGetRenderbufferParameteriv");
GL.API.Get_Renderbuffer_Parameter_Internal_Format := Load_T142 ("glGetRenderbufferParameteriv");
GL.API.Clamp_Color := Load_T143 ("glClampColor");
GL.API.Gen_Framebuffers := Load_T144 ("glGenFramebuffers");
GL.API.Delete_Framebuffers := Load_T145 ("glDeleteFramebuffers");
GL.API.Bind_Framebuffer := Load_T146 ("glBindFramebuffer");
GL.API.Check_Framebuffer_Status := Load_T147 ("glCheckFramebufferStatus");
GL.API.Framebuffer_Renderbuffer := Load_T148 ("glFramebufferRenderbuffer");
GL.API.Framebuffer_Texture := Load_T149 ("glFramebufferTexture");
GL.API.Framebuffer_Texture_Layer := Load_T150 ("glFramebufferTextureLayer");
GL.API.Blit_Framebuffer := Load_T151 ("glBlitFramebuffer");
GL.API.Invalidate_Framebuffer := Load_T152 ("glInvalidateFramebuffer");
GL.API.Invalidate_Sub_Framebuffer := Load_T153 ("glInvalidateSubFramebuffer");
GL.API.Framebuffer_Parameter_Size := Load_T154 ("glFramebufferParameteri");
GL.API.Framebuffer_Parameter_Bool := Load_T155 ("glFramebufferParameteri");
GL.API.Get_Framebuffer_Parameter_Size := Load_T156 ("glGetFramebufferParameteriv");
GL.API.Get_Framebuffer_Parameter_Bool := Load_T157 ("glGetFramebufferParameteriv");
GL.API.Gen_Queries := Load_T158 ("glGenQueries");
GL.API.Delete_Queries := Load_T159 ("glDeleteQueries");
GL.API.Is_Query := Load_T160 ("glIsQuery");
GL.API.Get_Query_Object := Load_T161 ("glGetQueryObjectuiv");
GL.API.Begin_Query := Load_T162 ("glBeginQuery");
GL.API.End_Query := Load_T163 ("glEndQuery");
GL.API.Begin_Query_Indexed := Load_T164 ("glBeginQueryIndexed");
GL.API.End_Query_Indexed := Load_T165 ("glEndQueryIndexed");
GL.API.Query_Counter := Load_T166 ("glQueryCounter");
GL.API.Get_Shader_Param := Load_T167 ("glGetShaderiv");
GL.API.Get_Shader_Type := Load_T168 ("glGetShaderiv");
GL.API.Create_Shader := Load_T169 ("glCreateShader");
GL.API.Delete_Shader := Load_T170 ("glDeleteShader");
GL.API.Shader_Source := Load_T171 ("glShaderSource");
GL.API.Get_Shader_Source := Load_T172 ("glGetShaderSource");
GL.API.Compile_Shader := Load_T170 ("glCompileShader");
GL.API.Release_Shader_Compiler := Load_T71 ("glReleaseShaderCompiler");
GL.API.Get_Shader_Info_Log := Load_T172 ("glGetShaderInfoLog");
GL.API.Create_Program := Load_T173 ("glCreateProgram");
GL.API.Delete_Program := Load_T174 ("glDeleteProgram");
GL.API.Get_Program_Param := Load_T175 ("glGetProgramiv");
GL.API.Attach_Shader := Load_T176 ("glAttachShader");
GL.API.Link_Program := Load_T174 ("glLinkProgram");
GL.API.Get_Program_Info_Log := Load_T177 ("glGetProgramInfoLog");
GL.API.Get_Program_Stage := Load_T178 ("glGetProgramStageiv");
GL.API.Get_Subroutine_Index := Load_T179 ("glGetSubroutineIndex");
GL.API.Get_Subroutine_Uniform_Location := Load_T180 ("glGetSubroutineUniformLocation");
GL.API.Use_Program := Load_T174 ("glUseProgram");
GL.API.Validate_Program := Load_T174 ("glValidateProgram");
GL.API.Get_Uniform_Location := Load_T181 ("glGetUniformLocation");
GL.API.Bind_Attrib_Location := Load_T182 ("glBindAttribLocation");
GL.API.Get_Attrib_Location := Load_T183 ("glGetAttribLocation");
GL.API.Vertex_Attrib_Pointer := Load_T184 ("glVertexAttribPointer");
GL.API.Vertex_AttribI_Pointer := Load_T185 ("glVertexAttribIPointer");
GL.API.Vertex_AttribL_Pointer := Load_T185 ("glVertexAttribLPointer");
GL.API.Enable_Vertex_Attrib_Array := Load_T186 ("glEnableVertexAttribArray");
GL.API.Disable_Vertex_Attrib_Array := Load_T186 ("glDisableVertexAttribArray");
GL.API.Get_Attached_Shaders := Load_T187 ("glGetAttachedShaders");
GL.API.Bind_Frag_Data_Location := Load_T188 ("glBindFragDataLocation");
GL.API.Get_Frag_Data_Location := Load_T189 ("glGetFragDataLocation");
GL.API.Begin_Transform_Feedback := Load_T190 ("glBeginTransformFeedback");
GL.API.End_Transform_Feedback := Load_T71 ("glEndTransformFeedback");
GL.API.Get_Transform_Feedback_Varying := Load_T191 ("glGetTransformFeedbackVarying");
GL.API.Transform_Feedback_Varyings := Load_T192 ("glTransformFeedbackVaryings");
GL.API.Set_Patch_Parameter_Int := Load_T193 ("glPatchParameteri");
GL.API.Set_Patch_Parameter_Float_Array := Load_T194 ("glPatchParameterfv");
end GL.Load_Function_Pointers;
|
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2017, 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 is a demo of the features available on the STM32F4-DISCOVERY board.
--
-- Press the blue button to change the note of the sound played in the
-- headphone jack. Press the black button to reset.
with HAL; use HAL;
with STM32.Device; use STM32.Device;
with STM32.Board; use STM32.Board;
with HAL.Audio; use HAL.Audio;
with Simple_Synthesizer;
with Audio_Stream; use Audio_Stream;
with System; use System;
with Interfaces; use Interfaces;
with STM32.User_Button;
procedure Main is
Synth : Simple_Synthesizer.Synthesizer
(Stereo => True,
Amplitude => Natural (Integer_16'Last / 3));
Audio_Data_0 : Audio_Buffer (1 .. 64);
Audio_Data_1 : Audio_Buffer (1 .. 64);
Note : Float := 110.0;
begin
Initialize_LEDs;
Initialize_Audio;
STM32.User_Button.Initialize;
Synth.Set_Frequency (STM32.Board.Audio_Rate);
STM32.Board.Audio_DAC.Set_Volume (60);
STM32.Board.Audio_DAC.Play;
Audio_TX_DMA_Int.Start (Destination => STM32.Board.Audio_I2S.Data_Register_Address,
Source_0 => Audio_Data_0'Address,
Source_1 => Audio_Data_1'Address,
Data_Count => Audio_Data_0'Length);
loop
if STM32.User_Button.Has_Been_Pressed then
Note := Note * 2.0;
if Note > 880.0 then
Note := 110.0;
end if;
end if;
Synth.Set_Note_Frequency (Note);
Audio_TX_DMA_Int.Wait_For_Transfer_Complete;
if Audio_TX_DMA_Int.Not_In_Transfer = Audio_Data_0'Address then
Synth.Receive (Audio_Data_0);
else
Synth.Receive (Audio_Data_1);
end if;
end loop;
end Main;
|
-- Copyright 2013-2017 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 IO; use IO;
package body Callee is
procedure Increment (Val : in out Float; Msg: String) is
begin
if Val > 200.0 then
Put_Line (Msg);
end if;
Val := Val + 1.0;
end Increment;
end Callee;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . N U M E R I C S . A U X --
-- --
-- S p e c --
-- (C Library Version for x86) --
-- --
-- Copyright (C) 1992-2005, 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 2, 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 COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides the basic computational interface for the generic
-- elementary functions. The C library version interfaces with the routines
-- in the C mathematical library, and is thus quite portable, although it may
-- not necessarily meet the requirements for accuracy in the numerics annex.
-- One advantage of using this package is that it will interface directly to
-- hardware instructions, such as the those provided on the Intel x86.
-- Note: there are two versions of this package. One using the 80-bit x86
-- long double format (which is this version), and one using 64-bit IEEE
-- double (see file a-numaux.ads).
package Ada.Numerics.Aux is
pragma Pure;
pragma Linker_Options ("-lm");
type Double is digits 18;
-- We import these functions directly from C. Note that we label them
-- all as pure functions, because indeed all of them are in fact pure!
function Sin (X : Double) return Double;
pragma Import (C, Sin, "sinl");
pragma Pure_Function (Sin);
function Cos (X : Double) return Double;
pragma Import (C, Cos, "cosl");
pragma Pure_Function (Cos);
function Tan (X : Double) return Double;
pragma Import (C, Tan, "tanl");
pragma Pure_Function (Tan);
function Exp (X : Double) return Double;
pragma Import (C, Exp, "expl");
pragma Pure_Function (Exp);
function Sqrt (X : Double) return Double;
pragma Import (C, Sqrt, "sqrtl");
pragma Pure_Function (Sqrt);
function Log (X : Double) return Double;
pragma Import (C, Log, "logl");
pragma Pure_Function (Log);
function Acos (X : Double) return Double;
pragma Import (C, Acos, "acosl");
pragma Pure_Function (Acos);
function Asin (X : Double) return Double;
pragma Import (C, Asin, "asinl");
pragma Pure_Function (Asin);
function Atan (X : Double) return Double;
pragma Import (C, Atan, "atanl");
pragma Pure_Function (Atan);
function Sinh (X : Double) return Double;
pragma Import (C, Sinh, "sinhl");
pragma Pure_Function (Sinh);
function Cosh (X : Double) return Double;
pragma Import (C, Cosh, "coshl");
pragma Pure_Function (Cosh);
function Tanh (X : Double) return Double;
pragma Import (C, Tanh, "tanhl");
pragma Pure_Function (Tanh);
function Pow (X, Y : Double) return Double;
pragma Import (C, Pow, "powl");
pragma Pure_Function (Pow);
end Ada.Numerics.Aux;
|
with Interfaces;
with Ada.Numerics.Float_Random;
with Ada.Numerics.Generic_Elementary_Functions;
with Vector_Math;
use Interfaces;
use Vector_Math;
package body Lights is
package Float_Functions is new Ada.Numerics.Generic_Elementary_Functions(float);
use Float_Functions;
function GetIntensity(l : LightRef) return float3 is
begin
return GetIntensity(l.all);
end GetIntensity;
function Sample(l : LightRef; gen : RandRef; lluminatingPoint : float3) return ShadowSample is
begin
return Sample(l.all, gen, lluminatingPoint);
end Sample;
function EvalPDF(l : LightRef; lluminatingPoint : float3; rayDir : float3; hitDist : float) return float is
begin
return EvalPDF(l.all, lluminatingPoint, rayDir, hitDist);
end EvalPDF;
function GetShapeType(l : LightRef) return LightShapes is
begin
return GetShapeType(l.all);
end GetShapeType;
-- explicit light sampling utils
--
epsilonDiv : constant float := 1.0e-20; -- small value for bsdf/pdf divisions
function PdfAtoW(aPdfA : in float; aDist : in float; aCosThere : in float) return float is
begin
return aPdfA*aDist*aDist/max(aCosThere, epsilonDiv);
end PdfAtoW;
---- Area Light
----
function AreaPDF(l : AreaLight) return float is
begin
return 1.0/l.surfaceArea;
end AreaPDF;
function Sample(l : AreaLight; gen : RandRef; lluminatingPoint : float3) return ShadowSample is
r1 : float := gen.rnd_uniform(0.0, 1.0);
r2 : float := gen.rnd_uniform(0.0, 1.0);
cosTheta : float; -- := max(dot(sdir, (-1.0)*lsam.norm), 0.0);
rayDir : float3;
d : float;
res : ShadowSample;
begin
res.pos.x := l.boxMin.x + r1*(l.boxMax.x - l.boxMin.x);
res.pos.y := l.boxMin.y;
res.pos.z := l.boxMin.z + r2*(l.boxMax.z - l.boxMin.z);
res.dir := l.normal;
rayDir := res.pos - lluminatingPoint;
d := length(rayDir);
rayDir := rayDir*(1.0/d);
cosTheta := max(dot(rayDir, (-1.0)*l.normal), 0.0);
res.pdf := PdfAtoW(AreaPDF(l), d, cosTheta);
res.intensity := l.intensity;
return res;
end Sample;
function EvalPDF(l : AreaLight; lluminatingPoint : float3; rayDir : float3; hitDist : float) return float is
cosTheta : float := max(dot(rayDir, (-1.0)*l.normal), 0.0);
begin
return PdfAtoW(AreaPDF(l), hitDist, cosTheta);
end EvalPDF;
function GetIntensity(l : AreaLight) return float3 is
begin
return l.intensity;
end GetIntensity;
function GetShapeType(l : AreaLight) return LightShapes is
begin
return Light_Shape_Rect;
end GetShapeType;
---- Sphere Light
----
function AreaPDF(l : SphereLight) return float is
begin
return 1.0/l.surfaceArea;
end AreaPDF;
procedure CoordinateSystem(v1 : in float3; v2 : out float3; v3 : out float3) is
invLen : float;
begin
if abs(v1.x) > abs(v1.y) then
invLen := 1.0 / sqrt(v1.x*v1.x + v1.z*v1.z);
v2 := (-v1.z * invLen, 0.0, v1.x * invLen);
else
invLen := 1.0 / sqrt(v1.y*v1.y + v1.z*v1.z);
v2 := (0.0, v1.z * invLen, -v1.y * invLen);
end if;
v3 := cross(v1, v2);
end CoordinateSystem;
function DistanceSquared(a : float3; b : float3) return float is
diff : float3 := (b - a);
begin
return dot(diff, diff);
exception -- floating point overflow may happen due to diff.x*diff.x may be too large
when Constraint_Error =>
return float'Last;
end DistanceSquared;
function UniformSampleSphere(u1 : float; u2 : float) return float3 is
x,y,z,r,phi : float;
begin
z := 1.0 - 2.0 * u1;
r := sqrt(max(0.0, 1.0 - z*z));
phi := 2.0 * M_PI * u2;
x := r * cos(phi);
y := r * sin(phi);
return (x,y,z);
end UniformSampleSphere;
function UniformSampleCone(u1 : float; u2 : float; costhetamax : float; x : float3; y : float3; z : float3) return float3 is
phi,costheta,sintheta : float;
begin
costheta := lerp(u1, costhetamax, 1.0);
sintheta := sqrt(1.0 - costheta*costheta);
phi := u2 * 2.0 * M_PI;
return cos(phi) * sintheta * x + sin(phi) * sintheta * y + costheta * z;
end UniformSampleCone;
function UniformConePdf(cosThetaMax : float) return float is
begin
return 1.0 / (2.0 * M_PI * (1.0 - cosThetaMax));
exception
when Constraint_Error =>
return 0.0; -- #NOTE: may be need return 1 ??
end UniformConePdf;
function RaySphereIntersect(rayPos : float3; rayDir : float3; sphPos : float3; radius : float) return float2 is
t1, t2 : float;
k : float3;
b, c, d, sqrtd : float;
res : float2;
begin
k := rayPos - sphPos;
b := dot(k,rayDir);
c := dot(k,k) - radius*radius;
d := b * b - c;
if d >= 0.0 then
sqrtd := sqrt(d);
t1 := -b - sqrtd;
t2 := -b + sqrtd;
res.x := min(t1,t2);
res.y := max(t1,t2);
else
res.x := -infinity;
res.y := -infinity;
end if;
return res;
exception
when Constraint_Error =>
return (-infinity,-infinity);
end RaySphereIntersect;
function Sample(l : SphereLight; gen : RandRef; lluminatingPoint : float3) return ShadowSample is
u1 : float := gen.rnd_uniform(0.0, 1.0);
u2 : float := gen.rnd_uniform(0.0, 1.0);
wc, wcX, wcY : float3;
sinThetaMax2,cosThetaMax,thit : float;
rpos, rdir : float3;
hitMinMax : float2;
res : ShadowSample;
begin
res.intensity := l.intensity;
if DistanceSquared(lluminatingPoint, l.center) - l.radius*l.radius < 1.0e-4 then
res.pos := l.center + l.radius*UniformSampleSphere(u1, u2);
res.dir := normalize(res.pos - l.center);
return res;
end if;
wc := normalize(l.center - lluminatingPoint);
CoordinateSystem(wc, v2 => wcX, v3 => wcY);
sinThetaMax2 := l.radius*l.radius / DistanceSquared(lluminatingPoint, l.center);
cosThetaMax := sqrt(max(0.0, 1.0 - sinThetaMax2));
rdir := UniformSampleCone(u1, u2, cosThetaMax, wcX, wcY, wc);
rpos := lluminatingPoint + rdir*(1.0e-3);
-- calc ray sphere intersection and store hit distance in thit
--
hitMinMax := RaySphereIntersect(rpos, rdir, l.center, l.radius);
if hitMinMax.x < 0.0 then -- !Intersect(r, &thit, &rayEpsilon, &dgSphere)
thit := dot(l.center - lluminatingPoint, normalize(rdir));
else
thit := hitMinMax.x;
end if;
res.pos := rpos + thit*rdir;
res.dir := normalize(res.pos - l.center);
res.pdf := EvalPDF(l, lluminatingPoint, rdir, thit);
return res;
end Sample;
function EvalPDF(l : SphereLight; lluminatingPoint : float3; rayDir : float3; hitDist : float) return float is
sinThetaMax2, cosThetaMax : float;
begin
if DistanceSquared(lluminatingPoint, l.center) - l.radius*l.radius < 1.0e-4 then
return 1.0/l.surfaceArea;
end if;
sinThetaMax2 := l.radius*l.radius / DistanceSquared(lluminatingPoint, l.center);
cosThetaMax := sqrt(max(0.0, 1.0 - sinThetaMax2));
return UniformConePdf(cosThetaMax);
end EvalPDF;
function GetIntensity(l : SphereLight) return float3 is
begin
return l.intensity;
end GetIntensity;
function GetShapeType(l : SphereLight) return LightShapes is
begin
return Light_Shape_Sphere;
end GetShapeType;
end Lights;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 6 1 --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Handling of packed arrays with Component_Size = 61
package System.Pack_61 is
pragma Preelaborate;
Bits : constant := 61;
type Bits_61 is mod 2 ** Bits;
for Bits_61'Size use Bits;
-- In all subprograms below, Rev_SSO is set True if the array has the
-- non-default scalar storage order.
function Get_61
(Arr : System.Address;
N : Natural;
Rev_SSO : Boolean) return Bits_61 with Inline;
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is extracted and returned.
procedure Set_61
(Arr : System.Address;
N : Natural;
E : Bits_61;
Rev_SSO : Boolean) with Inline;
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is set to the given value.
end System.Pack_61;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2016, Vadim Godunko <vgodunko@gmail.com> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Streams.Stream_IO;
package body Servlet.HTTP_Parameters is
----------------------
-- Get_Content_Type --
----------------------
function Get_Content_Type
(Self : HTTP_Parameter'Class) return League.Strings.Universal_String is
begin
if Self.Parameter /= null then
return Self.Parameter.Get_Content_Type;
else
return League.Strings.Empty_Universal_String;
end if;
end Get_Content_Type;
----------------
-- Get_Header --
----------------
function Get_Header
(Self : HTTP_Parameter'Class;
Name : League.Strings.Universal_String)
return League.Strings.Universal_String
is
Headers : League.String_Vectors.Universal_String_Vector;
begin
if Self.Parameter /= null then
Headers := Self.Parameter.Get_Headers (Name);
if not Headers.Is_Empty then
return Headers (1);
end if;
end if;
return League.Strings.Empty_Universal_String;
end Get_Header;
-----------------
-- Get_Headers --
-----------------
function Get_Headers
(Self : HTTP_Parameter'Class;
Name : League.Strings.Universal_String)
return League.String_Vectors.Universal_String_Vector is
begin
if Self.Parameter /= null then
return Self.Parameter.Get_Headers (Name);
else
return League.String_Vectors.Empty_Universal_String_Vector;
end if;
end Get_Headers;
----------------------
-- Get_Header_Names --
----------------------
function Get_Header_Names
(Self : HTTP_Parameter'Class)
return League.String_Vectors.Universal_String_Vector is
begin
if Self.Parameter /= null then
return Self.Parameter.Get_Header_Names;
else
return League.String_Vectors.Empty_Universal_String_Vector;
end if;
end Get_Header_Names;
----------------------
-- Get_Input_Stream --
----------------------
function Get_Input_Stream
(Self : HTTP_Parameter'Class)
return access Ada.Streams.Root_Stream_Type'Class is
begin
if Self.Parameter /= null then
return Self.Parameter.Get_Input_Stream;
else
return null;
end if;
end Get_Input_Stream;
--------------
-- Get_Name --
--------------
function Get_Name
(Self : HTTP_Parameter'Class) return League.Strings.Universal_String is
begin
if Self.Parameter /= null then
return Self.Parameter.Get_Name;
else
return League.Strings.Empty_Universal_String;
end if;
end Get_Name;
--------------
-- Get_Size --
--------------
function Get_Size
(Self : HTTP_Parameter'Class) return Ada.Streams.Stream_Element_Count is
begin
if Self.Parameter /= null then
return Self.Parameter.Get_Size;
else
return 0;
end if;
end Get_Size;
-----------------------------
-- Get_Submitted_File_Name --
-----------------------------
function Get_Submitted_File_Name
(Self : HTTP_Parameter'Class) return League.Strings.Universal_String is
begin
if Self.Parameter /= null then
return Self.Parameter.Get_Submitted_File_Name;
else
return League.Strings.Empty_Universal_String;
end if;
end Get_Submitted_File_Name;
-----------
-- Write --
-----------
not overriding procedure Write
(Self : Abstract_Parameter;
File_Name : League.Strings.Universal_String)
is
use type Ada.Streams.Stream_Element_Offset;
Input : constant access Ada.Streams.Root_Stream_Type'Class
:= Abstract_Parameter'Class (Self).Get_Input_Stream;
Output : Ada.Streams.Stream_IO.File_Type;
Buffer : Ada.Streams.Stream_Element_Array (1 .. 4096);
Last : Ada.Streams.Stream_Element_Offset;
begin
if Input /= null then
Ada.Streams.Stream_IO.Create
(Output, Ada.Streams.Stream_IO.Out_File, File_Name.To_UTF_8_String);
-- File name is converted to UTF-8. Should works with GNAT on UNIX
-- with UTF-8 locales and Windows.
loop
Input.Read (Buffer, Last);
exit when Last < Buffer'First;
Ada.Streams.Stream_IO.Write
(Output, Buffer (Buffer'First .. Last));
end loop;
Ada.Streams.Stream_IO.Close (Output);
end if;
end Write;
-----------
-- Write --
-----------
procedure Write
(Self : HTTP_Parameter'Class;
File_Name : League.Strings.Universal_String) is
begin
if Self.Parameter /= null then
Self.Parameter.Write (File_Name);
end if;
end Write;
end Servlet.HTTP_Parameters;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . S O F T _ L I N K S . T A S K I N G --
-- --
-- B o d y --
-- --
-- Copyright (C) 2004-2020, 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. --
-- --
------------------------------------------------------------------------------
pragma Style_Checks (All_Checks);
-- Turn off subprogram alpha ordering check, since we group soft link bodies
-- and dummy soft link bodies together separately in this unit.
with Ada.Exceptions;
with Ada.Exceptions.Is_Null_Occurrence;
with System.Task_Primitives.Operations;
with System.Tasking;
with System.Stack_Checking;
with System.Secondary_Stack;
package body System.Soft_Links.Tasking is
package STPO renames System.Task_Primitives.Operations;
package SSL renames System.Soft_Links;
use Ada.Exceptions;
use type System.Secondary_Stack.SS_Stack_Ptr;
use type System.Tasking.Task_Id;
use type System.Tasking.Termination_Handler;
----------------
-- Local Data --
----------------
Initialized : Boolean := False;
-- Boolean flag that indicates whether the tasking soft links have
-- already been set.
-----------------------------------------------------------------
-- Tasking Versions of Services Needed by Non-Tasking Programs --
-----------------------------------------------------------------
function Get_Jmpbuf_Address return Address;
procedure Set_Jmpbuf_Address (Addr : Address);
-- Get/Set Jmpbuf_Address for current task
function Get_Sec_Stack return SST.SS_Stack_Ptr;
procedure Set_Sec_Stack (Stack : SST.SS_Stack_Ptr);
-- Get/Set location of current task's secondary stack
procedure Timed_Delay_T (Time : Duration; Mode : Integer);
-- Task-safe version of SSL.Timed_Delay
procedure Task_Termination_Handler_T (Excep : SSL.EO);
-- Task-safe version of the task termination procedure
function Get_Stack_Info return Stack_Checking.Stack_Access;
-- Get access to the current task's Stack_Info
--------------------------
-- Soft-Link Get Bodies --
--------------------------
function Get_Jmpbuf_Address return Address is
begin
return STPO.Self.Common.Compiler_Data.Jmpbuf_Address;
end Get_Jmpbuf_Address;
function Get_Sec_Stack return SST.SS_Stack_Ptr is
begin
return Result : constant SST.SS_Stack_Ptr :=
STPO.Self.Common.Compiler_Data.Sec_Stack_Ptr
do
pragma Assert (Result /= null);
end return;
end Get_Sec_Stack;
function Get_Stack_Info return Stack_Checking.Stack_Access is
begin
return STPO.Self.Common.Compiler_Data.Pri_Stack_Info'Access;
end Get_Stack_Info;
--------------------------
-- Soft-Link Set Bodies --
--------------------------
procedure Set_Jmpbuf_Address (Addr : Address) is
begin
STPO.Self.Common.Compiler_Data.Jmpbuf_Address := Addr;
end Set_Jmpbuf_Address;
procedure Set_Sec_Stack (Stack : SST.SS_Stack_Ptr) is
begin
STPO.Self.Common.Compiler_Data.Sec_Stack_Ptr := Stack;
end Set_Sec_Stack;
-------------------
-- Timed_Delay_T --
-------------------
procedure Timed_Delay_T (Time : Duration; Mode : Integer) is
Self_Id : constant System.Tasking.Task_Id := STPO.Self;
begin
-- In case pragma Detect_Blocking is active then Program_Error
-- must be raised if this potentially blocking operation
-- is called from a protected operation.
if System.Tasking.Detect_Blocking
and then Self_Id.Common.Protected_Action_Nesting > 0
then
raise Program_Error with "potentially blocking operation";
else
Abort_Defer.all;
STPO.Timed_Delay (Self_Id, Time, Mode);
Abort_Undefer.all;
end if;
end Timed_Delay_T;
--------------------------------
-- Task_Termination_Handler_T --
--------------------------------
procedure Task_Termination_Handler_T (Excep : SSL.EO) is
Self_Id : constant System.Tasking.Task_Id := STPO.Self;
Cause : System.Tasking.Cause_Of_Termination;
EO : Ada.Exceptions.Exception_Occurrence;
begin
-- We can only be here because we are terminating the environment task.
-- Task termination for all other tasks is handled in the Task_Wrapper.
-- We do not want to enable this check and e.g. call System.OS_Lib.Abort
-- here because some restricted run-times may not have System.OS_Lib
-- and calling abort may do more harm than good to the main application.
pragma Assert (Self_Id = STPO.Environment_Task);
-- Normal task termination
if Is_Null_Occurrence (Excep) then
Cause := System.Tasking.Normal;
Ada.Exceptions.Save_Occurrence (EO, Ada.Exceptions.Null_Occurrence);
-- Abnormal task termination
elsif Exception_Identity (Excep) = Standard'Abort_Signal'Identity then
Cause := System.Tasking.Abnormal;
Ada.Exceptions.Save_Occurrence (EO, Ada.Exceptions.Null_Occurrence);
-- Termination because of an unhandled exception
else
Cause := System.Tasking.Unhandled_Exception;
Ada.Exceptions.Save_Occurrence (EO, Excep);
end if;
-- There is no need for explicit protection against race conditions for
-- this part because it can only be executed by the environment task
-- after all the other tasks have been finalized. Note that there is no
-- fall-back handler which could apply to this environment task because
-- it has no parents, and, as specified in ARM C.7.3 par. 9/2, "the
-- fall-back handler applies only to the dependent tasks of the task".
if Self_Id.Common.Specific_Handler /= null then
Self_Id.Common.Specific_Handler.all (Cause, Self_Id, EO);
end if;
end Task_Termination_Handler_T;
-----------------------------
-- Init_Tasking_Soft_Links --
-----------------------------
procedure Init_Tasking_Soft_Links is
begin
-- Set links only if not set already
if not Initialized then
-- Mark tasking soft links as initialized
Initialized := True;
-- The application being executed uses tasking so that the tasking
-- version of the following soft links need to be used.
SSL.Get_Jmpbuf_Address := Get_Jmpbuf_Address'Access;
SSL.Set_Jmpbuf_Address := Set_Jmpbuf_Address'Access;
SSL.Get_Sec_Stack := Get_Sec_Stack'Access;
SSL.Get_Stack_Info := Get_Stack_Info'Access;
SSL.Set_Sec_Stack := Set_Sec_Stack'Access;
SSL.Timed_Delay := Timed_Delay_T'Access;
SSL.Task_Termination_Handler := Task_Termination_Handler_T'Access;
-- No need to create a new secondary stack, since we will use the
-- default one created in s-secsta.adb.
SSL.Set_Sec_Stack (SSL.Get_Sec_Stack_NT);
SSL.Set_Jmpbuf_Address (SSL.Get_Jmpbuf_Address_NT);
end if;
pragma Assert (Get_Sec_Stack /= null);
end Init_Tasking_Soft_Links;
end System.Soft_Links.Tasking;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --
-- 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.Scripts.Collections is
pragma Preelaborate;
package Standard_Profile_L2_Script_Collections is
new AMF.Generic_Collections
(Standard_Profile_L2_Script,
Standard_Profile_L2_Script_Access);
type Set_Of_Standard_Profile_L2_Script is
new Standard_Profile_L2_Script_Collections.Set with null record;
Empty_Set_Of_Standard_Profile_L2_Script : constant Set_Of_Standard_Profile_L2_Script;
type Ordered_Set_Of_Standard_Profile_L2_Script is
new Standard_Profile_L2_Script_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_Standard_Profile_L2_Script : constant Ordered_Set_Of_Standard_Profile_L2_Script;
type Bag_Of_Standard_Profile_L2_Script is
new Standard_Profile_L2_Script_Collections.Bag with null record;
Empty_Bag_Of_Standard_Profile_L2_Script : constant Bag_Of_Standard_Profile_L2_Script;
type Sequence_Of_Standard_Profile_L2_Script is
new Standard_Profile_L2_Script_Collections.Sequence with null record;
Empty_Sequence_Of_Standard_Profile_L2_Script : constant Sequence_Of_Standard_Profile_L2_Script;
private
Empty_Set_Of_Standard_Profile_L2_Script : constant Set_Of_Standard_Profile_L2_Script
:= (Standard_Profile_L2_Script_Collections.Set with null record);
Empty_Ordered_Set_Of_Standard_Profile_L2_Script : constant Ordered_Set_Of_Standard_Profile_L2_Script
:= (Standard_Profile_L2_Script_Collections.Ordered_Set with null record);
Empty_Bag_Of_Standard_Profile_L2_Script : constant Bag_Of_Standard_Profile_L2_Script
:= (Standard_Profile_L2_Script_Collections.Bag with null record);
Empty_Sequence_Of_Standard_Profile_L2_Script : constant Sequence_Of_Standard_Profile_L2_Script
:= (Standard_Profile_L2_Script_Collections.Sequence with null record);
end AMF.Standard_Profile_L2.Scripts.Collections;
|
------------------------------------------------------------------------------
-- --
-- THIS IS AN AUTOMATICALLY GENERATED FILE! DO NOT EDIT! --
-- --
-- WAVEFILES --
-- --
-- Wavefile data I/O operations --
-- --
-- The MIT License (MIT) --
-- --
-- Copyright (c) 2015 -- 2021 Gustavo A. Hoffmann --
-- --
-- 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. --
------------------------------------------------------------------------------
generic
type Wav_Sample is digits <>;
type Channel_Range is (<>);
type Wav_MC_Sample is array (Channel_Range range <>) of Wav_Sample;
package Audio.Wavefiles.Generic_Direct_Float_Wav_IO is
function Wav_Format_Matches (WF : Wavefile) return Boolean
with Ghost;
function Get (WF : in out Wavefile) return Wav_MC_Sample
with Inline, Pre => Mode (WF) = In_File
and then Wav_Format_Matches (WF);
procedure Get (WF : in out Wavefile;
Wav : out Wav_MC_Sample)
with Inline, Pre => Mode (WF) = In_File
and then Wav_Format_Matches (WF);
procedure Put (WF : in out Wavefile;
Wav : Wav_MC_Sample)
with Inline,
Pre => Mode (WF) = Out_File
and then Wav'Length >= Number_Of_Channels (WF)
and then Wav_Format_Matches (WF);
private
function Wav_Format_Matches (WF : Wavefile) return Boolean is
(To_Positive (WF.Bit_Depth) = Wav_Sample'Size
and then WF.Format_Of_Wavefile.Is_Float_Format);
end Audio.Wavefiles.Generic_Direct_Float_Wav_IO;
|
-- { dg-do compile }
-- { dg-options "-O" }
with Unchecked_Conversion;
with System; use System;
with Opt58_Pkg; use Opt58_Pkg;
procedure Opt58 is
function Convert is new Unchecked_Conversion (Integer, Rec);
Dword : Integer := 0;
I : Small_Int := F1 (Convert (Dword));
begin
if F2 (Null_Address, I = 0) then
null;
end if;
end Opt58;
|
-- Abstract:
--
-- See spec.
--
-- Copyright (C) 1997 - 2004, 2006, 2009, 2019 Free Software Foundation, Inc.
--
-- SAL 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. SAL 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 distributed with SAL; see
-- file COPYING. If not, write to the Free Software Foundation, 59
-- Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--
-- As a special exception, if other files instantiate generics from
-- SAL, or you link SAL object files with other files to produce
-- an executable, that does not by itself cause the resulting
-- executable to be covered by the GNU General Public License. This
-- exception does not however invalidate any other reasons why the
-- executable file might be covered by the GNU Public License.
--
package body SAL is
function Version return String is
begin
return "SAL 3.2";
end Version;
end SAL;
|
--
-- Copyright 2018 The wookey project team <wookey@ssi.gouv.fr>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with ada.unchecked_conversion;
with ewok.tasks; use ewok.tasks;
with ewok.tasks.debug;
with ewok.tasks_shared; use ewok.tasks_shared;
with ewok.devices_shared; use ewok.devices_shared;
with ewok.sched;
with ewok.debug;
with ewok.interrupts;
with soc.interrupts;
with m4.scb;
package body ewok.mpu.handler
with spark_mode => off
is
function memory_fault_handler
(frame_a : t_stack_frame_access)
return t_stack_frame_access
is
#if not CONFIG_KERNEL_PANIC_FREEZE
new_frame_a : t_stack_frame_access
#end if;
begin
if m4.scb.SCB.CFSR.MMFSR.MMARVALID then
pragma DEBUG (debug.log (debug.ERROR,
"MPU: MMFAR.ADDRESS = " &
system_address'image (m4.scb.SCB.MMFAR.ADDRESS)));
end if;
if m4.scb.SCB.CFSR.MMFSR.MLSPERR then
pragma DEBUG (debug.log (debug.ERROR,
"MPU: MemManage fault during floating-point lazy state preservation"));
end if;
if m4.scb.SCB.CFSR.MMFSR.MSTKERR then
pragma DEBUG (debug.log (debug.ERROR,
"MPU: stacking for an exception entry has caused access violation"));
end if;
if m4.scb.SCB.CFSR.MMFSR.MUNSTKERR then
pragma DEBUG (debug.log (debug.ERROR,
"MPU: unstack for an exception return has caused access violation"));
end if;
if m4.scb.SCB.CFSR.MMFSR.DACCVIOL then
pragma DEBUG (debug.log (debug.ERROR,
"MPU: the processor attempted a load or store at a location that does not permit the operation"));
end if;
if m4.scb.SCB.CFSR.MMFSR.IACCVIOL then
pragma DEBUG (debug.log (debug.ERROR,
"MPU: the processor attempted an instruction fetch from a location that does not permit execution"));
end if;
pragma DEBUG (ewok.tasks.debug.crashdump (frame_a));
-- On memory fault, the task is not scheduled anymore
ewok.tasks.set_state
(ewok.sched.get_current, TASK_MODE_MAINTHREAD, ewok.tasks.TASK_STATE_FAULT);
#if CONFIG_KERNEL_PANIC_FREEZE
debug.panic ("Memory fault!");
return frame_a;
#else
new_frame_a := ewok.sched.do_schedule (frame_a);
return new_frame_a;
#end if;
end memory_fault_handler;
procedure init
is
ok : boolean;
begin
ewok.interrupts.set_task_switching_handler
(soc.interrupts.INT_MEMMANAGE,
memory_fault_handler'access,
ID_KERNEL,
ID_DEV_UNUSED,
ok);
if not ok then raise program_error; end if;
end init;
end ewok.mpu.handler;
|
-----------------------------------------------------------------------
-- Util-strings-builders -- Set of strings
-- Copyright (C) 2013 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Texts.Builders;
-- The <b>Util.Strings.Builders</b> package provides an instantiation
-- of a text builders for <tt>Character</tt> and <tt>String</tt> types.
package Util.Strings.Builders is new Util.Texts.Builders
(Element_Type => Character,
Input => String);
|
with
Ada.Integer_Text_IO,
Ada.Text_IO;
with
JSA.Intermediate_Backups;
package body JSA.Tests.Intermediate_Backups is
overriding
procedure Initialize (T : in out Test) is
use Ahven.Framework;
begin
T.Set_Name ("Intermediate backups");
Add_Test_Routine (T, Run'Access, "Run");
end Initialize;
procedure Run is
Counter : Natural := 0;
procedure Save_Counter;
procedure Save_Counter is
begin
Ada.Text_IO.Put ("Backup of counter: ");
Ada.Integer_Text_IO.Put (Counter);
Ada.Text_IO.New_Line;
end Save_Counter;
package Backups is
new JSA.Intermediate_Backups (Fraction => 0.01,
Save_State => Save_Counter);
begin
Backups.Begin_Loop;
for I in 1 .. 1_000 loop
Counter := Counter + 1;
for J in 1 .. 100_000 loop
if J mod 2 = 0 then
Counter := Counter + 1;
else
Counter := Counter - 1;
end if;
end loop;
Backups.End_Of_Iteration;
end loop;
Backups.End_Loop;
end Run;
end JSA.Tests.Intermediate_Backups;
|
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
package body File_Block_Drivers is
----------
-- Read --
----------
overriding
function Read
(This : in out File_Block_Driver;
Block_Number : UInt64;
Data : out Block)
return Boolean
is
begin
if This.File.Seek (IO_Count (Block_Number * 512)) /= Status_Ok then
return False;
end if;
return This.File.Read (Data) = Status_Ok;
end Read;
----------
-- Read --
----------
overriding
function Write
(This : in out File_Block_Driver;
Block_Number : UInt64;
Data : Block)
return Boolean
is
begin
if This.File.Seek (IO_Count (Block_Number * 512)) /= Status_Ok then
return False;
end if;
return This.File.Write (Data) = Status_Ok;
end Write;
end File_Block_Drivers;
|
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Statements;
with Program.Elements.Defining_Identifiers;
with Program.Lexical_Elements;
with Program.Element_Vectors;
with Program.Elements.Exception_Handlers;
with Program.Elements.Identifiers;
package Program.Elements.Block_Statements is
pragma Pure (Program.Elements.Block_Statements);
type Block_Statement is
limited interface and Program.Elements.Statements.Statement;
type Block_Statement_Access is access all Block_Statement'Class
with Storage_Size => 0;
not overriding function Statement_Identifier
(Self : Block_Statement)
return Program.Elements.Defining_Identifiers.Defining_Identifier_Access
is abstract;
not overriding function Declarations
(Self : Block_Statement)
return Program.Element_Vectors.Element_Vector_Access is abstract;
not overriding function Statements
(Self : Block_Statement)
return not null Program.Element_Vectors.Element_Vector_Access
is abstract;
not overriding function Exception_Handlers
(Self : Block_Statement)
return Program.Elements.Exception_Handlers
.Exception_Handler_Vector_Access is abstract;
not overriding function End_Statement_Identifier
(Self : Block_Statement)
return Program.Elements.Identifiers.Identifier_Access is abstract;
type Block_Statement_Text is limited interface;
type Block_Statement_Text_Access is access all Block_Statement_Text'Class
with Storage_Size => 0;
not overriding function To_Block_Statement_Text
(Self : in out Block_Statement)
return Block_Statement_Text_Access is abstract;
not overriding function Colon_Token
(Self : Block_Statement_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Declare_Token
(Self : Block_Statement_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Begin_Token
(Self : Block_Statement_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Exception_Token
(Self : Block_Statement_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function End_Token
(Self : Block_Statement_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Semicolon_Token
(Self : Block_Statement_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Block_Statements;
|
-- { dg-do compile }
pragma Restrictions(No_Elaboration_Code);
with System;
package Elab1 is
type Ptrs_Type is array (Integer range 1 .. 2) of System.Address;
type Vars_Array is array (Integer range 1 .. 2) of Integer;
Vars : Vars_Array;
Val1 : constant Integer := 1;
Val2 : constant Integer := 2;
Ptrs : constant Ptrs_Type :=
(1 => Vars (Val1)'Address,
2 => Vars (Val2)'Address);
end Elab1;
|
with Ada.Numerics.Generic_Elementary_Functions;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Containers.Hashed_Maps; use Ada.Containers;
with System.Machine_Code; use System.Machine_Code;
with Ada.Text_IO; use Ada.Text_IO;
package body vm is
objectFileLength : Natural := 0;
-- initialize our virtual YOTROC machine. Zeroes memory and loads the program
-- into memory.
procedure boot(objectFile : in MachineCodeVector.Vector) is
begin
-- start with zeroized registers
for i in regs'Range loop
regs(i) := 0;
end loop;
-- and memory
for i in memory'Range loop
memory(i) := 0;
end loop;
-- and load the program
for i in 0 .. objectFile.Length - 1 loop
memory(Integer(i)) := objectFile.Element(Integer(i));
end loop;
regs(PC) := 0;
objectFileLength := Natural(objectFile.Length);
end boot;
procedure dumpRegs is
begin
for i in Register'Range loop
Ada.Text_IO.Put_Line(Register'Image(i) & ": " & regs(i)'Image);
end loop;
end dumpRegs;
-- Execute the next instruction in our program
function step(msg : out Unbounded_String) return Boolean is
-- fetch an instruction from memory, and advance the program counter
-- by 8 bytes. Later, if a jump occurs, the ALU will rewrite it.
function fetch return Unsigned_64 is
ret : Unsigned_64;
begin
ret := memory(Integer(regs(pc)));
--Ada.Text_IO.Put_Line("CPU: Fetch " & toHexString(ret));
return memory(Integer(regs(pc)));
end fetch;
-- Given a word of machine code, execute it. This is a combined
-- Instruction-Decode / Execute / Writeback stage.
-- Return False if there was a fatal error or if we halt.
function ID_EX_WB(code : in Unsigned_64) return Boolean is
type sourceType is (FromRegister, FromMemory, FromImmediate);
type destType is (ToRegister, ToMemory);
-- Variant records for keeping track of sources/destinations
type Source (from : sourceType := FromMemory) is
record
case from is
when FromRegister =>
sourceReg : Register;
when FromMemory =>
sourceAddr : Unsigned_64;
when FromImmediate =>
sourceBits : Unsigned_32;
end case;
end record;
type Destination (to : destType := ToMemory) is
record
case to is
when ToRegister =>
destReg : Register;
when ToMemory =>
destAddr : Unsigned_64;
end case;
end record;
opcode : Operators;
loadStoreOperandType : Unsigned_8 := 0;
offset : Integer;
source1 : Source;
source1val : Unsigned_64;
--source2 : Source;
--source2val : Unsigned_64;
dest : Destination;
-- For arithmetic type operations, we'll use these as indices into
-- the register file.
reg1 : Register := Register'Val(getByte(1, code));
reg2 : Register := Register'Val(getByte(2, code));
reg3 : Register := Register'Val(getByte(3, code));
-- For the immediate jump operations, go ahead and get the high bits now.
jmpLoc : Unsigned_32 := getHiWord(code);
begin
-- First, get the operator. It will be the low 6-bits of the instruction.
opcode := Operators'Val(Integer(code and 16#3F#));
-- Decode operands for load/store. Other instructions have operands
-- based on their opcode.
loadStoreOperandType := Unsigned_8(code and 16#C0#);
-- for loads, dest will be register in byte 1, source will be
-- dependent on loadStoreOperandType
if opcode in l8..l64 then
Ada.Text_IO.Put_Line("CPU decode load instruction: " & toHexString(code));
dest := (to => ToRegister, destReg => Register'Val(getByte(1,code)));
case loadStoreOperandType is
when loadStoreImmModifier =>
source1 := (from => FromImmediate,
sourceBits => getHiWord(code));
--regs(dest.destReg) := source1.sourceBits;
source1val := Unsigned_64(source1.sourceBits);
when loadStoreRegModifier =>
-- source register always in byte 2 for loads.
source1 := (from => FromRegister,
sourceReg => Register'Val(getByte(2,code)));
--regs(dest.destReg) := regs(source.sourceReg);
source1val := regs(source1.sourceReg);
when loadStoreIndModifier =>
source1 := (from => FromMemory,
sourceAddr => regs(Register'Val(getByte(2,code))));
--regs(dest.destReg) := memory(source1.sourceAddr);
source1val := memory(Integer(source1.sourceAddr));
when loadStoreDisModifier =>
offset := Integer(getHiWord(code));
source1 := (from => FromMemory,
-- OK, this is kind of ugly.
sourceAddr => Unsigned_64(Integer(regs(Register'Val(getByte(2,code)))) + offset));
--regs(dest.destReg) := memory(source1.sourceAddr);
source1val := memory(Integer(source1.sourceAddr));
when others =>
msg := To_Unbounded_String("CPU load ERROR: unrecognized operand type. Instruction: " & toHexString(code));
return False;
end case;
-- now perform the load
case opcode is
when l8 =>
-- copy lower 8 bits into register
regs(dest.destReg) := regs(dest.destReg) and 16#FFFF_FFFF_FFFF_FF00#;
regs(dest.destReg) := regs(dest.destReg) or (16#0000_0000_0000_00FF#
and source1val);
when l16 =>
-- copy lower 16 bits into register
regs(dest.destReg) := regs(dest.destReg) and 16#FFFF_FFFF_FFFF_0000#;
regs(dest.destReg) := regs(dest.destReg) or (16#0000_0000_0000_FFFF#
and source1val);
when l32 =>
-- copy lower 32 bits into register
regs(dest.destReg) := regs(dest.destReg) and 16#FFFF_FFFF_0000_0000#;
regs(dest.destReg) := regs(dest.destReg) or (16#0000_0000_FFFF_FFFF#
and source1val);
when l32u =>
-- copy upper 32 bits into register
regs(dest.destReg) := regs(dest.destReg) and 16#0000_0000_FFFF_FFFF#;
regs(dest.destReg) := regs(dest.destReg) or Shift_Left(source1val, 32);
when l64 =>
regs(dest.destReg) := source1val;
when others =>
msg := To_Unbounded_String("CPU load ERROR: unrecognized load opcode. Instruction: " & toHexString(code));
return False;
end case;
return True;
end if;
-- for stores, source will be register in byte 1, dest will be
-- dependent on loadStoreOperandType
if opcode in s8..s64 then
Ada.Text_IO.Put_Line("CPU decode store instruction: " & toHexString(code));
source1 := (from => FromRegister, sourceReg => Register'Val(getByte(1,code)));
case loadStoreOperandType is
when loadStoreIndModifier =>
dest := (to => ToMemory,
destAddr => regs(Register'Val(getByte(2,code))));
source1val := regs(source1.sourceReg);
when loadStoreDisModifier =>
offset := Integer(getHiWord(code));
dest := (to => ToMemory,
destAddr => Unsigned_64(Integer(regs(Register'Val(getByte(2,code)))) + offset));
source1val := regs(source1.sourceReg);
when others =>
msg := To_Unbounded_String("CPU store ERROR: illegal instruction: " & toHexString(code));
return False;
end case;
-- now perform the store
case opcode is
when s8 =>
-- copy lower 8 bits into memory
memory(Integer(dest.destAddr)) := memory(Integer(dest.destAddr)) and 16#FFFF_FFFF_FFFF_FF00#;
memory(Integer(dest.destAddr)) := memory(Integer(dest.destAddr)) or (16#0000_0000_0000_00FF#
and source1val);
when s16 =>
-- copy lower 16 bits into memory
memory(Integer(dest.destAddr)) := memory(Integer(dest.destAddr)) and 16#FFFF_FFFF_FFFF_0000#;
memory(Integer(dest.destAddr)) := memory(Integer(dest.destAddr)) or (16#0000_0000_0000_FFFF#
and source1val);
when s32 =>
-- copy lower 32 bits into memory
memory(Integer(dest.destAddr)) := memory(Integer(dest.destAddr)) and 16#FFFF_FFFF_0000_0000#;
memory(Integer(dest.destAddr)) := memory(Integer(dest.destAddr)) or (16#0000_0000_FFFF_FFFF#
and source1val);
when l64 =>
memory(Integer(dest.destAddr)) := source1val;
when others =>
msg := To_Unbounded_String("CPU store ERROR: unrecognized load opcode. Instruction: " & toHexString(code));
return False;
end case;
return True;
end if;
-- Handle other instruction individually
case opcode is
when relax =>
return True; -- skip this round
when avast =>
msg := To_Unbounded_String("CPU Execution Halted with avast at address " & toHexString(regs(pc)));
return False; -- halt operation
when ret =>
-- return from function. Shorthand for jump to link reg (r63)
regs(pc) := regs(r63);
when btc =>
-- clear a bit
declare
curVal : Unsigned_64 := regs(reg1);
mask : Unsigned_64 := not Shift_Left(1, Integer(getByte(2, code)));
begin
regs(reg1) := curVal and mask;
end;
when bts =>
-- set a bit
declare
curVal : Unsigned_64 := regs(reg1);
mask : Unsigned_64 := Shift_Left(1, Integer(getByte(2, code)));
begin
regs(reg1) := curVal or mask;
end;
when tb =>
-- test whether a bit is set or not
declare
curVal : Unsigned_64 := regs(reg1);
mask : Unsigned_64 := Shift_Left(1, Integer(getByte(2, code)));
begin
if (curVal and mask) = 0 then
flags.zero := True;
else
flags.zero := False;
end if;
end;
-- Arithmetic operations. Note we don't check for overflow, sign
-- bits, or make sure that the appropriate registers are being used.
when add =>
regs(reg1) := regs(reg2) + regs(reg3);
when fadd =>
regs(reg1) := rawLongFloatBits(toDouble(regs(reg2)) + toDouble(regs(reg3)));
when sub =>
regs(reg1) := regs(reg2) - regs(reg3);
when fsub =>
regs(reg1) := rawLongFloatBits(toDouble(regs(reg2)) - toDouble(regs(reg3)));
when mul =>
regs(reg1) := regs(reg2) * regs(reg3);
when fmul =>
regs(reg1) := rawLongFloatBits(toDouble(regs(reg2)) * toDouble(regs(reg3)));
when div =>
regs(reg1) := regs(reg2) / regs(reg3);
when fdiv =>
regs(reg1) := rawLongFloatBits(toDouble(regs(reg2)) / toDouble(regs(reg3)));
-- bitwise operations
when modb =>
regs(reg1) := regs(reg2) mod regs(reg3);
when orb =>
regs(reg1) := regs(reg2) or regs(reg3);
when andb =>
regs(reg1) := regs(reg2) and regs(reg3);
when xorb =>
regs(reg1) := regs(reg2) xor regs(reg3);
when int =>
compoundInterest : declare
package Exponentiation is new
Ada.Numerics.Generic_Elementary_Functions(Long_Float);
use Exponentiation;
interestRate : Long_Float := Long_Float(toDouble(regs(reg2)));
principal : Long_Float := Long_Float(toDouble(regs(reg1)));
years : Long_Float := Long_Float(toDouble(regs(reg3)));
result : Long_Float;
begin
result := principal * (1.0 + interestRate)**years;
Ada.Text_IO.Put_Line("int result: " & result'Image);
regs(reg1) := rawLongFloatBits(result);
end compoundInterest;
when knots =>
regs(reg1) := rawLongFloatBits(toDouble(regs(reg2)) * 0.869);
when miles =>
regs(reg1) := rawLongFloatBits(toDouble(regs(reg2)) * 1.151);
when itd =>
regs(reg1) := rawLongFloatBits(Long_Float(regs(reg2)));
when std =>
regs(reg1) := rawLongFloatBits(Long_Float(fromFloatImmediate(util.getLoWord(regs(reg1)))));
when cb =>
-- count set bits in this register
declare
tmp : Unsigned_64;
count : Unsigned_64;
begin
tmp := regs(reg2);
Asm("popcnt %1, %0", Inputs => Unsigned_64'Asm_Input("r", tmp),
Outputs => Unsigned_64'Asm_Output("=r", count));
regs(reg1) := count;
end;
when shll =>
regs(reg1) := Shift_Left(regs(reg1), Integer(regs(reg2)));
when shrl =>
regs(reg1) := Shift_Right(regs(reg1), Integer(regs(reg2)));
when cmp =>
if regs(reg1) > regs(reg2) then
flags.gt := True;
flags.lt := False;
flags.eq := False;
elsif regs(reg1) < regs(reg2) then
flags.gt := False;
flags.lt := True;
flags.eq := False;
else
flags.gt := False;
flags.lt := False;
flags.eq := True;
end if;
when notb =>
regs(reg1) := not regs(reg1);
-- Branches
when jmp =>
-- need to be careful about off-by-8 errors here.
regs(pc) := regs(reg1);
when jz =>
if flags.zero then
regs(pc) := regs(reg1);
end if;
when jeq =>
if flags.eq then
regs(pc) := regs(reg1);
end if;
when jne =>
if not flags.eq then
regs(pc) := regs(reg1);
end if;
when jlt =>
if flags.lt then
regs(pc) := regs(reg1);
end if;
when jgt =>
if flags.gt then
regs(pc) := regs(reg1);
end if;
when call =>
regs(r63) := regs(pc); -- store addr of next instruction in link reg.
-- PC has already been advanced above.
regs(pc) := regs(reg1);
when jmpa =>
regs(pc) := Unsigned_64(jmpLoc);
when jza =>
if flags.zero then
regs(pc) := Unsigned_64(jmpLoc);
end if;
when jeqa =>
if flags.eq then
regs(pc) := Unsigned_64(jmpLoc);
end if;
when jnea =>
if not flags.eq then
regs(pc) := Unsigned_64(jmpLoc);
end if;
when jlta =>
if flags.lt then
regs(pc) := Unsigned_64(jmpLoc);
end if;
when jgta =>
if flags.gt then
regs(pc) := Unsigned_64(jmpLoc);
end if;
when others =>
msg := To_Unbounded_String("CPU Execute ERROR: illegal instruction " & toHexString(code));
return False;
end case;
-- If we did an arithmetic-ish operation, if it results in the first
-- reg being zero, then go ahead and set the zero flag.
if opcode in btc .. notb then
if regs(reg1) = 0 then
flags.zero := True;
end if;
end if;
return True;
end ID_EX_WB;
code : Unsigned_64;
begin
-- set zero register before each instruction so writes won't matter
regs(z) := 0;
code := fetch;
Ada.Text_IO.Put_Line("CPU fetched: instruction " & toHexString(code) & " from addr " & toHexString(regs(pc)));
-- advance the PC after we fetch the instruction. If there are any jumps
-- in the ALU, they will change it.
regs(pc) := regs(pc) + 1;
return ID_EX_WB(code);
end step;
-- Keep running the program.
--procedure execute is
--begin
-- flags.zero := False;
-- flags.lt := False;
-- flags.gt := False;
-- flags.eq := False;
-- flags.overflow := False;
-- flags.sign := False;
-- flags.carry := False;
--
-- InstructionLoop : loop
-- if not step then
-- return;
-- end if;
-- -- delay here a half-second between instructions for 2 reasons:
-- -- 1, if we put an infinite loop
-- -- in the code it is going to slow down our GUI a bunch, and 2,
-- -- it lets us follow along as the code runs.
-- delay 0.5;
-- -- this is just the fetch-decode-execution cycle, if there's a loop
-- -- in the program itself, it will continue to execute
-- exit InstructionLoop when regs(pc) > Unsigned_64(objectFileLength);
-- end loop InstructionLoop;
-- end execute;
end vm;
|
-- -----------------------------------------------------------------------------
-- smk, the smart make (http://lionel.draghi.free.fr/smk/)
-- © 2018, 2019 Lionel Draghi <lionel.draghi@free.fr>
-- SPDX-License-Identifier: APSL-2.0
-- -----------------------------------------------------------------------------
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
-- http://www.apache.org/licenses/LICENSE-2.0
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-- -----------------------------------------------------------------------------
with Smk.Files; use Smk.Files;
private package Smk.Runs.Strace_Analyzer is
-- --------------------------------------------------------------------------
type Line_Type is (Read_Call,
Write_Call,
Read_Write_Call,
Exec_Call,
Ignored);
-- --------------------------------------------------------------------------
type Operation_Kind is (None,
Read,
Write,
Delete,
Move);
-- --------------------------------------------------------------------------
type Operation_Type (Kind : Operation_Kind := None) is record
case Kind is
when None => null;
when Read
| Write
| Delete =>
Name : File_Name;
File : File_Type;
when Move =>
Source_Name : File_Name;
Source : File_Type;
Target_Name : File_Name;
Target : File_Type;
end case;
end record;
-- --------------------------------------------------------------------------
procedure Analyze_Line (Line : in String;
Operation : out Operation_Type);
-- Here is the kind of output from strace that we process here:
--
-- 19171 rename("x.mp3", "Luke-Sentinelle.mp3") = 0
-- 4372 openat(AT_FDCWD, "/tmp/ccHKHv8W.s", O_RDWR|O_CREAT ...
-- 12345 open("xyzzy", O_WRONLY|O_APPEND|O_CREAT, 0666) = 3
-- 15165 unlinkat(5</home/lionel/.slocdata/top_dir>, "filelist", 0) = 0
-- 15168 openat(AT_FDCWD, "/home/lionel/.sl", O_RDONLY <unfinished ...>
-- 15167 <... stat resumed> {st_mode=S_IFREG|0755, st_size=122224, ...}) = 0
-- 15232 renameat2(AT_FDCWD, "all.filect.new", AT_FDCWD, "all.filect"...
-- 15214 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, ...
-- 7120 mkdir("dir1", 0777) = 0
end Smk.Runs.Strace_Analyzer;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --
-- 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_Lifelines is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Lifeline_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_Lifeline
(AMF.UML.Lifelines.UML_Lifeline_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Lifeline_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_Lifeline
(AMF.UML.Lifelines.UML_Lifeline_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Lifeline_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_Lifeline
(Visitor,
AMF.UML.Lifelines.UML_Lifeline_Access (Self),
Control);
end if;
end Visit_Element;
--------------------
-- Get_Covered_By --
--------------------
overriding function Get_Covered_By
(Self : not null access constant UML_Lifeline_Proxy)
return AMF.UML.Interaction_Fragments.Collections.Set_Of_UML_Interaction_Fragment is
begin
return
AMF.UML.Interaction_Fragments.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Covered_By
(Self.Element)));
end Get_Covered_By;
-----------------------
-- Get_Decomposed_As --
-----------------------
overriding function Get_Decomposed_As
(Self : not null access constant UML_Lifeline_Proxy)
return AMF.UML.Part_Decompositions.UML_Part_Decomposition_Access is
begin
return
AMF.UML.Part_Decompositions.UML_Part_Decomposition_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Decomposed_As
(Self.Element)));
end Get_Decomposed_As;
-----------------------
-- Set_Decomposed_As --
-----------------------
overriding procedure Set_Decomposed_As
(Self : not null access UML_Lifeline_Proxy;
To : AMF.UML.Part_Decompositions.UML_Part_Decomposition_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Decomposed_As
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Decomposed_As;
---------------------
-- Get_Interaction --
---------------------
overriding function Get_Interaction
(Self : not null access constant UML_Lifeline_Proxy)
return AMF.UML.Interactions.UML_Interaction_Access is
begin
return
AMF.UML.Interactions.UML_Interaction_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Interaction
(Self.Element)));
end Get_Interaction;
---------------------
-- Set_Interaction --
---------------------
overriding procedure Set_Interaction
(Self : not null access UML_Lifeline_Proxy;
To : AMF.UML.Interactions.UML_Interaction_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Interaction
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Interaction;
--------------------
-- Get_Represents --
--------------------
overriding function Get_Represents
(Self : not null access constant UML_Lifeline_Proxy)
return AMF.UML.Connectable_Elements.UML_Connectable_Element_Access is
begin
return
AMF.UML.Connectable_Elements.UML_Connectable_Element_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Represents
(Self.Element)));
end Get_Represents;
--------------------
-- Set_Represents --
--------------------
overriding procedure Set_Represents
(Self : not null access UML_Lifeline_Proxy;
To : AMF.UML.Connectable_Elements.UML_Connectable_Element_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Represents
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Represents;
------------------
-- Get_Selector --
------------------
overriding function Get_Selector
(Self : not null access constant UML_Lifeline_Proxy)
return AMF.UML.Value_Specifications.UML_Value_Specification_Access is
begin
return
AMF.UML.Value_Specifications.UML_Value_Specification_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Selector
(Self.Element)));
end Get_Selector;
------------------
-- Set_Selector --
------------------
overriding procedure Set_Selector
(Self : not null access UML_Lifeline_Proxy;
To : AMF.UML.Value_Specifications.UML_Value_Specification_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Selector
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Selector;
---------------------------
-- Get_Client_Dependency --
---------------------------
overriding function Get_Client_Dependency
(Self : not null access constant UML_Lifeline_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_Lifeline_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_Lifeline_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_Lifeline_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_Lifeline_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;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant UML_Lifeline_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_Lifeline_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_Lifeline_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_Lifeline_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_Lifeline_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_Lifeline_Proxy.Namespace";
return Namespace (Self);
end Namespace;
end AMF.Internals.UML_Lifelines;
|
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2018, Universidad Politécnica de Madrid --
-- --
-- This is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. This software is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public --
-- License for more details. You should have received a copy of the GNU --
-- General Public License distributed with this software; see file --
-- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy --
-- of the license. --
-- --
------------------------------------------------------------------------------
-- TMP36 temperature sensor reading
-- See TMP35/TMP36/TMP37 datasheet
package HK_Data.TMP36 is
type Temperature_Range is digits 5 range -40.0 .. +125.0;
function Temperature (R : Sensor_Reading) return Temperature_Range
with Inline;
end HK_Data.TMP36;
|
-- Lumen.Window -- Create and destroy native windows and associated OpenGL
-- rendering contexts
--
-- Chip Richards, NiEstu, Phoenix AZ, Spring 2010
-- This code is covered by the ISC License:
--
-- Copyright © 2010, NiEstu
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- The software is provided "as is" and the author disclaims all warranties
-- with regard to this software including all implied warranties of
-- merchantability and fitness. In no event shall the author be liable for any
-- special, direct, indirect, or consequential damages or any damages
-- whatsoever resulting from loss of use, data or profits, whether in an
-- action of contract, negligence or other tortious action, arising out of or
-- in connection with the use or performance of this software.
-- The declarations below include a minimal Xlib binding, adapted from code by
-- Hans-Frieder Vogt and Vadim Godunko. Their code was GPLv2, but I've raped
-- it so badly, and they haven't touched it in so long, that I feel okay about
-- including its derivation here. Also included is a minimal binding to GLX,
-- adapted from another bit of abandonware originally by David Holm. His
-- license was a different one still, and the above excuse also applies to it.
-- Environment
with Ada.Command_Line;
with Ada.Directories;
with Ada.Environment_Variables;
with Ada.Unchecked_Deallocation;
with System;
with GNAT.Case_Util;
-- This is really "part of" this package, just packaged separately so it can
-- be used in Events
with X11; use X11;
with Lumen.Events.Key_Translate; use Lumen.Events.Key_Translate;
package body Lumen.Window is
type X11Window_Type is new Window_Type with
record
Display : Display_Pointer := Null_Display_Pointer;
Window : Window_ID := 0;
Visual : X_Visual_Info_Pointer := null;
Context : GLX_Context := Null_Context;
end record;
type X11Window_Handle is access all X11Window_Type;
---------------------------------------------------------------------------
String_Encoding : String := "STRING" & ASCII.NUL;
------------------------------------------------------------------------
-- Convert an X modifier mask into a Lumen modifier set
function Modifier_Mask_To_Set (Mask : in Modifier_Mask)
return Modifier_Set is
begin -- Modifier_Mask_To_Set
return (
Mod_Shift => (Mask and Shift_Mask) /= 0,
Mod_Lock => (Mask and Lock_Mask) /= 0,
Mod_Control => (Mask and Control_Mask) /= 0,
Mod_1 => (Mask and Mod_1_Mask) /= 0,
Mod_2 => (Mask and Mod_2_Mask) /= 0,
Mod_3 => (Mask and Mod_3_Mask) /= 0,
Mod_4 => (Mask and Mod_4_Mask) /= 0,
Mod_5 => (Mask and Mod_5_Mask) /= 0,
Mod_Button_1 => (Mask and Button_1_Mask) /= 0,
Mod_Button_2 => (Mask and Button_2_Mask) /= 0,
Mod_Button_3 => (Mask and Button_3_Mask) /= 0,
Mod_Button_4 => (Mask and Button_4_Mask) /= 0,
Mod_Button_5 => (Mask and Button_5_Mask) /= 0
);
end Modifier_Mask_To_Set;
------------------------------------------------------------------------
-- Create a native window
procedure Create (Win : in out Window_Handle;
Parent : in Window_Handle := No_Window;
Width : in Natural := 400;
Height : in Natural := 400;
Name : in String := "";
Icon_Name : in String := "";
Class_Name : in String := "";
Instance_Name : in String := "";
Depth : in Color_Depth := True_Color;
Direct : in Boolean := True;
Animated : in Boolean := True;
Attributes : in Context_Attributes :=
Default_Context_Attributes) is
-- An extremely abbreviated version of the XMapEvent structure.
type Map_Event_Data is record
Event_Type : Integer;
Pad : Padding;
end record;
Structure_Notify_Mask : constant X_Event_Mask :=
2#0000_0010_0000_0000_0000_0000#; -- 17th bit, always want this one
-- Variables used in Create
Our_Context : GLX_Context;
Did : Character;
Display : Display_Pointer;
Mapped : Map_Event_Data;
Our_Parent : Window_ID;
Visual : X_Visual_Info_Pointer;
Win_Attributes : X_Set_Window_Attributes;
Window : Window_ID;
XWin : X11Window_Handle;
------------------------------------------------------------------------
-- Choose an X visual, either from an explicit ID given in the
-- LUMEN_VISUAL_ID environment variable, or by asking GLX to pick one.
procedure Choose_Visual is
use type System.Address;
---------------------------------------------------------------------
Con_Attributes : GLX_Attribute_List :=
(others => X11Context_Attribute_Name'Pos (Attr_None));
Con_Attr_Index : Positive := Con_Attributes'First;
---------------------------------------------------------------------
Visual_ID_EV : constant String := "LUMEN_VISUAL_ID";
GLX_FB_Config_ID : constant := 16#8013#; -- from glx.h
---------------------------------------------------------------------
-- GLX functions needed only by Choose_Visual, and then only when an
-- explicit visual ID is given in an environment variable
ID : Visual_ID;
Found : aliased Integer;
FB : FB_Config_Ptr;
---------------------------------------------------------------------
begin -- Choose_Visual
-- See if an explicit ID was given
if Ada.Environment_Variables.Exists (Visual_ID_EV) then
begin
-- Ugly hack to convert hex value
ID := Visual_ID'Value
("16#" &
Ada.Environment_Variables.Value (Visual_ID_EV) &
"#");
exception
when others =>
raise Invalid_ID;
end;
-- ID was given; try to use that ID to get the visual
Con_Attributes (Con_Attr_Index) := GLX_FB_Config_ID;
Con_Attr_Index := Con_Attr_Index + 1;
Con_Attributes (Con_Attr_Index) := Integer (ID);
Con_Attr_Index := Con_Attr_Index + 1;
Found := 9;
FB := GLX_Choose_FB_Config (Display,
X_Default_Screen (Display),
GLX_Attribute_List_Ptr
(Con_Attributes'Address),
Found'Unrestricted_Access);
if FB = null then
raise Not_Available;
end if;
Visual := GLX_Get_Visual_From_FB_Config (Display, FB.all);
else
declare
procedure PushAttr
(Attr : Integer) is
begin
Con_Attributes(Con_Attr_Index):=Attr;
Con_Attr_Index:=Con_Attr_Index+1;
end PushAttr;
---------------------------------------------------------------
begin
-- No explicit ID given, so ask GLX to pick one. Set up the
-- attributes array (first putting in our separately-specified
-- ones if given) and use it to get an appropriate visual.
if Depth = True_Color then
PushAttr(X11Context_Attribute_Name'Pos (Attr_RGBA));
end if;
if Animated then
PushAttr(X11Context_Attribute_Name'Pos (Attr_Doublebuffer));
end if;
PushAttr(X11Context_Attribute_Name'Pos(Attr_Red_Size));
PushAttr(Attributes.Red_Size);
PushAttr(X11Context_Attribute_Name'Pos(Attr_Green_Size));
PushAttr(Attributes.Green_Size);
PushAttr(X11Context_Attribute_Name'Pos(Attr_Blue_Size));
PushAttr(Attributes.Blue_Size);
PushAttr(X11Context_Attribute_Name'Pos(Attr_Alpha_Size));
PushAttr(Attributes.Alpha_Size);
PushAttr(X11Context_Attribute_Name'Pos(Attr_Depth_Size));
PushAttr(Attributes.Depth_Size);
PushAttr(X11Context_Attribute_Name'Pos(Attr_Stencil_Size));
PushAttr(Attributes.Stencil_Size);
PushAttr(0);
-- for Attr in Attributes'Range loop
-- Con_Attributes (Con_Attr_Index) :=
-- X11Context_Attribute_Name'Pos (Attributes (Attr).Name);
-- Con_Attr_Index := Con_Attr_Index + 1;
-- case Attributes (Attr).Name is
-- when Attr_None | Attr_Use_GL | Attr_RGBA |
-- Attr_Doublebuffer | Attr_Stereo =>
-- null; -- present or not, no value
-- when Attr_Level =>
-- Con_Attributes (Con_Attr_Index) :=
-- Attributes (Attr).Level;
-- Con_Attr_Index := Con_Attr_Index + 1;
-- when Attr_Buffer_Size | Attr_Aux_Buffers |
-- Attr_Depth_Size | Attr_Stencil_Size |
-- Attr_Red_Size | Attr_Green_Size | Attr_Blue_Size |
-- Attr_Alpha_Size | Attr_Accum_Red_Size |
-- Attr_Accum_Green_Size | Attr_Accum_Blue_Size |
-- Attr_Accum_Alpha_Size =>
-- Con_Attributes (Con_Attr_Index) :=
-- Attributes (Attr).Size;
-- Con_Attr_Index := Con_Attr_Index + 1;
-- end case;
-- end loop;
Visual := GLX_Choose_Visual (Display,
X_Default_Screen (Display),
GLX_Attribute_List_Ptr
(Con_Attributes'Address));
end;
end if;
end Choose_Visual;
------------------------------------------------------------------------
begin -- Create
-- Connect to the X server
Display := X_Open_Display;
if Display = Null_Display_Pointer then
raise Connection_Failed;
end if;
-- Choose a visual to use
Choose_Visual;
-- Make sure we actually found a visual to use
if Visual = null then
raise Not_Available;
end if;
-- Pick the parent window to use
if Parent = No_Window then
Our_Parent := X_Root_Window (Display, Visual.Screen);
else
Our_Parent := X11Window_Handle(Parent).Window;
end if;
-- type Event_Mask_Table is array (Wanted_Event) of X_Event_Mask;
-- Event_Masks : constant Event_Mask_Table :=
-- (Want_Key_Press => 2#0000_0000_0000_0000_0000_0001#,
-- Want_Key_Release => 2#0000_0000_0000_0000_0000_0010#,
-- Want_Button_Press => 2#0000_0000_0000_0000_0000_0100#,
-- Want_Button_Release => 2#0000_0000_0000_0000_0000_1000#,
-- Want_Window_Enter => 2#0000_0000_0000_0000_0001_0000#,
-- Want_Window_Leave => 2#0000_0000_0000_0000_0010_0000#,
-- Want_Pointer_Move => 2#0000_0000_0000_0000_0100_0000#,
-- Want_Pointer_Drag => 2#0000_0000_0010_0000_0000_0000#,
-- Want_Exposure => 2#0000_0000_1000_0000_0000_0000#,
-- Want_Focus_Change => 2#0010_0000_0000_0000_0000_0000#
-- );
-- Build the event mask as requested by the caller
Win_Attributes.Event_Mask := Structure_Notify_Mask or
2#0010_000_1010_000_0111_1111#;
-- Create the window and map it
Win_Attributes.Colormap := X_Create_Colormap (Display,
Our_Parent,
Visual.Visual,
Alloc_None);
Window := X_Create_Window (Display,
Our_Parent,
0,
0,
Dimension (Width),
Dimension (Height),
0,
Visual.Depth,
Input_Output,
Visual.Visual,
Configure_Colormap or Configure_Event_Mask,
Win_Attributes'Address);
X_Map_Window (Display, Window);
-- Wait for the window to be mapped
loop
X_Next_Event (Display, Mapped'Address);
exit when Mapped.Event_Type = X_Map_Notify;
end loop;
-- Tell the window manager that we want the close button sent to us
Delete_Window_Atom := X_Intern_Atom (Display, WM_Del'Address, 0);
X_Set_WM_Protocols (Display, Window, Delete_Window_Atom'Address, 1);
-- Figure out what we want to call the new window
declare
Application_Name : String :=
Ada.Directories.Simple_Name (Ada.Command_Line.Command_Name);
-- converted to mixed case shortly
App_Class_Name : String := Application_Name;
Class_String : System.Address;
Instance_String : System.Address;
Name_Property : X_Text_Property;
begin
GNAT.Case_Util.To_Mixed (App_Class_Name);
-- Set the window name
if Name'Length < 1 then
Name_Property := (Application_Name'Address,
X_Intern_Atom (Display,
String_Encoding'Address,
0),
Bits_8,
Application_Name'Length);
else
Name_Property := (Name'Address,
X_Intern_Atom (Display,
String_Encoding'Address,
0),
Bits_8,
Name'Length);
end if;
X_Set_WM_Name (Display, Window, Name_Property'Address);
-- Set the icon name
if Icon_Name'Length < 1 then
Name_Property := (Application_Name'Address,
X_Intern_Atom (Display,
String_Encoding'Address,
0),
Bits_8,
Application_Name'Length);
X_Set_Icon_Name (Display, Window, Application_Name'Address);
else
Name_Property := (Icon_Name'Address,
X_Intern_Atom (Display,
String_Encoding'Address,
0),
Bits_8,
Name'Length);
X_Set_Icon_Name (Display, Window, Icon_Name'Address);
end if;
X_Set_WM_Icon_Name (Display, Window, Name_Property'Address);
-- Set the class and instance names
if Class_Name'Length < 1 then
Class_String := App_Class_Name'Address;
else
Class_String := Class_Name'Address;
end if;
if Instance_Name'Length < 1 then
Instance_String := Application_Name'Address;
else
Instance_String := Instance_Name'Address;
end if;
X_Set_Class_Hint (Display, Window, (Class_String, Instance_String));
end;
-- Connect the OpenGL context to the new X window
Our_Context := GLX_Create_Context (Display,
Visual,
GLX_Context (System.Null_Address),
Character'Val (Boolean'Pos (Direct)));
if Our_Context = Null_Context then
raise Context_Failed with "Cannot create OpenGL context";
end if;
Did := GLX_Make_Current (Display, Window, Our_Context);
if Did /= GL_TRUE then
raise Context_Failed with "Cannot make OpenGL context current";
end if;
XWin := new X11Window_Type;
XWin.Display := Display;
XWin.Window := Window;
XWin.Visual := Visual;
XWin.Width := Width;
XWin.Height := Height;
XWin.Prior_Frame := Never;
XWin.App_Start := Ada.Calendar.Clock;
XWin.Last_Start := Ada.Calendar.Clock;
XWin.App_Frames := 0;
XWin.Last_Frames := 0;
XWin.SPF := 0.0;
XWin.Context := Our_Context;
XWin.Looping := True;
Win := Window_Handle(XWin);
end Create;
---------------------------------------------------------------------------
-- Destroy a native window, including its current rendering context.
procedure Destroy (Win : in out Window_Handle) is
XWin : constant X11Window_Handle := X11Window_Handle (Win);
procedure X_Destroy_Window (Display : in Display_Pointer;
Window : in Window_ID);
pragma Import (C, X_Destroy_Window, "XDestroyWindow");
procedure Free is new Ada.Unchecked_Deallocation (Window_Type'Class,
Window_Handle);
begin -- Destroy
X_Destroy_Window (XWin.Display, XWin.Window);
Free (Win);
end Destroy;
---------------------------------------------------------------------------
-- Set various textual names associated with a window. Null string means
-- leave the current value unchanged. In the case of class and instance
-- names, both must be given to change either one.
procedure Set_Names (Win : in Window_Handle;
Name : in String := "";
Icon_Name : in String := "";
Class_Name : in String := "";
Instance_Name : in String := "") is
XWin : constant X11Window_Handle := X11Window_Handle (Win);
Name_Property : X_Text_Property;
begin -- Set_Names
-- Set the window name if one was given
if Name'Length >= 1 then
Name_Property := (Name'Address,
X_Intern_Atom (XWin.Display,
String_Encoding'Address,
0),
Bits_8,
Name'Length);
X_Set_WM_Name (XWin.Display, XWin.Window, Name_Property'Address);
end if;
-- Set the icon name if one was given
if Icon_Name'Length >= 1 then
X_Set_Icon_Name (XWin.Display, XWin.Window, Icon_Name'Address);
Name_Property := (Icon_Name'Address,
X_Intern_Atom (XWin.Display,
String_Encoding'Address,
0),
Bits_8,
Name'Length);
X_Set_WM_Icon_Name (XWin.Display, XWin.Window, Name_Property'Address);
end if;
-- Set the class and instance names if they were both given
if Class_Name'Length >= 1 and Instance_Name'Length >= 1 then
X_Set_Class_Hint (XWin.Display,
XWin.Window,
(Class_Name'Address, Instance_Name'Address));
end if;
end Set_Names;
---------------------------------------------------------------------------
-- Select a window to use for subsequent OpenGL calls
procedure Make_Current (Win : in Window_Handle) is
XWin : constant X11Window_Handle := X11Window_Handle (Win);
begin -- Make_Current
if GLX_Make_Current (XWin.Display, XWin.Window, XWin.Context) /=
GL_TRUE
then
raise Context_Failed with "Cannot make given OpenGL context current";
end if;
end Make_Current;
---------------------------------------------------------------------------
-- Promotes the back buffer to front; only valid if the window is double
-- buffered, meaning Animated was true when the window was created. Useful
-- for smooth animation.
procedure Swap (Win : in Window_Handle) is
XWin : constant X11Window_Handle := X11Window_Handle (Win);
procedure GLX_Swap_Buffers (Display : in Display_Pointer;
Window : in Window_ID);
pragma Import (C, GLX_Swap_Buffers, "glXSwapBuffers");
begin -- Swap
GLX_Swap_Buffers (XWin.Display, XWin.Window);
end Swap;
---------------------------------------------------------------------------
-- Return current window width
function Width (Win : in Window_Handle) return Natural is
begin -- Width
return Win.Width;
end Width;
---------------------------------------------------------------------------
-- Return current window width
function Height (Win : in Window_Handle) return Natural is
begin -- Height
return Win.Height;
end Height;
---------------------------------------------------------------------------
procedure Resize (Win : in Window_Handle;
Width : in Positive;
Height : in Positive) is
XWin : constant X11Window_Handle := X11Window_Handle (Win);
begin -- Resize
X_Resize_Window (XWin.Display, XWin.Window, Width, Height);
end Resize;
---------------------------------------------------------------------------
procedure Warp_Pointer (Win: in Window_Handle;
X : in Natural;
Y : in Natural) is
XWin : constant X11Window_Handle := X11Window_Handle (Win);
begin -- Warp_Pointer
X_Warp_Pointer (XWin.Display,
XWin.Window,
XWin.Window,
0, 0, 0, 0,
Integer (X),
XWin.Height - Integer (Y + 1));
end Warp_Pointer;
---------------------------------------------------------------------------
procedure Get_Pointer (Win : in Window_Handle;
X : out Integer;
Y : out Integer;
Modifiers : out Modifier_Set) is
XWin : constant X11Window_Handle := X11Window_Handle (Win);
Root_Return : Window_Type;
Child_Return : Window_Type;
Root_X : Natural;
Root_Y : Natural;
Mask : Modifier_Mask;
begin -- Get_Pointer
X_Query_Pointer (XWin.Display,
XWin.Window,
Root_Return'Address,
Child_Return'Address,
Root_X'Address,
Root_Y'Address,
X'Address,
Y'Address,
Mask'Address);
Modifiers := Modifier_Mask_To_Set (Mask);
-- Make Y start at bottom instead of top.
Y := Win.Height - (Y + 1);
end Get_Pointer;
---------------------------------------------------------------------------
procedure Move_Window (Win : in Window_Handle;
X : in Natural;
Y : in Natural) is
XWin : constant X11Window_Handle := X11Window_Handle (Win);
begin -- Move_Window
X_Move_Window (XWin.Display, XWin.Window, X, Y);
end Move_Window;
---------------------------------------------------------------------------
procedure Raise_Window (Win : in Window_Handle) is
XWin : constant X11Window_Handle := X11Window_Handle (Win);
begin -- Raise_Window
X_Raise_Window (XWin.Display, XWin.Window);
end Raise_Window;
---------------------------------------------------------------------------
procedure Lower_Window (Win : in Window_Handle) is
XWin : constant X11Window_Handle := X11Window_Handle (Win);
begin -- Lower_Window
X_Lower_Window (XWin.Display, XWin.Window);
end Lower_Window;
---------------------------------------------------------------------------
-- Xlib stuff needed for our window info record
-- Convert a Key_Symbol into a Latin-1 character; raises Not_Character if
-- it's not possible. Character'Val is simpler.
function To_Character (Symbol : in Key_Symbol) return Character is
begin -- To_Character
if Symbol not in Key_Symbol (Character'Pos (Character'First)) ..
Key_Symbol (Character'Pos (Character'Last))
then
raise Not_Character;
end if;
return Character'Val (Natural (Symbol));
end To_Character;
---------------------------------------------------------------------------
-- Convert a Key_Symbol into a UTF-8 encoded string; raises Not_Character
-- if it's not possible. Really only useful for Latin-1 hibit chars, but
-- works for all Latin-1 chars.
-- Returns the number of events that are waiting in the event queue.
-- Useful for more complex event loops.
function Pending (Win : Window_Handle) return Natural is
XWin : constant X11Window_Handle := X11Window_Handle (Win);
begin -- Pending
return X_Pending (XWin.Display);
end Pending;
---------------------------------------------------------------------------
-- Retrieve the next input event from the queue and return it
function Next_Event (Win : in Window_Handle;
Translate : in Boolean := True)
return Boolean is
XWin : constant X11Window_Handle := X11Window_Handle (Win);
------------------------------------------------------------------------
X_Event : X_Event_Data;
Buffer : String (1 .. 1);
Got : Natural;
Key_Mods : Modifier_Set;
X_Keysym : Key_Symbol;
Key_Value : Key_Symbol;
Key_Type : Key_Category;
------------------------------------------------------------------------
begin -- Next_Event
-- Get the event from the X server
X_Next_Event (XWin.Display, X_Event'Address);
-- Guard against pathological X servers
if not X_Event.X_Event_Type'Valid then
return True;
-- return (Which => Unknown_Event);
end if;
-- Based on the event type, transfer and convert the event data
case X_Event.X_Event_Type is
when X_Key_Press | X_Key_Release =>
Key_Mods := Modifier_Mask_To_Set (X_Event.Key_State);
-- If caller wants keycode translation, ask X for the value, since
-- he's the only one who knows
if Translate then
Got := X_Lookup_String (X_Event'Address,
Buffer'Address,
1,
X_Keysym'Address,
System.Null_Address);
-- If X translated it to ASCII for us, just use that
if Got > 0 then
Key_Value := Character'Pos (Buffer (Buffer'First));
-- See if it's a normal control char or DEL, else it's a graphic
-- char
if Buffer (Buffer'First) < ' ' or
Buffer (Buffer'First) = Character'Val (16#7F#)
then
Key_Type := Key_Control;
else
Key_Type := Key_Graphic;
end if;
else
-- Not ASCII, do our own translation
Keysym_To_Symbol (X_Keysym, Key_Value, Key_Type);
end if;
else
-- Caller didn't want keycode translation, the bum
Key_Type := Key_Not_Translated;
end if;
-- Now decide whether it was a press or a release, and return the value
if X_Event.X_Event_Type = X_Key_Press then
if Win.Key_Press/=null then
Win.Key_Press(Key_Type,Key_Value,Key_Mods);
end if;
else
if Win.Key_Release/=null then
Win.Key_Release(Key_Type,Key_Value,Key_Mods);
end if;
end if;
when X_Button_Press =>
if Win.Mouse_Down/=null then
Win.Mouse_Down
(X => X_Event.Btn_X,
Y => X_Event.Btn_Y,
Button => Button_Enum'Val(X_Event.Btn_Code-1),
Modifiers => Modifier_Mask_To_Set(X_Event.Btn_State));
end if;
when X_Button_Release =>
if Win.Mouse_Up/=null then
Win.Mouse_Up
(X => X_Event.Btn_X,
Y => X_Event.Btn_Y,
Button => Button_Enum'Val(X_Event.Btn_Code-1),
Modifiers => Modifier_Mask_To_Set(X_Event.Btn_State));
end if;
when X_Motion_Notify =>
if Win.Mouse_Move/=null then
Win.Mouse_Move
(X => X_Event.Mov_X,
Y => X_Event.Mov_Y,
Modifiers => Modifier_Mask_To_Set(X_Event.Mov_State));
end if;
when X_Enter_Notify =>
null;
-- return (Which => Enter_Window,
-- Crossing_Data => (X => X_Event.Xng_X,
-- Y => X_Event.Xng_Y,
-- Abs_X => X_Event.Xng_Root_X,
-- Abs_Y => X_Event.Xng_Root_Y));
when X_Leave_Notify =>
null;
-- return (Which => Leave_Window,
-- Crossing_Data => (X => X_Event.Xng_X,
-- Y => X_Event.Xng_Y,
-- Abs_X => X_Event.Xng_Root_X,
-- Abs_Y => X_Event.Xng_Root_Y));
when X_Focus_In =>
null;
-- return (Which => Focus_In);
when X_Focus_Out =>
null;
-- return (Which => Focus_Out);
when X_Expose =>
if Win.Exposed/=null then
Win.Exposed
(Top => X_Event.Xps_X,
Left => X_Event.Xng_Y,
Height => X_Event.Xps_Height,
Width => X_Event.Xps_Width);
end if;
when X_Unmap_Notify =>
null;
-- return (Which => Hidden);
when X_Map_Notify =>
if Win.Exposed/=null then
Win.Exposed
(Top => 0,
Left => 0,
Height => Win.Height,
Width => Win.Width);
end if;
when X_Configure_Notify =>
if X_Event.Cfg_Width /= Win.Width or
X_Event.Cfg_Height /= Win.Height
then
Win.Width := X_Event.Cfg_Width;
Win.Height := X_Event.Cfg_Height;
if Win.Resize/=null then
Win.Resize
(Height => X_Event.Cfg_Height,
Width => X_Event.Cfg_Width);
end if;
else
if Win.Exposed/=null then
Win.Exposed
(Top => 0,
Left => 0,
Height => X_Event.Cfg_Height,
Width => X_Event.Cfg_Width);
end if;
end if;
when X_Client_Message =>
begin
if X_Event.Msg_Value = Delete_Window_Atom then
return False;
end if;
end;
when others =>
null;
end case;
return True;
end Next_Event;
---------------------------------------------------------------------------
function Process_Events (Win : in Window_Handle)
return Boolean is
Pend : Integer;
begin
loop
Pend := Pending (Win);
if Pend = 0 then
return True;
end if;
-- Process all events currently in the queue
for i in 1 .. Pend loop
if not Next_Event (Win, Translate => True) then
return False;
end if;
end loop;
end loop;
end Process_Events;
---------------------------------------------------------------------------
end Lumen.Window;
|
pragma Ada_2012;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
limited with tileset_h;
package globals_h is
-- BSD 3-Clause License
-- *
-- * Copyright © 2008-2021, Jice and the libtcod contributors.
-- * All rights reserved.
-- *
-- * Redistribution and use in source and binary forms, with or without
-- * modification, are permitted provided that the following conditions are met:
-- *
-- * 1. Redistributions of source code must retain the above copyright notice,
-- * this list of conditions and the following disclaimer.
-- *
-- * 2. Redistributions in binary form must reproduce the above copyright notice,
-- * this list of conditions and the following disclaimer in the documentation
-- * and/or other materials provided with the distribution.
-- *
-- * 3. Neither the name of the copyright holder nor the names of its
-- * contributors may be used to endorse or promote products derived from
-- * this software without specific prior written permission.
-- *
-- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- * POSSIBILITY OF SUCH DAMAGE.
--
--*
-- Return the default tileset, may be NULL.
-- A non-NULL return value is a new reference to the global tileset.
-- When you are done you will need to call `TCOD_tileset_delete` on this
-- pointer.
-- This function is provisional, the API may change in the future.
--
function TCOD_get_default_tileset return access tileset_h.TCOD_Tileset -- globals.h:46
with Import => True,
Convention => C,
External_Name => "TCOD_get_default_tileset";
--*
-- Set the default tileset and update the default display to use it.
-- This will keep alive a reference to the given tileset. If you no longer
-- need the pointer then you should call `TCOD_tileset_delete` on it after
-- this function.
-- This function is provisional, the API may change in the future.
--
procedure TCOD_set_default_tileset (tileset : access tileset_h.TCOD_Tileset) -- globals.h:56
with Import => True,
Convention => C,
External_Name => "TCOD_set_default_tileset";
end globals_h;
|
------------------------------------------------------------------------------
-- --
-- tiled-code-gen --
-- --
-- Copyright (C) 2018 Fabien Chouteau --
-- --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Strings; use Ada.Strings;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ada.Strings.Maps; use Ada.Strings.Maps;
with Ada.Strings.Maps.Constants;
with DOM.Core; use DOM.Core;
with DOM.Core.Nodes; use DOM.Core.Nodes;
with DOM.Core.Elements; use DOM.Core.Elements;
with TCG.Utils; use TCG.Utils;
with TCG.Tilesets; use TCG.Tilesets;
package body TCG.Tile_Layers is
function Create (N : Node) return Tile_Layer;
procedure Load_Data (L : Tile_Layer; N : Node)
with Pre => L /= No_Layer;
Whitespace : constant Ada.Strings.Maps.Character_Set :=
not Ada.Strings.Maps.Constants.Decimal_Digit_Set;
------------
-- Create --
------------
function Create (N : Node) return Tile_Layer is
Id : Natural;
Width : constant Natural := Item_As_Natural (N, "width");
Height : constant Natural := Item_As_Natural (N, "height");
Name : constant String := Item_As_String (N, "name");
L : constant Tile_Layer := new Layer_Data (Width, Height);
begin
if Item_Exists (N, "id") then
Id := Item_As_Natural (N, "id");
else
-- When there is not ID it means that there is only one layer
Id := 0;
end if;
L.Id := Tile_Layer_Id (Id);
L.Name := new String'(Name);
return L;
end Create;
---------------
-- Load_Data --
---------------
procedure Load_Data (L : Tile_Layer; N : Node) is
Data : constant String := Node_Value (First_Child (N));
Cursor : Integer := Data'First;
function Next_Tile return Map_Tile_Id;
---------------
-- Next_Tile --
---------------
function Next_Tile return Map_Tile_Id is
From : constant Integer := Cursor;
To : Integer := Cursor;
begin
while To < Data'Last and then Data (To) /= ',' loop
To := To + 1;
end loop;
Cursor := To + 1;
return Map_Tile_Id'Value
(Trim (Data (From .. To - 1), Whitespace, Whitespace));
end Next_Tile;
Encoding : constant String := Item_As_String (N, "encoding");
begin
if Encoding /= "csv" then
raise Program_Error with "Unsupported layer encoding: " & Encoding;
end if;
for Y in L.Map'Range (2) loop
for X in L.Map'Range (1) loop
L.Map (X, Y) := Next_Tile;
end loop;
end loop;
end Load_Data;
----------
-- Load --
----------
function Load (Root : Node) return Tile_Layer is
L : constant Tile_Layer := Create (Root);
List : Node_List;
begin
List := Get_Elements_By_Tag_Name (Root, "data");
if Length (List) > 1 then
raise Program_Error with "Too many data elements";
end if;
Load_Data (L, Item (List, 0));
Free (List);
return L;
end Load;
----------
-- Name --
----------
function Name (This : Tile_Layer) return String
is (if This.Name /= null then This.Name.all else "");
--------
-- Id --
--------
function Id (This : Tile_Layer) return Tile_Layer_Id
is (This.Id);
-----------
-- Width --
-----------
function Width (This : Tile_Layer) return Natural
is (This.Width);
------------
-- Height --
------------
function Height (This : Tile_Layer) return Natural
is (This.Height);
----------
-- Tile --
----------
function Tile
(This : Tile_Layer;
X, Y : Natural)
return TCG.Tilesets.Map_Tile_Id
is (This.Map (X, Y));
---------
-- Put --
---------
procedure Put (This : Tile_Layer) is
begin
Put_Line ("Layer: " & Name (This) & " Id:" & This.Id'Img);
for Y in This.Map'Range (2) loop
for X in This.Map'Range (1) loop
Put (This.Map (X, Y)'Img &
(if X = This.Map'Last (1) then "," else ", "));
end loop;
New_Line;
end loop;
end Put;
end TCG.Tile_Layers;
|
with
Interfaces.C,
System;
use type
System.Address;
package body FLTK.Images.Bitmaps is
procedure free_fl_bitmap
(I : in System.Address);
pragma Import (C, free_fl_bitmap, "free_fl_bitmap");
pragma Inline (free_fl_bitmap);
function fl_bitmap_copy
(I : in System.Address;
W, H : in Interfaces.C.int)
return System.Address;
pragma Import (C, fl_bitmap_copy, "fl_bitmap_copy");
pragma Inline (fl_bitmap_copy);
function fl_bitmap_copy2
(I : in System.Address)
return System.Address;
pragma Import (C, fl_bitmap_copy2, "fl_bitmap_copy2");
pragma Inline (fl_bitmap_copy2);
procedure fl_bitmap_draw2
(I : in System.Address;
X, Y : in Interfaces.C.int);
pragma Import (C, fl_bitmap_draw2, "fl_bitmap_draw2");
pragma Inline (fl_bitmap_draw2);
procedure fl_bitmap_draw
(I : in System.Address;
X, Y, W, H, CX, CY : in Interfaces.C.int);
pragma Import (C, fl_bitmap_draw, "fl_bitmap_draw");
pragma Inline (fl_bitmap_draw);
overriding procedure Finalize
(This : in out Bitmap) is
begin
if This.Void_Ptr /= System.Null_Address and then
This in Bitmap'Class
then
free_fl_bitmap (This.Void_Ptr);
This.Void_Ptr := System.Null_Address;
end if;
Finalize (Image (This));
end Finalize;
function Copy
(This : in Bitmap;
Width, Height : in Natural)
return Bitmap'Class is
begin
return Copied : Bitmap do
Copied.Void_Ptr := fl_bitmap_copy
(This.Void_Ptr,
Interfaces.C.int (Width),
Interfaces.C.int (Height));
end return;
end Copy;
function Copy
(This : in Bitmap)
return Bitmap'Class is
begin
return Copied : Bitmap do
Copied.Void_Ptr := fl_bitmap_copy2 (This.Void_Ptr);
end return;
end Copy;
procedure Draw
(This : in Bitmap;
X, Y : in Integer) is
begin
fl_bitmap_draw2
(This.Void_Ptr,
Interfaces.C.int (X),
Interfaces.C.int (Y));
end Draw;
procedure Draw
(This : in Bitmap;
X, Y, W, H : in Integer;
CX, CY : in Integer := 0) is
begin
fl_bitmap_draw
(This.Void_Ptr,
Interfaces.C.int (X),
Interfaces.C.int (Y),
Interfaces.C.int (W),
Interfaces.C.int (H),
Interfaces.C.int (CX),
Interfaces.C.int (CY));
end Draw;
end FLTK.Images.Bitmaps;
|
-- MIT License
-- Copyright (c) 2021 Stephen Merrony
-- 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; use Ada.Text_IO;
with Debug_Logs; use Debug_Logs;
with Resolver; use Resolver;
package body Processor.Eagle_FPU_P is
procedure Debug_FPACs (CPU : in CPU_T) is
begin
Loggers.Debug_Print (Debug_Log, "... FPAC0: " & CPU.FPAC(0)'Image &
" FPAC1: " & CPU.FPAC(1)'Image &
" FPAC2: " & CPU.FPAC(2)'Image &
" FPAC3: " & CPU.FPAC(3)'Image);
end Debug_FPACs;
function Floor(X : in Long_Float) return Integer_32 is
Answer : Integer_32 := Integer_32(X);
begin
if Long_Float(Answer) > X then
Answer := Answer - 1;
end if;
return Answer;
end Floor;
procedure Do_Eagle_FPU (I : in Decoded_Instr_T; CPU : in out CPU_T) is
Scale_Factor : Integer_8;
Dec_Type : Natural;
SSize : Natural;
Addr : Phys_Addr_T;
DW : Dword_T;
QW : Qword_T;
DG_Dbl : Double_Overlay;
LF : Long_Float;
begin
Debug_FPACs (CPU);
case I.Instruction is
when I_LFAMD =>
Addr := Resolve_31bit_Disp (CPU, I.Ind, I.Mode, I.Disp_31, I.Disp_Offset);
DG_Dbl.Double_QW := RAM.Read_Qword (Addr);
CPU.FPAC(I.Ac) := CPU.FPAC(I.Ac) + DG_Double_To_Long_Float(DG_Dbl);
Set_N (CPU, (CPU.FPAC(I.Ac) < 0.0));
Set_Z (CPU, (CPU.FPAC(I.Ac) = 0.0));
when I_LFLDD =>
Addr := Resolve_31bit_Disp (CPU, I.Ind, I.Mode, I.Disp_31, I.Disp_Offset);
DG_Dbl.Double_QW := RAM.Read_Qword (Addr);
CPU.FPAC(I.Ac) := DG_Double_To_Long_Float(DG_Dbl);
Set_N (CPU, (CPU.FPAC(I.Ac) < 0.0));
Set_Z (CPU, (CPU.FPAC(I.Ac) = 0.0));
when I_LFLDS =>
Addr := Resolve_31bit_Disp (CPU, I.Ind, I.Mode, I.Disp_31, I.Disp_Offset);
CPU.FPAC(I.Ac) := DG_Single_To_Long_Float(RAM.Read_Dword(Addr));
Set_N (CPU, (CPU.FPAC(I.Ac) < 0.0));
Set_Z (CPU, (CPU.FPAC(I.Ac) = 0.0));
when I_LFDMD =>
Addr := Resolve_31bit_Disp (CPU, I.Ind, I.Mode, I.Disp_31, I.Disp_Offset);
DG_Dbl.Double_QW := RAM.Read_Qword (Addr);
-- TODO handle zero divisor
CPU.FPAC(I.Ac) := CPU.FPAC(I.Ac) / DG_Double_To_Long_Float(DG_Dbl);
Set_N (CPU, (CPU.FPAC(I.Ac) < 0.0));
Set_Z (CPU, (CPU.FPAC(I.Ac) = 0.0));
when I_LFMMD =>
Addr := Resolve_31bit_Disp (CPU, I.Ind, I.Mode, I.Disp_31, I.Disp_Offset);
DG_Dbl.Double_QW := RAM.Read_Qword (Addr);
CPU.FPAC(I.Ac) := CPU.FPAC(I.Ac) * DG_Double_To_Long_Float(DG_Dbl);
Set_N (CPU, (CPU.FPAC(I.Ac) < 0.0));
Set_Z (CPU, (CPU.FPAC(I.Ac) = 0.0));
when I_LFMMS =>
Addr := Resolve_31bit_Disp (CPU, I.Ind, I.Mode, I.Disp_31, I.Disp_Offset);
CPU.FPAC(I.Ac) := CPU.FPAC(I.Ac) * DG_Single_To_Long_Float(RAM.Read_Dword(Addr));
Set_N (CPU, (CPU.FPAC(I.Ac) < 0.0));
Set_Z (CPU, (CPU.FPAC(I.Ac) = 0.0));
when I_LFSMD =>
Addr := Resolve_31bit_Disp (CPU, I.Ind, I.Mode, I.Disp_31, I.Disp_Offset);
DG_Dbl.Double_QW := RAM.Read_Qword (Addr);
CPU.FPAC(I.Ac) := CPU.FPAC(I.Ac) - DG_Double_To_Long_Float(DG_Dbl);
Set_N (CPU, (CPU.FPAC(I.Ac) < 0.0));
Set_Z (CPU, (CPU.FPAC(I.Ac) = 0.0));
when I_LFSTD =>
Addr := Resolve_31bit_Disp (CPU, I.Ind, I.Mode, I.Disp_31, I.Disp_Offset);
QW := Long_Float_To_DG_Double (CPU.FPAC(I.Ac));
RAM.Write_Qword(Addr, QW);
when I_LFSTS =>
Addr := Resolve_31bit_Disp (CPU, I.Ind, I.Mode, I.Disp_31, I.Disp_Offset);
DW := Long_Float_To_DG_Single (CPU.FPAC(I.Ac));
RAM.Write_Dword(Addr, DW);
when I_WFFAD =>
-- Acs and Acd are the 'other way around' with this instruction
CPU.AC(I.Acs) := Dword_T(Floor(CPU.FPAC(I.Acd)));
when I_WFLAD =>
CPU.FPAC(I.Acd) := Long_Float(Dword_To_Integer_32(CPU.AC(I.Acs)));
Set_Z (CPU, (CPU.AC(I.Acs) = 0));
Set_N (CPU, (CPU.FPAC(I.Acd) < 0.0));
when I_WLDI =>
declare
SF : Integer_8;
Dec_Type : Natural;
Size : Natural;
Dec_US : Unbounded_String;
CI : Integer;
begin
Decode_Dec_Data_Type(CPU.AC(1), SF, Dec_Type, Size);
CPU.AC(2) := CPU.AC(3);
Dec_US := Read_Decimal(CPU.AC(3), Size);
case Dec_Type is
when Unpacked_Dec_U =>
CI := Integer'Value(To_String(Dec_US));
CPU.FPAC(I.Ac) := Long_Float(CI);
when others =>
raise Not_Yet_Implemented with "Packed Data-Types in WLDI";
end case;
Set_Z (CPU, (CPU.AC(I.Ac) = 0));
Set_N (CPU, (CPU.FPAC(I.Ac) < 0.0));
end;
when I_WSTI =>
CPU.AC(2) := CPU.AC(3);
Decode_Dec_Data_Type (CPU.AC(1),Scale_Factor, Dec_Type, SSize);
if Scale_Factor /= 0 then
raise Not_Yet_Implemented with "Non-Zero Decimal Scale factors is WSTI";
end if;
case Dec_Type is
when Packed_Dec =>
declare
type Nibble is mod 2 ** 4;
type Nibble_Arr_T is array (0 .. SSize) of Nibble;
Nibble_Arr : Nibble_Arr_T := (others => 0);
Int_Val : Integer := Integer(CPU.FPAC(I.Ac));
Byte : Byte_T;
begin
-- trailing sign
Nibble_Arr(SSize) := (if Int_Val < 0 then 16#D# else 16#C#);
-- digits in reverse order
for D in reverse 0 .. SSize - 1 loop
Nibble_Arr(D) := Nibble(Int_Val mod 10);
Int_Val := Int_Val / 10;
end loop;
for B in 0 ..SSize / 2 loop
Byte := Shift_Left(Byte_T(Nibble_Arr(2 * B)), 4) or Byte_T(Nibble_Arr((2 * B) + 1));
RAM.Write_Byte_BA(CPU.AC(3), Byte);
Loggers.Debug_Print (Debug_Log, "... BCD stored: " & Byte_To_String(Byte, Hex, 2, true));
CPU.AC(3) := CPU.AC(3) + 1;
end loop;
end;
when Unpacked_Dec_LS =>
declare
Converted : String(1 .. SSize);
Int_Val : Integer := Integer(CPU.FPAC(I.Ac));
Str_Val : String := Int_Val'Image;
Src_Ix : Integer := Str_Val'Last;
Dest_Ix : Integer := SSize;
begin
Converted(1) := (if Int_Val < 0 then '-' else '+');
for D in 2 .. SSize loop
Converted(D) := '0';
end loop;
loop
Converted(Dest_Ix) := Str_Val(Src_Ix);
Dest_Ix := Dest_Ix - 1;
Src_Ix := Src_Ix - 1;
exit when ((Int_Val < 0) and (Src_Ix = 1)) or ((Int_Val >= 0) and (Src_Ix = 0));
end loop;
for C in 1 .. SSize loop
RAM.Write_Byte_BA(CPU.AC(3), Char_To_Byte(Converted(C)));
CPU.AC(3) := CPU.AC(3) + 1;
end loop;
Loggers.Debug_Print (Debug_Log, "... UDecLS stored: " & Converted);
end;
when Unpacked_Dec_U =>
declare
Converted : String(1 .. SSize);
Int_Val : Integer := Integer(CPU.FPAC(I.Ac));
Str_Val : String := Int_Val'Image;
Src_Ix : Integer := Str_Val'Last;
Dest_Ix : Integer := SSize;
begin
for D in 1 .. SSize loop
Converted(D) := '0';
end loop;
loop
Converted(Dest_Ix) := Str_Val(Src_Ix);
Dest_Ix := Dest_Ix - 1;
Src_Ix := Src_Ix - 1;
exit when (Src_Ix = 1) or (Dest_Ix = 0);
end loop;
for C in 1 .. SSize loop
RAM.Write_Byte_BA(CPU.AC(3), Char_To_Byte(Converted(C)));
CPU.AC(3) := CPU.AC(3) + 1;
end loop;
Loggers.Debug_Print (Debug_Log, "... UDecUS stored: " & Converted);
end;
when others =>
raise Not_Yet_Implemented with "Decimal data type: " & Dec_Type'Image;
end case;
when I_XFAMD =>
Addr := Resolve_15bit_Disp (CPU, I.Ind, I.Mode, I.Disp_15, I.Disp_Offset);
DG_Dbl.Double_QW := RAM.Read_Qword(Addr);
CPU.FPAC(I.Ac) := CPU.FPAC(I.Ac) + DG_Double_To_Long_Float(DG_Dbl);
Set_N (CPU, (CPU.FPAC(I.Ac) < 0.0));
Set_Z (CPU, (CPU.FPAC(I.Ac) = 0.0));
when I_XFLDD =>
Addr := Resolve_15bit_Disp (CPU, I.Ind, I.Mode, I.Disp_15, I.Disp_Offset);
DG_Dbl.Double_QW := RAM.Read_Qword(Addr);
CPU.FPAC(I.Ac) := DG_Double_To_Long_Float(DG_Dbl);
Set_Z(CPU, (CPU.FPAC(I.Ac) = 0.0));
Set_N(CPU, (CPU.FPAC(I.Ac) < 0.0));
when I_XFDMS =>
Addr := Resolve_15bit_Disp (CPU, I.Ind, I.Mode, I.Disp_15, I.Disp_Offset);
DW := RAM.Read_Dword(Addr);
LF := DG_Single_To_Long_Float(DW);
Loggers.Debug_Print (Debug_Log, "... Single float Divisor (in memory): " & LF'Image &
" from hex value: " & Dword_To_String(DW, Hex, 8, true));
CPU.FPAC(I.Ac) := CPU.FPAC(I.Ac) / LF;
Set_N (CPU, (CPU.FPAC(I.Ac) < 0.0));
Set_Z (CPU, (CPU.FPAC(I.Ac) = 0.0));
when I_XFLDS =>
Addr := Resolve_15bit_Disp (CPU, I.Ind, I.Mode, I.Disp_15, I.Disp_Offset);
DW := RAM.Read_Dword(Addr);
CPU.FPAC(I.Ac) := DG_Single_To_Long_Float(DW);
Set_Z(CPU, (CPU.FPAC(I.Ac) = 0.0));
Set_N(CPU, (CPU.FPAC(I.Ac) < 0.0));
when I_XFMMD =>
Addr := Resolve_15bit_Disp (CPU, I.Ind, I.Mode, I.Disp_15, I.Disp_Offset);
DG_Dbl.Double_QW := RAM.Read_Qword(Addr);
CPU.FPAC(I.Ac) := CPU.FPAC(I.Ac) * DG_Double_To_Long_Float(DG_Dbl);
Set_N (CPU, (CPU.FPAC(I.Ac) < 0.0));
Set_Z (CPU, (CPU.FPAC(I.Ac) = 0.0));
when I_XFMMS =>
Addr := Resolve_15bit_Disp (CPU, I.Ind, I.Mode, I.Disp_15, I.Disp_Offset);
DW := RAM.Read_Dword(Addr);
CPU.FPAC(I.Ac) := CPU.FPAC(I.Ac) * DG_Single_To_Long_Float(DW);
Set_N (CPU, (CPU.FPAC(I.Ac) < 0.0));
Set_Z (CPU, (CPU.FPAC(I.Ac) = 0.0));
when I_XFSTD =>
Addr := Resolve_15bit_Disp (CPU, I.Ind, I.Mode, I.Disp_15, I.Disp_Offset);
DG_Dbl.Double_QW := Long_Float_To_DG_Double(CPU.FPAC(I.Ac));
RAM.Write_Qword (Addr, DG_Dbl.Double_QW);
when I_XFSTS =>
Addr := Resolve_15bit_Disp (CPU, I.Ind, I.Mode, I.Disp_15, I.Disp_Offset);
DG_Dbl.Double_QW := Long_Float_To_DG_Double(CPU.FPAC(I.Ac));
RAM.Write_Dword (Addr, Upper_Dword(DG_Dbl.Double_QW));
when others =>
Put_Line ("ERROR: EAGLE_FPU instruction " & To_String(I.Mnemonic) &
" not yet implemented");
raise Execution_Failure with "ERROR: EAGLE_FPU instruction " & To_String(I.Mnemonic) &
" not yet implemented";
end case;
Debug_FPACs (CPU);
CPU.PC := CPU.PC + Phys_Addr_T(I.Instr_Len);
end Do_Eagle_FPU;
end Processor.Eagle_FPU_P; |
------------------------------------------------------------------------------
-- --
-- Ada User Repository Annex (AURA) --
-- ANNEXI-STRAYLINE Reference Implementation --
-- --
-- Command Line Interface --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2020-2021, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * Richard Wai (ANNEXI-STRAYLINE) --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- --
-- * Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- This package is driven by the aura cli main program (aura.adb) specifically,
-- and is designed to be executed sequentially, in an apprpriate order
-- (determined by the main program). As such, it maintains a state via the
-- public "Command" object (below), as well as an internal Parameters object
-- (of type Parameters_Set)
with Build;
with Registrar.Library_Units;
package Scheduling is
Process_Failed: exception;
-- Raised during "normal", but ugly failures that are reported via work
-- reports, or involve explicit checks.
--
-- Generally speaking, if this exception occurs, it is not safe to save the
-- Registry or Configuration.
Build_Failed: exception;
-- Raised specifically when any unit fails to compile, bind, or link. Unlike
-- Process_Failed, this error implies that the Registry and Configuration
-- can (and should) be safely saved so that subsequent invokcations do not
-- need to recompile everything.
----------------
-- Parameters --
----------------
type Selected_Command is
(Build_Command,
Checkout_Command,
Clean_Command,
Compile_Command,
Help_Command,
Library_Command,
Run_Command,
Systemize_Command);
Command: Selected_Command := Checkout_Command;
-- Set by Initialize_Parameters;
procedure Initialize_Parameters;
-- Loads the previous set of parameters (if any), and then applies and
-- validates the parameters passed in.
--
-- Additionally checks the correctness of the specified
-- options/configuration for relevent commands.
--
-- If the parameters are not valid, a message explaining why is output,
-- and Process_Failed is raised, otherwise Command is set to the selected
-- command
--
-- Initialize_Parameters sets a variety of global variables in the
-- Scheduling and UI_Primitives packages, and must be invoked before
-- executing any other subprograms in this package
---------------
-- Processes --
---------------
procedure Clean;
-- Removes all state from the project.
-- 1. Removes the .aura subdirectory, containing all saved state (config and
-- last-run
-- 2. Removes the aura-build subdirectory
procedure Enter_Root;
-- Enters all units in the root directory
procedure Initialize_Repositories;
procedure Add_Explicit_Checkouts;
-- Enters "Requested" subsystems into the Registrar if they are not already
-- registered
--
-- This should be called after Enter_Root to ensure that root subsystems are
-- not checked-out by this process.
--
-- If there are no explicit checkouts to add, no action is taken.
procedure Checkout_Cycle;
-- Goes through successful cycles of Checkout -> Hash -> Configure -> Cache
-- until no Subsystems are in a state of "Requested".
--
-- If three cycles pass where the number of requested subsystems does not
-- change, a list of all requested subsystems is output and Process_Failed
-- is raised.
--
-- After a successful Checkout_Cycle process (all Requested subsystems
-- aquired and configured), the Root Configuration is processed (if any) and
-- then all Configuration Manifests are excluded from the Registrar.
procedure Consolidate_Dependencies;
-- Consolidates and builds all dependency maps
procedure Check_Completion;
-- Check for any subsystems that are Unavailable (checkout failed for
-- "common" reasons), and report diagnostic information to the user
-- before aborting.
--
-- If all Subsystems are Available, Check for any units with a state of
-- Requested (there should be none), and report any found to the user before
-- aborting
--
-- If -v is not given as a parameter, specific dependency relationships are
-- not output, and a simiplified description of incomplete or unavailable
-- subsystems is output.
--
-- If there are checkout failures and Verbose will be False,
-- Consolidate_Dependencies does not need to be invoked first, otherwise
-- it must be invoked first.
procedure Hash_Registry;
-- Hash all units in the registry, including compilation products
procedure Compile;
-- Executes:
-- 1. Build.Compute_Recomplations
-- 2. Build.Compilation.Compile
--
-- If Quiet is True, compiler output is not copied to the output
procedure Bind;
-- Creates a binder file, waits for the registration, and then executes a
-- compilation run to compile the binder unit
procedure Expand_Dependencies;
-- If a main unit is specified, all dependencies are added to the link set,
-- otherwise the link-set already contains all units. This must be invoked
-- before Scan_Linker_Options or Link_Or_Archive
procedure Scan_Linker_Options;
-- Invokes and tracks the Scan_Linker_Options phase when linking an image
-- or library
procedure Link_Or_Archive with
Pre => Command in Build_Command | Run_Command | Library_Command;
-- Depending on the command (build/run/library), and the output image name
-- (for library command only), either links an executable, a dynamic library,
-- or creates a regular object archive (".a" extension)
procedure Execute_Image;
-- Executes the compiled and linked image, passing no parameters, but
-- preserving the environment values.
--
-- On systems (such as Unix) that support replacing the image of the running
-- process, Execute_Image will not return. However, on systems that only
-- support explict process creation (such as Windows), a new process is
-- created, and Execute_Image returns normally.
procedure Save_Registry;
-- Saves Last_Run
procedure Save_Config;
-- Saves the build configuration (parameters)
end Scheduling;
|
-- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../License.txt
with Ada.Text_IO;
with JohnnyText;
with Definitions; use Definitions;
private with Ada.Characters.Latin_1;
private with Ada.Directories;
private with Parameters;
private with Unix;
package Replicant is
package JT renames JohnnyText;
package TIO renames Ada.Text_IO;
scenario_unexpected : exception;
type slave_options is record
need_procfs : Boolean := False;
need_linprocfs : Boolean := False;
skip_cwrappers : Boolean := False;
end record;
type package_abi is record
calculated_abi : JT.Text;
calculated_alt_abi : JT.Text;
calc_abi_noarch : JT.Text;
calc_alt_abi_noarch : JT.Text;
end record;
-- For every single port to be built, the build need to first be created
-- and then destroyed when the build is complete.
procedure launch_slave (id : builders; opts : slave_options);
procedure destroy_slave (id : builders; opts : slave_options);
-- This needs to be run as soon as the configuration profile is loaded,
-- env before the "initialize" function
procedure set_platform;
-- This procedure needs to be run once.
-- It basically sets the operating system "flavor" which affects the
-- mount command spawning. It also creates the password database
procedure initialize (testmode : Boolean; num_cores : cpu_range);
-- This removes the password database
procedure finalize;
-- Returns True if any mounts are detected (used by pilot)
function synth_mounts_exist return Boolean;
-- Returns True if any _work/_localbase dirs are detected (used by pilot)
function disk_workareas_exist return Boolean;
-- Returns True if the attempt to clear mounts is successful.
function clear_existing_mounts return Boolean;
-- Returns True if the attempt to remove the disk work areas is successful
function clear_existing_workareas return Boolean;
-- The actual command to build a local repository (Returns True on success)
function build_repository (id : builders; sign_command : String := "")
return Boolean;
-- Returns all the UNAME_x environment variables
-- They will be passed to the buildcycle package
function jail_environment return JT.Text;
-- On FreeBSD, if "/boot" exists but "/boot/modules" does not, return True
-- This is a pre-run validity check
function boot_modules_directory_missing return Boolean;
root_localbase : constant String := "/usr/local";
private
package PM renames Parameters;
package AD renames Ada.Directories;
package LAT renames Ada.Characters.Latin_1;
type mount_mode is (readonly, readwrite);
type flavors is (unknown, freebsd, dragonfly, netbsd, linux, solaris);
type folder_operation is (lock, unlock);
type folder is (bin, sbin, lib, libexec,
usr_bin,
usr_include,
usr_lib,
usr_libdata,
usr_libexec,
usr_sbin,
usr_share,
usr_lib32, xports, options, packages, distfiles,
dev, etc, etc_default, etc_mtree, etc_rcd, home, linux,
proc, root, tmp, var, wrkdirs, usr_local, usr_src, ccache,
boot, usr_x11r7, usr_games);
subtype subfolder is folder range bin .. usr_share;
subtype filearch is String (1 .. 11);
-- home and root need to be set readonly
reference_base : constant String := "Base";
root_bin : constant String := "/bin";
root_sbin : constant String := "/sbin";
root_X11R7 : constant String := "/usr/X11R7";
root_usr_bin : constant String := "/usr/bin";
root_usr_games : constant String := "/usr/games";
root_usr_include : constant String := "/usr/include";
root_usr_lib : constant String := "/usr/lib";
root_usr_lib32 : constant String := "/usr/lib32";
root_usr_libdata : constant String := "/usr/libdata";
root_usr_libexec : constant String := "/usr/libexec";
root_usr_sbin : constant String := "/usr/sbin";
root_usr_share : constant String := "/usr/share";
root_usr_src : constant String := "/usr/src";
root_dev : constant String := "/dev";
root_etc : constant String := "/etc";
root_etc_default : constant String := "/etc/defaults";
root_etc_mtree : constant String := "/etc/mtree";
root_etc_rcd : constant String := "/etc/rc.d";
root_lib : constant String := "/lib";
root_tmp : constant String := "/tmp";
root_var : constant String := "/var";
root_home : constant String := "/home";
root_boot : constant String := "/boot";
root_kmodules : constant String := "/boot/modules";
root_lmodules : constant String := "/boot/modules.local";
root_root : constant String := "/root";
root_proc : constant String := "/proc";
root_linux : constant String := "/compat/linux";
root_linproc : constant String := "/compat/linux/proc";
root_xports : constant String := "/xports";
root_options : constant String := "/options";
root_libexec : constant String := "/libexec";
root_wrkdirs : constant String := "/construction";
root_packages : constant String := "/packages";
root_distfiles : constant String := "/distfiles";
root_ccache : constant String := "/ccache";
chroot : constant String := "/usr/sbin/chroot ";
platform_type : flavors := unknown;
smp_cores : cpu_range := cpu_range'First;
support_locks : Boolean;
developer_mode : Boolean;
abn_log_ready : Boolean;
builder_env : JT.Text;
abnormal_log : TIO.File_Type;
abnormal_cmd_logname : constant String := "05_abnormal_command_output.log";
-- Throws exception if mount attempt was unsuccessful
procedure mount_nullfs (target, mount_point : String;
mode : mount_mode := readonly);
-- Throws exception if mount attempt was unsuccessful
procedure mount_tmpfs (mount_point : String; max_size_M : Natural := 0);
-- Throws exception if unmount attempt was unsuccessful
procedure unmount (device_or_node : String);
-- Throws exception if directory was not successfully created
procedure forge_directory (target : String);
-- Return the full path of the mount point
function location (mount_base : String; point : folder) return String;
function mount_target (point : folder) return String;
-- Query configuration to determine the master mount
function get_master_mount return String;
function get_slave_mount (id : builders) return String;
-- returns "SLXX" where XX is a zero-padded integer (01 .. 32)
function slave_name (id : builders) return String;
-- locks and unlocks folders, even from root
procedure folder_access (path : String; operation : folder_operation);
-- self explanatory
procedure create_symlink (destination, symbolic_link : String);
-- generic command, throws exception if exit code is not 0
procedure execute (command : String);
procedure silent_exec (command : String);
function internal_system_command (command : String) return JT.Text;
-- create slave's /var directory tree. Path should be an empty directory.
procedure populate_var_folder (path : String);
-- create /etc/make.conf in slave
procedure create_make_conf (path_to_etc : String;
skip_cwrappers : Boolean);
-- create /etc/passwd (and databases) to define system users
procedure create_passwd (path_to_etc : String);
procedure create_base_passwd (path_to_mm : String);
-- create /etc/group to define root user
procedure create_group (path_to_etc : String);
procedure create_base_group (path_to_mm : String);
-- copy host's /etc/resolv.conf to slave
procedure copy_resolv_conf (path_to_etc : String);
-- copy host's /etc/mtree files to slave
procedure copy_mtree_files (path_to_mtree : String);
-- copy host's conf defaults
procedure copy_rc_default (path_to_etc : String);
procedure copy_etc_rcsubr (path_to_etc : String);
procedure copy_ldconfig (path_to_etc : String);
-- create minimal /etc/services
procedure create_etc_services (path_to_etc : String);
-- create a dummy fstab for linux packages (looks for linprocfs)
procedure create_etc_fstab (path_to_etc : String);
-- create /etc/shells, required by install scripts of some packages
procedure create_etc_shells (path_to_etc : String);
-- mount the devices
procedure mount_devices (path_to_dev : String);
procedure unmount_devices (path_to_dev : String);
-- execute ldconfig as last action of slave creation
procedure execute_ldconfig (id : builders);
-- Used for per-profile make.conf fragments (if they exist)
procedure concatenate_makeconf (makeconf_handle : TIO.File_Type;
target_name : String);
-- Wrapper for rm -rf <directory>
procedure annihilate_directory_tree (tree : String);
-- This is only done for FreeBSD. For DragonFly, it's a null-op
procedure mount_linprocfs (mount_point : String);
-- It turns out at least one major port uses procfs (gnustep)
procedure mount_procfs (path_to_proc : String);
procedure unmount_procfs (path_to_proc : String);
-- Used to generic mtree exclusion files
procedure write_common_mtree_exclude_base (mtreefile : TIO.File_Type);
procedure write_preinstall_section (mtreefile : TIO.File_Type);
procedure create_mtree_exc_preconfig (path_to_mm : String);
procedure create_mtree_exc_preinst (path_to_mm : String);
-- capture unexpected output while setting up builders (e.g. mount)
procedure start_abnormal_logging;
procedure stop_abnormal_logging;
-- Generic directory copy utility (ordinary files only)
function copy_directory_contents (src_directory : String;
tgt_directory : String;
pattern : String) return Boolean;
end Replicant;
|
Pragma Ada_2012;
Pragma Assertion_Policy( Check );
With
Ada.Finalization,
Ada.Streams;
Generic
Type Character is (<>);
Type String is array(Positive Range <>) of Character;
Empty_String : String := (2..1 => <>);
Type File_Type is limited private;
Type File_Mode is (<>);
Type Stream_Access is access all Ada.Streams.Root_Stream_Type'Class;
with function Stream (File : File_Type) return Stream_Access is <>;
with procedure Create
(File : in out File_Type;
Mode : File_Mode;
Name : String := Empty_String;
Form : String := Empty_String) is <>;
with procedure Open
(File : in out File_Type;
Mode : File_Mode;
Name : String;
Form : String := Empty_String) is <>;
with procedure Close (File : In Out File_Type) is <>;
with procedure Delete (File : In Out File_Type) is <>;
with procedure Reset (File : In Out File_Type; Mode : File_Mode) is <>;
with procedure Reset (File : In Out File_Type) is <>;
with function Mode (File : In File_Type) return File_Mode is <>;
with function Name (File : In File_Type) return String is <>;
with function Form (File : In File_Type) return String is <>;
with function Is_Open (File : In File_Type) return Boolean is <>;
Package EVIL.Util.Files with Pure, SPARK_Mode => On is
Type File is tagged limited private;
Function Create (Name : In String; Mode : In File_Mode) Return File
with Global => Null, Depends => (Create'Result => (Name, Mode));
Function Open (Name : In String; Mode : In File_Mode) Return File
with Global => Null, Depends => (Open'Result => (Name, Mode));
Function Mode (Object : In File) Return File_Mode
with Global => Null, Depends => (Mode'Result => Object);
Function Name (Object : In File) Return String
with Global => Null, Depends => (Name'Result => Object);
Function Form (Object : In File) Return String
with Global => Null, Depends => (Form'Result => Object);
Function Open (Object : In File) Return Boolean
with Global => Null, Depends => (Open'Result => Object);
Function Stream (Object : In File) Return Stream_Access
with Global => Null, Depends => (Stream'Result => Object);
Procedure Close (Object : In Out File)
with Global => Null, Depends => (Object =>+ Null);
Procedure Delete (Object : In Out File)
with Global => Null, Depends => (Object =>+ Null);
Procedure Reset (Object : In Out File)
with Global => Null, Depends => (Object =>+ Null);
Procedure Reset (Object : In Out File; Mode : In File_Mode)
with Global => Null, Depends => (Object =>+ Mode);
Private
Type File is new Ada.Finalization.Limited_Controlled with Record
Data : Aliased File_Type;
FSA : Stream_Access;
end record;
Overriding
Procedure Finalize (Object : In Out File)
with Global => Null, Depends => (Object => Null);
Function Stream (Object : File) return Stream_Access is (Object.FSA);
End EVIL.Util.Files;
|
pragma SPARK_Mode (On);
with Stack;
with Ada.Text_IO; use Ada.Text_IO;
procedure Test is
package Int_Stack is new Stack (Thing => Integer, Basic => 0);
S : Int_Stack.Stack (10);
T : Integer;
begin
Int_Stack.Put (S, -1);
Int_Stack.Put (S, -2);
Int_Stack.Put (S, -3);
Int_Stack.Put (S, -4);
Int_Stack.Put (S, -5);
pragma Assert (Int_Stack.Pushes (S) = 5); -- Prover can track amounts.
pragma Assert (Int_Stack.Buffer (S) (5) = -5); -- Prover can track content.
pragma Assert (Int_Stack.Top (S) = -5); -- Prover can track content.
T := Int_Stack.Top (S);
Int_Stack.Pop (S);
-- Ensure tracking functions even after a pop operation.
pragma Assert (Int_Stack.Pushes (S) = 4); -- Prover can track amounts.
pragma Assert (Int_Stack.Buffer (S) (4) = -4); -- Prover can track content.
pragma Assert (Int_Stack.Top (S) = -4); -- Prover can track content.
Put_Line (Integer'Image ( T ));
Put_Line (Integer'Image (Integer (Int_Stack.Top (S)))); Int_Stack.Pop (S);
Put_Line (Integer'Image (Integer (Int_Stack.Top (S)))); Int_Stack.Pop (S);
Put_Line (Integer'Image (Integer (Int_Stack.Top (S)))); Int_Stack.Pop (S);
Put_Line (Integer'Image (Integer (Int_Stack.Top (S)))); Int_Stack.Pop (S);
end Test;
|
-----------------------------------------------------------------------
-- ado-schemas-entities -- Entity types cache
-- Copyright (C) 2011, 2012, 2017, 2018 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Log.Loggers;
with Util.Strings;
with ADO.SQL;
with ADO.Statements;
with ADO.Model;
package body ADO.Schemas.Entities is
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("ADO.Schemas.Entities");
-- ------------------------------
-- Expand the name into a target parameter value to be used in the SQL query.
-- The Expander can return a T_NULL when a value is not found or
-- it may also raise some exception.
-- ------------------------------
overriding
function Expand (Instance : in out Entity_Cache;
Name : in String) return ADO.Parameters.Parameter is
Pos : constant Entity_Map.Cursor := Instance.Entities.Find (Name);
begin
if not Entity_Map.Has_Element (Pos) then
Log.Error ("No entity type associated with table {0}", Name);
raise No_Entity_Type with "No entity type associated with table " & Name;
end if;
return ADO.Parameters.Parameter '(T => ADO.Parameters.T_INTEGER,
Len => 0, Value_Len => 0, Position => 0,
Name => "",
Num => Entity_Type'Pos (Entity_Map.Element (Pos)));
end Expand;
-- ------------------------------
-- Find the entity type index associated with the given database table.
-- Raises the No_Entity_Type exception if no such mapping exist.
-- ------------------------------
function Find_Entity_Type (Cache : in Entity_Cache;
Table : in Class_Mapping_Access) return ADO.Entity_Type is
begin
return Find_Entity_Type (Cache, Table.Table);
end Find_Entity_Type;
-- ------------------------------
-- Find the entity type index associated with the given database table.
-- Raises the No_Entity_Type exception if no such mapping exist.
-- ------------------------------
function Find_Entity_Type (Cache : in Entity_Cache;
Name : in Util.Strings.Name_Access) return ADO.Entity_Type is
Pos : constant Entity_Map.Cursor := Cache.Entities.Find (Name.all);
begin
if not Entity_Map.Has_Element (Pos) then
Log.Error ("No entity type associated with table {0}", Name.all);
raise No_Entity_Type with "No entity type associated with table " & Name.all;
end if;
return Entity_Type (Entity_Map.Element (Pos));
end Find_Entity_Type;
-- ------------------------------
-- Initialize the entity cache by reading the database entity table.
-- ------------------------------
procedure Initialize (Cache : in out Entity_Cache;
Session : in out ADO.Sessions.Session'Class) is
Query : ADO.SQL.Query;
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (ADO.Model.ENTITY_TYPE_TABLE'Access);
Count : Natural := 0;
begin
Stmt.Set_Parameters (Query);
Stmt.Execute;
while Stmt.Has_Elements loop
declare
Id : constant ADO.Entity_Type := ADO.Entity_Type (Stmt.Get_Integer (0));
Name : constant String := Stmt.Get_String (1);
begin
Cache.Entities.Insert (Key => Name, New_Item => Id);
end;
Count := Count + 1;
Stmt.Next;
end loop;
Log.Info ("Loaded {0} table entities", Util.Strings.Image (Count));
exception
when others =>
null;
end Initialize;
end ADO.Schemas.Entities;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
-- A redefinable template signature supports the addition of formal template
-- parameters in a specialization of a template classifier.
------------------------------------------------------------------------------
limited with AMF.UML.Classifiers;
with AMF.UML.Redefinable_Elements;
limited with AMF.UML.Redefinable_Template_Signatures.Collections;
limited with AMF.UML.Template_Parameters.Collections;
with AMF.UML.Template_Signatures;
package AMF.UML.Redefinable_Template_Signatures is
pragma Preelaborate;
type UML_Redefinable_Template_Signature is limited interface
and AMF.UML.Redefinable_Elements.UML_Redefinable_Element
and AMF.UML.Template_Signatures.UML_Template_Signature;
type UML_Redefinable_Template_Signature_Access is
access all UML_Redefinable_Template_Signature'Class;
for UML_Redefinable_Template_Signature_Access'Storage_Size use 0;
not overriding function Get_Classifier
(Self : not null access constant UML_Redefinable_Template_Signature)
return AMF.UML.Classifiers.UML_Classifier_Access is abstract;
-- Getter of RedefinableTemplateSignature::classifier.
--
-- The classifier that owns this template signature.
not overriding procedure Set_Classifier
(Self : not null access UML_Redefinable_Template_Signature;
To : AMF.UML.Classifiers.UML_Classifier_Access) is abstract;
-- Setter of RedefinableTemplateSignature::classifier.
--
-- The classifier that owns this template signature.
not overriding function Get_Extended_Signature
(Self : not null access constant UML_Redefinable_Template_Signature)
return AMF.UML.Redefinable_Template_Signatures.Collections.Set_Of_UML_Redefinable_Template_Signature is abstract;
-- Getter of RedefinableTemplateSignature::extendedSignature.
--
-- The template signature that is extended by this template signature.
not overriding function Get_Inherited_Parameter
(Self : not null access constant UML_Redefinable_Template_Signature)
return AMF.UML.Template_Parameters.Collections.Set_Of_UML_Template_Parameter is abstract;
-- Getter of RedefinableTemplateSignature::inheritedParameter.
--
-- The formal template parameters of the extendedSignature.
not overriding function Inherited_Parameter
(Self : not null access constant UML_Redefinable_Template_Signature)
return AMF.UML.Template_Parameters.Collections.Set_Of_UML_Template_Parameter is abstract;
-- Operation RedefinableTemplateSignature::inheritedParameter.
--
-- Missing derivation for
-- RedefinableTemplateSignature::/inheritedParameter : TemplateParameter
overriding function Is_Consistent_With
(Self : not null access constant UML_Redefinable_Template_Signature;
Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is abstract;
-- Operation RedefinableTemplateSignature::isConsistentWith.
--
-- The query isConsistentWith() specifies, for any two
-- RedefinableTemplateSignatures in a context in which redefinition is
-- possible, whether redefinition would be logically consistent. A
-- redefining template signature is always consistent with a redefined
-- template signature, since redefinition only adds new formal parameters.
end AMF.UML.Redefinable_Template_Signatures;
|
-----------------------------------------------------------------------
-- keystore-gpg_tests -- Test AKT with GPG2
-- Copyright (C) 2020 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Text_IO;
with Util.Test_Caller;
with Util.Log.Loggers;
with Util.Processes;
with Util.Streams.Buffered;
with Util.Streams.Pipes;
package body Keystore.Fuse_Tests is
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Keystore.Fuse_Tests");
CHECK_MOUNT_PATH : constant String := "regtests/files/check-mount.sh";
package Caller is new Util.Test_Caller (Test, "AKT.Fuse");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test AKT.Commands.Mount",
Test_Mount'Access);
Caller.Add_Test (Suite, "Test AKT.Commands.Mount (Fill)",
Test_Mount_Fill'Access);
Caller.Add_Test (Suite, "Test AKT.Commands.Mount (Clean)",
Test_Mount_Clean'Access);
Caller.Add_Test (Suite, "Test AKT.Commands.Mount (Check)",
Test_Mount_Check'Access);
Caller.Add_Test (Suite, "Test AKT.Commands.Mount (Stress)",
Test_Mount_Stress'Access);
end Add_Tests;
-- ------------------------------
-- Execute the command and get the output in a string.
-- ------------------------------
procedure Execute (T : in out Test;
Command : in String;
Input : in String;
Output : in String;
Result : out Ada.Strings.Unbounded.Unbounded_String;
Status : in Natural := 0) is
P : aliased Util.Streams.Pipes.Pipe_Stream;
Buffer : Util.Streams.Buffered.Input_Buffer_Stream;
begin
if Input'Length > 0 then
Log.Info ("Execute: {0} < {1}", Command, Input);
elsif Output'Length > 0 then
Log.Info ("Execute: {0} > {1}", Command, Output);
else
Log.Info ("Execute: {0}", Command);
end if;
P.Set_Input_Stream (Input);
P.Set_Output_Stream (Output);
P.Open (Command, Util.Processes.READ_ALL);
-- Write on the process input stream.
Result := Ada.Strings.Unbounded.Null_Unbounded_String;
Buffer.Initialize (P'Unchecked_Access, 8192);
Buffer.Read (Result);
P.Close;
Ada.Text_IO.Put_Line (Ada.Strings.Unbounded.To_String (Result));
Log.Info ("Command result: {0}", Result);
Util.Tests.Assert_Equals (T, Status, P.Get_Exit_Status, "Command '" & Command & "' failed");
end Execute;
procedure Execute (T : in out Test;
Command : in String;
Result : out Ada.Strings.Unbounded.Unbounded_String;
Status : in Natural := 0) is
begin
T.Execute (Command, "", "", Result, Status);
end Execute;
procedure Execute (T : in out Test;
Command : in String;
Expect : in String;
Status : in Natural := 0) is
Path : constant String := Util.Tests.Get_Test_Path ("regtests/expect/" & Expect);
Output : constant String := Util.Tests.Get_Test_Path ("regtests/result/" & Expect);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
T.Execute (Command, "", Output, Result, Status);
Util.Tests.Assert_Equal_Files (T, Path, Output, "Command '" & Command & "' invalid output");
end Execute;
-- ------------------------------
-- Test the akt keystore creation.
-- ------------------------------
procedure Test_Mount (T : in out Test) is
Tool : constant String := Util.Tests.Get_Test_Path (CHECK_MOUNT_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
-- Create keystore
T.Execute (Tool & " START", Result);
Util.Tests.Assert_Matches (T, "PASS", Result, "akt keystore creation failed");
end Test_Mount;
-- ------------------------------
-- Test the akt mount and filling the keystore.
-- ------------------------------
procedure Test_Mount_Fill (T : in out Test) is
Tool : constant String := Util.Tests.Get_Test_Path (CHECK_MOUNT_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
T.Execute (Tool & " FILL", Result);
Util.Tests.Assert_Matches (T, "PASS", Result,
"akt keystore mount+fill failed");
end Test_Mount_Fill;
-- ------------------------------
-- Test the akt mount and cleaning the keystore.
-- ------------------------------
procedure Test_Mount_Clean (T : in out Test) is
Tool : constant String := Util.Tests.Get_Test_Path (CHECK_MOUNT_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
T.Execute (Tool & " CLEAN", Result);
Util.Tests.Assert_Matches (T, "PASS", Result,
"akt keystore mount+clean failed");
end Test_Mount_Clean;
-- ------------------------------
-- Test the akt mount and checking its content.
-- ------------------------------
procedure Test_Mount_Check (T : in out Test) is
Tool : constant String := Util.Tests.Get_Test_Path (CHECK_MOUNT_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
T.Execute (Tool & " CHECK", Result);
Util.Tests.Assert_Matches (T, "PASS", Result,
"akt keystore mount+check after stress failed");
end Test_Mount_Check;
-- ------------------------------
-- Test the akt mount and stressing the filesystem.
-- ------------------------------
procedure Test_Mount_Stress (T : in out Test) is
Tool : constant String := Util.Tests.Get_Test_Path (CHECK_MOUNT_PATH);
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
T.Execute (Tool & " BIG", Result);
Util.Tests.Assert_Matches (T, "PASS", Result,
"akt keystore mount+check after stress failed");
end Test_Mount_Stress;
end Keystore.Fuse_Tests;
|
-- This package has been generated automatically by GNATtest.
-- Do not edit any part of it, see GNATtest documentation for more details.
-- begin read only
with Gnattest_Generated;
package Game.SaveLoad.Test_Data.Tests is
type Test is new GNATtest_Generated.GNATtest_Standard.Game.SaveLoad
.Test_Data
.Test with
null record;
procedure Test_Generate_Save_Name_3f9630_a0a8d0(Gnattest_T: in out Test);
-- game-saveload.ads:62:4:Generate_Save_Name:Test_GenerateSave_Name
end Game.SaveLoad.Test_Data.Tests;
-- end read only
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . S C A L A R _ V A L U E S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2001-2005, 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 2, 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 COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
--
--
--
--
--
--
--
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package defines the constants used for initializing scalar values
-- when pragma Initialize_Scalars is used. The actual values are defined
-- in the binder generated file. This package contains the Ada names that
-- are used by the generated code, which are linked to the actual values
-- by the use of pragma Import.
package System.Scalar_Values is
-- Note: logically this package should be Pure since it can be accessed
-- from pure units, but the IS_xxx variables below get set at run time,
-- so they have to be library level variables. In fact we only ever
-- access this from generated code, and the compiler knows that it is
-- OK to access this unit from generated code.
type Byte1 is mod 2 ** 8;
type Byte2 is mod 2 ** 16;
type Byte4 is mod 2 ** 32;
type Byte8 is mod 2 ** 64;
-- The explicit initializations here are not really required, since these
-- variables are always set by System.Scalar_Values.Initialize.
IS_Is1 : Byte1 := 0; -- Initialize 1 byte signed
IS_Is2 : Byte2 := 0; -- Initialize 2 byte signed
IS_Is4 : Byte4 := 0; -- Initialize 4 byte signed
IS_Is8 : Byte8 := 0; -- Initialize 8 byte signed
-- For the above cases, the undefined value (set by the binder -Sin switch)
-- is the largest negative number (1 followed by all zero bits).
IS_Iu1 : Byte1 := 0; -- Initialize 1 byte unsigned
IS_Iu2 : Byte2 := 0; -- Initialize 2 byte unsigned
IS_Iu4 : Byte4 := 0; -- Initialize 4 byte unsigned
IS_Iu8 : Byte8 := 0; -- Initialize 8 byte unsigned
-- For the above cases, the undefined value (set by the binder -Sin switch)
-- is the largest unsigned number (all 1 bits).
IS_Iz1 : Byte1 := 0; -- Initialize 1 byte zeroes
IS_Iz2 : Byte2 := 0; -- Initialize 2 byte zeroes
IS_Iz4 : Byte4 := 0; -- Initialize 4 byte zeroes
IS_Iz8 : Byte8 := 0; -- Initialize 8 byte zeroes
-- For the above cases, the undefined value (set by the binder -Sin switch)
-- is the zero (all 0 bits). This is used when zero is known to be an
-- invalid value.
-- The float definitions are aliased, because we use overlays to set them
IS_Isf : aliased Short_Float := 0.0; -- Initialize short float
IS_Ifl : aliased Float := 0.0; -- Initialize float
IS_Ilf : aliased Long_Float := 0.0; -- Initialize long float
IS_Ill : aliased Long_Long_Float := 0.0; -- Initialize long long float
procedure Initialize (Mode1 : Character; Mode2 : Character);
-- This procedure is called from the binder when Initialize_Scalars mode
-- is active. The arguments are the two characters from the -S switch,
-- with letters forced upper case. So for example if -S5a is given, then
-- Mode1 will be '5' and Mode2 will be 'A'. If the parameters are EV,
-- then this routine reads the environment variable GNAT_INIT_SCALARS.
-- The possible settings are the same as those for the -S switch (except
-- for EV), i.e. IN/LO/HO/xx, xx = 2 hex digits. If no -S switch is given
-- then the default of IN (invalid values) is passed on the call.
end System.Scalar_Values;
|
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="15">
<syndb class_id="0" tracking_level="0" version="0">
<userIPLatency>-1</userIPLatency>
<userIPName></userIPName>
<cdfg class_id="1" tracking_level="1" version="0" object_id="_0">
<name>conv_read</name>
<ret_bitwidth>32</ret_bitwidth>
<ports class_id="2" tracking_level="0" version="0">
<count>9</count>
<item_version>0</item_version>
<item class_id="3" tracking_level="1" version="0" object_id="_1">
<Value class_id="4" tracking_level="0" version="0">
<Obj class_id="5" tracking_level="0" version="0">
<type>1</type>
<id>1</id>
<name>cofm</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo class_id="6" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>cofm</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>512</bitwidth>
</Value>
<direction>2</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs class_id="7" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_2">
<Value>
<Obj>
<type>1</type>
<id>2</id>
<name>ofm_buff0_0</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>ofm_buff0[0]</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<direction>0</direction>
<if_type>1</if_type>
<array_size>56</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_3">
<Value>
<Obj>
<type>1</type>
<id>3</id>
<name>ofm_buff0_1</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>ofm_buff0[1]</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<direction>0</direction>
<if_type>1</if_type>
<array_size>56</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_4">
<Value>
<Obj>
<type>1</type>
<id>4</id>
<name>ofm_buff0_2</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>ofm_buff0[2]</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<direction>0</direction>
<if_type>1</if_type>
<array_size>56</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_5">
<Value>
<Obj>
<type>1</type>
<id>5</id>
<name>ofm_buff0_3</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>ofm_buff0[3]</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<direction>0</direction>
<if_type>1</if_type>
<array_size>56</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_6">
<Value>
<Obj>
<type>1</type>
<id>6</id>
<name>ofm_buff0_4</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>ofm_buff0[4]</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<direction>0</direction>
<if_type>1</if_type>
<array_size>56</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_7">
<Value>
<Obj>
<type>1</type>
<id>7</id>
<name>ofm_buff0_5</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>ofm_buff0[5]</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<direction>0</direction>
<if_type>1</if_type>
<array_size>56</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_8">
<Value>
<Obj>
<type>1</type>
<id>8</id>
<name>cofm_counter_read</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>cofm_counter</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<direction>0</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_9">
<Value>
<Obj>
<type>1</type>
<id>9</id>
<name>enable</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>enable</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<direction>0</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
</ports>
<nodes class_id="8" tracking_level="0" version="0">
<count>36</count>
<item_version>0</item_version>
<item class_id="9" tracking_level="1" version="0" object_id="_10">
<Value>
<Obj>
<type>0</type>
<id>11</id>
<name>enable_read</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>217</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item class_id="10" tracking_level="0" version="0">
<first>D:\Course\mSOC\final</first>
<second class_id="11" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="12" tracking_level="0" version="0">
<first class_id="13" tracking_level="0" version="0">
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>217</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>enable</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>58</item>
<item>59</item>
</oprand_edges>
<opcode>read</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>1</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_11">
<Value>
<Obj>
<type>0</type>
<id>12</id>
<name>cofm_counter_read_1</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>217</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>217</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>cofm_counter</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>61</item>
<item>62</item>
</oprand_edges>
<opcode>read</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>2</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_12">
<Value>
<Obj>
<type>0</type>
<id>13</id>
<name>_ln219</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>219</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>219</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>63</item>
<item>64</item>
<item>65</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>1.76</m_delay>
<m_topoIndex>3</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_13">
<Value>
<Obj>
<type>0</type>
<id>15</id>
<name>add_ln221</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>221</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>221</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>66</item>
<item>68</item>
</oprand_edges>
<opcode>add</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>2.55</m_delay>
<m_topoIndex>4</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_14">
<Value>
<Obj>
<type>0</type>
<id>16</id>
<name>_ln221</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>221</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>221</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>69</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>1.76</m_delay>
<m_topoIndex>5</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_15">
<Value>
<Obj>
<type>0</type>
<id>18</id>
<name>j_0</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>j</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>6</bitwidth>
</Value>
<oprand_edges>
<count>4</count>
<item_version>0</item_version>
<item>70</item>
<item>71</item>
<item>73</item>
<item>74</item>
</oprand_edges>
<opcode>phi</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>6</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_16">
<Value>
<Obj>
<type>0</type>
<id>19</id>
<name>icmp_ln221</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>221</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>221</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>75</item>
<item>77</item>
</oprand_edges>
<opcode>icmp</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>1.42</m_delay>
<m_topoIndex>7</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_17">
<Value>
<Obj>
<type>0</type>
<id>21</id>
<name>j</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>221</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>221</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>j</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>6</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>78</item>
<item>80</item>
</oprand_edges>
<opcode>add</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>1.82</m_delay>
<m_topoIndex>8</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_18">
<Value>
<Obj>
<type>0</type>
<id>22</id>
<name>_ln221</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>221</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>221</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>81</item>
<item>82</item>
<item>83</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>9</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_19">
<Value>
<Obj>
<type>0</type>
<id>26</id>
<name>zext_ln224</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>224</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>224</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>84</item>
</oprand_edges>
<opcode>zext</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>10</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_20">
<Value>
<Obj>
<type>0</type>
<id>27</id>
<name>ofm_buff0_0_addr</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>224</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>224</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>6</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>85</item>
<item>87</item>
<item>88</item>
</oprand_edges>
<opcode>getelementptr</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>11</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_21">
<Value>
<Obj>
<type>0</type>
<id>28</id>
<name>ofm_buff0_0_load</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>224</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>224</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>89</item>
</oprand_edges>
<opcode>load</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>3.25</m_delay>
<m_topoIndex>12</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_22">
<Value>
<Obj>
<type>0</type>
<id>29</id>
<name>bitcast_ln224</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>224</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>224</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>90</item>
</oprand_edges>
<opcode>bitcast</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>23</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_23">
<Value>
<Obj>
<type>0</type>
<id>30</id>
<name>cofm_read</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>224</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>224</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>512</bitwidth>
</Value>
<oprand_edges>
<count>2</count>
<item_version>0</item_version>
<item>92</item>
<item>93</item>
</oprand_edges>
<opcode>read</opcode>
<m_Display>1</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>1</m_isLCDNode>
<m_isStartOfPath>1</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>24</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_24">
<Value>
<Obj>
<type>0</type>
<id>31</id>
<name>ofm_buff0_1_addr</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>225</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>225</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>6</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>94</item>
<item>95</item>
<item>96</item>
</oprand_edges>
<opcode>getelementptr</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>13</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_25">
<Value>
<Obj>
<type>0</type>
<id>32</id>
<name>ofm_buff0_1_load</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>225</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>225</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>97</item>
</oprand_edges>
<opcode>load</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>3.25</m_delay>
<m_topoIndex>14</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_26">
<Value>
<Obj>
<type>0</type>
<id>33</id>
<name>bitcast_ln225</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>225</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>225</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>98</item>
</oprand_edges>
<opcode>bitcast</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>25</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_27">
<Value>
<Obj>
<type>0</type>
<id>34</id>
<name>ofm_buff0_2_addr</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>226</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>226</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>6</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>99</item>
<item>100</item>
<item>101</item>
</oprand_edges>
<opcode>getelementptr</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>15</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_28">
<Value>
<Obj>
<type>0</type>
<id>35</id>
<name>ofm_buff0_2_load</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>226</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>226</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>102</item>
</oprand_edges>
<opcode>load</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>3.25</m_delay>
<m_topoIndex>16</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_29">
<Value>
<Obj>
<type>0</type>
<id>36</id>
<name>bitcast_ln226</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>226</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>226</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>103</item>
</oprand_edges>
<opcode>bitcast</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>26</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_30">
<Value>
<Obj>
<type>0</type>
<id>37</id>
<name>ofm_buff0_3_addr</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>227</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>227</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>6</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>104</item>
<item>105</item>
<item>106</item>
</oprand_edges>
<opcode>getelementptr</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>17</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_31">
<Value>
<Obj>
<type>0</type>
<id>38</id>
<name>ofm_buff0_3_load</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>227</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>227</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>107</item>
</oprand_edges>
<opcode>load</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>3.25</m_delay>
<m_topoIndex>18</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_32">
<Value>
<Obj>
<type>0</type>
<id>39</id>
<name>bitcast_ln227</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>227</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>227</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>108</item>
</oprand_edges>
<opcode>bitcast</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>27</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_33">
<Value>
<Obj>
<type>0</type>
<id>40</id>
<name>ofm_buff0_4_addr</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>228</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>228</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>6</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>109</item>
<item>110</item>
<item>111</item>
</oprand_edges>
<opcode>getelementptr</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>19</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_34">
<Value>
<Obj>
<type>0</type>
<id>41</id>
<name>ofm_buff0_4_load</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>228</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>228</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>112</item>
</oprand_edges>
<opcode>load</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>3.25</m_delay>
<m_topoIndex>20</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_35">
<Value>
<Obj>
<type>0</type>
<id>42</id>
<name>bitcast_ln228</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>228</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>228</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>113</item>
</oprand_edges>
<opcode>bitcast</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>28</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_36">
<Value>
<Obj>
<type>0</type>
<id>43</id>
<name>ofm_buff0_5_addr</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>229</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>229</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>6</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>114</item>
<item>115</item>
<item>116</item>
</oprand_edges>
<opcode>getelementptr</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>21</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_37">
<Value>
<Obj>
<type>0</type>
<id>44</id>
<name>ofm_buff0_5_load</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>229</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>229</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>117</item>
</oprand_edges>
<opcode>load</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>3.25</m_delay>
<m_topoIndex>22</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_38">
<Value>
<Obj>
<type>0</type>
<id>45</id>
<name>bitcast_ln229</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>229</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>229</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>118</item>
</oprand_edges>
<opcode>bitcast</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>29</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_39">
<Value>
<Obj>
<type>0</type>
<id>46</id>
<name>tmp_3</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>229</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>229</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>192</bitwidth>
</Value>
<oprand_edges>
<count>7</count>
<item_version>0</item_version>
<item>120</item>
<item>121</item>
<item>122</item>
<item>123</item>
<item>124</item>
<item>125</item>
<item>126</item>
</oprand_edges>
<opcode>bitconcatenate</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>30</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_40">
<Value>
<Obj>
<type>0</type>
<id>47</id>
<name>cofm_b5_addr1516_par</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>229</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>229</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>512</bitwidth>
</Value>
<oprand_edges>
<count>5</count>
<item_version>0</item_version>
<item>128</item>
<item>129</item>
<item>130</item>
<item>132</item>
<item>134</item>
</oprand_edges>
<opcode>partset</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>31</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_41">
<Value>
<Obj>
<type>0</type>
<id>48</id>
<name>cofm_write_ln229</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>229</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>229</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>5</count>
<item_version>0</item_version>
<item>136</item>
<item>137</item>
<item>138</item>
<item>201</item>
<item>2147483647</item>
</oprand_edges>
<opcode>write</opcode>
<m_Display>1</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>1</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>32</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_42">
<Value>
<Obj>
<type>0</type>
<id>50</id>
<name>_ln221</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>221</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>221</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>139</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>33</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_43">
<Value>
<Obj>
<type>0</type>
<id>52</id>
<name>_ln0</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>140</item>
</oprand_edges>
<opcode>br</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>1.76</m_delay>
<m_topoIndex>34</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_44">
<Value>
<Obj>
<type>0</type>
<id>54</id>
<name>cofm_counter_1</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>217</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>217</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>4</count>
<item_version>0</item_version>
<item>141</item>
<item>142</item>
<item>143</item>
<item>144</item>
</oprand_edges>
<opcode>phi</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>35</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
<item class_id_reference="9" object_id="_45">
<Value>
<Obj>
<type>0</type>
<id>55</id>
<name>_ln244</name>
<fileName>finalpool.cpp</fileName>
<fileDirectory>D:\Course\mSOC\final</fileDirectory>
<lineNumber>244</lineNumber>
<contextFuncName>conv_read</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>D:\Course\mSOC\final</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>finalpool.cpp</first>
<second>conv_read</second>
</first>
<second>244</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>145</item>
</oprand_edges>
<opcode>ret</opcode>
<m_Display>0</m_Display>
<m_isOnCriticalPath>0</m_isOnCriticalPath>
<m_isLCDNode>0</m_isLCDNode>
<m_isStartOfPath>0</m_isStartOfPath>
<m_delay>0.00</m_delay>
<m_topoIndex>36</m_topoIndex>
<m_clusterGroupNumber>-1</m_clusterGroupNumber>
</item>
</nodes>
<consts class_id="15" tracking_level="0" version="0">
<count>7</count>
<item_version>0</item_version>
<item class_id="16" tracking_level="1" version="0" object_id="_46">
<Value>
<Obj>
<type>2</type>
<id>67</id>
<name>empty</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>56</content>
</item>
<item class_id_reference="16" object_id="_47">
<Value>
<Obj>
<type>2</type>
<id>72</id>
<name>empty</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>6</bitwidth>
</Value>
<const_type>0</const_type>
<content>0</content>
</item>
<item class_id_reference="16" object_id="_48">
<Value>
<Obj>
<type>2</type>
<id>76</id>
<name>empty</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>6</bitwidth>
</Value>
<const_type>0</const_type>
<content>56</content>
</item>
<item class_id_reference="16" object_id="_49">
<Value>
<Obj>
<type>2</type>
<id>79</id>
<name>empty</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>6</bitwidth>
</Value>
<const_type>0</const_type>
<content>1</content>
</item>
<item class_id_reference="16" object_id="_50">
<Value>
<Obj>
<type>2</type>
<id>86</id>
<name>empty</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<const_type>0</const_type>
<content>0</content>
</item>
<item class_id_reference="16" object_id="_51">
<Value>
<Obj>
<type>2</type>
<id>131</id>
<name>empty</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>0</content>
</item>
<item class_id_reference="16" object_id="_52">
<Value>
<Obj>
<type>2</type>
<id>133</id>
<name>empty</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<const_type>0</const_type>
<content>191</content>
</item>
</consts>
<blocks class_id="17" tracking_level="0" version="0">
<count>6</count>
<item_version>0</item_version>
<item class_id="18" tracking_level="1" version="0" object_id="_53">
<Obj>
<type>3</type>
<id>14</id>
<name></name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<node_objs>
<count>3</count>
<item_version>0</item_version>
<item>11</item>
<item>12</item>
<item>13</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_54">
<Obj>
<type>3</type>
<id>17</id>
<name>.preheader.preheader</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<node_objs>
<count>2</count>
<item_version>0</item_version>
<item>15</item>
<item>16</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_55">
<Obj>
<type>3</type>
<id>23</id>
<name>.preheader</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<node_objs>
<count>4</count>
<item_version>0</item_version>
<item>18</item>
<item>19</item>
<item>21</item>
<item>22</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_56">
<Obj>
<type>3</type>
<id>51</id>
<name>hls_label_6</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<node_objs>
<count>24</count>
<item_version>0</item_version>
<item>26</item>
<item>27</item>
<item>28</item>
<item>29</item>
<item>30</item>
<item>31</item>
<item>32</item>
<item>33</item>
<item>34</item>
<item>35</item>
<item>36</item>
<item>37</item>
<item>38</item>
<item>39</item>
<item>40</item>
<item>41</item>
<item>42</item>
<item>43</item>
<item>44</item>
<item>45</item>
<item>46</item>
<item>47</item>
<item>48</item>
<item>50</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_57">
<Obj>
<type>3</type>
<id>53</id>
<name>.loopexit.loopexit</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<node_objs>
<count>1</count>
<item_version>0</item_version>
<item>52</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_58">
<Obj>
<type>3</type>
<id>56</id>
<name>.loopexit</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<node_objs>
<count>2</count>
<item_version>0</item_version>
<item>54</item>
<item>55</item>
</node_objs>
</item>
</blocks>
<edges class_id="19" tracking_level="0" version="0">
<count>79</count>
<item_version>0</item_version>
<item class_id="20" tracking_level="1" version="0" object_id="_59">
<id>59</id>
<edge_type>1</edge_type>
<source_obj>9</source_obj>
<sink_obj>11</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_60">
<id>62</id>
<edge_type>1</edge_type>
<source_obj>8</source_obj>
<sink_obj>12</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_61">
<id>63</id>
<edge_type>1</edge_type>
<source_obj>11</source_obj>
<sink_obj>13</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_62">
<id>64</id>
<edge_type>2</edge_type>
<source_obj>56</source_obj>
<sink_obj>13</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_63">
<id>65</id>
<edge_type>2</edge_type>
<source_obj>17</source_obj>
<sink_obj>13</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_64">
<id>66</id>
<edge_type>1</edge_type>
<source_obj>12</source_obj>
<sink_obj>15</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_65">
<id>68</id>
<edge_type>1</edge_type>
<source_obj>67</source_obj>
<sink_obj>15</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_66">
<id>69</id>
<edge_type>2</edge_type>
<source_obj>23</source_obj>
<sink_obj>16</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_67">
<id>70</id>
<edge_type>1</edge_type>
<source_obj>21</source_obj>
<sink_obj>18</sink_obj>
<is_back_edge>1</is_back_edge>
</item>
<item class_id_reference="20" object_id="_68">
<id>71</id>
<edge_type>2</edge_type>
<source_obj>51</source_obj>
<sink_obj>18</sink_obj>
<is_back_edge>1</is_back_edge>
</item>
<item class_id_reference="20" object_id="_69">
<id>73</id>
<edge_type>1</edge_type>
<source_obj>72</source_obj>
<sink_obj>18</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_70">
<id>74</id>
<edge_type>2</edge_type>
<source_obj>17</source_obj>
<sink_obj>18</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_71">
<id>75</id>
<edge_type>1</edge_type>
<source_obj>18</source_obj>
<sink_obj>19</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_72">
<id>77</id>
<edge_type>1</edge_type>
<source_obj>76</source_obj>
<sink_obj>19</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_73">
<id>78</id>
<edge_type>1</edge_type>
<source_obj>18</source_obj>
<sink_obj>21</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_74">
<id>80</id>
<edge_type>1</edge_type>
<source_obj>79</source_obj>
<sink_obj>21</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_75">
<id>81</id>
<edge_type>1</edge_type>
<source_obj>19</source_obj>
<sink_obj>22</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_76">
<id>82</id>
<edge_type>2</edge_type>
<source_obj>51</source_obj>
<sink_obj>22</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_77">
<id>83</id>
<edge_type>2</edge_type>
<source_obj>53</source_obj>
<sink_obj>22</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_78">
<id>84</id>
<edge_type>1</edge_type>
<source_obj>18</source_obj>
<sink_obj>26</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_79">
<id>85</id>
<edge_type>1</edge_type>
<source_obj>2</source_obj>
<sink_obj>27</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_80">
<id>87</id>
<edge_type>1</edge_type>
<source_obj>86</source_obj>
<sink_obj>27</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_81">
<id>88</id>
<edge_type>1</edge_type>
<source_obj>26</source_obj>
<sink_obj>27</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_82">
<id>89</id>
<edge_type>1</edge_type>
<source_obj>27</source_obj>
<sink_obj>28</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_83">
<id>90</id>
<edge_type>1</edge_type>
<source_obj>28</source_obj>
<sink_obj>29</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_84">
<id>93</id>
<edge_type>1</edge_type>
<source_obj>1</source_obj>
<sink_obj>30</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_85">
<id>94</id>
<edge_type>1</edge_type>
<source_obj>3</source_obj>
<sink_obj>31</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_86">
<id>95</id>
<edge_type>1</edge_type>
<source_obj>86</source_obj>
<sink_obj>31</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_87">
<id>96</id>
<edge_type>1</edge_type>
<source_obj>26</source_obj>
<sink_obj>31</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_88">
<id>97</id>
<edge_type>1</edge_type>
<source_obj>31</source_obj>
<sink_obj>32</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_89">
<id>98</id>
<edge_type>1</edge_type>
<source_obj>32</source_obj>
<sink_obj>33</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_90">
<id>99</id>
<edge_type>1</edge_type>
<source_obj>4</source_obj>
<sink_obj>34</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_91">
<id>100</id>
<edge_type>1</edge_type>
<source_obj>86</source_obj>
<sink_obj>34</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_92">
<id>101</id>
<edge_type>1</edge_type>
<source_obj>26</source_obj>
<sink_obj>34</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_93">
<id>102</id>
<edge_type>1</edge_type>
<source_obj>34</source_obj>
<sink_obj>35</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_94">
<id>103</id>
<edge_type>1</edge_type>
<source_obj>35</source_obj>
<sink_obj>36</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_95">
<id>104</id>
<edge_type>1</edge_type>
<source_obj>5</source_obj>
<sink_obj>37</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_96">
<id>105</id>
<edge_type>1</edge_type>
<source_obj>86</source_obj>
<sink_obj>37</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_97">
<id>106</id>
<edge_type>1</edge_type>
<source_obj>26</source_obj>
<sink_obj>37</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_98">
<id>107</id>
<edge_type>1</edge_type>
<source_obj>37</source_obj>
<sink_obj>38</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_99">
<id>108</id>
<edge_type>1</edge_type>
<source_obj>38</source_obj>
<sink_obj>39</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_100">
<id>109</id>
<edge_type>1</edge_type>
<source_obj>6</source_obj>
<sink_obj>40</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_101">
<id>110</id>
<edge_type>1</edge_type>
<source_obj>86</source_obj>
<sink_obj>40</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_102">
<id>111</id>
<edge_type>1</edge_type>
<source_obj>26</source_obj>
<sink_obj>40</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_103">
<id>112</id>
<edge_type>1</edge_type>
<source_obj>40</source_obj>
<sink_obj>41</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_104">
<id>113</id>
<edge_type>1</edge_type>
<source_obj>41</source_obj>
<sink_obj>42</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_105">
<id>114</id>
<edge_type>1</edge_type>
<source_obj>7</source_obj>
<sink_obj>43</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_106">
<id>115</id>
<edge_type>1</edge_type>
<source_obj>86</source_obj>
<sink_obj>43</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_107">
<id>116</id>
<edge_type>1</edge_type>
<source_obj>26</source_obj>
<sink_obj>43</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_108">
<id>117</id>
<edge_type>1</edge_type>
<source_obj>43</source_obj>
<sink_obj>44</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_109">
<id>118</id>
<edge_type>1</edge_type>
<source_obj>44</source_obj>
<sink_obj>45</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_110">
<id>121</id>
<edge_type>1</edge_type>
<source_obj>45</source_obj>
<sink_obj>46</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_111">
<id>122</id>
<edge_type>1</edge_type>
<source_obj>42</source_obj>
<sink_obj>46</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_112">
<id>123</id>
<edge_type>1</edge_type>
<source_obj>39</source_obj>
<sink_obj>46</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_113">
<id>124</id>
<edge_type>1</edge_type>
<source_obj>36</source_obj>
<sink_obj>46</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_114">
<id>125</id>
<edge_type>1</edge_type>
<source_obj>33</source_obj>
<sink_obj>46</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_115">
<id>126</id>
<edge_type>1</edge_type>
<source_obj>29</source_obj>
<sink_obj>46</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_116">
<id>129</id>
<edge_type>1</edge_type>
<source_obj>30</source_obj>
<sink_obj>47</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_117">
<id>130</id>
<edge_type>1</edge_type>
<source_obj>46</source_obj>
<sink_obj>47</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_118">
<id>132</id>
<edge_type>1</edge_type>
<source_obj>131</source_obj>
<sink_obj>47</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_119">
<id>134</id>
<edge_type>1</edge_type>
<source_obj>133</source_obj>
<sink_obj>47</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_120">
<id>137</id>
<edge_type>1</edge_type>
<source_obj>1</source_obj>
<sink_obj>48</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_121">
<id>138</id>
<edge_type>1</edge_type>
<source_obj>47</source_obj>
<sink_obj>48</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_122">
<id>139</id>
<edge_type>2</edge_type>
<source_obj>23</source_obj>
<sink_obj>50</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_123">
<id>140</id>
<edge_type>2</edge_type>
<source_obj>56</source_obj>
<sink_obj>52</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_124">
<id>141</id>
<edge_type>1</edge_type>
<source_obj>12</source_obj>
<sink_obj>54</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_125">
<id>142</id>
<edge_type>2</edge_type>
<source_obj>14</source_obj>
<sink_obj>54</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_126">
<id>143</id>
<edge_type>1</edge_type>
<source_obj>15</source_obj>
<sink_obj>54</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_127">
<id>144</id>
<edge_type>2</edge_type>
<source_obj>53</source_obj>
<sink_obj>54</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_128">
<id>145</id>
<edge_type>1</edge_type>
<source_obj>54</source_obj>
<sink_obj>55</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_129">
<id>194</id>
<edge_type>2</edge_type>
<source_obj>14</source_obj>
<sink_obj>17</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_130">
<id>195</id>
<edge_type>2</edge_type>
<source_obj>14</source_obj>
<sink_obj>56</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_131">
<id>196</id>
<edge_type>2</edge_type>
<source_obj>17</source_obj>
<sink_obj>23</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_132">
<id>197</id>
<edge_type>2</edge_type>
<source_obj>23</source_obj>
<sink_obj>53</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_133">
<id>198</id>
<edge_type>2</edge_type>
<source_obj>23</source_obj>
<sink_obj>51</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_134">
<id>199</id>
<edge_type>2</edge_type>
<source_obj>51</source_obj>
<sink_obj>23</sink_obj>
<is_back_edge>1</is_back_edge>
</item>
<item class_id_reference="20" object_id="_135">
<id>200</id>
<edge_type>2</edge_type>
<source_obj>53</source_obj>
<sink_obj>56</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_136">
<id>201</id>
<edge_type>4</edge_type>
<source_obj>30</source_obj>
<sink_obj>48</sink_obj>
<is_back_edge>0</is_back_edge>
</item>
<item class_id_reference="20" object_id="_137">
<id>2147483647</id>
<edge_type>1</edge_type>
<source_obj>48</source_obj>
<sink_obj>30</sink_obj>
<is_back_edge>1</is_back_edge>
</item>
</edges>
</cdfg>
<cdfg_regions class_id="21" tracking_level="0" version="0">
<count>5</count>
<item_version>0</item_version>
<item class_id="22" tracking_level="1" version="0" object_id="_138">
<mId>1</mId>
<mTag>conv_read</mTag>
<mType>0</mType>
<sub_regions>
<count>4</count>
<item_version>0</item_version>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
</sub_regions>
<basic_blocks>
<count>0</count>
<item_version>0</item_version>
</basic_blocks>
<mII>-1</mII>
<mDepth>-1</mDepth>
<mMinTripCount>-1</mMinTripCount>
<mMaxTripCount>-1</mMaxTripCount>
<mMinLatency>1</mMinLatency>
<mMaxLatency>115</mMaxLatency>
<mIsDfPipe>0</mIsDfPipe>
<mDfPipe class_id="-1"></mDfPipe>
</item>
<item class_id_reference="22" object_id="_139">
<mId>2</mId>
<mTag>Entry</mTag>
<mType>0</mType>
<sub_regions>
<count>0</count>
<item_version>0</item_version>
</sub_regions>
<basic_blocks>
<count>2</count>
<item_version>0</item_version>
<item>14</item>
<item>17</item>
</basic_blocks>
<mII>-1</mII>
<mDepth>-1</mDepth>
<mMinTripCount>-1</mMinTripCount>
<mMaxTripCount>-1</mMaxTripCount>
<mMinLatency>0</mMinLatency>
<mMaxLatency>0</mMaxLatency>
<mIsDfPipe>0</mIsDfPipe>
<mDfPipe class_id="-1"></mDfPipe>
</item>
<item class_id_reference="22" object_id="_140">
<mId>3</mId>
<mTag>Loop 1</mTag>
<mType>1</mType>
<sub_regions>
<count>0</count>
<item_version>0</item_version>
</sub_regions>
<basic_blocks>
<count>2</count>
<item_version>0</item_version>
<item>23</item>
<item>51</item>
</basic_blocks>
<mII>2</mII>
<mDepth>3</mDepth>
<mMinTripCount>56</mMinTripCount>
<mMaxTripCount>56</mMaxTripCount>
<mMinLatency>112</mMinLatency>
<mMaxLatency>112</mMaxLatency>
<mIsDfPipe>0</mIsDfPipe>
<mDfPipe class_id="-1"></mDfPipe>
</item>
<item class_id_reference="22" object_id="_141">
<mId>4</mId>
<mTag>Region 1</mTag>
<mType>0</mType>
<sub_regions>
<count>0</count>
<item_version>0</item_version>
</sub_regions>
<basic_blocks>
<count>1</count>
<item_version>0</item_version>
<item>53</item>
</basic_blocks>
<mII>-1</mII>
<mDepth>-1</mDepth>
<mMinTripCount>-1</mMinTripCount>
<mMaxTripCount>-1</mMaxTripCount>
<mMinLatency>0</mMinLatency>
<mMaxLatency>0</mMaxLatency>
<mIsDfPipe>0</mIsDfPipe>
<mDfPipe class_id="-1"></mDfPipe>
</item>
<item class_id_reference="22" object_id="_142">
<mId>5</mId>
<mTag>Return</mTag>
<mType>0</mType>
<sub_regions>
<count>0</count>
<item_version>0</item_version>
</sub_regions>
<basic_blocks>
<count>1</count>
<item_version>0</item_version>
<item>56</item>
</basic_blocks>
<mII>-1</mII>
<mDepth>-1</mDepth>
<mMinTripCount>-1</mMinTripCount>
<mMaxTripCount>-1</mMaxTripCount>
<mMinLatency>0</mMinLatency>
<mMaxLatency>0</mMaxLatency>
<mIsDfPipe>0</mIsDfPipe>
<mDfPipe class_id="-1"></mDfPipe>
</item>
</cdfg_regions>
<fsm class_id="-1"></fsm>
<res class_id="-1"></res>
<node_label_latency class_id="26" tracking_level="0" version="0">
<count>36</count>
<item_version>0</item_version>
<item class_id="27" tracking_level="0" version="0">
<first>11</first>
<second class_id="28" tracking_level="0" version="0">
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>12</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>13</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>15</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>16</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>18</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>19</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>21</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>22</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>26</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>27</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>28</first>
<second>
<first>1</first>
<second>1</second>
</second>
</item>
<item>
<first>29</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>30</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>31</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>32</first>
<second>
<first>1</first>
<second>1</second>
</second>
</item>
<item>
<first>33</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>34</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>35</first>
<second>
<first>1</first>
<second>1</second>
</second>
</item>
<item>
<first>36</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>37</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>38</first>
<second>
<first>1</first>
<second>1</second>
</second>
</item>
<item>
<first>39</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>40</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>41</first>
<second>
<first>1</first>
<second>1</second>
</second>
</item>
<item>
<first>42</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>43</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
<item>
<first>44</first>
<second>
<first>1</first>
<second>1</second>
</second>
</item>
<item>
<first>45</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>46</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>47</first>
<second>
<first>2</first>
<second>0</second>
</second>
</item>
<item>
<first>48</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>50</first>
<second>
<first>3</first>
<second>0</second>
</second>
</item>
<item>
<first>52</first>
<second>
<first>4</first>
<second>0</second>
</second>
</item>
<item>
<first>54</first>
<second>
<first>5</first>
<second>0</second>
</second>
</item>
<item>
<first>55</first>
<second>
<first>5</first>
<second>0</second>
</second>
</item>
</node_label_latency>
<bblk_ent_exit class_id="29" tracking_level="0" version="0">
<count>6</count>
<item_version>0</item_version>
<item class_id="30" tracking_level="0" version="0">
<first>14</first>
<second class_id="31" tracking_level="0" version="0">
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>17</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>23</first>
<second>
<first>1</first>
<second>1</second>
</second>
</item>
<item>
<first>51</first>
<second>
<first>1</first>
<second>3</second>
</second>
</item>
<item>
<first>53</first>
<second>
<first>2</first>
<second>2</second>
</second>
</item>
<item>
<first>56</first>
<second>
<first>3</first>
<second>3</second>
</second>
</item>
</bblk_ent_exit>
<regions class_id="32" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="33" tracking_level="1" version="0" object_id="_143">
<region_name>Loop 1</region_name>
<basic_blocks>
<count>2</count>
<item_version>0</item_version>
<item>23</item>
<item>51</item>
</basic_blocks>
<nodes>
<count>0</count>
<item_version>0</item_version>
</nodes>
<anchor_node>-1</anchor_node>
<region_type>8</region_type>
<interval>2</interval>
<pipe_depth>3</pipe_depth>
</item>
</regions>
<dp_fu_nodes class_id="34" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_fu_nodes>
<dp_fu_nodes_expression class_id="35" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_fu_nodes_expression>
<dp_fu_nodes_module>
<count>0</count>
<item_version>0</item_version>
</dp_fu_nodes_module>
<dp_fu_nodes_io>
<count>0</count>
<item_version>0</item_version>
</dp_fu_nodes_io>
<return_ports>
<count>0</count>
<item_version>0</item_version>
</return_ports>
<dp_mem_port_nodes class_id="36" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_mem_port_nodes>
<dp_reg_nodes>
<count>0</count>
<item_version>0</item_version>
</dp_reg_nodes>
<dp_regname_nodes>
<count>0</count>
<item_version>0</item_version>
</dp_regname_nodes>
<dp_reg_phi>
<count>0</count>
<item_version>0</item_version>
</dp_reg_phi>
<dp_regname_phi>
<count>0</count>
<item_version>0</item_version>
</dp_regname_phi>
<dp_port_io_nodes class_id="37" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_port_io_nodes>
<port2core class_id="38" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</port2core>
<node2core>
<count>0</count>
<item_version>0</item_version>
</node2core>
</syndb>
</boost_serialization>
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . S T A C K _ C H E C K I N G --
-- --
-- S p e c --
-- --
-- Copyright (C) 1999-2009, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides a system-independent implementation of stack
-- checking using comparison with stack base and limit.
-- This package defines basic types and objects. Operations related to
-- stack checking can be found in package System.Stack_Checking.Operations.
pragma Compiler_Unit;
with System.Storage_Elements;
package System.Stack_Checking is
pragma Preelaborate;
pragma Elaborate_Body;
-- This unit has a junk null body. The reason is that historically we
-- used to have a real body, and it causes bootstrapping path problems
-- to eliminate it, since the old body may still be present in the
-- compilation environment for a build.
type Stack_Info is record
Limit : System.Address := System.Null_Address;
Base : System.Address := System.Null_Address;
Size : System.Storage_Elements.Storage_Offset := 0;
end record;
-- This record may be part of a larger data structure like the
-- task control block in the tasking case.
-- This specific layout has the advantage of being compatible with the
-- Intel x86 BOUNDS instruction.
type Stack_Access is access all Stack_Info;
-- Unique local storage associated with a specific task. This storage is
-- used for the stack base and limit, and is returned by Checked_Self.
-- Only self may write this information, it may be read by any task.
-- At no time the address range Limit .. Base (or Base .. Limit for
-- upgrowing stack) may contain any address that is part of another stack.
-- The Stack_Access may be part of a larger data structure.
Multi_Processor : constant Boolean := False; -- Not supported yet
private
Null_Stack_Info : aliased Stack_Info :=
(Limit => System.Null_Address,
Base => System.Null_Address,
Size => 0);
-- Use explicit assignment to avoid elaboration code (call to init proc)
Null_Stack : constant Stack_Access := Null_Stack_Info'Access;
-- Stack_Access value that will return a Stack_Base and Stack_Limit
-- that fail any stack check.
end System.Stack_Checking;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- P R J --
-- --
-- S p e c --
-- --
-- Copyright (C) 2001-2014, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. 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. --
-- --
------------------------------------------------------------------------------
-- The following package declares the data types for GNAT project.
-- These data types may be used by GNAT Project-aware tools.
-- Children of these package implements various services on these data types.
-- See in particular Prj.Pars and Prj.Env.
with Casing; use Casing;
with Namet; use Namet;
with Osint;
with Scans; use Scans;
with Types; use Types;
with GNAT.Dynamic_HTables; use GNAT.Dynamic_HTables;
with GNAT.Dynamic_Tables;
with GNAT.OS_Lib; use GNAT.OS_Lib;
package Prj is
procedure Add_Restricted_Language (Name : String);
-- Call by gprbuild for each language specify by switch
-- --restricted-to-languages=.
procedure Remove_All_Restricted_Languages;
-- Call by gprbuild in CodePeer mode to ignore switches
-- --restricted-to-languages=.
function Is_Allowed_Language (Name : Name_Id) return Boolean;
-- Returns True if --restricted-to-languages= is not used or if Name
-- is one of the restricted languages.
All_Other_Names : constant Name_Id := Names_High_Bound;
-- Name used to replace others as an index of an associative array
-- attribute in situations where this is allowed.
Subdirs : String_Ptr := null;
-- The value after the equal sign in switch --subdirs=...
-- Contains the relative subdirectory.
type Library_Support is (None, Static_Only, Full);
-- Support for Library Project File.
-- - None: Library Project Files are not supported at all
-- - Static_Only: Library Project Files are only supported for static
-- libraries.
-- - Full: Library Project Files are supported for static and dynamic
-- (shared) libraries.
type Yes_No_Unknown is (Yes, No, Unknown);
-- Tri-state to decide if -lgnarl is needed when linking
type Attribute_Default_Value is
(Read_Only_Value, -- For read only attributes (Name, Project_Dir)
Empty_Value, -- Empty string or empty string list
Dot_Value, -- "." or (".")
Object_Dir_Value, -- 'Object_Dir
Target_Value, -- 'Target (special rules)
Runtime_Value); -- 'Runtime (special rules)
-- Describe the default values of attributes that are referenced but not
-- declared.
pragma Warnings (Off);
type Project_Qualifier is
(Unspecified,
-- The following clash with Standard is OK, and justified by the context
-- which really wants to use the same set of qualifiers.
Standard,
Library,
Configuration,
Abstract_Project,
Aggregate,
Aggregate_Library);
pragma Warnings (On);
-- Qualifiers that can prefix the reserved word "project" in a project
-- file:
-- Standard: standard project ...
-- Library: library project is ...
-- Abstract_Project: abstract project is
-- Aggregate: aggregate project is
-- Aggregate_Library: aggregate library project is ...
-- Configuration: configuration project is ...
subtype Aggregate_Project is
Project_Qualifier range Aggregate .. Aggregate_Library;
All_Packages : constant String_List_Access;
-- Default value of parameter Packages of procedures Parse, in Prj.Pars and
-- Prj.Part, indicating that all packages should be checked.
type Project_Tree_Data;
type Project_Tree_Ref is access all Project_Tree_Data;
-- Reference to a project tree. Several project trees may exist in memory
-- at the same time.
No_Project_Tree : constant Project_Tree_Ref;
procedure Free (Tree : in out Project_Tree_Ref);
-- Free memory associated with the tree
Config_Project_File_Extension : String := ".cgpr";
Project_File_Extension : String := ".gpr";
-- The standard config and user project file name extensions. They are not
-- constants, because Canonical_Case_File_Name is called on these variables
-- in the body of Prj.
function Empty_File return File_Name_Type;
function Empty_String return Name_Id;
-- Return the id for an empty string ""
function Dot_String return Name_Id;
-- Return the id for "."
type Path_Information is record
Name : Path_Name_Type := No_Path;
Display_Name : Path_Name_Type := No_Path;
end record;
-- Directory names always end with a directory separator
No_Path_Information : constant Path_Information := (No_Path, No_Path);
type Project_Data;
type Project_Id is access all Project_Data;
No_Project : constant Project_Id := null;
-- Id of a Project File
type String_List_Id is new Nat;
Nil_String : constant String_List_Id := 0;
type String_Element is record
Value : Name_Id := No_Name;
Index : Int := 0;
Display_Value : Name_Id := No_Name;
Location : Source_Ptr := No_Location;
Flag : Boolean := False;
Next : String_List_Id := Nil_String;
end record;
-- To hold values for string list variables and array elements.
-- Component Flag may be used for various purposes. For source
-- directories, it indicates if the directory contains Ada source(s).
package String_Element_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => String_Element,
Table_Index_Type => String_List_Id,
Table_Low_Bound => 1,
Table_Initial => 200,
Table_Increment => 100);
-- The table for string elements in string lists
type Variable_Kind is (Undefined, List, Single);
-- Different kinds of variables
subtype Defined_Variable_Kind is Variable_Kind range List .. Single;
-- The defined kinds of variables
Ignored : constant Variable_Kind;
-- Used to indicate that a package declaration must be ignored while
-- processing the project tree (unknown package name).
type Variable_Value (Kind : Variable_Kind := Undefined) is record
Project : Project_Id := No_Project;
Location : Source_Ptr := No_Location;
Default : Boolean := False;
case Kind is
when Undefined =>
null;
when List =>
Values : String_List_Id := Nil_String;
when Single =>
Value : Name_Id := No_Name;
Index : Int := 0;
end case;
end record;
-- Values for variables and array elements. Default is True if the
-- current value is the default one for the variable.
Nil_Variable_Value : constant Variable_Value;
-- Value of a non existing variable or array element
type Variable_Id is new Nat;
No_Variable : constant Variable_Id := 0;
type Variable is record
Next : Variable_Id := No_Variable;
Name : Name_Id;
Value : Variable_Value;
end record;
-- To hold the list of variables in a project file and in packages
package Variable_Element_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Variable,
Table_Index_Type => Variable_Id,
Table_Low_Bound => 1,
Table_Initial => 200,
Table_Increment => 100);
-- The table of variable in list of variables
type Array_Element_Id is new Nat;
No_Array_Element : constant Array_Element_Id := 0;
type Array_Element is record
Index : Name_Id;
Restricted : Boolean := False;
Src_Index : Int := 0;
Index_Case_Sensitive : Boolean := True;
Value : Variable_Value;
Next : Array_Element_Id := No_Array_Element;
end record;
-- Each Array_Element represents an array element and is linked (Next)
-- to the next array element, if any, in the array.
package Array_Element_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Array_Element,
Table_Index_Type => Array_Element_Id,
Table_Low_Bound => 1,
Table_Initial => 200,
Table_Increment => 100);
-- The table that contains all array elements
type Array_Id is new Nat;
No_Array : constant Array_Id := 0;
type Array_Data is record
Name : Name_Id := No_Name;
Location : Source_Ptr := No_Location;
Value : Array_Element_Id := No_Array_Element;
Next : Array_Id := No_Array;
end record;
-- Each Array_Data value represents an array.
-- Value is the id of the first element.
-- Next is the id of the next array in the project file or package.
package Array_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Array_Data,
Table_Index_Type => Array_Id,
Table_Low_Bound => 1,
Table_Initial => 200,
Table_Increment => 100);
-- The table that contains all arrays
type Package_Id is new Nat;
No_Package : constant Package_Id := 0;
type Declarations is record
Variables : Variable_Id := No_Variable;
Attributes : Variable_Id := No_Variable;
Arrays : Array_Id := No_Array;
Packages : Package_Id := No_Package;
end record;
-- Contains the declarations (variables, single and array attributes,
-- packages) for a project or a package in a project.
No_Declarations : constant Declarations :=
(Variables => No_Variable,
Attributes => No_Variable,
Arrays => No_Array,
Packages => No_Package);
-- Default value of Declarations: used if there are no declarations
type Package_Element is record
Name : Name_Id := No_Name;
Decl : Declarations := No_Declarations;
Parent : Package_Id := No_Package;
Next : Package_Id := No_Package;
end record;
-- A package (includes declarations that may include other packages)
package Package_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Package_Element,
Table_Index_Type => Package_Id,
Table_Low_Bound => 1,
Table_Initial => 100,
Table_Increment => 100);
-- The table that contains all packages
type Language_Data;
type Language_Ptr is access all Language_Data;
-- Index of language data
No_Language_Index : constant Language_Ptr := null;
-- Constant indicating that there is no language data
function Get_Language_From_Name
(Project : Project_Id;
Name : String) return Language_Ptr;
-- Get a language from a project. This might return null if no such
-- language exists in the project
Max_Header_Num : constant := 6150;
type Header_Num is range 0 .. Max_Header_Num;
-- Size for hash table below. The upper bound is an arbitrary value, the
-- value here was chosen after testing to determine a good compromise
-- between speed of access and memory usage.
function Hash (Name : Name_Id) return Header_Num;
function Hash (Name : File_Name_Type) return Header_Num;
function Hash (Name : Path_Name_Type) return Header_Num;
function Hash (Project : Project_Id) return Header_Num;
-- Used for computing hash values for names put into hash tables
type Language_Kind is (File_Based, Unit_Based);
-- Type for the kind of language. All languages are file based, except Ada
-- which is unit based.
-- Type of dependency to be checked
type Dependency_File_Kind is
(None,
-- There is no dependency file, the source must always be recompiled
Makefile,
-- The dependency file is a Makefile fragment indicating all the files
-- the source depends on. If the object file or the dependency file is
-- more recent than any of these files, the source must be recompiled.
ALI_File,
-- The dependency file is an ALI file and the source must be recompiled
-- if the object or ALI file is more recent than any of the sources
-- listed in the D lines.
ALI_Closure);
-- The dependency file is an ALI file and the source must be recompiled
-- if the object or ALI file is more recent than any source in the full
-- closure.
Makefile_Dependency_Suffix : constant String := ".d";
ALI_Dependency_Suffix : constant String := ".ali";
Switches_Dependency_Suffix : constant String := ".cswi";
Binder_Exchange_Suffix : constant String := ".bexch";
-- Suffix for binder exchange files
Library_Exchange_Suffix : constant String := ".lexch";
-- Suffix for library exchange files
type Name_List_Index is new Nat;
No_Name_List : constant Name_List_Index := 0;
type Name_Node is record
Name : Name_Id := No_Name;
Next : Name_List_Index := No_Name_List;
end record;
package Name_List_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Name_Node,
Table_Index_Type => Name_List_Index,
Table_Low_Bound => 1,
Table_Initial => 10,
Table_Increment => 100);
-- The table for lists of names
function Length
(Table : Name_List_Table.Instance;
List : Name_List_Index) return Natural;
-- Return the number of elements in specified list
type Number_List_Index is new Nat;
No_Number_List : constant Number_List_Index := 0;
type Number_Node is record
Number : Natural := 0;
Next : Number_List_Index := No_Number_List;
end record;
package Number_List_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Number_Node,
Table_Index_Type => Number_List_Index,
Table_Low_Bound => 1,
Table_Initial => 10,
Table_Increment => 100);
-- The table for lists of numbers
package Mapping_Files_Htable is new Simple_HTable
(Header_Num => Header_Num,
Element => Path_Name_Type,
No_Element => No_Path,
Key => Path_Name_Type,
Hash => Hash,
Equal => "=");
-- A hash table to store the mapping files that are not used
-- The following record ???
type Lang_Naming_Data is record
Dot_Replacement : File_Name_Type := No_File;
-- The string to replace '.' in the source file name (for Ada)
Casing : Casing_Type := All_Lower_Case;
-- The casing of the source file name (for Ada)
Separate_Suffix : File_Name_Type := No_File;
-- String to append to unit name for source file name of an Ada subunit
Spec_Suffix : File_Name_Type := No_File;
-- The string to append to the unit name for the
-- source file name of a spec.
Body_Suffix : File_Name_Type := No_File;
-- The string to append to the unit name for the
-- source file name of a body.
end record;
No_Lang_Naming_Data : constant Lang_Naming_Data :=
(Dot_Replacement => No_File,
Casing => All_Lower_Case,
Separate_Suffix => No_File,
Spec_Suffix => No_File,
Body_Suffix => No_File);
function Is_Standard_GNAT_Naming (Naming : Lang_Naming_Data) return Boolean;
-- True if the naming scheme is GNAT's default naming scheme. This
-- is to take into account shortened names like "Ada." (a-), "System." (s-)
-- and so on.
type Source_Data;
type Source_Id is access all Source_Data;
function Is_Compilable (Source : Source_Id) return Boolean;
pragma Inline (Is_Compilable);
-- Return True if we know how to compile Source (i.e. if a compiler is
-- defined). This doesn't indicate whether the source should be compiled.
function Object_To_Global_Archive (Source : Source_Id) return Boolean;
pragma Inline (Object_To_Global_Archive);
-- Return True if the object file should be put in the global archive.
-- This is for Ada, when only the closure of a main needs to be
-- (re)compiled.
function Other_Part (Source : Source_Id) return Source_Id;
pragma Inline (Other_Part);
-- Source ID for the other part, if any: for a spec, returns its body;
-- for a body, returns its spec.
No_Source : constant Source_Id := null;
type Path_Syntax_Kind is
(Canonical, -- Unix style
Host); -- Host specific syntax
-- The following record describes the configuration of a language
type Language_Config is record
Kind : Language_Kind := File_Based;
-- Kind of language. Most languages are file based. A few, such as Ada,
-- are unit based.
Naming_Data : Lang_Naming_Data;
-- The naming data for the languages (prefixes, etc.)
Include_Compatible_Languages : Name_List_Index := No_Name_List;
-- List of languages that are "include compatible" with this language. A
-- language B (for example "C") is "include compatible" with a language
-- A (for example "C++") if it is expected that sources of language A
-- may "include" header files from language B.
Compiler_Driver : File_Name_Type := No_File;
-- The name of the executable for the compiler of the language
Compiler_Driver_Path : String_Access := null;
-- The path name of the executable for the compiler of the language
Compiler_Leading_Required_Switches : Name_List_Index := No_Name_List;
-- The list of initial switches that are required as a minimum to invoke
-- the compiler driver.
Compiler_Trailing_Required_Switches : Name_List_Index := No_Name_List;
-- The list of final switches that are required as a minimum to invoke
-- the compiler driver.
Multi_Unit_Switches : Name_List_Index := No_Name_List;
-- The switch(es) to indicate the index of a unit in a multi-source file
Multi_Unit_Object_Separator : Character := ' ';
-- The string separating the base name of a source from the index of the
-- unit in a multi-source file, in the object file name.
Path_Syntax : Path_Syntax_Kind := Host;
-- Value may be Canonical (Unix style) or Host (host syntax)
Source_File_Switches : Name_List_Index := No_Name_List;
-- Optional switches to be put before the source file. The source file
-- path name is appended to the last switch in the list.
-- Example: ("-i", "");
Object_File_Suffix : Name_Id := No_Name;
-- Optional alternate object file suffix
Object_File_Switches : Name_List_Index := No_Name_List;
-- Optional object file switches. When this is defined, the switches
-- are used to specify the object file. The object file name is appended
-- to the last switch in the list. Example: ("-o", "").
Object_Path_Switches : Name_List_Index := No_Name_List;
-- List of switches to specify to the compiler the path name of a
-- temporary file containing the list of object directories in the
-- correct order.
Compilation_PIC_Option : Name_List_Index := No_Name_List;
-- The option(s) to compile a source in Position Independent Code for
-- shared libraries. Specified in the configuration. When not specified,
-- there is no need for such switch.
Object_Generated : Boolean := True;
-- False if no object file is generated
Objects_Linked : Boolean := True;
-- False if object files are not use to link executables and build
-- libraries.
Runtime_Library_Dir : Name_Id := No_Name;
-- Path name of the runtime library directory, if any
Runtime_Source_Dir : Name_Id := No_Name;
-- Path name of the runtime source directory, if any
Mapping_File_Switches : Name_List_Index := No_Name_List;
-- The option(s) to provide a mapping file to the compiler. Specified in
-- the configuration. When value is No_Name_List, there is no mapping
-- file.
Mapping_Spec_Suffix : File_Name_Type := No_File;
-- Placeholder representing the spec suffix in a mapping file
Mapping_Body_Suffix : File_Name_Type := No_File;
-- Placeholder representing the body suffix in a mapping file
Config_File_Switches : Name_List_Index := No_Name_List;
-- The option(s) to provide a config file to the compiler. Specified in
-- the configuration. If value is No_Name_List there is no config file.
Dependency_Kind : Dependency_File_Kind := None;
-- The kind of dependency to be checked: none, Makefile fragment or
-- ALI file (for Ada).
Dependency_Option : Name_List_Index := No_Name_List;
-- The option(s) to be used to create the dependency file. When value is
-- No_Name_List, there is not such option(s).
Compute_Dependency : Name_List_Index := No_Name_List;
-- Hold the value of attribute Dependency_Driver, if declared for the
-- language.
Include_Option : Name_List_Index := No_Name_List;
-- Hold the value of attribute Include_Switches, if declared for the
-- language.
Include_Path : Name_Id := No_Name;
-- Name of environment variable declared by attribute Include_Path for
-- the language.
Include_Path_File : Name_Id := No_Name;
-- Name of environment variable declared by attribute Include_Path_File
-- for the language.
Objects_Path : Name_Id := No_Name;
-- Name of environment variable declared by attribute Objects_Path for
-- the language.
Objects_Path_File : Name_Id := No_Name;
-- Name of environment variable declared by attribute Objects_Path_File
-- for the language.
Config_Body : Name_Id := No_Name;
-- The template for a pragma Source_File_Name(_Project) for a specific
-- file name of a body.
Config_Body_Index : Name_Id := No_Name;
-- The template for a pragma Source_File_Name(_Project) for a specific
-- file name of a body in a multi-source file.
Config_Body_Pattern : Name_Id := No_Name;
-- The template for a pragma Source_File_Name(_Project) for a naming
-- body pattern.
Config_Spec : Name_Id := No_Name;
-- The template for a pragma Source_File_Name(_Project) for a specific
-- file name of a spec.
Config_Spec_Index : Name_Id := No_Name;
-- The template for a pragma Source_File_Name(_Project) for a specific
-- file name of a spec in a multi-source file.
Config_Spec_Pattern : Name_Id := No_Name;
-- The template for a pragma Source_File_Name(_Project) for a naming
-- spec pattern.
Config_File_Unique : Boolean := False;
-- True if the config file specified to the compiler needs to be unique.
-- If it is unique, then all config files are concatenated into a temp
-- config file.
Binder_Driver : File_Name_Type := No_File;
-- The name of the binder driver for the language, if any
Binder_Driver_Path : Path_Name_Type := No_Path;
-- The path name of the binder driver
Binder_Required_Switches : Name_List_Index := No_Name_List;
-- Hold the value of attribute Binder'Required_Switches for the language
Binder_Prefix : Name_Id := No_Name;
-- Hold the value of attribute Binder'Prefix for the language
Toolchain_Version : Name_Id := No_Name;
-- Hold the value of attribute Toolchain_Version for the language
Toolchain_Description : Name_Id := No_Name;
-- Hold the value of attribute Toolchain_Description for the language
Clean_Object_Artifacts : Name_List_Index := No_Name_List;
-- List of object artifact extensions to be deleted by gprclean
Clean_Source_Artifacts : Name_List_Index := No_Name_List;
-- List of source artifact extensions to be deleted by gprclean
end record;
No_Language_Config : constant Language_Config :=
(Kind => File_Based,
Naming_Data => No_Lang_Naming_Data,
Include_Compatible_Languages => No_Name_List,
Compiler_Driver => No_File,
Compiler_Driver_Path => null,
Compiler_Leading_Required_Switches
=> No_Name_List,
Compiler_Trailing_Required_Switches
=> No_Name_List,
Multi_Unit_Switches => No_Name_List,
Multi_Unit_Object_Separator => ' ',
Path_Syntax => Canonical,
Source_File_Switches => No_Name_List,
Object_File_Suffix => No_Name,
Object_File_Switches => No_Name_List,
Object_Path_Switches => No_Name_List,
Compilation_PIC_Option => No_Name_List,
Object_Generated => True,
Objects_Linked => True,
Runtime_Library_Dir => No_Name,
Runtime_Source_Dir => No_Name,
Mapping_File_Switches => No_Name_List,
Mapping_Spec_Suffix => No_File,
Mapping_Body_Suffix => No_File,
Config_File_Switches => No_Name_List,
Dependency_Kind => None,
Dependency_Option => No_Name_List,
Compute_Dependency => No_Name_List,
Include_Option => No_Name_List,
Include_Path => No_Name,
Include_Path_File => No_Name,
Objects_Path => No_Name,
Objects_Path_File => No_Name,
Config_Body => No_Name,
Config_Body_Index => No_Name,
Config_Body_Pattern => No_Name,
Config_Spec => No_Name,
Config_Spec_Index => No_Name,
Config_Spec_Pattern => No_Name,
Config_File_Unique => False,
Binder_Driver => No_File,
Binder_Driver_Path => No_Path,
Binder_Required_Switches => No_Name_List,
Binder_Prefix => No_Name,
Toolchain_Version => No_Name,
Toolchain_Description => No_Name,
Clean_Object_Artifacts => No_Name_List,
Clean_Source_Artifacts => No_Name_List);
type Language_Data is record
Name : Name_Id := No_Name;
-- The name of the language in lower case
Display_Name : Name_Id := No_Name;
-- The name of the language, as found in attribute Languages
Config : Language_Config := No_Language_Config;
-- Configuration of the language
First_Source : Source_Id := No_Source;
-- Head of the list of sources of the language in the project
Mapping_Files : Mapping_Files_Htable.Instance :=
Mapping_Files_Htable.Nil;
-- Hash table containing the mapping of the sources to their path names
Next : Language_Ptr := No_Language_Index;
-- Next language of the project
end record;
No_Language_Data : constant Language_Data :=
(Name => No_Name,
Display_Name => No_Name,
Config => No_Language_Config,
First_Source => No_Source,
Mapping_Files => Mapping_Files_Htable.Nil,
Next => No_Language_Index);
type Language_List_Element;
type Language_List is access all Language_List_Element;
type Language_List_Element is record
Language : Language_Ptr := No_Language_Index;
Next : Language_List;
end record;
type Source_Kind is (Spec, Impl, Sep);
subtype Spec_Or_Body is Source_Kind range Spec .. Impl;
-- The following declarations declare a structure used to store the Name
-- and File and Path names of a unit, with a reference to its GNAT Project
-- File(s). Some units might have neither Spec nor Impl when they were
-- created for a "separate".
type File_Names_Data is array (Spec_Or_Body) of Source_Id;
type Unit_Data is record
Name : Name_Id := No_Name;
File_Names : File_Names_Data;
end record;
type Unit_Index is access all Unit_Data;
No_Unit_Index : constant Unit_Index := null;
-- Used to indicate a null entry for no unit
type Source_Roots;
type Roots_Access is access Source_Roots;
type Source_Roots is record
Root : Source_Id;
Next : Roots_Access;
end record;
-- A list to store the roots associated with a main unit. These are the
-- files that need to linked along with the main (for instance a C file
-- corresponding to an Ada file). In general, these are dependencies that
-- cannot be computed automatically by the builder.
type Naming_Exception_Type is (No, Yes, Inherited);
-- Structure to define source data
type Source_Data is record
Initialized : Boolean := False;
-- Set to True when Source_Data is completely initialized
Project : Project_Id := No_Project;
-- Project of the source
Location : Source_Ptr := No_Location;
-- Location in the project file of the declaration of the source in
-- package Naming.
Source_Dir_Rank : Natural := 0;
-- The rank of the source directory in list declared with attribute
-- Source_Dirs. Two source files with the same name cannot appears in
-- different directory with the same rank. That can happen when the
-- recursive notation <dir>/** is used in attribute Source_Dirs.
Language : Language_Ptr := No_Language_Index;
-- Language of the source
In_Interfaces : Boolean := True;
-- False when the source is not included in interfaces, when attribute
-- Interfaces is declared.
Declared_In_Interfaces : Boolean := False;
-- True when source is declared in attribute Interfaces
Alternate_Languages : Language_List := null;
-- List of languages a header file may also be, in addition of language
-- Language_Name.
Kind : Source_Kind := Spec;
-- Kind of the source: spec, body or subunit
Unit : Unit_Index := No_Unit_Index;
-- Name of the unit, if language is unit based. This is only set for
-- those files that are part of the compilation set (for instance a
-- file in an extended project that is overridden will not have this
-- field set).
Index : Int := 0;
-- Index of the source in a multi unit source file (the same Source_Data
-- is duplicated several times when there are several units in the same
-- file). Index is 0 if there is either no unit or a single one, and
-- starts at 1 when there are multiple units
Compilable : Yes_No_Unknown := Unknown;
-- Updated at the first call to Is_Compilable. Yes if source file is
-- compilable.
In_The_Queue : Boolean := False;
-- True if the source has been put in the queue
Locally_Removed : Boolean := False;
-- True if the source has been "excluded"
Suppressed : Boolean := False;
-- True if the source is a locally removed direct source of the project.
-- These sources should not be put in the mapping file.
Replaced_By : Source_Id := No_Source;
-- Source in an extending project that replaces the current source
File : File_Name_Type := No_File;
-- Canonical file name of the source
Display_File : File_Name_Type := No_File;
-- File name of the source, for display purposes
Path : Path_Information := No_Path_Information;
-- Path name of the source
Source_TS : Time_Stamp_Type := Empty_Time_Stamp;
-- Time stamp of the source file
Object_Project : Project_Id := No_Project;
-- Project where the object file is. This might be different from
-- Project when using extending project files.
Object : File_Name_Type := No_File;
-- File name of the object file
Current_Object_Path : Path_Name_Type := No_Path;
-- Object path of an existing object file
Object_Path : Path_Name_Type := No_Path;
-- Object path of the real object file
Object_TS : Time_Stamp_Type := Empty_Time_Stamp;
-- Object file time stamp
Dep_Name : File_Name_Type := No_File;
-- Dependency file simple name
Current_Dep_Path : Path_Name_Type := No_Path;
-- Path name of an existing dependency file
Dep_Path : Path_Name_Type := No_Path;
-- Path name of the real dependency file
Dep_TS : aliased Osint.File_Attributes := Osint.Unknown_Attributes;
-- Dependency file time stamp
Switches : File_Name_Type := No_File;
-- File name of the switches file. For all languages, this is a file
-- that ends with the .cswi extension.
Switches_Path : Path_Name_Type := No_Path;
-- Path name of the switches file
Switches_TS : Time_Stamp_Type := Empty_Time_Stamp;
-- Switches file time stamp
Naming_Exception : Naming_Exception_Type := No;
-- True if the source has an exceptional name
Duplicate_Unit : Boolean := False;
-- True when a duplicate unit has been reported for this source
Next_In_Lang : Source_Id := No_Source;
-- Link to another source of the same language in the same project
Next_With_File_Name : Source_Id := No_Source;
-- Link to another source with the same base file name
Roots : Roots_Access := null;
-- The roots for a main unit
end record;
No_Source_Data : constant Source_Data :=
(Initialized => False,
Project => No_Project,
Location => No_Location,
Source_Dir_Rank => 0,
Language => No_Language_Index,
In_Interfaces => True,
Declared_In_Interfaces => False,
Alternate_Languages => null,
Kind => Spec,
Unit => No_Unit_Index,
Index => 0,
Locally_Removed => False,
Suppressed => False,
Compilable => Unknown,
In_The_Queue => False,
Replaced_By => No_Source,
File => No_File,
Display_File => No_File,
Path => No_Path_Information,
Source_TS => Empty_Time_Stamp,
Object_Project => No_Project,
Object => No_File,
Current_Object_Path => No_Path,
Object_Path => No_Path,
Object_TS => Empty_Time_Stamp,
Dep_Name => No_File,
Current_Dep_Path => No_Path,
Dep_Path => No_Path,
Dep_TS => Osint.Unknown_Attributes,
Switches => No_File,
Switches_Path => No_Path,
Switches_TS => Empty_Time_Stamp,
Naming_Exception => No,
Duplicate_Unit => False,
Next_In_Lang => No_Source,
Next_With_File_Name => No_Source,
Roots => null);
package Source_Files_Htable is new Simple_HTable
(Header_Num => Header_Num,
Element => Source_Id,
No_Element => No_Source,
Key => File_Name_Type,
Hash => Hash,
Equal => "=");
-- Mapping of source file names to source ids
package Source_Paths_Htable is new Simple_HTable
(Header_Num => Header_Num,
Element => Source_Id,
No_Element => No_Source,
Key => Path_Name_Type,
Hash => Hash,
Equal => "=");
-- Mapping of source paths to source ids
type Lib_Kind is (Static, Dynamic, Relocatable);
type Policy is (Autonomous, Compliant, Controlled, Restricted, Direct);
-- Type to specify the symbol policy, when symbol control is supported.
-- See full explanation about this type in package Symbols.
-- Autonomous: Create a symbol file without considering any reference
-- Compliant: Try to be as compatible as possible with an existing ref
-- Controlled: Fail if symbols are not the same as those in the reference
-- Restricted: Restrict the symbols to those in the symbol file
-- Direct: The symbol file is used as is
type Symbol_Record is record
Symbol_File : Path_Name_Type := No_Path;
Reference : Path_Name_Type := No_Path;
Symbol_Policy : Policy := Autonomous;
end record;
-- Type to keep the symbol data to be used when building a shared library
No_Symbols : constant Symbol_Record :=
(Symbol_File => No_Path,
Reference => No_Path,
Symbol_Policy => Autonomous);
-- The default value of the symbol data
function Image (The_Casing : Casing_Type) return String;
-- Similar to 'Image (but avoid use of this attribute in compiler)
function Value (Image : String) return Casing_Type;
-- Similar to 'Value (but avoid use of this attribute in compiler)
-- Raises Constraint_Error if not a Casing_Type image.
-- The following record contains data for a naming scheme
function Get_Object_Directory
(Project : Project_Id;
Including_Libraries : Boolean;
Only_If_Ada : Boolean := False) return Path_Name_Type;
-- Return the object directory to use for the project. This depends on
-- whether we have a library project or a standard project. This function
-- might return No_Name when no directory applies. If the project is a
-- library project file and Including_Libraries is True then the library
-- ALI dir is returned instead of the object dir, except when there is no
-- ALI files in the Library ALI dir and the object directory exists. If
-- Only_If_Ada is True, then No_Name is returned when the project doesn't
-- include any Ada source.
procedure Compute_All_Imported_Projects
(Root_Project : Project_Id;
Tree : Project_Tree_Ref);
-- For all projects in the tree, compute the list of the projects imported
-- directly or indirectly by project Root_Project. The result is stored in
-- Project.All_Imported_Projects for each project
function Ultimate_Extending_Project_Of
(Proj : Project_Id) return Project_Id;
-- Returns the ultimate extending project of project Proj. If project Proj
-- is not extended, returns Proj.
type Project_List_Element;
type Project_List is access all Project_List_Element;
type Project_List_Element is record
Project : Project_Id := No_Project;
From_Encapsulated_Lib : Boolean := False;
Next : Project_List := null;
end record;
-- A list of projects
procedure Free_List
(List : in out Project_List;
Free_Project : Boolean);
-- Free the list of projects, if Free_Project, each project is also freed
type Response_File_Format is
(None,
GNU,
Object_List,
Option_List,
GCC,
GCC_GNU,
GCC_Object_List,
GCC_Option_List);
-- The format of the different response files
type Project_Configuration is record
Target : Name_Id := No_Name;
-- The target of the configuration, when specified
Run_Path_Option : Name_List_Index := No_Name_List;
-- The option to use when linking to specify the path where to look for
-- libraries.
Run_Path_Origin : Name_Id := No_Name;
-- Specify the string (such as "$ORIGIN") to indicate paths relative to
-- the directory of the executable in the run path option.
Library_Install_Name_Option : Name_Id := No_Name;
-- When this is not an empty list, this option, followed by the single
-- name of the shared library file is used when linking a shared
-- library.
Separate_Run_Path_Options : Boolean := False;
-- True if each directory needs to be specified in a separate run path
-- option.
Executable_Suffix : Name_Id := No_Name;
-- The suffix of executables, when specified in the configuration or in
-- package Builder of the main project. When this is not specified, the
-- executable suffix is the default for the platform.
-- Linking
Linker : Path_Name_Type := No_Path;
-- Path name of the linker driver. Specified in the configuration or in
-- the package Builder of the main project.
Map_File_Option : Name_Id := No_Name;
-- Option to use when invoking the linker to build a map file
Trailing_Linker_Required_Switches : Name_List_Index := No_Name_List;
-- The minimum options for the linker driver. Specified in the
-- configuration.
Linker_Executable_Option : Name_List_Index := No_Name_List;
-- The option(s) to indicate the name of the executable in the linker
-- command. Specified in the configuration. When not specified, default
-- to -o <executable name>.
Linker_Lib_Dir_Option : Name_Id := No_Name;
-- The option to specify where to find a library for linking. Specified
-- in the configuration. When not specified, defaults to "-L".
Linker_Lib_Name_Option : Name_Id := No_Name;
-- The option to specify the name of a library for linking. Specified in
-- the configuration. When not specified, defaults to "-l".
Max_Command_Line_Length : Natural := 0;
-- When positive and when Resp_File_Format (see below) is not None,
-- if the command line for the invocation of the linker would be greater
-- than this value, a response file is used to invoke the linker.
Resp_File_Format : Response_File_Format := None;
-- The format of a response file, when linking with a response file is
-- supported.
Resp_File_Options : Name_List_Index := No_Name_List;
-- The switches, if any, that precede the path name of the response
-- file in the invocation of the linker.
-- Libraries
Library_Builder : Path_Name_Type := No_Path;
-- The executable to build library (specified in the configuration)
Lib_Support : Library_Support := None;
-- The level of library support. Specified in the configuration. Support
-- is none, static libraries only or both static and shared libraries.
Lib_Encapsulated_Supported : Boolean := False;
-- True when building fully standalone libraries supported on the target
Archive_Builder : Name_List_Index := No_Name_List;
-- The name of the executable to build archives, with the minimum
-- switches. Specified in the configuration.
Archive_Builder_Append_Option : Name_List_Index := No_Name_List;
-- The options to append object files to an archive
Archive_Indexer : Name_List_Index := No_Name_List;
-- The name of the executable to index archives, with the minimum
-- switches. Specified in the configuration.
Archive_Suffix : File_Name_Type := No_File;
-- The suffix of archives. Specified in the configuration. When not
-- specified, defaults to ".a".
Lib_Partial_Linker : Name_List_Index := No_Name_List;
-- Shared libraries
Shared_Lib_Driver : File_Name_Type := No_File;
-- The driver to link shared libraries. Set with attribute Library_GCC.
-- Default to gcc.
Shared_Lib_Prefix : File_Name_Type := No_File;
-- Part of a shared library file name that precedes the name of the
-- library. Specified in the configuration. When not specified, defaults
-- to "lib".
Shared_Lib_Suffix : File_Name_Type := No_File;
-- Suffix of shared libraries, after the library name in the shared
-- library name. Specified in the configuration. When not specified,
-- default to ".so".
Shared_Lib_Min_Options : Name_List_Index := No_Name_List;
-- The minimum options to use when building a shared library
Lib_Version_Options : Name_List_Index := No_Name_List;
-- The options to use to specify a library version
Symbolic_Link_Supported : Boolean := False;
-- True if the platform supports symbolic link files
Lib_Maj_Min_Id_Supported : Boolean := False;
-- True if platform supports library major and minor options, such as
-- libname.so -> libname.so.2 -> libname.so.2.4
Auto_Init_Supported : Boolean := False;
-- True if automatic initialisation is supported for shared stand-alone
-- libraries.
-- Cleaning
Artifacts_In_Exec_Dir : Name_List_Index := No_Name_List;
-- List of regexp file names to be cleaned in the exec directory of the
-- main project.
Artifacts_In_Object_Dir : Name_List_Index := No_Name_List;
-- List of regexp file names to be cleaned in the object directory of
-- all projects.
end record;
Default_Project_Config : constant Project_Configuration :=
(Target => No_Name,
Run_Path_Option => No_Name_List,
Run_Path_Origin => No_Name,
Library_Install_Name_Option => No_Name,
Separate_Run_Path_Options => False,
Executable_Suffix => No_Name,
Linker => No_Path,
Map_File_Option => No_Name,
Trailing_Linker_Required_Switches =>
No_Name_List,
Linker_Executable_Option => No_Name_List,
Linker_Lib_Dir_Option => No_Name,
Linker_Lib_Name_Option => No_Name,
Library_Builder => No_Path,
Max_Command_Line_Length => 0,
Resp_File_Format => None,
Resp_File_Options => No_Name_List,
Lib_Support => None,
Lib_Encapsulated_Supported => False,
Archive_Builder => No_Name_List,
Archive_Builder_Append_Option => No_Name_List,
Archive_Indexer => No_Name_List,
Archive_Suffix => No_File,
Lib_Partial_Linker => No_Name_List,
Shared_Lib_Driver => No_File,
Shared_Lib_Prefix => No_File,
Shared_Lib_Suffix => No_File,
Shared_Lib_Min_Options => No_Name_List,
Lib_Version_Options => No_Name_List,
Symbolic_Link_Supported => False,
Lib_Maj_Min_Id_Supported => False,
Auto_Init_Supported => False,
Artifacts_In_Exec_Dir => No_Name_List,
Artifacts_In_Object_Dir => No_Name_List);
-------------------------
-- Aggregated projects --
-------------------------
type Aggregated_Project;
type Aggregated_Project_List is access all Aggregated_Project;
type Aggregated_Project is record
Path : Path_Name_Type;
Tree : Project_Tree_Ref;
Project : Project_Id;
Next : Aggregated_Project_List;
end record;
procedure Free (List : in out Aggregated_Project_List);
-- Free the memory used for List
procedure Add_Aggregated_Project
(Project : Project_Id;
Path : Path_Name_Type);
-- Add a new aggregated project in Project.
-- The aggregated project has not been processed yet. This procedure should
-- the called while processing the aggregate project, and as a result
-- Prj.Proc.Process will then automatically process the aggregated projects
------------------
-- Project_Data --
------------------
-- The following record describes a project file representation
pragma Warnings (Off);
type Standalone is
(No,
-- The following clash with Standard is OK, and justified by the context
-- which really wants to use the same set of qualifiers.
Standard,
Encapsulated);
pragma Warnings (On);
type Project_Data (Qualifier : Project_Qualifier := Unspecified) is record
-------------
-- General --
-------------
Name : Name_Id := No_Name;
-- The name of the project
Display_Name : Name_Id := No_Name;
-- The name of the project with the spelling of its declaration
Externally_Built : Boolean := False;
-- True if the project is externally built. In such case, the Project
-- Manager will not modify anything in this project.
Config : Project_Configuration;
Path : Path_Information := No_Path_Information;
-- The path name of the project file. This include base name of the
-- project file.
Virtual : Boolean := False;
-- True for virtual extending projects
Location : Source_Ptr := No_Location;
-- The location in the project file source of the project name that
-- immediately follows the reserved word "project".
---------------
-- Languages --
---------------
Languages : Language_Ptr := No_Language_Index;
-- First index of the language data in the project. Traversing the list
-- gives access to all the languages supported by the project.
--------------
-- Projects --
--------------
Mains : String_List_Id := Nil_String;
-- List of mains specified by attribute Main
Extends : Project_Id := No_Project;
-- The reference of the project file, if any, that this project file
-- extends.
Extended_By : Project_Id := No_Project;
-- The reference of the project file, if any, that extends this project
-- file.
Decl : Declarations := No_Declarations;
-- The declarations (variables, attributes and packages) of this project
-- file.
Imported_Projects : Project_List := null;
-- The list of all directly imported projects, if any
All_Imported_Projects : Project_List := null;
-- The list of all projects imported directly or indirectly, if any.
-- This does not include the project itself.
-----------------
-- Directories --
-----------------
Directory : Path_Information := No_Path_Information;
-- Path name of the directory where the project file resides
Object_Directory : Path_Information := No_Path_Information;
-- The path name of the object directory of this project file
Exec_Directory : Path_Information := No_Path_Information;
-- The path name of the exec directory of this project file. Default is
-- equal to Object_Directory.
Object_Path_File : Path_Name_Type := No_Path;
-- Store the name of the temporary file that contains the list of object
-- directories, when attribute Object_Path_Switches is declared.
-------------
-- Library --
-------------
Library : Boolean := False;
-- True if this is a library project
Library_Name : Name_Id := No_Name;
-- If a library project, name of the library
Library_Kind : Lib_Kind := Static;
-- If a library project, kind of library
Library_Dir : Path_Information := No_Path_Information;
-- If a library project, path name of the directory where the library
-- resides.
Library_TS : Time_Stamp_Type := Empty_Time_Stamp;
-- The timestamp of a library file in a library project
Library_Src_Dir : Path_Information := No_Path_Information;
-- If a Stand-Alone Library project, path name of the directory where
-- the sources of the interfaces of the library are copied. By default,
-- if attribute Library_Src_Dir is not specified, sources of the
-- interfaces are not copied anywhere.
Library_ALI_Dir : Path_Information := No_Path_Information;
-- In a library project, path name of the directory where the ALI files
-- are copied. If attribute Library_ALI_Dir is not specified, ALI files
-- are copied in the Library_Dir.
Lib_Internal_Name : Name_Id := No_Name;
-- If a library project, internal name store inside the library
Standalone_Library : Standalone := No;
-- Indicate that this is a Standalone Library Project File
Lib_Interface_ALIs : String_List_Id := Nil_String;
-- For Standalone Library Project Files, list of Interface ALI files
Other_Interfaces : String_List_Id := Nil_String;
-- List of non unit based sources in attribute Interfaces
Lib_Auto_Init : Boolean := False;
-- For non static Stand-Alone Library Project Files, True if the library
-- initialisation should be automatic.
Symbol_Data : Symbol_Record := No_Symbols;
-- Symbol file name, reference symbol file name, symbol policy
Need_To_Build_Lib : Boolean := False;
-- True if the library of a Library Project needs to be built or rebuilt
-------------
-- Sources --
-------------
-- The sources for all languages including Ada are accessible through
-- the Source_Iterator type
Interfaces_Defined : Boolean := False;
-- True if attribute Interfaces is declared for the project or any
-- project it extends.
Include_Path_File : Path_Name_Type := No_Path;
-- The path name of the of the source search directory file.
-- This is only used by gnatmake
Source_Dirs : String_List_Id := Nil_String;
-- The list of all the source directories
Source_Dir_Ranks : Number_List_Index := No_Number_List;
Ada_Include_Path : String_Access := null;
-- The cached value of source search path for this project file. Set by
-- the first call to Prj.Env.Ada_Include_Path for the project. Do not
-- use this field directly outside of the project manager, use
-- Prj.Env.Ada_Include_Path instead.
Has_Multi_Unit_Sources : Boolean := False;
-- Whether there is at least one source file containing multiple units
-------------------
-- Miscellaneous --
-------------------
Ada_Objects_Path : String_Access := null;
-- The cached value of ADA_OBJECTS_PATH for this project file, with
-- library ALI directories for library projects instead of object
-- directories. Do not use this field directly outside of the
-- compiler, use Prj.Env.Ada_Objects_Path instead.
Ada_Objects_Path_No_Libs : String_Access := null;
-- The cached value of ADA_OBJECTS_PATH for this project file with all
-- object directories (no library ALI dir for library projects).
Libgnarl_Needed : Yes_No_Unknown := Unknown;
-- Set to True when libgnarl is needed to link
Objects_Path : String_Access := null;
-- The cached value of the object dir path, used during the binding
-- phase of gprbuild.
Objects_Path_File_With_Libs : Path_Name_Type := No_Path;
-- The cached value of the object path temp file (including library
-- dirs) for this project file.
Objects_Path_File_Without_Libs : Path_Name_Type := No_Path;
-- The cached value of the object path temp file (excluding library
-- dirs) for this project file.
Config_File_Name : Path_Name_Type := No_Path;
-- The path name of the configuration pragmas file, if any
Config_File_Temp : Boolean := False;
-- True if the configuration pragmas file is a temporary file that must
-- be deleted at the end.
Config_Checked : Boolean := False;
-- A flag to avoid checking repetitively the configuration pragmas file
Depth : Natural := 0;
-- The maximum depth of a project in the project graph. Depth of main
-- project is 0.
Unkept_Comments : Boolean := False;
-- True if there are comments in the project sources that cannot be kept
-- in the project tree.
-----------------------------
-- Qualifier-Specific data --
-----------------------------
-- The following fields are only valid for specific types of projects
case Qualifier is
when Aggregate | Aggregate_Library =>
Aggregated_Projects : Aggregated_Project_List := null;
-- List of aggregated projects (which could themselves be
-- aggregate projects).
when others =>
null;
end case;
end record;
function Empty_Project (Qualifier : Project_Qualifier) return Project_Data;
-- Return the representation of an empty project
function Is_Extending
(Extending : Project_Id;
Extended : Project_Id) return Boolean;
-- Return True if Extending is extending the Extended project
function Is_Ext
(Extending : Project_Id;
Extended : Project_Id) return Boolean renames Is_Extending;
function Has_Ada_Sources (Data : Project_Id) return Boolean;
-- Return True if the project has Ada sources
Project_Error : exception;
-- Raised by some subprograms in Prj.Attr
package Units_Htable is new Simple_HTable
(Header_Num => Header_Num,
Element => Unit_Index,
No_Element => No_Unit_Index,
Key => Name_Id,
Hash => Hash,
Equal => "=");
-- Mapping of unit names to indexes in the Units table
---------------------
-- Source_Iterator --
---------------------
type Source_Iterator is private;
function For_Each_Source
(In_Tree : Project_Tree_Ref;
Project : Project_Id := No_Project;
Language : Name_Id := No_Name;
Encapsulated_Libs : Boolean := True;
Locally_Removed : Boolean := True) return Source_Iterator;
-- Returns an iterator for all the sources of a project tree, or a specific
-- project, or a specific language. Include sources from aggregated libs if
-- Aggregated_Libs is True. If Locally_Removed is set to False the
-- Locally_Removed files won't be reported.
function Element (Iter : Source_Iterator) return Source_Id;
-- Return the current source (or No_Source if there are no more sources)
procedure Next (Iter : in out Source_Iterator);
-- Move on to the next source
function Find_Source
(In_Tree : Project_Tree_Ref;
Project : Project_Id;
In_Imported_Only : Boolean := False;
In_Extended_Only : Boolean := False;
Base_Name : File_Name_Type;
Index : Int := 0) return Source_Id;
-- Find the first source file with the given name.
-- If In_Extended_Only is True, it will search in project and the project
-- it extends, but not in the imported projects.
-- Elsif In_Imported_Only is True, it will search in project and the
-- projects it imports, but not in the others or in aggregated projects.
-- Else it searches in the whole tree.
-- If Index is specified, this only search for a source with that index.
type Source_Ids is array (Positive range <>) of Source_Id;
No_Sources : constant Source_Ids := (1 .. 0 => No_Source);
function Find_All_Sources
(In_Tree : Project_Tree_Ref;
Project : Project_Id;
In_Imported_Only : Boolean := False;
In_Extended_Only : Boolean := False;
Base_Name : File_Name_Type;
Index : Int := 0) return Source_Ids;
-- Find all source files with the given name:
--
-- If In_Extended_Only is True, it will search in project and the project
-- it extends, but not in the imported projects.
--
-- If Extended_Only is False, and In_Imported_Only is True, it will
-- search in project and the projects it imports, but not in the others
-- or in aggregated projects.
--
-- If both Extended_Only and In_Imported_Only are False (the default)
-- then it searches the whole tree.
--
-- If Index is specified, this only search for sources with that index.
-----------------------
-- Project_Tree_Data --
-----------------------
package Replaced_Source_HTable is new Simple_HTable
(Header_Num => Header_Num,
Element => File_Name_Type,
No_Element => No_File,
Key => File_Name_Type,
Hash => Hash,
Equal => "=");
type Private_Project_Tree_Data is private;
-- Data for a project tree that is used only by the Project Manager
type Shared_Project_Tree_Data is record
Name_Lists : Name_List_Table.Instance;
Number_Lists : Number_List_Table.Instance;
String_Elements : String_Element_Table.Instance;
Variable_Elements : Variable_Element_Table.Instance;
Array_Elements : Array_Element_Table.Instance;
Arrays : Array_Table.Instance;
Packages : Package_Table.Instance;
Private_Part : Private_Project_Tree_Data;
Dot_String_List : String_List_Id := Nil_String;
end record;
type Shared_Project_Tree_Data_Access is access all Shared_Project_Tree_Data;
-- The data that is shared among multiple trees, when these trees are
-- loaded through the same aggregate project.
-- To avoid ambiguities, limit the number of parameters to the
-- subprograms (we would have to parse the "root project tree" since this
-- is where the configuration file was loaded, in addition to the project's
-- own tree) and make the comparison of projects easier, all trees store
-- the lists in the same tables.
type Project_Tree_Appdata is tagged null record;
type Project_Tree_Appdata_Access is access all Project_Tree_Appdata'Class;
-- Application-specific data that can be associated with a project tree.
-- We do not make the Project_Tree_Data itself tagged for several reasons:
-- - it couldn't have a default value for its discriminant
-- - it would require a "factory" to allocate such data, because trees
-- are created automatically when parsing aggregate projects.
procedure Free (Tree : in out Project_Tree_Appdata);
-- Should be overridden if your derive your own data
type Project_Tree_Data (Is_Root_Tree : Boolean := True) is record
-- The root tree is the one loaded by the user from the command line.
-- Is_Root_Tree is only false for projects aggregated within a root
-- aggregate project.
Projects : Project_List;
-- List of projects in this tree
Replaced_Sources : Replaced_Source_HTable.Instance;
-- The list of sources that have been replaced by sources with
-- different file names.
Replaced_Source_Number : Natural := 0;
-- The number of entries in Replaced_Sources
Units_HT : Units_Htable.Instance;
-- Unit name to Unit_Index (and from there to Source_Id)
Source_Files_HT : Source_Files_Htable.Instance;
-- Base source file names to Source_Id list
Source_Paths_HT : Source_Paths_Htable.Instance;
-- Full path to Source_Id
-- ??? What is behavior for multi-unit source files, where there are
-- several source_id per file ?
Source_Info_File_Name : String_Access := null;
-- The name of the source info file, if specified by the builder
Source_Info_File_Exists : Boolean := False;
-- True when a source info file has been successfully read
Shared : Shared_Project_Tree_Data_Access;
-- The shared data for this tree and all aggregated trees
Appdata : Project_Tree_Appdata_Access;
-- Application-specific data for this tree
case Is_Root_Tree is
when True =>
Shared_Data : aliased Shared_Project_Tree_Data;
-- Do not access directly, only through Shared
when False =>
null;
end case;
end record;
-- Data for a project tree
function Debug_Name (Tree : Project_Tree_Ref) return Name_Id;
-- If debug traces are activated, return an identitier for the project
-- tree. This modifies Name_Buffer.
procedure Expect (The_Token : Token_Type; Token_Image : String);
-- Check that the current token is The_Token. If it is not, then output
-- an error message.
procedure Initialize (Tree : Project_Tree_Ref);
-- This procedure must be called before using any services from the Prj
-- hierarchy. Namet.Initialize must be called before Prj.Initialize.
procedure Reset (Tree : Project_Tree_Ref);
-- This procedure resets all the tables that are used when processing a
-- project file tree. Initialize must be called before the call to Reset.
package Project_Boolean_Htable is new Simple_HTable
(Header_Num => Header_Num,
Element => Boolean,
No_Element => False,
Key => Project_Id,
Hash => Hash,
Equal => "=");
-- A table that associates a project to a boolean. This is used to detect
-- whether a project was already processed for instance.
generic
with procedure Action (Project : Project_Id; Tree : Project_Tree_Ref);
procedure For_Project_And_Aggregated
(Root_Project : Project_Id;
Root_Tree : Project_Tree_Ref);
-- Execute Action for Root_Project and all its aggregated projects
-- recursively.
generic
type State is limited private;
with procedure Action
(Project : Project_Id;
Tree : Project_Tree_Ref;
With_State : in out State);
procedure For_Every_Project_Imported
(By : Project_Id;
Tree : Project_Tree_Ref;
With_State : in out State;
Include_Aggregated : Boolean := True;
Imported_First : Boolean := False);
-- Call Action for each project imported directly or indirectly by project
-- By, as well as extended projects.
--
-- The order of processing depends on Imported_First:
--
-- If False, Action is called according to the order of importation: if A
-- imports B, directly or indirectly, Action will be called for A before
-- it is called for B. If two projects import each other directly or
-- indirectly (using at least one "limited with"), it is not specified
-- for which of these two projects Action will be called first.
--
-- The order is reversed if Imported_First is True
--
-- With_State may be used by Action to choose a behavior or to report some
-- global result.
--
-- If Include_Aggregated is True, then an aggregate project will recurse
-- into the projects it aggregates. Otherwise, the latter are never
-- returned.
--
-- In_Aggregate_Lib is True if the project is in an aggregate library
--
-- The Tree argument passed to the callback is required in the case of
-- aggregated projects, since they might not be using the same tree as 'By'
type Project_Context is record
In_Aggregate_Lib : Boolean;
-- True if the project is part of an aggregate library
From_Encapsulated_Lib : Boolean;
-- True if the project is imported from an encapsulated library
end record;
generic
type State is limited private;
with procedure Action
(Project : Project_Id;
Tree : Project_Tree_Ref;
Context : Project_Context;
With_State : in out State);
procedure For_Every_Project_Imported_Context
(By : Project_Id;
Tree : Project_Tree_Ref;
With_State : in out State;
Include_Aggregated : Boolean := True;
Imported_First : Boolean := False);
-- As for For_Every_Project_Imported but with an associated context
generic
with procedure Action
(Project : Project_Id;
Tree : Project_Tree_Ref;
Context : Project_Context);
procedure For_Project_And_Aggregated_Context
(Root_Project : Project_Id;
Root_Tree : Project_Tree_Ref);
-- As for For_Project_And_Aggregated but with an associated context
function Extend_Name
(File : File_Name_Type;
With_Suffix : String) return File_Name_Type;
-- Replace the extension of File with With_Suffix
function Object_Name
(Source_File_Name : File_Name_Type;
Object_File_Suffix : Name_Id := No_Name) return File_Name_Type;
-- Returns the object file name corresponding to a source file name
function Object_Name
(Source_File_Name : File_Name_Type;
Source_Index : Int;
Index_Separator : Character;
Object_File_Suffix : Name_Id := No_Name) return File_Name_Type;
-- Returns the object file name corresponding to a unit in a multi-source
-- file.
function Dependency_Name
(Source_File_Name : File_Name_Type;
Dependency : Dependency_File_Kind) return File_Name_Type;
-- Returns the dependency file name corresponding to a source file name
function Switches_Name
(Source_File_Name : File_Name_Type) return File_Name_Type;
-- Returns the switches file name corresponding to a source file name
procedure Set_Path_File_Var (Name : String; Value : String);
-- Call Setenv, after calling To_Host_File_Spec
function Current_Source_Path_File_Of
(Shared : Shared_Project_Tree_Data_Access) return Path_Name_Type;
-- Get the current include path file name
procedure Set_Current_Source_Path_File_Of
(Shared : Shared_Project_Tree_Data_Access;
To : Path_Name_Type);
-- Record the current include path file name
function Current_Object_Path_File_Of
(Shared : Shared_Project_Tree_Data_Access) return Path_Name_Type;
-- Get the current object path file name
procedure Set_Current_Object_Path_File_Of
(Shared : Shared_Project_Tree_Data_Access;
To : Path_Name_Type);
-- Record the current object path file name
-----------
-- Flags --
-----------
type Processing_Flags is private;
-- Flags used while parsing and processing a project tree to configure the
-- behavior of the parser, and indicate how to report error messages. This
-- structure does not allocate memory and never needs to be freed
type Error_Warning is (Silent, Warning, Error);
-- Severity of some situations, such as: no Ada sources in a project where
-- Ada is one of the language.
--
-- When the situation occurs, the behaviour depends on the setting:
--
-- - Silent: no action
-- - Warning: issue a warning, does not cause the tool to fail
-- - Error: issue an error, causes the tool to fail
type Error_Handler is access procedure
(Project : Project_Id;
Is_Warning : Boolean);
-- This warns when an error was found when parsing a project. The error
-- itself is handled through Prj.Err (and Prj.Err.Finalize should be called
-- to actually print the error). This ensures that duplicate error messages
-- are always correctly removed, that errors msgs are sorted, and that all
-- tools will report the same error to the user.
function Create_Flags
(Report_Error : Error_Handler;
When_No_Sources : Error_Warning;
Require_Sources_Other_Lang : Boolean := True;
Allow_Duplicate_Basenames : Boolean := True;
Compiler_Driver_Mandatory : Boolean := False;
Error_On_Unknown_Language : Boolean := True;
Require_Obj_Dirs : Error_Warning := Error;
Allow_Invalid_External : Error_Warning := Error;
Missing_Source_Files : Error_Warning := Error;
Ignore_Missing_With : Boolean := False)
return Processing_Flags;
-- Function used to create Processing_Flags structure
--
-- If Allow_Duplicate_Basenames, then files with the same base names are
-- authorized within a project for source-based languages (never for unit
-- based languages).
--
-- If Compiler_Driver_Mandatory is true, then a Compiler.Driver attribute
-- for each language must be defined, or we will not look for its source
-- files.
--
-- When_No_Sources indicates what should be done when no sources of a
-- language are found in a project where this language is declared.
-- If Require_Sources_Other_Lang is true, then all languages must have at
-- least one source file, or an error is reported via When_No_Sources. If
-- it is false, this is only required for Ada (and only if it is a language
-- of the project). When this parameter is set to False, we do not check
-- that a proper naming scheme is defined for languages other than Ada.
--
-- If Report_Error is null, use the standard error reporting mechanism
-- (Errout). Otherwise, report errors using Report_Error.
--
-- If Error_On_Unknown_Language is true, an error is displayed if some of
-- the source files listed in the project do not match any naming scheme
--
-- If Require_Obj_Dirs is true, then all object directories must exist
-- (possibly after they have been created automatically if the appropriate
-- switches were specified), or an error is raised.
--
-- If Allow_Invalid_External is Silent, then no error is reported when an
-- invalid value is used for an external variable (and it doesn't match its
-- type). Instead, the first possible value is used.
--
-- Missing_Source_Files indicates whether it is an error or a warning that
-- a source file mentioned in the Source_Files attributes is not actually
-- found in the source directories. This also impacts errors for missing
-- source directories.
--
-- If Ignore_Missing_With is True, then a "with" statement that cannot be
-- resolved will simply be ignored. However, in such a case, the flag
-- Incomplete_With in the project tree will be set to True.
-- This is meant for use by tools so that they can properly set the
-- project path in such a case:
-- * no "gnatls" found (so no default project path)
-- * user project sets Project.IDE'gnatls attribute to a cross gnatls
-- * user project also includes a "with" that can only be resolved
-- once we have found the gnatls
procedure Set_Ignore_Missing_With
(Flags : in out Processing_Flags;
Value : Boolean);
-- Set the value of component Ignore_Missing_With in Flags to Value
Gprbuild_Flags : constant Processing_Flags;
Gprinstall_Flags : constant Processing_Flags;
Gprclean_Flags : constant Processing_Flags;
Gprexec_Flags : constant Processing_Flags;
Gnatmake_Flags : constant Processing_Flags;
-- Flags used by the various tools. They all display the error messages
-- through Prj.Err.
----------------
-- Temp Files --
----------------
procedure Record_Temp_File
(Shared : Shared_Project_Tree_Data_Access;
Path : Path_Name_Type);
-- Record the path of a newly created temporary file, so that it can be
-- deleted later.
procedure Delete_All_Temp_Files
(Shared : Shared_Project_Tree_Data_Access);
-- Delete all recorded temporary files.
-- Does nothing if Debug.Debug_Flag_N is set
procedure Delete_Temp_Config_Files (Project_Tree : Project_Tree_Ref);
-- Delete all temporary config files. Does nothing if Debug.Debug_Flag_N is
-- set or if Project_Tree is null. This initially came from gnatmake
-- ??? Should this be combined with Delete_All_Temp_Files above
procedure Delete_Temporary_File
(Shared : Shared_Project_Tree_Data_Access := null;
Path : Path_Name_Type);
-- Delete a temporary file from the disk. The file is also removed from the
-- list of temporary files to delete at the end of the program, in case
-- another program running on the same machine has recreated it. Does
-- nothing if Debug.Debug_Flag_N is set
Virtual_Prefix : constant String := "v$";
-- The prefix for virtual extending projects. Because of the '$', which is
-- normally forbidden for project names, there cannot be any name clash.
-----------
-- Debug --
-----------
type Verbosity is (Default, Medium, High);
pragma Ordered (Verbosity);
-- Verbosity when parsing GNAT Project Files
-- Default is default (very quiet, if no errors).
-- Medium is more verbose.
-- High is extremely verbose.
Current_Verbosity : Verbosity := Default;
-- The current value of the verbosity the project files are parsed with
procedure Debug_Indent;
-- Inserts a series of blanks depending on the current indentation level
procedure Debug_Output (Str : String);
procedure Debug_Output (Str : String; Str2 : Name_Id);
-- If Current_Verbosity is not Default, outputs Str.
-- This indents Str based on the current indentation level for traces
-- Debug_Error is intended to be used to report an error in the traces.
procedure Debug_Increase_Indent
(Str : String := ""; Str2 : Name_Id := No_Name);
procedure Debug_Decrease_Indent (Str : String := "");
-- Increase or decrease the indentation level for debug traces. This
-- indentation level only affects output done through Debug_Output.
private
All_Packages : constant String_List_Access := null;
No_Project_Tree : constant Project_Tree_Ref := null;
Ignored : constant Variable_Kind := Single;
Nil_Variable_Value : constant Variable_Value :=
(Project => No_Project,
Kind => Undefined,
Location => No_Location,
Default => False);
type Source_Iterator is record
In_Tree : Project_Tree_Ref;
Project : Project_List;
All_Projects : Boolean;
-- Current project and whether we should move on to the next
Language : Language_Ptr;
-- Current language processed
Language_Name : Name_Id;
-- Only sources of this language will be returned (or all if No_Name)
Current : Source_Id;
Encapsulated_Libs : Boolean;
-- True if we want to include the sources from encapsulated libs
Locally_Removed : Boolean;
end record;
procedure Add_To_Buffer
(S : String;
To : in out String_Access;
Last : in out Natural);
-- Append a String to the Buffer
-- Table used to store the path name of all the created temporary files, so
-- that they can be deleted at the end, or when the program is interrupted.
package Temp_Files_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Path_Name_Type,
Table_Index_Type => Integer,
Table_Low_Bound => 1,
Table_Initial => 10,
Table_Increment => 10);
-- The following type is used to represent the part of a project tree which
-- is private to the Project Manager.
type Private_Project_Tree_Data is record
Temp_Files : Temp_Files_Table.Instance;
-- Temporary files created as part of running tools (pragma files,
-- mapping files,...)
Current_Source_Path_File : Path_Name_Type := No_Path;
-- Current value of project source path file env var. Used to avoid
-- setting the env var to the same value. When different from No_Path,
-- this indicates that environment variables were created and should be
-- deassigned to avoid polluting the environment. For gnatmake only.
Current_Object_Path_File : Path_Name_Type := No_Path;
-- Current value of project object path file env var. Used to avoid
-- setting the env var to the same value.
-- gnatmake only
end record;
-- The following type is used to hold processing flags which show what
-- functions are required for the various tools that are handled.
type Processing_Flags is record
Require_Sources_Other_Lang : Boolean;
Report_Error : Error_Handler;
When_No_Sources : Error_Warning;
Allow_Duplicate_Basenames : Boolean;
Compiler_Driver_Mandatory : Boolean;
Error_On_Unknown_Language : Boolean;
Require_Obj_Dirs : Error_Warning;
Allow_Invalid_External : Error_Warning;
Missing_Source_Files : Error_Warning;
Ignore_Missing_With : Boolean;
Incomplete_Withs : Boolean := False;
-- This flag is set to True when the projects are parsed while ignoring
-- missing withed project and some withed projects are not found.
end record;
Gprbuild_Flags : constant Processing_Flags :=
(Report_Error => null,
When_No_Sources => Warning,
Require_Sources_Other_Lang => True,
Allow_Duplicate_Basenames => False,
Compiler_Driver_Mandatory => True,
Error_On_Unknown_Language => True,
Require_Obj_Dirs => Error,
Allow_Invalid_External => Error,
Missing_Source_Files => Error,
Ignore_Missing_With => False,
Incomplete_Withs => False);
Gprinstall_Flags : constant Processing_Flags :=
(Report_Error => null,
When_No_Sources => Warning,
Require_Sources_Other_Lang => True,
Allow_Duplicate_Basenames => False,
Compiler_Driver_Mandatory => True,
Error_On_Unknown_Language => True,
Require_Obj_Dirs => Silent,
Allow_Invalid_External => Error,
Missing_Source_Files => Error,
Ignore_Missing_With => False,
Incomplete_Withs => False);
Gprclean_Flags : constant Processing_Flags :=
(Report_Error => null,
When_No_Sources => Warning,
Require_Sources_Other_Lang => True,
Allow_Duplicate_Basenames => False,
Compiler_Driver_Mandatory => True,
Error_On_Unknown_Language => True,
Require_Obj_Dirs => Warning,
Allow_Invalid_External => Error,
Missing_Source_Files => Error,
Ignore_Missing_With => False,
Incomplete_Withs => False);
Gprexec_Flags : constant Processing_Flags :=
(Report_Error => null,
When_No_Sources => Silent,
Require_Sources_Other_Lang => False,
Allow_Duplicate_Basenames => False,
Compiler_Driver_Mandatory => False,
Error_On_Unknown_Language => True,
Require_Obj_Dirs => Silent,
Allow_Invalid_External => Error,
Missing_Source_Files => Silent,
Ignore_Missing_With => False,
Incomplete_Withs => False);
Gnatmake_Flags : constant Processing_Flags :=
(Report_Error => null,
When_No_Sources => Error,
Require_Sources_Other_Lang => False,
Allow_Duplicate_Basenames => False,
Compiler_Driver_Mandatory => False,
Error_On_Unknown_Language => False,
Require_Obj_Dirs => Error,
Allow_Invalid_External => Error,
Missing_Source_Files => Error,
Ignore_Missing_With => False,
Incomplete_Withs => False);
end Prj;
|
------------------------------------------------------------------------------
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
with HAL.SPI;
package body OpenMV is
---------------------
-- Initialize_LEDs --
---------------------
procedure Initialize_LEDs is
begin
Enable_Clock (All_LEDs);
Configure_IO
(All_LEDs,
(Mode => Mode_Out,
Output_Type => Push_Pull,
Speed => Speed_100MHz,
Resistors => Floating));
end Initialize_LEDs;
-----------------
-- Set_RGB_LED --
-----------------
procedure Set_RGB_LED (C : LED_Color) is
begin
-- Clear to turn on LED
-- Set to turn off
case C is
when White | Red | Yellow | Magenta =>
Clear (Red_LED);
when others =>
Set (Red_LED);
end case;
case C is
when White | Green | Yellow | Cyan =>
Clear (Green_LED);
when others =>
Set (Green_LED);
end case;
case C is
when White | Cyan | Blue | Magenta =>
Clear (Blue_LED);
when others =>
Set (Blue_LED);
end case;
end Set_RGB_LED;
----------------
-- Turn_On_IR --
----------------
procedure Turn_On_IR is
begin
Set (IR_LED);
end Turn_On_IR;
-----------------
-- Turn_Off_IR --
-----------------
procedure Turn_Off_IR is
begin
Clear (IR_LED);
end Turn_Off_IR;
---------------------------
-- Initialize_Shield_SPI --
---------------------------
procedure Initialize_Shield_SPI is
SPI_Conf : STM32.SPI.SPI_Configuration;
GPIO_Conf : STM32.GPIO.GPIO_Port_Configuration;
procedure Initialize_DMA;
--------------------
-- Initialize_DMA --
--------------------
procedure Initialize_DMA is
Config : DMA_Stream_Configuration;
begin
Enable_Clock (Shield_SPI_DMA);
Config.Channel := Shield_SPI_DMA_Chan;
Config.Direction := Memory_To_Peripheral;
Config.Increment_Peripheral_Address := False;
Config.Increment_Memory_Address := True;
Config.Peripheral_Data_Format := Bytes;
Config.Memory_Data_Format := Bytes;
Config.Operation_Mode := Normal_Mode;
Config.Priority := Priority_High;
Config.FIFO_Enabled := True;
Config.FIFO_Threshold := FIFO_Threshold_Full_Configuration;
Config.Memory_Burst_Size := Memory_Burst_Inc4;
Config.Peripheral_Burst_Size := Peripheral_Burst_Single;
Configure (Shield_SPI_DMA, Shield_SPI_DMA_Stream, Config);
Shield_SPI.Set_TX_DMA_Handler (Shield_SPI_DMA_Int'Access);
end Initialize_DMA;
begin
Initialize_DMA;
STM32.Device.Enable_Clock (Shield_SPI_Points);
GPIO_Conf := (Mode => STM32.GPIO.Mode_AF,
AF => GPIO_AF_SPI2_5,
Resistors => STM32.GPIO.Pull_Down, -- SPI low polarity
AF_Speed => STM32.GPIO.Speed_100MHz,
AF_Output_Type => STM32.GPIO.Push_Pull);
STM32.GPIO.Configure_IO (Shield_SPI_Points, GPIO_Conf);
STM32.Device.Enable_Clock (Shield_SPI);
Shield_SPI.Disable;
SPI_Conf.Direction := STM32.SPI.D2Lines_FullDuplex;
SPI_Conf.Mode := STM32.SPI.Master;
SPI_Conf.Data_Size := HAL.SPI.Data_Size_8b;
SPI_Conf.Clock_Polarity := STM32.SPI.Low;
SPI_Conf.Clock_Phase := STM32.SPI.P1Edge;
SPI_Conf.Slave_Management := STM32.SPI.Software_Managed;
SPI_Conf.Baud_Rate_Prescaler := STM32.SPI.BRP_2;
SPI_Conf.First_Bit := STM32.SPI.MSB;
SPI_Conf.CRC_Poly := 7;
Shield_SPI.Configure (SPI_Conf);
Shield_SPI.Enable;
end Initialize_Shield_SPI;
-----------------------------
-- Initialize_Shield_USART --
-----------------------------
procedure Initialize_Shield_USART (Baud : STM32.USARTs.Baud_Rates) is
Configuration : GPIO_Port_Configuration;
begin
Enable_Clock (Shield_USART);
Enable_Clock (Shield_USART_Points);
Configuration := (Mode => STM32.GPIO.Mode_AF,
AF => Shield_USART_AF,
Resistors => STM32.GPIO.Pull_Up,
AF_Speed => STM32.GPIO.Speed_50MHz,
AF_Output_Type => STM32.GPIO.Push_Pull);
Configure_IO (Shield_USART_Points, Configuration);
Disable (Shield_USART);
Set_Baud_Rate (Shield_USART, Baud);
Set_Mode (Shield_USART, Tx_Rx_Mode);
Set_Stop_Bits (Shield_USART, Stopbits_1);
Set_Word_Length (Shield_USART, Word_Length_8);
Set_Parity (Shield_USART, No_Parity);
Set_Flow_Control (Shield_USART, No_Flow_Control);
Enable (Shield_USART);
end Initialize_Shield_USART;
----------------------
-- Get_Shield_USART --
----------------------
function Get_Shield_USART return not null HAL.UART.Any_UART_Port is
(USART_3'Access);
end OpenMV;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . B O A R D _ P A R A M E T E R S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1999-2002 Universidad Politecnica de Madrid --
-- Copyright (C) 2003-2005 The European Space Agency --
-- Copyright (C) 2003-2020, AdaCore --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
-- The port of GNARL to bare board targets was initially developed by the --
-- Real-Time Systems Group at the Technical University of Madrid. --
-- --
------------------------------------------------------------------------------
-- This package defines basic parameters used by the non tasking part of
-- the runtime.
-- This is the TMS570 (ARMv7) version of this package
package System.Board_Parameters is
pragma No_Elaboration_Code_All;
pragma Pure;
--------------------
-- Hardware clock --
--------------------
-- see system_tms570lc43.c for clock setup
Clock_Frequency : constant Natural := 300_000_000;
-- GCLK clock Hz: used by the Cortex-R cores
-- GCLK Max. = 300MHz on the TMS570LC43
-- GCLK Value = Max. (value on the HDK board)
HCLK_Frequency : constant := Clock_Frequency / 2;
-- Main clock used by the high-speed system modules
-- HCLK Max. = 150MHz
-- HCLK Value = Max.
VCLK_Frequency : constant := HCLK_Frequency / 2;
-- used by some system modules, peripheral modules accessed via the
-- Peripheral Central Resource controller.
-- VCLK Max. = 110MHz
-- VCLK Value = 75 MHz
end System.Board_Parameters;
|
-- part of AdaYaml, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "copying.txt"
private package Yaml.Lexer.Evaluation is
procedure Read_Plain_Scalar (L : in out Instance; T : out Token);
procedure Read_Single_Quoted_Scalar (L : in out Instance; T : out Token)
with Pre => L.Cur = ''';
procedure Read_Double_Quoted_Scalar (L : in out Instance; T : out Token)
with Pre => L.Cur = '"';
procedure Read_Block_Scalar (L : in out Instance; T : out Token)
with Pre => L.Cur in '|' | '>';
procedure Read_URI (L : in out Instance; Restricted : Boolean);
end Yaml.Lexer.Evaluation;
|
------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- Sample.Keyboard_Handler --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control
-- $Revision: 1.9 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Terminal_Interface.Curses; use Terminal_Interface.Curses;
-- This package contains a centralized keyboard handler used throughout
-- this example. The handler establishes a timeout mechanism that provides
-- periodical updates of the common header lines used in this example.
--
package Sample.Keyboard_Handler is
function Get_Key (Win : Window := Standard_Window) return Real_Key_Code;
-- The central routine for handling keystrokes.
procedure Init_Keyboard_Handler;
-- Initialize the keyboard
end Sample.Keyboard_Handler;
|
package Warn10_Pkg is
Size : constant Natural := 100;
type My_Array is array(1..Size, 1..Size) of Float;
type Root is tagged record
Input_Values : My_Array;
end record;
function Get_Input_Value( Driver : Root; I, J : Natural) return Float;
end Warn10_Pkg;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUNTIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 0 6 --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-1999 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 2, 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 COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.Storage_Elements;
with System.Unsigned_Types;
with Unchecked_Conversion;
package body System.Pack_06 is
subtype Ofs is System.Storage_Elements.Storage_Offset;
subtype Uns is System.Unsigned_Types.Unsigned;
subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
use type System.Storage_Elements.Storage_Offset;
use type System.Unsigned_Types.Unsigned;
type Cluster is record
E0, E1, E2, E3, E4, E5, E6, E7 : Bits_06;
end record;
for Cluster use record
E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
end record;
for Cluster'Size use Bits * 8;
for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
1 +
1 * Boolean'Pos (Bits mod 2 = 0) +
2 * Boolean'Pos (Bits mod 4 = 0));
-- Use maximum possible alignment, given the bit field size, since this
-- will result in the most efficient code possible for the field.
type Cluster_Ref is access Cluster;
function To_Ref is new
Unchecked_Conversion (System.Address, Cluster_Ref);
-- The following declarations are for the case where the address
-- passed to GetU_06 or SetU_06 is not guaranteed to be aligned.
-- These routines are used when the packed array is itself a
-- component of a packed record, and therefore may not be aligned.
type ClusterU is new Cluster;
for ClusterU'Alignment use 1;
type ClusterU_Ref is access ClusterU;
function To_Ref is new
Unchecked_Conversion (System.Address, ClusterU_Ref);
------------
-- Get_06 --
------------
function Get_06 (Arr : System.Address; N : Natural) return Bits_06 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
when 1 => return C.E1;
when 2 => return C.E2;
when 3 => return C.E3;
when 4 => return C.E4;
when 5 => return C.E5;
when 6 => return C.E6;
when 7 => return C.E7;
end case;
end Get_06;
-------------
-- GetU_06 --
-------------
function GetU_06 (Arr : System.Address; N : Natural) return Bits_06 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
when 1 => return C.E1;
when 2 => return C.E2;
when 3 => return C.E3;
when 4 => return C.E4;
when 5 => return C.E5;
when 6 => return C.E6;
when 7 => return C.E7;
end case;
end GetU_06;
------------
-- Set_06 --
------------
procedure Set_06 (Arr : System.Address; N : Natural; E : Bits_06) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
when 1 => C.E1 := E;
when 2 => C.E2 := E;
when 3 => C.E3 := E;
when 4 => C.E4 := E;
when 5 => C.E5 := E;
when 6 => C.E6 := E;
when 7 => C.E7 := E;
end case;
end Set_06;
-------------
-- SetU_06 --
-------------
procedure SetU_06 (Arr : System.Address; N : Natural; E : Bits_06) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
when 1 => C.E1 := E;
when 2 => C.E2 := E;
when 3 => C.E3 := E;
when 4 => C.E4 := E;
when 5 => C.E5 := E;
when 6 => C.E6 := E;
when 7 => C.E7 := E;
end case;
end SetU_06;
end System.Pack_06;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S E M _ C H 4 --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2006, 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 2, 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 COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Atree; use Atree;
with Debug; use Debug;
with Einfo; use Einfo;
with Elists; use Elists;
with Errout; use Errout;
with Exp_Util; use Exp_Util;
with Fname; use Fname;
with Itypes; use Itypes;
with Lib; use Lib;
with Lib.Xref; use Lib.Xref;
with Namet; use Namet;
with Nlists; use Nlists;
with Nmake; use Nmake;
with Opt; use Opt;
with Output; use Output;
with Restrict; use Restrict;
with Rident; use Rident;
with Rtsfind; use Rtsfind;
with Sem; use Sem;
with Sem_Cat; use Sem_Cat;
with Sem_Ch3; use Sem_Ch3;
with Sem_Ch8; use Sem_Ch8;
with Sem_Dist; use Sem_Dist;
with Sem_Eval; use Sem_Eval;
with Sem_Res; use Sem_Res;
with Sem_Util; use Sem_Util;
with Sem_Type; use Sem_Type;
with Stand; use Stand;
with Sinfo; use Sinfo;
with Snames; use Snames;
with Tbuild; use Tbuild;
with GNAT.Spelling_Checker; use GNAT.Spelling_Checker;
package body Sem_Ch4 is
-----------------------
-- Local Subprograms --
-----------------------
procedure Analyze_Expression (N : Node_Id);
-- For expressions that are not names, this is just a call to analyze.
-- If the expression is a name, it may be a call to a parameterless
-- function, and if so must be converted into an explicit call node
-- and analyzed as such. This deproceduring must be done during the first
-- pass of overload resolution, because otherwise a procedure call with
-- overloaded actuals may fail to resolve. See 4327-001 for an example.
procedure Analyze_Operator_Call (N : Node_Id; Op_Id : Entity_Id);
-- Analyze a call of the form "+"(x, y), etc. The prefix of the call
-- is an operator name or an expanded name whose selector is an operator
-- name, and one possible interpretation is as a predefined operator.
procedure Analyze_Overloaded_Selected_Component (N : Node_Id);
-- If the prefix of a selected_component is overloaded, the proper
-- interpretation that yields a record type with the proper selector
-- name must be selected.
procedure Analyze_User_Defined_Binary_Op (N : Node_Id; Op_Id : Entity_Id);
-- Procedure to analyze a user defined binary operator, which is resolved
-- like a function, but instead of a list of actuals it is presented
-- with the left and right operands of an operator node.
procedure Analyze_User_Defined_Unary_Op (N : Node_Id; Op_Id : Entity_Id);
-- Procedure to analyze a user defined unary operator, which is resolved
-- like a function, but instead of a list of actuals, it is presented with
-- the operand of the operator node.
procedure Ambiguous_Operands (N : Node_Id);
-- for equality, membership, and comparison operators with overloaded
-- arguments, list possible interpretations.
procedure Analyze_One_Call
(N : Node_Id;
Nam : Entity_Id;
Report : Boolean;
Success : out Boolean;
Skip_First : Boolean := False);
-- Check one interpretation of an overloaded subprogram name for
-- compatibility with the types of the actuals in a call. If there is a
-- single interpretation which does not match, post error if Report is
-- set to True.
--
-- Nam is the entity that provides the formals against which the actuals
-- are checked. Nam is either the name of a subprogram, or the internal
-- subprogram type constructed for an access_to_subprogram. If the actuals
-- are compatible with Nam, then Nam is added to the list of candidate
-- interpretations for N, and Success is set to True.
--
-- The flag Skip_First is used when analyzing a call that was rewritten
-- from object notation. In this case the first actual may have to receive
-- an explicit dereference, depending on the first formal of the operation
-- being called. The caller will have verified that the object is legal
-- for the call. If the remaining parameters match, the first parameter
-- will rewritten as a dereference if needed, prior to completing analysis.
procedure Check_Misspelled_Selector
(Prefix : Entity_Id;
Sel : Node_Id);
-- Give possible misspelling diagnostic if Sel is likely to be
-- a misspelling of one of the selectors of the Prefix.
-- This is called by Analyze_Selected_Component after producing
-- an invalid selector error message.
function Defined_In_Scope (T : Entity_Id; S : Entity_Id) return Boolean;
-- Verify that type T is declared in scope S. Used to find intepretations
-- for operators given by expanded names. This is abstracted as a separate
-- function to handle extensions to System, where S is System, but T is
-- declared in the extension.
procedure Find_Arithmetic_Types
(L, R : Node_Id;
Op_Id : Entity_Id;
N : Node_Id);
-- L and R are the operands of an arithmetic operator. Find
-- consistent pairs of interpretations for L and R that have a
-- numeric type consistent with the semantics of the operator.
procedure Find_Comparison_Types
(L, R : Node_Id;
Op_Id : Entity_Id;
N : Node_Id);
-- L and R are operands of a comparison operator. Find consistent
-- pairs of interpretations for L and R.
procedure Find_Concatenation_Types
(L, R : Node_Id;
Op_Id : Entity_Id;
N : Node_Id);
-- For the four varieties of concatenation
procedure Find_Equality_Types
(L, R : Node_Id;
Op_Id : Entity_Id;
N : Node_Id);
-- Ditto for equality operators
procedure Find_Boolean_Types
(L, R : Node_Id;
Op_Id : Entity_Id;
N : Node_Id);
-- Ditto for binary logical operations
procedure Find_Negation_Types
(R : Node_Id;
Op_Id : Entity_Id;
N : Node_Id);
-- Find consistent interpretation for operand of negation operator
procedure Find_Non_Universal_Interpretations
(N : Node_Id;
R : Node_Id;
Op_Id : Entity_Id;
T1 : Entity_Id);
-- For equality and comparison operators, the result is always boolean,
-- and the legality of the operation is determined from the visibility
-- of the operand types. If one of the operands has a universal interpre-
-- tation, the legality check uses some compatible non-universal
-- interpretation of the other operand. N can be an operator node, or
-- a function call whose name is an operator designator.
procedure Find_Unary_Types
(R : Node_Id;
Op_Id : Entity_Id;
N : Node_Id);
-- Unary arithmetic types: plus, minus, abs
procedure Check_Arithmetic_Pair
(T1, T2 : Entity_Id;
Op_Id : Entity_Id;
N : Node_Id);
-- Subsidiary procedure to Find_Arithmetic_Types. T1 and T2 are valid
-- types for left and right operand. Determine whether they constitute
-- a valid pair for the given operator, and record the corresponding
-- interpretation of the operator node. The node N may be an operator
-- node (the usual case) or a function call whose prefix is an operator
-- designator. In both cases Op_Id is the operator name itself.
procedure Diagnose_Call (N : Node_Id; Nam : Node_Id);
-- Give detailed information on overloaded call where none of the
-- interpretations match. N is the call node, Nam the designator for
-- the overloaded entity being called.
function Junk_Operand (N : Node_Id) return Boolean;
-- Test for an operand that is an inappropriate entity (e.g. a package
-- name or a label). If so, issue an error message and return True. If
-- the operand is not an inappropriate entity kind, return False.
procedure Operator_Check (N : Node_Id);
-- Verify that an operator has received some valid interpretation. If none
-- was found, determine whether a use clause would make the operation
-- legal. The variable Candidate_Type (defined in Sem_Type) is set for
-- every type compatible with the operator, even if the operator for the
-- type is not directly visible. The routine uses this type to emit a more
-- informative message.
procedure Process_Implicit_Dereference_Prefix
(E : Entity_Id;
P : Node_Id);
-- Called when P is the prefix of an implicit dereference, denoting an
-- object E. If in semantics only mode (-gnatc or generic), record that is
-- a reference to E. Normally, such a reference is generated only when the
-- implicit dereference is expanded into an explicit one. E may be empty,
-- in which case this procedure does nothing.
procedure Remove_Abstract_Operations (N : Node_Id);
-- Ada 2005: implementation of AI-310. An abstract non-dispatching
-- operation is not a candidate interpretation.
function Try_Indexed_Call
(N : Node_Id;
Nam : Entity_Id;
Typ : Entity_Id) return Boolean;
-- If a function has defaults for all its actuals, a call to it may
-- in fact be an indexing on the result of the call. Try_Indexed_Call
-- attempts the interpretation as an indexing, prior to analysis as
-- a call. If both are possible, the node is overloaded with both
-- interpretations (same symbol but two different types).
function Try_Indirect_Call
(N : Node_Id;
Nam : Entity_Id;
Typ : Entity_Id) return Boolean;
-- Similarly, a function F that needs no actuals can return an access
-- to a subprogram, and the call F (X) interpreted as F.all (X). In
-- this case the call may be overloaded with both interpretations.
function Try_Object_Operation (N : Node_Id) return Boolean;
-- Ada 2005 (AI-252): Give support to the object operation notation
------------------------
-- Ambiguous_Operands --
------------------------
procedure Ambiguous_Operands (N : Node_Id) is
procedure List_Operand_Interps (Opnd : Node_Id);
--------------------------
-- List_Operand_Interps --
--------------------------
procedure List_Operand_Interps (Opnd : Node_Id) is
Nam : Node_Id;
Err : Node_Id := N;
begin
if Is_Overloaded (Opnd) then
if Nkind (Opnd) in N_Op then
Nam := Opnd;
elsif Nkind (Opnd) = N_Function_Call then
Nam := Name (Opnd);
else
return;
end if;
else
return;
end if;
if Opnd = Left_Opnd (N) then
Error_Msg_N
("\left operand has the following interpretations", N);
else
Error_Msg_N
("\right operand has the following interpretations", N);
Err := Opnd;
end if;
List_Interps (Nam, Err);
end List_Operand_Interps;
-- Start of processing for Ambiguous_Operands
begin
if Nkind (N) = N_In
or else Nkind (N) = N_Not_In
then
Error_Msg_N ("ambiguous operands for membership", N);
elsif Nkind (N) = N_Op_Eq
or else Nkind (N) = N_Op_Ne
then
Error_Msg_N ("ambiguous operands for equality", N);
else
Error_Msg_N ("ambiguous operands for comparison", N);
end if;
if All_Errors_Mode then
List_Operand_Interps (Left_Opnd (N));
List_Operand_Interps (Right_Opnd (N));
else
Error_Msg_N ("\use -gnatf switch for details", N);
end if;
end Ambiguous_Operands;
-----------------------
-- Analyze_Aggregate --
-----------------------
-- Most of the analysis of Aggregates requires that the type be known,
-- and is therefore put off until resolution.
procedure Analyze_Aggregate (N : Node_Id) is
begin
if No (Etype (N)) then
Set_Etype (N, Any_Composite);
end if;
end Analyze_Aggregate;
-----------------------
-- Analyze_Allocator --
-----------------------
procedure Analyze_Allocator (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Sav_Errs : constant Nat := Serious_Errors_Detected;
E : Node_Id := Expression (N);
Acc_Type : Entity_Id;
Type_Id : Entity_Id;
begin
Check_Restriction (No_Allocators, N);
if Nkind (E) = N_Qualified_Expression then
Acc_Type := Create_Itype (E_Allocator_Type, N);
Set_Etype (Acc_Type, Acc_Type);
Init_Size_Align (Acc_Type);
Find_Type (Subtype_Mark (E));
Type_Id := Entity (Subtype_Mark (E));
Check_Fully_Declared (Type_Id, N);
Set_Directly_Designated_Type (Acc_Type, Type_Id);
if Is_Limited_Type (Type_Id)
and then Comes_From_Source (N)
and then not In_Instance_Body
then
-- Ada 2005 (AI-287): Do not post an error if the expression
-- corresponds to a limited aggregate. Limited aggregates
-- are checked in sem_aggr in a per-component manner
-- (compare with handling of Get_Value subprogram).
if Ada_Version >= Ada_05
and then Nkind (Expression (E)) = N_Aggregate
then
null;
else
Error_Msg_N ("initialization not allowed for limited types", N);
Explain_Limited_Type (Type_Id, N);
end if;
end if;
Analyze_And_Resolve (Expression (E), Type_Id);
-- A qualified expression requires an exact match of the type,
-- class-wide matching is not allowed.
if Is_Class_Wide_Type (Type_Id)
and then Base_Type (Etype (Expression (E))) /= Base_Type (Type_Id)
then
Wrong_Type (Expression (E), Type_Id);
end if;
Check_Non_Static_Context (Expression (E));
-- We don't analyze the qualified expression itself because it's
-- part of the allocator
Set_Etype (E, Type_Id);
-- Case where no qualified expression is present
else
declare
Def_Id : Entity_Id;
Base_Typ : Entity_Id;
begin
-- If the allocator includes a N_Subtype_Indication then a
-- constraint is present, otherwise the node is a subtype mark.
-- Introduce an explicit subtype declaration into the tree
-- defining some anonymous subtype and rewrite the allocator to
-- use this subtype rather than the subtype indication.
-- It is important to introduce the explicit subtype declaration
-- so that the bounds of the subtype indication are attached to
-- the tree in case the allocator is inside a generic unit.
if Nkind (E) = N_Subtype_Indication then
-- A constraint is only allowed for a composite type in Ada
-- 95. In Ada 83, a constraint is also allowed for an
-- access-to-composite type, but the constraint is ignored.
Find_Type (Subtype_Mark (E));
Base_Typ := Entity (Subtype_Mark (E));
if Is_Elementary_Type (Base_Typ) then
if not (Ada_Version = Ada_83
and then Is_Access_Type (Base_Typ))
then
Error_Msg_N ("constraint not allowed here", E);
if Nkind (Constraint (E))
= N_Index_Or_Discriminant_Constraint
then
Error_Msg_N
("\if qualified expression was meant, " &
"use apostrophe", Constraint (E));
end if;
end if;
-- Get rid of the bogus constraint:
Rewrite (E, New_Copy_Tree (Subtype_Mark (E)));
Analyze_Allocator (N);
return;
-- Ada 2005, AI-363: if the designated type has a constrained
-- partial view, it cannot receive a discriminant constraint,
-- and the allocated object is unconstrained.
elsif Ada_Version >= Ada_05
and then Has_Constrained_Partial_View (Base_Typ)
then
Error_Msg_N
("constraint no allowed when type " &
"has a constrained partial view", Constraint (E));
end if;
if Expander_Active then
Def_Id :=
Make_Defining_Identifier (Loc, New_Internal_Name ('S'));
Insert_Action (E,
Make_Subtype_Declaration (Loc,
Defining_Identifier => Def_Id,
Subtype_Indication => Relocate_Node (E)));
if Sav_Errs /= Serious_Errors_Detected
and then Nkind (Constraint (E))
= N_Index_Or_Discriminant_Constraint
then
Error_Msg_N
("if qualified expression was meant, " &
"use apostrophe!", Constraint (E));
end if;
E := New_Occurrence_Of (Def_Id, Loc);
Rewrite (Expression (N), E);
end if;
end if;
Type_Id := Process_Subtype (E, N);
Acc_Type := Create_Itype (E_Allocator_Type, N);
Set_Etype (Acc_Type, Acc_Type);
Init_Size_Align (Acc_Type);
Set_Directly_Designated_Type (Acc_Type, Type_Id);
Check_Fully_Declared (Type_Id, N);
-- Ada 2005 (AI-231)
if Can_Never_Be_Null (Type_Id) then
Error_Msg_N ("(Ada 2005) qualified expression required",
Expression (N));
end if;
-- Check restriction against dynamically allocated protected
-- objects. Note that when limited aggregates are supported,
-- a similar test should be applied to an allocator with a
-- qualified expression ???
if Is_Protected_Type (Type_Id) then
Check_Restriction (No_Protected_Type_Allocators, N);
end if;
-- Check for missing initialization. Skip this check if we already
-- had errors on analyzing the allocator, since in that case these
-- are probably cascaded errors
if Is_Indefinite_Subtype (Type_Id)
and then Serious_Errors_Detected = Sav_Errs
then
if Is_Class_Wide_Type (Type_Id) then
Error_Msg_N
("initialization required in class-wide allocation", N);
else
Error_Msg_N
("initialization required in unconstrained allocation", N);
end if;
end if;
end;
end if;
if Is_Abstract (Type_Id) then
Error_Msg_N ("cannot allocate abstract object", E);
end if;
if Has_Task (Designated_Type (Acc_Type)) then
Check_Restriction (No_Tasking, N);
Check_Restriction (Max_Tasks, N);
Check_Restriction (No_Task_Allocators, N);
end if;
-- If the No_Streams restriction is set, check that the type of the
-- object is not, and does not contain, any subtype derived from
-- Ada.Streams.Root_Stream_Type. Note that we guard the call to
-- Has_Stream just for efficiency reasons. There is no point in
-- spending time on a Has_Stream check if the restriction is not set.
if Restrictions.Set (No_Streams) then
if Has_Stream (Designated_Type (Acc_Type)) then
Check_Restriction (No_Streams, N);
end if;
end if;
Set_Etype (N, Acc_Type);
if not Is_Library_Level_Entity (Acc_Type) then
Check_Restriction (No_Local_Allocators, N);
end if;
if Serious_Errors_Detected > Sav_Errs then
Set_Error_Posted (N);
Set_Etype (N, Any_Type);
end if;
end Analyze_Allocator;
---------------------------
-- Analyze_Arithmetic_Op --
---------------------------
procedure Analyze_Arithmetic_Op (N : Node_Id) is
L : constant Node_Id := Left_Opnd (N);
R : constant Node_Id := Right_Opnd (N);
Op_Id : Entity_Id;
begin
Candidate_Type := Empty;
Analyze_Expression (L);
Analyze_Expression (R);
-- If the entity is already set, the node is the instantiation of
-- a generic node with a non-local reference, or was manufactured
-- by a call to Make_Op_xxx. In either case the entity is known to
-- be valid, and we do not need to collect interpretations, instead
-- we just get the single possible interpretation.
Op_Id := Entity (N);
if Present (Op_Id) then
if Ekind (Op_Id) = E_Operator then
if (Nkind (N) = N_Op_Divide or else
Nkind (N) = N_Op_Mod or else
Nkind (N) = N_Op_Multiply or else
Nkind (N) = N_Op_Rem)
and then Treat_Fixed_As_Integer (N)
then
null;
else
Set_Etype (N, Any_Type);
Find_Arithmetic_Types (L, R, Op_Id, N);
end if;
else
Set_Etype (N, Any_Type);
Add_One_Interp (N, Op_Id, Etype (Op_Id));
end if;
-- Entity is not already set, so we do need to collect interpretations
else
Op_Id := Get_Name_Entity_Id (Chars (N));
Set_Etype (N, Any_Type);
while Present (Op_Id) loop
if Ekind (Op_Id) = E_Operator
and then Present (Next_Entity (First_Entity (Op_Id)))
then
Find_Arithmetic_Types (L, R, Op_Id, N);
-- The following may seem superfluous, because an operator cannot
-- be generic, but this ignores the cleverness of the author of
-- ACVC bc1013a.
elsif Is_Overloadable (Op_Id) then
Analyze_User_Defined_Binary_Op (N, Op_Id);
end if;
Op_Id := Homonym (Op_Id);
end loop;
end if;
Operator_Check (N);
end Analyze_Arithmetic_Op;
------------------
-- Analyze_Call --
------------------
-- Function, procedure, and entry calls are checked here. The Name in
-- the call may be overloaded. The actuals have been analyzed and may
-- themselves be overloaded. On exit from this procedure, the node N
-- may have zero, one or more interpretations. In the first case an
-- error message is produced. In the last case, the node is flagged
-- as overloaded and the interpretations are collected in All_Interp.
-- If the name is an Access_To_Subprogram, it cannot be overloaded, but
-- the type-checking is similar to that of other calls.
procedure Analyze_Call (N : Node_Id) is
Actuals : constant List_Id := Parameter_Associations (N);
Nam : Node_Id := Name (N);
X : Interp_Index;
It : Interp;
Nam_Ent : Entity_Id;
Success : Boolean := False;
function Name_Denotes_Function return Boolean;
-- If the type of the name is an access to subprogram, this may be
-- the type of a name, or the return type of the function being called.
-- If the name is not an entity then it can denote a protected function.
-- Until we distinguish Etype from Return_Type, we must use this
-- routine to resolve the meaning of the name in the call.
---------------------------
-- Name_Denotes_Function --
---------------------------
function Name_Denotes_Function return Boolean is
begin
if Is_Entity_Name (Nam) then
return Ekind (Entity (Nam)) = E_Function;
elsif Nkind (Nam) = N_Selected_Component then
return Ekind (Entity (Selector_Name (Nam))) = E_Function;
else
return False;
end if;
end Name_Denotes_Function;
-- Start of processing for Analyze_Call
begin
-- Initialize the type of the result of the call to the error type,
-- which will be reset if the type is successfully resolved.
Set_Etype (N, Any_Type);
if not Is_Overloaded (Nam) then
-- Only one interpretation to check
if Ekind (Etype (Nam)) = E_Subprogram_Type then
Nam_Ent := Etype (Nam);
-- If the prefix is an access_to_subprogram, this may be an indirect
-- call. This is the case if the name in the call is not an entity
-- name, or if it is a function name in the context of a procedure
-- call. In this latter case, we have a call to a parameterless
-- function that returns a pointer_to_procedure which is the entity
-- being called.
elsif Is_Access_Type (Etype (Nam))
and then Ekind (Designated_Type (Etype (Nam))) = E_Subprogram_Type
and then
(not Name_Denotes_Function
or else Nkind (N) = N_Procedure_Call_Statement)
then
Nam_Ent := Designated_Type (Etype (Nam));
Insert_Explicit_Dereference (Nam);
-- Selected component case. Simple entry or protected operation,
-- where the entry name is given by the selector name.
elsif Nkind (Nam) = N_Selected_Component then
Nam_Ent := Entity (Selector_Name (Nam));
if Ekind (Nam_Ent) /= E_Entry
and then Ekind (Nam_Ent) /= E_Entry_Family
and then Ekind (Nam_Ent) /= E_Function
and then Ekind (Nam_Ent) /= E_Procedure
then
Error_Msg_N ("name in call is not a callable entity", Nam);
Set_Etype (N, Any_Type);
return;
end if;
-- If the name is an Indexed component, it can be a call to a member
-- of an entry family. The prefix must be a selected component whose
-- selector is the entry. Analyze_Procedure_Call normalizes several
-- kinds of call into this form.
elsif Nkind (Nam) = N_Indexed_Component then
if Nkind (Prefix (Nam)) = N_Selected_Component then
Nam_Ent := Entity (Selector_Name (Prefix (Nam)));
else
Error_Msg_N ("name in call is not a callable entity", Nam);
Set_Etype (N, Any_Type);
return;
end if;
elsif not Is_Entity_Name (Nam) then
Error_Msg_N ("name in call is not a callable entity", Nam);
Set_Etype (N, Any_Type);
return;
else
Nam_Ent := Entity (Nam);
-- If no interpretations, give error message
if not Is_Overloadable (Nam_Ent) then
declare
L : constant Boolean := Is_List_Member (N);
K : constant Node_Kind := Nkind (Parent (N));
begin
-- If the node is in a list whose parent is not an
-- expression then it must be an attempted procedure call.
if L and then K not in N_Subexpr then
if Ekind (Entity (Nam)) = E_Generic_Procedure then
Error_Msg_NE
("must instantiate generic procedure& before call",
Nam, Entity (Nam));
else
Error_Msg_N
("procedure or entry name expected", Nam);
end if;
-- Check for tasking cases where only an entry call will do
elsif not L
and then (K = N_Entry_Call_Alternative
or else K = N_Triggering_Alternative)
then
Error_Msg_N ("entry name expected", Nam);
-- Otherwise give general error message
else
Error_Msg_N ("invalid prefix in call", Nam);
end if;
return;
end;
end if;
end if;
Analyze_One_Call (N, Nam_Ent, True, Success);
-- If this is an indirect call, the return type of the access_to
-- subprogram may be an incomplete type. At the point of the call,
-- use the full type if available, and at the same time update
-- the return type of the access_to_subprogram.
if Success
and then Nkind (Nam) = N_Explicit_Dereference
and then Ekind (Etype (N)) = E_Incomplete_Type
and then Present (Full_View (Etype (N)))
then
Set_Etype (N, Full_View (Etype (N)));
Set_Etype (Nam_Ent, Etype (N));
end if;
else
-- An overloaded selected component must denote overloaded
-- operations of a concurrent type. The interpretations are
-- attached to the simple name of those operations.
if Nkind (Nam) = N_Selected_Component then
Nam := Selector_Name (Nam);
end if;
Get_First_Interp (Nam, X, It);
while Present (It.Nam) loop
Nam_Ent := It.Nam;
-- Name may be call that returns an access to subprogram, or more
-- generally an overloaded expression one of whose interpretations
-- yields an access to subprogram. If the name is an entity, we
-- do not dereference, because the node is a call that returns
-- the access type: note difference between f(x), where the call
-- may return an access subprogram type, and f(x)(y), where the
-- type returned by the call to f is implicitly dereferenced to
-- analyze the outer call.
if Is_Access_Type (Nam_Ent) then
Nam_Ent := Designated_Type (Nam_Ent);
elsif Is_Access_Type (Etype (Nam_Ent))
and then not Is_Entity_Name (Nam)
and then Ekind (Designated_Type (Etype (Nam_Ent)))
= E_Subprogram_Type
then
Nam_Ent := Designated_Type (Etype (Nam_Ent));
end if;
Analyze_One_Call (N, Nam_Ent, False, Success);
-- If the interpretation succeeds, mark the proper type of the
-- prefix (any valid candidate will do). If not, remove the
-- candidate interpretation. This only needs to be done for
-- overloaded protected operations, for other entities disambi-
-- guation is done directly in Resolve.
if Success then
Set_Etype (Nam, It.Typ);
elsif Nkind (Name (N)) = N_Selected_Component
or else Nkind (Name (N)) = N_Function_Call
then
Remove_Interp (X);
end if;
Get_Next_Interp (X, It);
end loop;
-- If the name is the result of a function call, it can only
-- be a call to a function returning an access to subprogram.
-- Insert explicit dereference.
if Nkind (Nam) = N_Function_Call then
Insert_Explicit_Dereference (Nam);
end if;
if Etype (N) = Any_Type then
-- None of the interpretations is compatible with the actuals
Diagnose_Call (N, Nam);
-- Special checks for uninstantiated put routines
if Nkind (N) = N_Procedure_Call_Statement
and then Is_Entity_Name (Nam)
and then Chars (Nam) = Name_Put
and then List_Length (Actuals) = 1
then
declare
Arg : constant Node_Id := First (Actuals);
Typ : Entity_Id;
begin
if Nkind (Arg) = N_Parameter_Association then
Typ := Etype (Explicit_Actual_Parameter (Arg));
else
Typ := Etype (Arg);
end if;
if Is_Signed_Integer_Type (Typ) then
Error_Msg_N
("possible missing instantiation of " &
"'Text_'I'O.'Integer_'I'O!", Nam);
elsif Is_Modular_Integer_Type (Typ) then
Error_Msg_N
("possible missing instantiation of " &
"'Text_'I'O.'Modular_'I'O!", Nam);
elsif Is_Floating_Point_Type (Typ) then
Error_Msg_N
("possible missing instantiation of " &
"'Text_'I'O.'Float_'I'O!", Nam);
elsif Is_Ordinary_Fixed_Point_Type (Typ) then
Error_Msg_N
("possible missing instantiation of " &
"'Text_'I'O.'Fixed_'I'O!", Nam);
elsif Is_Decimal_Fixed_Point_Type (Typ) then
Error_Msg_N
("possible missing instantiation of " &
"'Text_'I'O.'Decimal_'I'O!", Nam);
elsif Is_Enumeration_Type (Typ) then
Error_Msg_N
("possible missing instantiation of " &
"'Text_'I'O.'Enumeration_'I'O!", Nam);
end if;
end;
end if;
elsif not Is_Overloaded (N)
and then Is_Entity_Name (Nam)
then
-- Resolution yields a single interpretation. Verify that
-- is has the proper capitalization.
Set_Entity_With_Style_Check (Nam, Entity (Nam));
Generate_Reference (Entity (Nam), Nam);
Set_Etype (Nam, Etype (Entity (Nam)));
else
Remove_Abstract_Operations (N);
end if;
End_Interp_List;
end if;
end Analyze_Call;
---------------------------
-- Analyze_Comparison_Op --
---------------------------
procedure Analyze_Comparison_Op (N : Node_Id) is
L : constant Node_Id := Left_Opnd (N);
R : constant Node_Id := Right_Opnd (N);
Op_Id : Entity_Id := Entity (N);
begin
Set_Etype (N, Any_Type);
Candidate_Type := Empty;
Analyze_Expression (L);
Analyze_Expression (R);
if Present (Op_Id) then
if Ekind (Op_Id) = E_Operator then
Find_Comparison_Types (L, R, Op_Id, N);
else
Add_One_Interp (N, Op_Id, Etype (Op_Id));
end if;
if Is_Overloaded (L) then
Set_Etype (L, Intersect_Types (L, R));
end if;
else
Op_Id := Get_Name_Entity_Id (Chars (N));
while Present (Op_Id) loop
if Ekind (Op_Id) = E_Operator then
Find_Comparison_Types (L, R, Op_Id, N);
else
Analyze_User_Defined_Binary_Op (N, Op_Id);
end if;
Op_Id := Homonym (Op_Id);
end loop;
end if;
Operator_Check (N);
end Analyze_Comparison_Op;
---------------------------
-- Analyze_Concatenation --
---------------------------
-- If the only one-dimensional array type in scope is String,
-- this is the resulting type of the operation. Otherwise there
-- will be a concatenation operation defined for each user-defined
-- one-dimensional array.
procedure Analyze_Concatenation (N : Node_Id) is
L : constant Node_Id := Left_Opnd (N);
R : constant Node_Id := Right_Opnd (N);
Op_Id : Entity_Id := Entity (N);
LT : Entity_Id;
RT : Entity_Id;
begin
Set_Etype (N, Any_Type);
Candidate_Type := Empty;
Analyze_Expression (L);
Analyze_Expression (R);
-- If the entity is present, the node appears in an instance,
-- and denotes a predefined concatenation operation. The resulting
-- type is obtained from the arguments when possible. If the arguments
-- are aggregates, the array type and the concatenation type must be
-- visible.
if Present (Op_Id) then
if Ekind (Op_Id) = E_Operator then
LT := Base_Type (Etype (L));
RT := Base_Type (Etype (R));
if Is_Array_Type (LT)
and then (RT = LT or else RT = Base_Type (Component_Type (LT)))
then
Add_One_Interp (N, Op_Id, LT);
elsif Is_Array_Type (RT)
and then LT = Base_Type (Component_Type (RT))
then
Add_One_Interp (N, Op_Id, RT);
-- If one operand is a string type or a user-defined array type,
-- and the other is a literal, result is of the specific type.
elsif
(Root_Type (LT) = Standard_String
or else Scope (LT) /= Standard_Standard)
and then Etype (R) = Any_String
then
Add_One_Interp (N, Op_Id, LT);
elsif
(Root_Type (RT) = Standard_String
or else Scope (RT) /= Standard_Standard)
and then Etype (L) = Any_String
then
Add_One_Interp (N, Op_Id, RT);
elsif not Is_Generic_Type (Etype (Op_Id)) then
Add_One_Interp (N, Op_Id, Etype (Op_Id));
else
-- Type and its operations must be visible
Set_Entity (N, Empty);
Analyze_Concatenation (N);
end if;
else
Add_One_Interp (N, Op_Id, Etype (Op_Id));
end if;
else
Op_Id := Get_Name_Entity_Id (Name_Op_Concat);
while Present (Op_Id) loop
if Ekind (Op_Id) = E_Operator then
-- Do not consider operators declared in dead code, they can
-- not be part of the resolution.
if Is_Eliminated (Op_Id) then
null;
else
Find_Concatenation_Types (L, R, Op_Id, N);
end if;
else
Analyze_User_Defined_Binary_Op (N, Op_Id);
end if;
Op_Id := Homonym (Op_Id);
end loop;
end if;
Operator_Check (N);
end Analyze_Concatenation;
------------------------------------
-- Analyze_Conditional_Expression --
------------------------------------
procedure Analyze_Conditional_Expression (N : Node_Id) is
Condition : constant Node_Id := First (Expressions (N));
Then_Expr : constant Node_Id := Next (Condition);
Else_Expr : constant Node_Id := Next (Then_Expr);
begin
Analyze_Expression (Condition);
Analyze_Expression (Then_Expr);
Analyze_Expression (Else_Expr);
Set_Etype (N, Etype (Then_Expr));
end Analyze_Conditional_Expression;
-------------------------
-- Analyze_Equality_Op --
-------------------------
procedure Analyze_Equality_Op (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
L : constant Node_Id := Left_Opnd (N);
R : constant Node_Id := Right_Opnd (N);
Op_Id : Entity_Id;
begin
Set_Etype (N, Any_Type);
Candidate_Type := Empty;
Analyze_Expression (L);
Analyze_Expression (R);
-- If the entity is set, the node is a generic instance with a non-local
-- reference to the predefined operator or to a user-defined function.
-- It can also be an inequality that is expanded into the negation of a
-- call to a user-defined equality operator.
-- For the predefined case, the result is Boolean, regardless of the
-- type of the operands. The operands may even be limited, if they are
-- generic actuals. If they are overloaded, label the left argument with
-- the common type that must be present, or with the type of the formal
-- of the user-defined function.
if Present (Entity (N)) then
Op_Id := Entity (N);
if Ekind (Op_Id) = E_Operator then
Add_One_Interp (N, Op_Id, Standard_Boolean);
else
Add_One_Interp (N, Op_Id, Etype (Op_Id));
end if;
if Is_Overloaded (L) then
if Ekind (Op_Id) = E_Operator then
Set_Etype (L, Intersect_Types (L, R));
else
Set_Etype (L, Etype (First_Formal (Op_Id)));
end if;
end if;
else
Op_Id := Get_Name_Entity_Id (Chars (N));
while Present (Op_Id) loop
if Ekind (Op_Id) = E_Operator then
Find_Equality_Types (L, R, Op_Id, N);
else
Analyze_User_Defined_Binary_Op (N, Op_Id);
end if;
Op_Id := Homonym (Op_Id);
end loop;
end if;
-- If there was no match, and the operator is inequality, this may
-- be a case where inequality has not been made explicit, as for
-- tagged types. Analyze the node as the negation of an equality
-- operation. This cannot be done earlier, because before analysis
-- we cannot rule out the presence of an explicit inequality.
if Etype (N) = Any_Type
and then Nkind (N) = N_Op_Ne
then
Op_Id := Get_Name_Entity_Id (Name_Op_Eq);
while Present (Op_Id) loop
if Ekind (Op_Id) = E_Operator then
Find_Equality_Types (L, R, Op_Id, N);
else
Analyze_User_Defined_Binary_Op (N, Op_Id);
end if;
Op_Id := Homonym (Op_Id);
end loop;
if Etype (N) /= Any_Type then
Op_Id := Entity (N);
Rewrite (N,
Make_Op_Not (Loc,
Right_Opnd =>
Make_Op_Eq (Loc,
Left_Opnd => Relocate_Node (Left_Opnd (N)),
Right_Opnd => Relocate_Node (Right_Opnd (N)))));
Set_Entity (Right_Opnd (N), Op_Id);
Analyze (N);
end if;
end if;
Operator_Check (N);
end Analyze_Equality_Op;
----------------------------------
-- Analyze_Explicit_Dereference --
----------------------------------
procedure Analyze_Explicit_Dereference (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
P : constant Node_Id := Prefix (N);
T : Entity_Id;
I : Interp_Index;
It : Interp;
New_N : Node_Id;
function Is_Function_Type return Boolean;
-- Check whether node may be interpreted as an implicit function call
----------------------
-- Is_Function_Type --
----------------------
function Is_Function_Type return Boolean is
I : Interp_Index;
It : Interp;
begin
if not Is_Overloaded (N) then
return Ekind (Base_Type (Etype (N))) = E_Subprogram_Type
and then Etype (Base_Type (Etype (N))) /= Standard_Void_Type;
else
Get_First_Interp (N, I, It);
while Present (It.Nam) loop
if Ekind (Base_Type (It.Typ)) /= E_Subprogram_Type
or else Etype (Base_Type (It.Typ)) = Standard_Void_Type
then
return False;
end if;
Get_Next_Interp (I, It);
end loop;
return True;
end if;
end Is_Function_Type;
-- Start of processing for Analyze_Explicit_Dereference
begin
Analyze (P);
Set_Etype (N, Any_Type);
-- Test for remote access to subprogram type, and if so return
-- after rewriting the original tree.
if Remote_AST_E_Dereference (P) then
return;
end if;
-- Normal processing for other than remote access to subprogram type
if not Is_Overloaded (P) then
if Is_Access_Type (Etype (P)) then
-- Set the Etype. We need to go thru Is_For_Access_Subtypes
-- to avoid other problems caused by the Private_Subtype
-- and it is safe to go to the Base_Type because this is the
-- same as converting the access value to its Base_Type.
declare
DT : Entity_Id := Designated_Type (Etype (P));
begin
if Ekind (DT) = E_Private_Subtype
and then Is_For_Access_Subtype (DT)
then
DT := Base_Type (DT);
end if;
Set_Etype (N, DT);
end;
elsif Etype (P) /= Any_Type then
Error_Msg_N ("prefix of dereference must be an access type", N);
return;
end if;
else
Get_First_Interp (P, I, It);
while Present (It.Nam) loop
T := It.Typ;
if Is_Access_Type (T) then
Add_One_Interp (N, Designated_Type (T), Designated_Type (T));
end if;
Get_Next_Interp (I, It);
end loop;
-- Error if no interpretation of the prefix has an access type
if Etype (N) = Any_Type then
Error_Msg_N
("access type required in prefix of explicit dereference", P);
Set_Etype (N, Any_Type);
return;
end if;
end if;
if Is_Function_Type
and then Nkind (Parent (N)) /= N_Indexed_Component
and then (Nkind (Parent (N)) /= N_Function_Call
or else N /= Name (Parent (N)))
and then (Nkind (Parent (N)) /= N_Procedure_Call_Statement
or else N /= Name (Parent (N)))
and then Nkind (Parent (N)) /= N_Subprogram_Renaming_Declaration
and then (Nkind (Parent (N)) /= N_Attribute_Reference
or else
(Attribute_Name (Parent (N)) /= Name_Address
and then
Attribute_Name (Parent (N)) /= Name_Access))
then
-- Name is a function call with no actuals, in a context that
-- requires deproceduring (including as an actual in an enclosing
-- function or procedure call). There are some pathological cases
-- where the prefix might include functions that return access to
-- subprograms and others that return a regular type. Disambiguation
-- of those has to take place in Resolve.
-- See e.g. 7117-014 and E317-001.
New_N :=
Make_Function_Call (Loc,
Name => Make_Explicit_Dereference (Loc, P),
Parameter_Associations => New_List);
-- If the prefix is overloaded, remove operations that have formals,
-- we know that this is a parameterless call.
if Is_Overloaded (P) then
Get_First_Interp (P, I, It);
while Present (It.Nam) loop
T := It.Typ;
if No (First_Formal (Base_Type (Designated_Type (T)))) then
Set_Etype (P, T);
else
Remove_Interp (I);
end if;
Get_Next_Interp (I, It);
end loop;
end if;
Rewrite (N, New_N);
Analyze (N);
elsif not Is_Function_Type
and then Is_Overloaded (N)
then
-- The prefix may include access to subprograms and other access
-- types. If the context selects the interpretation that is a call,
-- we cannot rewrite the node yet, but we include the result of
-- the call interpretation.
Get_First_Interp (N, I, It);
while Present (It.Nam) loop
if Ekind (Base_Type (It.Typ)) = E_Subprogram_Type
and then Etype (Base_Type (It.Typ)) /= Standard_Void_Type
then
Add_One_Interp (N, Etype (It.Typ), Etype (It.Typ));
end if;
Get_Next_Interp (I, It);
end loop;
end if;
-- A value of remote access-to-class-wide must not be dereferenced
-- (RM E.2.2(16)).
Validate_Remote_Access_To_Class_Wide_Type (N);
end Analyze_Explicit_Dereference;
------------------------
-- Analyze_Expression --
------------------------
procedure Analyze_Expression (N : Node_Id) is
begin
Analyze (N);
Check_Parameterless_Call (N);
end Analyze_Expression;
------------------------------------
-- Analyze_Indexed_Component_Form --
------------------------------------
procedure Analyze_Indexed_Component_Form (N : Node_Id) is
P : constant Node_Id := Prefix (N);
Exprs : constant List_Id := Expressions (N);
Exp : Node_Id;
P_T : Entity_Id;
E : Node_Id;
U_N : Entity_Id;
procedure Process_Function_Call;
-- Prefix in indexed component form is an overloadable entity,
-- so the node is a function call. Reformat it as such.
procedure Process_Indexed_Component;
-- Prefix in indexed component form is actually an indexed component.
-- This routine processes it, knowing that the prefix is already
-- resolved.
procedure Process_Indexed_Component_Or_Slice;
-- An indexed component with a single index may designate a slice if
-- the index is a subtype mark. This routine disambiguates these two
-- cases by resolving the prefix to see if it is a subtype mark.
procedure Process_Overloaded_Indexed_Component;
-- If the prefix of an indexed component is overloaded, the proper
-- interpretation is selected by the index types and the context.
---------------------------
-- Process_Function_Call --
---------------------------
procedure Process_Function_Call is
Actual : Node_Id;
begin
Change_Node (N, N_Function_Call);
Set_Name (N, P);
Set_Parameter_Associations (N, Exprs);
Actual := First (Parameter_Associations (N));
while Present (Actual) loop
Analyze (Actual);
Check_Parameterless_Call (Actual);
Next_Actual (Actual);
end loop;
Analyze_Call (N);
end Process_Function_Call;
-------------------------------
-- Process_Indexed_Component --
-------------------------------
procedure Process_Indexed_Component is
Exp : Node_Id;
Array_Type : Entity_Id;
Index : Node_Id;
Pent : Entity_Id := Empty;
begin
Exp := First (Exprs);
if Is_Overloaded (P) then
Process_Overloaded_Indexed_Component;
else
Array_Type := Etype (P);
if Is_Entity_Name (P) then
Pent := Entity (P);
elsif Nkind (P) = N_Selected_Component
and then Is_Entity_Name (Selector_Name (P))
then
Pent := Entity (Selector_Name (P));
end if;
-- Prefix must be appropriate for an array type, taking into
-- account a possible implicit dereference.
if Is_Access_Type (Array_Type) then
Array_Type := Designated_Type (Array_Type);
Error_Msg_NW (Warn_On_Dereference, "?implicit dereference", N);
Process_Implicit_Dereference_Prefix (Pent, P);
end if;
if Is_Array_Type (Array_Type) then
null;
elsif Present (Pent) and then Ekind (Pent) = E_Entry_Family then
Analyze (Exp);
Set_Etype (N, Any_Type);
if not Has_Compatible_Type
(Exp, Entry_Index_Type (Pent))
then
Error_Msg_N ("invalid index type in entry name", N);
elsif Present (Next (Exp)) then
Error_Msg_N ("too many subscripts in entry reference", N);
else
Set_Etype (N, Etype (P));
end if;
return;
elsif Is_Record_Type (Array_Type)
and then Remote_AST_I_Dereference (P)
then
return;
elsif Array_Type = Any_Type then
Set_Etype (N, Any_Type);
return;
-- Here we definitely have a bad indexing
else
if Nkind (Parent (N)) = N_Requeue_Statement
and then Present (Pent) and then Ekind (Pent) = E_Entry
then
Error_Msg_N
("REQUEUE does not permit parameters", First (Exprs));
elsif Is_Entity_Name (P)
and then Etype (P) = Standard_Void_Type
then
Error_Msg_NE ("incorrect use of&", P, Entity (P));
else
Error_Msg_N ("array type required in indexed component", P);
end if;
Set_Etype (N, Any_Type);
return;
end if;
Index := First_Index (Array_Type);
while Present (Index) and then Present (Exp) loop
if not Has_Compatible_Type (Exp, Etype (Index)) then
Wrong_Type (Exp, Etype (Index));
Set_Etype (N, Any_Type);
return;
end if;
Next_Index (Index);
Next (Exp);
end loop;
Set_Etype (N, Component_Type (Array_Type));
if Present (Index) then
Error_Msg_N
("too few subscripts in array reference", First (Exprs));
elsif Present (Exp) then
Error_Msg_N ("too many subscripts in array reference", Exp);
end if;
end if;
end Process_Indexed_Component;
----------------------------------------
-- Process_Indexed_Component_Or_Slice --
----------------------------------------
procedure Process_Indexed_Component_Or_Slice is
begin
Exp := First (Exprs);
while Present (Exp) loop
Analyze_Expression (Exp);
Next (Exp);
end loop;
Exp := First (Exprs);
-- If one index is present, and it is a subtype name, then the
-- node denotes a slice (note that the case of an explicit range
-- for a slice was already built as an N_Slice node in the first
-- place, so that case is not handled here).
-- We use a replace rather than a rewrite here because this is one
-- of the cases in which the tree built by the parser is plain wrong.
if No (Next (Exp))
and then Is_Entity_Name (Exp)
and then Is_Type (Entity (Exp))
then
Replace (N,
Make_Slice (Sloc (N),
Prefix => P,
Discrete_Range => New_Copy (Exp)));
Analyze (N);
-- Otherwise (more than one index present, or single index is not
-- a subtype name), then we have the indexed component case.
else
Process_Indexed_Component;
end if;
end Process_Indexed_Component_Or_Slice;
------------------------------------------
-- Process_Overloaded_Indexed_Component --
------------------------------------------
procedure Process_Overloaded_Indexed_Component is
Exp : Node_Id;
I : Interp_Index;
It : Interp;
Typ : Entity_Id;
Index : Node_Id;
Found : Boolean;
begin
Set_Etype (N, Any_Type);
Get_First_Interp (P, I, It);
while Present (It.Nam) loop
Typ := It.Typ;
if Is_Access_Type (Typ) then
Typ := Designated_Type (Typ);
Error_Msg_NW (Warn_On_Dereference, "?implicit dereference", N);
end if;
if Is_Array_Type (Typ) then
-- Got a candidate: verify that index types are compatible
Index := First_Index (Typ);
Found := True;
Exp := First (Exprs);
while Present (Index) and then Present (Exp) loop
if Has_Compatible_Type (Exp, Etype (Index)) then
null;
else
Found := False;
Remove_Interp (I);
exit;
end if;
Next_Index (Index);
Next (Exp);
end loop;
if Found and then No (Index) and then No (Exp) then
Add_One_Interp (N,
Etype (Component_Type (Typ)),
Etype (Component_Type (Typ)));
end if;
end if;
Get_Next_Interp (I, It);
end loop;
if Etype (N) = Any_Type then
Error_Msg_N ("no legal interpetation for indexed component", N);
Set_Is_Overloaded (N, False);
end if;
End_Interp_List;
end Process_Overloaded_Indexed_Component;
-- Start of processing for Analyze_Indexed_Component_Form
begin
-- Get name of array, function or type
Analyze (P);
if Nkind (N) = N_Function_Call
or else Nkind (N) = N_Procedure_Call_Statement
then
-- If P is an explicit dereference whose prefix is of a
-- remote access-to-subprogram type, then N has already
-- been rewritten as a subprogram call and analyzed.
return;
end if;
pragma Assert (Nkind (N) = N_Indexed_Component);
P_T := Base_Type (Etype (P));
if Is_Entity_Name (P)
or else Nkind (P) = N_Operator_Symbol
then
U_N := Entity (P);
if Ekind (U_N) in Type_Kind then
-- Reformat node as a type conversion
E := Remove_Head (Exprs);
if Present (First (Exprs)) then
Error_Msg_N
("argument of type conversion must be single expression", N);
end if;
Change_Node (N, N_Type_Conversion);
Set_Subtype_Mark (N, P);
Set_Etype (N, U_N);
Set_Expression (N, E);
-- After changing the node, call for the specific Analysis
-- routine directly, to avoid a double call to the expander.
Analyze_Type_Conversion (N);
return;
end if;
if Is_Overloadable (U_N) then
Process_Function_Call;
elsif Ekind (Etype (P)) = E_Subprogram_Type
or else (Is_Access_Type (Etype (P))
and then
Ekind (Designated_Type (Etype (P))) = E_Subprogram_Type)
then
-- Call to access_to-subprogram with possible implicit dereference
Process_Function_Call;
elsif Is_Generic_Subprogram (U_N) then
-- A common beginner's (or C++ templates fan) error
Error_Msg_N ("generic subprogram cannot be called", N);
Set_Etype (N, Any_Type);
return;
else
Process_Indexed_Component_Or_Slice;
end if;
-- If not an entity name, prefix is an expression that may denote
-- an array or an access-to-subprogram.
else
if Ekind (P_T) = E_Subprogram_Type
or else (Is_Access_Type (P_T)
and then
Ekind (Designated_Type (P_T)) = E_Subprogram_Type)
then
Process_Function_Call;
elsif Nkind (P) = N_Selected_Component
and then Is_Overloadable (Entity (Selector_Name (P)))
then
Process_Function_Call;
else
-- Indexed component, slice, or a call to a member of a family
-- entry, which will be converted to an entry call later.
Process_Indexed_Component_Or_Slice;
end if;
end if;
end Analyze_Indexed_Component_Form;
------------------------
-- Analyze_Logical_Op --
------------------------
procedure Analyze_Logical_Op (N : Node_Id) is
L : constant Node_Id := Left_Opnd (N);
R : constant Node_Id := Right_Opnd (N);
Op_Id : Entity_Id := Entity (N);
begin
Set_Etype (N, Any_Type);
Candidate_Type := Empty;
Analyze_Expression (L);
Analyze_Expression (R);
if Present (Op_Id) then
if Ekind (Op_Id) = E_Operator then
Find_Boolean_Types (L, R, Op_Id, N);
else
Add_One_Interp (N, Op_Id, Etype (Op_Id));
end if;
else
Op_Id := Get_Name_Entity_Id (Chars (N));
while Present (Op_Id) loop
if Ekind (Op_Id) = E_Operator then
Find_Boolean_Types (L, R, Op_Id, N);
else
Analyze_User_Defined_Binary_Op (N, Op_Id);
end if;
Op_Id := Homonym (Op_Id);
end loop;
end if;
Operator_Check (N);
end Analyze_Logical_Op;
---------------------------
-- Analyze_Membership_Op --
---------------------------
procedure Analyze_Membership_Op (N : Node_Id) is
L : constant Node_Id := Left_Opnd (N);
R : constant Node_Id := Right_Opnd (N);
Index : Interp_Index;
It : Interp;
Found : Boolean := False;
I_F : Interp_Index;
T_F : Entity_Id;
procedure Try_One_Interp (T1 : Entity_Id);
-- Routine to try one proposed interpretation. Note that the context
-- of the operation plays no role in resolving the arguments, so that
-- if there is more than one interpretation of the operands that is
-- compatible with a membership test, the operation is ambiguous.
--------------------
-- Try_One_Interp --
--------------------
procedure Try_One_Interp (T1 : Entity_Id) is
begin
if Has_Compatible_Type (R, T1) then
if Found
and then Base_Type (T1) /= Base_Type (T_F)
then
It := Disambiguate (L, I_F, Index, Any_Type);
if It = No_Interp then
Ambiguous_Operands (N);
Set_Etype (L, Any_Type);
return;
else
T_F := It.Typ;
end if;
else
Found := True;
T_F := T1;
I_F := Index;
end if;
Set_Etype (L, T_F);
end if;
end Try_One_Interp;
-- Start of processing for Analyze_Membership_Op
begin
Analyze_Expression (L);
if Nkind (R) = N_Range
or else (Nkind (R) = N_Attribute_Reference
and then Attribute_Name (R) = Name_Range)
then
Analyze (R);
if not Is_Overloaded (L) then
Try_One_Interp (Etype (L));
else
Get_First_Interp (L, Index, It);
while Present (It.Typ) loop
Try_One_Interp (It.Typ);
Get_Next_Interp (Index, It);
end loop;
end if;
-- If not a range, it can only be a subtype mark, or else there
-- is a more basic error, to be diagnosed in Find_Type.
else
Find_Type (R);
if Is_Entity_Name (R) then
Check_Fully_Declared (Entity (R), R);
end if;
end if;
-- Compatibility between expression and subtype mark or range is
-- checked during resolution. The result of the operation is Boolean
-- in any case.
Set_Etype (N, Standard_Boolean);
if Comes_From_Source (N)
and then Is_CPP_Class (Etype (Etype (Right_Opnd (N))))
then
Error_Msg_N ("membership test not applicable to cpp-class types", N);
end if;
end Analyze_Membership_Op;
----------------------
-- Analyze_Negation --
----------------------
procedure Analyze_Negation (N : Node_Id) is
R : constant Node_Id := Right_Opnd (N);
Op_Id : Entity_Id := Entity (N);
begin
Set_Etype (N, Any_Type);
Candidate_Type := Empty;
Analyze_Expression (R);
if Present (Op_Id) then
if Ekind (Op_Id) = E_Operator then
Find_Negation_Types (R, Op_Id, N);
else
Add_One_Interp (N, Op_Id, Etype (Op_Id));
end if;
else
Op_Id := Get_Name_Entity_Id (Chars (N));
while Present (Op_Id) loop
if Ekind (Op_Id) = E_Operator then
Find_Negation_Types (R, Op_Id, N);
else
Analyze_User_Defined_Unary_Op (N, Op_Id);
end if;
Op_Id := Homonym (Op_Id);
end loop;
end if;
Operator_Check (N);
end Analyze_Negation;
------------------
-- Analyze_Null --
------------------
procedure Analyze_Null (N : Node_Id) is
begin
Set_Etype (N, Any_Access);
end Analyze_Null;
----------------------
-- Analyze_One_Call --
----------------------
procedure Analyze_One_Call
(N : Node_Id;
Nam : Entity_Id;
Report : Boolean;
Success : out Boolean;
Skip_First : Boolean := False)
is
Actuals : constant List_Id := Parameter_Associations (N);
Prev_T : constant Entity_Id := Etype (N);
Formal : Entity_Id;
Actual : Node_Id;
Is_Indexed : Boolean := False;
Subp_Type : constant Entity_Id := Etype (Nam);
Norm_OK : Boolean;
procedure Indicate_Name_And_Type;
-- If candidate interpretation matches, indicate name and type of
-- result on call node.
----------------------------
-- Indicate_Name_And_Type --
----------------------------
procedure Indicate_Name_And_Type is
begin
Add_One_Interp (N, Nam, Etype (Nam));
Success := True;
-- If the prefix of the call is a name, indicate the entity
-- being called. If it is not a name, it is an expression that
-- denotes an access to subprogram or else an entry or family. In
-- the latter case, the name is a selected component, and the entity
-- being called is noted on the selector.
if not Is_Type (Nam) then
if Is_Entity_Name (Name (N))
or else Nkind (Name (N)) = N_Operator_Symbol
then
Set_Entity (Name (N), Nam);
elsif Nkind (Name (N)) = N_Selected_Component then
Set_Entity (Selector_Name (Name (N)), Nam);
end if;
end if;
if Debug_Flag_E and not Report then
Write_Str (" Overloaded call ");
Write_Int (Int (N));
Write_Str (" compatible with ");
Write_Int (Int (Nam));
Write_Eol;
end if;
end Indicate_Name_And_Type;
-- Start of processing for Analyze_One_Call
begin
Success := False;
-- If the subprogram has no formals, or if all the formals have
-- defaults, and the return type is an array type, the node may
-- denote an indexing of the result of a parameterless call.
if Needs_No_Actuals (Nam)
and then Present (Actuals)
then
if Is_Array_Type (Subp_Type) then
Is_Indexed := Try_Indexed_Call (N, Nam, Subp_Type);
elsif Is_Access_Type (Subp_Type)
and then Is_Array_Type (Designated_Type (Subp_Type))
then
Is_Indexed :=
Try_Indexed_Call (N, Nam, Designated_Type (Subp_Type));
-- The prefix can also be a parameterless function that returns an
-- access to subprogram. in which case this is an indirect call.
elsif Is_Access_Type (Subp_Type)
and then Ekind (Designated_Type (Subp_Type)) = E_Subprogram_Type
then
Is_Indexed := Try_Indirect_Call (N, Nam, Subp_Type);
end if;
end if;
Normalize_Actuals (N, Nam, (Report and not Is_Indexed), Norm_OK);
if not Norm_OK then
-- Mismatch in number or names of parameters
if Debug_Flag_E then
Write_Str (" normalization fails in call ");
Write_Int (Int (N));
Write_Str (" with subprogram ");
Write_Int (Int (Nam));
Write_Eol;
end if;
-- If the context expects a function call, discard any interpretation
-- that is a procedure. If the node is not overloaded, leave as is for
-- better error reporting when type mismatch is found.
elsif Nkind (N) = N_Function_Call
and then Is_Overloaded (Name (N))
and then Ekind (Nam) = E_Procedure
then
return;
-- Ditto for function calls in a procedure context
elsif Nkind (N) = N_Procedure_Call_Statement
and then Is_Overloaded (Name (N))
and then Etype (Nam) /= Standard_Void_Type
then
return;
elsif No (Actuals) then
-- If Normalize succeeds, then there are default parameters for
-- all formals.
Indicate_Name_And_Type;
elsif Ekind (Nam) = E_Operator then
if Nkind (N) = N_Procedure_Call_Statement then
return;
end if;
-- This can occur when the prefix of the call is an operator
-- name or an expanded name whose selector is an operator name.
Analyze_Operator_Call (N, Nam);
if Etype (N) /= Prev_T then
-- There may be a user-defined operator that hides the
-- current interpretation. We must check for this independently
-- of the analysis of the call with the user-defined operation,
-- because the parameter names may be wrong and yet the hiding
-- takes place. Fixes b34014o.
if Is_Overloaded (Name (N)) then
declare
I : Interp_Index;
It : Interp;
begin
Get_First_Interp (Name (N), I, It);
while Present (It.Nam) loop
if Ekind (It.Nam) /= E_Operator
and then Hides_Op (It.Nam, Nam)
and then
Has_Compatible_Type
(First_Actual (N), Etype (First_Formal (It.Nam)))
and then (No (Next_Actual (First_Actual (N)))
or else Has_Compatible_Type
(Next_Actual (First_Actual (N)),
Etype (Next_Formal (First_Formal (It.Nam)))))
then
Set_Etype (N, Prev_T);
return;
end if;
Get_Next_Interp (I, It);
end loop;
end;
end if;
-- If operator matches formals, record its name on the call.
-- If the operator is overloaded, Resolve will select the
-- correct one from the list of interpretations. The call
-- node itself carries the first candidate.
Set_Entity (Name (N), Nam);
Success := True;
elsif Report and then Etype (N) = Any_Type then
Error_Msg_N ("incompatible arguments for operator", N);
end if;
else
-- Normalize_Actuals has chained the named associations in the
-- correct order of the formals.
Actual := First_Actual (N);
Formal := First_Formal (Nam);
-- If we are analyzing a call rewritten from object notation,
-- skip first actual, which may be rewritten later as an
-- explicit dereference.
if Skip_First then
Next_Actual (Actual);
Next_Formal (Formal);
end if;
while Present (Actual) and then Present (Formal) loop
if Nkind (Parent (Actual)) /= N_Parameter_Association
or else Chars (Selector_Name (Parent (Actual))) = Chars (Formal)
then
if Has_Compatible_Type (Actual, Etype (Formal)) then
Next_Actual (Actual);
Next_Formal (Formal);
else
if Debug_Flag_E then
Write_Str (" type checking fails in call ");
Write_Int (Int (N));
Write_Str (" with formal ");
Write_Int (Int (Formal));
Write_Str (" in subprogram ");
Write_Int (Int (Nam));
Write_Eol;
end if;
if Report and not Is_Indexed then
-- Ada 2005 (AI-251): Complete the error notification
-- to help new Ada 2005 users
if Is_Class_Wide_Type (Etype (Formal))
and then Is_Interface (Etype (Etype (Formal)))
and then not Interface_Present_In_Ancestor
(Typ => Etype (Actual),
Iface => Etype (Etype (Formal)))
then
Error_Msg_NE
("(Ada 2005) does not implement interface }",
Actual, Etype (Etype (Formal)));
end if;
Wrong_Type (Actual, Etype (Formal));
if Nkind (Actual) = N_Op_Eq
and then Nkind (Left_Opnd (Actual)) = N_Identifier
then
Formal := First_Formal (Nam);
while Present (Formal) loop
if Chars (Left_Opnd (Actual)) = Chars (Formal) then
Error_Msg_N
("possible misspelling of `='>`!", Actual);
exit;
end if;
Next_Formal (Formal);
end loop;
end if;
if All_Errors_Mode then
Error_Msg_Sloc := Sloc (Nam);
if Is_Overloadable (Nam)
and then Present (Alias (Nam))
and then not Comes_From_Source (Nam)
then
Error_Msg_NE
(" =='> in call to &#(inherited)!", Actual, Nam);
elsif Ekind (Nam) = E_Subprogram_Type then
declare
Access_To_Subprogram_Typ :
constant Entity_Id :=
Defining_Identifier
(Associated_Node_For_Itype (Nam));
begin
Error_Msg_NE (
" =='> in call to dereference of &#!",
Actual, Access_To_Subprogram_Typ);
end;
else
Error_Msg_NE (" =='> in call to &#!", Actual, Nam);
end if;
end if;
end if;
return;
end if;
else
-- Normalize_Actuals has verified that a default value exists
-- for this formal. Current actual names a subsequent formal.
Next_Formal (Formal);
end if;
end loop;
-- On exit, all actuals match
Indicate_Name_And_Type;
end if;
end Analyze_One_Call;
---------------------------
-- Analyze_Operator_Call --
---------------------------
procedure Analyze_Operator_Call (N : Node_Id; Op_Id : Entity_Id) is
Op_Name : constant Name_Id := Chars (Op_Id);
Act1 : constant Node_Id := First_Actual (N);
Act2 : constant Node_Id := Next_Actual (Act1);
begin
-- Binary operator case
if Present (Act2) then
-- If more than two operands, then not binary operator after all
if Present (Next_Actual (Act2)) then
return;
elsif Op_Name = Name_Op_Add
or else Op_Name = Name_Op_Subtract
or else Op_Name = Name_Op_Multiply
or else Op_Name = Name_Op_Divide
or else Op_Name = Name_Op_Mod
or else Op_Name = Name_Op_Rem
or else Op_Name = Name_Op_Expon
then
Find_Arithmetic_Types (Act1, Act2, Op_Id, N);
elsif Op_Name = Name_Op_And
or else Op_Name = Name_Op_Or
or else Op_Name = Name_Op_Xor
then
Find_Boolean_Types (Act1, Act2, Op_Id, N);
elsif Op_Name = Name_Op_Lt
or else Op_Name = Name_Op_Le
or else Op_Name = Name_Op_Gt
or else Op_Name = Name_Op_Ge
then
Find_Comparison_Types (Act1, Act2, Op_Id, N);
elsif Op_Name = Name_Op_Eq
or else Op_Name = Name_Op_Ne
then
Find_Equality_Types (Act1, Act2, Op_Id, N);
elsif Op_Name = Name_Op_Concat then
Find_Concatenation_Types (Act1, Act2, Op_Id, N);
-- Is this else null correct, or should it be an abort???
else
null;
end if;
-- Unary operator case
else
if Op_Name = Name_Op_Subtract or else
Op_Name = Name_Op_Add or else
Op_Name = Name_Op_Abs
then
Find_Unary_Types (Act1, Op_Id, N);
elsif
Op_Name = Name_Op_Not
then
Find_Negation_Types (Act1, Op_Id, N);
-- Is this else null correct, or should it be an abort???
else
null;
end if;
end if;
end Analyze_Operator_Call;
-------------------------------------------
-- Analyze_Overloaded_Selected_Component --
-------------------------------------------
procedure Analyze_Overloaded_Selected_Component (N : Node_Id) is
Nam : constant Node_Id := Prefix (N);
Sel : constant Node_Id := Selector_Name (N);
Comp : Entity_Id;
I : Interp_Index;
It : Interp;
T : Entity_Id;
begin
Set_Etype (Sel, Any_Type);
Get_First_Interp (Nam, I, It);
while Present (It.Typ) loop
if Is_Access_Type (It.Typ) then
T := Designated_Type (It.Typ);
Error_Msg_NW (Warn_On_Dereference, "?implicit dereference", N);
else
T := It.Typ;
end if;
if Is_Record_Type (T) then
Comp := First_Entity (T);
while Present (Comp) loop
if Chars (Comp) = Chars (Sel)
and then Is_Visible_Component (Comp)
then
Set_Entity_With_Style_Check (Sel, Comp);
Generate_Reference (Comp, Sel);
Set_Etype (Sel, Etype (Comp));
Add_One_Interp (N, Etype (Comp), Etype (Comp));
-- This also specifies a candidate to resolve the name.
-- Further overloading will be resolved from context.
Set_Etype (Nam, It.Typ);
end if;
Next_Entity (Comp);
end loop;
elsif Is_Concurrent_Type (T) then
Comp := First_Entity (T);
while Present (Comp)
and then Comp /= First_Private_Entity (T)
loop
if Chars (Comp) = Chars (Sel) then
if Is_Overloadable (Comp) then
Add_One_Interp (Sel, Comp, Etype (Comp));
else
Set_Entity_With_Style_Check (Sel, Comp);
Generate_Reference (Comp, Sel);
end if;
Set_Etype (Sel, Etype (Comp));
Set_Etype (N, Etype (Comp));
Set_Etype (Nam, It.Typ);
-- For access type case, introduce explicit deference for
-- more uniform treatment of entry calls.
if Is_Access_Type (Etype (Nam)) then
Insert_Explicit_Dereference (Nam);
Error_Msg_NW
(Warn_On_Dereference, "?implicit dereference", N);
end if;
end if;
Next_Entity (Comp);
end loop;
Set_Is_Overloaded (N, Is_Overloaded (Sel));
end if;
Get_Next_Interp (I, It);
end loop;
if Etype (N) = Any_Type then
Error_Msg_NE ("undefined selector& for overloaded prefix", N, Sel);
Set_Entity (Sel, Any_Id);
Set_Etype (Sel, Any_Type);
end if;
end Analyze_Overloaded_Selected_Component;
----------------------------------
-- Analyze_Qualified_Expression --
----------------------------------
procedure Analyze_Qualified_Expression (N : Node_Id) is
Mark : constant Entity_Id := Subtype_Mark (N);
T : Entity_Id;
begin
Set_Etype (N, Any_Type);
Find_Type (Mark);
T := Entity (Mark);
if T = Any_Type then
return;
end if;
Check_Fully_Declared (T, N);
Analyze_Expression (Expression (N));
Set_Etype (N, T);
end Analyze_Qualified_Expression;
-------------------
-- Analyze_Range --
-------------------
procedure Analyze_Range (N : Node_Id) is
L : constant Node_Id := Low_Bound (N);
H : constant Node_Id := High_Bound (N);
I1, I2 : Interp_Index;
It1, It2 : Interp;
procedure Check_Common_Type (T1, T2 : Entity_Id);
-- Verify the compatibility of two types, and choose the
-- non universal one if the other is universal.
procedure Check_High_Bound (T : Entity_Id);
-- Test one interpretation of the low bound against all those
-- of the high bound.
procedure Check_Universal_Expression (N : Node_Id);
-- In Ada83, reject bounds of a universal range that are not
-- literals or entity names.
-----------------------
-- Check_Common_Type --
-----------------------
procedure Check_Common_Type (T1, T2 : Entity_Id) is
begin
if Covers (T1, T2) or else Covers (T2, T1) then
if T1 = Universal_Integer
or else T1 = Universal_Real
or else T1 = Any_Character
then
Add_One_Interp (N, Base_Type (T2), Base_Type (T2));
elsif T1 = T2 then
Add_One_Interp (N, T1, T1);
else
Add_One_Interp (N, Base_Type (T1), Base_Type (T1));
end if;
end if;
end Check_Common_Type;
----------------------
-- Check_High_Bound --
----------------------
procedure Check_High_Bound (T : Entity_Id) is
begin
if not Is_Overloaded (H) then
Check_Common_Type (T, Etype (H));
else
Get_First_Interp (H, I2, It2);
while Present (It2.Typ) loop
Check_Common_Type (T, It2.Typ);
Get_Next_Interp (I2, It2);
end loop;
end if;
end Check_High_Bound;
-----------------------------
-- Is_Universal_Expression --
-----------------------------
procedure Check_Universal_Expression (N : Node_Id) is
begin
if Etype (N) = Universal_Integer
and then Nkind (N) /= N_Integer_Literal
and then not Is_Entity_Name (N)
and then Nkind (N) /= N_Attribute_Reference
then
Error_Msg_N ("illegal bound in discrete range", N);
end if;
end Check_Universal_Expression;
-- Start of processing for Analyze_Range
begin
Set_Etype (N, Any_Type);
Analyze_Expression (L);
Analyze_Expression (H);
if Etype (L) = Any_Type or else Etype (H) = Any_Type then
return;
else
if not Is_Overloaded (L) then
Check_High_Bound (Etype (L));
else
Get_First_Interp (L, I1, It1);
while Present (It1.Typ) loop
Check_High_Bound (It1.Typ);
Get_Next_Interp (I1, It1);
end loop;
end if;
-- If result is Any_Type, then we did not find a compatible pair
if Etype (N) = Any_Type then
Error_Msg_N ("incompatible types in range ", N);
end if;
end if;
if Ada_Version = Ada_83
and then
(Nkind (Parent (N)) = N_Loop_Parameter_Specification
or else Nkind (Parent (N)) = N_Constrained_Array_Definition)
then
Check_Universal_Expression (L);
Check_Universal_Expression (H);
end if;
end Analyze_Range;
-----------------------
-- Analyze_Reference --
-----------------------
procedure Analyze_Reference (N : Node_Id) is
P : constant Node_Id := Prefix (N);
Acc_Type : Entity_Id;
begin
Analyze (P);
Acc_Type := Create_Itype (E_Allocator_Type, N);
Set_Etype (Acc_Type, Acc_Type);
Init_Size_Align (Acc_Type);
Set_Directly_Designated_Type (Acc_Type, Etype (P));
Set_Etype (N, Acc_Type);
end Analyze_Reference;
--------------------------------
-- Analyze_Selected_Component --
--------------------------------
-- Prefix is a record type or a task or protected type. In the
-- later case, the selector must denote a visible entry.
procedure Analyze_Selected_Component (N : Node_Id) is
Name : constant Node_Id := Prefix (N);
Sel : constant Node_Id := Selector_Name (N);
Comp : Entity_Id;
Entity_List : Entity_Id;
Prefix_Type : Entity_Id;
Pent : Entity_Id := Empty;
Act_Decl : Node_Id;
In_Scope : Boolean;
Parent_N : Node_Id;
-- Start of processing for Analyze_Selected_Component
begin
Set_Etype (N, Any_Type);
if Is_Overloaded (Name) then
Analyze_Overloaded_Selected_Component (N);
return;
elsif Etype (Name) = Any_Type then
Set_Entity (Sel, Any_Id);
Set_Etype (Sel, Any_Type);
return;
else
Prefix_Type := Etype (Name);
end if;
if Is_Access_Type (Prefix_Type) then
-- A RACW object can never be used as prefix of a selected
-- component since that means it is dereferenced without
-- being a controlling operand of a dispatching operation
-- (RM E.2.2(15)).
if Is_Remote_Access_To_Class_Wide_Type (Prefix_Type)
and then Comes_From_Source (N)
then
Error_Msg_N
("invalid dereference of a remote access to class-wide value",
N);
-- Normal case of selected component applied to access type
else
Error_Msg_NW (Warn_On_Dereference, "?implicit dereference", N);
if Is_Entity_Name (Name) then
Pent := Entity (Name);
elsif Nkind (Name) = N_Selected_Component
and then Is_Entity_Name (Selector_Name (Name))
then
Pent := Entity (Selector_Name (Name));
end if;
Process_Implicit_Dereference_Prefix (Pent, Name);
end if;
Prefix_Type := Designated_Type (Prefix_Type);
end if;
if Ekind (Prefix_Type) = E_Private_Subtype then
Prefix_Type := Base_Type (Prefix_Type);
end if;
Entity_List := Prefix_Type;
-- For class-wide types, use the entity list of the root type. This
-- indirection is specially important for private extensions because
-- only the root type get switched (not the class-wide type).
if Is_Class_Wide_Type (Prefix_Type) then
Entity_List := Root_Type (Prefix_Type);
end if;
Comp := First_Entity (Entity_List);
-- If the selector has an original discriminant, the node appears in
-- an instance. Replace the discriminant with the corresponding one
-- in the current discriminated type. For nested generics, this must
-- be done transitively, so note the new original discriminant.
if Nkind (Sel) = N_Identifier
and then Present (Original_Discriminant (Sel))
then
Comp := Find_Corresponding_Discriminant (Sel, Prefix_Type);
-- Mark entity before rewriting, for completeness and because
-- subsequent semantic checks might examine the original node.
Set_Entity (Sel, Comp);
Rewrite (Selector_Name (N),
New_Occurrence_Of (Comp, Sloc (N)));
Set_Original_Discriminant (Selector_Name (N), Comp);
Set_Etype (N, Etype (Comp));
if Is_Access_Type (Etype (Name)) then
Insert_Explicit_Dereference (Name);
Error_Msg_NW (Warn_On_Dereference, "?implicit dereference", N);
end if;
elsif Is_Record_Type (Prefix_Type) then
-- Find component with given name
while Present (Comp) loop
if Chars (Comp) = Chars (Sel)
and then Is_Visible_Component (Comp)
then
Set_Entity_With_Style_Check (Sel, Comp);
Generate_Reference (Comp, Sel);
Set_Etype (Sel, Etype (Comp));
if Ekind (Comp) = E_Discriminant then
if Is_Unchecked_Union (Base_Type (Prefix_Type)) then
Error_Msg_N
("cannot reference discriminant of Unchecked_Union",
Sel);
end if;
if Is_Generic_Type (Prefix_Type)
or else
Is_Generic_Type (Root_Type (Prefix_Type))
then
Set_Original_Discriminant (Sel, Comp);
end if;
end if;
-- Resolve the prefix early otherwise it is not possible to
-- build the actual subtype of the component: it may need
-- to duplicate this prefix and duplication is only allowed
-- on fully resolved expressions.
Resolve (Name);
-- Ada 2005 (AI-50217): Check wrong use of incomplete type.
-- Example:
-- limited with Pkg;
-- package Pkg is
-- type Acc_Inc is access Pkg.T;
-- X : Acc_Inc;
-- N : Natural := X.all.Comp; -- ERROR
-- end Pkg;
if Nkind (Name) = N_Explicit_Dereference
and then From_With_Type (Etype (Prefix (Name)))
and then not Is_Potentially_Use_Visible (Etype (Name))
then
Error_Msg_NE
("premature usage of incomplete}", Prefix (Name),
Etype (Prefix (Name)));
end if;
-- We never need an actual subtype for the case of a selection
-- for a indexed component of a non-packed array, since in
-- this case gigi generates all the checks and can find the
-- necessary bounds information.
-- We also do not need an actual subtype for the case of
-- a first, last, length, or range attribute applied to a
-- non-packed array, since gigi can again get the bounds in
-- these cases (gigi cannot handle the packed case, since it
-- has the bounds of the packed array type, not the original
-- bounds of the type). However, if the prefix is itself a
-- selected component, as in a.b.c (i), gigi may regard a.b.c
-- as a dynamic-sized temporary, so we do generate an actual
-- subtype for this case.
Parent_N := Parent (N);
if not Is_Packed (Etype (Comp))
and then
((Nkind (Parent_N) = N_Indexed_Component
and then Nkind (Name) /= N_Selected_Component)
or else
(Nkind (Parent_N) = N_Attribute_Reference
and then (Attribute_Name (Parent_N) = Name_First
or else
Attribute_Name (Parent_N) = Name_Last
or else
Attribute_Name (Parent_N) = Name_Length
or else
Attribute_Name (Parent_N) = Name_Range)))
then
Set_Etype (N, Etype (Comp));
-- If full analysis is not enabled, we do not generate an
-- actual subtype, because in the absence of expansion
-- reference to a formal of a protected type, for example,
-- will not be properly transformed, and will lead to
-- out-of-scope references in gigi.
-- In all other cases, we currently build an actual subtype.
-- It seems likely that many of these cases can be avoided,
-- but right now, the front end makes direct references to the
-- bounds (e.g. in generating a length check), and if we do
-- not make an actual subtype, we end up getting a direct
-- reference to a discriminant, which will not do.
elsif Full_Analysis then
Act_Decl :=
Build_Actual_Subtype_Of_Component (Etype (Comp), N);
Insert_Action (N, Act_Decl);
if No (Act_Decl) then
Set_Etype (N, Etype (Comp));
else
-- Component type depends on discriminants. Enter the
-- main attributes of the subtype.
declare
Subt : constant Entity_Id :=
Defining_Identifier (Act_Decl);
begin
Set_Etype (Subt, Base_Type (Etype (Comp)));
Set_Ekind (Subt, Ekind (Etype (Comp)));
Set_Etype (N, Subt);
end;
end if;
-- If Full_Analysis not enabled, just set the Etype
else
Set_Etype (N, Etype (Comp));
end if;
return;
end if;
Next_Entity (Comp);
end loop;
-- Ada 2005 (AI-252)
if Ada_Version >= Ada_05
and then Is_Tagged_Type (Prefix_Type)
and then Try_Object_Operation (N)
then
return;
-- If the transformation fails, it will be necessary to redo the
-- analysis with all errors enabled, to indicate candidate
-- interpretations and reasons for each failure ???
end if;
elsif Is_Private_Type (Prefix_Type) then
-- Allow access only to discriminants of the type. If the type has
-- no full view, gigi uses the parent type for the components, so we
-- do the same here.
if No (Full_View (Prefix_Type)) then
Entity_List := Root_Type (Base_Type (Prefix_Type));
Comp := First_Entity (Entity_List);
end if;
while Present (Comp) loop
if Chars (Comp) = Chars (Sel) then
if Ekind (Comp) = E_Discriminant then
Set_Entity_With_Style_Check (Sel, Comp);
Generate_Reference (Comp, Sel);
Set_Etype (Sel, Etype (Comp));
Set_Etype (N, Etype (Comp));
if Is_Generic_Type (Prefix_Type)
or else
Is_Generic_Type (Root_Type (Prefix_Type))
then
Set_Original_Discriminant (Sel, Comp);
end if;
else
Error_Msg_NE
("invisible selector for }",
N, First_Subtype (Prefix_Type));
Set_Entity (Sel, Any_Id);
Set_Etype (N, Any_Type);
end if;
return;
end if;
Next_Entity (Comp);
end loop;
elsif Is_Concurrent_Type (Prefix_Type) then
-- Prefix is concurrent type. Find visible operation with given name
-- For a task, this can only include entries or discriminants if the
-- task type is not an enclosing scope. If it is an enclosing scope
-- (e.g. in an inner task) then all entities are visible, but the
-- prefix must denote the enclosing scope, i.e. can only be a direct
-- name or an expanded name.
Set_Etype (Sel, Any_Type);
In_Scope := In_Open_Scopes (Prefix_Type);
while Present (Comp) loop
if Chars (Comp) = Chars (Sel) then
if Is_Overloadable (Comp) then
Add_One_Interp (Sel, Comp, Etype (Comp));
elsif Ekind (Comp) = E_Discriminant
or else Ekind (Comp) = E_Entry_Family
or else (In_Scope
and then Is_Entity_Name (Name))
then
Set_Entity_With_Style_Check (Sel, Comp);
Generate_Reference (Comp, Sel);
else
goto Next_Comp;
end if;
Set_Etype (Sel, Etype (Comp));
Set_Etype (N, Etype (Comp));
if Ekind (Comp) = E_Discriminant then
Set_Original_Discriminant (Sel, Comp);
end if;
-- For access type case, introduce explicit deference for more
-- uniform treatment of entry calls.
if Is_Access_Type (Etype (Name)) then
Insert_Explicit_Dereference (Name);
Error_Msg_NW
(Warn_On_Dereference, "?implicit dereference", N);
end if;
end if;
<<Next_Comp>>
Next_Entity (Comp);
exit when not In_Scope
and then
Comp = First_Private_Entity (Base_Type (Prefix_Type));
end loop;
Set_Is_Overloaded (N, Is_Overloaded (Sel));
else
-- Invalid prefix
Error_Msg_NE ("invalid prefix in selected component&", N, Sel);
end if;
-- If N still has no type, the component is not defined in the prefix
if Etype (N) = Any_Type then
-- If the prefix is a single concurrent object, use its name in the
-- error message, rather than that of its anonymous type.
if Is_Concurrent_Type (Prefix_Type)
and then Is_Internal_Name (Chars (Prefix_Type))
and then not Is_Derived_Type (Prefix_Type)
and then Is_Entity_Name (Name)
then
Error_Msg_Node_2 := Entity (Name);
Error_Msg_NE ("no selector& for&", N, Sel);
Check_Misspelled_Selector (Entity_List, Sel);
elsif Is_Generic_Type (Prefix_Type)
and then Ekind (Prefix_Type) = E_Record_Type_With_Private
and then Prefix_Type /= Etype (Prefix_Type)
and then Is_Record_Type (Etype (Prefix_Type))
then
-- If this is a derived formal type, the parent may have
-- different visibility at this point. Try for an inherited
-- component before reporting an error.
Set_Etype (Prefix (N), Etype (Prefix_Type));
Analyze_Selected_Component (N);
return;
elsif Ekind (Prefix_Type) = E_Record_Subtype_With_Private
and then Is_Generic_Actual_Type (Prefix_Type)
and then Present (Full_View (Prefix_Type))
then
-- Similarly, if this the actual for a formal derived type, the
-- component inherited from the generic parent may not be visible
-- in the actual, but the selected component is legal.
declare
Comp : Entity_Id;
begin
Comp :=
First_Component (Generic_Parent_Type (Parent (Prefix_Type)));
while Present (Comp) loop
if Chars (Comp) = Chars (Sel) then
Set_Entity_With_Style_Check (Sel, Comp);
Set_Etype (Sel, Etype (Comp));
Set_Etype (N, Etype (Comp));
return;
end if;
Next_Component (Comp);
end loop;
pragma Assert (Etype (N) /= Any_Type);
end;
else
if Ekind (Prefix_Type) = E_Record_Subtype then
-- Check whether this is a component of the base type
-- which is absent from a statically constrained subtype.
-- This will raise constraint error at run-time, but is
-- not a compile-time error. When the selector is illegal
-- for base type as well fall through and generate a
-- compilation error anyway.
Comp := First_Component (Base_Type (Prefix_Type));
while Present (Comp) loop
if Chars (Comp) = Chars (Sel)
and then Is_Visible_Component (Comp)
then
Set_Entity_With_Style_Check (Sel, Comp);
Generate_Reference (Comp, Sel);
Set_Etype (Sel, Etype (Comp));
Set_Etype (N, Etype (Comp));
-- Emit appropriate message. Gigi will replace the
-- node subsequently with the appropriate Raise.
Apply_Compile_Time_Constraint_Error
(N, "component not present in }?",
CE_Discriminant_Check_Failed,
Ent => Prefix_Type, Rep => False);
Set_Raises_Constraint_Error (N);
return;
end if;
Next_Component (Comp);
end loop;
end if;
Error_Msg_Node_2 := First_Subtype (Prefix_Type);
Error_Msg_NE ("no selector& for}", N, Sel);
Check_Misspelled_Selector (Entity_List, Sel);
end if;
Set_Entity (Sel, Any_Id);
Set_Etype (Sel, Any_Type);
end if;
end Analyze_Selected_Component;
---------------------------
-- Analyze_Short_Circuit --
---------------------------
procedure Analyze_Short_Circuit (N : Node_Id) is
L : constant Node_Id := Left_Opnd (N);
R : constant Node_Id := Right_Opnd (N);
Ind : Interp_Index;
It : Interp;
begin
Analyze_Expression (L);
Analyze_Expression (R);
Set_Etype (N, Any_Type);
if not Is_Overloaded (L) then
if Root_Type (Etype (L)) = Standard_Boolean
and then Has_Compatible_Type (R, Etype (L))
then
Add_One_Interp (N, Etype (L), Etype (L));
end if;
else
Get_First_Interp (L, Ind, It);
while Present (It.Typ) loop
if Root_Type (It.Typ) = Standard_Boolean
and then Has_Compatible_Type (R, It.Typ)
then
Add_One_Interp (N, It.Typ, It.Typ);
end if;
Get_Next_Interp (Ind, It);
end loop;
end if;
-- Here we have failed to find an interpretation. Clearly we
-- know that it is not the case that both operands can have
-- an interpretation of Boolean, but this is by far the most
-- likely intended interpretation. So we simply resolve both
-- operands as Booleans, and at least one of these resolutions
-- will generate an error message, and we do not need to give
-- a further error message on the short circuit operation itself.
if Etype (N) = Any_Type then
Resolve (L, Standard_Boolean);
Resolve (R, Standard_Boolean);
Set_Etype (N, Standard_Boolean);
end if;
end Analyze_Short_Circuit;
-------------------
-- Analyze_Slice --
-------------------
procedure Analyze_Slice (N : Node_Id) is
P : constant Node_Id := Prefix (N);
D : constant Node_Id := Discrete_Range (N);
Array_Type : Entity_Id;
procedure Analyze_Overloaded_Slice;
-- If the prefix is overloaded, select those interpretations that
-- yield a one-dimensional array type.
------------------------------
-- Analyze_Overloaded_Slice --
------------------------------
procedure Analyze_Overloaded_Slice is
I : Interp_Index;
It : Interp;
Typ : Entity_Id;
begin
Set_Etype (N, Any_Type);
Get_First_Interp (P, I, It);
while Present (It.Nam) loop
Typ := It.Typ;
if Is_Access_Type (Typ) then
Typ := Designated_Type (Typ);
Error_Msg_NW (Warn_On_Dereference, "?implicit dereference", N);
end if;
if Is_Array_Type (Typ)
and then Number_Dimensions (Typ) = 1
and then Has_Compatible_Type (D, Etype (First_Index (Typ)))
then
Add_One_Interp (N, Typ, Typ);
end if;
Get_Next_Interp (I, It);
end loop;
if Etype (N) = Any_Type then
Error_Msg_N ("expect array type in prefix of slice", N);
end if;
end Analyze_Overloaded_Slice;
-- Start of processing for Analyze_Slice
begin
Analyze (P);
Analyze (D);
if Is_Overloaded (P) then
Analyze_Overloaded_Slice;
else
Array_Type := Etype (P);
Set_Etype (N, Any_Type);
if Is_Access_Type (Array_Type) then
Array_Type := Designated_Type (Array_Type);
Error_Msg_NW (Warn_On_Dereference, "?implicit dereference", N);
end if;
if not Is_Array_Type (Array_Type) then
Wrong_Type (P, Any_Array);
elsif Number_Dimensions (Array_Type) > 1 then
Error_Msg_N
("type is not one-dimensional array in slice prefix", N);
elsif not
Has_Compatible_Type (D, Etype (First_Index (Array_Type)))
then
Wrong_Type (D, Etype (First_Index (Array_Type)));
else
Set_Etype (N, Array_Type);
end if;
end if;
end Analyze_Slice;
-----------------------------
-- Analyze_Type_Conversion --
-----------------------------
procedure Analyze_Type_Conversion (N : Node_Id) is
Expr : constant Node_Id := Expression (N);
T : Entity_Id;
begin
-- If Conversion_OK is set, then the Etype is already set, and the
-- only processing required is to analyze the expression. This is
-- used to construct certain "illegal" conversions which are not
-- allowed by Ada semantics, but can be handled OK by Gigi, see
-- Sinfo for further details.
if Conversion_OK (N) then
Analyze (Expr);
return;
end if;
-- Otherwise full type analysis is required, as well as some semantic
-- checks to make sure the argument of the conversion is appropriate.
Find_Type (Subtype_Mark (N));
T := Entity (Subtype_Mark (N));
Set_Etype (N, T);
Check_Fully_Declared (T, N);
Analyze_Expression (Expr);
Validate_Remote_Type_Type_Conversion (N);
-- Only remaining step is validity checks on the argument. These
-- are skipped if the conversion does not come from the source.
if not Comes_From_Source (N) then
return;
elsif Nkind (Expr) = N_Null then
Error_Msg_N ("argument of conversion cannot be null", N);
Error_Msg_N ("\use qualified expression instead", N);
Set_Etype (N, Any_Type);
elsif Nkind (Expr) = N_Aggregate then
Error_Msg_N ("argument of conversion cannot be aggregate", N);
Error_Msg_N ("\use qualified expression instead", N);
elsif Nkind (Expr) = N_Allocator then
Error_Msg_N ("argument of conversion cannot be an allocator", N);
Error_Msg_N ("\use qualified expression instead", N);
elsif Nkind (Expr) = N_String_Literal then
Error_Msg_N ("argument of conversion cannot be string literal", N);
Error_Msg_N ("\use qualified expression instead", N);
elsif Nkind (Expr) = N_Character_Literal then
if Ada_Version = Ada_83 then
Resolve (Expr, T);
else
Error_Msg_N ("argument of conversion cannot be character literal",
N);
Error_Msg_N ("\use qualified expression instead", N);
end if;
elsif Nkind (Expr) = N_Attribute_Reference
and then
(Attribute_Name (Expr) = Name_Access or else
Attribute_Name (Expr) = Name_Unchecked_Access or else
Attribute_Name (Expr) = Name_Unrestricted_Access)
then
Error_Msg_N ("argument of conversion cannot be access", N);
Error_Msg_N ("\use qualified expression instead", N);
end if;
end Analyze_Type_Conversion;
----------------------
-- Analyze_Unary_Op --
----------------------
procedure Analyze_Unary_Op (N : Node_Id) is
R : constant Node_Id := Right_Opnd (N);
Op_Id : Entity_Id := Entity (N);
begin
Set_Etype (N, Any_Type);
Candidate_Type := Empty;
Analyze_Expression (R);
if Present (Op_Id) then
if Ekind (Op_Id) = E_Operator then
Find_Unary_Types (R, Op_Id, N);
else
Add_One_Interp (N, Op_Id, Etype (Op_Id));
end if;
else
Op_Id := Get_Name_Entity_Id (Chars (N));
while Present (Op_Id) loop
if Ekind (Op_Id) = E_Operator then
if No (Next_Entity (First_Entity (Op_Id))) then
Find_Unary_Types (R, Op_Id, N);
end if;
elsif Is_Overloadable (Op_Id) then
Analyze_User_Defined_Unary_Op (N, Op_Id);
end if;
Op_Id := Homonym (Op_Id);
end loop;
end if;
Operator_Check (N);
end Analyze_Unary_Op;
----------------------------------
-- Analyze_Unchecked_Expression --
----------------------------------
procedure Analyze_Unchecked_Expression (N : Node_Id) is
begin
Analyze (Expression (N), Suppress => All_Checks);
Set_Etype (N, Etype (Expression (N)));
Save_Interps (Expression (N), N);
end Analyze_Unchecked_Expression;
---------------------------------------
-- Analyze_Unchecked_Type_Conversion --
---------------------------------------
procedure Analyze_Unchecked_Type_Conversion (N : Node_Id) is
begin
Find_Type (Subtype_Mark (N));
Analyze_Expression (Expression (N));
Set_Etype (N, Entity (Subtype_Mark (N)));
end Analyze_Unchecked_Type_Conversion;
------------------------------------
-- Analyze_User_Defined_Binary_Op --
------------------------------------
procedure Analyze_User_Defined_Binary_Op
(N : Node_Id;
Op_Id : Entity_Id)
is
begin
-- Only do analysis if the operator Comes_From_Source, since otherwise
-- the operator was generated by the expander, and all such operators
-- always refer to the operators in package Standard.
if Comes_From_Source (N) then
declare
F1 : constant Entity_Id := First_Formal (Op_Id);
F2 : constant Entity_Id := Next_Formal (F1);
begin
-- Verify that Op_Id is a visible binary function. Note that since
-- we know Op_Id is overloaded, potentially use visible means use
-- visible for sure (RM 9.4(11)).
if Ekind (Op_Id) = E_Function
and then Present (F2)
and then (Is_Immediately_Visible (Op_Id)
or else Is_Potentially_Use_Visible (Op_Id))
and then Has_Compatible_Type (Left_Opnd (N), Etype (F1))
and then Has_Compatible_Type (Right_Opnd (N), Etype (F2))
then
Add_One_Interp (N, Op_Id, Etype (Op_Id));
if Debug_Flag_E then
Write_Str ("user defined operator ");
Write_Name (Chars (Op_Id));
Write_Str (" on node ");
Write_Int (Int (N));
Write_Eol;
end if;
end if;
end;
end if;
end Analyze_User_Defined_Binary_Op;
-----------------------------------
-- Analyze_User_Defined_Unary_Op --
-----------------------------------
procedure Analyze_User_Defined_Unary_Op
(N : Node_Id;
Op_Id : Entity_Id)
is
begin
-- Only do analysis if the operator Comes_From_Source, since otherwise
-- the operator was generated by the expander, and all such operators
-- always refer to the operators in package Standard.
if Comes_From_Source (N) then
declare
F : constant Entity_Id := First_Formal (Op_Id);
begin
-- Verify that Op_Id is a visible unary function. Note that since
-- we know Op_Id is overloaded, potentially use visible means use
-- visible for sure (RM 9.4(11)).
if Ekind (Op_Id) = E_Function
and then No (Next_Formal (F))
and then (Is_Immediately_Visible (Op_Id)
or else Is_Potentially_Use_Visible (Op_Id))
and then Has_Compatible_Type (Right_Opnd (N), Etype (F))
then
Add_One_Interp (N, Op_Id, Etype (Op_Id));
end if;
end;
end if;
end Analyze_User_Defined_Unary_Op;
---------------------------
-- Check_Arithmetic_Pair --
---------------------------
procedure Check_Arithmetic_Pair
(T1, T2 : Entity_Id;
Op_Id : Entity_Id;
N : Node_Id)
is
Op_Name : constant Name_Id := Chars (Op_Id);
function Has_Fixed_Op (Typ : Entity_Id; Op : Entity_Id) return Boolean;
-- Check whether the fixed-point type Typ has a user-defined operator
-- (multiplication or division) that should hide the corresponding
-- predefined operator. Used to implement Ada 2005 AI-264, to make
-- such operators more visible and therefore useful.
function Specific_Type (T1, T2 : Entity_Id) return Entity_Id;
-- Get specific type (i.e. non-universal type if there is one)
------------------
-- Has_Fixed_Op --
------------------
function Has_Fixed_Op (Typ : Entity_Id; Op : Entity_Id) return Boolean is
Ent : Entity_Id;
F1 : Entity_Id;
F2 : Entity_Id;
begin
-- The operation is treated as primitive if it is declared in the
-- same scope as the type, and therefore on the same entity chain.
Ent := Next_Entity (Typ);
while Present (Ent) loop
if Chars (Ent) = Chars (Op) then
F1 := First_Formal (Ent);
F2 := Next_Formal (F1);
-- The operation counts as primitive if either operand or
-- result are of the given type, and both operands are fixed
-- point types.
if (Etype (F1) = Typ
and then Is_Fixed_Point_Type (Etype (F2)))
or else
(Etype (F2) = Typ
and then Is_Fixed_Point_Type (Etype (F1)))
or else
(Etype (Ent) = Typ
and then Is_Fixed_Point_Type (Etype (F1))
and then Is_Fixed_Point_Type (Etype (F2)))
then
return True;
end if;
end if;
Next_Entity (Ent);
end loop;
return False;
end Has_Fixed_Op;
-------------------
-- Specific_Type --
-------------------
function Specific_Type (T1, T2 : Entity_Id) return Entity_Id is
begin
if T1 = Universal_Integer or else T1 = Universal_Real then
return Base_Type (T2);
else
return Base_Type (T1);
end if;
end Specific_Type;
-- Start of processing for Check_Arithmetic_Pair
begin
if Op_Name = Name_Op_Add or else Op_Name = Name_Op_Subtract then
if Is_Numeric_Type (T1)
and then Is_Numeric_Type (T2)
and then (Covers (T1, T2) or else Covers (T2, T1))
then
Add_One_Interp (N, Op_Id, Specific_Type (T1, T2));
end if;
elsif Op_Name = Name_Op_Multiply or else Op_Name = Name_Op_Divide then
if Is_Fixed_Point_Type (T1)
and then (Is_Fixed_Point_Type (T2)
or else T2 = Universal_Real)
then
-- If Treat_Fixed_As_Integer is set then the Etype is already set
-- and no further processing is required (this is the case of an
-- operator constructed by Exp_Fixd for a fixed point operation)
-- Otherwise add one interpretation with universal fixed result
-- If the operator is given in functional notation, it comes
-- from source and Fixed_As_Integer cannot apply.
if (Nkind (N) not in N_Op
or else not Treat_Fixed_As_Integer (N))
and then
(not (Ada_Version >= Ada_05 and then Has_Fixed_Op (T1, Op_Id))
or else Nkind (Parent (N)) = N_Type_Conversion)
then
Add_One_Interp (N, Op_Id, Universal_Fixed);
end if;
elsif Is_Fixed_Point_Type (T2)
and then (Nkind (N) not in N_Op
or else not Treat_Fixed_As_Integer (N))
and then T1 = Universal_Real
and then
(not (Ada_Version >= Ada_05 and then Has_Fixed_Op (T1, Op_Id))
or else Nkind (Parent (N)) = N_Type_Conversion)
then
Add_One_Interp (N, Op_Id, Universal_Fixed);
elsif Is_Numeric_Type (T1)
and then Is_Numeric_Type (T2)
and then (Covers (T1, T2) or else Covers (T2, T1))
then
Add_One_Interp (N, Op_Id, Specific_Type (T1, T2));
elsif Is_Fixed_Point_Type (T1)
and then (Base_Type (T2) = Base_Type (Standard_Integer)
or else T2 = Universal_Integer)
then
Add_One_Interp (N, Op_Id, T1);
elsif T2 = Universal_Real
and then Base_Type (T1) = Base_Type (Standard_Integer)
and then Op_Name = Name_Op_Multiply
then
Add_One_Interp (N, Op_Id, Any_Fixed);
elsif T1 = Universal_Real
and then Base_Type (T2) = Base_Type (Standard_Integer)
then
Add_One_Interp (N, Op_Id, Any_Fixed);
elsif Is_Fixed_Point_Type (T2)
and then (Base_Type (T1) = Base_Type (Standard_Integer)
or else T1 = Universal_Integer)
and then Op_Name = Name_Op_Multiply
then
Add_One_Interp (N, Op_Id, T2);
elsif T1 = Universal_Real and then T2 = Universal_Integer then
Add_One_Interp (N, Op_Id, T1);
elsif T2 = Universal_Real
and then T1 = Universal_Integer
and then Op_Name = Name_Op_Multiply
then
Add_One_Interp (N, Op_Id, T2);
end if;
elsif Op_Name = Name_Op_Mod or else Op_Name = Name_Op_Rem then
-- Note: The fixed-point operands case with Treat_Fixed_As_Integer
-- set does not require any special processing, since the Etype is
-- already set (case of operation constructed by Exp_Fixed).
if Is_Integer_Type (T1)
and then (Covers (T1, T2) or else Covers (T2, T1))
then
Add_One_Interp (N, Op_Id, Specific_Type (T1, T2));
end if;
elsif Op_Name = Name_Op_Expon then
if Is_Numeric_Type (T1)
and then not Is_Fixed_Point_Type (T1)
and then (Base_Type (T2) = Base_Type (Standard_Integer)
or else T2 = Universal_Integer)
then
Add_One_Interp (N, Op_Id, Base_Type (T1));
end if;
else pragma Assert (Nkind (N) in N_Op_Shift);
-- If not one of the predefined operators, the node may be one
-- of the intrinsic functions. Its kind is always specific, and
-- we can use it directly, rather than the name of the operation.
if Is_Integer_Type (T1)
and then (Base_Type (T2) = Base_Type (Standard_Integer)
or else T2 = Universal_Integer)
then
Add_One_Interp (N, Op_Id, Base_Type (T1));
end if;
end if;
end Check_Arithmetic_Pair;
-------------------------------
-- Check_Misspelled_Selector --
-------------------------------
procedure Check_Misspelled_Selector
(Prefix : Entity_Id;
Sel : Node_Id)
is
Max_Suggestions : constant := 2;
Nr_Of_Suggestions : Natural := 0;
Suggestion_1 : Entity_Id := Empty;
Suggestion_2 : Entity_Id := Empty;
Comp : Entity_Id;
begin
-- All the components of the prefix of selector Sel are matched
-- against Sel and a count is maintained of possible misspellings.
-- When at the end of the analysis there are one or two (not more!)
-- possible misspellings, these misspellings will be suggested as
-- possible correction.
if not (Is_Private_Type (Prefix) or else Is_Record_Type (Prefix)) then
-- Concurrent types should be handled as well ???
return;
end if;
Get_Name_String (Chars (Sel));
declare
S : constant String (1 .. Name_Len) := Name_Buffer (1 .. Name_Len);
begin
Comp := First_Entity (Prefix);
while Nr_Of_Suggestions <= Max_Suggestions
and then Present (Comp)
loop
if Is_Visible_Component (Comp) then
Get_Name_String (Chars (Comp));
if Is_Bad_Spelling_Of (Name_Buffer (1 .. Name_Len), S) then
Nr_Of_Suggestions := Nr_Of_Suggestions + 1;
case Nr_Of_Suggestions is
when 1 => Suggestion_1 := Comp;
when 2 => Suggestion_2 := Comp;
when others => exit;
end case;
end if;
end if;
Comp := Next_Entity (Comp);
end loop;
-- Report at most two suggestions
if Nr_Of_Suggestions = 1 then
Error_Msg_NE ("\possible misspelling of&", Sel, Suggestion_1);
elsif Nr_Of_Suggestions = 2 then
Error_Msg_Node_2 := Suggestion_2;
Error_Msg_NE ("\possible misspelling of& or&",
Sel, Suggestion_1);
end if;
end;
end Check_Misspelled_Selector;
----------------------
-- Defined_In_Scope --
----------------------
function Defined_In_Scope (T : Entity_Id; S : Entity_Id) return Boolean
is
S1 : constant Entity_Id := Scope (Base_Type (T));
begin
return S1 = S
or else (S1 = System_Aux_Id and then S = Scope (S1));
end Defined_In_Scope;
-------------------
-- Diagnose_Call --
-------------------
procedure Diagnose_Call (N : Node_Id; Nam : Node_Id) is
Actual : Node_Id;
X : Interp_Index;
It : Interp;
Success : Boolean;
Err_Mode : Boolean;
New_Nam : Node_Id;
Void_Interp_Seen : Boolean := False;
begin
if Ada_Version >= Ada_05 then
Actual := First_Actual (N);
while Present (Actual) loop
-- Ada 2005 (AI-50217): Post an error in case of premature
-- usage of an entity from the limited view.
if not Analyzed (Etype (Actual))
and then From_With_Type (Etype (Actual))
then
Error_Msg_Qual_Level := 1;
Error_Msg_NE
("missing with_clause for scope of imported type&",
Actual, Etype (Actual));
Error_Msg_Qual_Level := 0;
end if;
Next_Actual (Actual);
end loop;
end if;
-- Analyze each candidate call again, with full error reporting
-- for each.
Error_Msg_N
("no candidate interpretations match the actuals:!", Nam);
Err_Mode := All_Errors_Mode;
All_Errors_Mode := True;
-- If this is a call to an operation of a concurrent type,
-- the failed interpretations have been removed from the
-- name. Recover them to provide full diagnostics.
if Nkind (Parent (Nam)) = N_Selected_Component then
Set_Entity (Nam, Empty);
New_Nam := New_Copy_Tree (Parent (Nam));
Set_Is_Overloaded (New_Nam, False);
Set_Is_Overloaded (Selector_Name (New_Nam), False);
Set_Parent (New_Nam, Parent (Parent (Nam)));
Analyze_Selected_Component (New_Nam);
Get_First_Interp (Selector_Name (New_Nam), X, It);
else
Get_First_Interp (Nam, X, It);
end if;
while Present (It.Nam) loop
if Etype (It.Nam) = Standard_Void_Type then
Void_Interp_Seen := True;
end if;
Analyze_One_Call (N, It.Nam, True, Success);
Get_Next_Interp (X, It);
end loop;
if Nkind (N) = N_Function_Call then
Get_First_Interp (Nam, X, It);
while Present (It.Nam) loop
if Ekind (It.Nam) = E_Function
or else Ekind (It.Nam) = E_Operator
then
return;
else
Get_Next_Interp (X, It);
end if;
end loop;
-- If all interpretations are procedures, this deserves a
-- more precise message. Ditto if this appears as the prefix
-- of a selected component, which may be a lexical error.
Error_Msg_N
("\context requires function call, found procedure name", Nam);
if Nkind (Parent (N)) = N_Selected_Component
and then N = Prefix (Parent (N))
then
Error_Msg_N (
"\period should probably be semicolon", Parent (N));
end if;
elsif Nkind (N) = N_Procedure_Call_Statement
and then not Void_Interp_Seen
then
Error_Msg_N (
"\function name found in procedure call", Nam);
end if;
All_Errors_Mode := Err_Mode;
end Diagnose_Call;
---------------------------
-- Find_Arithmetic_Types --
---------------------------
procedure Find_Arithmetic_Types
(L, R : Node_Id;
Op_Id : Entity_Id;
N : Node_Id)
is
Index1 : Interp_Index;
Index2 : Interp_Index;
It1 : Interp;
It2 : Interp;
procedure Check_Right_Argument (T : Entity_Id);
-- Check right operand of operator
--------------------------
-- Check_Right_Argument --
--------------------------
procedure Check_Right_Argument (T : Entity_Id) is
begin
if not Is_Overloaded (R) then
Check_Arithmetic_Pair (T, Etype (R), Op_Id, N);
else
Get_First_Interp (R, Index2, It2);
while Present (It2.Typ) loop
Check_Arithmetic_Pair (T, It2.Typ, Op_Id, N);
Get_Next_Interp (Index2, It2);
end loop;
end if;
end Check_Right_Argument;
-- Start processing for Find_Arithmetic_Types
begin
if not Is_Overloaded (L) then
Check_Right_Argument (Etype (L));
else
Get_First_Interp (L, Index1, It1);
while Present (It1.Typ) loop
Check_Right_Argument (It1.Typ);
Get_Next_Interp (Index1, It1);
end loop;
end if;
end Find_Arithmetic_Types;
------------------------
-- Find_Boolean_Types --
------------------------
procedure Find_Boolean_Types
(L, R : Node_Id;
Op_Id : Entity_Id;
N : Node_Id)
is
Index : Interp_Index;
It : Interp;
procedure Check_Numeric_Argument (T : Entity_Id);
-- Special case for logical operations one of whose operands is an
-- integer literal. If both are literal the result is any modular type.
----------------------------
-- Check_Numeric_Argument --
----------------------------
procedure Check_Numeric_Argument (T : Entity_Id) is
begin
if T = Universal_Integer then
Add_One_Interp (N, Op_Id, Any_Modular);
elsif Is_Modular_Integer_Type (T) then
Add_One_Interp (N, Op_Id, T);
end if;
end Check_Numeric_Argument;
-- Start of processing for Find_Boolean_Types
begin
if not Is_Overloaded (L) then
if Etype (L) = Universal_Integer
or else Etype (L) = Any_Modular
then
if not Is_Overloaded (R) then
Check_Numeric_Argument (Etype (R));
else
Get_First_Interp (R, Index, It);
while Present (It.Typ) loop
Check_Numeric_Argument (It.Typ);
Get_Next_Interp (Index, It);
end loop;
end if;
-- If operands are aggregates, we must assume that they may be
-- boolean arrays, and leave disambiguation for the second pass.
-- If only one is an aggregate, verify that the other one has an
-- interpretation as a boolean array
elsif Nkind (L) = N_Aggregate then
if Nkind (R) = N_Aggregate then
Add_One_Interp (N, Op_Id, Etype (L));
elsif not Is_Overloaded (R) then
if Valid_Boolean_Arg (Etype (R)) then
Add_One_Interp (N, Op_Id, Etype (R));
end if;
else
Get_First_Interp (R, Index, It);
while Present (It.Typ) loop
if Valid_Boolean_Arg (It.Typ) then
Add_One_Interp (N, Op_Id, It.Typ);
end if;
Get_Next_Interp (Index, It);
end loop;
end if;
elsif Valid_Boolean_Arg (Etype (L))
and then Has_Compatible_Type (R, Etype (L))
then
Add_One_Interp (N, Op_Id, Etype (L));
end if;
else
Get_First_Interp (L, Index, It);
while Present (It.Typ) loop
if Valid_Boolean_Arg (It.Typ)
and then Has_Compatible_Type (R, It.Typ)
then
Add_One_Interp (N, Op_Id, It.Typ);
end if;
Get_Next_Interp (Index, It);
end loop;
end if;
end Find_Boolean_Types;
---------------------------
-- Find_Comparison_Types --
---------------------------
procedure Find_Comparison_Types
(L, R : Node_Id;
Op_Id : Entity_Id;
N : Node_Id)
is
Index : Interp_Index;
It : Interp;
Found : Boolean := False;
I_F : Interp_Index;
T_F : Entity_Id;
Scop : Entity_Id := Empty;
procedure Try_One_Interp (T1 : Entity_Id);
-- Routine to try one proposed interpretation. Note that the context
-- of the operator plays no role in resolving the arguments, so that
-- if there is more than one interpretation of the operands that is
-- compatible with comparison, the operation is ambiguous.
--------------------
-- Try_One_Interp --
--------------------
procedure Try_One_Interp (T1 : Entity_Id) is
begin
-- If the operator is an expanded name, then the type of the operand
-- must be defined in the corresponding scope. If the type is
-- universal, the context will impose the correct type.
if Present (Scop)
and then not Defined_In_Scope (T1, Scop)
and then T1 /= Universal_Integer
and then T1 /= Universal_Real
and then T1 /= Any_String
and then T1 /= Any_Composite
then
return;
end if;
if Valid_Comparison_Arg (T1)
and then Has_Compatible_Type (R, T1)
then
if Found
and then Base_Type (T1) /= Base_Type (T_F)
then
It := Disambiguate (L, I_F, Index, Any_Type);
if It = No_Interp then
Ambiguous_Operands (N);
Set_Etype (L, Any_Type);
return;
else
T_F := It.Typ;
end if;
else
Found := True;
T_F := T1;
I_F := Index;
end if;
Set_Etype (L, T_F);
Find_Non_Universal_Interpretations (N, R, Op_Id, T1);
end if;
end Try_One_Interp;
-- Start processing for Find_Comparison_Types
begin
-- If left operand is aggregate, the right operand has to
-- provide a usable type for it.
if Nkind (L) = N_Aggregate
and then Nkind (R) /= N_Aggregate
then
Find_Comparison_Types (R, L, Op_Id, N);
return;
end if;
if Nkind (N) = N_Function_Call
and then Nkind (Name (N)) = N_Expanded_Name
then
Scop := Entity (Prefix (Name (N)));
-- The prefix may be a package renaming, and the subsequent test
-- requires the original package.
if Ekind (Scop) = E_Package
and then Present (Renamed_Entity (Scop))
then
Scop := Renamed_Entity (Scop);
Set_Entity (Prefix (Name (N)), Scop);
end if;
end if;
if not Is_Overloaded (L) then
Try_One_Interp (Etype (L));
else
Get_First_Interp (L, Index, It);
while Present (It.Typ) loop
Try_One_Interp (It.Typ);
Get_Next_Interp (Index, It);
end loop;
end if;
end Find_Comparison_Types;
----------------------------------------
-- Find_Non_Universal_Interpretations --
----------------------------------------
procedure Find_Non_Universal_Interpretations
(N : Node_Id;
R : Node_Id;
Op_Id : Entity_Id;
T1 : Entity_Id)
is
Index : Interp_Index;
It : Interp;
begin
if T1 = Universal_Integer
or else T1 = Universal_Real
then
if not Is_Overloaded (R) then
Add_One_Interp
(N, Op_Id, Standard_Boolean, Base_Type (Etype (R)));
else
Get_First_Interp (R, Index, It);
while Present (It.Typ) loop
if Covers (It.Typ, T1) then
Add_One_Interp
(N, Op_Id, Standard_Boolean, Base_Type (It.Typ));
end if;
Get_Next_Interp (Index, It);
end loop;
end if;
else
Add_One_Interp (N, Op_Id, Standard_Boolean, Base_Type (T1));
end if;
end Find_Non_Universal_Interpretations;
------------------------------
-- Find_Concatenation_Types --
------------------------------
procedure Find_Concatenation_Types
(L, R : Node_Id;
Op_Id : Entity_Id;
N : Node_Id)
is
Op_Type : constant Entity_Id := Etype (Op_Id);
begin
if Is_Array_Type (Op_Type)
and then not Is_Limited_Type (Op_Type)
and then (Has_Compatible_Type (L, Op_Type)
or else
Has_Compatible_Type (L, Component_Type (Op_Type)))
and then (Has_Compatible_Type (R, Op_Type)
or else
Has_Compatible_Type (R, Component_Type (Op_Type)))
then
Add_One_Interp (N, Op_Id, Op_Type);
end if;
end Find_Concatenation_Types;
-------------------------
-- Find_Equality_Types --
-------------------------
procedure Find_Equality_Types
(L, R : Node_Id;
Op_Id : Entity_Id;
N : Node_Id)
is
Index : Interp_Index;
It : Interp;
Found : Boolean := False;
I_F : Interp_Index;
T_F : Entity_Id;
Scop : Entity_Id := Empty;
procedure Try_One_Interp (T1 : Entity_Id);
-- The context of the operator plays no role in resolving the
-- arguments, so that if there is more than one interpretation
-- of the operands that is compatible with equality, the construct
-- is ambiguous and an error can be emitted now, after trying to
-- disambiguate, i.e. applying preference rules.
--------------------
-- Try_One_Interp --
--------------------
procedure Try_One_Interp (T1 : Entity_Id) is
begin
-- If the operator is an expanded name, then the type of the operand
-- must be defined in the corresponding scope. If the type is
-- universal, the context will impose the correct type. An anonymous
-- type for a 'Access reference is also universal in this sense, as
-- the actual type is obtained from context.
-- In Ada 2005, the equality operator for anonymous access types
-- is declared in Standard, and preference rules apply to it.
if Present (Scop) then
if Defined_In_Scope (T1, Scop)
or else T1 = Universal_Integer
or else T1 = Universal_Real
or else T1 = Any_Access
or else T1 = Any_String
or else T1 = Any_Composite
or else (Ekind (T1) = E_Access_Subprogram_Type
and then not Comes_From_Source (T1))
then
null;
elsif Ekind (T1) = E_Anonymous_Access_Type
and then Scop = Standard_Standard
then
null;
else
-- The scope does not contain an operator for the type
return;
end if;
end if;
-- Ada 2005 (AI-230): Keep restriction imposed by Ada 83 and 95:
-- Do not allow anonymous access types in equality operators.
if Ada_Version < Ada_05
and then Ekind (T1) = E_Anonymous_Access_Type
then
return;
end if;
if T1 /= Standard_Void_Type
and then not Is_Limited_Type (T1)
and then not Is_Limited_Composite (T1)
and then Has_Compatible_Type (R, T1)
then
if Found
and then Base_Type (T1) /= Base_Type (T_F)
then
It := Disambiguate (L, I_F, Index, Any_Type);
if It = No_Interp then
Ambiguous_Operands (N);
Set_Etype (L, Any_Type);
return;
else
T_F := It.Typ;
end if;
else
Found := True;
T_F := T1;
I_F := Index;
end if;
if not Analyzed (L) then
Set_Etype (L, T_F);
end if;
Find_Non_Universal_Interpretations (N, R, Op_Id, T1);
-- Case of operator was not visible, Etype still set to Any_Type
if Etype (N) = Any_Type then
Found := False;
end if;
elsif Scop = Standard_Standard
and then Ekind (T1) = E_Anonymous_Access_Type
then
Found := True;
end if;
end Try_One_Interp;
-- Start of processing for Find_Equality_Types
begin
-- If left operand is aggregate, the right operand has to
-- provide a usable type for it.
if Nkind (L) = N_Aggregate
and then Nkind (R) /= N_Aggregate
then
Find_Equality_Types (R, L, Op_Id, N);
return;
end if;
if Nkind (N) = N_Function_Call
and then Nkind (Name (N)) = N_Expanded_Name
then
Scop := Entity (Prefix (Name (N)));
-- The prefix may be a package renaming, and the subsequent test
-- requires the original package.
if Ekind (Scop) = E_Package
and then Present (Renamed_Entity (Scop))
then
Scop := Renamed_Entity (Scop);
Set_Entity (Prefix (Name (N)), Scop);
end if;
end if;
if not Is_Overloaded (L) then
Try_One_Interp (Etype (L));
else
Get_First_Interp (L, Index, It);
while Present (It.Typ) loop
Try_One_Interp (It.Typ);
Get_Next_Interp (Index, It);
end loop;
end if;
end Find_Equality_Types;
-------------------------
-- Find_Negation_Types --
-------------------------
procedure Find_Negation_Types
(R : Node_Id;
Op_Id : Entity_Id;
N : Node_Id)
is
Index : Interp_Index;
It : Interp;
begin
if not Is_Overloaded (R) then
if Etype (R) = Universal_Integer then
Add_One_Interp (N, Op_Id, Any_Modular);
elsif Valid_Boolean_Arg (Etype (R)) then
Add_One_Interp (N, Op_Id, Etype (R));
end if;
else
Get_First_Interp (R, Index, It);
while Present (It.Typ) loop
if Valid_Boolean_Arg (It.Typ) then
Add_One_Interp (N, Op_Id, It.Typ);
end if;
Get_Next_Interp (Index, It);
end loop;
end if;
end Find_Negation_Types;
----------------------
-- Find_Unary_Types --
----------------------
procedure Find_Unary_Types
(R : Node_Id;
Op_Id : Entity_Id;
N : Node_Id)
is
Index : Interp_Index;
It : Interp;
begin
if not Is_Overloaded (R) then
if Is_Numeric_Type (Etype (R)) then
Add_One_Interp (N, Op_Id, Base_Type (Etype (R)));
end if;
else
Get_First_Interp (R, Index, It);
while Present (It.Typ) loop
if Is_Numeric_Type (It.Typ) then
Add_One_Interp (N, Op_Id, Base_Type (It.Typ));
end if;
Get_Next_Interp (Index, It);
end loop;
end if;
end Find_Unary_Types;
------------------
-- Junk_Operand --
------------------
function Junk_Operand (N : Node_Id) return Boolean is
Enode : Node_Id;
begin
if Error_Posted (N) then
return False;
end if;
-- Get entity to be tested
if Is_Entity_Name (N)
and then Present (Entity (N))
then
Enode := N;
-- An odd case, a procedure name gets converted to a very peculiar
-- function call, and here is where we detect this happening.
elsif Nkind (N) = N_Function_Call
and then Is_Entity_Name (Name (N))
and then Present (Entity (Name (N)))
then
Enode := Name (N);
-- Another odd case, there are at least some cases of selected
-- components where the selected component is not marked as having
-- an entity, even though the selector does have an entity
elsif Nkind (N) = N_Selected_Component
and then Present (Entity (Selector_Name (N)))
then
Enode := Selector_Name (N);
else
return False;
end if;
-- Now test the entity we got to see if it is a bad case
case Ekind (Entity (Enode)) is
when E_Package =>
Error_Msg_N
("package name cannot be used as operand", Enode);
when Generic_Unit_Kind =>
Error_Msg_N
("generic unit name cannot be used as operand", Enode);
when Type_Kind =>
Error_Msg_N
("subtype name cannot be used as operand", Enode);
when Entry_Kind =>
Error_Msg_N
("entry name cannot be used as operand", Enode);
when E_Procedure =>
Error_Msg_N
("procedure name cannot be used as operand", Enode);
when E_Exception =>
Error_Msg_N
("exception name cannot be used as operand", Enode);
when E_Block | E_Label | E_Loop =>
Error_Msg_N
("label name cannot be used as operand", Enode);
when others =>
return False;
end case;
return True;
end Junk_Operand;
--------------------
-- Operator_Check --
--------------------
procedure Operator_Check (N : Node_Id) is
begin
Remove_Abstract_Operations (N);
-- Test for case of no interpretation found for operator
if Etype (N) = Any_Type then
declare
L : Node_Id;
R : Node_Id;
begin
R := Right_Opnd (N);
if Nkind (N) in N_Binary_Op then
L := Left_Opnd (N);
else
L := Empty;
end if;
-- If either operand has no type, then don't complain further,
-- since this simply means that we have a propagated error.
if R = Error
or else Etype (R) = Any_Type
or else (Nkind (N) in N_Binary_Op and then Etype (L) = Any_Type)
then
return;
-- We explicitly check for the case of concatenation of component
-- with component to avoid reporting spurious matching array types
-- that might happen to be lurking in distant packages (such as
-- run-time packages). This also prevents inconsistencies in the
-- messages for certain ACVC B tests, which can vary depending on
-- types declared in run-time interfaces. Another improvement when
-- aggregates are present is to look for a well-typed operand.
elsif Present (Candidate_Type)
and then (Nkind (N) /= N_Op_Concat
or else Is_Array_Type (Etype (L))
or else Is_Array_Type (Etype (R)))
then
if Nkind (N) = N_Op_Concat then
if Etype (L) /= Any_Composite
and then Is_Array_Type (Etype (L))
then
Candidate_Type := Etype (L);
elsif Etype (R) /= Any_Composite
and then Is_Array_Type (Etype (R))
then
Candidate_Type := Etype (R);
end if;
end if;
Error_Msg_NE
("operator for} is not directly visible!",
N, First_Subtype (Candidate_Type));
Error_Msg_N ("use clause would make operation legal!", N);
return;
-- If either operand is a junk operand (e.g. package name), then
-- post appropriate error messages, but do not complain further.
-- Note that the use of OR in this test instead of OR ELSE is
-- quite deliberate, we may as well check both operands in the
-- binary operator case.
elsif Junk_Operand (R)
or (Nkind (N) in N_Binary_Op and then Junk_Operand (L))
then
return;
-- If we have a logical operator, one of whose operands is
-- Boolean, then we know that the other operand cannot resolve to
-- Boolean (since we got no interpretations), but in that case we
-- pretty much know that the other operand should be Boolean, so
-- resolve it that way (generating an error)
elsif Nkind (N) = N_Op_And
or else
Nkind (N) = N_Op_Or
or else
Nkind (N) = N_Op_Xor
then
if Etype (L) = Standard_Boolean then
Resolve (R, Standard_Boolean);
return;
elsif Etype (R) = Standard_Boolean then
Resolve (L, Standard_Boolean);
return;
end if;
-- For an arithmetic operator or comparison operator, if one
-- of the operands is numeric, then we know the other operand
-- is not the same numeric type. If it is a non-numeric type,
-- then probably it is intended to match the other operand.
elsif Nkind (N) = N_Op_Add or else
Nkind (N) = N_Op_Divide or else
Nkind (N) = N_Op_Ge or else
Nkind (N) = N_Op_Gt or else
Nkind (N) = N_Op_Le or else
Nkind (N) = N_Op_Lt or else
Nkind (N) = N_Op_Mod or else
Nkind (N) = N_Op_Multiply or else
Nkind (N) = N_Op_Rem or else
Nkind (N) = N_Op_Subtract
then
if Is_Numeric_Type (Etype (L))
and then not Is_Numeric_Type (Etype (R))
then
Resolve (R, Etype (L));
return;
elsif Is_Numeric_Type (Etype (R))
and then not Is_Numeric_Type (Etype (L))
then
Resolve (L, Etype (R));
return;
end if;
-- Comparisons on A'Access are common enough to deserve a
-- special message.
elsif (Nkind (N) = N_Op_Eq or else
Nkind (N) = N_Op_Ne)
and then Ekind (Etype (L)) = E_Access_Attribute_Type
and then Ekind (Etype (R)) = E_Access_Attribute_Type
then
Error_Msg_N
("two access attributes cannot be compared directly", N);
Error_Msg_N
("\they must be converted to an explicit type for comparison",
N);
return;
-- Another one for C programmers
elsif Nkind (N) = N_Op_Concat
and then Valid_Boolean_Arg (Etype (L))
and then Valid_Boolean_Arg (Etype (R))
then
Error_Msg_N ("invalid operands for concatenation", N);
Error_Msg_N ("\maybe AND was meant", N);
return;
-- A special case for comparison of access parameter with null
elsif Nkind (N) = N_Op_Eq
and then Is_Entity_Name (L)
and then Nkind (Parent (Entity (L))) = N_Parameter_Specification
and then Nkind (Parameter_Type (Parent (Entity (L)))) =
N_Access_Definition
and then Nkind (R) = N_Null
then
Error_Msg_N ("access parameter is not allowed to be null", L);
Error_Msg_N ("\(call would raise Constraint_Error)", L);
return;
end if;
-- If we fall through then just give general message. Note that in
-- the following messages, if the operand is overloaded we choose
-- an arbitrary type to complain about, but that is probably more
-- useful than not giving a type at all.
if Nkind (N) in N_Unary_Op then
Error_Msg_Node_2 := Etype (R);
Error_Msg_N ("operator& not defined for}", N);
return;
else
if Nkind (N) in N_Binary_Op then
if not Is_Overloaded (L)
and then not Is_Overloaded (R)
and then Base_Type (Etype (L)) = Base_Type (Etype (R))
then
Error_Msg_Node_2 := First_Subtype (Etype (R));
Error_Msg_N ("there is no applicable operator& for}", N);
else
Error_Msg_N ("invalid operand types for operator&", N);
if Nkind (N) /= N_Op_Concat then
Error_Msg_NE ("\left operand has}!", N, Etype (L));
Error_Msg_NE ("\right operand has}!", N, Etype (R));
end if;
end if;
end if;
end if;
end;
end if;
end Operator_Check;
-----------------------------------------
-- Process_Implicit_Dereference_Prefix --
-----------------------------------------
procedure Process_Implicit_Dereference_Prefix
(E : Entity_Id;
P : Entity_Id)
is
Ref : Node_Id;
begin
if Present (E)
and then (Operating_Mode = Check_Semantics or else not Expander_Active)
then
-- We create a dummy reference to E to ensure that the reference
-- is not considered as part of an assignment (an implicit
-- dereference can never assign to its prefix). The Comes_From_Source
-- attribute needs to be propagated for accurate warnings.
Ref := New_Reference_To (E, Sloc (P));
Set_Comes_From_Source (Ref, Comes_From_Source (P));
Generate_Reference (E, Ref);
end if;
end Process_Implicit_Dereference_Prefix;
--------------------------------
-- Remove_Abstract_Operations --
--------------------------------
procedure Remove_Abstract_Operations (N : Node_Id) is
I : Interp_Index;
It : Interp;
Abstract_Op : Entity_Id := Empty;
-- AI-310: If overloaded, remove abstract non-dispatching operations. We
-- activate this if either extensions are enabled, or if the abstract
-- operation in question comes from a predefined file. This latter test
-- allows us to use abstract to make operations invisible to users. In
-- particular, if type Address is non-private and abstract subprograms
-- are used to hide its operators, they will be truly hidden.
type Operand_Position is (First_Op, Second_Op);
Univ_Type : constant Entity_Id := Universal_Interpretation (N);
procedure Remove_Address_Interpretations (Op : Operand_Position);
-- Ambiguities may arise when the operands are literal and the address
-- operations in s-auxdec are visible. In that case, remove the
-- interpretation of a literal as Address, to retain the semantics of
-- Address as a private type.
------------------------------------
-- Remove_Address_Interpretations --
------------------------------------
procedure Remove_Address_Interpretations (Op : Operand_Position) is
Formal : Entity_Id;
begin
if Is_Overloaded (N) then
Get_First_Interp (N, I, It);
while Present (It.Nam) loop
Formal := First_Entity (It.Nam);
if Op = Second_Op then
Formal := Next_Entity (Formal);
end if;
if Is_Descendent_Of_Address (Etype (Formal)) then
Remove_Interp (I);
end if;
Get_Next_Interp (I, It);
end loop;
end if;
end Remove_Address_Interpretations;
-- Start of processing for Remove_Abstract_Operations
begin
if Is_Overloaded (N) then
Get_First_Interp (N, I, It);
while Present (It.Nam) loop
if not Is_Type (It.Nam)
and then Is_Abstract (It.Nam)
and then not Is_Dispatching_Operation (It.Nam)
then
Abstract_Op := It.Nam;
-- In Ada 2005, this operation does not participate in Overload
-- resolution. If the operation is defined in in a predefined
-- unit, it is one of the operations declared abstract in some
-- variants of System, and it must be removed as well.
if Ada_Version >= Ada_05
or else Is_Predefined_File_Name
(Unit_File_Name (Get_Source_Unit (It.Nam)))
or else Is_Descendent_Of_Address (It.Typ)
then
Remove_Interp (I);
exit;
end if;
end if;
Get_Next_Interp (I, It);
end loop;
if No (Abstract_Op) then
-- If some interpretation yields an integer type, it is still
-- possible that there are address interpretations. Remove them
-- if one operand is a literal, to avoid spurious ambiguities
-- on systems where Address is a visible integer type.
if Is_Overloaded (N)
and then Nkind (N) in N_Op
and then Is_Integer_Type (Etype (N))
then
if Nkind (N) in N_Binary_Op then
if Nkind (Right_Opnd (N)) = N_Integer_Literal then
Remove_Address_Interpretations (Second_Op);
elsif Nkind (Right_Opnd (N)) = N_Integer_Literal then
Remove_Address_Interpretations (First_Op);
end if;
end if;
end if;
elsif Nkind (N) in N_Op then
-- Remove interpretations that treat literals as addresses. This
-- is never appropriate, even when Address is defined as a visible
-- Integer type. The reason is that we would really prefer Address
-- to behave as a private type, even in this case, which is there
-- only to accomodate oddities of VMS address sizes. If Address is
-- a visible integer type, we get lots of overload ambiguities.
if Nkind (N) in N_Binary_Op then
declare
U1 : constant Boolean :=
Present (Universal_Interpretation (Right_Opnd (N)));
U2 : constant Boolean :=
Present (Universal_Interpretation (Left_Opnd (N)));
begin
if U1 then
Remove_Address_Interpretations (Second_Op);
end if;
if U2 then
Remove_Address_Interpretations (First_Op);
end if;
if not (U1 and U2) then
-- Remove corresponding predefined operator, which is
-- always added to the overload set.
Get_First_Interp (N, I, It);
while Present (It.Nam) loop
if Scope (It.Nam) = Standard_Standard
and then Base_Type (It.Typ) =
Base_Type (Etype (Abstract_Op))
then
Remove_Interp (I);
end if;
Get_Next_Interp (I, It);
end loop;
elsif Is_Overloaded (N)
and then Present (Univ_Type)
then
-- If both operands have a universal interpretation,
-- it is still necessary to remove interpretations that
-- yield Address. Any remaining ambiguities will be
-- removed in Disambiguate.
Get_First_Interp (N, I, It);
while Present (It.Nam) loop
if Is_Descendent_Of_Address (It.Typ) then
Remove_Interp (I);
elsif not Is_Type (It.Nam) then
Set_Entity (N, It.Nam);
end if;
Get_Next_Interp (I, It);
end loop;
end if;
end;
end if;
elsif Nkind (N) = N_Function_Call
and then
(Nkind (Name (N)) = N_Operator_Symbol
or else
(Nkind (Name (N)) = N_Expanded_Name
and then
Nkind (Selector_Name (Name (N))) = N_Operator_Symbol))
then
declare
Arg1 : constant Node_Id := First (Parameter_Associations (N));
U1 : constant Boolean :=
Present (Universal_Interpretation (Arg1));
U2 : constant Boolean :=
Present (Next (Arg1)) and then
Present (Universal_Interpretation (Next (Arg1)));
begin
if U1 then
Remove_Address_Interpretations (First_Op);
end if;
if U2 then
Remove_Address_Interpretations (Second_Op);
end if;
if not (U1 and U2) then
Get_First_Interp (N, I, It);
while Present (It.Nam) loop
if Scope (It.Nam) = Standard_Standard
and then It.Typ = Base_Type (Etype (Abstract_Op))
then
Remove_Interp (I);
end if;
Get_Next_Interp (I, It);
end loop;
end if;
end;
end if;
-- If the removal has left no valid interpretations, emit
-- error message now and label node as illegal.
if Present (Abstract_Op) then
Get_First_Interp (N, I, It);
if No (It.Nam) then
-- Removal of abstract operation left no viable candidate
Set_Etype (N, Any_Type);
Error_Msg_Sloc := Sloc (Abstract_Op);
Error_Msg_NE
("cannot call abstract operation& declared#", N, Abstract_Op);
end if;
end if;
end if;
end Remove_Abstract_Operations;
-----------------------
-- Try_Indirect_Call --
-----------------------
function Try_Indirect_Call
(N : Node_Id;
Nam : Entity_Id;
Typ : Entity_Id) return Boolean
is
Actual : Node_Id;
Formal : Entity_Id;
Call_OK : Boolean;
begin
Normalize_Actuals (N, Designated_Type (Typ), False, Call_OK);
Actual := First_Actual (N);
Formal := First_Formal (Designated_Type (Typ));
while Present (Actual) and then Present (Formal) loop
if not Has_Compatible_Type (Actual, Etype (Formal)) then
return False;
end if;
Next (Actual);
Next_Formal (Formal);
end loop;
if No (Actual) and then No (Formal) then
Add_One_Interp (N, Nam, Etype (Designated_Type (Typ)));
-- Nam is a candidate interpretation for the name in the call,
-- if it is not an indirect call.
if not Is_Type (Nam)
and then Is_Entity_Name (Name (N))
then
Set_Entity (Name (N), Nam);
end if;
return True;
else
return False;
end if;
end Try_Indirect_Call;
----------------------
-- Try_Indexed_Call --
----------------------
function Try_Indexed_Call
(N : Node_Id;
Nam : Entity_Id;
Typ : Entity_Id) return Boolean
is
Actuals : constant List_Id := Parameter_Associations (N);
Actual : Node_Id;
Index : Entity_Id;
begin
Actual := First (Actuals);
Index := First_Index (Typ);
while Present (Actual) and then Present (Index) loop
-- If the parameter list has a named association, the expression
-- is definitely a call and not an indexed component.
if Nkind (Actual) = N_Parameter_Association then
return False;
end if;
if not Has_Compatible_Type (Actual, Etype (Index)) then
return False;
end if;
Next (Actual);
Next_Index (Index);
end loop;
if No (Actual) and then No (Index) then
Add_One_Interp (N, Nam, Component_Type (Typ));
-- Nam is a candidate interpretation for the name in the call,
-- if it is not an indirect call.
if not Is_Type (Nam)
and then Is_Entity_Name (Name (N))
then
Set_Entity (Name (N), Nam);
end if;
return True;
else
return False;
end if;
end Try_Indexed_Call;
--------------------------
-- Try_Object_Operation --
--------------------------
function Try_Object_Operation (N : Node_Id) return Boolean is
K : constant Node_Kind := Nkind (Parent (N));
Loc : constant Source_Ptr := Sloc (N);
Is_Subprg_Call : constant Boolean := K = N_Procedure_Call_Statement
or else K = N_Function_Call;
Obj : constant Node_Id := Prefix (N);
Subprog : constant Node_Id := Selector_Name (N);
Actual : Node_Id;
New_Call_Node : Node_Id := Empty;
Node_To_Replace : Node_Id;
Obj_Type : Entity_Id := Etype (Obj);
procedure Complete_Object_Operation
(Call_Node : Node_Id;
Node_To_Replace : Node_Id;
Subprog : Node_Id);
-- Make Subprog the name of Call_Node, replace Node_To_Replace with
-- Call_Node, insert the object (or its dereference) as the first actual
-- in the call, and complete the analysis of the call.
procedure Transform_Object_Operation
(Call_Node : out Node_Id;
Node_To_Replace : out Node_Id;
Subprog : Node_Id);
-- Transform Obj.Operation (X, Y,,) into Operation (Obj, X, Y ..)
-- Call_Node is the resulting subprogram call,
-- Node_To_Replace is either N or the parent of N, and Subprog
-- is a reference to the subprogram we are trying to match.
function Try_Class_Wide_Operation
(Call_Node : Node_Id;
Node_To_Replace : Node_Id) return Boolean;
-- Traverse all ancestor types looking for a class-wide subprogram
-- for which the current operation is a valid non-dispatching call.
function Try_Primitive_Operation
(Call_Node : Node_Id;
Node_To_Replace : Node_Id) return Boolean;
-- Traverse the list of primitive subprograms looking for a dispatching
-- operation for which the current node is a valid call .
-------------------------------
-- Complete_Object_Operation --
-------------------------------
procedure Complete_Object_Operation
(Call_Node : Node_Id;
Node_To_Replace : Node_Id;
Subprog : Node_Id)
is
Formal_Type : constant Entity_Id :=
Etype (First_Formal (Entity (Subprog)));
First_Actual : Node_Id;
begin
First_Actual := First (Parameter_Associations (Call_Node));
Set_Name (Call_Node, Subprog);
if Nkind (N) = N_Selected_Component
and then not Inside_A_Generic
then
Set_Entity (Selector_Name (N), Entity (Subprog));
end if;
-- If need be, rewrite first actual as an explicit dereference
if not Is_Access_Type (Formal_Type)
and then Is_Access_Type (Etype (Obj))
then
Rewrite (First_Actual,
Make_Explicit_Dereference (Sloc (Obj), Obj));
Analyze (First_Actual);
-- Conversely, if the formal is an access parameter and the
-- object is not, replace the actual with a 'Access reference.
-- Its analysis will check that the object is aliased.
elsif Is_Access_Type (Formal_Type)
and then not Is_Access_Type (Etype (Obj))
then
Rewrite (First_Actual,
Make_Attribute_Reference (Loc,
Attribute_Name => Name_Access,
Prefix => Relocate_Node (Obj)));
Analyze (First_Actual);
else
Rewrite (First_Actual, Obj);
end if;
Rewrite (Node_To_Replace, Call_Node);
Analyze (Node_To_Replace);
end Complete_Object_Operation;
--------------------------------
-- Transform_Object_Operation --
--------------------------------
procedure Transform_Object_Operation
(Call_Node : out Node_Id;
Node_To_Replace : out Node_Id;
Subprog : Node_Id)
is
Parent_Node : constant Node_Id := Parent (N);
Dummy : constant Node_Id := New_Copy (Obj);
-- Placeholder used as a first parameter in the call, replaced
-- eventually by the proper object.
Actuals : List_Id;
Actual : Node_Id;
begin
-- Common case covering 1) Call to a procedure and 2) Call to a
-- function that has some additional actuals.
if (Nkind (Parent_Node) = N_Function_Call
or else
Nkind (Parent_Node) = N_Procedure_Call_Statement)
-- N is a selected component node containing the name of the
-- subprogram. If N is not the name of the parent node we must
-- not replace the parent node by the new construct. This case
-- occurs when N is a parameterless call to a subprogram that
-- is an actual parameter of a call to another subprogram. For
-- example:
-- Some_Subprogram (..., Obj.Operation, ...)
and then Name (Parent_Node) = N
then
Node_To_Replace := Parent_Node;
Actuals := Parameter_Associations (Parent_Node);
if Present (Actuals) then
Prepend (Dummy, Actuals);
else
Actuals := New_List (Dummy);
end if;
if Nkind (Parent_Node) = N_Procedure_Call_Statement then
Call_Node :=
Make_Procedure_Call_Statement (Loc,
Name => New_Copy_Tree (Subprog),
Parameter_Associations => Actuals);
else
Call_Node :=
Make_Function_Call (Loc,
Name => New_Copy_Tree (Subprog),
Parameter_Associations => Actuals);
end if;
-- Before analysis, the function call appears as an indexed component
-- if there are no named associations.
elsif Nkind (Parent_Node) = N_Indexed_Component
and then N = Prefix (Parent_Node)
then
Node_To_Replace := Parent_Node;
Actuals := Expressions (Parent_Node);
Actual := First (Actuals);
while Present (Actual) loop
Analyze (Actual);
Next (Actual);
end loop;
Prepend (Dummy, Actuals);
Call_Node :=
Make_Function_Call (Loc,
Name => New_Copy_Tree (Subprog),
Parameter_Associations => Actuals);
-- Parameterless call: Obj.F is rewritten as F (Obj)
else
Node_To_Replace := N;
Call_Node :=
Make_Function_Call (Loc,
Name => New_Copy_Tree (Subprog),
Parameter_Associations => New_List (Dummy));
end if;
end Transform_Object_Operation;
------------------------------
-- Try_Class_Wide_Operation --
------------------------------
function Try_Class_Wide_Operation
(Call_Node : Node_Id;
Node_To_Replace : Node_Id) return Boolean
is
Anc_Type : Entity_Id;
Hom : Entity_Id;
Hom_Ref : Node_Id;
Success : Boolean;
begin
-- Loop through ancestor types, traverse the homonym chain of the
-- subprogram, and try out those homonyms whose first formal has the
-- class-wide type of the ancestor.
-- Should we verify that it is declared in the same package as the
-- ancestor type ???
Anc_Type := Obj_Type;
loop
Hom := Current_Entity (Subprog);
while Present (Hom) loop
if (Ekind (Hom) = E_Procedure
or else
Ekind (Hom) = E_Function)
and then Present (First_Formal (Hom))
and then Etype (First_Formal (Hom)) =
Class_Wide_Type (Anc_Type)
then
Hom_Ref := New_Reference_To (Hom, Sloc (Subprog));
Set_Etype (Call_Node, Any_Type);
Set_Parent (Call_Node, Parent (Node_To_Replace));
Set_Name (Call_Node, Hom_Ref);
Analyze_One_Call
(N => Call_Node,
Nam => Hom,
Report => False,
Success => Success,
Skip_First => True);
if Success then
-- Reformat into the proper call
Complete_Object_Operation
(Call_Node => Call_Node,
Node_To_Replace => Node_To_Replace,
Subprog => Hom_Ref);
return True;
end if;
end if;
Hom := Homonym (Hom);
end loop;
-- Examine other ancestor types
exit when Etype (Anc_Type) = Anc_Type;
Anc_Type := Etype (Anc_Type);
end loop;
-- Nothing matched
return False;
end Try_Class_Wide_Operation;
-----------------------------
-- Try_Primitive_Operation --
-----------------------------
function Try_Primitive_Operation
(Call_Node : Node_Id;
Node_To_Replace : Node_Id) return Boolean
is
Elmt : Elmt_Id;
Prim_Op : Entity_Id;
Prim_Op_Ref : Node_Id := Empty;
Success : Boolean := False;
Op_Exists : Boolean := False;
function Valid_First_Argument_Of (Op : Entity_Id) return Boolean;
-- Verify that the prefix, dereferenced if need be, is a valid
-- controlling argument in a call to Op. The remaining actuals
-- are checked in the subsequent call to Analyze_One_Call.
-----------------------------
-- Valid_First_Argument_Of --
-----------------------------
function Valid_First_Argument_Of (Op : Entity_Id) return Boolean is
Typ : constant Entity_Id := Etype (First_Formal (Op));
begin
-- Simple case
return Base_Type (Obj_Type) = Typ
-- Prefix can be dereferenced
or else
(Is_Access_Type (Obj_Type)
and then Designated_Type (Obj_Type) = Typ)
-- Formal is an access parameter, for which the object
-- can provide an access.
or else
(Ekind (Typ) = E_Anonymous_Access_Type
and then Designated_Type (Typ) = Obj_Type);
end Valid_First_Argument_Of;
-- Start of processing for Try_Primitive_Operation
begin
-- Look for subprograms in the list of primitive operations
-- The name must be identical, and the kind of call indicates
-- the expected kind of operation (function or procedure).
Elmt := First_Elmt (Primitive_Operations (Obj_Type));
while Present (Elmt) loop
Prim_Op := Node (Elmt);
if Chars (Prim_Op) = Chars (Subprog)
and then Present (First_Formal (Prim_Op))
and then Valid_First_Argument_Of (Prim_Op)
and then
(Nkind (Call_Node) = N_Function_Call)
= (Ekind (Prim_Op) = E_Function)
then
-- If this primitive operation corresponds with an immediate
-- ancestor interface there is no need to add it to the list
-- of interpretations; the corresponding aliased primitive is
-- also in this list of primitive operations and will be
-- used instead.
if Present (Abstract_Interface_Alias (Prim_Op))
and then Present (DTC_Entity (Alias (Prim_Op)))
and then Etype (DTC_Entity (Alias (Prim_Op))) = RTE (RE_Tag)
then
goto Continue;
end if;
if not Success then
Prim_Op_Ref := New_Reference_To (Prim_Op, Sloc (Subprog));
Set_Etype (Call_Node, Any_Type);
Set_Parent (Call_Node, Parent (Node_To_Replace));
Set_Name (Call_Node, Prim_Op_Ref);
Analyze_One_Call
(N => Call_Node,
Nam => Prim_Op,
Report => False,
Success => Success,
Skip_First => True);
if Success then
Op_Exists := True;
-- If the operation is a procedure call, there can only
-- be one candidate and we found it. If it is a function
-- we must collect all interpretations, because there
-- may be several primitive operations that differ only
-- in the return type.
if Nkind (Call_Node) = N_Procedure_Call_Statement then
exit;
end if;
end if;
elsif Ekind (Prim_Op) = E_Function then
-- Collect remaining function interpretations, to be
-- resolved from context.
Add_One_Interp (Prim_Op_Ref, Prim_Op, Etype (Prim_Op));
end if;
end if;
<<Continue>>
Next_Elmt (Elmt);
end loop;
if Op_Exists then
Complete_Object_Operation
(Call_Node => Call_Node,
Node_To_Replace => Node_To_Replace,
Subprog => Prim_Op_Ref);
end if;
return Op_Exists;
end Try_Primitive_Operation;
-- Start of processing for Try_Object_Operation
begin
if Is_Access_Type (Obj_Type) then
Obj_Type := Designated_Type (Obj_Type);
end if;
if Ekind (Obj_Type) = E_Private_Subtype then
Obj_Type := Base_Type (Obj_Type);
end if;
if Is_Class_Wide_Type (Obj_Type) then
Obj_Type := Etype (Class_Wide_Type (Obj_Type));
end if;
-- The type may have be obtained through a limited_with clause,
-- in which case the primitive operations are available on its
-- non-limited view.
if Ekind (Obj_Type) = E_Incomplete_Type
and then From_With_Type (Obj_Type)
then
Obj_Type := Non_Limited_View (Obj_Type);
end if;
if not Is_Tagged_Type (Obj_Type) then
return False;
end if;
-- Analyze the actuals if node is know to be a subprogram call
if Is_Subprg_Call and then N = Name (Parent (N)) then
Actual := First (Parameter_Associations (Parent (N)));
while Present (Actual) loop
Analyze_Expression (Actual);
Next (Actual);
end loop;
end if;
Analyze_Expression (Obj);
-- Build a subprogram call node, using a copy of Obj as its first
-- actual. This is a placeholder, to be replaced by an explicit
-- dereference when needed.
Transform_Object_Operation
(Call_Node => New_Call_Node,
Node_To_Replace => Node_To_Replace,
Subprog => Subprog);
Set_Etype (New_Call_Node, Any_Type);
Set_Parent (New_Call_Node, Parent (Node_To_Replace));
return
Try_Primitive_Operation
(Call_Node => New_Call_Node,
Node_To_Replace => Node_To_Replace)
or else
Try_Class_Wide_Operation
(Call_Node => New_Call_Node,
Node_To_Replace => Node_To_Replace);
end Try_Object_Operation;
end Sem_Ch4;
|
--
-- Jan & Uwe R. Zimmer, Australia, July 2011
--
with Ada.Numerics; use Ada.Numerics;
with GL;
-- with GL.Materials;
with GLOBE_3D;
with GLOBE_3D.Math; use GLOBE_3D.Math;
with GLOBE_3D.Stars_sky; pragma Elaborate_All (GLOBE_3D.Stars_sky);
with GLU;
with GLUT;
with GLUT_2D;
with Graphics_Configuration; use Graphics_Configuration;
with Graphics_Setup; use Graphics_Setup;
with Vectors_2D_N; use Vectors_2D_N;
package body Graphics_OpenGL is
use Real_Elementary_Functions;
package Stars is new GLOBE_3D.Stars_sky (No_of_Stars => Number_Of_Stars,
far_side => Distance_of_Stars);
---------------------------
-- To GL Rotation Matrix --
---------------------------
function To_GL_Rotation (Quat_Rotation : Quaternion_Rotation) return GLOBE_3D.Matrix_33 is
Rotation_Matrix : constant Matrix_3D := To_Matrix_3D_OpenGL (Roll (Quat_Rotation),
Pitch (Quat_Rotation),
Yaw (Quat_Rotation));
GL_Matrix : GLOBE_3D.Matrix_33;
begin
for Column in 1 .. 3 loop
for Row in 1 .. 3 loop
GL_Matrix (Column, Row) := GL.Double (Rotation_Matrix (Column, Row));
end loop;
end loop;
return GL_Matrix;
end To_GL_Rotation;
-----------------------
-- To GL Vector Type --
-----------------------
function To_GL_Vector (In_Vector : Vector_3D) return GLOBE_3D.Vector_3D is
(0 => GL.Double (In_Vector (x)),
1 => GL.Double (In_Vector (y)),
2 => GL.Double (In_Vector (z)));
--
--
--
function To_GL_Material_Float_vector (Colour : RGBA_Colour) return GL.Material_Float_vector is
(0 => GL.C_Float (Colour (Red)),
1 => GL.C_Float (Colour (Green)),
2 => GL.C_Float (Colour (Blue)),
3 => GL.C_Float (Colour (Alpha)));
--
procedure Set_Material (Material : Materials) is
begin
GL.Disable (GL.COLOR_MATERIAL);
GL.Material (GL.FRONT_AND_BACK, GL.AMBIENT, To_GL_Material_Float_vector (Material.Ambient));
GL.Material (GL.FRONT_AND_BACK, GL.DIFFUSE, To_GL_Material_Float_vector (Material.Diffuse));
GL.Material (GL.FRONT_AND_BACK, GL.SPECULAR, To_GL_Material_Float_vector (Material.Specular));
GL.Material (GL.FRONT_AND_BACK, GL.EMISSION, To_GL_Material_Float_vector (Material.Emission));
GL.Material (GL.FRONT_AND_BACK, GL.SHININESS, GL.C_Float (Material.Shininess));
end Set_Material;
procedure Set_Colour (Colour : RGB_Colour) is
begin
null;
end Set_Colour;
procedure Set_Colour (Colour : RGBA_Colour) is
begin
GL.Disable (GL.LIGHTING);
GL.Enable (GL.COLOR_MATERIAL);
GL.ColorMaterial (GL.FRONT_AND_BACK, GL.AMBIENT_AND_DIFFUSE);
GL.Color (red => GL.Double (Colour (Red)),
green => GL.Double (Colour (Green)),
blue => GL.Double (Colour (Blue)),
alpha => GL.Double (Colour (Alpha)));
end Set_Colour;
----------------
-- Set_Camera --
----------------
procedure Position_Camera (Cam_Position : GLOBE_3D.Vector_3D;
Cam_Rotation : GLOBE_3D.Matrix_33;
Cam_Offset : GLOBE_3D.Vector_3D) is
begin
GL.Clear (GL.DEPTH_BUFFER_BIT);
GL.Clear (GL.COLOR_BUFFER_BIT);
GL.Disable (GL.LIGHTING);
GL.Enable (GL.DEPTH_TEST);
GL.MatrixMode (GL.MODELVIEW);
GL.LoadIdentity;
GL.Translate (-Cam_Offset);
Multiply_GL_Matrix (Cam_Rotation);
GL.Translate (-Cam_Position);
Stars.Display (Cam_Rotation);
GL.Enable (GL.LIGHTING);
GL.Enable (GL.CULL_FACE);
GL.CullFace (GL.BACK);
end Position_Camera;
--
-- procedure Position_Camera (Cam_Position : Vector_3D;
-- Cam_Rotation : Quaternion_Rotation;
-- Cam_Offset : Vector_3D := Zero_Vector) is
--
-- begin
-- Position_Camera (To_GL_Vector (Cam_Position),
-- To_GL_Rotation (Cam_Rotation),
-- To_GL_Vector (Cam_Offset));
-- end Position_Camera;
--
procedure Position_Camera (C : Camera := Cam) is
begin
Position_Camera (To_GL_Vector (C.Position + C.Scene_Offset),
To_GL_Rotation (C.Rotation),
To_GL_Vector (C.Object_Offset));
end Position_Camera;
--
----------
-- Draw --
----------
procedure Draw (Draw_Object : GLOBE_3D.p_Object_3D) is
begin
GL.PushMatrix;
GLOBE_3D.Display (Draw_Object.all, Eye.Clipper);
GL.PopMatrix;
end Draw;
------------------------------------
-- Alternative Draw Input Options --
------------------------------------
procedure Draw (Draw_Object : GLOBE_3D.p_Object_3D;
In_Object_Position : GLOBE_3D.Vector_3D;
In_Object_Rotation : GLOBE_3D.Matrix_33) is
begin
Draw_Object.all.Centre := In_Object_Position;
Draw_Object.all.rotation := In_Object_Rotation;
Draw (Draw_Object);
end Draw;
procedure Draw (Draw_Object : GLOBE_3D.p_Object_3D;
In_Object_Position : Vector_3D;
In_Object_Rotation : Quaternion_Rotation) is
begin
Draw (Draw_Object,
To_GL_Vector (In_Object_Position),
To_GL_Rotation (In_Object_Rotation));
end Draw;
--
--
--
procedure Draw_Lines (Points : Points_3D) is
begin
GL.GL_Begin (GL.LINES);
GL.Vertex (To_GL_Vector (Points (Points'First)));
for i in Points'First + 1 .. Points'Last loop
GL.Vertex (To_GL_Vector (Points (i)));
end loop;
GL.GL_End;
end Draw_Lines;
procedure Draw_Line (Line : Line_3D; Line_Radius : Real) is
Cyl_Slices : constant GL.Int := 10;
Cyl_Stacks : constant GL.Int := 1;
Rad_to_Deg : constant Real := 360.0 / (2.0 * Pi);
Cylinder : constant Vector_3D := (0.0, 0.0, 1.0);
Line_Vector : constant Vector_3D := Line (Line'Last) - Line (Line'First);
Radius : constant Vector_3D := Cylinder * Line_Vector;
Tilt_Angle : constant Real := Rad_to_Deg * Angle_Between (Cylinder, Line_Vector);
Quadratic : constant GLU.GLUquadricObjPtr := GLU.NewQuadric;
begin
GL.PushMatrix;
GL.Translate (To_GL_Vector (Line (Line'First)));
GL.Rotate (GL.Double (Tilt_Angle), GL.Double (Radius (x)), GL.Double (Radius (y)), GL.Double (Radius (z)));
GLU.QuadricOrientation (Quadratic, GLU.GLU_OUTSIDE);
GLU.Cylinder (Quadratic,
GL.Double (Line_Radius),
GL.Double (Line_Radius),
GL.Double (abs (Line_Vector)),
Cyl_Slices,
Cyl_Stacks);
GLU.QuadricOrientation (Quadratic, GLU.GLU_INSIDE);
GLU.Disk (Quadratic, 0.0, GL.Double (Line_Radius), Cyl_Slices, Cyl_Stacks);
GL.Translate (To_GL_Vector (Line_Vector));
GLU.QuadricOrientation (Quadratic, GLU.GLU_OUTSIDE);
GLU.Disk (Quadratic, 0.0, GL.Double (Line_Radius), Cyl_Slices, Cyl_Stacks);
GL.PopMatrix;
GLU.DeleteQuadric (Quadratic);
end Draw_Line;
--
function Scale_RGB (In_Colour : RGBA_Colour; Scale : Colour_Component_Range) return RGBA_Colour is
(Red => In_Colour (Red) * Scale,
Green => In_Colour (Green) * Scale,
Blue => In_Colour (Blue) * Scale,
Alpha => In_Colour (Alpha));
--
procedure Draw_Laser (Line_Start, Line_End : Vector_3D;
Beam_Radius, Aura_Radius : Real;
Beam_Colour : RGBA_Colour) is
Rendering_Steps : constant Positive := 5;
Max_Alpha : constant Colour_Component_Range := 1.0;
Min_Alpha : constant Colour_Component_Range := 0.1;
Laser_Material : constant Materials :=
(Ambient => (Red => 0.00, Green => 0.00, Blue => 0.00, Alpha => 1.00),
Diffuse => (Red => 0.59, Green => 0.67, Blue => 0.73, Alpha => 1.00),
Specular => (Red => 0.90, Green => 0.90, Blue => 0.90, Alpha => 1.00),
Emission => Beam_Colour,
Shininess => 100.0);
Beam_Material : Materials := Laser_Material;
Radius : Real := Beam_Radius;
Beam_Alpha : Colour_Component_Range := 1.0;
begin
for Steps in 0 .. Rendering_Steps loop
Beam_Alpha := Max_Alpha - (Real (Steps) / Real (Rendering_Steps)) ** (1.0 / 2.0) * (Max_Alpha - Min_Alpha);
Radius := Beam_Radius + (Real (Steps) / Real (Rendering_Steps)) * (Aura_Radius - Beam_Radius);
Beam_Material.Diffuse := (Scale_RGB (Laser_Material.Diffuse, Beam_Alpha));
Beam_Material.Specular := (Scale_RGB (Laser_Material.Specular, Beam_Alpha));
Beam_Material.Emission := (Scale_RGB (Laser_Material.Emission, Beam_Alpha));
Beam_Material.Ambient (Alpha) := Beam_Alpha;
Beam_Material.Diffuse (Alpha) := Beam_Alpha;
Beam_Material.Specular (Alpha) := Beam_Alpha;
Beam_Material.Emission (Alpha) := Beam_Alpha;
Set_Material (Beam_Material);
Draw_Line ((Line_Start, Line_End), Radius);
end loop;
end Draw_Laser;
--
package body Cursor_Management is
function Cursor return Point_2D is (Cursor_Pos);
--
procedure Home is
begin
Cursor_Pos := Home_Pos;
end Home;
--
procedure Line_Feed is
begin
Cursor_Pos := (x => Home_Pos (x), y => Cursor_Pos (y) + Leading);
end Line_Feed;
--
procedure Paragraph_Feed is
begin
Cursor_Pos := (x => Home_Pos (x), y => Cursor_Pos (y) + Paragraph_Spacing);
end Paragraph_Feed;
--
procedure Indend (Set_x : Natural) is
begin
Cursor_Pos (x) := Set_x;
end Indend;
end Cursor_Management;
procedure Text_2D (S : String; C : Point_2D := Cursor_Management.Cursor) is
begin
GLUT_2D.Text_output (GL.Int (C (x)),
GL.Int (C (y)),
GL.Sizei (GLUT.Get (GLUT.WINDOW_WIDTH)),
GL.Sizei (GLUT.Get (GLUT.WINDOW_HEIGHT)),
S,
Screen_Font);
end Text_2D;
--
procedure Text_3D (S : String; P : Vector_3D) is
begin
GLUT_2D.Text_output (To_GL_Vector (P),
S,
Screen_Font);
end Text_3D;
------------------
-- Show Drawing --
------------------
procedure Show_Drawing is
begin
GLUT.SwapBuffers;
end Show_Drawing;
-------------------
-- Resize Window --
-------------------
procedure Resize_Window (Size : Size_2D) is
begin
GLUT.ReshapeWindow (Width => Size (x), Height => Size (y));
Window_Resize (Size (x), Size (y));
end Resize_Window;
-----------------
-- Move Window --
-----------------
procedure Move_Window (Position : Point_2D) is
begin
GLUT.PositionWindow (Position (x), Position (y));
end Move_Window;
-----------------
-- Full Screen --
-----------------
package body Full_Screen_Mode is
procedure Change_Full_Screen is
begin
case Full_Screen_State is
when False =>
Memoried_Viewer_Size := ((x => GLUT.Get (GLUT.WINDOW_WIDTH),
y => GLUT.Get (GLUT.WINDOW_HEIGHT)));
Memoried_Viewer_Position := ((x => GLUT.Get (GLUT.WINDOW_X),
y => GLUT.Get (GLUT.WINDOW_Y)));
GLUT.FullScreen;
Window_Resize (Size_x => GLUT.Get (GLUT.WINDOW_WIDTH),
Size_y => GLUT.Get (GLUT.WINDOW_HEIGHT));
GLUT.SetCursor (GLUT.CURSOR_NONE);
when True =>
Resize_Window (Memoried_Viewer_Size);
Move_Window (Memoried_Viewer_Position);
GLUT.SetCursor (GLUT.CURSOR_INHERIT);
end case;
Full_Screen_State := not Full_Screen_State;
end Change_Full_Screen;
end Full_Screen_Mode;
end Graphics_OpenGL;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . W I D E _ T E X T _ I O . G E N E R I C _ A U X --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2009, 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. --
-- --
-- --
-- --
-- --
-- --
-- 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 a set of auxiliary routines used by Wide_Text_IO
-- generic children, including for reading and writing numeric strings.
-- Note: although this is the Wide version of the package, the interface
-- here is still in terms of Character and String rather than Wide_Character
-- and Wide_String, since all numeric strings are composed entirely of
-- characters in the range of type Standard.Character, and the basic
-- conversion routines work with Character rather than Wide_Character.
package Ada.Wide_Text_IO.Generic_Aux is
-- Note: for all the Load routines, File indicates the file to be read,
-- Buf is the string into which data is stored, Ptr is the index of the
-- last character stored so far, and is updated if additional characters
-- are stored. Data_Error is raised if the input overflows Buf. The only
-- Load routines that do a file status check are Load_Skip and Load_Width
-- so one of these two routines must be called first.
procedure Check_End_Of_Field
(Buf : String;
Stop : Integer;
Ptr : Integer;
Width : Field);
-- This routine is used after doing a get operations on a numeric value.
-- Buf is the string being scanned, and Stop is the last character of
-- the field being scanned. Ptr is as set by the call to the scan routine
-- that scanned out the numeric value, i.e. it points one past the last
-- character scanned, and Width is the width parameter from the Get call.
--
-- There are two cases, if Width is non-zero, then a check is made that
-- the remainder of the field is all blanks. If Width is zero, then it
-- means that the scan routine scanned out only part of the field. We
-- have already scanned out the field that the ACVC tests seem to expect
-- us to read (even if it does not follow the syntax of the type being
-- scanned, e.g. allowing negative exponents in integers, and underscores
-- at the end of the string), so we just raise Data_Error.
procedure Check_On_One_Line (File : File_Type; Length : Integer);
-- Check to see if item of length Integer characters can fit on
-- current line. Call New_Line if not, first checking that the
-- line length can accommodate Length characters, raise Layout_Error
-- if item is too large for a single line.
function Is_Blank (C : Character) return Boolean;
-- Determines if C is a blank (space or tab)
procedure Load_Width
(File : File_Type;
Width : Field;
Buf : out String;
Ptr : in out Integer);
-- Loads exactly Width characters, unless a line mark is encountered first
procedure Load_Skip (File : File_Type);
-- Skips leading blanks and line and page marks, if the end of file is
-- read without finding a non-blank character, then End_Error is raised.
-- Note: a blank is defined as a space or horizontal tab (RM A.10.6(5)).
procedure Load
(File : File_Type;
Buf : out String;
Ptr : in out Integer;
Char : Character;
Loaded : out Boolean);
-- If next character is Char, loads it, otherwise no characters are loaded
-- Loaded is set to indicate whether or not the character was found.
procedure Load
(File : File_Type;
Buf : out String;
Ptr : in out Integer;
Char : Character);
-- Same as above, but no indication if character is loaded
procedure Load
(File : File_Type;
Buf : out String;
Ptr : in out Integer;
Char1 : Character;
Char2 : Character;
Loaded : out Boolean);
-- If next character is Char1 or Char2, loads it, otherwise no characters
-- are loaded. Loaded is set to indicate whether or not one of the two
-- characters was found.
procedure Load
(File : File_Type;
Buf : out String;
Ptr : in out Integer;
Char1 : Character;
Char2 : Character);
-- Same as above, but no indication if character is loaded
procedure Load_Digits
(File : File_Type;
Buf : out String;
Ptr : in out Integer;
Loaded : out Boolean);
-- Loads a sequence of zero or more decimal digits. Loaded is set if
-- at least one digit is loaded.
procedure Load_Digits
(File : File_Type;
Buf : out String;
Ptr : in out Integer);
-- Same as above, but no indication if character is loaded
procedure Load_Extended_Digits
(File : File_Type;
Buf : out String;
Ptr : in out Integer;
Loaded : out Boolean);
-- Like Load_Digits, but also allows extended digits a-f and A-F
procedure Load_Extended_Digits
(File : File_Type;
Buf : out String;
Ptr : in out Integer);
-- Same as above, but no indication if character is loaded
procedure Put_Item (File : File_Type; Str : String);
-- This routine is like Wide_Text_IO.Put, except that it checks for
-- overflow of bounded lines, as described in (RM A.10.6(8)). It is used
-- for all output of numeric values and of enumeration values. Note that
-- the buffer is of type String. Put_Item deals with converting this to
-- Wide_Characters as required.
procedure Store_Char
(File : File_Type;
ch : Integer;
Buf : out String;
Ptr : in out Integer);
-- Store a single character in buffer, checking for overflow and
-- adjusting the column number in the file to reflect the fact
-- that a character has been acquired from the input stream.
-- The pos value of the character to store is in ch on entry.
procedure String_Skip (Str : String; Ptr : out Integer);
-- Used in the Get from string procedures to skip leading blanks in the
-- string. Ptr is set to the index of the first non-blank. If the string
-- is all blanks, then the excption End_Error is raised, Note that blank
-- is defined as a space or horizontal tab (RM A.10.6(5)).
procedure Ungetc (ch : Integer; File : File_Type);
-- Pushes back character into stream, using ungetc. The caller has
-- checked that the file is in read status. Device_Error is raised
-- if the character cannot be pushed back. An attempt to push back
-- an end of file (EOF) is ignored.
private
pragma Inline (Is_Blank);
end Ada.Wide_Text_IO.Generic_Aux;
|
with HAL; use HAL;
with STM32.GPIO; use STM32.GPIO;
with STM32.ADC; use STM32.ADC;
with STM_Board; use STM_Board;
package Inverter_ADC is
-- Performs analog to digital conversions in a timed manner.
-- The timer starts ADC conversions and, at the end of conversion, it
-- produces an interrupt that actualizes the buffer of ADC values and
-- corrects the duty cycle for variations in battery voltage.
Sensor_Frequency_Hz : constant := 5_000;
-- Timer PWM frequency that controls start of ADC convertion.
subtype Voltage is Float;
-- Represents an electric measure.
ADC_Vref : constant Voltage := 3.3;
-- ADC full scale voltage.
Battery_V : constant Voltage := 12.0;
-- Battery nominal voltage.
subtype Battery_V_Range is Voltage range (Battery_V * 0.8) .. (Battery_V * 1.2);
-- Battery voltage tolerance is Battery_V ± 20%.
Battery_Relation : Float := 10_000.0 / 90_900.0; -- 10 kΩ / 90.9 kΩ
-- Resistive relation between the measured ADC input and the battery
-- voltage. This depends on the electronic circuitry.
Inverter_Power : constant Voltage := 300.0;
-- Inverter nominal electric power.
Battery_I : constant Voltage := Inverter_Power / Battery_V_Range'First;
-- Battery nominal current with maximum inverter power and
-- minimum battery voltage.
subtype Battery_I_Range is Voltage range 0.0 .. (Battery_I * 1.1);
-- Battery current tolerance is Battery_I + 10%.
Output_V : constant Voltage := 220.0;
-- AC output RMS voltage.
subtype Output_V_Range is Voltage range (Output_V * 0.9) .. (Output_V * 1.1);
-- AC ouput voltage tolerance is Output_V ± 10%.
Output_Relation : Float := 10_000.0 / 90_900.0; -- 10 kΩ / 90.9 kΩ
-- Resistive relation between the measured ADC input and the AC output
-- voltage. This depends on the electronic circuitry.
type ADC_Reading is
(V_Battery, I_Battery, V_Output);
-- Specifies the available readings.
procedure Initialize_ADC;
-- Initialize the ADCs.
function Get_Sample (Reading : in ADC_Reading) return Voltage
with
Pre => Is_Initialized;
-- Get the specified ADC reading.
subtype Gain_Range is Float range 0.0 .. 1.0;
-- For correcting battery voltage and AC output variation.
Sine_Gain : Gain_Range := 0.0;
function Battery_Gain
(V_Setpoint : Battery_V_Range := Battery_V_Range'First;
V_Actual : Voltage := Get_Sample (V_Battery)) return Gain_Range;
-- Calculate the gain of the sinusoid as a function of the
-- battery voltage.
function Test_V_Battery return Boolean
with
Pre => Is_Initialized;
-- Test if battery voltage is between maximum and minimum.
function Test_I_Battery return Boolean
with
Pre => Is_Initialized;
-- Test if battery current is below maximum.
function Test_V_Output return Boolean
with
Pre => Is_Initialized;
-- Test if output voltage is between maximum and minimum.
function Is_Initialized return Boolean;
private
Initialized : Boolean := False;
ADC_V_Per_Lsb : constant Float := ADC_Vref / 4_095.0; -- 12 bit
type Regular_Samples_Array is array (ADC_Reading'Range) of UInt16;
for Regular_Samples_Array'Component_Size use 16;
Regular_Samples : Regular_Samples_Array := (others => 0) with Volatile;
type ADC_Settings is record
GPIO_Entry : GPIO_Point;
ADC_Entry : ADC_Point;
Channel_Rank : Regular_Channel_Rank;
end record;
type ADC_Readings is array (ADC_Reading'Range) of ADC_Settings;
ADC_Reading_Settings : constant ADC_Readings :=
((V_Battery) => (GPIO_Entry => ADC_Battery_V_Pin,
ADC_Entry => ADC_Battery_V_Point,
Channel_Rank => 1),
(I_Battery) => (GPIO_Entry => ADC_Battery_I_Pin,
ADC_Entry => ADC_Battery_I_Point,
Channel_Rank => 2),
(V_Output) => (GPIO_Entry => ADC_Output_V_Pin,
ADC_Entry => ADC_Output_V_Point,
Channel_Rank => 3));
protected Sensor_Handler is
pragma Interrupt_Priority (Sensor_ISR_Priority);
private
Rank : ADC_Reading := ADC_Reading'First;
Counter : Integer := 0;
-- For testing the output.
procedure Sensor_ADC_Handler with
Attach_Handler => Sensor_Interrupt;
end Sensor_Handler;
end Inverter_ADC;
|
with p1; use p1;
package body p2 with SPARK_Mode is
procedure write_to_uart (msg : Byte_Array) with
Global => (Output => some_register)
is
begin
some_register := msg(1);
end;
procedure foo is
begin
write_to_uart(p1.toBytes (some_constant));
end foo;
end p2;
|
with GESTE;
with GESTE.Grid;
pragma Style_Checks (Off);
package Game_Assets.Level_2 is
-- Level_2
Width : constant := 20;
Height : constant := 15;
Tile_Width : constant := 16;
Tile_Height : constant := 16;
-- Back
package Back is
Width : constant := 20;
Height : constant := 20;
Data : aliased GESTE.Grid.Grid_Data :=
(( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 84, 0, 0, 0, 0, 0, 0, 90, 0, 0, 0, 0, 0),
( 0, 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 0, 0, 0, 0, 0, 90, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 0, 0, 0, 86, 86, 86, 86, 86, 86, 86, 86, 86, 0),
( 0, 0, 0, 0, 0, 86, 86, 86, 86, 86, 86, 86, 86, 86, 0),
( 0, 0, 0, 0, 0, 86, 86, 86, 86, 86, 86, 86, 86, 86, 0),
( 0, 0, 0, 0, 0, 86, 86, 86, 86, 86, 86, 86, 86, 86, 0),
( 0, 0, 0, 0, 0, 86, 86, 86, 0, 0, 0, 86, 86, 86, 0),
( 0, 0, 0, 0, 0, 86, 86, 86, 0, 0, 0, 86, 86, 86, 0),
( 0, 0, 0, 0, 0, 86, 86, 86, 86, 90, 86, 86, 86, 86, 0),
( 0, 0, 0, 0, 0, 86, 86, 86, 86, 86, 86, 86, 86, 86, 0),
( 0, 0, 0, 0, 0, 90, 86, 86, 86, 86, 86, 86, 86, 86, 0),
( 0, 0, 0, 0, 90, 0, 86, 86, 86, 86, 86, 86, 90, 0, 0),
( 0, 0, 0, 109, 0, 0, 86, 86, 86, 86, 86, 90, 0, 0, 0),
( 0, 0, 0, 110, 0, 0, 86, 86, 86, 86, 90, 0, 0, 0, 0),
( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) ;
end Back;
-- Mid
package Mid is
Width : constant := 20;
Height : constant := 20;
Data : aliased GESTE.Grid.Grid_Data :=
(( 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, 90, 90, 90, 90),
( 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, 90, 90, 90, 90),
( 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, 90, 90, 90, 90),
( 0, 0, 0, 0, 0, 0, 0, 91, 99, 111, 90, 90, 90, 90, 90),
( 0, 0, 0, 0, 0, 0, 0, 89, 90, 90, 90, 90, 90, 90, 90),
( 0, 0, 0, 0, 0, 91, 99, 111, 90, 90, 90, 90, 90, 90, 90),
( 0, 0, 0, 0, 0, 92, 93, 93, 93, 93, 93, 93, 93, 93, 90),
( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 90),
( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 90),
( 0, 0, 0, 0, 0, 112, 113, 113, 99, 99, 99, 114, 0, 0, 90),
( 0, 0, 0, 0, 0, 111, 0, 0, 89, 90, 90, 115, 0, 0, 90),
( 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, 90, 116, 0, 0, 90),
( 0, 0, 0, 0, 0, 0, 0, 0, 92, 117, 116, 0, 0, 0, 90),
( 0, 0, 0, 0, 0, 118, 0, 0, 0, 119, 0, 0, 0, 0, 90),
( 0, 0, 0, 0, 91, 111, 120, 0, 0, 0, 0, 0, 91, 99, 90),
( 0, 0, 0, 91, 111, 90, 115, 0, 0, 0, 0, 91, 111, 90, 90),
( 0, 0, 0, 89, 90, 90, 115, 0, 0, 0, 91, 111, 90, 90, 90),
( 0, 0, 0, 89, 90, 90, 90, 99, 99, 99, 111, 90, 90, 90, 90),
( 0, 0, 0, 89, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90),
( 0, 0, 0, 89, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90)) ;
end Mid;
-- Front
package Front is
Width : constant := 20;
Height : constant := 20;
Data : aliased GESTE.Grid.Grid_Data :=
(( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 121, 0),
( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 0),
( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) ;
end Front;
end Game_Assets.Level_2;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- M L I B . T G T. S P E C I F I C --
-- --
-- B o d y --
-- --
-- Copyright (C) 2003-2011, 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 is the bare board version of the body
with Sdefault;
with Types; use Types;
package body MLib.Tgt.Specific is
-----------------------
-- Local Subprograms --
-----------------------
function Get_Target_Prefix return String;
-- Returns the required prefix for some utilities
-- (such as ar and ranlib) that depend on the real target.
-- Non default subprograms
function Archive_Builder return String;
function Archive_Indexer return String;
procedure Build_Dynamic_Library
(Ofiles : Argument_List;
Options : Argument_List;
Interfaces : Argument_List;
Lib_Filename : String;
Lib_Dir : String;
Symbol_Data : Symbol_Record;
Driver_Name : Name_Id := No_Name;
Lib_Version : String := "";
Auto_Init : Boolean := False);
function DLL_Ext return String;
function Dynamic_Option return String;
function Library_Major_Minor_Id_Supported return Boolean;
function PIC_Option return String;
function Standalone_Library_Auto_Init_Is_Supported return Boolean;
function Support_For_Libraries return Library_Support;
---------------------
-- Archive_Builder --
---------------------
function Archive_Builder return String is
begin
return Get_Target_Prefix & "ar";
end Archive_Builder;
---------------------
-- Archive_Indexer --
---------------------
function Archive_Indexer return String is
begin
return Get_Target_Prefix & "ranlib";
end Archive_Indexer;
---------------------------
-- Build_Dynamic_Library --
---------------------------
procedure Build_Dynamic_Library
(Ofiles : Argument_List;
Options : Argument_List;
Interfaces : Argument_List;
Lib_Filename : String;
Lib_Dir : String;
Symbol_Data : Symbol_Record;
Driver_Name : Name_Id := No_Name;
Lib_Version : String := "";
Auto_Init : Boolean := False)
is
pragma Unreferenced (Ofiles);
pragma Unreferenced (Options);
pragma Unreferenced (Interfaces);
pragma Unreferenced (Lib_Filename);
pragma Unreferenced (Lib_Dir);
pragma Unreferenced (Symbol_Data);
pragma Unreferenced (Driver_Name);
pragma Unreferenced (Lib_Version);
pragma Unreferenced (Auto_Init);
begin
null;
end Build_Dynamic_Library;
-------------
-- DLL_Ext --
-------------
function DLL_Ext return String is
begin
return "";
end DLL_Ext;
--------------------
-- Dynamic_Option --
--------------------
function Dynamic_Option return String is
begin
return "";
end Dynamic_Option;
-----------------------
-- Get_Target_Prefix --
-----------------------
function Get_Target_Prefix return String is
Target_Name : constant String_Ptr := Sdefault.Target_Name;
begin
-- Target_name is the program prefix without '-' but with a trailing '/'
return Target_Name (Target_Name'First .. Target_Name'Last - 1) & '-';
end Get_Target_Prefix;
--------------------------------------
-- Library_Major_Minor_Id_Supported --
--------------------------------------
function Library_Major_Minor_Id_Supported return Boolean is
begin
return False;
end Library_Major_Minor_Id_Supported;
----------------
-- PIC_Option --
----------------
function PIC_Option return String is
begin
return "";
end PIC_Option;
-----------------------------------------------
-- Standalone_Library_Auto_Init_Is_Supported --
-----------------------------------------------
function Standalone_Library_Auto_Init_Is_Supported return Boolean is
begin
return False;
end Standalone_Library_Auto_Init_Is_Supported;
---------------------------
-- Support_For_Libraries --
---------------------------
function Support_For_Libraries return Library_Support is
begin
return Static_Only;
end Support_For_Libraries;
begin
Archive_Builder_Ptr := Archive_Builder'Access;
Archive_Indexer_Ptr := Archive_Indexer'Access;
Build_Dynamic_Library_Ptr := Build_Dynamic_Library'Access;
DLL_Ext_Ptr := DLL_Ext'Access;
Dynamic_Option_Ptr := Dynamic_Option'Access;
Library_Major_Minor_Id_Supported_Ptr :=
Library_Major_Minor_Id_Supported'Access;
PIC_Option_Ptr := PIC_Option'Access;
Standalone_Library_Auto_Init_Is_Supported_Ptr :=
Standalone_Library_Auto_Init_Is_Supported'Access;
Support_For_Libraries_Ptr := Support_For_Libraries'Access;
end MLib.Tgt.Specific;
|
-----------------------------------------------------------------------
-- AWA.Events.Models -- AWA.Events.Models
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-spec.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095
-----------------------------------------------------------------------
-- Copyright (C) 2013 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
pragma Warnings (Off, "unit * is not referenced");
with ADO.Sessions;
with ADO.Objects;
with ADO.Statements;
with ADO.SQL;
with ADO.Schemas;
with ADO.Queries;
with ADO.Queries.Loaders;
with Ada.Calendar;
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded;
with Util.Beans.Objects;
with Util.Beans.Objects.Enums;
with Util.Beans.Basic.Lists;
with AWA.Users.Models;
pragma Warnings (On, "unit * is not referenced");
package AWA.Events.Models is
type Message_Status_Type is (QUEUED, PROCESSING, PROCESSED);
for Message_Status_Type use (QUEUED => 0, PROCESSING => 1, PROCESSED => 2);
package Message_Status_Type_Objects is
new Util.Beans.Objects.Enums (Message_Status_Type);
type Message_Type_Ref is new ADO.Objects.Object_Ref with null record;
type Queue_Ref is new ADO.Objects.Object_Ref with null record;
type Message_Ref is new ADO.Objects.Object_Ref with null record;
-- Create an object key for Message_Type.
function Message_Type_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Message_Type from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Message_Type_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Message_Type : constant Message_Type_Ref;
function "=" (Left, Right : Message_Type_Ref'Class) return Boolean;
--
procedure Set_Id (Object : in out Message_Type_Ref;
Value : in ADO.Identifier);
--
function Get_Id (Object : in Message_Type_Ref)
return ADO.Identifier;
-- Set the message type name
procedure Set_Name (Object : in out Message_Type_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Name (Object : in out Message_Type_Ref;
Value : in String);
-- Get the message type name
function Get_Name (Object : in Message_Type_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Name (Object : in Message_Type_Ref)
return String;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Message_Type_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Message_Type_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Message_Type_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Message_Type_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Message_Type_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Message_Type_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
MESSAGE_TYPE_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Message_Type_Ref);
-- Copy of the object.
procedure Copy (Object : in Message_Type_Ref;
Into : in out Message_Type_Ref);
package Message_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Natural,
Element_Type => Message_Type_Ref,
"=" => "=");
subtype Message_Type_Vector is Message_Type_Vectors.Vector;
procedure List (Object : in out Message_Type_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class);
-- --------------------
-- The message queue tracks the event messages that must be dispatched by
-- a given server.
-- --------------------
-- Create an object key for Queue.
function Queue_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Queue from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Queue_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Queue : constant Queue_Ref;
function "=" (Left, Right : Queue_Ref'Class) return Boolean;
--
procedure Set_Id (Object : in out Queue_Ref;
Value : in ADO.Identifier);
--
function Get_Id (Object : in Queue_Ref)
return ADO.Identifier;
--
procedure Set_Server_Id (Object : in out Queue_Ref;
Value : in Integer);
--
function Get_Server_Id (Object : in Queue_Ref)
return Integer;
-- Set the message queue name
procedure Set_Name (Object : in out Queue_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Name (Object : in out Queue_Ref;
Value : in String);
-- Get the message queue name
function Get_Name (Object : in Queue_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Name (Object : in Queue_Ref)
return String;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Queue_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Queue_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Queue_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Queue_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Queue_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Queue_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
QUEUE_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Queue_Ref);
-- Copy of the object.
procedure Copy (Object : in Queue_Ref;
Into : in out Queue_Ref);
-- Create an object key for Message.
function Message_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Message from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Message_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Message : constant Message_Ref;
function "=" (Left, Right : Message_Ref'Class) return Boolean;
-- Set the message identifier
procedure Set_Id (Object : in out Message_Ref;
Value : in ADO.Identifier);
-- Get the message identifier
function Get_Id (Object : in Message_Ref)
return ADO.Identifier;
-- Set the message creation date
procedure Set_Create_Date (Object : in out Message_Ref;
Value : in Ada.Calendar.Time);
-- Get the message creation date
function Get_Create_Date (Object : in Message_Ref)
return Ada.Calendar.Time;
-- Set the message priority
procedure Set_Priority (Object : in out Message_Ref;
Value : in Integer);
-- Get the message priority
function Get_Priority (Object : in Message_Ref)
return Integer;
-- Set the message count
procedure Set_Count (Object : in out Message_Ref;
Value : in Integer);
-- Get the message count
function Get_Count (Object : in Message_Ref)
return Integer;
-- Set the message parameters
procedure Set_Parameters (Object : in out Message_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Parameters (Object : in out Message_Ref;
Value : in String);
-- Get the message parameters
function Get_Parameters (Object : in Message_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Parameters (Object : in Message_Ref)
return String;
-- Set the server identifier which processes the message
procedure Set_Server_Id (Object : in out Message_Ref;
Value : in Integer);
-- Get the server identifier which processes the message
function Get_Server_Id (Object : in Message_Ref)
return Integer;
-- Set the task identfier on the server which processes the message
procedure Set_Task_Id (Object : in out Message_Ref;
Value : in Integer);
-- Get the task identfier on the server which processes the message
function Get_Task_Id (Object : in Message_Ref)
return Integer;
-- Set the message status
procedure Set_Status (Object : in out Message_Ref;
Value : in AWA.Events.Models.Message_Status_Type);
-- Get the message status
function Get_Status (Object : in Message_Ref)
return AWA.Events.Models.Message_Status_Type;
-- Set the message processing date
procedure Set_Processing_Date (Object : in out Message_Ref;
Value : in ADO.Nullable_Time);
-- Get the message processing date
function Get_Processing_Date (Object : in Message_Ref)
return ADO.Nullable_Time;
--
function Get_Version (Object : in Message_Ref)
return Integer;
-- Set the entity identifier to which this event is associated.
procedure Set_Entity_Id (Object : in out Message_Ref;
Value : in ADO.Identifier);
-- Get the entity identifier to which this event is associated.
function Get_Entity_Id (Object : in Message_Ref)
return ADO.Identifier;
-- Set the entity type of the entity identifier to which this event is associated.
procedure Set_Entity_Type (Object : in out Message_Ref;
Value : in ADO.Entity_Type);
-- Get the entity type of the entity identifier to which this event is associated.
function Get_Entity_Type (Object : in Message_Ref)
return ADO.Entity_Type;
-- Set the date and time when the event was finished to be processed.
procedure Set_Finish_Date (Object : in out Message_Ref;
Value : in ADO.Nullable_Time);
-- Get the date and time when the event was finished to be processed.
function Get_Finish_Date (Object : in Message_Ref)
return ADO.Nullable_Time;
--
procedure Set_Queue (Object : in out Message_Ref;
Value : in AWA.Events.Models.Queue_Ref'Class);
--
function Get_Queue (Object : in Message_Ref)
return AWA.Events.Models.Queue_Ref'Class;
-- Set the message type
procedure Set_Message_Type (Object : in out Message_Ref;
Value : in AWA.Events.Models.Message_Type_Ref'Class);
-- Get the message type
function Get_Message_Type (Object : in Message_Ref)
return AWA.Events.Models.Message_Type_Ref'Class;
-- Set the optional user who triggered the event message creation
procedure Set_User (Object : in out Message_Ref;
Value : in AWA.Users.Models.User_Ref'Class);
-- Get the optional user who triggered the event message creation
function Get_User (Object : in Message_Ref)
return AWA.Users.Models.User_Ref'Class;
-- Set the optional user session that triggered the message creation
procedure Set_Session (Object : in out Message_Ref;
Value : in AWA.Users.Models.Session_Ref'Class);
-- Get the optional user session that triggered the message creation
function Get_Session (Object : in Message_Ref)
return AWA.Users.Models.Session_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Message_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Message_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Message_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Message_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Message_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Message_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
MESSAGE_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Message_Ref);
-- Copy of the object.
procedure Copy (Object : in Message_Ref;
Into : in out Message_Ref);
package Message_Vectors is
new Ada.Containers.Vectors (Index_Type => Natural,
Element_Type => Message_Ref,
"=" => "=");
subtype Message_Vector is Message_Vectors.Vector;
procedure List (Object : in out Message_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class);
Query_Queue_Pending_Message : constant ADO.Queries.Query_Definition_Access;
private
MESSAGE_TYPE_NAME : aliased constant String := "awa_message_type";
COL_0_1_NAME : aliased constant String := "id";
COL_1_1_NAME : aliased constant String := "name";
MESSAGE_TYPE_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 2,
Table => MESSAGE_TYPE_NAME'Access,
Members => (
1 => COL_0_1_NAME'Access,
2 => COL_1_1_NAME'Access
)
);
MESSAGE_TYPE_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= MESSAGE_TYPE_DEF'Access;
Null_Message_Type : constant Message_Type_Ref
:= Message_Type_Ref'(ADO.Objects.Object_Ref with others => <>);
type Message_Type_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => MESSAGE_TYPE_DEF'Access)
with record
Name : Ada.Strings.Unbounded.Unbounded_String;
end record;
type Message_Type_Access is access all Message_Type_Impl;
overriding
procedure Destroy (Object : access Message_Type_Impl);
overriding
procedure Find (Object : in out Message_Type_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Message_Type_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Message_Type_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Message_Type_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Message_Type_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Message_Type_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Message_Type_Ref'Class;
Impl : out Message_Type_Access);
QUEUE_NAME : aliased constant String := "awa_queue";
COL_0_2_NAME : aliased constant String := "id";
COL_1_2_NAME : aliased constant String := "server_id";
COL_2_2_NAME : aliased constant String := "name";
QUEUE_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 3,
Table => QUEUE_NAME'Access,
Members => (
1 => COL_0_2_NAME'Access,
2 => COL_1_2_NAME'Access,
3 => COL_2_2_NAME'Access
)
);
QUEUE_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= QUEUE_DEF'Access;
Null_Queue : constant Queue_Ref
:= Queue_Ref'(ADO.Objects.Object_Ref with others => <>);
type Queue_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => QUEUE_DEF'Access)
with record
Server_Id : Integer;
Name : Ada.Strings.Unbounded.Unbounded_String;
end record;
type Queue_Access is access all Queue_Impl;
overriding
procedure Destroy (Object : access Queue_Impl);
overriding
procedure Find (Object : in out Queue_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Queue_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Queue_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Queue_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Queue_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Queue_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Queue_Ref'Class;
Impl : out Queue_Access);
MESSAGE_NAME : aliased constant String := "awa_message";
COL_0_3_NAME : aliased constant String := "id";
COL_1_3_NAME : aliased constant String := "create_date";
COL_2_3_NAME : aliased constant String := "priority";
COL_3_3_NAME : aliased constant String := "count";
COL_4_3_NAME : aliased constant String := "parameters";
COL_5_3_NAME : aliased constant String := "server_id";
COL_6_3_NAME : aliased constant String := "task_id";
COL_7_3_NAME : aliased constant String := "status";
COL_8_3_NAME : aliased constant String := "processing_date";
COL_9_3_NAME : aliased constant String := "version";
COL_10_3_NAME : aliased constant String := "entity_id";
COL_11_3_NAME : aliased constant String := "entity_type";
COL_12_3_NAME : aliased constant String := "finish_date";
COL_13_3_NAME : aliased constant String := "queue_id";
COL_14_3_NAME : aliased constant String := "message_type_id";
COL_15_3_NAME : aliased constant String := "user_id";
COL_16_3_NAME : aliased constant String := "session_id";
MESSAGE_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 17,
Table => MESSAGE_NAME'Access,
Members => (
1 => COL_0_3_NAME'Access,
2 => COL_1_3_NAME'Access,
3 => COL_2_3_NAME'Access,
4 => COL_3_3_NAME'Access,
5 => COL_4_3_NAME'Access,
6 => COL_5_3_NAME'Access,
7 => COL_6_3_NAME'Access,
8 => COL_7_3_NAME'Access,
9 => COL_8_3_NAME'Access,
10 => COL_9_3_NAME'Access,
11 => COL_10_3_NAME'Access,
12 => COL_11_3_NAME'Access,
13 => COL_12_3_NAME'Access,
14 => COL_13_3_NAME'Access,
15 => COL_14_3_NAME'Access,
16 => COL_15_3_NAME'Access,
17 => COL_16_3_NAME'Access
)
);
MESSAGE_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= MESSAGE_DEF'Access;
Null_Message : constant Message_Ref
:= Message_Ref'(ADO.Objects.Object_Ref with others => <>);
type Message_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => MESSAGE_DEF'Access)
with record
Create_Date : Ada.Calendar.Time;
Priority : Integer;
Count : Integer;
Parameters : Ada.Strings.Unbounded.Unbounded_String;
Server_Id : Integer;
Task_Id : Integer;
Status : AWA.Events.Models.Message_Status_Type;
Processing_Date : ADO.Nullable_Time;
Version : Integer;
Entity_Id : ADO.Identifier;
Entity_Type : ADO.Entity_Type;
Finish_Date : ADO.Nullable_Time;
Queue : AWA.Events.Models.Queue_Ref;
Message_Type : AWA.Events.Models.Message_Type_Ref;
User : AWA.Users.Models.User_Ref;
Session : AWA.Users.Models.Session_Ref;
end record;
type Message_Access is access all Message_Impl;
overriding
procedure Destroy (Object : access Message_Impl);
overriding
procedure Find (Object : in out Message_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Message_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Message_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Message_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Create (Object : in out Message_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Message_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Message_Ref'Class;
Impl : out Message_Access);
package File_1 is
new ADO.Queries.Loaders.File (Path => "queue-messages.xml",
Sha1 => "9B2B599473F75F92CB5AB5045675E4CCEF926543");
package Def_Queue_Pending_Message is
new ADO.Queries.Loaders.Query (Name => "queue-pending-message",
File => File_1.File'Access);
Query_Queue_Pending_Message : constant ADO.Queries.Query_Definition_Access
:= Def_Queue_Pending_Message.Query'Access;
end AWA.Events.Models;
|
<Diagramm>
<Colors>
<Anzahl>23</Anzahl>
<Color0>
<B>255</B>
<G>0</G>
<Name>blau</Name>
<R>0</R>
</Color0>
<Color1>
<B>221</B>
<G>212</G>
<Name>blaugrau</Name>
<R>175</R>
</Color1>
<Color10>
<B>192</B>
<G>192</G>
<Name>hellgrau</Name>
<R>192</R>
</Color10>
<Color11>
<B>255</B>
<G>0</G>
<Name>kamesinrot</Name>
<R>255</R>
</Color11>
<Color12>
<B>0</B>
<G>200</G>
<Name>orange</Name>
<R>255</R>
</Color12>
<Color13>
<B>255</B>
<G>247</G>
<Name>pastell-blau</Name>
<R>211</R>
</Color13>
<Color14>
<B>186</B>
<G>245</G>
<Name>pastell-gelb</Name>
<R>255</R>
</Color14>
<Color15>
<B>234</B>
<G>255</G>
<Name>pastell-gr&uuml;n</Name>
<R>211</R>
</Color15>
<Color16>
<B>255</B>
<G>211</G>
<Name>pastell-lila</Name>
<R>244</R>
</Color16>
<Color17>
<B>191</B>
<G>165</G>
<Name>pastell-rot</Name>
<R>244</R>
</Color17>
<Color18>
<B>175</B>
<G>175</G>
<Name>pink</Name>
<R>255</R>
</Color18>
<Color19>
<B>0</B>
<G>0</G>
<Name>rot</Name>
<R>255</R>
</Color19>
<Color2>
<B>61</B>
<G>125</G>
<Name>braun</Name>
<R>170</R>
</Color2>
<Color20>
<B>0</B>
<G>0</G>
<Name>schwarz</Name>
<R>0</R>
</Color20>
<Color21>
<B>255</B>
<G>255</G>
<Name>t&uuml;rkis</Name>
<R>0</R>
</Color21>
<Color22>
<B>255</B>
<G>255</G>
<Name>wei&szlig;</Name>
<R>255</R>
</Color22>
<Color3>
<B>64</B>
<G>64</G>
<Name>dunkelgrau</Name>
<R>64</R>
</Color3>
<Color4>
<B>84</B>
<G>132</G>
<Name>dunkelgr&uuml;n</Name>
<R>94</R>
</Color4>
<Color5>
<B>0</B>
<G>255</G>
<Name>gelb</Name>
<R>255</R>
</Color5>
<Color6>
<B>0</B>
<G>225</G>
<Name>goldgelb</Name>
<R>255</R>
</Color6>
<Color7>
<B>128</B>
<G>128</G>
<Name>grau</Name>
<R>128</R>
</Color7>
<Color8>
<B>0</B>
<G>255</G>
<Name>gr&uuml;n</Name>
<R>0</R>
</Color8>
<Color9>
<B>255</B>
<G>212</G>
<Name>hellblau</Name>
<R>191</R>
</Color9>
</Colors>
<ComplexIndices>
<IndexCount>0</IndexCount>
</ComplexIndices>
<DataSource>
<Import>
<DBName></DBName>
<Description></Description>
<Domains>false</Domains>
<Driver></Driver>
<Name></Name>
<Referenzen>false</Referenzen>
<User></User>
</Import>
<Update>
<DBMode>MYSQL</DBMode>
<DBName></DBName>
<Description></Description>
<DomainFaehig>false</DomainFaehig>
<Driver></Driver>
<FkNotNullBeachten>false</FkNotNullBeachten>
<Name></Name>
<ReferenzenSetzen>false</ReferenzenSetzen>
<User></User>
</Update>
</DataSource>
<DefaultComment>
<Anzahl>0</Anzahl>
</DefaultComment>
<Domains>
<Anzahl>8</Anzahl>
<Domain0>
<Datatype>12</Datatype>
<History>@changed OLI 01.03.2013 - Added.</History>
<Initialwert>NULL</Initialwert>
<Kommentar>A type to represent account numbers.</Kommentar>
<Length>20</Length>
<NKS>0</NKS>
<Name>AccountNumber</Name>
</Domain0>
<Domain1>
<Datatype>4</Datatype>
<History>@changed OLI 01.03.2013 - Added.</History>
<Initialwert>NULL</Initialwert>
<Kommentar>An amount of cents.</Kommentar>
<Length>0</Length>
<NKS>0</NKS>
<Name>Amount</Name>
</Domain1>
<Domain2>
<Datatype>12</Datatype>
<History>@changed OLI 01.03.2013 - Added.</History>
<Initialwert>NULL</Initialwert>
<Kommentar>A type for bank identification numbers.</Kommentar>
<Length>20</Length>
<NKS>0</NKS>
<Name>BankIdentificationNumber</Name>
</Domain2>
<Domain3>
<Datatype>4</Datatype>
<History>@changed OLI 01.03.2013 - Added.</History>
<Initialwert>NULL</Initialwert>
<Kommentar>A type to represent boolean values.</Kommentar>
<Length>0</Length>
<NKS>0</NKS>
<Name>Boolean</Name>
</Domain3>
<Domain4>
<Datatype>4</Datatype>
<History>@changed OLI 01.03.2013 - Added.</History>
<Initialwert>NULL</Initialwert>
<Kommentar>A domain for primary keys.</Kommentar>
<Length>0</Length>
<NKS>0</NKS>
<Name>Ident</Name>
</Domain4>
<Domain5>
<Datatype>12</Datatype>
<History>@changed OLI 01.03.2013 - Added.</History>
<Initialwert>NULL</Initialwert>
<Kommentar>A domain for names.</Kommentar>
<Length>100</Length>
<NKS>0</NKS>
<Name>Name</Name>
</Domain5>
<Domain6>
<Datatype>12</Datatype>
<History>SEMSTRAL, </History>
<Initialwert>NULL</Initialwert>
<Kommentar>A type for periode enum representations (YEAR, SEMESTRAL, QUARTER, MONTH).</Kommentar>
<Length>10</Length>
<NKS>0</NKS>
<Name>Periode</Name>
</Domain6>
<Domain7>
<Datatype>12</Datatype>
<History>@changed OLI 01.03.2013 - Added.</History>
<Initialwert>NULL</Initialwert>
<Kommentar>A domain for reasons of payment.</Kommentar>
<Length>255</Length>
<NKS>0</NKS>
<Name>ReasonOfPayment</Name>
</Domain7>
</Domains>
<Factories>
<Object>archimedes.legacy.scheme.DefaultObjectFactory</Object>
</Factories>
<Pages>
<PerColumn>5</PerColumn>
<PerRow>10</PerRow>
</Pages>
<Parameter>
<AdditionalSQLScriptListener></AdditionalSQLScriptListener>
<Applicationname>Kroisos</Applicationname>
<AufgehobeneAusblenden>false</AufgehobeneAusblenden>
<Autor>ollie</Autor>
<Basepackagename>kroisos</Basepackagename>
<CodeFactoryClassName></CodeFactoryClassName>
<Codebasispfad>.\</Codebasispfad>
<DBVersionDBVersionColumn></DBVersionDBVersionColumn>
<DBVersionDescriptionColumn></DBVersionDescriptionColumn>
<DBVersionTablename></DBVersionTablename>
<History>@changed OLI 01.03.2013 - Added.</History>
<Kommentar>The model of the Kroisos application.</Kommentar>
<Name>Kroisos</Name>
<PflichtfelderMarkieren>false</PflichtfelderMarkieren>
<ReferenzierteSpaltenAnzeigen>true</ReferenzierteSpaltenAnzeigen>
<SchemaName></SchemaName>
<Schriftgroessen>
<Tabelleninhalte>12</Tabelleninhalte>
<Ueberschriften>24</Ueberschriften>
<Untertitel>12</Untertitel>
</Schriftgroessen>
<Scripte>
<AfterWrite>&lt;null&gt;</AfterWrite>
</Scripte>
<TechnischeFelderAusgrauen>false</TechnischeFelderAusgrauen>
<UdschebtiBaseClassName></UdschebtiBaseClassName>
<Version>1</Version>
<Versionsdatum>01.03.2013</Versionsdatum>
<Versionskommentar>&lt;null&gt;</Versionskommentar>
</Parameter>
<Stereotype>
<Anzahl>0</Anzahl>
</Stereotype>
<Tabellen>
<Anzahl>7</Anzahl>
<Tabelle0>
<Aufgehoben>false</Aufgehoben>
<Codegenerator>
<AuswahlMembers>
<Anzahl>0</Anzahl>
</AuswahlMembers>
<CompareMembers>
<Anzahl>0</Anzahl>
</CompareMembers>
<Equalsmembers>
<Anzahl>0</Anzahl>
</Equalsmembers>
<HashCodeMembers>
<Anzahl>0</Anzahl>
</HashCodeMembers>
<NReferenzen>
<Anzahl>0</Anzahl>
</NReferenzen>
<OrderMembers>
<Anzahl>0</Anzahl>
</OrderMembers>
<ToComboStringMembers>
<Anzahl>0</Anzahl>
</ToComboStringMembers>
<ToStringMembers>
<Anzahl>0</Anzahl>
</ToStringMembers>
</Codegenerator>
<Farben>
<Hintergrund>pastell-blau</Hintergrund>
<Schrift>schwarz</Schrift>
</Farben>
<FirstGenerationDone>false</FirstGenerationDone>
<History>@changed OLI 01.03.2013 - Added.</History>
<InDevelopment>false</InDevelopment>
<Kommentar>A representation of accounts.</Kommentar>
<NMRelation>false</NMRelation>
<Name>Account</Name>
<Panels>
<Anzahl>1</Anzahl>
<Panel0>
<PanelClass></PanelClass>
<PanelNumber>0</PanelNumber>
<TabMnemonic>1</TabMnemonic>
<TabTitle>1.Daten</TabTitle>
<TabToolTipText>Hier können Sie die Daten des Objekt warten</TabToolTipText>
</Panel0>
</Panels>
<Spalten>
<Anzahl>5</Anzahl>
<Codegenerator>
<ActiveInApplication>false</ActiveInApplication>
<Codegeneratoroptionen></Codegeneratoroptionen>
<Codeverzeichnis>.</Codeverzeichnis>
<Codieren>true</Codieren>
<DynamicCode>true</DynamicCode>
<Inherited>false</Inherited>
<Kontextname></Kontextname>
<UniqueFormula></UniqueFormula>
</Codegenerator>
<Spalte0>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>true</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Ident</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI 01.03.2013 - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar>The key of the account.</Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>Id</Name>
<NotNull>false</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>true</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte0>
<Spalte1>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Ident</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>true</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History></History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar></Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>Bank</Name>
<NotNull>true</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>false</PrimaryKey>
<Referenz>
<Direction0>RIGHT</Direction0>
<Direction1>LEFT</Direction1>
<Offset0>150</Offset0>
<Offset1>25</Offset1>
<Punkte>
<Anzahl>0</Anzahl>
</Punkte>
<Spalte>Id</Spalte>
<Tabelle>Bank</Tabelle>
<Views>
<Anzahl>1</Anzahl>
<View0>
<Direction0>RIGHT</Direction0>
<Direction1>LEFT</Direction1>
<Name>Main</Name>
<Offset0>150</Offset0>
<Offset1>25</Offset1>
<Punkte>
<Anzahl>0</Anzahl>
</Punkte>
</View0>
</Views>
</Referenz>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte1>
<Spalte2>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Ident</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>true</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History></History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar></Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>Owner</Name>
<NotNull>true</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>false</PrimaryKey>
<Referenz>
<Direction0>RIGHT</Direction0>
<Direction1>LEFT</Direction1>
<Offset0>25</Offset0>
<Offset1>25</Offset1>
<Punkte>
<Anzahl>0</Anzahl>
</Punkte>
<Spalte>Id</Spalte>
<Tabelle>Owner</Tabelle>
<Views>
<Anzahl>1</Anzahl>
<View0>
<Direction0>RIGHT</Direction0>
<Direction1>LEFT</Direction1>
<Name>Main</Name>
<Offset0>25</Offset0>
<Offset1>25</Offset1>
<Punkte>
<Anzahl>0</Anzahl>
</Punkte>
</View0>
</Views>
</Referenz>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte2>
<Spalte3>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Name</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI 01.03.2013 - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar>A name for the account.</Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>AccountName</Name>
<NotNull>false</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>false</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte3>
<Spalte4>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>AccountNumber</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI 01.03.2013 - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar>The account number.</Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>AccountNumber</Name>
<NotNull>false</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>false</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte4>
</Spalten>
<Stereotype>
<Anzahl>0</Anzahl>
</Stereotype>
<Views>
<Anzahl>1</Anzahl>
<View0>
<Name>Main</Name>
<X>100</X>
<Y>100</Y>
</View0>
</Views>
</Tabelle0>
<Tabelle1>
<Aufgehoben>false</Aufgehoben>
<Codegenerator>
<AuswahlMembers>
<Anzahl>0</Anzahl>
</AuswahlMembers>
<CompareMembers>
<Anzahl>0</Anzahl>
</CompareMembers>
<Equalsmembers>
<Anzahl>0</Anzahl>
</Equalsmembers>
<HashCodeMembers>
<Anzahl>0</Anzahl>
</HashCodeMembers>
<NReferenzen>
<Anzahl>0</Anzahl>
</NReferenzen>
<OrderMembers>
<Anzahl>0</Anzahl>
</OrderMembers>
<ToComboStringMembers>
<Anzahl>0</Anzahl>
</ToComboStringMembers>
<ToStringMembers>
<Anzahl>0</Anzahl>
</ToStringMembers>
</Codegenerator>
<Farben>
<Hintergrund>pastell-rot</Hintergrund>
<Schrift>schwarz</Schrift>
</Farben>
<FirstGenerationDone>false</FirstGenerationDone>
<History></History>
<InDevelopment>false</InDevelopment>
<Kommentar></Kommentar>
<NMRelation>false</NMRelation>
<Name>Bank</Name>
<Panels>
<Anzahl>1</Anzahl>
<Panel0>
<PanelClass></PanelClass>
<PanelNumber>0</PanelNumber>
<TabMnemonic>1</TabMnemonic>
<TabTitle>1.Daten</TabTitle>
<TabToolTipText>Hier können Sie die Daten des Objekt warten</TabToolTipText>
</Panel0>
</Panels>
<Spalten>
<Anzahl>3</Anzahl>
<Codegenerator>
<ActiveInApplication>false</ActiveInApplication>
<Codegeneratoroptionen>LIST: Account</Codegeneratoroptionen>
<Codeverzeichnis>.</Codeverzeichnis>
<Codieren>true</Codieren>
<DynamicCode>true</DynamicCode>
<Inherited>false</Inherited>
<Kontextname></Kontextname>
<UniqueFormula></UniqueFormula>
</Codegenerator>
<Spalte0>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>true</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Ident</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI 01.03.2013 - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar>The key of the bank.</Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>Id</Name>
<NotNull>false</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>true</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte0>
<Spalte1>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>BankIdentificationNumber</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History></History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar></Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>BankIdentificationNumber</Name>
<NotNull>false</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter>NOT-EMPTY</Parameter>
<PrimaryKey>false</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte1>
<Spalte2>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Name</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI 01.03.2013 - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar>The name of the bank.</Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>BankName</Name>
<NotNull>false</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter>NOT-EMPTY</Parameter>
<PrimaryKey>false</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte2>
</Spalten>
<Stereotype>
<Anzahl>0</Anzahl>
</Stereotype>
<Views>
<Anzahl>1</Anzahl>
<View0>
<Name>Main</Name>
<X>525</X>
<Y>225</Y>
</View0>
</Views>
</Tabelle1>
<Tabelle2>
<Aufgehoben>false</Aufgehoben>
<Codegenerator>
<AuswahlMembers>
<Anzahl>0</Anzahl>
</AuswahlMembers>
<CompareMembers>
<Anzahl>0</Anzahl>
</CompareMembers>
<Equalsmembers>
<Anzahl>0</Anzahl>
</Equalsmembers>
<HashCodeMembers>
<Anzahl>0</Anzahl>
</HashCodeMembers>
<NReferenzen>
<Anzahl>0</Anzahl>
</NReferenzen>
<OrderMembers>
<Anzahl>0</Anzahl>
</OrderMembers>
<ToComboStringMembers>
<Anzahl>0</Anzahl>
</ToComboStringMembers>
<ToStringMembers>
<Anzahl>0</Anzahl>
</ToStringMembers>
</Codegenerator>
<Farben>
<Hintergrund>goldgelb</Hintergrund>
<Schrift>schwarz</Schrift>
</Farben>
<FirstGenerationDone>false</FirstGenerationDone>
<History>@changed OLI 01.03.2013 - Added.</History>
<InDevelopment>false</InDevelopment>
<Kommentar>The representation of account owners.</Kommentar>
<NMRelation>false</NMRelation>
<Name>Owner</Name>
<Panels>
<Anzahl>1</Anzahl>
<Panel0>
<PanelClass></PanelClass>
<PanelNumber>0</PanelNumber>
<TabMnemonic>1</TabMnemonic>
<TabTitle>1.Daten</TabTitle>
<TabToolTipText>Hier können Sie die Daten des Objekt warten</TabToolTipText>
</Panel0>
</Panels>
<Spalten>
<Anzahl>3</Anzahl>
<Codegenerator>
<ActiveInApplication>false</ActiveInApplication>
<Codegeneratoroptionen>LIST: Account</Codegeneratoroptionen>
<Codeverzeichnis>.</Codeverzeichnis>
<Codieren>true</Codieren>
<DynamicCode>true</DynamicCode>
<Inherited>false</Inherited>
<Kontextname></Kontextname>
<UniqueFormula></UniqueFormula>
</Codegenerator>
<Spalte0>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>true</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Ident</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI 01.03.2013 - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar>The id of the owner.</Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>Id</Name>
<NotNull>false</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>true</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte0>
<Spalte1>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Name</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI 01.03.2013 - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar>The first name of the owner.</Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>FirstName</Name>
<NotNull>false</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>false</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte1>
<Spalte2>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Name</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI 01.03.2013 - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar>The last name of the owner.</Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>LastName</Name>
<NotNull>false</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>false</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte2>
</Spalten>
<Stereotype>
<Anzahl>0</Anzahl>
</Stereotype>
<Views>
<Anzahl>1</Anzahl>
<View0>
<Name>Main</Name>
<X>525</X>
<Y>100</Y>
</View0>
</Views>
</Tabelle2>
<Tabelle3>
<Aufgehoben>false</Aufgehoben>
<Codegenerator>
<AuswahlMembers>
<Anzahl>0</Anzahl>
</AuswahlMembers>
<CompareMembers>
<Anzahl>0</Anzahl>
</CompareMembers>
<Equalsmembers>
<Anzahl>0</Anzahl>
</Equalsmembers>
<HashCodeMembers>
<Anzahl>0</Anzahl>
</HashCodeMembers>
<NReferenzen>
<Anzahl>0</Anzahl>
</NReferenzen>
<OrderMembers>
<Anzahl>0</Anzahl>
</OrderMembers>
<ToComboStringMembers>
<Anzahl>0</Anzahl>
</ToComboStringMembers>
<ToStringMembers>
<Anzahl>0</Anzahl>
</ToStringMembers>
</Codegenerator>
<Farben>
<Hintergrund>hellblau</Hintergrund>
<Schrift>schwarz</Schrift>
</Farben>
<FirstGenerationDone>false</FirstGenerationDone>
<History>@changed OLI 01.03.2013 - Added.</History>
<InDevelopment>false</InDevelopment>
<Kommentar>The representation of the acount entries.</Kommentar>
<NMRelation>false</NMRelation>
<Name>AccountEntry</Name>
<Panels>
<Anzahl>1</Anzahl>
<Panel0>
<PanelClass></PanelClass>
<PanelNumber>0</PanelNumber>
<TabMnemonic>1</TabMnemonic>
<TabTitle>1.Daten</TabTitle>
<TabToolTipText>Hier können Sie die Daten des Objekt warten</TabToolTipText>
</Panel0>
</Panels>
<Spalten>
<Anzahl>5</Anzahl>
<Codegenerator>
<ActiveInApplication>false</ActiveInApplication>
<Codegeneratoroptionen>LIST: BudgetEntry</Codegeneratoroptionen>
<Codeverzeichnis>.</Codeverzeichnis>
<Codieren>true</Codieren>
<DynamicCode>true</DynamicCode>
<Inherited>false</Inherited>
<Kontextname></Kontextname>
<UniqueFormula></UniqueFormula>
</Codegenerator>
<Spalte0>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>true</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Ident</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI 01.03.2013 - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar>The id of the account entry.</Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>Id</Name>
<NotNull>false</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>true</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte0>
<Spalte1>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Ident</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>true</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI 01.03.2013 - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar>The account whose balance is decreased by the account of the entry.</Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>Creadit</Name>
<NotNull>false</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>false</PrimaryKey>
<Referenz>
<Direction0>UP</Direction0>
<Direction1>DOWN</Direction1>
<Offset0>25</Offset0>
<Offset1>25</Offset1>
<Punkte>
<Anzahl>0</Anzahl>
</Punkte>
<Spalte>Id</Spalte>
<Tabelle>Account</Tabelle>
<Views>
<Anzahl>1</Anzahl>
<View0>
<Direction0>UP</Direction0>
<Direction1>DOWN</Direction1>
<Name>Main</Name>
<Offset0>25</Offset0>
<Offset1>25</Offset1>
<Punkte>
<Anzahl>0</Anzahl>
</Punkte>
</View0>
</Views>
</Referenz>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte1>
<Spalte2>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Ident</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>true</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI 01.03.2013 - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar>The account whose balance is increased by the entry.</Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>Debit</Name>
<NotNull>false</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>false</PrimaryKey>
<Referenz>
<Direction0>UP</Direction0>
<Direction1>DOWN</Direction1>
<Offset0>50</Offset0>
<Offset1>50</Offset1>
<Punkte>
<Anzahl>0</Anzahl>
</Punkte>
<Spalte>Id</Spalte>
<Tabelle>Account</Tabelle>
<Views>
<Anzahl>1</Anzahl>
<View0>
<Direction0>UP</Direction0>
<Direction1>DOWN</Direction1>
<Name>Main</Name>
<Offset0>50</Offset0>
<Offset1>50</Offset1>
<Punkte>
<Anzahl>0</Anzahl>
</Punkte>
</View0>
</Views>
</Referenz>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte2>
<Spalte3>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Boolean</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI 01.03.2013 - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar>A flag which can be used to mark account entries as open.</Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>Invalid</Name>
<NotNull>false</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>false</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte3>
<Spalte4>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>ReasonOfPayment</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI 01.03.2013 - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar>The reason of payment for the account entry,.</Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>ReasonOfPayment</Name>
<NotNull>true</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>false</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte4>
</Spalten>
<Stereotype>
<Anzahl>0</Anzahl>
</Stereotype>
<Views>
<Anzahl>1</Anzahl>
<View0>
<Name>Main</Name>
<X>100</X>
<Y>375</Y>
</View0>
</Views>
</Tabelle3>
<Tabelle4>
<Aufgehoben>false</Aufgehoben>
<Codegenerator>
<AuswahlMembers>
<Anzahl>0</Anzahl>
</AuswahlMembers>
<CompareMembers>
<Anzahl>0</Anzahl>
</CompareMembers>
<Equalsmembers>
<Anzahl>0</Anzahl>
</Equalsmembers>
<HashCodeMembers>
<Anzahl>0</Anzahl>
</HashCodeMembers>
<NReferenzen>
<Anzahl>0</Anzahl>
</NReferenzen>
<OrderMembers>
<Anzahl>0</Anzahl>
</OrderMembers>
<ToComboStringMembers>
<Anzahl>0</Anzahl>
</ToComboStringMembers>
<ToStringMembers>
<Anzahl>0</Anzahl>
</ToStringMembers>
</Codegenerator>
<Farben>
<Hintergrund>dunkelgr&uuml;n</Hintergrund>
<Schrift>schwarz</Schrift>
</Farben>
<FirstGenerationDone>false</FirstGenerationDone>
<History>@changed OLI 01.03.2013 - Added.</History>
<InDevelopment>false</InDevelopment>
<Kommentar>Representation of a budget.</Kommentar>
<NMRelation>false</NMRelation>
<Name>Budget</Name>
<Panels>
<Anzahl>1</Anzahl>
<Panel0>
<PanelClass></PanelClass>
<PanelNumber>0</PanelNumber>
<TabMnemonic>1</TabMnemonic>
<TabTitle>1.Daten</TabTitle>
<TabToolTipText>Hier können Sie die Daten des Objekt warten</TabToolTipText>
</Panel0>
</Panels>
<Spalten>
<Anzahl>3</Anzahl>
<Codegenerator>
<ActiveInApplication>false</ActiveInApplication>
<Codegeneratoroptionen></Codegeneratoroptionen>
<Codeverzeichnis>.</Codeverzeichnis>
<Codieren>true</Codieren>
<DynamicCode>true</DynamicCode>
<Inherited>false</Inherited>
<Kontextname></Kontextname>
<UniqueFormula></UniqueFormula>
</Codegenerator>
<Spalte0>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>true</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Ident</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI 01.03.2013 - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar>The primary key of the budget.</Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>Id</Name>
<NotNull>false</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>true</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte0>
<Spalte1>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Name</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI 01.03.2013 - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar>The name of the budget.</Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>BudgetName</Name>
<NotNull>false</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>false</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte1>
<Spalte2>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Amount</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History></History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar></Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>MaximumAmount</Name>
<NotNull>false</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>false</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte2>
</Spalten>
<Stereotype>
<Anzahl>0</Anzahl>
</Stereotype>
<Views>
<Anzahl>1</Anzahl>
<View0>
<Name>Main</Name>
<X>100</X>
<Y>800</Y>
</View0>
</Views>
</Tabelle4>
<Tabelle5>
<Aufgehoben>false</Aufgehoben>
<Codegenerator>
<AuswahlMembers>
<Anzahl>0</Anzahl>
</AuswahlMembers>
<CompareMembers>
<Anzahl>0</Anzahl>
</CompareMembers>
<Equalsmembers>
<Anzahl>0</Anzahl>
</Equalsmembers>
<HashCodeMembers>
<Anzahl>0</Anzahl>
</HashCodeMembers>
<NReferenzen>
<Anzahl>0</Anzahl>
</NReferenzen>
<OrderMembers>
<Anzahl>0</Anzahl>
</OrderMembers>
<ToComboStringMembers>
<Anzahl>0</Anzahl>
</ToComboStringMembers>
<ToStringMembers>
<Anzahl>0</Anzahl>
</ToStringMembers>
</Codegenerator>
<Farben>
<Hintergrund>pastell-gr&uuml;n</Hintergrund>
<Schrift>schwarz</Schrift>
</Farben>
<FirstGenerationDone>false</FirstGenerationDone>
<History>@changed OLI 01.03.2013 - Added.</History>
<InDevelopment>false</InDevelopment>
<Kommentar>A single budget entry which represents an amount of an account entry which is to book on the related budget.</Kommentar>
<NMRelation>false</NMRelation>
<Name>BudgetEntry</Name>
<Panels>
<Anzahl>1</Anzahl>
<Panel0>
<PanelClass></PanelClass>
<PanelNumber>0</PanelNumber>
<TabMnemonic>1</TabMnemonic>
<TabTitle>1.Daten</TabTitle>
<TabToolTipText>Hier können Sie die Daten des Objekt warten</TabToolTipText>
</Panel0>
</Panels>
<Spalten>
<Anzahl>3</Anzahl>
<Codegenerator>
<ActiveInApplication>false</ActiveInApplication>
<Codegeneratoroptionen></Codegeneratoroptionen>
<Codeverzeichnis>.</Codeverzeichnis>
<Codieren>true</Codieren>
<DynamicCode>true</DynamicCode>
<Inherited>false</Inherited>
<Kontextname></Kontextname>
<UniqueFormula></UniqueFormula>
</Codegenerator>
<Spalte0>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Ident</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>true</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI 01.03.2013 - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar>The account entry which the budget entry is assigned to.</Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>AccountEntry</Name>
<NotNull>true</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>false</PrimaryKey>
<Referenz>
<Direction0>UP</Direction0>
<Direction1>DOWN</Direction1>
<Offset0>25</Offset0>
<Offset1>25</Offset1>
<Punkte>
<Anzahl>0</Anzahl>
</Punkte>
<Spalte>Id</Spalte>
<Tabelle>AccountEntry</Tabelle>
<Views>
<Anzahl>1</Anzahl>
<View0>
<Direction0>UP</Direction0>
<Direction1>DOWN</Direction1>
<Name>Main</Name>
<Offset0>25</Offset0>
<Offset1>25</Offset1>
<Punkte>
<Anzahl>0</Anzahl>
</Punkte>
</View0>
</Views>
</Referenz>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte0>
<Spalte1>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Ident</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>true</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI 01.03.2013 - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar>The budget which the entry is related to.</Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>Budget</Name>
<NotNull>true</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>false</PrimaryKey>
<Referenz>
<Direction0>DOWN</Direction0>
<Direction1>UP</Direction1>
<Offset0>25</Offset0>
<Offset1>25</Offset1>
<Punkte>
<Anzahl>0</Anzahl>
</Punkte>
<Spalte>Id</Spalte>
<Tabelle>Budget</Tabelle>
<Views>
<Anzahl>1</Anzahl>
<View0>
<Direction0>DOWN</Direction0>
<Direction1>UP</Direction1>
<Name>Main</Name>
<Offset0>25</Offset0>
<Offset1>25</Offset1>
<Punkte>
<Anzahl>0</Anzahl>
</Punkte>
</View0>
</Views>
</Referenz>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte1>
<Spalte2>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Amount</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI 01.03.2013 - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar>The amount which is to book for the budget.</Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>Amount</Name>
<NotNull>false</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>false</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte2>
</Spalten>
<Stereotype>
<Anzahl>0</Anzahl>
</Stereotype>
<Views>
<Anzahl>1</Anzahl>
<View0>
<Name>Main</Name>
<X>100</X>
<Y>600</Y>
</View0>
</Views>
</Tabelle5>
<Tabelle6>
<Aufgehoben>false</Aufgehoben>
<Codegenerator>
<AuswahlMembers>
<Anzahl>0</Anzahl>
</AuswahlMembers>
<CompareMembers>
<Anzahl>0</Anzahl>
</CompareMembers>
<Equalsmembers>
<Anzahl>0</Anzahl>
</Equalsmembers>
<HashCodeMembers>
<Anzahl>0</Anzahl>
</HashCodeMembers>
<NReferenzen>
<Anzahl>0</Anzahl>
</NReferenzen>
<OrderMembers>
<Anzahl>0</Anzahl>
</OrderMembers>
<ToComboStringMembers>
<Anzahl>0</Anzahl>
</ToComboStringMembers>
<ToStringMembers>
<Anzahl>0</Anzahl>
</ToStringMembers>
</Codegenerator>
<Farben>
<Hintergrund>blaugrau</Hintergrund>
<Schrift>schwarz</Schrift>
</Farben>
<FirstGenerationDone>false</FirstGenerationDone>
<History>@changed OLI 01.03.2013 - Added.</History>
<InDevelopment>false</InDevelopment>
<Kommentar>A preriodic account entry.</Kommentar>
<NMRelation>false</NMRelation>
<Name>PeriodicAccountEntry</Name>
<Panels>
<Anzahl>1</Anzahl>
<Panel0>
<PanelClass></PanelClass>
<PanelNumber>0</PanelNumber>
<TabMnemonic>1</TabMnemonic>
<TabTitle>1.Daten</TabTitle>
<TabToolTipText>Hier können Sie die Daten des Objekt warten</TabToolTipText>
</Panel0>
</Panels>
<Spalten>
<Anzahl>2</Anzahl>
<Codegenerator>
<ActiveInApplication>false</ActiveInApplication>
<Codegeneratoroptionen></Codegeneratoroptionen>
<Codeverzeichnis>.</Codeverzeichnis>
<Codieren>true</Codieren>
<DynamicCode>true</DynamicCode>
<Inherited>false</Inherited>
<Kontextname></Kontextname>
<UniqueFormula></UniqueFormula>
</Codegenerator>
<Spalte0>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>true</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Ident</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>true</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI 01.03.2013 - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar>The primary key of the periodic account entry.</Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>Id</Name>
<NotNull>true</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>true</PrimaryKey>
<Referenz>
<Direction0>LEFT</Direction0>
<Direction1>RIGHT</Direction1>
<Offset0>25</Offset0>
<Offset1>25</Offset1>
<Punkte>
<Anzahl>0</Anzahl>
</Punkte>
<Spalte>Id</Spalte>
<Tabelle>AccountEntry</Tabelle>
<Views>
<Anzahl>1</Anzahl>
<View0>
<Direction0>LEFT</Direction0>
<Direction1>RIGHT</Direction1>
<Name>Main</Name>
<Offset0>25</Offset0>
<Offset1>25</Offset1>
<Punkte>
<Anzahl>0</Anzahl>
</Punkte>
</View0>
</Views>
</Referenz>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte0>
<Spalte1>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Periode</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>SEMSTRAL, </History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar>The periode which is valid for the periodic entry.</Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>Periode</Name>
<NotNull>true</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>false</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<TechnicalField>false</TechnicalField>
<Unique>false</Unique>
</Spalte1>
</Spalten>
<Stereotype>
<Anzahl>0</Anzahl>
</Stereotype>
<Views>
<Anzahl>1</Anzahl>
<View0>
<Name>Main</Name>
<X>525</X>
<Y>375</Y>
</View0>
</Views>
</Tabelle6>
</Tabellen>
<Views>
<Anzahl>1</Anzahl>
<View0>
<Beschreibung>Diese Sicht beinhaltet alle Tabellen des Schemas</Beschreibung>
<Name>Main</Name>
<ReferenzierteSpaltenAnzeigen>true</ReferenzierteSpaltenAnzeigen>
<Tabelle0>Account</Tabelle0>
<Tabelle1>Bank</Tabelle1>
<Tabelle2>Owner</Tabelle2>
<Tabelle3>AccountEntry</Tabelle3>
<Tabelle4>Budget</Tabelle4>
<Tabelle5>BudgetEntry</Tabelle5>
<Tabelle6>PeriodicAccountEntry</Tabelle6>
<Tabellenanzahl>7</Tabellenanzahl>
<TechnischeSpaltenVerstecken>false</TechnischeSpaltenVerstecken>
</View0>
</Views>
</Diagramm>
|
with STM32.Device;
package body STM32.CORDIC.Interrupts is
-------------------------------
-- Calculate_CORDIC_Function --
-------------------------------
procedure Calculate_CORDIC_Function
(This : in out CORDIC_Coprocessor;
Argument : UInt32_Array;
Result : out UInt32_Array)
is
-- Test if data width is 32 bit
pragma Assert (This.CSR.ARGSIZE = True, "Invalid data size");
Operation : constant CORDIC_Function := CORDIC_Function'Val (This.CSR.FUNC);
begin
case Operation is
when Cosine | Sine | Phase | Modulus =>
-- Two 32 bit arguments
This.WDATA := Argument (1);
This.WDATA := Argument (2);
when Hyperbolic_Cosine | Hyperbolic_Sine | Arctangent |
Hyperbolic_Arctangent | Natural_Logarithm | Square_Root =>
-- One 32 bit argument
This.WDATA := Argument (1);
end case;
-- Get the results from the Ring Buffer
case Operation is
when Cosine | Sine | Phase | Modulus |
Hyperbolic_Cosine | Hyperbolic_Sine =>
-- Two 32 bit results
Receiver.Get_Result (Result (1));
Receiver.Get_Result (Result (2));
when Arctangent | Hyperbolic_Arctangent | Natural_Logarithm | Square_Root =>
-- One 32 bit result
Receiver.Get_Result (Result (1));
end case;
end Calculate_CORDIC_Function;
-------------------------------
-- Calculate_CORDIC_Function --
-------------------------------
procedure Calculate_CORDIC_Function
(This : in out CORDIC_Coprocessor;
Argument : UInt16_Array;
Result : out UInt16_Array)
is
-- Test if data width is 16 bit
pragma Assert (This.CSR.ARGSIZE = False, "Invalid data size");
Operation : constant CORDIC_Function := CORDIC_Function'Val (This.CSR.FUNC);
Data : UInt32;
begin
case Operation is
when Cosine | Sine | Phase | Modulus =>
-- Two 16 bit argument
Data := UInt32 (Argument (2));
Data := Shift_Left (Data, 16) or UInt32 (Argument (1));
This.WDATA := Data;
when Hyperbolic_Cosine | Hyperbolic_Sine | Arctangent |
Hyperbolic_Arctangent | Natural_Logarithm | Square_Root =>
-- One 16 bit argument
This.WDATA := UInt32 (Argument (1));
end case;
-- Get the results from the Ring Buffer
Receiver.Get_Result (Data);
case Operation is
when Cosine | Sine | Phase | Modulus |
Hyperbolic_Cosine | Hyperbolic_Sine =>
-- Two 16 bit results
Result (1) := UInt16 (Data);
Result (2) := UInt16 (Shift_Right (Data, 16));
when Arctangent | Hyperbolic_Arctangent | Natural_Logarithm | Square_Root =>
-- One 32 bit result
Result (1) := UInt16 (Data);
end case;
end Calculate_CORDIC_Function;
--------------
-- Receiver --
--------------
protected body Receiver is
----------------
-- Get_Result --
----------------
entry Get_Result (Value : out UInt32)
when Data_Available
is
Next : constant Integer :=
(Buffer.Tail + 1) mod Buffer.Content'Length;
begin
-- Remove an item from our ring buffer.
Value := Buffer.Content (Next);
Buffer.Tail := Next;
-- If the buffer is empty, make sure we block subsequent callers
-- until the buffer has something in it.
if Buffer.Tail = Buffer.Head then
Data_Available := False;
end if;
end Get_Result;
-----------------------
-- Interrupt_Handler --
-----------------------
procedure Interrupt_Handler is
use STM32.Device;
begin
if Interrupt_Enabled (CORDIC_Unit) then
if Status (CORDIC_Unit, Flag => Result_Ready) then
if (Buffer.Head + 1) mod Buffer.Content'Length = Buffer.Tail
then
-- But our buffer is full.
raise Ring_Buffer_Full;
else
-- Add this first 32 bit data to our buffer.
Buffer.Head := (Buffer.Head + 1) mod Buffer.Content'Length;
Buffer.Content (Buffer.Head) := Get_CORDIC_Data (CORDIC_Unit);
-- Test if the function has two 32 bits results
if Get_CORDIC_Results_Number (CORDIC_Unit) = Two_32_Bit then
if (Buffer.Head + 1) mod Buffer.Content'Length = Buffer.Tail
then
-- But our buffer is full.
raise Ring_Buffer_Full;
else
-- Add this second 32 bit data to our buffer.
Buffer.Head := (Buffer.Head + 1) mod Buffer.Content'Length;
Buffer.Content (Buffer.Head) := Get_CORDIC_Data (CORDIC_Unit);
end if;
end if;
Data_Available := True;
end if;
end if;
end if;
end Interrupt_Handler;
end Receiver;
end STM32.CORDIC.Interrupts;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- SYSTEM.TASKING.ASYNC_DELAYS.ENQUEUE_CALENDAR --
-- --
-- S p e c --
-- --
-- Copyright (C) 1998-2013, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
-- Note: the compiler generates direct calls to this interface, via Rtsfind.
-- Any changes to this interface may require corresponding compiler changes.
-- See comments in package System.Tasking.Async_Delays
with Ada.Calendar;
function System.Tasking.Async_Delays.Enqueue_Calendar
(T : Ada.Calendar.Time;
D : Delay_Block_Access) return Boolean;
|
-----------------------------------------------------------------------
-- widgets-factory -- Factory for widget Components
-- Copyright (C) 2013 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.Views.Nodes;
with ASF.Components.Base;
with ASF.Components.Widgets.Inputs;
with ASF.Components.Widgets.Gravatars;
with ASF.Components.Widgets.Likes;
with ASF.Components.Widgets.Panels;
with ASF.Components.Widgets.Tabs;
package body ASF.Components.Widgets.Factory is
use ASF.Components.Base;
function Create_Accordion return UIComponent_Access;
function Create_Input return UIComponent_Access;
function Create_Input_Date return UIComponent_Access;
function Create_Complete return UIComponent_Access;
function Create_Gravatar return UIComponent_Access;
function Create_Like return UIComponent_Access;
function Create_Panel return UIComponent_Access;
function Create_TabView return UIComponent_Access;
function Create_Tab return UIComponent_Access;
-- ------------------------------
-- Create a UIAccordion component
-- ------------------------------
function Create_Accordion return UIComponent_Access is
begin
return new ASF.Components.Widgets.Tabs.UIAccordion;
end Create_Accordion;
-- ------------------------------
-- Create a UIInput component
-- ------------------------------
function Create_Input return UIComponent_Access is
begin
return new ASF.Components.Widgets.Inputs.UIInput;
end Create_Input;
-- ------------------------------
-- Create a UIInput component
-- ------------------------------
function Create_Input_Date return UIComponent_Access is
begin
return new ASF.Components.Widgets.Inputs.UIInputDate;
end Create_Input_Date;
-- ------------------------------
-- Create a UIComplete component
-- ------------------------------
function Create_Complete return UIComponent_Access is
begin
return new ASF.Components.Widgets.Inputs.UIComplete;
end Create_Complete;
-- ------------------------------
-- Create a UIGravatar component
-- ------------------------------
function Create_Gravatar return UIComponent_Access is
begin
return new ASF.Components.Widgets.Gravatars.UIGravatar;
end Create_Gravatar;
-- ------------------------------
-- Create a UILike component
-- ------------------------------
function Create_Like return UIComponent_Access is
begin
return new ASF.Components.Widgets.Likes.UILike;
end Create_Like;
-- ------------------------------
-- Create a UIPanel component
-- ------------------------------
function Create_Panel return UIComponent_Access is
begin
return new ASF.Components.Widgets.Panels.UIPanel;
end Create_Panel;
-- ------------------------------
-- Create a UITab component
-- ------------------------------
function Create_Tab return UIComponent_Access is
begin
return new ASF.Components.Widgets.Tabs.UITab;
end Create_Tab;
-- ------------------------------
-- Create a UITabView component
-- ------------------------------
function Create_TabView return UIComponent_Access is
begin
return new ASF.Components.Widgets.Tabs.UITabView;
end Create_TabView;
use ASF.Views.Nodes;
URI : aliased constant String := "http://code.google.com/p/ada-asf/widget";
ACCORDION_TAG : aliased constant String := "accordion";
AUTOCOMPLETE_TAG : aliased constant String := "autocomplete";
INPUT_DATE_TAG : aliased constant String := "inputDate";
INPUT_TEXT_TAG : aliased constant String := "inputText";
GRAVATAR_TAG : aliased constant String := "gravatar";
LIKE_TAG : aliased constant String := "like";
PANEL_TAG : aliased constant String := "panel";
TAB_TAG : aliased constant String := "tab";
TAB_VIEW_TAG : aliased constant String := "tabView";
Widget_Bindings : aliased constant ASF.Factory.Binding_Array
:= (1 => (Name => ACCORDION_TAG'Access,
Component => Create_Accordion'Access,
Tag => Create_Component_Node'Access),
2 => (Name => AUTOCOMPLETE_TAG'Access,
Component => Create_Complete'Access,
Tag => Create_Component_Node'Access),
3 => (Name => INPUT_DATE_TAG'Access,
Component => Create_Input_Date'Access,
Tag => Create_Component_Node'Access),
4 => (Name => INPUT_TEXT_TAG'Access,
Component => Create_Input'Access,
Tag => Create_Component_Node'Access),
5 => (Name => GRAVATAR_TAG'Access,
Component => Create_Gravatar'Access,
Tag => Create_Component_Node'Access),
6 => (Name => LIKE_TAG'Access,
Component => Create_Like'Access,
Tag => Create_Component_Node'Access),
7 => (Name => PANEL_TAG'Access,
Component => Create_Panel'Access,
Tag => Create_Component_Node'Access),
8 => (Name => TAB_TAG'Access,
Component => Create_Tab'Access,
Tag => Create_Component_Node'Access),
9 => (Name => TAB_VIEW_TAG'Access,
Component => Create_TabView'Access,
Tag => Create_Component_Node'Access)
);
Core_Factory : aliased constant ASF.Factory.Factory_Bindings
:= (URI => URI'Access, Bindings => Widget_Bindings'Access);
-- ------------------------------
-- Get the widget component factory.
-- ------------------------------
function Definition return ASF.Factory.Factory_Bindings_Access is
begin
return Core_Factory'Access;
end Definition;
end ASF.Components.Widgets.Factory;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUNTIME COMPONENTS --
-- --
-- S Y S T E M . E X P _ U N S --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-1997 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 2, 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 COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This procedure performs exponentiation of unsigned types (with binary
-- modulus values up to and including that of Unsigned_Types.Unsigned).
-- The result is always full width, the caller must do a masking operation
-- the modulus is less than 2 ** (Unsigned'Size).
with System.Unsigned_Types;
package System.Exp_Uns is
pragma Pure (Exp_Uns);
function Exp_Unsigned
(Left : System.Unsigned_Types.Unsigned;
Right : Natural)
return System.Unsigned_Types.Unsigned;
end System.Exp_Uns;
|
with Ada.Text_IO, Ada.Integer_Text_IO, display, stats, player, inventory_list, Game_Map;
use Ada.Text_IO, Ada.Integer_Text_IO, display, stats, player, inventory_list, Game_Map;
procedure test is
User : Character := 'o';
Level_3 : Coords(1..30, 1..50);
Position : Room_Ptr;
Map_1 : Map_Type := (1..10 => (1..10 => (Others => Character'Val(178))));
Map_2 : Map_Type := (1..20 => (1..30 => (Others => Character'Val(178))));
Map_3 : Map_Type := (1..30 => (1..50 => (Others => Character'Val(178))));
Destroyed: Integer := 0;
My_Player : Player_Type;
Room_ID : Integer;
begin
Initialize(50, 30); -- Mark's Display System (Opposite My Coords)
Instantiate;
clearCharacter(My_Player);
Initialize(Level_3, Position);
Link(Level_3, Position, map_3);
WipeScreen;
Show_Screen(Position, map_3);
while (User /= 'q') loop
Get_Immediate(User);
If (User = 'w') then
Move_North(Position, map_3, My_Player, Room_ID);
elsif (User = 'a') then
Move_West(Position, map_3, My_Player, Room_ID);
elsif (User = 's') then
Move_South(Position, map_3, My_Player, Room_ID);
elsif (User = 'd') then
Move_East(Position, map_3, My_Player, Room_ID);
end if;
If (Empty(Position)) then
Show_Screen(Position, map_3);
Print(Position, map_3);
Else
Put_Line("Map has been deleted!");
End If;
end loop;
end test;
|
------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- ncurses --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright 2020 Thomas E. Dickey --
-- Copyright 2000,2006 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 <aldomel@ix.netcom.com> 2000
-- Version Control
-- $Revision: 1.3 $
-- $Date: 2020/02/02 23:34:34 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Terminal_Interface.Curses; use Terminal_Interface.Curses;
with ncurses2.util; use ncurses2.util;
-- Graphic-rendition test (adapted from vttest)
procedure ncurses2.test_sgr_attributes is
procedure xAdd (l : Line_Position; c : Column_Position; s : String);
procedure xAdd (l : Line_Position; c : Column_Position; s : String) is
begin
Add (Line => l, Column => c, Str => s);
end xAdd;
normal, current : Attributed_Character;
begin
for pass in reverse Boolean loop
if pass then
normal := (Ch => ' ', Attr => Normal_Video, Color => 0);
else
normal := (Ch => ' ', Attr =>
(Reverse_Video => True, others => False), Color => 0);
end if;
-- Use non-default colors if possible to exercise bce a little
if Has_Colors then
Init_Pair (1, White, Blue);
normal.Color := 1;
end if;
Set_Background (Ch => normal);
Erase;
xAdd (1, 20, "Graphic rendition test pattern:");
xAdd (4, 1, "vanilla");
current := normal;
current.Attr.Bold_Character := not current.Attr.Bold_Character;
Set_Background (Ch => current);
xAdd (4, 40, "bold");
current := normal;
current.Attr.Under_Line := not current.Attr.Under_Line;
Set_Background (Ch => current);
xAdd (6, 6, "underline");
current := normal;
current.Attr.Bold_Character := not current.Attr.Bold_Character;
current.Attr.Under_Line := not current.Attr.Under_Line;
Set_Background (Ch => current);
xAdd (6, 45, "bold underline");
current := normal;
current.Attr.Blink := not current.Attr.Blink;
Set_Background (Ch => current);
xAdd (8, 1, "blink");
current := normal;
current.Attr.Blink := not current.Attr.Blink;
current.Attr.Bold_Character := not current.Attr.Bold_Character;
Set_Background (Ch => current);
xAdd (8, 40, "bold blink");
current := normal;
current.Attr.Under_Line := not current.Attr.Under_Line;
current.Attr.Blink := not current.Attr.Blink;
Set_Background (Ch => current);
xAdd (10, 6, "underline blink");
current := normal;
current.Attr.Bold_Character := not current.Attr.Bold_Character;
current.Attr.Under_Line := not current.Attr.Under_Line;
current.Attr.Blink := not current.Attr.Blink;
Set_Background (Ch => current);
xAdd (10, 45, "bold underline blink");
current := normal;
current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
Set_Background (Ch => current);
xAdd (12, 1, "negative");
current := normal;
current.Attr.Bold_Character := not current.Attr.Bold_Character;
current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
Set_Background (Ch => current);
xAdd (12, 40, "bold negative");
current := normal;
current.Attr.Under_Line := not current.Attr.Under_Line;
current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
Set_Background (Ch => current);
xAdd (14, 6, "underline negative");
current := normal;
current.Attr.Bold_Character := not current.Attr.Bold_Character;
current.Attr.Under_Line := not current.Attr.Under_Line;
current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
Set_Background (Ch => current);
xAdd (14, 45, "bold underline negative");
current := normal;
current.Attr.Blink := not current.Attr.Blink;
current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
Set_Background (Ch => current);
xAdd (16, 1, "blink negative");
current := normal;
current.Attr.Bold_Character := not current.Attr.Bold_Character;
current.Attr.Blink := not current.Attr.Blink;
current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
Set_Background (Ch => current);
xAdd (16, 40, "bold blink negative");
current := normal;
current.Attr.Under_Line := not current.Attr.Under_Line;
current.Attr.Blink := not current.Attr.Blink;
current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
Set_Background (Ch => current);
xAdd (18, 6, "underline blink negative");
current := normal;
current.Attr.Bold_Character := not current.Attr.Bold_Character;
current.Attr.Under_Line := not current.Attr.Under_Line;
current.Attr.Blink := not current.Attr.Blink;
current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
Set_Background (Ch => current);
xAdd (18, 45, "bold underline blink negative");
Set_Background (Ch => normal);
Move_Cursor (Line => Lines - 2, Column => 1);
if pass then
Add (Str => "Dark");
else
Add (Str => "Light");
end if;
Add (Str => " background. ");
Clear_To_End_Of_Line;
Pause;
end loop;
Set_Background (Ch => Blank2);
Erase;
End_Windows;
end ncurses2.test_sgr_attributes;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.