CombinedText stringlengths 4 3.42M |
|---|
------------------------------------------------------------------------------
-- A d a r u n - t i m e s p e c i f i c a t i o n --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of ada.ads file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $
package Ada.Strings.Maps is
pragma Pure (Maps);
-- Representation for a set of character values:
type Character_Set is private;
pragma Preelaborable_Initialization (Character_Set);
Null_Set : constant Character_Set;
type Character_Range is
record
Low : Character;
High : Character;
end record;
-- Represents Character range Low..High
type Character_Ranges is
array (Positive range <>) of Character_Range;
function To_Set
(Ranges : in Character_Ranges) return Character_Set;
function To_Set (Span : in Character_Range) return Character_Set;
function To_Ranges
(Set : in Character_Set) return Character_Ranges;
function "=" (Left, Right : in Character_Set) return Boolean;
function "not" (Right : in Character_Set) return Character_Set;
function "and" (Left, Right : in Character_Set) return Character_Set;
function "or" (Left, Right : in Character_Set) return Character_Set;
function "xor" (Left, Right : in Character_Set) return Character_Set;
function "-" (Left, Right : in Character_Set) return Character_Set;
function Is_In (Element : in Character;
Set : in Character_Set)
return Boolean;
function Is_Subset (Elements : in Character_Set;
Set : in Character_Set)
return Boolean;
function "<=" (Left : in Character_Set;
Right : in Character_Set)
return Boolean renames Is_Subset;
-- Alternative representation for a set of character values:
subtype Character_Sequence is String;
function To_Set
(Sequence : in Character_Sequence)return Character_Set;
function To_Set (Singleton : in Character) return Character_Set;
function To_Sequence
(Set : in Character_Set) return Character_Sequence;
-- Representation for a character to character mapping:
type Character_Mapping is private;
pragma Preelaborable_Initialization (Character_Mapping);
function Value (Map : in Character_Mapping;
Element : in Character)
return Character;
Identity : constant Character_Mapping;
function To_Mapping (From, To : in Character_Sequence)
return Character_Mapping;
function To_Domain (Map : in Character_Mapping)
return Character_Sequence;
function To_Range (Map : in Character_Mapping)
return Character_Sequence;
type Character_Mapping_Function is
access function (From : in Character) return Character;
private
pragma Import (Ada, Character_Set);
pragma Import (Ada, Null_Set);
pragma Import (Ada, Character_Mapping);
pragma Import (Ada, Identity);
end Ada.Strings.Maps;
|
-- { dg-do run }
with Renaming4; use Renaming4;
procedure Renaming3 is
type A is array(1..16) of Integer;
Filler : A := (others => 0);
begin
if B(1) /= 1 then
raise Program_Error;
end if;
end;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . V A L _ R E A L --
-- --
-- S p e c --
-- --
-- $Revision: 2 $ --
-- --
-- Copyright (c) 1992,1993,1994 NYU, All Rights Reserved --
-- --
-- The GNAT library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU Library General Public License as published by --
-- the Free Software Foundation; either version 2, or (at your option) any --
-- later version. The GNAT library is distributed in the hope that it will --
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- Library General Public License for more details. You should have --
-- received a copy of the GNU Library General Public License along with --
-- the GNAT library; see the file COPYING.LIB. If not, write to the Free --
-- Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. --
-- --
------------------------------------------------------------------------------
package System.Val_Real is
pragma Pure (Val_Real);
function Scan_Real
(Str : String;
Ptr : access Positive'Base;
Max : Positive'Base)
return Long_Long_Float;
-- This function scans the string starting at Str (Ptr.all) for a valid
-- real literal according to the syntax described in (RM 3.5(43)). The
-- substring scanned extends no further than Str (Max). There are three
-- cases for the return:
--
-- If a valid real is found after scanning past any initial spaces, then
-- Ptr.all is updated past the last character of the real (but trailing
-- spaces are not scanned out).
--
-- If no valid real is found, then Ptr.all points either to an initial
-- non-blank character, or to Max + 1 if the field is all spaces and the
-- exception Constraint_Error is raised.
--
-- If a syntactically valid real is scanned, but the value is out of
-- range, or, in the based case, the base value is out of range or there
-- is an out of range digit, then Ptr.all points past the real literal,
-- and Constraint_Error is raised.
--
-- Note: these rules correspond to the requirements for leaving the
-- pointer positioned in Text_Io.Get
--
-- Note: if Str is null, i.e. if Max is less than Ptr, then this is a
-- special case of an all-blank string, and Ptr is unchanged, and hence
-- is greater than Max as required in this case.
function Value_Real (Str : String) return Long_Long_Float;
-- Used in computing X'Value (Str) where X is a floating-point type or an
-- ordinary fixed-point type. Str is the string argument of the attribute.
-- Constraint_Error is raised if the string is malformed, or if the value
-- out of range of Long_Long_Float.
end System.Val_Real;
|
------------------------------------------------------------------------------
-- --
-- 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.Elements;
with AMF.Internals.Helpers;
with AMF.Internals.Tables.UML_Attributes;
with AMF.UML.Packages;
with AMF.Visitors.Standard_Profile_L2_Iterators;
with AMF.Visitors.Standard_Profile_L2_Visitors;
package body AMF.Internals.Standard_Profile_L2_Model_Libraries is
----------------------
-- Get_Base_Package --
----------------------
overriding function Get_Base_Package
(Self : not null access constant Standard_Profile_L2_Model_Library_Proxy)
return AMF.UML.Packages.UML_Package_Access is
begin
return
AMF.UML.Packages.UML_Package_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Base_Package
(Self.Element)));
end Get_Base_Package;
----------------------
-- Set_Base_Package --
----------------------
overriding procedure Set_Base_Package
(Self : not null access Standard_Profile_L2_Model_Library_Proxy;
To : AMF.UML.Packages.UML_Package_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Base_Package
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Base_Package;
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant Standard_Profile_L2_Model_Library_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.Standard_Profile_L2_Visitors.Standard_Profile_L2_Visitor'Class then
AMF.Visitors.Standard_Profile_L2_Visitors.Standard_Profile_L2_Visitor'Class
(Visitor).Enter_Model_Library
(AMF.Standard_Profile_L2.Model_Libraries.Standard_Profile_L2_Model_Library_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant Standard_Profile_L2_Model_Library_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.Standard_Profile_L2_Visitors.Standard_Profile_L2_Visitor'Class then
AMF.Visitors.Standard_Profile_L2_Visitors.Standard_Profile_L2_Visitor'Class
(Visitor).Leave_Model_Library
(AMF.Standard_Profile_L2.Model_Libraries.Standard_Profile_L2_Model_Library_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant Standard_Profile_L2_Model_Library_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.Standard_Profile_L2_Iterators.Standard_Profile_L2_Iterator'Class then
AMF.Visitors.Standard_Profile_L2_Iterators.Standard_Profile_L2_Iterator'Class
(Iterator).Visit_Model_Library
(Visitor,
AMF.Standard_Profile_L2.Model_Libraries.Standard_Profile_L2_Model_Library_Access (Self),
Control);
end if;
end Visit_Element;
end AMF.Internals.Standard_Profile_L2_Model_Libraries;
|
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
with System;
with Ada.Finalization;
package USB is
-- This is a 1:1 maping of the libusb.h file
-- unsupported macro: DEPRECATED_FOR(f) __attribute__((deprecated("Use " #f " instead")))
API_VERSION : constant := 16#01000105#; -- libusb.h:144
-- unsupported macro: LIBUSBX_API_VERSION API_VERSION
-- unsupported macro: le16_to_cpu cpu_to_le16
DT_DEVICE_SIZE : constant := 18; -- libusb.h:290
DT_CONFIG_SIZE : constant := 9; -- libusb.h:291
DT_INTERFACE_SIZE : constant := 9; -- libusb.h:292
DT_ENDPOINT_SIZE : constant := 7; -- libusb.h:293
DT_ENDPOINT_AUDIO_SIZE : constant := 9; -- libusb.h:294
DT_HUB_NONVAR_SIZE : constant := 7; -- libusb.h:295
DT_SS_ENDPOINT_COMPANION_SIZE : constant := 6; -- libusb.h:296
DT_BOS_SIZE : constant := 5; -- libusb.h:297
DT_DEVICE_CAPABILITY_SIZE : constant := 3; -- libusb.h:298
BT_USB_2_0_EXTENSION_SIZE : constant := 7; -- libusb.h:301
BT_SS_USB_DEVICE_CAPABILITY_SIZE : constant := 10; -- libusb.h:302
BT_CONTAINER_ID_SIZE : constant := 20; -- libusb.h:303
DT_BOS_MAX_SIZE : constant := ((DT_BOS_SIZE) + (BT_USB_2_0_EXTENSION_SIZE) + (BT_SS_USB_DEVICE_CAPABILITY_SIZE) + (BT_CONTAINER_ID_SIZE));
ENDPOINT_ADDRESS_MASK : constant := 16#0f#; -- libusb.h:311
ENDPOINT_DIR_MASK : constant := 16#80#; -- libusb.h:312
TRANSFER_TYPE_MASK : constant := 16#03#; -- libusb.h:326
ISO_SYNC_TYPE_MASK : constant := 16#0C#; -- libusb.h:433
ISO_USAGE_TYPE_MASK : constant := 16#30#; -- libusb.h:454
-- unsupported macro: CONTROL_SETUP_SIZE (sizeof(struct control_setup))
ERROR_COUNT : constant := 14; -- libusb.h:1102
HOTPLUG_MATCH_ANY : constant := -1; -- libusb.h:1918
function cpu_to_le16 (x : Interfaces.Unsigned_16) return Interfaces.Unsigned_16; -- libusb.h:161
subtype class_code is unsigned;
CLASS_PER_INTERFACE : constant class_code := 0;
CLASS_AUDIO : constant class_code := 1;
CLASS_COMM : constant class_code := 2;
CLASS_HID : constant class_code := 3;
CLASS_PHYSICAL : constant class_code := 5;
CLASS_PRINTER : constant class_code := 7;
CLASS_PTP : constant class_code := 6;
CLASS_IMAGE : constant class_code := 6;
CLASS_MASS_STORAGE : constant class_code := 8;
CLASS_HUB : constant class_code := 9;
CLASS_DATA : constant class_code := 10;
CLASS_SMART_CARD : constant class_code := 11;
CLASS_CONTENT_SECURITY : constant class_code := 13;
CLASS_VIDEO : constant class_code := 14;
CLASS_PERSONAL_HEALTHCARE : constant class_code := 15;
CLASS_DIAGNOSTIC_DEVICE : constant class_code := 220;
CLASS_WIRELESS : constant class_code := 224;
CLASS_APPLICATION : constant class_code := 254;
CLASS_VENDOR_SPEC : constant class_code := 255; -- libusb.h:186
subtype descriptor_type is unsigned;
DT_DEVICE : constant descriptor_type := 1;
DT_CONFIG : constant descriptor_type := 2;
DT_STRING : constant descriptor_type := 3;
DT_INTERFACE : constant descriptor_type := 4;
DT_ENDPOINT : constant descriptor_type := 5;
DT_BOS : constant descriptor_type := 15;
DT_DEVICE_CAPABILITY : constant descriptor_type := 16;
DT_HID : constant descriptor_type := 33;
DT_REPORT : constant descriptor_type := 34;
DT_PHYSICAL : constant descriptor_type := 35;
DT_HUB : constant descriptor_type := 41;
DT_SUPERSPEED_HUB : constant descriptor_type := 42;
DT_SS_ENDPOINT_COMPANION : constant descriptor_type := 48; -- libusb.h:248
subtype endpoint_direction is unsigned;
ENDPOINT_IN : constant endpoint_direction := 128;
ENDPOINT_OUT : constant endpoint_direction := 0; -- libusb.h:318
type transfer_type is
(LIBUSB_TRANSFER_TYPE_CONTROL,
TRANSFER_TYPE_ISOCHRONOUS,
TRANSFER_TYPE_BULK,
TRANSFER_TYPE_INTERRUPT,
TRANSFER_TYPE_BULK_STREAM);
pragma Convention (C, transfer_type); -- libusb.h:332
subtype standard_request is unsigned;
REQUEST_GET_STATUS : constant standard_request := 0;
REQUEST_CLEAR_FEATURE : constant standard_request := 1;
REQUEST_SET_FEATURE : constant standard_request := 3;
REQUEST_SET_ADDRESS : constant standard_request := 5;
REQUEST_GET_DESCRIPTOR : constant standard_request := 6;
REQUEST_SET_DESCRIPTOR : constant standard_request := 7;
REQUEST_GET_CONFIGURATION : constant standard_request := 8;
REQUEST_SET_CONFIGURATION : constant standard_request := 9;
REQUEST_GET_INTERFACE : constant standard_request := 10;
REQUEST_SET_INTERFACE : constant standard_request := 11;
REQUEST_SYNCH_FRAME : constant standard_request := 12;
REQUEST_SET_SEL : constant standard_request := 48;
SET_ISOCH_DELAY : constant standard_request := 49; -- libusb.h:351
subtype request_type is unsigned;
REQUEST_TYPE_STANDARD : constant request_type := 0;
REQUEST_TYPE_CLASS : constant request_type := 32;
REQUEST_TYPE_VENDOR : constant request_type := 64;
REQUEST_TYPE_RESERVED : constant request_type := 96; -- libusb.h:401
type request_recipient is
(LIBUSB_RECIPIENT_DEVICE,
RECIPIENT_INTERFACE,
RECIPIENT_ENDPOINT,
RECIPIENT_OTHER);
pragma Convention (C, request_recipient); -- libusb.h:419
type iso_sync_type is
(LIBUSB_ISO_SYNC_TYPE_NONE,
ISO_SYNC_TYPE_ASYNC,
ISO_SYNC_TYPE_ADAPTIVE,
ISO_SYNC_TYPE_SYNC);
pragma Convention (C, iso_sync_type); -- libusb.h:440
type iso_usage_type is
(LIBUSB_ISO_USAGE_TYPE_DATA,
ISO_USAGE_TYPE_FEEDBACK,
ISO_USAGE_TYPE_IMPLICIT);
pragma Convention (C, iso_usage_type); -- libusb.h:461
type device_descriptor is record
bLength : aliased Interfaces.Unsigned_8; -- libusb.h:479
bDescriptorType : aliased Interfaces.Unsigned_8; -- libusb.h:484
bcdUSB : aliased Interfaces.Unsigned_16; -- libusb.h:488
bDeviceClass : aliased Interfaces.Unsigned_8; -- libusb.h:491
bDeviceSubClass : aliased Interfaces.Unsigned_8; -- libusb.h:495
bDeviceProtocol : aliased Interfaces.Unsigned_8; -- libusb.h:499
bMaxPacketSize0 : aliased Interfaces.Unsigned_8; -- libusb.h:502
idVendor : aliased Interfaces.Unsigned_16; -- libusb.h:505
idProduct : aliased Interfaces.Unsigned_16; -- libusb.h:508
bcdDevice : aliased Interfaces.Unsigned_16; -- libusb.h:511
iManufacturer : aliased Interfaces.Unsigned_8; -- libusb.h:514
iProduct : aliased Interfaces.Unsigned_8; -- libusb.h:517
iSerialNumber : aliased Interfaces.Unsigned_8; -- libusb.h:520
bNumConfigurations : aliased Interfaces.Unsigned_8; -- libusb.h:523
end record;
pragma Convention (C_Pass_By_Copy, device_descriptor); -- libusb.h:477
type endpoint_descriptor is record
bLength : aliased Interfaces.Unsigned_8; -- libusb.h:533
bDescriptorType : aliased Interfaces.Unsigned_8; -- libusb.h:538
bEndpointAddress : aliased Interfaces.Unsigned_8; -- libusb.h:544
bmAttributes : aliased Interfaces.Unsigned_8; -- libusb.h:553
wMaxPacketSize : aliased Interfaces.Unsigned_16; -- libusb.h:556
bInterval : aliased Interfaces.Unsigned_8; -- libusb.h:559
bRefresh : aliased Interfaces.Unsigned_8; -- libusb.h:563
bSynchAddress : aliased Interfaces.Unsigned_8; -- libusb.h:566
extra : access unsigned_char; -- libusb.h:570
extra_length : aliased int; -- libusb.h:573
end record;
pragma Convention (C_Pass_By_Copy, endpoint_descriptor); -- libusb.h:531
type interface_descriptor is record
bLength : aliased Interfaces.Unsigned_8; -- libusb.h:583
bDescriptorType : aliased Interfaces.Unsigned_8; -- libusb.h:588
bInterfaceNumber : aliased Interfaces.Unsigned_8; -- libusb.h:591
bAlternateSetting : aliased Interfaces.Unsigned_8; -- libusb.h:594
bNumEndpoints : aliased Interfaces.Unsigned_8; -- libusb.h:598
bInterfaceClass : aliased Interfaces.Unsigned_8; -- libusb.h:601
bInterfaceSubClass : aliased Interfaces.Unsigned_8; -- libusb.h:605
bInterfaceProtocol : aliased Interfaces.Unsigned_8; -- libusb.h:609
iInterface : aliased Interfaces.Unsigned_8; -- libusb.h:612
endpoint : access constant endpoint_descriptor; -- libusb.h:616
extra : access unsigned_char; -- libusb.h:620
extra_length : aliased int; -- libusb.h:623
end record;
pragma Convention (C_Pass_By_Copy, interface_descriptor); -- libusb.h:581
type interface_t is record
altsetting : access constant interface_descriptor; -- libusb.h:632
num_altsetting : aliased int; -- libusb.h:635
end record;
pragma Convention (C_Pass_By_Copy, interface_t); -- libusb.h:629
type config_descriptor is record
bLength : aliased Interfaces.Unsigned_8; -- libusb.h:645
bDescriptorType : aliased Interfaces.Unsigned_8; -- libusb.h:650
wTotalLength : aliased Interfaces.Unsigned_16; -- libusb.h:653
bNumInterfaces : aliased Interfaces.Unsigned_8; -- libusb.h:656
bConfigurationValue : aliased Interfaces.Unsigned_8; -- libusb.h:659
iConfiguration : aliased Interfaces.Unsigned_8; -- libusb.h:662
bmAttributes : aliased Interfaces.Unsigned_8; -- libusb.h:665
MaxPower : aliased Interfaces.Unsigned_8; -- libusb.h:671
c_interface : access constant interface_t; -- libusb.h:675
extra : access unsigned_char; -- libusb.h:679
extra_length : aliased int; -- libusb.h:682
end record;
pragma Convention (C_Pass_By_Copy, config_descriptor); -- libusb.h:643
type ss_endpoint_companion_descriptor is record
bLength : aliased Interfaces.Unsigned_8; -- libusb.h:694
bDescriptorType : aliased Interfaces.Unsigned_8; -- libusb.h:699
bMaxBurst : aliased Interfaces.Unsigned_8; -- libusb.h:704
bmAttributes : aliased Interfaces.Unsigned_8; -- libusb.h:710
wBytesPerInterval : aliased Interfaces.Unsigned_16; -- libusb.h:714
end record;
pragma Convention (C_Pass_By_Copy, ss_endpoint_companion_descriptor); -- libusb.h:691
type bos_dev_capability_descriptor_dev_capability_data_array is array (0 .. -1) of aliased Interfaces.Unsigned_8;
type bos_dev_capability_descriptor is record
bLength : aliased Interfaces.Unsigned_8; -- libusb.h:724
bDescriptorType : aliased Interfaces.Unsigned_8; -- libusb.h:728
bDevCapabilityType : aliased Interfaces.Unsigned_8; -- libusb.h:730
dev_capability_data : aliased bos_dev_capability_descriptor_dev_capability_data_array; -- libusb.h:736
end record;
pragma Convention (C_Pass_By_Copy, bos_dev_capability_descriptor); -- libusb.h:722
type bos_descriptor_dev_capability_array is array (0 .. -1) of access bos_dev_capability_descriptor;
type bos_descriptor is record
bLength : aliased Interfaces.Unsigned_8; -- libusb.h:748
bDescriptorType : aliased Interfaces.Unsigned_8; -- libusb.h:753
wTotalLength : aliased Interfaces.Unsigned_16; -- libusb.h:756
bNumDeviceCaps : aliased Interfaces.Unsigned_8; -- libusb.h:760
dev_capability : bos_descriptor_dev_capability_array; -- libusb.h:767
end record;
pragma Convention (C_Pass_By_Copy, bos_descriptor); -- libusb.h:746
type usb_2_0_extension_descriptor is record
bLength : aliased Interfaces.Unsigned_8; -- libusb.h:779
bDescriptorType : aliased Interfaces.Unsigned_8; -- libusb.h:784
bDevCapabilityType : aliased Interfaces.Unsigned_8; -- libusb.h:789
bmAttributes : aliased Interfaces.Unsigned_32; -- libusb.h:795
end record;
pragma Convention (C_Pass_By_Copy, usb_2_0_extension_descriptor); -- libusb.h:777
type ss_usb_device_capability_descriptor is record
bLength : aliased Interfaces.Unsigned_8; -- libusb.h:805
bDescriptorType : aliased Interfaces.Unsigned_8; -- libusb.h:810
bDevCapabilityType : aliased Interfaces.Unsigned_8; -- libusb.h:815
bmAttributes : aliased Interfaces.Unsigned_8; -- libusb.h:821
wSpeedSupported : aliased Interfaces.Unsigned_16; -- libusb.h:825
bFunctionalitySupport : aliased Interfaces.Unsigned_8; -- libusb.h:831
bU1DevExitLat : aliased Interfaces.Unsigned_8; -- libusb.h:834
bU2DevExitLat : aliased Interfaces.Unsigned_16; -- libusb.h:837
end record;
pragma Convention (C_Pass_By_Copy, ss_usb_device_capability_descriptor); -- libusb.h:803
type container_id_descriptor_ContainerID_array is array (0 .. 15) of aliased Interfaces.Unsigned_8;
type container_id_descriptor is record
bLength : aliased Interfaces.Unsigned_8; -- libusb.h:847
bDescriptorType : aliased Interfaces.Unsigned_8; -- libusb.h:852
bDevCapabilityType : aliased Interfaces.Unsigned_8; -- libusb.h:857
bReserved : aliased Interfaces.Unsigned_8; -- libusb.h:860
ContainerID : aliased container_id_descriptor_ContainerID_array; -- libusb.h:863
end record;
pragma Convention (C_Pass_By_Copy, container_id_descriptor); -- libusb.h:845
type control_setup is record
bmRequestType : aliased Interfaces.Unsigned_8; -- libusb.h:874
bRequest : aliased Interfaces.Unsigned_8; -- libusb.h:881
wValue : aliased Interfaces.Unsigned_16; -- libusb.h:884
wIndex : aliased Interfaces.Unsigned_16; -- libusb.h:888
wLength : aliased Interfaces.Unsigned_16; -- libusb.h:891
end record;
pragma Convention (C_Pass_By_Copy, control_setup); -- libusb.h:868
-- skipped empty struct context
-- skipped empty struct device
-- skipped empty struct device_handle
type version is record
major : aliased Interfaces.Unsigned_16; -- libusb.h:907
minor : aliased Interfaces.Unsigned_16; -- libusb.h:910
micro : aliased Interfaces.Unsigned_16; -- libusb.h:913
nano : aliased Interfaces.Unsigned_16; -- libusb.h:916
rc : Interfaces.C.Strings.chars_ptr; -- libusb.h:919
describe : Interfaces.C.Strings.chars_ptr; -- libusb.h:922
end record;
pragma Convention (C_Pass_By_Copy, version); -- libusb.h:905
type speed is
(LIBUSB_SPEED_UNKNOWN,
SPEED_LOW,
SPEED_FULL,
SPEED_HIGH,
SPEED_SUPER);
pragma Convention (C, speed); -- libusb.h:975
subtype supported_speed is unsigned;
LOW_SPEED_OPERATION : constant supported_speed := 1;
FULL_SPEED_OPERATION : constant supported_speed := 2;
HIGH_SPEED_OPERATION : constant supported_speed := 4;
SUPER_SPEED_OPERATION : constant supported_speed := 8; -- libusb.h:996
subtype usb_2_0_extension_attributes is unsigned;
BM_LPM_SUPPORT : constant usb_2_0_extension_attributes := 2; -- libusb.h:1015
subtype ss_usb_device_capability_attributes is unsigned;
BM_LTM_SUPPORT : constant ss_usb_device_capability_attributes := 2; -- libusb.h:1025
subtype bos_type is unsigned;
BT_WIRELESS_USB_DEVICE_CAPABILITY : constant bos_type := 1;
BT_USB_2_0_EXTENSION : constant bos_type := 2;
BT_SS_USB_DEVICE_CAPABILITY : constant bos_type := 3;
BT_CONTAINER_ID : constant bos_type := 4; -- libusb.h:1033
subtype error is int;
SUCCESS : constant error := 0;
ERROR_IO : constant error := -1;
ERROR_INVALID_PARAM : constant error := -2;
ERROR_ACCESS : constant error := -3;
ERROR_NO_DEVICE : constant error := -4;
ERROR_NOT_FOUND : constant error := -5;
ERROR_BUSY : constant error := -6;
ERROR_TIMEOUT : constant error := -7;
ERROR_OVERFLOW : constant error := -8;
ERROR_PIPE : constant error := -9;
ERROR_INTERRUPTED : constant error := -10;
ERROR_NO_MEM : constant error := -11;
ERROR_NOT_SUPPORTED : constant error := -12;
ERROR_OTHER : constant error := -99; -- libusb.h:1054
type transfer_status is
(TRANSFER_COMPLETED,
TRANSFER_ERROR,
TRANSFER_TIMED_OUT,
TRANSFER_CANCELLED,
TRANSFER_STALL,
TRANSFER_NO_DEVICE,
TRANSFER_OVERFLOW);
pragma Convention (C, transfer_status); -- libusb.h:1106
subtype transfer_flags is unsigned;
TRANSFER_SHORT_NOT_OK : constant transfer_flags := 1;
TRANSFER_FREE_BUFFER : constant transfer_flags := 2;
TRANSFER_FREE_TRANSFER : constant transfer_flags := 4;
TRANSFER_ADD_ZERO_PACKET : constant transfer_flags := 8; -- libusb.h:1136
type iso_packet_descriptor is record
length : aliased unsigned; -- libusb.h:1182
actual_length : aliased unsigned; -- libusb.h:1185
status : aliased transfer_status; -- libusb.h:1188
end record;
pragma Convention (C_Pass_By_Copy, iso_packet_descriptor); -- libusb.h:1180
type transfer_cb_fn is access procedure (arg1 : System.Address);
pragma Convention (C, transfer_cb_fn); -- libusb.h:1202
type transfer_iso_packet_desc_array is array (0 .. -1) of aliased iso_packet_descriptor;
type transfer is record
dev_handle : System.Address; -- libusb.h:1212
flags : aliased Interfaces.Unsigned_8; -- libusb.h:1215
endpoint : aliased unsigned_char; -- libusb.h:1218
c_type : aliased unsigned_char; -- libusb.h:1221
timeout : aliased unsigned; -- libusb.h:1225
status : aliased transfer_status; -- libusb.h:1234
length : aliased int; -- libusb.h:1237
actual_length : aliased int; -- libusb.h:1242
callback : transfer_cb_fn; -- libusb.h:1246
user_data : System.Address; -- libusb.h:1249
buffer : access unsigned_char; -- libusb.h:1252
num_iso_packets : aliased int; -- libusb.h:1256
iso_packet_desc : aliased transfer_iso_packet_desc_array; -- libusb.h:1263
end record;
pragma Convention (C_Pass_By_Copy, transfer); -- libusb.h:1210
subtype capability is unsigned;
CAP_HAS_CAPABILITY : constant capability := 0;
CAP_HAS_HOTPLUG : constant capability := 1;
CAP_HAS_HID_ACCESS : constant capability := 256;
CAP_SUPPORTS_DETACH_KERNEL_DRIVER : constant capability := 257; -- libusb.h:1273
type log_level is
(LIBUSB_LOG_LEVEL_NONE,
LOG_LEVEL_ERROR,
LOG_LEVEL_WARNING,
LOG_LEVEL_INFO,
LOG_LEVEL_DEBUG);
pragma Convention (C, log_level); -- libusb.h:1298
type Context is tagged limited private;
procedure set_debug (ctx : context; level : int); -- libusb.h:1308
function get_version return access constant version; -- libusb.h:1309
function has_capability (capability : Interfaces.Unsigned_32) return int; -- libusb.h:1310
function error_name (errcode : int) return Interfaces.C.Strings.chars_ptr; -- libusb.h:1311
procedure Setlocale (Locale : Interfaces.C.Strings.Chars_Ptr); -- libusb.h:13
function strerror (errcode : error) return Interfaces.C.Strings.chars_ptr; -- libusb.h:1313
type Device is null record;
type Device_Access is access all Device;
type Device_List is tagged record
List : Device_Access;
Len : size_t;
end record;
function Get_Device_List (Ctx : Context'Class) return Device_List; -- libusb.h:1315
procedure free_device_list (list : Device_Access; unref_devices : int); -- libusb.h:1317
function ref_device (dev : Device_Access) return Device_Access; -- libusb.h:1319
procedure unref_device (dev : System.Address); -- libusb.h:1320
function get_configuration (dev : System.Address; config : access int) return int; -- libusb.h:1322
function get_device_descriptor (dev : System.Address; desc : access device_descriptor) return int; -- libusb.h:1324
function get_active_config_descriptor (dev : System.Address; config : System.Address) return int; -- libusb.h:1326
function get_config_descriptor
(dev : System.Address;
config_index : Interfaces.Unsigned_8;
config : System.Address) return int; -- libusb.h:1328
function get_config_descriptor_by_value
(dev : System.Address;
bConfigurationValue : Interfaces.Unsigned_8;
config : System.Address) return int; -- libusb.h:1330
procedure free_config_descriptor (config : access config_descriptor); -- libusb.h:1332
function get_ss_endpoint_companion_descriptor
(ctx : context;
endpoint : access constant endpoint_descriptor;
ep_comp : System.Address) return int; -- libusb.h:1334
procedure free_ss_endpoint_companion_descriptor (ep_comp : access ss_endpoint_companion_descriptor); -- libusb.h:1338
function get_bos_descriptor (dev_handle : System.Address; bos : System.Address) return int; -- libusb.h:1340
procedure free_bos_descriptor (bos : access bos_descriptor); -- libusb.h:1342
function get_usb_2_0_extension_descriptor
(ctx : context;
dev_cap : access bos_dev_capability_descriptor;
usb_2_0_extension : System.Address) return int; -- libusb.h:1343
procedure free_usb_2_0_extension_descriptor (usb_2_0_extension : access usb_2_0_extension_descriptor); -- libusb.h:1347
function get_ss_usb_device_capability_descriptor
(ctx : context;
dev_cap : access bos_dev_capability_descriptor;
ss_usb_device_cap : System.Address) return int; -- libusb.h:1349
procedure free_ss_usb_device_capability_descriptor (ss_usb_device_cap : access ss_usb_device_capability_descriptor); -- libusb.h:1353
function get_container_id_descriptor
(ctx : context;
dev_cap : access bos_dev_capability_descriptor;
container_id : System.Address) return int; -- libusb.h:1355
procedure free_container_id_descriptor (container_id : access container_id_descriptor); -- libusb.h:1358
function get_bus_number (dev : System.Address) return Interfaces.Unsigned_8; -- libusb.h:1360
function get_port_number (dev : System.Address) return Interfaces.Unsigned_8; -- libusb.h:1361
function get_port_numbers
(dev : System.Address;
port_numbers : access Interfaces.Unsigned_8;
port_numbers_len : int) return int; -- libusb.h:1362
function get_port_path
(ctx : context;
dev : System.Address;
path : access Interfaces.Unsigned_8;
path_length : Interfaces.Unsigned_8) return int; -- libusb.h:1364
function get_parent (dev : System.Address) return System.Address; -- libusb.h:1365
function get_device_address (dev : System.Address) return Interfaces.Unsigned_8; -- libusb.h:1366
function get_device_speed (dev : System.Address) return int; -- libusb.h:1367
function get_max_packet_size (dev : System.Address; endpoint : unsigned_char) return int; -- libusb.h:1368
function get_max_iso_packet_size (dev : System.Address; endpoint : unsigned_char) return int; -- libusb.h:1370
function open (dev : System.Address; dev_handle : System.Address) return int; -- libusb.h:1373
procedure close (dev_handle : System.Address); -- libusb.h:1374
function get_device (dev_handle : System.Address) return System.Address; -- libusb.h:1375
function set_configuration (dev_handle : System.Address; configuration : int) return int; -- libusb.h:1377
function claim_interface (dev_handle : System.Address; interface_number : int) return int; -- libusb.h:1379
function release_interface (dev_handle : System.Address; interface_number : int) return int; -- libusb.h:1381
function open_device_with_vid_pid
(ctx : context;
vendor_id : Interfaces.Unsigned_16;
product_id : Interfaces.Unsigned_16) return System.Address; -- libusb.h:1384
function set_interface_alt_setting
(dev_handle : System.Address;
interface_number : int;
alternate_setting : int) return int; -- libusb.h:1387
function clear_halt (dev_handle : System.Address; endpoint : unsigned_char) return int; -- libusb.h:1389
function reset_device (dev_handle : System.Address) return int; -- libusb.h:1391
function alloc_streams
(dev_handle : System.Address;
num_streams : Interfaces.Unsigned_32;
endpoints : access unsigned_char;
num_endpoints : int) return int; -- libusb.h:1393
function free_streams
(dev_handle : System.Address;
endpoints : access unsigned_char;
num_endpoints : int) return int; -- libusb.h:1395
function dev_mem_alloc (dev_handle : System.Address; length : size_t) return access unsigned_char; -- libusb.h:1398
function dev_mem_free
(dev_handle : System.Address;
buffer : access unsigned_char;
length : size_t) return int; -- libusb.h:1400
function kernel_driver_active (dev_handle : System.Address; interface_number : int) return int; -- libusb.h:1403
function detach_kernel_driver (dev_handle : System.Address; interface_number : int) return int; -- libusb.h:1405
function attach_kernel_driver (dev_handle : System.Address; interface_number : int) return int; -- libusb.h:1407
function set_auto_detach_kernel_driver (dev_handle : System.Address; enable : int) return int; -- libusb.h:1409
function control_transfer_get_data (transfe : access transfer) return access unsigned_char; -- libusb.h:1426
function control_transfer_get_setup (transfe : access transfer) return access control_setup; -- libusb.h:1444
procedure fill_control_setup
(buffer : access unsigned_char;
bmRequestType : Interfaces.Unsigned_8;
bRequest : Interfaces.Unsigned_8;
wValue : Interfaces.Unsigned_16;
wIndex : Interfaces.Unsigned_16;
wLength : Interfaces.Unsigned_16); -- libusb.h:1473
function alloc_transfer (iso_packets : int) return access transfer; -- libusb.h:1485
function submit_transfer (transfe : access transfer) return int; -- libusb.h:1486
function cancel_transfer (transfe : access transfer) return int; -- libusb.h:1487
procedure free_transfer (transfe : access transfer); -- libusb.h:1488
procedure transfer_set_stream_id (transfe : access transfer; stream_id : Interfaces.Unsigned_32); -- libusb.h:1489
function transfer_get_stream_id (transfe : access transfer) return Interfaces.Unsigned_32; -- libusb.h:1491
procedure fill_control_transfer
(transfe : access transfer;
dev_handle : System.Address;
buffer : access unsigned_char;
callback : transfer_cb_fn;
user_data : System.Address;
timeout : unsigned); -- libusb.h:1522
procedure fill_bulk_transfer
(transfe : access transfer;
dev_handle : System.Address;
endpoint : unsigned_char;
buffer : access unsigned_char;
length : int;
callback : transfer_cb_fn;
user_data : System.Address;
timeout : unsigned); -- libusb.h:1553
procedure fill_bulk_stream_transfer
(transfe : access transfer;
dev_handle : System.Address;
endpoint : unsigned_char;
stream_id : Interfaces.Unsigned_32;
buffer : access unsigned_char;
length : int;
callback : transfer_cb_fn;
user_data : System.Address;
timeout : unsigned); -- libusb.h:1584
procedure fill_interrupt_transfer
(transfe : access transfer;
dev_handle : System.Address;
endpoint : unsigned_char;
buffer : access unsigned_char;
length : int;
callback : transfer_cb_fn;
user_data : System.Address;
timeout : unsigned); -- libusb.h:1609
procedure fill_iso_transfer
(transfe : access transfer;
dev_handle : System.Address;
endpoint : unsigned_char;
buffer : access unsigned_char;
length : int;
num_iso_packets : int;
callback : transfer_cb_fn;
user_data : System.Address;
timeout : unsigned); -- libusb.h:1638
procedure set_iso_packet_lengths (transfe : access transfer; length : unsigned); -- libusb.h:1662
function get_iso_packet_buffer (transfe : access transfer; packet : unsigned) return access unsigned_char; -- libusb.h:1686
function get_iso_packet_buffer_simple (transfe : access transfer; packet : unsigned) return access unsigned_char; -- libusb.h:1728
function control_transfer
(dev_handle : System.Address;
request_type : Interfaces.Unsigned_8;
bRequest : Interfaces.Unsigned_8;
wValue : Interfaces.Unsigned_16;
wIndex : Interfaces.Unsigned_16;
data : access unsigned_char;
wLength : Interfaces.Unsigned_16;
timeout : unsigned) return int; -- libusb.h:1748
function bulk_transfer
(dev_handle : System.Address;
endpoint : unsigned_char;
data : access unsigned_char;
length : int;
actual_length : access int;
timeout : unsigned) return int; -- libusb.h:1752
function interrupt_transfer
(dev_handle : System.Address;
endpoint : unsigned_char;
data : access unsigned_char;
length : int;
actual_length : access int;
timeout : unsigned) return int; -- libusb.h:1756
function get_descriptor
(dev_handle : System.Address;
desc_type : Interfaces.Unsigned_8;
desc_index : Interfaces.Unsigned_8;
data : access unsigned_char;
length : int) return int; -- libusb.h:1772
function get_string_descriptor
(dev_handle : System.Address;
desc_index : Interfaces.Unsigned_8;
langid : Interfaces.Unsigned_16;
data : access unsigned_char;
length : int) return int; -- libusb.h:1794
function get_string_descriptor_ascii
(dev_handle : System.Address;
desc_index : Interfaces.Unsigned_8;
data : access unsigned_char;
length : int) return int; -- libusb.h:1802
function try_lock_events (ctx : context) return int; -- libusb.h:1807
procedure lock_events (ctx : context); -- libusb.h:1808
procedure unlock_events (ctx : context); -- libusb.h:1809
function event_handling_ok (ctx : context) return int; -- libusb.h:1810
function event_handler_active (ctx : context) return int; -- libusb.h:1811
procedure interrupt_event_handler (ctx : context); -- libusb.h:1812
procedure lock_event_waiters (ctx : context); -- libusb.h:1813
procedure unlock_event_waiters (ctx : context); -- libusb.h:1814
function wait_for_event (ctx : context; tv : Duration) return int; -- libusb.h:1815
function handle_events_timeout (ctx : context; tv : Duration) return int; -- libusb.h:1817
function handle_events_timeout_completed
(ctx : context;
completed : access int) return int; -- libusb.h:1819
function handle_events (ctx : context) return int; -- libusb.h:1821
function handle_events_completed (ctx : context; completed : access int) return int; -- libusb.h:1822
function handle_events_locked (ctx : context; tv : Duration) return int; -- libusb.h:1823
function pollfds_handle_timeouts (ctx : context) return int; -- libusb.h:1825
function get_next_timeout (Ctx : Context;
Tv : Duration)
return Int; -- libusb.h:1826
type pollfd is record
fd : aliased int; -- libusb.h:1834
events : aliased short; -- libusb.h:1840
end record;
pragma Convention (C_Pass_By_Copy, pollfd); -- libusb.h:1832
type pollfd_added_cb is access procedure
(arg1 : int;
arg2 : short;
arg3 : System.Address);
pragma Convention (C, pollfd_added_cb); -- libusb.h:1853
type pollfd_removed_cb is access procedure (arg1 : int; arg2 : System.Address);
pragma Convention (C, pollfd_removed_cb); -- libusb.h:1865
function get_pollfds (ctx : context) return System.Address; -- libusb.h:1867
procedure free_pollfds (pollfds : System.Address); -- libusb.h:1869
procedure set_pollfd_notifiers
(ctx : context;
added_cb : pollfd_added_cb;
removed_cb : pollfd_removed_cb;
user_data : System.Address); -- libusb.h:1870
subtype hotplug_callback_handle is int; -- libusb.h:1886
type hotplug_flag is
(LIBUSB_HOTPLUG_NO_FLAGS,
HOTPLUG_ENUMERATE);
pragma Convention (C, hotplug_flag); -- libusb.h:1899
subtype hotplug_event is unsigned;
HOTPLUG_EVENT_DEVICE_ARRIVED : constant hotplug_event := 1;
HOTPLUG_EVENT_DEVICE_LEFT : constant hotplug_event := 2; -- libusb.h:1914
type hotplug_callback_fn is access function
(arg1 : System.Address;
arg2 : System.Address;
arg3 : hotplug_event;
arg4 : System.Address) return int;
pragma Convention (C, hotplug_callback_fn); -- libusb.h:1942
function hotplug_register_callback
(ctx : context;
events : hotplug_event;
flags : hotplug_flag;
vendor_id : int;
product_id : int;
dev_class : int;
cb_fn : hotplug_callback_fn;
user_data : System.Address;
callback_handle : access hotplug_callback_handle) return int; -- libusb.h:1981
procedure hotplug_deregister_callback (ctx : context; callback_handle : hotplug_callback_handle); -- libusb.h:2001
private
procedure Ret2exception (Code : Int) is null;
type Context is new Ada.Finalization.Limited_Controlled with record
Ctx : System.Address;
end record;
procedure Initialize (Ctx : in out Context);
procedure Finalize (Ctx : in out Context);
end USB;
|
with Ada.Containers.Hashed_Maps,
Ada.Containers.Ordered_Sets,
Ada.Containers.Unbounded_Synchronized_Queues,
Ada.Containers.Synchronized_Queue_Interfaces,
Ada.Containers.Vectors,
Ada.Execution_Time,
Ada.Exceptions,
Ada.Integer_Text_IO,
Ada.Real_Time,
Ada.Text_IO;
with Utils;
procedure Main is
use Ada.Containers,
Ada.Execution_Time,
Ada.Real_Time,
Ada.Text_IO;
use Utils;
type Bingo_Range is range 1 .. 5;
subtype Bingo_Values is Natural range 0 .. 99;
package Bingo_Values_IO is new Ada.Text_IO.Integer_IO (Bingo_Values);
use Bingo_Values_IO;
type Grid_Element is record
Value : Bingo_Values;
Marked : Boolean;
end record;
type Lookup_Item is record
Board_Id : Natural;
Line : Bingo_Range;
Column : Bingo_Range;
end record;
package Lookup_Item_Vectors is new Ada.Containers.Vectors (Natural, Lookup_Item);
function Bingo_Range_Hash (Elt : Bingo_Values) return Ada.Containers.Hash_Type is (Ada.Containers.Hash_Type (Elt));
package Lookup_Map is new Ada.Containers.Hashed_Maps (Key_Type => Bingo_Values,
Element_Type => Lookup_Item_Vectors.Vector,
Hash => Bingo_Range_Hash,
Equivalent_Keys => "=",
"=" => Lookup_Item_Vectors."=");
use Lookup_Map;
package Winner_Boards_Sets is new Ada.Containers.Ordered_Sets (Element_Type => Natural);
use Winner_Boards_Sets;
-- Given a Lookup map, it add an element to the specified value.
-- @param Lookup Lookup map to update
-- @param Value Id in the map "Lookup"
-- @param Board_Id Property of the Lookup_Item that will be added to the vector at id "Value"
-- @param Line Property of the Lookup_Item that will be added to the vector at id "Value"
-- @param Column Property of the Lookup_Item that will be added to the vector at id "Value"
procedure Update_Lookup (Lookup : in out Map; Value : Bingo_Values; Board_Id : Natural; Line, Column : Bingo_Range);
-------------------
-- Update_Lookup --
-------------------
procedure Update_Lookup (Lookup : in out Map; Value : Bingo_Values; Board_Id : Natural; Line, Column : Bingo_Range)
is
use Lookup_Item_Vectors;
Item : constant Lookup_Item := (Board_Id, Line, Column);
Vec : Lookup_Item_Vectors.Vector := Lookup.Element (Value);
begin
Vec.Append (Item);
Lookup.Replace_Element (Lookup.Find (Value), Vec);
end Update_Lookup;
type Grid is array (Bingo_Range, Bingo_Range) of Grid_Element;
package Grid_Vectors is new Ada.Containers.Vectors (Natural, Grid);
use Grid_Vectors;
package Bingo_Values_Queue_Interfaces is
new Ada.Containers.Synchronized_Queue_Interfaces
(Element_Type => Bingo_Values);
package Bingo_Balls is new Ada.Containers.Unbounded_Synchronized_Queues
(Queue_Interfaces => Bingo_Values_Queue_Interfaces);
use Bingo_Balls;
-- Tell if there is a bingo.
-- @param Board The board to check
-- @param Line The marked line
-- @param Column The marked column
-- @returns Return True if there is a bingo, False otherwise
function Is_Bingo (Board : Grid; Line, Column : Bingo_Range) return Boolean;
--------------
-- Is_Bingo --
--------------
function Is_Bingo (Board : Grid; Line, Column : Bingo_Range) return Boolean is
Line_Bingo, Column_Bingo : Boolean := True;
begin
for Index in Bingo_Range loop
Line_Bingo := Line_Bingo and Board (Index, Column).Marked;
Column_Bingo := Column_Bingo and Board (Line, Index).Marked;
if not Line_Bingo and not Column_Bingo then
return False;
end if;
end loop;
return True;
end Is_Bingo;
-- Compute the value of a board according to the exercice.
-- Formula: "sum of all unmarked numbers" x Current_Value
-- @param Board the winning board
-- @param Current_Value The last number called
-- @returns Returns the result of the calculation
function Compute_Board_Value (Board : Grid; Current_Value : Bingo_Values) return Natural;
-------------------------
-- Compute_Board_Value --
-------------------------
function Compute_Board_Value (Board : Grid; Current_Value : Bingo_Values) return Natural is
Sum : Natural := Natural'First;
begin
for Line in Board'Range (1) loop
for Column in Board'Range (2) loop
if not Board (Line, Column).Marked then
Sum := Sum + Board (Line, Column).Value;
end if;
end loop;
end loop;
return Sum * Current_Value;
end Compute_Board_Value;
File : File_Type;
Ball_Box : Queue;
Boards : Vector := Empty_Vector;
Lookup : Map := Empty_Map;
Winner_Boards : Set := Empty_Set;
Start_Time, End_Time : CPU_Time;
Execution_Duration : Time_Span;
begin
Get_File (File);
if End_Of_File (File) then
raise Program_Error with "Empty file";
end if;
Fill_Ball_Box : declare
Line : constant String := Get_Line (File);
First : Positive := Line'First;
Last : Positive := Line'First;
Last_Index : Positive := Line'First;
Value : Bingo_Values;
begin
while Last <= Line'Last loop
if Line (Last .. Last) = "," then
Get (Line (First .. Last - 1), Value, Last_Index);
Ball_Box.Enqueue (Value);
Lookup.Insert (Value, Lookup_Item_Vectors.Empty_Vector);
First := Last + 1;
elsif Last = Line'Last then
Get (Line (First .. Line'Last), Value, Last_Index);
Ball_Box.Enqueue (Value);
Lookup.Insert (Value, Lookup_Item_Vectors.Empty_Vector);
First := Last + 1;
end if;
Last := Last + 1;
end loop;
end Fill_Ball_Box;
-- Get all boards
Load_Boards : declare
Line_Index : Bingo_Range := Bingo_Range'First;
Column_Index : Bingo_Range := Bingo_Range'First;
Value : Bingo_Values;
Board : Grid;
begin
while not End_Of_File (File) loop
declare
Line : constant String := Get_Line (File);
Last : Positive := Line'First;
begin
while Last < Line'Last loop
Get (Line (Last .. Line'Last), Value, Last);
Board (Line_Index, Column_Index) := (Value, False);
Update_Lookup (Lookup => Lookup,
Value => Value,
Board_Id => Natural (Boards.Length),
Line => Line_Index,
Column => Column_Index);
if Column_Index = Bingo_Range'Last then
Column_Index := Bingo_Range'First;
if Line_Index = Bingo_Range'Last then
Line_Index := Bingo_Range'First;
Boards.Append (Board);
else
Line_Index := Line_Index + 1;
end if;
else
Column_Index := Column_Index + 1;
end if;
Last := Last + 1;
end loop;
end;
end loop;
end Load_Boards;
Start_Time := Ada.Execution_Time.Clock;
Solve_Puzzle : declare
Current_Value : Bingo_Values;
Current_Found : Lookup_Item_Vectors.Vector;
begin
Solve : loop
Ball_Box.Dequeue (Current_Value);
Current_Found := Lookup.Element (Current_Value);
-- The case where a number is not found in any boards
if Current_Found.Is_Empty then
goto Continue;
end if;
-- For each times the current value is on a board
for Current_Lookup of Current_Found loop
declare
Current_Board : Grid := Boards.Element (Current_Lookup.Board_Id);
begin
Current_Board (Current_Lookup.Line, Current_Lookup.Column).Marked := True;
Boards.Replace_Element (Current_Lookup.Board_Id, Current_Board);
if not Winner_Boards.Contains (Current_Lookup.Board_Id)
and then Is_Bingo (Current_Board, Current_Lookup.Line, Current_Lookup.Column)
then
Winner_Boards.Insert (Current_Lookup.Board_Id);
if Winner_Boards.Length = Boards.Length then
Put ("Result: ");
Ada.Integer_Text_IO.Put (Compute_Board_Value (Current_Board, Current_Value), Width => 0);
New_Line;
exit Solve;
end if;
end if;
end;
end loop;
<<Continue>>
exit Solve when Ball_Box.Current_Use = 0;
end loop Solve;
end Solve_Puzzle;
End_Time := Ada.Execution_Time.Clock;
Execution_Duration := End_Time - Start_Time;
Put_Line ("(Took " & Duration'Image (To_Duration (Execution_Duration) * 1_000_000) & "µs)");
Close_If_Open (File);
exception
when Occur : others =>
Put_Line ("Error: " & Ada.Exceptions.Exception_Message (Occur));
Close_If_Open (File);
end Main;
|
-- Copyright 2008-2016 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package Pck is
type Wrap is private;
function Create return Wrap;
private
type Empty;
type Empty_Access is access Empty;
type Wrap is record
E : Empty_Access;
end record;
end Pck;
|
with Test_Solution; use Test_Solution;
package Problem_11 is
type Grid is array(Natural range <>, Natural range <>) of Natural;
function Solution_1( G : Grid ) return Integer
with Pre => G'Length(1) = G'Length(2);
procedure Test_Solution_1;
function Get_Solutions return Solution_Case;
end Problem_11;
|
-- Copyright 2015-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/>.
package body Pck is
procedure Do_Nothing (A : A_Type) is
begin
null;
end Do_Nothing;
end Pck;
|
with Tkmrpc.Servers.Ike;
with Tkmrpc.Results;
with Tkmrpc.Request.Ike.Isa_Skip_Create_First.Convert;
with Tkmrpc.Response.Ike.Isa_Skip_Create_First.Convert;
package body Tkmrpc.Operation_Handlers.Ike.Isa_Skip_Create_First is
-------------------------------------------------------------------------
procedure Handle (Req : Request.Data_Type; Res : out Response.Data_Type) is
Specific_Req : Request.Ike.Isa_Skip_Create_First.Request_Type;
Specific_Res : Response.Ike.Isa_Skip_Create_First.Response_Type;
begin
Specific_Res := Response.Ike.Isa_Skip_Create_First.Null_Response;
Specific_Req :=
Request.Ike.Isa_Skip_Create_First.Convert.From_Request (S => Req);
if Specific_Req.Data.Isa_Id'Valid then
Servers.Ike.Isa_Skip_Create_First
(Result => Specific_Res.Header.Result,
Isa_Id => Specific_Req.Data.Isa_Id);
Res :=
Response.Ike.Isa_Skip_Create_First.Convert.To_Response
(S => Specific_Res);
else
Res.Header.Result := Results.Invalid_Parameter;
end if;
end Handle;
end Tkmrpc.Operation_Handlers.Ike.Isa_Skip_Create_First;
|
-----------------------------------------------------------------------
-- receiver -- Ethernet Packet Receiver
-- Copyright (C) 2016, 2017 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.Real_Time;
with Ada.Synchronous_Task_Control;
with Net.Buffers;
with Net.Protos.Arp;
with Net.Protos.Dispatchers;
with Net.Headers;
with Demos;
package body Receiver is
use type Net.Ip_Addr;
use type Net.Uint8;
use type Net.Uint16;
Ready : Ada.Synchronous_Task_Control.Suspension_Object;
ONE_US : constant Ada.Real_Time.Time_Span := Ada.Real_Time.Microseconds (1);
-- ------------------------------
-- Start the receiver loop.
-- ------------------------------
procedure Start is
begin
Ada.Synchronous_Task_Control.Set_True (Ready);
end Start;
task body Controller is
use type Ada.Real_Time.Time;
use type Ada.Real_Time.Time_Span;
use type Net.Uint64;
Packet : Net.Buffers.Buffer_Type;
Ether : Net.Headers.Ether_Header_Access;
Now : Ada.Real_Time.Time;
Dt : Us_Time;
Total : Net.Uint64 := 0;
Count : Net.Uint64 := 0;
begin
-- Wait until the Ethernet driver is ready.
Ada.Synchronous_Task_Control.Suspend_Until_True (Ready);
-- Loop receiving packets and dispatching them.
Min_Receive_Time := Us_Time'Last;
Max_Receive_Time := Us_Time'First;
loop
if Packet.Is_Null then
Net.Buffers.Allocate (Packet);
end if;
if not Packet.Is_Null then
Demos.Ifnet.Receive (Packet);
Now := Ada.Real_Time.Clock;
Ether := Packet.Ethernet;
if Ether.Ether_Type = Net.Headers.To_Network (Net.Protos.ETHERTYPE_ARP) then
Net.Protos.Arp.Receive (Demos.Ifnet, Packet);
elsif Ether.Ether_Type = Net.Headers.To_Network (Net.Protos.ETHERTYPE_IP) then
Net.Protos.Dispatchers.Receive (Demos.Ifnet, Packet);
end if;
-- Compute the time taken to process the packet in microseconds.
Dt := Us_Time ((Ada.Real_Time.Clock - Now) / ONE_US);
-- Compute average, min and max values.
Count := Count + 1;
Total := Total + Net.Uint64 (Dt);
Avg_Receive_Time := Us_Time (Total / Count);
if Dt < Min_Receive_Time then
Min_Receive_Time := Dt;
end if;
if Dt > Max_Receive_Time then
Max_Receive_Time := Dt;
end if;
else
delay until Ada.Real_Time.Clock + Ada.Real_Time.Milliseconds (100);
end if;
end loop;
end Controller;
end Receiver;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E X P _ C H 4 --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-2001, 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. --
-- --
-- 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 Checks; use Checks;
with Einfo; use Einfo;
with Elists; use Elists;
with Errout; use Errout;
with Exp_Aggr; use Exp_Aggr;
with Exp_Ch3; use Exp_Ch3;
with Exp_Ch7; use Exp_Ch7;
with Exp_Ch9; use Exp_Ch9;
with Exp_Disp; use Exp_Disp;
with Exp_Fixd; use Exp_Fixd;
with Exp_Pakd; use Exp_Pakd;
with Exp_Tss; use Exp_Tss;
with Exp_Util; use Exp_Util;
with Exp_VFpt; use Exp_VFpt;
with Hostparm; use Hostparm;
with Inline; use Inline;
with Nlists; use Nlists;
with Nmake; use Nmake;
with Opt; use Opt;
with Rtsfind; use Rtsfind;
with Sem; use Sem;
with Sem_Cat; use Sem_Cat;
with Sem_Ch13; use Sem_Ch13;
with Sem_Eval; use Sem_Eval;
with Sem_Res; use Sem_Res;
with Sem_Type; use Sem_Type;
with Sem_Util; use Sem_Util;
with Sinfo; use Sinfo;
with Sinfo.CN; use Sinfo.CN;
with Snames; use Snames;
with Stand; use Stand;
with Tbuild; use Tbuild;
with Ttypes; use Ttypes;
with Uintp; use Uintp;
with Urealp; use Urealp;
with Validsw; use Validsw;
package body Exp_Ch4 is
------------------------
-- Local Subprograms --
------------------------
procedure Binary_Op_Validity_Checks (N : Node_Id);
pragma Inline (Binary_Op_Validity_Checks);
-- Performs validity checks for a binary operator
procedure Expand_Array_Comparison (N : Node_Id);
-- This routine handles expansion of the comparison operators (N_Op_Lt,
-- N_Op_Le, N_Op_Gt, N_Op_Ge) when operating on an array type. The basic
-- code for these operators is similar, differing only in the details of
-- the actual comparison call that is made.
function Expand_Array_Equality
(Nod : Node_Id;
Typ : Entity_Id;
A_Typ : Entity_Id;
Lhs : Node_Id;
Rhs : Node_Id;
Bodies : List_Id)
return Node_Id;
-- Expand an array equality into a call to a function implementing this
-- equality, and a call to it. Loc is the location for the generated
-- nodes. Typ is the type of the array, and Lhs, Rhs are the array
-- expressions to be compared. A_Typ is the type of the arguments,
-- which may be a private type, in which case Typ is its full view.
-- Bodies is a list on which to attach bodies of local functions that
-- are created in the process. This is the responsability of the
-- caller to insert those bodies at the right place. Nod provides
-- the Sloc value for the generated code.
procedure Expand_Boolean_Operator (N : Node_Id);
-- Common expansion processing for Boolean operators (And, Or, Xor)
-- for the case of array type arguments.
function Expand_Composite_Equality
(Nod : Node_Id;
Typ : Entity_Id;
Lhs : Node_Id;
Rhs : Node_Id;
Bodies : List_Id)
return Node_Id;
-- Local recursive function used to expand equality for nested
-- composite types. Used by Expand_Record/Array_Equality, Bodies
-- is a list on which to attach bodies of local functions that are
-- created in the process. This is the responsability of the caller
-- to insert those bodies at the right place. Nod provides the Sloc
-- value for generated code.
procedure Expand_Concatenate_Other (Cnode : Node_Id; Opnds : List_Id);
-- This routine handles expansion of concatenation operations, where
-- N is the N_Op_Concat node being expanded and Operands is the list
-- of operands (at least two are present). The caller has dealt with
-- converting any singleton operands into singleton aggregates.
procedure Expand_Concatenate_String (Cnode : Node_Id; Opnds : List_Id);
-- Routine to expand concatenation of 2-5 operands (in the list Operands)
-- and replace node Cnode with the result of the contatenation. If there
-- are two operands, they can be string or character. If there are more
-- than two operands, then are always of type string (i.e. the caller has
-- already converted character operands to strings in this case).
procedure Fixup_Universal_Fixed_Operation (N : Node_Id);
-- N is either an N_Op_Divide or N_Op_Multiply node whose result is
-- universal fixed. We do not have such a type at runtime, so the
-- purpose of this routine is to find the real type by looking up
-- the tree. We also determine if the operation must be rounded.
procedure Insert_Dereference_Action (N : Node_Id);
-- N is an expression whose type is an access. When the type is derived
-- from Checked_Pool, expands a call to the primitive 'dereference'.
function Make_Array_Comparison_Op
(Typ : Entity_Id;
Nod : Node_Id)
return Node_Id;
-- Comparisons between arrays are expanded in line. This function
-- produces the body of the implementation of (a > b), where a and b
-- are one-dimensional arrays of some discrete type. The original
-- node is then expanded into the appropriate call to this function.
-- Nod provides the Sloc value for the generated code.
function Make_Boolean_Array_Op
(Typ : Entity_Id;
N : Node_Id)
return Node_Id;
-- Boolean operations on boolean arrays are expanded in line. This
-- function produce the body for the node N, which is (a and b),
-- (a or b), or (a xor b). It is used only the normal case and not
-- the packed case. The type involved, Typ, is the Boolean array type,
-- and the logical operations in the body are simple boolean operations.
-- Note that Typ is always a constrained type (the caller has ensured
-- this by using Convert_To_Actual_Subtype if necessary).
procedure Rewrite_Comparison (N : Node_Id);
-- N is the node for a compile time comparison. If this outcome of this
-- comparison can be determined at compile time, then the node N can be
-- rewritten with True or False. If the outcome cannot be determined at
-- compile time, the call has no effect.
function Tagged_Membership (N : Node_Id) return Node_Id;
-- Construct the expression corresponding to the tagged membership test.
-- Deals with a second operand being (or not) a class-wide type.
procedure Unary_Op_Validity_Checks (N : Node_Id);
pragma Inline (Unary_Op_Validity_Checks);
-- Performs validity checks for a unary operator
-------------------------------
-- Binary_Op_Validity_Checks --
-------------------------------
procedure Binary_Op_Validity_Checks (N : Node_Id) is
begin
if Validity_Checks_On and Validity_Check_Operands then
Ensure_Valid (Left_Opnd (N));
Ensure_Valid (Right_Opnd (N));
end if;
end Binary_Op_Validity_Checks;
-----------------------------
-- Expand_Array_Comparison --
-----------------------------
-- Expansion is only required in the case of array types. The form of
-- the expansion is:
-- [body for greater_nn; boolean_expression]
-- The body is built by Make_Array_Comparison_Op, and the form of the
-- Boolean expression depends on the operator involved.
procedure Expand_Array_Comparison (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Op1 : Node_Id := Left_Opnd (N);
Op2 : Node_Id := Right_Opnd (N);
Typ1 : constant Entity_Id := Base_Type (Etype (Op1));
Expr : Node_Id;
Func_Body : Node_Id;
Func_Name : Entity_Id;
begin
-- For (a <= b) we convert to not (a > b)
if Chars (N) = Name_Op_Le then
Rewrite (N,
Make_Op_Not (Loc,
Right_Opnd =>
Make_Op_Gt (Loc,
Left_Opnd => Op1,
Right_Opnd => Op2)));
Analyze_And_Resolve (N, Standard_Boolean);
return;
-- For < the Boolean expression is
-- greater__nn (op2, op1)
elsif Chars (N) = Name_Op_Lt then
Func_Body := Make_Array_Comparison_Op (Typ1, N);
-- Switch operands
Op1 := Right_Opnd (N);
Op2 := Left_Opnd (N);
-- For (a >= b) we convert to not (a < b)
elsif Chars (N) = Name_Op_Ge then
Rewrite (N,
Make_Op_Not (Loc,
Right_Opnd =>
Make_Op_Lt (Loc,
Left_Opnd => Op1,
Right_Opnd => Op2)));
Analyze_And_Resolve (N, Standard_Boolean);
return;
-- For > the Boolean expression is
-- greater__nn (op1, op2)
else
pragma Assert (Chars (N) = Name_Op_Gt);
Func_Body := Make_Array_Comparison_Op (Typ1, N);
end if;
Func_Name := Defining_Unit_Name (Specification (Func_Body));
Expr :=
Make_Function_Call (Loc,
Name => New_Reference_To (Func_Name, Loc),
Parameter_Associations => New_List (Op1, Op2));
Insert_Action (N, Func_Body);
Rewrite (N, Expr);
Analyze_And_Resolve (N, Standard_Boolean);
end Expand_Array_Comparison;
---------------------------
-- Expand_Array_Equality --
---------------------------
-- Expand an equality function for multi-dimensional arrays. Here is
-- an example of such a function for Nb_Dimension = 2
-- function Enn (A : arr; B : arr) return boolean is
-- J1 : integer;
-- J2 : integer;
--
-- begin
-- if A'length (1) /= B'length (1) then
-- return false;
-- else
-- J1 := B'first (1);
-- for I1 in A'first (1) .. A'last (1) loop
-- if A'length (2) /= B'length (2) then
-- return false;
-- else
-- J2 := B'first (2);
-- for I2 in A'first (2) .. A'last (2) loop
-- if A (I1, I2) /= B (J1, J2) then
-- return false;
-- end if;
-- J2 := Integer'succ (J2);
-- end loop;
-- end if;
-- J1 := Integer'succ (J1);
-- end loop;
-- end if;
-- return true;
-- end Enn;
function Expand_Array_Equality
(Nod : Node_Id;
Typ : Entity_Id;
A_Typ : Entity_Id;
Lhs : Node_Id;
Rhs : Node_Id;
Bodies : List_Id)
return Node_Id
is
Loc : constant Source_Ptr := Sloc (Nod);
Actuals : List_Id;
Decls : List_Id := New_List;
Index_List1 : List_Id := New_List;
Index_List2 : List_Id := New_List;
Formals : List_Id;
Stats : Node_Id;
Func_Name : Entity_Id;
Func_Body : Node_Id;
A : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uA);
B : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uB);
function Component_Equality (Typ : Entity_Id) return Node_Id;
-- Create one statement to compare corresponding components, designated
-- by a full set of indices.
function Loop_One_Dimension
(N : Int;
Index : Node_Id)
return Node_Id;
-- Loop over the n'th dimension of the arrays. The single statement
-- in the body of the loop is a loop over the next dimension, or
-- the comparison of corresponding components.
------------------------
-- Component_Equality --
------------------------
function Component_Equality (Typ : Entity_Id) return Node_Id is
Test : Node_Id;
L, R : Node_Id;
begin
-- if a(i1...) /= b(j1...) then return false; end if;
L :=
Make_Indexed_Component (Loc,
Prefix => Make_Identifier (Loc, Chars (A)),
Expressions => Index_List1);
R :=
Make_Indexed_Component (Loc,
Prefix => Make_Identifier (Loc, Chars (B)),
Expressions => Index_List2);
Test := Expand_Composite_Equality
(Nod, Component_Type (Typ), L, R, Decls);
return
Make_Implicit_If_Statement (Nod,
Condition => Make_Op_Not (Loc, Right_Opnd => Test),
Then_Statements => New_List (
Make_Return_Statement (Loc,
Expression => New_Occurrence_Of (Standard_False, Loc))));
end Component_Equality;
------------------------
-- Loop_One_Dimension --
------------------------
function Loop_One_Dimension
(N : Int;
Index : Node_Id)
return Node_Id
is
I : constant Entity_Id := Make_Defining_Identifier (Loc,
New_Internal_Name ('I'));
J : constant Entity_Id := Make_Defining_Identifier (Loc,
New_Internal_Name ('J'));
Index_Type : Entity_Id;
Stats : Node_Id;
begin
if N > Number_Dimensions (Typ) then
return Component_Equality (Typ);
else
-- Generate the following:
-- j: index_type;
-- ...
-- if a'length (n) /= b'length (n) then
-- return false;
-- else
-- j := b'first (n);
-- for i in a'range (n) loop
-- -- loop over remaining dimensions.
-- j := index_type'succ (j);
-- end loop;
-- end if;
-- retrieve index type for current dimension.
Index_Type := Base_Type (Etype (Index));
Append (New_Reference_To (I, Loc), Index_List1);
Append (New_Reference_To (J, Loc), Index_List2);
-- Declare index for j as a local variable to the function.
-- Index i is a loop variable.
Append_To (Decls,
Make_Object_Declaration (Loc,
Defining_Identifier => J,
Object_Definition => New_Reference_To (Index_Type, Loc)));
Stats :=
Make_Implicit_If_Statement (Nod,
Condition =>
Make_Op_Ne (Loc,
Left_Opnd =>
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (A, Loc),
Attribute_Name => Name_Length,
Expressions => New_List (
Make_Integer_Literal (Loc, N))),
Right_Opnd =>
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (B, Loc),
Attribute_Name => Name_Length,
Expressions => New_List (
Make_Integer_Literal (Loc, N)))),
Then_Statements => New_List (
Make_Return_Statement (Loc,
Expression => New_Occurrence_Of (Standard_False, Loc))),
Else_Statements => New_List (
Make_Assignment_Statement (Loc,
Name => New_Reference_To (J, Loc),
Expression =>
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (B, Loc),
Attribute_Name => Name_First,
Expressions => New_List (
Make_Integer_Literal (Loc, N)))),
Make_Implicit_Loop_Statement (Nod,
Identifier => Empty,
Iteration_Scheme =>
Make_Iteration_Scheme (Loc,
Loop_Parameter_Specification =>
Make_Loop_Parameter_Specification (Loc,
Defining_Identifier => I,
Discrete_Subtype_Definition =>
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (A, Loc),
Attribute_Name => Name_Range,
Expressions => New_List (
Make_Integer_Literal (Loc, N))))),
Statements => New_List (
Loop_One_Dimension (N + 1, Next_Index (Index)),
Make_Assignment_Statement (Loc,
Name => New_Reference_To (J, Loc),
Expression =>
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Index_Type, Loc),
Attribute_Name => Name_Succ,
Expressions => New_List (
New_Reference_To (J, Loc))))))));
return Stats;
end if;
end Loop_One_Dimension;
-- Start of processing for Expand_Array_Equality
begin
Formals := New_List (
Make_Parameter_Specification (Loc,
Defining_Identifier => A,
Parameter_Type => New_Reference_To (Typ, Loc)),
Make_Parameter_Specification (Loc,
Defining_Identifier => B,
Parameter_Type => New_Reference_To (Typ, Loc)));
Func_Name := Make_Defining_Identifier (Loc, New_Internal_Name ('E'));
Stats := Loop_One_Dimension (1, First_Index (Typ));
Func_Body :=
Make_Subprogram_Body (Loc,
Specification =>
Make_Function_Specification (Loc,
Defining_Unit_Name => Func_Name,
Parameter_Specifications => Formals,
Subtype_Mark => New_Reference_To (Standard_Boolean, Loc)),
Declarations => Decls,
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
Statements => New_List (
Stats,
Make_Return_Statement (Loc,
Expression => New_Occurrence_Of (Standard_True, Loc)))));
Set_Has_Completion (Func_Name, True);
-- If the array type is distinct from the type of the arguments,
-- it is the full view of a private type. Apply an unchecked
-- conversion to insure that analysis of the call succeeds.
if Base_Type (A_Typ) /= Base_Type (Typ) then
Actuals := New_List (
OK_Convert_To (Typ, Lhs),
OK_Convert_To (Typ, Rhs));
else
Actuals := New_List (Lhs, Rhs);
end if;
Append_To (Bodies, Func_Body);
return
Make_Function_Call (Loc,
Name => New_Reference_To (Func_Name, Loc),
Parameter_Associations => Actuals);
end Expand_Array_Equality;
-----------------------------
-- Expand_Boolean_Operator --
-----------------------------
-- Note that we first get the actual subtypes of the operands,
-- since we always want to deal with types that have bounds.
procedure Expand_Boolean_Operator (N : Node_Id) is
Typ : constant Entity_Id := Etype (N);
begin
if Is_Bit_Packed_Array (Typ) then
Expand_Packed_Boolean_Operator (N);
else
-- For the normal non-packed case, the expansion is
-- to build a function for carrying out the comparison
-- (using Make_Boolean_Array_Op) and then inserting it
-- into the tree. The original operator node is then
-- rewritten as a call to this function.
declare
Loc : constant Source_Ptr := Sloc (N);
L : constant Node_Id := Relocate_Node (Left_Opnd (N));
R : constant Node_Id := Relocate_Node (Right_Opnd (N));
Func_Body : Node_Id;
Func_Name : Entity_Id;
begin
Convert_To_Actual_Subtype (L);
Convert_To_Actual_Subtype (R);
Ensure_Defined (Etype (L), N);
Ensure_Defined (Etype (R), N);
Apply_Length_Check (R, Etype (L));
Func_Body := Make_Boolean_Array_Op (Etype (L), N);
Func_Name := Defining_Unit_Name (Specification (Func_Body));
Insert_Action (N, Func_Body);
-- Now rewrite the expression with a call
Rewrite (N,
Make_Function_Call (Loc,
Name => New_Reference_To (Func_Name, Loc),
Parameter_Associations =>
New_List
(L, Make_Type_Conversion
(Loc, New_Reference_To (Etype (L), Loc), R))));
Analyze_And_Resolve (N, Typ);
end;
end if;
end Expand_Boolean_Operator;
-------------------------------
-- Expand_Composite_Equality --
-------------------------------
-- This function is only called for comparing internal fields of composite
-- types when these fields are themselves composites. This is a special
-- case because it is not possible to respect normal Ada visibility rules.
function Expand_Composite_Equality
(Nod : Node_Id;
Typ : Entity_Id;
Lhs : Node_Id;
Rhs : Node_Id;
Bodies : List_Id)
return Node_Id
is
Loc : constant Source_Ptr := Sloc (Nod);
Full_Type : Entity_Id;
Prim : Elmt_Id;
Eq_Op : Entity_Id;
begin
if Is_Private_Type (Typ) then
Full_Type := Underlying_Type (Typ);
else
Full_Type := Typ;
end if;
-- Defense against malformed private types with no completion
-- the error will be diagnosed later by check_completion
if No (Full_Type) then
return New_Reference_To (Standard_False, Loc);
end if;
Full_Type := Base_Type (Full_Type);
if Is_Array_Type (Full_Type) then
-- If the operand is an elementary type other than a floating-point
-- type, then we can simply use the built-in block bitwise equality,
-- since the predefined equality operators always apply and bitwise
-- equality is fine for all these cases.
if Is_Elementary_Type (Component_Type (Full_Type))
and then not Is_Floating_Point_Type (Component_Type (Full_Type))
then
return Make_Op_Eq (Loc, Left_Opnd => Lhs, Right_Opnd => Rhs);
-- For composite component types, and floating-point types, use
-- the expansion. This deals with tagged component types (where
-- we use the applicable equality routine) and floating-point,
-- (where we need to worry about negative zeroes), and also the
-- case of any composite type recursively containing such fields.
else
return Expand_Array_Equality
(Nod, Full_Type, Typ, Lhs, Rhs, Bodies);
end if;
elsif Is_Tagged_Type (Full_Type) then
-- Call the primitive operation "=" of this type
if Is_Class_Wide_Type (Full_Type) then
Full_Type := Root_Type (Full_Type);
end if;
-- If this is derived from an untagged private type completed
-- with a tagged type, it does not have a full view, so we
-- use the primitive operations of the private type.
-- This check should no longer be necessary when these
-- types receive their full views ???
if Is_Private_Type (Typ)
and then not Is_Tagged_Type (Typ)
and then not Is_Controlled (Typ)
and then Is_Derived_Type (Typ)
and then No (Full_View (Typ))
then
Prim := First_Elmt (Collect_Primitive_Operations (Typ));
else
Prim := First_Elmt (Primitive_Operations (Full_Type));
end if;
loop
Eq_Op := Node (Prim);
exit when Chars (Eq_Op) = Name_Op_Eq
and then Etype (First_Formal (Eq_Op)) =
Etype (Next_Formal (First_Formal (Eq_Op)));
Next_Elmt (Prim);
pragma Assert (Present (Prim));
end loop;
Eq_Op := Node (Prim);
return
Make_Function_Call (Loc,
Name => New_Reference_To (Eq_Op, Loc),
Parameter_Associations =>
New_List
(Unchecked_Convert_To (Etype (First_Formal (Eq_Op)), Lhs),
Unchecked_Convert_To (Etype (First_Formal (Eq_Op)), Rhs)));
elsif Is_Record_Type (Full_Type) then
Eq_Op := TSS (Full_Type, Name_uEquality);
if Present (Eq_Op) then
if Etype (First_Formal (Eq_Op)) /= Full_Type then
-- Inherited equality from parent type. Convert the actuals
-- to match signature of operation.
declare
T : Entity_Id := Etype (First_Formal (Eq_Op));
begin
return
Make_Function_Call (Loc,
Name => New_Reference_To (Eq_Op, Loc),
Parameter_Associations =>
New_List (OK_Convert_To (T, Lhs),
OK_Convert_To (T, Rhs)));
end;
else
return
Make_Function_Call (Loc,
Name => New_Reference_To (Eq_Op, Loc),
Parameter_Associations => New_List (Lhs, Rhs));
end if;
else
return Expand_Record_Equality (Nod, Full_Type, Lhs, Rhs, Bodies);
end if;
else
-- It can be a simple record or the full view of a scalar private
return Make_Op_Eq (Loc, Left_Opnd => Lhs, Right_Opnd => Rhs);
end if;
end Expand_Composite_Equality;
------------------------------
-- Expand_Concatenate_Other --
------------------------------
-- Let n be the number of array operands to be concatenated, Base_Typ
-- their base type, Ind_Typ their index type, and Arr_Typ the original
-- array type to which the concatenantion operator applies, then the
-- following subprogram is constructed:
--
-- [function Cnn (S1 : Base_Typ; ...; Sn : Base_Typ) return Base_Typ is
-- L : Ind_Typ;
-- begin
-- if S1'Length /= 0 then
-- L := XXX; --> XXX = S1'First if Arr_Typ is unconstrained
-- XXX = Arr_Typ'First otherwise
-- elsif S2'Length /= 0 then
-- L := YYY; --> YYY = S2'First if Arr_Typ is unconstrained
-- YYY = Arr_Typ'First otherwise
-- ...
-- elsif Sn-1'Length /= 0 then
-- L := ZZZ; --> ZZZ = Sn-1'First if Arr_Typ is unconstrained
-- ZZZ = Arr_Typ'First otherwise
-- else
-- return Sn;
-- end if;
--
-- declare
-- P : Ind_Typ;
-- H : Ind_Typ :=
-- Ind_Typ'Val ((((S1'Length - 1) + S2'Length) + ... + Sn'Length)
-- + Ind_Typ'Pos (L));
-- R : Base_Typ (L .. H);
-- begin
-- if S1'Length /= 0 then
-- P := S1'First;
-- loop
-- R (L) := S1 (P);
-- L := Ind_Typ'Succ (L);
-- exit when P = S1'Last;
-- P := Ind_Typ'Succ (P);
-- end loop;
-- end if;
--
-- if S2'Length /= 0 then
-- L := Ind_Typ'Succ (L);
-- loop
-- R (L) := S2 (P);
-- L := Ind_Typ'Succ (L);
-- exit when P = S2'Last;
-- P := Ind_Typ'Succ (P);
-- end loop;
-- end if;
--
-- ...
--
-- if Sn'Length /= 0 then
-- P := Sn'First;
-- loop
-- R (L) := Sn (P);
-- L := Ind_Typ'Succ (L);
-- exit when P = Sn'Last;
-- P := Ind_Typ'Succ (P);
-- end loop;
-- end if;
--
-- return R;
-- end;
-- end Cnn;]
procedure Expand_Concatenate_Other (Cnode : Node_Id; Opnds : List_Id) is
Loc : constant Source_Ptr := Sloc (Cnode);
Nb_Opnds : constant Nat := List_Length (Opnds);
Arr_Typ : constant Entity_Id := Etype (Entity (Cnode));
Base_Typ : constant Entity_Id := Base_Type (Etype (Cnode));
Ind_Typ : constant Entity_Id := Etype (First_Index (Base_Typ));
Func_Id : Node_Id;
Func_Spec : Node_Id;
Param_Specs : List_Id;
Func_Body : Node_Id;
Func_Decls : List_Id;
Func_Stmts : List_Id;
L_Decl : Node_Id;
If_Stmt : Node_Id;
Elsif_List : List_Id;
Declare_Block : Node_Id;
Declare_Decls : List_Id;
Declare_Stmts : List_Id;
H_Decl : Node_Id;
H_Init : Node_Id;
P_Decl : Node_Id;
R_Decl : Node_Id;
R_Constr : Node_Id;
R_Range : Node_Id;
Params : List_Id;
Operand : Node_Id;
function Copy_Into_R_S (I : Nat) return List_Id;
-- Builds the sequence of statement:
-- P := Si'First;
-- loop
-- R (L) := Si (P);
-- L := Ind_Typ'Succ (L);
-- exit when P = Si'Last;
-- P := Ind_Typ'Succ (P);
-- end loop;
--
-- where i is the input parameter I given.
function Init_L (I : Nat) return Node_Id;
-- Builds the statement:
-- L := Arr_Typ'First; If Arr_Typ is constrained
-- L := Si'First; otherwise (where I is the input param given)
function H return Node_Id;
-- Builds reference to identifier H.
function Ind_Val (E : Node_Id) return Node_Id;
-- Builds expression Ind_Typ'Val (E);
function L return Node_Id;
-- Builds reference to identifier L.
function L_Pos return Node_Id;
-- Builds expression Ind_Typ'Pos (L).
function L_Succ return Node_Id;
-- Builds expression Ind_Typ'Succ (L).
function One return Node_Id;
-- Builds integer literal one.
function P return Node_Id;
-- Builds reference to identifier P.
function P_Succ return Node_Id;
-- Builds expression Ind_Typ'Succ (P).
function R return Node_Id;
-- Builds reference to identifier R.
function S (I : Nat) return Node_Id;
-- Builds reference to identifier Si, where I is the value given.
function S_First (I : Nat) return Node_Id;
-- Builds expression Si'First, where I is the value given.
function S_Last (I : Nat) return Node_Id;
-- Builds expression Si'Last, where I is the value given.
function S_Length (I : Nat) return Node_Id;
-- Builds expression Si'Length, where I is the value given.
function S_Length_Test (I : Nat) return Node_Id;
-- Builds expression Si'Length /= 0, where I is the value given.
-------------------
-- Copy_Into_R_S --
-------------------
function Copy_Into_R_S (I : Nat) return List_Id is
Stmts : List_Id := New_List;
P_Start : Node_Id;
Loop_Stmt : Node_Id;
R_Copy : Node_Id;
Exit_Stmt : Node_Id;
L_Inc : Node_Id;
P_Inc : Node_Id;
begin
-- First construct the initializations
P_Start := Make_Assignment_Statement (Loc,
Name => P,
Expression => S_First (I));
Append_To (Stmts, P_Start);
-- Then build the loop
R_Copy := Make_Assignment_Statement (Loc,
Name => Make_Indexed_Component (Loc,
Prefix => R,
Expressions => New_List (L)),
Expression => Make_Indexed_Component (Loc,
Prefix => S (I),
Expressions => New_List (P)));
L_Inc := Make_Assignment_Statement (Loc,
Name => L,
Expression => L_Succ);
Exit_Stmt := Make_Exit_Statement (Loc,
Condition => Make_Op_Eq (Loc, P, S_Last (I)));
P_Inc := Make_Assignment_Statement (Loc,
Name => P,
Expression => P_Succ);
Loop_Stmt :=
Make_Implicit_Loop_Statement (Cnode,
Statements => New_List (R_Copy, L_Inc, Exit_Stmt, P_Inc));
Append_To (Stmts, Loop_Stmt);
return Stmts;
end Copy_Into_R_S;
-------
-- H --
-------
function H return Node_Id is
begin
return Make_Identifier (Loc, Name_uH);
end H;
-------------
-- Ind_Val --
-------------
function Ind_Val (E : Node_Id) return Node_Id is
begin
return
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Ind_Typ, Loc),
Attribute_Name => Name_Val,
Expressions => New_List (E));
end Ind_Val;
------------
-- Init_L --
------------
function Init_L (I : Nat) return Node_Id is
E : Node_Id;
begin
if Is_Constrained (Arr_Typ) then
E := Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Arr_Typ, Loc),
Attribute_Name => Name_First);
else
E := S_First (I);
end if;
return Make_Assignment_Statement (Loc, Name => L, Expression => E);
end Init_L;
-------
-- L --
-------
function L return Node_Id is
begin
return Make_Identifier (Loc, Name_uL);
end L;
-----------
-- L_Pos --
-----------
function L_Pos return Node_Id is
begin
return
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Ind_Typ, Loc),
Attribute_Name => Name_Pos,
Expressions => New_List (L));
end L_Pos;
------------
-- L_Succ --
------------
function L_Succ return Node_Id is
begin
return
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Ind_Typ, Loc),
Attribute_Name => Name_Succ,
Expressions => New_List (L));
end L_Succ;
---------
-- One --
---------
function One return Node_Id is
begin
return Make_Integer_Literal (Loc, 1);
end One;
-------
-- P --
-------
function P return Node_Id is
begin
return Make_Identifier (Loc, Name_uP);
end P;
------------
-- P_Succ --
------------
function P_Succ return Node_Id is
begin
return
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Ind_Typ, Loc),
Attribute_Name => Name_Succ,
Expressions => New_List (P));
end P_Succ;
-------
-- R --
-------
function R return Node_Id is
begin
return Make_Identifier (Loc, Name_uR);
end R;
-------
-- S --
-------
function S (I : Nat) return Node_Id is
begin
return Make_Identifier (Loc, New_External_Name ('S', I));
end S;
-------------
-- S_First --
-------------
function S_First (I : Nat) return Node_Id is
begin
return Make_Attribute_Reference (Loc,
Prefix => S (I),
Attribute_Name => Name_First);
end S_First;
------------
-- S_Last --
------------
function S_Last (I : Nat) return Node_Id is
begin
return Make_Attribute_Reference (Loc,
Prefix => S (I),
Attribute_Name => Name_Last);
end S_Last;
--------------
-- S_Length --
--------------
function S_Length (I : Nat) return Node_Id is
begin
return Make_Attribute_Reference (Loc,
Prefix => S (I),
Attribute_Name => Name_Length);
end S_Length;
-------------------
-- S_Length_Test --
-------------------
function S_Length_Test (I : Nat) return Node_Id is
begin
return
Make_Op_Ne (Loc,
Left_Opnd => S_Length (I),
Right_Opnd => Make_Integer_Literal (Loc, 0));
end S_Length_Test;
-- Start of processing for Expand_Concatenate_Other
begin
-- Construct the parameter specs and the overall function spec
Param_Specs := New_List;
for I in 1 .. Nb_Opnds loop
Append_To
(Param_Specs,
Make_Parameter_Specification (Loc,
Defining_Identifier =>
Make_Defining_Identifier (Loc, New_External_Name ('S', I)),
Parameter_Type => New_Reference_To (Base_Typ, Loc)));
end loop;
Func_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('C'));
Func_Spec :=
Make_Function_Specification (Loc,
Defining_Unit_Name => Func_Id,
Parameter_Specifications => Param_Specs,
Subtype_Mark => New_Reference_To (Base_Typ, Loc));
-- Construct L's object declaration
L_Decl :=
Make_Object_Declaration (Loc,
Defining_Identifier => Make_Defining_Identifier (Loc, Name_uL),
Object_Definition => New_Reference_To (Ind_Typ, Loc));
Func_Decls := New_List (L_Decl);
-- Construct the if-then-elsif statements
Elsif_List := New_List;
for I in 2 .. Nb_Opnds - 1 loop
Append_To (Elsif_List, Make_Elsif_Part (Loc,
Condition => S_Length_Test (I),
Then_Statements => New_List (Init_L (I))));
end loop;
If_Stmt :=
Make_Implicit_If_Statement (Cnode,
Condition => S_Length_Test (1),
Then_Statements => New_List (Init_L (1)),
Elsif_Parts => Elsif_List,
Else_Statements => New_List (Make_Return_Statement (Loc,
Expression => S (Nb_Opnds))));
-- Construct the declaration for H
P_Decl :=
Make_Object_Declaration (Loc,
Defining_Identifier => Make_Defining_Identifier (Loc, Name_uP),
Object_Definition => New_Reference_To (Ind_Typ, Loc));
H_Init := Make_Op_Subtract (Loc, S_Length (1), One);
for I in 2 .. Nb_Opnds loop
H_Init := Make_Op_Add (Loc, H_Init, S_Length (I));
end loop;
H_Init := Ind_Val (Make_Op_Add (Loc, H_Init, L_Pos));
H_Decl :=
Make_Object_Declaration (Loc,
Defining_Identifier => Make_Defining_Identifier (Loc, Name_uH),
Object_Definition => New_Reference_To (Ind_Typ, Loc),
Expression => H_Init);
-- Construct the declaration for R
R_Range := Make_Range (Loc, Low_Bound => L, High_Bound => H);
R_Constr :=
Make_Index_Or_Discriminant_Constraint (Loc,
Constraints => New_List (R_Range));
R_Decl :=
Make_Object_Declaration (Loc,
Defining_Identifier => Make_Defining_Identifier (Loc, Name_uR),
Object_Definition =>
Make_Subtype_Indication (Loc,
Subtype_Mark => New_Reference_To (Base_Typ, Loc),
Constraint => R_Constr));
-- Construct the declarations for the declare block
Declare_Decls := New_List (P_Decl, H_Decl, R_Decl);
-- Construct list of statements for the declare block
Declare_Stmts := New_List;
for I in 1 .. Nb_Opnds loop
Append_To (Declare_Stmts,
Make_Implicit_If_Statement (Cnode,
Condition => S_Length_Test (I),
Then_Statements => Copy_Into_R_S (I)));
end loop;
Append_To (Declare_Stmts, Make_Return_Statement (Loc, Expression => R));
-- Construct the declare block
Declare_Block := Make_Block_Statement (Loc,
Declarations => Declare_Decls,
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc, Declare_Stmts));
-- Construct the list of function statements
Func_Stmts := New_List (If_Stmt, Declare_Block);
-- Construct the function body
Func_Body :=
Make_Subprogram_Body (Loc,
Specification => Func_Spec,
Declarations => Func_Decls,
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc, Func_Stmts));
-- Insert the newly generated function in the code. This is analyzed
-- with all checks off, since we have completed all the checks.
-- Note that this does *not* fix the array concatenation bug when the
-- low bound is Integer'first sibce that bug comes from the pointer
-- dereferencing an unconstrained array. An there we need a constraint
-- check to make sure the length of the concatenated array is ok. ???
Insert_Action (Cnode, Func_Body, Suppress => All_Checks);
-- Construct list of arguments for the function call
Params := New_List;
Operand := First (Opnds);
for I in 1 .. Nb_Opnds loop
Append_To (Params, Relocate_Node (Operand));
Next (Operand);
end loop;
-- Insert the function call
Rewrite
(Cnode,
Make_Function_Call (Loc, New_Reference_To (Func_Id, Loc), Params));
Analyze_And_Resolve (Cnode, Base_Typ);
Set_Is_Inlined (Func_Id);
end Expand_Concatenate_Other;
-------------------------------
-- Expand_Concatenate_String --
-------------------------------
procedure Expand_Concatenate_String (Cnode : Node_Id; Opnds : List_Id) is
Loc : constant Source_Ptr := Sloc (Cnode);
Opnd1 : constant Node_Id := First (Opnds);
Opnd2 : constant Node_Id := Next (Opnd1);
Typ1 : constant Entity_Id := Base_Type (Etype (Opnd1));
Typ2 : constant Entity_Id := Base_Type (Etype (Opnd2));
R : RE_Id;
-- RE_Id value for function to be called
begin
-- In all cases, we build a call to a routine giving the list of
-- arguments as the parameter list to the routine.
case List_Length (Opnds) is
when 2 =>
if Typ1 = Standard_Character then
if Typ2 = Standard_Character then
R := RE_Str_Concat_CC;
else
pragma Assert (Typ2 = Standard_String);
R := RE_Str_Concat_CS;
end if;
elsif Typ1 = Standard_String then
if Typ2 = Standard_Character then
R := RE_Str_Concat_SC;
else
pragma Assert (Typ2 = Standard_String);
R := RE_Str_Concat;
end if;
-- If we have anything other than Standard_Character or
-- Standard_String, then we must have had an error earlier.
-- So we just abandon the attempt at expansion.
else
pragma Assert (Errors_Detected > 0);
return;
end if;
when 3 =>
R := RE_Str_Concat_3;
when 4 =>
R := RE_Str_Concat_4;
when 5 =>
R := RE_Str_Concat_5;
when others =>
R := RE_Null;
raise Program_Error;
end case;
-- Now generate the appropriate call
Rewrite (Cnode,
Make_Function_Call (Sloc (Cnode),
Name => New_Occurrence_Of (RTE (R), Loc),
Parameter_Associations => Opnds));
Analyze_And_Resolve (Cnode, Standard_String);
end Expand_Concatenate_String;
------------------------
-- Expand_N_Allocator --
------------------------
procedure Expand_N_Allocator (N : Node_Id) is
PtrT : constant Entity_Id := Etype (N);
Desig : Entity_Id;
Loc : constant Source_Ptr := Sloc (N);
Temp : Entity_Id;
Node : Node_Id;
begin
-- RM E.2.3(22). We enforce that the expected type of an allocator
-- shall not be a remote access-to-class-wide-limited-private type
-- Why is this being done at expansion time, seems clearly wrong ???
Validate_Remote_Access_To_Class_Wide_Type (N);
-- Set the Storage Pool
Set_Storage_Pool (N, Associated_Storage_Pool (Root_Type (PtrT)));
if Present (Storage_Pool (N)) then
if Is_RTE (Storage_Pool (N), RE_SS_Pool) then
if not Java_VM then
Set_Procedure_To_Call (N, RTE (RE_SS_Allocate));
end if;
else
Set_Procedure_To_Call (N,
Find_Prim_Op (Etype (Storage_Pool (N)), Name_Allocate));
end if;
end if;
-- Under certain circumstances we can replace an allocator by an
-- access to statically allocated storage. The conditions, as noted
-- in AARM 3.10 (10c) are as follows:
-- Size and initial value is known at compile time
-- Access type is access-to-constant
if Is_Access_Constant (PtrT)
and then Nkind (Expression (N)) = N_Qualified_Expression
and then Compile_Time_Known_Value (Expression (Expression (N)))
and then Size_Known_At_Compile_Time (Etype (Expression
(Expression (N))))
then
-- Here we can do the optimization. For the allocator
-- new x'(y)
-- We insert an object declaration
-- Tnn : aliased x := y;
-- and replace the allocator by Tnn'Unrestricted_Access.
-- Tnn is marked as requiring static allocation.
Temp :=
Make_Defining_Identifier (Loc, New_Internal_Name ('T'));
Desig := Subtype_Mark (Expression (N));
-- If context is constrained, use constrained subtype directly,
-- so that the constant is not labelled as having a nomimally
-- unconstrained subtype.
if Entity (Desig) = Base_Type (Designated_Type (PtrT)) then
Desig := New_Occurrence_Of (Designated_Type (PtrT), Loc);
end if;
Insert_Action (N,
Make_Object_Declaration (Loc,
Defining_Identifier => Temp,
Aliased_Present => True,
Constant_Present => Is_Access_Constant (PtrT),
Object_Definition => Desig,
Expression => Expression (Expression (N))));
Rewrite (N,
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (Temp, Loc),
Attribute_Name => Name_Unrestricted_Access));
Analyze_And_Resolve (N, PtrT);
-- We set the variable as statically allocated, since we don't
-- want it going on the stack of the current procedure!
Set_Is_Statically_Allocated (Temp);
return;
end if;
-- If the allocator is for a type which requires initialization, and
-- there is no initial value (i.e. the operand is a subtype indication
-- rather than a qualifed expression), then we must generate a call to
-- the initialization routine. This is done using an expression actions
-- node:
--
-- [Pnnn : constant ptr_T := new (T); Init (Pnnn.all,...); Pnnn]
--
-- Here ptr_T is the pointer type for the allocator, and T is the
-- subtype of the allocator. A special case arises if the designated
-- type of the access type is a task or contains tasks. In this case
-- the call to Init (Temp.all ...) is replaced by code that ensures
-- that the tasks get activated (see Exp_Ch9.Build_Task_Allocate_Block
-- for details). In addition, if the type T is a task T, then the first
-- argument to Init must be converted to the task record type.
if Nkind (Expression (N)) = N_Qualified_Expression then
declare
Indic : constant Node_Id := Subtype_Mark (Expression (N));
T : constant Entity_Id := Entity (Indic);
Exp : constant Node_Id := Expression (Expression (N));
Aggr_In_Place : constant Boolean := Is_Delayed_Aggregate (Exp);
Tag_Assign : Node_Id;
Tmp_Node : Node_Id;
begin
if Is_Tagged_Type (T) or else Controlled_Type (T) then
-- Actions inserted before:
-- Temp : constant ptr_T := new T'(Expression);
-- <no CW> Temp._tag := T'tag;
-- <CTRL> Adjust (Finalizable (Temp.all));
-- <CTRL> Attach_To_Final_List (Finalizable (Temp.all));
-- We analyze by hand the new internal allocator to avoid
-- any recursion and inappropriate call to Initialize
if not Aggr_In_Place then
Remove_Side_Effects (Exp);
end if;
Temp :=
Make_Defining_Identifier (Loc, New_Internal_Name ('P'));
-- For a class wide allocation generate the following code:
-- type Equiv_Record is record ... end record;
-- implicit subtype CW is <Class_Wide_Subytpe>;
-- temp : PtrT := new CW'(CW!(expr));
if Is_Class_Wide_Type (T) then
Expand_Subtype_From_Expr (Empty, T, Indic, Exp);
Set_Expression (Expression (N),
Unchecked_Convert_To (Entity (Indic), Exp));
Analyze_And_Resolve (Expression (N), Entity (Indic));
end if;
if Aggr_In_Place then
Tmp_Node :=
Make_Object_Declaration (Loc,
Defining_Identifier => Temp,
Object_Definition => New_Reference_To (PtrT, Loc),
Expression => Make_Allocator (Loc,
New_Reference_To (Etype (Exp), Loc)));
Set_No_Initialization (Expression (Tmp_Node));
Insert_Action (N, Tmp_Node);
Convert_Aggr_In_Allocator (Tmp_Node, Exp);
else
Node := Relocate_Node (N);
Set_Analyzed (Node);
Insert_Action (N,
Make_Object_Declaration (Loc,
Defining_Identifier => Temp,
Constant_Present => True,
Object_Definition => New_Reference_To (PtrT, Loc),
Expression => Node));
end if;
-- Suppress the tag assignment when Java_VM because JVM tags
-- are represented implicitly in objects.
if Is_Tagged_Type (T)
and then not Is_Class_Wide_Type (T)
and then not Java_VM
then
Tag_Assign :=
Make_Assignment_Statement (Loc,
Name =>
Make_Selected_Component (Loc,
Prefix => New_Reference_To (Temp, Loc),
Selector_Name =>
New_Reference_To (Tag_Component (T), Loc)),
Expression =>
Unchecked_Convert_To (RTE (RE_Tag),
New_Reference_To (Access_Disp_Table (T), Loc)));
-- The previous assignment has to be done in any case
Set_Assignment_OK (Name (Tag_Assign));
Insert_Action (N, Tag_Assign);
elsif Is_Private_Type (T)
and then Is_Tagged_Type (Underlying_Type (T))
and then not Java_VM
then
declare
Utyp : constant Entity_Id := Underlying_Type (T);
Ref : constant Node_Id :=
Unchecked_Convert_To (Utyp,
Make_Explicit_Dereference (Loc,
New_Reference_To (Temp, Loc)));
begin
Tag_Assign :=
Make_Assignment_Statement (Loc,
Name =>
Make_Selected_Component (Loc,
Prefix => Ref,
Selector_Name =>
New_Reference_To (Tag_Component (Utyp), Loc)),
Expression =>
Unchecked_Convert_To (RTE (RE_Tag),
New_Reference_To (
Access_Disp_Table (Utyp), Loc)));
Set_Assignment_OK (Name (Tag_Assign));
Insert_Action (N, Tag_Assign);
end;
end if;
if Controlled_Type (Designated_Type (PtrT))
and then Controlled_Type (T)
then
declare
Flist : Node_Id;
Attach : Node_Id;
Apool : constant Entity_Id :=
Associated_Storage_Pool (PtrT);
begin
-- If it is an allocation on the secondary stack
-- (i.e. a value returned from a function), the object
-- is attached on the caller side as soon as the call
-- is completed (see Expand_Ctrl_Function_Call)
if Is_RTE (Apool, RE_SS_Pool) then
declare
F : constant Entity_Id :=
Make_Defining_Identifier (Loc,
New_Internal_Name ('F'));
begin
Insert_Action (N,
Make_Object_Declaration (Loc,
Defining_Identifier => F,
Object_Definition => New_Reference_To (RTE
(RE_Finalizable_Ptr), Loc)));
Flist := New_Reference_To (F, Loc);
Attach := Make_Integer_Literal (Loc, 1);
end;
-- Normal case, not a secondary stack allocation
else
Flist := Find_Final_List (PtrT);
Attach := Make_Integer_Literal (Loc, 2);
end if;
if not Aggr_In_Place then
Insert_Actions (N,
Make_Adjust_Call (
Ref =>
-- An unchecked conversion is needed in the
-- classwide case because the designated type
-- can be an ancestor of the subtype mark of
-- the allocator.
Unchecked_Convert_To (T,
Make_Explicit_Dereference (Loc,
New_Reference_To (Temp, Loc))),
Typ => T,
Flist_Ref => Flist,
With_Attach => Attach));
end if;
end;
end if;
Rewrite (N, New_Reference_To (Temp, Loc));
Analyze_And_Resolve (N, PtrT);
elsif Aggr_In_Place then
Temp :=
Make_Defining_Identifier (Loc, New_Internal_Name ('P'));
Tmp_Node :=
Make_Object_Declaration (Loc,
Defining_Identifier => Temp,
Object_Definition => New_Reference_To (PtrT, Loc),
Expression => Make_Allocator (Loc,
New_Reference_To (Etype (Exp), Loc)));
Set_No_Initialization (Expression (Tmp_Node));
Insert_Action (N, Tmp_Node);
Convert_Aggr_In_Allocator (Tmp_Node, Exp);
Rewrite (N, New_Reference_To (Temp, Loc));
Analyze_And_Resolve (N, PtrT);
elsif Is_Access_Type (Designated_Type (PtrT))
and then Nkind (Exp) = N_Allocator
and then Nkind (Expression (Exp)) /= N_Qualified_Expression
then
-- Apply constraint to designated subtype indication.
Apply_Constraint_Check (Expression (Exp),
Designated_Type (Designated_Type (PtrT)),
No_Sliding => True);
if Nkind (Expression (Exp)) = N_Raise_Constraint_Error then
-- Propagate constraint_error to enclosing allocator.
Rewrite
(Exp, New_Copy (Expression (Exp)));
end if;
else
-- First check against the type of the qualified expression
--
-- NOTE: The commented call should be correct, but for
-- some reason causes the compiler to bomb (sigsegv) on
-- ACVC test c34007g, so for now we just perform the old
-- (incorrect) test against the designated subtype with
-- no sliding in the else part of the if statement below.
-- ???
--
-- Apply_Constraint_Check (Exp, T, No_Sliding => True);
-- A check is also needed in cases where the designated
-- subtype is constrained and differs from the subtype
-- given in the qualified expression. Note that the check
-- on the qualified expression does not allow sliding,
-- but this check does (a relaxation from Ada 83).
if Is_Constrained (Designated_Type (PtrT))
and then not Subtypes_Statically_Match
(T, Designated_Type (PtrT))
then
Apply_Constraint_Check
(Exp, Designated_Type (PtrT), No_Sliding => False);
-- The nonsliding check should really be performed
-- (unconditionally) against the subtype of the
-- qualified expression, but that causes a problem
-- with c34007g (see above), so for now we retain this.
else
Apply_Constraint_Check
(Exp, Designated_Type (PtrT), No_Sliding => True);
end if;
end if;
end;
-- Here if not qualified expression case.
-- In this case, an initialization routine may be required
else
declare
T : constant Entity_Id := Entity (Expression (N));
Init : Entity_Id;
Arg1 : Node_Id;
Args : List_Id;
Decls : List_Id;
Decl : Node_Id;
Discr : Elmt_Id;
Flist : Node_Id;
Temp_Decl : Node_Id;
Temp_Type : Entity_Id;
begin
if No_Initialization (N) then
null;
-- Case of no initialization procedure present
elsif not Has_Non_Null_Base_Init_Proc (T) then
-- Case of simple initialization required
if Needs_Simple_Initialization (T) then
Rewrite (Expression (N),
Make_Qualified_Expression (Loc,
Subtype_Mark => New_Occurrence_Of (T, Loc),
Expression => Get_Simple_Init_Val (T, Loc)));
Analyze_And_Resolve (Expression (Expression (N)), T);
Analyze_And_Resolve (Expression (N), T);
Set_Paren_Count (Expression (Expression (N)), 1);
Expand_N_Allocator (N);
-- No initialization required
else
null;
end if;
-- Case of initialization procedure present, must be called
else
Init := Base_Init_Proc (T);
Node := N;
Temp :=
Make_Defining_Identifier (Loc, New_Internal_Name ('P'));
-- Construct argument list for the initialization routine call
-- The CPP constructor needs the address directly
if Is_CPP_Class (T) then
Arg1 := New_Reference_To (Temp, Loc);
Temp_Type := T;
else
Arg1 :=
Make_Explicit_Dereference (Loc,
Prefix => New_Reference_To (Temp, Loc));
Set_Assignment_OK (Arg1);
Temp_Type := PtrT;
-- The initialization procedure expects a specific type.
-- if the context is access to class wide, indicate that
-- the object being allocated has the right specific type.
if Is_Class_Wide_Type (Designated_Type (PtrT)) then
Arg1 := Unchecked_Convert_To (T, Arg1);
end if;
end if;
-- If designated type is a concurrent type or if it is a
-- private type whose definition is a concurrent type,
-- the first argument in the Init routine has to be
-- unchecked conversion to the corresponding record type.
-- If the designated type is a derived type, we also
-- convert the argument to its root type.
if Is_Concurrent_Type (T) then
Arg1 :=
Unchecked_Convert_To (Corresponding_Record_Type (T), Arg1);
elsif Is_Private_Type (T)
and then Present (Full_View (T))
and then Is_Concurrent_Type (Full_View (T))
then
Arg1 :=
Unchecked_Convert_To
(Corresponding_Record_Type (Full_View (T)), Arg1);
elsif Etype (First_Formal (Init)) /= Base_Type (T) then
declare
Ftyp : constant Entity_Id := Etype (First_Formal (Init));
begin
Arg1 := OK_Convert_To (Etype (Ftyp), Arg1);
Set_Etype (Arg1, Ftyp);
end;
end if;
Args := New_List (Arg1);
-- For the task case, pass the Master_Id of the access type
-- as the value of the _Master parameter, and _Chain as the
-- value of the _Chain parameter (_Chain will be defined as
-- part of the generated code for the allocator).
if Has_Task (T) then
if No (Master_Id (Base_Type (PtrT))) then
-- The designated type was an incomplete type, and
-- the access type did not get expanded. Salvage
-- it now.
Expand_N_Full_Type_Declaration
(Parent (Base_Type (PtrT)));
end if;
-- If the context of the allocator is a declaration or
-- an assignment, we can generate a meaningful image for
-- it, even though subsequent assignments might remove
-- the connection between task and entity. We build this
-- image when the left-hand side is a simple variable,
-- a simple indexed assignment or a simple selected
-- component.
if Nkind (Parent (N)) = N_Assignment_Statement then
declare
Nam : constant Node_Id := Name (Parent (N));
begin
if Is_Entity_Name (Nam) then
Decls :=
Build_Task_Image_Decls (
Loc,
New_Occurrence_Of
(Entity (Nam), Sloc (Nam)), T);
elsif (Nkind (Nam) = N_Indexed_Component
or else Nkind (Nam) = N_Selected_Component)
and then Is_Entity_Name (Prefix (Nam))
then
Decls :=
Build_Task_Image_Decls
(Loc, Nam, Etype (Prefix (Nam)));
else
Decls := Build_Task_Image_Decls (Loc, T, T);
end if;
end;
elsif Nkind (Parent (N)) = N_Object_Declaration then
Decls :=
Build_Task_Image_Decls (
Loc, Defining_Identifier (Parent (N)), T);
else
Decls := Build_Task_Image_Decls (Loc, T, T);
end if;
Append_To (Args,
New_Reference_To
(Master_Id (Base_Type (Root_Type (PtrT))), Loc));
Append_To (Args, Make_Identifier (Loc, Name_uChain));
Decl := Last (Decls);
Append_To (Args,
New_Occurrence_Of (Defining_Identifier (Decl), Loc));
-- Has_Task is false, Decls not used
else
Decls := No_List;
end if;
-- Add discriminants if discriminated type
if Has_Discriminants (T) then
Discr := First_Elmt (Discriminant_Constraint (T));
while Present (Discr) loop
Append (New_Copy (Elists.Node (Discr)), Args);
Next_Elmt (Discr);
end loop;
elsif Is_Private_Type (T)
and then Present (Full_View (T))
and then Has_Discriminants (Full_View (T))
then
Discr :=
First_Elmt (Discriminant_Constraint (Full_View (T)));
while Present (Discr) loop
Append (New_Copy (Elists.Node (Discr)), Args);
Next_Elmt (Discr);
end loop;
end if;
-- We set the allocator as analyzed so that when we analyze the
-- expression actions node, we do not get an unwanted recursive
-- expansion of the allocator expression.
Set_Analyzed (N, True);
Node := Relocate_Node (N);
-- Here is the transformation:
-- input: new T
-- output: Temp : constant ptr_T := new T;
-- Init (Temp.all, ...);
-- <CTRL> Attach_To_Final_List (Finalizable (Temp.all));
-- <CTRL> Initialize (Finalizable (Temp.all));
-- Here ptr_T is the pointer type for the allocator, and T
-- is the subtype of the allocator.
Temp_Decl :=
Make_Object_Declaration (Loc,
Defining_Identifier => Temp,
Constant_Present => True,
Object_Definition => New_Reference_To (Temp_Type, Loc),
Expression => Node);
Set_Assignment_OK (Temp_Decl);
if Is_CPP_Class (T) then
Set_Aliased_Present (Temp_Decl);
end if;
Insert_Action (N, Temp_Decl, Suppress => All_Checks);
-- Case of designated type is task or contains task
-- Create block to activate created tasks, and insert
-- declaration for Task_Image variable ahead of call.
if Has_Task (T) then
declare
L : List_Id := New_List;
Blk : Node_Id;
begin
Build_Task_Allocate_Block (L, Node, Args);
Blk := Last (L);
Insert_List_Before (First (Declarations (Blk)), Decls);
Insert_Actions (N, L);
end;
else
Insert_Action (N,
Make_Procedure_Call_Statement (Loc,
Name => New_Reference_To (Init, Loc),
Parameter_Associations => Args));
end if;
if Controlled_Type (T) then
-- If the context is an access parameter, we need to create
-- a non-anonymous access type in order to have a usable
-- final list, because there is otherwise no pool to which
-- the allocated object can belong. We create both the type
-- and the finalization chain here, because freezing an
-- internal type does not create such a chain.
if Ekind (PtrT) = E_Anonymous_Access_Type then
declare
Acc : Entity_Id :=
Make_Defining_Identifier (Loc,
New_Internal_Name ('I'));
begin
Insert_Action (N,
Make_Full_Type_Declaration (Loc,
Defining_Identifier => Acc,
Type_Definition =>
Make_Access_To_Object_Definition (Loc,
Subtype_Indication =>
New_Occurrence_Of (T, Loc))));
Build_Final_List (N, Acc);
Flist := Find_Final_List (Acc);
end;
else
Flist := Find_Final_List (PtrT);
end if;
Insert_Actions (N,
Make_Init_Call (
Ref => New_Copy_Tree (Arg1),
Typ => T,
Flist_Ref => Flist,
With_Attach => Make_Integer_Literal (Loc, 2)));
end if;
if Is_CPP_Class (T) then
Rewrite (N,
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Temp, Loc),
Attribute_Name => Name_Unchecked_Access));
else
Rewrite (N, New_Reference_To (Temp, Loc));
end if;
Analyze_And_Resolve (N, PtrT);
end if;
end;
end if;
end Expand_N_Allocator;
-----------------------
-- Expand_N_And_Then --
-----------------------
-- Expand into conditional expression if Actions present, and also
-- deal with optimizing case of arguments being True or False.
procedure Expand_N_And_Then (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Typ : constant Entity_Id := Etype (N);
Left : constant Node_Id := Left_Opnd (N);
Right : constant Node_Id := Right_Opnd (N);
Actlist : List_Id;
begin
-- Deal with non-standard booleans
if Is_Boolean_Type (Typ) then
Adjust_Condition (Left);
Adjust_Condition (Right);
Set_Etype (N, Standard_Boolean);
end if;
-- Check for cases of left argument is True or False
if Nkind (Left) = N_Identifier then
-- If left argument is True, change (True and then Right) to Right.
-- Any actions associated with Right will be executed unconditionally
-- and can thus be inserted into the tree unconditionally.
if Entity (Left) = Standard_True then
if Present (Actions (N)) then
Insert_Actions (N, Actions (N));
end if;
Rewrite (N, Right);
Adjust_Result_Type (N, Typ);
return;
-- If left argument is False, change (False and then Right) to
-- False. In this case we can forget the actions associated with
-- Right, since they will never be executed.
elsif Entity (Left) = Standard_False then
Kill_Dead_Code (Right);
Kill_Dead_Code (Actions (N));
Rewrite (N, New_Occurrence_Of (Standard_False, Loc));
Adjust_Result_Type (N, Typ);
return;
end if;
end if;
-- If Actions are present, we expand
-- left and then right
-- into
-- if left then right else false end
-- with the actions becoming the Then_Actions of the conditional
-- expression. This conditional expression is then further expanded
-- (and will eventually disappear)
if Present (Actions (N)) then
Actlist := Actions (N);
Rewrite (N,
Make_Conditional_Expression (Loc,
Expressions => New_List (
Left,
Right,
New_Occurrence_Of (Standard_False, Loc))));
Set_Then_Actions (N, Actlist);
Analyze_And_Resolve (N, Standard_Boolean);
Adjust_Result_Type (N, Typ);
return;
end if;
-- No actions present, check for cases of right argument True/False
if Nkind (Right) = N_Identifier then
-- Change (Left and then True) to Left. Note that we know there
-- are no actions associated with the True operand, since we
-- just checked for this case above.
if Entity (Right) = Standard_True then
Rewrite (N, Left);
-- Change (Left and then False) to False, making sure to preserve
-- any side effects associated with the Left operand.
elsif Entity (Right) = Standard_False then
Remove_Side_Effects (Left);
Rewrite
(N, New_Occurrence_Of (Standard_False, Loc));
end if;
end if;
Adjust_Result_Type (N, Typ);
end Expand_N_And_Then;
-------------------------------------
-- Expand_N_Conditional_Expression --
-------------------------------------
-- Expand into expression actions if then/else actions present
procedure Expand_N_Conditional_Expression (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Cond : constant Node_Id := First (Expressions (N));
Thenx : constant Node_Id := Next (Cond);
Elsex : constant Node_Id := Next (Thenx);
Typ : constant Entity_Id := Etype (N);
Cnn : Entity_Id;
New_If : Node_Id;
begin
-- If either then or else actions are present, then given:
-- if cond then then-expr else else-expr end
-- we insert the following sequence of actions (using Insert_Actions):
-- Cnn : typ;
-- if cond then
-- <<then actions>>
-- Cnn := then-expr;
-- else
-- <<else actions>>
-- Cnn := else-expr
-- end if;
-- and replace the conditional expression by a reference to Cnn.
if Present (Then_Actions (N)) or else Present (Else_Actions (N)) then
Cnn := Make_Defining_Identifier (Loc, New_Internal_Name ('C'));
New_If :=
Make_Implicit_If_Statement (N,
Condition => Relocate_Node (Cond),
Then_Statements => New_List (
Make_Assignment_Statement (Sloc (Thenx),
Name => New_Occurrence_Of (Cnn, Sloc (Thenx)),
Expression => Relocate_Node (Thenx))),
Else_Statements => New_List (
Make_Assignment_Statement (Sloc (Elsex),
Name => New_Occurrence_Of (Cnn, Sloc (Elsex)),
Expression => Relocate_Node (Elsex))));
if Present (Then_Actions (N)) then
Insert_List_Before
(First (Then_Statements (New_If)), Then_Actions (N));
end if;
if Present (Else_Actions (N)) then
Insert_List_Before
(First (Else_Statements (New_If)), Else_Actions (N));
end if;
Rewrite (N, New_Occurrence_Of (Cnn, Loc));
Insert_Action (N,
Make_Object_Declaration (Loc,
Defining_Identifier => Cnn,
Object_Definition => New_Occurrence_Of (Typ, Loc)));
Insert_Action (N, New_If);
Analyze_And_Resolve (N, Typ);
end if;
end Expand_N_Conditional_Expression;
-----------------------------------
-- Expand_N_Explicit_Dereference --
-----------------------------------
procedure Expand_N_Explicit_Dereference (N : Node_Id) is
begin
-- The only processing required is an insertion of an explicit
-- dereference call for the checked storage pool case.
Insert_Dereference_Action (Prefix (N));
end Expand_N_Explicit_Dereference;
-----------------
-- Expand_N_In --
-----------------
procedure Expand_N_In (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Rtyp : constant Entity_Id := Etype (N);
begin
-- No expansion is required if we have an explicit range
if Nkind (Right_Opnd (N)) = N_Range then
return;
-- Here right operand is a subtype mark
else
declare
Typ : Entity_Id := Etype (Right_Opnd (N));
Obj : Node_Id := Left_Opnd (N);
Cond : Node_Id := Empty;
Is_Acc : Boolean := Is_Access_Type (Typ);
begin
Remove_Side_Effects (Obj);
-- For tagged type, do tagged membership operation
if Is_Tagged_Type (Typ) then
-- No expansion will be performed when Java_VM, as the
-- JVM back end will handle the membership tests directly
-- (tags are not explicitly represented in Java objects,
-- so the normal tagged membership expansion is not what
-- we want).
if not Java_VM then
Rewrite (N, Tagged_Membership (N));
Analyze_And_Resolve (N, Rtyp);
end if;
return;
-- If type is scalar type, rewrite as x in t'first .. t'last
-- This reason we do this is that the bounds may have the wrong
-- type if they come from the original type definition.
elsif Is_Scalar_Type (Typ) then
Rewrite (Right_Opnd (N),
Make_Range (Loc,
Low_Bound =>
Make_Attribute_Reference (Loc,
Attribute_Name => Name_First,
Prefix => New_Reference_To (Typ, Loc)),
High_Bound =>
Make_Attribute_Reference (Loc,
Attribute_Name => Name_Last,
Prefix => New_Reference_To (Typ, Loc))));
Analyze_And_Resolve (N, Rtyp);
return;
end if;
if Is_Acc then
Typ := Designated_Type (Typ);
end if;
if not Is_Constrained (Typ) then
Rewrite (N,
New_Reference_To (Standard_True, Loc));
Analyze_And_Resolve (N, Rtyp);
-- For the constrained array case, we have to check the
-- subscripts for an exact match if the lengths are
-- non-zero (the lengths must match in any case).
elsif Is_Array_Type (Typ) then
declare
function Construct_Attribute_Reference
(E : Node_Id;
Nam : Name_Id;
Dim : Nat)
return Node_Id;
-- Build attribute reference E'Nam(Dim)
function Construct_Attribute_Reference
(E : Node_Id;
Nam : Name_Id;
Dim : Nat)
return Node_Id
is
begin
return
Make_Attribute_Reference (Loc,
Prefix => E,
Attribute_Name => Nam,
Expressions => New_List (
Make_Integer_Literal (Loc, Dim)));
end Construct_Attribute_Reference;
begin
for J in 1 .. Number_Dimensions (Typ) loop
Evolve_And_Then (Cond,
Make_Op_Eq (Loc,
Left_Opnd =>
Construct_Attribute_Reference
(Duplicate_Subexpr (Obj), Name_First, J),
Right_Opnd =>
Construct_Attribute_Reference
(New_Occurrence_Of (Typ, Loc), Name_First, J)));
Evolve_And_Then (Cond,
Make_Op_Eq (Loc,
Left_Opnd =>
Construct_Attribute_Reference
(Duplicate_Subexpr (Obj), Name_Last, J),
Right_Opnd =>
Construct_Attribute_Reference
(New_Occurrence_Of (Typ, Loc), Name_Last, J)));
end loop;
if Is_Acc then
Cond := Make_Or_Else (Loc,
Left_Opnd =>
Make_Op_Eq (Loc,
Left_Opnd => Obj,
Right_Opnd => Make_Null (Loc)),
Right_Opnd => Cond);
end if;
Rewrite (N, Cond);
Analyze_And_Resolve (N, Rtyp);
end;
-- These are the cases where constraint checks may be
-- required, e.g. records with possible discriminants
else
-- Expand the test into a series of discriminant comparisons.
-- The expression that is built is the negation of the one
-- that is used for checking discriminant constraints.
Obj := Relocate_Node (Left_Opnd (N));
if Has_Discriminants (Typ) then
Cond := Make_Op_Not (Loc,
Right_Opnd => Build_Discriminant_Checks (Obj, Typ));
if Is_Acc then
Cond := Make_Or_Else (Loc,
Left_Opnd =>
Make_Op_Eq (Loc,
Left_Opnd => Obj,
Right_Opnd => Make_Null (Loc)),
Right_Opnd => Cond);
end if;
else
Cond := New_Occurrence_Of (Standard_True, Loc);
end if;
Rewrite (N, Cond);
Analyze_And_Resolve (N, Rtyp);
end if;
end;
end if;
end Expand_N_In;
--------------------------------
-- Expand_N_Indexed_Component --
--------------------------------
procedure Expand_N_Indexed_Component (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Typ : constant Entity_Id := Etype (N);
P : constant Node_Id := Prefix (N);
T : constant Entity_Id := Etype (P);
begin
-- A special optimization, if we have an indexed component that
-- is selecting from a slice, then we can eliminate the slice,
-- since, for example, x (i .. j)(k) is identical to x(k). The
-- only difference is the range check required by the slice. The
-- range check for the slice itself has already been generated.
-- The range check for the subscripting operation is ensured
-- by converting the subject to the subtype of the slice.
-- This optimization not only generates better code, avoiding
-- slice messing especially in the packed case, but more importantly
-- bypasses some problems in handling this peculiar case, for
-- example, the issue of dealing specially with object renamings.
if Nkind (P) = N_Slice then
Rewrite (N,
Make_Indexed_Component (Loc,
Prefix => Prefix (P),
Expressions => New_List (
Convert_To
(Etype (First_Index (Etype (P))),
First (Expressions (N))))));
Analyze_And_Resolve (N, Typ);
return;
end if;
-- If the prefix is an access type, then we unconditionally rewrite
-- if as an explicit deference. This simplifies processing for several
-- cases, including packed array cases and certain cases in which
-- checks must be generated. We used to try to do this only when it
-- was necessary, but it cleans up the code to do it all the time.
if Is_Access_Type (T) then
Rewrite (P,
Make_Explicit_Dereference (Sloc (N),
Prefix => Relocate_Node (P)));
Analyze_And_Resolve (P, Designated_Type (T));
end if;
if Validity_Checks_On and then Validity_Check_Subscripts then
Apply_Subscript_Validity_Checks (N);
end if;
-- All done for the non-packed case
if not Is_Packed (Etype (Prefix (N))) then
return;
end if;
-- For packed arrays that are not bit-packed (i.e. the case of an array
-- with one or more index types with a non-coniguous enumeration type),
-- we can always use the normal packed element get circuit.
if not Is_Bit_Packed_Array (Etype (Prefix (N))) then
Expand_Packed_Element_Reference (N);
return;
end if;
-- For a reference to a component of a bit packed array, we have to
-- convert it to a reference to the corresponding Packed_Array_Type.
-- We only want to do this for simple references, and not for:
-- Left side of assignment (or prefix of left side of assignment)
-- This case is handled in Exp_Ch5.Expand_N_Assignment_Statement
-- Renaming objects in renaming associations
-- This case is handled when a use of the renamed variable occurs
-- Actual parameters for a procedure call
-- This case is handled in Exp_Ch6.Expand_Actuals
-- The second expression in a 'Read attribute reference
-- The prefix of an address or size attribute reference
-- The following circuit detects these exceptions
declare
Child : Node_Id := N;
Parnt : Node_Id := Parent (N);
begin
loop
if Nkind (Parnt) = N_Unchecked_Expression then
null;
elsif Nkind (Parnt) = N_Object_Renaming_Declaration
or else Nkind (Parnt) = N_Procedure_Call_Statement
or else (Nkind (Parnt) = N_Parameter_Association
and then
Nkind (Parent (Parnt)) = N_Procedure_Call_Statement)
then
return;
elsif Nkind (Parnt) = N_Attribute_Reference
and then (Attribute_Name (Parnt) = Name_Address
or else
Attribute_Name (Parnt) = Name_Size)
and then Prefix (Parnt) = Child
then
return;
elsif Nkind (Parnt) = N_Assignment_Statement
and then Name (Parnt) = Child
then
return;
elsif Nkind (Parnt) = N_Attribute_Reference
and then Attribute_Name (Parnt) = Name_Read
and then Next (First (Expressions (Parnt))) = Child
then
return;
elsif (Nkind (Parnt) = N_Indexed_Component
or else Nkind (Parnt) = N_Selected_Component)
and then Prefix (Parnt) = Child
then
null;
else
Expand_Packed_Element_Reference (N);
return;
end if;
-- Keep looking up tree for unchecked expression, or if we are
-- the prefix of a possible assignment left side.
Child := Parnt;
Parnt := Parent (Child);
end loop;
end;
end Expand_N_Indexed_Component;
---------------------
-- Expand_N_Not_In --
---------------------
-- Replace a not in b by not (a in b) so that the expansions for (a in b)
-- can be done. This avoids needing to duplicate this expansion code.
procedure Expand_N_Not_In (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Typ : constant Entity_Id := Etype (N);
begin
Rewrite (N,
Make_Op_Not (Loc,
Right_Opnd =>
Make_In (Loc,
Left_Opnd => Left_Opnd (N),
Right_Opnd => Right_Opnd (N))));
Analyze_And_Resolve (N, Typ);
end Expand_N_Not_In;
-------------------
-- Expand_N_Null --
-------------------
-- The only replacement required is for the case of a null of type
-- that is an access to protected subprogram. We represent such
-- access values as a record, and so we must replace the occurrence
-- of null by the equivalent record (with a null address and a null
-- pointer in it), so that the backend creates the proper value.
procedure Expand_N_Null (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Typ : constant Entity_Id := Etype (N);
Agg : Node_Id;
begin
if Ekind (Typ) = E_Access_Protected_Subprogram_Type then
Agg :=
Make_Aggregate (Loc,
Expressions => New_List (
New_Occurrence_Of (RTE (RE_Null_Address), Loc),
Make_Null (Loc)));
Rewrite (N, Agg);
Analyze_And_Resolve (N, Equivalent_Type (Typ));
-- For subsequent semantic analysis, the node must retain its
-- type. Gigi in any case replaces this type by the corresponding
-- record type before processing the node.
Set_Etype (N, Typ);
end if;
end Expand_N_Null;
---------------------
-- Expand_N_Op_Abs --
---------------------
procedure Expand_N_Op_Abs (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Expr : constant Node_Id := Right_Opnd (N);
begin
Unary_Op_Validity_Checks (N);
-- Deal with software overflow checking
if Software_Overflow_Checking
and then Is_Signed_Integer_Type (Etype (N))
and then Do_Overflow_Check (N)
then
-- Software overflow checking expands abs (expr) into
-- (if expr >= 0 then expr else -expr)
-- with the usual Duplicate_Subexpr use coding for expr
Rewrite (N,
Make_Conditional_Expression (Loc,
Expressions => New_List (
Make_Op_Ge (Loc,
Left_Opnd => Duplicate_Subexpr (Expr),
Right_Opnd => Make_Integer_Literal (Loc, 0)),
Duplicate_Subexpr (Expr),
Make_Op_Minus (Loc,
Right_Opnd => Duplicate_Subexpr (Expr)))));
Analyze_And_Resolve (N);
-- Vax floating-point types case
elsif Vax_Float (Etype (N)) then
Expand_Vax_Arith (N);
end if;
end Expand_N_Op_Abs;
---------------------
-- Expand_N_Op_Add --
---------------------
procedure Expand_N_Op_Add (N : Node_Id) is
Typ : constant Entity_Id := Etype (N);
begin
Binary_Op_Validity_Checks (N);
-- N + 0 = 0 + N = N for integer types
if Is_Integer_Type (Typ) then
if Compile_Time_Known_Value (Right_Opnd (N))
and then Expr_Value (Right_Opnd (N)) = Uint_0
then
Rewrite (N, Left_Opnd (N));
return;
elsif Compile_Time_Known_Value (Left_Opnd (N))
and then Expr_Value (Left_Opnd (N)) = Uint_0
then
Rewrite (N, Right_Opnd (N));
return;
end if;
end if;
-- Arithemtic overflow checks for signed integer/fixed point types
if Is_Signed_Integer_Type (Typ)
or else Is_Fixed_Point_Type (Typ)
then
Apply_Arithmetic_Overflow_Check (N);
return;
-- Vax floating-point types case
elsif Vax_Float (Typ) then
Expand_Vax_Arith (N);
end if;
end Expand_N_Op_Add;
---------------------
-- Expand_N_Op_And --
---------------------
procedure Expand_N_Op_And (N : Node_Id) is
Typ : constant Entity_Id := Etype (N);
begin
Binary_Op_Validity_Checks (N);
if Is_Array_Type (Etype (N)) then
Expand_Boolean_Operator (N);
elsif Is_Boolean_Type (Etype (N)) then
Adjust_Condition (Left_Opnd (N));
Adjust_Condition (Right_Opnd (N));
Set_Etype (N, Standard_Boolean);
Adjust_Result_Type (N, Typ);
end if;
end Expand_N_Op_And;
------------------------
-- Expand_N_Op_Concat --
------------------------
procedure Expand_N_Op_Concat (N : Node_Id) is
Opnds : List_Id;
-- List of operands to be concatenated
Opnd : Node_Id;
-- Single operand for concatenation
Cnode : Node_Id;
-- Node which is to be replaced by the result of concatenating
-- the nodes in the list Opnds.
Atyp : Entity_Id;
-- Array type of concatenation result type
Ctyp : Entity_Id;
-- Component type of concatenation represented by Cnode
begin
Binary_Op_Validity_Checks (N);
-- If we are the left operand of a concatenation higher up the
-- tree, then do nothing for now, since we want to deal with a
-- series of concatenations as a unit.
if Nkind (Parent (N)) = N_Op_Concat
and then N = Left_Opnd (Parent (N))
then
return;
end if;
-- We get here with a concatenation whose left operand may be a
-- concatenation itself with a consistent type. We need to process
-- these concatenation operands from left to right, which means
-- from the deepest node in the tree to the highest node.
Cnode := N;
while Nkind (Left_Opnd (Cnode)) = N_Op_Concat loop
Cnode := Left_Opnd (Cnode);
end loop;
-- Now Opnd is the deepest Opnd, and its parents are the concatenation
-- nodes above, so now we process bottom up, doing the operations. We
-- gather a string that is as long as possible up to five operands
-- The outer loop runs more than once if there are more than five
-- concatenations of type Standard.String, the most we handle for
-- this case, or if more than one concatenation type is involved.
Outer : loop
Opnds := New_List (Left_Opnd (Cnode), Right_Opnd (Cnode));
Set_Parent (Opnds, N);
-- The inner loop gathers concatenation operands
Inner : while Cnode /= N
and then (Base_Type (Etype (Cnode)) /= Standard_String
or else
List_Length (Opnds) < 5)
and then Base_Type (Etype (Cnode)) =
Base_Type (Etype (Parent (Cnode)))
loop
Cnode := Parent (Cnode);
Append (Right_Opnd (Cnode), Opnds);
end loop Inner;
-- Here we process the collected operands. First we convert
-- singleton operands to singleton aggregates. This is skipped
-- however for the case of two operands of type String, since
-- we have special routines for these cases.
Atyp := Base_Type (Etype (Cnode));
Ctyp := Base_Type (Component_Type (Etype (Cnode)));
if List_Length (Opnds) > 2 or else Atyp /= Standard_String then
Opnd := First (Opnds);
loop
if Base_Type (Etype (Opnd)) = Ctyp then
Rewrite (Opnd,
Make_Aggregate (Sloc (Cnode),
Expressions => New_List (Relocate_Node (Opnd))));
Analyze_And_Resolve (Opnd, Atyp);
end if;
Next (Opnd);
exit when No (Opnd);
end loop;
end if;
-- Now call appropriate continuation routine
if Atyp = Standard_String then
Expand_Concatenate_String (Cnode, Opnds);
else
Expand_Concatenate_Other (Cnode, Opnds);
end if;
exit Outer when Cnode = N;
Cnode := Parent (Cnode);
end loop Outer;
end Expand_N_Op_Concat;
------------------------
-- Expand_N_Op_Divide --
------------------------
procedure Expand_N_Op_Divide (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Ltyp : constant Entity_Id := Etype (Left_Opnd (N));
Rtyp : constant Entity_Id := Etype (Right_Opnd (N));
Typ : Entity_Id := Etype (N);
begin
Binary_Op_Validity_Checks (N);
-- Vax_Float is a special case
if Vax_Float (Typ) then
Expand_Vax_Arith (N);
return;
end if;
-- N / 1 = N for integer types
if Is_Integer_Type (Typ)
and then Compile_Time_Known_Value (Right_Opnd (N))
and then Expr_Value (Right_Opnd (N)) = Uint_1
then
Rewrite (N, Left_Opnd (N));
return;
end if;
-- Convert x / 2 ** y to Shift_Right (x, y). Note that the fact that
-- Is_Power_Of_2_For_Shift is set means that we know that our left
-- operand is an unsigned integer, as required for this to work.
if Nkind (Right_Opnd (N)) = N_Op_Expon
and then Is_Power_Of_2_For_Shift (Right_Opnd (N))
then
Rewrite (N,
Make_Op_Shift_Right (Loc,
Left_Opnd => Left_Opnd (N),
Right_Opnd =>
Convert_To (Standard_Natural, Right_Opnd (Right_Opnd (N)))));
Analyze_And_Resolve (N, Typ);
return;
end if;
-- Do required fixup of universal fixed operation
if Typ = Universal_Fixed then
Fixup_Universal_Fixed_Operation (N);
Typ := Etype (N);
end if;
-- Divisions with fixed-point results
if Is_Fixed_Point_Type (Typ) then
-- No special processing if Treat_Fixed_As_Integer is set,
-- since from a semantic point of view such operations are
-- simply integer operations and will be treated that way.
if not Treat_Fixed_As_Integer (N) then
if Is_Integer_Type (Rtyp) then
Expand_Divide_Fixed_By_Integer_Giving_Fixed (N);
else
Expand_Divide_Fixed_By_Fixed_Giving_Fixed (N);
end if;
end if;
-- Other cases of division of fixed-point operands. Again we
-- exclude the case where Treat_Fixed_As_Integer is set.
elsif (Is_Fixed_Point_Type (Ltyp) or else
Is_Fixed_Point_Type (Rtyp))
and then not Treat_Fixed_As_Integer (N)
then
if Is_Integer_Type (Typ) then
Expand_Divide_Fixed_By_Fixed_Giving_Integer (N);
else
pragma Assert (Is_Floating_Point_Type (Typ));
Expand_Divide_Fixed_By_Fixed_Giving_Float (N);
end if;
-- Mixed-mode operations can appear in a non-static universal
-- context, in which case the integer argument must be converted
-- explicitly.
elsif Typ = Universal_Real
and then Is_Integer_Type (Rtyp)
then
Rewrite (Right_Opnd (N),
Convert_To (Universal_Real, Relocate_Node (Right_Opnd (N))));
Analyze_And_Resolve (Right_Opnd (N), Universal_Real);
elsif Typ = Universal_Real
and then Is_Integer_Type (Ltyp)
then
Rewrite (Left_Opnd (N),
Convert_To (Universal_Real, Relocate_Node (Left_Opnd (N))));
Analyze_And_Resolve (Left_Opnd (N), Universal_Real);
-- Non-fixed point cases, do zero divide and overflow checks
elsif Is_Integer_Type (Typ) then
Apply_Divide_Check (N);
end if;
end Expand_N_Op_Divide;
--------------------
-- Expand_N_Op_Eq --
--------------------
procedure Expand_N_Op_Eq (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Typ : constant Entity_Id := Etype (N);
Lhs : constant Node_Id := Left_Opnd (N);
Rhs : constant Node_Id := Right_Opnd (N);
A_Typ : Entity_Id := Etype (Lhs);
Typl : Entity_Id := A_Typ;
Op_Name : Entity_Id;
Prim : Elmt_Id;
Bodies : List_Id := New_List;
procedure Build_Equality_Call (Eq : Entity_Id);
-- If a constructed equality exists for the type or for its parent,
-- build and analyze call, adding conversions if the operation is
-- inherited.
-------------------------
-- Build_Equality_Call --
-------------------------
procedure Build_Equality_Call (Eq : Entity_Id) is
Op_Type : constant Entity_Id := Etype (First_Formal (Eq));
L_Exp : Node_Id := Relocate_Node (Lhs);
R_Exp : Node_Id := Relocate_Node (Rhs);
begin
if Base_Type (Op_Type) /= Base_Type (A_Typ)
and then not Is_Class_Wide_Type (A_Typ)
then
L_Exp := OK_Convert_To (Op_Type, L_Exp);
R_Exp := OK_Convert_To (Op_Type, R_Exp);
end if;
Rewrite (N,
Make_Function_Call (Loc,
Name => New_Reference_To (Eq, Loc),
Parameter_Associations => New_List (L_Exp, R_Exp)));
Analyze_And_Resolve (N, Standard_Boolean, Suppress => All_Checks);
end Build_Equality_Call;
-- Start of processing for Expand_N_Op_Eq
begin
Binary_Op_Validity_Checks (N);
if Ekind (Typl) = E_Private_Type then
Typl := Underlying_Type (Typl);
elsif Ekind (Typl) = E_Private_Subtype then
Typl := Underlying_Type (Base_Type (Typl));
end if;
-- It may happen in error situations that the underlying type is not
-- set. The error will be detected later, here we just defend the
-- expander code.
if No (Typl) then
return;
end if;
Typl := Base_Type (Typl);
-- Vax float types
if Vax_Float (Typl) then
Expand_Vax_Comparison (N);
return;
-- Boolean types (requiring handling of non-standard case)
elsif Is_Boolean_Type (Typl) then
Adjust_Condition (Left_Opnd (N));
Adjust_Condition (Right_Opnd (N));
Set_Etype (N, Standard_Boolean);
Adjust_Result_Type (N, Typ);
-- Array types
elsif Is_Array_Type (Typl) then
-- Packed case
if Is_Bit_Packed_Array (Typl) then
Expand_Packed_Eq (N);
-- For non-floating-point elementary types, the primitive equality
-- always applies, and block-bit comparison is fine. Floating-point
-- is an exception because of negative zeroes.
-- However, we never use block bit comparison in No_Run_Time mode,
-- since this may result in a call to a run time routine
elsif Is_Elementary_Type (Component_Type (Typl))
and then not Is_Floating_Point_Type (Component_Type (Typl))
and then not No_Run_Time
then
null;
-- For composite and floating-point cases, expand equality loop
-- to make sure of using proper comparisons for tagged types,
-- and correctly handling the floating-point case.
else
Rewrite (N,
Expand_Array_Equality (N, Typl, A_Typ,
Relocate_Node (Lhs), Relocate_Node (Rhs), Bodies));
Insert_Actions (N, Bodies, Suppress => All_Checks);
Analyze_And_Resolve (N, Standard_Boolean, Suppress => All_Checks);
end if;
-- Record Types
elsif Is_Record_Type (Typl) then
-- For tagged types, use the primitive "="
if Is_Tagged_Type (Typl) then
-- If this is derived from an untagged private type completed
-- with a tagged type, it does not have a full view, so we
-- use the primitive operations of the private type.
-- This check should no longer be necessary when these
-- types receive their full views ???
if Is_Private_Type (A_Typ)
and then not Is_Tagged_Type (A_Typ)
and then Is_Derived_Type (A_Typ)
and then No (Full_View (A_Typ))
then
Prim := First_Elmt (Collect_Primitive_Operations (A_Typ));
while Chars (Node (Prim)) /= Name_Op_Eq loop
Next_Elmt (Prim);
pragma Assert (Present (Prim));
end loop;
Op_Name := Node (Prim);
else
Op_Name := Find_Prim_Op (Typl, Name_Op_Eq);
end if;
Build_Equality_Call (Op_Name);
-- If a type support function is present (for complex cases), use it
elsif Present (TSS (Root_Type (Typl), Name_uEquality)) then
Build_Equality_Call (TSS (Root_Type (Typl), Name_uEquality));
-- Otherwise expand the component by component equality. Note that
-- we never use block-bit coparisons for records, because of the
-- problems with gaps. The backend will often be able to recombine
-- the separate comparisons that we generate here.
else
Remove_Side_Effects (Lhs);
Remove_Side_Effects (Rhs);
Rewrite (N,
Expand_Record_Equality (N, Typl, Lhs, Rhs, Bodies));
Insert_Actions (N, Bodies, Suppress => All_Checks);
Analyze_And_Resolve (N, Standard_Boolean, Suppress => All_Checks);
end if;
end if;
-- If we still have an equality comparison (i.e. it was not rewritten
-- in some way), then we can test if result is needed at compile time).
if Nkind (N) = N_Op_Eq then
Rewrite_Comparison (N);
end if;
end Expand_N_Op_Eq;
-----------------------
-- Expand_N_Op_Expon --
-----------------------
procedure Expand_N_Op_Expon (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Typ : constant Entity_Id := Etype (N);
Rtyp : constant Entity_Id := Root_Type (Typ);
Base : constant Node_Id := Relocate_Node (Left_Opnd (N));
Exp : constant Node_Id := Relocate_Node (Right_Opnd (N));
Exptyp : constant Entity_Id := Etype (Exp);
Ovflo : constant Boolean := Do_Overflow_Check (N);
Expv : Uint;
Xnode : Node_Id;
Temp : Node_Id;
Rent : RE_Id;
Ent : Entity_Id;
begin
Binary_Op_Validity_Checks (N);
-- At this point the exponentiation must be dynamic since the static
-- case has already been folded after Resolve by Eval_Op_Expon.
-- Test for case of literal right argument
if Compile_Time_Known_Value (Exp) then
Expv := Expr_Value (Exp);
-- We only fold small non-negative exponents. You might think we
-- could fold small negative exponents for the real case, but we
-- can't because we are required to raise Constraint_Error for
-- the case of 0.0 ** (negative) even if Machine_Overflows = False.
-- See ACVC test C4A012B.
if Expv >= 0 and then Expv <= 4 then
-- X ** 0 = 1 (or 1.0)
if Expv = 0 then
if Ekind (Typ) in Integer_Kind then
Xnode := Make_Integer_Literal (Loc, Intval => 1);
else
Xnode := Make_Real_Literal (Loc, Ureal_1);
end if;
-- X ** 1 = X
elsif Expv = 1 then
Xnode := Base;
-- X ** 2 = X * X
elsif Expv = 2 then
Xnode :=
Make_Op_Multiply (Loc,
Left_Opnd => Duplicate_Subexpr (Base),
Right_Opnd => Duplicate_Subexpr (Base));
-- X ** 3 = X * X * X
elsif Expv = 3 then
Xnode :=
Make_Op_Multiply (Loc,
Left_Opnd =>
Make_Op_Multiply (Loc,
Left_Opnd => Duplicate_Subexpr (Base),
Right_Opnd => Duplicate_Subexpr (Base)),
Right_Opnd => Duplicate_Subexpr (Base));
-- X ** 4 ->
-- En : constant base'type := base * base;
-- ...
-- En * En
else -- Expv = 4
Temp :=
Make_Defining_Identifier (Loc, New_Internal_Name ('E'));
Insert_Actions (N, New_List (
Make_Object_Declaration (Loc,
Defining_Identifier => Temp,
Constant_Present => True,
Object_Definition => New_Reference_To (Typ, Loc),
Expression =>
Make_Op_Multiply (Loc,
Left_Opnd => Duplicate_Subexpr (Base),
Right_Opnd => Duplicate_Subexpr (Base)))));
Xnode :=
Make_Op_Multiply (Loc,
Left_Opnd => New_Reference_To (Temp, Loc),
Right_Opnd => New_Reference_To (Temp, Loc));
end if;
Rewrite (N, Xnode);
Analyze_And_Resolve (N, Typ);
return;
end if;
end if;
-- Case of (2 ** expression) appearing as an argument of an integer
-- multiplication, or as the right argument of a division of a non-
-- negative integer. In such cases we lave the node untouched, setting
-- the flag Is_Natural_Power_Of_2_for_Shift set, then the expansion
-- of the higher level node converts it into a shift.
if Nkind (Base) = N_Integer_Literal
and then Intval (Base) = 2
and then Is_Integer_Type (Root_Type (Exptyp))
and then Esize (Root_Type (Exptyp)) <= Esize (Standard_Integer)
and then Is_Unsigned_Type (Exptyp)
and then not Ovflo
and then Nkind (Parent (N)) in N_Binary_Op
then
declare
P : constant Node_Id := Parent (N);
L : constant Node_Id := Left_Opnd (P);
R : constant Node_Id := Right_Opnd (P);
begin
if (Nkind (P) = N_Op_Multiply
and then
((Is_Integer_Type (Etype (L)) and then R = N)
or else
(Is_Integer_Type (Etype (R)) and then L = N))
and then not Do_Overflow_Check (P))
or else
(Nkind (P) = N_Op_Divide
and then Is_Integer_Type (Etype (L))
and then Is_Unsigned_Type (Etype (L))
and then R = N
and then not Do_Overflow_Check (P))
then
Set_Is_Power_Of_2_For_Shift (N);
return;
end if;
end;
end if;
-- Fall through if exponentiation must be done using a runtime routine.
-- First deal with modular case.
if Is_Modular_Integer_Type (Rtyp) then
-- Non-binary case, we call the special exponentiation routine for
-- the non-binary case, converting the argument to Long_Long_Integer
-- and passing the modulus value. Then the result is converted back
-- to the base type.
if Non_Binary_Modulus (Rtyp) then
Rewrite (N,
Convert_To (Typ,
Make_Function_Call (Loc,
Name => New_Reference_To (RTE (RE_Exp_Modular), Loc),
Parameter_Associations => New_List (
Convert_To (Standard_Integer, Base),
Make_Integer_Literal (Loc, Modulus (Rtyp)),
Exp))));
-- Binary case, in this case, we call one of two routines, either
-- the unsigned integer case, or the unsigned long long integer
-- case, with a final "and" operation to do the required mod.
else
if UI_To_Int (Esize (Rtyp)) <= Standard_Integer_Size then
Ent := RTE (RE_Exp_Unsigned);
else
Ent := RTE (RE_Exp_Long_Long_Unsigned);
end if;
Rewrite (N,
Convert_To (Typ,
Make_Op_And (Loc,
Left_Opnd =>
Make_Function_Call (Loc,
Name => New_Reference_To (Ent, Loc),
Parameter_Associations => New_List (
Convert_To (Etype (First_Formal (Ent)), Base),
Exp)),
Right_Opnd =>
Make_Integer_Literal (Loc, Modulus (Rtyp) - 1))));
end if;
-- Common exit point for modular type case
Analyze_And_Resolve (N, Typ);
return;
-- Signed integer cases
elsif Rtyp = Base_Type (Standard_Integer) then
if Ovflo then
Rent := RE_Exp_Integer;
else
Rent := RE_Exn_Integer;
end if;
elsif Rtyp = Base_Type (Standard_Short_Integer) then
if Ovflo then
Rent := RE_Exp_Short_Integer;
else
Rent := RE_Exn_Short_Integer;
end if;
elsif Rtyp = Base_Type (Standard_Short_Short_Integer) then
if Ovflo then
Rent := RE_Exp_Short_Short_Integer;
else
Rent := RE_Exn_Short_Short_Integer;
end if;
elsif Rtyp = Base_Type (Standard_Long_Integer) then
if Ovflo then
Rent := RE_Exp_Long_Integer;
else
Rent := RE_Exn_Long_Integer;
end if;
elsif (Rtyp = Base_Type (Standard_Long_Long_Integer)
or else Rtyp = Universal_Integer)
then
if Ovflo then
Rent := RE_Exp_Long_Long_Integer;
else
Rent := RE_Exn_Long_Long_Integer;
end if;
-- Floating-point cases
elsif Rtyp = Standard_Float then
if Ovflo then
Rent := RE_Exp_Float;
else
Rent := RE_Exn_Float;
end if;
elsif Rtyp = Standard_Short_Float then
if Ovflo then
Rent := RE_Exp_Short_Float;
else
Rent := RE_Exn_Short_Float;
end if;
elsif Rtyp = Standard_Long_Float then
if Ovflo then
Rent := RE_Exp_Long_Float;
else
Rent := RE_Exn_Long_Float;
end if;
else
pragma Assert
(Rtyp = Standard_Long_Long_Float or else Rtyp = Universal_Real);
if Ovflo then
Rent := RE_Exp_Long_Long_Float;
else
Rent := RE_Exn_Long_Long_Float;
end if;
end if;
-- Common processing for integer cases and floating-point cases.
-- If we are in the base type, we can call runtime routine directly
if Typ = Rtyp
and then Rtyp /= Universal_Integer
and then Rtyp /= Universal_Real
then
Rewrite (N,
Make_Function_Call (Loc,
Name => New_Reference_To (RTE (Rent), Loc),
Parameter_Associations => New_List (Base, Exp)));
-- Otherwise we have to introduce conversions (conversions are also
-- required in the universal cases, since the runtime routine was
-- typed using the largest integer or real case.
else
Rewrite (N,
Convert_To (Typ,
Make_Function_Call (Loc,
Name => New_Reference_To (RTE (Rent), Loc),
Parameter_Associations => New_List (
Convert_To (Rtyp, Base),
Exp))));
end if;
Analyze_And_Resolve (N, Typ);
return;
end Expand_N_Op_Expon;
--------------------
-- Expand_N_Op_Ge --
--------------------
procedure Expand_N_Op_Ge (N : Node_Id) is
Typ : constant Entity_Id := Etype (N);
Op1 : constant Node_Id := Left_Opnd (N);
Op2 : constant Node_Id := Right_Opnd (N);
Typ1 : constant Entity_Id := Base_Type (Etype (Op1));
begin
Binary_Op_Validity_Checks (N);
if Vax_Float (Typ1) then
Expand_Vax_Comparison (N);
return;
elsif Is_Array_Type (Typ1) then
Expand_Array_Comparison (N);
return;
end if;
if Is_Boolean_Type (Typ1) then
Adjust_Condition (Op1);
Adjust_Condition (Op2);
Set_Etype (N, Standard_Boolean);
Adjust_Result_Type (N, Typ);
end if;
Rewrite_Comparison (N);
end Expand_N_Op_Ge;
--------------------
-- Expand_N_Op_Gt --
--------------------
procedure Expand_N_Op_Gt (N : Node_Id) is
Typ : constant Entity_Id := Etype (N);
Op1 : constant Node_Id := Left_Opnd (N);
Op2 : constant Node_Id := Right_Opnd (N);
Typ1 : constant Entity_Id := Base_Type (Etype (Op1));
begin
Binary_Op_Validity_Checks (N);
if Vax_Float (Typ1) then
Expand_Vax_Comparison (N);
return;
elsif Is_Array_Type (Typ1) then
Expand_Array_Comparison (N);
return;
end if;
if Is_Boolean_Type (Typ1) then
Adjust_Condition (Op1);
Adjust_Condition (Op2);
Set_Etype (N, Standard_Boolean);
Adjust_Result_Type (N, Typ);
end if;
Rewrite_Comparison (N);
end Expand_N_Op_Gt;
--------------------
-- Expand_N_Op_Le --
--------------------
procedure Expand_N_Op_Le (N : Node_Id) is
Typ : constant Entity_Id := Etype (N);
Op1 : constant Node_Id := Left_Opnd (N);
Op2 : constant Node_Id := Right_Opnd (N);
Typ1 : constant Entity_Id := Base_Type (Etype (Op1));
begin
Binary_Op_Validity_Checks (N);
if Vax_Float (Typ1) then
Expand_Vax_Comparison (N);
return;
elsif Is_Array_Type (Typ1) then
Expand_Array_Comparison (N);
return;
end if;
if Is_Boolean_Type (Typ1) then
Adjust_Condition (Op1);
Adjust_Condition (Op2);
Set_Etype (N, Standard_Boolean);
Adjust_Result_Type (N, Typ);
end if;
Rewrite_Comparison (N);
end Expand_N_Op_Le;
--------------------
-- Expand_N_Op_Lt --
--------------------
procedure Expand_N_Op_Lt (N : Node_Id) is
Typ : constant Entity_Id := Etype (N);
Op1 : constant Node_Id := Left_Opnd (N);
Op2 : constant Node_Id := Right_Opnd (N);
Typ1 : constant Entity_Id := Base_Type (Etype (Op1));
begin
Binary_Op_Validity_Checks (N);
if Vax_Float (Typ1) then
Expand_Vax_Comparison (N);
return;
elsif Is_Array_Type (Typ1) then
Expand_Array_Comparison (N);
return;
end if;
if Is_Boolean_Type (Typ1) then
Adjust_Condition (Op1);
Adjust_Condition (Op2);
Set_Etype (N, Standard_Boolean);
Adjust_Result_Type (N, Typ);
end if;
Rewrite_Comparison (N);
end Expand_N_Op_Lt;
-----------------------
-- Expand_N_Op_Minus --
-----------------------
procedure Expand_N_Op_Minus (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Typ : constant Entity_Id := Etype (N);
begin
Unary_Op_Validity_Checks (N);
if Software_Overflow_Checking
and then Is_Signed_Integer_Type (Etype (N))
and then Do_Overflow_Check (N)
then
-- Software overflow checking expands -expr into (0 - expr)
Rewrite (N,
Make_Op_Subtract (Loc,
Left_Opnd => Make_Integer_Literal (Loc, 0),
Right_Opnd => Right_Opnd (N)));
Analyze_And_Resolve (N, Typ);
-- Vax floating-point types case
elsif Vax_Float (Etype (N)) then
Expand_Vax_Arith (N);
end if;
end Expand_N_Op_Minus;
---------------------
-- Expand_N_Op_Mod --
---------------------
procedure Expand_N_Op_Mod (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
T : constant Entity_Id := Etype (N);
Left : constant Node_Id := Left_Opnd (N);
Right : constant Node_Id := Right_Opnd (N);
DOC : constant Boolean := Do_Overflow_Check (N);
DDC : constant Boolean := Do_Division_Check (N);
LLB : Uint;
Llo : Uint;
Lhi : Uint;
LOK : Boolean;
Rlo : Uint;
Rhi : Uint;
ROK : Boolean;
begin
Binary_Op_Validity_Checks (N);
Determine_Range (Right, ROK, Rlo, Rhi);
Determine_Range (Left, LOK, Llo, Lhi);
-- Convert mod to rem if operands are known non-negative. We do this
-- since it is quite likely that this will improve the quality of code,
-- (the operation now corresponds to the hardware remainder), and it
-- does not seem likely that it could be harmful.
if LOK and then Llo >= 0
and then
ROK and then Rlo >= 0
then
Rewrite (N,
Make_Op_Rem (Sloc (N),
Left_Opnd => Left_Opnd (N),
Right_Opnd => Right_Opnd (N)));
-- Instead of reanalyzing the node we do the analysis manually.
-- This avoids anomalies when the replacement is done in an
-- instance and is epsilon more efficient.
Set_Entity (N, Standard_Entity (S_Op_Rem));
Set_Etype (N, T);
Set_Do_Overflow_Check (N, DOC);
Set_Do_Division_Check (N, DDC);
Expand_N_Op_Rem (N);
Set_Analyzed (N);
-- Otherwise, normal mod processing
else
if Is_Integer_Type (Etype (N)) then
Apply_Divide_Check (N);
end if;
-- Deal with annoying case of largest negative number remainder
-- minus one. Gigi does not handle this case correctly, because
-- it generates a divide instruction which may trap in this case.
-- In fact the check is quite easy, if the right operand is -1,
-- then the mod value is always 0, and we can just ignore the
-- left operand completely in this case.
LLB := Expr_Value (Type_Low_Bound (Base_Type (Etype (Left))));
if ((not ROK) or else (Rlo <= (-1) and then (-1) <= Rhi))
and then
((not LOK) or else (Llo = LLB))
then
Rewrite (N,
Make_Conditional_Expression (Loc,
Expressions => New_List (
Make_Op_Eq (Loc,
Left_Opnd => Duplicate_Subexpr (Right),
Right_Opnd =>
Make_Integer_Literal (Loc, -1)),
Make_Integer_Literal (Loc, Uint_0),
Relocate_Node (N))));
Set_Analyzed (Next (Next (First (Expressions (N)))));
Analyze_And_Resolve (N, T);
end if;
end if;
end Expand_N_Op_Mod;
--------------------------
-- Expand_N_Op_Multiply --
--------------------------
procedure Expand_N_Op_Multiply (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Lop : constant Node_Id := Left_Opnd (N);
Rop : constant Node_Id := Right_Opnd (N);
Ltyp : constant Entity_Id := Etype (Lop);
Rtyp : constant Entity_Id := Etype (Rop);
Typ : Entity_Id := Etype (N);
begin
Binary_Op_Validity_Checks (N);
-- Special optimizations for integer types
if Is_Integer_Type (Typ) then
-- N * 0 = 0 * N = 0 for integer types
if (Compile_Time_Known_Value (Right_Opnd (N))
and then Expr_Value (Right_Opnd (N)) = Uint_0)
or else
(Compile_Time_Known_Value (Left_Opnd (N))
and then Expr_Value (Left_Opnd (N)) = Uint_0)
then
Rewrite (N, Make_Integer_Literal (Loc, Uint_0));
Analyze_And_Resolve (N, Typ);
return;
end if;
-- N * 1 = 1 * N = N for integer types
if Compile_Time_Known_Value (Right_Opnd (N))
and then Expr_Value (Right_Opnd (N)) = Uint_1
then
Rewrite (N, Left_Opnd (N));
return;
elsif Compile_Time_Known_Value (Left_Opnd (N))
and then Expr_Value (Left_Opnd (N)) = Uint_1
then
Rewrite (N, Right_Opnd (N));
return;
end if;
end if;
-- Deal with VAX float case
if Vax_Float (Typ) then
Expand_Vax_Arith (N);
return;
end if;
-- Convert x * 2 ** y to Shift_Left (x, y). Note that the fact that
-- Is_Power_Of_2_For_Shift is set means that we know that our left
-- operand is an integer, as required for this to work.
if Nkind (Rop) = N_Op_Expon
and then Is_Power_Of_2_For_Shift (Rop)
then
if Nkind (Lop) = N_Op_Expon
and then Is_Power_Of_2_For_Shift (Lop)
then
-- convert 2 ** A * 2 ** B into 2 ** (A + B)
Rewrite (N,
Make_Op_Expon (Loc,
Left_Opnd => Make_Integer_Literal (Loc, 2),
Right_Opnd =>
Make_Op_Add (Loc,
Left_Opnd => Right_Opnd (Lop),
Right_Opnd => Right_Opnd (Rop))));
Analyze_And_Resolve (N, Typ);
return;
else
Rewrite (N,
Make_Op_Shift_Left (Loc,
Left_Opnd => Lop,
Right_Opnd =>
Convert_To (Standard_Natural, Right_Opnd (Rop))));
Analyze_And_Resolve (N, Typ);
return;
end if;
-- Same processing for the operands the other way round
elsif Nkind (Lop) = N_Op_Expon
and then Is_Power_Of_2_For_Shift (Lop)
then
Rewrite (N,
Make_Op_Shift_Left (Loc,
Left_Opnd => Rop,
Right_Opnd =>
Convert_To (Standard_Natural, Right_Opnd (Lop))));
Analyze_And_Resolve (N, Typ);
return;
end if;
-- Do required fixup of universal fixed operation
if Typ = Universal_Fixed then
Fixup_Universal_Fixed_Operation (N);
Typ := Etype (N);
end if;
-- Multiplications with fixed-point results
if Is_Fixed_Point_Type (Typ) then
-- No special processing if Treat_Fixed_As_Integer is set,
-- since from a semantic point of view such operations are
-- simply integer operations and will be treated that way.
if not Treat_Fixed_As_Integer (N) then
-- Case of fixed * integer => fixed
if Is_Integer_Type (Rtyp) then
Expand_Multiply_Fixed_By_Integer_Giving_Fixed (N);
-- Case of integer * fixed => fixed
elsif Is_Integer_Type (Ltyp) then
Expand_Multiply_Integer_By_Fixed_Giving_Fixed (N);
-- Case of fixed * fixed => fixed
else
Expand_Multiply_Fixed_By_Fixed_Giving_Fixed (N);
end if;
end if;
-- Other cases of multiplication of fixed-point operands. Again
-- we exclude the cases where Treat_Fixed_As_Integer flag is set.
elsif (Is_Fixed_Point_Type (Ltyp) or else Is_Fixed_Point_Type (Rtyp))
and then not Treat_Fixed_As_Integer (N)
then
if Is_Integer_Type (Typ) then
Expand_Multiply_Fixed_By_Fixed_Giving_Integer (N);
else
pragma Assert (Is_Floating_Point_Type (Typ));
Expand_Multiply_Fixed_By_Fixed_Giving_Float (N);
end if;
-- Mixed-mode operations can appear in a non-static universal
-- context, in which case the integer argument must be converted
-- explicitly.
elsif Typ = Universal_Real
and then Is_Integer_Type (Rtyp)
then
Rewrite (Rop, Convert_To (Universal_Real, Relocate_Node (Rop)));
Analyze_And_Resolve (Rop, Universal_Real);
elsif Typ = Universal_Real
and then Is_Integer_Type (Ltyp)
then
Rewrite (Lop, Convert_To (Universal_Real, Relocate_Node (Lop)));
Analyze_And_Resolve (Lop, Universal_Real);
-- Non-fixed point cases, check software overflow checking required
elsif Is_Signed_Integer_Type (Etype (N)) then
Apply_Arithmetic_Overflow_Check (N);
end if;
end Expand_N_Op_Multiply;
--------------------
-- Expand_N_Op_Ne --
--------------------
-- Rewrite node as the negation of an equality operation, and reanalyze.
-- The equality to be used is defined in the same scope and has the same
-- signature. It must be set explicitly because in an instance it may not
-- have the same visibility as in the generic unit.
procedure Expand_N_Op_Ne (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Neg : Node_Id;
Ne : constant Entity_Id := Entity (N);
begin
Binary_Op_Validity_Checks (N);
Neg :=
Make_Op_Not (Loc,
Right_Opnd =>
Make_Op_Eq (Loc,
Left_Opnd => Left_Opnd (N),
Right_Opnd => Right_Opnd (N)));
Set_Paren_Count (Right_Opnd (Neg), 1);
if Scope (Ne) /= Standard_Standard then
Set_Entity (Right_Opnd (Neg), Corresponding_Equality (Ne));
end if;
Rewrite (N, Neg);
Analyze_And_Resolve (N, Standard_Boolean);
end Expand_N_Op_Ne;
---------------------
-- Expand_N_Op_Not --
---------------------
-- If the argument is other than a Boolean array type, there is no
-- special expansion required.
-- For the packed case, we call the special routine in Exp_Pakd, except
-- that if the component size is greater than one, we use the standard
-- routine generating a gruesome loop (it is so peculiar to have packed
-- arrays with non-standard Boolean representations anyway, so it does
-- not matter that we do not handle this case efficiently).
-- For the unpacked case (and for the special packed case where we have
-- non standard Booleans, as discussed above), we generate and insert
-- into the tree the following function definition:
-- function Nnnn (A : arr) is
-- B : arr;
-- begin
-- for J in a'range loop
-- B (J) := not A (J);
-- end loop;
-- return B;
-- end Nnnn;
-- Here arr is the actual subtype of the parameter (and hence always
-- constrained). Then we replace the not with a call to this function.
procedure Expand_N_Op_Not (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Typ : constant Entity_Id := Etype (N);
Opnd : Node_Id;
Arr : Entity_Id;
A : Entity_Id;
B : Entity_Id;
J : Entity_Id;
A_J : Node_Id;
B_J : Node_Id;
Func_Name : Entity_Id;
Loop_Statement : Node_Id;
begin
Unary_Op_Validity_Checks (N);
-- For boolean operand, deal with non-standard booleans
if Is_Boolean_Type (Typ) then
Adjust_Condition (Right_Opnd (N));
Set_Etype (N, Standard_Boolean);
Adjust_Result_Type (N, Typ);
return;
end if;
-- Only array types need any other processing
if not Is_Array_Type (Typ) then
return;
end if;
-- Case of array operand. If bit packed, handle it in Exp_Pakd
if Is_Bit_Packed_Array (Typ) and then Component_Size (Typ) = 1 then
Expand_Packed_Not (N);
return;
end if;
-- Case of array operand which is not bit-packed
Opnd := Relocate_Node (Right_Opnd (N));
Convert_To_Actual_Subtype (Opnd);
Arr := Etype (Opnd);
Ensure_Defined (Arr, N);
A := Make_Defining_Identifier (Loc, Name_uA);
B := Make_Defining_Identifier (Loc, Name_uB);
J := Make_Defining_Identifier (Loc, Name_uJ);
A_J :=
Make_Indexed_Component (Loc,
Prefix => New_Reference_To (A, Loc),
Expressions => New_List (New_Reference_To (J, Loc)));
B_J :=
Make_Indexed_Component (Loc,
Prefix => New_Reference_To (B, Loc),
Expressions => New_List (New_Reference_To (J, Loc)));
Loop_Statement :=
Make_Implicit_Loop_Statement (N,
Identifier => Empty,
Iteration_Scheme =>
Make_Iteration_Scheme (Loc,
Loop_Parameter_Specification =>
Make_Loop_Parameter_Specification (Loc,
Defining_Identifier => J,
Discrete_Subtype_Definition =>
Make_Attribute_Reference (Loc,
Prefix => Make_Identifier (Loc, Chars (A)),
Attribute_Name => Name_Range))),
Statements => New_List (
Make_Assignment_Statement (Loc,
Name => B_J,
Expression => Make_Op_Not (Loc, A_J))));
Func_Name := Make_Defining_Identifier (Loc, New_Internal_Name ('N'));
Set_Is_Inlined (Func_Name);
Insert_Action (N,
Make_Subprogram_Body (Loc,
Specification =>
Make_Function_Specification (Loc,
Defining_Unit_Name => Func_Name,
Parameter_Specifications => New_List (
Make_Parameter_Specification (Loc,
Defining_Identifier => A,
Parameter_Type => New_Reference_To (Typ, Loc))),
Subtype_Mark => New_Reference_To (Typ, Loc)),
Declarations => New_List (
Make_Object_Declaration (Loc,
Defining_Identifier => B,
Object_Definition => New_Reference_To (Arr, Loc))),
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
Statements => New_List (
Loop_Statement,
Make_Return_Statement (Loc,
Expression =>
Make_Identifier (Loc, Chars (B)))))));
Rewrite (N,
Make_Function_Call (Loc,
Name => New_Reference_To (Func_Name, Loc),
Parameter_Associations => New_List (Opnd)));
Analyze_And_Resolve (N, Typ);
end Expand_N_Op_Not;
--------------------
-- Expand_N_Op_Or --
--------------------
procedure Expand_N_Op_Or (N : Node_Id) is
Typ : constant Entity_Id := Etype (N);
begin
Binary_Op_Validity_Checks (N);
if Is_Array_Type (Etype (N)) then
Expand_Boolean_Operator (N);
elsif Is_Boolean_Type (Etype (N)) then
Adjust_Condition (Left_Opnd (N));
Adjust_Condition (Right_Opnd (N));
Set_Etype (N, Standard_Boolean);
Adjust_Result_Type (N, Typ);
end if;
end Expand_N_Op_Or;
----------------------
-- Expand_N_Op_Plus --
----------------------
procedure Expand_N_Op_Plus (N : Node_Id) is
begin
Unary_Op_Validity_Checks (N);
end Expand_N_Op_Plus;
---------------------
-- Expand_N_Op_Rem --
---------------------
procedure Expand_N_Op_Rem (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Left : constant Node_Id := Left_Opnd (N);
Right : constant Node_Id := Right_Opnd (N);
LLB : Uint;
Llo : Uint;
Lhi : Uint;
LOK : Boolean;
Rlo : Uint;
Rhi : Uint;
ROK : Boolean;
Typ : Entity_Id;
begin
Binary_Op_Validity_Checks (N);
if Is_Integer_Type (Etype (N)) then
Apply_Divide_Check (N);
end if;
-- Deal with annoying case of largest negative number remainder
-- minus one. Gigi does not handle this case correctly, because
-- it generates a divide instruction which may trap in this case.
-- In fact the check is quite easy, if the right operand is -1,
-- then the remainder is always 0, and we can just ignore the
-- left operand completely in this case.
Determine_Range (Right, ROK, Rlo, Rhi);
Determine_Range (Left, LOK, Llo, Lhi);
LLB := Expr_Value (Type_Low_Bound (Base_Type (Etype (Left))));
Typ := Etype (N);
if ((not ROK) or else (Rlo <= (-1) and then (-1) <= Rhi))
and then
((not LOK) or else (Llo = LLB))
then
Rewrite (N,
Make_Conditional_Expression (Loc,
Expressions => New_List (
Make_Op_Eq (Loc,
Left_Opnd => Duplicate_Subexpr (Right),
Right_Opnd =>
Make_Integer_Literal (Loc, -1)),
Make_Integer_Literal (Loc, Uint_0),
Relocate_Node (N))));
Set_Analyzed (Next (Next (First (Expressions (N)))));
Analyze_And_Resolve (N, Typ);
end if;
end Expand_N_Op_Rem;
-----------------------------
-- Expand_N_Op_Rotate_Left --
-----------------------------
procedure Expand_N_Op_Rotate_Left (N : Node_Id) is
begin
Binary_Op_Validity_Checks (N);
end Expand_N_Op_Rotate_Left;
------------------------------
-- Expand_N_Op_Rotate_Right --
------------------------------
procedure Expand_N_Op_Rotate_Right (N : Node_Id) is
begin
Binary_Op_Validity_Checks (N);
end Expand_N_Op_Rotate_Right;
----------------------------
-- Expand_N_Op_Shift_Left --
----------------------------
procedure Expand_N_Op_Shift_Left (N : Node_Id) is
begin
Binary_Op_Validity_Checks (N);
end Expand_N_Op_Shift_Left;
-----------------------------
-- Expand_N_Op_Shift_Right --
-----------------------------
procedure Expand_N_Op_Shift_Right (N : Node_Id) is
begin
Binary_Op_Validity_Checks (N);
end Expand_N_Op_Shift_Right;
----------------------------------------
-- Expand_N_Op_Shift_Right_Arithmetic --
----------------------------------------
procedure Expand_N_Op_Shift_Right_Arithmetic (N : Node_Id) is
begin
Binary_Op_Validity_Checks (N);
end Expand_N_Op_Shift_Right_Arithmetic;
--------------------------
-- Expand_N_Op_Subtract --
--------------------------
procedure Expand_N_Op_Subtract (N : Node_Id) is
Typ : constant Entity_Id := Etype (N);
begin
Binary_Op_Validity_Checks (N);
-- N - 0 = N for integer types
if Is_Integer_Type (Typ)
and then Compile_Time_Known_Value (Right_Opnd (N))
and then Expr_Value (Right_Opnd (N)) = 0
then
Rewrite (N, Left_Opnd (N));
return;
end if;
-- Arithemtic overflow checks for signed integer/fixed point types
if Is_Signed_Integer_Type (Typ)
or else Is_Fixed_Point_Type (Typ)
then
Apply_Arithmetic_Overflow_Check (N);
-- Vax floating-point types case
elsif Vax_Float (Typ) then
Expand_Vax_Arith (N);
end if;
end Expand_N_Op_Subtract;
---------------------
-- Expand_N_Op_Xor --
---------------------
procedure Expand_N_Op_Xor (N : Node_Id) is
Typ : constant Entity_Id := Etype (N);
begin
Binary_Op_Validity_Checks (N);
if Is_Array_Type (Etype (N)) then
Expand_Boolean_Operator (N);
elsif Is_Boolean_Type (Etype (N)) then
Adjust_Condition (Left_Opnd (N));
Adjust_Condition (Right_Opnd (N));
Set_Etype (N, Standard_Boolean);
Adjust_Result_Type (N, Typ);
end if;
end Expand_N_Op_Xor;
----------------------
-- Expand_N_Or_Else --
----------------------
-- Expand into conditional expression if Actions present, and also
-- deal with optimizing case of arguments being True or False.
procedure Expand_N_Or_Else (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Typ : constant Entity_Id := Etype (N);
Left : constant Node_Id := Left_Opnd (N);
Right : constant Node_Id := Right_Opnd (N);
Actlist : List_Id;
begin
-- Deal with non-standard booleans
if Is_Boolean_Type (Typ) then
Adjust_Condition (Left);
Adjust_Condition (Right);
Set_Etype (N, Standard_Boolean);
-- Check for cases of left argument is True or False
elsif Nkind (Left) = N_Identifier then
-- If left argument is False, change (False or else Right) to Right.
-- Any actions associated with Right will be executed unconditionally
-- and can thus be inserted into the tree unconditionally.
if Entity (Left) = Standard_False then
if Present (Actions (N)) then
Insert_Actions (N, Actions (N));
end if;
Rewrite (N, Right);
Adjust_Result_Type (N, Typ);
return;
-- If left argument is True, change (True and then Right) to
-- True. In this case we can forget the actions associated with
-- Right, since they will never be executed.
elsif Entity (Left) = Standard_True then
Kill_Dead_Code (Right);
Kill_Dead_Code (Actions (N));
Rewrite (N, New_Occurrence_Of (Standard_True, Loc));
Adjust_Result_Type (N, Typ);
return;
end if;
end if;
-- If Actions are present, we expand
-- left or else right
-- into
-- if left then True else right end
-- with the actions becoming the Else_Actions of the conditional
-- expression. This conditional expression is then further expanded
-- (and will eventually disappear)
if Present (Actions (N)) then
Actlist := Actions (N);
Rewrite (N,
Make_Conditional_Expression (Loc,
Expressions => New_List (
Left,
New_Occurrence_Of (Standard_True, Loc),
Right)));
Set_Else_Actions (N, Actlist);
Analyze_And_Resolve (N, Standard_Boolean);
Adjust_Result_Type (N, Typ);
return;
end if;
-- No actions present, check for cases of right argument True/False
if Nkind (Right) = N_Identifier then
-- Change (Left or else False) to Left. Note that we know there
-- are no actions associated with the True operand, since we
-- just checked for this case above.
if Entity (Right) = Standard_False then
Rewrite (N, Left);
-- Change (Left or else True) to True, making sure to preserve
-- any side effects associated with the Left operand.
elsif Entity (Right) = Standard_True then
Remove_Side_Effects (Left);
Rewrite
(N, New_Occurrence_Of (Standard_True, Loc));
end if;
end if;
Adjust_Result_Type (N, Typ);
end Expand_N_Or_Else;
-----------------------------------
-- Expand_N_Qualified_Expression --
-----------------------------------
procedure Expand_N_Qualified_Expression (N : Node_Id) is
Operand : constant Node_Id := Expression (N);
Target_Type : constant Entity_Id := Entity (Subtype_Mark (N));
begin
Apply_Constraint_Check (Operand, Target_Type, No_Sliding => True);
end Expand_N_Qualified_Expression;
---------------------------------
-- Expand_N_Selected_Component --
---------------------------------
-- If the selector is a discriminant of a concurrent object, rewrite the
-- prefix to denote the corresponding record type.
procedure Expand_N_Selected_Component (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Par : constant Node_Id := Parent (N);
P : constant Node_Id := Prefix (N);
Disc : Entity_Id;
Ptyp : Entity_Id := Underlying_Type (Etype (P));
New_N : Node_Id;
function In_Left_Hand_Side (Comp : Node_Id) return Boolean;
-- Gigi needs a temporary for prefixes that depend on a discriminant,
-- unless the context of an assignment can provide size information.
function In_Left_Hand_Side (Comp : Node_Id) return Boolean is
begin
return
(Nkind (Parent (Comp)) = N_Assignment_Statement
and then Comp = Name (Parent (Comp)))
or else
(Present (Parent (Comp))
and then Nkind (Parent (Comp)) in N_Subexpr
and then In_Left_Hand_Side (Parent (Comp)));
end In_Left_Hand_Side;
begin
if Do_Discriminant_Check (N) then
-- Present the discrminant checking function to the backend,
-- so that it can inline the call to the function.
Add_Inlined_Body
(Discriminant_Checking_Func
(Original_Record_Component (Entity (Selector_Name (N)))));
end if;
-- Insert explicit dereference call for the checked storage pool case
if Is_Access_Type (Ptyp) then
Insert_Dereference_Action (P);
return;
end if;
-- Gigi cannot handle unchecked conversions that are the prefix of
-- a selected component with discriminants. This must be checked
-- during expansion, because during analysis the type of the selector
-- is not known at the point the prefix is analyzed. If the conversion
-- is the target of an assignment, we cannot force the evaluation, of
-- course.
if Nkind (Prefix (N)) = N_Unchecked_Type_Conversion
and then Has_Discriminants (Etype (N))
and then not In_Left_Hand_Side (N)
then
Force_Evaluation (Prefix (N));
end if;
-- Remaining processing applies only if selector is a discriminant
if Ekind (Entity (Selector_Name (N))) = E_Discriminant then
-- If the selector is a discriminant of a constrained record type,
-- rewrite the expression with the actual value of the discriminant.
-- Don't do this on the left hand of an assignment statement (this
-- happens in generated code, and means we really want to set it!)
-- We also only do this optimization for discrete types, and not
-- for access types (access discriminants get us into trouble!)
-- We also do not expand the prefix of an attribute or the
-- operand of an object renaming declaration.
if Is_Record_Type (Ptyp)
and then Has_Discriminants (Ptyp)
and then Is_Constrained (Ptyp)
and then Is_Discrete_Type (Etype (N))
and then (Nkind (Par) /= N_Assignment_Statement
or else Name (Par) /= N)
and then (Nkind (Par) /= N_Attribute_Reference
or else Prefix (Par) /= N)
and then not Is_Renamed_Object (N)
then
declare
D : Entity_Id;
E : Elmt_Id;
begin
D := First_Discriminant (Ptyp);
E := First_Elmt (Discriminant_Constraint (Ptyp));
while Present (E) loop
if D = Entity (Selector_Name (N)) then
-- In the context of a case statement, the expression
-- may have the base type of the discriminant, and we
-- need to preserve the constraint to avoid spurious
-- errors on missing cases.
if Nkind (Parent (N)) = N_Case_Statement
and then Etype (Node (E)) /= Etype (D)
then
Rewrite (N,
Make_Qualified_Expression (Loc,
Subtype_Mark => New_Occurrence_Of (Etype (D), Loc),
Expression => New_Copy (Node (E))));
Analyze (N);
else
Rewrite (N, New_Copy (Node (E)));
end if;
Set_Is_Static_Expression (N, False);
return;
end if;
Next_Elmt (E);
Next_Discriminant (D);
end loop;
-- Note: the above loop should always terminate, but if
-- it does not, we just missed an optimization due to
-- some glitch (perhaps a previous error), so ignore!
end;
end if;
-- The only remaining processing is in the case of a discriminant of
-- a concurrent object, where we rewrite the prefix to denote the
-- corresponding record type. If the type is derived and has renamed
-- discriminants, use corresponding discriminant, which is the one
-- that appears in the corresponding record.
if not Is_Concurrent_Type (Ptyp) then
return;
end if;
Disc := Entity (Selector_Name (N));
if Is_Derived_Type (Ptyp)
and then Present (Corresponding_Discriminant (Disc))
then
Disc := Corresponding_Discriminant (Disc);
end if;
New_N :=
Make_Selected_Component (Loc,
Prefix =>
Unchecked_Convert_To (Corresponding_Record_Type (Ptyp),
New_Copy_Tree (P)),
Selector_Name => Make_Identifier (Loc, Chars (Disc)));
Rewrite (N, New_N);
Analyze (N);
end if;
end Expand_N_Selected_Component;
--------------------
-- Expand_N_Slice --
--------------------
procedure Expand_N_Slice (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Typ : constant Entity_Id := Etype (N);
Pfx : constant Node_Id := Prefix (N);
Ptp : Entity_Id := Etype (Pfx);
Ent : Entity_Id;
Decl : Node_Id;
begin
-- Special handling for access types
if Is_Access_Type (Ptp) then
-- Check for explicit dereference required for checked pool
Insert_Dereference_Action (Pfx);
-- If we have an access to a packed array type, then put in an
-- explicit dereference. We do this in case the slice must be
-- expanded, and we want to make sure we get an access check.
Ptp := Designated_Type (Ptp);
if Is_Array_Type (Ptp) and then Is_Packed (Ptp) then
Rewrite (Pfx,
Make_Explicit_Dereference (Sloc (N),
Prefix => Relocate_Node (Pfx)));
Analyze_And_Resolve (Pfx, Ptp);
-- The prefix will now carry the Access_Check flag for the back
-- end, remove it from slice itself.
Set_Do_Access_Check (N, False);
end if;
end if;
-- Range checks are potentially also needed for cases involving
-- a slice indexed by a subtype indication, but Do_Range_Check
-- can currently only be set for expressions ???
if not Index_Checks_Suppressed (Ptp)
and then (not Is_Entity_Name (Pfx)
or else not Index_Checks_Suppressed (Entity (Pfx)))
and then Nkind (Discrete_Range (N)) /= N_Subtype_Indication
then
Enable_Range_Check (Discrete_Range (N));
end if;
-- The remaining case to be handled is packed slices. We can leave
-- packed slices as they are in the following situations:
-- 1. Right or left side of an assignment (we can handle this
-- situation correctly in the assignment statement expansion).
-- 2. Prefix of indexed component (the slide is optimized away
-- in this case, see the start of Expand_N_Slice.
-- 3. Object renaming declaration, since we want the name of
-- the slice, not the value.
-- 4. Argument to procedure call, since copy-in/copy-out handling
-- may be required, and this is handled in the expansion of
-- call itself.
-- 5. Prefix of an address attribute (this is an error which
-- is caught elsewhere, and the expansion would intefere
-- with generating the error message).
if Is_Packed (Typ)
and then Nkind (Parent (N)) /= N_Assignment_Statement
and then Nkind (Parent (N)) /= N_Indexed_Component
and then not Is_Renamed_Object (N)
and then Nkind (Parent (N)) /= N_Procedure_Call_Statement
and then (Nkind (Parent (N)) /= N_Attribute_Reference
or else
Attribute_Name (Parent (N)) /= Name_Address)
then
Ent :=
Make_Defining_Identifier (Loc, New_Internal_Name ('T'));
Decl :=
Make_Object_Declaration (Loc,
Defining_Identifier => Ent,
Object_Definition => New_Occurrence_Of (Typ, Loc));
Set_No_Initialization (Decl);
Insert_Actions (N, New_List (
Decl,
Make_Assignment_Statement (Loc,
Name => New_Occurrence_Of (Ent, Loc),
Expression => Relocate_Node (N))));
Rewrite (N, New_Occurrence_Of (Ent, Loc));
Analyze_And_Resolve (N, Typ);
end if;
end Expand_N_Slice;
------------------------------
-- Expand_N_Type_Conversion --
------------------------------
procedure Expand_N_Type_Conversion (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Operand : constant Node_Id := Expression (N);
Target_Type : constant Entity_Id := Etype (N);
Operand_Type : Entity_Id := Etype (Operand);
procedure Handle_Changed_Representation;
-- This is called in the case of record and array type conversions
-- to see if there is a change of representation to be handled.
-- Change of representation is actually handled at the assignment
-- statement level, and what this procedure does is rewrite node N
-- conversion as an assignment to temporary. If there is no change
-- of representation, then the conversion node is unchanged.
procedure Real_Range_Check;
-- Handles generation of range check for real target value
-----------------------------------
-- Handle_Changed_Representation --
-----------------------------------
procedure Handle_Changed_Representation is
Temp : Entity_Id;
Decl : Node_Id;
Odef : Node_Id;
Disc : Node_Id;
N_Ix : Node_Id;
Cons : List_Id;
begin
-- Nothing to do if no change of representation
if Same_Representation (Operand_Type, Target_Type) then
return;
-- The real change of representation work is done by the assignment
-- statement processing. So if this type conversion is appearing as
-- the expression of an assignment statement, nothing needs to be
-- done to the conversion.
elsif Nkind (Parent (N)) = N_Assignment_Statement then
return;
-- Otherwise we need to generate a temporary variable, and do the
-- change of representation assignment into that temporary variable.
-- The conversion is then replaced by a reference to this variable.
else
Cons := No_List;
-- If type is unconstrained we have to add a constraint,
-- copied from the actual value of the left hand side.
if not Is_Constrained (Target_Type) then
if Has_Discriminants (Operand_Type) then
Disc := First_Discriminant (Operand_Type);
Cons := New_List;
while Present (Disc) loop
Append_To (Cons,
Make_Selected_Component (Loc,
Prefix => Duplicate_Subexpr (Operand),
Selector_Name =>
Make_Identifier (Loc, Chars (Disc))));
Next_Discriminant (Disc);
end loop;
elsif Is_Array_Type (Operand_Type) then
N_Ix := First_Index (Target_Type);
Cons := New_List;
for J in 1 .. Number_Dimensions (Operand_Type) loop
-- We convert the bounds explicitly. We use an unchecked
-- conversion because bounds checks are done elsewhere.
Append_To (Cons,
Make_Range (Loc,
Low_Bound =>
Unchecked_Convert_To (Etype (N_Ix),
Make_Attribute_Reference (Loc,
Prefix =>
Duplicate_Subexpr
(Operand, Name_Req => True),
Attribute_Name => Name_First,
Expressions => New_List (
Make_Integer_Literal (Loc, J)))),
High_Bound =>
Unchecked_Convert_To (Etype (N_Ix),
Make_Attribute_Reference (Loc,
Prefix =>
Duplicate_Subexpr
(Operand, Name_Req => True),
Attribute_Name => Name_Last,
Expressions => New_List (
Make_Integer_Literal (Loc, J))))));
Next_Index (N_Ix);
end loop;
end if;
end if;
Odef := New_Occurrence_Of (Target_Type, Loc);
if Present (Cons) then
Odef :=
Make_Subtype_Indication (Loc,
Subtype_Mark => Odef,
Constraint =>
Make_Index_Or_Discriminant_Constraint (Loc,
Constraints => Cons));
end if;
Temp := Make_Defining_Identifier (Loc, New_Internal_Name ('C'));
Decl :=
Make_Object_Declaration (Loc,
Defining_Identifier => Temp,
Object_Definition => Odef);
Set_No_Initialization (Decl, True);
-- Insert required actions. It is essential to suppress checks
-- since we have suppressed default initialization, which means
-- that the variable we create may have no discriminants.
Insert_Actions (N,
New_List (
Decl,
Make_Assignment_Statement (Loc,
Name => New_Occurrence_Of (Temp, Loc),
Expression => Relocate_Node (N))),
Suppress => All_Checks);
Rewrite (N, New_Occurrence_Of (Temp, Loc));
return;
end if;
end Handle_Changed_Representation;
----------------------
-- Real_Range_Check --
----------------------
-- Case of conversions to floating-point or fixed-point. If range
-- checks are enabled and the target type has a range constraint,
-- we convert:
-- typ (x)
-- to
-- Tnn : typ'Base := typ'Base (x);
-- [constraint_error when Tnn < typ'First or else Tnn > typ'Last]
-- Tnn
procedure Real_Range_Check is
Btyp : constant Entity_Id := Base_Type (Target_Type);
Lo : constant Node_Id := Type_Low_Bound (Target_Type);
Hi : constant Node_Id := Type_High_Bound (Target_Type);
Conv : Node_Id;
Tnn : Entity_Id;
begin
-- Nothing to do if conversion was rewritten
if Nkind (N) /= N_Type_Conversion then
return;
end if;
-- Nothing to do if range checks suppressed, or target has the
-- same range as the base type (or is the base type).
if Range_Checks_Suppressed (Target_Type)
or else (Lo = Type_Low_Bound (Btyp)
and then
Hi = Type_High_Bound (Btyp))
then
return;
end if;
-- Nothing to do if expression is an entity on which checks
-- have been suppressed.
if Is_Entity_Name (Expression (N))
and then Range_Checks_Suppressed (Entity (Expression (N)))
then
return;
end if;
-- Here we rewrite the conversion as described above
Conv := Relocate_Node (N);
Rewrite
(Subtype_Mark (Conv), New_Occurrence_Of (Btyp, Loc));
Set_Etype (Conv, Btyp);
-- Skip overflow check for integer to float conversions,
-- since it is not needed, and in any case gigi generates
-- incorrect code for such overflow checks ???
if not Is_Integer_Type (Etype (Expression (N))) then
Set_Do_Overflow_Check (Conv, True);
end if;
Tnn :=
Make_Defining_Identifier (Loc,
Chars => New_Internal_Name ('T'));
Insert_Actions (N, New_List (
Make_Object_Declaration (Loc,
Defining_Identifier => Tnn,
Object_Definition => New_Occurrence_Of (Btyp, Loc),
Expression => Conv),
Make_Raise_Constraint_Error (Loc,
Condition =>
Make_Or_Else (Loc,
Left_Opnd =>
Make_Op_Lt (Loc,
Left_Opnd => New_Occurrence_Of (Tnn, Loc),
Right_Opnd =>
Make_Attribute_Reference (Loc,
Attribute_Name => Name_First,
Prefix =>
New_Occurrence_Of (Target_Type, Loc))),
Right_Opnd =>
Make_Op_Gt (Loc,
Left_Opnd => New_Occurrence_Of (Tnn, Loc),
Right_Opnd =>
Make_Attribute_Reference (Loc,
Attribute_Name => Name_Last,
Prefix =>
New_Occurrence_Of (Target_Type, Loc)))))));
Rewrite (N, New_Occurrence_Of (Tnn, Loc));
Analyze_And_Resolve (N, Btyp);
end Real_Range_Check;
-- Start of processing for Expand_N_Type_Conversion
begin
-- Nothing at all to do if conversion is to the identical type
-- so remove the conversion completely, it is useless.
if Operand_Type = Target_Type then
Rewrite (N, Relocate_Node (Expression (N)));
return;
end if;
-- Deal with Vax floating-point cases
if Vax_Float (Operand_Type) or else Vax_Float (Target_Type) then
Expand_Vax_Conversion (N);
return;
end if;
-- Nothing to do if this is the second argument of read. This
-- is a "backwards" conversion that will be handled by the
-- specialized code in attribute processing.
if Nkind (Parent (N)) = N_Attribute_Reference
and then Attribute_Name (Parent (N)) = Name_Read
and then Next (First (Expressions (Parent (N)))) = N
then
return;
end if;
-- Here if we may need to expand conversion
-- Special case of converting from non-standard boolean type
if Is_Boolean_Type (Operand_Type)
and then (Nonzero_Is_True (Operand_Type))
then
Adjust_Condition (Operand);
Set_Etype (Operand, Standard_Boolean);
Operand_Type := Standard_Boolean;
end if;
-- Case of converting to an access type
if Is_Access_Type (Target_Type) then
-- Apply an accessibility check if the operand is an
-- access parameter. Note that other checks may still
-- need to be applied below (such as tagged type checks).
if Is_Entity_Name (Operand)
and then Ekind (Entity (Operand)) in Formal_Kind
and then Ekind (Etype (Operand)) = E_Anonymous_Access_Type
then
Apply_Accessibility_Check (Operand, Target_Type);
-- If the level of the operand type is statically deeper
-- then the level of the target type, then force Program_Error.
-- Note that this can only occur for cases where the attribute
-- is within the body of an instantiation (otherwise the
-- conversion will already have been rejected as illegal).
-- Note: warnings are issued by the analyzer for the instance
-- cases.
elsif In_Instance_Body
and then Type_Access_Level (Operand_Type)
> Type_Access_Level (Target_Type)
then
Rewrite (N, Make_Raise_Program_Error (Sloc (N)));
Set_Etype (N, Target_Type);
-- When the operand is a selected access discriminant
-- the check needs to be made against the level of the
-- object denoted by the prefix of the selected name.
-- Force Program_Error for this case as well (this
-- accessibility violation can only happen if within
-- the body of an instantiation).
elsif In_Instance_Body
and then Ekind (Operand_Type) = E_Anonymous_Access_Type
and then Nkind (Operand) = N_Selected_Component
and then Object_Access_Level (Operand) >
Type_Access_Level (Target_Type)
then
Rewrite (N, Make_Raise_Program_Error (Sloc (N)));
Set_Etype (N, Target_Type);
end if;
end if;
-- Case of conversions of tagged types and access to tagged types
-- When needed, that is to say when the expression is class-wide,
-- Add runtime a tag check for (strict) downward conversion by using
-- the membership test, generating:
-- [constraint_error when Operand not in Target_Type'Class]
-- or in the access type case
-- [constraint_error
-- when Operand /= null
-- and then Operand.all not in
-- Designated_Type (Target_Type)'Class]
if (Is_Access_Type (Target_Type)
and then Is_Tagged_Type (Designated_Type (Target_Type)))
or else Is_Tagged_Type (Target_Type)
then
-- Do not do any expansion in the access type case if the
-- parent is a renaming, since this is an error situation
-- which will be caught by Sem_Ch8, and the expansion can
-- intefere with this error check.
if Is_Access_Type (Target_Type)
and then Is_Renamed_Object (N)
then
return;
end if;
-- Oherwise, proceed with processing tagged conversion
declare
Actual_Operand_Type : Entity_Id;
Actual_Target_Type : Entity_Id;
Cond : Node_Id;
begin
if Is_Access_Type (Target_Type) then
Actual_Operand_Type := Designated_Type (Operand_Type);
Actual_Target_Type := Designated_Type (Target_Type);
else
Actual_Operand_Type := Operand_Type;
Actual_Target_Type := Target_Type;
end if;
if Is_Class_Wide_Type (Actual_Operand_Type)
and then Root_Type (Actual_Operand_Type) /= Actual_Target_Type
and then Is_Ancestor
(Root_Type (Actual_Operand_Type),
Actual_Target_Type)
and then not Tag_Checks_Suppressed (Actual_Target_Type)
then
-- The conversion is valid for any descendant of the
-- target type
Actual_Target_Type := Class_Wide_Type (Actual_Target_Type);
if Is_Access_Type (Target_Type) then
Cond :=
Make_And_Then (Loc,
Left_Opnd =>
Make_Op_Ne (Loc,
Left_Opnd => Duplicate_Subexpr (Operand),
Right_Opnd => Make_Null (Loc)),
Right_Opnd =>
Make_Not_In (Loc,
Left_Opnd =>
Make_Explicit_Dereference (Loc,
Prefix => Duplicate_Subexpr (Operand)),
Right_Opnd =>
New_Reference_To (Actual_Target_Type, Loc)));
else
Cond :=
Make_Not_In (Loc,
Left_Opnd => Duplicate_Subexpr (Operand),
Right_Opnd =>
New_Reference_To (Actual_Target_Type, Loc));
end if;
Insert_Action (N,
Make_Raise_Constraint_Error (Loc,
Condition => Cond));
Change_Conversion_To_Unchecked (N);
Analyze_And_Resolve (N, Target_Type);
end if;
end;
-- Case of other access type conversions
elsif Is_Access_Type (Target_Type) then
Apply_Constraint_Check (Operand, Target_Type);
-- Case of conversions from a fixed-point type
-- These conversions require special expansion and processing, found
-- in the Exp_Fixd package. We ignore cases where Conversion_OK is
-- set, since from a semantic point of view, these are simple integer
-- conversions, which do not need further processing.
elsif Is_Fixed_Point_Type (Operand_Type)
and then not Conversion_OK (N)
then
-- We should never see universal fixed at this case, since the
-- expansion of the constituent divide or multiply should have
-- eliminated the explicit mention of universal fixed.
pragma Assert (Operand_Type /= Universal_Fixed);
-- Check for special case of the conversion to universal real
-- that occurs as a result of the use of a round attribute.
-- In this case, the real type for the conversion is taken
-- from the target type of the Round attribute and the
-- result must be marked as rounded.
if Target_Type = Universal_Real
and then Nkind (Parent (N)) = N_Attribute_Reference
and then Attribute_Name (Parent (N)) = Name_Round
then
Set_Rounded_Result (N);
Set_Etype (N, Etype (Parent (N)));
end if;
-- Otherwise do correct fixed-conversion, but skip these if the
-- Conversion_OK flag is set, because from a semantic point of
-- view these are simple integer conversions needing no further
-- processing (the backend will simply treat them as integers)
if not Conversion_OK (N) then
if Is_Fixed_Point_Type (Etype (N)) then
Expand_Convert_Fixed_To_Fixed (N);
Real_Range_Check;
elsif Is_Integer_Type (Etype (N)) then
Expand_Convert_Fixed_To_Integer (N);
else
pragma Assert (Is_Floating_Point_Type (Etype (N)));
Expand_Convert_Fixed_To_Float (N);
Real_Range_Check;
end if;
end if;
-- Case of conversions to a fixed-point type
-- These conversions require special expansion and processing, found
-- in the Exp_Fixd package. Again, ignore cases where Conversion_OK
-- is set, since from a semantic point of view, these are simple
-- integer conversions, which do not need further processing.
elsif Is_Fixed_Point_Type (Target_Type)
and then not Conversion_OK (N)
then
if Is_Integer_Type (Operand_Type) then
Expand_Convert_Integer_To_Fixed (N);
Real_Range_Check;
else
pragma Assert (Is_Floating_Point_Type (Operand_Type));
Expand_Convert_Float_To_Fixed (N);
Real_Range_Check;
end if;
-- Case of float-to-integer conversions
-- We also handle float-to-fixed conversions with Conversion_OK set
-- since semantically the fixed-point target is treated as though it
-- were an integer in such cases.
elsif Is_Floating_Point_Type (Operand_Type)
and then
(Is_Integer_Type (Target_Type)
or else
(Is_Fixed_Point_Type (Target_Type) and then Conversion_OK (N)))
then
-- Special processing required if the conversion is the expression
-- of a Truncation attribute reference. In this case we replace:
-- ityp (ftyp'Truncation (x))
-- by
-- ityp (x)
-- with the Float_Truncate flag set. This is clearly more efficient.
if Nkind (Operand) = N_Attribute_Reference
and then Attribute_Name (Operand) = Name_Truncation
then
Rewrite (Operand,
Relocate_Node (First (Expressions (Operand))));
Set_Float_Truncate (N, True);
end if;
-- One more check here, gcc is still not able to do conversions of
-- this type with proper overflow checking, and so gigi is doing an
-- approximation of what is required by doing floating-point compares
-- with the end-point. But that can lose precision in some cases, and
-- give a wrong result. Converting the operand to Long_Long_Float is
-- helpful, but still does not catch all cases with 64-bit integers
-- on targets with only 64-bit floats ???
if Do_Range_Check (Expression (N)) then
Rewrite (Expression (N),
Make_Type_Conversion (Loc,
Subtype_Mark =>
New_Occurrence_Of (Standard_Long_Long_Float, Loc),
Expression =>
Relocate_Node (Expression (N))));
Set_Etype (Expression (N), Standard_Long_Long_Float);
Enable_Range_Check (Expression (N));
Set_Do_Range_Check (Expression (Expression (N)), False);
end if;
-- Case of array conversions
-- Expansion of array conversions, add required length/range checks
-- but only do this if there is no change of representation. For
-- handling of this case, see Handle_Changed_Representation.
elsif Is_Array_Type (Target_Type) then
if Is_Constrained (Target_Type) then
Apply_Length_Check (Operand, Target_Type);
else
Apply_Range_Check (Operand, Target_Type);
end if;
Handle_Changed_Representation;
-- Case of conversions of discriminated types
-- Add required discriminant checks if target is constrained. Again
-- this change is skipped if we have a change of representation.
elsif Has_Discriminants (Target_Type)
and then Is_Constrained (Target_Type)
then
Apply_Discriminant_Check (Operand, Target_Type);
Handle_Changed_Representation;
-- Case of all other record conversions. The only processing required
-- is to check for a change of representation requiring the special
-- assignment processing.
elsif Is_Record_Type (Target_Type) then
Handle_Changed_Representation;
-- Case of conversions of enumeration types
elsif Is_Enumeration_Type (Target_Type) then
-- Special processing is required if there is a change of
-- representation (from enumeration representation clauses)
if not Same_Representation (Target_Type, Operand_Type) then
-- Convert: x(y) to x'val (ytyp'val (y))
Rewrite (N,
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (Target_Type, Loc),
Attribute_Name => Name_Val,
Expressions => New_List (
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (Operand_Type, Loc),
Attribute_Name => Name_Pos,
Expressions => New_List (Operand)))));
Analyze_And_Resolve (N, Target_Type);
end if;
-- Case of conversions to floating-point
elsif Is_Floating_Point_Type (Target_Type) then
Real_Range_Check;
-- The remaining cases require no front end processing
else
null;
end if;
-- At this stage, either the conversion node has been transformed
-- into some other equivalent expression, or left as a conversion
-- that can be handled by Gigi. The conversions that Gigi can handle
-- are the following:
-- Conversions with no change of representation or type
-- Numeric conversions involving integer values, floating-point
-- values, and fixed-point values. Fixed-point values are allowed
-- only if Conversion_OK is set, i.e. if the fixed-point values
-- are to be treated as integers.
-- No other conversions should be passed to Gigi.
end Expand_N_Type_Conversion;
-----------------------------------
-- Expand_N_Unchecked_Expression --
-----------------------------------
-- Remove the unchecked expression node from the tree. It's job was simply
-- to make sure that its constituent expression was handled with checks
-- off, and now that that is done, we can remove it from the tree, and
-- indeed must, since gigi does not expect to see these nodes.
procedure Expand_N_Unchecked_Expression (N : Node_Id) is
Exp : constant Node_Id := Expression (N);
begin
Set_Assignment_OK (Exp, Assignment_OK (N) or Assignment_OK (Exp));
Rewrite (N, Exp);
end Expand_N_Unchecked_Expression;
----------------------------------------
-- Expand_N_Unchecked_Type_Conversion --
----------------------------------------
-- If this cannot be handled by Gigi and we haven't already made
-- a temporary for it, do it now.
procedure Expand_N_Unchecked_Type_Conversion (N : Node_Id) is
Target_Type : constant Entity_Id := Etype (N);
Operand : constant Node_Id := Expression (N);
Operand_Type : constant Entity_Id := Etype (Operand);
begin
-- If we have a conversion of a compile time known value to a target
-- type and the value is in range of the target type, then we can simply
-- replace the construct by an integer literal of the correct type. We
-- only apply this to integer types being converted. Possibly it may
-- apply in other cases, but it is too much trouble to worry about.
-- Note that we do not do this transformation if the Kill_Range_Check
-- flag is set, since then the value may be outside the expected range.
-- This happens in the Normalize_Scalars case.
if Is_Integer_Type (Target_Type)
and then Is_Integer_Type (Operand_Type)
and then Compile_Time_Known_Value (Operand)
and then not Kill_Range_Check (N)
then
declare
Val : constant Uint := Expr_Value (Operand);
begin
if Compile_Time_Known_Value (Type_Low_Bound (Target_Type))
and then
Compile_Time_Known_Value (Type_High_Bound (Target_Type))
and then
Val >= Expr_Value (Type_Low_Bound (Target_Type))
and then
Val <= Expr_Value (Type_High_Bound (Target_Type))
then
Rewrite (N, Make_Integer_Literal (Sloc (N), Val));
Analyze_And_Resolve (N, Target_Type);
return;
end if;
end;
end if;
-- Nothing to do if conversion is safe
if Safe_Unchecked_Type_Conversion (N) then
return;
end if;
-- Otherwise force evaluation unless Assignment_OK flag is set (this
-- flag indicates ??? -- more comments needed here)
if Assignment_OK (N) then
null;
else
Force_Evaluation (N);
end if;
end Expand_N_Unchecked_Type_Conversion;
----------------------------
-- Expand_Record_Equality --
----------------------------
-- For non-variant records, Equality is expanded when needed into:
-- and then Lhs.Discr1 = Rhs.Discr1
-- and then ...
-- and then Lhs.Discrn = Rhs.Discrn
-- and then Lhs.Cmp1 = Rhs.Cmp1
-- and then ...
-- and then Lhs.Cmpn = Rhs.Cmpn
-- The expression is folded by the back-end for adjacent fields. This
-- function is called for tagged record in only one occasion: for imple-
-- menting predefined primitive equality (see Predefined_Primitives_Bodies)
-- otherwise the primitive "=" is used directly.
function Expand_Record_Equality
(Nod : Node_Id;
Typ : Entity_Id;
Lhs : Node_Id;
Rhs : Node_Id;
Bodies : List_Id)
return Node_Id
is
Loc : constant Source_Ptr := Sloc (Nod);
function Suitable_Element (C : Entity_Id) return Entity_Id;
-- Return the first field to compare beginning with C, skipping the
-- inherited components
function Suitable_Element (C : Entity_Id) return Entity_Id is
begin
if No (C) then
return Empty;
elsif Ekind (C) /= E_Discriminant
and then Ekind (C) /= E_Component
then
return Suitable_Element (Next_Entity (C));
elsif Is_Tagged_Type (Typ)
and then C /= Original_Record_Component (C)
then
return Suitable_Element (Next_Entity (C));
elsif Chars (C) = Name_uController
or else Chars (C) = Name_uTag
then
return Suitable_Element (Next_Entity (C));
else
return C;
end if;
end Suitable_Element;
Result : Node_Id;
C : Entity_Id;
First_Time : Boolean := True;
-- Start of processing for Expand_Record_Equality
begin
-- Special processing for the unchecked union case, which will occur
-- only in the context of tagged types and dynamic dispatching, since
-- other cases are handled statically. We return True, but insert a
-- raise Program_Error statement.
if Is_Unchecked_Union (Typ) then
-- If this is a component of an enclosing record, return the Raise
-- statement directly.
if No (Parent (Lhs)) then
Result := Make_Raise_Program_Error (Loc);
Set_Etype (Result, Standard_Boolean);
return Result;
else
Insert_Action (Lhs,
Make_Raise_Program_Error (Loc));
return New_Occurrence_Of (Standard_True, Loc);
end if;
end if;
-- Generates the following code: (assuming that Typ has one Discr and
-- component C2 is also a record)
-- True
-- and then Lhs.Discr1 = Rhs.Discr1
-- and then Lhs.C1 = Rhs.C1
-- and then Lhs.C2.C1=Rhs.C2.C1 and then ... Lhs.C2.Cn=Rhs.C2.Cn
-- and then ...
-- and then Lhs.Cmpn = Rhs.Cmpn
Result := New_Reference_To (Standard_True, Loc);
C := Suitable_Element (First_Entity (Typ));
while Present (C) loop
declare
New_Lhs : Node_Id;
New_Rhs : Node_Id;
begin
if First_Time then
First_Time := False;
New_Lhs := Lhs;
New_Rhs := Rhs;
else
New_Lhs := New_Copy_Tree (Lhs);
New_Rhs := New_Copy_Tree (Rhs);
end if;
Result :=
Make_And_Then (Loc,
Left_Opnd => Result,
Right_Opnd =>
Expand_Composite_Equality (Nod, Etype (C),
Lhs =>
Make_Selected_Component (Loc,
Prefix => New_Lhs,
Selector_Name => New_Reference_To (C, Loc)),
Rhs =>
Make_Selected_Component (Loc,
Prefix => New_Rhs,
Selector_Name => New_Reference_To (C, Loc)),
Bodies => Bodies));
end;
C := Suitable_Element (Next_Entity (C));
end loop;
return Result;
end Expand_Record_Equality;
-------------------------------------
-- Fixup_Universal_Fixed_Operation --
-------------------------------------
procedure Fixup_Universal_Fixed_Operation (N : Node_Id) is
Conv : constant Node_Id := Parent (N);
begin
-- We must have a type conversion immediately above us
pragma Assert (Nkind (Conv) = N_Type_Conversion);
-- Normally the type conversion gives our target type. The exception
-- occurs in the case of the Round attribute, where the conversion
-- will be to universal real, and our real type comes from the Round
-- attribute (as well as an indication that we must round the result)
if Nkind (Parent (Conv)) = N_Attribute_Reference
and then Attribute_Name (Parent (Conv)) = Name_Round
then
Set_Etype (N, Etype (Parent (Conv)));
Set_Rounded_Result (N);
-- Normal case where type comes from conversion above us
else
Set_Etype (N, Etype (Conv));
end if;
end Fixup_Universal_Fixed_Operation;
-------------------------------
-- Insert_Dereference_Action --
-------------------------------
procedure Insert_Dereference_Action (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Typ : constant Entity_Id := Etype (N);
Pool : constant Entity_Id := Associated_Storage_Pool (Typ);
function Is_Checked_Storage_Pool (P : Entity_Id) return Boolean;
-- return true if type of P is derived from Checked_Pool;
function Is_Checked_Storage_Pool (P : Entity_Id) return Boolean is
T : Entity_Id;
begin
if No (P) then
return False;
end if;
T := Etype (P);
while T /= Etype (T) loop
if Is_RTE (T, RE_Checked_Pool) then
return True;
else
T := Etype (T);
end if;
end loop;
return False;
end Is_Checked_Storage_Pool;
-- Start of processing for Insert_Dereference_Action
begin
if not Comes_From_Source (Parent (N)) then
return;
elsif not Is_Checked_Storage_Pool (Pool) then
return;
end if;
Insert_Action (N,
Make_Procedure_Call_Statement (Loc,
Name => New_Reference_To (
Find_Prim_Op (Etype (Pool), Name_Dereference), Loc),
Parameter_Associations => New_List (
-- Pool
New_Reference_To (Pool, Loc),
-- Storage_Address
Make_Attribute_Reference (Loc,
Prefix =>
Make_Explicit_Dereference (Loc, Duplicate_Subexpr (N)),
Attribute_Name => Name_Address),
-- Size_In_Storage_Elements
Make_Op_Divide (Loc,
Left_Opnd =>
Make_Attribute_Reference (Loc,
Prefix =>
Make_Explicit_Dereference (Loc, Duplicate_Subexpr (N)),
Attribute_Name => Name_Size),
Right_Opnd =>
Make_Integer_Literal (Loc, System_Storage_Unit)),
-- Alignment
Make_Attribute_Reference (Loc,
Prefix =>
Make_Explicit_Dereference (Loc, Duplicate_Subexpr (N)),
Attribute_Name => Name_Alignment))));
end Insert_Dereference_Action;
------------------------------
-- Make_Array_Comparison_Op --
------------------------------
-- This is a hand-coded expansion of the following generic function:
-- generic
-- type elem is (<>);
-- type index is (<>);
-- type a is array (index range <>) of elem;
--
-- function Gnnn (X : a; Y: a) return boolean is
-- J : index := Y'first;
--
-- begin
-- if X'length = 0 then
-- return false;
--
-- elsif Y'length = 0 then
-- return true;
--
-- else
-- for I in X'range loop
-- if X (I) = Y (J) then
-- if J = Y'last then
-- exit;
-- else
-- J := index'succ (J);
-- end if;
--
-- else
-- return X (I) > Y (J);
-- end if;
-- end loop;
--
-- return X'length > Y'length;
-- end if;
-- end Gnnn;
-- Note that since we are essentially doing this expansion by hand, we
-- do not need to generate an actual or formal generic part, just the
-- instantiated function itself.
function Make_Array_Comparison_Op
(Typ : Entity_Id;
Nod : Node_Id)
return Node_Id
is
Loc : constant Source_Ptr := Sloc (Nod);
X : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uX);
Y : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uY);
I : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uI);
J : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uJ);
Index : constant Entity_Id := Base_Type (Etype (First_Index (Typ)));
Loop_Statement : Node_Id;
Loop_Body : Node_Id;
If_Stat : Node_Id;
Inner_If : Node_Id;
Final_Expr : Node_Id;
Func_Body : Node_Id;
Func_Name : Entity_Id;
Formals : List_Id;
Length1 : Node_Id;
Length2 : Node_Id;
begin
-- if J = Y'last then
-- exit;
-- else
-- J := index'succ (J);
-- end if;
Inner_If :=
Make_Implicit_If_Statement (Nod,
Condition =>
Make_Op_Eq (Loc,
Left_Opnd => New_Reference_To (J, Loc),
Right_Opnd =>
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Y, Loc),
Attribute_Name => Name_Last)),
Then_Statements => New_List (
Make_Exit_Statement (Loc)),
Else_Statements =>
New_List (
Make_Assignment_Statement (Loc,
Name => New_Reference_To (J, Loc),
Expression =>
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Index, Loc),
Attribute_Name => Name_Succ,
Expressions => New_List (New_Reference_To (J, Loc))))));
-- if X (I) = Y (J) then
-- if ... end if;
-- else
-- return X (I) > Y (J);
-- end if;
Loop_Body :=
Make_Implicit_If_Statement (Nod,
Condition =>
Make_Op_Eq (Loc,
Left_Opnd =>
Make_Indexed_Component (Loc,
Prefix => New_Reference_To (X, Loc),
Expressions => New_List (New_Reference_To (I, Loc))),
Right_Opnd =>
Make_Indexed_Component (Loc,
Prefix => New_Reference_To (Y, Loc),
Expressions => New_List (New_Reference_To (J, Loc)))),
Then_Statements => New_List (Inner_If),
Else_Statements => New_List (
Make_Return_Statement (Loc,
Expression =>
Make_Op_Gt (Loc,
Left_Opnd =>
Make_Indexed_Component (Loc,
Prefix => New_Reference_To (X, Loc),
Expressions => New_List (New_Reference_To (I, Loc))),
Right_Opnd =>
Make_Indexed_Component (Loc,
Prefix => New_Reference_To (Y, Loc),
Expressions => New_List (
New_Reference_To (J, Loc)))))));
-- for I in X'range loop
-- if ... end if;
-- end loop;
Loop_Statement :=
Make_Implicit_Loop_Statement (Nod,
Identifier => Empty,
Iteration_Scheme =>
Make_Iteration_Scheme (Loc,
Loop_Parameter_Specification =>
Make_Loop_Parameter_Specification (Loc,
Defining_Identifier => I,
Discrete_Subtype_Definition =>
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (X, Loc),
Attribute_Name => Name_Range))),
Statements => New_List (Loop_Body));
-- if X'length = 0 then
-- return false;
-- elsif Y'length = 0 then
-- return true;
-- else
-- for ... loop ... end loop;
-- return X'length > Y'length;
-- end if;
Length1 :=
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (X, Loc),
Attribute_Name => Name_Length);
Length2 :=
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Y, Loc),
Attribute_Name => Name_Length);
Final_Expr :=
Make_Op_Gt (Loc,
Left_Opnd => Length1,
Right_Opnd => Length2);
If_Stat :=
Make_Implicit_If_Statement (Nod,
Condition =>
Make_Op_Eq (Loc,
Left_Opnd =>
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (X, Loc),
Attribute_Name => Name_Length),
Right_Opnd =>
Make_Integer_Literal (Loc, 0)),
Then_Statements =>
New_List (
Make_Return_Statement (Loc,
Expression => New_Reference_To (Standard_False, Loc))),
Elsif_Parts => New_List (
Make_Elsif_Part (Loc,
Condition =>
Make_Op_Eq (Loc,
Left_Opnd =>
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Y, Loc),
Attribute_Name => Name_Length),
Right_Opnd =>
Make_Integer_Literal (Loc, 0)),
Then_Statements =>
New_List (
Make_Return_Statement (Loc,
Expression => New_Reference_To (Standard_True, Loc))))),
Else_Statements => New_List (
Loop_Statement,
Make_Return_Statement (Loc,
Expression => Final_Expr)));
-- (X : a; Y: a)
Formals := New_List (
Make_Parameter_Specification (Loc,
Defining_Identifier => X,
Parameter_Type => New_Reference_To (Typ, Loc)),
Make_Parameter_Specification (Loc,
Defining_Identifier => Y,
Parameter_Type => New_Reference_To (Typ, Loc)));
-- function Gnnn (...) return boolean is
-- J : index := Y'first;
-- begin
-- if ... end if;
-- end Gnnn;
Func_Name := Make_Defining_Identifier (Loc, New_Internal_Name ('G'));
Func_Body :=
Make_Subprogram_Body (Loc,
Specification =>
Make_Function_Specification (Loc,
Defining_Unit_Name => Func_Name,
Parameter_Specifications => Formals,
Subtype_Mark => New_Reference_To (Standard_Boolean, Loc)),
Declarations => New_List (
Make_Object_Declaration (Loc,
Defining_Identifier => J,
Object_Definition => New_Reference_To (Index, Loc),
Expression =>
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Y, Loc),
Attribute_Name => Name_First))),
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
Statements => New_List (If_Stat)));
return Func_Body;
end Make_Array_Comparison_Op;
---------------------------
-- Make_Boolean_Array_Op --
---------------------------
-- For logical operations on boolean arrays, expand in line the
-- following, replacing 'and' with 'or' or 'xor' where needed:
-- function Annn (A : typ; B: typ) return typ is
-- C : typ;
-- begin
-- for J in A'range loop
-- C (J) := A (J) op B (J);
-- end loop;
-- return C;
-- end Annn;
-- Here typ is the boolean array type
function Make_Boolean_Array_Op
(Typ : Entity_Id;
N : Node_Id)
return Node_Id
is
Loc : constant Source_Ptr := Sloc (N);
A : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uA);
B : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uB);
C : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uC);
J : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uJ);
A_J : Node_Id;
B_J : Node_Id;
C_J : Node_Id;
Op : Node_Id;
Formals : List_Id;
Func_Name : Entity_Id;
Func_Body : Node_Id;
Loop_Statement : Node_Id;
begin
A_J :=
Make_Indexed_Component (Loc,
Prefix => New_Reference_To (A, Loc),
Expressions => New_List (New_Reference_To (J, Loc)));
B_J :=
Make_Indexed_Component (Loc,
Prefix => New_Reference_To (B, Loc),
Expressions => New_List (New_Reference_To (J, Loc)));
C_J :=
Make_Indexed_Component (Loc,
Prefix => New_Reference_To (C, Loc),
Expressions => New_List (New_Reference_To (J, Loc)));
if Nkind (N) = N_Op_And then
Op :=
Make_Op_And (Loc,
Left_Opnd => A_J,
Right_Opnd => B_J);
elsif Nkind (N) = N_Op_Or then
Op :=
Make_Op_Or (Loc,
Left_Opnd => A_J,
Right_Opnd => B_J);
else
Op :=
Make_Op_Xor (Loc,
Left_Opnd => A_J,
Right_Opnd => B_J);
end if;
Loop_Statement :=
Make_Implicit_Loop_Statement (N,
Identifier => Empty,
Iteration_Scheme =>
Make_Iteration_Scheme (Loc,
Loop_Parameter_Specification =>
Make_Loop_Parameter_Specification (Loc,
Defining_Identifier => J,
Discrete_Subtype_Definition =>
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (A, Loc),
Attribute_Name => Name_Range))),
Statements => New_List (
Make_Assignment_Statement (Loc,
Name => C_J,
Expression => Op)));
Formals := New_List (
Make_Parameter_Specification (Loc,
Defining_Identifier => A,
Parameter_Type => New_Reference_To (Typ, Loc)),
Make_Parameter_Specification (Loc,
Defining_Identifier => B,
Parameter_Type => New_Reference_To (Typ, Loc)));
Func_Name :=
Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
Set_Is_Inlined (Func_Name);
Func_Body :=
Make_Subprogram_Body (Loc,
Specification =>
Make_Function_Specification (Loc,
Defining_Unit_Name => Func_Name,
Parameter_Specifications => Formals,
Subtype_Mark => New_Reference_To (Typ, Loc)),
Declarations => New_List (
Make_Object_Declaration (Loc,
Defining_Identifier => C,
Object_Definition => New_Reference_To (Typ, Loc))),
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
Statements => New_List (
Loop_Statement,
Make_Return_Statement (Loc,
Expression => New_Reference_To (C, Loc)))));
return Func_Body;
end Make_Boolean_Array_Op;
------------------------
-- Rewrite_Comparison --
------------------------
procedure Rewrite_Comparison (N : Node_Id) is
Typ : constant Entity_Id := Etype (N);
Op1 : constant Node_Id := Left_Opnd (N);
Op2 : constant Node_Id := Right_Opnd (N);
Res : constant Compare_Result := Compile_Time_Compare (Op1, Op2);
-- Res indicates if compare outcome can be determined at compile time
True_Result : Boolean;
False_Result : Boolean;
begin
case N_Op_Compare (Nkind (N)) is
when N_Op_Eq =>
True_Result := Res = EQ;
False_Result := Res = LT or else Res = GT or else Res = NE;
when N_Op_Ge =>
True_Result := Res in Compare_GE;
False_Result := Res = LT;
when N_Op_Gt =>
True_Result := Res = GT;
False_Result := Res in Compare_LE;
when N_Op_Lt =>
True_Result := Res = LT;
False_Result := Res in Compare_GE;
when N_Op_Le =>
True_Result := Res in Compare_LE;
False_Result := Res = GT;
when N_Op_Ne =>
True_Result := Res = NE;
False_Result := Res = LT or else Res = GT or else Res = EQ;
end case;
if True_Result then
Rewrite (N,
Convert_To (Typ, New_Occurrence_Of (Standard_True, Sloc (N))));
Analyze_And_Resolve (N, Typ);
elsif False_Result then
Rewrite (N,
Convert_To (Typ, New_Occurrence_Of (Standard_False, Sloc (N))));
Analyze_And_Resolve (N, Typ);
end if;
end Rewrite_Comparison;
-----------------------
-- Tagged_Membership --
-----------------------
-- There are two different cases to consider depending on whether
-- the right operand is a class-wide type or not. If not we just
-- compare the actual tag of the left expr to the target type tag:
--
-- Left_Expr.Tag = Right_Type'Tag;
--
-- If it is a class-wide type we use the RT function CW_Membership which
-- is usually implemented by looking in the ancestor tables contained in
-- the dispatch table pointed by Left_Expr.Tag for Typ'Tag
function Tagged_Membership (N : Node_Id) return Node_Id is
Left : constant Node_Id := Left_Opnd (N);
Right : constant Node_Id := Right_Opnd (N);
Loc : constant Source_Ptr := Sloc (N);
Left_Type : Entity_Id;
Right_Type : Entity_Id;
Obj_Tag : Node_Id;
begin
Left_Type := Etype (Left);
Right_Type := Etype (Right);
if Is_Class_Wide_Type (Left_Type) then
Left_Type := Root_Type (Left_Type);
end if;
Obj_Tag :=
Make_Selected_Component (Loc,
Prefix => Relocate_Node (Left),
Selector_Name => New_Reference_To (Tag_Component (Left_Type), Loc));
if Is_Class_Wide_Type (Right_Type) then
return
Make_DT_Access_Action (Left_Type,
Action => CW_Membership,
Args => New_List (
Obj_Tag,
New_Reference_To (
Access_Disp_Table (Root_Type (Right_Type)), Loc)));
else
return
Make_Op_Eq (Loc,
Left_Opnd => Obj_Tag,
Right_Opnd =>
New_Reference_To (Access_Disp_Table (Right_Type), Loc));
end if;
end Tagged_Membership;
------------------------------
-- Unary_Op_Validity_Checks --
------------------------------
procedure Unary_Op_Validity_Checks (N : Node_Id) is
begin
if Validity_Checks_On and Validity_Check_Operands then
Ensure_Valid (Right_Opnd (N));
end if;
end Unary_Op_Validity_Checks;
end Exp_Ch4;
|
-- Abstract :
--
-- A generalized LR parser, with no error recovery, no semantic checks.
--
-- This allows wisi-generate (which uses the generated wisi_grammar)
-- to not depend on wisitoken-lr-mckenzie_recover, so editing that
-- does not cause everything to be regenerated/compiled.
--
-- Copyright (C) 2002, 2003, 2009, 2010, 2013 - 2015, 2017 - 2019 Free Software Foundation, Inc.
--
-- This file is part of the WisiToken package.
--
-- The WisiToken package is free software; you can redistribute it
-- and/or modify it under terms of the GNU General Public License as
-- published by the Free Software Foundation; either version 3, or
-- (at your option) any later version. This library is distributed in
-- the hope that it will be useful, but WITHOUT ANY WARRANTY; without
-- even the implied warranty of MERCHAN- TABILITY or FITNESS FOR A
-- PARTICULAR PURPOSE.
--
-- As a special exception under Section 7 of GPL version 3, you are granted
-- additional permissions described in the GCC Runtime Library Exception,
-- version 3.1, as published by the Free Software Foundation.
pragma License (Modified_GPL);
with WisiToken.Lexer;
with WisiToken.Parse.LR.Parser_Lists;
with WisiToken.Syntax_Trees;
package WisiToken.Parse.LR.Parser_No_Recover is
Default_Max_Parallel : constant := 15;
type Parser is new WisiToken.Parse.Base_Parser with record
Table : Parse_Table_Ptr;
Shared_Tree : aliased Syntax_Trees.Base_Tree;
-- Each parser has its own branched syntax tree, all branched from
-- this tree.
--
-- See WisiToken.LR.Parser_Lists Parser_State for more discussion of
-- Shared_Tree.
Parsers : aliased Parser_Lists.List;
Max_Parallel : SAL.Base_Peek_Type;
First_Parser_Label : Integer;
Terminate_Same_State : Boolean;
end record;
overriding procedure Finalize (Object : in out LR.Parser_No_Recover.Parser);
-- Deep free Object.Table.
procedure New_Parser
(Parser : out LR.Parser_No_Recover.Parser;
Trace : not null access WisiToken.Trace'Class;
Lexer : in WisiToken.Lexer.Handle;
Table : in Parse_Table_Ptr;
User_Data : in Syntax_Trees.User_Data_Access;
Max_Parallel : in SAL.Base_Peek_Type := Default_Max_Parallel;
First_Parser_Label : in Integer := 1;
Terminate_Same_State : in Boolean := True);
overriding procedure Parse (Shared_Parser : aliased in out LR.Parser_No_Recover.Parser);
-- Attempt a parse. Calls Parser.Lexer.Reset, runs lexer to end of
-- input setting Shared_Parser.Terminals, then parses tokens.
--
-- If a parse error is encountered, raises Syntax_Error.
-- Parser.Lexer_Errors and Parsers(*).Errors contain information
-- about the errors.
--
-- For other errors, raises Parse_Error with an appropriate error
-- message.
overriding function Tree (Parser : in LR.Parser_No_Recover.Parser) return Syntax_Trees.Tree;
overriding function Any_Errors (Parser : in LR.Parser_No_Recover.Parser) return Boolean;
overriding procedure Put_Errors (Parser : in LR.Parser_No_Recover.Parser);
-- Put user-friendly error messages from the parse to
-- Ada.Text_IO.Current_Error.
overriding procedure Execute_Actions (Parser : in out LR.Parser_No_Recover.Parser);
-- Execute the grammar actions in Parser.
end WisiToken.Parse.LR.Parser_No_Recover;
|
-- Copyright (c) 2021 Devin Hill
-- zlib License -- see LICENSE for details.
package GBA.Interrupts is
type Interrupt_ID is
( VBlank
, HBlank
, VCounter_Match
, Timer_0_Overflow
, Timer_1_Overflow
, Timer_2_Overflow
, Timer_3_Overflow
, Serial_Communication
, DMA_0
, DMA_1
, DMA_2
, DMA_3
, Keypad
, Game_Pak
)
with Size => 16;
for Interrupt_ID use
( VBlank => 0
, HBlank => 1
, VCounter_Match => 2
, Timer_0_Overflow => 3
, Timer_1_Overflow => 4
, Timer_2_Overflow => 5
, Timer_3_Overflow => 6
, Serial_Communication => 7
, DMA_0 => 8
, DMA_1 => 9
, DMA_2 => 10
, DMA_3 => 11
, Keypad => 12
, Game_Pak => 13
);
type Interrupt_Flags is mod 2**14
with Size => 16;
All_Interrupts : constant Interrupt_Flags := Interrupt_Flags'Mod(-1);
function "or" (I1, I2 : Interrupt_ID) return Interrupt_Flags
with Pure_Function, Inline_Always;
function "or" (F : Interrupt_Flags; I : Interrupt_ID) return Interrupt_Flags
with Pure_Function, Inline_Always;
type Interrupt_Handler is
access procedure;
procedure Enable_Receiving_Interrupts (Enabled : Boolean)
with Inline;
procedure Enable_Receiving_Interrupts
with Inline;
procedure Disable_Receiving_Interrupts
with Inline;
procedure Disable_Receiving_Interrupts (Enabled : out Boolean)
with Inline;
procedure Enable_Interrupt (ID : Interrupt_ID)
with Inline;
procedure Enable_Interrupt (Flags : Interrupt_Flags)
with Inline;
procedure Disable_Interrupt (ID : Interrupt_ID)
with Inline;
procedure Disable_Interrupt (Flags : Interrupt_Flags)
with Inline;
procedure Disable_Interrupts_And_Save (Flags : out Interrupt_Flags)
with Inline;
procedure Acknowledge_Interrupt (ID : Interrupt_ID)
with Inline;
procedure Acknowledge_Interrupt (Flags : Interrupt_Flags)
with Inline;
procedure Attach_Interrupt_Handler
(ID : Interrupt_ID; Handler : not null Interrupt_Handler)
with Inline;
procedure Attach_Interrupt_Handler_And_Save
(ID : Interrupt_ID; Handler : not null Interrupt_Handler; Old_Handler : out Interrupt_Handler)
with Inline;
procedure Detach_Interrupt_Handler (ID : Interrupt_ID)
with Inline;
procedure Detach_Interrupt_Handler_And_Save (ID : Interrupt_ID; Old_Handler : out Interrupt_Handler)
with Inline;
private
procedure Default_Interrupt_Dispatcher
with Linker_Section => ".iwram";
pragma Machine_Attribute(Default_Interrupt_Dispatcher, "target", "arm");
end GBA.Interrupts; |
-----------------------------------------------------------------------
-- Ada Labs --
-- --
-- Copyright (C) 2008-2009, AdaCore --
-- --
-- Labs is free software; you can redistribute it and/or modify it --
-- under the terms of the GNU General Public License as published by --
-- the Free Software Foundation; either version 2 of the License, or --
-- (at your option) any later version. --
-- --
-- This program is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. You should have received --
-- a copy of the GNU General Public License along with this program; --
-- if not, write to the Free Software Foundation, Inc., 59 Temple --
-- Place - Suite 330, Boston, MA 02111-1307, USA. --
-----------------------------------------------------------------------
with Ada.Real_Time; use Ada.Real_Time;
with Display; use Display;
with Display.Basic; use Display.Basic;
with Libm_Single; use Libm_Single;
procedure Main is
-- define type Bodies_Enum_T as an enumeration of Sun, Earth, Moon, Satellite
type Bodies_Enum_T is (Sun, Earth, Moon, Satellite);
-- define type Parameters_Enum_T as an enumeration of parameter X, Y, Radius, Speed, Distance, Angle
type Parameters_Enum_T is (X, Y, Radius, Speed, Distance, Angle);
-- define type Bodies_Array_T as an array of float indexed by bodies and parameters
type Bodies_Array_T is array (Bodies_Enum_T, Parameters_Enum_T) of Float;
-- define type Colors_Array_T as an array of color (RGBA_T) indexed by bodies
type Colors_Array_T is array (Bodies_Enum_T) of RGBA_T;
-- declare variable Bodies which is an instance of Bodies_Array_T
Bodies : Bodies_Array_T;
-- declare variable Colors which is an instance of Colors_Array_T
Colors : Colors_Array_T;
-- declare a variable Next of type Time to store the Next step time
Next : Time;
-- declare a constant Period of 40 milliseconds of type Time_Span defining the loop period
Period : constant Time_Span := Milliseconds (40);
-- reference to the application window
Window : Window_ID;
-- reference to the graphical canvas associated with the application window
Canvas : Canvas_ID;
begin
-- Create a window 240x320
Window := Create_Window(Width => 240,
Height => 320,
Name => "Solar System");
-- Retrieve the graphical canvas from the window
Canvas := Get_Canvas (Window);
-- initialize Bodies variable with parameters for each body using an aggregate
-- Sun Distance = 0.0, Angle = 0.0, Speed = 0.0, Radius = 20.0;
-- Earth Distance = 50.0, Angle = 0.0, Speed = 0.02, Radius = 5.0;
-- Moon Distance = 15.0, Angle = 0.0, Speed = 0.04, Radius = 2.0;
-- Satellite Distance = 8.0, Angle = 0.0, Speed = 0.1, Radius = 1.0;
Bodies := (Sun => (Distance => 0.0,
Speed => 0.0,
Radius => 20.0,
X => 0.0,
Y => 0.0,
Angle => 0.0),
Earth => (Distance => 50.0,
Speed => 0.02,
Radius => 5.0,
X => 0.0,
Y => 0.0,
Angle => 0.0),
Moon => (Distance => 15.0,
Speed => 0.04,
Radius => 2.0,
X => 0.0,
Y => 0.0,
Angle => 0.0),
Satellite => (Distance => 8.0,
Speed => 0.1,
Radius => 1.0,
X => 0.0,
Y => 0.0,
Angle => 0.0));
-- initialize Colors variable with Sun is Yellow, Earth is Blue, Moon is White, Satellite is Red
Colors := (Sun => Yellow,
Earth => Blue,
Moon => White,
Satellite => Red);
-- initialize the Next step time begin the current time (Clock) + the period
Next := Clock + Period;
while not Is_Killed loop
-- create a loop to update each body position and angles
-- the position of an object around (0,0) at distance d with an angle a
-- is (d*cos(a), d*sin(a))
-- update angle parameter of each body adding speed to the previous angle
for B in Earth .. Satellite loop
-- This solution illustrates the use of a block statement with
-- local constants to reduce repetition and improve readability
-- in the loop body.
declare
This_Pred : constant Bodies_Enum_T := Bodies_Enum_T'Pred(B);
D : constant Float := Bodies (B, Distance);
A : constant Float := Bodies (B, Angle);
begin
Bodies (B, X) := Bodies (This_Pred, X) + D * Cos (A);
Bodies (B, Y) := Bodies (This_Pred, Y) + D * Sin (A);
Bodies (B, Angle) := A + Bodies (B, Speed);
end;
end loop;
-- create a loop to draw every objects
-- use the Draw_Sphere procedure to do it
for B in Bodies_Enum_T loop
Draw_Sphere(Canvas => Canvas,
Position => (Bodies (B, X), Bodies (B, Y), 0.0),
Radius => Bodies (B, Radius),
Color => Colors(B));
end loop;
-- update the screen using procedure Swap_Buffers
Swap_Buffers(Window);
-- wait until Next
delay until Next;
-- update the Next time adding the period for the next step
Next := Next + Period;
end loop;
end Main;
|
with Ada.Text_IO;
use Ada.Text_IO;
with Items;
use Items;
with Ada.Strings.Unbounded;
use Ada.Strings.Unbounded;
with Gilded_Rose;
use Gilded_Rose;
procedure Program is
Things : Item_Vecs.Vector;
begin
Things.Append(New_Item =>
(Name => To_Unbounded_String("+5 Dexterity Vest"),
Sell_In => 10,
Quality => 20));
Things.Append(New_Item =>
(Name => To_Unbounded_String("Aged Brie"),
Sell_In => 2,
Quality => 0));
Things.Append(New_Item =>
(Name => To_Unbounded_String("Elixir of the Mongoose"),
Sell_In => 5,
Quality => 7));
Things.Append(New_Item =>
(Name => To_Unbounded_String("Sulfuras, Hand of Ragnaros"),
Sell_In => 0,
Quality => 80));
Things.Append(New_Item =>
(Name => To_Unbounded_String("Sulfuras, Hand of Ragnaros"),
Sell_In => -1,
Quality => 80));
Things.Append(New_Item =>
(Name => To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert"),
Sell_In => 15,
Quality => 20));
Things.Append(New_Item =>
(Name => To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert"),
Sell_In => 10,
Quality => 49));
Things.Append(New_Item =>
(Name => To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert"),
Sell_In => 5,
Quality => 49));
-- this conjured item does not work properly yet
Things.Append(New_Item =>
(Name => To_Unbounded_String("Conjured Mana Cake"),
Sell_In => 3,
Quality => 6));
declare
App : Gilded_Rose.Gilded_Rose := (Items => Things);
begin
Put_Line("OMGHAI!");
for I in 0 .. 30 loop
Put_Line("-------- day" & Integer'Image(I) & " --------");
Put_Line("name, sellIn, quality");
for Each of App.Items loop
Put_Line(To_String(Each));
end loop;
Put_Line("");
Update_Quality(App);
end loop;
end;
end;
|
-----------------------------------------------------------------------
-- EL.Contexts.Properties -- EL Resolver using util properties
-- Copyright (C) 2011 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 EL.Objects;
with Util.Beans.Basic;
with Util.Properties;
package EL.Contexts.Properties is
-- ------------------------------
-- Property Resolver
-- ------------------------------
-- The <b>Property_Resolver</b> uses a property manager to resolve names.
type Property_Resolver is new ELResolver with private;
type Property_Resolver_Access is access all Property_Resolver'Class;
-- Set the properties used for resolving values.
procedure Set_Properties (Resolver : in out Property_Resolver;
Properties : in Util.Properties.Manager'Class);
-- Get the value associated with a base object and a given property.
overriding
function Get_Value (Resolver : in Property_Resolver;
Context : in ELContext'Class;
Base : access Util.Beans.Basic.Readonly_Bean'Class;
Name : in Unbounded_String) return EL.Objects.Object;
-- Set the value associated with a base object and a given property.
overriding
procedure Set_Value (Resolver : in out Property_Resolver;
Context : in ELContext'Class;
Base : access Util.Beans.Basic.Bean'Class;
Name : in Unbounded_String;
Value : in EL.Objects.Object);
private
type Property_Resolver is new ELResolver with record
Props : Util.Properties.Manager;
end record;
end EL.Contexts.Properties;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E X P _ P A K D --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-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. 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. --
-- --
------------------------------------------------------------------------------
-- Expand routines for manipulation of packed arrays
with Rtsfind; use Rtsfind;
with Types; use Types;
package Exp_Pakd is
-------------------------------------
-- Implementation of Packed Arrays --
-------------------------------------
-- When a packed array (sub)type is frozen, we create a corresponding
-- type that will be used to hold the bits of the packed value, and store
-- the entity for this type in the Packed_Array_Impl_Type field of the
-- E_Array_Type or E_Array_Subtype entity for the packed array.
-- This packed array type has the name xxxPn, where xxx is the name
-- of the packed type, and n is the component size. The expanded
-- declaration declares a type that is one of the following:
-- For an unconstrained array with component size 1,2,4 or any other
-- odd component size. These are the cases in which we do not need
-- to align the underlying array.
-- type xxxPn is new Packed_Bytes1;
-- For an unconstrained array with component size that is divisible
-- by 2, but not divisible by 4 (other than 2 itself). These are the
-- cases in which we can generate better code if the underlying array
-- is 2-byte aligned (see System.Pack_14 in file s-pack14 for example).
-- type xxxPn is new Packed_Bytes2;
-- For an unconstrained array with component size that is divisible
-- by 4, other than powers of 2 (which either come under the 1,2,4
-- exception above, or are not packed at all). These are cases where
-- we can generate better code if the underlying array is 4-byte
-- aligned (see System.Pack_20 in file s-pack20 for example).
-- type xxxPn is new Packed_Bytes4;
-- For a constrained array with a static index type where the number
-- of bits does not exceed the size of Unsigned:
-- type xxxPn is new Unsigned range 0 .. 2 ** nbits - 1;
-- For a constrained array with a static index type where the number
-- of bits is greater than the size of Unsigned, but does not exceed
-- the size of Long_Long_Unsigned:
-- type xxxPn is new Long_Long_Unsigned range 0 .. 2 ** nbits - 1;
-- For all other constrained arrays, we use one of
-- type xxxPn is new Packed_Bytes1 (0 .. m);
-- type xxxPn is new Packed_Bytes2 (0 .. m);
-- type xxxPn is new Packed_Bytes4 (0 .. m);
-- where m is calculated (from the length of the original packed array)
-- to hold the required number of bits, and the choice of the particular
-- Packed_Bytes{1,2,4} type is made on the basis of alignment needs as
-- described above for the unconstrained case.
-- When the packed array (sub)type is specified to have the reverse scalar
-- storage order, the Packed_Bytes{1,2,4} references above are replaced
-- with Rev_Packed_Bytes{1,2,4}. This is necessary because, although the
-- component type is Packed_Byte and therefore endian neutral, the scalar
-- storage order of the new type must be compatible with that of an outer
-- composite type, if this composite type contains a component whose type
-- is the packed array (sub)type and which does not start or does not end
-- on a storage unit boundary.
-- When a variable of packed array type is allocated, gigi will allocate
-- the amount of space indicated by the corresponding packed array type.
-- However, we do NOT attempt to rewrite the types of any references or
-- to retype the variable itself, since this would cause all kinds of
-- semantic problems in the front end (remember that expansion proceeds
-- at the same time as analysis).
-- For an indexed reference to a packed array, we simply convert the
-- reference to the appropriate equivalent reference to the object
-- of the packed array type (using unchecked conversion).
-- In some cases (for internally generated types, and for the subtypes
-- for record fields that depend on a discriminant), the corresponding
-- packed type cannot be easily generated in advance. In these cases,
-- we generate the required subtype on the fly at the reference point.
-- For the modular case, any unused bits are initialized to zero, and
-- all operations maintain these bits as zero (where necessary all
-- unchecked conversions from corresponding array values require
-- these bits to be clear, which is done automatically by gigi).
-- For the array cases, there can be unused bits in the last byte, and
-- these are neither initialized, nor treated specially in operations
-- (i.e. it is allowable for these bits to be clobbered, e.g. by not).
---------------------------
-- Endian Considerations --
---------------------------
-- The standard does not specify the way in which bits are numbered in
-- a packed array. There are two reasonable rules for deciding this:
-- Store the first bit at right end (low order) word. This means
-- that the scaled subscript can be used directly as a left shift
-- count (if we put bit 0 at the left end, then we need an extra
-- subtract to compute the shift count).
-- Layout the bits so that if the packed boolean array is overlaid on
-- a record, using unchecked conversion, then bit 0 of the array is
-- the same as the bit numbered bit 0 in a record representation
-- clause applying to the record. For example:
-- type Rec is record
-- C : Bits4;
-- D : Bits7;
-- E : Bits5;
-- end record;
-- for Rec use record
-- C at 0 range 0 .. 3;
-- D at 0 range 4 .. 10;
-- E at 0 range 11 .. 15;
-- end record;
-- type P16 is array (0 .. 15) of Boolean;
-- pragma Pack (P16);
-- Now if we use unchecked conversion to convert a value of the record
-- type to the packed array type, according to this second criterion,
-- we would expect field D to occupy bits 4..10 of the Boolean array.
-- Although not required, this correspondence seems a highly desirable
-- property, and is one that GNAT decides to guarantee. For a little
-- endian machine, we can also meet the first requirement, but for a
-- big endian machine, it will be necessary to store the first bit of
-- a Boolean array in the left end (most significant) bit of the word.
-- This may cost an extra instruction on some machines, but we consider
-- that a worthwhile price to pay for the consistency.
-- One more important point arises in the case where we have a constrained
-- subtype of an unconstrained array. Take the case of 20 bits. For the
-- unconstrained representation, we would use an array of bytes:
-- Little-endian case
-- 8-7-6-5-4-3-2-1 16-15-14-13-12-11-10-9 x-x-x-x-20-19-18-17
-- Big-endian case
-- 1-2-3-4-5-6-7-8 9-10-11-12-13-14-15-16 17-18-19-20-x-x-x-x
-- For the constrained case, we use a 20-bit modular value, but in
-- general this value may well be stored in 32 bits. Let's look at
-- what it looks like:
-- Little-endian case
-- x-x-x-x-x-x-x-x-x-x-x-x-20-19-18-17-...-10-9-8-7-6-5-4-3-2-1
-- which stored in memory looks like
-- 8-7-...-2-1 16-15-...-10-9 x-x-x-x-20-19-18-17 x-x-x-x-x-x-x
-- An important rule is that the constrained and unconstrained cases
-- must have the same bit representation in memory, since we will often
-- convert from one to the other (e.g. when calling a procedure whose
-- formal is unconstrained). As we see, that criterion is met for the
-- little-endian case above. Now let's look at the big-endian case:
-- Big-endian case
-- x-x-x-x-x-x-x-x-x-x-x-x-1-2-3-4-5-6-7-8-9-10-...-17-18-19-20
-- which stored in memory looks like
-- x-x-x-x-x-x-x-x x-x-x-x-1-2-3-4 5-6-...11-12 13-14-...-19-20
-- That won't do, the representation value in memory is NOT the same in
-- the constrained and unconstrained case. The solution is to store the
-- modular value left-justified:
-- 1-2-3-4-5-6-7-8-9-10-...-17-18-19-20-x-x-x-x-x-x-x-x-x-x-x
-- which stored in memory looks like
-- 1-2-...-7-8 9-10-...15-16 17-18-19-20-x-x-x-x x-x-x-x-x-x-x-x
-- and now, we do indeed have the same representation for the memory
-- version in the constrained and unconstrained cases.
----------------------------------------------
-- Entity Tables for Packed Access Routines --
----------------------------------------------
-- For the cases of component size = 3,5-7,9-15,17-31,33-63 we call library
-- routines. These tables provide the entity for the proper routine. They
-- are exposed in the spec to allow checking for the presence of the needed
-- routine when an array is subject to pragma Pack.
type E_Array is array (Int range 01 .. 63) of RE_Id;
-- Array of Bits_nn entities. Note that we do not use library routines
-- for the 8-bit and 16-bit cases, but we still fill in the table, using
-- entries from System.Unsigned, because we also use this table for
-- certain special unchecked conversions in the big-endian case.
Bits_Id : constant E_Array :=
(01 => RE_Bits_1,
02 => RE_Bits_2,
03 => RE_Bits_03,
04 => RE_Bits_4,
05 => RE_Bits_05,
06 => RE_Bits_06,
07 => RE_Bits_07,
08 => RE_Unsigned_8,
09 => RE_Bits_09,
10 => RE_Bits_10,
11 => RE_Bits_11,
12 => RE_Bits_12,
13 => RE_Bits_13,
14 => RE_Bits_14,
15 => RE_Bits_15,
16 => RE_Unsigned_16,
17 => RE_Bits_17,
18 => RE_Bits_18,
19 => RE_Bits_19,
20 => RE_Bits_20,
21 => RE_Bits_21,
22 => RE_Bits_22,
23 => RE_Bits_23,
24 => RE_Bits_24,
25 => RE_Bits_25,
26 => RE_Bits_26,
27 => RE_Bits_27,
28 => RE_Bits_28,
29 => RE_Bits_29,
30 => RE_Bits_30,
31 => RE_Bits_31,
32 => RE_Unsigned_32,
33 => RE_Bits_33,
34 => RE_Bits_34,
35 => RE_Bits_35,
36 => RE_Bits_36,
37 => RE_Bits_37,
38 => RE_Bits_38,
39 => RE_Bits_39,
40 => RE_Bits_40,
41 => RE_Bits_41,
42 => RE_Bits_42,
43 => RE_Bits_43,
44 => RE_Bits_44,
45 => RE_Bits_45,
46 => RE_Bits_46,
47 => RE_Bits_47,
48 => RE_Bits_48,
49 => RE_Bits_49,
50 => RE_Bits_50,
51 => RE_Bits_51,
52 => RE_Bits_52,
53 => RE_Bits_53,
54 => RE_Bits_54,
55 => RE_Bits_55,
56 => RE_Bits_56,
57 => RE_Bits_57,
58 => RE_Bits_58,
59 => RE_Bits_59,
60 => RE_Bits_60,
61 => RE_Bits_61,
62 => RE_Bits_62,
63 => RE_Bits_63);
-- Array of Get routine entities. These are used to obtain an element from
-- a packed array. The N'th entry is used to obtain elements from a packed
-- array whose component size is N. RE_Null is used as a null entry, for
-- the cases where a library routine is not used.
Get_Id : constant E_Array :=
(01 => RE_Null,
02 => RE_Null,
03 => RE_Get_03,
04 => RE_Null,
05 => RE_Get_05,
06 => RE_Get_06,
07 => RE_Get_07,
08 => RE_Null,
09 => RE_Get_09,
10 => RE_Get_10,
11 => RE_Get_11,
12 => RE_Get_12,
13 => RE_Get_13,
14 => RE_Get_14,
15 => RE_Get_15,
16 => RE_Null,
17 => RE_Get_17,
18 => RE_Get_18,
19 => RE_Get_19,
20 => RE_Get_20,
21 => RE_Get_21,
22 => RE_Get_22,
23 => RE_Get_23,
24 => RE_Get_24,
25 => RE_Get_25,
26 => RE_Get_26,
27 => RE_Get_27,
28 => RE_Get_28,
29 => RE_Get_29,
30 => RE_Get_30,
31 => RE_Get_31,
32 => RE_Null,
33 => RE_Get_33,
34 => RE_Get_34,
35 => RE_Get_35,
36 => RE_Get_36,
37 => RE_Get_37,
38 => RE_Get_38,
39 => RE_Get_39,
40 => RE_Get_40,
41 => RE_Get_41,
42 => RE_Get_42,
43 => RE_Get_43,
44 => RE_Get_44,
45 => RE_Get_45,
46 => RE_Get_46,
47 => RE_Get_47,
48 => RE_Get_48,
49 => RE_Get_49,
50 => RE_Get_50,
51 => RE_Get_51,
52 => RE_Get_52,
53 => RE_Get_53,
54 => RE_Get_54,
55 => RE_Get_55,
56 => RE_Get_56,
57 => RE_Get_57,
58 => RE_Get_58,
59 => RE_Get_59,
60 => RE_Get_60,
61 => RE_Get_61,
62 => RE_Get_62,
63 => RE_Get_63);
-- Array of Get routine entities to be used in the case where the packed
-- array is itself a component of a packed structure, and therefore may not
-- be fully aligned. This only affects the even sizes, since for the odd
-- sizes, we do not get any fixed alignment in any case.
GetU_Id : constant E_Array :=
(01 => RE_Null,
02 => RE_Null,
03 => RE_Get_03,
04 => RE_Null,
05 => RE_Get_05,
06 => RE_GetU_06,
07 => RE_Get_07,
08 => RE_Null,
09 => RE_Get_09,
10 => RE_GetU_10,
11 => RE_Get_11,
12 => RE_GetU_12,
13 => RE_Get_13,
14 => RE_GetU_14,
15 => RE_Get_15,
16 => RE_Null,
17 => RE_Get_17,
18 => RE_GetU_18,
19 => RE_Get_19,
20 => RE_GetU_20,
21 => RE_Get_21,
22 => RE_GetU_22,
23 => RE_Get_23,
24 => RE_GetU_24,
25 => RE_Get_25,
26 => RE_GetU_26,
27 => RE_Get_27,
28 => RE_GetU_28,
29 => RE_Get_29,
30 => RE_GetU_30,
31 => RE_Get_31,
32 => RE_Null,
33 => RE_Get_33,
34 => RE_GetU_34,
35 => RE_Get_35,
36 => RE_GetU_36,
37 => RE_Get_37,
38 => RE_GetU_38,
39 => RE_Get_39,
40 => RE_GetU_40,
41 => RE_Get_41,
42 => RE_GetU_42,
43 => RE_Get_43,
44 => RE_GetU_44,
45 => RE_Get_45,
46 => RE_GetU_46,
47 => RE_Get_47,
48 => RE_GetU_48,
49 => RE_Get_49,
50 => RE_GetU_50,
51 => RE_Get_51,
52 => RE_GetU_52,
53 => RE_Get_53,
54 => RE_GetU_54,
55 => RE_Get_55,
56 => RE_GetU_56,
57 => RE_Get_57,
58 => RE_GetU_58,
59 => RE_Get_59,
60 => RE_GetU_60,
61 => RE_Get_61,
62 => RE_GetU_62,
63 => RE_Get_63);
-- Array of Set routine entities. These are used to assign an element of a
-- packed array. The N'th entry is used to assign elements for a packed
-- array whose component size is N. RE_Null is used as a null entry, for
-- the cases where a library routine is not used.
Set_Id : constant E_Array :=
(01 => RE_Null,
02 => RE_Null,
03 => RE_Set_03,
04 => RE_Null,
05 => RE_Set_05,
06 => RE_Set_06,
07 => RE_Set_07,
08 => RE_Null,
09 => RE_Set_09,
10 => RE_Set_10,
11 => RE_Set_11,
12 => RE_Set_12,
13 => RE_Set_13,
14 => RE_Set_14,
15 => RE_Set_15,
16 => RE_Null,
17 => RE_Set_17,
18 => RE_Set_18,
19 => RE_Set_19,
20 => RE_Set_20,
21 => RE_Set_21,
22 => RE_Set_22,
23 => RE_Set_23,
24 => RE_Set_24,
25 => RE_Set_25,
26 => RE_Set_26,
27 => RE_Set_27,
28 => RE_Set_28,
29 => RE_Set_29,
30 => RE_Set_30,
31 => RE_Set_31,
32 => RE_Null,
33 => RE_Set_33,
34 => RE_Set_34,
35 => RE_Set_35,
36 => RE_Set_36,
37 => RE_Set_37,
38 => RE_Set_38,
39 => RE_Set_39,
40 => RE_Set_40,
41 => RE_Set_41,
42 => RE_Set_42,
43 => RE_Set_43,
44 => RE_Set_44,
45 => RE_Set_45,
46 => RE_Set_46,
47 => RE_Set_47,
48 => RE_Set_48,
49 => RE_Set_49,
50 => RE_Set_50,
51 => RE_Set_51,
52 => RE_Set_52,
53 => RE_Set_53,
54 => RE_Set_54,
55 => RE_Set_55,
56 => RE_Set_56,
57 => RE_Set_57,
58 => RE_Set_58,
59 => RE_Set_59,
60 => RE_Set_60,
61 => RE_Set_61,
62 => RE_Set_62,
63 => RE_Set_63);
-- Array of Set routine entities to be used in the case where the packed
-- array is itself a component of a packed structure, and therefore may not
-- be fully aligned. This only affects the even sizes, since for the odd
-- sizes, we do not get any fixed alignment in any case.
SetU_Id : constant E_Array :=
(01 => RE_Null,
02 => RE_Null,
03 => RE_Set_03,
04 => RE_Null,
05 => RE_Set_05,
06 => RE_SetU_06,
07 => RE_Set_07,
08 => RE_Null,
09 => RE_Set_09,
10 => RE_SetU_10,
11 => RE_Set_11,
12 => RE_SetU_12,
13 => RE_Set_13,
14 => RE_SetU_14,
15 => RE_Set_15,
16 => RE_Null,
17 => RE_Set_17,
18 => RE_SetU_18,
19 => RE_Set_19,
20 => RE_SetU_20,
21 => RE_Set_21,
22 => RE_SetU_22,
23 => RE_Set_23,
24 => RE_SetU_24,
25 => RE_Set_25,
26 => RE_SetU_26,
27 => RE_Set_27,
28 => RE_SetU_28,
29 => RE_Set_29,
30 => RE_SetU_30,
31 => RE_Set_31,
32 => RE_Null,
33 => RE_Set_33,
34 => RE_SetU_34,
35 => RE_Set_35,
36 => RE_SetU_36,
37 => RE_Set_37,
38 => RE_SetU_38,
39 => RE_Set_39,
40 => RE_SetU_40,
41 => RE_Set_41,
42 => RE_SetU_42,
43 => RE_Set_43,
44 => RE_SetU_44,
45 => RE_Set_45,
46 => RE_SetU_46,
47 => RE_Set_47,
48 => RE_SetU_48,
49 => RE_Set_49,
50 => RE_SetU_50,
51 => RE_Set_51,
52 => RE_SetU_52,
53 => RE_Set_53,
54 => RE_SetU_54,
55 => RE_Set_55,
56 => RE_SetU_56,
57 => RE_Set_57,
58 => RE_SetU_58,
59 => RE_Set_59,
60 => RE_SetU_60,
61 => RE_Set_61,
62 => RE_SetU_62,
63 => RE_Set_63);
-----------------
-- Subprograms --
-----------------
procedure Create_Packed_Array_Impl_Type (Typ : Entity_Id);
-- Typ is a array type or subtype to which pragma Pack applies. If the
-- Packed_Array_Impl_Type field of Typ is already set, then the call has
-- no effect, otherwise a suitable type or subtype is created and stored in
-- the Packed_Array_Impl_Type field of Typ. This created type is an Itype
-- so that Gigi will simply elaborate and freeze the type on first use
-- (which is typically the definition of the corresponding array type).
--
-- Note: although this routine is included in the expander package for
-- packed types, it is actually called unconditionally from Freeze,
-- whether or not expansion (and code generation) is enabled. We do this
-- since we want gigi to be able to properly compute type characteristics
-- (for the Data Decomposition Annex of ASIS, and possible other future
-- uses) even if code generation is not active. Strictly this means that
-- this procedure is not part of the expander, but it seems appropriate
-- to keep it together with the other expansion routines that have to do
-- with packed array types.
procedure Expand_Packed_Boolean_Operator (N : Node_Id);
-- N is an N_Op_And, N_Op_Or or N_Op_Xor node whose operand type is a
-- packed boolean array. This routine expands the appropriate operations
-- to carry out the logical operation on the packed arrays. It handles
-- both the modular and array representation cases.
procedure Expand_Packed_Element_Reference (N : Node_Id);
-- N is an N_Indexed_Component node whose prefix is a packed array. In
-- the bit packed case, this routine can only be used for the expression
-- evaluation case, not the assignment case, since the result is not a
-- variable. See Expand_Bit_Packed_Element_Set for how the assignment case
-- is handled in the bit packed case. For the enumeration case, the result
-- of this call is always a variable, so the call can be used for both the
-- expression evaluation and assignment cases.
procedure Expand_Bit_Packed_Element_Set (N : Node_Id);
-- N is an N_Assignment_Statement node whose name is an indexed
-- component of a bit-packed array. This procedure rewrites the entire
-- assignment statement with appropriate code to set the referenced
-- bits of the packed array type object. Note that this procedure is
-- used only for the bit-packed case, not for the enumeration case.
procedure Expand_Packed_Eq (N : Node_Id);
-- N is an N_Op_Eq node where the operands are packed arrays whose
-- representation is an array-of-bytes type (the case where a modular
-- type is used for the representation does not require any special
-- handling, because in the modular case, unused bits are zeroes.
procedure Expand_Packed_Not (N : Node_Id);
-- N is an N_Op_Not node where the operand is packed array of Boolean
-- in standard representation (i.e. component size is one bit). This
-- procedure expands the corresponding not operation. Note that the
-- non-standard representation case is handled by using a loop through
-- elements generated by the normal non-packed circuitry.
function Involves_Packed_Array_Reference (N : Node_Id) return Boolean;
-- N is the node for a name. This function returns true if the name
-- involves a packed array reference. A node involves a packed array
-- reference if it is itself an indexed component referring to a bit-
-- packed array, or it is a selected component whose prefix involves
-- a packed array reference.
procedure Expand_Packed_Address_Reference (N : Node_Id);
-- The node N is an attribute reference for the 'Address reference, where
-- the prefix involves a packed array reference. This routine expands the
-- necessary code for performing the address reference in this case.
procedure Expand_Packed_Bit_Reference (N : Node_Id);
-- The node N is an attribute reference for the 'Bit reference, where the
-- prefix involves a packed array reference. This routine expands the
-- necessary code for performing the bit reference in this case.
end Exp_Pakd;
|
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . C O N T A I N E R S . I N D E F I N I T E _ H O L D E R S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2013-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. --
-- --
-- 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/>. --
------------------------------------------------------------------------------
-- Note: special attention must be paid to the case of simultaneous access
-- to internal shared objects and elements by different tasks. The Reference
-- counter of internal shared object is the only component protected using
-- atomic operations; other components and elements can be modified only when
-- reference counter is equal to one (so there are no other references to this
-- internal shared object and element).
with Ada.Unchecked_Deallocation;
package body Ada.Containers.Indefinite_Holders is
procedure Free is
new Ada.Unchecked_Deallocation (Element_Type, Element_Access);
procedure Detach (Container : Holder);
-- Detach data from shared copy if necessary. This is necessary to prepare
-- container to be modified.
---------
-- "=" --
---------
function "=" (Left, Right : Holder) return Boolean is
begin
if Left.Reference = Right.Reference then
-- Covers both null and not null but the same shared object cases
return True;
elsif Left.Reference /= null and Right.Reference /= null then
return Left.Reference.Element.all = Right.Reference.Element.all;
else
return False;
end if;
end "=";
------------
-- Adjust --
------------
overriding procedure Adjust (Container : in out Holder) is
begin
if Container.Reference /= null then
if Container.Busy = 0 then
-- Container is not locked, reuse existing internal shared object
Reference (Container.Reference);
else
-- Otherwise, create copy of both internal shared object and
-- element.
Container.Reference :=
new Shared_Holder'
(Counter => <>,
Element =>
new Element_Type'(Container.Reference.Element.all));
end if;
end if;
Container.Busy := 0;
end Adjust;
overriding procedure Adjust (Control : in out Reference_Control_Type) is
begin
if Control.Container /= null then
Reference (Control.Container.Reference);
Control.Container.Busy := Control.Container.Busy + 1;
end if;
end Adjust;
------------
-- Assign --
------------
procedure Assign (Target : in out Holder; Source : Holder) is
begin
if Target.Busy /= 0 then
raise Program_Error with "attempt to tamper with elements";
end if;
if Target.Reference /= Source.Reference then
if Target.Reference /= null then
Unreference (Target.Reference);
end if;
Target.Reference := Source.Reference;
if Source.Reference /= null then
Reference (Target.Reference);
end if;
end if;
end Assign;
-----------
-- Clear --
-----------
procedure Clear (Container : in out Holder) is
begin
if Container.Busy /= 0 then
raise Program_Error with "attempt to tamper with elements";
end if;
if Container.Reference /= null then
Unreference (Container.Reference);
Container.Reference := null;
end if;
end Clear;
------------------------
-- Constant_Reference --
------------------------
function Constant_Reference
(Container : aliased Holder) return Constant_Reference_Type is
begin
if Container.Reference = null then
raise Constraint_Error with "container is empty";
end if;
Detach (Container);
declare
Ref : constant Constant_Reference_Type :=
(Element => Container.Reference.Element.all'Access,
Control => (Controlled with Container'Unrestricted_Access));
begin
Reference (Ref.Control.Container.Reference);
Ref.Control.Container.Busy := Ref.Control.Container.Busy + 1;
return Ref;
end;
end Constant_Reference;
----------
-- Copy --
----------
function Copy (Source : Holder) return Holder is
begin
if Source.Reference = null then
return (Controlled with null, 0);
elsif Source.Busy = 0 then
-- Container is not locked, reuse internal shared object
Reference (Source.Reference);
return (Controlled with Source.Reference, 0);
else
-- Otherwise, create copy of both internal shared object and element
return
(Controlled with
new Shared_Holder'
(Counter => <>,
Element => new Element_Type'(Source.Reference.Element.all)),
0);
end if;
end Copy;
------------
-- Detach --
------------
procedure Detach (Container : Holder) is
begin
if Container.Busy = 0
and then not System.Atomic_Counters.Is_One
(Container.Reference.Counter)
then
-- Container is not locked and internal shared object is used by
-- other container, create copy of both internal shared object and
-- element.
declare
Old : constant Shared_Holder_Access := Container.Reference;
begin
Container'Unrestricted_Access.Reference :=
new Shared_Holder'
(Counter => <>,
Element =>
new Element_Type'(Container.Reference.Element.all));
Unreference (Old);
end;
end if;
end Detach;
-------------
-- Element --
-------------
function Element (Container : Holder) return Element_Type is
begin
if Container.Reference = null then
raise Constraint_Error with "container is empty";
else
return Container.Reference.Element.all;
end if;
end Element;
--------------
-- Finalize --
--------------
overriding procedure Finalize (Container : in out Holder) is
begin
if Container.Busy /= 0 then
raise Program_Error with "attempt to tamper with elements";
end if;
if Container.Reference /= null then
Unreference (Container.Reference);
Container.Reference := null;
end if;
end Finalize;
overriding procedure Finalize (Control : in out Reference_Control_Type) is
begin
if Control.Container /= null then
Unreference (Control.Container.Reference);
Control.Container.Busy := Control.Container.Busy - 1;
Control.Container := null;
end if;
end Finalize;
--------------
-- Is_Empty --
--------------
function Is_Empty (Container : Holder) return Boolean is
begin
return Container.Reference = null;
end Is_Empty;
----------
-- Move --
----------
procedure Move (Target : in out Holder; Source : in out Holder) is
begin
if Target.Busy /= 0 then
raise Program_Error with "attempt to tamper with elements";
end if;
if Source.Busy /= 0 then
raise Program_Error with "attempt to tamper with elements";
end if;
if Target.Reference /= Source.Reference then
if Target.Reference /= null then
Unreference (Target.Reference);
end if;
Target.Reference := Source.Reference;
Source.Reference := null;
end if;
end Move;
-------------------
-- Query_Element --
-------------------
procedure Query_Element
(Container : Holder;
Process : not null access procedure (Element : Element_Type))
is
B : Natural renames Container'Unrestricted_Access.Busy;
begin
if Container.Reference = null then
raise Constraint_Error with "container is empty";
end if;
Detach (Container);
B := B + 1;
begin
Process (Container.Reference.Element.all);
exception
when others =>
B := B - 1;
raise;
end;
B := B - 1;
end Query_Element;
----------
-- Read --
----------
procedure Read
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Container : out Holder)
is
begin
Clear (Container);
if not Boolean'Input (Stream) then
Container.Reference :=
new Shared_Holder'
(Counter => <>,
Element => new Element_Type'(Element_Type'Input (Stream)));
end if;
end Read;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Constant_Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Read;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Read;
---------------
-- Reference --
---------------
procedure Reference (Item : not null Shared_Holder_Access) is
begin
System.Atomic_Counters.Increment (Item.Counter);
end Reference;
function Reference
(Container : aliased in out Holder) return Reference_Type
is
begin
if Container.Reference = null then
raise Constraint_Error with "container is empty";
end if;
Detach (Container);
declare
Ref : constant Reference_Type :=
(Element => Container.Reference.Element.all'Access,
Control => (Controlled with Container'Unrestricted_Access));
begin
Reference (Ref.Control.Container.Reference);
Ref.Control.Container.Busy := Ref.Control.Container.Busy + 1;
return Ref;
end;
end Reference;
---------------------
-- Replace_Element --
---------------------
procedure Replace_Element
(Container : in out Holder;
New_Item : Element_Type)
is
-- Element allocator may need an accessibility check in case actual type
-- is class-wide or has access discriminants (RM 4.8(10.1) and
-- AI12-0035).
pragma Unsuppress (Accessibility_Check);
begin
if Container.Busy /= 0 then
raise Program_Error with "attempt to tamper with elements";
end if;
if Container.Reference = null then
-- Holder is empty, allocate new Shared_Holder.
Container.Reference :=
new Shared_Holder'
(Counter => <>,
Element => new Element_Type'(New_Item));
elsif System.Atomic_Counters.Is_One (Container.Reference.Counter) then
-- Shared_Holder can be reused.
Free (Container.Reference.Element);
Container.Reference.Element := new Element_Type'(New_Item);
else
Unreference (Container.Reference);
Container.Reference :=
new Shared_Holder'
(Counter => <>,
Element => new Element_Type'(New_Item));
end if;
end Replace_Element;
---------------
-- To_Holder --
---------------
function To_Holder (New_Item : Element_Type) return Holder is
-- The element allocator may need an accessibility check in the case the
-- actual type is class-wide or has access discriminants (RM 4.8(10.1)
-- and AI12-0035).
pragma Unsuppress (Accessibility_Check);
begin
return
(Controlled with
new Shared_Holder'
(Counter => <>,
Element => new Element_Type'(New_Item)), 0);
end To_Holder;
-----------------
-- Unreference --
-----------------
procedure Unreference (Item : not null Shared_Holder_Access) is
procedure Free is
new Ada.Unchecked_Deallocation (Shared_Holder, Shared_Holder_Access);
Aux : Shared_Holder_Access := Item;
begin
if System.Atomic_Counters.Decrement (Aux.Counter) then
Free (Aux.Element);
Free (Aux);
end if;
end Unreference;
--------------------
-- Update_Element --
--------------------
procedure Update_Element
(Container : in out Holder;
Process : not null access procedure (Element : in out Element_Type))
is
B : Natural renames Container.Busy;
begin
if Container.Reference = null then
raise Constraint_Error with "container is empty";
end if;
Detach (Container);
B := B + 1;
begin
Process (Container.Reference.Element.all);
exception
when others =>
B := B - 1;
raise;
end;
B := B - 1;
end Update_Element;
-----------
-- Write --
-----------
procedure Write
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Container : Holder)
is
begin
Boolean'Output (Stream, Container.Reference = null);
if Container.Reference /= null then
Element_Type'Output (Stream, Container.Reference.Element.all);
end if;
end Write;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Write;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Constant_Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Write;
end Ada.Containers.Indefinite_Holders;
|
with System; use System;
with Ada.Unchecked_Conversion;
with STM32_SVD.DMA; use STM32_SVD.DMA;
package body STM32GD.USART.IRQ is
protected body IRQ_Handler is
entry Wait when Data_Available is
begin
Data_Available := False;
end Wait;
procedure Handler is
begin
USART.ICR.TCCF := 1;
USART.ICR.IDLECF := 1;
USART.ICR.EOBCF := 1;
Data_Available := True;
end Handler;
end IRQ_Handler;
procedure Init is
begin
null;
end Init;
end STM32GD.USART.IRQ;
|
package Microbit_Bsp is
end Microbit_Bsp;
|
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2021, 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 Ada.Unchecked_Conversion;
with Interfaces;
package body LPS25H.SPI is
use HAL;
-- SPI direction and multiplicity masks: 'or' these into the
-- register to control the characteristics of the required
-- transfer with the LPS25H.
Read_Request : constant := 2#1000_0000#;
Transfer_Multiples : constant := 2#0100_0000#;
-- Utility specs --
generic
Register : HAL.UInt8;
type Register_Type is private;
procedure Write_Register (This : LPS25H_Barometric_Sensor_SPI;
Value : Register_Type;
Status : out Boolean);
procedure Write
(This : LPS25H_Barometric_Sensor_SPI;
Index : HAL.UInt8;
Data : HAL.UInt8;
Status : out Boolean);
procedure Read
(This : LPS25H_Barometric_Sensor_SPI;
Index : HAL.UInt8;
Data : out HAL.UInt8_Array;
Status : out Boolean);
procedure Read
(This : LPS25H_Barometric_Sensor_SPI;
Index : HAL.UInt8;
Data : out HAL.UInt8;
Status : out Boolean);
--------------
-- Get_Data --
--------------
overriding
procedure Get_Data
(This : in out LPS25H_Barometric_Sensor_SPI;
Press : out Pressure;
Temp : out Temperature;
Asl : out Altitude;
Status : out Boolean)
is
Buf : HAL.UInt8_Array (0 .. 2) := (others => 0);
begin
-- Pressure
declare
type Integer_24 is range -(2 ** 23) .. 2 ** 23 - 1
with Size => 24;
subtype Buffer_3 is HAL.UInt8_Array (Buf'Range);
function Convert is new Ada.Unchecked_Conversion
(Buffer_3, Integer_24);
begin
-- bit 6 => read multiple bytes
This.Read (PRESS_OUT_XL or Transfer_Multiples,
Buf,
Status);
if not Status then
return;
end if;
Press := Float (Convert (Buf)) / 4096.0;
end;
-- Temperature
declare
subtype Buffer_2 is HAL.UInt8_Array (0 .. 1);
function Convert is new Ada.Unchecked_Conversion
(Buffer_2, Interfaces.Integer_16);
begin
-- bit 6 => read multiple bytes
This.Read (TEMP_OUT_L or Transfer_Multiples,
Buf (0 .. 1),
Status);
if not Status then
return;
end if;
Temp := 42.5 + Float (Convert (Buf (0 .. 1))) / 480.0;
end;
-- See Wikipedia, "Barometric formula": The pressure drops
-- approximately by 11.3 pascals per meter in first 1000 meters
-- above sea level.
-- See Wikipedia, "Atmospheric pressure": the standard atmosphere is
-- 1013.25 mbar.
-- 1 Pascal = 0.01 mbar
Asl := (1013.25 - Press) * (100.0 / 11.3);
end Get_Data;
----------------
-- Initialize --
----------------
overriding
procedure Initialize (This : in out LPS25H_Barometric_Sensor_SPI)
is
Data : UInt8;
Status : Boolean;
begin
This.Timing.Delay_Milliseconds (5); -- ?
This.Read (WHO_AM_I, Data, Status);
if not Status then
return;
end if;
if Data /= WAI_ID then
return;
end if;
declare
procedure Write_Ctrl_Reg1 is new Write_Register
(CTRL_REG1, Ctrl_Reg1_Register);
begin
Write_Ctrl_Reg1 (This,
(PD => 1, ODR => Hz_25, BDU => 1, others => <>),
Status);
if not Status then
return;
end if;
end;
This.Initialized := True;
end Initialize;
-- Utilities --
--------------------
-- Write_Register --
--------------------
procedure Write_Register (This : LPS25H_Barometric_Sensor_SPI;
Value : Register_Type;
Status : out Boolean) is
pragma Assert (Register_Type'Size = 8);
function Convert is new Ada.Unchecked_Conversion
(Register_Type, HAL.UInt8);
begin
Write (This,
Index => Register,
Data => Convert (Value),
Status => Status);
end Write_Register;
-----------
-- Write --
-----------
procedure Write
(This : LPS25H_Barometric_Sensor_SPI;
Index : HAL.UInt8;
Data : HAL.UInt8;
Status : out Boolean)
is
Outcome : HAL.SPI.SPI_Status;
use all type HAL.SPI.SPI_Status;
Buf : constant HAL.SPI.SPI_Data_8b := (Index, Data);
begin
This.CS.Clear;
This.Port.Transmit (Data => Buf,
Status => Outcome);
Status := Outcome = Ok;
This.CS.Set;
end Write;
----------
-- Read --
----------
procedure Read
(This : LPS25H_Barometric_Sensor_SPI;
Index : HAL.UInt8;
Data : out HAL.UInt8_Array;
Status : out Boolean)
is
Outcome : HAL.SPI.SPI_Status;
Buf : HAL.SPI.SPI_Data_8b (Data'Range);
use all type HAL.SPI.SPI_Status;
begin
This.CS.Clear;
-- bit 7 => read
This.Port.Transmit
(Data => HAL.SPI.SPI_Data_8b'((1 => Index or Read_Request)),
Status => Outcome);
Status := Outcome = Ok;
if Status then
This.Port.Receive (Data => Buf,
Status => Outcome);
Status := Outcome = Ok;
if Status then
for J in Buf'Range loop
Data (J) := Buf (J);
end loop;
end if;
end if;
This.CS.Set;
end Read;
----------
-- Read --
----------
procedure Read
(This : LPS25H_Barometric_Sensor_SPI;
Index : HAL.UInt8;
Data : out HAL.UInt8;
Status : out Boolean)
is
Buf : UInt8_Array (1 .. 1);
begin
This.Read (Index => Index,
Data => Buf,
Status => Status);
if Status then
Data := Buf (1);
end if;
end Read;
end LPS25H.SPI;
|
-- { dg-do compile }
-- { dg-options "-gnatws" }
with elab1;
procedure elab2 is
A : elab1.My_Rec;
begin
null;
end;
|
-----------------------------------------------------------------------
-- servlet-rest-definition -- REST API Definition
-- Copyright (C) 2016 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.
-----------------------------------------------------------------------
generic
type Object_Type is limited private;
URI : String;
package Servlet.Rest.Definition is
type Descriptor is new Servlet.Rest.Descriptor with record
Handler : access procedure (Object : in out Object_Type;
Req : in out Servlet.Rest.Request'Class;
Reply : in out Servlet.Rest.Response'Class;
Stream : in out Servlet.Rest.Output_Stream'Class);
end record;
overriding
procedure Dispatch (Handler : in Descriptor;
Req : in out Servlet.Rest.Request'Class;
Reply : in out Servlet.Rest.Response'Class;
Stream : in out Servlet.Rest.Output_Stream'Class);
-- Definition of an API operation mapped to a given URI pattern and associated with
-- the operation handler.
generic
Handler : access procedure (Object : in out Object_Type;
Req : in out Servlet.Rest.Request'Class;
Reply : in out Servlet.Rest.Response'Class;
Stream : in out Servlet.Rest.Output_Stream'Class);
Method : Method_Type := Servlet.Rest.GET;
Pattern : String;
Permission : Security.Permissions.Permission_Index := Security.Permissions.NONE;
package Definition is
Instance : aliased Descriptor;
end Definition;
-- Register the list of APIs that have been created by instantiating the <tt>Definition</tt>
-- package. The REST servlet identified by <tt>Name</tt> is searched in the servlet registry
-- and used as the servlet for processing the API requests.
procedure Register (Registry : in out Servlet.Core.Servlet_Registry;
Name : in String;
ELContext : in EL.Contexts.ELContext'Class);
private
Entries : Servlet.Rest.Descriptor_Access;
end Servlet.Rest.Definition;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 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.DG.Gradients.Collections is
pragma Preelaborate;
package DG_Gradient_Collections is
new AMF.Generic_Collections
(DG_Gradient,
DG_Gradient_Access);
type Set_Of_DG_Gradient is
new DG_Gradient_Collections.Set with null record;
Empty_Set_Of_DG_Gradient : constant Set_Of_DG_Gradient;
type Ordered_Set_Of_DG_Gradient is
new DG_Gradient_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_DG_Gradient : constant Ordered_Set_Of_DG_Gradient;
type Bag_Of_DG_Gradient is
new DG_Gradient_Collections.Bag with null record;
Empty_Bag_Of_DG_Gradient : constant Bag_Of_DG_Gradient;
type Sequence_Of_DG_Gradient is
new DG_Gradient_Collections.Sequence with null record;
Empty_Sequence_Of_DG_Gradient : constant Sequence_Of_DG_Gradient;
private
Empty_Set_Of_DG_Gradient : constant Set_Of_DG_Gradient
:= (DG_Gradient_Collections.Set with null record);
Empty_Ordered_Set_Of_DG_Gradient : constant Ordered_Set_Of_DG_Gradient
:= (DG_Gradient_Collections.Ordered_Set with null record);
Empty_Bag_Of_DG_Gradient : constant Bag_Of_DG_Gradient
:= (DG_Gradient_Collections.Bag with null record);
Empty_Sequence_Of_DG_Gradient : constant Sequence_Of_DG_Gradient
:= (DG_Gradient_Collections.Sequence with null record);
end AMF.DG.Gradients.Collections;
|
with Ada.Containers; use Ada.Containers;
with Ada.Containers.Formal_Ordered_Maps;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Strings; use Ada.Strings;
with Ada.Text_IO; use Ada.Text_IO;
with Algebra;
use Algebra;
with Bounded_Stack;
package body Assignment_Tree_Branch_Bound with SPARK_Mode is
---------------------------------------------------
-- Types used in the computation of the solution --
---------------------------------------------------
type VehicleAssignmentCost is record
TotalTime : Int64;
Last_TaskOptionID : Int64;
end record
with Predicate => TotalTime >= 0;
package Int64_VehicleAssignmentCost_Maps is new Ada.Containers.Formal_Ordered_Maps
(Key_Type => Int64,
Element_Type => VehicleAssignmentCost);
use Int64_VehicleAssignmentCost_Maps;
subtype Int64_VAC_Map is Int64_VehicleAssignmentCost_Maps.Map (200);
type Assignment_Info is record
Assignment_Sequence : TaskAssignment_Sequence;
Vehicle_Assignments : Int64_VAC_Map;
end record;
package Assignment_Stack is new Bounded_Stack (Assignment_Info);
type Stack is new Assignment_Stack.Stack;
type Children_Arr is array (Positive range <>) of Assignment_Info;
package Int64_Unbounded_String_Maps is new Ada.Containers.Functional_Maps
(Key_Type => Int64,
Element_Type => Unbounded_String);
type Int64_Unbounded_String_Map is new Int64_Unbounded_String_Maps.Map;
-----------------------
-- Ghost subprograms --
-----------------------
function All_Actions_In_Map
(Algebra : not null access constant Algebra_Tree_Cell;
TaskPlanOptions_Map : Int64_TPO_Map)
return Boolean
with Ghost;
function TaskOptionId_In_Map
(TaskOptionId : Int64;
TaskPlanOptions_Map : Int64_TPO_Map)
return Boolean
with Ghost;
function Travel_In_CostMatrix
(VehicleId, InitTaskOptionId, DestTaskOptionId : Int64;
Assignment_Cost_Matrix : AssignmentCostMatrix)
return Boolean
with Ghost;
-----------------------
-- Local subprograms --
-----------------------
function Children
(Assignment : Assignment_Info;
Algebra : not null access constant Algebra_Tree_Cell;
TaskPlanOptions_Map : Int64_TPO_Map;
Assignment_Cost_Matrix : AssignmentCostMatrix)
return Children_Arr
with
Pre =>
Valid_AssignmentCostMatrix (Assignment_Cost_Matrix)
and then
Valid_TaskPlanOptions (TaskPlanOptions_Map)
and then
All_Actions_In_Map (Algebra, TaskPlanOptions_Map)
and then
(for all TOC of Assignment_Cost_Matrix.CostMatrix =>
Contains (Assignment.Vehicle_Assignments, TOC.VehicleID)),
Post =>
(for all Child of Children'Result =>
(for all TOC of Assignment_Cost_Matrix.CostMatrix =>
(Contains (Child.Vehicle_Assignments, TOC.VehicleID))));
-- Returns a sequence of Elements corresponding to all the possible
-- assignments considering Assignment.
function Corresponding_TaskOption
(TaskPlanOptions_Map : Int64_TPO_Map;
TaskOptionId : Int64)
return TaskOption
with
Pre =>
Valid_TaskPlanOptions (TaskPlanOptions_Map)
and then TaskOptionId_In_Map (TaskOptionId, TaskPlanOptions_Map),
Post =>
Corresponding_TaskOption'Result.TaskID = Get_TaskID (TaskOptionId)
and then Corresponding_TaskOption'Result.OptionID = Get_OptionID (TaskOptionId)
and then Corresponding_TaskOption'Result.Cost >= 0;
-- Returns the TaskOption corresponding to TaskOptionId in TaskPlanOptions_Map
function Corresponding_TaskOptionCost
(Assignment_Cost_Matrix : AssignmentCostMatrix;
VehicleId, InitTaskOptionId, DestTaskOptionId : Int64)
return TaskOptionCost
with
Pre =>
Valid_AssignmentCostMatrix (Assignment_Cost_Matrix)
and then Travel_In_CostMatrix (VehicleId, InitTaskOptionId, DestTaskOptionId, Assignment_Cost_Matrix),
Post =>
VehicleId = Corresponding_TaskOptionCost'Result.VehicleID
and then Get_TaskID (InitTaskOptionId) = Corresponding_TaskOptionCost'Result.InitialTaskID
and then Get_OptionID (InitTaskOptionId) = Corresponding_TaskOptionCost'Result.InitialTaskOption
and then Get_TaskID (DestTaskOptionId) = Corresponding_TaskOptionCost'Result.DestinationTaskID
and then Get_OptionID (DestTaskOptionId) = Corresponding_TaskOptionCost'Result.DestinationTaskOption
and then Corresponding_TaskOptionCost'Result.TimeToGo >= 0;
-- Returns the TaskOptionCost corresponding to VehicleId going from
-- InitTaskOptionId to DestTaskOptionId.
function Cost (Assignment : Assignment_Info; Cost_Function : Cost_Function_Kind) return Int64;
-- Returns the cost of an assignment. This function can be expanded to
-- support other cost functions.
function Greedy_Solution
(Data : Assignment_Tree_Branch_Bound_Configuration_Data;
Assignment_Cost_Matrix : AssignmentCostMatrix;
TaskPlanOptions_Map : Int64_TPO_Map;
Algebra : not null access constant Algebra_Tree_Cell)
return Assignment_Info
with
Pre =>
Valid_AssignmentCostMatrix (Assignment_Cost_Matrix)
and then
Valid_TaskPlanOptions (TaskPlanOptions_Map)
and then
(for all Id of TaskPlanOptions_Map =>
(for all TaskOption of Get (TaskPlanOptions_Map, Id).Options => TaskOption.TaskID = Id))
and then
All_Actions_In_Map (Algebra, TaskPlanOptions_Map),
Post =>
(for all TOC of Assignment_Cost_Matrix.CostMatrix =>
Contains (Greedy_Solution'Result.Vehicle_Assignments, TOC.VehicleID));
-- Returns an assignment computed by taking the the child that costs the
-- less at each iteration. It does not necessarily return the assignment
-- that minimizes the cost.
procedure Initialize_Algebra
(Automation_Request : UniqueAutomationRequest;
TaskPlanOptions_Map : Int64_TPO_Map;
Algebra : out not null Algebra_Tree)
with Post => All_Actions_In_Map (Algebra, TaskPlanOptions_Map);
-- Returns the algebra tree corresponding to the formulas stored in
-- Automation_Request and the several TaskPlanOptions.
function Initialize_AssignmentVehicle
(Assignment_Cost_Matrix : AssignmentCostMatrix)
return Int64_VAC_Map
with
Post =>
(for all TOC of Assignment_Cost_Matrix.CostMatrix =>
Contains (Initialize_AssignmentVehicle'Result, TOC.VehicleID));
-- Returns the initialized AssignmentVehicle attribute. The keys are the
-- VehicleIds from the Assignment_Cost_Matrix, and the elements are
-- - TotalTime = 0
-- - LastTaskOptionId = VehicleId (travels between the initial location of
-- a vehicle to a task are stored with InitialTaskOption = VehicleId in
-- Assignment_Cost_Matrix).
function New_Assignment
(Assignment : Assignment_Info;
VehicleId, TaskOptionId : Int64;
Assignment_Cost_Matrix : AssignmentCostMatrix;
TaskPlanOptions_Map : Int64_TPO_Map)
return Assignment_Info
with
Pre =>
Valid_AssignmentCostMatrix (Assignment_Cost_Matrix)
and then
Valid_TaskPlanOptions (TaskPlanOptions_Map)
and then
(for some TOC of Assignment_Cost_Matrix.CostMatrix =>
TOC.VehicleID = VehicleId)
and then
(for all TOC of Assignment_Cost_Matrix.CostMatrix =>
Contains (Assignment.Vehicle_Assignments, TOC.VehicleID))
and then
TaskOptionId_In_Map (TaskOptionId, TaskPlanOptions_Map)
and then
Travel_In_CostMatrix (VehicleId,
Element (Assignment.Vehicle_Assignments, VehicleId).Last_TaskOptionID,
TaskOptionId,
Assignment_Cost_Matrix),
Post =>
(for all TOC of Assignment_Cost_Matrix.CostMatrix =>
(Contains (New_Assignment'Result.Vehicle_Assignments, TOC.VehicleID)));
-- This function returns a new Element. It assigns the TaskOptionId to
-- VehicleId in the enclosing assignment, and computes the new totalTime
-- of VehicleId.
------------------------
-- All_Actions_In_Map --
------------------------
function All_Actions_In_Map
(Algebra : not null access constant Algebra_Tree_Cell;
TaskPlanOptions_Map : Int64_TPO_Map)
return Boolean
is
(case Algebra.all.Node_Kind is
when Action =>
TaskOptionId_In_Map (Algebra.all.TaskOptionId, TaskPlanOptions_Map),
when Operator =>
(for all J in 1 .. Algebra.all.Collection.Num_Children =>
(All_Actions_In_Map (Algebra.all.Collection.Children (J), TaskPlanOptions_Map))),
when Undefined => False);
----------------------------
-- Check_Assignment_Ready --
----------------------------
procedure Check_Assignment_Ready
(Mailbox : in out Assignment_Tree_Branch_Bound_Mailbox;
Data : Assignment_Tree_Branch_Bound_Configuration_Data;
State : in out Assignment_Tree_Branch_Bound_State;
ReqId : Int64)
is
begin
if not Contains (State.m_uniqueAutomationRequests, ReqId)
or else not Contains (State.m_assignmentCostMatrixes, ReqId)
or else not Contains (State.m_taskPlanOptions, ReqId)
or else
(for some TaskId of Element (State.m_uniqueAutomationRequests, ReqId).TaskList =>
not Has_Key (Element (State.m_taskPlanOptions, ReqId), TaskId))
then
return;
end if;
Send_TaskAssignmentSummary (Mailbox, Data, State, ReqId);
end Check_Assignment_Ready;
--------------
-- Children --
--------------
function Children
(Assignment : Assignment_Info;
Algebra : not null access constant Algebra_Tree_Cell;
TaskPlanOptions_Map : Int64_TPO_Map;
Assignment_Cost_Matrix : AssignmentCostMatrix)
return Children_Arr
is
function To_Sequence_Of_TaskOptionId
(Assignment : Assignment_Info)
return Int64_Seq;
function To_Sequence_Of_TaskOptionId
(Assignment : Assignment_Info)
return Int64_Seq
is
Result : Int64_Seq;
begin
for TaskAssignment of Assignment.Assignment_Sequence loop
Result :=
Add (Result,
Get_TaskOptionID
(TaskAssignment.TaskID,
TaskAssignment.OptionID));
end loop;
return Result;
end To_Sequence_Of_TaskOptionId;
Result : Children_Arr (1 .. 1000);
Children_Nb : Natural := 0;
Objectives_IDs : constant Int64_Seq :=
Get_Next_Objectives_Ids
(To_Sequence_Of_TaskOptionId (Assignment),
Algebra);
TaskOpt : TaskOption;
-- List of TaskOptionIds to be assigned for the next iteration
begin
for Objective_ID of Objectives_IDs loop
pragma Assert (TaskOptionId_In_Map (Objective_ID, TaskPlanOptions_Map));
TaskOpt := Corresponding_TaskOption (TaskPlanOptions_Map, Objective_ID);
-- We add a new Assignment to Result for each eligible entity
-- for Objective_Id.
for EntityId of TaskOpt.EligibleEntities loop
pragma Assume (Children_Nb < 1000);
Children_Nb := Children_Nb + 1;
pragma Assert
(Contains (Assignment.Vehicle_Assignments, EntityId));
pragma Assert
(Travel_In_CostMatrix
(EntityId,
Element (Assignment.Vehicle_Assignments, EntityId).Last_TaskOptionID,
Objective_ID,
Assignment_Cost_Matrix));
Result (Children_Nb) := New_Assignment (Assignment, EntityId, Objective_ID, Assignment_Cost_Matrix, TaskPlanOptions_Map);
pragma Loop_Invariant (Children_Nb <= 1000);
pragma Loop_Invariant
(for all J in 1 .. Children_Nb =>
(for all TOC of Assignment_Cost_Matrix.CostMatrix =>
(Contains (Result (J).Vehicle_Assignments, TOC.VehicleID))));
end loop;
pragma Loop_Invariant (Children_Nb <= 1000);
pragma Loop_Invariant
(for all J in 1 .. Children_Nb =>
(for all TOC of Assignment_Cost_Matrix.CostMatrix =>
(Contains (Result (J).Vehicle_Assignments, TOC.VehicleID))));
end loop;
return Result (1 .. Children_Nb);
end Children;
------------------------------
-- Corresponding_TaskOption --
------------------------------
function Corresponding_TaskOption
(TaskPlanOptions_Map : Int64_TPO_Map;
TaskOptionId : Int64)
return TaskOption
is
TaskId : constant Int64 := Get_TaskID (TaskOptionId);
OptionId : constant Int64 := Get_OptionID (TaskOptionId);
Associated_TPO : constant TaskPlanOptions := Get (TaskPlanOptions_Map, TaskId);
begin
for Pos in TO_Sequences.First .. Last (Associated_TPO.Options) loop
if Get (Associated_TPO.Options, Pos).OptionID = OptionId then
return Get (Associated_TPO.Options, Pos);
end if;
pragma Loop_Invariant
(for all J in TO_Sequences.First .. Pos => Get (Associated_TPO.Options, J).OptionID /= OptionId);
end loop;
raise Program_Error;
end Corresponding_TaskOption;
----------------------------------
-- Corresponding_TaskOptionCost --
----------------------------------
function Corresponding_TaskOptionCost
(Assignment_Cost_Matrix : AssignmentCostMatrix;
VehicleId, InitTaskOptionId, DestTaskOptionId : Int64)
return TaskOptionCost
is
InitialTaskId : constant Int64 := Get_TaskID (InitTaskOptionId);
InitialTaskOption : constant Int64 := Get_OptionID (InitTaskOptionId);
DestinationTaskId : constant Int64 := Get_TaskID (DestTaskOptionId);
DestinationTaskOption : constant Int64 := Get_OptionID (DestTaskOptionId);
begin
for Pos in TOC_Sequences.First .. Last (Assignment_Cost_Matrix.CostMatrix) loop
pragma Loop_Invariant
(for all J in TOC_Sequences.First .. Pos - 1 =>
(VehicleId /= Get (Assignment_Cost_Matrix.CostMatrix, J).VehicleID
or else InitialTaskId /= Get (Assignment_Cost_Matrix.CostMatrix, J).InitialTaskID
or else InitialTaskOption /= Get (Assignment_Cost_Matrix.CostMatrix, J).InitialTaskOption
or else DestinationTaskId /= Get (Assignment_Cost_Matrix.CostMatrix, J).DestinationTaskID
or else DestinationTaskOption /= Get (Assignment_Cost_Matrix.CostMatrix, J).DestinationTaskOption));
declare
TOC : constant TaskOptionCost := Get (Assignment_Cost_Matrix.CostMatrix, Pos);
begin
if
VehicleId = TOC.VehicleID
and then InitialTaskId = TOC.InitialTaskID
and then InitialTaskOption = TOC.InitialTaskOption
and then DestinationTaskId = TOC.DestinationTaskID
and then DestinationTaskOption = TOC.DestinationTaskOption
then
return TOC;
end if;
end;
end loop;
raise Program_Error;
end Corresponding_TaskOptionCost;
----------
-- Cost --
----------
function Cost (Assignment : Assignment_Info; Cost_Function : Cost_Function_Kind) return Int64 is
Result : Int64 := 0;
begin
case Cost_Function is
when Minmax =>
for VehicleID of Assignment.Vehicle_Assignments loop
declare
TotalTime : constant Int64 := Element (Assignment.Vehicle_Assignments, VehicleID).TotalTime;
begin
if TotalTime > Result then
Result := TotalTime;
end if;
end;
end loop;
when Cumulative =>
for VehicleId of Assignment.Vehicle_Assignments loop
pragma Assume (Result < Int64'Last - Element (Assignment.Vehicle_Assignments, VehicleId).TotalTime);
Result := Result + Element (Assignment.Vehicle_Assignments, VehicleId).TotalTime;
end loop;
end case;
return Result;
end Cost;
---------------------
-- Greedy_Solution --
---------------------
function Greedy_Solution
(Data : Assignment_Tree_Branch_Bound_Configuration_Data;
Assignment_Cost_Matrix : AssignmentCostMatrix;
TaskPlanOptions_Map : Int64_TPO_Map;
Algebra : not null access constant Algebra_Tree_Cell)
return Assignment_Info
is
Empty_TA_Seq : TaskAssignment_Sequence;
Result : Assignment_Info :=
(Empty_TA_Seq,
Initialize_AssignmentVehicle (Assignment_Cost_Matrix));
Result_Cost : Int64;
begin
while True loop
pragma Loop_Invariant
(for all TOC of Assignment_Cost_Matrix.CostMatrix =>
Contains (Result.Vehicle_Assignments, TOC.VehicleID));
-- All computed costs will be greater than the current Cost, so
-- it is assigned to Int64'Last to actually find the Assignment that
-- minimizes the cost.
Result_Cost := Int64'Last;
declare
Children_A : constant Children_Arr :=
Children (Result, Algebra, TaskPlanOptions_Map, Assignment_Cost_Matrix);
begin
if Children_A'Length = 0 then
exit;
else
for Child of Children_A loop
pragma Loop_Invariant
(for all TOC of Assignment_Cost_Matrix.CostMatrix =>
Contains (Result.Vehicle_Assignments, TOC.VehicleID));
declare
Current_Cost : constant Int64 := Cost (Child, Data.Cost_Function);
begin
if Current_Cost <= Result_Cost then
Result := Child;
Result_Cost := Current_Cost;
end if;
end;
end loop;
end if;
end;
end loop;
return Result;
end Greedy_Solution;
-----------------------------------
-- Handle_Assignment_Cost_Matrix --
-----------------------------------
procedure Handle_Assignment_Cost_Matrix
(Mailbox : in out Assignment_Tree_Branch_Bound_Mailbox;
Data : Assignment_Tree_Branch_Bound_Configuration_Data;
State : in out Assignment_Tree_Branch_Bound_State;
Matrix : AssignmentCostMatrix)
is
begin
pragma Assume (Length (State.m_assignmentCostMatrixes) < Capacity (State.m_assignmentCostMatrixes));
Insert (State.m_assignmentCostMatrixes, Matrix.CorrespondingAutomationRequestID, Matrix);
Check_Assignment_Ready (Mailbox, Data, State, Matrix.CorrespondingAutomationRequestID);
end Handle_Assignment_Cost_Matrix;
------------------------------
-- Handle_Task_Plan_Options --
------------------------------
procedure Handle_Task_Plan_Options
(Mailbox : in out Assignment_Tree_Branch_Bound_Mailbox;
Data : Assignment_Tree_Branch_Bound_Configuration_Data;
State : in out Assignment_Tree_Branch_Bound_State;
Options : TaskPlanOptions)
is
ReqId : constant Int64 := Options.CorrespondingAutomationRequestID;
procedure Add_TaskPlanOption
(Int64_TPO_Map_Map : in out Int64_TaskPlanOptions_Map_Map)
with
Pre =>
(for all Id of Int64_TPO_Map_Map => Valid_TaskPlanOptions (Element (Int64_TPO_Map_Map, Id)))
and then Contains (Int64_TPO_Map_Map, ReqId)
and then not Has_Key (Element (Int64_TPO_Map_Map, ReqId), Options.TaskID)
and then
(for all TaskOption of Options.Options =>
(TaskOption.Cost >= 0
and then Options.TaskID = TaskOption.TaskID)),
Post => (for all Id of Int64_TPO_Map_Map => Valid_TaskPlanOptions (Element (Int64_TPO_Map_Map, Id)));
procedure Insert_Empty_TPO_Map
(Int64_TPO_Map_Map : in out Int64_TaskPlanOptions_Map_Map)
with
Pre =>
(for all Id of Int64_TPO_Map_Map => Valid_TaskPlanOptions (Element (Int64_TPO_Map_Map, Id)))
and then not Contains (Int64_TPO_Map_Map, ReqId),
Post =>
(for all Id of Int64_TPO_Map_Map => Valid_TaskPlanOptions (Element (Int64_TPO_Map_Map, Id)))
and then Contains (Int64_TPO_Map_Map, ReqId)
and then not Has_Key (Element (Int64_TPO_Map_Map, ReqId), Options.TaskID);
------------------------
-- Add_TaskPlanOption --
------------------------
procedure Add_TaskPlanOption
(Int64_TPO_Map_Map : in out Int64_TaskPlanOptions_Map_Map)
is
New_Int64_TPO_Map : Int64_TPO_Map;
begin
pragma Assert (Valid_TaskPlanOptions (Element (Int64_TPO_Map_Map, ReqId)));
pragma Assume (Length (Element (Int64_TPO_Map_Map, ReqId)) < Count_Type'Last);
New_Int64_TPO_Map := Add (Element (Int64_TPO_Map_Map, ReqId), Options.TaskID, Options);
pragma Assert (Valid_TaskPlanOptions (New_Int64_TPO_Map));
Replace
(Int64_TPO_Map_Map,
ReqId,
New_Int64_TPO_Map);
pragma Assert
(for all Id of Int64_TPO_Map_Map =>
(if Id /= ReqId then Valid_TaskPlanOptions (Element (Int64_TPO_Map_Map, Id))));
end Add_TaskPlanOption;
--------------------------
-- Insert_Empty_TPO_Map --
--------------------------
procedure Insert_Empty_TPO_Map
(Int64_TPO_Map_Map : in out Int64_TaskPlanOptions_Map_Map)
is
Empty_Int64_TPO_Map : Int64_TPO_Map;
begin
pragma Assume (Length (Int64_TPO_Map_Map) < Capacity (Int64_TPO_Map_Map));
Insert (Int64_TPO_Map_Map, ReqId, Empty_Int64_TPO_Map);
end Insert_Empty_TPO_Map;
begin
if not Contains (State.m_taskPlanOptions, ReqId) then
Insert_Empty_TPO_Map (State.m_taskPlanOptions);
end if;
Add_TaskPlanOption (State.m_taskPlanOptions);
Check_Assignment_Ready (Mailbox, Data, State, Options.CorrespondingAutomationRequestID);
end Handle_Task_Plan_Options;
--------------------------------------
-- Handle_Unique_Automation_Request --
--------------------------------------
procedure Handle_Unique_Automation_Request
(Mailbox : in out Assignment_Tree_Branch_Bound_Mailbox;
Data : Assignment_Tree_Branch_Bound_Configuration_Data;
State : in out Assignment_Tree_Branch_Bound_State;
Areq : UniqueAutomationRequest)
is
begin
pragma Assume (Length (State.m_uniqueAutomationRequests) < Capacity (State.m_uniqueAutomationRequests));
Insert (State.m_uniqueAutomationRequests, Areq.RequestID, Areq);
Check_Assignment_Ready (Mailbox, Data, State, Areq.RequestID);
end Handle_Unique_Automation_Request;
------------------------
-- Initialize_Algebra --
------------------------
procedure Initialize_Algebra
(Automation_Request : UniqueAutomationRequest;
TaskPlanOptions_Map : Int64_TPO_Map;
Algebra : out not null Algebra_Tree)
with SPARK_Mode => Off
is
package Unb renames Ada.Strings.Unbounded;
taskIdVsAlgebraString : Int64_Unbounded_String_Map;
algebraString : Unbounded_String := To_Unbounded_String ("");
begin
for taskId of TaskPlanOptions_Map loop
declare
compositionString : Unbounded_String :=
Get (TaskPlanOptions_Map, taskId).Composition;
algebraCompositionTaskOptionId : Unbounded_String :=
To_Unbounded_String ("");
isFinished : Boolean := False;
begin
while not isFinished loop
if Length (compositionString) > 0 then
declare
position : Natural := Unb.Index (compositionString, "p");
begin
if position > 0 then
algebraCompositionTaskOptionId :=
algebraCompositionTaskOptionId
& Slice (compositionString, 1, position);
position := position + 1;
declare
positionAfterId : Natural;
positionSpace : constant Natural :=
Unb.Index (compositionString, " ", position);
positionParen : constant Natural :=
Unb.Index (compositionString, ")", position);
begin
if positionSpace /= 0 and then positionParen /= 0 then
positionAfterId := Natural'Min (positionSpace, positionParen);
else
positionAfterId := Natural'Max (positionSpace, positionParen) - 1;
end if;
declare
optionId : constant Int64 :=
Int64'Value (Slice (compositionString, position, positionAfterId));
taskOptionId : constant Int64 :=
Get_TaskOptionID (taskId, optionId);
begin
algebraCompositionTaskOptionId :=
algebraCompositionTaskOptionId & Trim (taskOptionId'Image, Side => Left);
Delete (compositionString, 1, positionAfterId - 1);
end;
end;
else
algebraCompositionTaskOptionId :=
algebraCompositionTaskOptionId & compositionString;
taskIdVsAlgebraString :=
Add (taskIdVsAlgebraString, taskId, algebraCompositionTaskOptionId);
isFinished := True;
end if;
end;
else
isFinished := True;
end if;
end loop;
end;
end loop;
if Length (Automation_Request.TaskRelationships) > 0 then
declare
isFinished : Boolean := False;
TaskRelationShips : Unbounded_String := Automation_Request.TaskRelationships;
begin
while not isFinished loop
if Length (TaskRelationShips) > 0 then
declare
position : Natural := Unb.Index (TaskRelationShips, "p");
begin
if position > 0 then
algebraString :=
algebraString &
Slice (TaskRelationShips, 1, position - 1);
position := position + 1;
declare
positionAfterId : Natural;
positionSpace : constant Natural :=
Unb.Index (TaskRelationShips, " ", position);
positionParen : constant Natural :=
Unb.Index (TaskRelationShips, ")", position);
begin
if positionSpace /= 0 and then positionParen /= 0 then
positionAfterId := Natural'Min (positionSpace, positionParen);
else
positionAfterId := Natural'Max (positionSpace, positionParen);
end if;
declare
taskId : constant Int64 :=
Int64'Value (Slice (TaskRelationShips, position, positionAfterId - 1));
begin
if Has_Key (taskIdVsAlgebraString, taskId) then
algebraString :=
algebraString & Get (taskIdVsAlgebraString, taskId);
else
isFinished := True;
end if;
Delete (TaskRelationShips, 1, positionAfterId - 1);
end;
end;
else
algebraString := algebraString & TaskRelationShips;
isFinished := True;
end if;
end;
else
isFinished := True;
end if;
end loop;
end;
else
algebraString := algebraString & "|(";
for taskID of taskIdVsAlgebraString loop
algebraString :=
algebraString
& Get (taskIdVsAlgebraString, taskID)
& " ";
end loop;
algebraString := algebraString & ")";
end if;
Put_Line ("AlgebraString: " & To_String (algebraString));
Parse_Formula (algebraString, Algebra);
end Initialize_Algebra;
----------------------------------
-- Initialize_AssignmentVehicle --
----------------------------------
function Initialize_AssignmentVehicle
(Assignment_Cost_Matrix : AssignmentCostMatrix)
return Int64_VAC_Map
is
Result : Int64_VAC_Map;
TOC : TaskOptionCost;
begin
for Index in 1 .. Last (Assignment_Cost_Matrix.CostMatrix) loop
TOC := Get (Assignment_Cost_Matrix.CostMatrix, Index);
-- TOC may have several occurences of the same VehicleId
if not Contains (Result, TOC.VehicleID) then
pragma Assume (Length (Result) < Result.Capacity);
Insert (Result, TOC.VehicleID, (0, 0));
end if;
pragma Loop_Invariant (for all J in 1 .. Index => Contains (Result, Get (Assignment_Cost_Matrix.CostMatrix, J).VehicleID));
end loop;
return Result;
end Initialize_AssignmentVehicle;
--------------------
-- New_Assignment --
--------------------
function New_Assignment
(Assignment : Assignment_Info;
VehicleId, TaskOptionId : Int64;
Assignment_Cost_Matrix : AssignmentCostMatrix;
TaskPlanOptions_Map : Int64_TPO_Map)
return Assignment_Info
is
Result : Assignment_Info;
Vehicle_Assignment : constant VehicleAssignmentCost :=
Element (Assignment.Vehicle_Assignments, VehicleId);
pragma Assume
(Vehicle_Assignment.TotalTime
<= Int64'Last - Corresponding_TaskOptionCost (Assignment_Cost_Matrix,
VehicleId,
Vehicle_Assignment.Last_TaskOptionID,
TaskOptionId).TimeToGo);
TimeThreshold : constant Int64 :=
Vehicle_Assignment.TotalTime
+ Corresponding_TaskOptionCost
(Assignment_Cost_Matrix,
VehicleId,
Vehicle_Assignment.Last_TaskOptionID,
TaskOptionId).TimeToGo;
pragma Assume
(TimeThreshold <= Int64'Last - Corresponding_TaskOption (TaskPlanOptions_Map,
TaskOptionId).Cost);
TimeTaskCompleted : constant Int64 :=
TimeThreshold
+ Corresponding_TaskOption
(TaskPlanOptions_Map,
TaskOptionId).Cost;
begin
-- The assignment sequence is the enclosing assignment sequence with
-- the new TaskAssignment added at the end.
pragma Assume (Length (Assignment.Assignment_Sequence) < Count_Type'Last);
Result.Assignment_Sequence :=
Add (Assignment.Assignment_Sequence,
(Get_TaskID (TaskOptionId),
Get_OptionID (TaskOptionId),
VehicleId,
TimeThreshold,
TimeTaskCompleted));
-- Create the new Vehicle_Assignments map
Result.Vehicle_Assignments := Assignment.Vehicle_Assignments;
pragma Assert
(for all VehicleID of Assignment.Vehicle_Assignments =>
Contains (Result.Vehicle_Assignments, VehicleID));
pragma Assert
(for all TOC of Assignment_Cost_Matrix.CostMatrix =>
(Contains (Result.Vehicle_Assignments, TOC.VehicleID)));
-- Only the TimeTotal for VehicleId is modified
Replace (Result.Vehicle_Assignments, VehicleId, (TimeTaskCompleted, TaskOptionId));
return Result;
end New_Assignment;
------------------------------
-- Run_Calculate_Assignment --
------------------------------
procedure Run_Calculate_Assignment
(Data : Assignment_Tree_Branch_Bound_Configuration_Data;
Automation_Request : UniqueAutomationRequest;
Assignment_Cost_Matrix : AssignmentCostMatrix;
TaskPlanOptions_Map : Int64_TPO_Map;
Summary : out TaskAssignmentSummary)
is
procedure Bubble_Sort (Arr : in out Children_Arr)
with
Pre =>
Arr'Length > 0;
-- Sorts the array of assignments in the ascending order of cost.
procedure Bubble_Sort (Arr : in out Children_Arr) is
Switched : Boolean;
begin
loop
Switched := False;
for J in Arr'First .. Arr'Last - 1 loop
if Cost (Arr (J + 1), Data.Cost_Function) < Cost (Arr (J), Data.Cost_Function) then
declare
Tmp : Assignment_Info := Arr (J + 1);
begin
Arr (J + 1) := Arr (J);
Arr (J) := Tmp;
Switched := True;
end;
end if;
end loop;
exit when not Switched;
end loop;
end Bubble_Sort;
type Min_Option (Found : Boolean := False) is record
case Found is
when True =>
Info : Assignment_Info;
Cost : Int64;
when False =>
null;
end case;
end record;
Algebra : Algebra_Tree;
Min : Min_Option := (Found => False);
Search_Stack : Stack;
Current_Element : Assignment_Info;
Empty_TA_Seq : TaskAssignment_Sequence;
Nodes_Visited : Int64 := 0;
begin
Initialize_Algebra (Automation_Request, TaskPlanOptions_Map, Algebra);
Put_Line ("Algebra Tree:");
Print_Tree (Algebra);
-- The first element is a null assignment
Push (Search_Stack,
(Empty_TA_Seq,
Initialize_AssignmentVehicle (Assignment_Cost_Matrix)));
-- If the stack is empty, all solutions have been explored
while Size (Search_Stack) /= 0
-- We continue at least until we find a solution
and then (if Min.Found then
(Nodes_Visited in 1 .. Data.Number_Nodes_Maximum - 1))
loop
-- The element at the top of the stack is popped
Pop (Search_Stack, Current_Element);
if not Min.Found or else Cost (Current_Element, Data.Cost_Function) < Min.Cost then
declare
Children_A : Children_Arr :=
Children (Current_Element,
Algebra,
TaskPlanOptions_Map,
Assignment_Cost_Matrix);
Current_Cost : constant Int64 := Cost (Current_Element, Data.Cost_Function);
begin
-- If this element has no children, it means that this node
-- has assigned every task, so we compare it to the current
-- assignment that minimizes the cost.
if Children_A'Length = 0 then
if not Min.Found or else Current_Cost < Min.Cost then
Min := (Found => True, Info => Current_Element, Cost => Current_Cost);
-- If the maximum number of nodes is 0, we return the first found
-- solution, which is the greedy solution.
if Data.Number_Nodes_Maximum = 0 then
exit;
end if;
end if;
-- Else, we compute the cost for every child and push them into the
-- stack if their cost is lower than the current minimal cost.
else
Bubble_Sort (Children_A);
for J in reverse Children_A'Range loop
declare
Child : Assignment_Info := Children_A (J);
begin
if not Min.Found or else Cost (Child, Data.Cost_Function) < Min.Cost then
pragma Assume (Size (Search_Stack) < Assignment_Stack.Capacity, "we have space for another child");
Push (Search_Stack, Child);
end if;
end;
end loop;
end if;
end;
Nodes_Visited := Nodes_Visited + 1;
end if;
end loop;
Summary.CorrespondingAutomationRequestID := Automation_Request.RequestID;
Summary.OperatingRegion := Automation_Request.OperatingRegion;
Summary.TaskList := Min.Info.Assignment_Sequence;
end Run_Calculate_Assignment;
---------------------------------
-- Send_TaskAssignmentSummary --
---------------------------------
procedure Send_TaskAssignmentSummary
(Mailbox : in out Assignment_Tree_Branch_Bound_Mailbox;
Data : Assignment_Tree_Branch_Bound_Configuration_Data;
State : in out Assignment_Tree_Branch_Bound_State;
ReqId : Int64)
is
Summary : TaskAssignmentSummary;
begin
Run_Calculate_Assignment
(Data,
Element (State.m_uniqueAutomationRequests, ReqId),
Element (State.m_assignmentCostMatrixes, ReqId),
Element (State.m_taskPlanOptions, ReqId),
Summary);
sendBroadcastMessage (Mailbox, Summary);
Delete (State.m_uniqueAutomationRequests, ReqId);
Delete (State.m_assignmentCostMatrixes, ReqId);
pragma Assert (for all Id of State.m_taskPlanOptions => Valid_TaskPlanOptions (Element (State.m_taskPlanOptions, Id)));
Delete (State.m_taskPlanOptions, ReqId);
pragma Assert (for all Id of State.m_taskPlanOptions => Valid_TaskPlanOptions (Element (State.m_taskPlanOptions, Id)));
end Send_TaskAssignmentSummary;
-------------------------
-- TaskOptionId_In_Map --
-------------------------
function TaskOptionId_In_Map
(TaskOptionId : Int64;
TaskPlanOptions_Map : Int64_TPO_Map)
return Boolean
is
(for some TaskId of TaskPlanOptions_Map =>
(for some TaskOption of Get (TaskPlanOptions_Map, TaskId).Options =>
(TaskId = TaskOption.TaskID
and then TaskOption.TaskID = Get_TaskID (TaskOptionId)
and then TaskOption.OptionID = Get_OptionID (TaskOptionId))));
function Travel_In_CostMatrix
(VehicleId, InitTaskOptionId, DestTaskOptionId : Int64;
Assignment_Cost_Matrix : AssignmentCostMatrix)
return Boolean
is
(for some TOC of Assignment_Cost_Matrix.CostMatrix =>
(VehicleId = TOC.VehicleID
and then Get_TaskID (InitTaskOptionId) = TOC.InitialTaskID
and then Get_OptionID (InitTaskOptionId) = TOC.InitialTaskOption
and then Get_TaskID (DestTaskOptionId) = TOC.DestinationTaskID
and then Get_OptionID (DestTaskOptionId) = TOC.DestinationTaskOption));
end Assignment_Tree_Branch_Bound;
|
-- Copyright 2017-2021 Jeff Foley. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
name = "Alterations"
type = "alt"
ldh_chars = "_abcdefghijklmnopqrstuvwxyz0123456789-"
function resolved(ctx, name, domain, records)
local nparts = split(name, ".")
local dparts = split(domain, ".")
-- Do not process resolved root domain names
if #nparts <= #dparts then
return
end
local cfg = config(ctx)
if (cfg.mode == "passive" or not cfg['alterations'].active) then
return
end
makenames(ctx, cfg.alterations, name)
end
function makenames(ctx, cfg, name)
local words = alt_wordlist(ctx)
if cfg['flip_words'] then
for i, n in pairs(flip_words(name, words)) do
local expired = sendnames(ctx, n)
if expired then
return
end
end
end
if cfg['flip_numbers'] then
for i, n in pairs(flip_numbers(name)) do
local expired = sendnames(ctx, n)
if expired then
return
end
end
end
if cfg['add_numbers'] then
for i, n in pairs(append_numbers(name)) do
local expired = sendnames(ctx, n)
if expired then
return
end
end
end
if cfg['add_words'] then
for i, n in pairs(add_prefix_word(name, words)) do
local expired = sendnames(ctx, n)
if expired then
return
end
end
for i, n in pairs(add_suffix_word(name, words)) do
local expired = sendnames(ctx, n)
if expired then
return
end
end
end
local distance = cfg['edit_distance']
if distance > 0 then
for i, n in pairs(fuzzy_label_searches(name, distance)) do
local expired = sendnames(ctx, n)
if expired then
return
end
end
end
end
function flip_words(name, words)
local s = {}
local parts = split(name, ".")
local hostname = parts[1]
local base = partial_join(parts, ".", 2, #parts)
parts = split(hostname, "-")
if #parts < 2 then
return s
end
local post = partial_join(parts, "-", 2, #parts)
for i, word in pairs(words) do
set_insert(s, word .. "-" .. post .. "." .. base)
end
local pre = partial_join(parts, "-", 1, #parts - 1)
for i, word in pairs(words) do
set_insert(s, pre .. "-" .. word .. "." .. base)
end
return set_elements(s)
end
function flip_numbers(name)
local parts = split(name, ".")
local hostname = parts[1]
local base = partial_join(parts, ".", 2, #parts)
local s = {}
local start = 1
while true do
local b, e = string.find(hostname, "%d+", start)
if b == nil then
break
end
start = e + 1
local pre = string.sub(hostname, 1, b - 1)
local post = string.sub(hostname, e + 1)
-- Create an entry with the number removed
set_insert(s, pre .. post .. "." .. base)
local seq = numseq(tonumber(string.sub(hostname, b, e)))
for i, sn in pairs(seq) do
set_insert(s, pre .. sn .. post .. "." .. base)
end
end
return set_elements(s)
end
function numseq(num)
local s = {}
local start = num - 50
if start < 1 then
start = 1
end
local max = num + 50
for i=start,max do
set_insert(s, tostring(i))
end
return set_elements(s)
end
function append_numbers(name)
local s = {}
local parts = split(name, ".")
local hostname = parts[1]
local base = partial_join(parts, ".", 2, #parts)
for i=0,9 do
set_insert(s, hostname .. tostring(i) .. "." .. base)
set_insert(s, hostname .. "-" .. tostring(i) .. "." .. base)
end
return set_elements(s)
end
function add_prefix_word(name, words)
local s = {}
local parts = split(name, ".")
local hostname = parts[1]
local base = partial_join(parts, ".", 2, #parts)
for i, w in pairs(words) do
set_insert(s, w .. hostname .. "." .. base)
set_insert(s, w .. "-" .. hostname .. "." .. base)
end
return set_elements(s)
end
function add_suffix_word(name, words)
local s = {}
local parts = split(name, ".")
local hostname = parts[1]
local base = partial_join(parts, ".", 2, #parts)
for i, w in pairs(words) do
set_insert(s, hostname .. w .. "." .. base)
set_insert(s, hostname .. "-" .. w .. "." .. base)
end
return set_elements(s)
end
function fuzzy_label_searches(name, distance)
local parts = split(name, ".")
local hostname = parts[1]
local base = partial_join(parts, ".", 2, #parts)
local s = {hostname}
for i=1,distance do
local tb = set_elements(s)
set_insert_many(s, additions(tb))
set_insert_many(s, deletions(tb))
set_insert_many(s, substitutions(tb))
end
local results = {}
for i, n in pairs(set_elements(s)) do
set_insert(results, n .. "." .. base)
end
return set_elements(results)
end
function additions(set)
local results = {}
local l = string.len(ldh_chars)
for x, name in pairs(set) do
local nlen = string.len(name)
for i=1,nlen do
for j=1,l do
local c = string.sub(ldh_chars, j, j)
local post = string.sub(name, i)
local pre = ""
if i > 1 then
pre = string.sub(name, 1, i - 1)
end
set_insert(results, pre .. c .. post)
end
end
end
return set_elements(results)
end
function deletions(set)
local results = {}
for x, name in pairs(set) do
local nlen = string.len(name)
for i=1,nlen do
local post = string.sub(name, i + 1)
local pre = ""
if i > 1 then
pre = string.sub(name, 1, i - 1)
end
set_insert(results, pre .. post)
end
end
return set_elements(results)
end
function substitutions(set)
local results = {}
local l = string.len(ldh_chars)
for x, name in pairs(set) do
local nlen = string.len(name)
for i=1,nlen do
for j=1,l do
local c = string.sub(ldh_chars, j, j)
local post = string.sub(name, i + 1)
local pre = ""
if i > 1 then
pre = string.sub(name, 1, i - 1)
end
set_insert(results, pre .. c .. post)
end
end
end
return set_elements(results)
end
function split(str, delim)
local result = {}
local pattern = "[^%" .. delim .. "]+"
local matches = find(str, pattern)
if (matches == nil or #matches == 0) then
return result
end
for i, match in pairs(matches) do
table.insert(result, match)
end
return result
end
function join(parts, sep)
local result = ""
for i, v in pairs(parts) do
result = result .. sep .. v
end
return result
end
function partial_join(parts, sep, first, last)
if (first < 1 or last > #parts) then
return ""
end
local result = parts[first]
first = first + 1
for i=first,last do
result = result .. sep .. parts[i]
end
return result
end
function set_insert(tb, name)
if name ~= "" then
tb[name] = true
end
return tb
end
function set_insert_many(tb, list)
if list == nil then
return tb
end
for i, v in pairs(list) do
tb[v] = true
end
return tb
end
function set_elements(tb)
local result = {}
if tb == nil then
return result
end
for k, v in pairs(tb) do
table.insert(result, k)
end
return result
end
function sendnames(ctx, content)
local names = find(content, subdomainre)
if names == nil then
return false
end
local found = {}
for i, v in pairs(names) do
if found[v] == nil then
local expired = newname(ctx, v)
if expired then
return expired
end
found[v] = true
end
end
return false
end
|
------------------------------------------------------------------------------
-- --
-- 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.Behaviors;
with AMF.UML.Central_Buffer_Nodes;
with AMF.UML.Classifiers.Collections;
with AMF.UML.Dependencies.Collections;
with AMF.UML.Interruptible_Activity_Regions.Collections;
with AMF.UML.Named_Elements;
with AMF.UML.Namespaces;
with AMF.UML.Packages.Collections;
with AMF.UML.Redefinable_Elements.Collections;
with AMF.UML.States.Collections;
with AMF.UML.String_Expressions;
with AMF.UML.Structured_Activity_Nodes;
with AMF.UML.Types;
with AMF.UML.Value_Specifications;
with AMF.Visitors;
package AMF.Internals.UML_Central_Buffer_Nodes is
type UML_Central_Buffer_Node_Proxy is
limited new AMF.Internals.UML_Named_Elements.UML_Named_Element_Proxy
and AMF.UML.Central_Buffer_Nodes.UML_Central_Buffer_Node with null record;
overriding function Get_In_State
(Self : not null access constant UML_Central_Buffer_Node_Proxy)
return AMF.UML.States.Collections.Set_Of_UML_State;
-- Getter of ObjectNode::inState.
--
-- The required states of the object available at this point in the
-- activity.
overriding function Get_Is_Control_Type
(Self : not null access constant UML_Central_Buffer_Node_Proxy)
return Boolean;
-- Getter of ObjectNode::isControlType.
--
-- Tells whether the type of the object node is to be treated as control.
overriding procedure Set_Is_Control_Type
(Self : not null access UML_Central_Buffer_Node_Proxy;
To : Boolean);
-- Setter of ObjectNode::isControlType.
--
-- Tells whether the type of the object node is to be treated as control.
overriding function Get_Ordering
(Self : not null access constant UML_Central_Buffer_Node_Proxy)
return AMF.UML.UML_Object_Node_Ordering_Kind;
-- Getter of ObjectNode::ordering.
--
-- Tells whether and how the tokens in the object node are ordered for
-- selection to traverse edges outgoing from the object node.
overriding procedure Set_Ordering
(Self : not null access UML_Central_Buffer_Node_Proxy;
To : AMF.UML.UML_Object_Node_Ordering_Kind);
-- Setter of ObjectNode::ordering.
--
-- Tells whether and how the tokens in the object node are ordered for
-- selection to traverse edges outgoing from the object node.
overriding function Get_Selection
(Self : not null access constant UML_Central_Buffer_Node_Proxy)
return AMF.UML.Behaviors.UML_Behavior_Access;
-- Getter of ObjectNode::selection.
--
-- Selects tokens for outgoing edges.
overriding procedure Set_Selection
(Self : not null access UML_Central_Buffer_Node_Proxy;
To : AMF.UML.Behaviors.UML_Behavior_Access);
-- Setter of ObjectNode::selection.
--
-- Selects tokens for outgoing edges.
overriding function Get_Upper_Bound
(Self : not null access constant UML_Central_Buffer_Node_Proxy)
return AMF.UML.Value_Specifications.UML_Value_Specification_Access;
-- Getter of ObjectNode::upperBound.
--
-- The maximum number of tokens allowed in the node. Objects cannot flow
-- into the node if the upper bound is reached.
overriding procedure Set_Upper_Bound
(Self : not null access UML_Central_Buffer_Node_Proxy;
To : AMF.UML.Value_Specifications.UML_Value_Specification_Access);
-- Setter of ObjectNode::upperBound.
--
-- The maximum number of tokens allowed in the node. Objects cannot flow
-- into the node if the upper bound is reached.
overriding function Get_Activity
(Self : not null access constant UML_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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 Get_Type
(Self : not null access constant UML_Central_Buffer_Node_Proxy)
return AMF.UML.Types.UML_Type_Access;
-- Getter of TypedElement::type.
--
-- The type of the TypedElement.
-- This information is derived from the return result for this Operation.
overriding procedure Set_Type
(Self : not null access UML_Central_Buffer_Node_Proxy;
To : AMF.UML.Types.UML_Type_Access);
-- Setter of TypedElement::type.
--
-- The type of the TypedElement.
-- This information is derived from the return result for this Operation.
overriding function Is_Consistent_With
(Self : not null access constant UML_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Node_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_Central_Buffer_Nodes;
|
package body Types is
-- Implement divide operators defined in spec
-- Implement conversion functions defined in spec
end Types;
|
-- The Village of Vampire by YT, このソースコードはNYSLです
procedure Vampire.R3.Log_Index_Page (
Output : not null access Ada.Streams.Root_Stream_Type'Class;
Form : in Forms.Root_Form_Type'Class;
Template : in String;
HTML_Directory : in String;
Style_Sheet : in String;
Background : in String;
Summaries : in Tabula.Villages.Lists.Summary_Maps.Map);
|
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2012 Felix Krause <contact@flyx.org>
--
-- 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.
generic
type Element_Type is private;
type Index_Type is (<>);
package GL.Algebra is
pragma Pure;
-----------------------------------------------------------------------------
-- Vector types --
-----------------------------------------------------------------------------
type Vector2 is array (Index_2D) of aliased Element_Type;
type Vector3 is array (Index_3D) of aliased Element_Type;
type Vector4 is array (Index_Homogeneous) of aliased Element_Type;
pragma Convention (C, Vector2);
pragma Convention (C, Vector3);
pragma Convention (C, Vector4);
-----------------------------------------------------------------------------
-- Matrix types --
-----------------------------------------------------------------------------
type Matrix4 is array (Index_Homogeneous, Index_Homogeneous) of aliased Element_Type;
pragma Convention (C, Matrix4);
-----------------------------------------------------------------------------
-- Array types --
-----------------------------------------------------------------------------
type Vector2_Array is array (Index_Type range <>) of aliased Vector2;
type Vector3_Array is array (Index_Type range <>) of aliased Vector3;
type Vector4_Array is array (Index_Type range <>) of aliased Vector4;
type Matrix4_Array is array (Index_Type range <>) of aliased Matrix4;
pragma Convention (C, Vector2_Array);
pragma Convention (C, Vector3_Array);
pragma Convention (C, Vector4_Array);
pragma Convention (C, Matrix4_Array);
end GL.Algebra;
|
-- C35508K.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 'POS' AND 'VAL' YIELD THE CORRECT RESULTS WHEN THE
-- PREFIX IS A BOOLEAN TYPE.
-- RJW 3/19/86
-- PWN 01/31/95 REMOVED INCONSISTENCIES WITH ADA 9X.
WITH REPORT; USE REPORT;
PROCEDURE C35508K IS
TYPE NEWBOOL IS NEW BOOLEAN;
BEGIN
TEST ("C35508K", "CHECK THAT 'POS' AND 'VAL' YIELD THE " &
"CORRECT RESULTS WHEN THE PREFIX IS A " &
"BOOLEAN TYPE" );
BEGIN
IF BOOLEAN'POS (IDENT_BOOL(FALSE)) /= 0 THEN
FAILED ( "WRONG POS FOR 'FALSE'" );
END IF;
IF BOOLEAN'POS (IDENT_BOOL(TRUE)) /= 1 THEN
FAILED ( "WRONG POS FOR 'TRUE'" );
END IF;
IF BOOLEAN'VAL (IDENT_INT(0)) /= FALSE THEN
FAILED ( "WRONG VAL FOR '0'" );
END IF;
IF BOOLEAN'VAL (IDENT_INT(1)) /= TRUE THEN
FAILED ( "WRONG VAL FOR '1'" );
END IF;
END;
BEGIN
IF BOOLEAN'VAL (IDENT_INT(-1)) = TRUE THEN
FAILED("'VAL(-1) WRAPPED AROUND TO TRUE");
END IF;
FAILED ( "NO EXCEPTION RAISED FOR VAL OF '-1'" );
EXCEPTION
WHEN CONSTRAINT_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ( "WRONG EXCEPTION RAISED FOR VAL OF '-1'" );
END;
BEGIN
IF BOOLEAN'VAL (IDENT_INT(2)) = FALSE THEN
FAILED("BOOLEAN'VAL(2) WRAPPED AROUND TO FALSE");
END IF;
FAILED ( "NO EXCEPTION RAISED FOR VAL OF '2'" );
EXCEPTION
WHEN CONSTRAINT_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ( "WRONG EXCEPTION RAISED FOR VAL OF '2'" );
END;
BEGIN
IF NEWBOOL'POS (FALSE) /= 0 THEN
FAILED ( "WRONG POS FOR NEWBOOL'(FALSE)" );
END IF;
IF NEWBOOL'POS (TRUE) /= 1 THEN
FAILED ( "WRONG POS FOR NEWBOOL'(TRUE)" );
END IF;
IF NEWBOOL'VAL (0) /= FALSE THEN
FAILED ( "WRONG NEWBOOL'VAL FOR '0'" );
END IF;
IF NEWBOOL'VAL (1) /= TRUE THEN
FAILED ( "WRONG NEWBOOL'VAL FOR '1'" );
END IF;
END;
BEGIN
IF NEWBOOL'VAL (IDENT_INT(-1)) = TRUE THEN
FAILED("NEWBOOL'VAL(-1) WRAPPED AROUND TO TRUE");
END IF;
FAILED ( "NO EXCEPTION RAISED FOR NEWBOOL'VAL OF '-1'" );
EXCEPTION
WHEN CONSTRAINT_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ( "WRONG EXCEPTION RAISED FOR " &
"NEWBOOL'VAL OF '-1'" );
END;
BEGIN
IF NEWBOOL'VAL (IDENT_INT(2)) = FALSE THEN
FAILED("NEWBOOL'VAL(2) WRAPPED AROUND TO FALSE");
END IF;
FAILED ( "NO EXCEPTION RAISED FOR NEWBOOL'VAL OF '2'" );
EXCEPTION
WHEN CONSTRAINT_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ( "WRONG EXCEPTION RAISED FOR " &
"NEWBOOL'VAL OF '2'" );
END;
RESULT;
END C35508K;
|
with point_list;
use point_list;
with point;
use point;
package petit_poucet is
-- Un petit poucet est un objet possèdant un jeu de coordonées
-- et qui enregistre chacun des mouvements qu'il réalise
-- permettant ensuite de récupérer l'historique de ses mouvements
type petit_poucet_t is
record
-- historique des points du petit poucet
start_node : node_ptr;
-- historique des points du petit poucet
curr_node : node_ptr;
-- position de départ du petit poucet
start_pos : point_t;
-- position courrante du petit poucet
curr_pos : point_t;
end record;
-- Instancie un petit poucet
function get_petit_poucet(start_pos : point_t) return petit_poucet_t;
-- Obtient les points laissés par le petit poucet
function get_points(poucet : petit_poucet_t) return node_ptr;
-- Deplace le petit poucet de delta_x vers la gauche
-- Garantit: 0 <= coords <= infini
-- Exception: invalid_pos si coords < 0
procedure mv_l(poucet : in out petit_poucet_t; delta_x : float);
-- procedure mv_l(poucet : in out petit_poucet_t; delta_x : integer);
-- Deplace le petit poucet de delta_x vers la droite
-- Garantit: 0 <= coords <= infini
-- Exception: invalid_pos si coords < 0
procedure mv_r(poucet : in out petit_poucet_t; delta_x : float);
-- procedure mv_r(poucet : in out petit_poucet_t; delta_x : integer);
-- Deplace le petit poucet de delta_y vers le haut
-- Garantit: 0 <= coords <= infini
-- Exception: invalid_pos si coords < 0
procedure mv_u(poucet : in out petit_poucet_t; delta_y : float);
-- procedure mv_u(poucet : in out petit_poucet_t; delta_y : integer);
-- Deplace le petit poucet de delta_y vers le bas
-- Garantit: 0 <= coords <= infini
-- Exception: invalid_pos si coords < 0
procedure mv_d(poucet : in out petit_poucet_t; delta_y : float);
-- procedure mv_d(poucet : in out petit_poucet_t; delta_y : integer);
-- Type décrivant un pointeur de fonction
-- vers une procédure de mv de poucet
type mv_poucet_ptr is access procedure (poucet : in out petit_poucet_t; delta_axis : float);
-- Constantes de pointeurs vers les mv_* du poucet
mv_l_ptr : constant mv_poucet_ptr := mv_l'access;
mv_r_ptr : constant mv_poucet_ptr := mv_r'access;
mv_u_ptr : constant mv_poucet_ptr := mv_u'access;
mv_d_ptr : constant mv_poucet_ptr := mv_d'access;
end petit_poucet;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S T R I N G S . F I X E D --
-- --
-- B o d y --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
-- Note: This code is derived from the ADAR.CSH public domain Ada 83 versions
-- of the Appendix C string handling packages. One change is to avoid the use
-- of Is_In, so that we are not dependent on inlining. Note that the search
-- function implementations are to be found in the auxiliary package
-- Ada.Strings.Search. Also the Move procedure is directly incorporated (ADAR
-- used a subunit for this procedure). number of errors having to do with
-- bounds of function return results were also fixed, and use of & removed for
-- efficiency reasons.
with Ada.Strings.Maps; use Ada.Strings.Maps;
with Ada.Strings.Search;
package body Ada.Strings.Fixed is
------------------------
-- Search Subprograms --
------------------------
function Index
(Source : String;
Pattern : String;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
renames Ada.Strings.Search.Index;
function Index
(Source : String;
Pattern : String;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function) return Natural
renames Ada.Strings.Search.Index;
function Index
(Source : String;
Set : Maps.Character_Set;
Test : Membership := Inside;
Going : Direction := Forward) return Natural
renames Ada.Strings.Search.Index;
function Index
(Source : String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
renames Ada.Strings.Search.Index;
function Index
(Source : String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function) return Natural
renames Ada.Strings.Search.Index;
function Index
(Source : String;
Set : Maps.Character_Set;
From : Positive;
Test : Membership := Inside;
Going : Direction := Forward) return Natural
renames Ada.Strings.Search.Index;
function Index_Non_Blank
(Source : String;
Going : Direction := Forward) return Natural
renames Ada.Strings.Search.Index_Non_Blank;
function Index_Non_Blank
(Source : String;
From : Positive;
Going : Direction := Forward) return Natural
renames Ada.Strings.Search.Index_Non_Blank;
function Count
(Source : String;
Pattern : String;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
renames Ada.Strings.Search.Count;
function Count
(Source : String;
Pattern : String;
Mapping : Maps.Character_Mapping_Function) return Natural
renames Ada.Strings.Search.Count;
function Count
(Source : String;
Set : Maps.Character_Set) return Natural
renames Ada.Strings.Search.Count;
procedure Find_Token
(Source : String;
Set : Maps.Character_Set;
Test : Membership;
First : out Positive;
Last : out Natural)
renames Ada.Strings.Search.Find_Token;
---------
-- "*" --
---------
function "*"
(Left : Natural;
Right : Character) return String
is
Result : String (1 .. Left);
begin
for J in Result'Range loop
Result (J) := Right;
end loop;
return Result;
end "*";
function "*"
(Left : Natural;
Right : String) return String
is
Result : String (1 .. Left * Right'Length);
Ptr : Integer := 1;
begin
for J in 1 .. Left loop
Result (Ptr .. Ptr + Right'Length - 1) := Right;
Ptr := Ptr + Right'Length;
end loop;
return Result;
end "*";
------------
-- Delete --
------------
function Delete
(Source : String;
From : Positive;
Through : Natural) return String
is
begin
if From > Through then
declare
subtype Result_Type is String (1 .. Source'Length);
begin
return Result_Type (Source);
end;
elsif From not in Source'Range
or else Through > Source'Last
then
raise Index_Error;
else
declare
Front : constant Integer := From - Source'First;
Result : String (1 .. Source'Length - (Through - From + 1));
begin
Result (1 .. Front) :=
Source (Source'First .. From - 1);
Result (Front + 1 .. Result'Last) :=
Source (Through + 1 .. Source'Last);
return Result;
end;
end if;
end Delete;
procedure Delete
(Source : in out String;
From : Positive;
Through : Natural;
Justify : Alignment := Left;
Pad : Character := Space)
is
begin
Move (Source => Delete (Source, From, Through),
Target => Source,
Justify => Justify,
Pad => Pad);
end Delete;
----------
-- Head --
----------
function Head
(Source : String;
Count : Natural;
Pad : Character := Space) return String
is
subtype Result_Type is String (1 .. Count);
begin
if Count < Source'Length then
return
Result_Type (Source (Source'First .. Source'First + Count - 1));
else
declare
Result : Result_Type;
begin
Result (1 .. Source'Length) := Source;
for J in Source'Length + 1 .. Count loop
Result (J) := Pad;
end loop;
return Result;
end;
end if;
end Head;
procedure Head
(Source : in out String;
Count : Natural;
Justify : Alignment := Left;
Pad : Character := Space)
is
begin
Move (Source => Head (Source, Count, Pad),
Target => Source,
Drop => Error,
Justify => Justify,
Pad => Pad);
end Head;
------------
-- Insert --
------------
function Insert
(Source : String;
Before : Positive;
New_Item : String) return String
is
Result : String (1 .. Source'Length + New_Item'Length);
Front : constant Integer := Before - Source'First;
begin
if Before not in Source'First .. Source'Last + 1 then
raise Index_Error;
end if;
Result (1 .. Front) :=
Source (Source'First .. Before - 1);
Result (Front + 1 .. Front + New_Item'Length) :=
New_Item;
Result (Front + New_Item'Length + 1 .. Result'Last) :=
Source (Before .. Source'Last);
return Result;
end Insert;
procedure Insert
(Source : in out String;
Before : Positive;
New_Item : String;
Drop : Truncation := Error)
is
begin
Move (Source => Insert (Source, Before, New_Item),
Target => Source,
Drop => Drop);
end Insert;
----------
-- Move --
----------
procedure Move
(Source : String;
Target : out String;
Drop : Truncation := Error;
Justify : Alignment := Left;
Pad : Character := Space)
is
Sfirst : constant Integer := Source'First;
Slast : constant Integer := Source'Last;
Slength : constant Integer := Source'Length;
Tfirst : constant Integer := Target'First;
Tlast : constant Integer := Target'Last;
Tlength : constant Integer := Target'Length;
function Is_Padding (Item : String) return Boolean;
-- Check if Item is all Pad characters, return True if so, False if not
function Is_Padding (Item : String) return Boolean is
begin
for J in Item'Range loop
if Item (J) /= Pad then
return False;
end if;
end loop;
return True;
end Is_Padding;
-- Start of processing for Move
begin
if Slength = Tlength then
Target := Source;
elsif Slength > Tlength then
case Drop is
when Left =>
Target := Source (Slast - Tlength + 1 .. Slast);
when Right =>
Target := Source (Sfirst .. Sfirst + Tlength - 1);
when Error =>
case Justify is
when Left =>
if Is_Padding (Source (Sfirst + Tlength .. Slast)) then
Target :=
Source (Sfirst .. Sfirst + Target'Length - 1);
else
raise Length_Error;
end if;
when Right =>
if Is_Padding (Source (Sfirst .. Slast - Tlength)) then
Target := Source (Slast - Tlength + 1 .. Slast);
else
raise Length_Error;
end if;
when Center =>
raise Length_Error;
end case;
end case;
-- Source'Length < Target'Length
else
case Justify is
when Left =>
Target (Tfirst .. Tfirst + Slength - 1) := Source;
for I in Tfirst + Slength .. Tlast loop
Target (I) := Pad;
end loop;
when Right =>
for I in Tfirst .. Tlast - Slength loop
Target (I) := Pad;
end loop;
Target (Tlast - Slength + 1 .. Tlast) := Source;
when Center =>
declare
Front_Pad : constant Integer := (Tlength - Slength) / 2;
Tfirst_Fpad : constant Integer := Tfirst + Front_Pad;
begin
for I in Tfirst .. Tfirst_Fpad - 1 loop
Target (I) := Pad;
end loop;
Target (Tfirst_Fpad .. Tfirst_Fpad + Slength - 1) := Source;
for I in Tfirst_Fpad + Slength .. Tlast loop
Target (I) := Pad;
end loop;
end;
end case;
end if;
end Move;
---------------
-- Overwrite --
---------------
function Overwrite
(Source : String;
Position : Positive;
New_Item : String) return String
is
begin
if Position not in Source'First .. Source'Last + 1 then
raise Index_Error;
end if;
declare
Result_Length : constant Natural :=
Integer'Max
(Source'Length,
Position - Source'First + New_Item'Length);
Result : String (1 .. Result_Length);
Front : constant Integer := Position - Source'First;
begin
Result (1 .. Front) :=
Source (Source'First .. Position - 1);
Result (Front + 1 .. Front + New_Item'Length) :=
New_Item;
Result (Front + New_Item'Length + 1 .. Result'Length) :=
Source (Position + New_Item'Length .. Source'Last);
return Result;
end;
end Overwrite;
procedure Overwrite
(Source : in out String;
Position : Positive;
New_Item : String;
Drop : Truncation := Right)
is
begin
Move (Source => Overwrite (Source, Position, New_Item),
Target => Source,
Drop => Drop);
end Overwrite;
-------------------
-- Replace_Slice --
-------------------
function Replace_Slice
(Source : String;
Low : Positive;
High : Natural;
By : String) return String
is
begin
if Low > Source'Last + 1 or High < Source'First - 1 then
raise Index_Error;
end if;
if High >= Low then
declare
Front_Len : constant Integer :=
Integer'Max (0, Low - Source'First);
-- Length of prefix of Source copied to result
Back_Len : constant Integer :=
Integer'Max (0, Source'Last - High);
-- Length of suffix of Source copied to result
Result_Length : constant Integer :=
Front_Len + By'Length + Back_Len;
-- Length of result
Result : String (1 .. Result_Length);
begin
Result (1 .. Front_Len) :=
Source (Source'First .. Low - 1);
Result (Front_Len + 1 .. Front_Len + By'Length) :=
By;
Result (Front_Len + By'Length + 1 .. Result'Length) :=
Source (High + 1 .. Source'Last);
return Result;
end;
else
return Insert (Source, Before => Low, New_Item => By);
end if;
end Replace_Slice;
procedure Replace_Slice
(Source : in out String;
Low : Positive;
High : Natural;
By : String;
Drop : Truncation := Error;
Justify : Alignment := Left;
Pad : Character := Space)
is
begin
Move (Replace_Slice (Source, Low, High, By), Source, Drop, Justify, Pad);
end Replace_Slice;
----------
-- Tail --
----------
function Tail
(Source : String;
Count : Natural;
Pad : Character := Space) return String
is
subtype Result_Type is String (1 .. Count);
begin
if Count < Source'Length then
return Result_Type (Source (Source'Last - Count + 1 .. Source'Last));
-- Pad on left
else
declare
Result : Result_Type;
begin
for J in 1 .. Count - Source'Length loop
Result (J) := Pad;
end loop;
Result (Count - Source'Length + 1 .. Count) := Source;
return Result;
end;
end if;
end Tail;
procedure Tail
(Source : in out String;
Count : Natural;
Justify : Alignment := Left;
Pad : Character := Space)
is
begin
Move (Source => Tail (Source, Count, Pad),
Target => Source,
Drop => Error,
Justify => Justify,
Pad => Pad);
end Tail;
---------------
-- Translate --
---------------
function Translate
(Source : String;
Mapping : Maps.Character_Mapping) return String
is
Result : String (1 .. Source'Length);
begin
for J in Source'Range loop
Result (J - (Source'First - 1)) := Value (Mapping, Source (J));
end loop;
return Result;
end Translate;
procedure Translate
(Source : in out String;
Mapping : Maps.Character_Mapping)
is
begin
for J in Source'Range loop
Source (J) := Value (Mapping, Source (J));
end loop;
end Translate;
function Translate
(Source : String;
Mapping : Maps.Character_Mapping_Function) return String
is
Result : String (1 .. Source'Length);
pragma Unsuppress (Access_Check);
begin
for J in Source'Range loop
Result (J - (Source'First - 1)) := Mapping.all (Source (J));
end loop;
return Result;
end Translate;
procedure Translate
(Source : in out String;
Mapping : Maps.Character_Mapping_Function)
is
pragma Unsuppress (Access_Check);
begin
for J in Source'Range loop
Source (J) := Mapping.all (Source (J));
end loop;
end Translate;
----------
-- Trim --
----------
function Trim
(Source : String;
Side : Trim_End) return String
is
Low, High : Integer;
begin
Low := Index_Non_Blank (Source, Forward);
-- All blanks case
if Low = 0 then
return "";
-- At least one non-blank
else
High := Index_Non_Blank (Source, Backward);
case Side is
when Strings.Left =>
declare
subtype Result_Type is String (1 .. Source'Last - Low + 1);
begin
return Result_Type (Source (Low .. Source'Last));
end;
when Strings.Right =>
declare
subtype Result_Type is String (1 .. High - Source'First + 1);
begin
return Result_Type (Source (Source'First .. High));
end;
when Strings.Both =>
declare
subtype Result_Type is String (1 .. High - Low + 1);
begin
return Result_Type (Source (Low .. High));
end;
end case;
end if;
end Trim;
procedure Trim
(Source : in out String;
Side : Trim_End;
Justify : Alignment := Left;
Pad : Character := Space)
is
begin
Move (Trim (Source, Side),
Source,
Justify => Justify,
Pad => Pad);
end Trim;
function Trim
(Source : String;
Left : Maps.Character_Set;
Right : Maps.Character_Set) return String
is
High, Low : Integer;
begin
Low := Index (Source, Set => Left, Test => Outside, Going => Forward);
-- Case where source comprises only characters in Left
if Low = 0 then
return "";
end if;
High :=
Index (Source, Set => Right, Test => Outside, Going => Backward);
-- Case where source comprises only characters in Right
if High = 0 then
return "";
end if;
declare
subtype Result_Type is String (1 .. High - Low + 1);
begin
return Result_Type (Source (Low .. High));
end;
end Trim;
procedure Trim
(Source : in out String;
Left : Maps.Character_Set;
Right : Maps.Character_Set;
Justify : Alignment := Strings.Left;
Pad : Character := Space)
is
begin
Move (Source => Trim (Source, Left, Right),
Target => Source,
Justify => Justify,
Pad => Pad);
end Trim;
end Ada.Strings.Fixed;
|
-- Copyright 2014-2016 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
function Make (H, L : Natural) return Packed_Array is
begin
return (H .. L => False);
end Make;
procedure Do_Nothing (A : System.Address) is
begin
null;
end Do_Nothing;
end Pck;
|
-- Copyright 2011-2015 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure Foo is
type BA is access all Boolean;
type BAs is array (1 .. 1) of BA;
type Blob is record
Val : Integer;
Bees : BAs;
end record;
My_Blob : Blob := (Val => 1, Bees => (1 => null));
begin
Do_Nothing (My_Blob'Address); -- STOP
end Foo;
|
with AUnit.Assertions; use AUnit.Assertions;
package body Day.Test is
procedure Test_Part1 (T : in out AUnit.Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
v : constant XMAS_Vector.Vector := load_file("test1.txt");
invalid : constant Long_Integer := first_invalid(v, 5);
begin
Assert(invalid = 127, "Wrong number, expected 127, got" & Long_Integer'IMAGE(invalid));
end Test_Part1;
procedure Test_Part2 (T : in out AUnit.Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
v : constant XMAS_Vector.Vector := load_file("test1.txt");
contig : constant Long_Integer := find_sum(v, 127);
begin
Assert(contig = 62, "Wrong number, expected 62, got" & Long_Integer'IMAGE(contig));
end Test_Part2;
function Name (T : Test) return AUnit.Message_String is
pragma Unreferenced (T);
begin
return AUnit.Format ("Test Day package");
end Name;
procedure Register_Tests (T : in out Test) is
use AUnit.Test_Cases.Registration;
begin
Register_Routine (T, Test_Part1'Access, "Test Part 1");
Register_Routine (T, Test_Part2'Access, "Test Part 2");
end Register_Tests;
end Day.Test;
|
M:efm8_usbdint
F:G$usbIrqHandler$0$0({2}DF,SV:S),C,0,0,1,15,0
S:Lefm8_usbdint.usbIrqHandler$statusCommon$1$87({1}SC:U),R,0,0,[r7]
S:Lefm8_usbdint.usbIrqHandler$statusIn$1$87({1}SC:U),R,0,0,[r6]
S:Lefm8_usbdint.usbIrqHandler$statusOut$1$87({1}SC:U),R,0,0,[r5]
S:Lefm8_usbdint.usbIrqHandler$indexSave$1$87({1}SC:U),R,0,0,[r4]
F:Fefm8_usbdint$handleUsbEp0Int$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:Fefm8_usbdint$USB_ReadFIFOSetup$0$0({2}DF,SV:S),Z,0,3,0,0,0
S:Lefm8_usbdint.USB_ReadFIFOSetup$ptr$1$116({3}DG,SI:U),B,1,1
F:Fefm8_usbdint$handleUsbResetInt$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:Fefm8_usbdint$handleUsbSuspendInt$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:Fefm8_usbdint$handleUsbResumeInt$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:Fefm8_usbdint$handleUsbEp0Tx$0$0({2}DF,SV:S),Z,0,0,0,0,0
S:Lefm8_usbdint.handleUsbEp0Tx$count$1$135({1}SC:U),R,0,0,[r4]
S:Lefm8_usbdint.handleUsbEp0Tx$count_snapshot$1$135({1}SC:U),R,0,0,[r7]
S:Lefm8_usbdint.handleUsbEp0Tx$i$1$135({1}SC:U),R,0,0,[r5]
S:Lefm8_usbdint.handleUsbEp0Tx$callback$1$135({1}SB0$1:U),R,0,0,[b0]
F:Fefm8_usbdint$handleUsbEp0Rx$0$0({2}DF,SV:S),Z,0,0,0,0,0
S:Lefm8_usbdint.handleUsbEp0Rx$count$1$148({1}SC:U),R,0,0,[r7]
S:Lefm8_usbdint.handleUsbEp0Rx$status$1$148({1}SC:U),R,0,0,[r6]
S:Lefm8_usbdint.handleUsbEp0Rx$callback$1$148({1}SB0$1:U),R,0,0,[b0]
F:G$SendEp0Stall$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$forceModuleLoad_usbint$0$0({2}DF,SV:S),C,0,0,0,0,0
T:Fefm8_usbdint$SI_UU32[({0}S:S$u32$0$0({4}SL:U),Z,0,0)({0}S:S$s32$0$0({4}SL:S),Z,0,0)({0}S:S$uu16$0$0({4}DA2d,STSI_UU16:S),Z,0,0)({0}S:S$u16$0$0({4}DA2d,SI:U),Z,0,0)({0}S:S$s16$0$0({4}DA2d,SI:S),Z,0,0)({0}S:S$u8$0$0({4}DA4d,SC:U),Z,0,0)({0}S:S$s8$0$0({4}DA4d,SC:S),Z,0,0)]
T:Fefm8_usbdint$SI_UU16[({0}S:S$u16$0$0({2}SI:U),Z,0,0)({0}S:S$s16$0$0({2}SI:S),Z,0,0)({0}S:S$u8$0$0({2}DA2d,SC:U),Z,0,0)({0}S:S$s8$0$0({2}DA2d,SC:S),Z,0,0)]
T:Fefm8_usbdint$SI_GEN_PTR[({0}S:S$u8$0$0({3}DA3d,SC:U),Z,0,0)({0}S:S$gptr$0$0({3}ST__00000000:S),Z,0,0)]
T:Fefm8_usbdint$__00000000[({0}S:S$memtype$0$0({1}SC:U),Z,0,0)({1}S:S$address$0$0({2}STSI_UU16:S),Z,0,0)]
T:Fefm8_usbdint$__00000010[({0}S:S$bits$0$0({1}ST__00000011:S),Z,0,0)({0}S:S$c$0$0({1}SC:U),Z,0,0)]
T:Fefm8_usbdint$__00000001[({0}S:S$bmRequestType$0$0({1}ST__00000002:S),Z,0,0)({1}S:S$bRequest$0$0({1}SC:U),Z,0,0)({2}S:S$wValue$0$0({2}SI:U),Z,0,0)({4}S:S$wIndex$0$0({2}SI:U),Z,0,0)({6}S:S$wLength$0$0({2}SI:U),Z,0,0)]
T:Fefm8_usbdint$__00000011[({0}S:S$callback$0$0({1}SB0$1:U),Z,0,0)({0}S:S$outPacketPending$0$0({1}SB1$1:U),Z,0,0)({0}S:S$inPacketPending$0$0({1}SB2$1:U),Z,0,0)({0}S:S$waitForRead$0$0({1}SB3$1:U),Z,0,0)]
T:Fefm8_usbdint$__00000002[({0}S:S$Recipient$0$0({1}SB0$5:U),Z,0,0)({0}S:S$Type$0$0({1}SB5$2:U),Z,0,0)({0}S:S$Direction$0$0({1}SB7$1:U),Z,0,0)]
T:Fefm8_usbdint$__00000012[({0}S:S$configurationValue$0$0({1}SC:U),Z,0,0)({1}S:S$numberOfStrings$0$0({1}SC:U),Z,0,0)({2}S:S$state$0$0({1}SC:U),Z,0,0)({3}S:S$savedState$0$0({1}SC:U),Z,0,0)({4}S:S$setup$0$0({8}ST__00000001:S),Z,0,0)({12}S:S$ep0String$0$0({1}ST__00000013:S),Z,0,0)({13}S:S$ep0$0$0({7}ST__00000009:S),Z,0,0)({20}S:S$ep1in$0$0({7}ST__00000009:S),Z,0,0)({27}S:S$ep1out$0$0({7}ST__00000009:S),Z,0,0)({34}S:S$deviceDescriptor$0$0({3}DG,ST__00000004:S),Z,0,0)({37}S:S$configDescriptor$0$0({3}DG,ST__00000005:S),Z,0,0)({40}S:S$stringDescriptors$0$0({3}DG,DG,DG,SC:U),Z,0,0)]
T:Fefm8_usbdint$__00000003[({0}S:S$setup$0$0({8}ST__00000001:S),Z,0,0)({0}S:S$c$0$0({8}DA8d,SC:U),Z,0,0)({0}S:S$i$0$0({8}DA4d,SI:U),Z,0,0)]
T:Fefm8_usbdint$__00000013[({0}S:S$encoding$0$0({1}ST__00000014:S),Z,0,0)({0}S:S$c$0$0({1}SC:U),Z,0,0)]
T:Fefm8_usbdint$__00000004[({0}S:S$bLength$0$0({1}SC:U),Z,0,0)({1}S:S$bDescriptorType$0$0({1}SC:U),Z,0,0)({2}S:S$bcdUSB$0$0({2}SI:U),Z,0,0)({4}S:S$bDeviceClass$0$0({1}SC:U),Z,0,0)({5}S:S$bDeviceSubClass$0$0({1}SC:U),Z,0,0)({6}S:S$bDeviceProtocol$0$0({1}SC:U),Z,0,0)({7}S:S$bMaxPacketSize0$0$0({1}SC:U),Z,0,0)({8}S:S$idVendor$0$0({2}SI:U),Z,0,0)({10}S:S$idProduct$0$0({2}SI:U),Z,0,0)({12}S:S$bcdDevice$0$0({2}SI:U),Z,0,0)({14}S:S$iManufacturer$0$0({1}SC:U),Z,0,0)({15}S:S$iProduct$0$0({1}SC:U),Z,0,0)({16}S:S$iSerialNumber$0$0({1}SC:U),Z,0,0)({17}S:S$bNumConfigurations$0$0({1}SC:U),Z,0,0)]
T:Fefm8_usbdint$__00000014[({0}S:S$type$0$0({1}SB0$7:U),Z,0,0)({0}S:S$init$0$0({1}SB7$1:U),Z,0,0)]
T:Fefm8_usbdint$__00000005[({0}S:S$bLength$0$0({1}SC:U),Z,0,0)({1}S:S$bDescriptorType$0$0({1}SC:U),Z,0,0)({2}S:S$wTotalLength$0$0({2}SI:U),Z,0,0)({4}S:S$bNumInterfaces$0$0({1}SC:U),Z,0,0)({5}S:S$bConfigurationValue$0$0({1}SC:U),Z,0,0)({6}S:S$iConfiguration$0$0({1}SC:U),Z,0,0)({7}S:S$bmAttributes$0$0({1}SC:U),Z,0,0)({8}S:S$bMaxPower$0$0({1}SC:U),Z,0,0)]
T:Fefm8_usbdint$__00000006[({0}S:S$bLength$0$0({1}SC:U),Z,0,0)({1}S:S$bDescriptorType$0$0({1}SC:U),Z,0,0)({2}S:S$bInterfaceNumber$0$0({1}SC:U),Z,0,0)({3}S:S$bAlternateSetting$0$0({1}SC:U),Z,0,0)({4}S:S$bNumEndpoints$0$0({1}SC:U),Z,0,0)({5}S:S$bInterfaceClass$0$0({1}SC:U),Z,0,0)({6}S:S$bInterfaceSubClass$0$0({1}SC:U),Z,0,0)({7}S:S$bInterfaceProtocol$0$0({1}SC:U),Z,0,0)({8}S:S$iInterface$0$0({1}SC:U),Z,0,0)]
T:Fefm8_usbdint$__00000007[({0}S:S$bLength$0$0({1}SC:U),Z,0,0)({1}S:S$bDescriptorType$0$0({1}SC:U),Z,0,0)({2}S:S$bEndpointAddress$0$0({1}SC:U),Z,0,0)({3}S:S$bmAttributes$0$0({1}SC:U),Z,0,0)({4}S:S$wMaxPacketSize$0$0({2}SI:U),Z,0,0)({6}S:S$bInterval$0$0({1}SC:U),Z,0,0)]
T:Fefm8_usbdint$__00000008[({0}S:S$deviceDescriptor$0$0({3}DG,ST__00000004:S),Z,0,0)({3}S:S$configDescriptor$0$0({3}DG,SC:U),Z,0,0)({6}S:S$stringDescriptors$0$0({3}DG,DG,DG,SC:U),Z,0,0)({9}S:S$numberOfStrings$0$0({1}SC:U),Z,0,0)]
T:Fefm8_usbdint$__00000009[({0}S:S$buf$0$0({3}DG,SC:U),Z,0,0)({3}S:S$remaining$0$0({2}SI:U),Z,0,0)({5}S:S$state$0$0({1}SC:U),Z,0,0)({6}S:S$misc$0$0({1}ST__00000010:S),Z,0,0)]
S:G$myUsbDevice$0$0({43}ST__00000012:S),F,0,0
S:G$ACC$0$0({1}SC:U),I,0,0
S:G$ADC0AC$0$0({1}SC:U),I,0,0
S:G$ADC0CF$0$0({1}SC:U),I,0,0
S:G$ADC0CN0$0$0({1}SC:U),I,0,0
S:G$ADC0CN1$0$0({1}SC:U),I,0,0
S:G$ADC0GTH$0$0({1}SC:U),I,0,0
S:G$ADC0GTL$0$0({1}SC:U),I,0,0
S:G$ADC0H$0$0({1}SC:U),I,0,0
S:G$ADC0L$0$0({1}SC:U),I,0,0
S:G$ADC0LTH$0$0({1}SC:U),I,0,0
S:G$ADC0LTL$0$0({1}SC:U),I,0,0
S:G$ADC0MX$0$0({1}SC:U),I,0,0
S:G$ADC0PWR$0$0({1}SC:U),I,0,0
S:G$ADC0TK$0$0({1}SC:U),I,0,0
S:G$B$0$0({1}SC:U),I,0,0
S:G$CKCON0$0$0({1}SC:U),I,0,0
S:G$CKCON1$0$0({1}SC:U),I,0,0
S:G$CLKSEL$0$0({1}SC:U),I,0,0
S:G$CMP0CN0$0$0({1}SC:U),I,0,0
S:G$CMP0CN1$0$0({1}SC:U),I,0,0
S:G$CMP0MD$0$0({1}SC:U),I,0,0
S:G$CMP0MX$0$0({1}SC:U),I,0,0
S:G$CMP1CN0$0$0({1}SC:U),I,0,0
S:G$CMP1CN1$0$0({1}SC:U),I,0,0
S:G$CMP1MD$0$0({1}SC:U),I,0,0
S:G$CMP1MX$0$0({1}SC:U),I,0,0
S:G$CRC0CN0$0$0({1}SC:U),I,0,0
S:G$CRC0CN1$0$0({1}SC:U),I,0,0
S:G$CRC0CNT$0$0({1}SC:U),I,0,0
S:G$CRC0DAT$0$0({1}SC:U),I,0,0
S:G$CRC0FLIP$0$0({1}SC:U),I,0,0
S:G$CRC0IN$0$0({1}SC:U),I,0,0
S:G$CRC0ST$0$0({1}SC:U),I,0,0
S:G$DERIVID$0$0({1}SC:U),I,0,0
S:G$DEVICEID$0$0({1}SC:U),I,0,0
S:G$DPH$0$0({1}SC:U),I,0,0
S:G$DPL$0$0({1}SC:U),I,0,0
S:G$EIE1$0$0({1}SC:U),I,0,0
S:G$EIE2$0$0({1}SC:U),I,0,0
S:G$EIP1$0$0({1}SC:U),I,0,0
S:G$EIP1H$0$0({1}SC:U),I,0,0
S:G$EIP2$0$0({1}SC:U),I,0,0
S:G$EIP2H$0$0({1}SC:U),I,0,0
S:G$EMI0CN$0$0({1}SC:U),I,0,0
S:G$FLKEY$0$0({1}SC:U),I,0,0
S:G$HFO0CAL$0$0({1}SC:U),I,0,0
S:G$HFO1CAL$0$0({1}SC:U),I,0,0
S:G$HFOCN$0$0({1}SC:U),I,0,0
S:G$I2C0CN0$0$0({1}SC:U),I,0,0
S:G$I2C0DIN$0$0({1}SC:U),I,0,0
S:G$I2C0DOUT$0$0({1}SC:U),I,0,0
S:G$I2C0FCN0$0$0({1}SC:U),I,0,0
S:G$I2C0FCN1$0$0({1}SC:U),I,0,0
S:G$I2C0FCT$0$0({1}SC:U),I,0,0
S:G$I2C0SLAD$0$0({1}SC:U),I,0,0
S:G$I2C0STAT$0$0({1}SC:U),I,0,0
S:G$IE$0$0({1}SC:U),I,0,0
S:G$IP$0$0({1}SC:U),I,0,0
S:G$IPH$0$0({1}SC:U),I,0,0
S:G$IT01CF$0$0({1}SC:U),I,0,0
S:G$LFO0CN$0$0({1}SC:U),I,0,0
S:G$P0$0$0({1}SC:U),I,0,0
S:G$P0MASK$0$0({1}SC:U),I,0,0
S:G$P0MAT$0$0({1}SC:U),I,0,0
S:G$P0MDIN$0$0({1}SC:U),I,0,0
S:G$P0MDOUT$0$0({1}SC:U),I,0,0
S:G$P0SKIP$0$0({1}SC:U),I,0,0
S:G$P1$0$0({1}SC:U),I,0,0
S:G$P1MASK$0$0({1}SC:U),I,0,0
S:G$P1MAT$0$0({1}SC:U),I,0,0
S:G$P1MDIN$0$0({1}SC:U),I,0,0
S:G$P1MDOUT$0$0({1}SC:U),I,0,0
S:G$P1SKIP$0$0({1}SC:U),I,0,0
S:G$P2$0$0({1}SC:U),I,0,0
S:G$P2MASK$0$0({1}SC:U),I,0,0
S:G$P2MAT$0$0({1}SC:U),I,0,0
S:G$P2MDIN$0$0({1}SC:U),I,0,0
S:G$P2MDOUT$0$0({1}SC:U),I,0,0
S:G$P2SKIP$0$0({1}SC:U),I,0,0
S:G$P3$0$0({1}SC:U),I,0,0
S:G$P3MDIN$0$0({1}SC:U),I,0,0
S:G$P3MDOUT$0$0({1}SC:U),I,0,0
S:G$PCA0CENT$0$0({1}SC:U),I,0,0
S:G$PCA0CLR$0$0({1}SC:U),I,0,0
S:G$PCA0CN0$0$0({1}SC:U),I,0,0
S:G$PCA0CPH0$0$0({1}SC:U),I,0,0
S:G$PCA0CPH1$0$0({1}SC:U),I,0,0
S:G$PCA0CPH2$0$0({1}SC:U),I,0,0
S:G$PCA0CPL0$0$0({1}SC:U),I,0,0
S:G$PCA0CPL1$0$0({1}SC:U),I,0,0
S:G$PCA0CPL2$0$0({1}SC:U),I,0,0
S:G$PCA0CPM0$0$0({1}SC:U),I,0,0
S:G$PCA0CPM1$0$0({1}SC:U),I,0,0
S:G$PCA0CPM2$0$0({1}SC:U),I,0,0
S:G$PCA0H$0$0({1}SC:U),I,0,0
S:G$PCA0L$0$0({1}SC:U),I,0,0
S:G$PCA0MD$0$0({1}SC:U),I,0,0
S:G$PCA0POL$0$0({1}SC:U),I,0,0
S:G$PCA0PWM$0$0({1}SC:U),I,0,0
S:G$PCON0$0$0({1}SC:U),I,0,0
S:G$PCON1$0$0({1}SC:U),I,0,0
S:G$PFE0CN$0$0({1}SC:U),I,0,0
S:G$PRTDRV$0$0({1}SC:U),I,0,0
S:G$PSCTL$0$0({1}SC:U),I,0,0
S:G$PSW$0$0({1}SC:U),I,0,0
S:G$REF0CN$0$0({1}SC:U),I,0,0
S:G$REG0CN$0$0({1}SC:U),I,0,0
S:G$REG1CN$0$0({1}SC:U),I,0,0
S:G$REVID$0$0({1}SC:U),I,0,0
S:G$RSTSRC$0$0({1}SC:U),I,0,0
S:G$SBCON1$0$0({1}SC:U),I,0,0
S:G$SBRLH1$0$0({1}SC:U),I,0,0
S:G$SBRLL1$0$0({1}SC:U),I,0,0
S:G$SBUF0$0$0({1}SC:U),I,0,0
S:G$SBUF1$0$0({1}SC:U),I,0,0
S:G$SCON0$0$0({1}SC:U),I,0,0
S:G$SCON1$0$0({1}SC:U),I,0,0
S:G$SFRPAGE$0$0({1}SC:U),I,0,0
S:G$SFRPGCN$0$0({1}SC:U),I,0,0
S:G$SFRSTACK$0$0({1}SC:U),I,0,0
S:G$SMB0ADM$0$0({1}SC:U),I,0,0
S:G$SMB0ADR$0$0({1}SC:U),I,0,0
S:G$SMB0CF$0$0({1}SC:U),I,0,0
S:G$SMB0CN0$0$0({1}SC:U),I,0,0
S:G$SMB0DAT$0$0({1}SC:U),I,0,0
S:G$SMB0FCN0$0$0({1}SC:U),I,0,0
S:G$SMB0FCN1$0$0({1}SC:U),I,0,0
S:G$SMB0FCT$0$0({1}SC:U),I,0,0
S:G$SMB0RXLN$0$0({1}SC:U),I,0,0
S:G$SMB0TC$0$0({1}SC:U),I,0,0
S:G$SMOD1$0$0({1}SC:U),I,0,0
S:G$SP$0$0({1}SC:U),I,0,0
S:G$SPI0CFG$0$0({1}SC:U),I,0,0
S:G$SPI0CKR$0$0({1}SC:U),I,0,0
S:G$SPI0CN0$0$0({1}SC:U),I,0,0
S:G$SPI0DAT$0$0({1}SC:U),I,0,0
S:G$SPI0FCN0$0$0({1}SC:U),I,0,0
S:G$SPI0FCN1$0$0({1}SC:U),I,0,0
S:G$SPI0FCT$0$0({1}SC:U),I,0,0
S:G$TCON$0$0({1}SC:U),I,0,0
S:G$TH0$0$0({1}SC:U),I,0,0
S:G$TH1$0$0({1}SC:U),I,0,0
S:G$TL0$0$0({1}SC:U),I,0,0
S:G$TL1$0$0({1}SC:U),I,0,0
S:G$TMOD$0$0({1}SC:U),I,0,0
S:G$TMR2CN0$0$0({1}SC:U),I,0,0
S:G$TMR2CN1$0$0({1}SC:U),I,0,0
S:G$TMR2H$0$0({1}SC:U),I,0,0
S:G$TMR2L$0$0({1}SC:U),I,0,0
S:G$TMR2RLH$0$0({1}SC:U),I,0,0
S:G$TMR2RLL$0$0({1}SC:U),I,0,0
S:G$TMR3CN0$0$0({1}SC:U),I,0,0
S:G$TMR3CN1$0$0({1}SC:U),I,0,0
S:G$TMR3H$0$0({1}SC:U),I,0,0
S:G$TMR3L$0$0({1}SC:U),I,0,0
S:G$TMR3RLH$0$0({1}SC:U),I,0,0
S:G$TMR3RLL$0$0({1}SC:U),I,0,0
S:G$TMR4CN0$0$0({1}SC:U),I,0,0
S:G$TMR4CN1$0$0({1}SC:U),I,0,0
S:G$TMR4H$0$0({1}SC:U),I,0,0
S:G$TMR4L$0$0({1}SC:U),I,0,0
S:G$TMR4RLH$0$0({1}SC:U),I,0,0
S:G$TMR4RLL$0$0({1}SC:U),I,0,0
S:G$UART1FCN0$0$0({1}SC:U),I,0,0
S:G$UART1FCN1$0$0({1}SC:U),I,0,0
S:G$UART1FCT$0$0({1}SC:U),I,0,0
S:G$UART1LIN$0$0({1}SC:U),I,0,0
S:G$USB0ADR$0$0({1}SC:U),I,0,0
S:G$USB0AEC$0$0({1}SC:U),I,0,0
S:G$USB0CDCF$0$0({1}SC:U),I,0,0
S:G$USB0CDCN$0$0({1}SC:U),I,0,0
S:G$USB0CDSTA$0$0({1}SC:U),I,0,0
S:G$USB0CF$0$0({1}SC:U),I,0,0
S:G$USB0DAT$0$0({1}SC:U),I,0,0
S:G$USB0XCN$0$0({1}SC:U),I,0,0
S:G$VDM0CN$0$0({1}SC:U),I,0,0
S:G$WDTCN$0$0({1}SC:U),I,0,0
S:G$XBR0$0$0({1}SC:U),I,0,0
S:G$XBR1$0$0({1}SC:U),I,0,0
S:G$XBR2$0$0({1}SC:U),I,0,0
S:G$ADC0GT$0$0({2}SI:U),I,0,0
S:G$ADC0$0$0({2}SI:U),I,0,0
S:G$ADC0LT$0$0({2}SI:U),I,0,0
S:G$DP$0$0({2}SI:U),I,0,0
S:G$PCA0CP0$0$0({2}SI:U),I,0,0
S:G$PCA0CP1$0$0({2}SI:U),I,0,0
S:G$PCA0CP2$0$0({2}SI:U),I,0,0
S:G$PCA0$0$0({2}SI:U),I,0,0
S:G$SBRL1$0$0({2}SI:U),I,0,0
S:G$TMR2$0$0({2}SI:U),I,0,0
S:G$TMR2RL$0$0({2}SI:U),I,0,0
S:G$TMR3$0$0({2}SI:U),I,0,0
S:G$TMR3RL$0$0({2}SI:U),I,0,0
S:G$TMR4$0$0({2}SI:U),I,0,0
S:G$TMR4RL$0$0({2}SI:U),I,0,0
S:G$_XPAGE$0$0({1}SC:U),I,0,0
S:G$ACC_ACC0$0$0({1}SX:U),J,0,0
S:G$ACC_ACC1$0$0({1}SX:U),J,0,0
S:G$ACC_ACC2$0$0({1}SX:U),J,0,0
S:G$ACC_ACC3$0$0({1}SX:U),J,0,0
S:G$ACC_ACC4$0$0({1}SX:U),J,0,0
S:G$ACC_ACC5$0$0({1}SX:U),J,0,0
S:G$ACC_ACC6$0$0({1}SX:U),J,0,0
S:G$ACC_ACC7$0$0({1}SX:U),J,0,0
S:G$ADC0CN0_ADCM0$0$0({1}SX:U),J,0,0
S:G$ADC0CN0_ADCM1$0$0({1}SX:U),J,0,0
S:G$ADC0CN0_ADCM2$0$0({1}SX:U),J,0,0
S:G$ADC0CN0_ADWINT$0$0({1}SX:U),J,0,0
S:G$ADC0CN0_ADBUSY$0$0({1}SX:U),J,0,0
S:G$ADC0CN0_ADINT$0$0({1}SX:U),J,0,0
S:G$ADC0CN0_ADBMEN$0$0({1}SX:U),J,0,0
S:G$ADC0CN0_ADEN$0$0({1}SX:U),J,0,0
S:G$B_B0$0$0({1}SX:U),J,0,0
S:G$B_B1$0$0({1}SX:U),J,0,0
S:G$B_B2$0$0({1}SX:U),J,0,0
S:G$B_B3$0$0({1}SX:U),J,0,0
S:G$B_B4$0$0({1}SX:U),J,0,0
S:G$B_B5$0$0({1}SX:U),J,0,0
S:G$B_B6$0$0({1}SX:U),J,0,0
S:G$B_B7$0$0({1}SX:U),J,0,0
S:G$IE_EX0$0$0({1}SX:U),J,0,0
S:G$IE_ET0$0$0({1}SX:U),J,0,0
S:G$IE_EX1$0$0({1}SX:U),J,0,0
S:G$IE_ET1$0$0({1}SX:U),J,0,0
S:G$IE_ES0$0$0({1}SX:U),J,0,0
S:G$IE_ET2$0$0({1}SX:U),J,0,0
S:G$IE_ESPI0$0$0({1}SX:U),J,0,0
S:G$IE_EA$0$0({1}SX:U),J,0,0
S:G$IP_PX0$0$0({1}SX:U),J,0,0
S:G$IP_PT0$0$0({1}SX:U),J,0,0
S:G$IP_PX1$0$0({1}SX:U),J,0,0
S:G$IP_PT1$0$0({1}SX:U),J,0,0
S:G$IP_PS0$0$0({1}SX:U),J,0,0
S:G$IP_PT2$0$0({1}SX:U),J,0,0
S:G$IP_PSPI0$0$0({1}SX:U),J,0,0
S:G$P0_B0$0$0({1}SX:U),J,0,0
S:G$P0_B1$0$0({1}SX:U),J,0,0
S:G$P0_B2$0$0({1}SX:U),J,0,0
S:G$P0_B3$0$0({1}SX:U),J,0,0
S:G$P0_B4$0$0({1}SX:U),J,0,0
S:G$P0_B5$0$0({1}SX:U),J,0,0
S:G$P0_B6$0$0({1}SX:U),J,0,0
S:G$P0_B7$0$0({1}SX:U),J,0,0
S:G$P1_B0$0$0({1}SX:U),J,0,0
S:G$P1_B1$0$0({1}SX:U),J,0,0
S:G$P1_B2$0$0({1}SX:U),J,0,0
S:G$P1_B3$0$0({1}SX:U),J,0,0
S:G$P1_B4$0$0({1}SX:U),J,0,0
S:G$P1_B5$0$0({1}SX:U),J,0,0
S:G$P1_B6$0$0({1}SX:U),J,0,0
S:G$P1_B7$0$0({1}SX:U),J,0,0
S:G$P2_B0$0$0({1}SX:U),J,0,0
S:G$P2_B1$0$0({1}SX:U),J,0,0
S:G$P2_B2$0$0({1}SX:U),J,0,0
S:G$P2_B3$0$0({1}SX:U),J,0,0
S:G$P3_B0$0$0({1}SX:U),J,0,0
S:G$P3_B1$0$0({1}SX:U),J,0,0
S:G$PCA0CN0_CCF0$0$0({1}SX:U),J,0,0
S:G$PCA0CN0_CCF1$0$0({1}SX:U),J,0,0
S:G$PCA0CN0_CCF2$0$0({1}SX:U),J,0,0
S:G$PCA0CN0_CR$0$0({1}SX:U),J,0,0
S:G$PCA0CN0_CF$0$0({1}SX:U),J,0,0
S:G$PSW_PARITY$0$0({1}SX:U),J,0,0
S:G$PSW_F1$0$0({1}SX:U),J,0,0
S:G$PSW_OV$0$0({1}SX:U),J,0,0
S:G$PSW_RS0$0$0({1}SX:U),J,0,0
S:G$PSW_RS1$0$0({1}SX:U),J,0,0
S:G$PSW_F0$0$0({1}SX:U),J,0,0
S:G$PSW_AC$0$0({1}SX:U),J,0,0
S:G$PSW_CY$0$0({1}SX:U),J,0,0
S:G$SCON0_RI$0$0({1}SX:U),J,0,0
S:G$SCON0_TI$0$0({1}SX:U),J,0,0
S:G$SCON0_RB8$0$0({1}SX:U),J,0,0
S:G$SCON0_TB8$0$0({1}SX:U),J,0,0
S:G$SCON0_REN$0$0({1}SX:U),J,0,0
S:G$SCON0_MCE$0$0({1}SX:U),J,0,0
S:G$SCON0_SMODE$0$0({1}SX:U),J,0,0
S:G$SCON1_RI$0$0({1}SX:U),J,0,0
S:G$SCON1_TI$0$0({1}SX:U),J,0,0
S:G$SCON1_RBX$0$0({1}SX:U),J,0,0
S:G$SCON1_TBX$0$0({1}SX:U),J,0,0
S:G$SCON1_REN$0$0({1}SX:U),J,0,0
S:G$SCON1_PERR$0$0({1}SX:U),J,0,0
S:G$SCON1_OVR$0$0({1}SX:U),J,0,0
S:G$SMB0CN0_SI$0$0({1}SX:U),J,0,0
S:G$SMB0CN0_ACK$0$0({1}SX:U),J,0,0
S:G$SMB0CN0_ARBLOST$0$0({1}SX:U),J,0,0
S:G$SMB0CN0_ACKRQ$0$0({1}SX:U),J,0,0
S:G$SMB0CN0_STO$0$0({1}SX:U),J,0,0
S:G$SMB0CN0_STA$0$0({1}SX:U),J,0,0
S:G$SMB0CN0_TXMODE$0$0({1}SX:U),J,0,0
S:G$SMB0CN0_MASTER$0$0({1}SX:U),J,0,0
S:G$SPI0CN0_SPIEN$0$0({1}SX:U),J,0,0
S:G$SPI0CN0_TXNF$0$0({1}SX:U),J,0,0
S:G$SPI0CN0_NSSMD0$0$0({1}SX:U),J,0,0
S:G$SPI0CN0_NSSMD1$0$0({1}SX:U),J,0,0
S:G$SPI0CN0_RXOVRN$0$0({1}SX:U),J,0,0
S:G$SPI0CN0_MODF$0$0({1}SX:U),J,0,0
S:G$SPI0CN0_WCOL$0$0({1}SX:U),J,0,0
S:G$SPI0CN0_SPIF$0$0({1}SX:U),J,0,0
S:G$TCON_IT0$0$0({1}SX:U),J,0,0
S:G$TCON_IE0$0$0({1}SX:U),J,0,0
S:G$TCON_IT1$0$0({1}SX:U),J,0,0
S:G$TCON_IE1$0$0({1}SX:U),J,0,0
S:G$TCON_TR0$0$0({1}SX:U),J,0,0
S:G$TCON_TF0$0$0({1}SX:U),J,0,0
S:G$TCON_TR1$0$0({1}SX:U),J,0,0
S:G$TCON_TF1$0$0({1}SX:U),J,0,0
S:G$TMR2CN0_T2XCLK0$0$0({1}SX:U),J,0,0
S:G$TMR2CN0_T2XCLK1$0$0({1}SX:U),J,0,0
S:G$TMR2CN0_TR2$0$0({1}SX:U),J,0,0
S:G$TMR2CN0_T2SPLIT$0$0({1}SX:U),J,0,0
S:G$TMR2CN0_TF2CEN$0$0({1}SX:U),J,0,0
S:G$TMR2CN0_TF2LEN$0$0({1}SX:U),J,0,0
S:G$TMR2CN0_TF2L$0$0({1}SX:U),J,0,0
S:G$TMR2CN0_TF2H$0$0({1}SX:U),J,0,0
S:G$TMR4CN0_T4XCLK0$0$0({1}SX:U),J,0,0
S:G$TMR4CN0_T4XCLK1$0$0({1}SX:U),J,0,0
S:G$TMR4CN0_TR4$0$0({1}SX:U),J,0,0
S:G$TMR4CN0_T4SPLIT$0$0({1}SX:U),J,0,0
S:G$TMR4CN0_TF4CEN$0$0({1}SX:U),J,0,0
S:G$TMR4CN0_TF4LEN$0$0({1}SX:U),J,0,0
S:G$TMR4CN0_TF4L$0$0({1}SX:U),J,0,0
S:G$TMR4CN0_TF4H$0$0({1}SX:U),J,0,0
S:G$UART1FCN1_RIE$0$0({1}SX:U),J,0,0
S:G$UART1FCN1_RXTO0$0$0({1}SX:U),J,0,0
S:G$UART1FCN1_RXTO1$0$0({1}SX:U),J,0,0
S:G$UART1FCN1_RFRQ$0$0({1}SX:U),J,0,0
S:G$UART1FCN1_TIE$0$0({1}SX:U),J,0,0
S:G$UART1FCN1_TXHOLD$0$0({1}SX:U),J,0,0
S:G$UART1FCN1_TXNF$0$0({1}SX:U),J,0,0
S:G$UART1FCN1_TFRQ$0$0({1}SX:U),J,0,0
S:G$memcpy$0$0({2}DF,DG,SV:S),C,0,0
S:G$memmove$0$0({2}DF,DG,SV:S),C,0,0
S:G$strcpy$0$0({2}DF,DG,SC:U),C,0,0
S:G$strncpy$0$0({2}DF,DG,SC:U),C,0,0
S:G$strcat$0$0({2}DF,DG,SC:U),C,0,0
S:G$strncat$0$0({2}DF,DG,SC:U),C,0,0
S:G$memcmp$0$0({2}DF,SI:S),C,0,0
S:G$strcmp$0$0({2}DF,SI:S),C,0,0
S:G$strncmp$0$0({2}DF,SI:S),C,0,0
S:G$strxfrm$0$0({2}DF,SI:U),C,0,0
S:G$memchr$0$0({2}DF,DG,SV:S),C,0,0
S:G$strchr$0$0({2}DF,DG,SC:U),C,0,0
S:G$strcspn$0$0({2}DF,SI:U),C,0,0
S:G$strpbrk$0$0({2}DF,DG,SC:U),C,0,0
S:G$strrchr$0$0({2}DF,DG,SC:U),C,0,0
S:G$strspn$0$0({2}DF,SI:U),C,0,0
S:G$strstr$0$0({2}DF,DG,SC:U),C,0,0
S:G$strtok$0$0({2}DF,DG,SC:U),C,0,0
S:G$memset$0$0({2}DF,DG,SV:S),C,0,0
S:G$strlen$0$0({2}DF,SI:U),C,0,0
S:G$USBD_SetUsbState$0$0({2}DF,SV:S),C,0,0
S:G$USBDCH9_SetupCmd$0$0({2}DF,SC:U),C,0,0
S:G$USBD_AbortAllTransfers$0$0({2}DF,SV:S),C,0,0
S:G$USBD_AbortTransfer$0$0({2}DF,SC:S),C,0,0
S:G$USBD_Connect$0$0({2}DF,SV:S),C,0,0
S:G$USBD_Disconnect$0$0({2}DF,SV:S),C,0,0
S:G$USBD_EpIsBusy$0$0({2}DF,SB0$1:U),C,0,0
S:G$USBD_GetUsbState$0$0({2}DF,SC:U),C,0,0
S:G$USBD_Init$0$0({2}DF,SC:S),C,0,0
S:G$USBD_Read$0$0({2}DF,SC:S),C,0,0
S:G$USBD_RemoteWakeup$0$0({2}DF,SC:S),C,0,0
S:G$USBD_StallEp$0$0({2}DF,SC:S),C,0,0
S:G$USBD_Stop$0$0({2}DF,SV:S),C,0,0
S:G$USBD_Suspend$0$0({2}DF,SV:S),C,0,0
S:G$USBD_UnStallEp$0$0({2}DF,SC:S),C,0,0
S:G$USBD_Write$0$0({2}DF,SC:S),C,0,0
S:G$USBD_EnterHandler$0$0({2}DF,SV:S),C,0,0
S:G$USBD_ExitHandler$0$0({2}DF,SV:S),C,0,0
S:G$USBD_ResetCb$0$0({2}DF,SV:S),C,0,0
S:G$USBD_SofCb$0$0({2}DF,SV:S),C,0,0
S:G$USBD_DeviceStateChangeCb$0$0({2}DF,SV:S),C,0,0
S:G$USBD_IsSelfPoweredCb$0$0({2}DF,SB0$1:U),C,0,0
S:G$USBD_SetupCmdCb$0$0({2}DF,SC:U),C,0,0
S:G$USBD_SetInterfaceCb$0$0({2}DF,SC:U),C,0,0
S:G$USBD_RemoteWakeupCb$0$0({2}DF,SB0$1:U),C,0,0
S:G$USBD_RemoteWakeupDelay$0$0({2}DF,SV:S),C,0,0
S:G$USBD_Run$0$0({2}DF,SV:S),C,0,0
S:G$USBD_XferCompleteCb$0$0({2}DF,SI:U),C,0,0
S:G$USB_ReadFIFO$0$0({2}DF,SV:S),C,0,0
S:G$USB_WriteFIFO$0$0({2}DF,SV:S),C,0,0
S:G$USB_GetIntsEnabled$0$0({2}DF,SB0$1:U),C,0,0
S:G$USB_IsRegulatorEnabled$0$0({2}DF,SB0$1:U),C,0,0
S:G$USB_IsPrefetchEnabled$0$0({2}DF,SB0$1:U),C,0,0
S:G$USB_SuspendOscillator$0$0({2}DF,SV:S),C,0,0
S:G$USB_SetIndex$0$0({2}DF,SV:S),C,0,0
S:G$USB_GetCommonInts$0$0({2}DF,SC:U),C,0,0
S:G$USB_GetInInts$0$0({2}DF,SC:U),C,0,0
S:G$USB_GetOutInts$0$0({2}DF,SC:U),C,0,0
S:G$USB_GetIndex$0$0({2}DF,SC:U),C,0,0
S:G$USB_IsSuspended$0$0({2}DF,SB0$1:U),C,0,0
S:G$USB_GetSetupEnd$0$0({2}DF,SB0$1:U),C,0,0
S:G$USB_Ep0SentStall$0$0({2}DF,SB0$1:U),C,0,0
S:G$USB_Ep0InPacketReady$0$0({2}DF,SB0$1:U),C,0,0
S:G$USB_Ep0OutPacketReady$0$0({2}DF,SB0$1:U),C,0,0
S:G$USB_Ep0GetCount$0$0({2}DF,SC:U),C,0,0
S:G$USB_EpnInGetSentStall$0$0({2}DF,SB0$1:U),C,0,0
S:G$USB_EpnGetInPacketReady$0$0({2}DF,SB0$1:U),C,0,0
S:G$USB_EpnOutGetSentStall$0$0({2}DF,SB0$1:U),C,0,0
S:G$USB_EpnGetOutPacketReady$0$0({2}DF,SB0$1:U),C,0,0
S:G$USB_EpOutGetCount$0$0({2}DF,SI:U),C,0,0
S:G$USB_GetSofNumber$0$0({2}DF,SI:U),C,0,0
S:G$USB_AbortInEp$0$0({2}DF,SV:S),C,0,0
S:G$USB_AbortOutEp$0$0({2}DF,SV:S),C,0,0
S:G$USB_ActivateEp$0$0({2}DF,SV:S),C,0,0
S:G$handleUsbIn1Int$0$0({2}DF,SV:S),C,0,0
S:G$handleUsbOut1Int$0$0({2}DF,SV:S),C,0,0
S:G$usbIrqHandler$0$0({2}DF,SV:S),C,0,0
S:G$forceModuleLoad_usbint$0$0({2}DF,SV:S),C,0,0
S:G$txZero$0$0({2}DA2d,SC:U),D,0,0
|
-----------------------------------------------------------------------
-- util-commands-consoles -- Console interface
-- Copyright (C) 2014, 2015, 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.Strings;
package body Util.Commands.Consoles is
-- ------------------------------
-- Print the title for the given field and setup the associated field size.
-- ------------------------------
procedure Print_Title (Console : in out Console_Type;
Field : in Field_Type;
Title : in String;
Length : in Positive) is
begin
Console.Sizes (Field) := Length;
if Console.Field_Count >= 1 then
Console.Cols (Field) := Console.Cols (Console.Fields (Console.Field_Count))
+ Console.Sizes (Console.Fields (Console.Field_Count));
else
Console.Cols (Field) := 1;
end if;
Console.Field_Count := Console.Field_Count + 1;
Console.Fields (Console.Field_Count) := Field;
Console_Type'Class (Console).Print_Title (Field, Title);
end Print_Title;
-- ------------------------------
-- Format the integer and print it for the given field.
-- ------------------------------
procedure Print_Field (Console : in out Console_Type;
Field : in Field_Type;
Value : in Integer;
Justify : in Justify_Type := J_LEFT) is
Val : constant String := Util.Strings.Image (Value);
begin
Console_Type'Class (Console).Print_Field (Field, Val, Justify);
end Print_Field;
-- ------------------------------
-- Format the integer and print it for the given field.
-- ------------------------------
procedure Print_Field (Console : in out Console_Type;
Field : in Field_Type;
Value : in Ada.Strings.Unbounded.Unbounded_String;
Justify : in Justify_Type := J_LEFT) is
Item : String := Ada.Strings.Unbounded.To_String (Value);
Size : constant Natural := Console.Sizes (Field);
begin
if Size <= Item'Length then
Item (Item'Last - Size + 2 .. Item'Last - Size + 4) := "...";
Console_Type'Class (Console).Print_Field (Field,
Item (Item'Last - Size + 2 .. Item'Last));
else
Console_Type'Class (Console).Print_Field (Field, Item, Justify);
end if;
end Print_Field;
-- ------------------------------
-- Get the field count that was setup through the Print_Title calls.
-- ------------------------------
function Get_Field_Count (Console : in Console_Type) return Natural is
begin
return Console.Field_Count;
end Get_Field_Count;
-- ------------------------------
-- Reset the field count.
-- ------------------------------
procedure Clear_Fields (Console : in out Console_Type) is
begin
Console.Field_Count := 0;
end Clear_Fields;
end Util.Commands.Consoles;
|
-- Copyright 2017 Jeff Foley. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
name = "HackerOne"
type = "scrape"
function start()
setratelimit(1)
end
function vertical(ctx, domain)
scrape(ctx, {url=buildurl(domain)})
end
function buildurl(domain)
return "http://h1.nobbd.de/search.php?q=" .. domain
end
|
------------------------------------------------------------------------------
-- --
-- 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 League.Strings.Internals;
with Matreshka.Internals.Strings;
with AMF.Visitors.UML_Iterators;
with AMF.Visitors.UML_Visitors;
package body AMF.Internals.UML_Generalization_Sets is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Generalization_Set_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_Generalization_Set
(AMF.UML.Generalization_Sets.UML_Generalization_Set_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Generalization_Set_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_Generalization_Set
(AMF.UML.Generalization_Sets.UML_Generalization_Set_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Generalization_Set_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_Generalization_Set
(Visitor,
AMF.UML.Generalization_Sets.UML_Generalization_Set_Access (Self),
Control);
end if;
end Visit_Element;
------------------------
-- Get_Generalization --
------------------------
overriding function Get_Generalization
(Self : not null access constant UML_Generalization_Set_Proxy)
return AMF.UML.Generalizations.Collections.Set_Of_UML_Generalization is
begin
return
AMF.UML.Generalizations.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Generalization
(Self.Element)));
end Get_Generalization;
---------------------
-- Get_Is_Covering --
---------------------
overriding function Get_Is_Covering
(Self : not null access constant UML_Generalization_Set_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Covering
(Self.Element);
end Get_Is_Covering;
---------------------
-- Set_Is_Covering --
---------------------
overriding procedure Set_Is_Covering
(Self : not null access UML_Generalization_Set_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Covering
(Self.Element, To);
end Set_Is_Covering;
---------------------
-- Get_Is_Disjoint --
---------------------
overriding function Get_Is_Disjoint
(Self : not null access constant UML_Generalization_Set_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Disjoint
(Self.Element);
end Get_Is_Disjoint;
---------------------
-- Set_Is_Disjoint --
---------------------
overriding procedure Set_Is_Disjoint
(Self : not null access UML_Generalization_Set_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Disjoint
(Self.Element, To);
end Set_Is_Disjoint;
-------------------
-- Get_Powertype --
-------------------
overriding function Get_Powertype
(Self : not null access constant UML_Generalization_Set_Proxy)
return AMF.UML.Classifiers.UML_Classifier_Access is
begin
return
AMF.UML.Classifiers.UML_Classifier_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Powertype
(Self.Element)));
end Get_Powertype;
-------------------
-- Set_Powertype --
-------------------
overriding procedure Set_Powertype
(Self : not null access UML_Generalization_Set_Proxy;
To : AMF.UML.Classifiers.UML_Classifier_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Powertype
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Powertype;
---------------------------
-- Get_Client_Dependency --
---------------------------
overriding function Get_Client_Dependency
(Self : not null access constant UML_Generalization_Set_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_Generalization_Set_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_Generalization_Set_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_Generalization_Set_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_Generalization_Set_Proxy)
return AMF.Optional_String is
begin
declare
use type Matreshka.Internals.Strings.Shared_String_Access;
Aux : constant Matreshka.Internals.Strings.Shared_String_Access
:= AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
begin
if Aux = null then
return (Is_Empty => True);
else
return (False, League.Strings.Internals.Create (Aux));
end if;
end;
end Get_Qualified_Name;
-----------------------------------
-- Get_Owning_Template_Parameter --
-----------------------------------
overriding function Get_Owning_Template_Parameter
(Self : not null access constant UML_Generalization_Set_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
begin
return
AMF.UML.Template_Parameters.UML_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Template_Parameter
(Self.Element)));
end Get_Owning_Template_Parameter;
-----------------------------------
-- Set_Owning_Template_Parameter --
-----------------------------------
overriding procedure Set_Owning_Template_Parameter
(Self : not null access UML_Generalization_Set_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Owning_Template_Parameter;
----------------------------
-- Get_Template_Parameter --
----------------------------
overriding function Get_Template_Parameter
(Self : not null access constant UML_Generalization_Set_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
begin
return
AMF.UML.Template_Parameters.UML_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter
(Self.Element)));
end Get_Template_Parameter;
----------------------------
-- Set_Template_Parameter --
----------------------------
overriding procedure Set_Template_Parameter
(Self : not null access UML_Generalization_Set_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Template_Parameter;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant UML_Generalization_Set_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_Generalization_Set_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_Generalization_Set_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_Generalization_Set_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_Generalization_Set_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_Generalization_Set_Proxy.Namespace";
return Namespace (Self);
end Namespace;
------------------------
-- Is_Compatible_With --
------------------------
overriding function Is_Compatible_With
(Self : not null access constant UML_Generalization_Set_Proxy;
P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented");
raise Program_Error with "Unimplemented procedure UML_Generalization_Set_Proxy.Is_Compatible_With";
return Is_Compatible_With (Self, P);
end Is_Compatible_With;
---------------------------
-- Is_Template_Parameter --
---------------------------
overriding function Is_Template_Parameter
(Self : not null access constant UML_Generalization_Set_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented");
raise Program_Error with "Unimplemented procedure UML_Generalization_Set_Proxy.Is_Template_Parameter";
return Is_Template_Parameter (Self);
end Is_Template_Parameter;
end AMF.Internals.UML_Generalization_Sets;
|
--------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2020, Luke A. Guest
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
with Interfaces.C;
package body SDL.Power is
package C renames Interfaces.C;
procedure Info (Data : in out Battery_Info) is
function SDL_GetPowerInfo (Seconds, Percent : out C.int) return State with
Import => True,
Convention => C,
External_Name => "SDL_GetPowerInfo";
Seconds, Percent : C.int;
begin
Data.Power_State := SDL_GetPowerInfo (Seconds, Percent);
if Seconds = -1 then
Data.Time_Valid := False;
else
Data.Time_Valid := True;
Data.Time := SDL.Power.Seconds (Seconds);
end if;
if Percent = -1 then
Data.Percentage_Valid := False;
else
Data.Percentage_Valid := True;
Data.Percent := Percentage (Percent);
end if;
end Info;
end SDL.Power;
|
package body impact.d3.collision.Algorithm.empty
is
function to_empty_Algorithm (ci : in AlgorithmConstructionInfo) return Item'Class
is
Self : Item;
begin
define (self, ci);
return Self;
end to_empty_Algorithm;
overriding procedure destruct (Self : in out Item)
is
pragma Unreferenced (Self);
begin
return;
end destruct;
overriding procedure processCollision (Self : in out Item; body0, body1 : access impact.d3.Object.item'Class;
dispatchInfo : in impact.d3.Dispatcher.DispatcherInfo;
resultOut : out impact.d3.collision.manifold_Result.item)
is
pragma Unreferenced (resultOut, Self, body0, body1, dispatchInfo);
begin
return;
end processCollision;
overriding function calculateTimeOfImpact (Self : in Item; body0, body1 : access impact.d3.Object.item'Class;
dispatchInfo : in impact.d3.Dispatcher.DispatcherInfo;
resultOut : access impact.d3.collision.manifold_Result.item) return math.Real
is
pragma Unreferenced (Self, body0, body1, dispatchInfo, resultOut);
begin
return 1.0;
end calculateTimeOfImpact;
overriding procedure getAllContactManifolds (Self : in out Item; manifoldArray : out impact.d3.collision.Algorithm.btManifoldArray)
is
begin
raise Program_Error with "TBD";
null;
end getAllContactManifolds;
--- Create Functions
--
overriding function CreateCollisionAlgorithm (Self : in CreateFunc; ci : in AlgorithmConstructionInfo;
body0, body1 : access impact.d3.Object.item'Class) return impact.d3.Dispatcher.Algorithm_view
is
pragma Unreferenced (Self, body0, body1);
begin
return new Item'(Item (to_empty_Algorithm (ci)));
end CreateCollisionAlgorithm;
end impact.d3.collision.Algorithm.empty;
|
------------------------------------------------------------------------------
-- --
-- Giza --
-- --
-- Copyright (C) 2015 Fabien Chouteau (chouteau@adacore.com) --
-- --
-- --
-- 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 Giza.Timers;
package body Giza.Widget.Scrolling is
---------------
-- Triggered --
---------------
overriding
function Triggered (This : Repeat_Event) return Boolean is
Reset : Boolean := False;
begin
if This.Scroll = null then
return False;
end if;
if This.Scroll.Up.Active then
Reset := True;
This.Scroll.Go_Up;
elsif This.Scroll.Down.Active then
Reset := True;
This.Scroll.Go_Down;
end if;
if Reset then
-- Reset timer
Giza.Timers.Set_Timer (This'Unchecked_Access,
Clock + This.Scroll.Repeat_Time);
end if;
return Reset;
end Triggered;
---------------
-- Set_Dirty --
---------------
overriding
procedure Set_Dirty (This : in out Instance;
Dirty : Boolean := True)
is
begin
Set_Dirty (Parent (This), Dirty);
This.Up.Set_Dirty (Dirty);
This.Down.Set_Dirty (Dirty);
if This.Child /= null then
This.Child.Set_Dirty (Dirty);
end if;
end Set_Dirty;
----------
-- Draw --
----------
overriding
procedure Draw (This : in out Instance;
Ctx : in out Context.Class;
Force : Boolean := True)
is
begin
if not This.Dirty and then not Force then
return;
end if;
if This.Child /= null then
Ctx.Save;
Ctx.Set_Bounds (((0, 0), This.Get_Size));
Ctx.Save;
Ctx.Translate (This.Child_Pos);
This.Child.Draw (Ctx);
Ctx.Restore;
if This.Child_Pos.Y < 0 then
Ctx.Save;
This.Up.Draw (Ctx, True);
Ctx.Restore;
end if;
if This.Child_Pos.Y > -(This.Child.Size.H - This.Get_Size.H) then
Ctx.Save;
Ctx.Translate ((0, This.Get_Size.H - This.Down.Get_Size.H));
This.Down.Draw (Ctx, True);
Ctx.Restore;
end if;
Ctx.Restore;
end if;
end Draw;
-----------------------
-- On_Position_Event --
-----------------------
overriding
function On_Position_Event
(This : in out Instance;
Evt : Position_Event_Ref;
Pos : Point_T) return Boolean
is
begin
if This.Child /= null then
if This.Child_Pos.Y < 0
and then
Evt.Pos.Y < This.Up.Get_Size.H
then
if This.Up.On_Position_Event (Evt, Pos)
and then
This.Up.Active
then
This.Go_Up;
Giza.Timers.Set_Timer
(This.Repeat_Evt'Unchecked_Access, Clock + This.Repeat_Time);
return True;
end if;
elsif This.Child_Pos.Y > -(This.Child.Size.H - This.Get_Size.H)
and then
Evt.Pos.Y > This.Get_Size.H - This.Up.Get_Size.H
then
if This.Down.On_Position_Event
(Evt, Pos - (0, This.Get_Size.H - This.Up.Get_Size.H))
and then
This.Down.Active
then
This.Go_Down;
This.Repeat_Evt.Scroll := This'Unchecked_Access;
Giza.Timers.Set_Timer
(This.Repeat_Evt'Unchecked_Access, Clock + This.Repeat_Time);
return True;
end if;
else
return This.Child.On_Position_Event (Evt, Pos - This.Child_Pos);
end if;
end if;
return False;
end On_Position_Event;
--------------
-- On_Event --
--------------
overriding
function On_Event
(This : in out Instance;
Evt : Event_Not_Null_Ref) return Boolean
is
begin
return (This.Child = null or else This.Child.On_Event (Evt))
or This.Up.On_Event (Evt) or This.Down.On_Event (Evt);
end On_Event;
---------------
-- Set_Child --
---------------
procedure Set_Child (This : in out Instance;
Child : not null Widget.Reference) is
begin
This.Child := Child;
This.Up.Set_Size ((This.Get_Size.W, This.Get_Size.H / 10));
This.Down.Set_Size ((This.Get_Size.W, This.Get_Size.H / 10));
end Set_Child;
-----------
-- Go_Up --
-----------
procedure Go_Up (This : in out Instance) is
begin
if This.Child /= null then
This.Child_Pos := This.Child_Pos + Size_T'(0, 5);
if This.Child_Pos.Y > 0 then
This.Child_Pos.Y := 0;
end if;
end if;
end Go_Up;
-------------
-- Go_Down --
-------------
procedure Go_Down (This : in out Instance) is
begin
if This.Child /= null then
This.Child_Pos := This.Child_Pos - (0, 5);
if This.Child_Pos.Y < This.Get_Size.H - This.Child.Get_Size.H then
This.Child_Pos.Y := This.Get_Size.H - This.Child.Get_Size.H;
end if;
end if;
end Go_Down;
-------------
-- Go_Left --
-------------
procedure Go_Left (This : in out Instance) is
begin
if This.Child /= null then
This.Child_Pos := This.Child_Pos + Size_T'(5, 0);
if This.Child_Pos.X > 0 then
This.Child_Pos.X := 0;
end if;
end if;
end Go_Left;
--------------
-- Go_Right --
--------------
procedure Go_Right (This : in out Instance) is
begin
if This.Child /= null then
This.Child_Pos := This.Child_Pos - (5, 0);
if This.Child_Pos.X < (This.Get_Size.W - This.Child.Get_Size.W) then
This.Child_Pos.X := (This.Get_Size.W - This.Child.Get_Size.W);
end if;
end if;
end Go_Right;
end Giza.Widget.Scrolling;
|
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Stocks_Materiel; use Stocks_Materiel;
-- Auteur:
-- Gérer un stock de matériel informatique.
--
procedure Scenario_Stock is
Mon_Stock : T_Stock;
begin
-- Créer un stock vide
Creer (Mon_Stock);
pragma Assert (Nb_Materiels (Mon_Stock) = 0);
-- Enregistrer quelques matériels
Enregistrer (Mon_Stock, 1012, UNITE_CENTRALE, 2016);
pragma Assert (Nb_Materiels (Mon_Stock) = 1);
Enregistrer (Mon_Stock, 2143, ECRAN, 2016);
pragma Assert (Nb_Materiels (Mon_Stock) = 2);
Enregistrer (Mon_Stock, 3001, IMPRIMANTE, 2017);
pragma Assert (Nb_Materiels (Mon_Stock) = 3);
Enregistrer (Mon_Stock, 3012, UNITE_CENTRALE, 2017);
pragma Assert (Nb_Materiels (Mon_Stock) = 4);
end Scenario_Stock;
|
-- Standard Ada library specification
-- Copyright (c) 2003-2018 Maxim Reznik <reznikmm@gmail.com>
-- Copyright (c) 2004-2016 AXE Consultants
-- Copyright (c) 2004, 2005, 2006 Ada-Europe
-- Copyright (c) 2000 The MITRE Corporation, Inc.
-- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
-- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
---------------------------------------------------------------------------
with Ada.IO_Exceptions;
package Ada.Wide_Text_IO is
type File_Type is limited private;
type File_Mode is (In_File, Out_File, Append_File);
type Count is range 0 .. implementation_defined;
subtype Positive_Count is Count range 1 .. Count'Last;
Unbounded : constant Count := 0; -- line and page length
subtype Field is Integer range 0 .. implementation_defined;
subtype Number_Base is Integer range 2 .. 16;
type Type_Set is (Lower_Case, Upper_Case);
-- File Management
procedure Create (File : in out File_Type;
Mode : in File_Mode := Out_File;
Name : in String := "";
Form : in String := "");
procedure Open (File : in out File_Type;
Mode : in File_Mode;
Name : in String;
Form : in String := "");
procedure Close (File : in out File_Type);
procedure Delete (File : in out File_Type);
procedure Reset (File : in out File_Type; Mode : in File_Mode);
procedure Reset (File : in out File_Type);
function Mode (File : in File_Type) return File_Mode;
function Name (File : in File_Type) return String;
function Form (File : in File_Type) return String;
function Is_Open(File : in File_Type) return Boolean;
-- Control of default input and output files
procedure Set_Input (File : in File_Type);
procedure Set_Output(File : in File_Type);
procedure Set_Error (File : in File_Type);
function Standard_Input return File_Type;
function Standard_Output return File_Type;
function Standard_Error return File_Type;
function Current_Input return File_Type;
function Current_Output return File_Type;
function Current_Error return File_Type;
type File_Access is access constant File_Type;
function Standard_Input return File_Access;
function Standard_Output return File_Access;
function Standard_Error return File_Access;
function Current_Input return File_Access;
function Current_Output return File_Access;
function Current_Error return File_Access;
-- Buffer control
procedure Flush (File : in out File_Type);
procedure Flush;
-- Specification of line and page lengths
procedure Set_Line_Length (File : in File_Type; To : in Count);
procedure Set_Line_Length (To : in Count);
procedure Set_Page_Length (File : in File_Type; To : in Count);
procedure Set_Page_Length (To : in Count);
function Line_Length (File : in File_Type) return Count;
function Line_Length return Count;
function Page_Length (File : in File_Type) return Count;
function Page_Length return Count;
-- Column, Line, and Page Control
procedure New_Line (File : in File_Type;
Spacing : in Positive_Count := 1);
procedure New_Line (Spacing : in Positive_Count := 1);
procedure Skip_Line (File : in File_Type;
Spacing : in Positive_Count := 1);
procedure Skip_Line (Spacing : in Positive_Count := 1);
function End_Of_Line (File : in File_Type) return Boolean;
function End_Of_Line return Boolean;
procedure New_Page (File : in File_Type);
procedure New_Page;
procedure Skip_Page (File : in File_Type);
procedure Skip_Page;
function End_Of_Page (File : in File_Type) return Boolean;
function End_Of_Page return Boolean;
function End_Of_File (File : in File_Type) return Boolean;
function End_Of_File return Boolean;
procedure Set_Col (File : in File_Type; To : in Positive_Count);
procedure Set_Col (To : in Positive_Count);
procedure Set_Line (File : in File_Type; To : in Positive_Count);
procedure Set_Line (To : in Positive_Count);
function Col (File : in File_Type) return Positive_Count;
function Col return Positive_Count;
function Line (File : in File_Type) return Positive_Count;
function Line return Positive_Count;
function Page (File : in File_Type) return Positive_Count;
function Page return Positive_Count;
-- Character Input-Output
procedure Get (File : in File_Type; Item : out Wide_Character);
procedure Get (Item : out Wide_Character);
procedure Put (File : in File_Type; Item : in Wide_Character);
procedure Put (Item : in Wide_Character);
procedure Look_Ahead (File : in File_Type;
Item : out Wide_Character;
End_Of_Line : out Boolean);
procedure Look_Ahead (Item : out Wide_Character;
End_Of_Line : out Boolean);
procedure Get_Immediate (File : in File_Type;
Item : out Wide_Character);
procedure Get_Immediate (Item : out Wide_Character);
procedure Get_Immediate (File : in File_Type;
Item : out Wide_Character;
Available : out Boolean);
procedure Get_Immediate (Item : out Wide_Character;
Available : out Boolean);
-- String Input-Output
procedure Get (File : in File_Type; Item : out Wide_String);
procedure Get (Item : out Wide_String);
procedure Put (File : in File_Type; Item : in Wide_String);
procedure Put (Item : in Wide_String);
procedure Get_Line (File : in File_Type;
Item : out Wide_String;
Last : out Natural);
procedure Get_Line (Item : out Wide_String; Last : out Natural);
function Get_Line(File : in File_Type) return Wide_String;
function Get_Line return Wide_String;
procedure Put_Line (File : in File_Type; Item : in Wide_String);
procedure Put_Line (Item : in Wide_String);
-- Generic packages for Input-Output of Integer Types
generic
type Num is range <>;
package Integer_IO is
Default_Width : Field := Num'Width;
Default_Base : Number_Base := 10;
procedure Get (File : in File_Type;
Item : out Num;
Width : in Field := 0);
procedure Get (Item : out Num;
Width : in Field := 0);
procedure Put (File : in File_Type;
Item : in Num;
Width : in Field := Default_Width;
Base : in Number_Base := Default_Base);
procedure Put (Item : in Num;
Width : in Field := Default_Width;
Base : in Number_Base := Default_Base);
procedure Get (From : in Wide_String;
Item : out Num;
Last : out Positive);
procedure Put (To : out Wide_String;
Item : in Num;
Base : in Number_Base := Default_Base);
end Integer_IO;
generic
type Num is mod <>;
package Modular_IO is
Default_Width : Field := Num'Width;
Default_Base : Number_Base := 10;
procedure Get (File : in File_Type;
Item : out Num;
Width : in Field := 0);
procedure Get (Item : out Num;
Width : in Field := 0);
procedure Put (File : in File_Type;
Item : in Num;
Width : in Field := Default_Width;
Base : in Number_Base := Default_Base);
procedure Put (Item : in Num;
Width : in Field := Default_Width;
Base : in Number_Base := Default_Base);
procedure Get (From : in Wide_String;
Item : out Num;
Last : out Positive);
procedure Put (To : out Wide_String;
Item : in Num;
Base : in Number_Base := Default_Base);
end Modular_IO;
-- Generic packages for Input-Output of Real Types
generic
type Num is digits <>;
package Float_IO is
Default_Fore : Field := 2;
Default_Aft : Field := Num'Digits-1;
Default_Exp : Field := 3;
procedure Get (File : in File_Type;
Item : out Num;
Width : in Field := 0);
procedure Get (Item : out Num;
Width : in Field := 0);
procedure Put (File : in File_Type;
Item : in Num;
Fore : in Field := Default_Fore;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp);
procedure Put (Item : in Num;
Fore : in Field := Default_Fore;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp);
procedure Get (From : in Wide_String;
Item : out Num;
Last : out Positive);
procedure Put (To : out Wide_String;
Item : in Num;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp);
end Float_IO;
generic
type Num is delta <>;
package Fixed_IO is
Default_Fore : Field := Num'Fore;
Default_Aft : Field := Num'Aft;
Default_Exp : Field := 0;
procedure Get (File : in File_Type;
Item : out Num;
Width : in Field := 0);
procedure Get (Item : out Num;
Width : in Field := 0);
procedure Put (File : in File_Type;
Item : in Num;
Fore : in Field := Default_Fore;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp);
procedure Put (Item : in Num;
Fore : in Field := Default_Fore;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp);
procedure Get (From : in Wide_String;
Item : out Num;
Last : out Positive);
procedure Put (To : out Wide_String;
Item : in Num;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp);
end Fixed_IO;
generic
type Num is delta <> digits <>;
package Decimal_IO is
Default_Fore : Field := Num'Fore;
Default_Aft : Field := Num'Aft;
Default_Exp : Field := 0;
procedure Get (File : in File_Type;
Item : out Num;
Width : in Field := 0);
procedure Get (Item : out Num;
Width : in Field := 0);
procedure Put (File : in File_Type;
Item : in Num;
Fore : in Field := Default_Fore;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp);
procedure Put (Item : in Num;
Fore : in Field := Default_Fore;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp);
procedure Get (From : in Wide_String;
Item : out Num;
Last : out Positive);
procedure Put (To : out Wide_String;
Item : in Num;
Aft : in Field := Default_Aft;
Exp : in Field := Default_Exp);
end Decimal_IO;
-- Generic package for Input-Output of Enumeration Types
generic
type Enum is (<>);
package Enumeration_IO is
Default_Width : Field := 0;
Default_Setting : Type_Set := Upper_Case;
procedure Get (File : in File_Type;
Item : out Enum);
procedure Get (Item : out Enum);
procedure Put (File : in File_Type;
Item : in Enum;
Width : in Field := Default_Width;
Set : in Type_Set := Default_Setting);
procedure Put (Item : in Enum;
Width : in Field := Default_Width;
Set : in Type_Set := Default_Setting);
procedure Get (From : in Wide_String;
Item : out Enum;
Last : out Positive);
procedure Put (To : out Wide_String;
Item : in Enum;
Set : in Type_Set := Default_Setting);
end Enumeration_IO;
-- Exceptions
Status_Error : exception renames IO_Exceptions.Status_Error;
Mode_Error : exception renames IO_Exceptions.Mode_Error;
Name_Error : exception renames IO_Exceptions.Name_Error;
Use_Error : exception renames IO_Exceptions.Use_Error;
Device_Error : exception renames IO_Exceptions.Device_Error;
End_Error : exception renames IO_Exceptions.End_Error;
Data_Error : exception renames IO_Exceptions.Data_Error;
Layout_Error : exception renames IO_Exceptions.Layout_Error;
private
type File_Type is limited null record;
end Ada.Wide_Text_IO;
|
package Discr23_Pkg is
subtype Size_Range is Positive range 1 .. 256;
type Text (Size : Size_Range) is
record
Characters : String( 1.. Size);
end record;
function Get return Text;
end Discr23_Pkg;
|
-- Copyright 2008-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 Pck; use Pck;
procedure Foo is
begin
if Is_First then
Increment;
end if;
end Foo;
|
-- This spec has been automatically generated from FE310.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
-- E31 CPU Coreplex, high-performance, 32-bit RV32IMAC core
--
package FE310_SVD is
pragma Preelaborate;
--------------------
-- Base addresses --
--------------------
GPIO0_Base : constant System.Address :=
System'To_Address (16#10012000#);
UART0_Base : constant System.Address :=
System'To_Address (16#10013000#);
UART1_Base : constant System.Address :=
System'To_Address (16#10023000#);
PWM0_Base : constant System.Address :=
System'To_Address (16#10015000#);
PWM1_Base : constant System.Address :=
System'To_Address (16#10025000#);
PWM2_Base : constant System.Address :=
System'To_Address (16#10035000#);
end FE310_SVD;
|
with System;
with Ada.Unchecked_Conversion;
package body ACO.Utils.Byte_Order is
use type System.Bit_Order;
function Unchecked_To_Unsigned_16 is
new Ada.Unchecked_Conversion (Octets_2, Unsigned_16);
function Unchecked_To_Unsigned_32 is
new Ada.Unchecked_Conversion (Octets_4, Unsigned_32);
function Unchecked_To_Octets_2 is
new Ada.Unchecked_Conversion (Unsigned_16, Octets_2);
function Unchecked_To_Octets_4 is
new Ada.Unchecked_Conversion (Unsigned_32, Octets_4);
function Swap_Bus (X : Unsigned_16) return Unsigned_16
is
O : Octets_2 with
Address => X'Address, Alignment => Unsigned_16'Alignment;
begin
if System.Default_Bit_Order = System.Low_Order_First then
return X;
else
return Unchecked_To_Unsigned_16 ((O (1), O (0)));
end if;
end Swap_Bus;
function Swap_Bus (X : Unsigned_32) return Unsigned_32
is
O : Octets_4 with
Address => X'Address, Alignment => Unsigned_32'Alignment;
begin
if System.Default_Bit_Order = System.Low_Order_First then
return X;
else
return Unchecked_To_Unsigned_32 ((O (3), O (2), O (1), O (0)));
end if;
end Swap_Bus;
function Swap_Bus (X : Octets_2) return Unsigned_16
is
begin
if System.Default_Bit_Order = System.Low_Order_First then
return Unchecked_To_Unsigned_16 (X);
else
return Unchecked_To_Unsigned_16 ((X (1), X (0)));
end if;
end Swap_Bus;
function Swap_Bus (X : Octets_4) return Unsigned_32
is
begin
if System.Default_Bit_Order = System.Low_Order_First then
return Unchecked_To_Unsigned_32 (X);
else
return Unchecked_To_Unsigned_32 ((X (3), X (2), X (1), X (0)));
end if;
end Swap_Bus;
function Swap_Bus (X : Unsigned_16) return Octets_2
is
begin
if System.Default_Bit_Order = System.Low_Order_First then
return Unchecked_To_Octets_2 (X);
else
declare
O : constant Octets_2 := Unchecked_To_Octets_2 (X);
begin
return (O (1), O (0));
end;
end if;
end Swap_Bus;
function Swap_Bus (X : Unsigned_32) return Octets_4
is
begin
if System.Default_Bit_Order = System.Low_Order_First then
return Unchecked_To_Octets_4 (X);
else
declare
O : constant Octets_4 := Unchecked_To_Octets_4 (X);
begin
return (O (3), O (2), O (1), O (0));
end;
end if;
end Swap_Bus;
procedure Swap (X : in out Octets)
is
Tmp : Unsigned_8;
I : Natural := 0;
begin
while X'First + I < X'Last - I loop
Tmp := X (X'First + I);
X (X'First + I) := X (X'Last - I);
X (X'Last - I) := Tmp;
I := I + 1;
end loop;
end Swap;
function Swap_Bus (X : in Octets) return Octets
is
begin
if System.Default_Bit_Order = System.Low_Order_First then
return X;
else
declare
Tmp : Octets := X;
begin
Swap (Tmp);
return Tmp;
end;
end if;
end Swap_Bus;
end ACO.Utils.Byte_Order;
|
-- Copyright (c) 2015-2017 Maxim Reznik <reznikmm@gmail.com>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Ada.Containers.Hashed_Maps;
with League.Strings.Hash;
package body Incr.Ada_Lexers is
package body Tables is separate;
package Maps is new Ada.Containers.Hashed_Maps
(Key_Type => League.Strings.Universal_String,
Element_Type => Token,
Hash => League.Strings.Hash,
Equivalent_Keys => League.Strings."=",
"=" => Lexers.Batch_Lexers."=");
Default : constant Lexers.Batch_Lexers.State := 0;
Apostrophe : constant Lexers.Batch_Lexers.State := 87;
Map : Maps.Map;
-- Our batch lexer return token codes in this order:
Convert : constant array (Token range 1 .. 107) of Token :=
(Arrow_Token,
Double_Dot_Token,
Double_Star_Token,
Assignment_Token,
Inequality_Token,
Greater_Or_Equal_Token,
Less_Or_Equal_Token,
Left_Label_Token,
Right_Label_Token,
Box_Token,
Ampersand_Token,
Apostrophe_Token,
Left_Parenthesis_Token,
Right_Parenthesis_Token,
Star_Token,
Plus_Token,
Comma_Token,
Hyphen_Token,
Dot_Token,
Slash_Token,
Colon_Token,
Semicolon_Token,
Less_Token,
Equal_Token,
Greater_Token,
Vertical_Line_Token,
Identifier_Token,
Numeric_Literal_Token,
Character_Literal_Token,
String_Literal_Token,
Comment_Token,
Space_Token,
New_Line_Token,
Error_Token,
Abort_Token,
Abs_Token,
Abstract_Token,
Accept_Token,
Access_Token,
Aliased_Token,
All_Token,
And_Token,
Array_Token,
At_Token,
Begin_Token,
Body_Token,
Case_Token,
Constant_Token,
Declare_Token,
Delay_Token,
Delta_Token,
Digits_Token,
Do_Token,
Else_Token,
Elsif_Token,
End_Token,
Entry_Token,
Exception_Token,
Exit_Token,
For_Token,
Function_Token,
Generic_Token,
Goto_Token,
If_Token,
In_Token,
Interface_Token,
Is_Token,
Limited_Token,
Loop_Token,
Mod_Token,
New_Token,
Not_Token,
Null_Token,
Of_Token,
Or_Token,
Others_Token,
Out_Token,
Overriding_Token,
Package_Token,
Pragma_Token,
Private_Token,
Procedure_Token,
Protected_Token,
Raise_Token,
Range_Token,
Record_Token,
Rem_Token,
Renames_Token,
Requeue_Token,
Return_Token,
Reverse_Token,
Select_Token,
Separate_Token,
Some_Token,
Subtype_Token,
Synchronized_Token,
Tagged_Token,
Task_Token,
Terminate_Token,
Then_Token,
Type_Token,
Until_Token,
Use_Token,
When_Token,
While_Token,
With_Token,
Xor_Token);
overriding procedure Get_Token
(Self : access Batch_Lexer;
Result : out Lexers.Batch_Lexers.Rule_Index)
is
use type Lexers.Batch_Lexers.Rule_Index;
use type Lexers.Batch_Lexers.State;
Start : constant Lexers.Batch_Lexers.State := Self.Get_Start_Condition;
begin
if Start = Apostrophe then
Self.Set_Start_Condition (Default);
end if;
Base_Lexers.Batch_Lexer (Self.all).Get_Token (Result);
if Result = 34 then
Result := Vertical_Line_Token;
elsif Result = 35 then
Result := Numeric_Literal_Token;
elsif Result = 36 then
Result := String_Literal_Token;
elsif Result > 36 then
Result := Error_Token;
elsif Result = 27 then
declare
Text : constant League.Strings.Universal_String :=
Self.Get_Text.To_Casefold;
Cursor : constant Maps.Cursor := Map.Find (Text);
begin
if Maps.Has_Element (Cursor) then
Result := Maps.Element (Cursor);
if Start = Apostrophe and Result /= Range_Token then
Result := Identifier_Token;
end if;
else
Result := Identifier_Token;
end if;
end;
elsif Result > 0 then
Result := Convert (Result);
end if;
if Result = Apostrophe_Token then
Self.Set_Start_Condition (Apostrophe);
else
Self.Set_Start_Condition (Default);
end if;
end Get_Token;
function "+" (V : Wide_Wide_String) return League.Strings.Universal_String
renames League.Strings.To_Universal_String;
begin
Map.Insert (+"abort", Abort_Token);
Map.Insert (+"abs", Abs_Token);
Map.Insert (+"abstract", Abstract_Token);
Map.Insert (+"accept", Accept_Token);
Map.Insert (+"access", Access_Token);
Map.Insert (+"aliased", Aliased_Token);
Map.Insert (+"all", All_Token);
Map.Insert (+"and", And_Token);
Map.Insert (+"array", Array_Token);
Map.Insert (+"at", At_Token);
Map.Insert (+"begin", Begin_Token);
Map.Insert (+"body", Body_Token);
Map.Insert (+"case", Case_Token);
Map.Insert (+"constant", Constant_Token);
Map.Insert (+"declare", Declare_Token);
Map.Insert (+"delay", Delay_Token);
Map.Insert (+"delta", Delta_Token);
Map.Insert (+"digits", Digits_Token);
Map.Insert (+"do", Do_Token);
Map.Insert (+"else", Else_Token);
Map.Insert (+"elsif", Elsif_Token);
Map.Insert (+"end", End_Token);
Map.Insert (+"entry", Entry_Token);
Map.Insert (+"exception", Exception_Token);
Map.Insert (+"exit", Exit_Token);
Map.Insert (+"for", For_Token);
Map.Insert (+"function", Function_Token);
Map.Insert (+"generic", Generic_Token);
Map.Insert (+"goto", Goto_Token);
Map.Insert (+"if", If_Token);
Map.Insert (+"in", In_Token);
Map.Insert (+"interface", Interface_Token);
Map.Insert (+"is", Is_Token);
Map.Insert (+"limited", Limited_Token);
Map.Insert (+"loop", Loop_Token);
Map.Insert (+"mod", Mod_Token);
Map.Insert (+"new", New_Token);
Map.Insert (+"not", Not_Token);
Map.Insert (+"null", Null_Token);
Map.Insert (+"of", Of_Token);
Map.Insert (+"or", Or_Token);
Map.Insert (+"others", Others_Token);
Map.Insert (+"out", Out_Token);
Map.Insert (+"overriding", Overriding_Token);
Map.Insert (+"package", Package_Token);
Map.Insert (+"pragma", Pragma_Token);
Map.Insert (+"private", Private_Token);
Map.Insert (+"procedure", Procedure_Token);
Map.Insert (+"protected", Protected_Token);
Map.Insert (+"raise", Raise_Token);
Map.Insert (+"range", Range_Token);
Map.Insert (+"record", Record_Token);
Map.Insert (+"rem", Rem_Token);
Map.Insert (+"renames", Renames_Token);
Map.Insert (+"requeue", Requeue_Token);
Map.Insert (+"return", Return_Token);
Map.Insert (+"reverse", Reverse_Token);
Map.Insert (+"select", Select_Token);
Map.Insert (+"separate", Separate_Token);
Map.Insert (+"some", Some_Token);
Map.Insert (+"subtype", Subtype_Token);
Map.Insert (+"synchronized", Synchronized_Token);
Map.Insert (+"tagged", Tagged_Token);
Map.Insert (+"task", Task_Token);
Map.Insert (+"terminate", Terminate_Token);
Map.Insert (+"then", Then_Token);
Map.Insert (+"type", Type_Token);
Map.Insert (+"until", Until_Token);
Map.Insert (+"use", Use_Token);
Map.Insert (+"when", When_Token);
Map.Insert (+"while", While_Token);
Map.Insert (+"with", With_Token);
Map.Insert (+"xor", Xor_Token);
end Incr.Ada_Lexers;
|
-- Euler1 in Ada
with Ada.Text_IO;
with Ada.Integer_Text_IO;
procedure Euler1_1 is
function Euler(size : in Integer) return Integer is
result: Integer;
begin
result := 0;
for i in 1..size-1 loop
if i mod 3 = 0 or i mod 5 = 0 then
result := result + i;
end if;
end loop;
return result;
end Euler;
begin
Ada.Text_IO.Put ("Euler1 = ");
Ada.Integer_Text_IO.Put (Integer( Euler(1000) ), 6);
end Euler1_1;
|
------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A 4 G . E X P R _ S E M --
-- --
-- B o d y --
-- --
-- Copyright (C) 1995-2012, Free Software Foundation, Inc. --
-- --
-- ASIS-for-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 --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY 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 ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 51 Franklin --
-- Street, Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by AdaCore --
-- (http://www.adacore.com). --
-- --
------------------------------------------------------------------------------
with Ada.Wide_Characters.Unicode;
with Asis.Clauses; use Asis.Clauses;
with Asis.Compilation_Units; use Asis.Compilation_Units;
with Asis.Declarations; use Asis.Declarations;
with Asis.Elements; use Asis.Elements;
with Asis.Expressions; use Asis.Expressions;
with Asis.Extensions; use Asis.Extensions;
with Asis.Iterator; use Asis.Iterator;
with Asis.Statements; use Asis.Statements;
with Asis.Set_Get; use Asis.Set_Get;
with A4G.A_Debug; use A4G.A_Debug;
with A4G.A_Output; use A4G.A_Output;
with A4G.A_Sem; use A4G.A_Sem;
with A4G.A_Stand; use A4G.A_Stand;
with A4G.A_Types; use A4G.A_Types;
with A4G.Asis_Tables; use A4G.Asis_Tables;
with A4G.Contt.UT; use A4G.Contt.UT;
with A4G.Int_Knds; use A4G.Int_Knds;
with A4G.Knd_Conv; use A4G.Knd_Conv;
with A4G.Mapping; use A4G.Mapping;
with Atree; use Atree;
with Einfo; use Einfo;
with Namet; use Namet;
with Nlists; use Nlists;
with Output; use Output;
with Sem_Aux; use Sem_Aux;
with Sinfo; use Sinfo;
with Snames; use Snames;
with Stand; use Stand;
with Types; use Types;
package body A4G.Expr_Sem is
-----------------------
-- Local subprograms --
-----------------------
function Explicit_Type_Declaration (Entity_Node : Node_Id) return Node_Id;
-- Taking the Entity node obtained as a result of some call to Etype
-- function, this function yields the node for corresponding explicit
-- type or subtype declaration. This means that this function traverses all
-- the internal types generated by the compiler.
--
-- In case of an anonymous access type, this function returns the entity
-- node which is created by the compiler for this type (there is no tree
-- type structure for the type declaration in this case), and a caller is
-- responsible for further analysis
--
-- SHOULD WE MOVE THIS FUNCTION IN THE SPEC???
function Explicit_Type_Declaration_Unwound
(Entity_Node : Node_Id;
Reference_Node : Node_Id := Empty)
return Node_Id;
-- Does the same as Explicit_Type_Declaration and unwinds all the
-- subtypings (if any), resulting in a root type declaration.
-- Reference_Node is a node representing a "place" from which this function
-- is called. If the result type is private, but from the "place" of the
-- call the full view is visible, the full view is returned. If
-- Reference_Node is Empty, no private/full view check is made
function Explicit_Type_Declaration_Unwound_Unaccess
(Entity_Node : Node_Id;
Reference_Node : Node_Id := Empty)
return Node_Id;
-- Does the same as Explicit_Type_Declaration_Unwound and in case of access
-- types goes from the access to the designated type. --???
--
-- In case of an anonymous access type returns directly designated type.
function Rewritten_Image (Selector_Name : Node_Id) return Node_Id;
pragma Unreferenced (Rewritten_Image);
-- this is an example of the tricky programming needed because of the
-- tree rewriting. The problem is, that in the original tree structure
-- for a record aggregate a N_Identifier node for a component selector
-- name does not have an Entity field set. So we have to go to the
-- corresponding (that is, to representing the same component selector
-- name) node in the rewritten structure.
--
-- It is an error to use this function for a node which is does not
-- represent a component selector name in the original tree structure
-- for a record aggregate
--
-- This function is not used now, it is replaced by Search_Record_Comp
function Search_Record_Comp (Selector_Name : Node_Id) return Entity_Id;
-- This function looks for the entity node corresponding to a name from a
-- choices list from a record or extension aggregate. The problem here is
-- that an aggregate node is rewritten, and in the original tree structure
-- the nodes corresponding to component names do not have the Entity
-- field set. This function locates the corresponding entity node by
-- detecting the aggregate type and searching the component defining
-- identifier with the same name in the record definition.
-- It might be the case (because of the absence of some semantic
-- information in the tree or because of the ASIS bug) that Selector_Name
-- actually does not represent a name from the aggregate choice list, in
-- this case this function raises Assert_Failure or (if assertions are off)
-- returns the Empty node.
function Get_Statement_Identifier (Def_Id : Node_Id) return Node_Id;
-- For Int_Node which should represent the defining identifier from an
-- implicit declaration of a label (or a statement name?) (otherwise it
-- is an error to use this function), this function returns the "defining"
-- name representing the definition of this statement identifier in the
-- ASIS sense.
function GFP_Declaration (Par_Id : Node_Id) return Node_Id;
-- this is (I hope, temporary) fix for the problem 14: the Entity
-- field is not set for N_Identifier node representing the parameter
-- name in a named generic association, so we need this function to
-- compute the Entity for such an N_Identifier node.
-- ??? what about formal parameters in associations like
-- ??? "*" => Some_Function
--
-- This function is supposed to be called for an actual representing
-- the name of a generic formal parameter in a named formal parameter
-- association (it's an error to call it for any other actual)
function Is_Explicit_Type_Component
(Comp_Def_Name : Node_Id;
Type_Decl : Node_Id)
return Boolean;
-- Expects Comp_Def_Name to be a defining identifier of a record component
-- and Type_Decl to be a type declaration. Checks if Comp_Def_Name denotes
-- a component explicitly declared by this type declaration. (This function
-- is useful for discriminants and components explicitly declared in
-- derived type declarations.
function Is_Type_Discriminant
(Discr_Node : Node_Id;
Type_Node : Node_Id)
return Boolean;
-- Assuming that Discr_Node is N_Defining_Identifier node and Type_Node
-- represents a type declaration, this function checks if Discr_Node is
-- a discriminant of this type (we cannot just use Parent to check this
-- because of tree rewriting for discriminant types.
function Full_View_Visible
(Priv_Type : Node_Id;
Ref : Node_Id)
return Boolean;
-- Assuming that Priv_Type is a node representing a private type
-- declaration, checks, that in place of Ref the full view of the type is
-- visible
function Reset_To_Full_View
(Full_View : Node_Id;
Discr : Node_Id)
return Node_Id;
-- Assuming that Full_View is the full type declaration for some private
-- type and Discr is a defining name of a discriminant of the type
-- (probably, from its private view), this function returns the defining
-- name of this discriminant in the full view
function Is_Part_Of_Defining_Unit_Name (Name_Node : Node_Id) return Boolean;
-- Assuming that Name_Node is of N_Identifier kind, this function checks,
-- if it is a part of a defining program unit name
function Reset_To_Spec (Name_Node : Node_Id) return Node_Id;
-- Assuming that Name_Node is a part of a defining unit name which in turn
-- is a part of a compilation unit body (for such nodes Entity field is not
-- set), this function resets it to the node pointing to the same part of
-- the defining unit name, but in the spec of the corresponding library
-- unit
function Reference_Kind
(Name : Asis.Element)
return Internal_Element_Kinds;
-- If Name is of A_Defining_Name kind then this function returns the kind
-- of An_Expression elements which may be simple-name-form references to
-- the given name (that is, A_Defining_Identifier -> An_Identifier,
-- A_Defining_And_Operator -> An_And_Operator), otherwise returns
-- Not_An_Element. Note, that the result can never be
-- A_Selected_Component, because only references which are simple names
-- are considered.
function Get_Specificed_Component
(Comp : Node_Id;
Rec_Type : Entity_Id)
return Entity_Id;
-- Provided that Comp is the reference to a record component from the
-- component clause being a component of a record representation clause
-- for the record type Rec_Type, this function computes the corresponding
-- component entity
function Get_Entity_From_Long_Name (N : Node_Id) return Entity_Id;
-- Supposing that N denotes some component of a long expanded name
-- and for N and for its prefix the Entity fields are not set, this
-- function computes the corresponding entity node by traversing
-- the "chain" of definitions corresponding to this expanded name
function Get_Rewritten_Discr_Ref (N : Node_Id) return Node_Id;
pragma Unreferenced (Get_Rewritten_Discr_Ref);
-- This function is supposed to be called for a discriminant reference
-- from the discriminant constraint from derived type, in case if the
-- parent type is a task or protected type. In this case
-- N_Subtype_Indication node from the derived type definition is rewritten
-- in a subtype mark pointing to the internal subtype. The original
-- structure is not decorated, so we have to go to the corresponding
-- node in the definition of this internal subtype to get the semantic
-- information. See F407-011
-- Do we need this after fixing the regression caused by K120-031
function Get_Discriminant_From_Type (N : Node_Id) return Entity_Id;
-- Starting from the reference to discriminant in a discriminant
-- constraint, tries to compute the corresponding discriminant entity by
-- getting to the declaration of the corresponding type and traversing
-- its discriminant part.
function Is_Limited_Withed
(E : Entity_Id;
Reference : Asis.Element)
return Boolean;
-- Assuming that Reference is an_Identifier Element and E is the entity
-- node for the entity denoted by Reference, checks if this entity is
-- defined in a compilation unit that is limited withed by the unit
-- containing Reference
function To_Upper_Case (S : Wide_String) return Wide_String;
-- Folds the argument to upper case, may be used for string normalization
-- before comparing strings if the casing is not important for comparing
-- (Copied from ASIS_UL.Misc to avoid dependencies on ASIS UL in "pure"
-- ASIS.
---------------------------------------
-- Character_Literal_Name_Definition --
---------------------------------------
function Character_Literal_Name_Definition
(Reference_Ch : Element)
return Asis.Defining_Name
is
-- for now, the code is very similar to the code
-- for Identifier_Name_Definition. Any aggregation has been
-- put off till everything will work
Arg_Node : Node_Id;
Special_Case : Special_Cases := Not_A_Special_Case;
Result_Element : Asis.Defining_Name := Nil_Element;
Is_Inherited : Boolean := False;
Association_Type : Node_Id := Empty;
Set_Char_Code : Boolean := False;
Result_Node : Node_Id;
Result_Unit : Compilation_Unit;
Result_Kind : constant Internal_Element_Kinds :=
A_Defining_Character_Literal;
begin
-- We have to distinguish and to treat separately four (???)
-- different situations:
--
-- 1. a literal from user-defined character type (fully implemented
-- for now);
--
-- 2. a literal from a type derived from some user-defined character
-- type (not implemented for now as related to Implicit Elements);
--
-- 3. a literal from a character type defined in Standard (not
-- implemented for now);
--
-- 4. a literal from a type derived a character type defined in
-- Standard (not implemented for now as related to Implicit
-- Elements);
Arg_Node := Node (Reference_Ch);
-- if Reference_Ch is a Selector_Name in some N_Expanded_Name,
-- the corresponding Entity field is set not for the Node on which
-- this Reference_En is based, but for the whole expanded name.
-- (The same for Etype) So:
if Nkind (Parent (Arg_Node)) = N_Expanded_Name or else
Nkind (Parent (Arg_Node)) = N_Character_Literal
then
-- the last alternative of the condition corresponds to an expanded
-- name of a predefined character literal or to an expanded name
-- of a literal of a type derived from a predefined character type -
-- such an expanded name is rewritten into (another) "instance"
-- of the same literal
Arg_Node := Parent (Arg_Node);
end if;
Result_Node := Entity (Arg_Node);
-- will be Empty for any character literal belonging to
-- Standard.Character, Standard.Whide_Character or any type
-- derived (directly or indirectly) from any of these types
Association_Type := Etype (Arg_Node);
if No (Result_Node) and then
No (Association_Type) and then
Is_From_Unknown_Pragma (R_Node (Reference_Ch))
then
return Nil_Element;
end if;
if No (Association_Type) then
-- this may be the case if some character literals are
-- rewritten into a string constant
Association_Type := Arg_Node;
while Present (Association_Type) loop
exit when Nkind (Association_Type) = N_String_Literal;
Association_Type := Parent (Association_Type);
end loop;
pragma Assert (Present (Association_Type));
Association_Type := Etype (Association_Type);
Association_Type := Component_Type (Association_Type);
end if;
Association_Type := Explicit_Type_Declaration_Unwound (Association_Type);
if No (Result_Node) then
Set_Char_Code := True;
Result_Node := Association_Type;
Result_Node := Sinfo.Type_Definition (Result_Node);
if Char_Defined_In_Standard (Arg_Node) then
Special_Case := Stand_Char_Literal;
else
Is_Inherited := True;
end if;
elsif not Comes_From_Source (Result_Node) then
Is_Inherited := True;
end if;
if Char_Defined_In_Standard (Arg_Node) then
Result_Unit := Get_Comp_Unit
(Standard_Id, Encl_Cont_Id (Reference_Ch));
else
Result_Unit := Enclosing_Unit
(Encl_Cont_Id (Reference_Ch), Result_Node);
end if;
Result_Element := Node_To_Element_New
(Node => Result_Node,
Node_Field_1 => Association_Type,
Internal_Kind => Result_Kind,
Spec_Case => Special_Case,
Inherited => Is_Inherited,
In_Unit => Result_Unit);
if Set_Char_Code then
Set_Character_Code (Result_Element, Character_Code (Reference_Ch));
end if;
return Result_Element;
end Character_Literal_Name_Definition;
---------------------------------
-- Collect_Overloaded_Entities --
---------------------------------
procedure Collect_Overloaded_Entities (Reference : Asis.Element) is
Arg_Node : Node_Id;
Arg_Pragma_Chars : Name_Id;
Next_Entity : Entity_Id;
Result_Unit : Asis.Compilation_Unit;
Result_Context : constant Context_Id := Encl_Cont_Id (Reference);
Res_Node : Node_Id;
Res_NF_1 : Node_Id;
Res_Ekind : Entity_Kind;
Res_Inherited : Boolean;
Is_Program_Unit_Pragma : Boolean := False;
Enclosing_Scope_Entity : Entity_Id;
Enclosing_List : List_Id;
function Should_Be_Collected (Ent : Entity_Id) return Boolean;
-- When traversing the chain of homonyms potentially referred by
-- Reference, it checks if Ent should be used to create the next
-- Element in the Result list
function Should_Be_Collected (Ent : Entity_Id) return Boolean is
Result : Boolean := False;
N : Node_Id;
begin
if not (Ekind (Ent) = E_Operator and then
Is_Predefined (Ent))
then
if Is_Program_Unit_Pragma then
Result := Scope (Ent) = Enclosing_Scope_Entity;
else
N := Parent (Ent);
while Present (N) and then
not (Is_List_Member (N))
loop
N := Parent (N);
end loop;
if Present (N) and then Is_List_Member (N) then
Result := List_Containing (N) = Enclosing_List;
end if;
end if;
end if;
return Result;
end Should_Be_Collected;
begin
-- First, we decide what kind of pragma we have, because the search
-- depends on this:
Arg_Node := Node (Reference);
Arg_Pragma_Chars := Pragma_Name (Parent (Parent (Arg_Node)));
if Arg_Pragma_Chars = Name_Inline then
Is_Program_Unit_Pragma := True;
-- ??? is it enough? what about GNAT-specific pragmas?
-- In this case we have to search in the same declarative region
-- (in the same scope):
Enclosing_Scope_Entity := Scope (Entity (Arg_Node));
-- This is no more than a trick: actually, we have to compute
-- the scope node for the declarative region which encloses
-- Arg_Node, but entry bodies makes a serious problem (at the
-- moment of writing this code there is no semantic links between
-- protected entry declarations and bodies). So we just assume
-- that Arg_Node has the Entity field set, and this field
-- points to some correct (from the point of view of
-- Corresponding_Name_Definition_List query) entity, so we
-- just take the Scope of this entity...
else
Enclosing_List := List_Containing (Parent (Parent (Arg_Node)));
end if;
Next_Entity := Entity (Arg_Node);
while Present (Next_Entity) and then
Should_Be_Collected (Next_Entity)
loop
Result_Unit := Enclosing_Unit (Result_Context, Next_Entity);
Res_Ekind := Ekind (Next_Entity);
if Res_Ekind in Subprogram_Kind then
if Comes_From_Source (Next_Entity) then
Res_Node := Next_Entity;
Res_NF_1 := Empty;
Res_Inherited := False;
else
Res_Node := Alias (Next_Entity);
while Present (Alias (Res_Node)) loop
Res_Node := Alias (Res_Node);
end loop;
Res_NF_1 := Next_Entity;
Res_Inherited := True;
end if;
Asis_Element_Table.Append
(Node_To_Element_New (Node => Res_Node,
Node_Field_1 => Res_NF_1,
Inherited => Res_Inherited,
In_Unit => Result_Unit));
end if;
Next_Entity := Homonym (Next_Entity);
end loop;
end Collect_Overloaded_Entities;
---------------------------
-- Correct_Impl_Form_Par --
---------------------------
procedure Correct_Impl_Form_Par
(Result : in out Element;
Reference : Element)
is
Res_Node : Node_Id := Node (Result);
Subprogram_Name : Element;
Subprogram_Node : Node_Id := Node (Result);
Res_Sloc : Source_Ptr;
Top_Node : Node_Id;
Result_Unit : Compilation_Unit;
begin
Res_Node := Defining_Identifier (Parent (Res_Node));
Subprogram_Name := Enclosing_Element (Enclosing_Element (Reference));
case Int_Kind (Subprogram_Name) is
when A_Function_Call =>
Subprogram_Name := Prefix (Subprogram_Name);
when A_Procedure_Call_Statement |
An_Entry_Call_Statement =>
Subprogram_Name := Called_Name (Subprogram_Name);
when others =>
null;
pragma Assert (False);
end case;
Subprogram_Node := Node (Subprogram_Name);
Subprogram_Node := Associated_Node (Subprogram_Node);
Top_Node := Parent (Subprogram_Node);
while Nkind (Top_Node) /= N_Compilation_Unit loop
Top_Node := Parent (Top_Node);
end loop;
Res_Sloc := Sloc (Res_Node) - Sloc (Top_Node);
Result_Unit :=
Enclosing_Unit (Encl_Cont_Id (Reference), Subprogram_Node);
Set_Node (Result, Res_Node);
Set_R_Node (Result, Res_Node);
Set_From_Implicit (Result, True);
Set_From_Inherited (Result, True);
Set_From_Instance (Result, Is_From_Instance (Subprogram_Node));
Set_Node_Field_1 (Result, Subprogram_Node);
Set_Rel_Sloc (Result, Res_Sloc);
Set_Encl_Unit_Id (Result, Get_Unit_Id (Result_Unit));
end Correct_Impl_Form_Par;
--------------------
-- Correct_Result --
--------------------
procedure Correct_Result
(Result : in out Element;
Reference : Element)
is
Enclosing_Generic : Element := Nil_Element;
Tmp : Element;
Tmp_Generic : Element;
Is_From_Body : Boolean := False;
Instance : Element := Nil_Element;
procedure Check_Number_Name
(Element : Asis.Element;
Control : in out Traverse_Control;
State : in out No_State);
-- Check if the argument is the defining name of the named number
-- defining the same named number as Result, but in the template.
-- As soon as the check is successful, replace Result with this
-- defining name and terminates the traversal
Control : Traverse_Control := Continue;
State : No_State := Not_Used;
procedure Traverse_Instance is new Traverse_Element
(State_Information => No_State,
Pre_Operation => Check_Number_Name,
Post_Operation => No_Op);
procedure Check_Number_Name
(Element : Asis.Element;
Control : in out Traverse_Control;
State : in out No_State)
is
pragma Unreferenced (State);
El_Kind : constant Internal_Element_Kinds := Int_Kind (Element);
begin
case El_Kind is
when A_Defining_Identifier =>
if Int_Kind (Enclosing_Element (Element)) in
An_Integer_Number_Declaration .. A_Real_Number_Declaration
and then
Chars (Node (Result)) = Chars (Node (Element))
then
Result := Element;
Control := Terminate_Immediately;
end if;
when An_Integer_Number_Declaration |
A_Real_Number_Declaration |
A_Procedure_Body_Declaration |
A_Function_Body_Declaration |
A_Package_Declaration |
A_Package_Body_Declaration |
A_Task_Body_Declaration |
A_Protected_Body_Declaration |
An_Entry_Body_Declaration |
A_Generic_Package_Declaration |
A_Block_Statement =>
null;
when others =>
Control := Abandon_Children;
end case;
end Check_Number_Name;
begin
-- First, check if Result is declared in a template
Tmp := Enclosing_Element (Result);
while not Is_Nil (Tmp) loop
if Int_Kind (Tmp) in An_Internal_Generic_Declaration
or else
(Int_Kind (Tmp) in A_Procedure_Body_Declaration ..
A_Package_Body_Declaration
and then
Int_Kind (Corresponding_Declaration (Tmp)) in
An_Internal_Generic_Declaration)
then
if Int_Kind (Tmp) in A_Procedure_Body_Declaration ..
A_Package_Body_Declaration
then
Enclosing_Generic := Corresponding_Declaration (Tmp);
Is_From_Body := True;
else
Enclosing_Generic := Tmp;
end if;
exit;
end if;
Tmp := Enclosing_Element (Tmp);
end loop;
if Is_Nil (Enclosing_Generic) then
-- No need to correct anything!
return;
end if;
-- Now, traversing the instantiation chain from the Reference, looking
-- for the instantiation of Enlosing_Generic:
Tmp := Enclosing_Element (Reference);
while not Is_Nil (Tmp) loop
if Int_Kind (Tmp) in An_Internal_Generic_Instantiation then
Tmp_Generic := Generic_Unit_Name (Tmp);
if Int_Kind (Tmp_Generic) = A_Selected_Component then
Tmp_Generic := Selector (Tmp_Generic);
end if;
Tmp_Generic := Corresponding_Name_Declaration (Tmp_Generic);
if Is_Equal (Enclosing_Generic, Tmp_Generic) then
Instance := Tmp;
exit;
end if;
end if;
Tmp := Enclosing_Element (Tmp);
end loop;
if Is_Nil (Instance) then
-- No need to correct anything - we do not have a nested generics!
return;
end if;
-- And now we have to find the "image' of Result in expanded Instance
if Is_From_Body then
Instance := Corresponding_Body (Instance);
else
Instance := Corresponding_Declaration (Instance);
end if;
Traverse_Instance (Instance, Control, State);
end Correct_Result;
-------------------------------
-- Explicit_Type_Declaration --
-------------------------------
function Explicit_Type_Declaration (Entity_Node : Node_Id) return Node_Id is
Next_Node : Node_Id;
Result_Node : Node_Id;
Res_Ekind : Entity_Kind;
function Is_Explicit_Type_Declaration
(Type_Entity_Node : Node_Id)
return Boolean;
-- checks if Type_Entity_Node corresponds to the explicit type
-- declaration which is looked for (that is, the needed type declaration
-- node is Parent (Type_Entity_Node) )
function Is_Explicit_Type_Declaration
(Type_Entity_Node : Node_Id)
return Boolean
is
Type_Decl_Node : constant Node_Id := Parent (Type_Entity_Node);
Type_Decl_Nkind : Node_Kind;
Is_Full_Type_Decl : Boolean := False;
Is_Derived_Type_Decl : Boolean := False;
Is_Formal_Type_Decl : Boolean := False;
begin
if not Is_Itype (Entity_Node)
and then
Present (Type_Decl_Node)
then
Is_Full_Type_Decl :=
Comes_From_Source (Type_Decl_Node) and then
(not Is_Rewrite_Substitution (Type_Decl_Node));
if not Is_Full_Type_Decl and then
Is_Rewrite_Substitution (Type_Decl_Node)
then
-- The second part of the condition is common for all the cases
-- which require special analysis
Type_Decl_Nkind := Nkind (Type_Decl_Node);
Is_Derived_Type_Decl :=
(Type_Decl_Nkind = N_Subtype_Declaration or else
Type_Decl_Nkind = N_Full_Type_Declaration or else
Type_Decl_Nkind = N_Formal_Type_Declaration)
and then
(Nkind (Original_Node (Type_Decl_Node)) =
N_Full_Type_Declaration and then
Nkind (Sinfo.Type_Definition (Original_Node (Type_Decl_Node)))
= N_Derived_Type_Definition);
if not Is_Derived_Type_Decl then
Is_Formal_Type_Decl :=
(Type_Decl_Nkind = N_Private_Extension_Declaration
or else
Type_Decl_Nkind = N_Full_Type_Declaration)
and then
Nkind (Original_Node (Type_Decl_Node)) =
N_Formal_Type_Declaration;
end if;
end if;
end if;
return Is_Full_Type_Decl or else
Is_Derived_Type_Decl or else
Is_Formal_Type_Decl;
end Is_Explicit_Type_Declaration;
begin
-- well, here we have a (sub)type entity node passed as an actual...
-- the aim is to return the _explicit_ type declaration corresponding
-- to this (sub)type entity. It should be such a declaration, if this
-- function is called...
--
-- We try to organize the processing in a recursive way - may be,
-- not the most effective one, but easy-to maintain
if Is_Explicit_Type_Declaration (Entity_Node) then
-- the first part of the condition is the protection from
-- non-accurate settings of Comes_From_Source flag :((
Result_Node := Parent (Entity_Node);
elsif Sloc (Entity_Node) <= Standard_Location then
-- here we have a predefined type declared in Standard.
-- it may be the type entity or the entity for its 'Base
-- type. In the latter case we have to go to the type
-- entity
if Present (Parent (Entity_Node)) then
-- type entity, therefore simply
Result_Node := Parent (Entity_Node);
else
-- 'Base type, so we have to compute the first named
-- type. The code which does it looks tricky, but for now we
-- do not know any better solution:
Result_Node := Parent (Parent (Scalar_Range (Entity_Node)));
end if;
elsif Etype (Entity_Node) = Entity_Node and then
Present (Associated_Node_For_Itype (Entity_Node)) and then
Nkind (Associated_Node_For_Itype (Entity_Node)) =
N_Object_Declaration
then
-- this corresponds to an anonymous array subtype created by an
-- object declaration with array_type_definition
Result_Node := Empty;
else
-- Entity_Node corresponds to some internal or implicit type created
-- by the compiler. Here we have to traverse the tree till the
-- explicit type declaration being the cause for generating this
-- implicit type will be found
Res_Ekind := Ekind (Entity_Node);
if Res_Ekind = E_Anonymous_Access_Type then
-- There is no type declaration node in this case at all,
-- so we just return this N_Defining_Identifier node for
-- further analysis in the calling context:
return Entity_Node;
-- ??? Why do not we return Empty in this case???
elsif Res_Ekind = E_Anonymous_Access_Subprogram_Type then
-- No explicit type declaration, so
return Empty;
elsif Res_Ekind = E_String_Literal_Subtype
or else
(Res_Ekind = E_Array_Subtype
and then
Present (Parent (Entity_Node)))
then
-- The first part of the condition corresponds to a special case
-- E_String_Literal_Subtype is created for, see Einfo (spec) for
-- the details. The second part corresponds to the access to
-- string type, see E626-002
Result_Node := Parent (Etype (Entity_Node));
if No (Result_Node) then
Result_Node := Associated_Node_For_Itype (Etype (Entity_Node));
end if;
elsif Ekind (Entity_Node) = E_Enumeration_Type then
if Present (Associated_Node_For_Itype (Entity_Node)) then
Result_Node := Associated_Node_For_Itype (Entity_Node);
else
-- Entity_Node represents an implicit type created for
-- a derived enumeration type. we have to go down to this
-- derived type
Result_Node := Parent (Entity_Node);
while Present (Result_Node) loop
Result_Node := Next (Result_Node);
exit when Nkind (Result_Node) = N_Subtype_Declaration
and then
Is_Rewrite_Substitution (Result_Node);
end loop;
end if;
pragma Assert (Present (Result_Node));
elsif (No (Parent (Entity_Node)) or else
not Comes_From_Source (Parent (Entity_Node)))
and then
Etype (Entity_Node) /= Entity_Node
and then
not (Ekind (Entity_Node) = E_Floating_Point_Type or else
Ekind (Entity_Node) = E_Signed_Integer_Type or else
Ekind (Entity_Node) = E_Array_Type or else
Ekind (Entity_Node) = E_Private_Type or else
Ekind (Entity_Node) = E_Limited_Private_Type)
then
if Is_Itype (Entity_Node)
and then
Nkind (Associated_Node_For_Itype (Entity_Node)) =
N_Subtype_Declaration
then
Next_Node :=
Defining_Identifier (Associated_Node_For_Itype (Entity_Node));
if Next_Node = Entity_Node then
Next_Node := Etype (Entity_Node);
end if;
else
-- subtypes created for objects when an explicit constraint
-- presents in the object declaration ???
Next_Node := Etype (Entity_Node);
end if;
Result_Node := Explicit_Type_Declaration (Next_Node);
else
Next_Node := Associated_Node_For_Itype (Entity_Node);
pragma Assert (Present (Next_Node));
if Nkind (Original_Node (Next_Node)) = N_Full_Type_Declaration
or else
Nkind (Original_Node (Next_Node)) = N_Formal_Type_Declaration
then
Result_Node := Next_Node;
elsif Nkind (Next_Node) = N_Loop_Parameter_Specification then
-- here we have to traverse the loop parameter specification,
-- because otherwise we may get the base type instead of
-- the actually needed named subtype.
Result_Node := Next_Node;
Result_Node := Sinfo.Discrete_Subtype_Definition (Result_Node);
case Nkind (Result_Node) is
when N_Subtype_Indication =>
Result_Node := Sinfo.Subtype_Mark (Result_Node);
Result_Node := Parent (Entity (Result_Node));
when N_Identifier | N_Expanded_Name =>
Result_Node := Parent (Entity (Result_Node));
when N_Range =>
-- and here we have to use the Etype field of
-- the implicit type itself, because we do not have
-- any type mark to start from in the loop parameter
-- specification:
Result_Node := Explicit_Type_Declaration
(Etype (Entity_Node));
when others =>
null;
pragma Assert (False);
-- this is definitely wrong! Should be corrected
-- during debugging!!!
end case;
else
if Etype (Entity_Node) /= Entity_Node then
-- otherwise we will be in dead circle
Result_Node := Etype (Entity_Node);
Result_Node := Explicit_Type_Declaration (Result_Node);
else
-- for now, the only guess is that we have an object
-- defined by an object declaration with constrained
-- array definition, or an initialization expression
-- from such a declaration
pragma Assert (
Nkind (Next_Node) = N_Object_Declaration and then
Nkind (Object_Definition (Next_Node)) =
N_Constrained_Array_Definition);
return Empty;
-- what else could we return here?
end if;
end if;
end if;
end if;
return Result_Node;
end Explicit_Type_Declaration;
---------------------------------------
-- Explicit_Type_Declaration_Unwound --
---------------------------------------
function Explicit_Type_Declaration_Unwound
(Entity_Node : Node_Id;
Reference_Node : Node_Id := Empty)
return Node_Id
is
Result_Node : Node_Id;
Subtype_Mark_Node : Node_Id;
begin
Result_Node := Explicit_Type_Declaration (Entity_Node);
while Nkind (Original_Node (Result_Node)) = N_Subtype_Declaration loop
Subtype_Mark_Node :=
Sinfo.Subtype_Indication (Original_Node (Result_Node));
if Nkind (Subtype_Mark_Node) = N_Subtype_Indication then
Subtype_Mark_Node := Sinfo.Subtype_Mark (Subtype_Mark_Node);
end if;
Result_Node := Explicit_Type_Declaration (Entity (Subtype_Mark_Node));
end loop;
if Present (Reference_Node) and then
(Nkind (Original_Node (Result_Node)) = N_Private_Type_Declaration
or else
Nkind (Original_Node (Result_Node)) =
N_Private_Extension_Declaration)
and then
Full_View_Visible (Result_Node, Reference_Node)
then
Result_Node := Parent (Full_View (Defining_Identifier (Result_Node)));
end if;
return Result_Node;
end Explicit_Type_Declaration_Unwound;
------------------------------------------------
-- Explicit_Type_Declaration_Unwound_Unaccess --
------------------------------------------------
function Explicit_Type_Declaration_Unwound_Unaccess
(Entity_Node : Node_Id;
Reference_Node : Node_Id := Empty)
return Node_Id
is
Result_Node : Node_Id;
Subtype_Mark_Node : Node_Id;
Tmp : Node_Id;
begin
Result_Node := Explicit_Type_Declaration_Unwound (
Entity_Node, Reference_Node);
if Nkind (Result_Node) = N_Defining_Identifier and then
Ekind (Result_Node) = E_Anonymous_Access_Type
then
Result_Node := Explicit_Type_Declaration_Unwound (
Directly_Designated_Type (Result_Node), Reference_Node);
end if;
-- This loop unwinds accessing^
while (Nkind (Original_Node (Result_Node)) = N_Full_Type_Declaration
and then
Nkind (Sinfo.Type_Definition (Original_Node (Result_Node))) =
N_Access_To_Object_Definition)
or else
(Nkind (Original_Node (Result_Node)) = N_Formal_Type_Declaration
and then
Nkind (Sinfo.Formal_Type_Definition (Original_Node (
Result_Node))) = N_Access_To_Object_Definition)
loop
Subtype_Mark_Node := Original_Node (Result_Node);
if Nkind (Subtype_Mark_Node) = N_Full_Type_Declaration then
Subtype_Mark_Node := Sinfo.Subtype_Indication (
Sinfo.Type_Definition (Subtype_Mark_Node));
else
Subtype_Mark_Node := Sinfo.Subtype_Indication (
Sinfo.Formal_Type_Definition (Subtype_Mark_Node));
end if;
if Nkind (Subtype_Mark_Node) = N_Subtype_Indication then
Subtype_Mark_Node := Sinfo.Subtype_Mark (Subtype_Mark_Node);
end if;
Result_Node := Explicit_Type_Declaration_Unwound (
Entity (Subtype_Mark_Node), Reference_Node);
if Nkind (Result_Node) = N_Incomplete_Type_Declaration then
-- To be 100% honest, we have to check that at place of
-- Reference_Node the full view is visible. But we could hardly
-- call this routine (for a legal code) if we do not see the full
-- view from Reference_Node.
Tmp := Full_View (Defining_Identifier (Result_Node));
if Present (Tmp) then
Result_Node := Parent (Tmp);
end if;
end if;
end loop;
-- If we have a type derived from an access type, we have to go through
-- this derivation and unwind accessing
if Nkind (Result_Node) = N_Full_Type_Declaration
and then
Nkind (Sinfo.Type_Definition (Result_Node)) =
N_Derived_Type_Definition
then
Tmp := Defining_Identifier (Result_Node);
if Ekind (Tmp) in Access_Kind then
Result_Node :=
Explicit_Type_Declaration_Unwound_Unaccess
(Directly_Designated_Type (Tmp),
Reference_Node);
end if;
end if;
return Result_Node;
end Explicit_Type_Declaration_Unwound_Unaccess;
---------------
-- Expr_Type --
---------------
function Expr_Type (Expression : Asis.Expression) return Asis.Declaration is
Arg_Node : Node_Id;
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Expression);
Result_Entity : Node_Id;
Result_Node : Node_Id;
Result_Unit : Compilation_Unit;
Res_Spec_Case : Special_Cases := Not_A_Special_Case;
Encl_Cont : constant Context_Id := Encl_Cont_Id (Expression);
begin
-- first, we should check whether Expression has a universal
-- numeric type and return the corresponding ASIS universal type.
-- For now, this check includes numeric literals and some of the
-- attribute references is:
if Arg_Kind = An_Integer_Literal or else
Arg_Kind = An_Alignment_Attribute or else
Arg_Kind = A_Component_Size_Attribute or else
Arg_Kind = A_Digits_Attribute or else
Arg_Kind = A_Count_Attribute or else
Arg_Kind = An_Exponent_Attribute or else
Arg_Kind = A_First_Bit_Attribute or else
Arg_Kind = A_Fore_Attribute or else
Arg_Kind = A_Last_Bit_Attribute or else
Arg_Kind = A_Length_Attribute or else
Arg_Kind = A_Machine_Emax_Attribute or else
Arg_Kind = A_Machine_Emin_Attribute or else
Arg_Kind = A_Machine_Mantissa_Attribute or else
Arg_Kind = A_Machine_Radix_Attribute or else
Arg_Kind = A_Max_Size_In_Storage_Elements_Attribute or else
Arg_Kind = A_Model_Emin_Attribute or else
Arg_Kind = A_Model_Mantissa_Attribute or else
Arg_Kind = A_Modulus_Attribute or else
Arg_Kind = A_Partition_ID_Attribute or else
Arg_Kind = A_Pos_Attribute or else
Arg_Kind = A_Position_Attribute or else
Arg_Kind = A_Scale_Attribute or else
Arg_Kind = A_Size_Attribute or else
Arg_Kind = A_Storage_Size_Attribute or else
Arg_Kind = A_Wide_Width_Attribute or else
Arg_Kind = A_Width_Attribute or else
(Special_Case (Expression) = Rewritten_Named_Number
and then Nkind (R_Node (Expression)) = N_Integer_Literal)
then
return Set_Root_Type_Declaration
(A_Universal_Integer_Definition,
Encl_Cont);
elsif Arg_Kind = A_Real_Literal or else
Arg_Kind = A_Delta_Attribute or else
Arg_Kind = A_Model_Epsilon_Attribute or else
Arg_Kind = A_Model_Small_Attribute or else
Arg_Kind = A_Safe_First_Attribute or else
Arg_Kind = A_Safe_Last_Attribute or else
Arg_Kind = A_Small_Attribute or else
(Special_Case (Expression) = Rewritten_Named_Number
and then Nkind (R_Node (Expression)) = N_Real_Literal)
then
return Set_Root_Type_Declaration
(A_Universal_Real_Definition,
Encl_Cont);
end if;
Arg_Node := Node (Expression);
-- In some cases we have to use the rewritten node
if Is_Rewrite_Substitution (R_Node (Expression)) and then
(Nkind (Arg_Node) = N_Aggregate and then
Nkind (R_Node (Expression)) = N_String_Literal)
then
Arg_Node := R_Node (Expression);
end if;
while Nkind (Arg_Node) = N_String_Literal
and then
Nkind (Parent (Arg_Node)) = N_String_Literal
loop
-- Trick for F109-A24: for string literals in a static expression,
-- Etype points to some dummy subtype node (the tree structure is
-- rewritten for the whole expression, and the original subtree is
-- not fully decorated), so we take the type information from the
-- rewritten result of the expression
Arg_Node := Parent (Arg_Node);
end loop;
-- if the expression node is rewritten, all the semantic
-- information can be found only through the rewritten node
if Nkind (Parent (Arg_Node)) = N_Expanded_Name and then
Arg_Node = Selector_Name (Parent (Arg_Node))
then
-- selector in an expanded name - all the semantic fields
-- are set for the whole name, but not for this selector.
-- So:
Arg_Node := Parent (Arg_Node);
end if;
-- ??? <tree problem 1>
-- this fragment should be revised when the problem is fixed (as it should)
if Nkind (Arg_Node) = N_Selected_Component then
if Etype (Arg_Node) = Any_Type then
-- for now (GNAT 3.05) this means, that Expression is an expanded
-- name of the character literal of ether a predefined character
-- type or of the type derived from a predefined character type
Arg_Node := R_Node (Expression);
-- resetting Arg_Node pointing to the rewritten node for the
-- expanded name
--
-- ???
-- This looks strange... Should be revised
else
Arg_Node := Selector_Name (Arg_Node);
-- here the actual type is!
end if;
elsif Nkind (Arg_Node) = N_Character_Literal and then
No (Etype (Arg_Node))
-- for now (GNAT 3.05) this means, that Expression is the
-- selector in an expanded name of the character literal of
-- ether a predefined character type or of the type derived
-- from a predefined character type
then
Arg_Node := Parent (Arg_Node);
-- resetting Arg_Node pointing to the rewritten node for the whole
-- expanded name
end if;
-- ??? <tree problem 1> - end
-- now the idea is to take the Etype attribute of the expression
-- and to go to the corresponding type declaration. But
-- special processing for computing the right Etype is
-- required for some cases
if Nkind (Parent (Arg_Node)) = N_Qualified_Expression and then
Arg_Node = Sinfo.Expression (Parent (Arg_Node))
then
Result_Entity := Etype (Sinfo.Subtype_Mark (Parent (Arg_Node)));
-- we'll keep the commented code below for a while...
-- elsif (Arg_Kind = A_First_Attribute or else
-- Arg_Kind = A_Last_Attribute)
-- and then not Comes_From_Source (Etype (Arg_Node))
-- and then Sloc (Etype (Arg_Node)) > Standard_Location
-- and then Etype (Etype (Arg_Node)) = Etype (Arg_Node)
-- then
-- -- this tricky condition corresponds to the situation, when
-- -- 'First or 'Last attribute is applied to a formal discrete
-- -- type @:-(
-- -- In this case we simply use the attribute prefix to define
-- -- the result type
-- Result_Entity := Etype (Prefix (Arg_Node));
else
-- how nice it would be if *everything* would be so simple
Result_Entity := Etype (Arg_Node);
end if;
if Result_Entity = Any_Composite then
-- Here we have an aggregate in some original tree structure that has
-- not been properly decorated. All the semantic decorations are in
-- the corresponding rewritten structure, so we have to find the
-- corresponding node there.
declare
Tmp : Node_Id;
New_Arg_Node : Node_Id := Empty;
Arg_Kind : constant Node_Kind := Nkind (Arg_Node);
Arg_Sloc : constant Source_Ptr := Sloc (Arg_Node);
function Find (Node : Node_Id) return Traverse_Result;
-- Check if its argument represents the same construct as
-- Arg_Node, and if it does, stores Node in New_Arg_Node and
-- returns Abandon, otherwise returns OK.
procedure Find_Rewr_Aggr is new Traverse_Proc (Find);
function Find (Node : Node_Id) return Traverse_Result is
begin
if Nkind (Node) = Arg_Kind
and then
Sloc (Node) = Arg_Sloc
then
New_Arg_Node := Node;
return Abandon;
else
return OK;
end if;
end Find;
begin
Tmp := Parent (Arg_Node);
while not Is_Rewrite_Substitution (Tmp) loop
Tmp := Parent (Tmp);
end loop;
Find_Rewr_Aggr (Tmp);
pragma Assert (Present (New_Arg_Node));
Result_Entity := Etype (New_Arg_Node);
end;
end if;
Result_Node := Explicit_Type_Declaration (Result_Entity);
if No (Result_Node) then
return Nil_Element;
-- we cannot represent the type declaration in ASIS;
-- for example, an object defined by an object declaration
-- with constrained array definition
end if;
if Sloc (Result_Entity) <= Standard_Location then
Result_Unit := Get_Comp_Unit
(Standard_Id, Encl_Cont_Id (Expression));
Res_Spec_Case := Explicit_From_Standard;
else
Result_Unit := Enclosing_Unit
(Encl_Cont_Id (Expression), Result_Node);
end if;
return Node_To_Element_New (Node => Result_Node,
Spec_Case => Res_Spec_Case,
In_Unit => Result_Unit);
end Expr_Type;
-----------------------
-- Full_View_Visible --
-----------------------
function Full_View_Visible
(Priv_Type : Node_Id;
Ref : Node_Id)
return Boolean
is
Type_Scope : constant Node_Id :=
Scope (Defining_Identifier (Priv_Type));
Type_Scope_Body : Node_Id;
Type_Full_View : Node_Id;
Scope_Node : Node_Id := Empty;
Next_Node : Node_Id := Parent (Ref);
Next_Node_Inner : Node_Id := Ref;
Result : Boolean := False;
begin
Type_Scope_Body := Parent (Type_Scope);
if Nkind (Type_Scope_Body) = N_Defining_Program_Unit_Name then
Type_Scope_Body := Parent (Type_Scope_Body);
end if;
Type_Scope_Body := Corresponding_Body (Parent (Type_Scope_Body));
if Nkind (Parent (Type_Scope_Body)) = N_Defining_Program_Unit_Name then
Type_Scope_Body := Parent (Type_Scope_Body);
end if;
while Present (Next_Node) loop
if (Nkind (Next_Node) = N_Package_Specification and then
Defining_Unit_Name (Next_Node) = Type_Scope)
or else
(Nkind (Next_Node) = N_Package_Body and then
Defining_Unit_Name (Next_Node) = Type_Scope_Body)
then
Scope_Node := Next_Node;
exit;
end if;
Next_Node_Inner := Next_Node;
Next_Node := Parent (Next_Node);
end loop;
if Present (Scope_Node) then
if Nkind (Scope_Node) = N_Package_Body then
Result := True;
elsif List_Containing (Next_Node_Inner) =
Private_Declarations (Scope_Node)
then
-- That is, Ref is in the private part of the package where
-- Priv_Type is declared, and we have to check what goes first:
-- Ref (or a construct it is enclosed into - it is pointed by
-- Next_Node_Inner) or the full view of the private type:
Type_Full_View := Parent (Full_View
(Defining_Identifier (Priv_Type)));
Next_Node := First_Non_Pragma (Private_Declarations (Scope_Node));
while Present (Next_Node) loop
if Next_Node = Type_Full_View then
Result := True;
exit;
elsif Next_Node = Next_Node_Inner then
exit;
else
Next_Node := Next_Non_Pragma (Next_Node);
end if;
end loop;
end if;
end if;
return Result;
end Full_View_Visible;
--------------------------------
-- Get_Discriminant_From_Type --
--------------------------------
function Get_Discriminant_From_Type (N : Node_Id) return Entity_Id is
Type_Entity : Entity_Id := Parent (N);
Res_Chars : constant Name_Id := Chars (N);
Result : Entity_Id;
begin
while not (Nkind (Type_Entity) = N_Subtype_Declaration
or else
Nkind (Type_Entity) = N_Subtype_Indication)
loop
Type_Entity := Parent (Type_Entity);
if Nkind (Type_Entity) = N_Allocator then
Type_Entity := Etype (Type_Entity);
while Ekind (Type_Entity) in Access_Kind loop
Type_Entity := Directly_Designated_Type (Type_Entity);
end loop;
exit;
end if;
end loop;
if Nkind (Type_Entity) = N_Subtype_Indication and then
Nkind (Parent (Type_Entity)) = N_Subtype_Declaration
then
Type_Entity := Parent (Type_Entity);
end if;
if Nkind (Type_Entity) = N_Subtype_Declaration then
Type_Entity := Defining_Identifier (Type_Entity);
else
Type_Entity := Entity (Sinfo.Subtype_Mark (Type_Entity));
end if;
while
Type_Entity /= Etype (Type_Entity)
loop
exit when Comes_From_Source (Type_Entity)
and then
Comes_From_Source (Original_Node (Parent (Type_Entity)))
and then
Nkind (Parent (Type_Entity)) /= N_Subtype_Declaration;
Type_Entity := Etype (Type_Entity);
if Ekind (Type_Entity) = E_Access_Type then
Type_Entity := Directly_Designated_Type (Type_Entity);
elsif (Ekind (Type_Entity) = E_Private_Type
or else
Ekind (Type_Entity) = E_Limited_Private_Type)
and then
Present (Full_View (Type_Entity))
then
Type_Entity := Full_View (Type_Entity);
end if;
end loop;
-- Take care of a private type with unknown discriminant part:
if Nkind (Parent (Type_Entity)) in
N_Private_Extension_Declaration .. N_Private_Type_Declaration
and then
Unknown_Discriminants_Present (Parent (Type_Entity))
then
Type_Entity := Full_View (Type_Entity);
end if;
-- In case of a derived types, we may have discriminants declared for an
-- ansector type and then redefined for some child type
Search_Discriminant : loop
Result := Original_Node (Parent (Type_Entity));
Result := First (Discriminant_Specifications (Result));
while Present (Result) loop
if Chars (Defining_Identifier (Result)) = Res_Chars then
Result := Defining_Identifier (Result);
exit Search_Discriminant;
else
Result := Next (Result);
end if;
end loop;
exit Search_Discriminant when Type_Entity = Etype (Type_Entity);
Type_Entity := Etype (Type_Entity);
end loop Search_Discriminant;
pragma Assert (Present (Result));
return Result;
end Get_Discriminant_From_Type;
-------------------------------
-- Get_Entity_From_Long_Name --
-------------------------------
function Get_Entity_From_Long_Name (N : Node_Id) return Entity_Id is
Result : Entity_Id := Empty;
Arg_Chars : constant Name_Id := Chars (N);
Res_Chars : Name_Id;
P : Node_Id;
Next_Entity : Entity_Id;
begin
P := Parent (N);
while No (Entity (P)) loop
P := Parent (P);
end loop;
Next_Entity := Entity (P);
Res_Chars := Chars (Next_Entity);
loop
if Res_Chars = Arg_Chars then
Result := Next_Entity;
exit;
end if;
if Nkind (Parent (Next_Entity)) = N_Defining_Program_Unit_Name then
P := Sinfo.Name (Parent (Next_Entity));
Next_Entity := Entity (P);
Res_Chars := Chars (Next_Entity);
else
exit;
end if;
end loop;
pragma Assert (Present (Result));
return Result;
end Get_Entity_From_Long_Name;
-----------------------------
-- Get_Rewritten_Discr_Ref --
-----------------------------
function Get_Rewritten_Discr_Ref (N : Node_Id) return Node_Id is
Res_Chars : constant Name_Id := Chars (N);
Result : Node_Id := Parent (N);
begin
while not (Nkind (Result) = N_Identifier
and then
Is_Rewrite_Substitution (Result)
and then
Nkind (Original_Node (Result)) = N_Subtype_Indication)
loop
Result := Parent (Result);
end loop;
-- Go to the declaration of this internal subtype
Result := Parent (Entity (Result));
-- Now - no the constraint
Result := Sinfo.Constraint (Sinfo.Subtype_Indication (Result));
-- And iterating through discriminant names
Result := First (Constraints (Result));
Result := First (Selector_Names (Result));
while Present (Result) loop
if Chars (Result) = Res_Chars then
exit;
end if;
-- Get to the next discriminant
if Present (Next (Result)) then
Result := Next (Result);
else
Result := Next (Parent (Result));
if Present (Result) then
Result := First (Selector_Names (Result));
end if;
end if;
end loop;
pragma Assert (Present (Result));
return Result;
end Get_Rewritten_Discr_Ref;
------------------------------
-- Get_Specificed_Component --
------------------------------
function Get_Specificed_Component
(Comp : Node_Id;
Rec_Type : Entity_Id)
return Entity_Id
is
Rec_Type_Entity : Entity_Id;
Result : Entity_Id := Empty;
Res_Chars : constant Name_Id := Chars (Comp);
Next_Comp : Node_Id;
begin
if Ekind (Rec_Type) = E_Private_Type or else
Ekind (Rec_Type) = E_Limited_Private_Type
then
Rec_Type_Entity := Full_View (Rec_Type);
else
Rec_Type_Entity := Rec_Type;
end if;
Next_Comp := First_Entity (Rec_Type_Entity);
while Present (Next_Comp) loop
if Chars (Next_Comp) = Res_Chars then
Result := Next_Comp;
exit;
end if;
Next_Comp := Next_Entity (Next_Comp);
end loop;
pragma Assert (Present (Result));
return Result;
end Get_Specificed_Component;
------------------------------
-- Get_Statement_Identifier --
------------------------------
function Get_Statement_Identifier (Def_Id : Node_Id) return Node_Id is
Result_Node : Node_Id := Empty;
-- List_Elem : Node_Id;
begin
Result_Node := Label_Construct (Parent (Def_Id));
if not (Nkind (Result_Node) = N_Label) then
-- this means, that Result_Node is of N_Block_Statement or
-- of N_Loop_Statement kind, therefore
Result_Node := Sinfo.Identifier (Result_Node);
end if;
return Result_Node;
end Get_Statement_Identifier;
---------------------
-- GFP_Declaration --
---------------------
function GFP_Declaration (Par_Id : Node_Id) return Node_Id is
Par_Chars : constant Name_Id := Chars (Par_Id);
Result_Node : Node_Id;
Gen_Par_Decl : Node_Id;
begin
-- First, going up to the generic instantiation itself:
Result_Node := Parent (Parent (Par_Id));
-- then taking the name of the generic unit being instantiated
-- and going to its definition - and declaration:
Result_Node := Parent (Parent (Entity (Sinfo.Name (Result_Node))));
-- and now - searching the declaration of the corresponding
-- generic parameter:
Gen_Par_Decl :=
First_Non_Pragma (Generic_Formal_Declarations (Result_Node));
while Present (Gen_Par_Decl) loop
if Nkind (Gen_Par_Decl) in N_Formal_Subprogram_Declaration then
Result_Node := Defining_Unit_Name (Specification (Gen_Par_Decl));
else
Result_Node := Defining_Identifier (Gen_Par_Decl);
end if;
if Chars (Result_Node) = Par_Chars then
exit;
else
Gen_Par_Decl := Next_Non_Pragma (Gen_Par_Decl);
end if;
end loop;
return Result_Node;
end GFP_Declaration;
--------------------------------
-- Identifier_Name_Definition --
--------------------------------
function Identifier_Name_Definition
(Reference_I : Element)
return Asis.Defining_Name
is
Arg_Node : Node_Id;
Arg_Node_Kind : Node_Kind;
Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Reference_I);
Result_Node : Node_Id := Empty;
Result_Unit : Compilation_Unit;
Spec_Case : Special_Cases := Not_A_Special_Case;
Result_Kind : Internal_Element_Kinds := Not_An_Element;
Is_Inherited : Boolean := False;
Association_Type : Node_Id := Empty;
-- ??? Is it a good name for a parameter?
Componnet_Name : Node_Id := Empty;
Tmp_Node : Node_Id;
Result : Asis.Element;
function Ekind (N : Node_Id) return Entity_Kind;
-- This function differs from Atree.Ekind in that it can operate
-- with N_Defining_Program_Unit_Name (in this case it returns
-- Atree.Ekind for the corresponding Defining_Identifier node.
function Ekind (N : Node_Id) return Entity_Kind is
Arg_Node : Node_Id := N;
begin
if Nkind (Arg_Node) = N_Defining_Program_Unit_Name then
Arg_Node := Defining_Identifier (Arg_Node);
end if;
return Atree.Ekind (Arg_Node);
end Ekind;
begin
-- this function is currently integrated with
-- Enumeration_Literal_Name_Definition and
-- Operator_Symbol_Name_Definition
-- The implementation approach is very similar to that one of
-- A4G.A_Sem.Get_Corr_Called_Entity. Now the implicit *predefined*
-- operations are turned off for a while
------------------------------------------------------------------
-- 1. Defining Result_Node (and adjusting Arg_Node, if needed) --
------------------------------------------------------------------
if Arg_Kind = An_Identifier then
Result_Kind := A_Defining_Identifier;
-- may be changed to A_Defining_Expanded_Name later
elsif Arg_Kind = An_Enumeration_Literal then
Result_Kind := A_Defining_Enumeration_Literal;
elsif Arg_Kind in Internal_Operator_Symbol_Kinds then
Result_Kind := Def_Operator_Kind (Int_Kind (Reference_I));
end if;
if Special_Case (Reference_I) = Rewritten_Named_Number then
Arg_Node := R_Node (Reference_I);
else
-- Arg_Node := Get_Actual_Type_Name (Node (Reference_I));
Arg_Node := Node (Reference_I);
end if;
-- the code below is really awful! In some future we'll have
-- to revise this "patch on patch" approach!!!
if Is_Part_Of_Defining_Unit_Name (Arg_Node) and then
Kind (Encl_Unit (Reference_I)) in A_Library_Unit_Body
then
-- this means, that we have a part of a prefix of a defining
-- unit name which is a part of a body. These components do not
-- have Entity field set, so we have to go to the spec:
Arg_Node := Reset_To_Spec (Arg_Node);
end if;
if Nkind (Arg_Node) in N_Entity then
-- This is the case of the reference to a formal type inside
-- the expanded code when the actual type is a derived type
-- In this case Get_Actual_Type_Name returns the entity node
-- (see 8924-006)
Result_Node := Arg_Node;
Arg_Node := Node (Reference_I);
-- For the rest of the processing we need Arg_Node properly set as
-- the reference, but not as an entity node
elsif Special_Case (Reference_I) = Rewritten_Named_Number then
-- See BB10-002
Result_Node := Original_Entity (Arg_Node);
elsif No (Entity (Arg_Node)) then
Arg_Node_Kind := Nkind (Original_Node (Parent (Arg_Node)));
-- in some cases we can try to "repair" the situation:
if Arg_Node_Kind = N_Expanded_Name then
-- the Entity field is set for the whole expanded name:
if Entity_Present (Original_Node (Parent (Arg_Node))) or else
Entity_Present (Parent (Arg_Node))
then
Arg_Node := Parent (Arg_Node);
-- In case of renamings, here we may have the expanded name
-- rewritten, and the Entity field for the new name pointing
-- to the renamed entity, but not to the entity defined by
-- the renamed declaration, see B924-A13
if Is_Rewrite_Substitution (Arg_Node) and then
Entity_Present (Original_Node (Arg_Node))
then
Arg_Node := Original_Node (Arg_Node);
end if;
else
-- Trying to "traverse a "long" defining program unit
-- name (see 7917-005)
Result_Node := Get_Entity_From_Long_Name (Arg_Node);
end if;
elsif Arg_Node_Kind = N_Component_Definition and then
Sloc (Arg_Node) = Standard_Location
then
-- Special case of Subtype_Indication for predefined String
-- and Wide_String types:
Result_Node := Parent (Parent (Parent (Arg_Node)));
-- Here we are in N_Full_Type_Declaration node
Result_Node := Defining_Identifier (Result_Node);
Result_Node := Component_Type (Result_Node);
Spec_Case := Explicit_From_Standard;
elsif Arg_Node_Kind = N_Function_Call then
-- this is a special case of a parameterless function call
-- of the form P.F
Arg_Node := Sinfo.Name (Original_Node (Parent (Arg_Node)));
elsif Arg_Node_Kind = N_Integer_Literal or else
Arg_Node_Kind = N_Real_Literal or else
Arg_Node_Kind = N_Character_Literal or else
Arg_Node_Kind = N_String_Literal or else
Arg_Node_Kind = N_Identifier
then
-- All but last conditions are a result of some compile-time
-- optimization. The last one is a kind of
-- semantically-transparent transformation which loses some
-- semantic information for replaced structures (see the test
-- for 9429-006).
--
-- The last condition may need some more attention in case if new
-- Corresponding_Name_Definition problems are detected
Arg_Node := Original_Node (Parent (Arg_Node));
elsif Arg_Node_Kind = N_Component_Association and then
Nkind (Parent (Parent (Arg_Node))) = N_Raise_Constraint_Error
then
-- A whole aggregate is rewritten into N_Raise_Constraint_Error
-- node, see G628-026
Tmp_Node := Parent (Parent (Arg_Node));
Tmp_Node := Etype (Tmp_Node);
Tmp_Node := First_Entity (Tmp_Node);
while Present (Tmp_Node) loop
if Chars (Tmp_Node) = Chars (Arg_Node) then
Result_Node := Tmp_Node;
exit;
end if;
Tmp_Node := Next_Entity (Tmp_Node);
end loop;
pragma Assert (Present (Result_Node));
if not (Comes_From_Source (Result_Node))
and then
Comes_From_Source (Parent (Result_Node))
then
Result_Node := Defining_Identifier (Parent (Result_Node));
end if;
elsif Arg_Node_Kind = N_Component_Association and then
Nkind (Sinfo.Expression (Parent (Arg_Node))) =
N_Raise_Constraint_Error
then
-- here we are guessing for the situation when a compiler
-- optimization take place. We can probably be non-accurate
-- for inherited record components, but what can we do....
--
-- first, defining the corresponding Entity Node, we assume
-- it to be a record component definition
Result_Node := Parent (Parent (Arg_Node)); -- aggregate
Association_Type := Etype (Result_Node);
if Ekind (Association_Type) in Private_Kind then
Association_Type := Full_View (Association_Type);
end if;
Result_Node := First_Entity (Association_Type);
while Chars (Result_Node) /= Chars (Arg_Node) loop
Result_Node := Next_Entity (Result_Node);
end loop;
elsif Arg_Node_Kind = N_Parameter_Association and then
Arg_Node = Selector_Name (Parent (Arg_Node))
then
-- Currently we assume, that this corresponds to the case of
-- formal parameters of predefined operations
return Nil_Element;
elsif Arg_Node_Kind = N_Component_Clause then
-- Component clause in record representation clause - Entity
-- field is not set, we have to traverse the list of components
-- of the record type
Association_Type :=
Entity (Sinfo.Identifier (Parent (Parent (Arg_Node))));
if Ekind (Association_Type) = E_Record_Subtype then
-- In case of a subtype it may be the case that some components
-- depending on discriminant are skipped in case of a static
-- discriminnat constraint, see also
-- A4G.Mapping.Set_Inherited_Components
Association_Type := Etype (Association_Type);
end if;
Result_Node :=
Get_Specificed_Component (Arg_Node, Association_Type);
Association_Type := Empty;
-- Association_Type is set back to Empty to make it possible
-- to use the general approach for computing Association_Type
-- later
elsif Nkind (Arg_Node) = N_Identifier and then
Sloc (Parent (Arg_Node)) = Standard_ASCII_Location
then
-- reference to Character in a constant definition in the
-- ASCII package, see 8303-011
Result_Node := Standard_Character;
elsif not (Arg_Node_Kind = N_Discriminant_Association or else
Arg_Node_Kind = N_Generic_Association)
and then
not Is_From_Unknown_Pragma (R_Node (Reference_I))
then
-- now we are considering all the other cases as component simple
-- names in a (rewritten!) record aggregate, and we go from the
-- original to the rewritten structure (because the original
-- structure is not decorated). If this is not the case, we should
-- get the Assert_Failure raised in Rewritten_Image
-- Arg_Node := Rewritten_Image (Arg_Node);
Result_Node := Search_Record_Comp (Arg_Node);
end if;
end if;
if No (Result_Node) and then
No (Entity (Arg_Node)) and then
not (Nkind (Parent (Arg_Node)) = N_Discriminant_Association or else
Nkind (Parent (Arg_Node)) = N_Generic_Association or else
Is_From_Unknown_Pragma (R_Node (Reference_I)))
then
if Debug_Flag_S then
Write_Str ("A4G.Expr_Sem.Identifier_Name_Definition:");
Write_Eol;
Write_Str ("no Entity field is set for Node ");
Write_Int (Int (Arg_Node));
Write_Eol;
Write_Str (" the debug image of the query argument is:");
Write_Eol;
Debug_String (Reference_I);
Write_Str (Debug_Buffer (1 .. Debug_Buffer_Len));
Write_Eol;
end if;
raise Internal_Implementation_Error;
end if;
if Present (Result_Node) then
null;
elsif Is_From_Unknown_Pragma (R_Node (Reference_I)) then
return Nil_Element;
elsif Nkind (Parent (Arg_Node)) = N_Discriminant_Association and then
Arg_Node /= Original_Node (Sinfo.Expression (Parent (Arg_Node)))
then
-- We use Original_Node (Sinfo.Expression (Parent (Arg_Node)))
-- because of C730-016 (named numbers rewritten into their values)
if No (Original_Discriminant (Arg_Node)) then
Result_Node := Get_Discriminant_From_Type (Arg_Node);
else
Result_Node := Original_Discriminant (Arg_Node);
if Present (Corresponding_Discriminant (Result_Node)) then
Result_Node := Corresponding_Discriminant (Result_Node);
end if;
end if;
elsif No (Entity (Arg_Node)) and then
Nkind (Parent (Arg_Node)) = N_Generic_Association
then
-- this is the problem up to 3.10p. We have to compute
-- N_Defining_Identifier_Node for this generic formal
-- parameter "by hands"
-- ??? should be rechecked for 3.11w!!!
Result_Node := GFP_Declaration (Arg_Node);
else
Result_Node := Entity (Arg_Node);
end if;
-- Here we have Result_Node set. And now we have a whole bunch of
-- situations when we have to correct Result_Node because of different
-- reasons
-- If Result_Node is the type reference, and the type has both private
-- and full view, Result_Node will point to the private view. In some
-- situations we have to replace it with the full view.
if Ekind (Result_Node) in Einfo.Type_Kind
and then
Nkind (Original_Node (Parent (Result_Node))) in
N_Private_Extension_Declaration .. N_Private_Type_Declaration
and then
Full_View_Visible
(Priv_Type => Parent (Result_Node),
Ref => Arg_Node)
then
Result_Node := Full_View (Result_Node);
end if;
-- FB02-015: Ada 2005 - reference to a record type with self-referencing
-- components, The front-end creates an incomplete type
-- declaration, and the Entity field may point to this
-- incomplete type.
if Ekind (Result_Node) = E_Incomplete_Type
and then
not Comes_From_Source (Result_Node)
and then
Nkind (Parent (Result_Node)) = N_Incomplete_Type_Declaration
then
Tmp_Node := Full_View (Result_Node);
if Present (Tmp_Node) then
Result_Node := Full_View (Result_Node);
end if;
end if;
-- F818-A05: reference to a formal parameter of a child subprogram in
-- case when the subprogram does not have a separate spec.
-- The front-end creates some artificial data structures to
-- represent this separate spec, so the entity field of a
-- parameter reference points to some artificial node
if Nkind (Parent (Result_Node)) = N_Parameter_Specification
and then
not (Comes_From_Source (Result_Node))
then
-- Check if we are in the artificial spec created for child
-- subprogram body:
Tmp_Node := Scope (Result_Node);
Tmp_Node := Parent (Parent (Parent (Tmp_Node)));
if Nkind (Tmp_Node) = N_Subprogram_Declaration
and then
not Comes_From_Source (Tmp_Node)
and then
Present (Parent_Spec (Tmp_Node))
and then
Present (Corresponding_Body (Tmp_Node))
then
-- Go to the defining identifier of this parameter in subprogram
-- body:
Tmp_Node := Corresponding_Body (Tmp_Node);
Tmp_Node := Parent (Parent (Tmp_Node));
Tmp_Node := First_Non_Pragma (Parameter_Specifications (Tmp_Node));
while Present (Tmp_Node) loop
if Chars (Defining_Identifier (Tmp_Node)) =
Chars (Result_Node)
then
Result_Node := Defining_Identifier (Tmp_Node);
exit;
end if;
Tmp_Node := Next_Non_Pragma (Tmp_Node);
end loop;
pragma Assert (Present (Tmp_Node));
end if;
end if;
-- E802-015: for a protected operation items that do not have separate
-- specs the front-end creates these specs and sets all the Entity
-- fields pointing to the entities from these artificial specs.
if Is_Artificial_Protected_Op_Item_Spec (Result_Node) then
if Ekind (Result_Node) in Formal_Kind then
Tmp_Node := Parent (Parent (Parent (Result_Node)));
Tmp_Node := Parent (Corresponding_Body (Tmp_Node));
Tmp_Node := First_Non_Pragma (Parameter_Specifications (Tmp_Node));
while Present (Tmp_Node) loop
if Chars (Defining_Identifier (Tmp_Node)) =
Chars (Result_Node)
then
Result_Node := Defining_Identifier (Tmp_Node);
exit;
else
Tmp_Node := Next_Non_Pragma (Tmp_Node);
end if;
end loop;
else
-- The only possibility - the protected operation entity
Result_Node := Corresponding_Body (Parent (Parent (Result_Node)));
end if;
end if;
-- See E421-006: problem with reference to a formal type in an expanded
-- code.
if Present (Result_Node)
and then
Is_Itype (Result_Node)
-- and then Present (Cloned_Subtype (Result_Node))
then
if Special_Case (Reference_I) = Dummy_Base_Attribute_Prefix then
Result_Node := Associated_Node_For_Itype (Result_Node);
else
Result_Node := Etype (Result_Node);
end if;
-- This is for E912-013
if No (Parent (Result_Node))
and then
Present (Associated_Node_For_Itype (Result_Node))
then
Result_Node :=
Defining_Identifier (Associated_Node_For_Itype (Result_Node));
elsif Special_Case (Reference_I) = Dummy_Base_Attribute_Prefix then
Result_Node := Defining_Identifier (Result_Node);
end if;
end if;
-- Problem with System redefined with Extend_System pragma (E315-001)
if Nkind (Arg_Node) in N_Has_Chars
and then
Chars (Arg_Node) = Name_System
and then
Chars (Result_Node) /= Name_System
and then
Nkind (Parent (Result_Node)) = N_Defining_Program_Unit_Name
then
Result_Node := Entity (Sinfo.Name (Parent (Result_Node)));
pragma Assert (Chars (Result_Node) = Name_System);
end if;
-- Problem with tasks defined by a single task definition: for such a
-- definition the front-end creates an artificial variable declaration
-- node, and for the references to such task, the Entity field points to
-- the entity node from this artificial variable declaration (E224-024).
-- The same problem exists for a single protected declaration
-- (E418-015)
Tmp_Node := Parent (Result_Node);
if Comes_From_Source (Result_Node)
and then
not Comes_From_Source (Tmp_Node)
and then
Nkind (Tmp_Node) = N_Object_Declaration
and then
not Constant_Present (Tmp_Node)
and then
No (Corresponding_Generic_Association (Tmp_Node))
then
Tmp_Node := Etype (Result_Node);
if Ekind (Tmp_Node) in Concurrent_Kind then
Result_Node := Parent (Result_Node);
while not (Nkind (Result_Node) = N_Task_Type_Declaration
or else
Nkind (Result_Node) = N_Protected_Type_Declaration)
loop
Result_Node := Prev (Result_Node);
end loop;
end if;
Result_Node := Defining_Identifier (Original_Node (Result_Node));
end if;
-- F703-020: see the comment marked by this TN in the body of
-- A4G.A_Sem.Get_Corr_Called_Entity
if not Comes_From_Source (Result_Node)
and then
Is_Overloadable (Result_Node)
and then
Present (Alias (Result_Node))
and then
not (Is_Intrinsic_Subprogram (Result_Node))
and then
Pass_Generic_Actual (Parent (Result_Node))
then
-- ???
Result_Node := Alias (Result_Node);
end if;
-- and here we have to solve the problem with generic instances:
-- for them Result_Node as it has been obtained above points not
-- to the defining identifier from the corresponding instantiation,
-- but to an entity defined in a "implicit" package created by the
-- compiler
if Is_Generic_Instance (Result_Node) then
Result_Node := Get_Instance_Name (Result_Node);
end if;
-- If the argument is Is_Part_Of_Implicit reference to a type, we
-- have to check if it is the reference to a type mark in parameter
-- or parameter and result profile of inherited subprogram and if it
-- should be substituted by the reference to the corresponding
-- derived type
Tmp_Node := Node_Field_1 (Reference_I);
if Ekind (Result_Node) in Einfo.Type_Kind
and then
Is_From_Inherited (Reference_I)
and then
Nkind (Tmp_Node) in Sinfo.N_Entity
and then
(Ekind (Tmp_Node) = E_Procedure or else
Ekind (Tmp_Node) = E_Function)
then
Result_Node := Get_Derived_Type (Type_Entity => Result_Node,
Inherited_Subpr => Tmp_Node);
end if;
-- labels (and, probably, statement names!!) makes another problem:
-- we have to return not the implicit label (statement identifier??)
-- declaration, but the label (statement name) attached to the
-- corresponding statement
if Nkind (Parent (Result_Node)) = N_Implicit_Label_Declaration then
Result_Node := Get_Statement_Identifier (Result_Node);
end if;
Tmp_Node := Original_Node (Parent (Parent (Result_Node)));
while Nkind (Tmp_Node) = N_Subprogram_Renaming_Declaration
and then
not (Comes_From_Source (Tmp_Node))
and then
not Pass_Generic_Actual (Tmp_Node)
loop
-- Result_Node is a defining name from the artificial renaming
-- declarations created by the compiler in the for wrapper
-- package for expanded subprogram instantiation. We
-- have to go to expanded subprogram spec which is renamed.
--
-- We have to do this in a loop in case of nested instantiations
Result_Node := Sinfo.Name (Tmp_Node);
if Nkind (Result_Node) = N_Selected_Component then
Result_Node := Selector_Name (Result_Node);
end if;
Result_Node := Entity (Result_Node);
Tmp_Node := Parent (Parent (Result_Node));
end loop;
-- -- ???
-- if Ekind (Result_Node) = E_Operator then
-- Result_Kind := N_Defining_Identifier_Mapping (Result_Node);
-- end if;
if Nkind (Parent (Result_Node)) = N_Defining_Program_Unit_Name or else
Nkind (Result_Node) = N_Defining_Program_Unit_Name
then
-- if we are processing the reference to a child unit, we have to
-- go from a defining identifier to the corresponding defining
-- unit name (the first part of the condition).
-- If this is a reference to a child subprogram, for which
-- the separate subprogram specification does not exist,
-- GNAT generates the tree structure corresponding to such a
-- separate subprogram specification, and it set the Entity
-- field for all references to this subprogram pointing
-- to the defining identifier in this inserted subprogram
-- specification. This case may be distinguished by the fact,
-- that Comes_From_Source field for this defining identifier
-- is set OFF. And in this case we have to go to the defining
-- identifier in the subprogram body:
if not Comes_From_Source (Result_Node) then
-- we have to go to the defining identifier in the
-- corresponding body:
while not (Nkind (Result_Node) = N_Subprogram_Declaration) loop
Result_Node := Parent (Result_Node);
end loop;
Result_Node := Corresponding_Body (Result_Node);
end if;
if Nkind (Result_Node) /= N_Defining_Program_Unit_Name then
Result_Node := Parent (Result_Node);
end if;
Result_Kind := A_Defining_Expanded_Name;
if not Comes_From_Source (Result_Node) then
-- now it means that we have a library level instantiation
-- of a generic child package
Result_Node := Parent (Parent (Result_Node));
Result_Node := Original_Node (Result_Node);
if Nkind (Result_Node) = N_Package_Declaration then
Result_Node := Sinfo.Corresponding_Body (Result_Node);
while Nkind (Result_Node) /= N_Package_Body loop
Result_Node := Parent (Result_Node);
end loop;
Result_Node := Original_Node (Result_Node);
end if;
Result_Node := Defining_Unit_Name (Result_Node);
end if;
end if;
if Nkind (Result_Node) = N_Defining_Identifier and then
(Ekind (Result_Node) = E_In_Parameter or else
Ekind (Result_Node) = E_Constant) and then
Present (Discriminal_Link (Result_Node))
then
-- here we have to go to an original discriminant
Result_Node := Discriminal_Link (Result_Node);
end if;
-- FA13-008: subtype mark in parameter specification in implicit "/="
-- declaration in case if in the corresponding "=" the parameter is
-- specified by 'Class attribute:
if Nkind (Arg_Node) = N_Identifier
and then
not Comes_From_Source (Arg_Node)
and then
Ekind (Result_Node) = E_Class_Wide_Type
and then
Result_Node /= Defining_Identifier (Parent (Result_Node))
then
Result_Node := Defining_Identifier (Parent (Result_Node));
end if;
-- Now we have Result_Node pointing to some defining name. There are
-- some kinds of entities which require special processing. For
-- implicitly declared entities we have to set Association_Type
-- pointing to a type which "generates" the corresponding implicit
-- declaration (there is no harm to set Association_Type for explicitly
-- declared entities, but for them it is of no use). For predefined
-- entities the special case attribute should be set.
----------------------------------------
-- temporary solution for 5522-003 ???--
----------------------------------------
-- The problem for record components:
--
-- 1. The Entity field for references to record components and
-- disciminants may point to field of some implicit types created
-- by the compiler
--
-- 2. The Entity field for the references to the (implicitly declared!)
-- components of a derived record type point to the explicit
-- declarations of the component of the ancestor record type
--
-- 3. Probably, all this stuff should be incapsulated in a separate
-- subprogram???
-- Here we already have Result_Node:
if Nkind (Result_Node) = N_Defining_Identifier and then
(Ekind (Result_Node) = E_Component or else
Ekind (Result_Node) = E_Discriminant or else
Ekind (Result_Node) = E_Entry or else
Ekind (Result_Node) = E_Procedure or else
Ekind (Result_Node) = E_Function)
then
-- first, we compute Association_Type as pointed to a type
-- declaration for which Agr_Node is a component:
if No (Association_Type) then
Association_Type := Parent (Arg_Node);
if Nkind (Association_Type) = N_Function_Call then
Association_Type := Sinfo.Name (Association_Type);
end if;
case Nkind (Association_Type) is
when N_Component_Clause =>
Association_Type :=
Sinfo.Identifier (Parent (Association_Type));
when N_Selected_Component =>
Association_Type := Prefix (Association_Type);
if Nkind (Association_Type) = N_Attribute_Reference
and then
(Attribute_Name (Association_Type) =
Name_Unrestricted_Access
or else
Attribute_Name (Association_Type) = Name_Access)
then
-- See G222-012
Association_Type := Prefix (Association_Type);
end if;
if Nkind (Association_Type) = N_Selected_Component then
Association_Type := Selector_Name (Association_Type);
end if;
when N_Component_Association =>
Association_Type := Parent (Association_Type);
when N_Discriminant_Association =>
if Arg_Node = Sinfo.Expression (Association_Type) then
-- using a discriminant in initialization expression
Association_Type := Empty;
else
Association_Type := Scope (Result_Node);
end if;
when others =>
-- We set Association_Type as Empty to indicate the case of
-- a definitely explicit result
Association_Type := Empty;
end case;
end if;
if Present (Association_Type) then
if not (Comes_From_Source (Association_Type)
and then
Nkind (Association_Type) in N_Entity
and then
Ekind (Association_Type) in Einfo.Type_Kind)
then
Association_Type := Etype (Association_Type);
end if;
if Nkind (Original_Node (Parent (Association_Type))) =
N_Single_Task_Declaration
or else
Nkind (Original_Node (Parent (Association_Type))) =
N_Single_Protected_Declaration
then
Association_Type := Empty;
else
if Ekind (Result_Node) = E_Component
and then
not Comes_From_Source (Parent (Result_Node))
and then
Ekind (Association_Type) in Private_Kind
then
Association_Type := Full_View (Association_Type);
end if;
Association_Type :=
Explicit_Type_Declaration_Unwound_Unaccess
(Association_Type, Arg_Node);
if Nkind (Original_Node (Association_Type)) in
N_Protected_Type_Declaration ..
N_Private_Extension_Declaration
then
Association_Type :=
Parent
(Full_View (Defining_Identifier (Original_Node
(Association_Type))));
end if;
end if;
end if;
-- then, we have to adjust result Node:
if Ekind (Result_Node) = E_Discriminant and then
Chars (Discriminal (Result_Node)) /=
Chars (Original_Record_Component (Result_Node))
then
-- This condition is the clue for discriminants explicitly
-- declared in declarations of derived types.
-- These assignments below resets Result_Node to
-- N_Defining_Identifier node which denotes the same discriminant
-- but has a properly set bottom-up chain of Parent nodes
Result_Node := Discriminal (Result_Node);
Result_Node := Discriminal_Link (Result_Node);
else
-- There we have to come from an implicit type to a explicitly
-- declared type:
Tmp_Node := Scope (Result_Node);
if Ekind (Tmp_Node) = E_Record_Subtype then
Tmp_Node := Etype (Tmp_Node);
end if;
if (Ekind (Result_Node) = E_Component
or else
Ekind (Result_Node) = E_Discriminant)
and then
not (Comes_From_Source (Result_Node)
and then
not Comes_From_Source (Parent (Result_Node)))
then
-- This condition leaves unchanged inherited discriminants
-- of derived record types
Tmp_Node := First_Entity (Tmp_Node);
while Present (Tmp_Node) loop
if Chars (Tmp_Node) = Chars (Result_Node) then
Result_Node := Tmp_Node;
exit;
end if;
Tmp_Node := Next_Entity (Tmp_Node);
end loop;
end if;
end if;
-- A private type may require some special adjustment in case if
-- full view is visible: if Result_Node is a discriminant:
-- it points to a discriminant in a private view, and we have
-- to reset it to point to the discriminant in the full view
if Present (Association_Type)
and then
Has_Private_Declaration (Defining_Identifier (Association_Type))
and then
Ekind (Result_Node) = E_Discriminant
and then
Nkind (Association_Type) /= N_Private_Type_Declaration
and then
Nkind (Association_Type) /= N_Private_Extension_Declaration
and then
Is_Type_Discriminant (Result_Node,
Original_Node (Association_Type))
then
Result_Node := Reset_To_Full_View (Association_Type, Result_Node);
end if;
-- Now, we have to define if we have an implicit component here.
-- Result_Context_Node is finally supposed to be set to the
-- declaration of the type to which the argument component belongs
if No (Association_Type) then
-- definitely explicit result:
Is_Inherited := False;
elsif Is_Rewrite_Substitution (Association_Type) then
-- here we have a derived type with no record extension part
-- but it can have an explicitly declared discriminant
if Ekind (Result_Node) = E_Discriminant then
Is_Inherited := not (Is_Type_Discriminant (
Result_Node, Original_Node (Association_Type)));
else
Is_Inherited := True;
end if;
elsif Nkind (Association_Type) = N_Incomplete_Type_Declaration
or else
Nkind (Association_Type) = N_Private_Extension_Declaration
or else
Nkind (Association_Type) = N_Private_Type_Declaration
or else
Nkind (Association_Type) = N_Task_Type_Declaration
or else
Nkind (Association_Type) = N_Protected_Type_Declaration
or else
(Nkind (Association_Type) = N_Formal_Type_Declaration and then
Nkind (Sinfo.Formal_Type_Definition (Association_Type)) =
N_Formal_Private_Type_Definition)
or else
Nkind (Sinfo.Type_Definition (Association_Type)) =
N_Record_Definition
then
-- should be an explicit component
Is_Inherited := False;
-- Patch for E407-A08
if Ekind (Result_Node) = E_Component then
Result_Node := Original_Record_Component (Result_Node);
end if;
elsif Nkind (Sinfo.Type_Definition (Association_Type)) =
N_Derived_Type_Definition
then
-- it may be an inherited component or an explicitly declared
-- discriminant or a component from a record extension part
if Is_Explicit_Type_Component (Result_Node, Association_Type) then
Is_Inherited := False;
else
Is_Inherited := True;
end if;
else
-- ??? this Assert pragma - only for development/debug period
-- ??? what else except N_Selected_Component could be here
null;
pragma Assert (False);
end if;
end if;
-------------------------------------------------
-- end for the temporary solution for 5522-003 --
-------------------------------------------------
--------------------------
-- Enumeration literals --
--------------------------
if not (Defined_In_Standard (Arg_Node))
and then
Nkind (Result_Node) = N_Defining_Identifier
-- or else
-- Nkind (Result_Node) = N_Defining_Character_Literal)
and then
Ekind (Result_Node) = E_Enumeration_Literal
and then (not Comes_From_Source (Result_Node))
then
-- an enumeration literal inherited by a derived type definition
-- (character literals are still processed by a separate function
-- Character_Literal_Name_Definition, that's why the corresponding
-- part of the condition is commented out)
-- ???Needs revising for the new model of implicit Elements
Is_Inherited := True;
Association_Type := Etype (Arg_Node);
Association_Type :=
Explicit_Type_Declaration_Unwound (Association_Type);
end if;
---------------------------------------
-- The rest of special processing: --
-- somewhat messy and needs revising --
---------------------------------------
-- We have to turn off for a while the full processing of the
-- implicit elements (Hope to fix this soon).
if Defined_In_Standard (Arg_Node)
or else
Sloc (Arg_Node) <= Standard_Location
or else
Sloc (Result_Node) <= Standard_Location
then
-- We need the second part of the condition for references to
-- Standard.Characters which are parts of the definitions in
-- the ASCII package
if Ekind (Result_Node) = E_Operator then
return Nil_Element;
else
-- I hope, that I'm right, that all the *identifiers* declared
-- in standard are declared explicitly, and all the rest
-- (which are defined in Standard) are implicit
-- Root and universal types can make a problem, but let's
-- see it before...
Spec_Case := Explicit_From_Standard;
end if;
else
if Result_Kind in Internal_Defining_Operator_Kinds then
if Is_Predefined (Result_Node) then
Spec_Case := Predefined_Operation;
-- -- note, that Predefined_Operation corresponds to an
-- -- implicitly declared operation of a type, which is defined
-- -- not in the Standard package
-- Association_Type := Enclosed_Type (Result_Node);
-- -- we have to use namely Association_Type, but not Result_Node
-- -- to define Result_Unit, because sometimes Result_Node
-- -- does not have the Parent field set
return Nil_Element;
-- ???!!! this turns off all the predefined operations
-- !!!??? defined not in Standard
elsif Is_Impl_Neq (Result_Node) then
Spec_Case := Is_From_Imp_Neq_Declaration;
end if;
end if;
end if;
-------------------
-- Limited views --
-------------------
if Spec_Case = Not_A_Special_Case then
Tmp_Node := Result_Node;
if Nkind (Tmp_Node) = N_Defining_Program_Unit_Name then
Tmp_Node := Defining_Identifier (Tmp_Node);
end if;
if Nkind (Tmp_Node) in N_Entity then
case Ekind (Tmp_Node) is
when Einfo.Type_Kind =>
if not Comes_From_Source (Tmp_Node)
and then
Ekind (Tmp_Node) in Incomplete_Kind
and then
Present (Non_Limited_View (Tmp_Node))
then
Spec_Case := From_Limited_View;
Result_Node := Non_Limited_View (Result_Node);
end if;
when E_Package =>
if not Is_Generic_Instance (Tmp_Node) then
if not Analyzed (Parent (Result_Node)) then
Spec_Case := From_Limited_View;
elsif Is_Limited_Withed (Result_Node, Reference_I) then
Spec_Case := From_Limited_View;
end if;
end if;
when others =>
null;
end case;
end if;
end if;
if Spec_Case not in Predefined
and then
Spec_Case /= Is_From_Imp_Neq_Declaration
and then
Spec_Case /= From_Limited_View
and then
not Comes_From_Source (Result_Node)
and then
No (Association_Type)
and then
not Part_Of_Pass_Generic_Actual (Result_Node)
then
-- Here we may have the following possibilities:
-- - library-level subprogram instantiation;
-- - artificial entity created for an inner package from a package
-- "withed" by a limited with clause;
-- - defining name from the artificial spec created for subprogram
-- body which acts as a spec;
-- - prefix of the artificial 'Class attribute reference (ASIS has
-- to emulate such an attribute reference in case if a class-wide
-- type is use as an actual type in the instantiation);
-- - index (sub)type in case if the corresponding type is declared as
-- private (F424-A01);
-- - F619-024;
-- - F627-001
-- - inherited subprogram;
if Nkind (Parent (Result_Node)) in N_Subprogram_Specification then
if Is_Generic_Instance (Result_Node) then
-- Library-level subprogram instantiation
-- Here we have to go from the rewritten to the original
-- tree structure
-- This code appeared at some point, but it seems that it is
-- of no real need. Will be for a while - just in case.
-- It does not allow to fix G312-006
-- ???
-- Result_Node := Parent (Parent (Parent (Parent (Result_Node))));
-- Result_Node := Original_Node (Result_Node);
-- Result_Node := Sinfo.Defining_Unit_Name (Result_Node);
null;
else
-- Artificial subprogram spec created for the body acting
-- as spec
Result_Node := Parent (Parent (Result_Node));
Result_Node := Corresponding_Body (Result_Node);
end if;
elsif Nkind (Parent (Result_Node)) = N_Package_Specification
and then
Comes_From_Source (Parent (Result_Node))
then
-- An artificial internal entity created for a local package
-- from a package that is "withed" by limited with clause
-- We go to the entity node the package spec points to.
-- See F310-025 and F311-003.
Result_Node := Defining_Unit_Name (Parent (Result_Node));
elsif Special_Case (Reference_I) = Dummy_Class_Attribute_Prefix
and then
Ekind (Result_Node) = E_Class_Wide_Type
then
Result_Node := Defining_Identifier (Parent (Result_Node));
elsif Ekind (Result_Node) in Discrete_Kind
and then
Nkind (Parent (Result_Node)) = N_Subtype_Declaration
then
-- Go to the full view of the corresponding private type:
Result_Node := Sinfo.Subtype_Indication (Parent (Result_Node));
Result_Node := Entity (Result_Node);
pragma Assert (Ekind (Result_Node) in Private_Kind);
Result_Node := Full_View (Result_Node);
elsif Ekind (Result_Node) = E_Package
and then
Is_Hidden (Result_Node)
and then
Is_Rewrite_Substitution (R_Node (Reference_I))
then
-- This is the case when we have a reference to the instantiation
-- of generic parent in the instantiation of generic child,
-- see F619-024
Result_Node := Entity (R_Node (Reference_I));
if Nkind (Parent (Result_Node)) = N_Defining_Program_Unit_Name then
Result_Node := Parent (Result_Node);
Result_Kind := A_Defining_Expanded_Name;
end if;
elsif Ekind (Result_Node) = E_Package
and then
Nkind (Parent (Result_Node)) = N_Package_Renaming_Declaration
and then
not Comes_From_Source (Parent (Result_Node))
then
-- Reference_I is the reference to the name of the instantiation
-- inside an expanded template, but the name of the template is
-- the defining expanded name. In this case we have to use the
-- entity of the rewritten node (F627-001)
Result_Node := Entity (R_Node (Reference_I));
else
-- It should be inherited!
-- The last condition is needed to filter out already processed
-- cases. This case corresponds to inherited user-defined
-- subprograms
Is_Inherited := True;
if Ekind (Result_Node) = E_Function or else
Ekind (Result_Node) = E_Procedure
then
Association_Type := Result_Node;
-- Points to the defining identifier of implicit inherited
-- subprogram
Result_Node := Explicit_Parent_Subprogram (Result_Node);
-- Now Result_Node points to the defining identifier of
-- explicit subprogram which is inherited
else
-- ??? Probably will need revising when inherited record
-- components and enumeration literals are fully
-- implemented
Association_Type := Defining_Identifier (Parent (Result_Node));
Association_Type := First_Subtype (Association_Type);
end if;
end if;
end if;
if Defined_In_Standard (Arg_Node) then
-- Here we may need to adjust the result node in case if it is an
-- entity representing an unconstrained base type for a signed
-- integer type (see Cstand.Create_Unconstrained_Base_Type)
if No (Parent (Result_Node))
and then
Ekind (Result_Node) = E_Signed_Integer_Type
then
Result_Node := Parent (Scalar_Range (Result_Node));
end if;
Result_Unit := Get_Comp_Unit
(Standard_Id, Encl_Cont_Id (Reference_I));
else
if Result_Kind in Internal_Defining_Operator_Kinds and then
Is_Predefined (Result_Node)
then
null;
-- -- note, that Predefined_Operation corresponds to an
-- -- implicitly declared operation of a type, which is defined
-- -- not in the Standard package
-- Association_Type := Enclosed_Type (Result_Node);
-- -- we have to use namely Association_Type, but not Result_Node
-- -- to define Result_Unit, because sometimes Result_Node
-- -- does not have the Parent field set
-- Result_Unit :=
-- Enclosing_Unit (Encl_Cont_Id (Reference_I), Association_Type);
return Nil_Element;
-- ???!!! this turns off all the predefined operations
-- !!!??? defined not in Standard
elsif Is_Inherited then
Result_Unit :=
Enclosing_Unit (Encl_Cont_Id (Reference_I), Association_Type);
else
Result_Unit :=
Enclosing_Unit (Encl_Cont_Id (Reference_I), Result_Node);
end if;
end if;
if Is_Inherited
and then
(Ekind (Result_Node) = E_Component or else
Ekind (Result_Node) = E_Discriminant)
then
Componnet_Name := Result_Node;
end if;
-- A special case of fake Numeric_Error renaming is handled
-- separately (see B712-0050)
if Result_Node = Standard_Constraint_Error and then
Chars (Result_Node) /= Chars (Arg_Node)
then
Result := Get_Numeric_Error_Renaming;
Set_Int_Kind (Result, A_Defining_Identifier);
else
Result :=
Node_To_Element_New (Node => Result_Node,
Node_Field_1 => Association_Type,
Node_Field_2 => Componnet_Name,
Internal_Kind => Result_Kind,
Spec_Case => Spec_Case,
Inherited => Is_Inherited,
In_Unit => Result_Unit);
end if;
-- See the comment in the body of A4G.A_Sem.Get_Corr_Called_Entity
if Present (Association_Type) then
if Is_From_Instance (Association_Type) then
Set_From_Instance (Result, True);
else
Set_From_Instance (Result, False);
end if;
end if;
if Spec_Case = From_Limited_View then
Set_From_Implicit (Result, True);
end if;
return Result;
end Identifier_Name_Definition;
--------------------------------
-- Is_Explicit_Type_Component --
--------------------------------
function Is_Explicit_Type_Component
(Comp_Def_Name : Node_Id;
Type_Decl : Node_Id)
return Boolean
is
Result : Boolean := False;
Cont_Node : Node_Id;
begin
Cont_Node := Parent (Comp_Def_Name);
while Present (Cont_Node) loop
if Cont_Node = Type_Decl then
Result := True;
exit;
end if;
Cont_Node := Parent (Cont_Node);
end loop;
return Result;
end Is_Explicit_Type_Component;
------------------------------
-- Is_From_Dispatching_Call --
------------------------------
function Is_From_Dispatching_Call (Reference : Element) return Boolean is
Can_Be_Dynamically_Identified : Boolean := False;
Ref_Node : Node_Id;
Parent_Ref_Node : Node_Id;
Ref_Entity : Entity_Id;
Parent_Call : Node_Id := Empty;
Result : Boolean := False;
begin
Ref_Node := R_Node (Reference);
if not (Nkind (Ref_Node) = N_Identifier
or else
Nkind (Ref_Node) = N_Operator_Symbol)
then
return False;
end if;
Parent_Ref_Node := Parent (Ref_Node);
if Nkind (Parent_Ref_Node) = N_Expanded_Name
and then
Ref_Node = Selector_Name (Parent_Ref_Node)
then
Ref_Node := Parent (Ref_Node);
Parent_Ref_Node := Parent (Ref_Node);
end if;
-- First, detect if Reference indeed can be dynamically identified, that
-- is, it is either a subprogram name in a call or a formal parameter
-- name in a parameter association. Because of the performance reasons,
-- we do this on the tree structures, but not using ASIS queries
case Nkind (Parent_Ref_Node) is
when N_Parameter_Association =>
if Selector_Name (Parent_Ref_Node) = Ref_Node then
Can_Be_Dynamically_Identified := True;
end if;
when N_Procedure_Call_Statement |
N_Function_Call =>
if Sinfo.Name (Parent_Ref_Node) = Ref_Node then
Can_Be_Dynamically_Identified := True;
end if;
when others =>
null;
end case;
if Can_Be_Dynamically_Identified then
Ref_Entity := Entity (Ref_Node);
if No (Ref_Entity)
and then
Nkind (Parent (Ref_Node)) = N_Expanded_Name
and then
Ref_Node = Selector_Name (Parent (Ref_Node))
then
Ref_Node := Parent (Ref_Node);
Ref_Entity := Entity (Ref_Node);
end if;
if Present (Ref_Entity) then
case Ekind (Ref_Entity) is
when Formal_Kind =>
Parent_Call := Parent (Parent (Ref_Node));
when Subprogram_Kind =>
Parent_Call := Parent (Ref_Node);
when others =>
null;
end case;
end if;
if Present (Parent_Call)
and then
(Nkind (Parent_Call) = N_Procedure_Call_Statement
or else
Nkind (Parent_Call) = N_Function_Call)
and then
Present (Controlling_Argument (Parent_Call))
then
Result := True;
end if;
end if;
return Result;
end Is_From_Dispatching_Call;
----------------------------
-- Is_Implicit_Formal_Par --
----------------------------
function Is_Implicit_Formal_Par (Result_El : Element) return Boolean is
Result : Boolean := False;
Res_Node : constant Node_Id := Node (Result_El);
Parent_Node : Node_Id;
begin
if Nkind (Res_Node) in N_Entity
and then
Ekind (Res_Node) in Formal_Kind
then
Parent_Node := Parent (Res_Node);
if Present (Parent_Node)
and then
Nkind (Parent_Node) = N_Parameter_Specification
and then
Res_Node /= Defining_Identifier (Parent_Node)
then
-- The condition is no more than just a clue...
Result := True;
end if;
end if;
return Result;
end Is_Implicit_Formal_Par;
-----------------------
-- Is_Limited_Withed --
-----------------------
function Is_Limited_Withed
(E : Entity_Id;
Reference : Asis.Element)
return Boolean
is
Result : Boolean := False;
CU_E : Asis.Compilation_Unit;
CU_R : Asis.Compilation_Unit;
begin
CU_E := Enclosing_Unit (Encl_Cont_Id (Reference), E);
if Unit_Kind (CU_E) = A_Package then
CU_R := Enclosing_Compilation_Unit (Reference);
if not Is_Equal (CU_R, CU_E) then
declare
CU_E_Name : constant Program_Text :=
To_Upper_Case (Unit_Full_Name (CU_E));
Comp_Clauses : constant Asis.Element_List :=
Context_Clause_Elements (CU_R);
Name_List : Element_List_Access;
begin
for C in Comp_Clauses'Range loop
if Trait_Kind (Comp_Clauses (C)) in
A_Limited_Trait .. A_Limited_Private_Trait
then
Name_List :=
new Asis.Element_List'(Clause_Names (Comp_Clauses (C)));
for N in Name_List'Range loop
if To_Upper_Case (Full_Name_Image (Name_List (N))) =
CU_E_Name
then
Free (Name_List);
Result := True;
exit;
end if;
end loop;
Free (Name_List);
end if;
end loop;
end;
end if;
end if;
return Result;
end Is_Limited_Withed;
-----------------------------------
-- Is_Part_Of_Defining_Unit_Name --
-----------------------------------
function Is_Part_Of_Defining_Unit_Name
(Name_Node : Node_Id)
return Boolean
is
Result : Boolean := False;
Next_Node : Node_Id := Parent (Name_Node);
begin
while Present (Next_Node) loop
if Nkind (Next_Node) = N_Defining_Program_Unit_Name then
Result := True;
exit;
elsif not (Nkind (Next_Node) = N_Expanded_Name or else
Nkind (Next_Node) = N_Selected_Component)
then
-- theoretically, we need only the first part of the condition,
-- but the unit name in the body is not fully decorated and,
-- therefore, has the wrong syntax structure, so we need the
-- second part. We are keeping both in order to have the correct
-- code if it is changed in the tree.
exit;
else
Next_Node := Parent (Next_Node);
end if;
end loop;
return Result;
end Is_Part_Of_Defining_Unit_Name;
------------------
-- Is_Reference --
------------------
function Is_Reference
(Name : Asis.Element;
Ref : Asis.Element)
return Boolean
is
Ref_Kind : constant Internal_Element_Kinds := Reference_Kind (Name);
Result : Boolean := False;
begin
if Int_Kind (Ref) = Ref_Kind then
begin
if Is_Equal (Corresponding_Name_Definition (Ref), Name) then
Result := True;
end if;
exception
-- Corresponding_Name_Definition may raise Asis_Failed with
-- Value_Error status when applied to identifiers which
-- cannot have definitions (see section 17.6). Here we
-- have to skip such Elements paying no attention to
-- exception raising
when others => null;
end;
end if;
return Result;
end Is_Reference;
--------------------------
-- Is_Type_Discriminant --
--------------------------
function Is_Type_Discriminant
(Discr_Node : Node_Id;
Type_Node : Node_Id)
return Boolean
is
Discr_Chars : constant Name_Id := Chars (Discr_Node);
Discr_List : List_Id;
Next_Discr_Spec : Node_Id;
Result : Boolean := False;
begin
Discr_List := Discriminant_Specifications (Type_Node);
if Present (Discr_List) then
Next_Discr_Spec := First (Discr_List);
while Present (Next_Discr_Spec) loop
if Chars (Defining_Identifier (Next_Discr_Spec)) = Discr_Chars then
Result := True;
exit;
end if;
Next_Discr_Spec := Next (Next_Discr_Spec);
end loop;
end if;
return Result;
end Is_Type_Discriminant;
----------------
-- Needs_List --
----------------
function Needs_List (Reference : Asis.Element) return Boolean is
Result : Boolean := False;
N : Node_Id := R_Node (Reference);
Entity_N : Entity_Id;
Pragma_Name_Id : Name_Id;
begin
if Nkind (Parent (N)) = N_Pragma_Argument_Association then
Pragma_Name_Id := Pragma_Name (Parent (Parent (N)));
if Pragma_Name_Id = Name_Asynchronous or else
Pragma_Name_Id = Name_Convention or else
Pragma_Name_Id = Name_Export or else
Pragma_Name_Id = Name_Import or else
Pragma_Name_Id = Name_Inline
then
Entity_N := Entity (N);
if Present (Entity_N) and then
Is_Overloadable (Entity_N) and then
Has_Homonym (Entity_N)
then
-- ??? Is this the right condition???
-- ??? At the moment we do not consider any GNAT-specific
-- pragma
N := Homonym (Entity_N);
if Present (N)
and then
(not (Sloc (N) <= Standard_Location
-- !!! Note, that this check filters out the predefined
-- implicitly declared operations!!!
or else
Part_Of_Pass_Generic_Actual (N)
or else
(Ekind (N) in Subprogram_Kind and then
Is_Formal_Subprogram (N))))
then
Result := True;
end if;
end if;
end if;
end if;
return Result;
end Needs_List;
--------------------
-- Reference_Kind --
--------------------
function Reference_Kind
(Name : Asis.Element)
return Internal_Element_Kinds
is
Arg_Kind : Internal_Element_Kinds := Int_Kind (Name);
Result : Internal_Element_Kinds := Not_An_Element;
begin
if Arg_Kind in Internal_Defining_Name_Kinds then
if Arg_Kind = A_Defining_Expanded_Name then
Arg_Kind := Int_Kind (Defining_Selector (Name));
end if;
end if;
case Arg_Kind is
when A_Defining_Identifier =>
Result := An_Identifier;
when A_Defining_Character_Literal =>
Result := A_Character_Literal;
when A_Defining_Enumeration_Literal =>
Result := An_Enumeration_Literal;
when A_Defining_And_Operator =>
Result := An_And_Operator;
when A_Defining_Or_Operator =>
Result := An_Or_Operator;
when A_Defining_Xor_Operator =>
Result := An_Xor_Operator;
when A_Defining_Equal_Operator =>
Result := An_Equal_Operator;
when A_Defining_Not_Equal_Operator =>
Result := A_Not_Equal_Operator;
when A_Defining_Less_Than_Operator =>
Result := A_Less_Than_Operator;
when A_Defining_Less_Than_Or_Equal_Operator =>
Result := A_Less_Than_Or_Equal_Operator;
when A_Defining_Greater_Than_Operator =>
Result := A_Greater_Than_Operator;
when A_Defining_Greater_Than_Or_Equal_Operator =>
Result := A_Greater_Than_Or_Equal_Operator;
when A_Defining_Plus_Operator =>
Result := A_Plus_Operator;
when A_Defining_Minus_Operator =>
Result := A_Minus_Operator;
when A_Defining_Concatenate_Operator =>
Result := A_Concatenate_Operator;
when A_Defining_Unary_Plus_Operator =>
Result := A_Unary_Plus_Operator;
when A_Defining_Unary_Minus_Operator =>
Result := A_Unary_Minus_Operator;
when A_Defining_Multiply_Operator =>
Result := A_Multiply_Operator;
when A_Defining_Divide_Operator =>
Result := A_Divide_Operator;
when A_Defining_Mod_Operator =>
Result := A_Mod_Operator;
when A_Defining_Rem_Operator =>
Result := A_Rem_Operator;
when A_Defining_Exponentiate_Operator =>
Result := An_Exponentiate_Operator;
when A_Defining_Abs_Operator =>
Result := An_Abs_Operator;
when A_Defining_Not_Operator =>
Result := A_Not_Operator;
when others =>
null;
end case;
return Result;
end Reference_Kind;
------------------------
-- Reset_To_Full_View --
------------------------
function Reset_To_Full_View
(Full_View : Node_Id;
Discr : Node_Id)
return Node_Id
is
Result : Node_Id;
Discr_Chars : constant Name_Id := Chars (Discr);
begin
Result := First (Discriminant_Specifications (Full_View));
while Present (Result) loop
exit when Chars (Defining_Identifier (Result)) = Discr_Chars;
Result := Next (Result);
end loop;
pragma Assert (Present (Result));
Result := Defining_Identifier (Result);
return Result;
end Reset_To_Full_View;
-------------------
-- Reset_To_Spec --
-------------------
function Reset_To_Spec (Name_Node : Node_Id) return Node_Id is
Result : Node_Id := Empty;
Next_Node : Node_Id := Parent (Name_Node);
Name_Chars : constant Name_Id := Chars (Name_Node);
begin
while Nkind (Next_Node) /= N_Defining_Program_Unit_Name loop
Next_Node := Parent (Next_Node);
end loop;
if Nkind (Parent (Next_Node)) in N_Subprogram_Specification then
Next_Node := Parent (Next_Node);
end if;
Next_Node := Corresponding_Spec (Parent (Next_Node));
while Nkind (Next_Node) /= N_Defining_Program_Unit_Name loop
Next_Node := Parent (Next_Node);
end loop;
Next_Node := Parent (Next_Node);
Next_Node := Defining_Unit_Name (Next_Node);
-- Now Next_Node should point to the defining program unit name in the
-- spec:
Next_Node := Sinfo.Name (Next_Node);
while Present (Next_Node) loop
if Nkind (Next_Node) = N_Expanded_Name then
Next_Node := Selector_Name (Next_Node);
end if;
if Name_Chars = Chars (Next_Node) then
Result := Next_Node;
exit;
end if;
Next_Node := Parent (Next_Node);
if Nkind (Next_Node) = N_Expanded_Name then
Next_Node := Prefix (Next_Node);
else
exit;
end if;
end loop;
pragma Assert (Present (Result));
return Result;
end Reset_To_Spec;
---------------------
-- Rewritten_Image --
---------------------
function Rewritten_Image (Selector_Name : Node_Id) return Node_Id is
Name_Chars : constant Name_Id := Chars (Selector_Name);
Aggr_Node : Node_Id;
Result_Node : Node_Id := Empty;
Association_Node : Node_Id;
Choice_Node : Node_Id;
begin
-- may be, we have to be more smart for aggregates in aggregates...
Aggr_Node := Parent (Selector_Name);
-- we are in N_Component_Association node, and its Parent points not
-- to the original, but to the rewritten structure for aggregate
Aggr_Node := Parent (Aggr_Node);
-- we are in the rewritten node for the aggregate
pragma Assert (
(Nkind (Aggr_Node) = N_Aggregate or else
Nkind (Aggr_Node) = N_Extension_Aggregate)
and then
Is_Rewrite_Substitution (Aggr_Node));
-- and now - traversing the rewritten structure
Association_Node :=
First_Non_Pragma (Component_Associations (Aggr_Node));
Associations : while Present (Association_Node) loop
Choice_Node := First_Non_Pragma (Choices (Association_Node));
-- in the rewritten aggregate it is exactly one choice in any
-- component association
if Chars (Choice_Node) = Name_Chars then
Result_Node := Choice_Node;
exit Associations;
end if;
Association_Node := Next_Non_Pragma (Association_Node);
end loop Associations;
pragma Assert (Present (Result_Node));
return Result_Node;
end Rewritten_Image;
------------------------
-- Search_Record_Comp --
------------------------
function Search_Record_Comp (Selector_Name : Node_Id) return Entity_Id is
Result : Entity_Id := Empty;
Res_Chars : constant Name_Id := Chars (Selector_Name);
Aggr_Type : Entity_Id;
begin
Aggr_Type := Parent (Selector_Name);
while not (Nkind (Aggr_Type) = N_Extension_Aggregate
or else
Nkind (Aggr_Type) = N_Aggregate
or else
No (Aggr_Type))
loop
Aggr_Type := Parent (Aggr_Type);
end loop;
if No (Aggr_Type) then
-- This definitely means that something went wrong...
pragma Assert (False);
return Empty;
end if;
Aggr_Type := Etype (Aggr_Type);
while Ekind (Aggr_Type) /= E_Record_Type loop
if Ekind (Aggr_Type) = E_Private_Type
or else
Ekind (Aggr_Type) = E_Limited_Private_Type
or else
Ekind (Aggr_Type) = E_Record_Type_With_Private
then
Aggr_Type := Full_View (Aggr_Type);
else
Aggr_Type := Etype (Aggr_Type);
end if;
end loop;
Result := First_Entity (Aggr_Type);
while Chars (Result) /= Res_Chars loop
Result := Next_Entity (Result);
end loop;
pragma Assert (Present (Result));
return Result;
end Search_Record_Comp;
-------------------
-- To_Upper_Case --
-------------------
function To_Upper_Case (S : Wide_String) return Wide_String is
Result : Wide_String (S'Range);
begin
for J in Result'Range loop
Result (J) := Ada.Wide_Characters.Unicode.To_Upper_Case (S (J));
end loop;
return Result;
end To_Upper_Case;
end A4G.Expr_Sem;
|
-- C64005DA.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.
--*
-- JRK 7/30/84
SEPARATE (C64005D0M)
PROCEDURE C64005DA (L : LEVEL; C : CALL; T : IN OUT TRACE) IS
V : STRING (1..2);
M : CONSTANT NATURAL := LEVEL'POS (L) -
LEVEL'POS (LEVEL'FIRST) + 1;
N : CONSTANT NATURAL := 2 * M + 1;
PROCEDURE C64005DB (L : LEVEL; C : CALL; T : IN OUT TRACE) IS
SEPARATE;
BEGIN
V (1) := IDENT_CHAR (ASCII.LC_A);
V (2) := C;
-- APPEND ALL V TO T.
T.S (T.E+1 .. T.E+N) := C64005D0M.V & C64005DA.V;
T.E := T.E + N;
CASE C IS
WHEN '1' =>
C64005DB (LEVEL'SUCC(L), IDENT_CHAR('1'), T);
WHEN '2' =>
C64005DA (L, IDENT_CHAR('3'), T);
WHEN '3' =>
C64005DB (LEVEL'SUCC(L), IDENT_CHAR('2'), T);
END CASE;
-- APPEND ALL L AND C TO T IN REVERSE ORDER.
T.S (T.E+1 .. T.E+N) := C64005DA.L & C64005DA.C & C64005D0M.L;
T.E := T.E + N;
END C64005DA;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . I M G _ F I X E D _ 6 4 --
-- --
-- S p e c --
-- --
-- Copyright (C) 2020-2021, 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 the routines for supporting the Image attribute for
-- ordinary fixed point types up to 64-bit small and mantissa.
with Interfaces;
with System.Arith_64;
with System.Image_F;
package System.Img_Fixed_64 is
pragma Pure;
subtype Int64 is Interfaces.Integer_64;
package Impl is new Image_F (Int64, Arith_64.Scaled_Divide64);
procedure Image_Fixed64
(V : Int64;
S : in out String;
P : out Natural;
Num : Int64;
Den : Int64;
For0 : Natural;
Aft0 : Natural)
renames Impl.Image_Fixed;
procedure Set_Image_Fixed64
(V : Int64;
S : in out String;
P : in out Natural;
Num : Int64;
Den : Int64;
For0 : Natural;
Aft0 : Natural;
Fore : Natural;
Aft : Natural;
Exp : Natural)
renames Impl.Set_Image_Fixed;
end System.Img_Fixed_64;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- SYSTEM.TASKING.PROTECTED_OBJECTS.SINGLE_ENTRY --
-- --
-- S p e c --
-- --
-- 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/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides an optimized version of Protected_Objects.Operations
-- and Protected_Objects.Entries making the following assumptions:
-- PO have only one entry
-- There is only one caller at a time (No_Entry_Queue)
-- There is no dynamic priority support (No_Dynamic_Priorities)
-- No Abort Statements
-- (No_Abort_Statements, Max_Asynchronous_Select_Nesting => 0)
-- PO are at library level
-- None of the tasks will terminate (no need for finalization)
-- This interface is intended to be used in the Ravenscar profile, the
-- compiler is responsible for ensuring that the conditions mentioned above
-- are respected, except for the No_Entry_Queue restriction that is checked
-- dynamically in this package, since the check cannot be performed at compile
-- time, and is relatively cheap (see body).
-- This package is part of the high level tasking interface used by the
-- compiler to expand Ada 95 tasking constructs into simpler run time calls
-- (aka GNARLI, GNU Ada Run-time Library Interface)
-- Note: the compiler generates direct calls to this interface, via Rtsfind.
-- Any changes to this interface may require corresponding compiler changes
-- in exp_ch9.adb and possibly exp_ch7.adb
package System.Tasking.Protected_Objects.Single_Entry is
pragma Elaborate_Body;
---------------------------------
-- Compiler Interface (GNARLI) --
---------------------------------
-- The compiler will expand in the GNAT tree the following construct:
-- protected PO is
-- entry E;
-- procedure P;
-- private
-- Open : Boolean := False;
-- end PO;
-- protected body PO is
-- entry E when Open is
-- ...variable declarations...
-- begin
-- ...B...
-- end E;
-- procedure P is
-- ...variable declarations...
-- begin
-- ...C...
-- end P;
-- end PO;
-- as follows:
-- protected type poT is
-- entry e;
-- procedure p;
-- private
-- open : boolean := false;
-- end poT;
-- type poTV is limited record
-- open : boolean := false;
-- _object : aliased protection_entry;
-- end record;
-- procedure poPT__E1s (O : address; P : address; E :
-- protected_entry_index);
-- function poPT__B2s (O : address; E : protected_entry_index) return
-- boolean;
-- procedure poPT__pN (_object : in out poTV);
-- procedure poPT__pP (_object : in out poTV);
-- poTA : aliased entry_body := (
-- barrier => poPT__B2s'unrestricted_access,
-- action => poPT__E1s'unrestricted_access);
-- freeze poTV [
-- procedure poTVIP (_init : in out poTV) is
-- begin
-- _init.open := false;
-- object-init-proc (_init._object);
-- initialize_protection_entry (_init._object'unchecked_access,
-- unspecified_priority, _init'address, poTA'
-- unrestricted_access);
-- return;
-- end poTVIP;
-- ]
-- po : poT;
-- poTVIP (poTV!(po));
-- function poPT__B2s (O : address; E : protected_entry_index) return
-- boolean is
-- type poTVP is access poTV;
-- _object : poTVP := poTVP!(O);
-- poR : protection_entry renames _object._object;
-- openP : boolean renames _object.open;
-- begin
-- return open;
-- end poPT__B2s;
-- procedure poPT__E1s (O : address; P : address; E :
-- protected_entry_index) is
-- type poTVP is access poTV;
-- _object : poTVP := poTVP!(O);
-- begin
-- B1b : declare
-- poR : protection_entry renames _object._object;
-- openP : boolean renames _object.open;
-- ...variable declarations...
-- begin
-- ...B...
-- end B1b;
-- complete_single_entry_body (_object._object'unchecked_access);
-- return;
-- exception
-- when all others =>
-- exceptional_complete_single_entry_body (_object._object'
-- unchecked_access, get_gnat_exception);
-- return;
-- end poPT__E1s;
-- procedure poPT__pN (_object : in out poTV) is
-- poR : protection_entry renames _object._object;
-- openP : boolean renames _object.open;
-- ...variable declarations...
-- begin
-- ...C...
-- return;
-- end poPT__pN;
-- procedure poPT__pP (_object : in out poTV) is
-- procedure _clean is
-- begin
-- service_entry (_object._object'unchecked_access);
-- return;
-- end _clean;
-- begin
-- lock_entry (_object._object'unchecked_access);
-- B5b : begin
-- poPT__pN (_object);
-- at end
-- _clean;
-- end B5b;
-- return;
-- end poPT__pP;
type Protection_Entry is limited private;
-- This type contains the GNARL state of a protected object. The
-- application-defined portion of the state (i.e. private objects)
-- is maintained by the compiler-generated code.
type Protection_Entry_Access is access all Protection_Entry;
type Entry_Body_Access is access constant Entry_Body;
-- Access to barrier and action function of an entry
procedure Initialize_Protection_Entry
(Object : Protection_Entry_Access;
Ceiling_Priority : Integer;
Compiler_Info : System.Address;
Entry_Body : Entry_Body_Access);
-- Initialize the Object parameter so that it can be used by the run time
-- to keep track of the runtime state of a protected object.
procedure Lock_Entry (Object : Protection_Entry_Access);
-- Lock a protected object for write access. Upon return, the caller owns
-- the lock to this object, and no other call to Lock or Lock_Read_Only
-- with the same argument will return until the corresponding call to
-- Unlock has been made by the caller.
procedure Lock_Read_Only_Entry
(Object : Protection_Entry_Access);
-- Lock a protected object for read access. Upon return, the caller owns
-- the lock for read access, and no other calls to Lock with the same
-- argument will return until the corresponding call to Unlock has been
-- made by the caller. Other calls to Lock_Read_Only may (but need not)
-- return before the call to Unlock, and the corresponding callers will
-- also own the lock for read access.
procedure Unlock_Entry (Object : Protection_Entry_Access);
-- Relinquish ownership of the lock for the object represented by the
-- Object parameter. If this ownership was for write access, or if it was
-- for read access where there are no other read access locks outstanding,
-- one (or more, in the case of Lock_Read_Only) of the tasks waiting on
-- this lock (if any) will be given the lock and allowed to return from
-- the Lock or Lock_Read_Only call.
procedure Service_Entry (Object : Protection_Entry_Access);
-- Service the entry queue of the specified object, executing the
-- corresponding body of any queued entry call that is waiting on True
-- barrier. This is used when the state of a protected object may have
-- changed, in particular after the execution of the statement sequence
-- of a protected procedure.
--
-- This must be called with abort deferred and with the corresponding
-- object locked. Object is unlocked on return.
procedure Protected_Single_Entry_Call
(Object : Protection_Entry_Access;
Uninterpreted_Data : System.Address);
-- Make a protected entry call to the specified object
--
-- Pends a protected entry call on the protected object represented by
-- Object. A pended call is not queued; it may be executed immediately
-- or queued, depending on the state of the entry barrier.
--
-- Uninterpreted_Data
-- This will be returned by Next_Entry_Call when this call is serviced.
-- It can be used by the compiler to pass information between the
-- caller and the server, in particular entry parameters.
procedure Exceptional_Complete_Single_Entry_Body
(Object : Protection_Entry_Access;
Ex : Ada.Exceptions.Exception_Id);
-- Perform all of the functions of Complete_Entry_Body. In addition, report
-- in Ex the exception whose propagation terminated the entry body to the
-- runtime system.
function Protected_Count_Entry (Object : Protection_Entry) return Natural;
-- Return the number of entry calls on Object (0 or 1)
function Protected_Single_Entry_Caller
(Object : Protection_Entry) return Task_Id;
-- Return value of E'Caller, where E is the protected entry currently being
-- handled. This will only work if called from within an entry body, as
-- required by the LRM (C.7.1(14)).
private
type Protection_Entry is record
Common : aliased Protection;
-- State of the protected object. This part is common to any protected
-- object, including those without entries.
Compiler_Info : System.Address;
-- Pointer to compiler-generated record representing protected object
Call_In_Progress : Entry_Call_Link;
-- Pointer to the entry call being executed (if any)
Entry_Body : Entry_Body_Access;
-- Pointer to executable code for the entry body of the protected type
Entry_Queue : Entry_Call_Link;
-- Place to store the waiting entry call (if any)
end record;
end System.Tasking.Protected_Objects.Single_Entry;
|
package Giza.Bitmap_Fonts.FreeSansOblique18pt7b is
Font : constant Giza.Font.Ref_Const;
private
FreeSansOblique18pt7bBitmaps : aliased constant Font_Bitmap := (
16#03#, 16#83#, 16#81#, 16#C0#, 16#E0#, 16#70#, 16#78#, 16#38#, 16#1C#,
16#0E#, 16#07#, 16#07#, 16#83#, 16#81#, 16#C0#, 16#E0#, 16#60#, 16#30#,
16#10#, 16#18#, 16#08#, 16#04#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#E0#,
16#70#, 16#78#, 16#00#, 16#71#, 16#DC#, 16#7E#, 16#3B#, 16#8E#, 16#E3#,
16#B8#, 16#EC#, 16#33#, 16#0C#, 16#82#, 16#00#, 16#00#, 16#38#, 16#70#,
16#01#, 16#C3#, 16#80#, 16#0C#, 16#18#, 16#00#, 16#E1#, 16#C0#, 16#06#,
16#0C#, 16#00#, 16#70#, 16#E0#, 16#03#, 16#87#, 16#03#, 16#FF#, 16#FF#,
16#1F#, 16#FF#, 16#F0#, 16#FF#, 16#FF#, 16#80#, 16#60#, 16#C0#, 16#07#,
16#0E#, 16#00#, 16#30#, 16#60#, 16#03#, 16#87#, 16#00#, 16#18#, 16#30#,
16#1F#, 16#FF#, 16#F8#, 16#FF#, 16#FF#, 16#C7#, 16#FF#, 16#FC#, 16#07#,
16#0E#, 16#00#, 16#30#, 16#70#, 16#03#, 16#87#, 16#00#, 16#1C#, 16#38#,
16#00#, 16#C1#, 16#80#, 16#0E#, 16#1C#, 16#00#, 16#60#, 16#C0#, 16#00#,
16#00#, 16#0C#, 16#00#, 16#07#, 16#F8#, 16#01#, 16#FF#, 16#C0#, 16#3F#,
16#FE#, 16#07#, 16#99#, 16#F0#, 16#F1#, 16#87#, 16#0E#, 16#18#, 16#71#,
16#C1#, 16#87#, 16#1C#, 16#30#, 16#01#, 16#C3#, 16#00#, 16#1C#, 16#30#,
16#01#, 16#E3#, 16#00#, 16#0F#, 16#B0#, 16#00#, 16#FF#, 16#80#, 16#03#,
16#FF#, 16#00#, 16#0F#, 16#F8#, 16#00#, 16#6F#, 16#C0#, 16#06#, 16#3C#,
16#00#, 16#C1#, 16#CE#, 16#0C#, 16#1C#, 16#E0#, 16#C1#, 16#CE#, 16#0C#,
16#38#, 16#F1#, 16#83#, 16#8F#, 16#98#, 16#F0#, 16#7F#, 16#FE#, 16#03#,
16#FF#, 16#C0#, 16#0F#, 16#F0#, 16#00#, 16#30#, 16#00#, 16#03#, 16#00#,
16#00#, 16#30#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#,
16#03#, 16#E0#, 16#03#, 16#81#, 16#FC#, 16#00#, 16#C0#, 16#FF#, 16#00#,
16#60#, 16#70#, 16#E0#, 16#30#, 16#38#, 16#18#, 16#1C#, 16#0C#, 16#06#,
16#0E#, 16#03#, 16#01#, 16#83#, 16#00#, 16#C0#, 16#E1#, 16#80#, 16#38#,
16#70#, 16#C0#, 16#0F#, 16#F8#, 16#70#, 16#01#, 16#FC#, 16#18#, 16#00#,
16#3E#, 16#0C#, 16#00#, 16#00#, 16#06#, 16#07#, 16#80#, 16#03#, 16#07#,
16#F8#, 16#00#, 16#C3#, 16#FE#, 16#00#, 16#61#, 16#E1#, 16#C0#, 16#30#,
16#60#, 16#30#, 16#18#, 16#30#, 16#0C#, 16#0C#, 16#0C#, 16#03#, 16#03#,
16#03#, 16#01#, 16#81#, 16#80#, 16#E1#, 16#E0#, 16#C0#, 16#1F#, 16#F0#,
16#60#, 16#07#, 16#F8#, 16#18#, 16#00#, 16#F8#, 16#00#, 16#00#, 16#1F#,
16#00#, 16#07#, 16#F8#, 16#00#, 16#FF#, 16#C0#, 16#1E#, 16#3C#, 16#03#,
16#C1#, 16#C0#, 16#38#, 16#1C#, 16#03#, 16#81#, 16#C0#, 16#38#, 16#38#,
16#03#, 16#C7#, 16#00#, 16#1D#, 16#E0#, 16#01#, 16#FC#, 16#00#, 16#1F#,
16#00#, 16#07#, 16#F0#, 16#01#, 16#F7#, 16#87#, 16#3C#, 16#3C#, 16#E7#,
16#81#, 16#CE#, 16#70#, 16#1F#, 16#CE#, 16#00#, 16#FC#, 16#E0#, 16#07#,
16#8E#, 16#00#, 16#78#, 16#F0#, 16#1F#, 16#8F#, 16#87#, 16#FC#, 16#7F#,
16#F9#, 16#C3#, 16#FE#, 16#1E#, 16#1F#, 16#80#, 16#E0#, 16#77#, 16#EE#,
16#EE#, 16#CC#, 16#80#, 16#00#, 16#30#, 16#06#, 16#00#, 16#C0#, 16#18#,
16#03#, 16#80#, 16#30#, 16#06#, 16#00#, 16#E0#, 16#0C#, 16#01#, 16#C0#,
16#18#, 16#03#, 16#80#, 16#38#, 16#07#, 16#00#, 16#70#, 16#07#, 16#00#,
16#70#, 16#0E#, 16#00#, 16#E0#, 16#0E#, 16#00#, 16#E0#, 16#0E#, 16#00#,
16#E0#, 16#0E#, 16#00#, 16#E0#, 16#0E#, 16#00#, 16#E0#, 16#06#, 16#00#,
16#70#, 16#07#, 16#00#, 16#30#, 16#03#, 16#00#, 16#18#, 16#00#, 16#01#,
16#80#, 16#0C#, 16#00#, 16#C0#, 16#0E#, 16#00#, 16#E0#, 16#06#, 16#00#,
16#70#, 16#07#, 16#00#, 16#70#, 16#07#, 16#00#, 16#70#, 16#07#, 16#00#,
16#70#, 16#07#, 16#00#, 16#70#, 16#07#, 16#00#, 16#E0#, 16#0E#, 16#00#,
16#E0#, 16#0E#, 16#01#, 16#C0#, 16#1C#, 16#03#, 16#80#, 16#38#, 16#03#,
16#00#, 16#70#, 16#06#, 16#00#, 16#C0#, 16#1C#, 16#01#, 16#80#, 16#30#,
16#06#, 16#00#, 16#C0#, 16#00#, 16#06#, 16#01#, 16#84#, 16#47#, 16#F7#,
16#FF#, 16#CF#, 16#C1#, 16#E0#, 16#D8#, 16#67#, 16#18#, 16#C0#, 16#00#,
16#70#, 16#00#, 16#1C#, 16#00#, 16#0F#, 16#00#, 16#03#, 16#80#, 16#00#,
16#E0#, 16#00#, 16#38#, 16#0F#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#,
16#FF#, 16#C0#, 16#70#, 16#00#, 16#1C#, 16#00#, 16#07#, 16#00#, 16#01#,
16#C0#, 16#00#, 16#E0#, 16#00#, 16#38#, 16#00#, 16#0E#, 16#00#, 16#3B#,
16#DC#, 16#21#, 16#18#, 16#98#, 16#FF#, 16#FF#, 16#FF#, 16#E0#, 16#7F#,
16#FE#, 16#00#, 16#06#, 16#00#, 16#08#, 16#00#, 16#30#, 16#00#, 16#40#,
16#01#, 16#80#, 16#02#, 16#00#, 16#0C#, 16#00#, 16#10#, 16#00#, 16#60#,
16#00#, 16#80#, 16#03#, 16#00#, 16#0C#, 16#00#, 16#10#, 16#00#, 16#60#,
16#00#, 16#80#, 16#03#, 16#00#, 16#04#, 16#00#, 16#18#, 16#00#, 16#20#,
16#00#, 16#C0#, 16#01#, 16#00#, 16#06#, 16#00#, 16#18#, 16#00#, 16#20#,
16#00#, 16#C0#, 16#01#, 16#00#, 16#00#, 16#00#, 16#7C#, 16#00#, 16#7F#,
16#C0#, 16#7F#, 16#F8#, 16#3E#, 16#1E#, 16#0F#, 16#03#, 16#C7#, 16#80#,
16#71#, 16#C0#, 16#1C#, 16#E0#, 16#07#, 16#38#, 16#01#, 16#DE#, 16#00#,
16#77#, 16#00#, 16#1D#, 16#C0#, 16#0F#, 16#70#, 16#03#, 16#FC#, 16#00#,
16#EE#, 16#00#, 16#3B#, 16#80#, 16#0E#, 16#E0#, 16#07#, 16#B8#, 16#01#,
16#CE#, 16#00#, 16#F3#, 16#80#, 16#38#, 16#F0#, 16#1E#, 16#1E#, 16#1F#,
16#07#, 16#FF#, 16#80#, 16#FF#, 16#C0#, 16#0F#, 16#80#, 16#00#, 16#00#,
16#C0#, 16#70#, 16#38#, 16#3E#, 16#FF#, 16#BF#, 16#EF#, 16#F8#, 16#1C#,
16#07#, 16#01#, 16#C0#, 16#70#, 16#1C#, 16#0E#, 16#03#, 16#80#, 16#E0#,
16#38#, 16#0E#, 16#07#, 16#01#, 16#C0#, 16#70#, 16#1C#, 16#06#, 16#01#,
16#80#, 16#E0#, 16#38#, 16#00#, 16#00#, 16#3F#, 16#00#, 16#0F#, 16#FC#,
16#03#, 16#FF#, 16#E0#, 16#7C#, 16#1E#, 16#07#, 16#80#, 16#F0#, 16#F0#,
16#07#, 16#0E#, 16#00#, 16#70#, 16#E0#, 16#07#, 16#00#, 16#00#, 16#70#,
16#00#, 16#0E#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#3C#, 16#00#, 16#0F#,
16#80#, 16#03#, 16#F0#, 16#00#, 16#FC#, 16#00#, 16#1F#, 16#00#, 16#07#,
16#C0#, 16#00#, 16#F0#, 16#00#, 16#1E#, 16#00#, 16#03#, 16#80#, 16#00#,
16#70#, 16#00#, 16#07#, 16#00#, 16#00#, 16#FF#, 16#FF#, 16#8F#, 16#FF#,
16#F0#, 16#FF#, 16#FF#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#3F#, 16#F0#,
16#0F#, 16#FF#, 16#03#, 16#C1#, 16#F0#, 16#70#, 16#0E#, 16#1C#, 16#01#,
16#C3#, 16#80#, 16#38#, 16#E0#, 16#07#, 16#00#, 16#01#, 16#C0#, 16#00#,
16#F0#, 16#03#, 16#FC#, 16#00#, 16#7F#, 16#00#, 16#0F#, 16#F0#, 16#00#,
16#1F#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#1C#, 16#00#, 16#03#, 16#9C#,
16#00#, 16#73#, 16#80#, 16#1E#, 16#70#, 16#03#, 16#8F#, 16#00#, 16#F1#,
16#F0#, 16#7C#, 16#1F#, 16#FF#, 16#01#, 16#FF#, 16#C0#, 16#0F#, 16#C0#,
16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#E0#, 16#00#, 16#78#, 16#00#,
16#3E#, 16#00#, 16#1F#, 16#80#, 16#0F#, 16#E0#, 16#07#, 16#F0#, 16#03#,
16#DC#, 16#01#, 16#E7#, 16#00#, 16#71#, 16#C0#, 16#38#, 16#60#, 16#1C#,
16#38#, 16#0E#, 16#0E#, 16#07#, 16#03#, 16#83#, 16#80#, 16#C1#, 16#C0#,
16#70#, 16#7F#, 16#FF#, 16#DF#, 16#FF#, 16#FF#, 16#FF#, 16#FC#, 16#00#,
16#70#, 16#00#, 16#38#, 16#00#, 16#0E#, 16#00#, 16#03#, 16#80#, 16#00#,
16#E0#, 16#00#, 16#30#, 16#00#, 16#01#, 16#FF#, 16#F0#, 16#3F#, 16#FF#,
16#03#, 16#FF#, 16#E0#, 16#38#, 16#00#, 16#07#, 16#00#, 16#00#, 16#70#,
16#00#, 16#0E#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#0E#, 16#FC#, 16#01#,
16#FF#, 16#F0#, 16#1F#, 16#FF#, 16#83#, 16#E0#, 16#78#, 16#3C#, 16#03#,
16#C0#, 16#00#, 16#1C#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#1C#, 16#00#,
16#01#, 16#C0#, 16#00#, 16#18#, 16#00#, 16#03#, 16#8E#, 16#00#, 16#78#,
16#E0#, 16#0F#, 16#0F#, 16#81#, 16#E0#, 16#7F#, 16#FC#, 16#03#, 16#FF#,
16#80#, 16#0F#, 16#E0#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#3F#, 16#F0#,
16#0F#, 16#FF#, 16#03#, 16#E1#, 16#F0#, 16#F0#, 16#0E#, 16#1C#, 16#01#,
16#C7#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#38#, 16#00#, 16#07#, 16#1F#,
16#01#, 16#CF#, 16#F8#, 16#3B#, 16#FF#, 16#87#, 16#E0#, 16#F8#, 16#F0#,
16#0F#, 16#3C#, 16#00#, 16#E7#, 16#80#, 16#1C#, 16#E0#, 16#03#, 16#9C#,
16#00#, 16#73#, 16#80#, 16#1C#, 16#70#, 16#03#, 16#8F#, 16#00#, 16#E0#,
16#F0#, 16#78#, 16#1F#, 16#FF#, 16#01#, 16#FF#, 16#80#, 16#0F#, 16#C0#,
16#00#, 16#3F#, 16#FF#, 16#CF#, 16#FF#, 16#F7#, 16#FF#, 16#FC#, 16#00#,
16#0E#, 16#00#, 16#07#, 16#00#, 16#03#, 16#80#, 16#00#, 16#C0#, 16#00#,
16#70#, 16#00#, 16#38#, 16#00#, 16#1C#, 16#00#, 16#0E#, 16#00#, 16#03#,
16#80#, 16#01#, 16#C0#, 16#00#, 16#E0#, 16#00#, 16#78#, 16#00#, 16#1C#,
16#00#, 16#0E#, 16#00#, 16#03#, 16#80#, 16#01#, 16#C0#, 16#00#, 16#F0#,
16#00#, 16#38#, 16#00#, 16#1E#, 16#00#, 16#07#, 16#00#, 16#03#, 16#C0#,
16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#3F#, 16#F0#,
16#1F#, 16#FF#, 16#07#, 16#C1#, 16#F0#, 16#E0#, 16#0E#, 16#38#, 16#01#,
16#C7#, 16#00#, 16#38#, 16#E0#, 16#0E#, 16#1C#, 16#01#, 16#C3#, 16#C0#,
16#F0#, 16#3F#, 16#FC#, 16#03#, 16#FE#, 16#01#, 16#FF#, 16#F0#, 16#7C#,
16#1E#, 16#1E#, 16#01#, 16#E3#, 16#80#, 16#1C#, 16#E0#, 16#03#, 16#9C#,
16#00#, 16#73#, 16#80#, 16#0E#, 16#70#, 16#03#, 16#8F#, 16#00#, 16#F1#,
16#F0#, 16#7C#, 16#1F#, 16#FF#, 16#01#, 16#FF#, 16#C0#, 16#0F#, 16#C0#,
16#00#, 16#00#, 16#7E#, 16#00#, 16#3F#, 16#F0#, 16#1F#, 16#FF#, 16#07#,
16#C1#, 16#E0#, 16#E0#, 16#1E#, 16#38#, 16#01#, 16#C7#, 16#00#, 16#39#,
16#C0#, 16#07#, 16#38#, 16#00#, 16#E7#, 16#00#, 16#3C#, 16#E0#, 16#07#,
16#9E#, 16#01#, 16#E3#, 16#E0#, 16#FC#, 16#3F#, 16#FB#, 16#83#, 16#FE#,
16#F0#, 16#3F#, 16#1C#, 16#00#, 16#03#, 16#80#, 16#00#, 16#F0#, 16#00#,
16#1C#, 16#70#, 16#07#, 16#8E#, 16#01#, 16#E1#, 16#E0#, 16#F8#, 16#1F#,
16#FE#, 16#01#, 16#FF#, 16#80#, 16#0F#, 16#C0#, 16#00#, 16#0E#, 16#3C#,
16#78#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#38#, 16#F1#, 16#E3#, 16#80#, 16#07#, 16#0F#, 16#0F#,
16#0E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#38#, 16#78#, 16#70#, 16#10#, 16#10#,
16#30#, 16#20#, 16#C0#, 16#00#, 16#00#, 16#20#, 16#00#, 16#1C#, 16#00#,
16#1F#, 16#80#, 16#1F#, 16#C0#, 16#0F#, 16#C0#, 16#0F#, 16#E0#, 16#07#,
16#E0#, 16#03#, 16#F0#, 16#00#, 16#F0#, 16#00#, 16#1F#, 16#80#, 16#00#,
16#FC#, 16#00#, 16#07#, 16#E0#, 16#00#, 16#3F#, 16#00#, 16#01#, 16#FC#,
16#00#, 16#0F#, 16#C0#, 16#00#, 16#78#, 16#00#, 16#01#, 16#00#, 16#7F#,
16#FF#, 16#DF#, 16#FF#, 16#F7#, 16#FF#, 16#FC#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#0F#, 16#FF#, 16#FB#, 16#FF#, 16#FE#, 16#FF#,
16#FF#, 16#80#, 16#10#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#7E#, 16#00#,
16#07#, 16#F0#, 16#00#, 16#1F#, 16#80#, 16#00#, 16#FC#, 16#00#, 16#07#,
16#E0#, 16#00#, 16#3F#, 16#00#, 16#01#, 16#E0#, 16#01#, 16#F8#, 16#00#,
16#FC#, 16#00#, 16#FE#, 16#00#, 16#7E#, 16#00#, 16#7F#, 16#00#, 16#3F#,
16#00#, 16#07#, 16#00#, 16#00#, 16#80#, 16#00#, 16#00#, 16#03#, 16#F8#,
16#0F#, 16#FC#, 16#1F#, 16#FE#, 16#3C#, 16#1F#, 16#78#, 16#07#, 16#70#,
16#07#, 16#E0#, 16#07#, 16#E0#, 16#07#, 16#00#, 16#0E#, 16#00#, 16#1E#,
16#00#, 16#3C#, 16#00#, 16#78#, 16#00#, 16#F0#, 16#01#, 16#C0#, 16#03#,
16#80#, 16#07#, 16#00#, 16#0F#, 16#00#, 16#0E#, 16#00#, 16#0E#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#1C#,
16#00#, 16#1C#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#80#,
16#00#, 16#03#, 16#FF#, 16#F0#, 16#00#, 16#07#, 16#FF#, 16#FE#, 16#00#,
16#0F#, 16#E0#, 16#3F#, 16#80#, 16#0F#, 16#80#, 16#03#, 16#E0#, 16#0F#,
16#00#, 16#00#, 16#F8#, 16#0F#, 16#00#, 16#00#, 16#3C#, 16#0F#, 16#01#,
16#F0#, 16#0F#, 16#0F#, 16#03#, 16#FC#, 16#C7#, 16#8F#, 16#03#, 16#FE#,
16#E1#, 16#C7#, 16#03#, 16#C3#, 16#60#, 16#E7#, 16#03#, 16#C0#, 16#F0#,
16#77#, 16#83#, 16#C0#, 16#70#, 16#3B#, 16#83#, 16#C0#, 16#78#, 16#1D#,
16#C1#, 16#C0#, 16#38#, 16#1F#, 16#C1#, 16#E0#, 16#18#, 16#0E#, 16#E0#,
16#E0#, 16#1C#, 16#0F#, 16#70#, 16#70#, 16#0C#, 16#07#, 16#38#, 16#38#,
16#0E#, 16#07#, 16#9C#, 16#1C#, 16#0F#, 16#07#, 16#8E#, 16#0F#, 16#0F#,
16#8F#, 16#87#, 16#03#, 16#FD#, 16#FF#, 16#83#, 16#C1#, 16#FC#, 16#FF#,
16#80#, 16#E0#, 16#7C#, 16#3F#, 16#00#, 16#78#, 16#00#, 16#00#, 16#00#,
16#1E#, 16#00#, 16#00#, 16#00#, 16#07#, 16#80#, 16#00#, 16#00#, 16#01#,
16#F8#, 16#07#, 16#00#, 16#00#, 16#7F#, 16#FF#, 16#80#, 16#00#, 16#1F#,
16#FF#, 16#C0#, 16#00#, 16#01#, 16#FE#, 16#00#, 16#00#, 16#00#, 16#01#,
16#E0#, 16#00#, 16#07#, 16#C0#, 16#00#, 16#0F#, 16#C0#, 16#00#, 16#3F#,
16#80#, 16#00#, 16#7F#, 16#00#, 16#01#, 16#DE#, 16#00#, 16#03#, 16#BC#,
16#00#, 16#0E#, 16#38#, 16#00#, 16#38#, 16#78#, 16#00#, 16#70#, 16#F0#,
16#01#, 16#C1#, 16#E0#, 16#03#, 16#83#, 16#C0#, 16#0E#, 16#07#, 16#80#,
16#18#, 16#07#, 16#00#, 16#70#, 16#0E#, 16#01#, 16#FF#, 16#FE#, 16#03#,
16#FF#, 16#FC#, 16#0F#, 16#FF#, 16#F8#, 16#1C#, 16#00#, 16#F0#, 16#70#,
16#01#, 16#E0#, 16#E0#, 16#03#, 16#C3#, 16#80#, 16#03#, 16#CF#, 16#00#,
16#07#, 16#9C#, 16#00#, 16#0F#, 16#78#, 16#00#, 16#1E#, 16#E0#, 16#00#,
16#3C#, 16#07#, 16#FF#, 16#C0#, 16#3F#, 16#FF#, 16#81#, 16#FF#, 16#FC#,
16#0E#, 16#00#, 16#F0#, 16#F0#, 16#03#, 16#87#, 16#00#, 16#1C#, 16#38#,
16#00#, 16#E1#, 16#C0#, 16#07#, 16#0E#, 16#00#, 16#70#, 16#F0#, 16#03#,
16#87#, 16#00#, 16#78#, 16#3F#, 16#FF#, 16#81#, 16#FF#, 16#F8#, 16#0F#,
16#FF#, 16#F0#, 16#E0#, 16#03#, 16#C7#, 16#00#, 16#0E#, 16#38#, 16#00#,
16#71#, 16#C0#, 16#03#, 16#9E#, 16#00#, 16#1C#, 16#E0#, 16#00#, 16#E7#,
16#00#, 16#0E#, 16#38#, 16#00#, 16#F1#, 16#C0#, 16#0F#, 16#1F#, 16#FF#,
16#F0#, 16#FF#, 16#FF#, 16#07#, 16#FF#, 16#E0#, 16#00#, 16#00#, 16#1F#,
16#80#, 16#03#, 16#FF#, 16#80#, 16#1F#, 16#FF#, 16#01#, 16#F8#, 16#3E#,
16#07#, 16#80#, 16#38#, 16#38#, 16#00#, 16#F1#, 16#C0#, 16#01#, 16#CF#,
16#00#, 16#07#, 16#38#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#07#, 16#00#,
16#00#, 16#1C#, 16#00#, 16#00#, 16#70#, 16#00#, 16#03#, 16#80#, 16#00#,
16#0E#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#7B#,
16#80#, 16#01#, 16#CE#, 16#00#, 16#0F#, 16#3C#, 16#00#, 16#38#, 16#70#,
16#01#, 16#E1#, 16#E0#, 16#0F#, 16#07#, 16#C0#, 16#F8#, 16#0F#, 16#FF#,
16#C0#, 16#1F#, 16#FC#, 16#00#, 16#1F#, 16#C0#, 16#00#, 16#03#, 16#FF#,
16#C0#, 16#0F#, 16#FF#, 16#E0#, 16#1F#, 16#FF#, 16#E0#, 16#38#, 16#03#,
16#E0#, 16#70#, 16#03#, 16#C1#, 16#C0#, 16#03#, 16#83#, 16#80#, 16#03#,
16#87#, 16#00#, 16#07#, 16#0E#, 16#00#, 16#0E#, 16#18#, 16#00#, 16#1C#,
16#70#, 16#00#, 16#38#, 16#E0#, 16#00#, 16#71#, 16#C0#, 16#00#, 16#E3#,
16#80#, 16#03#, 16#8E#, 16#00#, 16#07#, 16#1C#, 16#00#, 16#0E#, 16#38#,
16#00#, 16#3C#, 16#70#, 16#00#, 16#71#, 16#C0#, 16#01#, 16#E3#, 16#80#,
16#03#, 16#87#, 16#00#, 16#0E#, 16#0E#, 16#00#, 16#3C#, 16#1C#, 16#01#,
16#F0#, 16#7F#, 16#FF#, 16#C0#, 16#FF#, 16#FE#, 16#01#, 16#FF#, 16#F0#,
16#00#, 16#03#, 16#FF#, 16#FE#, 16#0F#, 16#FF#, 16#FC#, 16#1F#, 16#FF#,
16#F0#, 16#38#, 16#00#, 16#00#, 16#70#, 16#00#, 16#01#, 16#C0#, 16#00#,
16#03#, 16#80#, 16#00#, 16#07#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#18#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#FF#, 16#FF#, 16#81#,
16#FF#, 16#FF#, 16#03#, 16#FF#, 16#FE#, 16#0E#, 16#00#, 16#00#, 16#1C#,
16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#70#, 16#00#, 16#01#, 16#E0#,
16#00#, 16#03#, 16#80#, 16#00#, 16#07#, 16#00#, 16#00#, 16#0E#, 16#00#,
16#00#, 16#1C#, 16#00#, 16#00#, 16#7F#, 16#FF#, 16#F0#, 16#FF#, 16#FF#,
16#C1#, 16#FF#, 16#FF#, 16#80#, 16#03#, 16#FF#, 16#FC#, 16#1F#, 16#FF#,
16#F0#, 16#7F#, 16#FF#, 16#C1#, 16#C0#, 16#00#, 16#07#, 16#00#, 16#00#,
16#38#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#03#, 16#80#, 16#00#, 16#0E#,
16#00#, 16#00#, 16#30#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#07#, 16#FF#,
16#F0#, 16#1F#, 16#FF#, 16#C0#, 16#7F#, 16#FF#, 16#03#, 16#80#, 16#00#,
16#0E#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#07#,
16#80#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#70#, 16#00#, 16#01#, 16#C0#,
16#00#, 16#07#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#E0#, 16#00#,
16#03#, 16#80#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#E0#, 16#00#, 16#7F#,
16#F8#, 16#01#, 16#FF#, 16#FC#, 16#03#, 16#E0#, 16#3E#, 16#07#, 16#80#,
16#0E#, 16#0F#, 16#00#, 16#0F#, 16#1E#, 16#00#, 16#07#, 16#1C#, 16#00#,
16#07#, 16#38#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#70#, 16#00#,
16#00#, 16#70#, 16#00#, 16#00#, 16#F0#, 16#07#, 16#FE#, 16#E0#, 16#07#,
16#FE#, 16#E0#, 16#07#, 16#FE#, 16#E0#, 16#00#, 16#0E#, 16#E0#, 16#00#,
16#0E#, 16#E0#, 16#00#, 16#0E#, 16#E0#, 16#00#, 16#1C#, 16#F0#, 16#00#,
16#3C#, 16#70#, 16#00#, 16#7C#, 16#78#, 16#00#, 16#FC#, 16#3E#, 16#03#,
16#DC#, 16#1F#, 16#FF#, 16#98#, 16#0F#, 16#FE#, 16#18#, 16#03#, 16#F8#,
16#18#, 16#07#, 16#00#, 16#07#, 16#83#, 16#80#, 16#03#, 16#C1#, 16#C0#,
16#01#, 16#C0#, 16#E0#, 16#00#, 16#E0#, 16#F0#, 16#00#, 16#70#, 16#70#,
16#00#, 16#78#, 16#38#, 16#00#, 16#3C#, 16#1C#, 16#00#, 16#1C#, 16#1E#,
16#00#, 16#0E#, 16#0F#, 16#00#, 16#07#, 16#07#, 16#00#, 16#07#, 16#83#,
16#FF#, 16#FF#, 16#81#, 16#FF#, 16#FF#, 16#C1#, 16#FF#, 16#FF#, 16#E0#,
16#E0#, 16#00#, 16#70#, 16#70#, 16#00#, 16#78#, 16#38#, 16#00#, 16#38#,
16#1C#, 16#00#, 16#1C#, 16#1E#, 16#00#, 16#0E#, 16#0E#, 16#00#, 16#0F#,
16#07#, 16#00#, 16#07#, 16#83#, 16#80#, 16#03#, 16#81#, 16#C0#, 16#01#,
16#C1#, 16#E0#, 16#00#, 16#E0#, 16#E0#, 16#00#, 16#F0#, 16#70#, 16#00#,
16#78#, 16#00#, 16#07#, 16#07#, 16#07#, 16#0E#, 16#0E#, 16#0E#, 16#0E#,
16#0E#, 16#1C#, 16#1C#, 16#1C#, 16#1C#, 16#1C#, 16#38#, 16#38#, 16#38#,
16#38#, 16#38#, 16#70#, 16#70#, 16#70#, 16#70#, 16#70#, 16#E0#, 16#E0#,
16#E0#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#70#, 16#00#, 16#1C#, 16#00#,
16#0E#, 16#00#, 16#03#, 16#80#, 16#00#, 16#E0#, 16#00#, 16#38#, 16#00#,
16#0C#, 16#00#, 16#07#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#70#, 16#00#,
16#1C#, 16#00#, 16#0E#, 16#00#, 16#03#, 16#80#, 16#00#, 16#E0#, 16#00#,
16#38#, 16#00#, 16#0C#, 16#1C#, 16#07#, 16#0E#, 16#01#, 16#C3#, 16#80#,
16#70#, 16#E0#, 16#3C#, 16#38#, 16#0E#, 16#0F#, 16#0F#, 16#81#, 16#FF#,
16#C0#, 16#7F#, 16#E0#, 16#07#, 16#E0#, 16#00#, 16#07#, 16#00#, 16#07#,
16#83#, 16#80#, 16#07#, 16#81#, 16#C0#, 16#0F#, 16#00#, 16#E0#, 16#0F#,
16#00#, 16#F0#, 16#0F#, 16#00#, 16#70#, 16#0F#, 16#00#, 16#38#, 16#0F#,
16#00#, 16#1C#, 16#0F#, 16#00#, 16#1E#, 16#1E#, 16#00#, 16#0F#, 16#1E#,
16#00#, 16#07#, 16#1E#, 16#00#, 16#03#, 16#9F#, 16#00#, 16#01#, 16#DF#,
16#C0#, 16#01#, 16#FC#, 16#E0#, 16#00#, 16#FC#, 16#78#, 16#00#, 16#7C#,
16#1C#, 16#00#, 16#3C#, 16#0F#, 16#00#, 16#1C#, 16#07#, 16#80#, 16#1E#,
16#01#, 16#E0#, 16#0E#, 16#00#, 16#F0#, 16#07#, 16#00#, 16#3C#, 16#03#,
16#80#, 16#1E#, 16#01#, 16#C0#, 16#07#, 16#81#, 16#E0#, 16#03#, 16#C0#,
16#E0#, 16#00#, 16#F0#, 16#70#, 16#00#, 16#78#, 16#00#, 16#07#, 16#00#,
16#07#, 16#00#, 16#07#, 16#00#, 16#07#, 16#00#, 16#0F#, 16#00#, 16#0E#,
16#00#, 16#0E#, 16#00#, 16#0E#, 16#00#, 16#1E#, 16#00#, 16#1E#, 16#00#,
16#1C#, 16#00#, 16#1C#, 16#00#, 16#1C#, 16#00#, 16#3C#, 16#00#, 16#38#,
16#00#, 16#38#, 16#00#, 16#38#, 16#00#, 16#38#, 16#00#, 16#78#, 16#00#,
16#70#, 16#00#, 16#70#, 16#00#, 16#70#, 16#00#, 16#70#, 16#00#, 16#FF#,
16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#03#, 16#C0#, 16#00#, 16#F8#,
16#3E#, 16#00#, 16#07#, 16#C1#, 16#F0#, 16#00#, 16#7E#, 16#0F#, 16#80#,
16#03#, 16#F0#, 16#7C#, 16#00#, 16#3F#, 16#07#, 16#70#, 16#01#, 16#F8#,
16#3B#, 16#80#, 16#1D#, 16#C1#, 16#DC#, 16#00#, 16#EE#, 16#0E#, 16#E0#,
16#0E#, 16#E0#, 16#67#, 16#00#, 16#77#, 16#07#, 16#38#, 16#07#, 16#38#,
16#39#, 16#C0#, 16#31#, 16#C1#, 16#CE#, 16#03#, 16#9E#, 16#0C#, 16#38#,
16#38#, 16#E0#, 16#E1#, 16#C1#, 16#C7#, 16#07#, 16#0E#, 16#1C#, 16#38#,
16#38#, 16#70#, 16#E1#, 16#C1#, 16#C3#, 16#8E#, 16#1E#, 16#1C#, 16#1C#,
16#70#, 16#E0#, 16#E0#, 16#E7#, 16#07#, 16#07#, 16#07#, 16#38#, 16#38#,
16#38#, 16#1F#, 16#81#, 16#C1#, 16#80#, 16#F8#, 16#1E#, 16#1C#, 16#07#,
16#C0#, 16#E0#, 16#E0#, 16#3C#, 16#07#, 16#07#, 16#01#, 16#E0#, 16#38#,
16#00#, 16#03#, 16#80#, 16#03#, 16#83#, 16#E0#, 16#01#, 16#C1#, 16#F0#,
16#00#, 16#E0#, 16#F8#, 16#00#, 16#E0#, 16#7E#, 16#00#, 16#70#, 16#7F#,
16#00#, 16#38#, 16#3B#, 16#C0#, 16#1C#, 16#1D#, 16#E0#, 16#1E#, 16#0E#,
16#F8#, 16#0E#, 16#06#, 16#3C#, 16#07#, 16#07#, 16#1E#, 16#03#, 16#83#,
16#87#, 16#81#, 16#C1#, 16#C3#, 16#C1#, 16#E0#, 16#C0#, 16#F0#, 16#E0#,
16#E0#, 16#78#, 16#70#, 16#70#, 16#3C#, 16#38#, 16#38#, 16#0F#, 16#1C#,
16#1C#, 16#07#, 16#9E#, 16#1C#, 16#01#, 16#EE#, 16#0E#, 16#00#, 16#F7#,
16#07#, 16#00#, 16#3F#, 16#83#, 16#80#, 16#1F#, 16#C1#, 16#80#, 16#07#,
16#C1#, 16#C0#, 16#03#, 16#E0#, 16#E0#, 16#01#, 16#F0#, 16#70#, 16#00#,
16#78#, 16#00#, 16#00#, 16#1F#, 16#C0#, 16#00#, 16#FF#, 16#F0#, 16#01#,
16#FF#, 16#F8#, 16#03#, 16#E0#, 16#7C#, 16#07#, 16#80#, 16#1E#, 16#0F#,
16#00#, 16#0E#, 16#1C#, 16#00#, 16#0F#, 16#3C#, 16#00#, 16#07#, 16#38#,
16#00#, 16#07#, 16#70#, 16#00#, 16#07#, 16#70#, 16#00#, 16#07#, 16#70#,
16#00#, 16#07#, 16#E0#, 16#00#, 16#07#, 16#E0#, 16#00#, 16#0F#, 16#E0#,
16#00#, 16#0E#, 16#E0#, 16#00#, 16#0E#, 16#E0#, 16#00#, 16#0E#, 16#E0#,
16#00#, 16#1C#, 16#E0#, 16#00#, 16#1C#, 16#F0#, 16#00#, 16#38#, 16#70#,
16#00#, 16#78#, 16#78#, 16#00#, 16#F0#, 16#3E#, 16#07#, 16#E0#, 16#1F#,
16#FF#, 16#C0#, 16#0F#, 16#FF#, 16#00#, 16#03#, 16#F8#, 16#00#, 16#03#,
16#FF#, 16#E0#, 16#1F#, 16#FF#, 16#C0#, 16#7F#, 16#FF#, 16#81#, 16#C0#,
16#1F#, 16#07#, 16#00#, 16#3C#, 16#38#, 16#00#, 16#70#, 16#E0#, 16#01#,
16#C3#, 16#80#, 16#07#, 16#0E#, 16#00#, 16#1C#, 16#30#, 16#00#, 16#E1#,
16#C0#, 16#07#, 16#87#, 16#00#, 16#3C#, 16#1F#, 16#FF#, 16#E0#, 16#7F#,
16#FF#, 16#03#, 16#FF#, 16#F0#, 16#0E#, 16#00#, 16#00#, 16#38#, 16#00#,
16#00#, 16#E0#, 16#00#, 16#07#, 16#80#, 16#00#, 16#1C#, 16#00#, 16#00#,
16#70#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#07#, 16#00#, 16#00#, 16#38#,
16#00#, 16#00#, 16#E0#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#00#,
16#1F#, 16#E0#, 16#00#, 16#3F#, 16#FC#, 16#00#, 16#7F#, 16#FF#, 16#00#,
16#7C#, 16#07#, 16#C0#, 16#78#, 16#00#, 16#F0#, 16#78#, 16#00#, 16#38#,
16#78#, 16#00#, 16#1E#, 16#78#, 16#00#, 16#07#, 16#38#, 16#00#, 16#03#,
16#BC#, 16#00#, 16#01#, 16#DC#, 16#00#, 16#00#, 16#EE#, 16#00#, 16#00#,
16#7E#, 16#00#, 16#00#, 16#3F#, 16#00#, 16#00#, 16#1F#, 16#80#, 16#00#,
16#1D#, 16#C0#, 16#00#, 16#0E#, 16#E0#, 16#00#, 16#0F#, 16#70#, 16#00#,
16#07#, 16#38#, 16#00#, 16#87#, 16#9E#, 16#00#, 16#E7#, 16#87#, 16#00#,
16#7F#, 16#83#, 16#C0#, 16#1F#, 16#80#, 16#F8#, 16#1F#, 16#80#, 16#3F#,
16#FF#, 16#E0#, 16#0F#, 16#FF#, 16#78#, 16#01#, 16#FE#, 16#1E#, 16#00#,
16#00#, 16#07#, 16#00#, 16#00#, 16#02#, 16#00#, 16#03#, 16#FF#, 16#F0#,
16#0F#, 16#FF#, 16#F8#, 16#1F#, 16#FF#, 16#F0#, 16#38#, 16#00#, 16#F0#,
16#70#, 16#00#, 16#E1#, 16#C0#, 16#01#, 16#C3#, 16#80#, 16#03#, 16#87#,
16#00#, 16#07#, 16#0E#, 16#00#, 16#0E#, 16#18#, 16#00#, 16#38#, 16#70#,
16#00#, 16#F0#, 16#E0#, 16#03#, 16#C1#, 16#FF#, 16#FE#, 16#03#, 16#FF#,
16#F8#, 16#0F#, 16#FF#, 16#F8#, 16#1C#, 16#00#, 16#78#, 16#38#, 16#00#,
16#70#, 16#70#, 16#00#, 16#E1#, 16#E0#, 16#01#, 16#C3#, 16#80#, 16#03#,
16#87#, 16#00#, 16#06#, 16#0E#, 16#00#, 16#1C#, 16#1C#, 16#00#, 16#38#,
16#70#, 16#00#, 16#70#, 16#E0#, 16#00#, 16#E1#, 16#C0#, 16#01#, 16#E0#,
16#00#, 16#3F#, 16#C0#, 16#07#, 16#FF#, 16#C0#, 16#3F#, 16#FF#, 16#81#,
16#F0#, 16#1E#, 16#0F#, 16#00#, 16#3C#, 16#38#, 16#00#, 16#71#, 16#C0#,
16#01#, 16#C7#, 16#00#, 16#07#, 16#1C#, 16#00#, 16#00#, 16#78#, 16#00#,
16#01#, 16#F8#, 16#00#, 16#03#, 16#FC#, 16#00#, 16#07#, 16#FE#, 16#00#,
16#07#, 16#FF#, 16#00#, 16#03#, 16#FE#, 16#00#, 16#00#, 16#FC#, 16#00#,
16#00#, 16#F3#, 16#80#, 16#01#, 16#CE#, 16#00#, 16#07#, 16#38#, 16#00#,
16#18#, 16#E0#, 16#00#, 16#E3#, 16#C0#, 16#07#, 16#07#, 16#80#, 16#7C#,
16#1F#, 16#FF#, 16#E0#, 16#3F#, 16#FE#, 16#00#, 16#3F#, 16#C0#, 16#00#,
16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#F0#, 16#0E#,
16#00#, 16#00#, 16#E0#, 16#00#, 16#1E#, 16#00#, 16#01#, 16#E0#, 16#00#,
16#1C#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#1C#, 16#00#, 16#03#, 16#C0#,
16#00#, 16#38#, 16#00#, 16#03#, 16#80#, 16#00#, 16#38#, 16#00#, 16#03#,
16#80#, 16#00#, 16#78#, 16#00#, 16#07#, 16#00#, 16#00#, 16#70#, 16#00#,
16#07#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#E0#,
16#00#, 16#0E#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#1E#, 16#00#, 16#01#,
16#E0#, 16#00#, 16#0E#, 16#00#, 16#07#, 16#0E#, 16#00#, 16#0F#, 16#0E#,
16#00#, 16#0E#, 16#0E#, 16#00#, 16#0E#, 16#1E#, 16#00#, 16#0E#, 16#1C#,
16#00#, 16#0E#, 16#1C#, 16#00#, 16#1C#, 16#1C#, 16#00#, 16#1C#, 16#1C#,
16#00#, 16#1C#, 16#38#, 16#00#, 16#1C#, 16#38#, 16#00#, 16#38#, 16#38#,
16#00#, 16#38#, 16#38#, 16#00#, 16#38#, 16#70#, 16#00#, 16#38#, 16#70#,
16#00#, 16#38#, 16#70#, 16#00#, 16#70#, 16#70#, 16#00#, 16#70#, 16#F0#,
16#00#, 16#70#, 16#F0#, 16#00#, 16#70#, 16#E0#, 16#00#, 16#F0#, 16#E0#,
16#00#, 16#E0#, 16#F0#, 16#03#, 16#E0#, 16#78#, 16#0F#, 16#C0#, 16#7F#,
16#FF#, 16#80#, 16#1F#, 16#FE#, 16#00#, 16#07#, 16#F0#, 16#00#, 16#E0#,
16#00#, 16#3F#, 16#80#, 16#03#, 16#FC#, 16#00#, 16#1D#, 16#E0#, 16#01#,
16#EF#, 16#00#, 16#0E#, 16#78#, 16#00#, 16#E1#, 16#C0#, 16#07#, 16#0E#,
16#00#, 16#70#, 16#78#, 16#07#, 16#83#, 16#C0#, 16#38#, 16#1E#, 16#03#,
16#C0#, 16#F0#, 16#1C#, 16#07#, 16#81#, 16#E0#, 16#1C#, 16#0E#, 16#00#,
16#E0#, 16#F0#, 16#07#, 16#87#, 16#00#, 16#3C#, 16#70#, 16#01#, 16#E3#,
16#80#, 16#0F#, 16#38#, 16#00#, 16#79#, 16#C0#, 16#01#, 16#DC#, 16#00#,
16#0E#, 16#E0#, 16#00#, 16#7E#, 16#00#, 16#03#, 16#F0#, 16#00#, 16#1F#,
16#00#, 16#00#, 16#F0#, 16#00#, 16#00#, 16#E0#, 16#03#, 16#80#, 16#0E#,
16#E0#, 16#07#, 16#80#, 16#0E#, 16#E0#, 16#07#, 16#C0#, 16#1E#, 16#E0#,
16#0F#, 16#C0#, 16#1C#, 16#E0#, 16#0F#, 16#C0#, 16#3C#, 16#E0#, 16#1F#,
16#C0#, 16#38#, 16#E0#, 16#1D#, 16#C0#, 16#78#, 16#E0#, 16#3D#, 16#C0#,
16#70#, 16#E0#, 16#39#, 16#C0#, 16#70#, 16#E0#, 16#79#, 16#C0#, 16#E0#,
16#E0#, 16#71#, 16#C0#, 16#E0#, 16#E0#, 16#F1#, 16#C1#, 16#C0#, 16#F0#,
16#E1#, 16#C1#, 16#C0#, 16#F1#, 16#E1#, 16#C3#, 16#C0#, 16#71#, 16#C1#,
16#C3#, 16#80#, 16#73#, 16#C1#, 16#C7#, 16#80#, 16#73#, 16#80#, 16#E7#,
16#00#, 16#77#, 16#80#, 16#E7#, 16#00#, 16#77#, 16#00#, 16#EE#, 16#00#,
16#7F#, 16#00#, 16#EE#, 16#00#, 16#7E#, 16#00#, 16#FC#, 16#00#, 16#7E#,
16#00#, 16#FC#, 16#00#, 16#7C#, 16#00#, 16#F8#, 16#00#, 16#7C#, 16#00#,
16#F8#, 16#00#, 16#78#, 16#00#, 16#F8#, 16#00#, 16#70#, 16#00#, 16#F0#,
16#00#, 16#03#, 16#C0#, 16#03#, 16#C0#, 16#78#, 16#00#, 16#70#, 16#07#,
16#80#, 16#1C#, 16#00#, 16#F0#, 16#07#, 16#80#, 16#0F#, 16#01#, 16#E0#,
16#01#, 16#E0#, 16#78#, 16#00#, 16#1E#, 16#1E#, 16#00#, 16#03#, 16#C7#,
16#80#, 16#00#, 16#39#, 16#E0#, 16#00#, 16#07#, 16#B8#, 16#00#, 16#00#,
16#7E#, 16#00#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#01#, 16#F0#, 16#00#,
16#00#, 16#3E#, 16#00#, 16#00#, 16#0F#, 16#C0#, 16#00#, 16#03#, 16#FC#,
16#00#, 16#00#, 16#F7#, 16#80#, 16#00#, 16#3C#, 16#78#, 16#00#, 16#0F#,
16#0F#, 16#00#, 16#01#, 16#C0#, 16#F0#, 16#00#, 16#70#, 16#1E#, 16#00#,
16#1C#, 16#01#, 16#E0#, 16#07#, 16#80#, 16#3C#, 16#01#, 16#E0#, 16#03#,
16#C0#, 16#78#, 16#00#, 16#78#, 16#1E#, 16#00#, 16#0F#, 16#00#, 16#F0#,
16#00#, 16#1C#, 16#E0#, 16#00#, 16#71#, 16#E0#, 16#01#, 16#E3#, 16#C0#,
16#07#, 16#83#, 16#C0#, 16#1E#, 16#07#, 16#80#, 16#78#, 16#07#, 16#00#,
16#E0#, 16#0F#, 16#03#, 16#80#, 16#1E#, 16#0F#, 16#00#, 16#1E#, 16#3C#,
16#00#, 16#3C#, 16#F0#, 16#00#, 16#39#, 16#C0#, 16#00#, 16#7F#, 16#00#,
16#00#, 16#FE#, 16#00#, 16#00#, 16#F8#, 16#00#, 16#01#, 16#E0#, 16#00#,
16#03#, 16#C0#, 16#00#, 16#07#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#1C#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#01#,
16#C0#, 16#00#, 16#03#, 16#80#, 16#00#, 16#07#, 16#00#, 16#00#, 16#1E#,
16#00#, 16#00#, 16#03#, 16#FF#, 16#FF#, 16#81#, 16#FF#, 16#FF#, 16#C0#,
16#FF#, 16#FF#, 16#C0#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#01#, 16#E0#,
16#00#, 16#01#, 16#E0#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#01#, 16#E0#,
16#00#, 16#01#, 16#E0#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#01#, 16#E0#,
16#00#, 16#01#, 16#E0#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#01#, 16#E0#,
16#00#, 16#01#, 16#E0#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#01#, 16#E0#,
16#00#, 16#01#, 16#E0#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#01#, 16#E0#,
16#00#, 16#01#, 16#E0#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#01#, 16#E0#,
16#00#, 16#00#, 16#FF#, 16#FF#, 16#E0#, 16#FF#, 16#FF#, 16#F0#, 16#7F#,
16#FF#, 16#F8#, 16#00#, 16#01#, 16#F8#, 16#0F#, 16#C0#, 16#7E#, 16#07#,
16#00#, 16#38#, 16#01#, 16#C0#, 16#0C#, 16#00#, 16#E0#, 16#07#, 16#00#,
16#38#, 16#01#, 16#80#, 16#0C#, 16#00#, 16#E0#, 16#07#, 16#00#, 16#30#,
16#01#, 16#80#, 16#1C#, 16#00#, 16#E0#, 16#07#, 16#00#, 16#30#, 16#03#,
16#80#, 16#1C#, 16#00#, 16#E0#, 16#06#, 16#00#, 16#30#, 16#03#, 16#80#,
16#1C#, 16#00#, 16#E0#, 16#06#, 16#00#, 16#70#, 16#03#, 16#F8#, 16#1F#,
16#C0#, 16#FE#, 16#00#, 16#CC#, 16#CC#, 16#CC#, 16#46#, 16#66#, 16#66#,
16#66#, 16#66#, 16#66#, 16#62#, 16#33#, 16#33#, 16#33#, 16#03#, 16#F8#,
16#1F#, 16#C0#, 16#FE#, 16#00#, 16#70#, 16#03#, 16#00#, 16#38#, 16#01#,
16#C0#, 16#0E#, 16#00#, 16#60#, 16#03#, 16#00#, 16#38#, 16#01#, 16#C0#,
16#0E#, 16#00#, 16#60#, 16#07#, 16#00#, 16#38#, 16#01#, 16#C0#, 16#0C#,
16#00#, 16#60#, 16#07#, 16#00#, 16#38#, 16#01#, 16#80#, 16#0C#, 16#00#,
16#E0#, 16#07#, 16#00#, 16#38#, 16#01#, 16#80#, 16#1C#, 16#00#, 16#E0#,
16#07#, 16#03#, 16#F0#, 16#1F#, 16#80#, 16#FC#, 16#00#, 16#00#, 16#70#,
16#03#, 16#C0#, 16#1F#, 16#00#, 16#7C#, 16#03#, 16#38#, 16#1C#, 16#E0#,
16#63#, 16#83#, 16#8E#, 16#0C#, 16#38#, 16#60#, 16#73#, 16#81#, 16#CC#,
16#07#, 16#60#, 16#1F#, 16#80#, 16#70#, 16#FF#, 16#FF#, 16#FF#, 16#FF#,
16#FF#, 16#C0#, 16#F1#, 16#C3#, 16#86#, 16#0C#, 16#00#, 16#FE#, 16#01#,
16#FF#, 16#E0#, 16#FF#, 16#FC#, 16#3C#, 16#0F#, 16#1C#, 16#01#, 16#C0#,
16#00#, 16#70#, 16#00#, 16#1C#, 16#00#, 16#0E#, 16#00#, 16#1F#, 16#83#,
16#FF#, 16#E3#, 16#FE#, 16#39#, 16#F0#, 16#1C#, 16#F0#, 16#07#, 16#38#,
16#01#, 16#CE#, 16#00#, 16#F3#, 16#C0#, 16#F8#, 16#FF#, 16#F7#, 16#9F#,
16#F1#, 16#E1#, 16#F0#, 16#38#, 16#07#, 16#00#, 16#00#, 16#E0#, 16#00#,
16#1C#, 16#00#, 16#03#, 16#80#, 16#00#, 16#F0#, 16#00#, 16#1C#, 16#00#,
16#03#, 16#80#, 16#00#, 16#71#, 16#F0#, 16#0E#, 16#FF#, 16#83#, 16#FF#,
16#F8#, 16#7F#, 16#0F#, 16#0F#, 16#80#, 16#F1#, 16#E0#, 16#0E#, 16#38#,
16#01#, 16#CF#, 16#00#, 16#39#, 16#E0#, 16#07#, 16#38#, 16#00#, 16#E7#,
16#00#, 16#38#, 16#E0#, 16#07#, 16#3C#, 16#00#, 16#E7#, 16#80#, 16#38#,
16#F8#, 16#0F#, 16#1F#, 16#87#, 16#C3#, 16#FF#, 16#F0#, 16#E7#, 16#FC#,
16#1C#, 16#7E#, 16#00#, 16#01#, 16#F8#, 16#07#, 16#FC#, 16#0F#, 16#FE#,
16#1E#, 16#0F#, 16#3C#, 16#07#, 16#78#, 16#07#, 16#70#, 16#07#, 16#70#,
16#00#, 16#F0#, 16#00#, 16#E0#, 16#00#, 16#E0#, 16#00#, 16#E0#, 16#00#,
16#E0#, 16#0E#, 16#E0#, 16#1C#, 16#F0#, 16#3C#, 16#78#, 16#78#, 16#7F#,
16#F0#, 16#3F#, 16#E0#, 16#0F#, 16#80#, 16#00#, 16#00#, 16#70#, 16#00#,
16#07#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#E0#,
16#00#, 16#0E#, 16#00#, 16#00#, 16#C0#, 16#1F#, 16#1C#, 16#07#, 16#FD#,
16#C0#, 16#FF#, 16#DC#, 16#1E#, 16#0F#, 16#C3#, 16#C0#, 16#78#, 16#38#,
16#07#, 16#87#, 16#00#, 16#38#, 16#70#, 16#03#, 16#8F#, 16#00#, 16#38#,
16#E0#, 16#07#, 16#0E#, 16#00#, 16#70#, 16#E0#, 16#07#, 16#0E#, 16#00#,
16#F0#, 16#E0#, 16#0E#, 16#0F#, 16#01#, 16#E0#, 16#78#, 16#7E#, 16#07#,
16#FF#, 16#E0#, 16#3F#, 16#EE#, 16#01#, 16#F8#, 16#C0#, 16#01#, 16#F8#,
16#03#, 16#FF#, 16#03#, 16#FF#, 16#C3#, 16#C1#, 16#F3#, 16#C0#, 16#79#,
16#C0#, 16#1D#, 16#C0#, 16#0E#, 16#FF#, 16#FF#, 16#7F#, 16#FF#, 16#FF#,
16#FF#, 16#F8#, 16#00#, 16#1C#, 16#00#, 16#0E#, 16#00#, 16#07#, 16#00#,
16#73#, 16#C0#, 16#78#, 16#F0#, 16#78#, 16#7F#, 16#F8#, 16#1F#, 16#F8#,
16#03#, 16#F0#, 16#00#, 16#01#, 16#E0#, 16#7C#, 16#1F#, 16#83#, 16#80#,
16#70#, 16#1C#, 16#03#, 16#83#, 16#FC#, 16#7F#, 16#8F#, 16#F0#, 16#30#,
16#0E#, 16#01#, 16#C0#, 16#38#, 16#06#, 16#01#, 16#C0#, 16#38#, 16#07#,
16#00#, 16#E0#, 16#38#, 16#07#, 16#00#, 16#E0#, 16#1C#, 16#03#, 16#00#,
16#E0#, 16#1C#, 16#00#, 16#00#, 16#FC#, 16#60#, 16#7F#, 16#CC#, 16#1F#,
16#FF#, 16#87#, 16#C3#, 16#F1#, 16#E0#, 16#3E#, 16#38#, 16#03#, 16#8E#,
16#00#, 16#71#, 16#C0#, 16#0E#, 16#38#, 16#01#, 16#CE#, 16#00#, 16#79#,
16#C0#, 16#0E#, 16#38#, 16#01#, 16#C7#, 16#00#, 16#78#, 16#E0#, 16#0F#,
16#1E#, 16#03#, 16#C1#, 16#E1#, 16#F8#, 16#3F#, 16#FF#, 16#03#, 16#FE#,
16#E0#, 16#1F#, 16#1C#, 16#00#, 16#03#, 16#00#, 16#00#, 16#E0#, 16#00#,
16#18#, 16#38#, 16#07#, 16#07#, 16#83#, 16#C0#, 16#7F#, 16#F8#, 16#0F#,
16#FC#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#07#, 16#00#, 16#01#, 16#C0#,
16#00#, 16#70#, 16#00#, 16#1C#, 16#00#, 16#0F#, 16#00#, 16#03#, 16#80#,
16#00#, 16#E0#, 16#00#, 16#38#, 16#FC#, 16#0E#, 16#FF#, 16#87#, 16#FF#,
16#F1#, 16#F8#, 16#3C#, 16#7C#, 16#07#, 16#1E#, 16#01#, 16#C7#, 16#00#,
16#73#, 16#C0#, 16#1C#, 16#E0#, 16#07#, 16#38#, 16#03#, 16#8E#, 16#00#,
16#E3#, 16#80#, 16#39#, 16#E0#, 16#0E#, 16#70#, 16#07#, 16#1C#, 16#01#,
16#C7#, 16#00#, 16#71#, 16#C0#, 16#1C#, 16#E0#, 16#06#, 16#38#, 16#03#,
16#80#, 16#07#, 16#07#, 16#0F#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#1E#,
16#1C#, 16#1C#, 16#1C#, 16#1C#, 16#1C#, 16#38#, 16#38#, 16#38#, 16#38#,
16#38#, 16#78#, 16#70#, 16#70#, 16#70#, 16#70#, 16#F0#, 16#E0#, 16#E0#,
16#00#, 16#3C#, 16#00#, 16#E0#, 16#03#, 16#80#, 16#0E#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#70#, 16#01#, 16#C0#,
16#06#, 16#00#, 16#38#, 16#00#, 16#E0#, 16#03#, 16#80#, 16#0C#, 16#00#,
16#70#, 16#01#, 16#C0#, 16#07#, 16#00#, 16#1C#, 16#00#, 16#60#, 16#03#,
16#80#, 16#0E#, 16#00#, 16#38#, 16#00#, 16#C0#, 16#07#, 16#00#, 16#1C#,
16#00#, 16#70#, 16#01#, 16#80#, 16#0E#, 16#00#, 16#38#, 16#00#, 16#E0#,
16#1F#, 16#80#, 16#7C#, 16#03#, 16#E0#, 16#00#, 16#07#, 16#00#, 16#00#,
16#E0#, 16#00#, 16#1C#, 16#00#, 16#03#, 16#80#, 16#00#, 16#F0#, 16#00#,
16#1C#, 16#00#, 16#03#, 16#80#, 16#00#, 16#70#, 16#1E#, 16#0E#, 16#07#,
16#83#, 16#C1#, 16#E0#, 16#70#, 16#70#, 16#0E#, 16#1C#, 16#01#, 16#CF#,
16#00#, 16#3B#, 16#C0#, 16#0F#, 16#F8#, 16#01#, 16#FF#, 16#80#, 16#3E#,
16#70#, 16#07#, 16#8E#, 16#00#, 16#E0#, 16#E0#, 16#38#, 16#1C#, 16#07#,
16#03#, 16#C0#, 16#E0#, 16#38#, 16#1C#, 16#07#, 16#03#, 16#80#, 16#F0#,
16#E0#, 16#0E#, 16#1C#, 16#01#, 16#E0#, 16#07#, 16#07#, 16#0F#, 16#0E#,
16#0E#, 16#0E#, 16#0E#, 16#1E#, 16#1C#, 16#1C#, 16#1C#, 16#1C#, 16#1C#,
16#38#, 16#38#, 16#38#, 16#38#, 16#38#, 16#78#, 16#70#, 16#70#, 16#70#,
16#70#, 16#F0#, 16#E0#, 16#E0#, 16#0E#, 16#7C#, 16#0F#, 16#81#, 16#BF#,
16#E7#, 16#F8#, 16#7F#, 16#FD#, 16#FF#, 16#8F#, 16#C3#, 16#F0#, 16#F1#,
16#E0#, 16#3C#, 16#0E#, 16#38#, 16#07#, 16#01#, 16#C7#, 16#00#, 16#E0#,
16#39#, 16#C0#, 16#38#, 16#07#, 16#38#, 16#07#, 16#00#, 16#E7#, 16#00#,
16#E0#, 16#1C#, 16#E0#, 16#1C#, 16#07#, 16#18#, 16#03#, 16#00#, 16#E7#,
16#00#, 16#E0#, 16#1C#, 16#E0#, 16#1C#, 16#03#, 16#9C#, 16#03#, 16#80#,
16#63#, 16#80#, 16#70#, 16#1C#, 16#60#, 16#1C#, 16#03#, 16#9C#, 16#03#,
16#80#, 16#73#, 16#80#, 16#70#, 16#0E#, 16#00#, 16#0E#, 16#3E#, 16#03#,
16#7F#, 16#E1#, 16#FF#, 16#F8#, 16#7E#, 16#0F#, 16#1F#, 16#01#, 16#C7#,
16#80#, 16#71#, 16#C0#, 16#1C#, 16#E0#, 16#07#, 16#38#, 16#01#, 16#CE#,
16#00#, 16#E3#, 16#80#, 16#38#, 16#C0#, 16#0E#, 16#70#, 16#03#, 16#9C#,
16#01#, 16#C7#, 16#00#, 16#71#, 16#C0#, 16#1C#, 16#70#, 16#07#, 16#38#,
16#01#, 16#8E#, 16#00#, 16#E0#, 16#01#, 16#F8#, 16#03#, 16#FF#, 16#03#,
16#FF#, 16#C3#, 16#E1#, 16#E3#, 16#C0#, 16#79#, 16#C0#, 16#1D#, 16#C0#,
16#0E#, 16#E0#, 16#07#, 16#70#, 16#03#, 16#F0#, 16#01#, 16#F8#, 16#01#,
16#DC#, 16#00#, 16#EE#, 16#00#, 16#77#, 16#00#, 16#73#, 16#C0#, 16#78#,
16#F0#, 16#F8#, 16#7F#, 16#F8#, 16#1F#, 16#F8#, 16#03#, 16#F0#, 16#00#,
16#03#, 16#8F#, 16#80#, 16#1D#, 16#FF#, 16#00#, 16#FF#, 16#FC#, 16#07#,
16#C1#, 16#E0#, 16#7C#, 16#07#, 16#83#, 16#C0#, 16#1C#, 16#1C#, 16#00#,
16#E0#, 16#E0#, 16#07#, 16#0E#, 16#00#, 16#38#, 16#70#, 16#01#, 16#C3#,
16#80#, 16#1E#, 16#1C#, 16#00#, 16#E0#, 16#E0#, 16#07#, 16#0F#, 16#00#,
16#70#, 16#78#, 16#07#, 16#83#, 16#F0#, 16#F8#, 16#1F#, 16#FF#, 16#81#,
16#DF#, 16#F8#, 16#0E#, 16#3F#, 16#00#, 16#70#, 16#00#, 16#03#, 16#80#,
16#00#, 16#3C#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#0E#, 16#00#, 16#00#,
16#70#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#00#, 16#F8#, 16#70#,
16#7F#, 16#EE#, 16#0F#, 16#FF#, 16#E1#, 16#F0#, 16#FE#, 16#3C#, 16#07#,
16#E3#, 16#80#, 16#3C#, 16#70#, 16#03#, 16#C7#, 16#00#, 16#3C#, 16#70#,
16#03#, 16#CE#, 16#00#, 16#3C#, 16#E0#, 16#07#, 16#8E#, 16#00#, 16#78#,
16#E0#, 16#07#, 16#8E#, 16#00#, 16#F8#, 16#F0#, 16#1F#, 16#07#, 16#87#,
16#F0#, 16#7F#, 16#F7#, 16#03#, 16#FE#, 16#70#, 16#0F#, 16#8E#, 16#00#,
16#00#, 16#E0#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#0E#,
16#00#, 16#01#, 16#C0#, 16#00#, 16#1C#, 16#00#, 16#01#, 16#C0#, 16#00#,
16#04#, 16#00#, 16#0E#, 16#78#, 16#67#, 16#C7#, 16#7C#, 16#3F#, 16#01#,
16#F0#, 16#0F#, 16#00#, 16#70#, 16#07#, 16#00#, 16#38#, 16#01#, 16#C0#,
16#0E#, 16#00#, 16#70#, 16#07#, 16#00#, 16#38#, 16#01#, 16#C0#, 16#0E#,
16#00#, 16#70#, 16#07#, 16#00#, 16#38#, 16#00#, 16#01#, 16#F8#, 16#07#,
16#FE#, 16#0F#, 16#FF#, 16#1E#, 16#0F#, 16#3C#, 16#07#, 16#38#, 16#07#,
16#38#, 16#00#, 16#3C#, 16#00#, 16#3F#, 16#80#, 16#1F#, 16#F8#, 16#07#,
16#FC#, 16#00#, 16#7E#, 16#00#, 16#0E#, 16#E0#, 16#0E#, 16#E0#, 16#1E#,
16#F0#, 16#3C#, 16#7F#, 16#F8#, 16#7F#, 16#F0#, 16#1F#, 16#C0#, 16#0E#,
16#03#, 16#80#, 16#E0#, 16#38#, 16#7F#, 16#DF#, 16#EF#, 16#F8#, 16#70#,
16#1C#, 16#0E#, 16#03#, 16#80#, 16#E0#, 16#38#, 16#0C#, 16#07#, 16#01#,
16#C0#, 16#70#, 16#1C#, 16#0E#, 16#03#, 16#80#, 16#FC#, 16#3F#, 16#07#,
16#80#, 16#1C#, 16#01#, 16#C7#, 16#00#, 16#E1#, 16#C0#, 16#38#, 16#70#,
16#0E#, 16#38#, 16#03#, 16#8E#, 16#00#, 16#E3#, 16#80#, 16#70#, 16#E0#,
16#1C#, 16#30#, 16#07#, 16#1C#, 16#01#, 16#C7#, 16#00#, 16#71#, 16#C0#,
16#38#, 16#60#, 16#0E#, 16#38#, 16#07#, 16#8E#, 16#03#, 16#E3#, 16#81#,
16#F8#, 16#FF#, 16#FC#, 16#1F#, 16#FF#, 16#03#, 16#F1#, 16#C0#, 16#E0#,
16#07#, 16#E0#, 16#07#, 16#E0#, 16#0E#, 16#E0#, 16#1C#, 16#70#, 16#1C#,
16#70#, 16#38#, 16#70#, 16#38#, 16#70#, 16#70#, 16#70#, 16#60#, 16#70#,
16#E0#, 16#71#, 16#C0#, 16#71#, 16#C0#, 16#33#, 16#80#, 16#3B#, 16#80#,
16#3F#, 16#00#, 16#3E#, 16#00#, 16#3E#, 16#00#, 16#3C#, 16#00#, 16#3C#,
16#00#, 16#E0#, 16#1C#, 16#07#, 16#E0#, 16#3C#, 16#0E#, 16#E0#, 16#3C#,
16#0E#, 16#E0#, 16#7C#, 16#1C#, 16#E0#, 16#7C#, 16#1C#, 16#E0#, 16#EC#,
16#38#, 16#E0#, 16#EC#, 16#38#, 16#61#, 16#CC#, 16#70#, 16#61#, 16#CC#,
16#70#, 16#63#, 16#8C#, 16#60#, 16#73#, 16#8C#, 16#E0#, 16#77#, 16#0C#,
16#C0#, 16#77#, 16#0D#, 16#C0#, 16#7E#, 16#0D#, 16#80#, 16#7E#, 16#0F#,
16#80#, 16#7C#, 16#0F#, 16#80#, 16#7C#, 16#0F#, 16#00#, 16#78#, 16#0F#,
16#00#, 16#78#, 16#0E#, 16#00#, 16#0E#, 16#00#, 16#E1#, 16#E0#, 16#38#,
16#1C#, 16#0E#, 16#03#, 16#C3#, 16#80#, 16#38#, 16#E0#, 16#07#, 16#BC#,
16#00#, 16#77#, 16#00#, 16#0F#, 16#C0#, 16#00#, 16#F0#, 16#00#, 16#1C#,
16#00#, 16#07#, 16#C0#, 16#01#, 16#F8#, 16#00#, 16#77#, 16#80#, 16#1E#,
16#70#, 16#07#, 16#8F#, 16#00#, 16#E0#, 16#E0#, 16#38#, 16#1C#, 16#0E#,
16#01#, 16#C3#, 16#80#, 16#38#, 16#00#, 16#0E#, 16#00#, 16#70#, 16#F0#,
16#0F#, 16#07#, 16#00#, 16#E0#, 16#70#, 16#1C#, 16#07#, 16#01#, 16#C0#,
16#70#, 16#38#, 16#07#, 16#03#, 16#80#, 16#70#, 16#70#, 16#07#, 16#06#,
16#00#, 16#70#, 16#E0#, 16#03#, 16#9C#, 16#00#, 16#39#, 16#C0#, 16#03#,
16#B8#, 16#00#, 16#3B#, 16#80#, 16#03#, 16#F0#, 16#00#, 16#3E#, 16#00#,
16#03#, 16#E0#, 16#00#, 16#1C#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#18#,
16#00#, 16#03#, 16#80#, 16#00#, 16#70#, 16#00#, 16#06#, 16#00#, 16#00#,
16#E0#, 16#00#, 16#FE#, 16#00#, 16#0F#, 16#C0#, 16#00#, 16#F0#, 16#00#,
16#00#, 16#07#, 16#FF#, 16#C0#, 16#FF#, 16#F8#, 16#3F#, 16#FF#, 16#00#,
16#01#, 16#C0#, 16#00#, 16#70#, 16#00#, 16#1C#, 16#00#, 16#07#, 16#00#,
16#01#, 16#C0#, 16#00#, 16#70#, 16#00#, 16#1C#, 16#00#, 16#07#, 16#00#,
16#03#, 16#C0#, 16#00#, 16#F0#, 16#00#, 16#3C#, 16#00#, 16#0F#, 16#00#,
16#03#, 16#C0#, 16#00#, 16#7F#, 16#FE#, 16#1F#, 16#FF#, 16#C3#, 16#FF#,
16#F8#, 16#00#, 16#00#, 16#70#, 16#1F#, 16#01#, 16#F0#, 16#3C#, 16#03#,
16#80#, 16#38#, 16#07#, 16#00#, 16#70#, 16#07#, 16#00#, 16#70#, 16#07#,
16#00#, 16#E0#, 16#0E#, 16#01#, 16#E0#, 16#3C#, 16#0F#, 16#80#, 16#E0#,
16#0F#, 16#00#, 16#78#, 16#03#, 16#80#, 16#38#, 16#03#, 16#80#, 16#38#,
16#03#, 16#80#, 16#38#, 16#07#, 16#00#, 16#70#, 16#07#, 16#00#, 16#70#,
16#0E#, 16#00#, 16#F8#, 16#0F#, 16#80#, 16#78#, 16#00#, 16#01#, 16#80#,
16#C0#, 16#40#, 16#20#, 16#30#, 16#18#, 16#0C#, 16#04#, 16#06#, 16#03#,
16#01#, 16#80#, 16#80#, 16#40#, 16#60#, 16#30#, 16#10#, 16#08#, 16#0C#,
16#06#, 16#03#, 16#01#, 16#00#, 16#80#, 16#C0#, 16#60#, 16#20#, 16#10#,
16#18#, 16#0C#, 16#04#, 16#02#, 16#03#, 16#01#, 16#80#, 16#C0#, 16#00#,
16#01#, 16#E0#, 16#1F#, 16#01#, 16#F0#, 16#07#, 16#00#, 16#E0#, 16#0E#,
16#00#, 16#E0#, 16#0E#, 16#01#, 16#C0#, 16#1C#, 16#01#, 16#C0#, 16#1C#,
16#01#, 16#C0#, 16#1C#, 16#01#, 16#E0#, 16#0F#, 16#00#, 16#70#, 16#1F#,
16#03#, 16#C0#, 16#78#, 16#07#, 16#00#, 16#70#, 16#0E#, 16#00#, 16#E0#,
16#0E#, 16#00#, 16#E0#, 16#0E#, 16#01#, 16#C0#, 16#1C#, 16#03#, 16#C0#,
16#F8#, 16#0F#, 16#80#, 16#E0#, 16#00#, 16#1C#, 16#00#, 16#3F#, 16#00#,
16#7F#, 16#83#, 16#63#, 16#C7#, 16#C1#, 16#FE#, 16#00#, 16#FC#, 16#00#,
16#78#);
FreeSansOblique18pt7bGlyphs : aliased constant Glyph_Array := (
(0, 0, 0, 10, 0, 1), -- 0x20 ' '
(0, 9, 26, 10, 4, -25), -- 0x21 '!'
(30, 10, 9, 12, 6, -24), -- 0x22 '"'
(42, 21, 25, 19, 2, -24), -- 0x23 '#'
(108, 20, 31, 19, 2, -26), -- 0x24 '$'
(186, 26, 25, 31, 5, -24), -- 0x25 '%'
(268, 20, 25, 23, 3, -24), -- 0x26 '&'
(331, 4, 9, 7, 6, -24), -- 0x27 '''
(336, 12, 33, 12, 4, -25), -- 0x28 '('
(386, 12, 33, 12, -1, -24), -- 0x29 ')'
(436, 10, 10, 14, 6, -25), -- 0x2A '*'
(449, 18, 16, 20, 3, -15), -- 0x2B '+'
(485, 5, 8, 10, 2, -2), -- 0x2C ','
(490, 9, 3, 12, 3, -10), -- 0x2D '-'
(494, 4, 4, 10, 3, -3), -- 0x2E '.'
(496, 15, 26, 10, 0, -25), -- 0x2F '/'
(545, 18, 25, 19, 3, -24), -- 0x30 '0'
(602, 10, 25, 19, 7, -24), -- 0x31 '1'
(634, 20, 25, 19, 2, -24), -- 0x32 '2'
(697, 19, 25, 19, 2, -24), -- 0x33 '3'
(757, 18, 25, 19, 2, -24), -- 0x34 '4'
(814, 20, 25, 19, 2, -24), -- 0x35 '5'
(877, 19, 25, 19, 3, -24), -- 0x36 '6'
(937, 18, 25, 19, 5, -24), -- 0x37 '7'
(994, 19, 25, 19, 3, -24), -- 0x38 '8'
(1054, 19, 25, 19, 2, -24), -- 0x39 '9'
(1114, 7, 19, 10, 4, -18), -- 0x3A ':'
(1131, 8, 24, 10, 3, -18), -- 0x3B ';'
(1155, 19, 17, 20, 3, -16), -- 0x3C '<'
(1196, 18, 9, 20, 3, -12), -- 0x3D '='
(1217, 19, 17, 20, 2, -15), -- 0x3E '>'
(1258, 16, 26, 19, 6, -25), -- 0x3F '?'
(1310, 33, 31, 36, 3, -25), -- 0x40 '@'
(1438, 23, 26, 23, 0, -25), -- 0x41 'A'
(1513, 21, 26, 23, 3, -25), -- 0x42 'B'
(1582, 22, 26, 25, 4, -25), -- 0x43 'C'
(1654, 23, 26, 25, 3, -25), -- 0x44 'D'
(1729, 23, 26, 23, 3, -25), -- 0x45 'E'
(1804, 22, 26, 21, 3, -25), -- 0x46 'F'
(1876, 24, 26, 27, 4, -25), -- 0x47 'G'
(1954, 25, 26, 25, 3, -25), -- 0x48 'H'
(2036, 8, 26, 10, 4, -25), -- 0x49 'I'
(2062, 18, 26, 18, 2, -25), -- 0x4A 'J'
(2121, 25, 26, 23, 3, -25), -- 0x4B 'K'
(2203, 16, 26, 19, 3, -25), -- 0x4C 'L'
(2255, 29, 26, 30, 3, -25), -- 0x4D 'M'
(2350, 25, 26, 26, 3, -25), -- 0x4E 'N'
(2432, 24, 26, 27, 4, -25), -- 0x4F 'O'
(2510, 22, 26, 23, 3, -25), -- 0x50 'P'
(2582, 25, 28, 27, 4, -25), -- 0x51 'Q'
(2670, 23, 26, 25, 3, -25), -- 0x52 'R'
(2745, 22, 26, 23, 3, -25), -- 0x53 'S'
(2817, 20, 26, 21, 6, -25), -- 0x54 'T'
(2882, 24, 26, 25, 4, -25), -- 0x55 'U'
(2960, 21, 26, 23, 6, -25), -- 0x56 'V'
(3029, 32, 26, 33, 6, -25), -- 0x57 'W'
(3133, 27, 26, 23, 1, -25), -- 0x58 'X'
(3221, 23, 26, 24, 6, -25), -- 0x59 'Y'
(3296, 25, 26, 21, 1, -25), -- 0x5A 'Z'
(3378, 13, 33, 10, 1, -25), -- 0x5B '['
(3432, 4, 26, 10, 5, -25), -- 0x5C '\'
(3445, 13, 33, 10, -1, -24), -- 0x5D ']'
(3499, 14, 14, 16, 3, -24), -- 0x5E '^'
(3524, 21, 2, 19, -2, 5), -- 0x5F '_'
(3530, 6, 5, 12, 6, -25), -- 0x60 '`'
(3534, 18, 19, 19, 2, -18), -- 0x61 'a'
(3577, 19, 26, 20, 2, -25), -- 0x62 'b'
(3639, 16, 19, 18, 3, -18), -- 0x63 'c'
(3677, 20, 26, 20, 3, -25), -- 0x64 'd'
(3742, 17, 19, 19, 3, -18), -- 0x65 'e'
(3783, 11, 26, 9, 2, -25), -- 0x66 'f'
(3819, 19, 27, 19, 2, -18), -- 0x67 'g'
(3884, 18, 26, 19, 2, -25), -- 0x68 'h'
(3943, 8, 26, 8, 2, -25), -- 0x69 'i'
(3969, 14, 34, 8, -2, -25), -- 0x6A 'j'
(4029, 19, 26, 18, 2, -25), -- 0x6B 'k'
(4091, 8, 26, 8, 2, -25), -- 0x6C 'l'
(4117, 27, 19, 29, 2, -18), -- 0x6D 'm'
(4182, 18, 19, 19, 2, -18), -- 0x6E 'n'
(4225, 17, 19, 19, 3, -18), -- 0x6F 'o'
(4266, 21, 26, 20, 0, -18), -- 0x70 'p'
(4335, 20, 27, 19, 2, -18), -- 0x71 'q'
(4403, 13, 19, 11, 2, -18), -- 0x72 'r'
(4434, 16, 19, 18, 2, -18), -- 0x73 's'
(4472, 10, 23, 9, 3, -22), -- 0x74 't'
(4501, 18, 19, 19, 3, -18), -- 0x75 'u'
(4544, 16, 19, 17, 4, -18), -- 0x76 'v'
(4582, 24, 19, 25, 4, -18), -- 0x77 'w'
(4639, 19, 19, 17, 1, -18), -- 0x78 'x'
(4685, 20, 27, 17, 0, -18), -- 0x79 'y'
(4753, 19, 19, 17, 1, -18), -- 0x7A 'z'
(4799, 12, 33, 12, 3, -25), -- 0x7B '{'
(4849, 9, 33, 9, 2, -25), -- 0x7C '|'
(4887, 12, 33, 12, 0, -24), -- 0x7D '}'
(4937, 16, 7, 20, 5, -15)); -- 0x7E '~'
Font_D : aliased constant Bitmap_Font :=
(FreeSansOblique18pt7bBitmaps'Access,
FreeSansOblique18pt7bGlyphs'Access,
42);
Font : constant Giza.Font.Ref_Const := Font_D'Access;
end Giza.Bitmap_Fonts.FreeSansOblique18pt7b;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2015, 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$
------------------------------------------------------------------------------
pragma Restrictions (No_Elaboration_Code);
-- GNAT: enforce generation of preinitialized data section instead of
-- generation of elaboration code.
package Matreshka.Internals.Unicode.Ucd.Core_010D is
pragma Preelaborate;
Group_010D : aliased constant Core_Second_Stage
:= (others =>
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)));
end Matreshka.Internals.Unicode.Ucd.Core_010D;
|
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of STMicroelectronics nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
-- --
-- This file is based on: --
-- --
-- @file stm32f7xx_hal_sai.c --
-- @author MCD Application Team --
-- @version V1.0.2 --
-- @date 21-September-2015 --
-- @brief This file provides firmware functions to manage the following --
-- functionalities of the Serial Audio Interface (SAI) --
-- peripheral: --
-- + Initialization/de-initialization functions --
-- + I/O operation functions --
-- + Peripheral Control functions --
-- + Peripheral State functions --
-- --
-- COPYRIGHT(c) 2015 STMicroelectronics --
------------------------------------------------------------------------------
with Ada.Real_Time; use Ada.Real_Time;
with STM32_SVD; use STM32_SVD;
with STM32_SVD.RCC; use STM32_SVD.RCC;
package body STM32.SAI is
function Get_Block
(Periph : SAI_Controller;
Block : SAI_Block) return Block_Registers_Access;
---------------
-- Get_Block --
---------------
function Get_Block
(Periph : SAI_Controller;
Block : SAI_Block) return Block_Registers_Access
is
BlockA : aliased Block_Registers
with Volatile, Import, Address => Periph.ACR1'Address;
BlockB : aliased Block_Registers
with Volatile, Import, Address => Periph.BCR1'Address;
begin
case Block is
when Block_A =>
return BlockA'Unchecked_Access;
when Block_B =>
return BlockB'Unchecked_Access;
end case;
end Get_Block;
------------------
-- Deinitialize --
------------------
procedure Deinitialize
(This : SAI_Controller;
Block : SAI_Block)
is
Block_Regs : constant Block_Registers_Access :=
Get_Block (This, Block);
Start : Time;
begin
-- Disable SAI
Block_Regs.CR1.SAIAEN := False;
Start := Clock;
while Block_Regs.CR1.SAIAEN loop
if Start + Seconds (1) < Clock then
raise Constraint_Error with "Cannot reset the SAI peripheral";
end if;
end loop;
-- Reset the SAI block interrupts
Block_Regs.IM := (others => <>);
Block_Regs.CLRFR :=
(Reserved_3_3 => 0,
Reserved_7_31 => 0,
others => True);
-- Flush the FIFO
Block_Regs.CR2.FFLUS := True;
end Deinitialize;
-------------
-- Enabled --
-------------
function Enabled (This : SAI_Controller;
Block : SAI_Block) return Boolean
is
Block_Regs : constant Block_Registers_Access :=
Get_Block (This, Block);
begin
return Block_Regs.CR1.SAIAEN;
end Enabled;
------------
-- Enable --
------------
procedure Enable
(This : SAI_Controller;
Block : SAI_Block)
is
Block_Regs : constant Block_Registers_Access :=
Get_Block (This, Block);
begin
Block_Regs.CR1.SAIAEN := True;
end Enable;
-------------
-- Disable --
-------------
procedure Disable
(This : SAI_Controller;
Block : SAI_Block)
is
Block_Regs : constant Block_Registers_Access :=
Get_Block (This, Block);
begin
Block_Regs.CR1.SAIAEN := False;
end Disable;
----------------
-- Enable_DMA --
----------------
procedure Enable_DMA
(This : SAI_Controller;
Block : SAI_Block)
is
Block_Regs : constant Block_Registers_Access :=
Get_Block (This, Block);
begin
Block_Regs.CR1.DMAEN := True;
end Enable_DMA;
---------------
-- DMA_Pause --
---------------
procedure DMA_Pause
(This : SAI_Controller;
Block : SAI_Block)
is
Block_Regs : constant Block_Registers_Access :=
Get_Block (This, Block);
begin
Block_Regs.CR1.DMAEN := False;
end DMA_Pause;
----------------
-- DMA_Resume --
----------------
procedure DMA_Resume
(This : SAI_Controller;
Block : SAI_Block)
is
Block_Regs : constant Block_Registers_Access :=
Get_Block (This, Block);
begin
Block_Regs.CR1.DMAEN := True;
if not Block_Regs.CR1.SAIAEN then
Enable (This, Block);
end if;
end DMA_Resume;
--------------
-- DMA_Stop --
--------------
procedure DMA_Stop
(This : SAI_Controller;
Block : SAI_Block)
is
Block_Regs : constant Block_Registers_Access :=
Get_Block (This, Block);
begin
Block_Regs.CR1.DMAEN := False;
Disable (This, Block);
end DMA_Stop;
---------------------------
-- Configure_Audio_Block --
---------------------------
procedure Configure_Audio_Block
(This : SAI_Controller;
Block : SAI_Block;
Frequency : SAI_Audio_Frequency;
Stereo_Mode : SAI_Mono_Stereo_Mode;
Mode : SAI_Audio_Mode;
MCD_Enabled : Boolean;
Protocol : SAI_Protocol_Configuration;
Data_Size : SAI_Data_Size;
Endianness : SAI_Endianness;
Clock_Strobing : SAI_Clock_Strobing_Edge;
Synchronization : SAI_Synchronization;
Output_Drive : SAI_Output_Drive;
FIFO_Threshold : SAI_FIFO_Threshold;
Tristate_Mgt : SAI_Tristate_Management := SD_Line_Driven;
Companding_Mode : SAI_Companding_Mode := No_Companding)
is
Block_Reg : constant Block_Registers_Access := Get_Block (This, Block);
Freq : UInt32;
Tmp_Clock : UInt32;
Mckdiv : UInt32;
begin
Deinitialize (This, Block);
-- Configure Master Clock using the following formula :
-- MCLK_x = SAI_CK_x / (MCKDIV[3:0] * 2) with MCLK_x = 256 * FS
-- FS = SAI_CK_x / (MCKDIV[3:0] * 2) * 256
-- MCKDIV[3:0] = SAI_CK_x / FS * 512
Freq := STM32.Device.Get_Clock_Frequency (This);
-- Calculate *10 to keep some precision
Tmp_Clock := Freq * 10 / (Frequency * 512);
Mckdiv := Tmp_Clock / 10;
-- Round the result if needed
if (Tmp_Clock mod 10) > 8 then
Mckdiv := Mckdiv + 1;
end if;
Block_Reg.CR1 :=
(MODE => SAI_Audio_Mode'Enum_Rep (Mode),
PRTCFG => SAI_Protocol_Configuration'Enum_Rep (Protocol),
DS => SAI_Data_Size'Enum_Rep (Data_Size),
LSBFIRST => Endianness = Data_LSB_First,
CKSTR => Clock_Strobing = Clock_Strobing_Rising_Edge,
SYNCEN => SAI_Synchronization'Enum_Rep (Synchronization),
MONO => Stereo_Mode = Mono,
OutDri => Output_Drive = Drive_Immediate,
SAIAEN => False,
DMAEN => False,
NODIV => not MCD_Enabled,
MCKDIV => UInt6 (Mckdiv),
others => <>);
Block_Reg.CR2.FTH := SAI_FIFO_Threshold'Enum_Rep (FIFO_Threshold);
Block_Reg.CR2.FFLUS := False;
Block_Reg.CR2.TRIS := Tristate_Mgt = SD_Line_Released;
Block_Reg.CR2.COMP := SAI_Companding_Mode'Enum_Rep (Companding_Mode);
end Configure_Audio_Block;
---------------------------
-- Configure_Block_Frame --
---------------------------
procedure Configure_Block_Frame
(This : SAI_Controller;
Block : SAI_Block;
Frame_Length : UInt8;
Frame_Active : UInt7;
Frame_Sync : SAI_Frame_Synchronization;
FS_Polarity : SAI_Frame_Sync_Polarity;
FS_Offset : SAI_Frame_Sync_Offset)
is
Block_Reg : constant Block_Registers_Access := Get_Block (This, Block);
begin
Block_Reg.FRCR :=
(FRL => Frame_Length - 1,
FSALL => Frame_Active - 1,
FSDEF => Frame_Sync = FS_Frame_And_Channel_Identification,
FSPOL => FS_Polarity = FS_Active_High,
FSOFF => FS_Offset = Before_First_Bit,
others => <>);
end Configure_Block_Frame;
--------------------------
-- Configure_Block_Slot --
--------------------------
procedure Configure_Block_Slot
(This : SAI_Controller;
Block : SAI_Block;
First_Bit_Offset : UInt5;
Slot_Size : SAI_Slot_Size;
Number_Of_Slots : Slots_Number;
Enabled_Slots : SAI_Slots)
is
Block_Reg : constant Block_Registers_Access := Get_Block (This, Block);
begin
Block_Reg.SLOTR :=
(FBOFF => First_Bit_Offset,
SLOTSZ => SAI_Slot_Size'Enum_Rep (Slot_Size),
NBSLOT => UInt4 (Number_Of_Slots - 1),
SLOTEN => UInt16 (Enabled_Slots),
others => <>);
end Configure_Block_Slot;
end STM32.SAI;
|
with Generic_Heapsort;
with Ada.Text_Io; use Ada.Text_Io;
procedure Test_Generic_Heapsort is
type Days is (Sun, Mon, Tue, Wed, Thu, Fri, Sat);
type Days_Col is array(Days range <>) of Natural;
procedure Sort is new Generic_Heapsort(Natural, Days, Days_Col);
Week : Days_Col := (5, 2, 7, 3, 4, 9, 1);
begin
for I in Week'range loop
Put(Days'Image(I) & ":" & Natural'Image(Week(I)) & " ");
end loop;
New_Line;
Sort(Week);
for I in Week'range loop
Put(Days'Image(I) & ":" & Natural'Image(Week(I))& " ");
end loop;
New_Line;
end Test_Generic_Heapsort;
|
-- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_get_selection_owner_reply_t is
-- Item
--
type Item is record
response_type : aliased Interfaces.Unsigned_8;
pad0 : aliased Interfaces.Unsigned_8;
sequence : aliased Interfaces.Unsigned_16;
length : aliased Interfaces.Unsigned_32;
owner : aliased xcb.xcb_window_t;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_get_selection_owner_reply_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_get_selection_owner_reply_t.Item,
Element_Array => xcb.xcb_get_selection_owner_reply_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_get_selection_owner_reply_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_get_selection_owner_reply_t.Pointer,
Element_Array => xcb.xcb_get_selection_owner_reply_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_get_selection_owner_reply_t;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . B B . 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-2021, 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 low level tasking system
-- This is the Xilinx Ultrascale+ MPSoC version of this package
pragma Restrictions (No_Elaboration_Code);
package System.BB.Parameters is
pragma Pure;
--------------------
-- Hardware clock --
--------------------
Clock_Frequency : constant := 1_099_989_000;
-- CPU frequency
Ticks_Per_Second : constant := 99_999_000;
-- Frequency of the Global timestamp timer in Hz.
----------------
-- Interrupts --
----------------
-- These definitions are in this package in order to isolate target
-- dependencies.
subtype Interrupt_Range is Natural range 0 .. 187;
-- Number of interrupts supported by RPI2.
Trap_Vectors : constant := 7;
-- ARM in general has these traps:
-- 0 (at 16#0000#) Reset
-- 1 (at 16#0004#) Undefined Instruction (synchronous)
-- 2 (at 16#0008#) Supervisor Call (synchronous)
-- 3 (at 16#000C#) Abort - Prefetch (synchronous)
-- 4 (at 16#0010#) Abort - Data (asynchronous)
-- 5 (at 16#0014#) IRQ Trap (asynchronous)
-- 6 (at 16#0018#) FIQ Trap (asynchronous)
-----------------------------
-- GIC peripheral location --
-----------------------------
GICD_Base_Address : constant := 16#F901_0000#;
GICC_Base_Address : constant := 16#F902_0000#;
------------------------
-- Context Management --
------------------------
-- The run time stores a minimal amount of state in the thread context.
-- Most state will be saved on the task's stack when calling a potentially
-- blocking operation, or on the interrupt stack when the task is pre-
-- empted. Most of the space is currently required for floating point
-- state, which is saved lazily.
-- The TMS570 processor needs to save:
-- * 6 integer registers of 32 bits (r0, r1, PC, CPSR, R12, SP)
-- for normal processing
-- * 33 floating point registers of 32 bits (s0 .. s31, FPCSR)
-- This amounts to 39 registers, rounded up to 40 for alignment.
Context_Buffer_Capacity : constant := 40;
------------
-- Stacks --
------------
Interrupt_Stack_Size : constant := 8192;
-- Size of each of the interrupt stacks. Each processor has its own
-- interrupt stack. In case interrupts are nested, the same stack is used.
Interrupt_Sec_Stack_Size : constant := 128;
-- Size of the secondary stack for interrupt handlers
----------
-- CPUS --
----------
Max_Number_Of_CPUs : constant := 4;
-- Maximum number of CPUs avaialble on the target.
-- Note: the actual number of CPUs can be lower than this number, in
-- which case the runtime will adjust the CPUs according to the actual
-- CPU count.
-- The actual number of CPUs can be also bigger, in which case the runtime
-- will not use the additional CPUs.
Multiprocessor : constant Boolean := Max_Number_Of_CPUs /= 1;
-- Are we on a multiprocessor board?
end System.BB.Parameters;
|
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . C O N T A I N E R S . P R I M E _ N U M B E R S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2004-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. --
-- --
-- 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/>. --
-- --
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
-- This package declares the prime numbers array used to implement hashed
-- containers. Bucket arrays are always allocated with a prime-number
-- length (computed using To_Prime below), as this produces better scatter
-- when hash values are folded.
package Ada.Containers.Prime_Numbers is
pragma Pure;
type Primes_Type is array (Positive range <>) of Hash_Type;
Primes : constant Primes_Type :=
(53, 97, 193, 389, 769,
1543, 3079, 6151, 12289, 24593,
49157, 98317, 196613, 393241, 786433,
1572869, 3145739, 6291469, 12582917, 25165843,
50331653, 100663319, 201326611, 402653189, 805306457,
1610612741, 3221225473, 4294967291);
function To_Prime (Length : Count_Type) return Hash_Type;
-- Returns the smallest value in Primes not less than Length
end Ada.Containers.Prime_Numbers;
|
-- WORDS, a Latin dictionary, by Colonel William Whitaker (USAF, Retired)
--
-- Copyright William A. Whitaker (1936–2010)
--
-- This is a free program, which means it is proper to copy it and pass
-- it on to your friends. Consider it a developmental item for which
-- there is no charge. However, just for form, it is Copyrighted
-- (c). Permission is hereby freely given for any and all use of program
-- and data. You can sell it as your own, but at least tell me.
--
-- This version is distributed without obligation, but the developer
-- would appreciate comments and suggestions.
--
-- All parts of the WORDS system, source code and data files, are made freely
-- available to anyone who wishes to use them, for whatever purpose.
procedure Diffdict is
begin
null;
-- Two DICTLINEs, sorted the same way
-- Read into memory arrays (because we have so much memory)
-- Compared for STEMS, PART, FLAGs, (||), MEAN
-- The difference generated and written to output file
-- Color coded, if possible
-- Two DICTLINEs can then be compared and corrections made
-- A second run with the corrections gives a benchmark
-- Another exercise some time later produces another difference file
-- The two difference files are then DIFFed giving the changes
-- made over time
end Diffdict;
|
-----------------------------------------------------------------------
-- Servlet tests - Servlet Tests Framework
-- Copyright (C) 2011, 2012, 2013, 2015, 2017, 2018, 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 GNAT.Regpat;
with Ada.Strings.Unbounded;
with Ada.Unchecked_Deallocation;
with Util.Files;
with Servlet.Streams;
with Servlet.Responses;
with Servlet.Responses.Tools;
with EL.Variables.Default;
package body Servlet.Tests is
use Ada.Strings.Unbounded;
use Util.Tests;
type Container_Access is access Servlet.Server.Container;
Server : Container_Access;
App_Created : Servlet.Core.Servlet_Registry_Access;
App : Servlet.Core.Servlet_Registry_Access;
App_URI : Unbounded_String;
-- Save the response headers and content in a file
procedure Save_Response (Name : in String;
Response : in out Servlet.Responses.Mockup.Response'Class);
-- ------------------------------
-- Initialize the awa test framework mockup.
-- ------------------------------
procedure Initialize (Props : in Util.Properties.Manager'Class;
Context_Path : in String := "/servlet-unit";
Registry : in Servlet.Core.Servlet_Registry_Access := null) is
use type Servlet.Core.Servlet_Registry_Access;
begin
if Registry /= null then
App := Registry;
else
if App_Created = null then
App_Created := new Servlet.Core.Servlet_Registry;
end if;
App := App_Created;
end if;
if not Props.Is_Empty then
App.Set_Init_Parameters (Props);
end if;
App_URI := To_Unbounded_String (Context_Path);
Server := new Servlet.Server.Container;
Server.Register_Application (Context_Path, App.all'Access);
end Initialize;
-- ------------------------------
-- Called when the testsuite execution has finished.
-- ------------------------------
procedure Finish (Status : in Util.XUnit.Status) is
pragma Unreferenced (Status);
procedure Free is
new Ada.Unchecked_Deallocation (Object => Servlet.Server.Container,
Name => Container_Access);
begin
Free (Server);
end Finish;
-- ------------------------------
-- Get the server
-- ------------------------------
function Get_Server return access Servlet.Server.Container is
begin
return Server;
end Get_Server;
-- ------------------------------
-- Get the test application.
-- ------------------------------
function Get_Application return Servlet.Core.Servlet_Registry_Access is
begin
return App;
end Get_Application;
-- ------------------------------
-- Save the response headers and content in a file
-- ------------------------------
procedure Save_Response (Name : in String;
Response : in out Servlet.Responses.Mockup.Response'Class) is
use Servlet.Responses;
Info : constant String := Tools.To_String (Reply => Response,
Html => False,
Print_Headers => True);
Result_Path : constant String := Util.Tests.Get_Test_Path ("regtests/result");
Content : Unbounded_String;
Stream : Servlet.Streams.Print_Stream := Response.Get_Output_Stream;
begin
Response.Read_Content (Content);
Stream.Write (Content);
Insert (Content, 1, Info);
Util.Files.Write_File (Result_Path & "/" & Name, Content);
end Save_Response;
-- ------------------------------
-- Simulate a raw request. The URI and method must have been set on the Request object.
-- ------------------------------
procedure Do_Req (Request : in out Servlet.Requests.Mockup.Request'Class;
Response : in out Servlet.Responses.Mockup.Response'Class) is
begin
-- For the purpose of writing tests, clear the buffer before invoking the service.
Response.Clear;
Server.Service (Request => Request,
Response => Response);
end Do_Req;
-- ------------------------------
-- Simulate a GET request on the given URI with the request parameters.
-- Get the result in the response object.
-- ------------------------------
procedure Do_Get (Request : in out Servlet.Requests.Mockup.Request'Class;
Response : in out Servlet.Responses.Mockup.Response'Class;
URI : in String;
Save : in String := "") is
begin
Request.Set_Method (Method => "GET");
Request.Set_Request_URI (URI => To_String (App_URI) & URI, Split => True);
Request.Set_Protocol (Protocol => "HTTP/1.1");
Do_Req (Request, Response);
if Save'Length > 0 then
Save_Response (Save, Response);
end if;
end Do_Get;
-- ------------------------------
-- Simulate a POST request on the given URI with the request parameters.
-- Get the result in the response object.
-- ------------------------------
procedure Do_Post (Request : in out Servlet.Requests.Mockup.Request'Class;
Response : in out Servlet.Responses.Mockup.Response'Class;
URI : in String;
Save : in String := "") is
begin
Request.Set_Method (Method => "POST");
Request.Set_Request_URI (URI => To_String (App_URI) & URI, Split => False);
Request.Set_Protocol (Protocol => "HTTP/1.1");
Do_Req (Request, Response);
if Save'Length > 0 then
Save_Response (Save, Response);
end if;
end Do_Post;
-- ------------------------------
-- Check that the response body contains the string
-- ------------------------------
procedure Assert_Contains (T : in Util.Tests.Test'Class;
Value : in String;
Reply : in out Servlet.Responses.Mockup.Response;
Message : in String := "Test failed";
Source : String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line) is
Stream : Servlet.Streams.Print_Stream := Reply.Get_Output_Stream;
Content : Unbounded_String;
begin
Reply.Read_Content (Content);
Stream.Write (Content);
Assert_Equals (T, Servlet.Responses.SC_OK, Reply.Get_Status,
"Invalid response", Source, Line);
T.Assert (Condition => Index (Content, Value) > 0,
Message => Message & ": value '" & Value & "' not found",
Source => Source,
Line => Line);
end Assert_Contains;
-- ------------------------------
-- Check that the response body matches the regular expression
-- ------------------------------
procedure Assert_Matches (T : in Util.Tests.Test'Class;
Pattern : in String;
Reply : in out Servlet.Responses.Mockup.Response;
Message : in String := "Test failed";
Status : in Natural := Servlet.Responses.SC_OK;
Source : String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line) is
use GNAT.Regpat;
Stream : Servlet.Streams.Print_Stream := Reply.Get_Output_Stream;
Content : Unbounded_String;
Regexp : constant Pattern_Matcher := Compile (Expression => Pattern,
Flags => Multiple_Lines);
begin
Reply.Read_Content (Content);
Stream.Write (Content);
Assert_Equals (T, Status, Reply.Get_Status, "Invalid response", Source, Line);
T.Assert (Condition => Match (Regexp, To_String (Content)),
Message => Message & ": does not match '" & Pattern & "'",
Source => Source,
Line => Line);
end Assert_Matches;
-- ------------------------------
-- Check that the response contains the given header.
-- ------------------------------
procedure Assert_Header (T : in Util.Tests.Test'Class;
Header : in String;
Value : in String;
Reply : in out Servlet.Responses.Mockup.Response;
Message : in String := "Test failed";
Status : in Natural := Servlet.Responses.SC_OK;
Source : String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line) is
begin
Assert_Equals (T, Status, Reply.Get_Status,
"Invalid response status", Source, Line);
T.Assert (Condition => Reply.Contains_Header (Header),
Message => Message & ": missing header '" & Header & "'",
Source => Source,
Line => Line);
Assert_Equals (T, Value, Reply.Get_Header (Header), Message, Source, Line);
end Assert_Header;
-- ------------------------------
-- Check that the response body is a redirect to the given URI.
-- ------------------------------
procedure Assert_Redirect (T : in Util.Tests.Test'Class;
Value : in String;
Reply : in out Servlet.Responses.Mockup.Response;
Message : in String := "Test failed";
Source : String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line) is
begin
Assert_Equals (T, Servlet.Responses.SC_MOVED_TEMPORARILY, Reply.Get_Status,
"Invalid response", Source, Line);
Util.Tests.Assert_Equals (T, Value, Reply.Get_Header ("Location"),
Message & ": missing Location",
Source, Line);
end Assert_Redirect;
-- ------------------------------
-- Cleanup the test instance.
-- ------------------------------
overriding
procedure Tear_Down (T : in out EL_Test) is
procedure Free is
new Ada.Unchecked_Deallocation (EL.Contexts.Default.Default_Context'Class,
EL.Contexts.Default.Default_Context_Access);
procedure Free is
new Ada.Unchecked_Deallocation (EL.Variables.Variable_Mapper'Class,
EL.Variables.Variable_Mapper_Access);
procedure Free is
new Ada.Unchecked_Deallocation (EL.Contexts.Default.Default_ELResolver'Class,
EL.Contexts.Default.Default_ELResolver_Access);
begin
-- Servlet.Contexts.Faces.Restore (null);
Free (T.ELContext);
Free (T.Variables);
Free (T.Root_Resolver);
end Tear_Down;
-- ------------------------------
-- Setup the test instance.
-- ------------------------------
overriding
procedure Set_Up (T : in out EL_Test) is
begin
T.ELContext := new EL.Contexts.Default.Default_Context;
T.Root_Resolver := new EL.Contexts.Default.Default_ELResolver;
T.Variables := new EL.Variables.Default.Default_Variable_Mapper;
T.ELContext.Set_Resolver (T.Root_Resolver.all'Access);
T.ELContext.Set_Variable_Mapper (T.Variables.all'Access);
end Set_Up;
end Servlet.Tests;
|
with
physics.Shape,
c_math_c.Pointers,
bullet_c.Pointers,
bullet_c;
package bullet_Physics.Shape
--
-- Provides glue between a physics shape and a Bullet3D shape.
--
is
type Item is abstract new physics.Shape.item with
record
C : bullet_c.Pointers.Shape_Pointer;
end record;
type View is access all Item'Class;
use Math;
---------
-- Forge
--
overriding
procedure define (Self : in out Item);
overriding
procedure destruct (Self : in out Item);
function new_box_Shape (half_Extents : in Vector_3) return physics.Shape.view;
function new_capsule_Shape (Radii : in Vector_2;
Height : in Real) return physics.Shape.view;
function new_cone_Shape (Radius,
Height : in Real) return physics.Shape.view;
function new_convex_hull_Shape (Points : in physics.Vector_3_array)
return physics.Shape.view;
function new_mesh_Shape (Model : access Geometry.d3.a_Model)
return physics.Shape.view;
function new_cylinder_Shape (half_Extents : in Vector_3) return physics.Shape.view;
function new_heightfield_Shape (Width,
Depth : in Positive;
Heights : in c_math_c.Pointers.Real_pointer;
min_Height,
max_Height : in Real;
Scale : in Vector_3) return physics.Shape.view;
function new_multiSphere_Shape (Positions : in physics.Vector_3_array;
Radii : in Vector) return physics.Shape.view;
function new_plane_Shape (Normal : in Vector_3;
Offset : in Real) return physics.Shape.view;
function new_sphere_Shape (Radius : in Real) return physics.Shape.view;
procedure free (the_Shape : in out physics.Shape.view);
---------------
--- Attributes
--
overriding
procedure Scale_is (Self : in out Item; Now : Vector_3);
private
type Box is new Item with null record;
type Capsule is new Item with null record;
type Cone is new Item with null record;
type Cylinder is new Item with null record;
type Heightfield is new Item with null record;
type multiSphere is new Item with null record;
type Plane is new Item with null record;
type Sphere is new Item with null record;
type convex_Hull is new Item with null record;
type Mesh is new Item with null record;
end bullet_Physics.Shape;
|
package Units.Operations with SPARK_Mode is
-- instantiate some useful functions for the units. Cannot be done
function Sum_Time is new Saturated_Addition (T => Time_Type);
end Units.Operations;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S P R I N T --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-2001, 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. --
-- --
-- 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 Casing; use Casing;
with Debug; use Debug;
with Einfo; use Einfo;
with Lib; use Lib;
with Namet; use Namet;
with Nlists; use Nlists;
with Opt; use Opt;
with Output; use Output;
with Rtsfind; use Rtsfind;
with Sinfo; use Sinfo;
with Sinput; use Sinput;
with Sinput.L; use Sinput.L;
with Snames; use Snames;
with Stand; use Stand;
with Stringt; use Stringt;
with Uintp; use Uintp;
with Uname; use Uname;
with Urealp; use Urealp;
package body Sprint is
Debug_Node : Node_Id := Empty;
-- If we are in Debug_Generated_Code mode, then this location is set
-- to the current node requiring Sloc fixup, until Set_Debug_Sloc is
-- called to set the proper value. The call clears it back to Empty.
Debug_Sloc : Source_Ptr;
-- Sloc of first byte of line currently being written if we are
-- generating a source debug file.
Dump_Original_Only : Boolean;
-- Set True if the -gnatdo (dump original tree) flag is set
Dump_Generated_Only : Boolean;
-- Set True if the -gnatG (dump generated tree) debug flag is set
-- or for Print_Generated_Code (-gnatG) or Dump_Gnerated_Code (-gnatD).
Dump_Freeze_Null : Boolean;
-- Set True if freeze nodes and non-source null statements output
Indent : Int := 0;
-- Number of columns for current line output indentation
Indent_Annull_Flag : Boolean := False;
-- Set True if subsequent Write_Indent call to be ignored, gets reset
-- by this call, so it is only active to suppress a single indent call.
Line_Limit : constant := 72;
-- Limit value for chopping long lines
Freeze_Indent : Int := 0;
-- Keep track of freeze indent level (controls blank lines before
-- procedures within expression freeze actions)
-----------------------
-- Local Subprograms --
-----------------------
procedure Col_Check (N : Nat);
-- Check that at least N characters remain on current line, and if not,
-- then start an extra line with two characters extra indentation for
-- continuing text on the next line.
procedure Indent_Annull;
-- Causes following call to Write_Indent to be ignored. This is used when
-- a higher level node wants to stop a lower level node from starting a
-- new line, when it would otherwise be inclined to do so (e.g. the case
-- of an accept statement called from an accept alternative with a guard)
procedure Indent_Begin;
-- Increase indentation level
procedure Indent_End;
-- Decrease indentation level
procedure Print_Eol;
-- Terminate current line in line buffer
procedure Process_TFAI_RR_Flags (Nod : Node_Id);
-- Given a divide, multiplication or division node, check the flags
-- Treat_Fixed_As_Integer and Rounded_Flags, and if set, output the
-- appropriate special syntax characters (# and @).
procedure Set_Debug_Sloc;
-- If Debug_Node is non-empty, this routine sets the appropriate value
-- in its Sloc field, from the current location in the debug source file
-- that is currently being written. Note that Debug_Node is always empty
-- if a debug source file is not being written.
procedure Sprint_Bar_List (List : List_Id);
-- Print the given list with items separated by vertical bars
procedure Sprint_Node_Actual (Node : Node_Id);
-- This routine prints its node argument. It is a lower level routine than
-- Sprint_Node, in that it does not bother about rewritten trees.
procedure Sprint_Node_Sloc (Node : Node_Id);
-- Like Sprint_Node, but in addition, in Debug_Generated_Code mode,
-- sets the Sloc of the current debug node to be a copy of the Sloc
-- of the sprinted node Node. Note that this is done after printing
-- Node, so that the Sloc is the proper updated value for the debug file.
procedure Write_Char_Sloc (C : Character);
-- Like Write_Char, except that if C is non-blank, Set_Debug_Sloc is
-- called to ensure that the current node has a proper Sloc set.
procedure Write_Discr_Specs (N : Node_Id);
-- Output discriminant specification for node, which is any of the type
-- declarations that can have discriminants.
procedure Write_Ekind (E : Entity_Id);
-- Write the String corresponding to the Ekind without "E_".
procedure Write_Id (N : Node_Id);
-- N is a node with a Chars field. This procedure writes the name that
-- will be used in the generated code associated with the name. For a
-- node with no associated entity, this is simply the Chars field. For
-- the case where there is an entity associated with the node, we print
-- the name associated with the entity (since it may have been encoded).
-- One other special case is that an entity has an active external name
-- (i.e. an external name present with no address clause), then this
-- external name is output.
function Write_Identifiers (Node : Node_Id) return Boolean;
-- Handle node where the grammar has a list of defining identifiers, but
-- the tree has a separate declaration for each identifier. Handles the
-- printing of the defining identifier, and returns True if the type and
-- initialization information is to be printed, False if it is to be
-- skipped (the latter case happens when printing defining identifiers
-- other than the first in the original tree output case).
procedure Write_Implicit_Def (E : Entity_Id);
pragma Warnings (Off, Write_Implicit_Def);
-- Write the definition of the implicit type E according to its Ekind
-- For now a debugging procedure, but might be used in the future.
procedure Write_Indent;
-- Start a new line and write indentation spacing
function Write_Indent_Identifiers (Node : Node_Id) return Boolean;
-- Like Write_Identifiers except that each new printed declaration
-- is at the start of a new line.
function Write_Indent_Identifiers_Sloc (Node : Node_Id) return Boolean;
-- Like Write_Indent_Identifiers except that in Debug_Generated_Code
-- mode, the Sloc of the current debug node is set to point ot the
-- first output identifier.
procedure Write_Indent_Str (S : String);
-- Start a new line and write indent spacing followed by given string
procedure Write_Indent_Str_Sloc (S : String);
-- Like Write_Indent_Str, but in addition, in Debug_Generated_Code mode,
-- the Sloc of the current node is set to the first non-blank character
-- in the string S.
procedure Write_Name_With_Col_Check (N : Name_Id);
-- Write name (using Write_Name) with initial column check, and possible
-- initial Write_Indent (to get new line) if current line is too full.
procedure Write_Name_With_Col_Check_Sloc (N : Name_Id);
-- Like Write_Name_With_Col_Check but in addition, in Debug_Generated_Code
-- mode, sets Sloc of current debug node to first character of name.
procedure Write_Operator (N : Node_Id; S : String);
-- Like Write_Str_Sloc, used for operators, encloses the string in
-- characters {} if the Do_Overflow flag is set on the node N.
procedure Write_Param_Specs (N : Node_Id);
-- Output parameter specifications for node (which is either a function
-- or procedure specification with a Parameter_Specifications field)
procedure Write_Rewrite_Str (S : String);
-- Writes out a string (typically containing <<< or >>>}) for a node
-- created by rewriting the tree. Suppressed if we are outputting the
-- generated code only, since in this case we don't specially mark nodes
-- created by rewriting).
procedure Write_Str_Sloc (S : String);
-- Like Write_Str, but sets debug Sloc of current debug node to first
-- non-blank character if a current debug node is active.
procedure Write_Str_With_Col_Check (S : String);
-- Write string (using Write_Str) with initial column check, and possible
-- initial Write_Indent (to get new line) if current line is too full.
procedure Write_Str_With_Col_Check_Sloc (S : String);
-- Like Write_Str_WIth_Col_Check, but sets debug Sloc of current debug
-- node to first non-blank character if a current debug node is active.
procedure Write_Uint_With_Col_Check_Sloc (U : Uint; Format : UI_Format);
-- Write Uint (using UI_Write) with initial column check, and possible
-- initial Write_Indent (to get new line) if current line is too full.
-- The format parameter determines the output format (see UI_Write).
-- In addition, in Debug_Generated_Code mode, sets the current node
-- Sloc to the first character of the output value.
procedure Write_Ureal_With_Col_Check_Sloc (U : Ureal);
-- Write Ureal (using same output format as UR_Write) with column checks
-- and a possible initial Write_Indent (to get new line) if current line
-- is too full. In addition, in Debug_Generated_Code mode, sets the
-- current node Sloc to the first character of the output value.
---------------
-- Col_Check --
---------------
procedure Col_Check (N : Nat) is
begin
if N + Column > Line_Limit then
Write_Indent_Str (" ");
end if;
end Col_Check;
-------------------
-- Indent_Annull --
-------------------
procedure Indent_Annull is
begin
Indent_Annull_Flag := True;
end Indent_Annull;
------------------
-- Indent_Begin --
------------------
procedure Indent_Begin is
begin
Indent := Indent + 3;
end Indent_Begin;
----------------
-- Indent_End --
----------------
procedure Indent_End is
begin
Indent := Indent - 3;
end Indent_End;
--------
-- PG --
--------
procedure PG (Node : Node_Id) is
begin
Dump_Generated_Only := True;
Dump_Original_Only := False;
Sprint_Node (Node);
Print_Eol;
end PG;
--------
-- PO --
--------
procedure PO (Node : Node_Id) is
begin
Dump_Generated_Only := False;
Dump_Original_Only := True;
Sprint_Node (Node);
Print_Eol;
end PO;
---------------
-- Print_Eol --
---------------
procedure Print_Eol is
begin
-- If we are writing a debug source file, then grab it from the
-- Output buffer, and reset the column counter (the routines in
-- Output never actually write any output for us in this mode,
-- they just build line images in Buffer).
if Debug_Generated_Code then
Write_Debug_Line (Buffer (1 .. Natural (Column) - 1), Debug_Sloc);
Column := 1;
-- In normal mode, we call Write_Eol to write the line normally
else
Write_Eol;
end if;
end Print_Eol;
---------------------------
-- Process_TFAI_RR_Flags --
---------------------------
procedure Process_TFAI_RR_Flags (Nod : Node_Id) is
begin
if Treat_Fixed_As_Integer (Nod) then
Write_Char ('#');
end if;
if Rounded_Result (Nod) then
Write_Char ('@');
end if;
end Process_TFAI_RR_Flags;
--------
-- PS --
--------
procedure PS (Node : Node_Id) is
begin
Dump_Generated_Only := False;
Dump_Original_Only := False;
Sprint_Node (Node);
Print_Eol;
end PS;
--------------------
-- Set_Debug_Sloc --
--------------------
procedure Set_Debug_Sloc is
begin
if Present (Debug_Node) then
Set_Sloc (Debug_Node, Debug_Sloc + Source_Ptr (Column - 1));
Debug_Node := Empty;
end if;
end Set_Debug_Sloc;
-----------------
-- Source_Dump --
-----------------
procedure Source_Dump is
procedure Underline;
-- Put underline under string we just printed
procedure Underline is
Col : constant Int := Column;
begin
Print_Eol;
while Col > Column loop
Write_Char ('-');
end loop;
Print_Eol;
end Underline;
-- Start of processing for Tree_Dump.
begin
Dump_Generated_Only := Debug_Flag_G or
Print_Generated_Code or
Debug_Generated_Code;
Dump_Original_Only := Debug_Flag_O;
Dump_Freeze_Null := Debug_Flag_S or Debug_Flag_G;
-- Note that we turn off the tree dump flags immediately, before
-- starting the dump. This avoids generating two copies of the dump
-- if an abort occurs after printing the dump, and more importantly,
-- avoids an infinite loop if an abort occurs during the dump.
if Debug_Flag_Z then
Debug_Flag_Z := False;
Print_Eol;
Print_Eol;
Write_Str ("Source recreated from tree of Standard (spec)");
Underline;
Sprint_Node (Standard_Package_Node);
Print_Eol;
Print_Eol;
end if;
if Debug_Flag_S or Dump_Generated_Only or Dump_Original_Only then
Debug_Flag_G := False;
Debug_Flag_O := False;
Debug_Flag_S := False;
-- Dump requested units
for U in Main_Unit .. Last_Unit loop
-- Dump all units if -gnatdf set, otherwise we dump only
-- the source files that are in the extended main source.
if Debug_Flag_F
or else In_Extended_Main_Source_Unit (Cunit_Entity (U))
then
-- If we are generating debug files, setup to write them
if Debug_Generated_Code then
Create_Debug_Source (Source_Index (U), Debug_Sloc);
Sprint_Node (Cunit (U));
Print_Eol;
Close_Debug_Source;
-- Normal output to standard output file
else
Write_Str ("Source recreated from tree for ");
Write_Unit_Name (Unit_Name (U));
Underline;
Sprint_Node (Cunit (U));
Write_Eol;
Write_Eol;
end if;
end if;
end loop;
end if;
end Source_Dump;
---------------------
-- Sprint_Bar_List --
---------------------
procedure Sprint_Bar_List (List : List_Id) is
Node : Node_Id;
begin
if Is_Non_Empty_List (List) then
Node := First (List);
loop
Sprint_Node (Node);
Next (Node);
exit when Node = Empty;
Write_Str (" | ");
end loop;
end if;
end Sprint_Bar_List;
-----------------------
-- Sprint_Comma_List --
-----------------------
procedure Sprint_Comma_List (List : List_Id) is
Node : Node_Id;
begin
if Is_Non_Empty_List (List) then
Node := First (List);
loop
Sprint_Node (Node);
Next (Node);
exit when Node = Empty;
if not Is_Rewrite_Insertion (Node)
or else not Dump_Original_Only
then
Write_Str (", ");
end if;
end loop;
end if;
end Sprint_Comma_List;
--------------------------
-- Sprint_Indented_List --
--------------------------
procedure Sprint_Indented_List (List : List_Id) is
begin
Indent_Begin;
Sprint_Node_List (List);
Indent_End;
end Sprint_Indented_List;
-----------------
-- Sprint_Node --
-----------------
procedure Sprint_Node (Node : Node_Id) is
begin
if Is_Rewrite_Insertion (Node) then
if not Dump_Original_Only then
-- For special cases of nodes that always output <<< >>>
-- do not duplicate the output at this point.
if Nkind (Node) = N_Freeze_Entity
or else Nkind (Node) = N_Implicit_Label_Declaration
then
Sprint_Node_Actual (Node);
-- Normal case where <<< >>> may be required
else
Write_Rewrite_Str ("<<<");
Sprint_Node_Actual (Node);
Write_Rewrite_Str (">>>");
end if;
end if;
elsif Is_Rewrite_Substitution (Node) then
-- Case of dump generated only
if Dump_Generated_Only then
Sprint_Node_Actual (Node);
-- Case of dump original only
elsif Dump_Original_Only then
Sprint_Node_Actual (Original_Node (Node));
-- Case of both being dumped
else
Sprint_Node_Actual (Original_Node (Node));
Write_Rewrite_Str ("<<<");
Sprint_Node_Actual (Node);
Write_Rewrite_Str (">>>");
end if;
else
Sprint_Node_Actual (Node);
end if;
end Sprint_Node;
------------------------
-- Sprint_Node_Actual --
------------------------
procedure Sprint_Node_Actual (Node : Node_Id) is
Save_Debug_Node : constant Node_Id := Debug_Node;
begin
if Node = Empty then
return;
end if;
for J in 1 .. Paren_Count (Node) loop
Write_Str_With_Col_Check ("(");
end loop;
-- Setup node for Sloc fixup if writing a debug source file. Note
-- that we take care of any previous node not yet properly set.
if Debug_Generated_Code then
Debug_Node := Node;
end if;
if Nkind (Node) in N_Subexpr
and then Do_Range_Check (Node)
then
Write_Str_With_Col_Check ("{");
end if;
-- Select print circuit based on node kind
case Nkind (Node) is
when N_Abort_Statement =>
Write_Indent_Str_Sloc ("abort ");
Sprint_Comma_List (Names (Node));
Write_Char (';');
when N_Abortable_Part =>
Set_Debug_Sloc;
Write_Str_Sloc ("abort ");
Sprint_Indented_List (Statements (Node));
when N_Abstract_Subprogram_Declaration =>
Write_Indent;
Sprint_Node (Specification (Node));
Write_Str_With_Col_Check (" is ");
Write_Str_Sloc ("abstract;");
when N_Accept_Alternative =>
Sprint_Node_List (Pragmas_Before (Node));
if Present (Condition (Node)) then
Write_Indent_Str ("when ");
Sprint_Node (Condition (Node));
Write_Str (" => ");
Indent_Annull;
end if;
Sprint_Node_Sloc (Accept_Statement (Node));
Sprint_Node_List (Statements (Node));
when N_Accept_Statement =>
Write_Indent_Str_Sloc ("accept ");
Write_Id (Entry_Direct_Name (Node));
if Present (Entry_Index (Node)) then
Write_Str_With_Col_Check (" (");
Sprint_Node (Entry_Index (Node));
Write_Char (')');
end if;
Write_Param_Specs (Node);
if Present (Handled_Statement_Sequence (Node)) then
Write_Str_With_Col_Check (" do");
Sprint_Node (Handled_Statement_Sequence (Node));
Write_Indent_Str ("end ");
Write_Id (Entry_Direct_Name (Node));
end if;
Write_Char (';');
when N_Access_Definition =>
Write_Str_With_Col_Check_Sloc ("access ");
Sprint_Node (Subtype_Mark (Node));
when N_Access_Function_Definition =>
Write_Str_With_Col_Check_Sloc ("access ");
if Protected_Present (Node) then
Write_Str_With_Col_Check ("protected ");
end if;
Write_Str_With_Col_Check ("function");
Write_Param_Specs (Node);
Write_Str_With_Col_Check (" return ");
Sprint_Node (Subtype_Mark (Node));
when N_Access_Procedure_Definition =>
Write_Str_With_Col_Check_Sloc ("access ");
if Protected_Present (Node) then
Write_Str_With_Col_Check ("protected ");
end if;
Write_Str_With_Col_Check ("procedure");
Write_Param_Specs (Node);
when N_Access_To_Object_Definition =>
Write_Str_With_Col_Check_Sloc ("access ");
if All_Present (Node) then
Write_Str_With_Col_Check ("all ");
elsif Constant_Present (Node) then
Write_Str_With_Col_Check ("constant ");
end if;
Sprint_Node (Subtype_Indication (Node));
when N_Aggregate =>
if Null_Record_Present (Node) then
Write_Str_With_Col_Check_Sloc ("(null record)");
else
Write_Str_With_Col_Check_Sloc ("(");
if Present (Expressions (Node)) then
Sprint_Comma_List (Expressions (Node));
if Present (Component_Associations (Node)) then
Write_Str (", ");
end if;
end if;
if Present (Component_Associations (Node)) then
Indent_Begin;
declare
Nd : Node_Id;
begin
Nd := First (Component_Associations (Node));
loop
Write_Indent;
Sprint_Node (Nd);
Next (Nd);
exit when No (Nd);
if not Is_Rewrite_Insertion (Nd)
or else not Dump_Original_Only
then
Write_Str (", ");
end if;
end loop;
end;
Indent_End;
end if;
Write_Char (')');
end if;
when N_Allocator =>
Write_Str_With_Col_Check_Sloc ("new ");
Sprint_Node (Expression (Node));
if Present (Storage_Pool (Node)) then
Write_Str_With_Col_Check ("[storage_pool = ");
Sprint_Node (Storage_Pool (Node));
Write_Char (']');
end if;
when N_And_Then =>
Sprint_Node (Left_Opnd (Node));
Write_Str_Sloc (" and then ");
Sprint_Node (Right_Opnd (Node));
when N_At_Clause =>
Write_Indent_Str_Sloc ("for ");
Write_Id (Identifier (Node));
Write_Str_With_Col_Check (" use at ");
Sprint_Node (Expression (Node));
Write_Char (';');
when N_Assignment_Statement =>
Write_Indent;
Sprint_Node (Name (Node));
Write_Str_Sloc (" := ");
Sprint_Node (Expression (Node));
Write_Char (';');
when N_Asynchronous_Select =>
Write_Indent_Str_Sloc ("select");
Indent_Begin;
Sprint_Node (Triggering_Alternative (Node));
Indent_End;
-- Note: let the printing of Abortable_Part handle outputting
-- the ABORT keyword, so that the Slco can be set correctly.
Write_Indent_Str ("then ");
Sprint_Node (Abortable_Part (Node));
Write_Indent_Str ("end select;");
when N_Attribute_Definition_Clause =>
Write_Indent_Str_Sloc ("for ");
Sprint_Node (Name (Node));
Write_Char (''');
Write_Name_With_Col_Check (Chars (Node));
Write_Str_With_Col_Check (" use ");
Sprint_Node (Expression (Node));
Write_Char (';');
when N_Attribute_Reference =>
if Is_Procedure_Attribute_Name (Attribute_Name (Node)) then
Write_Indent;
end if;
Sprint_Node (Prefix (Node));
Write_Char_Sloc (''');
Write_Name_With_Col_Check (Attribute_Name (Node));
Sprint_Paren_Comma_List (Expressions (Node));
if Is_Procedure_Attribute_Name (Attribute_Name (Node)) then
Write_Char (';');
end if;
when N_Block_Statement =>
Write_Indent;
if Present (Identifier (Node))
and then (not Has_Created_Identifier (Node)
or else not Dump_Original_Only)
then
Write_Rewrite_Str ("<<<");
Write_Id (Identifier (Node));
Write_Str (" : ");
Write_Rewrite_Str (">>>");
end if;
if Present (Declarations (Node)) then
Write_Str_With_Col_Check_Sloc ("declare");
Sprint_Indented_List (Declarations (Node));
Write_Indent;
end if;
Write_Str_With_Col_Check_Sloc ("begin");
Sprint_Node (Handled_Statement_Sequence (Node));
Write_Indent_Str ("end");
if Present (Identifier (Node))
and then (not Has_Created_Identifier (Node)
or else not Dump_Original_Only)
then
Write_Rewrite_Str ("<<<");
Write_Char (' ');
Write_Id (Identifier (Node));
Write_Rewrite_Str (">>>");
end if;
Write_Char (';');
when N_Case_Statement =>
Write_Indent_Str_Sloc ("case ");
Sprint_Node (Expression (Node));
Write_Str (" is");
Sprint_Indented_List (Alternatives (Node));
Write_Indent_Str ("end case;");
when N_Case_Statement_Alternative =>
Write_Indent_Str_Sloc ("when ");
Sprint_Bar_List (Discrete_Choices (Node));
Write_Str (" => ");
Sprint_Indented_List (Statements (Node));
when N_Character_Literal =>
if Column > 70 then
Write_Indent_Str (" ");
end if;
Write_Char_Sloc (''');
Write_Char_Code (Char_Literal_Value (Node));
Write_Char (''');
when N_Code_Statement =>
Write_Indent;
Set_Debug_Sloc;
Sprint_Node (Expression (Node));
Write_Char (';');
when N_Compilation_Unit =>
Sprint_Node_List (Context_Items (Node));
Sprint_Opt_Node_List (Declarations (Aux_Decls_Node (Node)));
if Private_Present (Node) then
Write_Indent_Str ("private ");
Indent_Annull;
end if;
Sprint_Node_Sloc (Unit (Node));
if Present (Actions (Aux_Decls_Node (Node)))
or else
Present (Pragmas_After (Aux_Decls_Node (Node)))
then
Write_Indent;
end if;
Sprint_Opt_Node_List (Actions (Aux_Decls_Node (Node)));
Sprint_Opt_Node_List (Pragmas_After (Aux_Decls_Node (Node)));
when N_Compilation_Unit_Aux =>
null; -- nothing to do, never used, see above
when N_Component_Association =>
Set_Debug_Sloc;
Sprint_Bar_List (Choices (Node));
Write_Str (" => ");
Sprint_Node (Expression (Node));
when N_Component_Clause =>
Write_Indent;
Sprint_Node (Component_Name (Node));
Write_Str_Sloc (" at ");
Sprint_Node (Position (Node));
Write_Char (' ');
Write_Str_With_Col_Check ("range ");
Sprint_Node (First_Bit (Node));
Write_Str (" .. ");
Sprint_Node (Last_Bit (Node));
Write_Char (';');
when N_Component_Declaration =>
if Write_Indent_Identifiers_Sloc (Node) then
Write_Str (" : ");
if Aliased_Present (Node) then
Write_Str_With_Col_Check ("aliased ");
end if;
Sprint_Node (Subtype_Indication (Node));
if Present (Expression (Node)) then
Write_Str (" := ");
Sprint_Node (Expression (Node));
end if;
Write_Char (';');
end if;
when N_Component_List =>
if Null_Present (Node) then
Indent_Begin;
Write_Indent_Str_Sloc ("null");
Write_Char (';');
Indent_End;
else
Set_Debug_Sloc;
Sprint_Indented_List (Component_Items (Node));
Sprint_Node (Variant_Part (Node));
end if;
when N_Conditional_Entry_Call =>
Write_Indent_Str_Sloc ("select");
Indent_Begin;
Sprint_Node (Entry_Call_Alternative (Node));
Indent_End;
Write_Indent_Str ("else");
Sprint_Indented_List (Else_Statements (Node));
Write_Indent_Str ("end select;");
when N_Conditional_Expression =>
declare
Condition : constant Node_Id := First (Expressions (Node));
Then_Expr : constant Node_Id := Next (Condition);
Else_Expr : constant Node_Id := Next (Then_Expr);
begin
Write_Str_With_Col_Check_Sloc ("(if ");
Sprint_Node (Condition);
Write_Str_With_Col_Check (" then ");
Sprint_Node (Then_Expr);
Write_Str_With_Col_Check (" else ");
Sprint_Node (Else_Expr);
Write_Char (')');
end;
when N_Constrained_Array_Definition =>
Write_Str_With_Col_Check_Sloc ("array ");
Sprint_Paren_Comma_List (Discrete_Subtype_Definitions (Node));
Write_Str (" of ");
if Aliased_Present (Node) then
Write_Str_With_Col_Check ("aliased ");
end if;
Sprint_Node (Subtype_Indication (Node));
when N_Decimal_Fixed_Point_Definition =>
Write_Str_With_Col_Check_Sloc (" delta ");
Sprint_Node (Delta_Expression (Node));
Write_Str_With_Col_Check ("digits ");
Sprint_Node (Digits_Expression (Node));
Sprint_Opt_Node (Real_Range_Specification (Node));
when N_Defining_Character_Literal =>
Write_Name_With_Col_Check_Sloc (Chars (Node));
when N_Defining_Identifier =>
Set_Debug_Sloc;
Write_Id (Node);
when N_Defining_Operator_Symbol =>
Write_Name_With_Col_Check_Sloc (Chars (Node));
when N_Defining_Program_Unit_Name =>
Set_Debug_Sloc;
Sprint_Node (Name (Node));
Write_Char ('.');
Write_Id (Defining_Identifier (Node));
when N_Delay_Alternative =>
Sprint_Node_List (Pragmas_Before (Node));
if Present (Condition (Node)) then
Write_Indent;
Write_Str_With_Col_Check ("when ");
Sprint_Node (Condition (Node));
Write_Str (" => ");
Indent_Annull;
end if;
Sprint_Node_Sloc (Delay_Statement (Node));
Sprint_Node_List (Statements (Node));
when N_Delay_Relative_Statement =>
Write_Indent_Str_Sloc ("delay ");
Sprint_Node (Expression (Node));
Write_Char (';');
when N_Delay_Until_Statement =>
Write_Indent_Str_Sloc ("delay until ");
Sprint_Node (Expression (Node));
Write_Char (';');
when N_Delta_Constraint =>
Write_Str_With_Col_Check_Sloc ("delta ");
Sprint_Node (Delta_Expression (Node));
Sprint_Opt_Node (Range_Constraint (Node));
when N_Derived_Type_Definition =>
if Abstract_Present (Node) then
Write_Str_With_Col_Check ("abstract ");
end if;
Write_Str_With_Col_Check_Sloc ("new ");
Sprint_Node (Subtype_Indication (Node));
if Present (Record_Extension_Part (Node)) then
Write_Str_With_Col_Check (" with ");
Sprint_Node (Record_Extension_Part (Node));
end if;
when N_Designator =>
Sprint_Node (Name (Node));
Write_Char_Sloc ('.');
Write_Id (Identifier (Node));
when N_Digits_Constraint =>
Write_Str_With_Col_Check_Sloc ("digits ");
Sprint_Node (Digits_Expression (Node));
Sprint_Opt_Node (Range_Constraint (Node));
when N_Discriminant_Association =>
Set_Debug_Sloc;
if Present (Selector_Names (Node)) then
Sprint_Bar_List (Selector_Names (Node));
Write_Str (" => ");
end if;
Set_Debug_Sloc;
Sprint_Node (Expression (Node));
when N_Discriminant_Specification =>
Set_Debug_Sloc;
if Write_Identifiers (Node) then
Write_Str (" : ");
Sprint_Node (Discriminant_Type (Node));
if Present (Expression (Node)) then
Write_Str (" := ");
Sprint_Node (Expression (Node));
end if;
else
Write_Str (", ");
end if;
when N_Elsif_Part =>
Write_Indent_Str_Sloc ("elsif ");
Sprint_Node (Condition (Node));
Write_Str_With_Col_Check (" then");
Sprint_Indented_List (Then_Statements (Node));
when N_Empty =>
null;
when N_Entry_Body =>
Write_Indent_Str_Sloc ("entry ");
Write_Id (Defining_Identifier (Node));
Sprint_Node (Entry_Body_Formal_Part (Node));
Write_Str_With_Col_Check (" is");
Sprint_Indented_List (Declarations (Node));
Write_Indent_Str ("begin");
Sprint_Node (Handled_Statement_Sequence (Node));
Write_Indent_Str ("end ");
Write_Id (Defining_Identifier (Node));
Write_Char (';');
when N_Entry_Body_Formal_Part =>
if Present (Entry_Index_Specification (Node)) then
Write_Str_With_Col_Check_Sloc (" (");
Sprint_Node (Entry_Index_Specification (Node));
Write_Char (')');
end if;
Write_Param_Specs (Node);
Write_Str_With_Col_Check_Sloc (" when ");
Sprint_Node (Condition (Node));
when N_Entry_Call_Alternative =>
Sprint_Node_List (Pragmas_Before (Node));
Sprint_Node_Sloc (Entry_Call_Statement (Node));
Sprint_Node_List (Statements (Node));
when N_Entry_Call_Statement =>
Write_Indent;
Sprint_Node_Sloc (Name (Node));
Sprint_Opt_Paren_Comma_List (Parameter_Associations (Node));
Write_Char (';');
when N_Entry_Declaration =>
Write_Indent_Str_Sloc ("entry ");
Write_Id (Defining_Identifier (Node));
if Present (Discrete_Subtype_Definition (Node)) then
Write_Str_With_Col_Check (" (");
Sprint_Node (Discrete_Subtype_Definition (Node));
Write_Char (')');
end if;
Write_Param_Specs (Node);
Write_Char (';');
when N_Entry_Index_Specification =>
Write_Str_With_Col_Check_Sloc ("for ");
Write_Id (Defining_Identifier (Node));
Write_Str_With_Col_Check (" in ");
Sprint_Node (Discrete_Subtype_Definition (Node));
when N_Enumeration_Representation_Clause =>
Write_Indent_Str_Sloc ("for ");
Write_Id (Identifier (Node));
Write_Str_With_Col_Check (" use ");
Sprint_Node (Array_Aggregate (Node));
Write_Char (';');
when N_Enumeration_Type_Definition =>
Set_Debug_Sloc;
-- Skip attempt to print Literals field if it's not there and
-- we are in package Standard (case of Character, which is
-- handled specially (without an explicit literals list).
if Sloc (Node) > Standard_Location
or else Present (Literals (Node))
then
Sprint_Paren_Comma_List (Literals (Node));
end if;
when N_Error =>
Write_Str_With_Col_Check_Sloc ("<error>");
when N_Exception_Declaration =>
if Write_Indent_Identifiers (Node) then
Write_Str_With_Col_Check (" : ");
Write_Str_Sloc ("exception;");
end if;
when N_Exception_Handler =>
Write_Indent_Str_Sloc ("when ");
if Present (Choice_Parameter (Node)) then
Sprint_Node (Choice_Parameter (Node));
Write_Str (" : ");
end if;
Sprint_Bar_List (Exception_Choices (Node));
Write_Str (" => ");
Sprint_Indented_List (Statements (Node));
when N_Exception_Renaming_Declaration =>
Write_Indent;
Set_Debug_Sloc;
Sprint_Node (Defining_Identifier (Node));
Write_Str_With_Col_Check (" : exception renames ");
Sprint_Node (Name (Node));
Write_Char (';');
when N_Exit_Statement =>
Write_Indent_Str_Sloc ("exit");
Sprint_Opt_Node (Name (Node));
if Present (Condition (Node)) then
Write_Str_With_Col_Check (" when ");
Sprint_Node (Condition (Node));
end if;
Write_Char (';');
when N_Explicit_Dereference =>
Sprint_Node (Prefix (Node));
Write_Char ('.');
Write_Str_Sloc ("all");
when N_Extension_Aggregate =>
Write_Str_With_Col_Check_Sloc ("(");
Sprint_Node (Ancestor_Part (Node));
Write_Str_With_Col_Check (" with ");
if Null_Record_Present (Node) then
Write_Str_With_Col_Check ("null record");
else
if Present (Expressions (Node)) then
Sprint_Comma_List (Expressions (Node));
if Present (Component_Associations (Node)) then
Write_Str (", ");
end if;
end if;
if Present (Component_Associations (Node)) then
Sprint_Comma_List (Component_Associations (Node));
end if;
end if;
Write_Char (')');
when N_Floating_Point_Definition =>
Write_Str_With_Col_Check_Sloc ("digits ");
Sprint_Node (Digits_Expression (Node));
Sprint_Opt_Node (Real_Range_Specification (Node));
when N_Formal_Decimal_Fixed_Point_Definition =>
Write_Str_With_Col_Check_Sloc ("delta <> digits <>");
when N_Formal_Derived_Type_Definition =>
Write_Str_With_Col_Check_Sloc ("new ");
Sprint_Node (Subtype_Mark (Node));
if Private_Present (Node) then
Write_Str_With_Col_Check (" with private");
end if;
when N_Formal_Discrete_Type_Definition =>
Write_Str_With_Col_Check_Sloc ("<>");
when N_Formal_Floating_Point_Definition =>
Write_Str_With_Col_Check_Sloc ("digits <>");
when N_Formal_Modular_Type_Definition =>
Write_Str_With_Col_Check_Sloc ("mod <>");
when N_Formal_Object_Declaration =>
Set_Debug_Sloc;
if Write_Indent_Identifiers (Node) then
Write_Str (" : ");
if In_Present (Node) then
Write_Str_With_Col_Check ("in ");
end if;
if Out_Present (Node) then
Write_Str_With_Col_Check ("out ");
end if;
Sprint_Node (Subtype_Mark (Node));
if Present (Expression (Node)) then
Write_Str (" := ");
Sprint_Node (Expression (Node));
end if;
Write_Char (';');
end if;
when N_Formal_Ordinary_Fixed_Point_Definition =>
Write_Str_With_Col_Check_Sloc ("delta <>");
when N_Formal_Package_Declaration =>
Write_Indent_Str_Sloc ("with package ");
Write_Id (Defining_Identifier (Node));
Write_Str_With_Col_Check (" is new ");
Sprint_Node (Name (Node));
Write_Str_With_Col_Check (" (<>);");
when N_Formal_Private_Type_Definition =>
if Abstract_Present (Node) then
Write_Str_With_Col_Check ("abstract ");
end if;
if Tagged_Present (Node) then
Write_Str_With_Col_Check ("tagged ");
end if;
if Limited_Present (Node) then
Write_Str_With_Col_Check ("limited ");
end if;
Write_Str_With_Col_Check_Sloc ("private");
when N_Formal_Signed_Integer_Type_Definition =>
Write_Str_With_Col_Check_Sloc ("range <>");
when N_Formal_Subprogram_Declaration =>
Write_Indent_Str_Sloc ("with ");
Sprint_Node (Specification (Node));
if Box_Present (Node) then
Write_Str_With_Col_Check (" is <>");
elsif Present (Default_Name (Node)) then
Write_Str_With_Col_Check (" is ");
Sprint_Node (Default_Name (Node));
end if;
Write_Char (';');
when N_Formal_Type_Declaration =>
Write_Indent_Str_Sloc ("type ");
Write_Id (Defining_Identifier (Node));
if Present (Discriminant_Specifications (Node)) then
Write_Discr_Specs (Node);
elsif Unknown_Discriminants_Present (Node) then
Write_Str_With_Col_Check ("(<>)");
end if;
Write_Str_With_Col_Check (" is ");
Sprint_Node (Formal_Type_Definition (Node));
Write_Char (';');
when N_Free_Statement =>
Write_Indent_Str_Sloc ("free ");
Sprint_Node (Expression (Node));
Write_Char (';');
when N_Freeze_Entity =>
if Dump_Original_Only then
null;
elsif Present (Actions (Node)) or else Dump_Freeze_Null then
Write_Indent;
Write_Rewrite_Str ("<<<");
Write_Str_With_Col_Check_Sloc ("freeze ");
Write_Id (Entity (Node));
Write_Str (" [");
if No (Actions (Node)) then
Write_Char (']');
else
Freeze_Indent := Freeze_Indent + 1;
Sprint_Indented_List (Actions (Node));
Freeze_Indent := Freeze_Indent - 1;
Write_Indent_Str ("]");
end if;
Write_Rewrite_Str (">>>");
end if;
when N_Full_Type_Declaration =>
Write_Indent_Str_Sloc ("type ");
Write_Id (Defining_Identifier (Node));
Write_Discr_Specs (Node);
Write_Str_With_Col_Check (" is ");
Sprint_Node (Type_Definition (Node));
Write_Char (';');
when N_Function_Call =>
Set_Debug_Sloc;
Sprint_Node (Name (Node));
Sprint_Opt_Paren_Comma_List (Parameter_Associations (Node));
when N_Function_Instantiation =>
Write_Indent_Str_Sloc ("function ");
Sprint_Node (Defining_Unit_Name (Node));
Write_Str_With_Col_Check (" is new ");
Sprint_Node (Name (Node));
Sprint_Opt_Paren_Comma_List (Generic_Associations (Node));
Write_Char (';');
when N_Function_Specification =>
Write_Str_With_Col_Check_Sloc ("function ");
Sprint_Node (Defining_Unit_Name (Node));
Write_Param_Specs (Node);
Write_Str_With_Col_Check (" return ");
Sprint_Node (Subtype_Mark (Node));
when N_Generic_Association =>
Set_Debug_Sloc;
if Present (Selector_Name (Node)) then
Sprint_Node (Selector_Name (Node));
Write_Str (" => ");
end if;
Sprint_Node (Explicit_Generic_Actual_Parameter (Node));
when N_Generic_Function_Renaming_Declaration =>
Write_Indent_Str_Sloc ("generic function ");
Sprint_Node (Defining_Unit_Name (Node));
Write_Str_With_Col_Check (" renames ");
Sprint_Node (Name (Node));
Write_Char (';');
when N_Generic_Package_Declaration =>
Write_Indent;
Write_Indent_Str_Sloc ("generic ");
Sprint_Indented_List (Generic_Formal_Declarations (Node));
Write_Indent;
Sprint_Node (Specification (Node));
Write_Char (';');
when N_Generic_Package_Renaming_Declaration =>
Write_Indent_Str_Sloc ("generic package ");
Sprint_Node (Defining_Unit_Name (Node));
Write_Str_With_Col_Check (" renames ");
Sprint_Node (Name (Node));
Write_Char (';');
when N_Generic_Procedure_Renaming_Declaration =>
Write_Indent_Str_Sloc ("generic procedure ");
Sprint_Node (Defining_Unit_Name (Node));
Write_Str_With_Col_Check (" renames ");
Sprint_Node (Name (Node));
Write_Char (';');
when N_Generic_Subprogram_Declaration =>
Write_Indent;
Write_Indent_Str_Sloc ("generic ");
Sprint_Indented_List (Generic_Formal_Declarations (Node));
Write_Indent;
Sprint_Node (Specification (Node));
Write_Char (';');
when N_Goto_Statement =>
Write_Indent_Str_Sloc ("goto ");
Sprint_Node (Name (Node));
Write_Char (';');
if Nkind (Next (Node)) = N_Label then
Write_Indent;
end if;
when N_Handled_Sequence_Of_Statements =>
Set_Debug_Sloc;
Sprint_Indented_List (Statements (Node));
if Present (Exception_Handlers (Node)) then
Write_Indent_Str ("exception");
Indent_Begin;
Sprint_Node_List (Exception_Handlers (Node));
Indent_End;
end if;
if Present (At_End_Proc (Node)) then
Write_Indent_Str ("at end");
Indent_Begin;
Write_Indent;
Sprint_Node (At_End_Proc (Node));
Write_Char (';');
Indent_End;
end if;
when N_Identifier =>
Set_Debug_Sloc;
Write_Id (Node);
when N_If_Statement =>
Write_Indent_Str_Sloc ("if ");
Sprint_Node (Condition (Node));
Write_Str_With_Col_Check (" then");
Sprint_Indented_List (Then_Statements (Node));
Sprint_Opt_Node_List (Elsif_Parts (Node));
if Present (Else_Statements (Node)) then
Write_Indent_Str ("else");
Sprint_Indented_List (Else_Statements (Node));
end if;
Write_Indent_Str ("end if;");
when N_Implicit_Label_Declaration =>
if not Dump_Original_Only then
Write_Indent;
Write_Rewrite_Str ("<<<");
Set_Debug_Sloc;
Write_Id (Defining_Identifier (Node));
Write_Str (" : ");
Write_Str_With_Col_Check ("label");
Write_Rewrite_Str (">>>");
end if;
when N_In =>
Sprint_Node (Left_Opnd (Node));
Write_Str_Sloc (" in ");
Sprint_Node (Right_Opnd (Node));
when N_Incomplete_Type_Declaration =>
Write_Indent_Str_Sloc ("type ");
Write_Id (Defining_Identifier (Node));
if Present (Discriminant_Specifications (Node)) then
Write_Discr_Specs (Node);
elsif Unknown_Discriminants_Present (Node) then
Write_Str_With_Col_Check ("(<>)");
end if;
Write_Char (';');
when N_Index_Or_Discriminant_Constraint =>
Set_Debug_Sloc;
Sprint_Paren_Comma_List (Constraints (Node));
when N_Indexed_Component =>
Sprint_Node_Sloc (Prefix (Node));
Sprint_Opt_Paren_Comma_List (Expressions (Node));
when N_Integer_Literal =>
if Print_In_Hex (Node) then
Write_Uint_With_Col_Check_Sloc (Intval (Node), Hex);
else
Write_Uint_With_Col_Check_Sloc (Intval (Node), Auto);
end if;
when N_Iteration_Scheme =>
if Present (Condition (Node)) then
Write_Str_With_Col_Check_Sloc ("while ");
Sprint_Node (Condition (Node));
else
Write_Str_With_Col_Check_Sloc ("for ");
Sprint_Node (Loop_Parameter_Specification (Node));
end if;
Write_Char (' ');
when N_Itype_Reference =>
Write_Indent_Str_Sloc ("reference ");
Write_Id (Itype (Node));
when N_Label =>
Write_Indent_Str_Sloc ("<<");
Write_Id (Identifier (Node));
Write_Str (">>");
when N_Loop_Parameter_Specification =>
Set_Debug_Sloc;
Write_Id (Defining_Identifier (Node));
Write_Str_With_Col_Check (" in ");
if Reverse_Present (Node) then
Write_Str_With_Col_Check ("reverse ");
end if;
Sprint_Node (Discrete_Subtype_Definition (Node));
when N_Loop_Statement =>
Write_Indent;
if Present (Identifier (Node))
and then (not Has_Created_Identifier (Node)
or else not Dump_Original_Only)
then
Write_Rewrite_Str ("<<<");
Write_Id (Identifier (Node));
Write_Str (" : ");
Write_Rewrite_Str (">>>");
Sprint_Node (Iteration_Scheme (Node));
Write_Str_With_Col_Check_Sloc ("loop");
Sprint_Indented_List (Statements (Node));
Write_Indent_Str ("end loop ");
Write_Rewrite_Str ("<<<");
Write_Id (Identifier (Node));
Write_Rewrite_Str (">>>");
Write_Char (';');
else
Sprint_Node (Iteration_Scheme (Node));
Write_Str_With_Col_Check_Sloc ("loop");
Sprint_Indented_List (Statements (Node));
Write_Indent_Str ("end loop;");
end if;
when N_Mod_Clause =>
Sprint_Node_List (Pragmas_Before (Node));
Write_Str_With_Col_Check_Sloc ("at mod ");
Sprint_Node (Expression (Node));
when N_Modular_Type_Definition =>
Write_Str_With_Col_Check_Sloc ("mod ");
Sprint_Node (Expression (Node));
when N_Not_In =>
Sprint_Node (Left_Opnd (Node));
Write_Str_Sloc (" not in ");
Sprint_Node (Right_Opnd (Node));
when N_Null =>
Write_Str_With_Col_Check_Sloc ("null");
when N_Null_Statement =>
if Comes_From_Source (Node)
or else Dump_Freeze_Null
or else not Is_List_Member (Node)
or else (No (Prev (Node)) and then No (Next (Node)))
then
Write_Indent_Str_Sloc ("null;");
end if;
when N_Number_Declaration =>
Set_Debug_Sloc;
if Write_Indent_Identifiers (Node) then
Write_Str_With_Col_Check (" : constant ");
Write_Str (" := ");
Sprint_Node (Expression (Node));
Write_Char (';');
end if;
when N_Object_Declaration =>
-- Put extra blank line before and after if this is a handler
-- record or a subprogram descriptor.
declare
Typ : constant Entity_Id := Etype (Defining_Identifier (Node));
Exc : constant Boolean :=
Is_RTE (Typ, RE_Handler_Record)
or else
Is_RTE (Typ, RE_Subprogram_Descriptor);
begin
if Exc then
Write_Indent;
end if;
Set_Debug_Sloc;
if Write_Indent_Identifiers (Node) then
Write_Str (" : ");
if Aliased_Present (Node) then
Write_Str_With_Col_Check ("aliased ");
end if;
if Constant_Present (Node) then
Write_Str_With_Col_Check ("constant ");
end if;
Sprint_Node (Object_Definition (Node));
if Present (Expression (Node)) then
Write_Str (" := ");
Sprint_Node (Expression (Node));
end if;
Write_Char (';');
end if;
if Exc then
Write_Indent;
end if;
end;
when N_Object_Renaming_Declaration =>
Write_Indent;
Set_Debug_Sloc;
Sprint_Node (Defining_Identifier (Node));
Write_Str (" : ");
Sprint_Node (Subtype_Mark (Node));
Write_Str_With_Col_Check (" renames ");
Sprint_Node (Name (Node));
Write_Char (';');
when N_Op_Abs =>
Write_Operator (Node, "abs ");
Sprint_Node (Right_Opnd (Node));
when N_Op_Add =>
Sprint_Node (Left_Opnd (Node));
Write_Operator (Node, " + ");
Sprint_Node (Right_Opnd (Node));
when N_Op_And =>
Sprint_Node (Left_Opnd (Node));
Write_Operator (Node, " and ");
Sprint_Node (Right_Opnd (Node));
when N_Op_Concat =>
Sprint_Node (Left_Opnd (Node));
Write_Operator (Node, " & ");
Sprint_Node (Right_Opnd (Node));
when N_Op_Divide =>
Sprint_Node (Left_Opnd (Node));
Write_Char (' ');
Process_TFAI_RR_Flags (Node);
Write_Operator (Node, "/ ");
Sprint_Node (Right_Opnd (Node));
when N_Op_Eq =>
Sprint_Node (Left_Opnd (Node));
Write_Operator (Node, " = ");
Sprint_Node (Right_Opnd (Node));
when N_Op_Expon =>
Sprint_Node (Left_Opnd (Node));
Write_Operator (Node, " ** ");
Sprint_Node (Right_Opnd (Node));
when N_Op_Ge =>
Sprint_Node (Left_Opnd (Node));
Write_Operator (Node, " >= ");
Sprint_Node (Right_Opnd (Node));
when N_Op_Gt =>
Sprint_Node (Left_Opnd (Node));
Write_Operator (Node, " > ");
Sprint_Node (Right_Opnd (Node));
when N_Op_Le =>
Sprint_Node (Left_Opnd (Node));
Write_Operator (Node, " <= ");
Sprint_Node (Right_Opnd (Node));
when N_Op_Lt =>
Sprint_Node (Left_Opnd (Node));
Write_Operator (Node, " < ");
Sprint_Node (Right_Opnd (Node));
when N_Op_Minus =>
Write_Operator (Node, "-");
Sprint_Node (Right_Opnd (Node));
when N_Op_Mod =>
Sprint_Node (Left_Opnd (Node));
if Treat_Fixed_As_Integer (Node) then
Write_Str (" #");
end if;
Write_Operator (Node, " mod ");
Sprint_Node (Right_Opnd (Node));
when N_Op_Multiply =>
Sprint_Node (Left_Opnd (Node));
Write_Char (' ');
Process_TFAI_RR_Flags (Node);
Write_Operator (Node, "* ");
Sprint_Node (Right_Opnd (Node));
when N_Op_Ne =>
Sprint_Node (Left_Opnd (Node));
Write_Operator (Node, " /= ");
Sprint_Node (Right_Opnd (Node));
when N_Op_Not =>
Write_Operator (Node, "not ");
Sprint_Node (Right_Opnd (Node));
when N_Op_Or =>
Sprint_Node (Left_Opnd (Node));
Write_Operator (Node, " or ");
Sprint_Node (Right_Opnd (Node));
when N_Op_Plus =>
Write_Operator (Node, "+");
Sprint_Node (Right_Opnd (Node));
when N_Op_Rem =>
Sprint_Node (Left_Opnd (Node));
if Treat_Fixed_As_Integer (Node) then
Write_Str (" #");
end if;
Write_Operator (Node, " rem ");
Sprint_Node (Right_Opnd (Node));
when N_Op_Shift =>
Set_Debug_Sloc;
Write_Id (Node);
Write_Char ('!');
Write_Str_With_Col_Check ("(");
Sprint_Node (Left_Opnd (Node));
Write_Str (", ");
Sprint_Node (Right_Opnd (Node));
Write_Char (')');
when N_Op_Subtract =>
Sprint_Node (Left_Opnd (Node));
Write_Operator (Node, " - ");
Sprint_Node (Right_Opnd (Node));
when N_Op_Xor =>
Sprint_Node (Left_Opnd (Node));
Write_Operator (Node, " xor ");
Sprint_Node (Right_Opnd (Node));
when N_Operator_Symbol =>
Write_Name_With_Col_Check_Sloc (Chars (Node));
when N_Ordinary_Fixed_Point_Definition =>
Write_Str_With_Col_Check_Sloc ("delta ");
Sprint_Node (Delta_Expression (Node));
Sprint_Opt_Node (Real_Range_Specification (Node));
when N_Or_Else =>
Sprint_Node (Left_Opnd (Node));
Write_Str_Sloc (" or else ");
Sprint_Node (Right_Opnd (Node));
when N_Others_Choice =>
if All_Others (Node) then
Write_Str_With_Col_Check ("all ");
end if;
Write_Str_With_Col_Check_Sloc ("others");
when N_Package_Body =>
Write_Indent;
Write_Indent_Str_Sloc ("package body ");
Sprint_Node (Defining_Unit_Name (Node));
Write_Str (" is");
Sprint_Indented_List (Declarations (Node));
if Present (Handled_Statement_Sequence (Node)) then
Write_Indent_Str ("begin");
Sprint_Node (Handled_Statement_Sequence (Node));
end if;
Write_Indent_Str ("end ");
Sprint_Node (Defining_Unit_Name (Node));
Write_Char (';');
when N_Package_Body_Stub =>
Write_Indent_Str_Sloc ("package body ");
Sprint_Node (Defining_Identifier (Node));
Write_Str_With_Col_Check (" is separate;");
when N_Package_Declaration =>
Write_Indent;
Write_Indent;
Sprint_Node_Sloc (Specification (Node));
Write_Char (';');
when N_Package_Instantiation =>
Write_Indent;
Write_Indent_Str_Sloc ("package ");
Sprint_Node (Defining_Unit_Name (Node));
Write_Str (" is new ");
Sprint_Node (Name (Node));
Sprint_Opt_Paren_Comma_List (Generic_Associations (Node));
Write_Char (';');
when N_Package_Renaming_Declaration =>
Write_Indent_Str_Sloc ("package ");
Sprint_Node (Defining_Unit_Name (Node));
Write_Str_With_Col_Check (" renames ");
Sprint_Node (Name (Node));
Write_Char (';');
when N_Package_Specification =>
Write_Str_With_Col_Check_Sloc ("package ");
Sprint_Node (Defining_Unit_Name (Node));
Write_Str (" is");
Sprint_Indented_List (Visible_Declarations (Node));
if Present (Private_Declarations (Node)) then
Write_Indent_Str ("private");
Sprint_Indented_List (Private_Declarations (Node));
end if;
Write_Indent_Str ("end ");
Sprint_Node (Defining_Unit_Name (Node));
when N_Parameter_Association =>
Sprint_Node_Sloc (Selector_Name (Node));
Write_Str (" => ");
Sprint_Node (Explicit_Actual_Parameter (Node));
when N_Parameter_Specification =>
Set_Debug_Sloc;
if Write_Identifiers (Node) then
Write_Str (" : ");
if In_Present (Node) then
Write_Str_With_Col_Check ("in ");
end if;
if Out_Present (Node) then
Write_Str_With_Col_Check ("out ");
end if;
Sprint_Node (Parameter_Type (Node));
if Present (Expression (Node)) then
Write_Str (" := ");
Sprint_Node (Expression (Node));
end if;
else
Write_Str (", ");
end if;
when N_Pragma =>
Write_Indent_Str_Sloc ("pragma ");
Write_Name_With_Col_Check (Chars (Node));
if Present (Pragma_Argument_Associations (Node)) then
Sprint_Opt_Paren_Comma_List
(Pragma_Argument_Associations (Node));
end if;
Write_Char (';');
when N_Pragma_Argument_Association =>
Set_Debug_Sloc;
if Chars (Node) /= No_Name then
Write_Name_With_Col_Check (Chars (Node));
Write_Str (" => ");
end if;
Sprint_Node (Expression (Node));
when N_Private_Type_Declaration =>
Write_Indent_Str_Sloc ("type ");
Write_Id (Defining_Identifier (Node));
if Present (Discriminant_Specifications (Node)) then
Write_Discr_Specs (Node);
elsif Unknown_Discriminants_Present (Node) then
Write_Str_With_Col_Check ("(<>)");
end if;
Write_Str (" is ");
if Tagged_Present (Node) then
Write_Str_With_Col_Check ("tagged ");
end if;
if Limited_Present (Node) then
Write_Str_With_Col_Check ("limited ");
end if;
Write_Str_With_Col_Check ("private;");
when N_Private_Extension_Declaration =>
Write_Indent_Str_Sloc ("type ");
Write_Id (Defining_Identifier (Node));
if Present (Discriminant_Specifications (Node)) then
Write_Discr_Specs (Node);
elsif Unknown_Discriminants_Present (Node) then
Write_Str_With_Col_Check ("(<>)");
end if;
Write_Str_With_Col_Check (" is new ");
Sprint_Node (Subtype_Indication (Node));
Write_Str_With_Col_Check (" with private;");
when N_Procedure_Call_Statement =>
Write_Indent;
Set_Debug_Sloc;
Sprint_Node (Name (Node));
Sprint_Opt_Paren_Comma_List (Parameter_Associations (Node));
Write_Char (';');
when N_Procedure_Instantiation =>
Write_Indent_Str_Sloc ("procedure ");
Sprint_Node (Defining_Unit_Name (Node));
Write_Str_With_Col_Check (" is new ");
Sprint_Node (Name (Node));
Sprint_Opt_Paren_Comma_List (Generic_Associations (Node));
Write_Char (';');
when N_Procedure_Specification =>
Write_Str_With_Col_Check_Sloc ("procedure ");
Sprint_Node (Defining_Unit_Name (Node));
Write_Param_Specs (Node);
when N_Protected_Body =>
Write_Indent_Str_Sloc ("protected body ");
Write_Id (Defining_Identifier (Node));
Write_Str (" is");
Sprint_Indented_List (Declarations (Node));
Write_Indent_Str ("end ");
Write_Id (Defining_Identifier (Node));
Write_Char (';');
when N_Protected_Body_Stub =>
Write_Indent_Str_Sloc ("protected body ");
Write_Id (Defining_Identifier (Node));
Write_Str_With_Col_Check (" is separate;");
when N_Protected_Definition =>
Set_Debug_Sloc;
Sprint_Indented_List (Visible_Declarations (Node));
if Present (Private_Declarations (Node)) then
Write_Indent_Str ("private");
Sprint_Indented_List (Private_Declarations (Node));
end if;
Write_Indent_Str ("end ");
when N_Protected_Type_Declaration =>
Write_Indent_Str_Sloc ("protected type ");
Write_Id (Defining_Identifier (Node));
Write_Discr_Specs (Node);
Write_Str (" is");
Sprint_Node (Protected_Definition (Node));
Write_Id (Defining_Identifier (Node));
Write_Char (';');
when N_Qualified_Expression =>
Sprint_Node (Subtype_Mark (Node));
Write_Char_Sloc (''');
Sprint_Node (Expression (Node));
when N_Raise_Constraint_Error =>
-- This node can be used either as a subexpression or as a
-- statement form. The following test is a reasonably reliable
-- way to distinguish the two cases.
if Is_List_Member (Node)
and then Nkind (Parent (Node)) not in N_Subexpr
then
Write_Indent;
end if;
Write_Str_With_Col_Check_Sloc ("[constraint_error");
if Present (Condition (Node)) then
Write_Str_With_Col_Check (" when ");
Sprint_Node (Condition (Node));
end if;
Write_Char (']');
when N_Raise_Program_Error =>
Write_Indent;
Write_Str_With_Col_Check_Sloc ("[program_error");
if Present (Condition (Node)) then
Write_Str_With_Col_Check (" when ");
Sprint_Node (Condition (Node));
end if;
Write_Char (']');
when N_Raise_Storage_Error =>
Write_Indent;
Write_Str_With_Col_Check_Sloc ("[storage_error");
if Present (Condition (Node)) then
Write_Str_With_Col_Check (" when ");
Sprint_Node (Condition (Node));
end if;
Write_Char (']');
when N_Raise_Statement =>
Write_Indent_Str_Sloc ("raise ");
Sprint_Node (Name (Node));
Write_Char (';');
when N_Range =>
Sprint_Node (Low_Bound (Node));
Write_Str_Sloc (" .. ");
Sprint_Node (High_Bound (Node));
when N_Range_Constraint =>
Write_Str_With_Col_Check_Sloc ("range ");
Sprint_Node (Range_Expression (Node));
when N_Real_Literal =>
Write_Ureal_With_Col_Check_Sloc (Realval (Node));
when N_Real_Range_Specification =>
Write_Str_With_Col_Check_Sloc ("range ");
Sprint_Node (Low_Bound (Node));
Write_Str (" .. ");
Sprint_Node (High_Bound (Node));
when N_Record_Definition =>
if Abstract_Present (Node) then
Write_Str_With_Col_Check ("abstract ");
end if;
if Tagged_Present (Node) then
Write_Str_With_Col_Check ("tagged ");
end if;
if Limited_Present (Node) then
Write_Str_With_Col_Check ("limited ");
end if;
if Null_Present (Node) then
Write_Str_With_Col_Check_Sloc ("null record");
else
Write_Str_With_Col_Check_Sloc ("record");
Sprint_Node (Component_List (Node));
Write_Indent_Str ("end record");
end if;
when N_Record_Representation_Clause =>
Write_Indent_Str_Sloc ("for ");
Sprint_Node (Identifier (Node));
Write_Str_With_Col_Check (" use record ");
if Present (Mod_Clause (Node)) then
Sprint_Node (Mod_Clause (Node));
end if;
Sprint_Indented_List (Component_Clauses (Node));
Write_Indent_Str ("end record;");
when N_Reference =>
Sprint_Node (Prefix (Node));
Write_Str_With_Col_Check_Sloc ("'reference");
when N_Requeue_Statement =>
Write_Indent_Str_Sloc ("requeue ");
Sprint_Node (Name (Node));
if Abort_Present (Node) then
Write_Str_With_Col_Check (" with abort");
end if;
Write_Char (';');
when N_Return_Statement =>
if Present (Expression (Node)) then
Write_Indent_Str_Sloc ("return ");
Sprint_Node (Expression (Node));
Write_Char (';');
else
Write_Indent_Str_Sloc ("return;");
end if;
when N_Selective_Accept =>
Write_Indent_Str_Sloc ("select");
declare
Alt_Node : Node_Id;
begin
Alt_Node := First (Select_Alternatives (Node));
loop
Indent_Begin;
Sprint_Node (Alt_Node);
Indent_End;
Next (Alt_Node);
exit when No (Alt_Node);
Write_Indent_Str ("or");
end loop;
end;
if Present (Else_Statements (Node)) then
Write_Indent_Str ("else");
Sprint_Indented_List (Else_Statements (Node));
end if;
Write_Indent_Str ("end select;");
when N_Signed_Integer_Type_Definition =>
Write_Str_With_Col_Check_Sloc ("range ");
Sprint_Node (Low_Bound (Node));
Write_Str (" .. ");
Sprint_Node (High_Bound (Node));
when N_Single_Protected_Declaration =>
Write_Indent_Str_Sloc ("protected ");
Write_Id (Defining_Identifier (Node));
Write_Str (" is");
Sprint_Node (Protected_Definition (Node));
Write_Id (Defining_Identifier (Node));
Write_Char (';');
when N_Single_Task_Declaration =>
Write_Indent_Str_Sloc ("task ");
Write_Id (Defining_Identifier (Node));
if Present (Task_Definition (Node)) then
Write_Str (" is");
Sprint_Node (Task_Definition (Node));
Write_Id (Defining_Identifier (Node));
end if;
Write_Char (';');
when N_Selected_Component | N_Expanded_Name =>
Sprint_Node (Prefix (Node));
Write_Char_Sloc ('.');
Sprint_Node (Selector_Name (Node));
when N_Slice =>
Set_Debug_Sloc;
Sprint_Node (Prefix (Node));
Write_Str_With_Col_Check (" (");
Sprint_Node (Discrete_Range (Node));
Write_Char (')');
when N_String_Literal =>
if String_Length (Strval (Node)) + Column > 75 then
Write_Indent_Str (" ");
end if;
Set_Debug_Sloc;
Write_String_Table_Entry (Strval (Node));
when N_Subprogram_Body =>
if Freeze_Indent = 0 then
Write_Indent;
end if;
Write_Indent;
Sprint_Node_Sloc (Specification (Node));
Write_Str (" is");
Sprint_Indented_List (Declarations (Node));
Write_Indent_Str ("begin");
Sprint_Node (Handled_Statement_Sequence (Node));
Write_Indent_Str ("end ");
Sprint_Node (Defining_Unit_Name (Specification (Node)));
Write_Char (';');
if Is_List_Member (Node)
and then Present (Next (Node))
and then Nkind (Next (Node)) /= N_Subprogram_Body
then
Write_Indent;
end if;
when N_Subprogram_Body_Stub =>
Write_Indent;
Sprint_Node_Sloc (Specification (Node));
Write_Str_With_Col_Check (" is separate;");
when N_Subprogram_Declaration =>
Write_Indent;
Sprint_Node_Sloc (Specification (Node));
Write_Char (';');
when N_Subprogram_Info =>
Sprint_Node (Identifier (Node));
Write_Str_With_Col_Check_Sloc ("'subprogram_info");
when N_Subprogram_Renaming_Declaration =>
Write_Indent;
Sprint_Node (Specification (Node));
Write_Str_With_Col_Check_Sloc (" renames ");
Sprint_Node (Name (Node));
Write_Char (';');
when N_Subtype_Declaration =>
Write_Indent_Str_Sloc ("subtype ");
Write_Id (Defining_Identifier (Node));
Write_Str (" is ");
Sprint_Node (Subtype_Indication (Node));
Write_Char (';');
when N_Subtype_Indication =>
Sprint_Node_Sloc (Subtype_Mark (Node));
Write_Char (' ');
Sprint_Node (Constraint (Node));
when N_Subunit =>
Write_Indent_Str_Sloc ("separate (");
Sprint_Node (Name (Node));
Write_Char (')');
Print_Eol;
Sprint_Node (Proper_Body (Node));
when N_Task_Body =>
Write_Indent_Str_Sloc ("task body ");
Write_Id (Defining_Identifier (Node));
Write_Str (" is");
Sprint_Indented_List (Declarations (Node));
Write_Indent_Str ("begin");
Sprint_Node (Handled_Statement_Sequence (Node));
Write_Indent_Str ("end ");
Write_Id (Defining_Identifier (Node));
Write_Char (';');
when N_Task_Body_Stub =>
Write_Indent_Str_Sloc ("task body ");
Write_Id (Defining_Identifier (Node));
Write_Str_With_Col_Check (" is separate;");
when N_Task_Definition =>
Set_Debug_Sloc;
Sprint_Indented_List (Visible_Declarations (Node));
if Present (Private_Declarations (Node)) then
Write_Indent_Str ("private");
Sprint_Indented_List (Private_Declarations (Node));
end if;
Write_Indent_Str ("end ");
when N_Task_Type_Declaration =>
Write_Indent_Str_Sloc ("task type ");
Write_Id (Defining_Identifier (Node));
Write_Discr_Specs (Node);
if Present (Task_Definition (Node)) then
Write_Str (" is");
Sprint_Node (Task_Definition (Node));
Write_Id (Defining_Identifier (Node));
end if;
Write_Char (';');
when N_Terminate_Alternative =>
Sprint_Node_List (Pragmas_Before (Node));
Write_Indent;
if Present (Condition (Node)) then
Write_Str_With_Col_Check ("when ");
Sprint_Node (Condition (Node));
Write_Str (" => ");
end if;
Write_Str_With_Col_Check_Sloc ("terminate;");
Sprint_Node_List (Pragmas_After (Node));
when N_Timed_Entry_Call =>
Write_Indent_Str_Sloc ("select");
Indent_Begin;
Sprint_Node (Entry_Call_Alternative (Node));
Indent_End;
Write_Indent_Str ("or");
Indent_Begin;
Sprint_Node (Delay_Alternative (Node));
Indent_End;
Write_Indent_Str ("end select;");
when N_Triggering_Alternative =>
Sprint_Node_List (Pragmas_Before (Node));
Sprint_Node_Sloc (Triggering_Statement (Node));
Sprint_Node_List (Statements (Node));
when N_Type_Conversion =>
Set_Debug_Sloc;
Sprint_Node (Subtype_Mark (Node));
Col_Check (4);
if Conversion_OK (Node) then
Write_Char ('?');
end if;
if Float_Truncate (Node) then
Write_Char ('^');
end if;
if Rounded_Result (Node) then
Write_Char ('@');
end if;
Write_Char ('(');
Sprint_Node (Expression (Node));
Write_Char (')');
when N_Unchecked_Expression =>
Col_Check (10);
Write_Str ("`(");
Sprint_Node_Sloc (Expression (Node));
Write_Char (')');
when N_Unchecked_Type_Conversion =>
Sprint_Node (Subtype_Mark (Node));
Write_Char ('!');
Write_Str_With_Col_Check ("(");
Sprint_Node_Sloc (Expression (Node));
Write_Char (')');
when N_Unconstrained_Array_Definition =>
Write_Str_With_Col_Check_Sloc ("array (");
declare
Node1 : Node_Id;
begin
Node1 := First (Subtype_Marks (Node));
loop
Sprint_Node (Node1);
Write_Str_With_Col_Check (" range <>");
Next (Node1);
exit when Node1 = Empty;
Write_Str (", ");
end loop;
end;
Write_Str (") of ");
if Aliased_Present (Node) then
Write_Str_With_Col_Check ("aliased ");
end if;
Sprint_Node (Subtype_Indication (Node));
when N_Unused_At_Start | N_Unused_At_End =>
Write_Indent_Str ("***** Error, unused node encountered *****");
Print_Eol;
when N_Use_Package_Clause =>
Write_Indent_Str_Sloc ("use ");
Sprint_Comma_List (Names (Node));
Write_Char (';');
when N_Use_Type_Clause =>
Write_Indent_Str_Sloc ("use type ");
Sprint_Comma_List (Subtype_Marks (Node));
Write_Char (';');
when N_Validate_Unchecked_Conversion =>
Write_Indent_Str_Sloc ("validate unchecked_conversion (");
Sprint_Node (Source_Type (Node));
Write_Str (", ");
Sprint_Node (Target_Type (Node));
Write_Str (");");
when N_Variant =>
Write_Indent_Str_Sloc ("when ");
Sprint_Bar_List (Discrete_Choices (Node));
Write_Str (" => ");
Sprint_Node (Component_List (Node));
when N_Variant_Part =>
Indent_Begin;
Write_Indent_Str_Sloc ("case ");
Sprint_Node (Name (Node));
Write_Str (" is ");
Sprint_Indented_List (Variants (Node));
Write_Indent_Str ("end case");
Indent_End;
when N_With_Clause =>
-- Special test, if we are dumping the original tree only,
-- then we want to eliminate the bogus with clauses that
-- correspond to the non-existent children of Text_IO.
if Dump_Original_Only
and then Is_Text_IO_Kludge_Unit (Name (Node))
then
null;
-- Normal case, output the with clause
else
if First_Name (Node) or else not Dump_Original_Only then
Write_Indent_Str ("with ");
else
Write_Str (", ");
end if;
Sprint_Node_Sloc (Name (Node));
if Last_Name (Node) or else not Dump_Original_Only then
Write_Char (';');
end if;
end if;
when N_With_Type_Clause =>
Write_Indent_Str ("with type ");
Sprint_Node_Sloc (Name (Node));
if Tagged_Present (Node) then
Write_Str (" is tagged;");
else
Write_Str (" is access;");
end if;
end case;
if Nkind (Node) in N_Subexpr
and then Do_Range_Check (Node)
then
Write_Str ("}");
end if;
for J in 1 .. Paren_Count (Node) loop
Write_Char (')');
end loop;
pragma Assert (No (Debug_Node));
Debug_Node := Save_Debug_Node;
end Sprint_Node_Actual;
----------------------
-- Sprint_Node_List --
----------------------
procedure Sprint_Node_List (List : List_Id) is
Node : Node_Id;
begin
if Is_Non_Empty_List (List) then
Node := First (List);
loop
Sprint_Node (Node);
Next (Node);
exit when Node = Empty;
end loop;
end if;
end Sprint_Node_List;
----------------------
-- Sprint_Node_Sloc --
----------------------
procedure Sprint_Node_Sloc (Node : Node_Id) is
begin
Sprint_Node (Node);
if Present (Debug_Node) then
Set_Sloc (Debug_Node, Sloc (Node));
Debug_Node := Empty;
end if;
end Sprint_Node_Sloc;
---------------------
-- Sprint_Opt_Node --
---------------------
procedure Sprint_Opt_Node (Node : Node_Id) is
begin
if Present (Node) then
Write_Char (' ');
Sprint_Node (Node);
end if;
end Sprint_Opt_Node;
--------------------------
-- Sprint_Opt_Node_List --
--------------------------
procedure Sprint_Opt_Node_List (List : List_Id) is
begin
if Present (List) then
Sprint_Node_List (List);
end if;
end Sprint_Opt_Node_List;
---------------------------------
-- Sprint_Opt_Paren_Comma_List --
---------------------------------
procedure Sprint_Opt_Paren_Comma_List (List : List_Id) is
begin
if Is_Non_Empty_List (List) then
Write_Char (' ');
Sprint_Paren_Comma_List (List);
end if;
end Sprint_Opt_Paren_Comma_List;
-----------------------------
-- Sprint_Paren_Comma_List --
-----------------------------
procedure Sprint_Paren_Comma_List (List : List_Id) is
N : Node_Id;
Node_Exists : Boolean := False;
begin
if Is_Non_Empty_List (List) then
if Dump_Original_Only then
N := First (List);
while Present (N) loop
if not Is_Rewrite_Insertion (N) then
Node_Exists := True;
exit;
end if;
Next (N);
end loop;
if not Node_Exists then
return;
end if;
end if;
Write_Str_With_Col_Check ("(");
Sprint_Comma_List (List);
Write_Char (')');
end if;
end Sprint_Paren_Comma_List;
---------------------
-- Write_Char_Sloc --
---------------------
procedure Write_Char_Sloc (C : Character) is
begin
if Debug_Generated_Code and then C /= ' ' then
Set_Debug_Sloc;
end if;
Write_Char (C);
end Write_Char_Sloc;
------------------------
-- Write_Discr_Specs --
------------------------
procedure Write_Discr_Specs (N : Node_Id) is
Specs : List_Id;
Spec : Node_Id;
begin
Specs := Discriminant_Specifications (N);
if Present (Specs) then
Write_Str_With_Col_Check (" (");
Spec := First (Specs);
loop
Sprint_Node (Spec);
Next (Spec);
exit when Spec = Empty;
-- Add semicolon, unless we are printing original tree and the
-- next specification is part of a list (but not the first
-- element of that list)
if not Dump_Original_Only or else not Prev_Ids (Spec) then
Write_Str ("; ");
end if;
end loop;
Write_Char (')');
end if;
end Write_Discr_Specs;
-----------------
-- Write_Ekind --
-----------------
procedure Write_Ekind (E : Entity_Id) is
S : constant String := Entity_Kind'Image (Ekind (E));
begin
Name_Len := S'Length;
Name_Buffer (1 .. Name_Len) := S;
Set_Casing (Mixed_Case);
Write_Str_With_Col_Check (Name_Buffer (1 .. Name_Len));
end Write_Ekind;
--------------
-- Write_Id --
--------------
procedure Write_Id (N : Node_Id) is
begin
-- Case of a defining identifier
if Nkind (N) = N_Defining_Identifier then
-- If defining identifier has an interface name (and no
-- address clause), then we output the interface name.
if (Is_Imported (N) or else Is_Exported (N))
and then Present (Interface_Name (N))
and then No (Address_Clause (N))
then
String_To_Name_Buffer (Strval (Interface_Name (N)));
Write_Str_With_Col_Check (Name_Buffer (1 .. Name_Len));
-- If no interface name (or inactive because there was
-- an address clause), then just output the Chars name.
else
Write_Name_With_Col_Check (Chars (N));
end if;
-- Case of selector of an expanded name where the expanded name
-- has an associated entity, output this entity.
elsif Nkind (Parent (N)) = N_Expanded_Name
and then Selector_Name (Parent (N)) = N
and then Present (Entity (Parent (N)))
then
Write_Id (Entity (Parent (N)));
-- For any other kind of node with an associated entity, output it.
elsif Nkind (N) in N_Has_Entity
and then Present (Entity (N))
then
Write_Id (Entity (N));
-- All other cases, we just print the Chars field
else
Write_Name_With_Col_Check (Chars (N));
end if;
end Write_Id;
-----------------------
-- Write_Identifiers --
-----------------------
function Write_Identifiers (Node : Node_Id) return Boolean is
begin
Sprint_Node (Defining_Identifier (Node));
-- The remainder of the declaration must be printed unless we are
-- printing the original tree and this is not the last identifier
return
not Dump_Original_Only or else not More_Ids (Node);
end Write_Identifiers;
------------------------
-- Write_Implicit_Def --
------------------------
procedure Write_Implicit_Def (E : Entity_Id) is
Ind : Node_Id;
begin
case Ekind (E) is
when E_Array_Subtype =>
Write_Str_With_Col_Check ("subtype ");
Write_Id (E);
Write_Str_With_Col_Check (" is ");
Write_Id (Base_Type (E));
Write_Str_With_Col_Check (" (");
Ind := First_Index (E);
while Present (Ind) loop
Sprint_Node (Ind);
Next_Index (Ind);
if Present (Ind) then
Write_Str (", ");
end if;
end loop;
Write_Str (");");
when E_Signed_Integer_Subtype | E_Enumeration_Subtype =>
Write_Str_With_Col_Check ("subtype ");
Write_Id (E);
Write_Str (" is ");
Write_Id (Etype (E));
Write_Str_With_Col_Check (" range ");
Sprint_Node (Scalar_Range (E));
Write_Str (";");
when others =>
Write_Str_With_Col_Check ("type ");
Write_Id (E);
Write_Str_With_Col_Check (" is <");
Write_Ekind (E);
Write_Str (">;");
end case;
end Write_Implicit_Def;
------------------
-- Write_Indent --
------------------
procedure Write_Indent is
begin
if Indent_Annull_Flag then
Indent_Annull_Flag := False;
else
Print_Eol;
for J in 1 .. Indent loop
Write_Char (' ');
end loop;
end if;
end Write_Indent;
------------------------------
-- Write_Indent_Identifiers --
------------------------------
function Write_Indent_Identifiers (Node : Node_Id) return Boolean is
begin
-- We need to start a new line for every node, except in the case
-- where we are printing the original tree and this is not the first
-- defining identifier in the list.
if not Dump_Original_Only or else not Prev_Ids (Node) then
Write_Indent;
-- If printing original tree and this is not the first defining
-- identifier in the list, then the previous call to this procedure
-- printed only the name, and we add a comma to separate the names.
else
Write_Str (", ");
end if;
Sprint_Node (Defining_Identifier (Node));
-- The remainder of the declaration must be printed unless we are
-- printing the original tree and this is not the last identifier
return
not Dump_Original_Only or else not More_Ids (Node);
end Write_Indent_Identifiers;
-----------------------------------
-- Write_Indent_Identifiers_Sloc --
-----------------------------------
function Write_Indent_Identifiers_Sloc (Node : Node_Id) return Boolean is
begin
-- We need to start a new line for every node, except in the case
-- where we are printing the original tree and this is not the first
-- defining identifier in the list.
if not Dump_Original_Only or else not Prev_Ids (Node) then
Write_Indent;
-- If printing original tree and this is not the first defining
-- identifier in the list, then the previous call to this procedure
-- printed only the name, and we add a comma to separate the names.
else
Write_Str (", ");
end if;
Set_Debug_Sloc;
Sprint_Node (Defining_Identifier (Node));
-- The remainder of the declaration must be printed unless we are
-- printing the original tree and this is not the last identifier
return
not Dump_Original_Only or else not More_Ids (Node);
end Write_Indent_Identifiers_Sloc;
----------------------
-- Write_Indent_Str --
----------------------
procedure Write_Indent_Str (S : String) is
begin
Write_Indent;
Write_Str (S);
end Write_Indent_Str;
---------------------------
-- Write_Indent_Str_Sloc --
---------------------------
procedure Write_Indent_Str_Sloc (S : String) is
begin
Write_Indent;
Write_Str_Sloc (S);
end Write_Indent_Str_Sloc;
-------------------------------
-- Write_Name_With_Col_Check --
-------------------------------
procedure Write_Name_With_Col_Check (N : Name_Id) is
J : Natural;
begin
Get_Name_String (N);
-- Deal with -gnatI which replaces digits in an internal
-- name by three dots (e.g. R7b becomes R...b).
if Debug_Flag_II and then Name_Buffer (1) in 'A' .. 'Z' then
J := 2;
while J < Name_Len loop
exit when Name_Buffer (J) not in 'A' .. 'Z';
J := J + 1;
end loop;
if Name_Buffer (J) in '0' .. '9' then
Write_Str_With_Col_Check (Name_Buffer (1 .. J - 1));
Write_Str ("...");
while J <= Name_Len loop
if Name_Buffer (J) not in '0' .. '9' then
Write_Str (Name_Buffer (J .. Name_Len));
exit;
else
J := J + 1;
end if;
end loop;
return;
end if;
end if;
-- Fall through for normal case
Write_Str_With_Col_Check (Name_Buffer (1 .. Name_Len));
end Write_Name_With_Col_Check;
------------------------------------
-- Write_Name_With_Col_Check_Sloc --
------------------------------------
procedure Write_Name_With_Col_Check_Sloc (N : Name_Id) is
begin
Get_Name_String (N);
Write_Str_With_Col_Check_Sloc (Name_Buffer (1 .. Name_Len));
end Write_Name_With_Col_Check_Sloc;
--------------------
-- Write_Operator --
--------------------
procedure Write_Operator (N : Node_Id; S : String) is
F : Natural := S'First;
T : Natural := S'Last;
begin
if S (F) = ' ' then
Write_Char (' ');
F := F + 1;
end if;
if S (T) = ' ' then
T := T - 1;
end if;
if Do_Overflow_Check (N) then
Write_Char ('{');
Write_Str_Sloc (S (F .. T));
Write_Char ('}');
else
Write_Str_Sloc (S);
end if;
if S (S'Last) = ' ' then
Write_Char (' ');
end if;
end Write_Operator;
-----------------------
-- Write_Param_Specs --
-----------------------
procedure Write_Param_Specs (N : Node_Id) is
Specs : List_Id;
Spec : Node_Id;
Formal : Node_Id;
begin
Specs := Parameter_Specifications (N);
if Is_Non_Empty_List (Specs) then
Write_Str_With_Col_Check (" (");
Spec := First (Specs);
loop
Sprint_Node (Spec);
Formal := Defining_Identifier (Spec);
Next (Spec);
exit when Spec = Empty;
-- Add semicolon, unless we are printing original tree and the
-- next specification is part of a list (but not the first
-- element of that list)
if not Dump_Original_Only or else not Prev_Ids (Spec) then
Write_Str ("; ");
end if;
end loop;
-- Write out any extra formals
while Present (Extra_Formal (Formal)) loop
Formal := Extra_Formal (Formal);
Write_Str ("; ");
Write_Name_With_Col_Check (Chars (Formal));
Write_Str (" : ");
Write_Name_With_Col_Check (Chars (Etype (Formal)));
end loop;
Write_Char (')');
end if;
end Write_Param_Specs;
--------------------------
-- Write_Rewrite_Str --
--------------------------
procedure Write_Rewrite_Str (S : String) is
begin
if not Dump_Generated_Only then
if S'Length = 3 and then S = ">>>" then
Write_Str (">>>");
else
Write_Str_With_Col_Check (S);
end if;
end if;
end Write_Rewrite_Str;
--------------------
-- Write_Str_Sloc --
--------------------
procedure Write_Str_Sloc (S : String) is
begin
for J in S'Range loop
Write_Char_Sloc (S (J));
end loop;
end Write_Str_Sloc;
------------------------------
-- Write_Str_With_Col_Check --
------------------------------
procedure Write_Str_With_Col_Check (S : String) is
begin
if Int (S'Last) + Column > Line_Limit then
Write_Indent_Str (" ");
if S (1) = ' ' then
Write_Str (S (2 .. S'Length));
else
Write_Str (S);
end if;
else
Write_Str (S);
end if;
end Write_Str_With_Col_Check;
-----------------------------------
-- Write_Str_With_Col_Check_Sloc --
-----------------------------------
procedure Write_Str_With_Col_Check_Sloc (S : String) is
begin
if Int (S'Last) + Column > Line_Limit then
Write_Indent_Str (" ");
if S (1) = ' ' then
Write_Str_Sloc (S (2 .. S'Length));
else
Write_Str_Sloc (S);
end if;
else
Write_Str_Sloc (S);
end if;
end Write_Str_With_Col_Check_Sloc;
------------------------------------
-- Write_Uint_With_Col_Check_Sloc --
------------------------------------
procedure Write_Uint_With_Col_Check_Sloc (U : Uint; Format : UI_Format) is
begin
Col_Check (UI_Decimal_Digits_Hi (U));
Set_Debug_Sloc;
UI_Write (U, Format);
end Write_Uint_With_Col_Check_Sloc;
-------------------------------------
-- Write_Ureal_With_Col_Check_Sloc --
-------------------------------------
procedure Write_Ureal_With_Col_Check_Sloc (U : Ureal) is
D : constant Uint := Denominator (U);
N : constant Uint := Numerator (U);
begin
Col_Check
(UI_Decimal_Digits_Hi (D) + UI_Decimal_Digits_Hi (N) + 4);
Set_Debug_Sloc;
UR_Write (U);
end Write_Ureal_With_Col_Check_Sloc;
end Sprint;
|
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2020 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.
private package EGL.Loading is
pragma Preelaborate;
generic
Function_Name : String;
type Param1_Type (<>) is private;
type Param2_Type (<>) is private;
type Return_Type is private;
package Function_With_2_Params is
type Function_Reference is not null access function
(Param1 : Param1_Type;
Param2 : Param2_Type) return Return_Type
with Convention => StdCall;
function Init
(Param1 : Param1_Type;
Param2 : Param2_Type) return Return_Type
with Convention => StdCall;
Ref : Function_Reference := Init'Access;
end Function_With_2_Params;
generic
Function_Name : String;
type Param1_Type (<>) is private;
type Param2_Type (<>) is private;
type Param3_Type (<>) is private;
type Return_Type is private;
package Function_With_3_Params is
type Function_Reference is not null access function
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type) return Return_Type
with Convention => StdCall;
function Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type) return Return_Type
with Convention => StdCall;
Ref : Function_Reference := Init'Access;
end Function_With_3_Params;
generic
Function_Name : String;
type Param1_Type (<>) is private;
type Param2_Type (<>) is private;
type Param3_Type (<>) is private;
type Param4_Type (<>) is private;
type Return_Type is private;
package Function_With_4_Params is
type Function_Reference is not null access function
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type;
Param4 : Param4_Type) return Return_Type
with Convention => StdCall;
function Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type;
Param4 : Param4_Type) return Return_Type
with Convention => StdCall;
Ref : Function_Reference := Init'Access;
end Function_With_4_Params;
generic
Function_Name : String;
type Param1_Type (<>) is private;
type Element_Type is private;
type Array_Type is array (Natural range <>) of Element_Type;
type Size_Type (<>) is private;
type Return_Type is private;
package Array_Getter_With_3_Params is
type Function_Reference is not null access function
(Param1 : Param1_Type;
Values : in out Array_Type;
Size : in out Size_Type) return Return_Type
with Convention => StdCall;
function Init
(Param1 : Param1_Type;
Values : in out Array_Type;
Size : in out Size_Type) return Return_Type
with Convention => StdCall;
Ref : Function_Reference := Init'Access;
end Array_Getter_With_3_Params;
generic
Function_Name : String;
type Param1_Type (<>) is private;
type Param2_Type (<>) is private;
type Param3_Type (<>) is private;
type Return_Type is private;
package Getter_With_3_Params is
type Function_Reference is not null access function
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : out Param3_Type) return Return_Type
with Convention => StdCall;
function Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : out Param3_Type) return Return_Type
with Convention => StdCall;
Ref : Function_Reference := Init'Access;
end Getter_With_3_Params;
end EGL.Loading;
|
-- C96008A.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.
--*
-- MISCELLANEOUS CHECKS ON THE PRE-DEFINED FUNCTIONS IN THE PACKAGE
-- CALENDAR. SUBTESTS ARE:
-- (A) TIME_OF() AND SPLIT() ARE INVERSE FUNCTIONS.
-- (B) FORMAL PARAMETERS OF TIME_OF() AND SPLIT() ARE NAMED CORRECTLY.
-- (C) TIME_OF() GIVES THE PARAMETER SECONDS A DEFAULT VALUE OF 0.0.
-- (D) THE FUNCTIONS YEAR(), MONTH(), DAY(), AND SECONDS() RETURN
-- CORRECT VALUES USING NAMED NOTATION.
-- (E) A VALUE RETURNED FROM CLOCK() CAN BE PROCESSED BY SPLIT().
-- (F) DURATION'SMALL MEETS REQUIRED LIMIT.
-- CPP 8/16/84
WITH SYSTEM;
WITH CALENDAR; USE CALENDAR;
WITH REPORT; USE REPORT;
PROCEDURE C96008A IS
BEGIN
TEST ("C96008A", "CHECK MISCELLANEOUS FUNCTIONS IN THE " &
"PACKAGE CALENDAR");
---------------------------------------------
DECLARE -- (A)
NOW : TIME;
YR : YEAR_NUMBER;
MO : MONTH_NUMBER;
DY : DAY_NUMBER;
SEC : DAY_DURATION;
BEGIN -- (A)
BEGIN
NOW := TIME_OF (1984, 8, 13, DURATION(1.0/3.0));
SPLIT (NOW, YR, MO, DY, SEC);
IF NOW /= TIME_OF (YR, MO, DY, SEC) THEN
COMMENT ("TIME_OF AND SPLIT ARE NOT INVERSES " &
"WHEN SECONDS IS A NON-MODEL NUMBER " &
"- (A)");
END IF;
EXCEPTION
WHEN OTHERS =>
FAILED ("TIME_OF(SPLIT) RAISED EXCEPTION - (A)");
END;
BEGIN
-- RESET VALUES.
YR := 1984;
MO := 8;
DY := 13;
SEC := 1.0;
SPLIT (TIME_OF (YR, MO, DY, SEC), YR, MO, DY, SEC);
IF YR /= 1984 THEN
FAILED ("SPLIT(TIME_OF) CHANGED VALUE OF YR - (A)");
END IF;
IF MO /= 8 THEN
FAILED ("SPLIT(TIME_OF) CHANGED VALUE OF MO - (A)");
END IF;
IF DY /= 13 THEN
FAILED ("SPLIT(TIME_OF) CHANGED VALUE OF DY - (A)");
END IF;
IF SEC /= 1.0 THEN
FAILED ("SPLIT(TIME_OF) CHANGED VALUE OF " &
"SEC - (A)");
END IF;
EXCEPTION
WHEN OTHERS =>
FAILED ("SPLIT(TIME_OF) PROCESSING RAISED " &
"EXCEPTION - (A)");
END;
END; -- (A)
---------------------------------------------
BEGIN -- (B)
DECLARE
NOW : TIME;
BEGIN
NOW := TIME_OF (YEAR => 1984,
MONTH => 8,
DAY => 13,
SECONDS => 60.0);
EXCEPTION
WHEN OTHERS =>
FAILED ("NAMED ASSOCIATION ON TIME_OF() RAISED " &
"EXCEPTION - (B)");
END;
DECLARE
NOW : TIME := CLOCK;
YR : YEAR_NUMBER := 1984;
MO : MONTH_NUMBER := 8;
DY : DAY_NUMBER := 13;
SEC : DAY_DURATION := 0.0;
BEGIN
SPLIT (DATE => NOW,
YEAR => YR,
MONTH => MO,
DAY => DY,
SECONDS => SEC);
EXCEPTION
WHEN OTHERS =>
FAILED ("NAMED ASSOCIATION ON SPLIT() RAISED " &
"EXCEPTION - (B)2");
END;
END; -- (B)
---------------------------------------------
DECLARE -- (C)
NOW : TIME;
BEGIN -- (C)
NOW := TIME_OF (1984, 8, 13);
IF SECONDS (NOW) /= 0.0 THEN
FAILED ("TIME_OF() DID NOT ZERO SECONDS - (C)");
END IF;
END; -- (C)
---------------------------------------------
DECLARE -- (D)
-- ASSUMES TIME_OF() WORKS CORRECTLY.
HOLIDAY : TIME;
BEGIN -- (D)
HOLIDAY := TIME_OF (1958, 9, 9, 1.0);
IF YEAR (DATE => HOLIDAY) /= 1958 THEN
FAILED ("YEAR() DID NOT RETURN CORRECT VALUE - (D)");
END IF;
IF MONTH (DATE => HOLIDAY) /= 9 THEN
FAILED ("MONTH() DID NOT RETURN CORRECT VALUE - (D)");
END IF;
IF DAY (DATE => HOLIDAY) /= 9 THEN
FAILED ("DAY() DID NOT RETURN CORRECT VALUE - (D)");
END IF;
IF SECONDS (HOLIDAY) /= 1.0 THEN
FAILED ("SECONDS() DID NOT RETURN CORRECT VALUE - (D)");
END IF;
END; -- (D)
---------------------------------------------
DECLARE -- (E)
YR : YEAR_NUMBER;
MO : MONTH_NUMBER;
DY : DAY_NUMBER;
SEC : DAY_DURATION;
BEGIN -- (E)
SPLIT (CLOCK, YR, MO, DY, SEC);
DELAY SYSTEM.TICK;
IF TIME_OF (YR, MO, DY, SEC) > CLOCK THEN
FAILED ("SPLIT() ON CLOCK INCORRECT - (E)");
END IF;
EXCEPTION
WHEN OTHERS =>
FAILED ("SPLIT() ON CLOCK RAISED EXCEPTION - (E)");
END; -- (E)
---------------------------------------------
BEGIN -- (F)
IF DURATION'SMALL > 0.020 THEN
FAILED ("DURATION'SMALL LARGER THAN SPECIFIED - (F)");
END IF;
END; -- (F)
---------------------------------------------
RESULT;
END C96008A;
|
with Giza.Window; use Giza.Window;
with Giza.Widget.Button;
with Giza.Widget.Tiles; use Giza.Widget.Tiles;
with Giza.Events; use Giza.Events;
with Giza.Types; use Giza.Types;
use Giza.Widget;
package Test_Main_Window is
subtype Parent is Giza.Window.Instance;
type Main_Window is new Parent with private;
type Main_Window_Ref is access all Main_Window;
overriding
procedure On_Init (This : in out Main_Window);
overriding
procedure On_Displayed (This : in out Main_Window);
overriding
procedure On_Hidden (This : in out Main_Window);
overriding
function On_Position_Event
(This : in out Main_Window;
Evt : Position_Event_Ref;
Pos : Point_T) return Boolean;
private
type Sub_Window is record
Btn : Button.Ref := null;
Win : Giza.Window.Ref := null;
end record;
type Sub_Window_Array is array (Positive range <>) of Sub_Window;
type Main_Window is new Parent with record
Btn_Tile : Tiles.Ref;
Sub_Windows : Sub_Window_Array (1 .. 8);
end record;
end Test_Main_Window;
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2013, 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.OCL.Literal_Exps.Collections is
pragma Preelaborate;
package OCL_Literal_Exp_Collections is
new AMF.Generic_Collections
(OCL_Literal_Exp,
OCL_Literal_Exp_Access);
type Set_Of_OCL_Literal_Exp is
new OCL_Literal_Exp_Collections.Set with null record;
Empty_Set_Of_OCL_Literal_Exp : constant Set_Of_OCL_Literal_Exp;
type Ordered_Set_Of_OCL_Literal_Exp is
new OCL_Literal_Exp_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_OCL_Literal_Exp : constant Ordered_Set_Of_OCL_Literal_Exp;
type Bag_Of_OCL_Literal_Exp is
new OCL_Literal_Exp_Collections.Bag with null record;
Empty_Bag_Of_OCL_Literal_Exp : constant Bag_Of_OCL_Literal_Exp;
type Sequence_Of_OCL_Literal_Exp is
new OCL_Literal_Exp_Collections.Sequence with null record;
Empty_Sequence_Of_OCL_Literal_Exp : constant Sequence_Of_OCL_Literal_Exp;
private
Empty_Set_Of_OCL_Literal_Exp : constant Set_Of_OCL_Literal_Exp
:= (OCL_Literal_Exp_Collections.Set with null record);
Empty_Ordered_Set_Of_OCL_Literal_Exp : constant Ordered_Set_Of_OCL_Literal_Exp
:= (OCL_Literal_Exp_Collections.Ordered_Set with null record);
Empty_Bag_Of_OCL_Literal_Exp : constant Bag_Of_OCL_Literal_Exp
:= (OCL_Literal_Exp_Collections.Bag with null record);
Empty_Sequence_Of_OCL_Literal_Exp : constant Sequence_Of_OCL_Literal_Exp
:= (OCL_Literal_Exp_Collections.Sequence with null record);
end AMF.OCL.Literal_Exps.Collections;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S Y N C H R O N O U S _ B A R R I E R S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body Ada.Synchronous_Barriers is
protected body Synchronous_Barrier is
-- The condition "Wait'Count = Release_Threshold" opens the barrier when
-- the required number of tasks is reached. The condition "Keep_Open"
-- leaves the barrier open while there are queued tasks. While there are
-- tasks in the queue no new task will be queued (no new protected
-- action can be started on a protected object while another protected
-- action on the same protected object is underway, RM 9.5.1 (4)),
-- guaranteeing that the barrier will remain open only for those tasks
-- already inside the queue when the barrier was open.
entry Wait (Notified : out Boolean)
when Keep_Open or else Wait'Count = Release_Threshold
is
begin
-- If we are executing the entry it means that the required number of
-- tasks have been queued in the entry. Keep_Open barrier will remain
-- true until all queued tasks are out.
Keep_Open := Wait'Count > 0;
-- The last released task will close the barrier and get the Notified
-- token.
Notified := Wait'Count = 0;
end Wait;
end Synchronous_Barrier;
----------------------
-- Wait_For_Release --
----------------------
procedure Wait_For_Release
(The_Barrier : in out Synchronous_Barrier;
Notified : out Boolean)
is
begin
The_Barrier.Wait (Notified);
end Wait_For_Release;
end Ada.Synchronous_Barriers;
|
------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- Copyright 2020 Thomas E. Dickey --
-- Copyright 1999-2002,2003 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.12 $
-- Binding Version 01.00
------------------------------------------------------------------------------
generic
type T is (<>);
package Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada is
pragma Preelaborate
(Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada);
function Create (Set : Type_Set := Mixed_Case;
Case_Sensitive : Boolean := False;
Must_Be_Unique : Boolean := False)
return Enumeration_Field;
function Value (Fld : Field;
Buf : Buffer_Number := Buffer_Number'First) return T;
-- Translate the content of the fields buffer - indicated by the
-- buffer number - into an enumeration value. If the buffer is empty
-- or the content is invalid, a Constraint_Error is raises.
end Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada;
|
--
-- Copyright 2022 (C) Nicolas Pinault (aka DrPi)
--
-- SPDX-License-Identifier: BSD-3-Clause
--
--
-- Converts an ELF file to a UF2 formated file.
--
-- UF2 files are accepted by RP2040 micro_controllers
-- in BOOTSEL mode for FLASH programming.
--
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Streams.Stream_IO;
with elf2uf2;
with Errors;
procedure Rp2040_Elf2uf2 is
package SIO renames Ada.Streams.Stream_IO;
function usage return Exit_Status is
begin
Put_Line ("Usage: elf2uf2 (-v) <input ELF file> <output UF2 file>");
return Errors.ARGS;
end usage;
Arg : Natural := 0;
begin
if (Argument_Count < 2) or (Argument_Count > 3) then
Set_Exit_Status (Usage);
return;
end if;
if Argument_Count = 3 then
Arg := 2;
if (Argument(1) = "-v") then
elf2uf2.Set_Verbosity(1);
elsif (Argument(1) = "-vv") then
elf2uf2.Set_Verbosity(2);
else
Set_Exit_Status (Usage);
return;
end if;
else
Arg := 1;
end if;
declare
In_Filename : constant String := Argument(Arg);
Out_Filename : constant String := Argument(Arg+1);
In_File : SIO.File_Type;
Out_File : SIO.File_Type;
begin
declare
begin
SIO.Open (File => In_File, Mode => SIO.In_File, Name => In_Filename);
exception
when Name_Error =>
Put_Line ("Input File does not exist.");
Set_Exit_Status (Errors.ARGS);
return;
when others =>
Put_Line ("Error while opening input file.");
Set_Exit_Status (Errors.ARGS);
return;
end;
declare
begin
SIO.Create (File => Out_File, Mode => SIO.Out_File, Name => Out_Filename);
exception
when others =>
Put_Line ("Error while creating Output file.");
Set_Exit_Status (Errors.ARGS);
return;
end;
declare
Ret_Code : Exit_Status;
begin
Ret_Code := elf2uf2.Run(In_File, Out_File);
SIO.Close(In_File);
SIO.Close(Out_File);
if Ret_Code /= Errors.NO_ERROR then
SIO.Delete (Out_File);
end if;
Set_Exit_Status (Ret_Code);
end;
end;
end Rp2040_Elf2uf2; |
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- SYSTEM.INTERRUPT_MANAGEMENT.OPERATIONS --
-- --
-- B o d y --
-- --
-- Copyright (C) 1991-2017, Florida State University --
-- Copyright (C) 1995-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/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
-- This is a VxWorks version of this package. Many operations are null as this
-- package supports the use of Ada interrupt handling facilities for signals,
-- while those facilities are used for hardware interrupts on these targets.
with Ada.Exceptions;
with Interfaces.C;
with System.OS_Interface;
package body System.Interrupt_Management.Operations is
use Ada.Exceptions;
use Interfaces.C;
use System.OS_Interface;
----------------------------
-- Thread_Block_Interrupt --
----------------------------
procedure Thread_Block_Interrupt
(Interrupt : Interrupt_ID)
is
pragma Unreferenced (Interrupt);
begin
Raise_Exception
(Program_Error'Identity,
"Thread_Block_Interrupt unimplemented");
end Thread_Block_Interrupt;
------------------------------
-- Thread_Unblock_Interrupt --
------------------------------
procedure Thread_Unblock_Interrupt
(Interrupt : Interrupt_ID)
is
pragma Unreferenced (Interrupt);
begin
Raise_Exception
(Program_Error'Identity,
"Thread_Unblock_Interrupt unimplemented");
end Thread_Unblock_Interrupt;
------------------------
-- Set_Interrupt_Mask --
------------------------
procedure Set_Interrupt_Mask (Mask : access Interrupt_Mask) is
pragma Unreferenced (Mask);
begin
null;
end Set_Interrupt_Mask;
procedure Set_Interrupt_Mask
(Mask : access Interrupt_Mask;
OMask : access Interrupt_Mask)
is
pragma Unreferenced (Mask, OMask);
begin
Raise_Exception
(Program_Error'Identity,
"Set_Interrupt_Mask unimplemented");
end Set_Interrupt_Mask;
------------------------
-- Get_Interrupt_Mask --
------------------------
procedure Get_Interrupt_Mask (Mask : access Interrupt_Mask) is
pragma Unreferenced (Mask);
begin
Raise_Exception
(Program_Error'Identity,
"Get_Interrupt_Mask unimplemented");
end Get_Interrupt_Mask;
--------------------
-- Interrupt_Wait --
--------------------
function Interrupt_Wait
(Mask : access Interrupt_Mask) return Interrupt_ID
is
pragma Unreferenced (Mask);
begin
Raise_Exception
(Program_Error'Identity,
"Interrupt_Wait unimplemented");
return 0;
end Interrupt_Wait;
----------------------------
-- Install_Default_Action --
----------------------------
procedure Install_Default_Action (Interrupt : Interrupt_ID) is
pragma Unreferenced (Interrupt);
begin
Raise_Exception
(Program_Error'Identity,
"Install_Default_Action unimplemented");
end Install_Default_Action;
---------------------------
-- Install_Ignore_Action --
---------------------------
procedure Install_Ignore_Action (Interrupt : Interrupt_ID) is
pragma Unreferenced (Interrupt);
begin
Raise_Exception
(Program_Error'Identity,
"Install_Ignore_Action unimplemented");
end Install_Ignore_Action;
-------------------------
-- Fill_Interrupt_Mask --
-------------------------
procedure Fill_Interrupt_Mask (Mask : access Interrupt_Mask) is
pragma Unreferenced (Mask);
begin
Raise_Exception
(Program_Error'Identity,
"Fill_Interrupt_Mask unimplemented");
end Fill_Interrupt_Mask;
--------------------------
-- Empty_Interrupt_Mask --
--------------------------
procedure Empty_Interrupt_Mask (Mask : access Interrupt_Mask) is
pragma Unreferenced (Mask);
begin
Raise_Exception
(Program_Error'Identity,
"Empty_Interrupt_Mask unimplemented");
end Empty_Interrupt_Mask;
---------------------------
-- Add_To_Interrupt_Mask --
---------------------------
procedure Add_To_Interrupt_Mask
(Mask : access Interrupt_Mask;
Interrupt : Interrupt_ID)
is
pragma Unreferenced (Mask, Interrupt);
begin
Raise_Exception
(Program_Error'Identity,
"Add_To_Interrupt_Mask unimplemented");
end Add_To_Interrupt_Mask;
--------------------------------
-- Delete_From_Interrupt_Mask --
--------------------------------
procedure Delete_From_Interrupt_Mask
(Mask : access Interrupt_Mask;
Interrupt : Interrupt_ID)
is
pragma Unreferenced (Mask, Interrupt);
begin
Raise_Exception
(Program_Error'Identity,
"Delete_From_Interrupt_Mask unimplemented");
end Delete_From_Interrupt_Mask;
---------------
-- Is_Member --
---------------
function Is_Member
(Mask : access Interrupt_Mask;
Interrupt : Interrupt_ID) return Boolean
is
pragma Unreferenced (Mask, Interrupt);
begin
Raise_Exception
(Program_Error'Identity,
"Is_Member unimplemented");
return False;
end Is_Member;
-------------------------
-- Copy_Interrupt_Mask --
-------------------------
procedure Copy_Interrupt_Mask
(X : out Interrupt_Mask;
Y : Interrupt_Mask) is
pragma Unreferenced (X, Y);
begin
Raise_Exception
(Program_Error'Identity,
"Copy_Interrupt_Mask unimplemented");
end Copy_Interrupt_Mask;
----------------------------
-- Interrupt_Self_Process --
----------------------------
procedure Interrupt_Self_Process (Interrupt : Interrupt_ID) is
Result : Interfaces.C.int;
begin
Result := kill (getpid, Signal (Interrupt));
pragma Assert (Result = 0);
end Interrupt_Self_Process;
--------------------------
-- Setup_Interrupt_Mask --
--------------------------
procedure Setup_Interrupt_Mask is
begin
-- Nothing to be done. Ada interrupt facilities on VxWorks do not use
-- signals but hardware interrupts. Therefore, interrupt management does
-- not need anything related to signal masking. Note that this procedure
-- cannot raise an exception (as some others in this package) because
-- the generic implementation of the Timer_Server and timing events make
-- explicit calls to this routine to make ensure proper signal masking
-- on targets needed that.
null;
end Setup_Interrupt_Mask;
end System.Interrupt_Management.Operations;
|
------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Text_IO --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- Copyright 2020 Thomas E. Dickey --
-- Copyright 1999-2003,2009 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control:
-- $Revision: 1.15 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Ada.Text_IO;
with Ada.IO_Exceptions;
package Terminal_Interface.Curses.Text_IO is
use type Ada.Text_IO.Count;
subtype Count is Ada.Text_IO.Count;
subtype Positive_Count is Count range 1 .. Count'Last;
subtype Field is Ada.Text_IO.Field;
subtype Number_Base is Integer range 2 .. 16;
type Type_Set is (Lower_Case, Upper_Case, Mixed_Case);
-- For most of the routines you will see a version without a Window
-- type parameter. They will operate on a default window, which can
-- be set by the user. It is initially equal to Standard_Window.
procedure Set_Window (Win : Window);
-- Set Win as the default window
function Get_Window return Window;
-- Get the current default window
procedure Flush (Win : Window);
procedure Flush;
--------------------------------------------
-- Specification of line and page lengths --
--------------------------------------------
-- There are no set routines in this package. I assume, that you allocate
-- the window with an appropriate size.
-- A scroll-window is interpreted as an page with unbounded page length,
-- i.e. it returns the conventional 0 as page length.
function Line_Length (Win : Window) return Count;
function Line_Length return Count;
function Page_Length (Win : Window) return Count;
function Page_Length return Count;
------------------------------------
-- Column, Line, and Page Control --
------------------------------------
procedure New_Line (Win : Window; Spacing : Positive_Count := 1);
procedure New_Line (Spacing : Positive_Count := 1);
procedure New_Page (Win : Window);
procedure New_Page;
procedure Set_Col (Win : Window; To : Positive_Count);
procedure Set_Col (To : Positive_Count);
procedure Set_Line (Win : Window; To : Positive_Count);
procedure Set_Line (To : Positive_Count);
function Col (Win : Window) return Positive_Count;
function Col return Positive_Count;
function Line (Win : Window) return Positive_Count;
function Line return Positive_Count;
-----------------------
-- Characters-Output --
-----------------------
procedure Put (Win : Window; Item : Character);
procedure Put (Item : Character);
--------------------
-- Strings-Output --
--------------------
procedure Put (Win : Window; Item : String);
procedure Put (Item : String);
procedure Put_Line
(Win : Window;
Item : String);
procedure Put_Line
(Item : String);
-- Exceptions
Status_Error : exception renames Ada.IO_Exceptions.Status_Error;
Mode_Error : exception renames Ada.IO_Exceptions.Mode_Error;
Name_Error : exception renames Ada.IO_Exceptions.Name_Error;
Use_Error : exception renames Ada.IO_Exceptions.Use_Error;
Device_Error : exception renames Ada.IO_Exceptions.Device_Error;
End_Error : exception renames Ada.IO_Exceptions.End_Error;
Data_Error : exception renames Ada.IO_Exceptions.Data_Error;
Layout_Error : exception renames Ada.IO_Exceptions.Layout_Error;
end Terminal_Interface.Curses.Text_IO;
|
generic
type Number is private;
Zero : Number;
One : Number;
Two : Number;
with function Image (X : Number) return String is <>;
with function "+" (X, Y : Number) return Number is <>;
with function "/" (X, Y : Number) return Number is <>;
with function "mod" (X, Y : Number) return Number is <>;
with function ">=" (X, Y : Number) return Boolean is <>;
package Prime_Numbers is
type Number_List is array (Positive range <>) of Number;
procedure Put (List : Number_List);
task type Calculate_Factors is
entry Start (The_Number : in Number);
entry Get_Size (Size : out Natural);
entry Get_Result (List : out Number_List);
end Calculate_Factors;
end Prime_Numbers;
|
-- This spec has been automatically generated from STM32F072x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package STM32_SVD.CRC is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype IDR_IDR_Field is STM32_SVD.Byte;
-- Independent data register
type IDR_Register is record
-- General-purpose 8-bit data register bits
IDR : IDR_IDR_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for IDR_Register use record
IDR at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype CR_RESET_Field is STM32_SVD.Bit;
subtype CR_REV_IN_Field is STM32_SVD.UInt2;
subtype CR_REV_OUT_Field is STM32_SVD.Bit;
-- Control register
type CR_Register is record
-- reset bit
RESET : CR_RESET_Field := 16#0#;
-- unspecified
Reserved_1_4 : STM32_SVD.UInt4 := 16#0#;
-- Reverse input data
REV_IN : CR_REV_IN_Field := 16#0#;
-- Reverse output data
REV_OUT : CR_REV_OUT_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32_SVD.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
RESET at 0 range 0 .. 0;
Reserved_1_4 at 0 range 1 .. 4;
REV_IN at 0 range 5 .. 6;
REV_OUT at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- cyclic redundancy check calculation unit
type CRC_Peripheral is record
-- Data register
DR : aliased STM32_SVD.UInt32;
-- Independent data register
IDR : aliased IDR_Register;
-- Control register
CR : aliased CR_Register;
-- Initial CRC value
INIT : aliased STM32_SVD.UInt32;
end record
with Volatile;
for CRC_Peripheral use record
DR at 16#0# range 0 .. 31;
IDR at 16#4# range 0 .. 31;
CR at 16#8# range 0 .. 31;
INIT at 16#C# range 0 .. 31;
end record;
-- cyclic redundancy check calculation unit
CRC_Periph : aliased CRC_Peripheral
with Import, Address => System'To_Address (16#40023000#);
end STM32_SVD.CRC;
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T . S O C K E T S . L I N K E R _ O P T I O N S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2001-2010, 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 is used to provide target specific linker_options for the
-- support of sockets as required by the package GNAT.Sockets.
-- This is the Windows/NT version of this package
-- This package should not be directly with'ed by an application program
package GNAT.Sockets.Linker_Options is
private
pragma Linker_Options ("-lws2_32");
end GNAT.Sockets.Linker_Options;
|
------------------------------------------------------------------------------
-- Copyright (c) 2016-2017, Natacha Porté --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
package body Natools.Smaz_Implementations.Base_64 is
package Tools renames Natools.Smaz_Implementations.Base_64_Tools;
use type Ada.Streams.Stream_Element_Offset;
use type Tools.Base_64_Digit;
----------------------
-- Public Interface --
----------------------
procedure Read_Code
(Input : in Ada.Streams.Stream_Element_Array;
Offset : in out Ada.Streams.Stream_Element_Offset;
Code : out Natools.Smaz_Implementations.Base_64_Tools.Base_64_Digit;
Verbatim_Length : out Natural;
Last_Code : in Natools.Smaz_Implementations.Base_64_Tools.Base_64_Digit;
Variable_Length_Verbatim : in Boolean)
is
Ignored : String (1 .. 2);
Offset_Backup : Ada.Streams.Stream_Element_Offset;
Finished : Boolean;
begin
Tools.Next_Digit_Or_End (Input, Offset, Code, Finished);
if Finished then
Code := Base_64_Tools.Base_64_Digit'Last;
Verbatim_Length := 0;
return;
end if;
if Code <= Last_Code then
Verbatim_Length := 0;
elsif Variable_Length_Verbatim then
if Code < 63 then
Verbatim_Length := 63 - Natural (Code);
else
Tools.Next_Digit (Input, Offset, Code);
Verbatim_Length := Natural (Code) + 63 - Natural (Last_Code);
end if;
Code := 0;
elsif Code = 63 then
Tools.Next_Digit (Input, Offset, Code);
Verbatim_Length := Natural (Code) * 3 + 3;
Code := 0;
elsif Code = 62 then
Offset_Backup := Offset;
Tools.Decode_Single (Input, Offset, Ignored (1), Code);
Verbatim_Length := Natural (Code) * 3 + 1;
Offset := Offset_Backup;
Code := 0;
else
Offset_Backup := Offset;
Verbatim_Length := (61 - Natural (Code)) * 4;
Tools.Decode_Double (Input, Offset, Ignored, Code);
Verbatim_Length := (Verbatim_Length + Natural (Code)) * 3 + 2;
Offset := Offset_Backup;
Code := 0;
end if;
end Read_Code;
procedure Read_Verbatim
(Input : in Ada.Streams.Stream_Element_Array;
Offset : in out Ada.Streams.Stream_Element_Offset;
Output : out String)
is
Ignored : Tools.Base_64_Digit;
Output_Index : Natural := Output'First - 1;
begin
if Output'Length mod 3 = 1 then
Tools.Decode_Single
(Input, Offset, Output (Output_Index + 1), Ignored);
Output_Index := Output_Index + 1;
elsif Output'Length mod 3 = 2 then
Tools.Decode_Double
(Input, Offset,
Output (Output_Index + 1 .. Output_Index + 2), Ignored);
Output_Index := Output_Index + 2;
end if;
if Output_Index < Output'Last then
Tools.Decode
(Input, Offset, Output (Output_Index + 1 .. Output'Last));
end if;
end Read_Verbatim;
procedure Skip_Verbatim
(Input : in Ada.Streams.Stream_Element_Array;
Offset : in out Ada.Streams.Stream_Element_Offset;
Verbatim_Length : in Positive)
is
Code : Tools.Base_64_Digit;
begin
for I in 1 .. Tools.Image_Length (Verbatim_Length) loop
Tools.Next_Digit (Input, Offset, Code);
end loop;
end Skip_Verbatim;
function Verbatim_Size
(Input_Length : in Positive;
Last_Code : in Natools.Smaz_Implementations.Base_64_Tools.Base_64_Digit;
Variable_Length_Verbatim : in Boolean)
return Ada.Streams.Stream_Element_Count is
begin
if Variable_Length_Verbatim then
declare
Largest_Single : constant Positive := 62 - Natural (Last_Code);
Largest_Run : constant Positive := 64 + Largest_Single;
Run_Count : constant Natural
:= (Input_Length + Largest_Run - 1) / Largest_Run;
Last_Run_Size : constant Positive
:= Input_Length - (Run_Count - 1) * Largest_Run;
Last_Run_Header_Size : constant Ada.Streams.Stream_Element_Count
:= (if Last_Run_Size > Largest_Single then 2 else 1);
begin
return Ada.Streams.Stream_Element_Count (Run_Count)
* (Tools.Image_Length (Largest_Run) + 2)
+ Tools.Image_Length (Last_Run_Size) + Last_Run_Header_Size;
end;
else
declare
Largest_Prefix : constant Natural
:= (case Input_Length mod 3 is
when 1 => 15 * 3 + 1,
when 2 => ((61 - Natural (Last_Code)) * 4 - 1) * 3 + 2,
when others => 0);
Prefix_Header_Size : constant Ada.Streams.Stream_Element_Count
:= (if Largest_Prefix > 0 then 1 else 0);
Largest_Run : constant Positive := 64 * 3;
Prefix_Size : constant Natural
:= Natural'Min (Largest_Prefix, Input_Length);
Run_Count : constant Natural
:= (Input_Length - Prefix_Size + Largest_Run - 1) / Largest_Run;
begin
if Run_Count > 0 then
return Prefix_Header_Size + Tools.Image_Length (Prefix_Size)
+ Ada.Streams.Stream_Element_Count (Run_Count - 1)
* (Tools.Image_Length (Largest_Run) + 2)
+ Tools.Image_Length (Input_Length - Prefix_Size
- (Run_Count - 1) * Largest_Run)
+ 2;
else
return Prefix_Header_Size + Tools.Image_Length (Prefix_Size);
end if;
end;
end if;
end Verbatim_Size;
procedure Write_Code
(Output : in out Ada.Streams.Stream_Element_Array;
Offset : in out Ada.Streams.Stream_Element_Offset;
Code : in Natools.Smaz_Implementations.Base_64_Tools.Base_64_Digit) is
begin
Output (Offset) := Tools.Image (Code);
Offset := Offset + 1;
end Write_Code;
procedure Write_Verbatim
(Output : in out Ada.Streams.Stream_Element_Array;
Offset : in out Ada.Streams.Stream_Element_Offset;
Input : in String;
Last_Code : in Natools.Smaz_Implementations.Base_64_Tools.Base_64_Digit;
Variable_Length_Verbatim : in Boolean)
is
Index : Positive := Input'First;
begin
if Variable_Length_Verbatim then
declare
Largest_Single : constant Positive := 62 - Natural (Last_Code);
Largest_Run : constant Positive := 64 + Largest_Single;
Length, Last : Natural;
begin
while Index in Input'Range loop
Length := Positive'Min (Largest_Run, Input'Last + 1 - Index);
if Length > Largest_Single then
Write_Code (Output, Offset, 63);
Write_Code
(Output, Offset,
Tools.Base_64_Digit (Length - Largest_Single - 1));
else
Write_Code
(Output, Offset,
Tools.Base_64_Digit (63 - Length));
end if;
if Length mod 3 = 1 then
Tools.Encode_Single (Input (Index), 0, Output, Offset);
Index := Index + 1;
Length := Length - 1;
elsif Length mod 3 = 2 then
Tools.Encode_Double
(Input (Index .. Index + 1), 0, Output, Offset);
Index := Index + 2;
Length := Length - 2;
end if;
if Length > 0 then
Last := Index + Length - 1;
Tools.Encode (Input (Index .. Last), Output, Offset);
Index := Last + 1;
end if;
end loop;
end;
else
if Input'Length mod 3 = 1 then
declare
Extra_Blocks : constant Natural
:= Natural'Min (15, Input'Length / 3);
begin
Output (Offset) := Tools.Image (62);
Offset := Offset + 1;
Tools.Encode_Single
(Input (Index), Tools.Single_Byte_Padding (Extra_Blocks),
Output, Offset);
Index := Index + 1;
if Extra_Blocks > 0 then
Tools.Encode
(Input (Index .. Index + Extra_Blocks * 3 - 1),
Output, Offset);
Index := Index + Extra_Blocks * 3;
end if;
end;
elsif Input'Length mod 3 = 2 then
declare
Extra_Blocks : constant Natural := Natural'Min
(Input'Length / 3,
(61 - Natural (Last_Code)) * 4 - 1);
begin
Output (Offset)
:= Tools.Image (61 - Tools.Base_64_Digit (Extra_Blocks / 4));
Offset := Offset + 1;
Tools.Encode_Double
(Input (Index .. Index + 1),
Tools.Double_Byte_Padding (Extra_Blocks mod 4),
Output, Offset);
Index := Index + 2;
if Extra_Blocks > 0 then
Tools.Encode
(Input (Index .. Index + Extra_Blocks * 3 - 1),
Output, Offset);
Index := Index + Extra_Blocks * 3;
end if;
end;
end if;
pragma Assert ((Input'Last + 1 - Index) mod 3 = 0);
while Index <= Input'Last loop
declare
Block_Count : constant Natural
:= Natural'Min (64, (Input'Last + 1 - Index) / 3);
begin
Output (Offset) := Tools.Image (63);
Output (Offset + 1)
:= Tools.Image (Tools.Base_64_Digit (Block_Count - 1));
Offset := Offset + 2;
Tools.Encode
(Input (Index .. Index + Block_Count * 3 - 1),
Output, Offset);
Index := Index + Block_Count * 3;
end;
end loop;
end if;
end Write_Verbatim;
end Natools.Smaz_Implementations.Base_64;
|
------------------------------------------------------------------------------
-- --
-- AUDIO / RIFF / WAV --
-- --
-- Standard channel configurations for wavefiles --
-- --
-- The MIT License (MIT) --
-- --
-- Copyright (c) 2020 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. --
------------------------------------------------------------------------------
package body Audio.RIFF.Wav.Formats.Standard_Channel_Configurations is
-----------------------------------
-- Guessed_Channel_Configuration --
-----------------------------------
function Guessed_Channel_Configuration
(Number_Of_Channels : Positive) return Channel_Configuration is
begin
case Number_Of_Channels is
when 1 => return Channel_Config_1_0;
when 2 => return Channel_Config_2_0;
when 3 => return Channel_Config_3_0;
when 4 => return Channel_Config_4_0;
when 5 => return Channel_Config_5_0;
when 6 => return Channel_Config_5_1;
when 7 => return Channel_Config_7_0;
when 8 => return Channel_Config_7_1;
when 9 => return Channel_Config_7_1_BC;
when 10 => return Channel_Config_5_1_4;
-- return Channel_Config_7_1_2;
when 11 => return Channel_Config_7_0_4;
when 12 => return Channel_Config_7_1_4;
when others => return Channel_Config_Empty;
end case;
end Guessed_Channel_Configuration;
end Audio.RIFF.Wav.Formats.Standard_Channel_Configurations;
|
package Lto1_Pkg is
type Unsigned_64 is mod 2 ** 64;
type Associated_Report_T is (miss, radpr, radssr, radcmb);
-- sensor type : primary, secondary, co-rotating (combined)
subtype Sensor_Type_T is Associated_Report_T; -- range radpr .. radcmb;
subtype Antenna_Type_T is Sensor_Type_T range radpr .. radssr;
type Filtering_Level_T is (none, pr_in_clutter, ssr_plots, pr_plots);
type Filtering_Levels_T is array (Filtering_Level_T) of boolean;
type Radar_T is record
External_Sensor_ID : Unsigned_64;
Dual_Radar_Index : Integer;
Compatible_Filtering_Levels : Filtering_Levels_T;
Sensor_Type : Sensor_Type_T;
end record;
procedure Initialize (Radar : in Radar_T);
end Lto1_Pkg;
|
------------------------------------------------------------------------------
-- A d a r u n - t i m e s p e c i f i c a t i o n --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of ada.ads file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $
with Ada.Numerics.Generic_Complex_Types;
generic
with package Complex_Types is new Ada.Numerics.Generic_Complex_Types (<>);
package Ada.Numerics.Generic_Complex_Elementary_Functions is
pragma Pure (Generic_Complex_Elementary_Functions);
function Sqrt (X : in Complex_Types.Complex) return Complex_Types.Complex;
function Log (X : in Complex_Types.Complex) return Complex_Types.Complex;
function Exp (X : in Complex_Types.Complex) return Complex_Types.Complex;
function Exp (X : in Complex_Types.Imaginary) return Complex_Types.Complex;
function "**" (Left : in Complex_Types.Complex;
Right : in Complex_Types.Complex)
return Complex_Types.Complex;
function "**" (Left : in Complex_Types.Complex;
Right : in Complex_Types.Real'Base)
return Complex_Types.Complex;
function "**" (Left : in Complex_Types.Real'Base;
Right : in Complex_Types.Complex)
return Complex_Types.Complex;
function Sin (X : in Complex_Types.Complex) return Complex_Types.Complex;
function Cos (X : in Complex_Types.Complex) return Complex_Types.Complex;
function Tan (X : in Complex_Types.Complex) return Complex_Types.Complex;
function Cot (X : in Complex_Types.Complex) return Complex_Types.Complex;
function Arcsin (X : in Complex_Types.Complex)
return Complex_Types.Complex;
function Arccos (X : in Complex_Types.Complex)
return Complex_Types.Complex;
function Arctan (X : in Complex_Types.Complex)
return Complex_Types.Complex;
function Arccot (X : in Complex_Types.Complex)
return Complex_Types.Complex;
function Sinh (X : in Complex_Types.Complex) return Complex_Types.Complex;
function Cosh (X : in Complex_Types.Complex) return Complex_Types.Complex;
function Tanh (X : in Complex_Types.Complex) return Complex_Types.Complex;
function Coth (X : in Complex_Types.Complex) return Complex_Types.Complex;
function Arcsinh (X : in Complex_Types.Complex)
return Complex_Types.Complex;
function Arccosh (X : in Complex_Types.Complex)
return Complex_Types.Complex;
function Arctanh (X : in Complex_Types.Complex)
return Complex_Types.Complex;
function Arccoth (X : in Complex_Types.Complex)
return Complex_Types.Complex;
end Ada.Numerics.Generic_Complex_Elementary_Functions;
|
<?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>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/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo class_id="6" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>cofm</originalName>
<rtlName/>
<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/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>ofm_buff0[0]</originalName>
<rtlName/>
<coreName>RAM</coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<direction>0</direction>
<if_type>1</if_type>
<array_size>32</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/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>ofm_buff0[1]</originalName>
<rtlName/>
<coreName>RAM</coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<direction>0</direction>
<if_type>1</if_type>
<array_size>32</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/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>ofm_buff0[2]</originalName>
<rtlName/>
<coreName>RAM</coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<direction>0</direction>
<if_type>1</if_type>
<array_size>32</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/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>ofm_buff0[3]</originalName>
<rtlName/>
<coreName>RAM</coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<direction>0</direction>
<if_type>1</if_type>
<array_size>32</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/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>ofm_buff0[4]</originalName>
<rtlName/>
<coreName>RAM</coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<direction>0</direction>
<if_type>1</if_type>
<array_size>32</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/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>ofm_buff0[5]</originalName>
<rtlName/>
<coreName>RAM</coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<direction>0</direction>
<if_type>1</if_type>
<array_size>32</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/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>cofm_counter</originalName>
<rtlName/>
<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/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>enable</originalName>
<rtlName/>
<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>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>229</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>229</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>enable</originalName>
<rtlName/>
<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>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>229</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>cofm_counter</originalName>
<rtlName/>
<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>_ln231</name>
<fileName>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>231</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>231</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<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_ln233</name>
<fileName>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>233</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>233</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>add_ln233_fu_191_p2</rtlName>
<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>_ln233</name>
<fileName>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>233</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>233</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<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/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>j</originalName>
<rtlName/>
<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_ln233</name>
<fileName>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>233</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>233</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>icmp_ln233_fu_197_p2</rtlName>
<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>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>233</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>233</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>j</originalName>
<rtlName>j_fu_203_p2</rtlName>
<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>_ln233</name>
<fileName>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>233</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>233</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_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_ln236</name>
<fileName>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>236</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>236</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>zext_ln236_fu_209_p1</rtlName>
<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>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>236</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>236</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>5</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>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>236</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>236</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<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_ln236</name>
<fileName>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>236</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>236</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>bitcast_ln236_fu_219_p1</rtlName>
<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>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>236</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>236</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<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>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>237</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>237</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>5</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>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>237</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>237</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<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_ln237</name>
<fileName>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>237</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>237</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>bitcast_ln237_fu_223_p1</rtlName>
<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>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>238</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>238</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>5</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>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>238</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>238</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<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_ln238</name>
<fileName>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>238</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>238</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>bitcast_ln238_fu_227_p1</rtlName>
<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>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>239</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>239</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>5</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>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>239</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>239</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<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_ln239</name>
<fileName>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>239</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>239</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>bitcast_ln239_fu_231_p1</rtlName>
<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>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>240</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>240</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>5</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>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>240</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>240</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<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_ln240</name>
<fileName>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>240</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>240</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>bitcast_ln240_fu_235_p1</rtlName>
<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>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>241</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>241</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>5</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>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>241</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>241</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<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_ln241</name>
<fileName>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>241</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>241</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>bitcast_ln241_fu_239_p1</rtlName>
<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_5</name>
<fileName>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>241</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>241</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>tmp_5_fu_243_p7</rtlName>
<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>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>241</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>241</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName>cofm_b5_addr1516_par_fu_259_p5</rtlName>
<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_ln241</name>
<fileName>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>241</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>241</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<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>_ln233</name>
<fileName>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>233</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>233</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<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/>
<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>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>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>229</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<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>_ln256</name>
<fileName>finalconv_Jan19.cpp</fileName>
<fileDirectory>..</fileDirectory>
<lineNumber>256</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>finalconv_Jan19.cpp</first>
<second>conv_read</second>
</first>
<second>256</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName/>
<rtlName/>
<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/>
<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>32</content>
</item>
<item class_id_reference="16" object_id="_47">
<Value>
<Obj>
<type>2</type>
<id>72</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>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/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<coreName/>
</Obj>
<bitwidth>6</bitwidth>
</Value>
<const_type>0</const_type>
<content>32</content>
</item>
<item class_id_reference="16" object_id="_49">
<Value>
<Obj>
<type>2</type>
<id>79</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>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/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<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/>
<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>0</content>
</item>
<item class_id_reference="16" object_id="_52">
<Value>
<Obj>
<type>2</type>
<id>133</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>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/>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<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/>
<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>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/>
<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>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_7</name>
<fileName/>
<fileDirectory/>
<lineNumber>0</lineNumber>
<contextFuncName/>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName/>
<rtlName/>
<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/>
<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>52</item>
</node_objs>
</item>
<item class_id_reference="18" object_id="_58">
<Obj>
<type>3</type>
<id>56</id>
<name>.loopexit</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>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>67</mMaxLatency>
<mIsDfPipe>0</mIsDfPipe>
<mDfPipe class_id="-1"/>
</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"/>
</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>32</mMinTripCount>
<mMaxTripCount>32</mMaxTripCount>
<mMinLatency>64</mMinLatency>
<mMaxLatency>64</mMaxLatency>
<mIsDfPipe>0</mIsDfPipe>
<mDfPipe class_id="-1"/>
</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"/>
</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"/>
</item>
</cdfg_regions>
<fsm class_id="24" tracking_level="1" version="0" object_id="_143">
<states class_id="25" tracking_level="0" version="0">
<count>6</count>
<item_version>0</item_version>
<item class_id="26" tracking_level="1" version="0" object_id="_144">
<id>1</id>
<operations class_id="27" tracking_level="0" version="0">
<count>6</count>
<item_version>0</item_version>
<item class_id="28" tracking_level="1" version="0" object_id="_145">
<id>10</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_146">
<id>11</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_147">
<id>12</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_148">
<id>13</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_149">
<id>15</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_150">
<id>16</id>
<stage>1</stage>
<latency>1</latency>
</item>
</operations>
</item>
<item class_id_reference="26" object_id="_151">
<id>2</id>
<operations>
<count>18</count>
<item_version>0</item_version>
<item class_id_reference="28" object_id="_152">
<id>18</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_153">
<id>19</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_154">
<id>20</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_155">
<id>21</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_156">
<id>22</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_157">
<id>26</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_158">
<id>27</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_159">
<id>28</id>
<stage>2</stage>
<latency>2</latency>
</item>
<item class_id_reference="28" object_id="_160">
<id>31</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_161">
<id>32</id>
<stage>2</stage>
<latency>2</latency>
</item>
<item class_id_reference="28" object_id="_162">
<id>34</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_163">
<id>35</id>
<stage>2</stage>
<latency>2</latency>
</item>
<item class_id_reference="28" object_id="_164">
<id>37</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_165">
<id>38</id>
<stage>2</stage>
<latency>2</latency>
</item>
<item class_id_reference="28" object_id="_166">
<id>40</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_167">
<id>41</id>
<stage>2</stage>
<latency>2</latency>
</item>
<item class_id_reference="28" object_id="_168">
<id>43</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_169">
<id>44</id>
<stage>2</stage>
<latency>2</latency>
</item>
</operations>
</item>
<item class_id_reference="26" object_id="_170">
<id>3</id>
<operations>
<count>15</count>
<item_version>0</item_version>
<item class_id_reference="28" object_id="_171">
<id>28</id>
<stage>1</stage>
<latency>2</latency>
</item>
<item class_id_reference="28" object_id="_172">
<id>29</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_173">
<id>30</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_174">
<id>32</id>
<stage>1</stage>
<latency>2</latency>
</item>
<item class_id_reference="28" object_id="_175">
<id>33</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_176">
<id>35</id>
<stage>1</stage>
<latency>2</latency>
</item>
<item class_id_reference="28" object_id="_177">
<id>36</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_178">
<id>38</id>
<stage>1</stage>
<latency>2</latency>
</item>
<item class_id_reference="28" object_id="_179">
<id>39</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_180">
<id>41</id>
<stage>1</stage>
<latency>2</latency>
</item>
<item class_id_reference="28" object_id="_181">
<id>42</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_182">
<id>44</id>
<stage>1</stage>
<latency>2</latency>
</item>
<item class_id_reference="28" object_id="_183">
<id>45</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_184">
<id>46</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_185">
<id>47</id>
<stage>1</stage>
<latency>1</latency>
</item>
</operations>
</item>
<item class_id_reference="26" object_id="_186">
<id>4</id>
<operations>
<count>5</count>
<item_version>0</item_version>
<item class_id_reference="28" object_id="_187">
<id>24</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_188">
<id>25</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_189">
<id>48</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_190">
<id>49</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_191">
<id>50</id>
<stage>1</stage>
<latency>1</latency>
</item>
</operations>
</item>
<item class_id_reference="26" object_id="_192">
<id>5</id>
<operations>
<count>1</count>
<item_version>0</item_version>
<item class_id_reference="28" object_id="_193">
<id>52</id>
<stage>1</stage>
<latency>1</latency>
</item>
</operations>
</item>
<item class_id_reference="26" object_id="_194">
<id>6</id>
<operations>
<count>2</count>
<item_version>0</item_version>
<item class_id_reference="28" object_id="_195">
<id>54</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="28" object_id="_196">
<id>55</id>
<stage>1</stage>
<latency>1</latency>
</item>
</operations>
</item>
</states>
<transitions class_id="29" tracking_level="0" version="0">
<count>7</count>
<item_version>0</item_version>
<item class_id="30" tracking_level="1" version="0" object_id="_197">
<inState>1</inState>
<outState>6</outState>
<condition class_id="31" tracking_level="0" version="0">
<id>-1</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>1</count>
<item_version>0</item_version>
<item class_id="34" tracking_level="0" version="0">
<first class_id="35" tracking_level="0" version="0">
<first>11</first>
<second>0</second>
</first>
<second>1</second>
</item>
</item>
</sop>
</condition>
</item>
<item class_id_reference="30" object_id="_198">
<inState>1</inState>
<outState>2</outState>
<condition>
<id>-1</id>
<sop>
<count>1</count>
<item_version>0</item_version>
<item>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>11</first>
<second>0</second>
</first>
<second>0</second>
</item>
</item>
</sop>
</condition>
</item>
<item class_id_reference="30" object_id="_199">
<inState>5</inState>
<outState>6</outState>
<condition>
<id>-1</id>
<sop>
<count>1</count>
<item_version>0</item_version>
<item>
<count>0</count>
<item_version>0</item_version>
</item>
</sop>
</condition>
</item>
<item class_id_reference="30" object_id="_200">
<inState>3</inState>
<outState>4</outState>
<condition>
<id>-1</id>
<sop>
<count>1</count>
<item_version>0</item_version>
<item>
<count>0</count>
<item_version>0</item_version>
</item>
</sop>
</condition>
</item>
<item class_id_reference="30" object_id="_201">
<inState>4</inState>
<outState>2</outState>
<condition>
<id>-1</id>
<sop>
<count>1</count>
<item_version>0</item_version>
<item>
<count>0</count>
<item_version>0</item_version>
</item>
</sop>
</condition>
</item>
<item class_id_reference="30" object_id="_202">
<inState>2</inState>
<outState>5</outState>
<condition>
<id>-1</id>
<sop>
<count>1</count>
<item_version>0</item_version>
<item>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>19</first>
<second>0</second>
</first>
<second>0</second>
</item>
</item>
</sop>
</condition>
</item>
<item class_id_reference="30" object_id="_203">
<inState>2</inState>
<outState>3</outState>
<condition>
<id>-1</id>
<sop>
<count>1</count>
<item_version>0</item_version>
<item>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>19</first>
<second>0</second>
</first>
<second>1</second>
</item>
</item>
</sop>
</condition>
</item>
</transitions>
</fsm>
<res class_id="36" tracking_level="1" version="0" object_id="_204">
<dp_component_resource class_id="37" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_component_resource>
<dp_expression_resource>
<count>8</count>
<item_version>0</item_version>
<item class_id="38" tracking_level="0" version="0">
<first>add_ln233_fu_191_p2 ( + ) </first>
<second class_id="39" tracking_level="0" version="0">
<count>4</count>
<item_version>0</item_version>
<item class_id="40" tracking_level="0" version="0">
<first>(0P0)</first>
<second>32</second>
</item>
<item>
<first>(1P1)</first>
<second>6</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>39</second>
</item>
</second>
</item>
<item>
<first>ap_block_pp0_stage0_11001 ( 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_pp0_stage1_11001 ( 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_state3_pp0_stage1_iter0 ( 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_state4_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_enable_pp0 ( xor ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>1</second>
</item>
<item>
<first>(1P1)</first>
<second>2</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>2</second>
</item>
</second>
</item>
<item>
<first>icmp_ln233_fu_197_p2 ( icmp ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>6</second>
</item>
<item>
<first>(1P1)</first>
<second>7</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>11</second>
</item>
</second>
</item>
<item>
<first>j_fu_203_p2 ( + ) </first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0P0)</first>
<second>6</second>
</item>
<item>
<first>(1P1)</first>
<second>1</second>
</item>
<item>
<first>FF</first>
<second>0</second>
</item>
<item>
<first>LUT</first>
<second>15</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>8</count>
<item_version>0</item_version>
<item>
<first>ap_NS_fsm</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0Size)</first>
<second>6</second>
</item>
<item>
<first>(1Bits)</first>
<second>1</second>
</item>
<item>
<first>(2Count)</first>
<second>6</second>
</item>
<item>
<first>LUT</first>
<second>33</second>
</item>
</second>
</item>
<item>
<first>ap_enable_reg_pp0_iter1</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>ap_phi_mux_j_0_phi_fu_175_p4</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0Size)</first>
<second>2</second>
</item>
<item>
<first>(1Bits)</first>
<second>6</second>
</item>
<item>
<first>(2Count)</first>
<second>12</second>
</item>
<item>
<first>LUT</first>
<second>9</second>
</item>
</second>
</item>
<item>
<first>ap_return</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0Size)</first>
<second>2</second>
</item>
<item>
<first>(1Bits)</first>
<second>32</second>
</item>
<item>
<first>(2Count)</first>
<second>64</second>
</item>
<item>
<first>LUT</first>
<second>9</second>
</item>
</second>
</item>
<item>
<first>cofm_TDATA_i_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>cofm_TDATA_o_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>cofm_counter_1_reg_182</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0Size)</first>
<second>2</second>
</item>
<item>
<first>(1Bits)</first>
<second>32</second>
</item>
<item>
<first>(2Count)</first>
<second>64</second>
</item>
<item>
<first>LUT</first>
<second>9</second>
</item>
</second>
</item>
<item>
<first>j_0_reg_171</first>
<second>
<count>4</count>
<item_version>0</item_version>
<item>
<first>(0Size)</first>
<second>2</second>
</item>
<item>
<first>(1Bits)</first>
<second>6</second>
</item>
<item>
<first>(2Count)</first>
<second>12</second>
</item>
<item>
<first>LUT</first>
<second>9</second>
</item>
</second>
</item>
</dp_multiplexer_resource>
<dp_register_resource>
<count>10</count>
<item_version>0</item_version>
<item>
<first>add_ln233_reg_280</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>32</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>32</second>
</item>
</second>
</item>
<item>
<first>ap_CS_fsm</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>5</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>5</second>
</item>
</second>
</item>
<item>
<first>ap_enable_reg_pp0_iter0</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_enable_reg_pp0_iter1</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_return_preg</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>32</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>32</second>
</item>
</second>
</item>
<item>
<first>cofm_b5_addr1516_par_reg_324</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>512</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>512</second>
</item>
</second>
</item>
<item>
<first>cofm_counter_1_reg_182</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>32</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>32</second>
</item>
</second>
</item>
<item>
<first>icmp_ln233_reg_285</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>j_0_reg_171</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>6</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>6</second>
</item>
</second>
</item>
<item>
<first>j_reg_289</first>
<second>
<count>3</count>
<item_version>0</item_version>
<item>
<first>(Bits)</first>
<second>6</second>
</item>
<item>
<first>(Consts)</first>
<second>0</second>
</item>
<item>
<first>FF</first>
<second>6</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="41" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_component_map>
<dp_expression_map>
<count>3</count>
<item_version>0</item_version>
<item class_id="42" tracking_level="0" version="0">
<first>add_ln233_fu_191_p2 ( + ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>15</item>
</second>
</item>
<item>
<first>icmp_ln233_fu_197_p2 ( icmp ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>19</item>
</second>
</item>
<item>
<first>j_fu_203_p2 ( + ) </first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>21</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="43" tracking_level="0" version="0">
<count>36</count>
<item_version>0</item_version>
<item class_id="44" tracking_level="0" version="0">
<first>11</first>
<second class_id="45" 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="46" tracking_level="0" version="0">
<count>6</count>
<item_version>0</item_version>
<item class_id="47" tracking_level="0" version="0">
<first>14</first>
<second class_id="48" 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="49" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="50" tracking_level="1" version="0" object_id="_205">
<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="51" tracking_level="0" version="0">
<count>30</count>
<item_version>0</item_version>
<item class_id="52" tracking_level="0" version="0">
<first>68</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>11</item>
</second>
</item>
<item>
<first>74</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>12</item>
</second>
</item>
<item>
<first>80</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>30</item>
</second>
</item>
<item>
<first>86</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>48</item>
</second>
</item>
<item>
<first>93</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>27</item>
</second>
</item>
<item>
<first>100</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>28</item>
<item>28</item>
</second>
</item>
<item>
<first>106</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>31</item>
</second>
</item>
<item>
<first>113</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>32</item>
<item>32</item>
</second>
</item>
<item>
<first>119</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>34</item>
</second>
</item>
<item>
<first>126</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>35</item>
<item>35</item>
</second>
</item>
<item>
<first>132</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>37</item>
</second>
</item>
<item>
<first>139</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>38</item>
<item>38</item>
</second>
</item>
<item>
<first>145</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>40</item>
</second>
</item>
<item>
<first>152</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>41</item>
<item>41</item>
</second>
</item>
<item>
<first>158</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>43</item>
</second>
</item>
<item>
<first>165</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>44</item>
<item>44</item>
</second>
</item>
<item>
<first>175</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>18</item>
</second>
</item>
<item>
<first>185</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>54</item>
</second>
</item>
<item>
<first>191</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>15</item>
</second>
</item>
<item>
<first>197</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>19</item>
</second>
</item>
<item>
<first>203</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>21</item>
</second>
</item>
<item>
<first>209</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>26</item>
</second>
</item>
<item>
<first>219</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>29</item>
</second>
</item>
<item>
<first>223</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>33</item>
</second>
</item>
<item>
<first>227</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>36</item>
</second>
</item>
<item>
<first>231</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>39</item>
</second>
</item>
<item>
<first>235</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>42</item>
</second>
</item>
<item>
<first>239</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>45</item>
</second>
</item>
<item>
<first>243</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>46</item>
</second>
</item>
<item>
<first>259</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>47</item>
</second>
</item>
</dp_fu_nodes>
<dp_fu_nodes_expression class_id="54" tracking_level="0" version="0">
<count>20</count>
<item_version>0</item_version>
<item class_id="55" tracking_level="0" version="0">
<first>add_ln233_fu_191</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>15</item>
</second>
</item>
<item>
<first>bitcast_ln236_fu_219</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>29</item>
</second>
</item>
<item>
<first>bitcast_ln237_fu_223</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>33</item>
</second>
</item>
<item>
<first>bitcast_ln238_fu_227</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>36</item>
</second>
</item>
<item>
<first>bitcast_ln239_fu_231</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>39</item>
</second>
</item>
<item>
<first>bitcast_ln240_fu_235</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>42</item>
</second>
</item>
<item>
<first>bitcast_ln241_fu_239</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>45</item>
</second>
</item>
<item>
<first>cofm_b5_addr1516_par_fu_259</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>47</item>
</second>
</item>
<item>
<first>cofm_counter_1_phi_fu_185</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>54</item>
</second>
</item>
<item>
<first>icmp_ln233_fu_197</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>19</item>
</second>
</item>
<item>
<first>j_0_phi_fu_175</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>18</item>
</second>
</item>
<item>
<first>j_fu_203</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>21</item>
</second>
</item>
<item>
<first>ofm_buff0_0_addr_gep_fu_93</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>27</item>
</second>
</item>
<item>
<first>ofm_buff0_1_addr_gep_fu_106</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>31</item>
</second>
</item>
<item>
<first>ofm_buff0_2_addr_gep_fu_119</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>34</item>
</second>
</item>
<item>
<first>ofm_buff0_3_addr_gep_fu_132</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>37</item>
</second>
</item>
<item>
<first>ofm_buff0_4_addr_gep_fu_145</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>40</item>
</second>
</item>
<item>
<first>ofm_buff0_5_addr_gep_fu_158</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>43</item>
</second>
</item>
<item>
<first>tmp_5_fu_243</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>46</item>
</second>
</item>
<item>
<first>zext_ln236_fu_209</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>26</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>4</count>
<item_version>0</item_version>
<item>
<first>cofm_counter_read_1_read_fu_74</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>12</item>
</second>
</item>
<item>
<first>cofm_read_read_fu_80</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>30</item>
</second>
</item>
<item>
<first>enable_read_read_fu_68</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>11</item>
</second>
</item>
<item>
<first>write_ln241_write_fu_86</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>48</item>
</second>
</item>
</dp_fu_nodes_io>
<return_ports>
<count>1</count>
<item_version>0</item_version>
<item>
<first>ap_return</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>55</item>
</second>
</item>
</return_ports>
<dp_mem_port_nodes class_id="56" tracking_level="0" version="0">
<count>6</count>
<item_version>0</item_version>
<item class_id="57" tracking_level="0" version="0">
<first class_id="58" tracking_level="0" version="0">
<first>ofm_buff0_0</first>
<second>0</second>
</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>28</item>
<item>28</item>
</second>
</item>
<item>
<first>
<first>ofm_buff0_1</first>
<second>0</second>
</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>32</item>
<item>32</item>
</second>
</item>
<item>
<first>
<first>ofm_buff0_2</first>
<second>0</second>
</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>35</item>
<item>35</item>
</second>
</item>
<item>
<first>
<first>ofm_buff0_3</first>
<second>0</second>
</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>38</item>
<item>38</item>
</second>
</item>
<item>
<first>
<first>ofm_buff0_4</first>
<second>0</second>
</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>41</item>
<item>41</item>
</second>
</item>
<item>
<first>
<first>ofm_buff0_5</first>
<second>0</second>
</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>44</item>
<item>44</item>
</second>
</item>
</dp_mem_port_nodes>
<dp_reg_nodes>
<count>14</count>
<item_version>0</item_version>
<item>
<first>171</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>18</item>
</second>
</item>
<item>
<first>182</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>54</item>
</second>
</item>
<item>
<first>271</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>11</item>
</second>
</item>
<item>
<first>275</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>12</item>
</second>
</item>
<item>
<first>280</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>15</item>
</second>
</item>
<item>
<first>285</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>19</item>
</second>
</item>
<item>
<first>289</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>21</item>
</second>
</item>
<item>
<first>294</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>27</item>
</second>
</item>
<item>
<first>299</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>31</item>
</second>
</item>
<item>
<first>304</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>34</item>
</second>
</item>
<item>
<first>309</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>37</item>
</second>
</item>
<item>
<first>314</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>40</item>
</second>
</item>
<item>
<first>319</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>43</item>
</second>
</item>
<item>
<first>324</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>47</item>
</second>
</item>
</dp_reg_nodes>
<dp_regname_nodes>
<count>14</count>
<item_version>0</item_version>
<item>
<first>add_ln233_reg_280</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>15</item>
</second>
</item>
<item>
<first>cofm_b5_addr1516_par_reg_324</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>47</item>
</second>
</item>
<item>
<first>cofm_counter_1_reg_182</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>54</item>
</second>
</item>
<item>
<first>cofm_counter_read_1_reg_275</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>12</item>
</second>
</item>
<item>
<first>enable_read_reg_271</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>11</item>
</second>
</item>
<item>
<first>icmp_ln233_reg_285</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>19</item>
</second>
</item>
<item>
<first>j_0_reg_171</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>18</item>
</second>
</item>
<item>
<first>j_reg_289</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>21</item>
</second>
</item>
<item>
<first>ofm_buff0_0_addr_reg_294</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>27</item>
</second>
</item>
<item>
<first>ofm_buff0_1_addr_reg_299</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>31</item>
</second>
</item>
<item>
<first>ofm_buff0_2_addr_reg_304</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>34</item>
</second>
</item>
<item>
<first>ofm_buff0_3_addr_reg_309</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>37</item>
</second>
</item>
<item>
<first>ofm_buff0_4_addr_reg_314</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>40</item>
</second>
</item>
<item>
<first>ofm_buff0_5_addr_reg_319</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>43</item>
</second>
</item>
</dp_regname_nodes>
<dp_reg_phi>
<count>2</count>
<item_version>0</item_version>
<item>
<first>171</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>18</item>
</second>
</item>
<item>
<first>182</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>54</item>
</second>
</item>
</dp_reg_phi>
<dp_regname_phi>
<count>2</count>
<item_version>0</item_version>
<item>
<first>cofm_counter_1_reg_182</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>54</item>
</second>
</item>
<item>
<first>j_0_reg_171</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>18</item>
</second>
</item>
</dp_regname_phi>
<dp_port_io_nodes class_id="59" tracking_level="0" version="0">
<count>9</count>
<item_version>0</item_version>
<item class_id="60" tracking_level="0" version="0">
<first>cofm</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>
<first>read</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>30</item>
</second>
</item>
<item>
<first>write</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>48</item>
</second>
</item>
</second>
</item>
<item>
<first>cofm_counter_read</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>read</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>12</item>
</second>
</item>
</second>
</item>
<item>
<first>enable</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>read</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>11</item>
</second>
</item>
</second>
</item>
<item>
<first>ofm_buff0_0(p0)</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>load</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>28</item>
<item>28</item>
</second>
</item>
</second>
</item>
<item>
<first>ofm_buff0_1(p0)</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>load</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>32</item>
<item>32</item>
</second>
</item>
</second>
</item>
<item>
<first>ofm_buff0_2(p0)</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>load</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>35</item>
<item>35</item>
</second>
</item>
</second>
</item>
<item>
<first>ofm_buff0_3(p0)</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>load</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>38</item>
<item>38</item>
</second>
</item>
</second>
</item>
<item>
<first>ofm_buff0_4(p0)</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>load</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>41</item>
<item>41</item>
</second>
</item>
</second>
</item>
<item>
<first>ofm_buff0_5(p0)</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>load</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>44</item>
<item>44</item>
</second>
</item>
</second>
</item>
</dp_port_io_nodes>
<port2core class_id="61" tracking_level="0" version="0">
<count>6</count>
<item_version>0</item_version>
<item class_id="62" tracking_level="0" version="0">
<first>2</first>
<second>RAM</second>
</item>
<item>
<first>3</first>
<second>RAM</second>
</item>
<item>
<first>4</first>
<second>RAM</second>
</item>
<item>
<first>5</first>
<second>RAM</second>
</item>
<item>
<first>6</first>
<second>RAM</second>
</item>
<item>
<first>7</first>
<second>RAM</second>
</item>
</port2core>
<node2core>
<count>0</count>
<item_version>0</item_version>
</node2core>
</syndb>
</boost_serialization>
|
------------------------------------------------------------------------------
-- A d a r u n - t i m e s p e c i f i c a t i o n --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of ada.ads file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $
with Ada.Calendar.Time_Zones;
package Ada.Calendar.Formatting is
-- Day of the week:
type Day_Name is
(Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday);
function Day_of_Week (Date : in Time) return Day_Name;
-- Hours:Minutes:Seconds access:
subtype Hour_Number is Natural range 0 .. 23;
subtype Minute_Number is Natural range 0 .. 59;
subtype Second_Number is Natural range 0 .. 59;
subtype Second_Duration is Day_Duration range 0.0 .. 1.0;
function Year (Date : in Time;
Time_Zone : in Time_Zones.Time_Offset := 0)
return Year_Number;
function Month (Date : in Time;
Time_Zone : in Time_Zones.Time_Offset := 0)
return Month_Number;
function Day (Date : in Time;
Time_Zone : in Time_Zones.Time_Offset := 0)
return Day_Number;
function Hour (Date : in Time;
Time_Zone : in Time_Zones.Time_Offset := 0)
return Hour_Number;
function Minute (Date : in Time;
Time_Zone : in Time_Zones.Time_Offset := 0)
return Minute_Number;
function Second (Date : in Time) return Second_Number;
function Sub_Second (Date : in Time) return Second_Duration;
function Seconds_Of (Hour : in Hour_Number;
Minute : in Minute_Number;
Second : in Second_Number := 0;
Sub_Second : in Second_Duration := 0.0)
return Day_Duration;
procedure Split (Seconds : in Day_Duration;
Hour : out Hour_Number;
Minute : out Minute_Number;
Second : out Second_Number;
Sub_Second : out Second_Duration);
function Time_Of (Year : in Year_Number;
Month : in Month_Number;
Day : in Day_Number;
Hour : in Hour_Number;
Minute : in Minute_Number;
Second : in Second_Number;
Sub_Second : in Second_Duration := 0.0;
Leap_Second : in Boolean := False;
Time_Zone : in Time_Zones.Time_Offset := 0)
return Time;
function Time_Of (Year : in Year_Number;
Month : in Month_Number;
Day : in Day_Number;
Seconds : in Day_Duration := 0.0;
Leap_Second : in Boolean := False;
Time_Zone : in Time_Zones.Time_Offset := 0)
return Time;
procedure Split (Date : in Time;
Year : out Year_Number;
Month : out Month_Number;
Day : out Day_Number;
Hour : out Hour_Number;
Minute : out Minute_Number;
Second : out Second_Number;
Sub_Second : out Second_Duration;
Time_Zone : in Time_Zones.Time_Offset := 0);
procedure Split (Date : in Time;
Year : out Year_Number;
Month : out Month_Number;
Day : out Day_Number;
Hour : out Hour_Number;
Minute : out Minute_Number;
Second : out Second_Number;
Sub_Second : out Second_Duration;
Leap_Second : out Boolean;
Time_Zone : in Time_Zones.Time_Offset := 0);
procedure Split (Date : in Time;
Year : out Year_Number;
Month : out Month_Number;
Day : out Day_Number;
Seconds : out Day_Duration;
Leap_Second : out Boolean;
Time_Zone : in Time_Zones.Time_Offset := 0);
-- Simple image and value:
function Image (Date : in Time;
Include_Time_Fraction : in Boolean := False;
Time_Zone : in Time_Zones.Time_Offset := 0)
return String;
function Value (Date : in String;
Time_Zone : in Time_Zones.Time_Offset := 0)
return Time;
function Image (Elapsed_Time : in Duration;
Include_Time_Fraction : in Boolean := False)
return String;
function Value (Elapsed_Time : in String) return Duration;
end Ada.Calendar.Formatting;
|
-----------------------------------------------------------------------
-- gen-model-beans -- Ada Bean declarations
-- Copyright (C) 2012, 2013, 2018, 2021 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 Gen.Model.Mappings;
package body Gen.Model.Beans is
-- ------------------------------
-- Get the value identified by the name.
-- If the name cannot be found, the method should return the Null object.
-- ------------------------------
overriding
function Get_Value (From : in Bean_Definition;
Name : in String) return UBO.Object is
begin
if Name = "members" or Name = "columns" then
return From.Members_Bean;
elsif Name = "type" then
return UBO.To_Object (From.Type_Name);
elsif Name = "isBean" then
return UBO.To_Object (True);
else
return Tables.Table_Definition (From).Get_Value (Name);
end if;
end Get_Value;
-- ------------------------------
-- Create an attribute with the given name and add it to the bean.
-- ------------------------------
procedure Add_Attribute (Bean : in out Bean_Definition;
Name : in UString;
Column : out Gen.Model.Tables.Column_Definition_Access) is
begin
Column := new Gen.Model.Tables.Column_Definition;
Column.Set_Name (Name);
Column.Sql_Name := Name;
Column.Number := Bean.Members.Get_Count;
Column.Table := Bean'Unchecked_Access;
Bean.Members.Append (Column);
end Add_Attribute;
-- ------------------------------
-- Create a table with the given name.
-- ------------------------------
function Create_Bean (Name : in UString) return Bean_Definition_Access is
use Ada.Strings.Unbounded;
Bean : constant Bean_Definition_Access := new Bean_Definition;
begin
Bean.Kind := Mappings.T_BEAN;
Bean.Set_Name (Name);
declare
Pos : constant Natural := Index (Bean.Name, ".", Ada.Strings.Backward);
begin
if Pos > 0 then
Bean.Pkg_Name := Unbounded_Slice (Bean.Name, 1, Pos - 1);
Bean.Type_Name := Unbounded_Slice (Bean.Name, Pos + 1, Length (Bean.Name));
else
Bean.Pkg_Name := To_UString ("ADO");
Bean.Type_Name := Bean.Name;
end if;
end;
return Bean;
end Create_Bean;
end Gen.Model.Beans;
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S T R I N G S . F I X E D --
-- --
-- S p e c --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- --
------------------------------------------------------------------------------
with Ada.Strings.Maps;
with Ada.Strings; use Ada.Strings;
package String_Fixed with SPARK_Mode is
pragma Preelaborate;
------------------------
-- Search Subprograms --
------------------------
function Index
(Source : String;
Set : Maps.Character_Set;
From : Positive;
Test : Membership := Inside;
Going : Direction := Forward) return Natural;
-- Index searches for the first or last occurrence of any of a set of
-- characters (when Test=Inside), or any of the complement of a set of
-- characters (when Test=Outside). If Source is the null string, Index
-- returns 0; otherwise, if From is not in Source'Range, then Index_Error
-- is propagated. Otherwise, it returns the smallest index I >= From (if
-- Going=Forward) or the largest index I <= From (if Going=Backward) such
-- that Source(I) satisfies the Test condition with respect to Set; it
-- returns 0 if there is no such Character in Source.
function Index
(Source : String;
Set : Maps.Character_Set;
Test : Membership := Inside;
Going : Direction := Forward) return Natural;
-- If Going = Forward,
-- returns Index (Source, Set, Source'First, Test, Forward);
-- otherwise, returns
-- Index (Source, Set, Source'Last, Test, Backward);
function Index_Non_Blank
(Source : String;
From : Positive;
Going : Direction := Forward) return Natural;
-- Returns Index (Source, Maps.To_Set(Space), From, Outside, Going);
function Index_Non_Blank
(Source : String;
Going : Direction := Forward) return Natural;
-- Returns Index(Source, Maps.To_Set(Space), Outside, Going)
---------------------------------------
-- String Transformation Subprograms --
---------------------------------------
function Insert
(Source : String;
Before : Positive;
New_Item : String) return String;
-- Propagates Index_Error if Before is not in Source'First .. Source'Last+1;
-- otherwise, returns Source(Source'First..Before-1) & New_Item &
-- Source(Before..Source'Last), but with lower bound 1.
-- Beware of the overflow of the string length !
function Overwrite
(Source : String;
Position : Positive;
New_Item : String) return String;
-- Propagates Index_Error if Position is not in Source'First ..
-- Source'Last+1; otherwise, returns the string obtained from Source by
-- consecutively replacing characters starting at Position with
-- corresponding characters from New_Item with lower bound 1. If the end of
-- Source is reached before the characters in New_Item are exhausted, the
-- remaining characters from New_Item are appended to the string.
-- Beware of the overflow of the string length !
function Delete
(Source : String;
From : Positive;
Through : Natural) return String;
-- If From > Through, the returned string is Source with lower bound 1.
-- If From not in Source'Range, or Through > Source'Last, then Index_Error
-- is propagated. Otherwise, the returned string comprises
-- Source(Source'First..From - 1) & Source(Through+1..Source'Last), but
-- with lower bound 1.
---------------------------------
-- String Selector Subprograms --
---------------------------------
function Trim
(Source : String;
Left : Maps.Character_Set;
Right : Maps.Character_Set) return String;
-- Returns the string obtained by removing from Source all leading
-- characters in Left and all trailing characters in Right.
function Trim
(Source : String;
Side : Trim_End) return String;
-- Returns the string obtained by removing from Source all leading Space
-- characters (if Side = Left), all trailing Space characters
-- (if Side = Right), or all leading and trailing Space characters
-- (if Side = Both).
function Head
(Source : String;
Count : Natural;
Pad : Character := Space) return String;
-- Returns a string of length Count. If Count <= Source'Length, the string
-- comprises the first Count characters of Source. Otherwise, its contents
-- are Source concatenated with Count-Source'Length Pad characters.
function Tail
(Source : String;
Count : Natural;
Pad : Character := Space) return String;
-- Returns a string of length Count. If Count <= Source'Length, the string
-- comprises the last Count characters of Source. Otherwise, its contents
-- are Count-Source'Length Pad characters concatenated with Source.
----------------------------------
-- String Constructor Functions --
----------------------------------
function "*"
(Left : Natural;
Right : Character) return String;
-- This function replicates a character a specified number of times. It
-- returns a string whose length is Left and each of whose elements is
-- Right.
end String_Fixed;
|
-----------------------------------------------------------------------
-- gen-integration-tests -- Tests for integration
-- Copyright (C) 2012, 2013, 2014, 2016, 2017, 2018, 2021 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.Strings.Unbounded;
with Util.Tests;
package Gen.Integration.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
-- Execute the command and get the output in a string.
procedure Execute (T : in out Test;
Command : in String;
Result : out Ada.Strings.Unbounded.Unbounded_String;
Status : in Natural := 0);
-- Test dynamo create-project command.
procedure Test_Create_Project (T : in out Test);
-- Test dynamo create-project command --ado.
procedure Test_Create_ADO_Project (T : in out Test);
-- Test dynamo create-project command --gtk.
procedure Test_Create_GTK_Project (T : in out Test);
-- Test dynamo create-project command --lib.
procedure Test_Create_Lib_Project (T : in out Test);
-- Test project configure.
procedure Test_Configure (T : in out Test);
-- Test propset command.
procedure Test_Change_Property (T : in out Test);
-- Test add-module command.
procedure Test_Add_Module (T : in out Test);
-- Test add-model command.
procedure Test_Add_Model (T : in out Test);
-- Test add-module-operation command.
procedure Test_Add_Module_Operation (T : in out Test);
-- Test add-service command.
procedure Test_Add_Service (T : in out Test);
-- Test add-query command.
procedure Test_Add_Query (T : in out Test);
-- Test add-page command.
procedure Test_Add_Page (T : in out Test);
-- Test add-layout command.
procedure Test_Add_Layout (T : in out Test);
-- Test add-ajax-form command.
procedure Test_Add_Ajax_Form (T : in out Test);
-- Test generate command.
procedure Test_Generate (T : in out Test);
-- Test help command.
procedure Test_Help (T : in out Test);
-- Test dist command.
procedure Test_Dist (T : in out Test);
-- Test dist with exclude support command.
procedure Test_Dist_Exclude (T : in out Test);
-- Test dist command.
procedure Test_Info (T : in out Test);
-- Test build-doc command.
procedure Test_Build_Doc (T : in out Test);
-- Test build-doc command with -pandoc.
procedure Test_Build_Pandoc (T : in out Test);
-- Test generate command with Hibernate XML mapping files.
procedure Test_Generate_Hibernate (T : in out Test);
-- Test generate command (XMI enum).
procedure Test_Generate_XMI_Enum (T : in out Test);
-- Test generate command (XMI Ada Bean).
procedure Test_Generate_XMI_Bean (T : in out Test);
-- Test generate command (XMI Ada Bean with inheritance).
procedure Test_Generate_XMI_Bean_Table (T : in out Test);
-- Test generate command (XMI Ada Table).
procedure Test_Generate_XMI_Table (T : in out Test);
-- Test generate command (XMI Associations between Tables).
procedure Test_Generate_XMI_Association (T : in out Test);
-- Test generate command (XMI Datatype).
procedure Test_Generate_XMI_Datatype (T : in out Test);
-- Test generate command using the ArgoUML file directly (runs unzip -cq and parse the output).
procedure Test_Generate_Zargo_Association (T : in out Test);
-- Test UML with several tables that have dependencies between each of them (non circular).
procedure Test_Generate_Zargo_Dependencies (T : in out Test);
-- Test UML with several tables in several packages (non circular).
procedure Test_Generate_Zargo_Packages (T : in out Test);
-- Test UML with serialization code.
procedure Test_Generate_Zargo_Serialization (T : in out Test);
-- Test UML with several errors in the UML model.
procedure Test_Generate_Zargo_Errors (T : in out Test);
-- Test GNAT compilation of the final project.
procedure Test_Build (T : in out Test);
-- Test GNAT compilation of the generated model files.
procedure Test_Build_Model (T : in out Test);
end Gen.Integration.Tests;
|
-- C35503L.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 'POS' AND 'VAL' YIELD THE CORRECT RESULTS WHEN THE
-- PREFIX IS A GENERIC FORMAL DISCRETE TYPE WHOSE ACTUAL PARAMETER
-- IS AN INTEGER TYPE.
-- HISTORY:
-- RJW 03/17/86 CREATED ORIGINAL TEST.
-- DHH 10/19/87 SHORTENED LINES CONTAINING MORE THAN 72 CHARACTERS.
WITH REPORT; USE REPORT;
PROCEDURE C35503L IS
BEGIN
TEST ("C35503L", "CHECK THAT 'POS' AND 'VAL' YIELD THE " &
"CORRECT RESULTS WHEN THE PREFIX IS A " &
"GENERIC FORMAL DISCRETE TYPE WHOSE " &
"ACTUAL PARAMETER IS AN INTEGER TYPE" );
DECLARE
TYPE INTRANGE IS RANGE -6 .. 6;
GENERIC
TYPE INT IS (<>);
PROCEDURE P (STR : STRING);
PROCEDURE P (STR : STRING) IS
SUBTYPE SINT IS INT RANGE
INT'VAL (IDENT_INT(-4)) .. INT'VAL (IDENT_INT(4));
I :INTEGER;
BEGIN
I := IDENT_INT(-6);
FOR S IN INT'VAL (IDENT_INT(-6)) ..
INT'VAL (IDENT_INT(6))
LOOP
BEGIN
IF SINT'POS (S) /= I THEN
FAILED ( "WRONG VALUE FOR " &
STR & "'POS OF "
& INT'IMAGE (S) );
END IF;
EXCEPTION
WHEN OTHERS =>
FAILED ( "EXCEPTION RAISED FOR " &
STR & "'POS "
& "OF " & INT'IMAGE (S) );
END;
BEGIN
IF SINT'VAL (I) /= S THEN
FAILED ( "WRONG VALUE FOR " &
STR & "'VAL "
& "OF " & INT'IMAGE (S) );
END IF;
EXCEPTION
WHEN OTHERS =>
FAILED ( "EXCEPTION RAISED FOR " &
STR & "'VAL "
& "OF " & INT'IMAGE (S) );
END;
I := I + 1;
END LOOP;
END P;
PROCEDURE P1 IS NEW P (INTRANGE);
PROCEDURE P2 IS NEW P (INTEGER);
BEGIN
P1 ("INTRANGE");
P2 ("INTEGER");
END;
RESULT;
END C35503L;
|
-----------------------------------------------------------------------
-- util-serialize-tools -- Tools to Serialize objects in various formats
-- Copyright (C) 2012, 2016, 2017 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.Containers;
with Util.Streams.Texts;
with Util.Serialize.Mappers.Record_Mapper;
package body Util.Serialize.Tools is
type Object_Field is (FIELD_NAME, FIELD_VALUE);
type Object_Map_Access is access all Util.Beans.Objects.Maps.Map'Class;
type Object_Mapper_Context is record
Map : Object_Map_Access;
Name : Util.Beans.Objects.Object;
end record;
type Object_Mapper_Context_Access is access all Object_Mapper_Context;
procedure Set_Member (Into : in out Object_Mapper_Context;
Field : in Object_Field;
Value : in Util.Beans.Objects.Object);
procedure Set_Member (Into : in out Object_Mapper_Context;
Field : in Object_Field;
Value : in Util.Beans.Objects.Object) is
begin
case Field is
when FIELD_NAME =>
Into.Name := Value;
when FIELD_VALUE =>
Into.Map.Include (Util.Beans.Objects.To_String (Into.Name), Value);
Into.Name := Util.Beans.Objects.Null_Object;
end case;
end Set_Member;
package Object_Mapper is new
Util.Serialize.Mappers.Record_Mapper (Element_Type => Object_Mapper_Context,
Element_Type_Access => Object_Mapper_Context_Access,
Fields => Object_Field,
Set_Member => Set_Member);
JSON_Mapping : aliased Object_Mapper.Mapper;
-- -----------------------
-- Serialize the objects defined in the object map <b>Map</b> into the <b>Output</b>
-- JSON stream. Use the <b>Name</b> as the name of the JSON object.
-- -----------------------
procedure To_JSON (Output : in out Util.Serialize.IO.JSON.Output_Stream'Class;
Name : in String;
Map : in Util.Beans.Objects.Maps.Map) is
use type Ada.Containers.Count_Type;
procedure Write (Name : in String;
Value : in Util.Beans.Objects.Object);
procedure Write (Name : in String;
Value : in Util.Beans.Objects.Object) is
begin
Output.Start_Entity (Name => "");
Output.Write_Attribute (Name => "name",
Value => Util.Beans.Objects.To_Object (Name));
Output.Write_Attribute (Name => "value",
Value => Value);
Output.End_Entity (Name => "");
end Write;
begin
if Map.Length > 0 then
declare
Iter : Util.Beans.Objects.Maps.Cursor := Map.First;
begin
Output.Start_Array (Name => Name);
while Util.Beans.Objects.Maps.Has_Element (Iter) loop
Util.Beans.Objects.Maps.Query_Element (Iter, Write'Access);
Util.Beans.Objects.Maps.Next (Iter);
end loop;
Output.End_Array (Name => Name);
end;
end if;
end To_JSON;
-- -----------------------
-- Serialize the objects defined in the object map <b>Map</b> into an XML stream.
-- Returns the JSON string that contains a serialization of the object maps.
-- -----------------------
function To_JSON (Map : in Util.Beans.Objects.Maps.Map) return String is
use type Ada.Containers.Count_Type;
begin
if Map.Length = 0 then
return "";
end if;
declare
Buffer : aliased Util.Streams.Texts.Print_Stream;
Output : Util.Serialize.IO.JSON.Output_Stream;
begin
Buffer.Initialize (Size => 10000);
Output.Initialize (Buffer'Unchecked_Access);
Output.Start_Document;
To_JSON (Output, "params", Map);
Output.End_Document;
return Util.Streams.Texts.To_String (Buffer);
end;
end To_JSON;
-- -----------------------
-- Deserializes the JSON content passed in <b>Content</b> and restore the object map
-- with their values. The object map passed in <b>Map</b> can contain existing values.
-- They will be overriden by the JSON values.
-- -----------------------
procedure From_JSON (Content : in String;
Map : in out Util.Beans.Objects.Maps.Map) is
Parser : Util.Serialize.IO.JSON.Parser;
Mapper : Util.Serialize.Mappers.Processing;
Context : aliased Object_Mapper_Context;
begin
if Content'Length > 0 then
Context.Map := Map'Unchecked_Access;
Mapper.Add_Mapping ("**", JSON_Mapping'Access);
Object_Mapper.Set_Context (Mapper, Context'Unchecked_Access);
Parser.Parse_String (Content, Mapper);
end if;
end From_JSON;
-- -----------------------
-- Deserializes the JSON content passed in <b>Content</b> and restore the object map
-- with their values.
-- Returns the object map that was restored.
-- -----------------------
function From_JSON (Content : in String) return Util.Beans.Objects.Maps.Map is
Result : Util.Beans.Objects.Maps.Map;
begin
From_JSON (Content, Result);
return Result;
end From_JSON;
begin
JSON_Mapping.Add_Mapping ("name", FIELD_NAME);
JSON_Mapping.Add_Mapping ("value", FIELD_VALUE);
end Util.Serialize.Tools;
|
-- C38002A.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 AN UNCONSTRAINED ARRAY TYPE OR A RECORD WITHOUT
-- DEFAULT DISCRIMINANTS CAN BE USED IN AN ACCESS_TYPE_DEFINITION
-- WITHOUT AN INDEX OR DISCRIMINANT CONSTRAINT.
--
-- CHECK THAT (NON-STATIC) INDEX OR DISCRIMINANT CONSTRAINTS CAN
-- SUBSEQUENTLY BE IMPOSED WHEN THE TYPE IS USED IN AN OBJECT
-- DECLARATION, ARRAY COMPONENT DECLARATION, RECORD COMPONENT
-- DECLARATION, ACCESS TYPE DECLARATION, PARAMETER DECLARATION,
-- DERIVED TYPE DEFINITION, PRIVATE TYPE.
--
-- CHECK FOR UNCONSTRAINED GENERIC FORMAL TYPE.
-- HISTORY:
-- AH 09/02/86 CREATED ORIGINAL TEST.
-- DHH 08/16/88 REVISED HEADER AND ENTERED COMMENTS FOR PRIVATE TYPE
-- AND CORRECTED INDENTATION.
-- BCB 04/12/90 ADDED CHECKS FOR AN ARRAY AS A SUBPROGRAM RETURN
-- TYPE AND AN ARRAY AS A FORMAL PARAMETER.
-- LDC 10/01/90 ADDED CODE SO F, FPROC, G, GPROC AREN'T OPTIMIZED
-- AWAY
WITH REPORT; USE REPORT;
PROCEDURE C38002A IS
BEGIN
TEST ("C38002A", "NON-STATIC CONSTRAINTS CAN BE IMPOSED " &
"ON ACCESS TYPES ACCESSING PREVIOUSLY UNCONSTRAINED " &
"ARRAY OR RECORD TYPES");
DECLARE
C3 : CONSTANT INTEGER := IDENT_INT(3);
TYPE ARR IS ARRAY (INTEGER RANGE <>) OF INTEGER;
TYPE ARR_NAME IS ACCESS ARR;
SUBTYPE ARR_NAME_3 IS ARR_NAME(1..3);
TYPE REC(DISC : INTEGER) IS
RECORD
COMP : ARR_NAME(1..DISC);
END RECORD;
TYPE REC_NAME IS ACCESS REC;
OBJ : REC_NAME(C3);
TYPE ARR2 IS ARRAY (1..10) OF REC_NAME(C3);
TYPE REC2 IS
RECORD
COMP2 : REC_NAME(C3);
END RECORD;
TYPE NAME_REC_NAME IS ACCESS REC_NAME(C3);
TYPE DERIV IS NEW REC_NAME(C3);
SUBTYPE REC_NAME_3 IS REC_NAME(C3);
FUNCTION F (PARM : REC_NAME_3) RETURN REC_NAME_3 IS
BEGIN
IF NOT EQUAL(IDENT_INT(3), 1 + IDENT_INT(2)) THEN
COMMENT("DON'T OPTIMIZE F AWAY");
END IF;
RETURN PARM;
END;
PROCEDURE FPROC (PARM : REC_NAME_3) IS
BEGIN
IF NOT EQUAL(IDENT_INT(4), 2 + IDENT_INT(2)) THEN
COMMENT("DON'T OPTIMIZE FPROC AWAY");
END IF;
END FPROC;
FUNCTION G (PA : ARR_NAME_3) RETURN ARR_NAME_3 IS
BEGIN
IF NOT EQUAL(IDENT_INT(5), 3 + IDENT_INT(2)) THEN
COMMENT("DON'T OPTIMIZE G AWAY");
END IF;
RETURN PA;
END G;
PROCEDURE GPROC (PA : ARR_NAME_3) IS
BEGIN
IF NOT EQUAL(IDENT_INT(6), 4 + IDENT_INT(2)) THEN
COMMENT("DON'T OPTIMIZE GPROC AWAY");
END IF;
END GPROC;
BEGIN
DECLARE
R : REC_NAME;
BEGIN
R := NEW REC'(DISC => 3, COMP => NEW ARR'(1..3 => 5));
R := F(R);
R := NEW REC'(DISC => 4, COMP => NEW ARR'(1..4 => 5));
R := F(R);
FAILED ("INCOMPATIBLE CONSTRAINT ON ACCESS VALUE " &
"ACCEPTED BY FUNCTION FOR RECORD");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
IF R = NULL OR ELSE R.DISC /= 4 THEN
FAILED ("ERROR IN EVALUATION/ASSIGNMENT OF " &
"ACCESS VALUE - RECORD,FUNCTION");
END IF;
END;
DECLARE
R : REC_NAME;
BEGIN
R := NEW REC'(DISC => 3, COMP => NEW ARR'(1..3 => 5));
FPROC(R);
R := NEW REC'(DISC => 4, COMP => NEW ARR'(1..4 => 5));
FPROC(R);
FAILED ("INCOMPATIBLE CONSTRAINT ON ACCESS VALUE " &
"ACCEPTED BY PROCEDURE FOR RECORD");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
IF R = NULL OR ELSE R.DISC /= 4 THEN
FAILED ("ERROR IN EVALUATION/ASSIGNMENT OF " &
"ACCESS VALUE - RECORD,PROCEDURE");
END IF;
END;
DECLARE
A : ARR_NAME;
BEGIN
A := NEW ARR'(1..3 => 5);
A := G(A);
A := NEW ARR'(1..4 => 6);
A := G(A);
FAILED ("INCOMPATIBLE CONSTRAINT ON ACCESS VALUE " &
"ACCEPTED BY FUNCTION FOR ARRAY");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
IF A = NULL OR ELSE A(4) /= 6 THEN
FAILED ("ERROR IN EVALUATION/ASSIGNMENT OF " &
"ACCESS VALUE - ARRAY,FUNCTION");
END IF;
END;
DECLARE
A : ARR_NAME;
BEGIN
A := NEW ARR'(1..3 => 5);
GPROC(A);
A := NEW ARR'(1..4 => 6);
GPROC(A);
FAILED ("INCOMPATIBLE CONSTRAINT ON ACCESS VALUE " &
"ACCEPTED BY PROCEDURE FOR ARRAY");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
IF A = NULL OR ELSE A(4) /= 6 THEN
FAILED ("ERROR IN EVALUATION/ASSIGNMENT OF " &
"ACCESS VALUE - ARRAY,PROCEDURE");
END IF;
END;
END;
DECLARE
C3 : CONSTANT INTEGER := IDENT_INT(3);
TYPE REC (DISC : INTEGER) IS
RECORD
NULL;
END RECORD;
TYPE P_ARR IS ARRAY (INTEGER RANGE <>) OF INTEGER;
TYPE P_ARR_NAME IS ACCESS P_ARR;
TYPE P_REC_NAME IS ACCESS REC;
GENERIC
TYPE UNCON_ARR IS ARRAY (INTEGER RANGE <>) OF INTEGER;
PACKAGE P IS
TYPE ACC_REC IS ACCESS REC;
TYPE ACC_ARR IS ACCESS UNCON_ARR;
TYPE ACC_P_ARR IS ACCESS P_ARR;
SUBTYPE ACC_P_ARR_3 IS ACC_P_ARR(1..3);
OBJ : ACC_REC(C3);
TYPE ARR2 IS ARRAY (1..10) OF ACC_REC(C3);
TYPE REC1 IS
RECORD
COMP1 : ACC_REC(C3);
END RECORD;
TYPE REC2 IS
RECORD
COMP2 : ACC_ARR(1..C3);
END RECORD;
SUBTYPE ACC_REC_3 IS ACC_REC(C3);
FUNCTION F (PARM : ACC_REC_3) RETURN ACC_REC_3;
PROCEDURE FPROC (PARM : ACC_REC_3);
FUNCTION G (PA : ACC_P_ARR_3) RETURN ACC_P_ARR_3;
PROCEDURE GPROC (PA : ACC_P_ARR_3);
TYPE ACC1 IS PRIVATE;
TYPE ACC2 IS PRIVATE;
TYPE DER1 IS PRIVATE;
TYPE DER2 IS PRIVATE;
PRIVATE
TYPE ACC1 IS ACCESS ACC_REC(C3);
TYPE ACC2 IS ACCESS ACC_ARR(1..C3);
TYPE DER1 IS NEW ACC_REC(C3);
TYPE DER2 IS NEW ACC_ARR(1..C3);
END P;
PACKAGE BODY P IS
FUNCTION F (PARM : ACC_REC_3) RETURN ACC_REC_3 IS
BEGIN
IF NOT EQUAL(IDENT_INT(3), 1 + IDENT_INT(2)) THEN
COMMENT("DON'T OPTIMIZE F AWAY");
END IF;
RETURN PARM;
END;
PROCEDURE FPROC (PARM : ACC_REC_3) IS
BEGIN
IF NOT EQUAL(IDENT_INT(4), 2 + IDENT_INT(2)) THEN
COMMENT("DON'T OPTIMIZE FPROC AWAY");
END IF;
END FPROC;
FUNCTION G (PA : ACC_P_ARR_3) RETURN ACC_P_ARR_3 IS
BEGIN
IF NOT EQUAL(IDENT_INT(5), 3 + IDENT_INT(2)) THEN
COMMENT("DON'T OPTIMIZE G AWAY");
END IF;
RETURN PA;
END;
PROCEDURE GPROC (PA : ACC_P_ARR_3) IS
BEGIN
IF NOT EQUAL(IDENT_INT(6), 4 + IDENT_INT(2)) THEN
COMMENT("DON'T OPTIMIZE GPROC AWAY");
END IF;
END GPROC;
END P;
PACKAGE NP IS NEW P (UNCON_ARR => P_ARR);
USE NP;
BEGIN
DECLARE
R : ACC_REC;
BEGIN
R := NEW REC(DISC => 3);
R := F(R);
R := NEW REC(DISC => 4);
R := F(R);
FAILED ("INCOMPATIBLE CONSTRAINT ON ACCESS VALUE " &
"ACCEPTED BY FUNCTION FOR A RECORD -GENERIC");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
IF R = NULL OR ELSE R.DISC /= 4 THEN
FAILED ("ERROR IN EVALUATION/ASSIGNMENT " &
"OF ACCESS VALUE - RECORD," &
"FUNCTION -GENERIC");
END IF;
END;
DECLARE
R : ACC_REC;
BEGIN
R := NEW REC(DISC => 3);
FPROC(R);
R := NEW REC(DISC => 4);
FPROC(R);
FAILED ("INCOMPATIBLE CONSTRAINT ON ACCESS VALUE " &
"ACCEPTED BY PROCEDURE FOR A RECORD -GENERIC");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
IF R = NULL OR ELSE R.DISC /= 4 THEN
FAILED ("ERROR IN EVALUATION/ASSIGNMENT " &
"OF ACCESS VALUE - RECORD," &
"PROCEDURE -GENERIC");
END IF;
END;
DECLARE
A : ACC_P_ARR;
BEGIN
A := NEW P_ARR'(1..3 => 5);
A := G(A);
A := NEW P_ARR'(1..4 => 6);
A := G(A);
FAILED ("INCOMPATIBLE CONSTRAINT ON ACCESS VALUE " &
"ACCEPTED BY FUNCTION FOR AN ARRAY -GENERIC");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
IF A = NULL OR ELSE A(4) /= 6 THEN
FAILED ("ERROR IN EVALUATION/ASSIGNMENT " &
"OF ACCESS VALUE - ARRAY," &
"FUNCTION -GENERIC");
END IF;
END;
DECLARE
A : ACC_P_ARR;
BEGIN
A := NEW P_ARR'(1..3 => 5);
GPROC(A);
A := NEW P_ARR'(1..4 => 6);
GPROC(A);
FAILED ("INCOMPATIBLE CONSTRAINT ON ACCESS VALUE " &
"ACCEPTED BY PROCEDURE FOR AN ARRAY -GENERIC");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
IF A = NULL OR ELSE A(4) /= 6 THEN
FAILED ("ERROR IN EVALUATION/ASSIGNMENT " &
"OF ACCESS VALUE - ARRAY," &
"PROCEDURE -GENERIC");
END IF;
END;
END;
DECLARE
TYPE CON_INT IS RANGE 1..10;
GENERIC
TYPE UNCON_INT IS RANGE <>;
PACKAGE P2 IS
SUBTYPE NEW_INT IS UNCON_INT RANGE 1..5;
FUNCTION FUNC_INT (PARM : NEW_INT) RETURN NEW_INT;
PROCEDURE PROC_INT (PARM : NEW_INT);
END P2;
PACKAGE BODY P2 IS
FUNCTION FUNC_INT (PARM : NEW_INT) RETURN NEW_INT IS
BEGIN
IF NOT EQUAL(IDENT_INT(3), 1 + IDENT_INT(2)) THEN
COMMENT("DON'T OPTIMIZE F AWAY");
END IF;
RETURN PARM;
END FUNC_INT;
PROCEDURE PROC_INT (PARM : NEW_INT) IS
BEGIN
IF NOT EQUAL(IDENT_INT(4), 2 + IDENT_INT(2)) THEN
COMMENT("DON'T OPTIMIZE FPROC AWAY");
END IF;
END PROC_INT;
END P2;
PACKAGE NP2 IS NEW P2 (UNCON_INT => CON_INT);
USE NP2;
BEGIN
DECLARE
R : CON_INT;
BEGIN
R := 2;
R := FUNC_INT(R);
R := 8;
R := FUNC_INT(R);
FAILED ("INCOMPATIBLE CONSTRAINT ON VALUE " &
"ACCEPTED BY FUNCTION -GENERIC");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
IF R /= 8 THEN
FAILED ("ERROR IN EVALUATION/ASSIGNMENT " &
"OF VALUE -FUNCTION, GENERIC");
END IF;
END;
DECLARE
R : CON_INT;
BEGIN
R := 2;
PROC_INT(R);
R := 9;
PROC_INT(R);
FAILED ("INCOMPATIBLE CONSTRAINT ON ACCESS VALUE " &
"ACCEPTED BY PROCEDURE -GENERIC");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
IF R /= 9 THEN
FAILED ("ERROR IN EVALUATION/ASSIGNMENT " &
"OF ACCESS VALUE - PROCEDURE, " &
"GENERIC");
END IF;
END;
END;
RESULT;
END C38002A;
|
with
openGL.Tasks,
GL.Pointers,
GL.lean,
ada.Characters.latin_1,
ada.Strings.unbounded,
ada.Text_IO,
Interfaces.C.Strings;
package body openGL.Program
is
use gl.lean,
Interfaces,
ada.Text_IO;
compiling_in_debug_Mode : constant Boolean := True;
type Shader_view is access all Shader.item'Class;
--------------
-- Parameters
--
procedure Program_is (Self : in out Parameters; Now : in openGL.Program.view)
is
begin
Self.Program := Now;
end Program_is;
function Program (Self : in Parameters) return openGL.Program.view
is
begin
return Self.Program;
end Program;
---------
--- Forge
--
procedure define (Self : in out Item; use_vertex_Shader : in Shader.view;
use_fragment_Shader : in Shader.view)
is
begin
Tasks.check;
Self.gl_Program := glCreateProgram;
glAttachShader (Self.gl_Program, use_vertex_Shader.gl_Shader);
glAttachShader (Self.gl_Program, use_fragment_Shader.gl_Shader);
Self. vertex_Shader := use_vertex_Shader;
Self.fragment_Shader := use_fragment_Shader;
glLinkProgram (Self.gl_Program);
declare
use type C.int;
Status : aliased gl.glInt;
begin
glGetProgramiv (Self.gl_Program,
GL_LINK_STATUS,
Status'unchecked_Access);
if Status = 0
then
declare
link_Log : constant String := Self.ProgramInfoLog;
begin
Self.destroy;
raise Error with "Program link error ~ " & link_Log;
end;
end if;
end;
if compiling_in_debug_Mode
then
glValidateProgram (Self.gl_Program);
end if;
end define;
procedure define (Self : in out Item; use_vertex_Shader_File : in String;
use_fragment_Shader_File : in String)
is
use openGL.Shader;
the_vertex_Shader : constant Shader_view := new openGL.Shader.item;
the_fragment_Shader : constant Shader_view := new openGL.Shader.item;
begin
the_vertex_Shader .define (openGL.Shader.vertex, use_vertex_Shader_File);
the_fragment_Shader.define (openGL.Shader.fragment, use_fragment_Shader_File);
Self.define ( the_vertex_Shader.all'Access,
the_fragment_Shader.all'Access);
end define;
procedure destroy (Self : in out Item)
is
begin
Tasks.check;
glDeleteProgram (Self.gl_Program);
end destroy;
--------------
-- Attributes
--
function Attribute (Self : access Item'Class; Named : in String) return openGL.Attribute.view
is
begin
for Each in 1 .. Self.attribute_Count
loop
if Self.Attributes (Each).Name = Named
then
return Self.Attributes (Each);
end if;
end loop;
raise Error with "'" & Named & "' is not a valid program attribute.";
end Attribute;
function attribute_Location (Self : access Item'Class; Named : in String) return gl.GLuint
is
use gl.Pointers;
use type gl.GLint;
attribute_Name : C.strings.chars_ptr := C.Strings.new_String (Named & ada.characters.Latin_1.NUL);
begin
Tasks.check;
declare
gl_Location : constant gl.GLint := glGetAttribLocation (Self.gl_Program,
to_GLchar_access (attribute_Name));
begin
if gl_Location = -1
then
raise Error with "Requested attribute '" & Named & "' has no gl location in program.";
end if;
C.Strings.free (attribute_Name);
return gl.GLuint (gl_Location);
end;
end attribute_Location;
function is_defined (Self : in Item'Class) return Boolean
is
use type a_gl_Program;
begin
return Self.gl_Program /= 0;
end is_defined;
function ProgramInfoLog (Self : in Item) return String
is
use C, GL;
info_log_Length : aliased glInt := 0;
chars_Written : aliased glSizei := 0;
begin
Tasks.check;
glGetProgramiv (Self.gl_Program,
GL_INFO_LOG_LENGTH,
info_log_Length'unchecked_Access);
if info_log_Length = 0 then
return "";
end if;
declare
use GL.Pointers;
info_Log : aliased C.char_array := C.char_array' (1 .. C.size_t (info_log_Length) => <>);
info_Log_ptr : constant C.strings.chars_ptr := C.strings.to_chars_ptr (info_Log'unchecked_Access);
begin
glGetProgramInfoLog (Self.gl_Program,
glSizei (info_log_Length),
chars_Written'unchecked_Access,
to_GLchar_access (info_Log_ptr));
return C.to_Ada (info_Log);
end;
end ProgramInfoLog;
function uniform_Variable (Self : access Item'Class; Named : in String) return Variable.uniform.bool
is
the_Variable : Variable.uniform.bool;
begin
the_Variable.define (Self, Named);
return the_Variable;
end uniform_Variable;
function uniform_Variable (Self : access Item'Class; Named : in String) return Variable.uniform.int
is
the_Variable : Variable.uniform.int;
begin
the_Variable.define (Self, Named);
return the_Variable;
end uniform_Variable;
function uniform_Variable (Self : access Item'Class; Named : in String) return Variable.uniform.float
is
the_Variable : Variable.uniform.float;
begin
the_Variable.define (Self, Named);
return the_Variable;
end uniform_Variable;
function uniform_Variable (Self : access Item'Class; Named : in String) return Variable.uniform.vec3
is
the_Variable : Variable.uniform.vec3;
begin
the_Variable.define (Self, Named);
return the_Variable;
end uniform_Variable;
function uniform_Variable (Self : access Item'Class; Named : in String) return Variable.uniform.vec4
is
the_Variable : Variable.uniform.vec4;
begin
the_Variable.define (Self, Named);
return the_Variable;
end uniform_Variable;
function uniform_Variable (Self : access Item'Class; Named : in String) return Variable.uniform.mat3
is
the_Variable : Variable.uniform.mat3;
begin
the_Variable.define (Self, Named);
return the_Variable;
end uniform_Variable;
function uniform_Variable (Self : access Item'Class; Named : in String) return Variable.uniform.mat4
is
the_Variable : Variable.uniform.mat4;
begin
the_Variable.define (Self, Named);
return the_Variable;
end uniform_Variable;
--------------
-- Operations
--
procedure add (Self : in out Item; Attribute : in openGL.Attribute.view)
is
begin
Self.attribute_Count := Self.attribute_Count + 1;
Self.Attributes (Self.attribute_Count) := Attribute;
end add;
procedure enable (Self : in out Item)
is
use type gl.GLuint;
begin
Tasks.check;
if Self.gl_Program = 0
then
Item'Class (Self).define; -- TODO: This appears to do nothing.
end if;
glUseProgram (self.gl_Program);
end enable;
procedure enable_Attributes (Self : in Item)
is
begin
for Each in 1 .. Self.attribute_Count
loop
Self.Attributes (Each).enable;
end loop;
end enable_Attributes;
procedure mvp_Matrix_is (Self : in out Item'Class; Now : in Matrix_4x4)
is
begin
Self.mvp_Matrix := Now;
end mvp_Matrix_is;
procedure inverse_modelview_Matrix_is (Self : in out Item'Class; Now : in Matrix_3x3)
is
begin
Self.inverse_modelview_Matrix := Now;
end inverse_modelview_Matrix_is;
procedure directional_Light_is (Self : in out Item'Class; light_Id : in Positive;
Now : in Light.directional.item)
is
begin
Self.directional_Light (light_Id) := Now;
end directional_Light_is;
procedure Scale_is (Self : in out Item'Class; Now : in Vector_3)
is
begin
Self.Scale := Now;
end Scale_is;
procedure Shine_is (Self : in out Item'Class; Now : in Shine)
is
begin
Self.Shine := Now;
end Shine_is;
procedure set_mvp_Uniform (Self : in Item)
is
the_mvp_Uniform : constant Variable.uniform.mat4 := Self.uniform_Variable ("mvp_Matrix");
begin
the_mvp_Uniform.Value_is (Self.mvp_Matrix);
end set_mvp_Uniform;
-- Privvy
--
function gl_Program (Self : in Item) return a_gl_Program
is
begin
return Self.gl_Program;
end gl_Program;
end openGL.Program;
|
with mwc_constants;
use mwc_constants;
generic
type Parent_Random_Int is mod <>;
package LCG_Rand
with Spark_Mode => On
is
pragma Pure (LCG_Rand);
pragma Assert (Parent_Random_Int'Modulus > 2**63-1);
pragma Assert (m0 < Parent_Random_Int'Last);
pragma Assert (m1 < Parent_Random_Int'Last);
subtype Valid_LCG_0_Range is Parent_Random_Int range 1 .. m0 - 1;
subtype Valid_LCG_1_Range is Parent_Random_Int range 1 .. m1 - 1;
procedure Get_Random_LCG_64_0 (X0 : in out Parent_Random_Int);
pragma Inline (Get_Random_LCG_64_0);
-- x0 = 0 gives period of 1; needs to be rejected as a seed.
procedure Get_Random_LCG_64_1 (X1 : in out Parent_Random_Int);
pragma Inline (Get_Random_LCG_64_1);
-- x1 = 0 gives period of 1; needs to be rejected as a seed.
procedure Get_Random_LCG_64_Combined
(S0 : in out Parent_Random_Int;
S1 : in out Parent_Random_Int;
Random_x : out Parent_Random_Int); -- result
-- S1 = 0 and S2 = 0 give reduced periods; need to be rejected as a seeds.
end LCG_Rand;
|
with STM32_SVD; use STM32_SVD;
with Drivers.Text_IO;
with HAL;
generic
with package Chip_Select is new HAL.Pin (<>);
with package IRQ is new HAL.Pin (<>);
with package SPI is new HAL.SPI (<>);
AES_Enabled : Boolean := False;
Frequency : Positive;
TX_PA_Boost : Boolean := False;
Channel : Byte := 0;
package Drivers.RFM69 is
subtype Address_Type is Byte;
type Sync_Word_Type is array (Byte range <>) of Byte
with Dynamic_Predicate => Sync_Word_Type'Length <= 8;
type Packet_Type is array (Byte range <>) of Byte;
type AES_Key_Type is array (Byte range 1 .. 16) of Byte;
type Raw_Register_Array is array (0 .. 16#4D#) of Byte;
procedure Init;
procedure Set_Sync_Word (Sync_Word : Sync_Word_Type);
procedure Get_Sync_Word (Sync_Word : out Sync_Word_Type);
procedure Set_Frequency (Frequency : Positive);
procedure Set_Bitrate (Bitrate : Positive);
procedure Set_Broadcast_Address (Address : Address_Type);
procedure Set_RX_Address (Address : Address_Type);
procedure Set_TX_Address (Address : Address_Type);
procedure TX_Mode;
procedure RX_Mode;
procedure TX (Packet: Packet_Type);
procedure TX (Packet: Packet_Type; Length: Byte);
function RX_Available return Boolean;
function RX_Available_Reg return Boolean;
function TX_Complete return Boolean;
function Wait_For_RX return Boolean;
procedure RX (Packet : out Packet_Type; Length : out Byte);
procedure Clear_IRQ;
procedure Power_Down;
procedure Cancel;
procedure Read_Registers (Registers : out Raw_Register_Array);
generic
with procedure Put_Line (Line: in string);
procedure Print_Registers;
end Drivers.RFM69;
|
echo 'with Ada.text_IO; use Ada.text_IO; procedure X is begin Put("Hello!"); end X;' > x.adb; gnatmake x; ./x; rm x.adb x.ali x.o x
|
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
package body Date_Package is
function "="(Date1, Date2: Date_Type)
return Boolean is
begin
if Date1.Year = Date2.Year and Date1.Month = Date2.Month and Date1.Day = Date2.Day then
return True;
else
return False;
end if;
end;
function "<"(Date2, Date1: Date_Type)
return Boolean is
begin
if Date1.Year >= Date2.Year then
if Date1.Year > Date2.Year then
return True;
else
if Date1.Month >= Date2.Month then
if Date1.Month > Date2.Month then
return True;
else
if Date1.Day > Date2.Day then
return True;
else
return False;
end if;
end if;
else
return False;
end if;
end if;
else
return False;
end if;
end;
function ">"(Date1, Date2: Date_Type)
return Boolean is
begin
if Date1.Year >= Date2.Year then
if Date1.Year > Date2.Year then
return True;
else
if Date1.Month >= Date2.Month then
if Date1.Month > Date2.Month then
return True;
else
if Date1.Day > Date2.Day then
return True;
else
return False;
end if;
end if;
else
return False;
end if;
end if;
else
return False;
end if;
end;
function Is_Leap_Year(Year: in Integer)
return Boolean is
begin
if Year mod 4 = 0 and Year mod 100 /= 0 then
return True;
elsif Year mod 400 = 0 then
return True;
else
return False;
end if;
end Is_Leap_Year;
procedure Test_Leap_Years is
begin
for I in 1800..2400 loop
Put(I); Put(" ");
if Is_Leap_Year(I) then
Put("SKOTT");
end if;
New_Line;
end loop;
end Test_Leap_Years;
function Last_Day_Of_Month(Month, Year: in Integer)
return Integer is
febleap: Integer;
begin
if Is_Leap_Year(Year) then
febleap := 29;
else
febleap := 28;
end if;
case Month is
when 1 => return 31;
when 2 => return febleap;
when 3 => return 31;
when 4 => return 30;
when 5 => return 31;
when 6 => return 30;
when 7 => return 31;
when 8 => return 31;
when 9 => return 30;
when 10 => return 31;
when 11 => return 30;
when 12 => return 31;
when others => -- Errorhantering
return 0;
end case;
end Last_Day_Of_Month;
-- Tar in ett datum från terminalen
procedure Get(Date: out Date_Type) is
Ins: String(1..10);
begin
Get(Ins);
for I in Ins'Range loop
if I = 5 or I = 8 then
if Ins(I) /= '-' then
raise FORMAT_ERROR;
end if;
end if;
if I in 1..4 then
if Ins(I) not in '0'..'9' then
raise FORMAT_ERROR;
end if;
end if;
if I in 6..7 then
if Ins(I) not in '0'..'9' then
raise FORMAT_ERROR;
end if;
end if;
if I in 9..10 then
if Ins(I) not in '0'..'9' then
raise FORMAT_ERROR;
end if;
end if;
end loop;
Date.Year := Integer'Value(Ins(1..4));
Date.Month := Integer'Value(Ins(6..7));
Date.Day := Integer'Value(Ins(9..10));
if Date.Year > 9999 or Date.Year < 0 then
raise YEAR_ERROR;
end if;
if Date.Month > 12 or Date.Month < 1 then
raise MONTH_ERROR;
end if;
if Date.Day > Last_Day_Of_Month(Date.Month, Date.Year) or Date.Day < 1 then
raise DAY_ERROR;
end if;
--if Date.Year < 0 or Date.Year > 9999 then
-- raise YEAR_ERROR;
--end if;
end Get;
-- Skriver ut datum
procedure Put(Date: in Date_Type) is
begin
Put(Date.Year, 4);
Put("-");
if Date.Month < 10 then
Put("0");
end if;
Put(Date.Month,1);
Put("-");
if Date.Day < 10 then
Put("0");
end if;
Put(Date.Day,1);
end Put;
-- Returnerar nästkommande datum
function Next_Date(Date: in Date_Type)
return Date_Type is
Temp_Date: Date_Type;
begin
Temp_Date := Date;
if Temp_Date.Day = Last_Day_Of_Month(Temp_Date.Month, Temp_Date.Year) then
if Temp_Date.Month = 12 then
Temp_Date.Year := Temp_Date.Year + 1; Temp_Date.Month := 1; Temp_Date.Day := 1;
else
Temp_Date.Month := Temp_Date.Month + 1; Temp_Date.Day := 1;
end if;
else
Temp_Date.Day := Temp_Date.Day + 1;
end if;
return Temp_Date;
end Next_Date;
-- Returnerar föregående datum
function Previous_Date(Date: in Date_Type)
return Date_Type is
Temp_Date: Date_Type;
begin
Temp_Date := Date;
-- Om dagen inte är 1, ta bara bort en dag
if Temp_Date.Day /= 1 then
Temp_Date.Day := Temp_Date.Day - 1;
else
-- Beroende på vilken månad vi är i ska nya dagen bli olika.
if Temp_Date.Month = 1 then
Temp_Date.Year := Temp_Date.Year - 1; Temp_Date.Month := 12; Temp_Date.Day := 31;
else
Temp_Date.Month := Temp_Date.Month - 1;
Temp_Date.Day := Last_Day_Of_Month(Temp_Date.Month, Temp_Date.Year); -- Tar in månad och år så att funktionen kan ta hänsyn till skottår
end if;
end if;
--Temp_Date.Year := Temp_Date.Year - 1;
return Temp_Date;
end Previous_Date;
end Date_Package;
|
------------------------------------------------------------------------------
-- --
-- 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_Comments is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Comment_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_Comment
(AMF.UML.Comments.UML_Comment_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Comment_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_Comment
(AMF.UML.Comments.UML_Comment_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Comment_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_Comment
(Visitor,
AMF.UML.Comments.UML_Comment_Access (Self),
Control);
end if;
end Visit_Element;
---------------------------
-- Get_Annotated_Element --
---------------------------
overriding function Get_Annotated_Element
(Self : not null access constant UML_Comment_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element is
begin
return
AMF.UML.Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Annotated_Element
(Self.Element)));
end Get_Annotated_Element;
--------------
-- Get_Body --
--------------
overriding function Get_Body
(Self : not null access constant UML_Comment_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_Body (Self.Element);
begin
if Aux = null then
return (Is_Empty => True);
else
return (False, League.Strings.Internals.Create (Aux));
end if;
end;
end Get_Body;
--------------
-- Set_Body --
--------------
overriding procedure Set_Body
(Self : not null access UML_Comment_Proxy;
To : AMF.Optional_String) is
begin
if To.Is_Empty then
AMF.Internals.Tables.UML_Attributes.Internal_Set_Body
(Self.Element, null);
else
AMF.Internals.Tables.UML_Attributes.Internal_Set_Body
(Self.Element,
League.Strings.Internals.Internal (To.Value));
end if;
end Set_Body;
end AMF.Internals.UML_Comments;
|
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2016 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 Ada.Strings.Fixed;
with GL.Pixels.Extensions;
with GL.Viewports;
with Orka.Containers.Bounded_Vectors;
package body Orka.Rendering.Framebuffers is
package Attachment_Vectors is new Containers.Bounded_Vectors (Positive, FB.Attachment_Point);
package Default_Attachment_Vectors is new Containers.Bounded_Vectors
(Positive, FB.Default_Attachment_Point);
function Create_Framebuffer
(Width, Height, Samples : Size) return Framebuffer is
begin
return Result : Framebuffer :=
(Default => False,
Width => Width,
Height => Height,
Samples => Samples,
others => <>)
do
Result.GL_Framebuffer.Set_Default_Width (Width);
Result.GL_Framebuffer.Set_Default_Height (Height);
Result.GL_Framebuffer.Set_Default_Samples (Samples);
Result.Set_Draw_Buffers ((0 => GL.Buffers.Color_Attachment0));
Result.Set_Read_Buffer (GL.Buffers.Color_Attachment0);
end return;
end Create_Framebuffer;
function Create_Framebuffer
(Width, Height, Samples : Size;
Context : Contexts.Context'Class) return Framebuffer
is (Create_Framebuffer (Width, Height, Samples => Samples));
function Create_Framebuffer
(Width, Height : Size) return Framebuffer
is (Create_Framebuffer (Width, Height, Samples => 0));
-----------------------------------------------------------------------------
function Create_Default_Framebuffer
(Width, Height : Natural) return Framebuffer is
begin
return Result : Framebuffer :=
(Default => True,
Width => Size (Width),
Height => Size (Height),
Samples => 0,
GL_Framebuffer => GL.Objects.Framebuffers.Default_Framebuffer,
others => <>)
do
-- Assumes a double-buffered context (Front_Left for single-buffered)
Result.Set_Draw_Buffers ((0 => GL.Buffers.Back_Left));
Result.Set_Read_Buffer (GL.Buffers.Back_Left);
end return;
end Create_Default_Framebuffer;
-----------------------------------------------------------------------------
function Width (Object : Framebuffer) return Size is (Object.Width);
function Height (Object : Framebuffer) return Size is (Object.Height);
function Samples (Object : Framebuffer) return Size is (Object.Samples);
function Image (Object : Framebuffer) return String is
function Trim (Value : String) return String is
(Ada.Strings.Fixed.Trim (Value, Ada.Strings.Both));
Width : constant String := Trim (Object.Width'Image);
Height : constant String := Trim (Object.Height'Image);
Default : constant String := (if Object.Default then " default" else "");
begin
return Width & " × " & Height & Default & " framebuffer";
end Image;
procedure Use_Framebuffer (Object : Framebuffer) is
use GL.Objects.Framebuffers;
begin
GL.Objects.Framebuffers.Draw_Target.Bind (Object.GL_Framebuffer);
-- Adjust viewport
GL.Viewports.Set_Viewports
((0 => (X => 0.0,
Y => 0.0,
Width => Single (Object.Width),
Height => Single (Object.Height))
));
-- Check attachments
if not Object.Default then
declare
Status : constant Framebuffer_Status := Object.GL_Framebuffer.Status (Draw_Target);
begin
if Status /= Complete then
raise Framebuffer_Incomplete_Error with Status'Image;
end if;
end;
end if;
end Use_Framebuffer;
procedure Set_Default_Values (Object : in out Framebuffer; Values : Buffer_Values) is
begin
Object.Defaults := Values;
end Set_Default_Values;
function Default_Values (Object : Framebuffer) return Buffer_Values is (Object.Defaults);
procedure Set_Read_Buffer
(Object : Framebuffer;
Buffer : GL.Buffers.Color_Buffer_Selector) is
begin
Object.GL_Framebuffer.Set_Read_Buffer (Buffer);
end Set_Read_Buffer;
procedure Set_Draw_Buffers
(Object : in out Framebuffer;
Buffers : GL.Buffers.Color_Buffer_List) is
begin
Object.GL_Framebuffer.Set_Draw_Buffers (Buffers);
Object.Draw_Buffers.Replace_Element (Buffers);
end Set_Draw_Buffers;
procedure Clear
(Object : Framebuffer;
Mask : GL.Buffers.Buffer_Bits := (others => True))
is
Depth_Stencil : constant Boolean
:= Object.Default or else Object.Has_Attachment (FB.Depth_Stencil_Attachment);
Depth : constant Boolean := Object.Has_Attachment (FB.Depth_Attachment);
Stencil : constant Boolean := Object.Has_Attachment (FB.Stencil_Attachment);
begin
if Mask.Depth or Mask.Stencil then
if Mask.Depth and Mask.Stencil and Depth_Stencil then
-- This procedure is used because it may be faster for
-- combined depth/stencil textures
Object.GL_Framebuffer.Clear_Depth_And_Stencil_Buffer
(Depth_Value => Object.Defaults.Depth,
Stencil_Value => Object.Defaults.Stencil);
else
if Mask.Depth and (Depth_Stencil or Depth) then
Object.GL_Framebuffer.Clear_Depth_Buffer (Object.Defaults.Depth);
end if;
if Mask.Stencil and (Depth_Stencil or Stencil) then
Object.GL_Framebuffer.Clear_Stencil_Buffer (Object.Defaults.Stencil);
end if;
end if;
end if;
if Mask.Color then
declare
procedure Clear_Attachments (List : GL.Buffers.Color_Buffer_List) is
package PE renames GL.Pixels.Extensions;
use all type GL.Buffers.Color_Buffer_Selector;
Index : GL.Buffers.Draw_Buffer_Index := GL.Buffers.Draw_Buffer_Index'First;
begin
for Buffer of List loop
if Buffer /= None then
if Object.Default then
Object.GL_Framebuffer.Clear_Color_Buffer
(Index, PE.Float_Or_Normalized_Type, Object.Defaults.Color);
else
declare
Point : constant FB.Attachment_Point := Color_Attachment_Point'Val
(GL.Buffers.Color_Buffer_Selector'Pos (Buffer)
- GL.Buffers.Color_Buffer_Selector'Pos
(GL.Buffers.Color_Attachment0)
+ Color_Attachment_Point'Pos (Color_Attachment_Point'First));
begin
if Object.Has_Attachment (Point) then
declare
Format : constant GL.Pixels.Internal_Format
:= Object.Attachments (Point).Element.Internal_Format;
begin
Object.GL_Framebuffer.Clear_Color_Buffer
(Index, PE.Texture_Format_Type (Format), Object.Defaults.Color);
end;
end if;
end;
end if;
end if;
Index := Index + 1;
end loop;
end Clear_Attachments;
begin
Object.Draw_Buffers.Query_Element (Clear_Attachments'Access);
end;
end if;
end Clear;
procedure Invalidate_Non_Default
(Object : Framebuffer;
Mask : GL.Buffers.Buffer_Bits)
is
Attachments : Attachment_Vectors.Vector (Capacity => Attachment_Array'Length);
Depth_Stencil : constant Boolean := Object.Has_Attachment (FB.Depth_Stencil_Attachment);
Depth : constant Boolean := Object.Has_Attachment (FB.Depth_Attachment);
Stencil : constant Boolean := Object.Has_Attachment (FB.Stencil_Attachment);
procedure Invalidate_Attachments (Elements : Attachment_Vectors.Element_Array) is
begin
Object.GL_Framebuffer.Invalidate_Data (FB.Attachment_List (Elements));
end Invalidate_Attachments;
begin
if Mask.Depth or Mask.Stencil then
if Mask.Depth and Mask.Stencil and Depth_Stencil then
Attachments.Append (FB.Depth_Stencil_Attachment);
else
if Mask.Depth and (Depth_Stencil or Depth) then
Attachments.Append (FB.Depth_Attachment);
end if;
if Mask.Stencil and (Depth_Stencil or Stencil) then
Attachments.Append (FB.Stencil_Attachment);
end if;
end if;
end if;
if Mask.Color then
for Attachment in Color_Attachment_Point loop
if Object.Has_Attachment (Attachment) then
Attachments.Append (Attachment);
end if;
end loop;
end if;
Attachments.Query (Invalidate_Attachments'Access);
end Invalidate_Non_Default;
procedure Invalidate_Default
(Object : Framebuffer;
Mask : GL.Buffers.Buffer_Bits)
is
Attachments : Default_Attachment_Vectors.Vector (Capacity => 3);
procedure Invalidate_Attachments (Elements : Default_Attachment_Vectors.Element_Array) is
begin
Object.GL_Framebuffer.Invalidate_Data (FB.Default_Attachment_List (Elements));
end Invalidate_Attachments;
begin
if Mask.Depth then
Attachments.Append (FB.Depth);
end if;
if Mask.Stencil then
Attachments.Append (FB.Stencil);
end if;
if Mask.Color then
-- Assumes a double-buffered context (Front_Left for single-buffered)
Attachments.Append (FB.Back_Left);
end if;
Attachments.Query (Invalidate_Attachments'Access);
end Invalidate_Default;
procedure Invalidate
(Object : Framebuffer;
Mask : GL.Buffers.Buffer_Bits) is
begin
if Object.Default then
Object.Invalidate_Default (Mask);
else
Object.Invalidate_Non_Default (Mask);
end if;
end Invalidate;
procedure Resolve_To
(Object, Subject : Framebuffer;
Mask : GL.Buffers.Buffer_Bits := (Color => True, others => False))
is
use all type GL.Objects.Textures.Minifying_Function;
begin
FB.Blit
(Object.GL_Framebuffer, Subject.GL_Framebuffer,
0, 0, Object.Width, Object.Height,
0, 0, Subject.Width, Subject.Height,
Mask, (if Mask.Depth or Mask.Stencil then Nearest else Linear));
end Resolve_To;
procedure Attach
(Object : in out Framebuffer;
Attachment : FB.Attachment_Point;
Texture : Textures.Texture;
Level : Textures.Mipmap_Level := 0) is
begin
Object.GL_Framebuffer.Attach_Texture (Attachment, Texture, Level);
Object.Attachments (Attachment) := Attachment_Holder.To_Holder (Texture);
end Attach;
procedure Attach
(Object : in out Framebuffer;
Texture : Textures.Texture;
Level : Textures.Mipmap_Level := 0)
is
use all type GL.Pixels.Internal_Format;
begin
case Texture.Internal_Format is
when Depth24_Stencil8 | Depth32F_Stencil8 =>
Object.Attach (FB.Depth_Stencil_Attachment, Texture, Level);
when Depth_Component16 | Depth_Component24 | Depth_Component32F =>
Object.Attach (FB.Depth_Attachment, Texture, Level);
when Stencil_Index8 =>
Object.Attach (FB.Stencil_Attachment, Texture, Level);
when others =>
Object.Attach (FB.Color_Attachment_0, Texture, Level);
end case;
end Attach;
procedure Attach_Layer
(Object : in out Framebuffer;
Attachment : FB.Attachment_Point;
Texture : Textures.Texture;
Layer : Natural;
Level : Textures.Mipmap_Level := 0) is
begin
Object.GL_Framebuffer.Attach_Texture_Layer (Attachment, Texture, Level, Layer => Layer);
Object.Attachments (Attachment) := Attachment_Holder.To_Holder (Texture);
end Attach_Layer;
procedure Detach
(Object : in out Framebuffer;
Attachment : FB.Attachment_Point) is
begin
Object.GL_Framebuffer.Detach (Attachment);
Object.Attachments (Attachment).Clear;
end Detach;
function Has_Attachment
(Object : Framebuffer;
Attachment : FB.Attachment_Point) return Boolean
is (not Object.Attachments (Attachment).Is_Empty);
end Orka.Rendering.Framebuffers;
|
with ObjectPack;
use ObjectPack;
package PathPackage is
type Path is interface and Object;
type IntArray is array (Natural range <> ) of Integer;
type IntArrayPtr is access all IntArray;
function add(p1, p2: Path) return Path is abstract;
function sub(p1, p2: Path) return Path is abstract;
function inverse(p:Path) return Path is abstract;
function length(p: Path) return Natural is abstract;
function getHead(p: Path) return Integer is abstract;
function getTail(p: Path) return Path is abstract;
function conc(p: Path; i: Integer) return Path is abstract;
function getCanonicalPath(p: Path) return Path is abstract;
function toIntArray(p: Path) return IntArrayPtr is abstract;
end PathPackage;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.