CombinedText
stringlengths
4
3.42M
-- Copyright (c) 2020 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Skynet; with League.Strings; with Ada.Wide_Wide_Text_IO; procedure Skynet_Test is Options : Skynet.Upload_Options; Skylink : League.Strings.Universal_String; begin Skynet.Upload_File (Path => League.Strings.To_Universal_String ("/etc/hosts"), Skylink => Skylink, Options => Options); Ada.Wide_Wide_Text_IO.Put_Line (Skylink.To_Wide_Wide_String); Skynet.Download_File (Path => League.Strings.To_Universal_String ("/tmp/hosts"), Skylink => Skylink); end Skynet_Test;
-- 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. local json = require("json") name = "ZoomEye" type = "api" function start() setratelimit(3) end function check() local c local cfg = datasrc_config() if cfg ~= nil then c = cfg.credentials end if (c ~= nil and c.username ~= nil and c.password ~= nil and c.username ~= "" and c.password ~= "") then return true end return false end function vertical(ctx, domain) local c local cfg = datasrc_config() if cfg ~= nil then c = cfg.credentials end if (c == nil or c.username == nil or c.username == "" or c.password == nil or c.password == "") then return end local token = bearer_token(ctx, c.username, c.password) if token == "" then return end local resp, err = request(ctx, { url=buildurl(domain), headers={ ['Content-Type']="application/json", ['Authorization']="JWT " .. token, }, }) if (err ~= nil and err ~= "") then return end local d = json.decode(resp) if (d == nil or d.total == 0 or d.available == 0 or #(d.matches) == 0) then return end for i, host in pairs(d.matches) do sendnames(ctx, host.rdns) sendnames(ctx, host['rdns_new']) newaddr(ctx, domain, host.ip) end -- Just in case sendnames(ctx, resp) end function buildurl(domain) return "https://api.zoomeye.org/host/search?query=hostname:*." .. domain end function bearer_token(ctx, username, password) local body, err = json.encode({ username=username, password=password, }) if (err ~= nil and err ~= "") then return "" end resp, err = request(ctx, { method="POST", data=body, url="https://api.zoomeye.org/user/login", headers={['Content-Type']="application/json"}, }) if (err ~= nil and err ~= "") then return "" end local d = json.decode(resp) if (d == nil or d.access_token == nil or d.access_token == "") then return "" end return d.access_token end function sendnames(ctx, content) local names = find(content, subdomainre) if names == nil then return end local found = {} for i, v in pairs(names) do if found[v] == nil then newname(ctx, v) found[v] = true end end end
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015-2016, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- This program demonstrates the on-board gyro provided by the L3GD20 chip -- on the STM32F429 Discovery boards. The pitch, roll, and yaw values are -- continuously displayed on the LCD, as are the adjusted raw values. Move -- the board to see them change. The values will be positive or negative, -- depending on the direction of movement. Note that the values are not -- constant, even when the board is not moving, due to noise. -- Polling is used to determine when gyro data are available. -- NB: You may need to reset the board after downloading. with Last_Chance_Handler; pragma Unreferenced (Last_Chance_Handler); with STM32.Device; use STM32.Device; with STM32.Board; use STM32.Board; with LCD_Std_Out; use LCD_Std_Out; with L3GD20; use L3GD20; with Output_Utils; use Output_Utils; procedure Demo_L3GD20 is Axes : L3GD20.Angle_Rates; Stable : L3GD20.Angle_Rates; -- the values when the board is motionless Sensitivity : Float; Scaled_X : Float; Scaled_Y : Float; Scaled_Z : Float; procedure Get_Gyro_Offsets (Offsets : out Angle_Rates; Sample_Count : in Long_Integer); -- computes the averages for the gyro values returned when the board is -- motionless procedure Configure_Gyro; -- configures the on-board gyro chip Timeout : exception; -- raised by Await_Data_Ready when data is not ready within a reasonable -- time procedure Await_Data_Ready (This : in out Three_Axis_Gyroscope); -- Polls the gyro data status, returning when data for all three axes are -- available. Raises Timeout when a "reasonable" number of attempts have -- been made. -------------------- -- Configure_Gyro -- -------------------- procedure Configure_Gyro is begin -- Init the on-board gyro SPI and GPIO. This is board-specific, not -- every board has a gyro. The F429 Discovery does, for example, but -- the F4 Discovery does not. STM32.Board.Initialize_Gyro_IO; Gyro.Reset; Gyro.Configure (Power_Mode => L3GD20_Mode_Active, Output_Data_Rate => L3GD20_Output_Data_Rate_95Hz, Axes_Enable => L3GD20_Axes_Enable, Bandwidth => L3GD20_Bandwidth_1, BlockData_Update => L3GD20_BlockDataUpdate_Continous, Endianness => L3GD20_Little_Endian, Full_Scale => L3GD20_Fullscale_250); Enable_Low_Pass_Filter (Gyro); end Configure_Gyro; ---------------------- -- Get_Gyro_Offsets -- ---------------------- procedure Get_Gyro_Offsets (Offsets : out Angle_Rates; Sample_Count : in Long_Integer) is Sample : Angle_Rates; Total_X : Long_Integer := 0; Total_Y : Long_Integer := 0; Total_Z : Long_Integer := 0; begin for K in 1 .. Sample_Count loop Gyro.Get_Raw_Angle_Rates (Sample); Total_X := Total_X + Long_Integer (Sample.X); Total_Y := Total_Y + Long_Integer (Sample.Y); Total_Z := Total_Z + Long_Integer (Sample.Z); end loop; Offsets.X := Angle_Rate (Total_X / Sample_Count); Offsets.Y := Angle_Rate (Total_Y / Sample_Count); Offsets.Z := Angle_Rate (Total_Z / Sample_Count); end Get_Gyro_Offsets; ---------------------- -- Await_Data_Ready -- ---------------------- procedure Await_Data_Ready (This : in out Three_Axis_Gyroscope) is Max_Status_Attempts : constant := 10_000; -- This timeout value is arbitrary but must be sufficient for the -- slower gyro data rate options and higher clock rates. It need not be -- as small as possible, the point is not to hang forever. begin for K in 1 .. Max_Status_Attempts loop exit when Data_Status (This).ZYX_Available; if K = Max_Status_Attempts then raise Timeout with "no angle rate data"; end if; end loop; end Await_Data_Ready; begin LCD_Std_Out.Set_Font (Output_Utils.Selected_Font); Configure_Gyro; Sensitivity := Gyro.Full_Scale_Sensitivity; Print (0, 0, "Calibrating"); Get_Gyro_Offsets (Stable, Sample_Count => 100); -- arbitrary count Print_Static_Content (Stable); loop Await_Data_Ready (Gyro); Gyro.Get_Raw_Angle_Rates (Axes); -- print the raw values Print (Col_Raw, Line1_Raw, Axes.X'Img & " "); Print (Col_Raw, Line2_Raw, Axes.Y'Img & " "); Print (Col_Raw, Line3_Raw, Axes.Z'Img & " "); -- remove the computed stable offsets from the raw values Axes.X := Axes.X - Stable.X; Axes.Y := Axes.Y - Stable.Y; Axes.Z := Axes.Z - Stable.Z; -- print the values after the stable offset is removed Print (Col_Adjusted, Line1_Adjusted, Axes.X'Img & " "); Print (Col_Adjusted, Line2_Adjusted, Axes.Y'Img & " "); Print (Col_Adjusted, Line3_Adjusted, Axes.Z'Img & " "); -- scale the adjusted values Scaled_X := Float (Axes.X) * Sensitivity; Scaled_Y := Float (Axes.Y) * Sensitivity; Scaled_Z := Float (Axes.Z) * Sensitivity; -- print the final scaled values Print (Final_Column, Line1_Final, Scaled_X'Img & " "); Print (Final_Column, Line2_Final, Scaled_Y'Img & " "); Print (Final_Column, Line3_Final, Scaled_Z'Img & " "); end loop; end Demo_L3GD20;
-- Abstract: -- -- see spec -- -- Copyright (C) 2005, 2006, 2009 Stephen Leake. All Rights Reserved. -- -- This library is free software; you can redistribute it and/or -- modify it under terms of the GNU General Public License as -- published by the Free Software Foundation; either version 3, or (at -- your option) any later version. This library is distributed in the -- hope that it will be useful, but WITHOUT ANY WARRANTY; without even -- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -- PURPOSE. See the GNU General Public License for more details. You -- should have received a copy of the GNU General Public License -- distributed with this program; see file COPYING. If not, write to -- the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- MA 02111-1307, USA. -- -- As a special exception, if other files instantiate generics from -- this unit, or you link this unit with other files to produce an -- executable, this unit does not by itself cause the resulting -- executable to be covered by the GNU General Public License. This -- exception does not however invalidate any other reasons why the -- executable file might be covered by the GNU Public License. pragma License (Modified_GPL); function SAL.Generic_Decimal_Image (Item : in Number_Type; Width : in Natural) return String is pragma Warnings (Off); -- Avoid warning about "abs applied to non-negative value has no -- effect" for some instantiations. Temp : Integer := abs Integer (Item); -- IMPROVEME: need test for Decimal_Image, include constrained positive number_type pragma Warnings (On); Digit : Integer; Image : String (1 .. Width); begin for I in reverse Image'Range loop Digit := Temp mod 10; Temp := Temp / 10; Image (I) := Character'Val (Character'Pos ('0') + Digit); end loop; return Image; end SAL.Generic_Decimal_Image;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . T A S K I N G -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, 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. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNARL; 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. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides necessary type definitions for compiler interface -- Note: the compiler generates direct calls to this interface, via Rtsfind. -- Any changes to this interface may require corresponding compiler changes. with Ada.Exceptions; -- Used for Exception_Id -- Exception_Occurrence with System.Parameters; -- used for Size_Type with System.Task_Info; -- used for Task_Info_Type with System.Soft_Links; -- used for TSD with System.Task_Primitives; -- used for Private_Data with System.Stack_Usage; -- used for Stack_Analyzer with Unchecked_Conversion; package System.Tasking is pragma Preelaborate; ------------------- -- Locking Rules -- ------------------- -- The following rules must be followed at all times, to prevent -- deadlock and generally ensure correct operation of locking. -- Never lock a lock unless abort is deferred -- Never undefer abort while holding a lock -- Overlapping critical sections must be properly nested, and locks must -- be released in LIFO order. e.g., the following is not allowed: -- Lock (X); -- ... -- Lock (Y); -- ... -- Unlock (X); -- ... -- Unlock (Y); -- Locks with lower (smaller) level number cannot be locked -- while holding a lock with a higher level number. (The level -- 1. System.Tasking.PO_Simple.Protection.L (any PO lock) -- 2. System.Tasking.Initialization.Global_Task_Lock (in body) -- 3. System.Task_Primitives.Operations.Single_RTS_Lock -- 4. System.Tasking.Ada_Task_Control_Block.LL.L (any TCB lock) -- Clearly, there can be no circular chain of hold-and-wait -- relationships involving locks in different ordering levels. -- We used to have Global_Task_Lock before Protection.L but this was -- clearly wrong since there can be calls to "new" inside protected -- operations. The new ordering prevents these failures. -- Sometimes we need to hold two ATCB locks at the same time. To allow us -- to order the locking, each ATCB is given a unique serial number. If one -- needs to hold locks on several ATCBs at once, the locks with lower -- serial numbers must be locked first. -- We don't always need to check the serial numbers, since the serial -- numbers are assigned sequentially, and so: -- . The parent of a task always has a lower serial number. -- . The activator of a task always has a lower serial number. -- . The environment task has a lower serial number than any other task. -- . If the activator of a task is different from the task's parent, -- the parent always has a lower serial number than the activator. --------------------------------- -- Task_Id related definitions -- --------------------------------- type Ada_Task_Control_Block; type Task_Id is access all Ada_Task_Control_Block; Null_Task : constant Task_Id; type Task_List is array (Positive range <>) of Task_Id; function Self return Task_Id; pragma Inline (Self); -- This is the compiler interface version of this function. Do not call -- from the run-time system. function To_Task_Id is new Unchecked_Conversion (System.Address, Task_Id); function To_Address is new Unchecked_Conversion (Task_Id, System.Address); ----------------------- -- Enumeration types -- ----------------------- type Task_States is (Unactivated, -- Task has been created but has not been activated. -- It cannot be executing. -- Active states -- For all states from here down, the task has been activated. -- For all states from here down, except for Terminated, the task -- may be executing. -- Activator = null iff it has not yet completed activating. -- For all states from here down, -- the task has been activated, and may be executing. Runnable, -- Task is not blocked for any reason known to Ada. -- (It may be waiting for a mutex, though.) -- It is conceptually "executing" in normal mode. Terminated, -- The task is terminated, in the sense of ARM 9.3 (5). -- Any dependents that were waiting on terminate -- alternatives have been awakened and have terminated themselves. Activator_Sleep, -- Task is waiting for created tasks to complete activation Acceptor_Sleep, -- Task is waiting on an accept or selective wait statement Entry_Caller_Sleep, -- Task is waiting on an entry call Async_Select_Sleep, -- Task is waiting to start the abortable part of an -- asynchronous select statement. Delay_Sleep, -- Task is waiting on a select statement with only a delay -- alternative open. Master_Completion_Sleep, -- Master completion has two phases. -- In Phase 1 the task is sleeping in Complete_Master -- having completed a master within itself, -- and is waiting for the tasks dependent on that master to become -- terminated or waiting on a terminate Phase. Master_Phase_2_Sleep, -- In Phase 2 the task is sleeping in Complete_Master -- waiting for tasks on terminate alternatives to finish -- terminating. -- The following are special uses of sleep, for server tasks -- within the run-time system. Interrupt_Server_Idle_Sleep, Interrupt_Server_Blocked_Interrupt_Sleep, Timer_Server_Sleep, AST_Server_Sleep, Asynchronous_Hold, -- The task has been held by Asynchronous_Task_Control.Hold_Task Interrupt_Server_Blocked_On_Event_Flag -- The task has been blocked on a system call waiting for the -- completion event. ); type Call_Modes is (Simple_Call, Conditional_Call, Asynchronous_Call, Timed_Call); type Select_Modes is (Simple_Mode, Else_Mode, Terminate_Mode, Delay_Mode); subtype Delay_Modes is Integer; ------------------------------- -- Entry related definitions -- ------------------------------- Null_Entry : constant := 0; Max_Entry : constant := Integer'Last; Interrupt_Entry : constant := -2; Cancelled_Entry : constant := -1; type Entry_Index is range Interrupt_Entry .. Max_Entry; Null_Task_Entry : constant := Null_Entry; Max_Task_Entry : constant := Max_Entry; type Task_Entry_Index is new Entry_Index range Null_Task_Entry .. Max_Task_Entry; type Entry_Call_Record; type Entry_Call_Link is access all Entry_Call_Record; type Entry_Queue is record Head : Entry_Call_Link; Tail : Entry_Call_Link; end record; type Task_Entry_Queue_Array is array (Task_Entry_Index range <>) of Entry_Queue; ---------------------------------- -- Entry_Call_Record definition -- ---------------------------------- type Entry_Call_State is (Never_Abortable, -- the call is not abortable, and never can be Not_Yet_Abortable, -- the call is not abortable, but may become so Was_Abortable, -- the call is not abortable, but once was Now_Abortable, -- the call is abortable Done, -- the call has been completed Cancelled -- the call was asynchronous, and was cancelled ); -- Never_Abortable is used for calls that are made in a abort -- deferred region (see ARM 9.8(5-11), 9.8 (20)). -- Such a call is never abortable. -- The Was_ vs. Not_Yet_ distinction is needed to decide whether it -- is OK to advance into the abortable part of an async. select stmt. -- That is allowed iff the mode is Now_ or Was_. -- Done indicates the call has been completed, without cancellation, -- or no call has been made yet at this ATC nesting level, -- and so aborting the call is no longer an issue. -- Completion of the call does not necessarily indicate "success"; -- the call may be returning an exception if Exception_To_Raise is -- non-null. -- Cancelled indicates the call was cancelled, -- and so aborting the call is no longer an issue. -- The call is on an entry queue unless -- State >= Done, in which case it may or may not be still Onqueue. -- Please do not modify the order of the values, without checking -- all uses of this type. We rely on partial "monotonicity" of -- Entry_Call_Record.State to avoid locking when we access this -- value for certain tests. In particular: -- 1) Once State >= Done, we can rely that the call has been -- completed. If State >= Done, it will not -- change until the task does another entry call at this level. -- 2) Once State >= Was_Abortable, we can rely that the call has -- been queued abortably at least once, and so the check for -- whether it is OK to advance to the abortable part of an -- async. select statement does not need to lock anything. type Restricted_Entry_Call_Record is record Self : Task_Id; -- ID of the caller Mode : Call_Modes; State : Entry_Call_State; pragma Atomic (State); -- Indicates part of the state of the call. -- -- Protection: If the call is not on a queue, it should only be -- accessed by Self, and Self does not need any lock to modify this -- field. -- -- Once the call is on a queue, the value should be something other -- than Done unless it is cancelled, and access is controller by the -- "server" of the queue -- i.e., the lock of Checked_To_Protection -- (Call_Target) if the call record is on the queue of a PO, or the -- lock of Called_Target if the call is on the queue of a task. See -- comments on type declaration for more details. Uninterpreted_Data : System.Address; -- Data passed by the compiler Exception_To_Raise : Ada.Exceptions.Exception_Id; -- The exception to raise once this call has been completed without -- being aborted. end record; pragma Suppress_Initialization (Restricted_Entry_Call_Record); ------------------------------------------- -- Task termination procedure definition -- ------------------------------------------- -- We need to redefine here these types (already defined in -- Ada.Task_Termination) for avoiding circular dependencies. type Cause_Of_Termination is (Normal, Abnormal, Unhandled_Exception); -- Possible causes for task termination: -- -- Normal means that the task terminates due to completing the -- last sentence of its body, or as a result of waiting on a -- terminate alternative. -- Abnormal means that the task terminates because it is being aborted -- handled_Exception means that the task terminates because of exception -- raised by by the execution of its task_body. type Termination_Handler is access protected procedure (Cause : Cause_Of_Termination; T : Task_Id; X : Ada.Exceptions.Exception_Occurrence); -- Used to represent protected procedures to be executed when task -- terminates. ------------------------------------ -- Task related other definitions -- ------------------------------------ type Activation_Chain is limited private; -- Comment required ??? type Activation_Chain_Access is access all Activation_Chain; -- Comment required ??? type Task_Procedure_Access is access procedure (Arg : System.Address); type Access_Boolean is access all Boolean; function Detect_Blocking return Boolean; pragma Inline (Detect_Blocking); -- Return whether the Detect_Blocking pragma is enabled ---------------------------------------------- -- Ada_Task_Control_Block (ATCB) definition -- ---------------------------------------------- -- Notes on protection (synchronization) of TRTS data structures -- Any field of the TCB can be written by the activator of a task when the -- task is created, since no other task can access the new task's -- state until creation is complete. -- The protection for each field is described in a comment starting with -- "Protection:". -- When a lock is used to protect an ATCB field, this lock is simply named -- Some protection is described in terms of tasks related to the -- ATCB being protected. These are: -- Self: The task which is controlled by this ATCB -- Acceptor: A task accepting a call from Self -- Caller: A task calling an entry of Self -- Parent: The task executing the master on which Self depends -- Dependent: A task dependent on Self -- Activator: The task that created Self and initiated its activation -- Created: A task created and activated by Self -- Note: The order of the fields is important to implement efficiently -- tasking support under gdb. -- Currently gdb relies on the order of the State, Parent, Base_Priority, -- Task_Image, Task_Image_Len, Call and LL fields. ------------------------- -- Common ATCB section -- ------------------------- -- Section used by all GNARL implementations (regular and restricted) type Common_ATCB is record State : Task_States; pragma Atomic (State); -- Encodes some basic information about the state of a task, -- including whether it has been activated, whether it is sleeping, -- and whether it is terminated. -- -- Protection: Self.L Parent : Task_Id; -- The task on which this task depends. -- See also Master_Level and Master_Within. Base_Priority : System.Any_Priority; -- Base priority, not changed during entry calls, only changed -- via dynamic priorities package. -- -- Protection: Only written by Self, accessed by anyone Current_Priority : System.Any_Priority; -- Active priority, except that the effects of protected object -- priority ceilings are not reflected. This only reflects explicit -- priority changes and priority inherited through task activation -- and rendezvous. -- -- Ada 95 notes: In Ada 95, this field will be transferred to the -- Priority field of an Entry_Calls component when an entry call -- is initiated. The Priority of the Entry_Calls component will not -- change for the duration of the call. The accepting task can -- use it to boost its own priority without fear of its changing in -- the meantime. -- -- This can safely be used in the priority ordering -- of entry queues. Once a call is queued, its priority does not -- change. -- -- Since an entry call cannot be made while executing -- a protected action, the priority of a task will never reflect a -- priority ceiling change at the point of an entry call. -- -- Protection: Only written by Self, and only accessed when Acceptor -- accepts an entry or when Created activates, at which points Self is -- suspended. Protected_Action_Nesting : Natural; pragma Atomic (Protected_Action_Nesting); -- The dynamic level of protected action nesting for this task. This -- field is needed for checking whether potentially blocking operations -- are invoked from protected actions. pragma Atomic is used because it -- can be read/written from protected interrupt handlers. Task_Image : String (1 .. 32); -- Hold a string that provides a readable id for task, -- built from the variable of which it is a value or component. Task_Image_Len : Natural; -- Actual length of Task_Image Call : Entry_Call_Link; -- The entry call that has been accepted by this task. -- -- Protection: Self.L. Self will modify this field when Self.Accepting -- is False, and will not need the mutex to do so. Once a task sets -- Pending_ATC_Level = 0, no other task can access this field. LL : aliased Task_Primitives.Private_Data; -- Control block used by the underlying low-level tasking service -- (GNULLI). -- -- Protection: This is used only by the GNULLI implementation, which -- takes care of all of its synchronization. Task_Arg : System.Address; -- The argument to task procedure. Provide a handle for discriminant -- information -- -- Protection: Part of the synchronization between Self and Activator. -- Activator writes it, once, before Self starts executing. Thereafter, -- Self only reads it. Task_Entry_Point : Task_Procedure_Access; -- Information needed to call the procedure containing the code for -- the body of this task. -- -- Protection: Part of the synchronization between Self and Activator. -- Activator writes it, once, before Self starts executing. Self reads -- it, once, as part of its execution. Compiler_Data : System.Soft_Links.TSD; -- Task-specific data needed by the compiler to store per-task -- structures. -- -- Protection: Only accessed by Self All_Tasks_Link : Task_Id; -- Used to link this task to the list of all tasks in the system -- -- Protection: RTS_Lock Activation_Link : Task_Id; -- Used to link this task to a list of tasks to be activated -- -- Protection: Only used by Activator Activator : Task_Id; -- The task that created this task, either by declaring it as a task -- object or by executing a task allocator. The value is null iff Self -- has completed activation. -- -- Protection: Set by Activator before Self is activated, and only read -- and modified by Self after that. Wait_Count : Integer; -- This count is used by a task that is waiting for other tasks. At all -- other times, the value should be zero. It is used differently in -- several different states. Since a task cannot be in more than one of -- these states at the same time, a single counter suffices. -- -- Protection: Self.L -- Activator_Sleep -- This is the number of tasks that this task is activating, i.e. the -- children that have started activation but have not completed it. -- -- Protection: Self.L and Created.L. Both mutexes must be locked, since -- Self.Activation_Count and Created.State must be synchronized. -- Master_Completion_Sleep (phase 1) -- This is the number dependent tasks of a master being completed by -- Self that are not activated, not terminated, and not waiting on a -- terminate alternative. -- Master_Completion_2_Sleep (phase 2) -- This is the count of tasks dependent on a master being completed by -- Self which are waiting on a terminate alternative. Elaborated : Access_Boolean; -- Pointer to a flag indicating that this task's body has been -- elaborated. The flag is created and managed by the -- compiler-generated code. -- -- Protection: The field itself is only accessed by Activator. The flag -- that it points to is updated by Master and read by Activator; access -- is assumed to be atomic. Activation_Failed : Boolean; -- Set to True if activation of a chain of tasks fails, -- so that the activator should raise Tasking_Error. Task_Info : System.Task_Info.Task_Info_Type; -- System-specific attributes of the task as specified by the -- Task_Info pragma. Analyzer : System.Stack_Usage.Stack_Analyzer; -- For storing informations used to measure the stack usage Global_Task_Lock_Nesting : Natural; -- This is the current nesting level of calls to -- System.Tasking.Initialization.Lock_Task. This allows a task to call -- Lock_Task multiple times without deadlocking. A task only locks -- Global_Task_Lock when its Global_Task_Lock_Nesting goes from 0 to 1, -- and only unlocked when it goes from 1 to 0. -- -- Protection: Only accessed by Self Fall_Back_Handler : Termination_Handler; -- This is the fall-back handler that applies to the dependent tasks of -- the task. -- -- Protection: Self.L Specific_Handler : Termination_Handler; -- This is the specific handler that applies only to this task, and not -- any of its dependent tasks. -- -- Protection: Self.L end record; --------------------------------------- -- Restricted_Ada_Task_Control_Block -- --------------------------------------- -- This type should only be used by the restricted GNARLI and by -- restricted GNULL implementations to allocate an ATCB (see -- System.Task_Primitives.Operations.New_ATCB) that will take -- significantly less memory. -- Note that the restricted GNARLI should only access fields that are -- present in the Restricted_Ada_Task_Control_Block structure. type Restricted_Ada_Task_Control_Block (Entry_Num : Task_Entry_Index) is record Common : Common_ATCB; -- The common part between various tasking implementations Entry_Call : aliased Restricted_Entry_Call_Record; -- Protection: This field is used on entry call "queues" associated -- with protected objects, and is protected by the protected object -- lock. end record; pragma Suppress_Initialization (Restricted_Ada_Task_Control_Block); Interrupt_Manager_ID : Task_Id; -- This task ID is declared here to break circular dependencies. -- Also declare Interrupt_Manager_ID after Task_Id is known, to avoid -- generating unneeded finalization code. ----------------------- -- List of all Tasks -- ----------------------- All_Tasks_List : Task_Id; -- Global linked list of all tasks ------------------------------------------ -- Regular (non restricted) definitions -- ------------------------------------------ -------------------------------- -- Master Related Definitions -- -------------------------------- subtype Master_Level is Integer; subtype Master_ID is Master_Level; -- Normally, a task starts out with internal master nesting level one -- larger than external master nesting level. It is incremented to one by -- Enter_Master, which is called in the task body only if the compiler -- thinks the task may have dependent tasks. It is set to for the -- environment task, the level 2 is reserved for server tasks of the -- run-time system (the so called "independent tasks"), and the level 3 is -- for the library level tasks. Environment_Task_Level : constant Master_Level := 1; Independent_Task_Level : constant Master_Level := 2; Library_Task_Level : constant Master_Level := 3; ------------------------------ -- Task size, priority info -- ------------------------------ Unspecified_Priority : constant Integer := System.Priority'First - 1; Priority_Not_Boosted : constant Integer := System.Priority'First - 1; -- Definition of Priority actually has to come from the RTS configuration subtype Rendezvous_Priority is Integer range Priority_Not_Boosted .. System.Any_Priority'Last; ------------------------------------ -- Rendezvous related definitions -- ------------------------------------ No_Rendezvous : constant := 0; Max_Select : constant Integer := Integer'Last; -- RTS-defined subtype Select_Index is Integer range No_Rendezvous .. Max_Select; -- type Select_Index is range No_Rendezvous .. Max_Select; subtype Positive_Select_Index is Select_Index range 1 .. Select_Index'Last; type Accept_Alternative is record Null_Body : Boolean; S : Task_Entry_Index; end record; type Accept_List is array (Positive_Select_Index range <>) of Accept_Alternative; type Accept_List_Access is access constant Accept_List; ----------------------------------- -- ATC_Level related definitions -- ----------------------------------- Max_ATC_Nesting : constant Natural := 20; subtype ATC_Level_Base is Integer range 0 .. Max_ATC_Nesting; ATC_Level_Infinity : constant ATC_Level_Base := ATC_Level_Base'Last; subtype ATC_Level is ATC_Level_Base range 0 .. ATC_Level_Base'Last - 1; subtype ATC_Level_Index is ATC_Level range 1 .. ATC_Level'Last; ---------------------------------- -- Entry_Call_Record definition -- ---------------------------------- type Entry_Call_Record is record Self : Task_Id; -- ID of the caller Mode : Call_Modes; State : Entry_Call_State; pragma Atomic (State); -- Indicates part of the state of the call -- -- Protection: If the call is not on a queue, it should only be -- accessed by Self, and Self does not need any lock to modify this -- field. Once the call is on a queue, the value should be something -- other than Done unless it is cancelled, and access is controller by -- the "server" of the queue -- i.e., the lock of Checked_To_Protection -- (Call_Target) if the call record is on the queue of a PO, or the -- lock of Called_Target if the call is on the queue of a task. See -- comments on type declaration for more details. Uninterpreted_Data : System.Address; -- Data passed by the compiler Exception_To_Raise : Ada.Exceptions.Exception_Id; -- The exception to raise once this call has been completed without -- being aborted. Prev : Entry_Call_Link; Next : Entry_Call_Link; Level : ATC_Level; -- One of Self and Level are redundant in this implementation, since -- each Entry_Call_Record is at Self.Entry_Calls (Level). Since we must -- have access to the entry call record to be reading this, we could -- get Self from Level, or Level from Self. However, this requires -- non-portable address arithmetic. E : Entry_Index; Prio : System.Any_Priority; -- The above fields are those that there may be some hope of packing. -- They are gathered together to allow for compilers that lay records -- out contiguously, to allow for such packing. Called_Task : Task_Id; pragma Atomic (Called_Task); -- Use for task entry calls. The value is null if the call record is -- not in use. Conversely, unless State is Done and Onqueue is false, -- Called_Task points to an ATCB. -- -- Protection: Called_Task.L Called_PO : System.Address; pragma Atomic (Called_PO); -- Similar to Called_Task but for protected objects -- -- Note that the previous implementation tried to merge both -- Called_Task and Called_PO but this ended up in many unexpected -- complications (e.g having to add a magic number in the ATCB, which -- caused gdb lots of confusion) with no real gain since the -- Lock_Server implementation still need to loop around chasing for -- pointer changes even with a single pointer. Acceptor_Prev_Call : Entry_Call_Link; -- For task entry calls only Acceptor_Prev_Priority : Rendezvous_Priority := Priority_Not_Boosted; -- For task entry calls only. The priority of the most recent prior -- call being serviced. For protected entry calls, this function should -- be performed by GNULLI ceiling locking. Cancellation_Attempted : Boolean := False; pragma Atomic (Cancellation_Attempted); -- Cancellation of the call has been attempted. -- Consider merging this into State??? Requeue_With_Abort : Boolean := False; -- Temporary to tell caller whether requeue is with abort. -- Find a better way of doing this ??? Needs_Requeue : Boolean := False; -- Temporary to tell acceptor of task entry call that -- Exceptional_Complete_Rendezvous needs to do requeue. end record; ------------------------------------ -- Task related other definitions -- ------------------------------------ type Access_Address is access all System.Address; -- Comment on what this is used for ??? pragma No_Strict_Aliasing (Access_Address); -- This type is used in contexts where aliasing may be an issue (see -- for example s-tataat.adb), so we avoid any incorrect aliasing -- assumptions. ---------------------------------------------- -- Ada_Task_Control_Block (ATCB) definition -- ---------------------------------------------- type Entry_Call_Array is array (ATC_Level_Index) of aliased Entry_Call_Record; type Direct_Index is range 0 .. Parameters.Default_Attribute_Count; subtype Direct_Index_Range is Direct_Index range 1 .. Direct_Index'Last; -- Attributes with indices in this range are stored directly in the task -- control block. Such attributes must be Address-sized. Other attributes -- will be held in dynamically allocated records chained off of the task -- control block. type Direct_Attribute_Element is mod Memory_Size; pragma Atomic (Direct_Attribute_Element); type Direct_Attribute_Array is array (Direct_Index_Range) of aliased Direct_Attribute_Element; type Direct_Index_Vector is mod 2 ** Parameters.Default_Attribute_Count; -- This is a bit-vector type, used to store information about -- the usage of the direct attribute fields. type Task_Serial_Number is mod 2 ** 64; -- Used to give each task a unique serial number type Ada_Task_Control_Block (Entry_Num : Task_Entry_Index) is record Common : Common_ATCB; -- The common part between various tasking implementations Entry_Calls : Entry_Call_Array; -- An array of entry calls -- -- Protection: The elements of this array are on entry call queues -- associated with protected objects or task entries, and are protected -- by the protected object lock or Acceptor.L, respectively. New_Base_Priority : System.Any_Priority; -- New value for Base_Priority (for dynamic priorities package) -- -- Protection: Self.L Open_Accepts : Accept_List_Access; -- This points to the Open_Accepts array of accept alternatives passed -- to the RTS by the compiler-generated code to Selective_Wait. It is -- non-null iff this task is ready to accept an entry call. -- -- Protection: Self.L Chosen_Index : Select_Index; -- The index in Open_Accepts of the entry call accepted by a selective -- wait executed by this task. -- -- Protection: Written by both Self and Caller. Usually protected by -- Self.L. However, once the selection is known to have been written it -- can be accessed without protection. This happens after Self has -- updated it itself using information from a suspended Caller, or -- after Caller has updated it and awakened Self. Master_of_Task : Master_Level; -- The task executing the master of this task, and the ID of this task's -- master (unique only among masters currently active within Parent). -- -- Protection: Set by Activator before Self is activated, and read -- after Self is activated. Master_Within : Master_Level; -- The ID of the master currently executing within this task; that is, -- the most deeply nested currently active master. -- -- Protection: Only written by Self, and only read by Self or by -- dependents when Self is attempting to exit a master. Since Self will -- not write this field until the master is complete, the -- synchronization should be adequate to prevent races. Alive_Count : Integer := 0; -- Number of tasks directly dependent on this task (including itself) -- that are still "alive", i.e. not terminated. -- -- Protection: Self.L Awake_Count : Integer := 0; -- Number of tasks directly dependent on this task (including itself) -- still "awake", i.e., are not terminated and not waiting on a -- terminate alternative. -- -- Invariant: Awake_Count <= Alive_Count -- Protection: Self.L -- Beginning of flags Aborting : Boolean := False; pragma Atomic (Aborting); -- Self is in the process of aborting. While set, prevents multiple -- abort signals from being sent by different aborter while abort -- is acted upon. This is essential since an aborter which calls -- Abort_To_Level could set the Pending_ATC_Level to yet a lower level -- (than the current level), may be preempted and would send the -- abort signal when resuming execution. At this point, the abortee -- may have completed abort to the proper level such that the -- signal (and resulting abort exception) are not handled any more. -- In other words, the flag prevents a race between multiple aborters -- -- Protection: protected by atomic access. ATC_Hack : Boolean := False; pragma Atomic (ATC_Hack); -- ????? -- Temporary fix, to allow Undefer_Abort to reset Aborting in the -- handler for Abort_Signal that encloses an async. entry call. -- For the longer term, this should be done via code in the -- handler itself. Callable : Boolean := True; -- It is OK to call entries of this task Dependents_Aborted : Boolean := False; -- This is set to True by whichever task takes responsibility for -- aborting the dependents of this task. -- -- Protection: Self.L Interrupt_Entry : Boolean := False; -- Indicates if one or more Interrupt Entries are attached to the task. -- This flag is needed for cleaning up the Interrupt Entry bindings. Pending_Action : Boolean := False; -- Unified flag indicating some action needs to be take when abort -- next becomes undeferred. Currently set if: -- . Pending_Priority_Change is set -- . Pending_ATC_Level is changed -- . Requeue involving POs -- (Abortable field may have changed and the Wait_Until_Abortable -- has to recheck the abortable status of the call.) -- . Exception_To_Raise is non-null -- -- Protection: Self.L -- -- This should never be reset back to False outside of the procedure -- Do_Pending_Action, which is called by Undefer_Abort. It should only -- be set to True by Set_Priority and Abort_To_Level. Pending_Priority_Change : Boolean := False; -- Flag to indicate pending priority change (for dynamic priorities -- package). The base priority is updated on the next abort -- completion point (aka. synchronization point). -- -- Protection: Self.L Terminate_Alternative : Boolean := False; -- Task is accepting Select with Terminate Alternative -- -- Protection: Self.L -- End of flags -- Beginning of counts ATC_Nesting_Level : ATC_Level := 1; -- The dynamic level of ATC nesting (currently executing nested -- asynchronous select statements) in this task. -- Protection: Self_ID.L. Only Self reads or updates this field. -- Decrementing it deallocates an Entry_Calls component, and care must -- be taken that all references to that component are eliminated before -- doing the decrement. This in turn will require locking a protected -- object (for a protected entry call) or the Acceptor's lock (for a -- task entry call). No other task should attempt to read or modify -- this value. Deferral_Level : Natural := 1; -- This is the number of times that Defer_Abortion has been called by -- this task without a matching Undefer_Abortion call. Abortion is only -- allowed when this zero. It is initially 1, to protect the task at -- startup. -- Protection: Only updated by Self; access assumed to be atomic Pending_ATC_Level : ATC_Level_Base := ATC_Level_Infinity; -- The ATC level to which this task is currently being aborted. If the -- value is zero, the entire task has "completed". That may be via -- abort, exception propagation, or normal exit. If the value is -- ATC_Level_Infinity, the task is not being aborted to any level. If -- the value is positive, the task has not completed. This should ONLY -- be modified by Abort_To_Level and Exit_One_ATC_Level. -- -- Protection: Self.L Serial_Number : Task_Serial_Number; -- A growing number to provide some way to check locking rules/ordering Known_Tasks_Index : Integer := -1; -- Index in the System.Tasking.Debug.Known_Tasks array User_State : Long_Integer := 0; -- User-writeable location, for use in debugging tasks; also provides a -- simple task specific data. Direct_Attributes : Direct_Attribute_Array; -- For task attributes that have same size as Address Is_Defined : Direct_Index_Vector := 0; -- Bit I is 1 iff Direct_Attributes (I) is defined Indirect_Attributes : Access_Address; -- A pointer to chain of records for other attributes that are not -- address-sized, including all tagged types. Entry_Queues : Task_Entry_Queue_Array (1 .. Entry_Num); -- An array of task entry queues -- -- Protection: Self.L. Once a task has set Self.Stage to Completing, it -- has exclusive access to this field. end record; -------------------- -- Initialization -- -------------------- procedure Initialize; -- This procedure constitutes the first part of the initialization of the -- GNARL. This includes creating data structures to make the initial thread -- into the environment task. The last part of the initialization is done -- in System.Tasking.Initialization or System.Tasking.Restricted.Stages. -- All the initializations used to be in Tasking.Initialization, but this -- is no longer possible with the run time simplification (including -- optimized PO and the restricted run time) since one cannot rely on -- System.Tasking.Initialization being present, as was done before. procedure Initialize_ATCB (Self_ID : Task_Id; Task_Entry_Point : Task_Procedure_Access; Task_Arg : System.Address; Parent : Task_Id; Elaborated : Access_Boolean; Base_Priority : System.Any_Priority; Task_Info : System.Task_Info.Task_Info_Type; Stack_Size : System.Parameters.Size_Type; T : Task_Id; Success : out Boolean); -- Initialize fields of a TCB and link into global TCB structures Call -- this only with abort deferred and holding RTS_Lock. Need more -- documentation, mention T, and describe Success ??? private Null_Task : constant Task_Id := null; type Activation_Chain is record T_ID : Task_Id; end record; pragma Volatile (Activation_Chain); -- Activation_chain is an in-out parameter of initialization procedures -- and it must be passed by reference because the init proc may terminate -- abnormally after creating task components, and these must be properly -- registered for removal (Expunge_Unactivated_Tasks). end System.Tasking;
with AWS.Utils; with WBlocks.Widget_Counter; package body @_Project_Name_@.Ajax is use AWS; use AWS.Services; ------------------ -- Onclick_Incr -- ------------------ procedure Onclick_Incr (Request : in Status.Data; Context : not null access Web_Block.Context.Object; Translations : in out Templates.Translate_Set) is N : Natural := 0; begin if Context.Exist ("N") then N := Natural'Value (Context.Get_Value ("N")); end if; N := N + 1; Context.Set_Value ("N", Utils.Image (N)); Templates.Insert (Translations, Templates.Assoc (WBlocks.Widget_Counter.COUNTER, N)); end Onclick_Incr; end @_Project_Name_@.Ajax;
-------------------------------------------------------------------------------- -- MIT License -- -- Copyright (c) 2020 Zane Myers -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in all -- copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -- SOFTWARE. -------------------------------------------------------------------------------- with Vulkan.Math.GenFType; with Vulkan.Math.GenDType; with Vulkan.Math.Vec3; with Vulkan.Math.Dvec3; use Vulkan.Math.GenFType; use Vulkan.Math.GenDType; use Vulkan.Math.Vec3; use Vulkan.Math.Dvec3; -------------------------------------------------------------------------------- --< @group Vulkan Math Functions -------------------------------------------------------------------------------- --< @summary --< This package provides GLSL Geometry Built-in functions. --< --< @description --< All geometry functions operate on vectors as objects. -------------------------------------------------------------------------------- package Vulkan.Math.Geometry is pragma Preelaborate; pragma Pure; ---------------------------------------------------------------------------- --< @summary --< Calculate the magnitude of the vector. --< --< @description --< Calculate the magnitude of the GenFType vector, using the formula: --< --< Magnitude = sqrt(sum(x0^2, ..., xn^2)) --< --< @param x --< The vector to determine the magnitude for. --< --< @return --< The magnitude of the vector. ---------------------------------------------------------------------------- function Mag (x : in Vkm_GenFType) return Vkm_Float; ---------------------------------------------------------------------------- --< @summary --< Calculate the magnitude of the vector. --< --< @description --< Calculate the magnitude of the Vkm_GenDType vector, using the formula: --< --< Magnitude = sqrt(sum(x0^2, ..., xn^2)) --< --< @param x --< The vector to determine the magnitude for. --< --< @return --< The magnitude of the vector. ---------------------------------------------------------------------------- function Mag (x : in Vkm_GenDType) return Vkm_Double; ---------------------------------------------------------------------------- --< @summary --< Calculate the distance between two points, p0 and p1. --< --< @description --< Calculate the distance between two GenFType vectors representing points p0 --< and p1, using the formula: --< --< Distance = Magnitude(p0 - p1) --< --< @param p0 --< A vector which represents the first point. --< --< @param p1 --< A vector which represents the seconds point. --< --< @return --< The distance between the two points. ---------------------------------------------------------------------------- function Distance (p0, p1 : in Vkm_GenFType) return Vkm_Float is (Mag(p0 - p1)) with Inline; ---------------------------------------------------------------------------- --< @summary --< Calculate the distance between two points, p0 and p1. --< --< @description --< Calculate the distance between two GenDType vectors representing points p0 --< and p1, using the formula: --< --< Distance = Magnitude(p0 - p1) --< --< @param p0 --< A vector which represents the first point. --< --< @param p1 --< A vector which represents the seconds point. --< --< @return --< The distance between the two points. ---------------------------------------------------------------------------- function Distance (p0, p1 : in Vkm_GenDType) return Vkm_Double is (Mag(p0 - p1)) with Inline; ---------------------------------------------------------------------------- --< @summary --< Calculate the dot product between two vectors. --< --< @description --< Calculate the dot product between two GenFType vectors. --< --< x dot y = --< \ [x1 ... xN] . | y1 | = x1*y1 + ... xN * yN --< \ | ... | --< \ | yN | --< --< @param x --< The left vector in the dot product operation. --< --< @param y --< The right vector in the dot product operation. --< --< --< @return The dot product of the two vectors. ---------------------------------------------------------------------------- function Dot (x, y : in Vkm_GenFType) return Vkm_Float; ---------------------------------------------------------------------------- --< @summary --< Calculate the dot product between two vectors. --< --< @description --< Calculate the dot product between the two GenDType vectors. --< --< x dot y = --< \ [x1 ... xN] . | y1 | = x1*y1 + ... xN * yN --< \ | ... | --< \ | yN | --< --< @param x --< The left vector in the dot product operation. --< --< @param y --< The right vector in the dot product operation. --< --< @return --< The dot product of the two vectors. ---------------------------------------------------------------------------- function Dot (x, y : in Vkm_GenDType) return Vkm_Double; ---------------------------------------------------------------------------- --< @summary --< Calculate the cross product between two 3 dimmensional vectors. --< --< @description --< Calculate the cross product between two 3 dimmensional GenFType vectors. --< --< x cross y = --< \ | i j k | = i | x1 x2 | -j | x0 x2 | +k | x0 x1 | = | +(x1*y2 - x2*y1) | --< \ | x0 x1 x2 | | y1 y2 | | y0 y2 | | y0 y1 | | -(x0*y2 - x2*y1) | --< \ | y0 y1 y2 | | +(x0*y1 - x1*y0) | --< --< @param x --< The left vector in the cross product operation. --< --< @param y --< The right vector in the cross product operation. --< --< @return --< The cross product of the two vectors. ---------------------------------------------------------------------------- function Cross (x, y : in Vkm_Vec3 ) return Vkm_Vec3; ---------------------------------------------------------------------------- --< @summary --< Calculate the cross product between two 3 dimmensional vectors. --< --< @description --< Calculate the cross product between two 3 dimmensional GenDType vectors. --< --< x cross y = --< \ | i j k | = i | x1 x2 | -j | x0 x2 | +k | x0 x1 | = | +(x1*y2 - x2*y1) | --< \ | x0 x1 x2 | | y1 y2 | | y0 y2 | | y0 y1 | | -(x0*y2 - x2*y1) | --< \ | y0 y1 y2 | | +(x0*y1 - x1*y0) | --< --< @param x --< The left vector in the cross product operation. --< --< @param y --< The right vector in the cross product operation. --< --< @return --< The cross product of the two vectors. ---------------------------------------------------------------------------- function Cross (x, y : in Vkm_Dvec3) return Vkm_Dvec3; ---------------------------------------------------------------------------- --< @summary --< Normalize a vector. --< --< @description --< Normalize the GenFType vector so that it has a magnitude of 1. --< --< @param x --< The vector to normalize. --< --< @return --< The normalized vector. ---------------------------------------------------------------------------- function Normalize(x : in Vkm_GenFType) return Vkm_GenFType is (x / Mag(x)) with inline; ---------------------------------------------------------------------------- --< @summary --< Normalize a vector. --< --< @description --< Normalize the GenDType vector so that it has a magnitude of 1. --< --< @param x --< The vector to normalize. --< --< @return --< The normalized vector. ---------------------------------------------------------------------------- function Normalize(x : in Vkm_GenDType) return Vkm_GenDType is (x / Mag(x)) with inline; ---------------------------------------------------------------------------- --< @summary --< Force a normal vector to face an incident vector. --< --< @description --< Return a normal vector N as-is if an incident vector I points in the opposite --< direction of a reference normal vector, Nref. Otherwise, if I is pointing --< in the same direction as the reference normal, flip the normal vector N. --< --< - If Nref dot I is negative, these vectors are not facing the same direction. --< - If Nref dot I is positive, these vectors are facing in the same direction. --< - If Nref dot I is zero, these two vectors are orthogonal to each other. --< --< @param n --< The normal vector N --< --< @param i --< The incident vector I --< --< @param nref --< The reference normal vector Nref --< --< @return --< If I dot Nref < 0, return N. Otherwise return -N. ---------------------------------------------------------------------------- function Face_Forward(n, i, nref : in Vkm_GenFType) return Vkm_GenFType is (if Dot(nref,i) < 0.0 then n else -n) with Inline; ---------------------------------------------------------------------------- --< @summary --< Force a normal vector to face an incident vector. --< --< @description --< Return a normal vector N as-is if an incident vector I points in the opposite --< direction of a reference normal vector, Nref. Otherwise, if I is pointing --< in the same direction as the reference normal, flip the normal vector N. --< --< - If Nref dot I is negative, these vectors are not facing the same direction. --< - If Nref dot I is positive, these vectors are facing in the same direction. --< - If Nref dot I is zero, these two vectors are orthogonal to each other. --< --< @param n --< The normal vector N --< --< @param i --< The incident vector I --< --< @param nref --< The reference normal vector Nref --< --< @return --< If I dot Nref < 0, return N. Otherwise return -N. ---------------------------------------------------------------------------- function Face_Forward(n, i, nref : in Vkm_GenDType) return Vkm_GenDType is (if Dot(nref,i) < 0.0 then n else -n) with Inline; ---------------------------------------------------------------------------- --< @summary --< Calculate the reflection of an incident vector using the normal vector --< for the surface. --< --< @description --< For the incident vector I and surface orientation N, returns the reflection --< direction: --< --< I - 2 * ( N dot I ) * N. --< --< @param i --< The incident vector I. --< --< @param n --< The normal vector N. N should already be normalized. --< --< @return The reflection direction. ---------------------------------------------------------------------------- function Reflect(i, n : in Vkm_GenFType) return Vkm_GenFType is (i - 2.0 * Dot(n, i) * n) with Inline; ---------------------------------------------------------------------------- --< @summary --< Calculate the reflection of an incident vector using the normal vector --< for the surface. --< --< @description --< For the incident vector I and surface orientation N, returns the reflection --< direction: --< --< I - 2 * ( N dot I ) * N. --< --< @param i --< The incident vector I. --< --< @param n --< The normal vector N. N should already be normalized. --< --< @return The reflection direction. ---------------------------------------------------------------------------- function Reflect(i, n : in Vkm_GenDType) return Vkm_GenDType is (i - 2.0 * Dot(n, i) * n) with Inline; ---------------------------------------------------------------------------- --< @summary --< Calculate the refraction vector for the incident vector I travelling --< through the surface with normal N and a ratio of refraction eta. --< --< @description --< For the indident vector I and surface normal N, and the ratio of refraction --< eta, calculate the refraction vector. --< --< k = 1.0 - eta^2 (1.0 - dot(N,I)^2) --< If k < 0, the result is a vector of all zeros. --< Else , the result is: eta*I - (eta*dot(N,I) + sqrt(k))*N --< --< @param i --< The incident vector I. --< --< @param n --< The surface normal vector N. --< --< @param eta --< The indices of refraction. --< --< @return --< The refraction vector. ---------------------------------------------------------------------------- function Refract(i, n : in Vkm_GenFType; eta : in Vkm_Float ) return Vkm_GenFType; ---------------------------------------------------------------------------- --< @summary --< Calculate the refraction vector for the incident vector I travelling --< through the surface with normal N and a ratio of refraction eta. --< --< @description --< For the indident vector I and surface normal N, and the ratio of refraction --< eta, calculate the refraction vector. --< --< k = 1.0 - eta^2 (1.0 - dot(N,I)^2) --< If k < 0, the result is a vector of all zeros. --< Else , the result is: eta*I - (eta*dot(N,I) + sqrt(k))*N --< --< @param i --< The incident vector I. --< --< @param n --< The surface normal vector N. --< --< @param eta --< The indices of refraction. --< --< @return --< The refraction vector. ---------------------------------------------------------------------------- function Refract(i, n : in Vkm_GenDType; eta : in Vkm_Double ) return Vkm_GenDType; end Vulkan.Math.Geometry;
with impact.d3.Collision.Configuration.default, impact.d3.Collision.Broadphase.bounding_volume_Tree, impact.d3.Dispatcher.collision, impact.d3.constraint_Solver.sequential_impulse, impact.d3.Space.dynamic.discrete, impact.d3.Shape.convex.internal.polyhedral.box, impact.d3.Object.rigid, impact.d3.motion_State.default, impact.d3.Transform, ada.text_IO; with any_math.any_Algebra.any_linear.any_d3; procedure launch_box_box_collision_Test -- -- This is a test of sphere on sphere collision. -- is use Impact.d3, impact.d3.Collision.Configuration.default, impact.d3.Transform, impact.Math, ada.text_IO; collisionConfiguration : access Collision.Configuration.item'Class := new_default_Configuration; -- -- Collision configuration contains default setup for memory, collision setup. -- Advanced users can create their own configuration. -- Use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded). -- the_Dispatcher : access Dispatcher.collision.item := new Dispatcher.collision.item' (Dispatcher.collision.to_Dispatcher (collisionConfiguration.all'unchecked_access)); -- 'btDbvtBroadphase' is a good general purpose broadphase. You can also try out btAxis3Sweep. -- overlappingPairCache : Collision.Broadphase.bounding_volume_Tree.view := Collision.Broadphase.bounding_volume_Tree.new_Broadphase; -- The default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded) -- solver : access constraint_Solver.sequential_impulse.item'Class := new constraint_Solver.sequential_impulse.item; dynamicsWorld : access Space.dynamic.discrete.item'Class := new Space.dynamic.discrete.item' (Space.dynamic.discrete.Forge.to_Space (the_Dispatcher, overlappingPairCache, solver.all'unchecked_access, collisionConfiguration)); -- Create a few basic rigid bodies. -- ground_Shape : Shape.convex.internal.polyhedral.box.view := new Shape.convex.internal.polyhedral.box.item' (Shape.convex.internal.polyhedral.box.to_box_Shape ((50.0, 1.0, 50.0))); box_Shape_1 : Shape.convex.internal.polyhedral.box.view := new Shape.convex.internal.polyhedral.box.item' (Shape.convex.internal.polyhedral.box.to_box_Shape ((1.0, 1.0, 1.0))); box_Shape_2 : Shape.convex.internal.polyhedral.box.view := new Shape.convex.internal.polyhedral.box.item' (Shape.convex.internal.polyhedral.box.to_box_Shape ((1.0, 1.0, 1.0))); ground_motion_State : motion_State.default.view; box_motion_State : motion_State.default.view; localInertia : Vector_3 := (0.0, 0.0, 0.0); the_Transform : Transform_3d := transform.getIdentity; unused : Integer; begin dynamicsWorld.setGravity ((0.0, -10.0, 0.0)); ground_Shape.calculateLocalInertia (0.0, localInertia); setOrigin (the_Transform, (0.0, -2.0, 0.0)); ground_motion_State := new motion_State.default.item' (motion_State.default.to_motion_State (the_Transform)); declare rbInfo : access Object.rigid.ConstructionInfo := new Object.rigid.ConstructionInfo' (Object.rigid.to_ConstructionInfo (0.0, ground_motion_State.all'access, ground_Shape, localInertia)); the_Ground : Object.rigid.View := Object.rigid.new_rigid_Object (rbInfo.all); begin dynamicsWorld.addRigidBody (the_Ground); -- Add the body to the dynamics world. end; box_Shape_1.calculateLocalInertia (1.0, localInertia); setOrigin (the_Transform, (0.0, 2.501, 0.0)); setBasis (the_Transform, impact.linear_Algebra_3d.X_Rotation_from (to_Radians (40.0))); box_motion_State := new motion_State.default.item' (motion_State.default.to_motion_State (the_Transform)); declare rbInfo : access Object.rigid.ConstructionInfo := new Object.rigid.ConstructionInfo' (Object.rigid.to_ConstructionInfo (1.0, box_motion_State.all'access, box_Shape_1, localInertia)); Box_1 : impact.d3.Object.rigid.view := Object.rigid.new_rigid_Object (rbInfo.all); begin dynamicsWorld.addRigidBody (Box_1); -- Add the body to the dynamics world. end; -- box_Shape_2.calculateLocalInertia (1.0, localInertia); -- setOrigin (the_Transform, (0.0, 5.0, 0.0)); -- box_motion_State := new motion_State.default.item' (motion_State.default.to_motion_State (the_Transform)); -- -- declare -- rbInfo : access Object.rigid.ConstructionInfo -- := new Object.rigid.ConstructionInfo' (Object.rigid.to_ConstructionInfo (1.0, box_motion_State.all'access, box_Shape_2, localInertia)); -- -- Box_2 : Object.rigid.View := Object.rigid.new_rigid_Object (rbInfo.all); -- -- begin -- dynamicsWorld.addRigidBody (Box_2); -- Add the body to the dynamics world. -- end; --- Do some simulation. -- for i in 1 .. 500 loop unused := dynamicsWorld.stepSimulation (1.0/60.0, 10); box_motion_State.getWorldTransform (the_Transform); put (" X: " & Image (the_Transform.Translation (1), 9)); put (" Y: " & Image (the_Transform.Translation (2), 9)); put_Line (" Z: " & Image (the_Transform.Translation (3), 9)); end loop; end launch_box_box_collision_Test;
package body afrl.cmasi.location3D is function getFullLmcpTypeName(this : Location3D) return String is ("afrl.cmasi.location3D.Location3D"); function getLmcpTypeName(this : Location3D) return String is ("Location3D"); function getLmcpType(this : Location3D) return UInt32_t is (CMASIEnum'Pos(LOCATION3D_ENUM)); function getLatitude (this : Location3D'Class) return Double_t is (this.Latitude); procedure setLatitude(this : out Location3D'Class; Latitude : in Double_t) is begin this.Latitude := Latitude; end setLatitude; function getLongitude(this : Location3D'Class) return Double_t is (this.Longitude); procedure setLongitude(this : out Location3D'Class; Longitude : in double_t) is begin this.Longitude := Longitude; end setLongitude; function getAltitude(this : Location3D'Class) return Float_t is (this.Altitude); procedure setAltitude(this : out Location3D'Class; Altitude : in Float_t) is begin this.Altitude := Altitude; end setAltitude; function getAltitudeType(this : Location3D'Class) return AltitudeTypeEnum is (this.AltitudeType); procedure setAltitudeType(this : out Location3D'Class; AltitudeType : in AltitudeTypeEnum) is begin this.AltitudeType := AltitudeType; end setAltitudeType; end afrl.cmasi.location3D;
------------------------------------------------------------------------------ -- -- -- 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.Internals.OCL_Elements; with AMF.OCL.Set_Types; with AMF.String_Collections; with AMF.UML.Classifier_Template_Parameters; with AMF.UML.Classifiers.Collections; with AMF.UML.Collaboration_Uses.Collections; with AMF.UML.Comments.Collections; with AMF.UML.Constraints.Collections; with AMF.UML.Dependencies.Collections; with AMF.UML.Element_Imports.Collections; with AMF.UML.Elements.Collections; with AMF.UML.Features.Collections; with AMF.UML.Generalization_Sets.Collections; with AMF.UML.Generalizations.Collections; with AMF.UML.Named_Elements.Collections; with AMF.UML.Namespaces.Collections; with AMF.UML.Operations.Collections; with AMF.UML.Package_Imports.Collections; with AMF.UML.Packageable_Elements.Collections; with AMF.UML.Packages.Collections; with AMF.UML.Parameterable_Elements.Collections; with AMF.UML.Properties.Collections; with AMF.UML.Redefinable_Elements.Collections; with AMF.UML.Redefinable_Template_Signatures; with AMF.UML.String_Expressions; with AMF.UML.Substitutions.Collections; with AMF.UML.Template_Bindings.Collections; with AMF.UML.Template_Parameters; with AMF.UML.Template_Signatures; with AMF.UML.Types; with AMF.UML.Use_Cases.Collections; with AMF.Visitors; package AMF.Internals.OCL_Set_Types is type OCL_Set_Type_Proxy is limited new AMF.Internals.OCL_Elements.OCL_Element_Proxy and AMF.OCL.Set_Types.OCL_Set_Type with null record; overriding function Get_Element_Type (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Classifiers.UML_Classifier_Access; -- Getter of CollectionType::elementType. -- overriding procedure Set_Element_Type (Self : not null access OCL_Set_Type_Proxy; To : AMF.UML.Classifiers.UML_Classifier_Access); -- Setter of CollectionType::elementType. -- overriding function Get_Owned_Attribute (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property; -- Getter of DataType::ownedAttribute. -- -- The Attributes owned by the DataType. overriding function Get_Owned_Operation (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Operations.Collections.Ordered_Set_Of_UML_Operation; -- Getter of DataType::ownedOperation. -- -- The Operations owned by the DataType. overriding function Get_Attribute (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Properties.Collections.Set_Of_UML_Property; -- Getter of Classifier::attribute. -- -- Refers to all of the Properties that are direct (i.e. not inherited or -- imported) attributes of the classifier. overriding function Get_Collaboration_Use (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Collaboration_Uses.Collections.Set_Of_UML_Collaboration_Use; -- Getter of Classifier::collaborationUse. -- -- References the collaboration uses owned by the classifier. overriding function Get_Feature (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Features.Collections.Set_Of_UML_Feature; -- Getter of Classifier::feature. -- -- Specifies each feature defined in the classifier. -- Note that there may be members of the Classifier that are of the type -- Feature but are not included in this association, e.g. inherited -- features. overriding function Get_General (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier; -- Getter of Classifier::general. -- -- Specifies the general Classifiers for this Classifier. -- References the general classifier in the Generalization relationship. overriding function Get_Generalization (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Generalizations.Collections.Set_Of_UML_Generalization; -- Getter of Classifier::generalization. -- -- Specifies the Generalization relationships for this Classifier. These -- Generalizations navigaten to more general classifiers in the -- generalization hierarchy. overriding function Get_Inherited_Member (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element; -- Getter of Classifier::inheritedMember. -- -- Specifies all elements inherited by this classifier from the general -- classifiers. overriding function Get_Is_Abstract (Self : not null access constant OCL_Set_Type_Proxy) return Boolean; -- Getter of Classifier::isAbstract. -- -- If true, the Classifier does not provide a complete declaration and can -- typically not be instantiated. An abstract classifier is intended to be -- used by other classifiers e.g. as the target of general -- metarelationships or generalization relationships. overriding procedure Set_Is_Abstract (Self : not null access OCL_Set_Type_Proxy; To : Boolean); -- Setter of Classifier::isAbstract. -- -- If true, the Classifier does not provide a complete declaration and can -- typically not be instantiated. An abstract classifier is intended to be -- used by other classifiers e.g. as the target of general -- metarelationships or generalization relationships. overriding function Get_Is_Final_Specialization (Self : not null access constant OCL_Set_Type_Proxy) return Boolean; -- Getter of Classifier::isFinalSpecialization. -- -- If true, the Classifier cannot be specialized by generalization. Note -- that this property is preserved through package merge operations; that -- is, the capability to specialize a Classifier (i.e., -- isFinalSpecialization =false) must be preserved in the resulting -- Classifier of a package merge operation where a Classifier with -- isFinalSpecialization =false is merged with a matching Classifier with -- isFinalSpecialization =true: the resulting Classifier will have -- isFinalSpecialization =false. overriding procedure Set_Is_Final_Specialization (Self : not null access OCL_Set_Type_Proxy; To : Boolean); -- Setter of Classifier::isFinalSpecialization. -- -- If true, the Classifier cannot be specialized by generalization. Note -- that this property is preserved through package merge operations; that -- is, the capability to specialize a Classifier (i.e., -- isFinalSpecialization =false) must be preserved in the resulting -- Classifier of a package merge operation where a Classifier with -- isFinalSpecialization =false is merged with a matching Classifier with -- isFinalSpecialization =true: the resulting Classifier will have -- isFinalSpecialization =false. overriding function Get_Owned_Template_Signature (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access; -- Getter of Classifier::ownedTemplateSignature. -- -- The optional template signature specifying the formal template -- parameters. overriding procedure Set_Owned_Template_Signature (Self : not null access OCL_Set_Type_Proxy; To : AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access); -- Setter of Classifier::ownedTemplateSignature. -- -- The optional template signature specifying the formal template -- parameters. overriding function Get_Owned_Use_Case (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case; -- Getter of Classifier::ownedUseCase. -- -- References the use cases owned by this classifier. overriding function Get_Powertype_Extent (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Generalization_Sets.Collections.Set_Of_UML_Generalization_Set; -- Getter of Classifier::powertypeExtent. -- -- Designates the GeneralizationSet of which the associated Classifier is -- a power type. overriding function Get_Redefined_Classifier (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier; -- Getter of Classifier::redefinedClassifier. -- -- References the Classifiers that are redefined by this Classifier. overriding function Get_Representation (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access; -- Getter of Classifier::representation. -- -- References a collaboration use which indicates the collaboration that -- represents this classifier. overriding procedure Set_Representation (Self : not null access OCL_Set_Type_Proxy; To : AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access); -- Setter of Classifier::representation. -- -- References a collaboration use which indicates the collaboration that -- represents this classifier. overriding function Get_Substitution (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Substitutions.Collections.Set_Of_UML_Substitution; -- Getter of Classifier::substitution. -- -- References the substitutions that are owned by this Classifier. overriding function Get_Template_Parameter (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access; -- Getter of Classifier::templateParameter. -- -- The template parameter that exposes this element as a formal parameter. overriding procedure Set_Template_Parameter (Self : not null access OCL_Set_Type_Proxy; To : AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access); -- Setter of Classifier::templateParameter. -- -- The template parameter that exposes this element as a formal parameter. overriding function Get_Use_Case (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case; -- Getter of Classifier::useCase. -- -- The set of use cases for which this Classifier is the subject. overriding function Get_Element_Import (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import; -- Getter of Namespace::elementImport. -- -- References the ElementImports owned by the Namespace. overriding function Get_Imported_Member (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element; -- Getter of Namespace::importedMember. -- -- References the PackageableElements that are members of this Namespace -- as a result of either PackageImports or ElementImports. overriding function Get_Member (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element; -- Getter of Namespace::member. -- -- A collection of NamedElements identifiable within the Namespace, either -- by being owned or by being introduced by importing or inheritance. overriding function Get_Owned_Member (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element; -- Getter of Namespace::ownedMember. -- -- A collection of NamedElements owned by the Namespace. overriding function Get_Owned_Rule (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint; -- Getter of Namespace::ownedRule. -- -- Specifies a set of Constraints owned by this Namespace. overriding function Get_Package_Import (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import; -- Getter of Namespace::packageImport. -- -- References the PackageImports owned by the Namespace. overriding function Get_Client_Dependency (Self : not null access constant OCL_Set_Type_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 (Self : not null access constant OCL_Set_Type_Proxy) return AMF.Optional_String; -- Getter of NamedElement::name. -- -- The name of the NamedElement. overriding procedure Set_Name (Self : not null access OCL_Set_Type_Proxy; To : AMF.Optional_String); -- Setter of NamedElement::name. -- -- The name of the NamedElement. overriding function Get_Name_Expression (Self : not null access constant OCL_Set_Type_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 OCL_Set_Type_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 OCL_Set_Type_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 OCL_Set_Type_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_Visibility (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Optional_UML_Visibility_Kind; -- Getter of NamedElement::visibility. -- -- Determines where the NamedElement appears within different Namespaces -- within the overall model, and its accessibility. overriding procedure Set_Visibility (Self : not null access OCL_Set_Type_Proxy; To : AMF.UML.Optional_UML_Visibility_Kind); -- Setter of NamedElement::visibility. -- -- Determines where the NamedElement appears within different Namespaces -- within the overall model, and its accessibility. overriding function Get_Owned_Comment (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Comments.Collections.Set_Of_UML_Comment; -- Getter of Element::ownedComment. -- -- The Comments owned by this element. overriding function Get_Owned_Element (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Getter of Element::ownedElement. -- -- The Elements owned by this element. overriding function Get_Owner (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Elements.UML_Element_Access; -- Getter of Element::owner. -- -- The Element that owns this element. overriding function Get_Package (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Packages.UML_Package_Access; -- Getter of Type::package. -- -- Specifies the owning package of this classifier, if any. overriding procedure Set_Package (Self : not null access OCL_Set_Type_Proxy; To : AMF.UML.Packages.UML_Package_Access); -- Setter of Type::package. -- -- Specifies the owning package of this classifier, if any. overriding function Get_Visibility (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.UML_Visibility_Kind; -- Getter of PackageableElement::visibility. -- -- Indicates that packageable elements must always have a visibility, -- i.e., visibility is not optional. overriding procedure Set_Visibility (Self : not null access OCL_Set_Type_Proxy; To : AMF.UML.UML_Visibility_Kind); -- Setter of PackageableElement::visibility. -- -- Indicates that packageable elements must always have a visibility, -- i.e., visibility is not optional. overriding function Get_Owning_Template_Parameter (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access; -- Getter of ParameterableElement::owningTemplateParameter. -- -- The formal template parameter that owns this element. overriding procedure Set_Owning_Template_Parameter (Self : not null access OCL_Set_Type_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access); -- Setter of ParameterableElement::owningTemplateParameter. -- -- The formal template parameter that owns this element. overriding function Get_Template_Parameter (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access; -- Getter of ParameterableElement::templateParameter. -- -- The template parameter that exposes this element as a formal parameter. overriding procedure Set_Template_Parameter (Self : not null access OCL_Set_Type_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access); -- Setter of ParameterableElement::templateParameter. -- -- The template parameter that exposes this element as a formal parameter. overriding function Get_Owned_Template_Signature (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Template_Signatures.UML_Template_Signature_Access; -- Getter of TemplateableElement::ownedTemplateSignature. -- -- The optional template signature specifying the formal template -- parameters. overriding procedure Set_Owned_Template_Signature (Self : not null access OCL_Set_Type_Proxy; To : AMF.UML.Template_Signatures.UML_Template_Signature_Access); -- Setter of TemplateableElement::ownedTemplateSignature. -- -- The optional template signature specifying the formal template -- parameters. overriding function Get_Template_Binding (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Template_Bindings.Collections.Set_Of_UML_Template_Binding; -- Getter of TemplateableElement::templateBinding. -- -- The optional bindings from this element to templates. overriding function Get_Is_Leaf (Self : not null access constant OCL_Set_Type_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 OCL_Set_Type_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 OCL_Set_Type_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 OCL_Set_Type_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 Inherit (Self : not null access constant OCL_Set_Type_Proxy; Inhs : AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element; -- Operation DataType::inherit. -- -- The inherit operation is overridden to exclude redefined properties. overriding function All_Features (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Features.Collections.Set_Of_UML_Feature; -- Operation Classifier::allFeatures. -- -- The query allFeatures() gives all of the features in the namespace of -- the classifier. In general, through mechanisms such as inheritance, -- this will be a larger set than feature. overriding function All_Parents (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier; -- Operation Classifier::allParents. -- -- The query allParents() gives all of the direct and indirect ancestors -- of a generalized Classifier. overriding function Conforms_To (Self : not null access constant OCL_Set_Type_Proxy; Other : AMF.UML.Classifiers.UML_Classifier_Access) return Boolean; -- Operation Classifier::conformsTo. -- -- The query conformsTo() gives true for a classifier that defines a type -- that conforms to another. This is used, for example, in the -- specification of signature conformance for operations. overriding function General (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier; -- Operation Classifier::general. -- -- The general classifiers are the classifiers referenced by the -- generalization relationships. overriding function Has_Visibility_Of (Self : not null access constant OCL_Set_Type_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access) return Boolean; -- Operation Classifier::hasVisibilityOf. -- -- The query hasVisibilityOf() determines whether a named element is -- visible in the classifier. By default all are visible. It is only -- called when the argument is something owned by a parent. overriding function Inheritable_Members (Self : not null access constant OCL_Set_Type_Proxy; C : AMF.UML.Classifiers.UML_Classifier_Access) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element; -- Operation Classifier::inheritableMembers. -- -- The query inheritableMembers() gives all of the members of a classifier -- that may be inherited in one of its descendants, subject to whatever -- visibility restrictions apply. overriding function Inherited_Member (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element; -- Operation Classifier::inheritedMember. -- -- The inheritedMember association is derived by inheriting the -- inheritable members of the parents. -- The inheritedMember association is derived by inheriting the -- inheritable members of the parents. overriding function Is_Template (Self : not null access constant OCL_Set_Type_Proxy) return Boolean; -- Operation Classifier::isTemplate. -- -- The query isTemplate() returns whether this templateable element is -- actually a template. overriding function May_Specialize_Type (Self : not null access constant OCL_Set_Type_Proxy; C : AMF.UML.Classifiers.UML_Classifier_Access) return Boolean; -- Operation Classifier::maySpecializeType. -- -- The query maySpecializeType() determines whether this classifier may -- have a generalization relationship to classifiers of the specified -- type. By default a classifier may specialize classifiers of the same or -- a more general type. It is intended to be redefined by classifiers that -- have different specialization constraints. overriding function Parents (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier; -- Operation Classifier::parents. -- -- The query parents() gives all of the immediate ancestors of a -- generalized Classifier. overriding function Exclude_Collisions (Self : not null access constant OCL_Set_Type_Proxy; Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element; -- Operation Namespace::excludeCollisions. -- -- The query excludeCollisions() excludes from a set of -- PackageableElements any that would not be distinguishable from each -- other in this namespace. overriding function Get_Names_Of_Member (Self : not null access constant OCL_Set_Type_Proxy; Element : AMF.UML.Named_Elements.UML_Named_Element_Access) return AMF.String_Collections.Set_Of_String; -- Operation Namespace::getNamesOfMember. -- -- The query getNamesOfMember() takes importing into account. It gives -- back the set of names that an element would have in an importing -- namespace, either because it is owned, or if not owned then imported -- individually, or if not individually then from a package. -- The query getNamesOfMember() gives a set of all of the names that a -- member would have in a Namespace. In general a member can have multiple -- names in a Namespace if it is imported more than once with different -- aliases. The query takes account of importing. It gives back the set of -- names that an element would have in an importing namespace, either -- because it is owned, or if not owned then imported individually, or if -- not individually then from a package. overriding function Import_Members (Self : not null access constant OCL_Set_Type_Proxy; Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element; -- Operation Namespace::importMembers. -- -- The query importMembers() defines which of a set of PackageableElements -- are actually imported into the namespace. This excludes hidden ones, -- i.e., those which have names that conflict with names of owned members, -- and also excludes elements which would have the same name when imported. overriding function Imported_Member (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element; -- Operation Namespace::importedMember. -- -- The importedMember property is derived from the ElementImports and the -- PackageImports. References the PackageableElements that are members of -- this Namespace as a result of either PackageImports or ElementImports. overriding function Members_Are_Distinguishable (Self : not null access constant OCL_Set_Type_Proxy) return Boolean; -- Operation Namespace::membersAreDistinguishable. -- -- The Boolean query membersAreDistinguishable() determines whether all of -- the namespace's members are distinguishable within it. overriding function Owned_Member (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element; -- Operation Namespace::ownedMember. -- -- Missing derivation for Namespace::/ownedMember : NamedElement overriding function All_Namespaces (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Namespaces.Collections.Ordered_Set_Of_UML_Namespace; -- Operation NamedElement::allNamespaces. -- -- The query allNamespaces() gives the sequence of namespaces in which the -- NamedElement is nested, working outwards. overriding function All_Owning_Packages (Self : not null access constant OCL_Set_Type_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 OCL_Set_Type_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 OCL_Set_Type_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Operation NamedElement::namespace. -- -- Missing derivation for NamedElement::/namespace : Namespace overriding function Qualified_Name (Self : not null access constant OCL_Set_Type_Proxy) return League.Strings.Universal_String; -- Operation NamedElement::qualifiedName. -- -- When there is a name, and all of the containing namespaces have a name, -- the qualified name is constructed from the names of the containing -- namespaces. overriding function Separator (Self : not null access constant OCL_Set_Type_Proxy) return League.Strings.Universal_String; -- Operation NamedElement::separator. -- -- The query separator() gives the string that is used to separate names -- when constructing a qualified name. overriding function All_Owned_Elements (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Operation Element::allOwnedElements. -- -- The query allOwnedElements() gives all of the direct and indirect owned -- elements of an element. overriding function Must_Be_Owned (Self : not null access constant OCL_Set_Type_Proxy) return Boolean; -- Operation Element::mustBeOwned. -- -- The query mustBeOwned() indicates whether elements of this type must -- have an owner. Subclasses of Element that do not require an owner must -- override this operation. overriding function Conforms_To (Self : not null access constant OCL_Set_Type_Proxy; Other : AMF.UML.Types.UML_Type_Access) return Boolean; -- Operation Type::conformsTo. -- -- The query conformsTo() gives true for a type that conforms to another. -- By default, two types do not conform to each other. This query is -- intended to be redefined for specific conformance situations. overriding function Is_Compatible_With (Self : not null access constant OCL_Set_Type_Proxy; P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) return Boolean; -- Operation ParameterableElement::isCompatibleWith. -- -- The query isCompatibleWith() determines if this parameterable element -- is compatible with the specified parameterable element. By default -- parameterable element P is compatible with parameterable element Q if -- the kind of P is the same or a subtype as the kind of Q. Subclasses -- should override this operation to specify different compatibility -- constraints. overriding function Is_Template_Parameter (Self : not null access constant OCL_Set_Type_Proxy) return Boolean; -- Operation ParameterableElement::isTemplateParameter. -- -- The query isTemplateParameter() determines if this parameterable -- element is exposed as a formal template parameter. overriding function Parameterable_Elements (Self : not null access constant OCL_Set_Type_Proxy) return AMF.UML.Parameterable_Elements.Collections.Set_Of_UML_Parameterable_Element; -- Operation TemplateableElement::parameterableElements. -- -- The query parameterableElements() returns the set of elements that may -- be used as the parametered elements for a template parameter of this -- templateable element. By default, this set includes all the owned -- elements. Subclasses may override this operation if they choose to -- restrict the set of parameterable elements. overriding function Is_Consistent_With (Self : not null access constant OCL_Set_Type_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 OCL_Set_Type_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 procedure Enter_Element (Self : not null access constant OCL_Set_Type_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Leave_Element (Self : not null access constant OCL_Set_Type_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Visit_Element (Self : not null access constant OCL_Set_Type_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); end AMF.Internals.OCL_Set_Types;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- L I B . X R E F . S P A R K _ S P E C I F I C -- -- -- -- B o d y -- -- -- -- Copyright (C) 2011-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. -- -- -- ------------------------------------------------------------------------------ with Einfo; use Einfo; with Nmake; use Nmake; with SPARK_Xrefs; use SPARK_Xrefs; separate (Lib.Xref) package body SPARK_Specific is --------------------- -- Local Constants -- --------------------- -- Table of SPARK_Entities, True for each entity kind used in SPARK SPARK_Entities : constant array (Entity_Kind) of Boolean := (E_Constant => True, E_Entry => True, E_Function => True, E_In_Out_Parameter => True, E_In_Parameter => True, E_Loop_Parameter => True, E_Operator => True, E_Out_Parameter => True, E_Procedure => True, E_Variable => True, others => False); -- True for each reference type used in SPARK SPARK_References : constant array (Character) of Boolean := ('m' => True, 'r' => True, 's' => True, others => False); --------------------- -- Local Variables -- --------------------- package Drefs is new Table.Table ( Table_Component_Type => Xref_Entry, Table_Index_Type => Xref_Entry_Number, Table_Low_Bound => 1, Table_Initial => Alloc.Drefs_Initial, Table_Increment => Alloc.Drefs_Increment, Table_Name => "Drefs"); -- Table of cross-references for reads and writes through explicit -- dereferences, that are output as reads/writes to the special variable -- "Heap". These references are added to the regular references when -- computing SPARK cross-references. ------------------------- -- Iterate_SPARK_Xrefs -- ------------------------- procedure Iterate_SPARK_Xrefs is procedure Add_SPARK_Xref (Index : Int; Xref : Xref_Entry); function Is_SPARK_Reference (E : Entity_Id; Typ : Character) return Boolean; -- Return whether entity reference E meets SPARK requirements. Typ is -- the reference type. function Is_SPARK_Scope (E : Entity_Id) return Boolean; -- Return whether the entity or reference scope meets requirements for -- being a SPARK scope. -------------------- -- Add_SPARK_Xref -- -------------------- procedure Add_SPARK_Xref (Index : Int; Xref : Xref_Entry) is Ref : Xref_Key renames Xref.Key; begin -- Eliminate entries not appropriate for SPARK if SPARK_Entities (Ekind (Ref.Ent)) and then SPARK_References (Ref.Typ) and then Is_SPARK_Scope (Ref.Ent_Scope) and then Is_SPARK_Scope (Ref.Ref_Scope) and then Is_SPARK_Reference (Ref.Ent, Ref.Typ) then Process (Index, (Entity => Ref.Ent, Ref_Scope => Ref.Ref_Scope, Rtype => Ref.Typ)); end if; end Add_SPARK_Xref; ------------------------ -- Is_SPARK_Reference -- ------------------------ function Is_SPARK_Reference (E : Entity_Id; Typ : Character) return Boolean is begin -- The only references of interest on callable entities are calls. On -- uncallable entities, the only references of interest are reads and -- writes. if Ekind (E) in Overloadable_Kind then return Typ = 's'; -- In all other cases, result is true for reference/modify cases, -- and false for all other cases. else return Typ = 'r' or else Typ = 'm'; end if; end Is_SPARK_Reference; -------------------- -- Is_SPARK_Scope -- -------------------- function Is_SPARK_Scope (E : Entity_Id) return Boolean is Can_Be_Renamed : constant Boolean := Present (E) and then (Is_Subprogram_Or_Entry (E) or else Ekind (E) = E_Package); begin return Present (E) and then not Is_Generic_Unit (E) and then (not Can_Be_Renamed or else No (Renamed_Entity (E))); end Is_SPARK_Scope; -- Start of processing for Add_SPARK_Xrefs begin -- Expose cross-references from private frontend tables to the backend for Index in Drefs.First .. Drefs.Last loop Add_SPARK_Xref (Index, Drefs.Table (Index)); end loop; for Index in Xrefs.First .. Xrefs.Last loop Add_SPARK_Xref (-Index, Xrefs.Table (Index)); end loop; end Iterate_SPARK_Xrefs; --------------------------------------------- -- Enclosing_Subprogram_Or_Library_Package -- --------------------------------------------- function Enclosing_Subprogram_Or_Library_Package (N : Node_Id) return Entity_Id is Context : Entity_Id; begin -- If N is the defining identifier for a subprogram, then return the -- enclosing subprogram or package, not this subprogram. if Nkind (N) in N_Defining_Identifier | N_Defining_Operator_Symbol and then Ekind (N) in Entry_Kind | E_Subprogram_Body | Generic_Subprogram_Kind | Subprogram_Kind then Context := Parent (Unit_Declaration_Node (N)); -- If this was a library-level subprogram then replace Context with -- its Unit, which points to N_Subprogram_* node. if Nkind (Context) = N_Compilation_Unit then Context := Unit (Context); end if; else Context := N; end if; while Present (Context) loop case Nkind (Context) is when N_Package_Body | N_Package_Specification => -- Only return a library-level package if Is_Library_Level_Entity (Defining_Entity (Context)) then Context := Defining_Entity (Context); exit; else Context := Parent (Context); end if; when N_Pragma => -- The enclosing subprogram for a precondition, postcondition, -- or contract case should be the declaration preceding the -- pragma (skipping any other pragmas between this pragma and -- this declaration. while Nkind (Context) = N_Pragma and then Is_List_Member (Context) and then Present (Prev (Context)) loop Context := Prev (Context); end loop; if Nkind (Context) = N_Pragma then -- When used for cross-references then aspects might not be -- yet linked to pragmas; when used for AST navigation in -- GNATprove this routine is expected to follow those links. if From_Aspect_Specification (Context) then Context := Corresponding_Aspect (Context); pragma Assert (Nkind (Context) = N_Aspect_Specification); Context := Entity (Context); else Context := Parent (Context); end if; end if; when N_Entry_Body | N_Entry_Declaration | N_Protected_Type_Declaration | N_Subprogram_Body | N_Subprogram_Declaration | N_Subprogram_Specification | N_Task_Body | N_Task_Type_Declaration => Context := Defining_Entity (Context); exit; when others => Context := Parent (Context); end case; end loop; if Nkind (Context) = N_Defining_Program_Unit_Name then Context := Defining_Identifier (Context); end if; -- Do not return a scope without a proper location if Present (Context) and then Sloc (Context) = No_Location then return Empty; end if; return Context; end Enclosing_Subprogram_Or_Library_Package; -------------------------- -- Generate_Dereference -- -------------------------- procedure Generate_Dereference (N : Node_Id; Typ : Character := 'r') is procedure Create_Heap; -- Create and decorate the special entity which denotes the heap ----------------- -- Create_Heap -- ----------------- procedure Create_Heap is begin Heap := Make_Defining_Identifier (Standard_Location, Name_Enter (Name_Of_Heap_Variable)); Set_Ekind (Heap, E_Variable); Set_Is_Internal (Heap, True); Set_Etype (Heap, Standard_Void_Type); Set_Scope (Heap, Standard_Standard); Set_Has_Fully_Qualified_Name (Heap); end Create_Heap; -- Local variables Loc : constant Source_Ptr := Sloc (N); -- Start of processing for Generate_Dereference begin if Loc > No_Location then Drefs.Increment_Last; declare Deref_Entry : Xref_Entry renames Drefs.Table (Drefs.Last); Deref : Xref_Key renames Deref_Entry.Key; begin if No (Heap) then Create_Heap; end if; Deref.Ent := Heap; Deref.Loc := Loc; Deref.Typ := Typ; -- It is as if the special "Heap" was defined in the main unit, -- in the scope of the entity for the main unit. This single -- definition point is required to ensure that sorting cross -- references works for "Heap" references as well. Deref.Eun := Main_Unit; Deref.Lun := Get_Top_Level_Code_Unit (Loc); Deref.Ref_Scope := Enclosing_Subprogram_Or_Library_Package (N); Deref.Ent_Scope := Cunit_Entity (Main_Unit); Deref_Entry.Def := No_Location; Deref_Entry.Ent_Scope_File := Main_Unit; end; end if; end Generate_Dereference; end SPARK_Specific;
------------------------------------------------------------------------------ -- -- -- 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.DG.Clip_Paths; with AMF.DG.Groups; with AMF.DG.Markers; with AMF.DG.Paths; with AMF.DG.Styles.Collections; with AMF.Internals.DG_Elements; with AMF.Visitors; package AMF.Internals.DG_Paths is type DG_Path_Proxy is limited new AMF.Internals.DG_Elements.DG_Element_Proxy and AMF.DG.Paths.DG_Path with null record; overriding function Get_Command (Self : not null access constant DG_Path_Proxy) return AMF.DG.Sequence_Of_Path_Command; -- Getter of Path::command. -- -- a list of path commands that define the geometry of the custom shape. overriding function Get_Start_Marker (Self : not null access constant DG_Path_Proxy) return AMF.DG.Markers.DG_Marker_Access; -- Getter of MarkedElement::startMarker. -- -- an optional start marker that aligns with the first vertex of the -- marked element. overriding procedure Set_Start_Marker (Self : not null access DG_Path_Proxy; To : AMF.DG.Markers.DG_Marker_Access); -- Setter of MarkedElement::startMarker. -- -- an optional start marker that aligns with the first vertex of the -- marked element. overriding function Get_End_Marker (Self : not null access constant DG_Path_Proxy) return AMF.DG.Markers.DG_Marker_Access; -- Getter of MarkedElement::endMarker. -- -- an optional end marker that aligns with the last vertex of the marked -- element. overriding procedure Set_End_Marker (Self : not null access DG_Path_Proxy; To : AMF.DG.Markers.DG_Marker_Access); -- Setter of MarkedElement::endMarker. -- -- an optional end marker that aligns with the last vertex of the marked -- element. overriding function Get_Mid_Marker (Self : not null access constant DG_Path_Proxy) return AMF.DG.Markers.DG_Marker_Access; -- Getter of MarkedElement::midMarker. -- -- an optional mid marker that aligns with all vertices of the marked -- element except the first and the last. overriding procedure Set_Mid_Marker (Self : not null access DG_Path_Proxy; To : AMF.DG.Markers.DG_Marker_Access); -- Setter of MarkedElement::midMarker. -- -- an optional mid marker that aligns with all vertices of the marked -- element except the first and the last. overriding function Get_Group (Self : not null access constant DG_Path_Proxy) return AMF.DG.Groups.DG_Group_Access; -- Getter of GraphicalElement::group. -- -- the group element that owns this graphical element. overriding procedure Set_Group (Self : not null access DG_Path_Proxy; To : AMF.DG.Groups.DG_Group_Access); -- Setter of GraphicalElement::group. -- -- the group element that owns this graphical element. overriding function Get_Local_Style (Self : not null access constant DG_Path_Proxy) return AMF.DG.Styles.Collections.Ordered_Set_Of_DG_Style; -- Getter of GraphicalElement::localStyle. -- -- a list of locally-owned styles for this graphical element. overriding function Get_Shared_Style (Self : not null access constant DG_Path_Proxy) return AMF.DG.Styles.Collections.Ordered_Set_Of_DG_Style; -- Getter of GraphicalElement::sharedStyle. -- -- a list of shared styles for this graphical element. overriding function Get_Transform (Self : not null access constant DG_Path_Proxy) return AMF.DG.Sequence_Of_DG_Transform; -- Getter of GraphicalElement::transform. -- -- a list of zero or more transforms to apply to this graphical element. overriding function Get_Clip_Path (Self : not null access constant DG_Path_Proxy) return AMF.DG.Clip_Paths.DG_Clip_Path_Access; -- Getter of GraphicalElement::clipPath. -- -- an optional reference to a clip path element that masks the painting of -- this graphical element. overriding procedure Set_Clip_Path (Self : not null access DG_Path_Proxy; To : AMF.DG.Clip_Paths.DG_Clip_Path_Access); -- Setter of GraphicalElement::clipPath. -- -- an optional reference to a clip path element that masks the painting of -- this graphical element. overriding procedure Enter_Element (Self : not null access constant DG_Path_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Leave_Element (Self : not null access constant DG_Path_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Visit_Element (Self : not null access constant DG_Path_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); end AMF.Internals.DG_Paths;
------------------------------------------------------------------------------------------------------------------------ -- See COPYING for licence information. ------------------------------------------------------------------------------------------------------------------------ with Ada.Directories; with Ada.Text_IO; use Ada.Text_IO; with Ada.Text_IO.Text_Streams; with Ada.Streams.Stream_IO; package body Oberon.Files is function Open (File_Name : String) return File is package Dirs renames Ada.Directories; Actual_Name : String := File_Name & ".obn"; Size : Dirs.File_Size := Dirs.Size (Actual_Name); Data_File : Ada.Text_IO.File_Type; Data : File (1 .. Natural (Size)); Stream : Ada.Text_IO.Text_Streams.Stream_Access := null; use type Ada.Text_IO.File_Mode; begin Ada.Text_IO.Open (File => Data_File, Mode => Ada.Text_IO.In_File, Name => Actual_Name); Stream := Ada.Text_IO.Text_Streams.Stream (File => Data_File); File'Read (Stream, Data); Ada.Text_IO.Close (File => Data_File); return Data; exception when others => Put_Line ("Error, reading source file, " & Actual_Name); raise; end Open; end Oberon.Files;
with MyStrings; use MyStrings; package body Buildinfo with SPARK_Mode is function Short_Datetime return String is l_date : constant String := Compilation_ISO_Date; b_time : constant String := Strip_Non_Alphanum (Compilation_Time); b_date : constant String := Strip_Non_Alphanum (l_date (l_date'First + 2 .. l_date'Last)); shortstring : String (1 .. 11); begin -- XXX array concatenation: L-value is should be a constrained array, see AARM-4.5.3-6f if b_date'Length > 5 and then b_time'Length > 3 then shortstring (1 .. 6) := b_date (b_date'First .. b_date'First + 5); pragma Annotate (GNATProve, False_Positive, """shortstring"" might not be initialized", "that is done right here"); shortstring (7) := '_'; shortstring (8 .. 11) := b_time (b_time'First .. b_time'First + 3); else declare tmp : String (1 .. 9); begin tmp (tmp'First .. tmp'First - 1 + b_date'Length) := b_date; pragma Annotate (GNATProve, False_Positive, """tmp"" might not be initialized", "that is done right here"); tmp (tmp'First + b_date'Length) := '_'; tmp (tmp'First + b_date'Length + 1 .. tmp'First + b_date'Length + b_time'Length) := b_time; StrCpySpace (instring => tmp, outstring => shortstring); end; end if; return shortstring; end Short_Datetime; end Buildinfo;
with lace.Event, lace.Response, lace.Observer; private with ada.Containers.indefinite_hashed_Maps, ada.Strings.Hash; generic type T is abstract tagged limited private; package lace.make_Observer -- -- Makes a user class T into an event Observer. -- is pragma remote_Types; type Item is abstract limited new T and Observer.item with private; type View is access all Item'Class; procedure destroy (Self : in out Item); -- Responses -- overriding procedure add (Self : access Item; the_Response : in Response.view; to_Kind : in event.Kind; from_Subject : in Event.subject_Name); overriding procedure rid (Self : access Item; the_Response : in Response.view; to_Kind : in event.Kind; from_Subject : in Event.subject_Name); overriding procedure relay_responseless_Events (Self : in out Item; To : in Observer.view); -- Operations -- overriding procedure receive (Self : access Item; the_Event : in Event.item'Class := event.null_Event; from_Subject : in Event.subject_Name); overriding procedure respond (Self : access Item); private -- Event response maps -- use type event.Kind; use type Response.view; package event_response_Maps is new ada.Containers.indefinite_hashed_Maps (key_type => event.Kind, element_type => Response.view, hash => event.Hash, equivalent_keys => "="); subtype event_response_Map is event_response_Maps.Map; type event_response_Map_view is access all event_response_Map; -- Subject maps of event responses -- package subject_Maps_of_event_responses is new ada.Containers.indefinite_hashed_Maps (key_type => Event.subject_Name, element_type => event_response_Map_view, hash => ada.strings.Hash, equivalent_keys => "="); subtype subject_Map_of_event_responses is subject_Maps_of_event_responses.Map; protected type safe_Responses is procedure destroy; -- Responses -- procedure add (Self : access Item'Class; the_Response : in Response.view; to_Kind : in event.Kind; from_Subject : in Event.subject_Name); procedure rid (Self : access Item'Class; the_Response : in Response.view; to_Kind : in event.Kind; from_Subject : in Event.subject_Name); procedure relay_responseless_Events (To : in Observer.view); function relay_Target return Observer.view; function Contains (Subject : in Event.subject_Name) return Boolean; function Element (Subject : in Event.subject_Name) return event_response_Map; -- Operations -- procedure receive (Self : access Item'Class; the_Event : in Event.item'Class := event.null_Event; from_Subject : in Event.subject_Name); private my_Responses : subject_Map_of_event_responses; my_relay_Target : Observer.view; end safe_Responses; -- Observer Item -- type Item is abstract limited new T and Observer.item with record Responses : safe_Responses; end record; end lace.make_Observer;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2016-2020, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision: 5703 $ $Date: 2017-01-20 22:17:20 +0300 (Пт, 20 янв 2017) $ ------------------------------------------------------------------------------ package body Web.Core.Connectables.Slots_0.Emitters is ------------- -- Connect -- ------------- overriding procedure Connect (Self : in out Emitter; Slot : Slots_0.Slot'Class) is Slot_End : Slot_End_Access := Slot.Create_Slot_End; Signal_End : Signal_End_Access := new Emitters.Signal_End (Self'Unchecked_Access); begin Slot_End.Attach; Signal_End.Attach; Signal_End.Slot_End := Slot_End; end Connect; ---------- -- Emit -- ---------- procedure Emit (Self : in out Emitter'Class) is Current : Signal_End_Access := Self.Head; begin while Current /= null loop begin Signal_End'Class (Current.all).Invoke; exception when others => null; end; Current := Current.Next; end loop; end Emit; ------------ -- Invoke -- ------------ procedure Invoke (Self : in out Signal_End'Class) is begin Slot_End_0'Class (Self.Slot_End.all).Invoke; end Invoke; end Web.Core.Connectables.Slots_0.Emitters;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . S T R I N G S . F I X E D -- -- -- -- S p e c -- -- -- -- $Revision$ -- -- -- Copyright (C) 1992-1997 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 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Strings.Maps; package Ada.Strings.Fixed is pragma Preelaborate (Fixed); -------------------------------------------------------------- -- Copy Procedure for Strings of Possibly Different Lengths -- -------------------------------------------------------------- procedure Move (Source : in String; Target : out String; Drop : in Truncation := Error; Justify : in Alignment := Left; Pad : in Character := Space); ------------------------ -- Search Subprograms -- ------------------------ function Index (Source : in String; Pattern : in String; Going : in Direction := Forward; Mapping : in Maps.Character_Mapping := Maps.Identity) return Natural; function Index (Source : in String; Pattern : in String; Going : in Direction := Forward; Mapping : in Maps.Character_Mapping_Function) return Natural; function Index (Source : in String; Set : in Maps.Character_Set; Test : in Membership := Inside; Going : in Direction := Forward) return Natural; function Index_Non_Blank (Source : in String; Going : in Direction := Forward) return Natural; function Count (Source : in String; Pattern : in String; Mapping : in Maps.Character_Mapping := Maps.Identity) return Natural; function Count (Source : in String; Pattern : in String; Mapping : in Maps.Character_Mapping_Function) return Natural; function Count (Source : in String; Set : in Maps.Character_Set) return Natural; procedure Find_Token (Source : in String; Set : in Maps.Character_Set; Test : in Membership; First : out Positive; Last : out Natural); ------------------------------------ -- String Translation Subprograms -- ------------------------------------ function Translate (Source : in String; Mapping : in Maps.Character_Mapping) return String; procedure Translate (Source : in out String; Mapping : in Maps.Character_Mapping); function Translate (Source : in String; Mapping : in Maps.Character_Mapping_Function) return String; procedure Translate (Source : in out String; Mapping : in Maps.Character_Mapping_Function); --------------------------------------- -- String Transformation Subprograms -- --------------------------------------- function Replace_Slice (Source : in String; Low : in Positive; High : in Natural; By : in String) return String; procedure Replace_Slice (Source : in out String; Low : in Positive; High : in Natural; By : in String; Drop : in Truncation := Error; Justify : in Alignment := Left; Pad : in Character := Space); function Insert (Source : in String; Before : in Positive; New_Item : in String) return String; procedure Insert (Source : in out String; Before : in Positive; New_Item : in String; Drop : in Truncation := Error); function Overwrite (Source : in String; Position : in Positive; New_Item : in String) return String; procedure Overwrite (Source : in out String; Position : in Positive; New_Item : in String; Drop : in Truncation := Right); function Delete (Source : in String; From : in Positive; Through : in Natural) return String; procedure Delete (Source : in out String; From : in Positive; Through : in Natural; Justify : in Alignment := Left; Pad : in Character := Space); --------------------------------- -- String Selector Subprograms -- --------------------------------- function Trim (Source : in String; Side : in Trim_End) return String; procedure Trim (Source : in out String; Side : in Trim_End; Justify : in Alignment := Left; Pad : in Character := Space); function Trim (Source : in String; Left : in Maps.Character_Set; Right : in Maps.Character_Set) return String; procedure Trim (Source : in out String; Left : in Maps.Character_Set; Right : in Maps.Character_Set; Justify : in Alignment := Strings.Left; Pad : in Character := Space); function Head (Source : in String; Count : in Natural; Pad : in Character := Space) return String; procedure Head (Source : in out String; Count : in Natural; Justify : in Alignment := Left; Pad : in Character := Space); function Tail (Source : in String; Count : in Natural; Pad : in Character := Space) return String; procedure Tail (Source : in out String; Count : in Natural; Justify : in Alignment := Left; Pad : in Character := Space); ---------------------------------- -- String Constructor Functions -- ---------------------------------- function "*" (Left : in Natural; Right : in Character) return String; function "*" (Left : in Natural; Right : in String) return String; end Ada.Strings.Fixed;
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- A D A . C O N T A I N E R S . D O U B L Y _ L I N K E D _ L I S T S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2004-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/>. -- -- -- -- This unit was originally developed by Matthew J Heaney. -- ------------------------------------------------------------------------------ with Ada.Unchecked_Deallocation; with System; use type System.Address; with System.Put_Images; package body Ada.Containers.Doubly_Linked_Lists with SPARK_Mode => Off is pragma Warnings (Off, "variable ""Busy*"" is not referenced"); pragma Warnings (Off, "variable ""Lock*"" is not referenced"); -- See comment in Ada.Containers.Helpers ----------------------- -- Local Subprograms -- ----------------------- procedure Free (X : in out Node_Access); procedure Insert_Internal (Container : in out List; Before : Node_Access; New_Node : Node_Access); procedure Splice_Internal (Target : in out List; Before : Node_Access; Source : in out List); procedure Splice_Internal (Target : in out List; Before : Node_Access; Source : in out List; Position : Node_Access); function Vet (Position : Cursor) return Boolean; -- Checks invariants of the cursor and its designated container, as a -- simple way of detecting dangling references (see operation Free for a -- description of the detection mechanism), returning True if all checks -- pass. Invocations of Vet are used here as the argument of pragma Assert, -- so the checks are performed only when assertions are enabled. --------- -- "=" -- --------- function "=" (Left, Right : List) return Boolean is begin if Left.Length /= Right.Length then return False; end if; if Left.Length = 0 then return True; end if; declare -- Per AI05-0022, the container implementation is required to detect -- element tampering by a generic actual subprogram. Lock_Left : With_Lock (Left.TC'Unrestricted_Access); Lock_Right : With_Lock (Right.TC'Unrestricted_Access); L : Node_Access := Left.First; R : Node_Access := Right.First; begin for J in 1 .. Left.Length loop if L.Element /= R.Element then return False; end if; L := L.Next; R := R.Next; end loop; end; return True; end "="; ------------ -- Adjust -- ------------ procedure Adjust (Container : in out List) is Src : Node_Access := Container.First; begin -- If the counts are nonzero, execution is technically erroneous, but -- it seems friendly to allow things like concurrent "=" on shared -- constants. Zero_Counts (Container.TC); if Src = null then pragma Assert (Container.Last = null); pragma Assert (Container.Length = 0); return; end if; pragma Assert (Container.First.Prev = null); pragma Assert (Container.Last.Next = null); pragma Assert (Container.Length > 0); Container.First := new Node_Type'(Src.Element, null, null); Container.Last := Container.First; Container.Length := 1; Src := Src.Next; while Src /= null loop Container.Last.Next := new Node_Type'(Element => Src.Element, Prev => Container.Last, Next => null); Container.Last := Container.Last.Next; Container.Length := Container.Length + 1; Src := Src.Next; end loop; end Adjust; ------------ -- Append -- ------------ procedure Append (Container : in out List; New_Item : Element_Type; Count : Count_Type) is begin Insert (Container, No_Element, New_Item, Count); end Append; procedure Append (Container : in out List; New_Item : Element_Type) is begin Insert (Container, No_Element, New_Item, 1); end Append; ------------ -- Assign -- ------------ procedure Assign (Target : in out List; Source : List) is Node : Node_Access; begin if Target'Address = Source'Address then return; end if; Target.Clear; Node := Source.First; while Node /= null loop Target.Append (Node.Element); Node := Node.Next; end loop; end Assign; ----------- -- Clear -- ----------- procedure Clear (Container : in out List) is X : Node_Access; begin if Container.Length = 0 then pragma Assert (Container.First = null); pragma Assert (Container.Last = null); pragma Assert (Container.TC = (Busy => 0, Lock => 0)); return; end if; pragma Assert (Container.First.Prev = null); pragma Assert (Container.Last.Next = null); TC_Check (Container.TC); while Container.Length > 1 loop X := Container.First; pragma Assert (X.Next.Prev = Container.First); Container.First := X.Next; Container.First.Prev := null; Container.Length := Container.Length - 1; Free (X); end loop; X := Container.First; pragma Assert (X = Container.Last); Container.First := null; Container.Last := null; Container.Length := 0; Free (X); end Clear; ------------------------ -- Constant_Reference -- ------------------------ function Constant_Reference (Container : aliased List; Position : Cursor) return Constant_Reference_Type is begin if Checks and then Position.Container = null then raise Constraint_Error with "Position cursor has no element"; end if; if Checks and then Position.Container /= Container'Unrestricted_Access then raise Program_Error with "Position cursor designates wrong container"; end if; pragma Assert (Vet (Position), "bad cursor in Constant_Reference"); declare TC : constant Tamper_Counts_Access := Container.TC'Unrestricted_Access; begin return R : constant Constant_Reference_Type := (Element => Position.Node.Element'Access, Control => (Controlled with TC)) do Busy (TC.all); end return; end; end Constant_Reference; -------------- -- Contains -- -------------- function Contains (Container : List; Item : Element_Type) return Boolean is begin return Find (Container, Item) /= No_Element; end Contains; ---------- -- Copy -- ---------- function Copy (Source : List) return List is begin return Target : List do Target.Assign (Source); end return; end Copy; ------------ -- Delete -- ------------ procedure Delete (Container : in out List; Position : in out Cursor; Count : Count_Type := 1) is X : Node_Access; begin TC_Check (Container.TC); if Checks and then Position.Node = null then raise Constraint_Error with "Position cursor has no element"; end if; if Checks and then Position.Container /= Container'Unrestricted_Access then raise Program_Error with "Position cursor designates wrong container"; end if; pragma Assert (Vet (Position), "bad cursor in Delete"); if Position.Node = Container.First then Delete_First (Container, Count); Position := No_Element; -- Post-York behavior return; end if; if Count = 0 then Position := No_Element; -- Post-York behavior return; end if; for Index in 1 .. Count loop X := Position.Node; Container.Length := Container.Length - 1; if X = Container.Last then Position := No_Element; Container.Last := X.Prev; Container.Last.Next := null; Free (X); return; end if; Position.Node := X.Next; X.Next.Prev := X.Prev; X.Prev.Next := X.Next; Free (X); end loop; -- The following comment is unacceptable, more detail needed ??? Position := No_Element; -- Post-York behavior end Delete; ------------------ -- Delete_First -- ------------------ procedure Delete_First (Container : in out List; Count : Count_Type := 1) is X : Node_Access; begin if Count >= Container.Length then Clear (Container); return; end if; if Count = 0 then return; end if; TC_Check (Container.TC); for J in 1 .. Count loop X := Container.First; pragma Assert (X.Next.Prev = Container.First); Container.First := X.Next; Container.First.Prev := null; Container.Length := Container.Length - 1; Free (X); end loop; end Delete_First; ----------------- -- Delete_Last -- ----------------- procedure Delete_Last (Container : in out List; Count : Count_Type := 1) is X : Node_Access; begin if Count >= Container.Length then Clear (Container); return; end if; if Count = 0 then return; end if; TC_Check (Container.TC); for J in 1 .. Count loop X := Container.Last; pragma Assert (X.Prev.Next = Container.Last); Container.Last := X.Prev; Container.Last.Next := null; Container.Length := Container.Length - 1; Free (X); end loop; end Delete_Last; ------------- -- Element -- ------------- function Element (Position : Cursor) return Element_Type is begin if Checks and then Position.Node = null then raise Constraint_Error with "Position cursor has no element"; end if; pragma Assert (Vet (Position), "bad cursor in Element"); return Position.Node.Element; end Element; -------------- -- Finalize -- -------------- procedure Finalize (Object : in out Iterator) is begin if Object.Container /= null then Unbusy (Object.Container.TC); end if; end Finalize; ---------- -- Find -- ---------- function Find (Container : List; Item : Element_Type; Position : Cursor := No_Element) return Cursor is Node : Node_Access := Position.Node; begin if Node = null then Node := Container.First; else if Checks and then Position.Container /= Container'Unrestricted_Access then raise Program_Error with "Position cursor designates wrong container"; end if; pragma Assert (Vet (Position), "bad cursor in Find"); end if; -- Per AI05-0022, the container implementation is required to detect -- element tampering by a generic actual subprogram. declare Lock : With_Lock (Container.TC'Unrestricted_Access); begin while Node /= null loop if Node.Element = Item then return Cursor'(Container'Unrestricted_Access, Node); end if; Node := Node.Next; end loop; return No_Element; end; end Find; ----------- -- First -- ----------- function First (Container : List) return Cursor is begin if Container.First = null then return No_Element; else return Cursor'(Container'Unrestricted_Access, Container.First); end if; end First; function First (Object : Iterator) return Cursor is begin -- The value of the iterator object's Node component influences the -- behavior of the First (and Last) selector function. -- When the Node component is null, this means the iterator object was -- constructed without a start expression, in which case the (forward) -- iteration starts from the (logical) beginning of the entire sequence -- of items (corresponding to Container.First, for a forward iterator). -- Otherwise, this is iteration over a partial sequence of items. When -- the Node component is non-null, the iterator object was constructed -- with a start expression, that specifies the position from which the -- (forward) partial iteration begins. if Object.Node = null then return Doubly_Linked_Lists.First (Object.Container.all); else return Cursor'(Object.Container, Object.Node); end if; end First; ------------------- -- First_Element -- ------------------- function First_Element (Container : List) return Element_Type is begin if Checks and then Container.First = null then raise Constraint_Error with "list is empty"; end if; return Container.First.Element; end First_Element; ---------- -- Free -- ---------- procedure Free (X : in out Node_Access) is procedure Deallocate is new Ada.Unchecked_Deallocation (Node_Type, Node_Access); begin -- While a node is in use, as an active link in a list, its Previous and -- Next components must be null, or designate a different node; this is -- a node invariant. Before actually deallocating the node, we set both -- access value components of the node to point to the node itself, thus -- falsifying the node invariant. Subprogram Vet inspects the value of -- the node components when interrogating the node, in order to detect -- whether the cursor's node access value is dangling. -- Note that we have no guarantee that the storage for the node isn't -- modified when it is deallocated, but there are other tests that Vet -- does if node invariants appear to be satisifed. However, in practice -- this simple test works well enough, detecting dangling references -- immediately, without needing further interrogation. X.Prev := X; X.Next := X; Deallocate (X); end Free; --------------------- -- Generic_Sorting -- --------------------- package body Generic_Sorting is --------------- -- Is_Sorted -- --------------- function Is_Sorted (Container : List) return Boolean is -- Per AI05-0022, the container implementation is required to detect -- element tampering by a generic actual subprogram. Lock : With_Lock (Container.TC'Unrestricted_Access); Node : Node_Access; begin Node := Container.First; for Idx in 2 .. Container.Length loop if Node.Next.Element < Node.Element then return False; end if; Node := Node.Next; end loop; return True; end Is_Sorted; ----------- -- Merge -- ----------- procedure Merge (Target : in out List; Source : in out List) is begin TC_Check (Target.TC); TC_Check (Source.TC); -- The semantics of Merge changed slightly per AI05-0021. It was -- originally the case that if Target and Source denoted the same -- container object, then the GNAT implementation of Merge did -- nothing. However, it was argued that RM05 did not precisely -- specify the semantics for this corner case. The decision of the -- ARG was that if Target and Source denote the same non-empty -- container object, then Program_Error is raised. if Source.Is_Empty then return; end if; if Checks and then Target'Address = Source'Address then raise Program_Error with "Target and Source denote same non-empty container"; end if; if Checks and then Target.Length > Count_Type'Last - Source.Length then raise Constraint_Error with "new length exceeds maximum"; end if; -- Per AI05-0022, the container implementation is required to detect -- element tampering by a generic actual subprogram. declare Lock_Target : With_Lock (Target.TC'Unchecked_Access); Lock_Source : With_Lock (Source.TC'Unchecked_Access); LI, RI, RJ : Node_Access; begin LI := Target.First; RI := Source.First; while RI /= null loop pragma Assert (RI.Next = null or else not (RI.Next.Element < RI.Element)); if LI = null then Splice_Internal (Target, null, Source); exit; end if; pragma Assert (LI.Next = null or else not (LI.Next.Element < LI.Element)); if RI.Element < LI.Element then RJ := RI; RI := RI.Next; Splice_Internal (Target, LI, Source, RJ); else LI := LI.Next; end if; end loop; end; end Merge; ---------- -- Sort -- ---------- procedure Sort (Container : in out List) is procedure Partition (Pivot : Node_Access; Back : Node_Access); procedure Sort (Front, Back : Node_Access); --------------- -- Partition -- --------------- procedure Partition (Pivot : Node_Access; Back : Node_Access) is Node : Node_Access; begin Node := Pivot.Next; while Node /= Back loop if Node.Element < Pivot.Element then declare Prev : constant Node_Access := Node.Prev; Next : constant Node_Access := Node.Next; begin Prev.Next := Next; if Next = null then Container.Last := Prev; else Next.Prev := Prev; end if; Node.Next := Pivot; Node.Prev := Pivot.Prev; Pivot.Prev := Node; if Node.Prev = null then Container.First := Node; else Node.Prev.Next := Node; end if; Node := Next; end; else Node := Node.Next; end if; end loop; end Partition; ---------- -- Sort -- ---------- procedure Sort (Front, Back : Node_Access) is Pivot : constant Node_Access := (if Front = null then Container.First else Front.Next); begin if Pivot /= Back then Partition (Pivot, Back); Sort (Front, Pivot); Sort (Pivot, Back); end if; end Sort; -- Start of processing for Sort begin if Container.Length <= 1 then return; end if; pragma Assert (Container.First.Prev = null); pragma Assert (Container.Last.Next = null); TC_Check (Container.TC); -- Per AI05-0022, the container implementation is required to detect -- element tampering by a generic actual subprogram. declare Lock : With_Lock (Container.TC'Unchecked_Access); begin Sort (Front => null, Back => null); end; pragma Assert (Container.First.Prev = null); pragma Assert (Container.Last.Next = null); end Sort; end Generic_Sorting; ------------------------ -- Get_Element_Access -- ------------------------ function Get_Element_Access (Position : Cursor) return not null Element_Access is begin return Position.Node.Element'Access; end Get_Element_Access; ----------------- -- Has_Element -- ----------------- function Has_Element (Position : Cursor) return Boolean is begin pragma Assert (Vet (Position), "bad cursor in Has_Element"); return Position.Node /= null; end Has_Element; ------------ -- Insert -- ------------ procedure Insert (Container : in out List; Before : Cursor; New_Item : Element_Type; Position : out Cursor; Count : Count_Type := 1) is First_Node : Node_Access; New_Node : Node_Access; begin TC_Check (Container.TC); if Before.Container /= null then if Checks and then Before.Container /= Container'Unrestricted_Access then raise Program_Error with "Before cursor designates wrong list"; end if; pragma Assert (Vet (Before), "bad cursor in Insert"); end if; if Count = 0 then Position := Before; return; end if; if Checks and then Container.Length > Count_Type'Last - Count then raise Constraint_Error with "new length exceeds maximum"; end if; New_Node := new Node_Type'(New_Item, null, null); First_Node := New_Node; Insert_Internal (Container, Before.Node, New_Node); for J in 2 .. Count loop New_Node := new Node_Type'(New_Item, null, null); Insert_Internal (Container, Before.Node, New_Node); end loop; Position := Cursor'(Container'Unchecked_Access, First_Node); end Insert; procedure Insert (Container : in out List; Before : Cursor; New_Item : Element_Type; Count : Count_Type := 1) is Position : Cursor; pragma Unreferenced (Position); begin Insert (Container, Before, New_Item, Position, Count); end Insert; procedure Insert (Container : in out List; Before : Cursor; Position : out Cursor; Count : Count_Type := 1) is First_Node : Node_Access; New_Node : Node_Access; begin TC_Check (Container.TC); if Before.Container /= null then if Checks and then Before.Container /= Container'Unrestricted_Access then raise Program_Error with "Before cursor designates wrong list"; end if; pragma Assert (Vet (Before), "bad cursor in Insert"); end if; if Count = 0 then Position := Before; return; end if; if Checks and then Container.Length > Count_Type'Last - Count then raise Constraint_Error with "new length exceeds maximum"; end if; New_Node := new Node_Type; First_Node := New_Node; Insert_Internal (Container, Before.Node, New_Node); for J in 2 .. Count loop New_Node := new Node_Type; Insert_Internal (Container, Before.Node, New_Node); end loop; Position := Cursor'(Container'Unchecked_Access, First_Node); end Insert; --------------------- -- Insert_Internal -- --------------------- procedure Insert_Internal (Container : in out List; Before : Node_Access; New_Node : Node_Access) is begin if Container.Length = 0 then pragma Assert (Before = null); pragma Assert (Container.First = null); pragma Assert (Container.Last = null); Container.First := New_Node; Container.Last := New_Node; elsif Before = null then pragma Assert (Container.Last.Next = null); Container.Last.Next := New_Node; New_Node.Prev := Container.Last; Container.Last := New_Node; elsif Before = Container.First then pragma Assert (Container.First.Prev = null); Container.First.Prev := New_Node; New_Node.Next := Container.First; Container.First := New_Node; else pragma Assert (Container.First.Prev = null); pragma Assert (Container.Last.Next = null); New_Node.Next := Before; New_Node.Prev := Before.Prev; Before.Prev.Next := New_Node; Before.Prev := New_Node; end if; Container.Length := Container.Length + 1; end Insert_Internal; -------------- -- Is_Empty -- -------------- function Is_Empty (Container : List) return Boolean is begin return Container.Length = 0; end Is_Empty; ------------- -- Iterate -- ------------- procedure Iterate (Container : List; Process : not null access procedure (Position : Cursor)) is Busy : With_Busy (Container.TC'Unrestricted_Access); Node : Node_Access := Container.First; begin while Node /= null loop Process (Cursor'(Container'Unrestricted_Access, Node)); Node := Node.Next; end loop; end Iterate; function Iterate (Container : List) return List_Iterator_Interfaces.Reversible_Iterator'Class is begin -- The value of the Node component influences the behavior of the First -- and Last selector functions of the iterator object. When the Node -- component is null (as is the case here), this means the iterator -- object was constructed without a start expression. This is a -- complete iterator, meaning that the iteration starts from the -- (logical) beginning of the sequence of items. -- Note: For a forward iterator, Container.First is the beginning, and -- for a reverse iterator, Container.Last is the beginning. return It : constant Iterator := Iterator'(Limited_Controlled with Container => Container'Unrestricted_Access, Node => null) do Busy (Container.TC'Unrestricted_Access.all); end return; end Iterate; function Iterate (Container : List; Start : Cursor) return List_Iterator_Interfaces.Reversible_Iterator'Class is begin -- It was formerly the case that when Start = No_Element, the partial -- iterator was defined to behave the same as for a complete iterator, -- and iterate over the entire sequence of items. However, those -- semantics were unintuitive and arguably error-prone (it is too easy -- to accidentally create an endless loop), and so they were changed, -- per the ARG meeting in Denver on 2011/11. However, there was no -- consensus about what positive meaning this corner case should have, -- and so it was decided to simply raise an exception. This does imply, -- however, that it is not possible to use a partial iterator to specify -- an empty sequence of items. if Checks and then Start = No_Element then raise Constraint_Error with "Start position for iterator equals No_Element"; end if; if Checks and then Start.Container /= Container'Unrestricted_Access then raise Program_Error with "Start cursor of Iterate designates wrong list"; end if; pragma Assert (Vet (Start), "Start cursor of Iterate is bad"); -- The value of the Node component influences the behavior of the First -- and Last selector functions of the iterator object. When the Node -- component is non-null (as is the case here), it means that this is a -- partial iteration, over a subset of the complete sequence of items. -- The iterator object was constructed with a start expression, -- indicating the position from which the iteration begins. Note that -- the start position has the same value irrespective of whether this is -- a forward or reverse iteration. return It : constant Iterator := Iterator'(Limited_Controlled with Container => Container'Unrestricted_Access, Node => Start.Node) do Busy (Container.TC'Unrestricted_Access.all); end return; end Iterate; ---------- -- Last -- ---------- function Last (Container : List) return Cursor is begin if Container.Last = null then return No_Element; else return Cursor'(Container'Unrestricted_Access, Container.Last); end if; end Last; function Last (Object : Iterator) return Cursor is begin -- The value of the iterator object's Node component influences the -- behavior of the Last (and First) selector function. -- When the Node component is null, this means the iterator object was -- constructed without a start expression, in which case the (reverse) -- iteration starts from the (logical) beginning of the entire sequence -- (corresponding to Container.Last, for a reverse iterator). -- Otherwise, this is iteration over a partial sequence of items. When -- the Node component is non-null, the iterator object was constructed -- with a start expression, that specifies the position from which the -- (reverse) partial iteration begins. if Object.Node = null then return Doubly_Linked_Lists.Last (Object.Container.all); else return Cursor'(Object.Container, Object.Node); end if; end Last; ------------------ -- Last_Element -- ------------------ function Last_Element (Container : List) return Element_Type is begin if Checks and then Container.Last = null then raise Constraint_Error with "list is empty"; end if; return Container.Last.Element; end Last_Element; ------------ -- Length -- ------------ function Length (Container : List) return Count_Type is begin return Container.Length; end Length; ---------- -- Move -- ---------- procedure Move (Target : in out List; Source : in out List) is begin if Target'Address = Source'Address then return; end if; TC_Check (Source.TC); Clear (Target); Target.First := Source.First; Source.First := null; Target.Last := Source.Last; Source.Last := null; Target.Length := Source.Length; Source.Length := 0; end Move; ---------- -- Next -- ---------- procedure Next (Position : in out Cursor) is begin Position := Next (Position); end Next; function Next (Position : Cursor) return Cursor is begin if Position.Node = null then return No_Element; else pragma Assert (Vet (Position), "bad cursor in Next"); declare Next_Node : constant Node_Access := Position.Node.Next; begin if Next_Node = null then return No_Element; else return Cursor'(Position.Container, Next_Node); end if; end; end if; end Next; function Next (Object : Iterator; Position : Cursor) return Cursor is begin if Position.Container = null then return No_Element; end if; if Checks and then Position.Container /= Object.Container then raise Program_Error with "Position cursor of Next designates wrong list"; end if; return Next (Position); end Next; ------------- -- Prepend -- ------------- procedure Prepend (Container : in out List; New_Item : Element_Type; Count : Count_Type := 1) is begin Insert (Container, First (Container), New_Item, Count); end Prepend; -------------- -- Previous -- -------------- procedure Previous (Position : in out Cursor) is begin Position := Previous (Position); end Previous; function Previous (Position : Cursor) return Cursor is begin if Position.Node = null then return No_Element; else pragma Assert (Vet (Position), "bad cursor in Previous"); declare Prev_Node : constant Node_Access := Position.Node.Prev; begin if Prev_Node = null then return No_Element; else return Cursor'(Position.Container, Prev_Node); end if; end; end if; end Previous; function Previous (Object : Iterator; Position : Cursor) return Cursor is begin if Position.Container = null then return No_Element; end if; if Checks and then Position.Container /= Object.Container then raise Program_Error with "Position cursor of Previous designates wrong list"; end if; return Previous (Position); end Previous; ---------------------- -- Pseudo_Reference -- ---------------------- function Pseudo_Reference (Container : aliased List'Class) return Reference_Control_Type is TC : constant Tamper_Counts_Access := Container.TC'Unrestricted_Access; begin return R : constant Reference_Control_Type := (Controlled with TC) do Busy (TC.all); end return; end Pseudo_Reference; ------------------- -- Query_Element -- ------------------- procedure Query_Element (Position : Cursor; Process : not null access procedure (Element : Element_Type)) is begin if Checks and then Position.Node = null then raise Constraint_Error with "Position cursor has no element"; end if; pragma Assert (Vet (Position), "bad cursor in Query_Element"); declare Lock : With_Lock (Position.Container.TC'Unrestricted_Access); begin Process (Position.Node.Element); end; end Query_Element; --------------- -- Put_Image -- --------------- procedure Put_Image (S : in out Ada.Strings.Text_Buffers.Root_Buffer_Type'Class; V : List) is First_Time : Boolean := True; use System.Put_Images; begin Array_Before (S); for X of V loop if First_Time then First_Time := False; else Simple_Array_Between (S); end if; Element_Type'Put_Image (S, X); end loop; Array_After (S); end Put_Image; ---------- -- Read -- ---------- procedure Read (Stream : not null access Root_Stream_Type'Class; Item : out List) is N : Count_Type'Base; X : Node_Access; begin Clear (Item); Count_Type'Base'Read (Stream, N); if N = 0 then return; end if; X := new Node_Type; begin Element_Type'Read (Stream, X.Element); exception when others => Free (X); raise; end; Item.First := X; Item.Last := X; loop Item.Length := Item.Length + 1; exit when Item.Length = N; X := new Node_Type; begin Element_Type'Read (Stream, X.Element); exception when others => Free (X); raise; end; X.Prev := Item.Last; Item.Last.Next := X; Item.Last := X; end loop; end Read; procedure Read (Stream : not null access Root_Stream_Type'Class; Item : out Cursor) is begin raise Program_Error with "attempt to stream list cursor"; 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; 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; --------------- -- Reference -- --------------- function Reference (Container : aliased in out List; Position : Cursor) return Reference_Type is begin if Checks and then Position.Container = null then raise Constraint_Error with "Position cursor has no element"; end if; if Checks and then Position.Container /= Container'Unchecked_Access then raise Program_Error with "Position cursor designates wrong container"; end if; pragma Assert (Vet (Position), "bad cursor in function Reference"); declare TC : constant Tamper_Counts_Access := Container.TC'Unrestricted_Access; begin return R : constant Reference_Type := (Element => Position.Node.Element'Access, Control => (Controlled with TC)) do Busy (TC.all); end return; end; end Reference; --------------------- -- Replace_Element -- --------------------- procedure Replace_Element (Container : in out List; Position : Cursor; New_Item : Element_Type) is begin TE_Check (Container.TC); if Checks and then Position.Container = null then raise Constraint_Error with "Position cursor has no element"; end if; if Checks and then Position.Container /= Container'Unchecked_Access then raise Program_Error with "Position cursor designates wrong container"; end if; pragma Assert (Vet (Position), "bad cursor in Replace_Element"); Position.Node.Element := New_Item; end Replace_Element; ---------------------- -- Reverse_Elements -- ---------------------- procedure Reverse_Elements (Container : in out List) is I : Node_Access := Container.First; J : Node_Access := Container.Last; procedure Swap (L, R : Node_Access); ---------- -- Swap -- ---------- procedure Swap (L, R : Node_Access) is LN : constant Node_Access := L.Next; LP : constant Node_Access := L.Prev; RN : constant Node_Access := R.Next; RP : constant Node_Access := R.Prev; begin if LP /= null then LP.Next := R; end if; if RN /= null then RN.Prev := L; end if; L.Next := RN; R.Prev := LP; if LN = R then pragma Assert (RP = L); L.Prev := R; R.Next := L; else L.Prev := RP; RP.Next := L; R.Next := LN; LN.Prev := R; end if; end Swap; -- Start of processing for Reverse_Elements begin if Container.Length <= 1 then return; end if; pragma Assert (Container.First.Prev = null); pragma Assert (Container.Last.Next = null); TC_Check (Container.TC); Container.First := J; Container.Last := I; loop Swap (L => I, R => J); J := J.Next; exit when I = J; I := I.Prev; exit when I = J; Swap (L => J, R => I); I := I.Next; exit when I = J; J := J.Prev; exit when I = J; end loop; pragma Assert (Container.First.Prev = null); pragma Assert (Container.Last.Next = null); end Reverse_Elements; ------------------ -- Reverse_Find -- ------------------ function Reverse_Find (Container : List; Item : Element_Type; Position : Cursor := No_Element) return Cursor is Node : Node_Access := Position.Node; begin if Node = null then Node := Container.Last; else if Checks and then Position.Container /= Container'Unrestricted_Access then raise Program_Error with "Position cursor designates wrong container"; end if; pragma Assert (Vet (Position), "bad cursor in Reverse_Find"); end if; -- Per AI05-0022, the container implementation is required to detect -- element tampering by a generic actual subprogram. declare Lock : With_Lock (Container.TC'Unrestricted_Access); begin while Node /= null loop if Node.Element = Item then return Cursor'(Container'Unrestricted_Access, Node); end if; Node := Node.Prev; end loop; return No_Element; end; end Reverse_Find; --------------------- -- Reverse_Iterate -- --------------------- procedure Reverse_Iterate (Container : List; Process : not null access procedure (Position : Cursor)) is Busy : With_Busy (Container.TC'Unrestricted_Access); Node : Node_Access := Container.Last; begin while Node /= null loop Process (Cursor'(Container'Unrestricted_Access, Node)); Node := Node.Prev; end loop; end Reverse_Iterate; ------------ -- Splice -- ------------ procedure Splice (Target : in out List; Before : Cursor; Source : in out List) is begin TC_Check (Target.TC); TC_Check (Source.TC); if Before.Container /= null then if Checks and then Before.Container /= Target'Unrestricted_Access then raise Program_Error with "Before cursor designates wrong container"; end if; pragma Assert (Vet (Before), "bad cursor in Splice"); end if; if Target'Address = Source'Address or else Source.Length = 0 then return; end if; if Checks and then Target.Length > Count_Type'Last - Source.Length then raise Constraint_Error with "new length exceeds maximum"; end if; Splice_Internal (Target, Before.Node, Source); end Splice; procedure Splice (Container : in out List; Before : Cursor; Position : Cursor) is begin TC_Check (Container.TC); if Before.Container /= null then if Checks and then Before.Container /= Container'Unchecked_Access then raise Program_Error with "Before cursor designates wrong container"; end if; pragma Assert (Vet (Before), "bad Before cursor in Splice"); end if; if Checks and then Position.Node = null then raise Constraint_Error with "Position cursor has no element"; end if; if Checks and then Position.Container /= Container'Unrestricted_Access then raise Program_Error with "Position cursor designates wrong container"; end if; pragma Assert (Vet (Position), "bad Position cursor in Splice"); if Position.Node = Before.Node or else Position.Node.Next = Before.Node then return; end if; pragma Assert (Container.Length >= 2); if Before.Node = null then pragma Assert (Position.Node /= Container.Last); if Position.Node = Container.First then Container.First := Position.Node.Next; Container.First.Prev := null; else Position.Node.Prev.Next := Position.Node.Next; Position.Node.Next.Prev := Position.Node.Prev; end if; Container.Last.Next := Position.Node; Position.Node.Prev := Container.Last; Container.Last := Position.Node; Container.Last.Next := null; return; end if; if Before.Node = Container.First then pragma Assert (Position.Node /= Container.First); if Position.Node = Container.Last then Container.Last := Position.Node.Prev; Container.Last.Next := null; else Position.Node.Prev.Next := Position.Node.Next; Position.Node.Next.Prev := Position.Node.Prev; end if; Container.First.Prev := Position.Node; Position.Node.Next := Container.First; Container.First := Position.Node; Container.First.Prev := null; return; end if; if Position.Node = Container.First then Container.First := Position.Node.Next; Container.First.Prev := null; elsif Position.Node = Container.Last then Container.Last := Position.Node.Prev; Container.Last.Next := null; else Position.Node.Prev.Next := Position.Node.Next; Position.Node.Next.Prev := Position.Node.Prev; end if; Before.Node.Prev.Next := Position.Node; Position.Node.Prev := Before.Node.Prev; Before.Node.Prev := Position.Node; Position.Node.Next := Before.Node; pragma Assert (Container.First.Prev = null); pragma Assert (Container.Last.Next = null); end Splice; procedure Splice (Target : in out List; Before : Cursor; Source : in out List; Position : in out Cursor) is begin if Target'Address = Source'Address then Splice (Target, Before, Position); return; end if; TC_Check (Target.TC); TC_Check (Source.TC); if Before.Container /= null then if Checks and then Before.Container /= Target'Unrestricted_Access then raise Program_Error with "Before cursor designates wrong container"; end if; pragma Assert (Vet (Before), "bad Before cursor in Splice"); end if; if Checks and then Position.Node = null then raise Constraint_Error with "Position cursor has no element"; end if; if Checks and then Position.Container /= Source'Unrestricted_Access then raise Program_Error with "Position cursor designates wrong container"; end if; pragma Assert (Vet (Position), "bad Position cursor in Splice"); if Checks and then Target.Length = Count_Type'Last then raise Constraint_Error with "Target is full"; end if; Splice_Internal (Target, Before.Node, Source, Position.Node); Position.Container := Target'Unchecked_Access; end Splice; --------------------- -- Splice_Internal -- --------------------- procedure Splice_Internal (Target : in out List; Before : Node_Access; Source : in out List) is begin -- This implements the corresponding Splice operation, after the -- parameters have been vetted, and corner-cases disposed of. pragma Assert (Target'Address /= Source'Address); pragma Assert (Source.Length > 0); pragma Assert (Source.First /= null); pragma Assert (Source.First.Prev = null); pragma Assert (Source.Last /= null); pragma Assert (Source.Last.Next = null); pragma Assert (Target.Length <= Count_Type'Last - Source.Length); if Target.Length = 0 then pragma Assert (Target.First = null); pragma Assert (Target.Last = null); pragma Assert (Before = null); Target.First := Source.First; Target.Last := Source.Last; elsif Before = null then pragma Assert (Target.Last.Next = null); Target.Last.Next := Source.First; Source.First.Prev := Target.Last; Target.Last := Source.Last; elsif Before = Target.First then pragma Assert (Target.First.Prev = null); Source.Last.Next := Target.First; Target.First.Prev := Source.Last; Target.First := Source.First; else pragma Assert (Target.Length >= 2); Before.Prev.Next := Source.First; Source.First.Prev := Before.Prev; Before.Prev := Source.Last; Source.Last.Next := Before; end if; Source.First := null; Source.Last := null; Target.Length := Target.Length + Source.Length; Source.Length := 0; end Splice_Internal; procedure Splice_Internal (Target : in out List; Before : Node_Access; -- node of Target Source : in out List; Position : Node_Access) -- node of Source is begin -- This implements the corresponding Splice operation, after the -- parameters have been vetted. pragma Assert (Target'Address /= Source'Address); pragma Assert (Target.Length < Count_Type'Last); pragma Assert (Source.Length > 0); pragma Assert (Source.First /= null); pragma Assert (Source.First.Prev = null); pragma Assert (Source.Last /= null); pragma Assert (Source.Last.Next = null); pragma Assert (Position /= null); if Position = Source.First then Source.First := Position.Next; if Position = Source.Last then pragma Assert (Source.First = null); pragma Assert (Source.Length = 1); Source.Last := null; else Source.First.Prev := null; end if; elsif Position = Source.Last then pragma Assert (Source.Length >= 2); Source.Last := Position.Prev; Source.Last.Next := null; else pragma Assert (Source.Length >= 3); Position.Prev.Next := Position.Next; Position.Next.Prev := Position.Prev; end if; if Target.Length = 0 then pragma Assert (Target.First = null); pragma Assert (Target.Last = null); pragma Assert (Before = null); Target.First := Position; Target.Last := Position; Target.First.Prev := null; Target.Last.Next := null; elsif Before = null then pragma Assert (Target.Last.Next = null); Target.Last.Next := Position; Position.Prev := Target.Last; Target.Last := Position; Target.Last.Next := null; elsif Before = Target.First then pragma Assert (Target.First.Prev = null); Target.First.Prev := Position; Position.Next := Target.First; Target.First := Position; Target.First.Prev := null; else pragma Assert (Target.Length >= 2); Before.Prev.Next := Position; Position.Prev := Before.Prev; Before.Prev := Position; Position.Next := Before; end if; Target.Length := Target.Length + 1; Source.Length := Source.Length - 1; end Splice_Internal; ---------- -- Swap -- ---------- procedure Swap (Container : in out List; I, J : Cursor) is begin TE_Check (Container.TC); if Checks and then I.Node = null then raise Constraint_Error with "I cursor has no element"; end if; if Checks and then J.Node = null then raise Constraint_Error with "J cursor has no element"; end if; if Checks and then I.Container /= Container'Unchecked_Access then raise Program_Error with "I cursor designates wrong container"; end if; if Checks and then J.Container /= Container'Unchecked_Access then raise Program_Error with "J cursor designates wrong container"; end if; if I.Node = J.Node then return; end if; pragma Assert (Vet (I), "bad I cursor in Swap"); pragma Assert (Vet (J), "bad J cursor in Swap"); declare EI : Element_Type renames I.Node.Element; EJ : Element_Type renames J.Node.Element; EI_Copy : constant Element_Type := EI; begin EI := EJ; EJ := EI_Copy; end; end Swap; ---------------- -- Swap_Links -- ---------------- procedure Swap_Links (Container : in out List; I, J : Cursor) is begin TC_Check (Container.TC); if Checks and then I.Node = null then raise Constraint_Error with "I cursor has no element"; end if; if Checks and then J.Node = null then raise Constraint_Error with "J cursor has no element"; end if; if Checks and then I.Container /= Container'Unrestricted_Access then raise Program_Error with "I cursor designates wrong container"; end if; if Checks and then J.Container /= Container'Unrestricted_Access then raise Program_Error with "J cursor designates wrong container"; end if; if I.Node = J.Node then return; end if; pragma Assert (Vet (I), "bad I cursor in Swap_Links"); pragma Assert (Vet (J), "bad J cursor in Swap_Links"); declare I_Next : constant Cursor := Next (I); begin if I_Next = J then Splice (Container, Before => I, Position => J); else declare J_Next : constant Cursor := Next (J); begin if J_Next = I then Splice (Container, Before => J, Position => I); else pragma Assert (Container.Length >= 3); Splice (Container, Before => I_Next, Position => J); Splice (Container, Before => J_Next, Position => I); end if; end; end if; end; end Swap_Links; -------------------- -- Update_Element -- -------------------- procedure Update_Element (Container : in out List; Position : Cursor; Process : not null access procedure (Element : in out Element_Type)) is begin if Checks and then Position.Node = null then raise Constraint_Error with "Position cursor has no element"; end if; if Checks and then Position.Container /= Container'Unchecked_Access then raise Program_Error with "Position cursor designates wrong container"; end if; pragma Assert (Vet (Position), "bad cursor in Update_Element"); declare Lock : With_Lock (Container.TC'Unchecked_Access); begin Process (Position.Node.Element); end; end Update_Element; --------- -- Vet -- --------- function Vet (Position : Cursor) return Boolean is begin if Position.Node = null then return Position.Container = null; end if; if Position.Container = null then return False; end if; -- An invariant of a node is that its Previous and Next components can -- be null, or designate a different node. Operation Free sets the -- access value components of the node to designate the node itself -- before actually deallocating the node, thus deliberately violating -- the node invariant. This gives us a simple way to detect a dangling -- reference to a node. if Position.Node.Next = Position.Node then return False; end if; if Position.Node.Prev = Position.Node then return False; end if; -- In practice the tests above will detect most instances of a dangling -- reference. If we get here, it means that the invariants of the -- designated node are satisfied (they at least appear to be satisfied), -- so we perform some more tests, to determine whether invariants of the -- designated list are satisfied too. declare L : List renames Position.Container.all; begin if L.Length = 0 then return False; end if; if L.First = null then return False; end if; if L.Last = null then return False; end if; if L.First.Prev /= null then return False; end if; if L.Last.Next /= null then return False; end if; if Position.Node.Prev = null and then Position.Node /= L.First then return False; end if; pragma Assert (Position.Node.Prev /= null or else Position.Node = L.First); if Position.Node.Next = null and then Position.Node /= L.Last then return False; end if; pragma Assert (Position.Node.Next /= null or else Position.Node = L.Last); if L.Length = 1 then return L.First = L.Last; end if; if L.First = L.Last then return False; end if; if L.First.Next = null then return False; end if; if L.Last.Prev = null then return False; end if; if L.First.Next.Prev /= L.First then return False; end if; if L.Last.Prev.Next /= L.Last then return False; end if; if L.Length = 2 then if L.First.Next /= L.Last then return False; elsif L.Last.Prev /= L.First then return False; else return True; end if; end if; if L.First.Next = L.Last then return False; end if; if L.Last.Prev = L.First then return False; end if; -- Eliminate earlier possibility if Position.Node = L.First then return True; end if; pragma Assert (Position.Node.Prev /= null); -- Eliminate earlier possibility if Position.Node = L.Last then return True; end if; pragma Assert (Position.Node.Next /= null); if Position.Node.Next.Prev /= Position.Node then return False; end if; if Position.Node.Prev.Next /= Position.Node then return False; end if; if L.Length = 3 then if L.First.Next /= Position.Node then return False; elsif L.Last.Prev /= Position.Node then return False; end if; end if; return True; end; end Vet; ----------- -- Write -- ----------- procedure Write (Stream : not null access Root_Stream_Type'Class; Item : List) is Node : Node_Access; begin Count_Type'Base'Write (Stream, Item.Length); Node := Item.First; while Node /= null loop Element_Type'Write (Stream, Node.Element); Node := Node.Next; end loop; end Write; procedure Write (Stream : not null access Root_Stream_Type'Class; Item : Cursor) is begin raise Program_Error with "attempt to stream list cursor"; 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.Doubly_Linked_Lists;
-- Copyright (c) 2020-2021 Bartek thindil Jasicki <thindil@laeran.pl> -- -- 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 Ada.Containers; use Ada.Containers; with Ada.Strings; use Ada.Strings; with Ada.Strings.Fixed; use Ada.Strings.Fixed; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with GNAT.String_Split; use GNAT.String_Split; with Tcl.Ada; use Tcl.Ada; with Tcl.Tk.Ada.Widgets.Toplevel.MainWindow; use Tcl.Tk.Ada.Widgets.Toplevel.MainWindow; with Tcl.Tk.Ada.Widgets.Menu; use Tcl.Tk.Ada.Widgets.Menu; with Tcl.Tk.Ada.Winfo; use Tcl.Tk.Ada.Winfo; with Bases; use Bases; with BasesTypes; use BasesTypes; with Combat; use Combat; with Combat.UI; use Combat.UI; with Crafts; use Crafts; with Crew; use Crew; with Dialogs; use Dialogs; with Events; use Events; with Factions; use Factions; with Game; use Game; with Items; use Items; with Maps; use Maps; with Maps.UI; use Maps.UI; with Messages; use Messages; with Missions; use Missions; with Ships; use Ships; with Ships.Cargo; use Ships.Cargo; with Ships.Crew; use Ships.Crew; with Ships.Movement; use Ships.Movement; with Stories; use Stories; with Trades; use Trades; with Utils; use Utils; with Utils.UI; use Utils.UI; with WaitMenu; use WaitMenu; package body OrdersMenu is function Show_Orders_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(ClientData, Argc, Argv); HaveTrader: Boolean := False; BaseIndex: constant Natural := SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y).BaseIndex; MissionsLimit: Integer; Event: Events_Types := None; ItemIndex: Natural; OrdersMenu: constant Tk_Menu := Get_Widget(".orders", Interp); begin if Winfo_Get(OrdersMenu, "ismapped") = "1" then if Invoke(OrdersMenu, "end") /= "" then return TCL_ERROR; end if; return TCL_OK; end if; Delete(OrdersMenu, "0", "end"); if FindMember(Talk) > 0 then HaveTrader := True; end if; if CurrentStory.Index /= Null_Unbounded_String then declare Step: constant Step_Data := (if CurrentStory.CurrentStep = 0 then Stories_List(CurrentStory.Index).StartingStep elsif CurrentStory.CurrentStep > 0 then Stories_List(CurrentStory.Index).Steps (CurrentStory.CurrentStep) else Stories_List(CurrentStory.Index).FinalStep); begin case Step.FinishCondition is when ASKINBASE => if BaseIndex > 0 then if CurrentStory.Data = Null_Unbounded_String or CurrentStory.Data = Sky_Bases(BaseIndex).Name then Add (OrdersMenu, "command", "-label {Ask for " & To_String (Items_List(GetStepData(Step.FinishData, "item")) .Name) & "} -underline 4 -command ExecuteStory"); end if; end if; when DESTROYSHIP => declare Tokens: Slice_Set; begin Create(Tokens, To_String(CurrentStory.Data), ";"); if Player_Ship.Sky_X = Positive'Value(Slice(Tokens, 1)) and Player_Ship.Sky_Y = Positive'Value(Slice(Tokens, 2)) then Add (OrdersMenu, "command", "-label {Search for " & To_String (Proto_Ships_List (To_Unbounded_String(Slice(Tokens, 3))) .Name) & "} -underline 0 -command ExecuteStory"); end if; end; when EXPLORE => declare Tokens: Slice_Set; begin Create(Tokens, To_String(CurrentStory.Data), ";"); if Player_Ship.Sky_X = Positive'Value(Slice(Tokens, 1)) and Player_Ship.Sky_Y = Positive'Value(Slice(Tokens, 2)) then Add (OrdersMenu, "command", "-label {Search area} -underline 0 -command ExecuteStory"); end if; end; when ANY | LOOT => null; end case; end; end if; if Player_Ship.Speed = DOCKED then Add (OrdersMenu, "command", "-label {Undock} -underline 0 -command {Docking}"); if Sky_Bases(BaseIndex).Population > 0 then Add (OrdersMenu, "command", "-label {Escape} -underline 3 -command {Docking escape}"); end if; if HaveTrader and Sky_Bases(BaseIndex).Population > 0 then Add (OrdersMenu, "command", "-label {Trade} -underline 0 -command ShowTrade"); Add (OrdersMenu, "command", "-label {School} -underline 0 -command ShowSchool"); if Sky_Bases(BaseIndex).Recruits.Length > 0 then Add (OrdersMenu, "command", "-label {Recruit} -underline 0 -command ShowRecruit"); end if; if Days_Difference(Sky_Bases(BaseIndex).Asked_For_Events) > 6 then Add (OrdersMenu, "command", "-label {Ask for events} -underline 8 -command AskForEvents"); end if; if not Sky_Bases(BaseIndex).Asked_For_Bases then Add (OrdersMenu, "command", "-label {Ask for bases} -underline 8 -command AskForBases"); end if; if Bases_Types_List(Sky_Bases(BaseIndex).Base_Type).Flags.Contains (To_Unbounded_String("temple")) then Add(OrdersMenu, "command", "-label {Pray} -command Pray"); end if; Add_Heal_Wounded_Menu_Loop : for Member of Player_Ship.Crew loop if Member.Health < 100 then Add (OrdersMenu, "command", "-label {Heal wounded} -underline 5 -command {ShowBaseUI heal}"); exit Add_Heal_Wounded_Menu_Loop; end if; end loop Add_Heal_Wounded_Menu_Loop; Add_Repair_Ship_Menu_Loop : for Module of Player_Ship.Modules loop if Module.Durability < Module.Max_Durability then Add (OrdersMenu, "command", "-label {Repair ship} -underline 2 -command {ShowBaseUI repair}"); exit Add_Repair_Ship_Menu_Loop; end if; end loop Add_Repair_Ship_Menu_Loop; if Bases_Types_List(Sky_Bases(BaseIndex).Base_Type).Flags.Contains (To_Unbounded_String("shipyard")) then Add (OrdersMenu, "command", "-label {Shipyard} -underline 2 -command ShowShipyard"); end if; Add_Buy_Recipes_Menu_Loop : for I in Recipes_List.Iterate loop if Known_Recipes.Find_Index(Item => Recipes_Container.Key(I)) = UnboundedString_Container.No_Index and Bases_Types_List(Sky_Bases(BaseIndex).Base_Type).Recipes .Contains (Recipes_Container.Key(I)) and Recipes_List(I).Reputation <= Sky_Bases(BaseIndex).Reputation(1) then Add (OrdersMenu, "command", "-label {Buy recipes} -underline 2 -command {ShowBaseUI recipes}"); exit Add_Buy_Recipes_Menu_Loop; end if; end loop Add_Buy_Recipes_Menu_Loop; if Sky_Bases(BaseIndex).Missions.Length > 0 then MissionsLimit := (case Sky_Bases(BaseIndex).Reputation(1) is when 0 .. 25 => 1, when 26 .. 50 => 3, when 51 .. 75 => 5, when 76 .. 100 => 10, when others => 0); Add_Mission_Menu_Loop : for Mission of AcceptedMissions loop if (Mission.Finished and Mission.StartBase = BaseIndex) or (Mission.TargetX = Player_Ship.Sky_X and Mission.TargetY = Player_Ship.Sky_Y) then case Mission.MType is when Deliver => Insert (OrdersMenu, "0", "command", "-label {Complete delivery of " & To_String(Items_List(Mission.ItemIndex).Name) & "} -underline 0 -command CompleteMission"); when Destroy => if Mission.Finished then Insert (OrdersMenu, "0", "command", "-label {Complete destroy " & To_String (Proto_Ships_List(Mission.ShipIndex).Name) & "} -underline 0 -command CompleteMission"); end if; when Patrol => if Mission.Finished then Insert (OrdersMenu, "0", "command", "-label {Complete Patrol area mission} -underline 0 -command CompleteMission"); end if; when Explore => if Mission.Finished then Insert (OrdersMenu, "0", "command", "-label {Complete Explore area mission} -underline 0 -command CompleteMission"); end if; when Passenger => if Mission.Finished then Insert (OrdersMenu, "0", "command", "-label {Complete Transport passenger mission} -underline 0 -command CompleteMission"); end if; end case; end if; if Mission.StartBase = BaseIndex then MissionsLimit := MissionsLimit - 1; end if; end loop Add_Mission_Menu_Loop; if MissionsLimit > 0 then Add (OrdersMenu, "command", "-label Missions -underline 0 -command ShowBaseMissions"); end if; end if; if Player_Ship.Home_Base /= BaseIndex then Add (OrdersMenu, "command", "-label {Set as home} -underline 7 -command SetAsHome"); end if; end if; if Sky_Bases(BaseIndex).Population = 0 then Add (OrdersMenu, "command", "-label {Loot} -underline 0 -command ShowLoot"); end if; else if SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y).EventIndex > 0 then Event := Events_List (SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y).EventIndex) .EType; end if; case Event is when EnemyShip | EnemyPatrol => Add (OrdersMenu, "command", "-label {Attack} -underline 0 -command Attack"); when FullDocks => Add (OrdersMenu, "command", "-label {Wait (full docks)} -underline 0 -command ShowWait"); when AttackOnBase => Add (OrdersMenu, "command", "-label {Defend} -underline 0 -command Attack"); when Disease => if HaveTrader then ItemIndex := FindItem (Inventory => Player_Ship.Cargo, ItemType => Factions_List(Sky_Bases(BaseIndex).Owner) .HealingTools); if ItemIndex > 0 then Add (OrdersMenu, "command", "-label {Deliver medicines for free} -underline 0 -command {DeliverMedicines free}"); Add (OrdersMenu, "command", "-label {Deliver medicines for price} -underline 8 -command {DeliverMedicines paid}"); end if; end if; when None | DoublePrice | BaseRecovery => if BaseIndex > 0 then if Sky_Bases(BaseIndex).Reputation(1) > -25 then declare DockingCost: Positive; begin Count_Docking_Cost_Loop : for Module of Player_Ship.Modules loop if Module.M_Type = HULL then DockingCost := Module.Max_Modules; exit Count_Docking_Cost_Loop; end if; end loop Count_Docking_Cost_Loop; if Sky_Bases(BaseIndex).Population > 0 then Add (OrdersMenu, "command", "-label {Dock (" & Trim(Positive'Image(DockingCost), Left) & " " & To_String(Money_Name) & ")} -underline 0 -command {Docking}"); else Add (OrdersMenu, "command", "-label {Dock} -underline 0 -command {Docking}"); end if; end; end if; Complete_Mission_Menu_Loop : for Mission of AcceptedMissions loop if HaveTrader and Mission.TargetX = Player_Ship.Sky_X and Mission.TargetY = Player_Ship.Sky_Y and Mission.Finished then case Mission.MType is when Deliver => Add (OrdersMenu, "command", "-label {Complete delivery of " & To_String (Items_List(Mission.ItemIndex).Name) & "} -underline 0 -command CompleteMission"); when Destroy => if Mission.Finished then Add (OrdersMenu, "command", "-label {Complete destroy " & To_String (Proto_Ships_List(Mission.ShipIndex) .Name) & "} -underline 0 -command CompleteMission"); end if; when Patrol => if Mission.Finished then Add (OrdersMenu, "command", "-label {Complete Patrol area mission} -underline 0 -command CompleteMission"); end if; when Explore => if Mission.Finished then Add (OrdersMenu, "command", "-label {Complete Explore area mission} -underline 0 -command CompleteMission"); end if; when Passenger => if Mission.Finished then Add (OrdersMenu, "command", "-label {Complete Transport passenger mission} -underline 0 -command CompleteMission"); end if; end case; end if; end loop Complete_Mission_Menu_Loop; else Progress_Mission_Loop : for Mission of AcceptedMissions loop if Mission.TargetX = Player_Ship.Sky_X and Mission.TargetY = Player_Ship.Sky_Y and not Mission.Finished then case Mission.MType is when Deliver | Passenger => null; when Destroy => Add (OrdersMenu, "command", "-label {Search for " & To_String (Proto_Ships_List(Mission.ShipIndex).Name) & "} -underline 0 -command StartMission"); when Patrol => Add (OrdersMenu, "command", "-label {Patrol area} -underline 0 -command StartMission"); when Explore => Add (OrdersMenu, "command", "-label {Explore area} -underline 0 -command StartMission"); end case; end if; end loop Progress_Mission_Loop; end if; when Trader => if HaveTrader then Add (OrdersMenu, "command", "-label {Trade} -underline 0 -command {ShowTrader " & To_String (Events_List (SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y) .EventIndex) .ShipIndex) & "}"); Add (OrdersMenu, "command", "-label {Ask for events} -underline 8 -command AskForEvents"); Add (OrdersMenu, "command", "-label {Ask for bases} -underline 8 -command AskForBases"); end if; Add (OrdersMenu, "command", "-label {Attack} -underline 0 -command Attack"); when FriendlyShip => if HaveTrader then if Index (Proto_Ships_List (Events_List (SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y) .EventIndex) .ShipIndex) .Name, To_String(Traders_Name)) > 0 then Add (OrdersMenu, "command", "-label {Trade} -underline 0 -command {ShowTrader " & To_String (Events_List (SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y) .EventIndex) .ShipIndex) & "}"); Add (OrdersMenu, "command", "-label {Ask for bases} -underline 8 -command AskForBases"); end if; Add (OrdersMenu, "command", "-label {Ask for events} -underline 8 -command AskForEvents"); end if; Add (OrdersMenu, "command", "-label {Attack} -underline 0 -command Attack"); end case; end if; Add(OrdersMenu, "command", "-label {Close} -underline 0"); if Index(OrdersMenu, "0") = Index(OrdersMenu, "end") then ShowMessage (Text => "Here are no available ship orders at this moment. Ship orders available mostly when you are at base or at event on map.", Title => "No orders available"); else Tk_Popup (OrdersMenu, Winfo_Get(Get_Main_Window(Interp), "pointerx"), Winfo_Get(Get_Main_Window(Interp), "pointery")); end if; return TCL_OK; end Show_Orders_Command; -- ****o* OrdersMenu/OrdersMenu.Docking_Command -- FUNCTION -- Dock or undock from the sky base -- PARAMETERS -- ClientData - Custom data send to the command. -- Interp - Tcl interpreter in which command was executed. -- Argc - Number of arguments passed to the command. -- Argv - Values of arguments passed to the command. -- RESULT -- This function always return TCL_OK -- COMMANDS -- Docking ?escape? -- If argument escape is present, escape from the base without paying, -- otherwise normal docking or undocking operation -- SOURCE function Docking_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Docking_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is Message: Unbounded_String; begin if Player_Ship.Speed = DOCKED then Message := (if Argc = 1 then To_Unbounded_String(DockShip(False)) else To_Unbounded_String(DockShip(False, True))); if Length(Message) > 0 then ShowMessage (Text => To_String(Message), Title => "Can't undock from base"); return TCL_OK; end if; else if SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y).EventIndex > 0 then if Events_List (SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y).EventIndex) .EType = FullDocks then return Show_Wait_Command(ClientData, Interp, Argc, Argv); end if; end if; Message := To_Unbounded_String(DockShip(True)); if Length(Message) > 0 then ShowMessage (Text => To_String(Message), Title => "Can't dock to base"); return TCL_OK; end if; end if; ShowSkyMap; if Player_Ship.Speed = DOCKED then return Show_Orders_Command(ClientData, Interp, Argc, Argv); end if; return TCL_OK; end Docking_Command; -- ****o* OrdersMenu/OrdersMenu.Ask_For_Bases_Command -- FUNCTION -- Ask for bases in the currently visited base -- PARAMETERS -- ClientData - Custom data send to the command. Unused -- Interp - Tcl interpreter in which command was executed. Unused -- Argc - Number of arguments passed to the command. Unused -- Argv - Values of arguments passed to the command. Unused -- RESULT -- This function always return TCL_OK -- COMMANDS -- AskForBases -- SOURCE function Ask_For_Bases_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Ask_For_Bases_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(ClientData, Interp, Argc, Argv); begin Ask_For_Bases; ShowSkyMap; return TCL_OK; end Ask_For_Bases_Command; -- ****o* OrdersMenu/OrdersMenu.Ask_For_Events_Command -- FUNCTION -- Ask for events in the currently visited base -- PARAMETERS -- ClientData - Custom data send to the command. Unused -- Interp - Tcl interpreter in which command was executed. Unused -- Argc - Number of arguments passed to the command. Unused -- Argv - Values of arguments passed to the command. Unused -- RESULT -- This function always return TCL_OK -- COMMANDS -- AskForEvents -- SOURCE function Ask_For_Events_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Ask_For_Events_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(ClientData, Interp, Argc, Argv); begin Ask_For_Events; ShowSkyMap; return TCL_OK; end Ask_For_Events_Command; -- ****o* OrdersMenu/OrdersMenu.Attack_Command -- FUNCTION -- Start the combat -- PARAMETERS -- ClientData - Custom data send to the command. Unused -- Interp - Tcl interpreter in which command was executed. Unused -- Argc - Number of arguments passed to the command. Unused -- Argv - Values of arguments passed to the command. Unused -- RESULT -- This function always return TCL_OK -- COMMANDS -- Attack -- SOURCE function Attack_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Attack_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(ClientData, Interp, Argc, Argv); begin ShowCombatUI; return TCL_OK; end Attack_Command; -- ****f* OrdersMenu/OrdersMenu.Pray_Command -- FUNCTION -- Pray in the selected base -- PARAMETERS -- ClientData - Custom data send to the command. Unused -- Interp - Tcl interpreter in which command was executed. Unused -- Argc - Number of arguments passed to the command. Unused -- Argv - Values of arguments passed to the command. Unused -- RESULT -- This function always return TCL_OK -- COMMANDS -- Pray -- SOURCE function Pray_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Pray_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(ClientData, Interp, Argc, Argv); begin Update_Morale_Loop : for I in Player_Ship.Crew.Iterate loop UpdateMorale(Player_Ship, Crew_Container.To_Index(I), 10); end loop Update_Morale_Loop; AddMessage ("You and your crew were praying for some time. Now you all feel a bit better.", OrderMessage); Update_Game(30); ShowSkyMap; return TCL_OK; end Pray_Command; -- ****f* OrdersMenu/OrdersMenu.Set_As_Home_Command -- FUNCTION -- Set the selected base as a home base -- PARAMETERS -- ClientData - Custom data send to the command. Unused -- Interp - Tcl interpreter in which command was executed. Unused -- Argc - Number of arguments passed to the command. Unused -- Argv - Values of arguments passed to the command. Unused -- RESULT -- This function always return TCL_OK -- COMMANDS -- SetAsHome -- SOURCE function Set_As_Home_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Set_As_Home_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(ClientData, Interp, Argc, Argv); TraderIndex: constant Natural := FindMember(Talk); Price: Positive := 1_000; begin Count_Price(Price, TraderIndex); ShowQuestion ("Are you sure want to change your home base (it cost" & Positive'Image(Price) & " " & To_String(Money_Name) & ")?", "sethomebase"); return TCL_OK; end Set_As_Home_Command; -- ****f* OrdersMenu/OrdersMenu.Show_Trader_Command -- FUNCTION -- Generate cargo for trader and show trading UI -- PARAMETERS -- ClientData - Custom data send to the command. Unused -- Interp - Tcl interpreter in which command was executed. Unused -- Argc - Number of arguments passed to the command. Unused -- Argv - Values of arguments passed to the command. Unused -- RESULT -- This function always return TCL_OK -- COMMANDS -- ShowTrader protoindex -- Protoindex is the index of ship prototype on which trader cargo will be -- generated -- SOURCE function Show_Trader_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Show_Trader_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(ClientData, Argc); begin GenerateTraderCargo(To_Unbounded_String(CArgv.Arg(Argv, 1))); Tcl_Eval(Interp, "ShowTrade"); return TCL_OK; end Show_Trader_Command; -- ****f* OrdersMenu/OrdersMenu.Start_Mission_Command -- FUNCTION -- Start the selected mission -- PARAMETERS -- ClientData - Custom data send to the command. Unused -- Interp - Tcl interpreter in which command was executed. Unused -- Argc - Number of arguments passed to the command. Unused -- Argv - Values of arguments passed to the command. Unused -- RESULT -- This function always return TCL_OK -- COMMANDS -- StartMission -- SOURCE function Start_Mission_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Start_Mission_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(ClientData, Interp, Argc, Argv); StartsCombat: Boolean := False; begin for Mission of AcceptedMissions loop if Mission.TargetX = Player_Ship.Sky_X and Mission.TargetY = Player_Ship.Sky_Y and not Mission.Finished then case Mission.MType is when Deliver | Passenger => null; when Destroy => Update_Game(Get_Random(15, 45)); StartsCombat := CheckForEvent; if not StartsCombat then StartsCombat := StartCombat (AcceptedMissions (SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y) .MissionIndex) .ShipIndex, False); end if; when Patrol => Update_Game(Get_Random(45, 75)); StartsCombat := CheckForEvent; if not StartsCombat then UpdateMission (SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y) .MissionIndex); end if; when Explore => Update_Game(Get_Random(30, 60)); StartsCombat := CheckForEvent; if not StartsCombat then UpdateMission (SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y) .MissionIndex); end if; end case; exit; end if; end loop; if StartsCombat then ShowCombatUI; return TCL_OK; end if; UpdateHeader; Update_Messages; ShowSkyMap; return TCL_OK; end Start_Mission_Command; -- ****f* OrdersMenu/OrdersMenu.Complete_Mission_Command -- FUNCTION -- Complete the selected mission in base -- PARAMETERS -- ClientData - Custom data send to the command. Unused -- Interp - Tcl interpreter in which command was executed. Unused -- Argc - Number of arguments passed to the command. Unused -- Argv - Values of arguments passed to the command. Unused -- RESULT -- This function always return TCL_OK -- COMMANDS -- CompleteMission -- SOURCE function Complete_Mission_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Complete_Mission_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(ClientData, Interp, Argc, Argv); begin FinishMission(SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y).MissionIndex); UpdateHeader; Update_Messages; ShowSkyMap; return TCL_OK; end Complete_Mission_Command; -- ****f* OrdersMenu/OrdersMenu.Execute_Story_Command -- FUNCTION -- Execute the current step in the current story -- PARAMETERS -- ClientData - Custom data send to the command. Unused -- Interp - Tcl interpreter in which command was executed. Unused -- Argc - Number of arguments passed to the command. Unused -- Argv - Values of arguments passed to the command. Unused -- RESULT -- This function always return TCL_OK -- COMMANDS -- ExecuteStory -- SOURCE function Execute_Story_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Execute_Story_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(ClientData, Interp, Argc, Argv); Step: Step_Data := (if CurrentStory.CurrentStep = 0 then Stories_List(CurrentStory.Index).StartingStep elsif CurrentStory.CurrentStep > 0 then Stories_List(CurrentStory.Index).Steps(CurrentStory.CurrentStep) else Stories_List(CurrentStory.Index).FinalStep); Message: Unbounded_String; begin if Player_Ship.Speed /= DOCKED and Step.FinishCondition = ASKINBASE then Message := To_Unbounded_String(DockShip(True)); if Message /= Null_Unbounded_String then ShowInfo (Text => To_String(Message), Title => "Can't dock to base"); return TCL_OK; end if; end if; if ProgressStory then declare Tokens: Slice_Set; begin Create(Tokens, To_String(CurrentStory.Data), ";"); case Step.FinishCondition is when DESTROYSHIP => if StartCombat (To_Unbounded_String(Slice(Tokens, 3)), False) then ShowCombatUI; return TCL_OK; end if; when others => null; end case; if CurrentStory.CurrentStep > -2 then Step := (if CurrentStory.CurrentStep > 0 then Stories_List(CurrentStory.Index).Steps (CurrentStory.CurrentStep) else Stories_List(CurrentStory.Index).FinalStep); for Text of Step.Texts loop if CurrentStory.FinishedStep = Text.Condition then ShowInfo(Text => To_String(Text.Text), Title => "Story"); CurrentStory.ShowText := False; exit; end if; end loop; else FinishStory; end if; end; else ShowInfo(Text => To_String(Step.FailText), Title => "Story"); CurrentStory.ShowText := False; end if; UpdateHeader; Update_Messages; ShowSkyMap; return TCL_OK; end Execute_Story_Command; -- ****f* OrdersMenu/OrdersMenu.Deliver_Medicines_Command -- FUNCTION -- Deliver medicines to the base -- PARAMETERS -- ClientData - Custom data send to the command. Unused -- Interp - Tcl interpreter in which command was executed. Unused -- Argc - Number of arguments passed to the command. Unused -- Argv - Values of arguments passed to the command. -- RESULT -- This function always return TCL_OK -- COMMANDS -- DeliverMedicines type -- If argument type is free, deliver medicines for free, otherwise deliver -- medicines for a price -- SOURCE function Deliver_Medicines_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** function Deliver_Medicines_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int is pragma Unreferenced(ClientData, Interp, Argc); BaseIndex: constant Positive := SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y).BaseIndex; EventIndex: constant Natural := SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y).EventIndex; ItemIndex: constant Natural := FindItem (Inventory => Player_Ship.Cargo, ItemType => Factions_List(Sky_Bases(BaseIndex).Owner).HealingTools); NewTime: constant Integer := Events_List(EventIndex).Time - Player_Ship.Cargo(ItemIndex).Amount; begin if NewTime < 1 then DeleteEvent(EventIndex); else Events_List(EventIndex).Time := NewTime; end if; if CArgv.Arg(Argv, 1) = "free" then Gain_Rep(BaseIndex, (Player_Ship.Cargo(ItemIndex).Amount / 10)); AddMessage ("You gave " & To_String (Items_List(Player_Ship.Cargo(ItemIndex).ProtoIndex).Name) & " for free to base.", TradeMessage); UpdateCargo (Player_Ship, Player_Ship.Cargo.Element(ItemIndex).ProtoIndex, (0 - Player_Ship.Cargo.Element(ItemIndex).Amount)); else begin Gain_Rep (BaseIndex, ((Player_Ship.Cargo(ItemIndex).Amount / 20) * (-1))); SellItems (ItemIndex, Integer'Image(Player_Ship.Cargo.Element(ItemIndex).Amount)); exception when Trade_No_Free_Cargo => ShowMessage (Text => "You can't sell medicines to the base because you don't have enough free cargo space for money.", Title => "No free cargo space"); when Trade_No_Money_In_Base => ShowMessage (Text => "You can't sell medicines to the base because the base don't have enough money to buy them.", Title => "Can't sell medicines"); end; end if; UpdateHeader; Update_Messages; ShowSkyMap; return TCL_OK; end Deliver_Medicines_Command; procedure AddCommands is begin Add_Command("ShowOrders", Show_Orders_Command'Access); Add_Command("Docking", Docking_Command'Access); Add_Command("AskForBases", Ask_For_Bases_Command'Access); Add_Command("AskForEvents", Ask_For_Events_Command'Access); Add_Command("Attack", Attack_Command'Access); Add_Command("Pray", Pray_Command'Access); Add_Command("SetAsHome", Set_As_Home_Command'Access); Add_Command("ShowTrader", Show_Trader_Command'Access); Add_Command("StartMission", Start_Mission_Command'Access); Add_Command("CompleteMission", Complete_Mission_Command'Access); Add_Command("ExecuteStory", Execute_Story_Command'Access); Add_Command("DeliverMedicines", Deliver_Medicines_Command'Access); end AddCommands; end OrdersMenu;
with Tkmrpc.Request; with Tkmrpc.Response; package Tkmrpc.Operation_Handlers.Ike.Esa_Reset is procedure Handle (Req : Request.Data_Type; Res : out Response.Data_Type); -- Handler for the esa_reset operation. end Tkmrpc.Operation_Handlers.Ike.Esa_Reset;
------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT INTERFACE COMPONENTS -- -- -- -- A S I S . D E F I N I T I O N S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2006-2011, Free Software Foundation, Inc. -- -- -- -- This specification is adapted from the Ada Semantic Interface -- -- Specification Standard (ISO/IEC 15291) 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. -- -- -- -- This specification also contains suggestions and discussion items -- -- related to revising the ASIS Standard according to the changes proposed -- -- for the new revision of the Ada standard. The copyright notice above, -- -- and the license provisions that follow apply solely to these suggestions -- -- and discussion items that are separated by the corresponding comment -- -- sentinels -- -- -- -- 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). -- -- -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 16 package Asis.Definitions -- Suggestions related to changing this specification to accept new Ada -- features as defined in incoming revision of the Ada Standard (ISO 8652) -- are marked by following comment sentinels: -- -- --|A2005 start -- ... the suggestion goes here ... -- --|A2005 end -- -- and the discussion items are marked by the comment sentinels of teh form: -- -- --|D2005 start -- ... the discussion item goes here ... -- --|D2005 end ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ package Asis.Definitions is ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Asis.Definitions encapsulates a set of queries that operate on A_Definition -- and An_Association elements. ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 16.1 function Corresponding_Type_Operators ------------------------------------------------------------------------------ -- --|ER--------------------------------------------------------------------- -- --|ER A_Type_Definition - 3.2.1 ------------------------------------------------------------------------------ function Corresponding_Type_Operators (Type_Definition : Asis.Type_Definition) return Asis.Declaration_List; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the type to query -- -- Returns a list of operators. These include all predefined operators, and -- all user-defined operator overloads, that have been implicitly or -- explicitly declared for the type. (Reference Manual 7.3.1(2)) -- -- This list includes only operators appropriate for the type, from the set: -- and or xor = /= < <= > >= + - & * / mod rem ** abs not -- -- Returns a Nil_Element_List if there are no predefined or overloaded -- operators for the type. -- -- Returns a Nil_Element_List if the implementation does not provide -- such implicit declarations. -- -- The Enclosing_Element for each implicit declaration is the declaration -- (type or object) that declared the type. -- -- --|D2005 start -- -- It seems that there are at least two serious problems with the definition -- of this query -- -- 1. Consider an Element representing an implicit inherited user-defined -- operator function. According to the definition of this query, the -- Enclosing_Element for this Element should be a type DECLARATION, but the -- same (that is, Is_Equal) Element can be obtained as a result of applying -- Implicit_Inherited_Subprograms to the type DEFINITION, and the -- documentation of Implicit_Inherited_Subprograms says that the -- Enclosing_Element for this operator function Element should be the -- type DEFINITION. But for two Is_Equal Elements the corresponding results -- of Enclosing_Element should also be Is_Equal! -- -- 2. Should this query return ALL the operator function having the argument -- type as a type of a parameter or result, or should it return only those -- opeartor functions that are PRIMITIVE OPERATIONS of the type? The first -- approach looks too expensive from the implementation viewpoint -- -- --|D2005 end -- -- For limited private types, if a user-defined equality operator has -- been defined, an Ada implementation has two choices when dealing with an -- instance of the "/=" operator. a) treat A/=B as NOT(A=B), b) implicitly -- create a "/=" operator. Implementations that take the second alternative -- will include this implicit inequality operation in their result. -- Implementations that choose the first alternative are encouraged to hide -- this choice beneath the ASIS interface and to "fake" an inequality -- operation. Failing that, the function call, representing the NOT -- operation, must have Is_Part_Of_Implicit = True so that an ASIS application -- can tell the difference between a user-specified NOT(A=B) and an -- implementation-specific A/=B transformation. -- -- Appropriate Definition_Kinds: -- A_Type_Definition -- A_Formal_Type_Declaration -- -- Returns Declaration_Kinds: -- A_Function_Declaration -- A_Function_Body_Declaration -- A_Function_Body_Stub -- A_Function_Renaming_Declaration -- A_Function_Instantiation -- A_Formal_Function_Declaration -- -- --|IP Implementation Permissions: -- --|IP -- --|IP The result may or may not include language defined operators that -- --|IP have been overridden by user-defined overloads. Operators that are -- --|IP totally hidden, in all contexts, by user-defined operators may be -- --|IP omitted from the list. -- --|IP -- --|IP Some implementations do not represent all forms of implicit -- --|IP declarations such that elements representing them can be easily -- --|IP provided. An implementation can choose whether or not to construct -- --|IP and provide artificial declarations for implicitly declared elements. -- --|IP -- --|ER--------------------------------------------------------------------- -- --|ER A_Derived_Type_Definition - 3.4 -- --|CR -- --|CR Child elements returned by: -- --|CR function Parent_Subtype_Indication -- --|ER--------------------------------------------------------------------- -- --|ER A_Derived_Record_Extension_Definition - 3.4 -- --|CR -- --|CR Child elements returned by: -- --|CR function Parent_Subtype_Indication -- --|CR function Record_Definition -- ------------------------------------------------------------------------------ -- 16.2 function Parent_Subtype_Indication ------------------------------------------------------------------------------ function Parent_Subtype_Indication (Type_Definition : Asis.Type_Definition) return Asis.Subtype_Indication; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the derived_type_definition to query -- -- Returns the parent_subtype_indication following the reserved word "new". -- -- Appropriate Type_Kinds: -- A_Derived_Type_Definition -- A_Derived_Record_Extension_Definition -- -- Returns Definition_Kinds: -- A_Subtype_Indication -- ------------------------------------------------------------------------------ -- 16.3 function Record_Definition ------------------------------------------------------------------------------ function Record_Definition (Type_Definition : Asis.Type_Definition) return Asis.Definition; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the definition to query -- -- Returns the record definition of the type_definition. -- -- Appropriate Type_Kinds: -- A_Derived_Record_Extension_Definition -- A_Record_Type_Definition -- A_Tagged_Record_Type_Definition -- -- Returns Definition_Kinds: -- A_Record_Definition -- A_Null_Record_Definition -- ------------------------------------------------------------------------------ -- 16.4 function Implicit_Inherited_Declarations ------------------------------------------------------------------------------ function Implicit_Inherited_Declarations (Definition : Asis.Definition) return Asis.Declaration_List; ------------------------------------------------------------------------------ -- Definition - Specifies the derived type to query -- -- Returns a list of Is_Part_Of_Implicit inherited enumeration literals, -- discriminants, components, protected subprograms, or entries of a -- derived_type_definition whose parent type is an enumeration type, or a -- composite type other than an array type. See Reference Manual 3.4(10-14). -- -- Returns a Nil_Element_List if the root type of derived_type_definition is -- not an enumeration, record, task, or protected type. -- -- Returns a Nil_Element_List if the implementation does not provide -- such implicit declarations. -- -- The Enclosing_Element for each of the implicit declarations is the -- Declaration argument. -- -- Appropriate Definition_Kinds: -- A_Type_Definition -- A_Private_Extension_Definition -- A_Formal_Type_Definition -- -- Appropriate Type_Kinds: -- A_Derived_Type_Definition -- A_Derived_Record_Extension_Definition -- -- Appropriate Formal_Type_Kinds: -- A_Formal_Derived_Type_Definition -- -- Returns Declaration_Kinds: -- -- An_Enumeration_Literal_Specification -- A_Discriminant_Specification -- A_Component_Declaration -- A_Procedure_Declaration -- A_Function_Declaration -- An_Entry_Declaration -- -- --|IP Implementation Permissions: -- --|IP -- --|IP Some implementations do not represent all forms of implicit -- --|IP declarations such that elements representing them can be easily -- --|IP provided. An implementation can choose whether or not to construct -- --|IP and provide artificial declarations for implicitly declared elements. -- --|IP -- --|AN Application Note: -- --|AN -- --|AN This query returns only implicit inherited entry declarations for -- --|AN derived task types. All representation clauses and pragmas associated -- --|AN with the entries of the original task type (the root type of the -- --|AN derived task type) apply to the inherited entries. Those are -- --|AN available by examining the original type or by calling -- --|AN Corresponding_Pragmas and Corresponding_Representation_Clauses. -- --|AN These functions will return the pragmas and clauses from the original -- --|AN type. -- ------------------------------------------------------------------------------ -- 16.5 function Implicit_Inherited_Subprograms ------------------------------------------------------------------------------ function Implicit_Inherited_Subprograms (Definition : Asis.Definition) return Asis.Declaration_List; ------------------------------------------------------------------------------ -- Definition - Specifies the derived type to query -- -- Returns the list of user-defined inherited primitive subprograms that have -- been implicitly declared for the derived_type_definition. -- -- The list result does not include hidden inherited subprograms -- (Reference Manual 8.3). -- -- Returns a Nil_Element_List if there are no inherited subprograms for the -- derived type. -- -- Returns a Nil_Element_List if the implementation does not provide -- such implicit declarations. -- -- The Enclosing_Element for each of the subprogram declarations is the -- Definition argument. -- -- Appropriate Definition_Kinds: -- A_Type_Definition -- A_Private_Extension_Definition -- A_Formal_Type_Definition -- -- Appropriate Type_Kinds: -- A_Derived_Type_Definition -- A_Derived_Record_Extension_Definition -- -- Appropriate Formal_Type_Kinds: -- A_Formal_Derived_Type_Definition -- -- Returns Declaration_Kinds: -- A_Function_Declaration -- A_Procedure_Declaration -- -- --|IP Implementation Permissions: -- --|IP -- --|IP Some implementations do not represent all forms of implicit -- --|IP declarations such that elements representing them can be easily -- --|IP provided. An implementation can choose whether or not to construct -- --|IP and provide artificial declarations for implicitly declared elements. -- ------------------------------------------------------------------------------ -- 16.6 function Corresponding_Parent_Subtype ------------------------------------------------------------------------------ function Corresponding_Parent_Subtype (Type_Definition : Asis.Type_Definition) return Asis.Declaration; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the derived_type_definition to query -- -- Returns the parent subtype declaration of the derived_type_definition. -- The parent subtype is defined by the parent_subtype_indication. -- -- --|D2005 start -- -- It is not clear what should be returned, if the argument type definition -- contains an attribute reference as the subtype_mark in the -- parent_subtype_indication (only 'Base attribute is possible in this -- context): -- -- type Derived_Type is new Parent_Type'Base; -- -- We return Nil_Element in this case as an indication that this case needs -- some special processing in the application code. -- -- --|D2005 end -- -- Appropriate Type_Kinds: -- A_Derived_Type_Definition -- A_Derived_Record_Extension_Definition -- -- Returns Declaration_Kinds: -- An_Ordinary_Type_Declaration -- A_Task_Type_Declaration -- A_Protected_Type_Declaration -- A_Subtype_Declaration -- A_Formal_Type_Declaration -- An_Incomplete_Type_Declaration -- A_Private_Type_Declaration -- A_Private_Extension_Declaration -- ------------------------------------------------------------------------------ -- 16.7 function Corresponding_Root_Type ------------------------------------------------------------------------------ function Corresponding_Root_Type (Type_Definition : Asis.Type_Definition) return Asis.Declaration; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the derived_type_definition to query -- -- This function recursively unwinds all type derivations and subtyping to -- arrive at a full_type_declaration that is neither a derived type nor a -- subtype. -- -- In case of numeric types, this function always returns some user-defined -- type, not an implicitly defined root type corresponding to -- A_Root_Type_Definition. The only ways to get implicitly declared numeric -- root or universal types are to ask for the type of a universal expression -- or from the parameter and result profile of a predefined operation working -- with numeric types. -- -- Appropriate Type_Kinds: -- A_Derived_Type_Definition -- A_Derived_Record_Extension_Definition -- -- Returns Declaration_Kinds: -- An_Ordinary_Type_Declaration -- A_Task_Type_Declaration -- A_Protected_Type_Declaration -- A_Formal_Type_Declaration -- A_Private_Type_Declaration -- A_Private_Extension_Declaration -- ------------------------------------------------------------------------------ -- 16.8 function Corresponding_Type_Structure ------------------------------------------------------------------------------ function Corresponding_Type_Structure (Type_Definition : Asis.Type_Definition) return Asis.Declaration; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the derived_type_definition to query -- -- Returns the type structure from which the specified type definition has -- been derived. This function will recursively unwind derivations and -- subtyping until the type_declaration derives a change of representation or -- is no longer derived. See Reference Manual 13.6. -- -- Appropriate Type_Kinds: -- A_Derived_Type_Definition -- A_Derived_Record_Extension_Definition -- -- Returns Declaration_Kinds: -- An_Ordinary_Type_Declaration -- A_Task_Type_Declaration -- A_Protected_Type_Declaration -- A_Formal_Type_Declaration -- -- --|ER--------------------------------------------------------------------- -- --|ER An_Enumeration_Type_Definition - 3.5.1 -- --|CR -- --|CR Child elements returned by: -- --|CR function Enumeration_Literal_Declarations -- ------------------------------------------------------------------------------ -- 16.9 function Enumeration_Literal_Declarations ------------------------------------------------------------------------------ function Enumeration_Literal_Declarations (Type_Definition : Asis.Type_Definition) return Asis.Declaration_List; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the enumeration type definition to query -- -- Returns a list of the literals declared in an enumeration_type_definition, -- in their order of appearance. -- -- Appropriate Type_Kinds: -- An_Enumeration_Type_Definition -- -- Returns Declaration_Kinds: -- An_Enumeration_Literal_Specification -- -- --|ER--------------------------------------------------------------------- -- --|ER A_Signed_Integer_Type_Definition - 3.5.4 -- --|CR -- --|CR Child elements returned by: -- --|CR function Integer_Constraint -- ------------------------------------------------------------------------------ -- 16.10 function Integer_Constraint ------------------------------------------------------------------------------ function Integer_Constraint (Type_Definition : Asis.Type_Definition) return Asis.Range_Constraint; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the signed_integer_type_definition to query -- -- Returns the range_constraint of the signed_integer_type_definition. -- -- Appropriate Type_Kinds: -- A_Signed_Integer_Type_Definition -- -- Returns Constraint_Kinds: -- A_Simple_Expression_Range -- -- --|ER--------------------------------------------------------------------- -- --|ER A_Modular_Type_Definition - 3.5.4 -- --|CR -- --|CR Child elements returned by: -- --|CR function Mod_Static_Expression -- ------------------------------------------------------------------------------ -- 16.11 function Mod_Static_Expression ------------------------------------------------------------------------------ function Mod_Static_Expression (Type_Definition : Asis.Type_Definition) return Asis.Expression; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the modular_type_definition to query -- -- Returns the static_expression following the reserved word "mod". -- -- Appropriate Type_Kinds: -- A_Modular_Type_Definition -- -- Returns Element_Kinds: -- An_Expression -- -- --|ER--------------------------------------------------------------------- -- --|ER A_Floating_Point_Definition - 3.5.7 -- --|CR -- --|CR Child elements returned by: -- --|CR function Digits_Expression -- --|CR function Real_Range_Constraint -- -- --|ER--------------------------------------------------------------------- -- --|ER A_Decimal_Fixed_Point_Definition - 3.5.9 -- --|CR -- --|CR Child elements returned by: -- --|CR function Digits_Expression -- --|CR function Delta_Expression -- --|CR function Real_Range_Constraint -- ------------------------------------------------------------------------------ -- 16.12 function Digits_Expression ------------------------------------------------------------------------------ function Digits_Expression (Definition : Asis.Definition) return Asis.Expression; ------------------------------------------------------------------------------ -- Definition - Specifies the definition to query -- -- Returns the static_expression following the reserved word "digits". -- -- Appropriate Definition_Kinds: -- A_Floating_Point_Definition -- A_Decimal_Fixed_Point_Definition -- A_Constraint -- Appropriate Constraint_Kinds: -- A_Digits_Constraint -- -- Returns Element_Kinds: -- An_Expression -- -- --|ER--------------------------------------------------------------------- -- --|ER An_Ordinary_Fixed_Point_Definition - 3.5.9 -- --|CR -- --|CR Child elements returned by: -- --|CR function Delta_Expression -- ------------------------------------------------------------------------------ -- 16.13 function Delta_Expression ------------------------------------------------------------------------------ function Delta_Expression (Definition : Asis.Definition) return Asis.Expression; ------------------------------------------------------------------------------ -- Definition - Specifies the definition to query -- -- Returns the static_expression following the reserved word "delta". -- -- Appropriate Definition_Kinds: -- An_Ordinary_Fixed_Point_Definition -- A_Decimal_Fixed_Point_Definition -- A_Constraint -- Appropriate Constraint_Kinds: -- A_Delta_Constraint -- -- Returns Element_Kinds: -- An_Expression -- ------------------------------------------------------------------------------ -- 16.14 function Real_Range_Constraint ------------------------------------------------------------------------------ function Real_Range_Constraint (Definition : Asis.Definition) return Asis.Range_Constraint; ------------------------------------------------------------------------------ -- Definition - Specifies the definition to query -- -- Returns the real_range_specification range_constraint of the definition. -- -- Returns a Nil_Element if there is no explicit range_constraint. -- -- Appropriate Definition_Kinds: -- A_Floating_Point_Definition -- An_Ordinary_Fixed_Point_Definition -- A_Decimal_Fixed_Point_Definition -- A_Constraint -- Appropriate Constraint_Kinds: -- A_Digits_Constraint -- A_Delta_Constraint -- -- Returns Constraint_Kinds: -- Not_A_Constraint -- A_Simple_Expression_Range -- -- --|ER--------------------------------------------------------------------- -- --|ER An_Unconstrained_Array_Definition 3.6 -- --|CR -- --|CR Child elements returned by: -- --|CR function Index_Subtype_Definitions -- --|CR function Array_Component_Definition -- ------------------------------------------------------------------------------ -- 16.15 function Index_Subtype_Definitions ------------------------------------------------------------------------------ function Index_Subtype_Definitions (Type_Definition : Asis.Type_Definition) return Asis.Expression_List; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the array_type_definition to query -- -- Returns a list of the index_subtype_definition subtype mark names for -- an unconstrained_array_definition, in their order of appearance. -- -- Appropriate Type_Kinds: -- An_Unconstrained_Array_Definition -- -- Appropriate Formal_Type_Kinds: -- A_Formal_Unconstrained_Array_Definition -- -- Returns Expression_Kinds: -- An_Identifier -- A_Selected_Component -- -- --|ER--------------------------------------------------------------------- -- --|ER A_Constrained_Array_Definition 3.6 -- --|CR -- --|CR Child elements returned by: -- --|CR function Discrete_Subtype_Definitions -- --|CR function Array_Component_Definition -- ------------------------------------------------------------------------------ -- 16.16 function Discrete_Subtype_Definitions ------------------------------------------------------------------------------ function Discrete_Subtype_Definitions (Type_Definition : Asis.Type_Definition) return Asis.Definition_List; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the array_type_definition to query -- -- Returns the list of Discrete_Subtype_Definition elements of a -- constrained_array_definition, in their order of appearance. -- -- Appropriate Type_Kinds: -- A_Constrained_Array_Definition -- -- Appropriate Formal_Type_Kinds: -- A_Formal_Constrained_Array_Definition -- -- Returns Definition_Kinds: -- A_Discrete_Subtype_Definition -- ------------------------------------------------------------------------------ -- 16.17 function Array_Component_Definition ------------------------------------------------------------------------------ function Array_Component_Definition (Type_Definition : Asis.Type_Definition) return Asis.Component_Definition; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the array_type_definition to query -- -- Returns the Component_Definition of the array_type_definition. -- -- Appropriate Type_Kinds: -- An_Unconstrained_Array_Definition -- A_Constrained_Array_Definition -- -- Appropriate Formal_Type_Kinds: -- A_Formal_Unconstrained_Array_Definition -- A_Formal_Constrained_Array_Definition -- -- Returns Definition_Kinds: -- A_Component_Definition -- -- --|ER--------------------------------------------------------------------- -- --|ER A_Record_Type_Definition - 3.8 -- --|ER A_Tagged_Record_Type_Definition - 3.8 -- --|CR -- --|CR Child elements returned by: -- --|CR function Record_Definition -- --|ER--------------------------------------------------------------------- -- --|ER An_Access_Type_Definition - 3.10 -- --|CR -- --|CR Child elements returned by: -- --|CR function Access_To_Object_Definition -- --|CR function Access_To_Subprogram_Parameter_Profile -- --|CR function Access_To_Function_Result_Profile -- ------------------------------------------------------------------------------ -- 16.18 function Access_To_Object_Definition ------------------------------------------------------------------------------ function Access_To_Object_Definition (Type_Definition : Asis.Type_Definition) return Asis.Subtype_Indication; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the Access_Type_Definition to query -- -- Returns the subtype_indication following the reserved word "access". -- -- Appropriate Type_Kinds: -- An_Access_Type_Definition. -- A_Formal_Access_Type_Definition -- -- Appropriate Access_Type_Kinds: -- A_Pool_Specific_Access_To_Variable -- An_Access_To_Variable -- An_Access_To_Constant -- -- Returns Element_Kinds: -- A_Subtype_Indication -- ------------------------------------------------------------------------------ -- --|A2005 start (implemented) -- 16.N??? function Anonymous_Access_To_Object_Subtype_Mark ------------------------------------------------------------------------------ function Anonymous_Access_To_Object_Subtype_Mark (Definition : Asis.Definition) return Asis.Expression; ------------------------------------------------------------------------------ -- Definition - Specifies the anonymous access definition to query -- -- Returns the subtype_mark following the reserved word(s) "access" or -- "access constant". -- -- Appropriate Definition_Kinds: -- An_Access_Definition. -- -- Appropriate Access_Definition_Kinds: -- An_Anonymous_Access_To_Variable -- An_Anonymous_Access_To_Constant -- -- Returns Expression_Kinds: -- An_Identifier -- A_Selected_Component -- An_Attribute_Reference -- --|D2005 start -- Another possibility could be to add this functionality to the -- Access_To_Object_Definition query. What would be better? -- --|D2005 end -- --|A2005 end ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 16.19 function Access_To_Subprogram_Parameter_Profile ------------------------------------------------------------------------------ function Access_To_Subprogram_Parameter_Profile (Type_Definition : Asis.Type_Definition) return Asis.Parameter_Specification_List; ------------------------------------------------------------------------------ -- --|A2005 start -- Type_Definition - Specifies the access type definition to query. It may be -- access_type_definition from type_declaration or access_definition -- defining an anonymous access type -- -- Returns a list of parameter_specification elements in the formal part of -- the parameter_profile in the access type definition defining access to -- subprogram. -- --|A2005 end -- -- Returns a Nil_Element_List if the parameter_profile has no formal part. -- -- Results of this query may vary across ASIS implementations. Some -- implementations normalize all multiple name parameter_specification -- elements into an equivalent sequence of corresponding single name -- parameter_specification elements. See Reference Manual 3.3.1(7). -- -- --|A2005 start -- Appropriate Definition_Kinds: -- A_Type_Definition -- An_Access_Definition -- --|A2005 end -- Appropriate Type_Kinds: -- An_Access_Type_Definition. -- A_Formal_Access_Type_Definition. -- -- Appropriate Access_Type_Kinds: -- An_Access_To_Procedure -- An_Access_To_Protected_Procedure -- An_Access_To_Function -- An_Access_To_Protected_Function -- -- --|A2005 start -- Appropriate Access_Definition_Kinds: (implemented) -- An_Anonymous_Access_To_Procedure -- An_Anonymous_Access_To_Protected_Procedure -- An_Anonymous_Access_To_Function -- An_Anonymous_Access_To_Protected_Function -- --|A2005 end -- -- Returns Declaration_Kinds: -- A_Parameter_Specification -- ------------------------------------------------------------------------------ -- 16.20 function Access_To_Function_Result_Profile ------------------------------------------------------------------------------ function Access_To_Function_Result_Profile (Type_Definition : Asis.Type_Definition) -- --|A2005 start return Asis.Element; -- --|A2005 end ------------------------------------------------------------------------------ -- --|A2005 start -- Type_Definition - Specifies the access type definition to query. It may be -- access_type_definition from type_declaration or access_definition -- defining an anonymous access type -- -- Returns the definition for the return type for the access function. It may -- be subtype_mark expression or anonymous access_definition -- --|A2005 end -- -- --|A2005 start -- Appropriate Definition_Kinds: -- A_Type_Definition -- An_Access_Definition -- --|A2005 end -- -- Appropriate Type_Kinds: -- An_Access_Type_Definition -- A_Formal_Access_Type_Definition -- -- Appropriate Access_Type_Kinds: -- An_Access_To_Function -- An_Access_To_Protected_Function -- -- --|A2005 start -- Appropriate Access_Definition_Kinds: (implemented) -- An_Anonymous_Access_To_Function -- An_Anonymous_Access_To_Protected_Function -- --|A2005 end -- -- Returns Expression_Kinds: -- An_Identifier -- A_Selected_Component -- -- --|A2005 start -- Returns Definition_Kinds: -- An_Access_Definition -- --|A2005 end -- -- --|ER--------------------------------------------------------------------- -- --|ER A_Root_Type_Definition - 3.5.4(9), 3.5.6(2) - No child elements -- --|ER--------------------------------------------------------------------- -- --|ER -- --|ER A_Subtype_Indication - 3.3.2 -- --|CR -- --|CR Child elements returned by: -- --|CR function Subtype_Mark -- --|CR function Subtype_Constraint -- ------------------------------------------------------------------------------ -- 16.21 function Subtype_Mark ------------------------------------------------------------------------------ function Subtype_Mark (Definition : Asis.Definition) return Asis.Expression; ------------------------------------------------------------------------------ -- Definition - Specifies the definition to query -- -- Returns the subtype_mark expression of the definition. -- -- Appropriate Definition_Kinds: -- A_Subtype_Indication -- A_Discrete_Subtype_Definition -- Appropriate Discrete_Range_Kinds: -- A_Discrete_Subtype_Indication -- A_Discrete_Range -- Appropriate Discrete_Range_Kinds: -- A_Discrete_Subtype_Indication -- A_Formal_Derived_Type_Definition -- -- Returns Expression_Kinds: -- An_Identifier -- A_Selected_Component -- An_Attribute_Reference -- ------------------------------------------------------------------------------ -- 16.22 function Subtype_Constraint ------------------------------------------------------------------------------ function Subtype_Constraint (Definition : Asis.Definition) return Asis.Constraint; ------------------------------------------------------------------------------ -- Definition - Specifies the definition to query -- -- Returns the constraint of the subtype_indication. -- -- Returns a Nil_Element if no explicit constraint is present. -- -- Appropriate Definition_Kinds: -- A_Subtype_Indication -- A_Discrete_Subtype_Definition -- Appropriate Discrete_Range_Kinds: -- A_Discrete_Subtype_Indication -- A_Discrete_Range -- Appropriate Discrete_Range_Kinds: -- A_Discrete_Subtype_Indication -- -- Returns Definition_Kinds: -- Not_A_Definition -- A_Constraint -- -- --|AN Application Note: -- --|AN -- --|AN When an unconstrained subtype indication for a type having -- --|AN discriminants with default values is used, a Nil_Element is -- --|AN returned by this function. Use the queries Subtype_Mark, and -- --|AN Corresponding_Name_Declaration [, and Corresponding_First_Subtype] -- --|AN to obtain the declaration defining the defaults. -- -- --|ER--------------------------------------------------------------------- -- --|ER A_Constraint - 3.2.2 -- --|ER -- --|ER A_Simple_Expression_Range - 3.5 -- --|CR -- --|CR Child elements returned by: -- --|CR function Lower_Bound -- --|CR function Upper_Bound -- ------------------------------------------------------------------------------ -- 16.23 function Lower_Bound ------------------------------------------------------------------------------ function Lower_Bound (Constraint : Asis.Range_Constraint) return Asis.Expression; ------------------------------------------------------------------------------ -- Constraint - Specifies the range_constraint or discrete_range to query -- -- Returns the simple_expression for the lower bound of the range. -- -- Appropriate Constraint_Kinds: -- A_Simple_Expression_Range -- -- Appropriate Discrete_Range_Kinds: -- A_Discrete_Simple_Expression_Range -- -- Returns Element_Kinds: -- An_Expression -- ------------------------------------------------------------------------------ -- 16.24 function Upper_Bound ------------------------------------------------------------------------------ function Upper_Bound (Constraint : Asis.Range_Constraint) return Asis.Expression; ------------------------------------------------------------------------------ -- Constraint - Specifies the range_constraint or discrete_range to query -- -- Returns the simple_expression for the upper bound of the range. -- -- Appropriate Constraint_Kinds: -- A_Simple_Expression_Range -- -- Appropriate Discrete_Range_Kinds: -- A_Discrete_Simple_Expression_Range -- -- Returns Element_Kinds: -- An_Expression -- -- --|ER--------------------------------------------------------------------- -- --|ER A_Range_Attribute_Reference - 3.5 -- --|CR -- --|CR Child elements returned by: -- --|CR function Range_Attribute -- ------------------------------------------------------------------------------ -- 16.25 function Range_Attribute ------------------------------------------------------------------------------ function Range_Attribute (Constraint : Asis.Range_Constraint) return Asis.Expression; ------------------------------------------------------------------------------ -- Constraint - Specifies the range_attribute_reference or -- discrete_range attribute_reference to query -- -- Returns the range_attribute_reference expression of the range. -- -- Appropriate Constraint_Kinds: -- A_Range_Attribute_Reference -- -- Appropriate Discrete_Range_Kinds: -- A_Discrete_Range_Attribute_Reference -- -- Returns Expression_Kinds: -- An_Attribute_Reference -- -- --|ER--------------------------------------------------------------------- -- --|ER A_Digits_Constraint - 3.5.9 -- --|CR -- --|CR Child elements returned by: -- --|CR function Digits_Expression -- --|CR function Real_Range_Constraint -- --|ER--------------------------------------------------------------------- -- --|ER A_Delta_Constraint - J.3 -- --|CR -- --|CR Child elements returned by: -- --|CR function Delta_Expression -- --|CR function Real_Range_Constraint -- --|CR--------------------------------------------------------------------- -- --|ER An_Index_Constraint - 3.6.1 -- --|CR -- --|CR Child elements returned by: -- --|CR function Discrete_Ranges -- ------------------------------------------------------------------------------ -- 16.26 function Discrete_Ranges ------------------------------------------------------------------------------ function Discrete_Ranges (Constraint : Asis.Constraint) return Asis.Discrete_Range_List; ------------------------------------------------------------------------------ -- Constraint - Specifies the array index_constraint to query -- -- Returns the list of discrete_range components for an index_constraint, -- in their order of appearance. -- -- Appropriate Constraint_Kinds: -- An_Index_Constraint -- -- Returns Definition_Kinds: -- A_Discrete_Range -- -- --|ER--------------------------------------------------------------------- -- --|ER A_Discriminant_Constraint - 3.7.1 -- --|CR -- --|CR Child elements returned by: -- --|CR function Discriminant_Associations -- ------------------------------------------------------------------------------ -- 16.27 function Discriminant_Associations ------------------------------------------------------------------------------ function Discriminant_Associations (Constraint : Asis.Constraint; Normalized : Boolean := False) return Asis.Discriminant_Association_List; ------------------------------------------------------------------------------ -- Constraint - Specifies the discriminant_constraint to query -- Normalized - Specifies whether the normalized form is desired -- -- Returns a list of the discriminant_association elements of the -- discriminant_constraint. -- -- Returns a Nil_Element_List if there are no discriminant_association -- elements. -- --|D2005 start -- A_Discriminant_Constraint can never contain no discriminant_association! -- Just check with the definition of the syntax of this construct in the Ada -- Standard -- --|D2005 end -- -- An unnormalized list contains only explicit associations ordered as they -- appear in the program text. Each unnormalized association has a list of -- discriminant_selector_name elements and an explicit expression. -- -- A normalized list contains artificial associations representing all -- explicit associations. It has a length equal to the number of -- discriminant_specification elements of the known_discriminant_part. -- The order of normalized associations matches the order of -- discriminant_specification elements. -- -- Each normalized association represents a one on one mapping of a -- discriminant_specification to the explicit expression. A normalized -- association has one A_Defining_Name component that denotes the -- discriminant_specification, and one An_Expression component that is the -- explicit expression. -- -- -- Appropriate Constraint_Kinds: -- A_Discriminant_Constraint -- -- Returns Association_Kinds: -- A_Discriminant_Association -- -- --|IR Implementation Requirements: -- --|IR -- --|IR Normalized associations are Is_Normalized and Is_Part_Of_Implicit. -- --|IR Normalized associations are never Is_Equal to unnormalized -- --|IR associations. -- --|IR -- --|IP Implementation Permissions: -- --|IP -- --|IP An implementation may choose to normalize its internal representation -- --|IP to use the defining_identifier element instead of the -- --|IP discriminant_selector_name element. -- --|IP -- --|IP If so, this query will return Is_Normalized associations even if -- --|IP Normalized is False, and the query -- --|IP Discriminant_Associations_Normalized will return True. -- --|IP -- --|AN Application Note: -- --|AN -- --|AN It is not possible to obtain either a normalized or unnormalized -- --|AN Discriminant_Association list for an unconstrained record or derived -- --|AN subtype_indication where the discriminant_association elements are -- --|AN by default; there is no constraint to query, and a Nil_Element is -- --|AN supplied returned from the query Subtype_Constraint. -- -- --|ER--------------------------------------------------------------------- -- --|ER A_Component_Definition - 3.6 -- --|CR -- --|CR Child elements returned by: -- --|CR function Component_Subtype_Indication -- ------------------------------------------------------------------------------ -- 16.28 function Component_Subtype_Indication ------------------------------------------------------------------------------ function Component_Subtype_Indication (Component_Definition : Asis.Component_Definition) return Asis.Subtype_Indication; ------------------------------------------------------------------------------ -- Component_Definition - Specifies the Component_Definition to query -- -- Returns the subtype_indication of the Component_Definition. -- -- --|A2005 start -- --|D2005 start -- In ASIS 2005 this query is an obsolescent feature, it should not be used -- for analyzing Ada 2005 code. We need a proper warning note in the ASIS -- Standard. The problem here that the name of the query requires to return -- namely a subtype indication, but in Ada 2005 we may also return -- access_defintion. See proposal in next section. -- This query should be kept as is because of upward compatibility reasons -- --|D2005 end -- --|A2005 end -- Appropriate Definition_Kinds: -- A_Component_Definition -- -- Returns Definition_Kinds: -- A_Subtype_Indication -- -- --|A2005 start ------------------------------------------------------------------------------ -- 16.#??? function Component_Definition_View ------------------------------------------------------------------------------ function Component_Definition_View (Component_Definition : Asis.Component_Definition) return Asis.Definition; -- --|D2005 start -- Is it a good name for the query? -- --|D2005 end ------------------------------------------------------------------------------ -- Component_Definition - Specifies the Component_Definition to query -- -- Returns the subtype_indication or access_definition of the -- Component_Definition. -- -- Appropriate Definition_Kinds: -- A_Component_Definition -- -- Returns Definition_Kinds: -- A_Subtype_Indication -- An_Access_Definition -- -- --|A2005 end -- --|ER--------------------------------------------------------------------- -- --|ER A_Discrete_Subtype_Definition - 3.6 -- --|ER A_Discrete_Range - 3.6.1 -- --|ER -- --|ER A_Discrete_Subtype_Indication -- --|CR -- --|CR Child elements returned by: -- --|CR function Subtype_Mark -- --|CR function Subtype_Constraint -- --|CR -- --|CR A_Discrete_Simple_Expression_Range -- --|CR -- --|CR Child elements returned by: -- --|CR function Lower_Bound -- --|CR function Upper_Bound -- --|ER -- --|ER--------------------------------------------------------------------- -- --|ER A_Discrete_Range_Attribute_Reference - 3.5 -- --|CR -- --|CR Child elements returned by: -- --|CR function Range_Attribute -- --|ER--------------------------------------------------------------------- -- --|ER An_Unknown_Discriminant_Part - 3.7 - No child elements -- --|ER--------------------------------------------------------------------- -- --|ER A_Known_Discriminant_Part - 3.7 -- --|CR -- --|CR Child elements returned by: -- --|CR function Discriminants -- ------------------------------------------------------------------------------ -- 16.29 function Discriminants ------------------------------------------------------------------------------ function Discriminants (Definition : Asis.Definition) return Asis.Discriminant_Specification_List; ------------------------------------------------------------------------------ -- Definition - Specifies the known_discriminant_part to query -- -- Returns a list of discriminant_specification elements, in their order of -- appearance. -- -- Results of this query may vary across ASIS implementations. Some -- implementations normalize all multi-name discriminant_specification -- elements into an equivalent sequence of single name -- discriminant_specification elements. See Reference Manual 3.3.1(7). -- -- Appropriate Definition_Kinds: -- A_Known_Discriminant_Part -- -- Returns Declaration_Kinds: -- A_Discriminant_Specification -- -- --|ER--------------------------------------------------------------------- -- --|ER A_Record_Definition - 3.8 -- --|CR -- --|CR Child elements returned by: -- --|CR function Record_Components -- --|CR function Implicit_Components -- ------------------------------------------------------------------------------ -- 16.30 function Record_Components ------------------------------------------------------------------------------ function Record_Components (Definition : Asis.Definition; Include_Pragmas : Boolean := False) return Asis.Record_Component_List; ------------------------------------------------------------------------------ -- Definition - Specifies the record_definition or variant to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns a list of the components and pragmas of the record_definition or -- variant, in their order of appearance. -- -- Declarations are not returned for implementation-defined components of the -- record_definition. See Reference Manual 13.5.1 (15). These components are -- not normally visible to the ASIS application. However, they can be obtained -- with the query Implicit_Components. -- -- Appropriate Definition_Kinds: -- A_Record_Definition -- A_Variant -- -- Returns Element_Kinds: -- A_Pragma -- A_Declaration -- A_Definition -- A_Clause -- -- Returns Declaration_Kinds: -- A_Component_Declaration -- -- Returns Definition_Kinds: -- A_Null_Component -- A_Variant_Part -- -- Returns Representation_Clause_Kinds: -- An_Attribute_Definition_Clause -- ------------------------------------------------------------------------------ -- 16.31 function Implicit_Components ------------------------------------------------------------------------------ function Implicit_Components (Definition : Asis.Definition) return Asis.Record_Component_List; ------------------------------------------------------------------------------ -- Definition - Specifies the record_definition or variant to query -- -- Returns a list of all implicit implementation-defined components of the -- record_definition or variant. The Enclosing_Element of each component is -- the Definition argument. Each component is Is_Part_Of_Implicit. -- -- Returns a Nil_Element_List if there are no implicit implementation-defined -- components or if the ASIS implementation does not support such -- implicit declarations. -- -- Appropriate Definition_Kinds: -- A_Record_Definition -- A_Variant -- -- Returns Element_Kinds: -- A_Declaration -- -- Returns Declaration_Kinds: -- A_Component_Declaration -- -- --|IP Implementation Permissions: -- --|IP -- --|IP Some implementations do not represent all forms of implicit -- --|IP declarations such that elements representing them can be easily -- --|IP provided. An implementation can choose whether or not to construct -- --|IP and provide artificial declarations for implicitly declared elements. -- --|IP -- --|IP Use the query Implicit_Components_Supported to determine if the -- --|IP implementation provides implicit record components. -- -- --|ER--------------------------------------------------------------------- -- --|ER A_Null_Record_Definition - 3.8 - No child elements -- --|ER--------------------------------------------------------------------- -- --|ER A_Variant_Part - 3.8.1 -- --|CR -- --|CR Child elements returned by: -- --|CR function Discriminant_Direct_Name -- --|CR function Variants -- ------------------------------------------------------------------------------ -- 16.32 function Discriminant_Direct_Name ------------------------------------------------------------------------------ function Discriminant_Direct_Name (Variant_Part : Asis.Record_Component) return Asis.Name; ------------------------------------------------------------------------------ -- Variant_Part - Specifies the variant_part to query -- -- Returns the Discriminant_Direct_Name of the variant_part. -- -- Appropriate Definition_Kinds: -- A_Variant_Part -- -- Returns Expression_Kinds: -- An_Identifier -- ------------------------------------------------------------------------------ -- 16.33 function Variants ------------------------------------------------------------------------------ function Variants (Variant_Part : Asis.Record_Component; Include_Pragmas : Boolean := False) return Asis.Variant_List; ------------------------------------------------------------------------------ -- Variant_Part - Specifies the variant_part to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns a list of variants that make up the record component, in their -- order of appearance. -- -- The only pragmas returned are those following the reserved word "is" -- and preceding the reserved word "when" of first variant, and those between -- following variants. -- -- Appropriate Definition_Kinds: -- A_Variant_Part -- -- Returns Element_Kinds: -- A_Pragma -- A_Definition -- -- Returns Definition_Kinds: -- A_Variant -- -- --|ER--------------------------------------------------------------------- -- --|ER A_Variant - 3.8.1 -- --|CR -- --|CR Child elements returned by: -- --|CR function Variant_Choices -- --|CR function Record_Components -- --|CR function Implicit_Components -- ------------------------------------------------------------------------------ -- 16.34 function Variant_Choices ------------------------------------------------------------------------------ function Variant_Choices (Variant : Asis.Variant) return Asis.Element_List; ------------------------------------------------------------------------------ -- Variant - Specifies the variant to query -- -- Returns the discrete_choice_list elements, in their order of appearance. -- Choices are either an expression, a discrete range, or an others choice. -- -- Appropriate Definition_Kinds: -- A_Variant -- -- Returns Element_Kinds: -- An_Expression -- A_Definition -- -- Returns Definition_Kinds: -- A_Discrete_Range -- An_Others_Choice -- -- --|ER--------------------------------------------------------------------- -- --|ER A_Private_Type_Definition - 7.3 - No child elements -- --|ER A_Tagged_Private_Type_Definition - 7.3 - No child elements -- --|ER--------------------------------------------------------------------- -- --|ER A_Private_Extension_Definition - 7.3 -- --|CR -- --|CR Child elements returned by: -- --|CR function Ancestor_Subtype_Indication -- ------------------------------------------------------------------------------ -- --|A2005 start (implemented) -- 16.#??? function Definition_Interface_List ------------------------------------------------------------------------------ function Definition_Interface_List (Type_Definition : Asis.Definition) return Asis.Expression_List; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the definition to query -- -- Returns a list of subtype mark names making up the interface_list in the -- argument definition, in their order of appearance. -- -- Appropriate Definition_Kinds: -- A_Private_Extension_Definition -- -- Appropriate Type_Kinds: -- A_Derived_Record_Extension_Definition -- An_Interface_Type_Definition -- -- Appropriate Formal_Type_Kinds: -- A_Formal_Derived_Type_Definition -- A_Formal_Interface_Type_Definition -- -- Returns Expression_Kinds: -- An_Identifier -- A_Selected_Component -- --|A2005 end ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 16.35 function Ancestor_Subtype_Indication ------------------------------------------------------------------------------ function Ancestor_Subtype_Indication (Definition : Asis.Definition) return Asis.Subtype_Indication; ------------------------------------------------------------------------------ -- Definition - Specifies the definition to query -- -- Returns the ancestor_subtype_indication following the reserved word "new" -- in the private_extension_declaration. -- -- Appropriate Definition_Kinds: -- A_Private_Extension_Definition -- -- Returns Definition_Kinds: -- A_Subtype_Indication -- --|ER--------------------------------------------------------------------- -- --|ER A_Task_Definition - 9.1 -- --|ER A_Protected_Definition - 9.4 -- --|CR -- --|CR Child elements returned by: -- --|CR function Visible_Part_Items -- --|CR function Private_Part_Items -- ------------------------------------------------------------------------------ -- 16.36 function Visible_Part_Items ------------------------------------------------------------------------------ function Visible_Part_Items (Definition : Asis.Definition; Include_Pragmas : Boolean := False) return Asis.Declarative_Item_List; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the type_definition to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns a list of declarations, representation clauses, and pragmas -- in the visible part of the task or protected definition, in their order -- of appearance. The list does not include discriminant_specification -- elements of the known_discriminant_part, if any, of the protected type or -- task type declaration. -- -- Returns a Nil_Element_List if there are no items. -- -- Appropriate Definition_Kinds: -- A_Task_Definition -- A_Protected_Definition -- -- Returns Element_Kinds: -- A_Pragma -- A_Declaration -- A_Clause -- ------------------------------------------------------------------------------ -- 16.37 function Private_Part_Items ------------------------------------------------------------------------------ function Private_Part_Items (Definition : Asis.Definition; Include_Pragmas : Boolean := False) return Asis.Declarative_Item_List; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the task type definition to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns a list of declarations, representation clauses, and pragmas in the -- private part of the task or protected definition, in their order of -- appearance. -- -- Returns a Nil_Element_List if there are no items. -- -- Appropriate Definition_Kinds: -- A_Task_Definition -- A_Protected_Definition -- -- Returns Element_Kinds: -- A_Pragma -- A_Declaration -- A_Clause -- ------------------------------------------------------------------------------ -- 16.38 function Is_Private_Present ------------------------------------------------------------------------------ function Is_Private_Present (Definition : Asis.Definition) return Boolean; ------------------------------------------------------------------------------ -- Definition - Specifies the definition to query -- -- Returns True if the argument is a task_definition or a protected_definition -- that has a reserved word "private" marking the beginning of a (possibly -- empty) private part. -- -- Returns False for any definition without a private part. -- Returns False for any unexpected Element. -- -- Expected Definition_Kinds: -- A_Task_Definition -- A_Protected_Definition -- -- --|ER--------------------------------------------------------------------- -- --|ER A_Formal_Type_Definition - 12.5 -- --|ER -- --|ER A_Formal_Private_Type_Definition - 12.5.1 - No child elements -- --|ER A_Formal_Tagged_Private_Type_Definition - 12.5.1 - No child elements -- --|ER -- --|ER A_Formal_Derived_Type_Definition -- --|CR Child elements returned by: -- --|CR function Subtype_Mark -- -- --|ER--------------------------------------------------------------------- -- --|ER A_Formal_Discrete_Type_Definition - 12.5.2 - No child elements -- --|ER A_Formal_Signed_Integer_Type_Definition - 12.5.2 - No child elements -- --|ER A_Formal_Modular_Type_Definition - 12.5.2 - No child elements -- --|ER A_Formal_Floating_Point_Definition - 12.5.2 - No child elements -- --|ER A_Formal_Ordinary_Fixed_Point_Definition - 12.5.2 - No child elements -- --|ER A_Formal_Decimal_Fixed_Point_Definition - 12.5.2 - No child elements -- --|ER--------------------------------------------------------------------- -- --|ER A_Formal_Unconstrained_Array_Definition - 12.5.3 -- --|CR -- --|CR Child elements returned by: -- --|CR function Index_Subtype_Definitions -- --|CR function Array_Component_Definition -- --|ER--------------------------------------------------------------------- -- --|ER A_Formal_Constrained_Array_Definition - 12.5.3 -- --|CR -- --|CR Child elements returned by: -- --|CR function Discrete_Subtype_Definitions -- --|CR function Array_Component_Definition -- --|ER--------------------------------------------------------------------- -- --|ER A_Formal_Access_Type_Definition - 12.5.4 -- --|CR -- --|CR Child elements returned by: -- --|CR function Access_To_Object_Definition -- --|CR function Access_To_Subprogram_Parameter_Profile -- --|CR function Access_To_Function_Result_Profile -- ------------------------------------------------------------------------------ -- --|ASIS2012 start -- The stuff here should be reordered when the new language standard is -- stabilized. function Aspect_Mark (Aspect_Specification : Asis.Element) return Asis.Element; ------------------------------------------------------------------------------ -- Returns the aspect mark from the argument aspect specification -- Element. -- -- Appropriate Definition_Kinds: -- An_Aspect_Specification -- -- Returns Expression_Kinds: -- An_Identifier -- An_Attribute_Reference function Aspect_Definition (Aspect_Specification : Asis.Element) return Asis.Element; ------------------------------------------------------------------------------ -- Returns the aspect definition expression from the argument aspect -- specification -- -- Appropriate Definition_Kinds: -- -- An_Aspect_Specification -- -- Returns Element_Kinds: -- -- An_Expression -- --|ASIS2012 end end Asis.Definitions;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Tools Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 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$ ------------------------------------------------------------------------------ package Engines is type Text_Property is (Code, Condition, Lower, Upper, -- Code for range return X'First X'Last Intrinsic_Name, Associations, -- names of record assotiation a,b,c Tag_Name, -- external tag name image Method_Name, -- name of subrogram in virtual table Address, -- Access or address of an object Initialize, -- Code to initialize an object of given type Typed_Array_Initialize, -- Iniitalize component of Typed_Array aggr Typed_Array_Item_Type, -- Elementary type of Typed_Array item Assign, -- Code to copy component, discriminant or variant Bounds, -- "First,Last" bounds for nested named array aggregate Size); -- value of S'Size or X'Size type Boolean_Property is (Export, Has_Simple_Output, -- Has parameters of Is_Simple_Type and -- has [in] out mode Is_Simple_Type, -- Is non-object type (Number, Boolean, etc) Is_Simple_Ref, -- Wrapper for non-object type (Number, Boolean, etc) Is_Array_Of_Simple, -- Is array elements Is_Simple_Type Inside_Package, -- Enclosing Element is a package Is_Dispatching); -- Declaration/call is a dispatching subprogram type Integer_Property is (Alignment); -- value of S'Alignment or X'Alignment type Convention_Property is (Call_Convention); type Convention_Kind is (Intrinsic, JavaScript_Property_Getter, -- obj.prop JavaScript_Property_Setter, -- obj.prop = val JavaScript_Function, -- funct (args) JavaScript_Method, -- obj.funct (args) JavaScript_Getter, -- collection.getter (index - 1) Unspecified); end Engines;
-- This package is intended to set up and tear down the test environment. -- Once created by GNATtest, this package will never be overwritten -- automatically. Contents of this package can be modified in any way -- except for sections surrounded by a 'read only' marker. package body Statistics.Test_Data is procedure Set_Up(Gnattest_T: in out Test) is pragma Unreferenced(Gnattest_T); begin null; end Set_Up; procedure Tear_Down(Gnattest_T: in out Test) is pragma Unreferenced(Gnattest_T); begin null; end Tear_Down; end Statistics.Test_Data;
Ada.Text_IO.Put_Line -- would not compile ("Factorial(20) =" & Integer'Image(A_11_15 * A_16_20 * F_10));
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- A D A . C O N T A I N E R S . V E C T O R S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2004-2006, 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 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. -- -- -- -- -- -- -- -- -- -- -- This unit was originally developed by Matthew J Heaney. -- ------------------------------------------------------------------------------ with Ada.Finalization; with Ada.Streams; generic type Index_Type is range <>; type Element_Type is private; with function "=" (Left, Right : Element_Type) return Boolean is <>; package Ada.Containers.Vectors is pragma Preelaborate; subtype Extended_Index is Index_Type'Base range Index_Type'First - 1 .. Index_Type'Min (Index_Type'Base'Last - 1, Index_Type'Last) + 1; No_Index : constant Extended_Index := Extended_Index'First; type Vector is tagged private; pragma Preelaborable_Initialization (Vector); type Cursor is private; pragma Preelaborable_Initialization (Cursor); Empty_Vector : constant Vector; No_Element : constant Cursor; function "=" (Left, Right : Vector) return Boolean; function To_Vector (Length : Count_Type) return Vector; function To_Vector (New_Item : Element_Type; Length : Count_Type) return Vector; function "&" (Left, Right : Vector) return Vector; function "&" (Left : Vector; Right : Element_Type) return Vector; function "&" (Left : Element_Type; Right : Vector) return Vector; function "&" (Left, Right : Element_Type) return Vector; function Capacity (Container : Vector) return Count_Type; procedure Reserve_Capacity (Container : in out Vector; Capacity : Count_Type); function Length (Container : Vector) return Count_Type; procedure Set_Length (Container : in out Vector; Length : Count_Type); function Is_Empty (Container : Vector) return Boolean; procedure Clear (Container : in out Vector); function To_Cursor (Container : Vector; Index : Extended_Index) return Cursor; function To_Index (Position : Cursor) return Extended_Index; function Element (Container : Vector; Index : Index_Type) return Element_Type; function Element (Position : Cursor) return Element_Type; procedure Replace_Element (Container : in out Vector; Index : Index_Type; New_Item : Element_Type); procedure Replace_Element (Container : in out Vector; Position : Cursor; New_Item : Element_Type); procedure Query_Element (Container : Vector; Index : Index_Type; Process : not null access procedure (Element : Element_Type)); procedure Query_Element (Position : Cursor; Process : not null access procedure (Element : Element_Type)); procedure Update_Element (Container : in out Vector; Index : Index_Type; Process : not null access procedure (Element : in out Element_Type)); procedure Update_Element (Container : in out Vector; Position : Cursor; Process : not null access procedure (Element : in out Element_Type)); procedure Move (Target : in out Vector; Source : in out Vector); procedure Insert (Container : in out Vector; Before : Extended_Index; New_Item : Vector); procedure Insert (Container : in out Vector; Before : Cursor; New_Item : Vector); procedure Insert (Container : in out Vector; Before : Cursor; New_Item : Vector; Position : out Cursor); procedure Insert (Container : in out Vector; Before : Extended_Index; New_Item : Element_Type; Count : Count_Type := 1); procedure Insert (Container : in out Vector; Before : Cursor; New_Item : Element_Type; Count : Count_Type := 1); procedure Insert (Container : in out Vector; Before : Cursor; New_Item : Element_Type; Position : out Cursor; Count : Count_Type := 1); procedure Insert (Container : in out Vector; Before : Extended_Index; Count : Count_Type := 1); procedure Insert (Container : in out Vector; Before : Cursor; Position : out Cursor; Count : Count_Type := 1); procedure Prepend (Container : in out Vector; New_Item : Vector); procedure Prepend (Container : in out Vector; New_Item : Element_Type; Count : Count_Type := 1); procedure Append (Container : in out Vector; New_Item : Vector); procedure Append (Container : in out Vector; New_Item : Element_Type; Count : Count_Type := 1); procedure Insert_Space (Container : in out Vector; Before : Extended_Index; Count : Count_Type := 1); procedure Insert_Space (Container : in out Vector; Before : Cursor; Position : out Cursor; Count : Count_Type := 1); procedure Delete (Container : in out Vector; Index : Extended_Index; Count : Count_Type := 1); procedure Delete (Container : in out Vector; Position : in out Cursor; Count : Count_Type := 1); procedure Delete_First (Container : in out Vector; Count : Count_Type := 1); procedure Delete_Last (Container : in out Vector; Count : Count_Type := 1); procedure Reverse_Elements (Container : in out Vector); procedure Swap (Container : in out Vector; I, J : Index_Type); procedure Swap (Container : in out Vector; I, J : Cursor); function First_Index (Container : Vector) return Index_Type; function First (Container : Vector) return Cursor; function First_Element (Container : Vector) return Element_Type; function Last_Index (Container : Vector) return Extended_Index; function Last (Container : Vector) return Cursor; function Last_Element (Container : Vector) return Element_Type; function Next (Position : Cursor) return Cursor; procedure Next (Position : in out Cursor); function Previous (Position : Cursor) return Cursor; procedure Previous (Position : in out Cursor); function Find_Index (Container : Vector; Item : Element_Type; Index : Index_Type := Index_Type'First) return Extended_Index; function Find (Container : Vector; Item : Element_Type; Position : Cursor := No_Element) return Cursor; function Reverse_Find_Index (Container : Vector; Item : Element_Type; Index : Index_Type := Index_Type'Last) return Extended_Index; function Reverse_Find (Container : Vector; Item : Element_Type; Position : Cursor := No_Element) return Cursor; function Contains (Container : Vector; Item : Element_Type) return Boolean; function Has_Element (Position : Cursor) return Boolean; procedure Iterate (Container : Vector; Process : not null access procedure (Position : Cursor)); procedure Reverse_Iterate (Container : Vector; Process : not null access procedure (Position : Cursor)); generic with function "<" (Left, Right : Element_Type) return Boolean is <>; package Generic_Sorting is function Is_Sorted (Container : Vector) return Boolean; procedure Sort (Container : in out Vector); procedure Merge (Target : in out Vector; Source : in out Vector); end Generic_Sorting; private pragma Inline (First_Index); pragma Inline (Last_Index); pragma Inline (Element); pragma Inline (First_Element); pragma Inline (Last_Element); pragma Inline (Query_Element); pragma Inline (Update_Element); pragma Inline (Replace_Element); pragma Inline (Contains); type Elements_Type is array (Index_Type range <>) of Element_Type; function "=" (L, R : Elements_Type) return Boolean is abstract; type Elements_Access is access Elements_Type; use Ada.Finalization; type Vector is new Controlled with record Elements : Elements_Access; Last : Extended_Index := No_Index; Busy : Natural := 0; Lock : Natural := 0; end record; procedure Adjust (Container : in out Vector); procedure Finalize (Container : in out Vector); use Ada.Streams; procedure Write (Stream : not null access Root_Stream_Type'Class; Container : Vector); for Vector'Write use Write; procedure Read (Stream : not null access Root_Stream_Type'Class; Container : out Vector); for Vector'Read use Read; Empty_Vector : constant Vector := (Controlled with null, No_Index, 0, 0); type Vector_Access is access constant Vector; for Vector_Access'Storage_Size use 0; type Cursor is record Container : Vector_Access; Index : Index_Type := Index_Type'First; end record; procedure Write (Stream : not null access Root_Stream_Type'Class; Position : Cursor); for Cursor'Write use Write; procedure Read (Stream : not null access Root_Stream_Type'Class; Position : out Cursor); for Cursor'Read use Read; No_Element : constant Cursor := Cursor'(null, Index_Type'First); end Ada.Containers.Vectors;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . S E Q U E N T I A L _ I O . C _ S T R E A M S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides an interface between Ada.Sequential_IO and the -- C streams. This allows sharing of a stream between Ada and C or C++, -- as well as allowing the Ada program to operate directly on the stream. with Interfaces.C_Streams; generic package Ada.Sequential_IO.C_Streams is package ICS renames Interfaces.C_Streams; function C_Stream (F : File_Type) return ICS.FILEs; -- Obtain stream from existing open file procedure Open (File : in out File_Type; Mode : File_Mode; C_Stream : ICS.FILEs; Form : String := ""; Name : String := ""); -- Create new file from existing stream end Ada.Sequential_IO.C_Streams;
with Ada.Containers.Doubly_Linked_Lists; use Ada.Containers; package Marble_Mania is package Nat_List is new Ada.Containers.Doubly_Linked_Lists (Natural); type List_Ptr is access all Nat_List.List; type Score_Count is mod 2**64; type Player_Scores is array (Positive range <>) of Score_Count; type Circle_Game (Players : Positive) is tagged record Round : Natural := 0; Current : Nat_List.Cursor; Scores : Player_Scores (1 .. Players) := (others => 0); Board : not null List_Ptr := new Nat_List.List; end record; procedure Start (Game : in out Circle_Game) with Pre => Game.Board.Length = 0, Post => Game.Board.Length = 1 and Game.Round = 1; procedure Play (Player : in Positive; Game : in out Circle_Game) with Pre => Player <= Game.Scores'Last and Game.Board.Length > 0, Post => Game'Old.Round + 1 = Game.Round; function Play_Until (Players : in Positive; Last_Marble : in Positive) return Score_Count; end Marble_Mania;
-- This file was generated by bmp2ada with Giza.Image; with Giza.Image.DMA2D; use Giza.Image.DMA2D; package ok_80x80 is pragma Style_Checks (Off); CLUT : aliased constant L4_CLUT_T := ( (R => 181, G => 230, B => 18), (R => 186, G => 232, B => 41), (R => 190, G => 233, B => 56), (R => 195, G => 236, B => 73), (R => 202, G => 237, B => 89), (R => 208, G => 239, B => 105), (R => 210, G => 240, B => 116), (R => 213, G => 240, B => 124), (R => 216, G => 242, B => 135), (R => 220, G => 244, B => 153), (R => 226, G => 245, B => 165), (R => 229, G => 246, B => 178), (R => 239, G => 250, B => 207), (R => 244, G => 251, B => 222), (R => 249, G => 252, B => 235), (R => 254, G => 255, B => 252)); Data : aliased constant L4_Data_T := ( 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 0, 0, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 15, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 255, 15, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 15, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 0, 0, 0, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 0, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 ); Image : constant Giza.Image.Ref := new Giza.Image.DMA2D.Instance' (Mode => L4, W => 80, H => 80, Length => 3200, L4_CLUT => CLUT'Access, L4_Data => Data'Access); pragma Style_Checks (On); end ok_80x80;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- G N A T . S P E L L I N G _ C H E C K E R -- -- -- -- B o d y -- -- -- -- Copyright (C) 1998-2005 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 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. -- -- -- ------------------------------------------------------------------------------ package body GNAT.Spelling_Checker is ------------------------ -- Is_Bad_Spelling_Of -- ------------------------ function Is_Bad_Spelling_Of (Found : String; Expect : String) return Boolean is FN : constant Natural := Found'Length; FF : constant Natural := Found'First; FL : constant Natural := Found'Last; EN : constant Natural := Expect'Length; EF : constant Natural := Expect'First; EL : constant Natural := Expect'Last; begin -- If both strings null, then we consider this a match, but if one -- is null and the other is not, then we definitely do not match if FN = 0 then return (EN = 0); elsif EN = 0 then return False; -- If first character does not match, then definitely not misspelling elsif Found (FF) /= Expect (EF) then return False; -- Not a bad spelling if both strings are 1-2 characters long elsif FN < 3 and then EN < 3 then return False; -- Lengths match. Execute loop to check for a single error, single -- transposition or exact match (we only fall through this loop if -- one of these three conditions is found). elsif FN = EN then for J in 1 .. FN - 2 loop if Expect (EF + J) /= Found (FF + J) then -- If both mismatched characters are digits, then we do -- not consider it a misspelling (e.g. B345 is not a -- misspelling of B346, it is something quite different) if Expect (EF + J) in '0' .. '9' and then Found (FF + J) in '0' .. '9' then return False; elsif Expect (EF + J + 1) = Found (FF + J + 1) and then Expect (EF + J + 2 .. EL) = Found (FF + J + 2 .. FL) then return True; elsif Expect (EF + J) = Found (FF + J + 1) and then Expect (EF + J + 1) = Found (FF + J) and then Expect (EF + J + 2 .. EL) = Found (FF + J + 2 .. FL) then return True; else return False; end if; end if; end loop; -- At last character. Test digit case as above, otherwise we -- have a match since at most this last character fails to match. if Expect (EL) in '0' .. '9' and then Found (FL) in '0' .. '9' and then Expect (EL) /= Found (FL) then return False; else return True; end if; -- Length is 1 too short. Execute loop to check for single deletion elsif FN = EN - 1 then for J in 1 .. FN - 1 loop if Found (FF + J) /= Expect (EF + J) then return Found (FF + J .. FL) = Expect (EF + J + 1 .. EL); end if; end loop; -- If we fall through then the last character was missing, which -- we consider to be a match (e.g. found xyz, expected xyza). return True; -- Length is 1 too long. Execute loop to check for single insertion elsif FN = EN + 1 then for J in 1 .. EN - 1 loop if Found (FF + J) /= Expect (EF + J) then return Found (FF + J + 1 .. FL) = Expect (EF + J .. EL); end if; end loop; -- If we fall through then the last character was an additional -- character, which is a match (e.g. found xyza, expected xyz). return True; -- Length is completely wrong else return False; end if; end Is_Bad_Spelling_Of; end GNAT.Spelling_Checker;
-- { dg-do run } -- { dg-options "-gnatws" } with System; use System; procedure Trampoline2 is A : Integer; type FuncPtr is access function (I : Integer) return Integer; function F (I : Integer) return Integer is begin return A + I; end F; P : FuncPtr := F'Access; CA : System.Address := F'Code_Address; I : Integer; begin if CA = System.Null_Address then raise Program_Error; end if; I := P(0); end;
-- C87B54A.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 OVERLOADING RESOLUTION USES THE RULE THAT: -- -- THE ARGUMENT OF THE DELAY STATEMENT IS OF THE PREDEFINED FIXED -- POINT TYPE DURATION. -- TRH 7 SEPT 82 WITH REPORT; USE REPORT; PROCEDURE C87B54A IS TYPE TEMPS IS NEW DURATION; TYPE REAL IS NEW FLOAT; TYPE TEMPUS IS DELTA 0.1 RANGE -1.0 .. 1.0; ERR : BOOLEAN := FALSE; FUNCTION F (X : TEMPS) RETURN TEMPS IS BEGIN ERR := TRUE; RETURN X; END F; FUNCTION F (X : REAL) RETURN REAL IS BEGIN ERR := TRUE; RETURN X; END F; FUNCTION F (X : TEMPUS) RETURN TEMPUS IS BEGIN ERR := TRUE; RETURN X; END F; FUNCTION F (X : DURATION) RETURN DURATION IS BEGIN RETURN X; END F; BEGIN TEST ("C87B54A","OVERLOADED EXPRESSION WITHIN DELAY STATEMENT"); DECLARE TASK T IS ENTRY E; END T; TASK BODY T IS BEGIN DELAY F (0.0); DELAY F (1.0); DELAY F (-1.0); END T; BEGIN IF ERR THEN FAILED ("DELAY STATEMENT TAKES AN ARGUMENT OF " & "THE PREDEFINED FIXED POINT TYPE " & "DURATION"); END IF; END; RESULT; END C87B54A;
pragma Ada_2012; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; package sys_utypes_uint8_t_h is -- * Copyright (c) 2012 Apple Inc. All rights reserved. -- * -- * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ -- * -- * This file contains Original Code and/or Modifications of Original Code -- * as defined in and that are subject to the Apple Public Source License -- * Version 2.0 (the 'License'). You may not use this file except in -- * compliance with the License. The rights granted to you under the License -- * may not be used to create, or enable the creation or redistribution of, -- * unlawful or unlicensed copies of an Apple operating system, or to -- * circumvent, violate, or enable the circumvention or violation of, any -- * terms of an Apple operating system software license agreement. -- * -- * Please obtain a copy of the License at -- * http://www.opensource.apple.com/apsl/ and read it before using this file. -- * -- * The Original Code and all software distributed under the License are -- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER -- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, -- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, -- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. -- * Please see the License for the specific language governing rights and -- * limitations under the License. -- * -- * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ -- subtype int8_t is signed_char; -- /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_int8_t.h:30 end sys_utypes_uint8_t_h;
with SPARKNaCl; use SPARKNaCl; with SPARKNaCl.Core; use SPARKNaCl.Core; with SPARKNaCl.Debug; use SPARKNaCl.Debug; with SPARKNaCl.Secretbox; use SPARKNaCl.Secretbox; with SPARKNaCl.Stream; with Ada.Text_IO; use Ada.Text_IO; procedure Secretbox2 is Firstkey : constant Core.Salsa20_Key := Construct ((16#1b#, 16#27#, 16#55#, 16#64#, 16#73#, 16#e9#, 16#85#, 16#d4#, 16#62#, 16#cd#, 16#51#, 16#19#, 16#7a#, 16#9a#, 16#46#, 16#c7#, 16#60#, 16#09#, 16#54#, 16#9e#, 16#ac#, 16#64#, 16#74#, 16#f2#, 16#06#, 16#c4#, 16#ee#, 16#08#, 16#44#, 16#f6#, 16#83#, 16#89#)); Nonce : constant Stream.HSalsa20_Nonce := (16#69#, 16#69#, 16#6e#, 16#e9#, 16#55#, 16#b6#, 16#2b#, 16#73#, 16#cd#, 16#62#, 16#bd#, 16#a8#, 16#75#, 16#fc#, 16#73#, 16#d6#, 16#82#, 16#19#, 16#e0#, 16#03#, 16#6b#, 16#7a#, 16#0b#, 16#37#); C : constant Byte_Seq (0 .. 162) := (16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F3#, 16#FF#, 16#C7#, 16#70#, 16#3F#, 16#94#, 16#00#, 16#E5#, 16#2A#, 16#7D#, 16#FB#, 16#4B#, 16#3D#, 16#33#, 16#05#, 16#D9#, 16#8E#, 16#99#, 16#3B#, 16#9F#, 16#48#, 16#68#, 16#12#, 16#73#, 16#C2#, 16#96#, 16#50#, 16#BA#, 16#32#, 16#FC#, 16#76#, 16#CE#, 16#48#, 16#33#, 16#2E#, 16#A7#, 16#16#, 16#4D#, 16#96#, 16#A4#, 16#47#, 16#6F#, 16#B8#, 16#C5#, 16#31#, 16#A1#, 16#18#, 16#6A#, 16#C0#, 16#DF#, 16#C1#, 16#7C#, 16#98#, 16#DC#, 16#E8#, 16#7B#, 16#4D#, 16#A7#, 16#F0#, 16#11#, 16#EC#, 16#48#, 16#C9#, 16#72#, 16#71#, 16#D2#, 16#C2#, 16#0F#, 16#9B#, 16#92#, 16#8F#, 16#E2#, 16#27#, 16#0D#, 16#6F#, 16#B8#, 16#63#, 16#D5#, 16#17#, 16#38#, 16#B4#, 16#8E#, 16#EE#, 16#E3#, 16#14#, 16#A7#, 16#CC#, 16#8A#, 16#B9#, 16#32#, 16#16#, 16#45#, 16#48#, 16#E5#, 16#26#, 16#AE#, 16#90#, 16#22#, 16#43#, 16#68#, 16#51#, 16#7A#, 16#CF#, 16#EA#, 16#BD#, 16#6B#, 16#B3#, 16#73#, 16#2B#, 16#C0#, 16#E9#, 16#DA#, 16#99#, 16#83#, 16#2B#, 16#61#, 16#CA#, 16#01#, 16#B6#, 16#DE#, 16#56#, 16#24#, 16#4A#, 16#9E#, 16#88#, 16#D5#, 16#F9#, 16#B3#, 16#79#, 16#73#, 16#F6#, 16#22#, 16#A4#, 16#3D#, 16#14#, 16#A6#, 16#59#, 16#9B#, 16#1F#, 16#65#, 16#4C#, 16#B4#, 16#5A#, 16#74#, 16#E3#, 16#55#, 16#A5#); M : Byte_Seq (0 .. 162); S : Boolean; begin Open (M, S, C, Nonce, Firstkey); Put_Line ("Status is " & S'Img); DH ("M is", M); end Secretbox2;
package Global_Singleton is procedure Set_Data (Value : Integer); function Get_Data return Integer; private type Instance_Type is record -- Define instance data elements Data : Integer := 0; end record; Instance : Instance_Type; end Global_Singleton;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of STMicroelectronics nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- -- -- -- This file is based on: -- -- -- -- @file stm32f4xx_hal_rng.h -- -- @author MCD Application Team -- -- @version V1.1.0 -- -- @date 19-June-2014 -- -- @brief Header file of RNG HAL module. -- -- -- -- COPYRIGHT(c) 2014 STMicroelectronics -- ------------------------------------------------------------------------------ -- This file provides the API for the random number generator on the STM32F4 -- (ARM Cortex M4F) microcontrollers from ST Microelectronics. -- -- See the child packages for routines to initialze the generator and acquire -- numbers, using either polling or interrupts. with STM32_SVD.RNG; package STM32.RNG is type RNG_Generator is limited private; procedure Enable (This : in out RNG_Generator) with Post => Enabled (This); procedure Disable (This : in out RNG_Generator) with Post => not Enabled (This); function Enabled (This : RNG_Generator) return Boolean; procedure Enable_Interrupt (This : in out RNG_Generator) with Inline, Post => Interrupt_Enabled (This); procedure Disable_Interrupt (This : in out RNG_Generator) with Inline, Post => not Interrupt_Enabled (This); function Interrupt_Enabled (This : RNG_Generator) return Boolean; function Read_Data (This : RNG_Generator) return UInt32; type Status_Flag is (Data_Ready, Clock_Error, Seed_Error, Clock_Error_Interrupt, Seed_Error_Interrupt); subtype Clearable_Status_Flag is Status_Flag range Clock_Error_Interrupt .. Seed_Error_Interrupt; function Status (This : RNG_Generator; Flag : Status_Flag) return Boolean; procedure Clear_Interrupt_Pending (This : in out RNG_Generator; Flag : Clearable_Status_Flag) with Inline, Post => not Status (This, Flag); private type RNG_Generator is new STM32_SVD.RNG.RNG_Peripheral; end STM32.RNG;
------------------------------------------------------------------------------ -- Copyright (c) 2014, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ package body Natools.Reference_Tests.Pools is use type Ref_Pools.Pool_Size; procedure Check_Counts (Test : in out NT.Test; Pool : in Ref_Pools.Pool; Active, Initialized, Total : in Ref_Pools.Pool_Size); procedure Check_Order (Test : in out NT.Test; Pool : in out Ref_Pools.Pool); ------------------------------ -- Local Helper Subprograms -- ------------------------------ procedure Check_Counts (Test : in out NT.Test; Pool : in Ref_Pools.Pool; Active, Initialized, Total : in Ref_Pools.Pool_Size) is S : Ref_Pools.Pool_Size; begin S := Pool.Active_Size; if S /= Active then Test.Fail ("Pool.Active_Size is" & Ref_Pools.Pool_Size'Image (S) & ", expected " & Ref_Pools.Pool_Size'Image (Active)); end if; S := Pool.Initialized_Size; if S /= Initialized then Test.Fail ("Pool.Initialized_Size is" & Ref_Pools.Pool_Size'Image (S) & ", expected " & Ref_Pools.Pool_Size'Image (Initialized)); end if; S := Pool.Capacity; if S /= Total then Test.Fail ("Pool.Initialized_Size is" & Ref_Pools.Pool_Size'Image (S) & ", expected " & Ref_Pools.Pool_Size'Image (Total)); end if; end Check_Counts; procedure Check_Order (Test : in out NT.Test; Pool : in out Ref_Pools.Pool) is procedure Process (Ref : in Refs.Reference); Rank, Last : Natural := 0; procedure Process (Ref : in Refs.Reference) is begin Rank := Rank + 1; if Ref.Is_Empty then Test.Fail ("Unexpected empty reference at rank" & Natural'Image (Rank)); return; end if; declare Accessor : constant Refs.Accessor := Ref.Query; begin if Accessor.Data.Instance_Number = 0 then Test.Fail ("Unexpected null instance number at rank" & Natural'Image (Rank)); elsif Last = 0 then Last := Accessor.Data.Instance_Number; elsif Accessor.Data.Instance_Number /= Last + 1 then Test.Fail ("At rank" & Natural'Image (Rank) & ", reference to instance" & Natural'Image (Accessor.Data.Instance_Number) & " following reference to instance" & Natural'Image (Last)); Last := 0; else Last := Accessor.Data.Instance_Number; end if; end; end Process; begin Pool.Unchecked_Iterate (Process'Access); end Check_Order; ------------------------ -- Peudo_Process Task -- ------------------------ task body Pseudo_Process is Time : Duration; Ref : Refs.Reference; begin select accept Start (Target : in Refs.Reference; Amount : in Duration) do Time := Amount; Ref := Target; end Start; or terminate; end select; delay Time; Ref.Reset; end Pseudo_Process; procedure Bounded_Start (Process : in out Pseudo_Process; Pool : in out Ref_Pools.Pool; Amount : in Duration; Test : in out NT.Test; Expected_Instance : in Natural) is Ref : Refs.Reference; begin Pool.Get (Factory'Access, Ref); if Ref.Query.Data.Instance_Number /= Expected_Instance then Test.Fail ("Got reference to instance" & Natural'Image (Ref.Query.Data.Instance_Number) & ", expected" & Natural'Image (Expected_Instance)); end if; Process.Start (Ref, Amount); end Bounded_Start; procedure Unbounded_Start (Process : in out Pseudo_Process; Pool : in out Ref_Pools.Pool; Amount : in Duration; Test : in out NT.Test; Expected_Instance : in Natural) is Ref : Refs.Reference; begin Pool.Create (Factory'Access, Ref); if Ref.Query.Data.Instance_Number /= Expected_Instance then Test.Fail ("Got reference to instance" & Natural'Image (Ref.Query.Data.Instance_Number) & ", expected" & Natural'Image (Expected_Instance)); end if; Process.Start (Ref, Amount); end Unbounded_Start; ------------------------- -- Complete Test Suite -- ------------------------- procedure All_Tests (Report : in out NT.Reporter'Class) is begin Bounded_Pool (Report); Static_Pool (Report); Unbounded_Pool (Report); end All_Tests; ----------------------- -- Inidividual Tests -- ----------------------- procedure Bounded_Pool (Report : in out NT.Reporter'Class) is Test : NT.Test := Report.Item ("Bounded pool typical usage"); begin declare Test_Length : constant Duration := 0.5; Ref_Pool : Ref_Pools.Pool; Workers : array (1 .. 4) of Pseudo_Process; begin -- Timeline (in Test_Length/10): <--------> -- Task using reference 1: 1111111111 -- Task using reference 2: 2222 44 -- Task using reference 3: 3333 Check_Counts (Test, Ref_Pool, 0, 0, 0); Ref_Pool.Preallocate (3); Check_Counts (Test, Ref_Pool, 0, 0, 3); Bounded_Start (Workers (1), Ref_Pool, Test_Length, Test, 1); Check_Counts (Test, Ref_Pool, 1, 1, 3); delay Test_Length * 0.2; Bounded_Start (Workers (2), Ref_Pool, Test_Length * 0.4, Test, 2); Check_Counts (Test, Ref_Pool, 2, 2, 3); delay Test_Length * 0.2; Bounded_Start (Workers (3), Ref_Pool, Test_Length * 0.4, Test, 3); Check_Counts (Test, Ref_Pool, 3, 3, 3); delay Test_Length * 0.1; begin Bounded_Start (Workers (4), Ref_Pool, Test_Length * 0.2, Test, 0); Test.Fail ("Expected exception after filling bounded pool"); exception when Constraint_Error => null; when Error : others => Test.Info ("At Get on full bounded pool,"); Test.Report_Exception (Error, NT.Fail); end; delay Test_Length * 0.2; Check_Counts (Test, Ref_Pool, 2, 3, 3); Bounded_Start (Workers (4), Ref_Pool, Test_Length * 0.2, Test, 2); Check_Counts (Test, Ref_Pool, 3, 3, 3); Check_Order (Test, Ref_Pool); end; exception when Error : others => Test.Report_Exception (Error); end Bounded_Pool; procedure Static_Pool (Report : in out NT.Reporter'Class) is Test : NT.Test := Report.Item ("Static pool typical usage"); begin declare Size : constant Ref_Pools.Pool_Size := 10; Ref_Pool : Ref_Pools.Pool; Ref : array (Ref_Pools.Pool_Size range 1 .. Size) of Refs.Reference; begin Check_Counts (Test, Ref_Pool, 0, 0, 0); Ref_Pool.Preallocate (Size, Factory'Access); Check_Counts (Test, Ref_Pool, 0, Size, Size); for I in Ref'Range loop Ref_Pool.Get (Ref (I)); Check_Counts (Test, Ref_Pool, I, Size, Size); end loop; Ref (2).Reset; Check_Counts (Test, Ref_Pool, Size - 1, Size, Size); Ref_Pool.Get (Ref (2)); Check_Counts (Test, Ref_Pool, Size, Size, Size); declare Extra_Ref : Refs.Reference; begin Ref_Pool.Get (Extra_Ref); Test.Fail ("Expected exception at Get on full pool"); exception when Constraint_Error => null; when Error : others => Test.Info ("At Get on full pool,"); Test.Report_Exception (Error, NT.Fail); end; Check_Order (Test, Ref_Pool); end; exception when Error : others => Test.Report_Exception (Error); end Static_Pool; procedure Unbounded_Pool (Report : in out NT.Reporter'Class) is Test : NT.Test := Report.Item ("Unbounded pool typical usage"); begin declare Test_Length : constant Duration := 0.5; Ref_Pool : Ref_Pools.Pool; Workers : array (1 .. 5) of Pseudo_Process; begin Check_Counts (Test, Ref_Pool, 0, 0, 0); Ref_Pool.Preallocate (1); Check_Counts (Test, Ref_Pool, 0, 0, 1); -- Timeline (in Test_Length/10): <--------> -- Task using reference 1: 11111 444 -- Task using reference 2: 22222 55 -- Task using reference 3: 33333 Unbounded_Start (Workers (1), Ref_Pool, Test_Length * 0.5, Test, 1); Check_Counts (Test, Ref_Pool, 1, 1, 1); delay Test_Length * 0.2; Unbounded_Start (Workers (2), Ref_Pool, Test_Length * 0.5, Test, 2); Check_Counts (Test, Ref_Pool, 2, 2, 2); delay Test_Length * 0.2; Unbounded_Start (Workers (3), Ref_Pool, Test_Length * 0.5, Test, 3); Check_Counts (Test, Ref_Pool, 3, 3, 3); delay Test_Length * 0.2; Check_Counts (Test, Ref_Pool, 2, 3, 3); Unbounded_Start (Workers (4), Ref_Pool, Test_Length * 0.3, Test, 1); Check_Counts (Test, Ref_Pool, 3, 3, 3); delay Test_Length * 0.1; Check_Counts (Test, Ref_Pool, 2, 3, 3); Ref_Pool.Purge; Check_Counts (Test, Ref_Pool, 2, 2, 2); Unbounded_Start (Workers (5), Ref_Pool, Test_Length * 0.2, Test, 3); end; exception when Error : others => Test.Report_Exception (Error); end Unbounded_Pool; end Natools.Reference_Tests.Pools;
------------------------------------------------------------------------------ -- Copyright (c) 2014-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.Constant_Indefinite_Ordered_Maps is -------------------------- -- Sorted Array Backend -- -------------------------- function Create (Size : Index_Type; Key_Factory : not null access function (Index : Index_Type) return Key_Type; Element_Factory : not null access function (Index : Index_Type) return Element_Type) return Backend_Array is function Node_Factory (Index : Index_Type) return Node with Inline; function Node_Factory (Index : Index_Type) return Node is begin return (Key => new Key_Type'(Key_Factory (Index)), Element => new Element_Type'(Element_Factory (Index))); end Node_Factory; First_Node : constant Node := Node_Factory (1); begin return Result : Backend_Array := (Ada.Finalization.Limited_Controlled with Size => Size, Nodes => (others => First_Node), Finalized => False) do if Size >= 2 then for I in 2 .. Size loop Result.Nodes (I) := Node_Factory (I); end loop; end if; end return; end Create; function Make_Backend (Size : Count_Type; Key_Factory : not null access function (Index : Index_Type) return Key_Type; Element_Factory : not null access function (Index : Index_Type) return Element_Type) return Backend_Refs.Immutable_Reference is function Create return Backend_Array; function Create return Backend_Array is begin return Create (Size, Key_Factory, Element_Factory); end Create; begin if Size = 0 then return Backend_Refs.Null_Immutable_Reference; else return Backend_Refs.Create (Create'Access); end if; end Make_Backend; function Make_Backend (Map : Unsafe_Maps.Map) return Backend_Refs.Immutable_Reference is function Create return Backend_Array; function Element (Index : Index_Type) return Element_Type; function Key (Index : Index_Type) return Key_Type; procedure Update_Cursor (Index : in Index_Type); function Is_Valid (Nodes : Node_Array) return Boolean; Length : constant Count_Type := Map.Length; Cursor : Unsafe_Maps.Cursor := Map.First; I : Index_Type := 1; function Create return Backend_Array is begin return Create (Length, Key'Access, Element'Access); end Create; function Element (Index : Index_Type) return Element_Type is begin Update_Cursor (Index); return Unsafe_Maps.Element (Cursor); end Element; function Is_Valid (Nodes : Node_Array) return Boolean is begin return (for all J in Nodes'First + 1 .. Nodes'Last => Nodes (J - 1).Key.all < Nodes (J).Key.all); end Is_Valid; function Key (Index : Index_Type) return Key_Type is begin Update_Cursor (Index); pragma Assert (Unsafe_Maps.Has_Element (Cursor)); return Unsafe_Maps.Key (Cursor); end Key; procedure Update_Cursor (Index : in Index_Type) is begin if Index = I + 1 then Unsafe_Maps.Next (Cursor); I := I + 1; elsif Index /= I then raise Program_Error with "Unexpected index value" & Index_Type'Image (Index) & " (previous value" & Index_Type'Image (I) & ')'; end if; end Update_Cursor; Result : Backend_Refs.Immutable_Reference; begin if Length = 0 then return Backend_Refs.Null_Immutable_Reference; end if; Result := Backend_Refs.Create (Create'Access); pragma Assert (I = Length); pragma Assert (Unsafe_Maps."=" (Cursor, Map.Last)); pragma Assert (Is_Valid (Result.Query.Data.Nodes)); return Result; end Make_Backend; overriding procedure Finalize (Object : in out Backend_Array) is Key : Key_Access; Element : Element_Access; begin if not Object.Finalized then for I in Object.Nodes'Range loop Key := Object.Nodes (I).Key; Element := Object.Nodes (I).Element; Free (Key); Free (Element); end loop; Object.Finalized := True; end if; end Finalize; procedure Search (Nodes : in Node_Array; Key : in Key_Type; Floor : out Count_Type; Ceiling : out Count_Type) is Middle : Index_Type; begin Floor := 0; Ceiling := 0; if Nodes'Length = 0 then return; end if; Floor := Nodes'First; if Key < Nodes (Floor).Key.all then Ceiling := Floor; Floor := 0; return; elsif not (Nodes (Floor).Key.all < Key) then Ceiling := Floor; return; end if; Ceiling := Nodes'Last; if Nodes (Ceiling).Key.all < Key then Floor := Ceiling; Ceiling := 0; return; elsif not (Key < Nodes (Ceiling).Key.all) then Floor := Ceiling; return; end if; while Ceiling - Floor >= 2 loop Middle := Floor + (Ceiling - Floor) / 2; if Nodes (Middle).Key.all < Key then Floor := Middle; elsif Key < Nodes (Middle).Key.all then Ceiling := Middle; else Floor := Middle; Ceiling := Middle; return; end if; end loop; return; end Search; ----------------------- -- Cursor Operations -- ----------------------- function "<" (Left, Right : Cursor) return Boolean is begin return Key (Left) < Key (Right); end "<"; function ">" (Left, Right : Cursor) return Boolean is begin return Key (Right) < Key (Left); end ">"; function "<" (Left : Cursor; Right : Key_Type) return Boolean is begin return Key (Left) < Right; end "<"; function ">" (Left : Cursor; Right : Key_Type) return Boolean is begin return Right < Key (Left); end ">"; function "<" (Left : Key_Type; Right : Cursor) return Boolean is begin return Left < Key (Right); end "<"; function ">" (Left : Key_Type; Right : Cursor) return Boolean is begin return Key (Right) < Left; end ">"; procedure Clear (Position : in out Cursor) is begin Position := No_Element; end Clear; function Element (Position : Cursor) return Element_Type is begin return Position.Backend.Query.Data.Nodes (Position.Index).Element.all; end Element; function Key (Position : Cursor) return Key_Type is begin return Position.Backend.Query.Data.Nodes (Position.Index).Key.all; end Key; function Next (Position : Cursor) return Cursor is begin if Position.Is_Empty or else Position.Index >= Position.Backend.Query.Data.Size then return No_Element; else return (Is_Empty => False, Backend => Position.Backend, Index => Position.Index + 1); end if; end Next; procedure Next (Position : in out Cursor) is begin if Position.Is_Empty then null; elsif Position.Index >= Position.Backend.Query.Data.Size then Position := No_Element; else Position.Index := Position.Index + 1; end if; end Next; function Previous (Position : Cursor) return Cursor is begin if Position.Is_Empty or else Position.Index = 1 then return No_Element; else return (Is_Empty => False, Backend => Position.Backend, Index => Position.Index - 1); end if; end Previous; procedure Previous (Position : in out Cursor) is begin if Position.Is_Empty then null; elsif Position.Index = 1 then Position := No_Element; else Position.Index := Position.Index - 1; end if; end Previous; procedure Query_Element (Position : in Cursor; Process : not null access procedure (Key : in Key_Type; Element : in Element_Type)) is Accessor : constant Backend_Refs.Accessor := Position.Backend.Query; begin Process.all (Accessor.Data.Nodes (Position.Index).Key.all, Accessor.Data.Nodes (Position.Index).Element.all); end Query_Element; function Rank (Position : Cursor) return Ada.Containers.Count_Type is begin case Position.Is_Empty is when True => return 0; when False => return Position.Index; end case; end Rank; ----------------------------- -- Non-Standard Operations -- ----------------------------- function Create (Source : Unsafe_Maps.Map) return Constant_Map is begin return (Backend => Make_Backend (Source)); end Create; procedure Replace (Container : in out Constant_Map; New_Items : in Unsafe_Maps.Map) is begin Container.Backend := Make_Backend (New_Items); end Replace; function To_Unsafe_Map (Container : Constant_Map) return Unsafe_Maps.Map is Result : Unsafe_Maps.Map; begin if Container.Backend.Is_Empty then return Result; end if; declare Accessor : constant Backend_Refs.Accessor := Container.Backend.Query; begin for I in Accessor.Data.Nodes'Range loop Result.Insert (Accessor.Data.Nodes (I).Key.all, Accessor.Data.Nodes (I).Element.all); end loop; end; return Result; end To_Unsafe_Map; ----------------------------- -- Constant Map Operations -- ----------------------------- function "=" (Left, Right : Constant_Map) return Boolean is use type Backend_Refs.Immutable_Reference; begin return Left.Backend = Right.Backend; end "="; function Ceiling (Container : Constant_Map; Key : Key_Type) return Cursor is Floor, Ceiling : Count_Type; begin if Container.Is_Empty then return No_Element; end if; Search (Container.Backend.Query.Data.Nodes, Key, Floor, Ceiling); if Ceiling > 0 then return (Is_Empty => False, Backend => Container.Backend, Index => Ceiling); else return No_Element; end if; end Ceiling; procedure Clear (Container : in out Constant_Map) is begin Container.Backend.Reset; end Clear; function Constant_Reference (Container : aliased in Constant_Map; Position : in Cursor) return Constant_Reference_Type is use type Backend_Refs.Immutable_Reference; begin if Position.Is_Empty then raise Constraint_Error with "Constant_Reference called with empty Position"; end if; if Container.Backend /= Position.Backend then raise Program_Error with "Constant_Reference called" & " with unrelated Container and Position"; end if; return (Backend => Container.Backend, Element => Container.Backend.Query.Data.all.Nodes (Position.Index).Element); end Constant_Reference; function Constant_Reference (Container : aliased in Constant_Map; Key : in Key_Type) return Constant_Reference_Type is Position : constant Cursor := Container.Find (Key); begin if Position.Is_Empty then raise Constraint_Error with "Constant_Reference called with Key not in map"; end if; return (Backend => Container.Backend, Element => Container.Backend.Query.Data.Nodes (Position.Index).Element); end Constant_Reference; function Contains (Container : Constant_Map; Key : Key_Type) return Boolean is Floor, Ceiling : Count_Type; begin if Container.Is_Empty then return False; end if; Search (Container.Backend.Query.Data.Nodes, Key, Floor, Ceiling); return Floor = Ceiling; end Contains; function Element (Container : Constant_Map; Key : Key_Type) return Element_Type is begin return Element (Find (Container, Key)); end Element; function Find (Container : Constant_Map; Key : Key_Type) return Cursor is Floor, Ceiling : Count_Type; begin if Container.Is_Empty then return No_Element; end if; Search (Container.Backend.Query.Data.Nodes, Key, Floor, Ceiling); if Floor = Ceiling then return (Is_Empty => False, Backend => Container.Backend, Index => Floor); else return No_Element; end if; end Find; function First (Container : Constant_Map) return Cursor is begin if Container.Is_Empty then return No_Element; else return (Is_Empty => False, Backend => Container.Backend, Index => 1); end if; end First; function First_Element (Container : Constant_Map) return Element_Type is Accessor : constant Backend_Refs.Accessor := Container.Backend.Query; begin return Accessor.Data.Nodes (1).Element.all; end First_Element; function First_Key (Container : Constant_Map) return Key_Type is Accessor : constant Backend_Refs.Accessor := Container.Backend.Query; begin return Accessor.Data.Nodes (1).Key.all; end First_Key; function Floor (Container : Constant_Map; Key : Key_Type) return Cursor is Floor, Ceiling : Count_Type; begin if Container.Is_Empty then return No_Element; end if; Search (Container.Backend.Query.Data.Nodes, Key, Floor, Ceiling); if Floor > 0 then return (Is_Empty => False, Backend => Container.Backend, Index => Floor); else return No_Element; end if; end Floor; procedure Iterate (Container : in Constant_Map; Process : not null access procedure (Position : in Cursor)) is Position : Cursor := (Is_Empty => False, Backend => Container.Backend, Index => 1); begin if Container.Backend.Is_Empty then return; end if; for I in Container.Backend.Query.Data.Nodes'Range loop Position.Index := I; Process.all (Position); end loop; end Iterate; function Iterate (Container : in Constant_Map) return Map_Iterator_Interfaces.Reversible_Iterator'Class is begin return Iterator'(Backend => Container.Backend, Start => No_Element); end Iterate; function Iterate (Container : in Constant_Map; Start : in Cursor) return Map_Iterator_Interfaces.Reversible_Iterator'Class is begin return Iterator'(Backend => Container.Backend, Start => Start); end Iterate; function Iterate (Container : in Constant_Map; First, Last : in Cursor) return Map_Iterator_Interfaces.Reversible_Iterator'Class is begin if Is_Empty (Container) or else not Has_Element (First) or else not Has_Element (Last) or else First > Last then return Iterator'(Backend => Backend_Refs.Null_Immutable_Reference, Start => No_Element); else return Range_Iterator'(Backend => Container.Backend, First_Position => First, Last_Position => Last); end if; end Iterate; function Last (Container : Constant_Map) return Cursor is begin if Container.Is_Empty then return No_Element; else return (Is_Empty => False, Backend => Container.Backend, Index => Container.Backend.Query.Data.Size); end if; end Last; function Last_Element (Container : Constant_Map) return Element_Type is Accessor : constant Backend_Refs.Accessor := Container.Backend.Query; begin return Accessor.Data.Nodes (Accessor.Data.Size).Element.all; end Last_Element; function Last_Key (Container : Constant_Map) return Key_Type is Accessor : constant Backend_Refs.Accessor := Container.Backend.Query; begin return Accessor.Data.Nodes (Accessor.Data.Size).Key.all; end Last_Key; function Length (Container : Constant_Map) return Ada.Containers.Count_Type is begin if Container.Backend.Is_Empty then return 0; else return Container.Backend.Query.Data.Size; end if; end Length; procedure Move (Target, Source : in out Constant_Map) is begin Target.Backend := Source.Backend; Source.Backend.Reset; end Move; procedure Reverse_Iterate (Container : in Constant_Map; Process : not null access procedure (Position : in Cursor)) is Position : Cursor := (Is_Empty => False, Backend => Container.Backend, Index => 1); begin if Container.Backend.Is_Empty then return; end if; for I in reverse Container.Backend.Query.Data.Nodes'Range loop Position.Index := I; Process.all (Position); end loop; end Reverse_Iterate; ---------------------------------------- -- Constant Map "Update" Constructors -- ---------------------------------------- function Insert (Source : in Constant_Map; Key : in Key_Type; New_Item : in Element_Type; Position : out Cursor; Inserted : out Boolean) return Constant_Map is Floor, Ceiling : Count_Type; begin if Source.Is_Empty then declare Backend : constant Backend_Refs.Data_Access := new Backend_Array' (Ada.Finalization.Limited_Controlled with Size => 1, Nodes => (1 => (Key => new Key_Type'(Key), Element => new Element_Type'(New_Item))), Finalized => False); Result : constant Constant_Map := (Backend => Backend_Refs.Create (Backend)); begin Position := (Is_Empty => False, Backend => Result.Backend, Index => 1); Inserted := True; return Result; end; end if; Search (Source.Backend.Query.Data.Nodes, Key, Floor, Ceiling); if Floor = Ceiling then Position := (Is_Empty => False, Backend => Source.Backend, Index => Floor); Inserted := False; return Source; end if; declare function Key_Factory (Index : Index_Type) return Key_Type; function Element_Factory (Index : Index_Type) return Element_Type; Accessor : constant Backend_Refs.Accessor := Source.Backend.Query; function Key_Factory (Index : Index_Type) return Key_Type is begin if Index <= Floor then return Accessor.Nodes (Index).Key.all; elsif Index = Floor + 1 then return Key; else return Accessor.Nodes (Index - 1).Key.all; end if; end Key_Factory; function Element_Factory (Index : Index_Type) return Element_Type is begin if Index <= Floor then return Accessor.Nodes (Index).Element.all; elsif Index = Floor + 1 then return New_Item; else return Accessor.Nodes (Index - 1).Element.all; end if; end Element_Factory; Result : constant Constant_Map := (Backend => Make_Backend (Accessor.Size + 1, Key_Factory'Access, Element_Factory'Access)); begin Position := (Is_Empty => False, Backend => Result.Backend, Index => Floor + 1); Inserted := True; return Result; end; end Insert; function Insert (Source : in Constant_Map; Key : in Key_Type; New_Item : in Element_Type) return Constant_Map is Position : Cursor; Inserted : Boolean; Result : constant Constant_Map := Insert (Source, Key, New_Item, Position, Inserted); begin if not Inserted then raise Constraint_Error with "Inserted key already in Constant_Map"; end if; return Result; end Insert; function Include (Source : in Constant_Map; Key : in Key_Type; New_Item : in Element_Type) return Constant_Map is Position : Cursor; Inserted : Boolean; Result : constant Constant_Map := Insert (Source, Key, New_Item, Position, Inserted); begin if Inserted then return Result; end if; declare function Key_Factory (Index : Index_Type) return Key_Type; function Element_Factory (Index : Index_Type) return Element_Type; Accessor : constant Backend_Refs.Accessor := Source.Backend.Query; function Key_Factory (Index : Index_Type) return Key_Type is begin if Index = Position.Index then return Key; else return Accessor.Nodes (Index).Key.all; end if; end Key_Factory; function Element_Factory (Index : Index_Type) return Element_Type is begin if Index = Position.Index then return New_Item; else return Accessor.Nodes (Index).Element.all; end if; end Element_Factory; Result : constant Constant_Map := (Backend => Make_Backend (Accessor.Size, Key_Factory'Access, Element_Factory'Access)); begin return Result; end; end Include; function Replace (Source : in Constant_Map; Key : in Key_Type; New_Item : in Element_Type) return Constant_Map is Floor, Ceiling : Count_Type; begin if Source.Is_Empty then raise Constraint_Error with "Replace called on empty Constant_Map"; end if; Search (Source.Backend.Query.Data.Nodes, Key, Floor, Ceiling); if Floor /= Ceiling then raise Constraint_Error with "Replace called with key not in Constant_Map"; end if; return Replace_Element (Source => Source, Position => (Is_Empty => False, Backend => Source.Backend, Index => Floor), New_Item => New_Item); end Replace; function Replace_Element (Source : in Constant_Map; Position : in Cursor; New_Item : in Element_Type) return Constant_Map is use type Backend_Refs.Immutable_Reference; begin if Position.Is_Empty then raise Constraint_Error with "Constant_Map.Replace_Element called with empty cursor"; end if; if Source.Backend /= Position.Backend then raise Program_Error with "Constant_Map.Replace_Element " & "with unrelated container and cursor"; end if; declare function Key_Factory (Index : Index_Type) return Key_Type; function Element_Factory (Index : Index_Type) return Element_Type; Accessor : constant Backend_Refs.Accessor := Source.Backend.Query; function Key_Factory (Index : Index_Type) return Key_Type is begin return Accessor.Nodes (Index).Key.all; end Key_Factory; function Element_Factory (Index : Index_Type) return Element_Type is begin if Index = Position.Index then return New_Item; else return Accessor.Nodes (Index).Element.all; end if; end Element_Factory; Result : constant Constant_Map := (Backend => Make_Backend (Accessor.Size, Key_Factory'Access, Element_Factory'Access)); begin return Result; end; end Replace_Element; function Replace_Element (Source : in Constant_Map; Position : in Cursor; New_Item : in Element_Type; New_Position : out Cursor) return Constant_Map is Result : constant Constant_Map := Replace_Element (Source, Position, New_Item); begin New_Position := (Is_Empty => False, Backend => Result.Backend, Index => Position.Index); return Result; end Replace_Element; function Exclude (Source : in Constant_Map; Key : in Key_Type) return Constant_Map is Floor, Ceiling : Count_Type; begin if Source.Is_Empty then return Source; end if; Search (Source.Backend.Query.Data.Nodes, Key, Floor, Ceiling); if Floor = Ceiling then return Delete (Source, Cursor'(Is_Empty => False, Backend => Source.Backend, Index => Floor)); else return Source; end if; end Exclude; function Delete (Source : in Constant_Map; Key : in Key_Type) return Constant_Map is Floor, Ceiling : Count_Type; begin if Source.Is_Empty then raise Constraint_Error with "Delete called on empty Constant_Map"; end if; Search (Source.Backend.Query.Data.Nodes, Key, Floor, Ceiling); if Floor /= Ceiling then raise Constraint_Error with "Deleted key not in Constant_Map"; end if; return Delete (Source, (Is_Empty => False, Backend => Source.Backend, Index => Floor)); end Delete; function Delete (Source : in Constant_Map; Position : in Cursor) return Constant_Map is use type Backend_Refs.Immutable_Reference; begin if Position.Is_Empty then raise Constraint_Error with "Constant_Map.Delete with empty cursor"; end if; if Source.Backend /= Position.Backend then raise Program_Error with "Constant_Map.Delete with unrelated container and cursor"; end if; declare function Key_Factory (Index : Index_Type) return Key_Type; function Element_Factory (Index : Index_Type) return Element_Type; Accessor : constant Backend_Refs.Accessor := Source.Backend.Query; function Key_Factory (Index : Index_Type) return Key_Type is begin if Index < Position.Index then return Accessor.Nodes (Index).Key.all; else return Accessor.Nodes (Index + 1).Key.all; end if; end Key_Factory; function Element_Factory (Index : Index_Type) return Element_Type is begin if Index < Position.Index then return Accessor.Nodes (Index).Element.all; else return Accessor.Nodes (Index + 1).Element.all; end if; end Element_Factory; Result : constant Constant_Map := (Backend => Make_Backend (Accessor.Size - 1, Key_Factory'Access, Element_Factory'Access)); begin return Result; end; end Delete; ------------------------------ -- Updatable Map Operations -- ------------------------------ function Constant_Reference_For_Bugged_GNAT (Container : aliased in Updatable_Map; Position : in Cursor) return Constant_Reference_Type is begin return Constant_Reference (Constant_Map (Container), Position); end Constant_Reference_For_Bugged_GNAT; function Constant_Reference_For_Bugged_GNAT (Container : aliased in Updatable_Map; Key : in Key_Type) return Constant_Reference_Type is begin return Constant_Reference (Constant_Map (Container), Key); end Constant_Reference_For_Bugged_GNAT; function Reference (Container : aliased in out Updatable_Map; Position : in Cursor) return Reference_Type is use type Backend_Refs.Immutable_Reference; begin if Position.Is_Empty then raise Constraint_Error with "Reference called with empty Position"; end if; if Container.Backend /= Position.Backend then raise Program_Error with "Reference called with unrelated Container and Position"; end if; return (Backend => Container.Backend, Element => Container.Backend.Query.Data.Nodes (Position.Index).Element); end Reference; function Reference (Container : aliased in out Updatable_Map; Key : in Key_Type) return Reference_Type is Position : constant Cursor := Container.Find (Key); begin if Position.Is_Empty then raise Constraint_Error with "Reference called with Key not in map"; end if; return (Backend => Container.Backend, Element => Container.Backend.Query.Data.Nodes (Position.Index).Element); end Reference; procedure Update_Element (Container : in out Updatable_Map; Position : in Cursor; Process : not null access procedure (Key : in Key_Type; Element : in out Element_Type)) is pragma Unreferenced (Container); Accessor : constant Backend_Refs.Accessor := Position.Backend.Query; begin Process.all (Accessor.Data.Nodes (Position.Index).Key.all, Accessor.Data.Nodes (Position.Index).Element.all); end Update_Element; ------------------------- -- Iterator Operations -- ------------------------- overriding function First (Object : Iterator) return Cursor is begin if Has_Element (Object.Start) then return Object.Start; elsif Object.Backend.Is_Empty then return No_Element; else return (Is_Empty => False, Backend => Object.Backend, Index => 1); end if; end First; overriding function Last (Object : Iterator) return Cursor is begin if Has_Element (Object.Start) then return Object.Start; elsif Object.Backend.Is_Empty then return No_Element; else return (Is_Empty => False, Backend => Object.Backend, Index => Object.Backend.Query.Data.Size); end if; end Last; overriding function First (Object : Range_Iterator) return Cursor is begin return Object.First_Position; end First; overriding function Last (Object : Range_Iterator) return Cursor is begin return Object.Last_Position; end Last; overriding function Next (Object : Range_Iterator; Position : Cursor) return Cursor is begin if Has_Element (Position) and then Position < Object.Last_Position then return Next (Position); else return No_Element; end if; end Next; overriding function Previous (Object : Range_Iterator; Position : Cursor) return Cursor is begin if Has_Element (Position) and then Position > Object.First_Position then return Previous (Position); else return No_Element; end if; end Previous; end Natools.Constant_Indefinite_Ordered_Maps;
-------------------------------------------------------------------------------- -- MIT License -- -- Copyright (c) 2021 Zane Myers -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in all -- copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -- SOFTWARE. -------------------------------------------------------------------------------- with Ada.Text_IO; with Ada.Characters.Latin_1; with Vulkan.Math.GenFMatrix; with Vulkan.Math.Mat2x2; with Vulkan.Math.Mat2x4; with Vulkan.Math.GenFType; with Vulkan.Math.Vec2; with Vulkan.Math.Vec4; with Vulkan.Math.Operators; with Vulkan.Test.Framework; use Ada.Text_IO; use Ada.Characters.Latin_1; use Vulkan.Math.Mat2x2; use Vulkan.Math.Mat2x4; use Vulkan.Math.GenFType; use Vulkan.Math.Vec2; use Vulkan.Math.Vec4; use Vulkan.Test.Framework; -------------------------------------------------------------------------------- --< @group Vulkan Math Basic Types -------------------------------------------------------------------------------- --< @summary --< This package provides tests for single precision floating point mat2x4. -------------------------------------------------------------------------------- package body Vulkan.Math.Mat2x4.Test is -- Test Mat2x4 procedure Test_Mat2x4 is vec1 : Vkm_Vec2 := Make_Vec2(1.0, 2.0); vec2 : Vkm_Vec4 := Make_Vec4(1.0, 2.0, 3.0, 4.0); mat1 : Vkm_Mat2x4 := Make_Mat2x4; mat2 : Vkm_Mat2x4 := Make_Mat2x4(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0); mat3 : Vkm_Mat2x4 := Make_Mat2x4(vec2, - vec2); mat4 : Vkm_Mat2x4 := Make_Mat2x4(mat2); mat5 : Vkm_Mat2x2 := Make_Mat2x2(5.0); mat6 : Vkm_Mat2x4 := Make_Mat2x4(mat5); begin Put_Line(LF & "Testing Mat2x4 Constructors..."); Put_Line("mat1 " & mat1.Image); Assert_Mat2x4_Equals(mat1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); Put_Line("mat2 " & mat2.Image); Assert_Mat2x4_Equals(mat2, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0); Put_Line("mat3 " & mat3.Image); Assert_Mat2x4_Equals(mat3, 1.0, 2.0, 3.0, 4.0, -1.0, -2.0, -3.0, -4.0); Put_Line("mat4 " & mat4.Image); Assert_Mat2x4_Equals(mat4, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0); Put_Line("mat6 " & mat6.Image); Assert_Mat2x4_Equals(mat6, 5.0, 0.0, 0.0, 0.0, 0.0, 5.0, 0.0, 0.0); Put_Line("Testing '=' operator..."); Put_Line(" mat2 != mat3"); Assert_Vkm_Bool_Equals(mat2 = mat3, False); Put_Line(" mat4 != mat5"); Assert_Vkm_Bool_Equals(mat4 = mat5, False); Put_Line(" mat4 = mat2"); Assert_Vkm_Bool_Equals(mat4 = mat2, True); Put_Line(" Testing unary '+/-' operator"); Put_Line(" + mat4 = " & Image(+ mat4)); Assert_Mat2x4_Equals(+mat4, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0); Put_Line(" - mat4 = " & Image(- mat4)); Assert_Mat2x4_Equals(-mat4, -0.0, -1.0, -2.0, -3.0, -4.0, -5.0, -6.0, -7.0); Put_Line("+(- mat4) = " & Image(+(- mat4))); Assert_Mat2x4_Equals(-mat4, -0.0, -1.0, -2.0, -3.0, -4.0, -5.0, -6.0, -7.0); Put_Line("Testing 'abs' operator..."); Put_Line(" abs(- mat4) = " & Image(abs(-mat4))); Assert_Mat2x4_Equals(abs(-mat4), 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0); Put_Line("Testing '+' operator..."); Put_Line(" mat4 + mat3 = " & Image(mat4 + mat3)); Assert_Mat2x4_Equals(mat4 + mat3, 1.0, 3.0, 5.0, 7.0, 3.0, 3.0, 3.0, 3.0); Put_Line("Testing '-' operator..."); Put_Line(" mat4 - mat3 = " & Image(mat4 -mat3)); Assert_Mat2x4_Equals(mat4 - mat3, -1.0, -1.0, -1.0, -1.0, 5.0, 7.0, 9.0, 11.0); Put_Line("Testing '*' operator..."); Put_Line(" mat5 * mat4 = " & Image(mat5 * mat4)); Assert_Mat2x4_Equals(mat5 * mat4, 0.0 , 5.0 , 10.0, 15.0, 20.0, 25.0, 30.0, 35.0); Put_Line(" mat4 * vec2 = " & Image(mat4 * vec2)); Assert_Vec2_Equals(mat4 * vec2, 20.0, 60.0); Put_Line(" vec1 * mat4 = " & Image(vec1 * mat4)); Assert_Vec4_Equals(vec1 * mat4, 8.0, 11.0, 14.0, 17.0); end Test_Mat2x4; end Vulkan.Math.Mat2x4.Test;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . S T R I N G S . M A P S . C O N S T A N T S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2009, 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. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Characters.Latin_1; package Ada.Strings.Maps.Constants is pragma Preelaborate; pragma Pure_05; -- In accordance with Ada 2005 AI-362 Control_Set : constant Character_Set; Graphic_Set : constant Character_Set; Letter_Set : constant Character_Set; Lower_Set : constant Character_Set; Upper_Set : constant Character_Set; Basic_Set : constant Character_Set; Decimal_Digit_Set : constant Character_Set; Hexadecimal_Digit_Set : constant Character_Set; Alphanumeric_Set : constant Character_Set; Special_Set : constant Character_Set; ISO_646_Set : constant Character_Set; Lower_Case_Map : constant Character_Mapping; -- Maps to lower case for letters, else identity Upper_Case_Map : constant Character_Mapping; -- Maps to upper case for letters, else identity Basic_Map : constant Character_Mapping; -- Maps to basic letters for letters, else identity private package L renames Ada.Characters.Latin_1; Control_Set : constant Character_Set := (L.NUL .. L.US => True, L.DEL .. L.APC => True, others => False); Graphic_Set : constant Character_Set := (L.Space .. L.Tilde => True, L.No_Break_Space .. L.LC_Y_Diaeresis => True, others => False); Letter_Set : constant Character_Set := ('A' .. 'Z' => True, L.LC_A .. L.LC_Z => True, L.UC_A_Grave .. L.UC_O_Diaeresis => True, L.UC_O_Oblique_Stroke .. L.LC_O_Diaeresis => True, L.LC_O_Oblique_Stroke .. L.LC_Y_Diaeresis => True, others => False); Lower_Set : constant Character_Set := (L.LC_A .. L.LC_Z => True, L.LC_German_Sharp_S .. L.LC_O_Diaeresis => True, L.LC_O_Oblique_Stroke .. L.LC_Y_Diaeresis => True, others => False); Upper_Set : constant Character_Set := ('A' .. 'Z' => True, L.UC_A_Grave .. L.UC_O_Diaeresis => True, L.UC_O_Oblique_Stroke .. L.UC_Icelandic_Thorn => True, others => False); Basic_Set : constant Character_Set := ('A' .. 'Z' => True, L.LC_A .. L.LC_Z => True, L.UC_AE_Diphthong .. L.UC_AE_Diphthong => True, L.LC_AE_Diphthong .. L.LC_AE_Diphthong => True, L.LC_German_Sharp_S .. L.LC_German_Sharp_S => True, L.UC_Icelandic_Thorn .. L.UC_Icelandic_Thorn => True, L.LC_Icelandic_Thorn .. L.LC_Icelandic_Thorn => True, L.UC_Icelandic_Eth .. L.UC_Icelandic_Eth => True, L.LC_Icelandic_Eth .. L.LC_Icelandic_Eth => True, others => False); Decimal_Digit_Set : constant Character_Set := ('0' .. '9' => True, others => False); Hexadecimal_Digit_Set : constant Character_Set := ('0' .. '9' => True, 'A' .. 'F' => True, L.LC_A .. L.LC_F => True, others => False); Alphanumeric_Set : constant Character_Set := ('0' .. '9' => True, 'A' .. 'Z' => True, L.LC_A .. L.LC_Z => True, L.UC_A_Grave .. L.UC_O_Diaeresis => True, L.UC_O_Oblique_Stroke .. L.LC_O_Diaeresis => True, L.LC_O_Oblique_Stroke .. L.LC_Y_Diaeresis => True, others => False); Special_Set : constant Character_Set := (L.Space .. L.Solidus => True, L.Colon .. L.Commercial_At => True, L.Left_Square_Bracket .. L.Grave => True, L.Left_Curly_Bracket .. L.Tilde => True, L.No_Break_Space .. L.Inverted_Question => True, L.Multiplication_Sign .. L.Multiplication_Sign => True, L.Division_Sign .. L.Division_Sign => True, others => False); ISO_646_Set : constant Character_Set := (L.NUL .. L.DEL => True, others => False); Lower_Case_Map : constant Character_Mapping := (L.NUL & -- NUL 0 L.SOH & -- SOH 1 L.STX & -- STX 2 L.ETX & -- ETX 3 L.EOT & -- EOT 4 L.ENQ & -- ENQ 5 L.ACK & -- ACK 6 L.BEL & -- BEL 7 L.BS & -- BS 8 L.HT & -- HT 9 L.LF & -- LF 10 L.VT & -- VT 11 L.FF & -- FF 12 L.CR & -- CR 13 L.SO & -- SO 14 L.SI & -- SI 15 L.DLE & -- DLE 16 L.DC1 & -- DC1 17 L.DC2 & -- DC2 18 L.DC3 & -- DC3 19 L.DC4 & -- DC4 20 L.NAK & -- NAK 21 L.SYN & -- SYN 22 L.ETB & -- ETB 23 L.CAN & -- CAN 24 L.EM & -- EM 25 L.SUB & -- SUB 26 L.ESC & -- ESC 27 L.FS & -- FS 28 L.GS & -- GS 29 L.RS & -- RS 30 L.US & -- US 31 L.Space & -- ' ' 32 L.Exclamation & -- '!' 33 L.Quotation & -- '"' 34 L.Number_Sign & -- '#' 35 L.Dollar_Sign & -- '$' 36 L.Percent_Sign & -- '%' 37 L.Ampersand & -- '&' 38 L.Apostrophe & -- ''' 39 L.Left_Parenthesis & -- '(' 40 L.Right_Parenthesis & -- ')' 41 L.Asterisk & -- '*' 42 L.Plus_Sign & -- '+' 43 L.Comma & -- ',' 44 L.Hyphen & -- '-' 45 L.Full_Stop & -- '.' 46 L.Solidus & -- '/' 47 '0' & -- '0' 48 '1' & -- '1' 49 '2' & -- '2' 50 '3' & -- '3' 51 '4' & -- '4' 52 '5' & -- '5' 53 '6' & -- '6' 54 '7' & -- '7' 55 '8' & -- '8' 56 '9' & -- '9' 57 L.Colon & -- ':' 58 L.Semicolon & -- ';' 59 L.Less_Than_Sign & -- '<' 60 L.Equals_Sign & -- '=' 61 L.Greater_Than_Sign & -- '>' 62 L.Question & -- '?' 63 L.Commercial_At & -- '@' 64 L.LC_A & -- 'a' 65 L.LC_B & -- 'b' 66 L.LC_C & -- 'c' 67 L.LC_D & -- 'd' 68 L.LC_E & -- 'e' 69 L.LC_F & -- 'f' 70 L.LC_G & -- 'g' 71 L.LC_H & -- 'h' 72 L.LC_I & -- 'i' 73 L.LC_J & -- 'j' 74 L.LC_K & -- 'k' 75 L.LC_L & -- 'l' 76 L.LC_M & -- 'm' 77 L.LC_N & -- 'n' 78 L.LC_O & -- 'o' 79 L.LC_P & -- 'p' 80 L.LC_Q & -- 'q' 81 L.LC_R & -- 'r' 82 L.LC_S & -- 's' 83 L.LC_T & -- 't' 84 L.LC_U & -- 'u' 85 L.LC_V & -- 'v' 86 L.LC_W & -- 'w' 87 L.LC_X & -- 'x' 88 L.LC_Y & -- 'y' 89 L.LC_Z & -- 'z' 90 L.Left_Square_Bracket & -- '[' 91 L.Reverse_Solidus & -- '\' 92 L.Right_Square_Bracket & -- ']' 93 L.Circumflex & -- '^' 94 L.Low_Line & -- '_' 95 L.Grave & -- '`' 96 L.LC_A & -- 'a' 97 L.LC_B & -- 'b' 98 L.LC_C & -- 'c' 99 L.LC_D & -- 'd' 100 L.LC_E & -- 'e' 101 L.LC_F & -- 'f' 102 L.LC_G & -- 'g' 103 L.LC_H & -- 'h' 104 L.LC_I & -- 'i' 105 L.LC_J & -- 'j' 106 L.LC_K & -- 'k' 107 L.LC_L & -- 'l' 108 L.LC_M & -- 'm' 109 L.LC_N & -- 'n' 110 L.LC_O & -- 'o' 111 L.LC_P & -- 'p' 112 L.LC_Q & -- 'q' 113 L.LC_R & -- 'r' 114 L.LC_S & -- 's' 115 L.LC_T & -- 't' 116 L.LC_U & -- 'u' 117 L.LC_V & -- 'v' 118 L.LC_W & -- 'w' 119 L.LC_X & -- 'x' 120 L.LC_Y & -- 'y' 121 L.LC_Z & -- 'z' 122 L.Left_Curly_Bracket & -- '{' 123 L.Vertical_Line & -- '|' 124 L.Right_Curly_Bracket & -- '}' 125 L.Tilde & -- '~' 126 L.DEL & -- DEL 127 L.Reserved_128 & -- Reserved_128 128 L.Reserved_129 & -- Reserved_129 129 L.BPH & -- BPH 130 L.NBH & -- NBH 131 L.Reserved_132 & -- Reserved_132 132 L.NEL & -- NEL 133 L.SSA & -- SSA 134 L.ESA & -- ESA 135 L.HTS & -- HTS 136 L.HTJ & -- HTJ 137 L.VTS & -- VTS 138 L.PLD & -- PLD 139 L.PLU & -- PLU 140 L.RI & -- RI 141 L.SS2 & -- SS2 142 L.SS3 & -- SS3 143 L.DCS & -- DCS 144 L.PU1 & -- PU1 145 L.PU2 & -- PU2 146 L.STS & -- STS 147 L.CCH & -- CCH 148 L.MW & -- MW 149 L.SPA & -- SPA 150 L.EPA & -- EPA 151 L.SOS & -- SOS 152 L.Reserved_153 & -- Reserved_153 153 L.SCI & -- SCI 154 L.CSI & -- CSI 155 L.ST & -- ST 156 L.OSC & -- OSC 157 L.PM & -- PM 158 L.APC & -- APC 159 L.No_Break_Space & -- No_Break_Space 160 L.Inverted_Exclamation & -- Inverted_Exclamation 161 L.Cent_Sign & -- Cent_Sign 162 L.Pound_Sign & -- Pound_Sign 163 L.Currency_Sign & -- Currency_Sign 164 L.Yen_Sign & -- Yen_Sign 165 L.Broken_Bar & -- Broken_Bar 166 L.Section_Sign & -- Section_Sign 167 L.Diaeresis & -- Diaeresis 168 L.Copyright_Sign & -- Copyright_Sign 169 L.Feminine_Ordinal_Indicator & -- Feminine_Ordinal_Indicator 170 L.Left_Angle_Quotation & -- Left_Angle_Quotation 171 L.Not_Sign & -- Not_Sign 172 L.Soft_Hyphen & -- Soft_Hyphen 173 L.Registered_Trade_Mark_Sign & -- Registered_Trade_Mark_Sign 174 L.Macron & -- Macron 175 L.Degree_Sign & -- Degree_Sign 176 L.Plus_Minus_Sign & -- Plus_Minus_Sign 177 L.Superscript_Two & -- Superscript_Two 178 L.Superscript_Three & -- Superscript_Three 179 L.Acute & -- Acute 180 L.Micro_Sign & -- Micro_Sign 181 L.Pilcrow_Sign & -- Pilcrow_Sign 182 L.Middle_Dot & -- Middle_Dot 183 L.Cedilla & -- Cedilla 184 L.Superscript_One & -- Superscript_One 185 L.Masculine_Ordinal_Indicator & -- Masculine_Ordinal_Indicator 186 L.Right_Angle_Quotation & -- Right_Angle_Quotation 187 L.Fraction_One_Quarter & -- Fraction_One_Quarter 188 L.Fraction_One_Half & -- Fraction_One_Half 189 L.Fraction_Three_Quarters & -- Fraction_Three_Quarters 190 L.Inverted_Question & -- Inverted_Question 191 L.LC_A_Grave & -- UC_A_Grave 192 L.LC_A_Acute & -- UC_A_Acute 193 L.LC_A_Circumflex & -- UC_A_Circumflex 194 L.LC_A_Tilde & -- UC_A_Tilde 195 L.LC_A_Diaeresis & -- UC_A_Diaeresis 196 L.LC_A_Ring & -- UC_A_Ring 197 L.LC_AE_Diphthong & -- UC_AE_Diphthong 198 L.LC_C_Cedilla & -- UC_C_Cedilla 199 L.LC_E_Grave & -- UC_E_Grave 200 L.LC_E_Acute & -- UC_E_Acute 201 L.LC_E_Circumflex & -- UC_E_Circumflex 202 L.LC_E_Diaeresis & -- UC_E_Diaeresis 203 L.LC_I_Grave & -- UC_I_Grave 204 L.LC_I_Acute & -- UC_I_Acute 205 L.LC_I_Circumflex & -- UC_I_Circumflex 206 L.LC_I_Diaeresis & -- UC_I_Diaeresis 207 L.LC_Icelandic_Eth & -- UC_Icelandic_Eth 208 L.LC_N_Tilde & -- UC_N_Tilde 209 L.LC_O_Grave & -- UC_O_Grave 210 L.LC_O_Acute & -- UC_O_Acute 211 L.LC_O_Circumflex & -- UC_O_Circumflex 212 L.LC_O_Tilde & -- UC_O_Tilde 213 L.LC_O_Diaeresis & -- UC_O_Diaeresis 214 L.Multiplication_Sign & -- Multiplication_Sign 215 L.LC_O_Oblique_Stroke & -- UC_O_Oblique_Stroke 216 L.LC_U_Grave & -- UC_U_Grave 217 L.LC_U_Acute & -- UC_U_Acute 218 L.LC_U_Circumflex & -- UC_U_Circumflex 219 L.LC_U_Diaeresis & -- UC_U_Diaeresis 220 L.LC_Y_Acute & -- UC_Y_Acute 221 L.LC_Icelandic_Thorn & -- UC_Icelandic_Thorn 222 L.LC_German_Sharp_S & -- LC_German_Sharp_S 223 L.LC_A_Grave & -- LC_A_Grave 224 L.LC_A_Acute & -- LC_A_Acute 225 L.LC_A_Circumflex & -- LC_A_Circumflex 226 L.LC_A_Tilde & -- LC_A_Tilde 227 L.LC_A_Diaeresis & -- LC_A_Diaeresis 228 L.LC_A_Ring & -- LC_A_Ring 229 L.LC_AE_Diphthong & -- LC_AE_Diphthong 230 L.LC_C_Cedilla & -- LC_C_Cedilla 231 L.LC_E_Grave & -- LC_E_Grave 232 L.LC_E_Acute & -- LC_E_Acute 233 L.LC_E_Circumflex & -- LC_E_Circumflex 234 L.LC_E_Diaeresis & -- LC_E_Diaeresis 235 L.LC_I_Grave & -- LC_I_Grave 236 L.LC_I_Acute & -- LC_I_Acute 237 L.LC_I_Circumflex & -- LC_I_Circumflex 238 L.LC_I_Diaeresis & -- LC_I_Diaeresis 239 L.LC_Icelandic_Eth & -- LC_Icelandic_Eth 240 L.LC_N_Tilde & -- LC_N_Tilde 241 L.LC_O_Grave & -- LC_O_Grave 242 L.LC_O_Acute & -- LC_O_Acute 243 L.LC_O_Circumflex & -- LC_O_Circumflex 244 L.LC_O_Tilde & -- LC_O_Tilde 245 L.LC_O_Diaeresis & -- LC_O_Diaeresis 246 L.Division_Sign & -- Division_Sign 247 L.LC_O_Oblique_Stroke & -- LC_O_Oblique_Stroke 248 L.LC_U_Grave & -- LC_U_Grave 249 L.LC_U_Acute & -- LC_U_Acute 250 L.LC_U_Circumflex & -- LC_U_Circumflex 251 L.LC_U_Diaeresis & -- LC_U_Diaeresis 252 L.LC_Y_Acute & -- LC_Y_Acute 253 L.LC_Icelandic_Thorn & -- LC_Icelandic_Thorn 254 L.LC_Y_Diaeresis); -- LC_Y_Diaeresis 255 Upper_Case_Map : constant Character_Mapping := (L.NUL & -- NUL 0 L.SOH & -- SOH 1 L.STX & -- STX 2 L.ETX & -- ETX 3 L.EOT & -- EOT 4 L.ENQ & -- ENQ 5 L.ACK & -- ACK 6 L.BEL & -- BEL 7 L.BS & -- BS 8 L.HT & -- HT 9 L.LF & -- LF 10 L.VT & -- VT 11 L.FF & -- FF 12 L.CR & -- CR 13 L.SO & -- SO 14 L.SI & -- SI 15 L.DLE & -- DLE 16 L.DC1 & -- DC1 17 L.DC2 & -- DC2 18 L.DC3 & -- DC3 19 L.DC4 & -- DC4 20 L.NAK & -- NAK 21 L.SYN & -- SYN 22 L.ETB & -- ETB 23 L.CAN & -- CAN 24 L.EM & -- EM 25 L.SUB & -- SUB 26 L.ESC & -- ESC 27 L.FS & -- FS 28 L.GS & -- GS 29 L.RS & -- RS 30 L.US & -- US 31 L.Space & -- ' ' 32 L.Exclamation & -- '!' 33 L.Quotation & -- '"' 34 L.Number_Sign & -- '#' 35 L.Dollar_Sign & -- '$' 36 L.Percent_Sign & -- '%' 37 L.Ampersand & -- '&' 38 L.Apostrophe & -- ''' 39 L.Left_Parenthesis & -- '(' 40 L.Right_Parenthesis & -- ')' 41 L.Asterisk & -- '*' 42 L.Plus_Sign & -- '+' 43 L.Comma & -- ',' 44 L.Hyphen & -- '-' 45 L.Full_Stop & -- '.' 46 L.Solidus & -- '/' 47 '0' & -- '0' 48 '1' & -- '1' 49 '2' & -- '2' 50 '3' & -- '3' 51 '4' & -- '4' 52 '5' & -- '5' 53 '6' & -- '6' 54 '7' & -- '7' 55 '8' & -- '8' 56 '9' & -- '9' 57 L.Colon & -- ':' 58 L.Semicolon & -- ';' 59 L.Less_Than_Sign & -- '<' 60 L.Equals_Sign & -- '=' 61 L.Greater_Than_Sign & -- '>' 62 L.Question & -- '?' 63 L.Commercial_At & -- '@' 64 'A' & -- 'A' 65 'B' & -- 'B' 66 'C' & -- 'C' 67 'D' & -- 'D' 68 'E' & -- 'E' 69 'F' & -- 'F' 70 'G' & -- 'G' 71 'H' & -- 'H' 72 'I' & -- 'I' 73 'J' & -- 'J' 74 'K' & -- 'K' 75 'L' & -- 'L' 76 'M' & -- 'M' 77 'N' & -- 'N' 78 'O' & -- 'O' 79 'P' & -- 'P' 80 'Q' & -- 'Q' 81 'R' & -- 'R' 82 'S' & -- 'S' 83 'T' & -- 'T' 84 'U' & -- 'U' 85 'V' & -- 'V' 86 'W' & -- 'W' 87 'X' & -- 'X' 88 'Y' & -- 'Y' 89 'Z' & -- 'Z' 90 L.Left_Square_Bracket & -- '[' 91 L.Reverse_Solidus & -- '\' 92 L.Right_Square_Bracket & -- ']' 93 L.Circumflex & -- '^' 94 L.Low_Line & -- '_' 95 L.Grave & -- '`' 96 'A' & -- 'a' 97 'B' & -- 'b' 98 'C' & -- 'c' 99 'D' & -- 'd' 100 'E' & -- 'e' 101 'F' & -- 'f' 102 'G' & -- 'g' 103 'H' & -- 'h' 104 'I' & -- 'i' 105 'J' & -- 'j' 106 'K' & -- 'k' 107 'L' & -- 'l' 108 'M' & -- 'm' 109 'N' & -- 'n' 110 'O' & -- 'o' 111 'P' & -- 'p' 112 'Q' & -- 'q' 113 'R' & -- 'r' 114 'S' & -- 's' 115 'T' & -- 't' 116 'U' & -- 'u' 117 'V' & -- 'v' 118 'W' & -- 'w' 119 'X' & -- 'x' 120 'Y' & -- 'y' 121 'Z' & -- 'z' 122 L.Left_Curly_Bracket & -- '{' 123 L.Vertical_Line & -- '|' 124 L.Right_Curly_Bracket & -- '}' 125 L.Tilde & -- '~' 126 L.DEL & -- DEL 127 L.Reserved_128 & -- Reserved_128 128 L.Reserved_129 & -- Reserved_129 129 L.BPH & -- BPH 130 L.NBH & -- NBH 131 L.Reserved_132 & -- Reserved_132 132 L.NEL & -- NEL 133 L.SSA & -- SSA 134 L.ESA & -- ESA 135 L.HTS & -- HTS 136 L.HTJ & -- HTJ 137 L.VTS & -- VTS 138 L.PLD & -- PLD 139 L.PLU & -- PLU 140 L.RI & -- RI 141 L.SS2 & -- SS2 142 L.SS3 & -- SS3 143 L.DCS & -- DCS 144 L.PU1 & -- PU1 145 L.PU2 & -- PU2 146 L.STS & -- STS 147 L.CCH & -- CCH 148 L.MW & -- MW 149 L.SPA & -- SPA 150 L.EPA & -- EPA 151 L.SOS & -- SOS 152 L.Reserved_153 & -- Reserved_153 153 L.SCI & -- SCI 154 L.CSI & -- CSI 155 L.ST & -- ST 156 L.OSC & -- OSC 157 L.PM & -- PM 158 L.APC & -- APC 159 L.No_Break_Space & -- No_Break_Space 160 L.Inverted_Exclamation & -- Inverted_Exclamation 161 L.Cent_Sign & -- Cent_Sign 162 L.Pound_Sign & -- Pound_Sign 163 L.Currency_Sign & -- Currency_Sign 164 L.Yen_Sign & -- Yen_Sign 165 L.Broken_Bar & -- Broken_Bar 166 L.Section_Sign & -- Section_Sign 167 L.Diaeresis & -- Diaeresis 168 L.Copyright_Sign & -- Copyright_Sign 169 L.Feminine_Ordinal_Indicator & -- Feminine_Ordinal_Indicator 170 L.Left_Angle_Quotation & -- Left_Angle_Quotation 171 L.Not_Sign & -- Not_Sign 172 L.Soft_Hyphen & -- Soft_Hyphen 173 L.Registered_Trade_Mark_Sign & -- Registered_Trade_Mark_Sign 174 L.Macron & -- Macron 175 L.Degree_Sign & -- Degree_Sign 176 L.Plus_Minus_Sign & -- Plus_Minus_Sign 177 L.Superscript_Two & -- Superscript_Two 178 L.Superscript_Three & -- Superscript_Three 179 L.Acute & -- Acute 180 L.Micro_Sign & -- Micro_Sign 181 L.Pilcrow_Sign & -- Pilcrow_Sign 182 L.Middle_Dot & -- Middle_Dot 183 L.Cedilla & -- Cedilla 184 L.Superscript_One & -- Superscript_One 185 L.Masculine_Ordinal_Indicator & -- Masculine_Ordinal_Indicator 186 L.Right_Angle_Quotation & -- Right_Angle_Quotation 187 L.Fraction_One_Quarter & -- Fraction_One_Quarter 188 L.Fraction_One_Half & -- Fraction_One_Half 189 L.Fraction_Three_Quarters & -- Fraction_Three_Quarters 190 L.Inverted_Question & -- Inverted_Question 191 L.UC_A_Grave & -- UC_A_Grave 192 L.UC_A_Acute & -- UC_A_Acute 193 L.UC_A_Circumflex & -- UC_A_Circumflex 194 L.UC_A_Tilde & -- UC_A_Tilde 195 L.UC_A_Diaeresis & -- UC_A_Diaeresis 196 L.UC_A_Ring & -- UC_A_Ring 197 L.UC_AE_Diphthong & -- UC_AE_Diphthong 198 L.UC_C_Cedilla & -- UC_C_Cedilla 199 L.UC_E_Grave & -- UC_E_Grave 200 L.UC_E_Acute & -- UC_E_Acute 201 L.UC_E_Circumflex & -- UC_E_Circumflex 202 L.UC_E_Diaeresis & -- UC_E_Diaeresis 203 L.UC_I_Grave & -- UC_I_Grave 204 L.UC_I_Acute & -- UC_I_Acute 205 L.UC_I_Circumflex & -- UC_I_Circumflex 206 L.UC_I_Diaeresis & -- UC_I_Diaeresis 207 L.UC_Icelandic_Eth & -- UC_Icelandic_Eth 208 L.UC_N_Tilde & -- UC_N_Tilde 209 L.UC_O_Grave & -- UC_O_Grave 210 L.UC_O_Acute & -- UC_O_Acute 211 L.UC_O_Circumflex & -- UC_O_Circumflex 212 L.UC_O_Tilde & -- UC_O_Tilde 213 L.UC_O_Diaeresis & -- UC_O_Diaeresis 214 L.Multiplication_Sign & -- Multiplication_Sign 215 L.UC_O_Oblique_Stroke & -- UC_O_Oblique_Stroke 216 L.UC_U_Grave & -- UC_U_Grave 217 L.UC_U_Acute & -- UC_U_Acute 218 L.UC_U_Circumflex & -- UC_U_Circumflex 219 L.UC_U_Diaeresis & -- UC_U_Diaeresis 220 L.UC_Y_Acute & -- UC_Y_Acute 221 L.UC_Icelandic_Thorn & -- UC_Icelandic_Thorn 222 L.LC_German_Sharp_S & -- LC_German_Sharp_S 223 L.UC_A_Grave & -- LC_A_Grave 224 L.UC_A_Acute & -- LC_A_Acute 225 L.UC_A_Circumflex & -- LC_A_Circumflex 226 L.UC_A_Tilde & -- LC_A_Tilde 227 L.UC_A_Diaeresis & -- LC_A_Diaeresis 228 L.UC_A_Ring & -- LC_A_Ring 229 L.UC_AE_Diphthong & -- LC_AE_Diphthong 230 L.UC_C_Cedilla & -- LC_C_Cedilla 231 L.UC_E_Grave & -- LC_E_Grave 232 L.UC_E_Acute & -- LC_E_Acute 233 L.UC_E_Circumflex & -- LC_E_Circumflex 234 L.UC_E_Diaeresis & -- LC_E_Diaeresis 235 L.UC_I_Grave & -- LC_I_Grave 236 L.UC_I_Acute & -- LC_I_Acute 237 L.UC_I_Circumflex & -- LC_I_Circumflex 238 L.UC_I_Diaeresis & -- LC_I_Diaeresis 239 L.UC_Icelandic_Eth & -- LC_Icelandic_Eth 240 L.UC_N_Tilde & -- LC_N_Tilde 241 L.UC_O_Grave & -- LC_O_Grave 242 L.UC_O_Acute & -- LC_O_Acute 243 L.UC_O_Circumflex & -- LC_O_Circumflex 244 L.UC_O_Tilde & -- LC_O_Tilde 245 L.UC_O_Diaeresis & -- LC_O_Diaeresis 246 L.Division_Sign & -- Division_Sign 247 L.UC_O_Oblique_Stroke & -- LC_O_Oblique_Stroke 248 L.UC_U_Grave & -- LC_U_Grave 249 L.UC_U_Acute & -- LC_U_Acute 250 L.UC_U_Circumflex & -- LC_U_Circumflex 251 L.UC_U_Diaeresis & -- LC_U_Diaeresis 252 L.UC_Y_Acute & -- LC_Y_Acute 253 L.UC_Icelandic_Thorn & -- LC_Icelandic_Thorn 254 L.LC_Y_Diaeresis); -- LC_Y_Diaeresis 255 Basic_Map : constant Character_Mapping := (L.NUL & -- NUL 0 L.SOH & -- SOH 1 L.STX & -- STX 2 L.ETX & -- ETX 3 L.EOT & -- EOT 4 L.ENQ & -- ENQ 5 L.ACK & -- ACK 6 L.BEL & -- BEL 7 L.BS & -- BS 8 L.HT & -- HT 9 L.LF & -- LF 10 L.VT & -- VT 11 L.FF & -- FF 12 L.CR & -- CR 13 L.SO & -- SO 14 L.SI & -- SI 15 L.DLE & -- DLE 16 L.DC1 & -- DC1 17 L.DC2 & -- DC2 18 L.DC3 & -- DC3 19 L.DC4 & -- DC4 20 L.NAK & -- NAK 21 L.SYN & -- SYN 22 L.ETB & -- ETB 23 L.CAN & -- CAN 24 L.EM & -- EM 25 L.SUB & -- SUB 26 L.ESC & -- ESC 27 L.FS & -- FS 28 L.GS & -- GS 29 L.RS & -- RS 30 L.US & -- US 31 L.Space & -- ' ' 32 L.Exclamation & -- '!' 33 L.Quotation & -- '"' 34 L.Number_Sign & -- '#' 35 L.Dollar_Sign & -- '$' 36 L.Percent_Sign & -- '%' 37 L.Ampersand & -- '&' 38 L.Apostrophe & -- ''' 39 L.Left_Parenthesis & -- '(' 40 L.Right_Parenthesis & -- ')' 41 L.Asterisk & -- '*' 42 L.Plus_Sign & -- '+' 43 L.Comma & -- ',' 44 L.Hyphen & -- '-' 45 L.Full_Stop & -- '.' 46 L.Solidus & -- '/' 47 '0' & -- '0' 48 '1' & -- '1' 49 '2' & -- '2' 50 '3' & -- '3' 51 '4' & -- '4' 52 '5' & -- '5' 53 '6' & -- '6' 54 '7' & -- '7' 55 '8' & -- '8' 56 '9' & -- '9' 57 L.Colon & -- ':' 58 L.Semicolon & -- ';' 59 L.Less_Than_Sign & -- '<' 60 L.Equals_Sign & -- '=' 61 L.Greater_Than_Sign & -- '>' 62 L.Question & -- '?' 63 L.Commercial_At & -- '@' 64 'A' & -- 'A' 65 'B' & -- 'B' 66 'C' & -- 'C' 67 'D' & -- 'D' 68 'E' & -- 'E' 69 'F' & -- 'F' 70 'G' & -- 'G' 71 'H' & -- 'H' 72 'I' & -- 'I' 73 'J' & -- 'J' 74 'K' & -- 'K' 75 'L' & -- 'L' 76 'M' & -- 'M' 77 'N' & -- 'N' 78 'O' & -- 'O' 79 'P' & -- 'P' 80 'Q' & -- 'Q' 81 'R' & -- 'R' 82 'S' & -- 'S' 83 'T' & -- 'T' 84 'U' & -- 'U' 85 'V' & -- 'V' 86 'W' & -- 'W' 87 'X' & -- 'X' 88 'Y' & -- 'Y' 89 'Z' & -- 'Z' 90 L.Left_Square_Bracket & -- '[' 91 L.Reverse_Solidus & -- '\' 92 L.Right_Square_Bracket & -- ']' 93 L.Circumflex & -- '^' 94 L.Low_Line & -- '_' 95 L.Grave & -- '`' 96 L.LC_A & -- 'a' 97 L.LC_B & -- 'b' 98 L.LC_C & -- 'c' 99 L.LC_D & -- 'd' 100 L.LC_E & -- 'e' 101 L.LC_F & -- 'f' 102 L.LC_G & -- 'g' 103 L.LC_H & -- 'h' 104 L.LC_I & -- 'i' 105 L.LC_J & -- 'j' 106 L.LC_K & -- 'k' 107 L.LC_L & -- 'l' 108 L.LC_M & -- 'm' 109 L.LC_N & -- 'n' 110 L.LC_O & -- 'o' 111 L.LC_P & -- 'p' 112 L.LC_Q & -- 'q' 113 L.LC_R & -- 'r' 114 L.LC_S & -- 's' 115 L.LC_T & -- 't' 116 L.LC_U & -- 'u' 117 L.LC_V & -- 'v' 118 L.LC_W & -- 'w' 119 L.LC_X & -- 'x' 120 L.LC_Y & -- 'y' 121 L.LC_Z & -- 'z' 122 L.Left_Curly_Bracket & -- '{' 123 L.Vertical_Line & -- '|' 124 L.Right_Curly_Bracket & -- '}' 125 L.Tilde & -- '~' 126 L.DEL & -- DEL 127 L.Reserved_128 & -- Reserved_128 128 L.Reserved_129 & -- Reserved_129 129 L.BPH & -- BPH 130 L.NBH & -- NBH 131 L.Reserved_132 & -- Reserved_132 132 L.NEL & -- NEL 133 L.SSA & -- SSA 134 L.ESA & -- ESA 135 L.HTS & -- HTS 136 L.HTJ & -- HTJ 137 L.VTS & -- VTS 138 L.PLD & -- PLD 139 L.PLU & -- PLU 140 L.RI & -- RI 141 L.SS2 & -- SS2 142 L.SS3 & -- SS3 143 L.DCS & -- DCS 144 L.PU1 & -- PU1 145 L.PU2 & -- PU2 146 L.STS & -- STS 147 L.CCH & -- CCH 148 L.MW & -- MW 149 L.SPA & -- SPA 150 L.EPA & -- EPA 151 L.SOS & -- SOS 152 L.Reserved_153 & -- Reserved_153 153 L.SCI & -- SCI 154 L.CSI & -- CSI 155 L.ST & -- ST 156 L.OSC & -- OSC 157 L.PM & -- PM 158 L.APC & -- APC 159 L.No_Break_Space & -- No_Break_Space 160 L.Inverted_Exclamation & -- Inverted_Exclamation 161 L.Cent_Sign & -- Cent_Sign 162 L.Pound_Sign & -- Pound_Sign 163 L.Currency_Sign & -- Currency_Sign 164 L.Yen_Sign & -- Yen_Sign 165 L.Broken_Bar & -- Broken_Bar 166 L.Section_Sign & -- Section_Sign 167 L.Diaeresis & -- Diaeresis 168 L.Copyright_Sign & -- Copyright_Sign 169 L.Feminine_Ordinal_Indicator & -- Feminine_Ordinal_Indicator 170 L.Left_Angle_Quotation & -- Left_Angle_Quotation 171 L.Not_Sign & -- Not_Sign 172 L.Soft_Hyphen & -- Soft_Hyphen 173 L.Registered_Trade_Mark_Sign & -- Registered_Trade_Mark_Sign 174 L.Macron & -- Macron 175 L.Degree_Sign & -- Degree_Sign 176 L.Plus_Minus_Sign & -- Plus_Minus_Sign 177 L.Superscript_Two & -- Superscript_Two 178 L.Superscript_Three & -- Superscript_Three 179 L.Acute & -- Acute 180 L.Micro_Sign & -- Micro_Sign 181 L.Pilcrow_Sign & -- Pilcrow_Sign 182 L.Middle_Dot & -- Middle_Dot 183 L.Cedilla & -- Cedilla 184 L.Superscript_One & -- Superscript_One 185 L.Masculine_Ordinal_Indicator & -- Masculine_Ordinal_Indicator 186 L.Right_Angle_Quotation & -- Right_Angle_Quotation 187 L.Fraction_One_Quarter & -- Fraction_One_Quarter 188 L.Fraction_One_Half & -- Fraction_One_Half 189 L.Fraction_Three_Quarters & -- Fraction_Three_Quarters 190 L.Inverted_Question & -- Inverted_Question 191 'A' & -- UC_A_Grave 192 'A' & -- UC_A_Acute 193 'A' & -- UC_A_Circumflex 194 'A' & -- UC_A_Tilde 195 'A' & -- UC_A_Diaeresis 196 'A' & -- UC_A_Ring 197 L.UC_AE_Diphthong & -- UC_AE_Diphthong 198 'C' & -- UC_C_Cedilla 199 'E' & -- UC_E_Grave 200 'E' & -- UC_E_Acute 201 'E' & -- UC_E_Circumflex 202 'E' & -- UC_E_Diaeresis 203 'I' & -- UC_I_Grave 204 'I' & -- UC_I_Acute 205 'I' & -- UC_I_Circumflex 206 'I' & -- UC_I_Diaeresis 207 L.UC_Icelandic_Eth & -- UC_Icelandic_Eth 208 'N' & -- UC_N_Tilde 209 'O' & -- UC_O_Grave 210 'O' & -- UC_O_Acute 211 'O' & -- UC_O_Circumflex 212 'O' & -- UC_O_Tilde 213 'O' & -- UC_O_Diaeresis 214 L.Multiplication_Sign & -- Multiplication_Sign 215 'O' & -- UC_O_Oblique_Stroke 216 'U' & -- UC_U_Grave 217 'U' & -- UC_U_Acute 218 'U' & -- UC_U_Circumflex 219 'U' & -- UC_U_Diaeresis 220 'Y' & -- UC_Y_Acute 221 L.UC_Icelandic_Thorn & -- UC_Icelandic_Thorn 222 L.LC_German_Sharp_S & -- LC_German_Sharp_S 223 L.LC_A & -- LC_A_Grave 224 L.LC_A & -- LC_A_Acute 225 L.LC_A & -- LC_A_Circumflex 226 L.LC_A & -- LC_A_Tilde 227 L.LC_A & -- LC_A_Diaeresis 228 L.LC_A & -- LC_A_Ring 229 L.LC_AE_Diphthong & -- LC_AE_Diphthong 230 L.LC_C & -- LC_C_Cedilla 231 L.LC_E & -- LC_E_Grave 232 L.LC_E & -- LC_E_Acute 233 L.LC_E & -- LC_E_Circumflex 234 L.LC_E & -- LC_E_Diaeresis 235 L.LC_I & -- LC_I_Grave 236 L.LC_I & -- LC_I_Acute 237 L.LC_I & -- LC_I_Circumflex 238 L.LC_I & -- LC_I_Diaeresis 239 L.LC_Icelandic_Eth & -- LC_Icelandic_Eth 240 L.LC_N & -- LC_N_Tilde 241 L.LC_O & -- LC_O_Grave 242 L.LC_O & -- LC_O_Acute 243 L.LC_O & -- LC_O_Circumflex 244 L.LC_O & -- LC_O_Tilde 245 L.LC_O & -- LC_O_Diaeresis 246 L.Division_Sign & -- Division_Sign 247 L.LC_O & -- LC_O_Oblique_Stroke 248 L.LC_U & -- LC_U_Grave 249 L.LC_U & -- LC_U_Acute 250 L.LC_U & -- LC_U_Circumflex 251 L.LC_U & -- LC_U_Diaeresis 252 L.LC_Y & -- LC_Y_Acute 253 L.LC_Icelandic_Thorn & -- LC_Icelandic_Thorn 254 L.LC_Y); -- LC_Y_Diaeresis 255 end Ada.Strings.Maps.Constants;
procedure Raise_Statement is The_Exception : exception; begin raise The_Exception; end Raise_Statement;
-------------------------------------------------------------------------------------------------------------------- -- 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. -------------------------------------------------------------------------------------------------------------------- -- SDL.Events.Mice -- -- Mouse specific events. -------------------------------------------------------------------------------------------------------------------- with Ada.Unchecked_Conversion; with Interfaces; with SDL.Video.Windows; package SDL.Events.Mice is pragma Preelaborate; -- Mouse events. Motion : constant Event_Types := 16#0000_0400#; Button_Down : constant Event_Types := Motion + 1; Button_Up : constant Event_Types := Motion + 2; Wheel : constant Event_Types := Motion + 3; type IDs is range 0 .. 2 ** 32 - 1 with Convention => C, Size => 32; Touch_Mouse_ID : constant IDs := IDs'Last; -- Equals -1 cast to Uint32 in C. type Buttons is (Left, Middle, Right, X_1, X_2) with Convention => C; for Buttons use (Left => 1, Middle => 2, Right => 3, X_1 => 4, X_2 => 5); type Button_Masks is mod 2 ** 32 with Convention => C, Size => 32; function Convert is new Ada.Unchecked_Conversion (Source => Interfaces.Unsigned_32, Target => Button_Masks); function Left_Mask return Button_Masks is (Convert (Interfaces.Shift_Left (1, Buttons'Pos (Left)))) with Inline => True; function Middle_Mask return Button_Masks is (Convert (Interfaces.Shift_Left (1, Buttons'Pos (Middle)))) with Inline => True; function Right_Mask return Button_Masks is (Convert (Interfaces.Shift_Left (1, Buttons'Pos (Right)))) with Inline => True; function X_1_Mask return Button_Masks is (Convert (Interfaces.Shift_Left (1, Buttons'Pos (X_1)))) with Inline => True; function X_2_Mask return Button_Masks is (Convert (Interfaces.Shift_Left (1, Buttons'Pos (X_2)))) with Inline => True; type Movement_Values is range -2 ** 31 .. 2 ** 31 - 1 with Convention => C, Size => 32; type Motion_Events is record Event_Type : Event_Types; -- Will be set to Motion. Time_Stamp : Time_Stamps; Window : SDL.Video.Windows.ID; Which : IDs; Mask : Button_Masks; X : SDL.Natural_Coordinate; -- Relative to the left of the window. Y : SDL.Natural_Coordinate; -- Relative to the top of the window. X_Relative : Movement_Values; Y_Relative : Movement_Values; end record with Convention => C; type Button_Clicks is range 0 .. 255 with Convention => C, Size => 8; type Button_Events is record Event_Type : Event_Types; -- Will be set to Button_Up or Button_Down. Time_Stamp : Time_Stamps; Window : SDL.Video.Windows.ID; Which : IDs; Button : Buttons; State : Button_State; Clicks : Button_Clicks; Padding_1 : Padding_8; X : SDL.Natural_Coordinate; -- Relative to the left of the window. Y : SDL.Natural_Coordinate; -- Relative to the top of the window. end record with Convention => C; type Wheel_Values is range -2 ** 31 .. 2 ** 31 - 1 with Convention => C, Size => 32; function Flip_Wheel_Value (Value : in Wheel_Values) return Wheel_Values is (Value * Wheel_Values'First); type Wheel_Directions is (Normal, Flipped) with Convention => C; type Wheel_Events is record Event_Type : Event_Types; -- Will be set to Wheel. Time_Stamp : Time_Stamps; Window : SDL.Video.Windows.ID; Which : IDs; X : Wheel_Values; Y : Wheel_Values; Direction : Wheel_Directions; end record with Convention => C; private for Motion_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Window at 2 * SDL.Word range 0 .. 31; Which at 3 * SDL.Word range 0 .. 31; Mask at 4 * SDL.Word range 0 .. 31; X at 5 * SDL.Word range 0 .. 31; Y at 6 * SDL.Word range 0 .. 31; X_Relative at 7 * SDL.Word range 0 .. 31; Y_Relative at 8 * SDL.Word range 0 .. 31; end record; for Button_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Window at 2 * SDL.Word range 0 .. 31; Which at 3 * SDL.Word range 0 .. 31; Button at 4 * SDL.Word range 0 .. 7; State at 4 * SDL.Word range 8 .. 15; Clicks at 4 * SDL.Word range 16 .. 23; Padding_1 at 4 * SDL.Word range 24 .. 31; X at 5 * SDL.Word range 0 .. 31; Y at 6 * SDL.Word range 0 .. 31; end record; for Wheel_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Window at 2 * SDL.Word range 0 .. 31; Which at 3 * SDL.Word range 0 .. 31; X at 4 * SDL.Word range 0 .. 31; Y at 5 * SDL.Word range 0 .. 31; Direction at 6 * SDL.Word range 0 .. 31; end record; end SDL.Events.Mice;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Testsuite 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$ ------------------------------------------------------------------------------ -- Test:T37 -- -- Description: -- -- This test consists of Node A sending a msg with a header that does not have -- MU attr defined. Node C returns a valid reply. -- -- Messages: -- -- Message sent from Node A -- -- <?xml version='1.0' ?> -- <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> -- <env:Header> -- <test:Unknown -- xmlns:test="http://example.org/ts-tests" -- env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"> -- foo -- </test:Unknown> -- </env:Header> -- <env:Body> -- </env:Body> -- </env:Envelope> -- -- Message sent from Node C -- -- <?xml version='1.0' ?> -- <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> -- <env:Header> -- </env:Header> -- <env:Body> -- </env:Body> -- </env:Envelope> ------------------------------------------------------------------------------ package SOAPConf.Testcases.Test_T37 is Scenario : constant Testcase_Data := (League.Strings.To_Universal_String ("<?xml version='1.0'?>" & "<env:Envelope" & " xmlns:env='http://www.w3.org/2003/05/soap-envelope'>" & "<env:Header>" & "<test:Unknown xmlns:test='http://example.org/ts-tests'" & " env:role='http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver'>" & "foo" & "</test:Unknown>" & "</env:Header>" & "<env:Body>" & "</env:Body>" & "</env:Envelope>"), League.Strings.To_Universal_String ("<?xml version='1.0'?>" & "<env:Envelope" & " xmlns:env='http://www.w3.org/2003/05/soap-envelope'>" & "<env:Body/>" & "</env:Envelope>")); end SOAPConf.Testcases.Test_T37;
------------------------------------------------------------------------------ -- -- -- 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.Internals.OCL_Elements; with AMF.OCL.Unspecified_Value_Exps; with AMF.UML.Comments.Collections; with AMF.UML.Dependencies.Collections; with AMF.UML.Elements.Collections; with AMF.UML.Named_Elements; with AMF.UML.Namespaces.Collections; with AMF.UML.Packages.Collections; with AMF.UML.String_Expressions; with AMF.UML.Types; with AMF.Visitors; package AMF.Internals.OCL_Unspecified_Value_Exps is type OCL_Unspecified_Value_Exp_Proxy is limited new AMF.Internals.OCL_Elements.OCL_Element_Proxy and AMF.OCL.Unspecified_Value_Exps.OCL_Unspecified_Value_Exp with null record; overriding function Get_Type (Self : not null access constant OCL_Unspecified_Value_Exp_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 OCL_Unspecified_Value_Exp_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 Get_Client_Dependency (Self : not null access constant OCL_Unspecified_Value_Exp_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 (Self : not null access constant OCL_Unspecified_Value_Exp_Proxy) return AMF.Optional_String; -- Getter of NamedElement::name. -- -- The name of the NamedElement. overriding procedure Set_Name (Self : not null access OCL_Unspecified_Value_Exp_Proxy; To : AMF.Optional_String); -- Setter of NamedElement::name. -- -- The name of the NamedElement. overriding function Get_Name_Expression (Self : not null access constant OCL_Unspecified_Value_Exp_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 OCL_Unspecified_Value_Exp_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 OCL_Unspecified_Value_Exp_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 OCL_Unspecified_Value_Exp_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_Visibility (Self : not null access constant OCL_Unspecified_Value_Exp_Proxy) return AMF.UML.Optional_UML_Visibility_Kind; -- Getter of NamedElement::visibility. -- -- Determines where the NamedElement appears within different Namespaces -- within the overall model, and its accessibility. overriding procedure Set_Visibility (Self : not null access OCL_Unspecified_Value_Exp_Proxy; To : AMF.UML.Optional_UML_Visibility_Kind); -- Setter of NamedElement::visibility. -- -- Determines where the NamedElement appears within different Namespaces -- within the overall model, and its accessibility. overriding function Get_Owned_Comment (Self : not null access constant OCL_Unspecified_Value_Exp_Proxy) return AMF.UML.Comments.Collections.Set_Of_UML_Comment; -- Getter of Element::ownedComment. -- -- The Comments owned by this element. overriding function Get_Owned_Element (Self : not null access constant OCL_Unspecified_Value_Exp_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Getter of Element::ownedElement. -- -- The Elements owned by this element. overriding function Get_Owner (Self : not null access constant OCL_Unspecified_Value_Exp_Proxy) return AMF.UML.Elements.UML_Element_Access; -- Getter of Element::owner. -- -- The Element that owns this element. overriding function All_Namespaces (Self : not null access constant OCL_Unspecified_Value_Exp_Proxy) return AMF.UML.Namespaces.Collections.Ordered_Set_Of_UML_Namespace; -- Operation NamedElement::allNamespaces. -- -- The query allNamespaces() gives the sequence of namespaces in which the -- NamedElement is nested, working outwards. overriding function All_Owning_Packages (Self : not null access constant OCL_Unspecified_Value_Exp_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 OCL_Unspecified_Value_Exp_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 OCL_Unspecified_Value_Exp_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Operation NamedElement::namespace. -- -- Missing derivation for NamedElement::/namespace : Namespace overriding function Qualified_Name (Self : not null access constant OCL_Unspecified_Value_Exp_Proxy) return League.Strings.Universal_String; -- Operation NamedElement::qualifiedName. -- -- When there is a name, and all of the containing namespaces have a name, -- the qualified name is constructed from the names of the containing -- namespaces. overriding function Separator (Self : not null access constant OCL_Unspecified_Value_Exp_Proxy) return League.Strings.Universal_String; -- Operation NamedElement::separator. -- -- The query separator() gives the string that is used to separate names -- when constructing a qualified name. overriding function All_Owned_Elements (Self : not null access constant OCL_Unspecified_Value_Exp_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Operation Element::allOwnedElements. -- -- The query allOwnedElements() gives all of the direct and indirect owned -- elements of an element. overriding function Must_Be_Owned (Self : not null access constant OCL_Unspecified_Value_Exp_Proxy) return Boolean; -- Operation Element::mustBeOwned. -- -- The query mustBeOwned() indicates whether elements of this type must -- have an owner. Subclasses of Element that do not require an owner must -- override this operation. overriding procedure Enter_Element (Self : not null access constant OCL_Unspecified_Value_Exp_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Leave_Element (Self : not null access constant OCL_Unspecified_Value_Exp_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Visit_Element (Self : not null access constant OCL_Unspecified_Value_Exp_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); end AMF.Internals.OCL_Unspecified_Value_Exps;
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces; with swig; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_glx_get_color_table_parameteriv_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; pad1 : aliased swig.int8_t_Array (0 .. 3); n : aliased Interfaces.Unsigned_32; datum : aliased Interfaces.Integer_32; pad2 : aliased swig.int8_t_Array (0 .. 11); end record; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb .xcb_glx_get_color_table_parameteriv_reply_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_get_color_table_parameteriv_reply_t.Item, Element_Array => xcb.xcb_glx_get_color_table_parameteriv_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_glx_get_color_table_parameteriv_reply_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_get_color_table_parameteriv_reply_t.Pointer, Element_Array => xcb.xcb_glx_get_color_table_parameteriv_reply_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_glx_get_color_table_parameteriv_reply_t;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S E M _ W A R N -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1999-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 Alloc; with Atree; use Atree; with Einfo; use Einfo; with Errout; use Errout; with Fname; use Fname; with Lib; use Lib; with Nlists; use Nlists; with Opt; use Opt; with Sem; use Sem; with Sem_Util; use Sem_Util; with Sinfo; use Sinfo; with Sinput; use Sinput; with Snames; use Snames; with Stand; use Stand; with Table; package body Sem_Warn is -- The following table collects Id's of entities that are potentially -- unreferenced. See Check_Unset_Reference for further details. package Unreferenced_Entities is new Table.Table ( Table_Component_Type => Entity_Id, Table_Index_Type => Nat, Table_Low_Bound => 1, Table_Initial => Alloc.Unreferenced_Entities_Initial, Table_Increment => Alloc.Unreferenced_Entities_Increment, Table_Name => "Unreferenced_Entities"); -- One entry is made in the following table for each branch of -- a conditional, e.g. an if-then-elsif-else-endif structure -- creates three entries in this table. type Branch_Entry is record Sloc : Source_Ptr; -- Location for warnings associated with this branch Defs : Elist_Id; -- List of entities defined for the first time in this branch. On -- exit from a conditional structure, any entity that is in the -- list of all branches is removed (and the entity flagged as -- defined by the conditional as a whole). Thus after processing -- a conditional, Defs contains a list of entities defined in this -- branch for the first time, but not defined at all in some other -- branch of the same conditional. A value of No_Elist is used to -- represent the initial empty list. Next : Nat; -- Index of next branch for this conditional, zero = last branch end record; package Branch_Table is new Table.Table ( Table_Component_Type => Branch_Entry, Table_Index_Type => Nat, Table_Low_Bound => 1, Table_Initial => Alloc.Branches_Initial, Table_Increment => Alloc.Branches_Increment, Table_Name => "Branches"); -- The following table is used to represent conditionals, there is -- one entry in this table for each conditional structure. type Conditional_Entry is record If_Stmt : Boolean; -- True for IF statement, False for CASE statement First_Branch : Nat; -- Index in Branch table of first branch, zero = none yet Current_Branch : Nat; -- Index in Branch table of current branch, zero = none yet end record; package Conditional_Table is new Table.Table ( Table_Component_Type => Conditional_Entry, Table_Index_Type => Nat, Table_Low_Bound => 1, Table_Initial => Alloc.Conditionals_Initial, Table_Increment => Alloc.Conditionals_Increment, Table_Name => "Conditionals"); -- The following table is a stack that keeps track of the current -- conditional. The Last entry is the top of the stack. An Empty -- entry represents the start of a compilation unit. Non-zero -- entries in the stack are indexes into the conditional table. package Conditional_Stack is new Table.Table ( Table_Component_Type => Nat, Table_Index_Type => Nat, Table_Low_Bound => 1, Table_Initial => Alloc.Conditional_Stack_Initial, Table_Increment => Alloc.Conditional_Stack_Increment, Table_Name => "Conditional_Stack"); Current_Entity_List : Elist_Id := No_Elist; -- This is a copy of the Defs list of the current branch of the current -- conditional. It could be accessed by taking the top element of the -- Conditional_Stack, and going to te Current_Branch entry of this -- conditional, but we keep it precomputed for rapid access. ---------------------- -- Check_References -- ---------------------- procedure Check_References (E : Entity_Id; Anod : Node_Id := Empty) is E1 : Entity_Id; UR : Node_Id; PU : Node_Id; procedure Output_Reference_Error (M : String); -- Used to output an error message. Deals with posting the error on -- the body formal in the accept case. function Publicly_Referenceable (Ent : Entity_Id) return Boolean; -- This is true if the entity in question is potentially referenceable -- from another unit. This is true for entities in packages that are -- at the library level, or for entities in tasks or protected objects -- that are themselves publicly visible. ---------------------------- -- Output_Reference_Error -- ---------------------------- procedure Output_Reference_Error (M : String) is begin -- Other than accept case, post error on defining identifier if No (Anod) then Error_Msg_N (M, E1); -- Accept case, find body formal to post the message else declare Parm : Node_Id; Enod : Node_Id; Defid : Entity_Id; begin Enod := Anod; if Present (Parameter_Specifications (Anod)) then Parm := First (Parameter_Specifications (Anod)); while Present (Parm) loop Defid := Defining_Identifier (Parm); if Chars (E1) = Chars (Defid) then Enod := Defid; exit; end if; Next (Parm); end loop; end if; Error_Msg_NE (M, Enod, E1); end; end if; end Output_Reference_Error; ---------------------------- -- Publicly_Referenceable -- ---------------------------- function Publicly_Referenceable (Ent : Entity_Id) return Boolean is S : Entity_Id; begin -- Any entity in a generic package is considered to be publicly -- referenceable, since it could be referenced in an instantiation if Ekind (E) = E_Generic_Package then return True; end if; -- Otherwise look up the scope stack S := Scope (Ent); loop if Is_Package (S) then return Is_Library_Level_Entity (S); elsif Ekind (S) = E_Task_Type or else Ekind (S) = E_Protected_Type or else Ekind (S) = E_Entry then S := Scope (S); else return False; end if; end loop; end Publicly_Referenceable; -- Start of processing for Check_References begin -- No messages if warnings are suppressed, or if we have detected -- any real errors so far (this last check avoids junk messages -- resulting from errors, e.g. a subunit that is not loaded). -- We also skip the messages if any subunits were not loaded (see -- comment in Sem_Ch10 to understand how this is set, and why it is -- necessary to suppress the warnings in this case). if Warning_Mode = Suppress or else Errors_Detected /= 0 or else Unloaded_Subunits then return; end if; -- Otherwise loop through entities, looking for suspicious stuff E1 := First_Entity (E); while Present (E1) loop -- We only look at source entities with warning flag off if Comes_From_Source (E1) and then not Warnings_Off (E1) then -- We are interested in variables and out parameters, but we -- exclude protected types, too complicated to worry about. if Ekind (E1) = E_Variable or else (Ekind (E1) = E_Out_Parameter and then not Is_Protected_Type (Current_Scope)) then -- Post warning if this object not assigned. Note that we -- do not consider the implicit initialization of an access -- type to be the assignment of a value for this purpose. -- If the entity is an out parameter of the current subprogram -- body, check the warning status of the parameter in the spec. if Ekind (E1) = E_Out_Parameter and then Present (Spec_Entity (E1)) and then Warnings_Off (Spec_Entity (E1)) then null; elsif Not_Source_Assigned (E1) then Output_Reference_Error ("& is never assigned a value?"); -- Deal with special case where this variable is hidden -- by a loop variable if Ekind (E1) = E_Variable and then Present (Hiding_Loop_Variable (E1)) then Error_Msg_Sloc := Sloc (E1); Error_Msg_N ("declaration hides &#?", Hiding_Loop_Variable (E1)); Error_Msg_N ("for loop implicitly declares loop variable?", Hiding_Loop_Variable (E1)); end if; goto Continue; end if; -- Check for unset reference, note that we exclude access -- types from this check, since access types do always have -- a null value, and that seems legitimate in this case. UR := Unset_Reference (E1); if Present (UR) then -- For access types, the only time we complain is when -- we have a dereference (of a null value) if Is_Access_Type (Etype (E1)) then PU := Parent (UR); if (Nkind (PU) = N_Selected_Component or else Nkind (PU) = N_Explicit_Dereference or else Nkind (PU) = N_Indexed_Component) and then Prefix (PU) = UR then Error_Msg_N ("& may be null?", UR); goto Continue; end if; -- For other than access type, go back to original node -- to deal with case where original unset reference -- has been rewritten during expansion. else UR := Original_Node (UR); -- In some cases, the original node may be a type -- conversion or qualification, and in this case -- we want the object entity inside. while Nkind (UR) = N_Type_Conversion or else Nkind (UR) = N_Qualified_Expression loop UR := Expression (UR); end loop; Error_Msg_N ("& may be referenced before it has a value?", UR); goto Continue; end if; end if; end if; -- Then check for unreferenced variables if Check_Unreferenced -- Check entity is flagged as not referenced and that -- warnings are not suppressed for this entity and then not Referenced (E1) and then not Warnings_Off (E1) -- Warnings are placed on objects, types, subprograms, -- labels, and enumeration literals. and then (Is_Object (E1) or else Is_Type (E1) or else Ekind (E1) = E_Label or else Ekind (E1) = E_Named_Integer or else Ekind (E1) = E_Named_Real or else Is_Overloadable (E1)) -- We only place warnings for the main unit and then In_Extended_Main_Source_Unit (E1) -- Exclude instantiations, since there is no reason why -- every entity in an instantiation should be referenced. and then Instantiation_Location (Sloc (E1)) = No_Location -- Exclude formal parameters from bodies (in the case -- where there is a separate spec, it is the spec formals -- that are of interest). and then (not Is_Formal (E1) or else Ekind (Scope (E1)) /= E_Subprogram_Body) -- Consider private type referenced if full view is -- referenced. and then not (Is_Private_Type (E1) and then Referenced (Full_View (E1))) -- Don't worry about full view, only about private type and then not Has_Private_Declaration (E1) -- Eliminate dispatching operations from consideration, we -- cannot tell if these are referenced or not in any easy -- manner (note this also catches Adjust/Finalize/Initialize) and then not Is_Dispatching_Operation (E1) -- Check entity that can be publicly referenced (we do not -- give messages for such entities, since there could be -- other units, not involved in this compilation, that -- contain relevant references. and then not Publicly_Referenceable (E1) -- Class wide types are marked as source entities, but -- they are not really source entities, and are always -- created, so we do not care if they are not referenced. and then Ekind (E1) /= E_Class_Wide_Type -- Objects other than parameters of task types are allowed -- to be non-referenced, since they start up tasks! and then ((Ekind (E1) /= E_Variable and then Ekind (E1) /= E_Constant and then Ekind (E1) /= E_Component) or else not Is_Task_Type (Etype (E1))) then -- Suppress warnings in internal units if not in -gnatg -- mode (these would be junk warnings for an applications -- program, since they refer to problems in internal units) if GNAT_Mode or else not Is_Internal_File_Name (Unit_File_Name (Get_Source_Unit (E1))) then -- We do not immediately flag the error. This is because -- we have not expanded generic bodies yet, and they may -- have the missing reference. So instead we park the -- entity on a list, for later processing. However, for -- the accept case, post the error right here, since we -- have the information now in this case. if Present (Anod) then Output_Reference_Error ("& is not referenced?"); else Unreferenced_Entities.Increment_Last; Unreferenced_Entities.Table (Unreferenced_Entities.Last) := E1; end if; end if; end if; end if; -- Recurse into nested package or block <<Continue>> if (Ekind (E1) = E_Package and then Nkind (Parent (E1)) = N_Package_Specification) or else Ekind (E1) = E_Block then Check_References (E1); end if; Next_Entity (E1); end loop; end Check_References; --------------------------- -- Check_Unset_Reference -- --------------------------- procedure Check_Unset_Reference (N : Node_Id) is begin -- Nothing to do if warnings suppressed if Warning_Mode = Suppress then return; end if; -- Otherwise see what kind of node we have. If the entity already -- has an unset reference, it is not necessarily the earliest in -- the text, because resolution of the prefix of selected components -- is completed before the resolution of the selected component itself. -- as a result, given (R /= null and then R.X > 0), the occurrences -- of R are examined in right-to-left order. If there is already an -- unset reference, we check whether N is earlier before proceeding. case Nkind (N) is when N_Identifier | N_Expanded_Name => declare E : constant Entity_Id := Entity (N); begin if (Ekind (E) = E_Variable or else Ekind (E) = E_Out_Parameter) and then Not_Source_Assigned (E) and then (No (Unset_Reference (E)) or else Earlier_In_Extended_Unit (Sloc (N), Sloc (Unset_Reference (E)))) and then not Warnings_Off (E) then -- Here we have a potential unset reference. But before we -- get worried about it, we have to make sure that the -- entity declaration is in the same procedure as the -- reference, since if they are in separate procedures, -- then we have no idea about sequential execution. -- The tests in the loop below catch all such cases, but -- do allow the reference to appear in a loop, block, or -- package spec that is nested within the declaring scope. -- As always, it is possible to construct cases where the -- warning is wrong, that is why it is a warning! -- If the entity is an out_parameter, it is ok to read its -- its discriminants (that was true in Ada83) so suppress -- the message in that case as well. if Ekind (E) = E_Out_Parameter and then Nkind (Parent (N)) = N_Selected_Component and then Ekind (Entity (Selector_Name (Parent (N)))) = E_Discriminant then return; end if; declare SR : Entity_Id; SE : constant Entity_Id := Scope (E); begin SR := Current_Scope; while SR /= SE loop if SR = Standard_Standard or else Is_Subprogram (SR) or else Is_Concurrent_Body (SR) or else Is_Concurrent_Type (SR) then return; end if; SR := Scope (SR); end loop; if Nkind (N) = N_Identifier then Set_Unset_Reference (E, N); else Set_Unset_Reference (E, Selector_Name (N)); end if; end; end if; end; when N_Indexed_Component | N_Selected_Component | N_Slice => Check_Unset_Reference (Prefix (N)); return; when N_Type_Conversion | N_Qualified_Expression => Check_Unset_Reference (Expression (N)); when others => null; end case; end Check_Unset_Reference; ------------------------ -- Check_Unused_Withs -- ------------------------ procedure Check_Unused_Withs (Spec_Unit : Unit_Number_Type := No_Unit) is Cnode : Node_Id; Item : Node_Id; Lunit : Node_Id; Ent : Entity_Id; Munite : constant Entity_Id := Cunit_Entity (Main_Unit); -- This is needed for checking the special renaming case procedure Check_One_Unit (Unit : Unit_Number_Type); -- Subsidiary procedure, performs checks for specified unit -------------------- -- Check_One_Unit -- -------------------- procedure Check_One_Unit (Unit : Unit_Number_Type) is Is_Visible_Renaming : Boolean := False; Pack : Entity_Id; function Find_Package_Renaming (P : Entity_Id; L : Entity_Id) return Entity_Id; -- The only reference to a context unit may be in a renaming -- declaration. If this renaming declares a visible entity, do -- not warn that the context clause could be moved to the body, -- because the renaming may be intented to re-export the unit. --------------------------- -- Find_Package_Renaming -- --------------------------- function Find_Package_Renaming (P : Entity_Id; L : Entity_Id) return Entity_Id is E1 : Entity_Id; R : Entity_Id; begin Is_Visible_Renaming := False; E1 := First_Entity (P); while Present (E1) loop if Ekind (E1) = E_Package and then Renamed_Object (E1) = L then Is_Visible_Renaming := not Is_Hidden (E1); return E1; elsif Ekind (E1) = E_Package and then No (Renamed_Object (E1)) and then not Is_Generic_Instance (E1) then R := Find_Package_Renaming (E1, L); if Present (R) then Is_Visible_Renaming := not Is_Hidden (R); return R; end if; end if; Next_Entity (E1); end loop; return Empty; end Find_Package_Renaming; -- Start of processing for Check_One_Unit begin Cnode := Cunit (Unit); -- Only do check in units that are part of the extended main -- unit. This is actually a necessary restriction, because in -- the case of subprogram acting as its own specification, -- there can be with's in subunits that we will not see. if not In_Extended_Main_Source_Unit (Cnode) then return; -- In No_Run_Time_Mode, we remove the bodies of non- -- inlined subprograms, which may lead to spurious -- warnings, clearly undesirable. elsif No_Run_Time and then Is_Predefined_File_Name (Unit_File_Name (Unit)) then return; end if; -- Loop through context items in this unit Item := First (Context_Items (Cnode)); while Present (Item) loop if Nkind (Item) = N_With_Clause and then not Implicit_With (Item) and then In_Extended_Main_Source_Unit (Item) then Lunit := Entity (Name (Item)); -- Check if this unit is referenced if not Referenced (Lunit) then -- Suppress warnings in internal units if not in -gnatg -- mode (these would be junk warnings for an applications -- program, since they refer to problems in internal units) if GNAT_Mode or else not Is_Internal_File_Name (Unit_File_Name (Unit)) then -- Here we definitely have a non-referenced unit. If -- it is the special call for a spec unit, then just -- set the flag to be read later. if Unit = Spec_Unit then Set_Unreferenced_In_Spec (Item); -- Otherwise simple unreferenced message else Error_Msg_N ("unit& is not referenced?", Name (Item)); end if; end if; -- If main unit is a renaming of this unit, then we consider -- the with to be OK (obviously it is needed in this case!) elsif Present (Renamed_Entity (Munite)) and then Renamed_Entity (Munite) = Lunit then null; -- If this unit is referenced, and it is a package, we -- do another test, to see if any of the entities in the -- package are referenced. If none of the entities are -- referenced, we still post a warning. This occurs if -- the only use of the package is in a use clause, or -- in a package renaming declaration. elsif Ekind (Lunit) = E_Package then -- If Is_Instantiated is set, it means that the package -- is implicitly instantiated (this is the case of a -- parent instance or an actual for a generic package -- formal), and this counts as a reference. if Is_Instantiated (Lunit) then null; -- If no entities in package, and there is a pragma -- Elaborate_Body present, then assume that this with -- is done for purposes of this elaboration. elsif No (First_Entity (Lunit)) and then Has_Pragma_Elaborate_Body (Lunit) then null; -- Otherwise see if any entities have been referenced else Ent := First_Entity (Lunit); loop -- No more entities, and we did not find one -- that was referenced. Means we have a definite -- case of a with none of whose entities was -- referenced. if No (Ent) then -- If in spec, just set the flag if Unit = Spec_Unit then Set_No_Entities_Ref_In_Spec (Item); -- Else give the warning else Error_Msg_N ("no entities of & are referenced?", Name (Item)); -- Look for renamings of this package, and -- flag them as well. If the original package -- has warnings off, we suppress the warning -- on the renaming as well. Pack := Find_Package_Renaming (Munite, Lunit); if Present (Pack) and then not Warnings_Off (Lunit) then Error_Msg_NE ("no entities of & are referenced?", Unit_Declaration_Node (Pack), Pack); end if; end if; exit; -- Case of next entity is referenced elsif Referenced (Ent) then -- This means that the with is indeed fine, in -- that it is definitely needed somewhere, and -- we can quite worrying about this one. -- Except for one little detail, if either of -- the flags was set during spec processing, -- this is where we complain that the with -- could be moved from the spec. If the spec -- contains a visible renaming of the package, -- inhibit warning to move with_clause to body. if Ekind (Munite) = E_Package_Body then Pack := Find_Package_Renaming (Spec_Entity (Munite), Lunit); end if; if Unreferenced_In_Spec (Item) then Error_Msg_N ("unit& is not referenced in spec?", Name (Item)); elsif No_Entities_Ref_In_Spec (Item) then Error_Msg_N ("no entities of & are referenced in spec?", Name (Item)); else exit; end if; if not Is_Visible_Renaming then Error_Msg_N ("\with clause might be moved to body?", Name (Item)); end if; exit; -- Move to next entity to continue search else Next_Entity (Ent); end if; end loop; end if; -- For a generic package, the only interesting kind of -- reference is an instantiation, since entities cannot -- be referenced directly. elsif Is_Generic_Unit (Lunit) then -- Unit was never instantiated, set flag for case of spec -- call, or give warning for normal call. if not Is_Instantiated (Lunit) then if Unit = Spec_Unit then Set_Unreferenced_In_Spec (Item); else Error_Msg_N ("unit& is never instantiated?", Name (Item)); end if; -- If unit was indeed instantiated, make sure that -- flag is not set showing it was uninstantiated in -- the spec, and if so, give warning. elsif Unreferenced_In_Spec (Item) then Error_Msg_N ("unit& is not instantiated in spec?", Name (Item)); Error_Msg_N ("\with clause can be moved to body?", Name (Item)); end if; end if; end if; Next (Item); end loop; end Check_One_Unit; -- Start of processing for Check_Unused_Withs begin if not Opt.Check_Withs or else Operating_Mode = Check_Syntax then return; end if; -- Flag any unused with clauses, but skip this step if we are -- compiling a subunit on its own, since we do not have enough -- information to determine whether with's are used. We will get -- the relevant warnings when we compile the parent. This is the -- normal style of GNAT compilation in any case. if Nkind (Unit (Cunit (Main_Unit))) = N_Subunit then return; end if; -- Process specified units if Spec_Unit = No_Unit then -- For main call, check all units for Unit in Main_Unit .. Last_Unit loop Check_One_Unit (Unit); end loop; else -- For call for spec, check only the spec Check_One_Unit (Spec_Unit); end if; end Check_Unused_Withs; ---------------------------------- -- Output_Unreferenced_Messages -- ---------------------------------- procedure Output_Unreferenced_Messages is E : Entity_Id; begin for J in Unreferenced_Entities.First .. Unreferenced_Entities.Last loop E := Unreferenced_Entities.Table (J); if not Referenced (E) and then not Warnings_Off (E) then case Ekind (E) is when E_Variable => if Present (Renamed_Object (E)) and then Comes_From_Source (Renamed_Object (E)) then Error_Msg_N ("renamed variable & is not referenced?", E); else Error_Msg_N ("variable & is not referenced?", E); end if; when E_Constant => if Present (Renamed_Object (E)) and then Comes_From_Source (Renamed_Object (E)) then Error_Msg_N ("renamed constant & is not referenced?", E); else Error_Msg_N ("constant & is not referenced?", E); end if; when E_In_Parameter | E_Out_Parameter | E_In_Out_Parameter => -- Do not emit message for formals of a renaming, because -- they are never referenced explicitly. if Nkind (Original_Node (Unit_Declaration_Node (Scope (E)))) /= N_Subprogram_Renaming_Declaration then Error_Msg_N ("formal parameter & is not referenced?", E); end if; when E_Named_Integer | E_Named_Real => Error_Msg_N ("named number & is not referenced?", E); when E_Enumeration_Literal => Error_Msg_N ("literal & is not referenced?", E); when E_Function => Error_Msg_N ("function & is not referenced?", E); when E_Procedure => Error_Msg_N ("procedure & is not referenced?", E); when Type_Kind => Error_Msg_N ("type & is not referenced?", E); when others => Error_Msg_N ("& is not referenced?", E); end case; Set_Warnings_Off (E); end if; end loop; end Output_Unreferenced_Messages; ----------------------------- -- Warn_On_Known_Condition -- ----------------------------- procedure Warn_On_Known_Condition (C : Node_Id) is P : Node_Id; begin if Constant_Condition_Warnings and then Nkind (C) = N_Identifier and then (Entity (C) = Standard_False or else Entity (C) = Standard_True) and then Comes_From_Source (Original_Node (C)) and then not In_Instance then -- See if this is in a statement or a declaration P := Parent (C); loop -- If tree is not attached, do not issue warning (this is very -- peculiar, and probably arises from some other error condition) if No (P) then return; -- If we are in a declaration, then no warning, since in practice -- conditionals in declarations are used for intended tests which -- may be known at compile time, e.g. things like -- x : constant Integer := 2 + (Word'Size = 32); -- And a warning is annoying in such cases elsif Nkind (P) in N_Declaration or else Nkind (P) in N_Later_Decl_Item then return; -- Don't warn in assert pragma, since presumably tests in such -- a context are very definitely intended, and might well be -- known at compile time. Note that we have to test the original -- node, since assert pragmas get rewritten at analysis time. elsif Nkind (Original_Node (P)) = N_Pragma and then Chars (Original_Node (P)) = Name_Assert then return; end if; exit when Is_Statement (P); P := Parent (P); end loop; if Entity (C) = Standard_True then Error_Msg_N ("condition is always True?", C); else Error_Msg_N ("condition is always False?", C); end if; end if; end Warn_On_Known_Condition; end Sem_Warn;
------------------------------------------------------------------------------ -- -- -- 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.Elements.Generic_Hash; function AMF.OCL.Collection_Items.Hash is new AMF.Elements.Generic_Hash (OCL_Collection_Item, OCL_Collection_Item_Access);
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . W I D E _ W I D E _ T E X T _ I O . G E N E R I C _ A U X -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package contains a set of auxiliary routines used by Wide_Wide_Text_IO -- generic children, including for reading and writing numeric strings. -- Note: although this is the Wide version of the package, the interface here -- is still in terms of Character and String rather than Wide_Wide_Character -- and Wide_Wide_String, since all numeric strings are composed entirely of -- characters in the range of type Standard.Character, and the basic -- conversion routines work with Character rather than Wide_Wide_Character. package Ada.Wide_Wide_Text_IO.Generic_Aux is -- Note: for all the Load routines, File indicates the file to be read, -- Buf is the string into which data is stored, Ptr is the index of the -- last character stored so far, and is updated if additional characters -- are stored. Data_Error is raised if the input overflows Buf. The only -- Load routines that do a file status check are Load_Skip and Load_Width -- so one of these two routines must be called first. procedure Check_End_Of_Field (Buf : String; Stop : Integer; Ptr : Integer; Width : Field); -- This routine is used after doing a get operations on a numeric value. -- Buf is the string being scanned, and Stop is the last character of -- the field being scanned. Ptr is as set by the call to the scan routine -- that scanned out the numeric value, i.e. it points one past the last -- character scanned, and Width is the width parameter from the Get call. -- -- There are two cases, if Width is non-zero, then a check is made that -- the remainder of the field is all blanks. If Width is zero, then it -- means that the scan routine scanned out only part of the field. We -- have already scanned out the field that the ACVC tests seem to expect -- us to read (even if it does not follow the syntax of the type being -- scanned, e.g. allowing negative exponents in integers, and underscores -- at the end of the string), so we just raise Data_Error. procedure Check_On_One_Line (File : File_Type; Length : Integer); -- Check to see if item of length Integer characters can fit on -- current line. Call New_Line if not, first checking that the -- line length can accommodate Length characters, raise Layout_Error -- if item is too large for a single line. function Is_Blank (C : Character) return Boolean; -- Determines if C is a blank (space or tab) procedure Load_Width (File : File_Type; Width : Field; Buf : out String; Ptr : in out Integer); -- Loads exactly Width characters, unless a line mark is encountered first procedure Load_Skip (File : File_Type); -- Skips leading blanks and line and page marks, if the end of file is -- read without finding a non-blank character, then End_Error is raised. -- Note: a blank is defined as a space or horizontal tab (RM A.10.6(5)). procedure Load (File : File_Type; Buf : out String; Ptr : in out Integer; Char : Character; Loaded : out Boolean); -- If next character is Char, loads it, otherwise no characters are loaded -- Loaded is set to indicate whether or not the character was found. procedure Load (File : File_Type; Buf : out String; Ptr : in out Integer; Char : Character); -- Same as above, but no indication if character is loaded procedure Load (File : File_Type; Buf : out String; Ptr : in out Integer; Char1 : Character; Char2 : Character; Loaded : out Boolean); -- If next character is Char1 or Char2, loads it, otherwise no characters -- are loaded. Loaded is set to indicate whether or not one of the two -- characters was found. procedure Load (File : File_Type; Buf : out String; Ptr : in out Integer; Char1 : Character; Char2 : Character); -- Same as above, but no indication if character is loaded procedure Load_Digits (File : File_Type; Buf : out String; Ptr : in out Integer; Loaded : out Boolean); -- Loads a sequence of zero or more decimal digits. Loaded is set if -- at least one digit is loaded. procedure Load_Digits (File : File_Type; Buf : out String; Ptr : in out Integer); -- Same as above, but no indication if character is loaded procedure Load_Extended_Digits (File : File_Type; Buf : out String; Ptr : in out Integer; Loaded : out Boolean); -- Like Load_Digits, but also allows extended digits a-f and A-F procedure Load_Extended_Digits (File : File_Type; Buf : out String; Ptr : in out Integer); -- Same as above, but no indication if character is loaded procedure Put_Item (File : File_Type; Str : String); -- This routine is like Wide_Wide_Text_IO.Put, except that it checks for -- overflow of bounded lines, as described in (RM A.10.6(8)). It is used -- for all output of numeric values and of enumeration values. Note that -- the buffer is of type String. Put_Item deals with converting this to -- Wide_Wide_Characters as required. procedure Store_Char (File : File_Type; ch : Integer; Buf : out String; Ptr : in out Integer); -- Store a single character in buffer, checking for overflow and -- adjusting the column number in the file to reflect the fact -- that a character has been acquired from the input stream. -- The pos value of the character to store is in ch on entry. procedure String_Skip (Str : String; Ptr : out Integer); -- Used in the Get from string procedures to skip leading blanks in the -- string. Ptr is set to the index of the first non-blank. If the string -- is all blanks, then the excption End_Error is raised, Note that blank -- is defined as a space or horizontal tab (RM A.10.6(5)). procedure Ungetc (ch : Integer; File : File_Type); -- Pushes back character into stream, using ungetc. The caller has -- checked that the file is in read status. Device_Error is raised -- if the character cannot be pushed back. An attempt to push back -- an end of file (EOF) is ignored. private pragma Inline (Is_Blank); end Ada.Wide_Wide_Text_IO.Generic_Aux;
-- -- Copyright (C) 2015-2016 secunet Security Networks AG -- -- 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 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. -- package HW.GFX.GMA.PCH.FDI is type Training_Pattern is (TP_1, TP_2, TP_Idle, TP_None); procedure Pre_Train (Port : PCH.FDI_Port_Type; Port_Cfg : Port_Config); procedure Train (Port : in PCH.FDI_Port_Type; TP : in Training_Pattern; Success : out Boolean); procedure Auto_Train (Port : PCH.FDI_Port_Type); procedure Enable_EC (Port : PCH.FDI_Port_Type); type Off_Type is (Rx_Off, Lanes_Off, Clock_Off); procedure Off (Port : PCH.FDI_Port_Type; OT : Off_Type); end HW.GFX.GMA.PCH.FDI;
package body Bluetooth_Low_Energy is --------------- -- Make_UUID -- --------------- function Make_UUID (UUID : UInt16) return BLE_UUID is begin return (Kind => UUID_16bits, UUID_16 => UUID); end Make_UUID; --------------- -- Make_UUID -- --------------- function Make_UUID (UUID : UInt32) return BLE_UUID is begin return (Kind => UUID_32bits, UUID_32 => UUID); end Make_UUID; --------------- -- Make_UUID -- --------------- function Make_UUID (UUID : BLE_16UInt8s_UUID) return BLE_UUID is begin return (Kind => UUID_16UInt8s, UUID_16_UInt8s => UUID); end Make_UUID; end Bluetooth_Low_Energy;
with Ada.Text_IO; with Ada.Numerics.Float_Random; use Ada.Numerics.Float_Random; with get_rod_absorption; with rod_control; use rod_control; with types; with signal; use signal; procedure Main is use types; Choice : Float; -- Random Number Choice (0 to 1) G : Generator; -- Random Number Generator Temp_Potential : Kilojoule := 0.001; -- Temperature potential is the total neutron energy in the system Temperature : Kilojoule := 0.000; -- Temperature is the absolute energy in the system (not inc neutrons) Output : Kilojoule := 0.0; Control_Rods : Rod_Array; Absorption : Percent; Input : String (1 .. 10); Last : Natural; Sigint : Boolean := False; Term : Boolean := False; task Sig_Handler; task body Sig_Handler is begin Handler.Wait; if not Term then Sigint := True; Ada.Text_IO.Put_Line("Exit Control Signal Received. Shutting down reactor..."); for i in (Index) loop Control_Rods(i) := 1.0; end loop; while Temperature > 0.0 and not Term loop null; end loop; Ada.Text_IO.Put_Line("Shutdown Success"); Term := True; end if; end Sig_Handler; begin Reset(G); for i in (Index) loop Control_Rods(i) := 0.0; end loop; Outer_Loop: while not Term loop -- Ignore AI input for manual shutdown if not Sigint then callback(Control_Rods, Temperature, Output); end if; Choice := Random(G); if Choice <= 0.03 then -- Temperature potential quadruples this second Temp_Potential := Temp_Potential * 4; elsif Choice < 0.97 then -- Temperature potential doubles each second Temp_Potential := Temp_Potential * 2; end if; -- Otherwise Temperature doesn't change -- Apply control rod modifier Absorption := get_rod_absorption(Control_Rods); Temp_Potential := Temp_Potential * Kilojoule (1.0 - Absorption); -- Apply Temperature Potential to Temperature Temperature := Temperature + Temp_Potential; -- 5% of Temperature dissipates each second Output := Temperature * 0.05; Temperature := Temperature * 0.95; Ada.Text_IO.Put_Line ("Heat is" & Kilojoule'Image(Temperature) & "KJ, Output of" & Kilojoule'Image(Output) & "KJ/s"); delay 1.0; if Temperature >= 750.000 then Ada.Text_IO.Put_Line ("FATAL: Heat is above hard limit of 750KJ."); Ada.Text_IO.Put_Line (" Plant should be evacuated."); exit Outer_Loop; elsif Temperature >= 500.000 then Ada.Text_IO.Put_Line ("Warning: Heat is above safety limit of 500KJ."); elsif Temperature = 0.000 and not Sigint then Ada.Text_IO.Put_Line ("Warning: Reactor heat is at 0KJ"); loop Ada.Text_IO.Put (" Would you like to resart? (Y/N) "); Ada.Text_IO.Get_Line (Input, Last); exit Outer_Loop when Input (1) = 'N' or Input (1) = 'n'; exit when Input (1) = 'Y' or Input (1) = 'y'; end loop; Ada.Text_IO.Put_Line (""); Temp_Potential := 0.001; end if; end loop Outer_Loop; Term := True; end Main;
-- This spec has been automatically generated from STM32L0x3.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.PWR is pragma Preelaborate; --------------- -- Registers -- --------------- subtype CR_PLS_Field is HAL.UInt3; subtype CR_VOS_Field is HAL.UInt2; -- power control register type CR_Register is record -- Low-power deep sleep LPDS : Boolean := False; -- Power down deepsleep PDDS : Boolean := False; -- Clear wakeup flag CWUF : Boolean := False; -- Clear standby flag CSBF : Boolean := False; -- Power voltage detector enable PVDE : Boolean := False; -- PVD level selection PLS : CR_PLS_Field := 16#0#; -- Disable backup domain write protection DBP : Boolean := False; -- Ultra-low-power mode ULP : Boolean := False; -- Fast wakeup FWU : Boolean := False; -- Voltage scaling range selection VOS : CR_VOS_Field := 16#2#; -- Deep sleep mode with Flash memory kept off DS_EE_KOFF : Boolean := False; -- Low power run mode LPRUN : Boolean := False; -- unspecified Reserved_15_31 : HAL.UInt17 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR_Register use record LPDS at 0 range 0 .. 0; PDDS at 0 range 1 .. 1; CWUF at 0 range 2 .. 2; CSBF at 0 range 3 .. 3; PVDE at 0 range 4 .. 4; PLS at 0 range 5 .. 7; DBP at 0 range 8 .. 8; ULP at 0 range 9 .. 9; FWU at 0 range 10 .. 10; VOS at 0 range 11 .. 12; DS_EE_KOFF at 0 range 13 .. 13; LPRUN at 0 range 14 .. 14; Reserved_15_31 at 0 range 15 .. 31; end record; -- power control/status register type CSR_Register is record -- Read-only. Wakeup flag WUF : Boolean := False; -- Read-only. Standby flag SBF : Boolean := False; -- Read-only. PVD output PVDO : Boolean := False; -- Read-only. Backup regulator ready BRR : Boolean := False; -- Read-only. Voltage Scaling select flag VOSF : Boolean := False; -- Read-only. Regulator LP flag REGLPF : Boolean := False; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; -- Enable WKUP pin EWUP : Boolean := False; -- Backup regulator enable BRE : Boolean := False; -- unspecified Reserved_10_31 : HAL.UInt22 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CSR_Register use record WUF at 0 range 0 .. 0; SBF at 0 range 1 .. 1; PVDO at 0 range 2 .. 2; BRR at 0 range 3 .. 3; VOSF at 0 range 4 .. 4; REGLPF at 0 range 5 .. 5; Reserved_6_7 at 0 range 6 .. 7; EWUP at 0 range 8 .. 8; BRE at 0 range 9 .. 9; Reserved_10_31 at 0 range 10 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Power control type PWR_Peripheral is record -- power control register CR : aliased CR_Register; -- power control/status register CSR : aliased CSR_Register; end record with Volatile; for PWR_Peripheral use record CR at 16#0# range 0 .. 31; CSR at 16#4# range 0 .. 31; end record; -- Power control PWR_Periph : aliased PWR_Peripheral with Import, Address => System'To_Address (16#40007000#); end STM32_SVD.PWR;
-- Abstract: -- -- Stack implementation. -- -- Copyright (C) 1998-2000, 2002-2003, 2009, 2015, 2017 - 2019 Free Software Foundation, Inc. -- -- SAL is free software; you can redistribute it and/or modify it -- under terms of the GNU General Public License as published by the -- Free Software Foundation; either version 3, or (at your option) -- any later version. SAL is distributed in the hope that it will be -- useful, but WITHOUT ANY WARRANTY; without even the implied -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- See the GNU General Public License for more details. You should -- have received a copy of the GNU General Public License distributed -- with SAL; see file COPYING. If not, write to the Free Software -- Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -- USA. -- -- As a special exception 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 Ada.Finalization; with Ada.Iterator_Interfaces; with Ada.Unchecked_Deallocation; generic type Element_Type is private; package SAL.Gen_Unbounded_Definite_Stacks is package Sguds renames SAL.Gen_Unbounded_Definite_Stacks; type Stack is new Ada.Finalization.Controlled with private with Constant_Indexing => Constant_Reference, Default_Iterator => Iterate, Iterator_Element => Element_Type; Empty_Stack : constant Stack; overriding procedure Finalize (Stack : in out Sguds.Stack); overriding procedure Adjust (Stack : in out Sguds.Stack); overriding function "=" (Left, Right : in Sguds.Stack) return Boolean; procedure Clear (Stack : in out Sguds.Stack); -- Empty Stack of all items. function Depth (Stack : in Sguds.Stack) return Base_Peek_Type; -- Returns current count of items in the Stack function Is_Empty (Stack : in Sguds.Stack) return Boolean; -- Returns true iff no items are in Stack. function Peek (Stack : in Sguds.Stack; Index : in Peek_Type := 1) return Element_Type with Inline; -- Return the Index'th item from the top of Stack; the Item is _not_ removed. -- Top item has index 1. -- -- Raises Constraint_Error if Index > Depth. -- -- See also Constant_Ref, implicit indexing procedure Pop (Stack : in out Sguds.Stack; Count : in Base_Peek_Type := 1); -- Remove Count Items from the top of Stack, discard them. -- -- Raises Container_Empty if there are fewer than Count items on -- Stack. function Pop (Stack : in out Sguds.Stack) return Element_Type; -- Remove Item from the top of Stack, and return it. -- -- Raises Container_Empty if Is_Empty. procedure Push (Stack : in out Sguds.Stack; Item : in Element_Type); -- Add Item to the top of Stack. -- -- May raise Container_Full. function Top (Stack : in Sguds.Stack) return Element_Type; -- Return the item at the top of Stack; the Item is _not_ removed. -- Same as Peek (Stack, 1). -- -- Raises Container_Empty if Is_Empty. procedure Set_Depth (Stack : in out Sguds.Stack; Depth : in Peek_Type); -- Empty Stack, set its Depth to Depth. Must be followed by Set -- for each element. -- -- Useful when creating a stack from pre-existing data. procedure Set (Stack : in out Sguds.Stack; Index : in Peek_Type; Depth : in Peek_Type; Element : in Element_Type); -- Set a Stack element. Index is the same as Peek Index; Depth is -- used to compute the index in the underlying array. -- -- Stack must have been initialized by Set_Depth. -- -- Useful when creating a stack from pre-existing data. type Constant_Reference_Type (Element : not null access constant Element_Type) is private with Implicit_Dereference => Element; function Constant_Reference (Container : aliased in Stack'Class; Position : in Peek_Type) return Constant_Reference_Type with Inline; type Cursor is private; function Constant_Reference (Container : aliased in Stack'Class; Position : in Cursor) return Constant_Reference_Type with Inline; function Has_Element (Position : in Cursor) return Boolean; package Iterator_Interfaces is new Ada.Iterator_Interfaces (Cursor, Has_Element); function Iterate (Container : aliased in Stack) return Iterator_Interfaces.Forward_Iterator'Class; private type Element_Array is array (Peek_Type range <>) of aliased Element_Type; type Element_Array_Access is access Element_Array; procedure Free is new Ada.Unchecked_Deallocation (Element_Array, Element_Array_Access); type Stack is new Ada.Finalization.Controlled with record Top : Base_Peek_Type := Invalid_Peek_Index; -- empty Data : Element_Array_Access; -- Top of stack is at Data (Top). -- Data (1 .. Top) has been set at some point. end record; type Stack_Access is access all Stack; type Constant_Reference_Type (Element : not null access constant Element_Type) is record Dummy : Integer := raise Program_Error with "uninitialized reference"; end record; Empty_Stack : constant Stack := (Ada.Finalization.Controlled with Invalid_Peek_Index, null); type Cursor is record Container : Stack_Access; Ptr : Peek_Type; end record; type Iterator is new Iterator_Interfaces.Forward_Iterator with record Container : Stack_Access; end record; overriding function First (Object : Iterator) return Cursor; overriding function Next (Object : Iterator; Position : Cursor) return Cursor; end SAL.Gen_Unbounded_Definite_Stacks;
-- Copyright (c) 2021 Devin Hill -- zlib License -- see LICENSE for details. with System.Parameters; package body System.Allocation.Arenas is use SSE; use all type System.Parameters.Size_Type; procedure Allocate (Pool : in out Heap_Arena; Storage_Address : out System.Address; Storage_Size : Storage_Count; Alignment : Storage_Count) is Align_Mask : constant Address := Address (Alignment - 1); Aligned_Address : constant Address := (Pool.Top_Address + Align_Mask) and not Align_Mask; begin Storage_Address := Aligned_Address; Pool.Top_Address := Aligned_Address + Storage_Size; if Pool.Top_Address > Pool.End_Address then raise Storage_Error; end if; end Allocate; function Storage_Size (Pool : Heap_Arena) return Storage_Count is (Storage_Count'(Pool.End_Address - Pool.Start_Address)); function Mark (Pool : Heap_Arena) return Marker is (Marker (Pool.Top_Address)); procedure Release (Pool : in out Heap_Arena; Mark : Marker) is begin Pool.Top_Address := Address (Mark); end Release; procedure Allocate (Pool : in out Local_Arena; Storage_Address : out System.Address; Storage_Size : Storage_Count; Alignment : Storage_Count) is begin Allocate (Pool.Heap, Storage_Address, Storage_Size, Alignment); end Allocate; function Storage_Size (Pool : Local_Arena) return Storage_Count is (Storage_Size (Pool.Heap)); function Mark (Pool : Local_Arena) return Marker is (Mark (Pool.Heap)); procedure Release (Pool : in out Local_Arena; Mark : Marker) is begin Release (Pool.Heap, Mark); end Release; function Create_Arena (Start_Address, End_Address : Address) return Heap_Arena is pragma Assert (End_Address >= Start_Address); begin return Heap_Arena' (Top_Address | Start_Address => Start_Address, End_Address => End_Address); end Create_Arena; function Create_Arena (Local_Size : Storage_Count) return Local_Arena is begin return A : Local_Arena (Local_Size) do Init_Arena (A); end return; end Create_Arena; procedure Init_Arena (Pool : in out Local_Arena) is begin Pool.Heap.Top_Address := Pool.Storage'Address; Pool.Heap.Start_Address := Pool.Storage'Address; Pool.Heap.End_Address := Pool.Storage'Address + Pool.Size; end Init_Arena; end System.Allocation.Arenas;
package body Max with SPARK_Mode is function Arrays_Max (A : in Our_Array) return Index_Range is X : Index_Range := Index_Range'First; Y : Index_Range := Index_Range'Last; function max (L, R : Content_Range) return Content_Range is (if L > R then L else R) with Ghost; begin while X /= Y loop -- Write a suitable Loop_Invariant to help prove the postcondition -- Write a suitable Loop_Variant to help prove loop termination pragma Loop_Invariant ( -- for all values up to X, the value is <= the larger of the value at -- x and the value at y (for all k in Index_Range'first .. X => max (a (x), a (y)) >= a(k) ) and -- for all values down to Y, the value is <= the larger of the value -- at x and the value at y (for all k in Y .. Index_Range'last => max (a (x), a (y)) >= a(k) ) and ( X < Y ) ); pragma Loop_Variant (decreases => Y - X); if A (X) <= A (Y) then X := X + 1; else Y := Y - 1; end if; end loop; return X; end Arrays_Max; end Max;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Web API Definition -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014-2018, 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 is root package to expose WebGL API to Ada applications. ------------------------------------------------------------------------------ with Interfaces; package WebAPI.WebGL is pragma Preelaborate; type GLboolean is new Interfaces.Unsigned_8; type GLenum is new Interfaces.Unsigned_32; type GLbitfield is new Interfaces.Unsigned_32; type GLint is new Interfaces.Integer_32; subtype GLsizei is GLint range 0 .. GLint'Last; type GLuint is new Interfaces.Unsigned_32; type GLfloat is new Interfaces.IEEE_Float_32; subtype GLclampf is GLfloat range 0.0 .. 1.0; type GLintptr is new Interfaces.Integer_64; type GLfloat_Vector_2 is array (Positive range 1 .. 2) of GLfloat; pragma JavaScript_Array_Buffer (GLfloat_Vector_2); type GLfloat_Vector_3 is array (Positive range 1 .. 3) of GLfloat; pragma JavaScript_Array_Buffer (GLfloat_Vector_3); type GLfloat_Vector_4 is array (Positive range 1 .. 4) of GLfloat; pragma JavaScript_Array_Buffer (GLfloat_Vector_4); type GLfloat_Matrix_2x2 is array (Positive range 1 .. 2, Positive range 1 .. 2) of GLfloat with Convention => Fortran; pragma JavaScript_Array_Buffer (GLfloat_Matrix_2x2); type GLfloat_Matrix_3x3 is array (Positive range 1 .. 3, Positive range 1 .. 3) of GLfloat with Convention => Fortran; pragma JavaScript_Array_Buffer (GLfloat_Matrix_3x3); type GLfloat_Matrix_4x4 is array (Positive range 1 .. 4, Positive range 1 .. 4) of GLfloat with Convention => Fortran; pragma JavaScript_Array_Buffer (GLfloat_Matrix_4x4); end WebAPI.WebGL;
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="15"> <syndb class_id="0" tracking_level="0" version="0"> <userIPLatency>-1</userIPLatency> <userIPName></userIPName> <cdfg class_id="1" tracking_level="1" version="0" object_id="_0"> <name>aes_main</name> <ret_bitwidth>32</ret_bitwidth> <ports class_id="2" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </ports> <nodes class_id="3" tracking_level="0" version="0"> <count>107</count> <item_version>0</item_version> <item class_id="4" tracking_level="1" version="0" object_id="_1"> <Value class_id="5" tracking_level="0" version="0"> <Obj class_id="6" tracking_level="0" version="0"> <type>0</type> <id>14</id> <name>0_write_ln83</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>83</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo class_id="7" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="8" tracking_level="0" version="0"> <first>G:\AES</first> <second class_id="9" tracking_level="0" version="0"> <count>1</count> <item_version>0</item_version> <item class_id="10" tracking_level="0" version="0"> <first class_id="11" tracking_level="0" version="0"> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>83</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>137</item> <item>140</item> </oprand_edges> <opcode>store</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>7</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_2"> <Value> <Obj> <type>0</type> <id>15</id> <name>1_write_ln84</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>84</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>84</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>142</item> <item>145</item> </oprand_edges> <opcode>store</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>8</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_3"> <Value> <Obj> <type>0</type> <id>16</id> <name>2_write_ln85</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>85</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>85</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>147</item> <item>150</item> </oprand_edges> <opcode>store</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>11</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_4"> <Value> <Obj> <type>0</type> <id>17</id> <name>3_write_ln86</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>86</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>86</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>152</item> <item>155</item> </oprand_edges> <opcode>store</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="4" object_id="_5"> <Value> <Obj> <type>0</type> <id>18</id> <name>4_write_ln87</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>87</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>87</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>157</item> <item>160</item> </oprand_edges> <opcode>store</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>15</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_6"> <Value> <Obj> <type>0</type> <id>19</id> <name>5_write_ln88</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>88</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>88</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>162</item> <item>165</item> </oprand_edges> <opcode>store</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="4" object_id="_7"> <Value> <Obj> <type>0</type> <id>20</id> <name>6_write_ln89</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>89</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>89</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>167</item> <item>170</item> </oprand_edges> <opcode>store</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>19</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_8"> <Value> <Obj> <type>0</type> <id>21</id> <name>7_write_ln90</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>90</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>90</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>172</item> <item>175</item> </oprand_edges> <opcode>store</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="4" object_id="_9"> <Value> <Obj> <type>0</type> <id>22</id> <name>8_write_ln91</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>91</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>91</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>177</item> <item>180</item> </oprand_edges> <opcode>store</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>23</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_10"> <Value> <Obj> <type>0</type> <id>23</id> <name>9_write_ln92</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>92</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>92</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>181</item> <item>184</item> </oprand_edges> <opcode>store</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>24</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_11"> <Value> <Obj> <type>0</type> <id>24</id> <name>10_write_ln93</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>93</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>93</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>186</item> <item>189</item> </oprand_edges> <opcode>store</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>27</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_12"> <Value> <Obj> <type>0</type> <id>25</id> <name>11_write_ln94</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>94</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>94</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>191</item> <item>194</item> </oprand_edges> <opcode>store</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>28</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_13"> <Value> <Obj> <type>0</type> <id>26</id> <name>12_write_ln95</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>95</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>95</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>196</item> <item>199</item> </oprand_edges> <opcode>store</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>31</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_14"> <Value> <Obj> <type>0</type> <id>27</id> <name>13_write_ln96</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>96</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>96</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>201</item> <item>204</item> </oprand_edges> <opcode>store</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>32</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_15"> <Value> <Obj> <type>0</type> <id>28</id> <name>14_write_ln97</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>97</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>97</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>206</item> <item>209</item> </oprand_edges> <opcode>store</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>34</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_16"> <Value> <Obj> <type>0</type> <id>29</id> <name>15_write_ln98</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>98</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>98</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>211</item> <item>214</item> </oprand_edges> <opcode>store</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>35</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_17"> <Value> <Obj> <type>0</type> <id>30</id> <name>0_write_ln100</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>100</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>100</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>216</item> <item>219</item> </oprand_edges> <opcode>store</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>1</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_18"> <Value> <Obj> <type>0</type> <id>31</id> <name>1_write_ln101</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>101</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>101</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>221</item> <item>224</item> </oprand_edges> <opcode>store</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>2</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_19"> <Value> <Obj> <type>0</type> <id>32</id> <name>2_write_ln102</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>102</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>102</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>226</item> <item>229</item> </oprand_edges> <opcode>store</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>5</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_20"> <Value> <Obj> <type>0</type> <id>33</id> <name>3_write_ln103</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>103</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>103</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>231</item> <item>234</item> </oprand_edges> <opcode>store</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>6</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_21"> <Value> <Obj> <type>0</type> <id>34</id> <name>4_write_ln104</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>104</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>104</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>236</item> <item>239</item> </oprand_edges> <opcode>store</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>9</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_22"> <Value> <Obj> <type>0</type> <id>35</id> <name>5_write_ln105</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>105</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>105</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>241</item> <item>244</item> </oprand_edges> <opcode>store</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>10</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_23"> <Value> <Obj> <type>0</type> <id>36</id> <name>6_write_ln106</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>106</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>106</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>246</item> <item>249</item> </oprand_edges> <opcode>store</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>13</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_24"> <Value> <Obj> <type>0</type> <id>37</id> <name>7_write_ln107</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>107</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>107</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>251</item> <item>254</item> </oprand_edges> <opcode>store</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="4" object_id="_25"> <Value> <Obj> <type>0</type> <id>38</id> <name>8_write_ln108</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>108</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>108</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>256</item> <item>259</item> </oprand_edges> <opcode>store</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>17</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_26"> <Value> <Obj> <type>0</type> <id>39</id> <name>9_write_ln109</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>109</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>109</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>261</item> <item>264</item> </oprand_edges> <opcode>store</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="4" object_id="_27"> <Value> <Obj> <type>0</type> <id>40</id> <name>10_write_ln110</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>110</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>110</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>265</item> <item>268</item> </oprand_edges> <opcode>store</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>21</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_28"> <Value> <Obj> <type>0</type> <id>41</id> <name>11_write_ln111</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>111</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>111</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>269</item> <item>272</item> </oprand_edges> <opcode>store</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="4" object_id="_29"> <Value> <Obj> <type>0</type> <id>42</id> <name>12_write_ln112</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>112</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>112</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>274</item> <item>277</item> </oprand_edges> <opcode>store</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>25</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_30"> <Value> <Obj> <type>0</type> <id>43</id> <name>13_write_ln113</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>113</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>113</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>279</item> <item>282</item> </oprand_edges> <opcode>store</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>26</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_31"> <Value> <Obj> <type>0</type> <id>44</id> <name>14_write_ln114</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>114</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>114</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>284</item> <item>287</item> </oprand_edges> <opcode>store</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>29</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_32"> <Value> <Obj> <type>0</type> <id>45</id> <name>15_write_ln115</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>115</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>115</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>289</item> <item>292</item> </oprand_edges> <opcode>store</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>30</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_33"> <Value> <Obj> <type>0</type> <id>46</id> <name>_ln75</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>75</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>75</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>21</count> <item_version>0</item_version> <item>294</item> <item>295</item> <item>457</item> <item>458</item> <item>459</item> <item>507</item> <item>508</item> <item>509</item> <item>510</item> <item>511</item> <item>512</item> <item>513</item> <item>514</item> <item>515</item> <item>516</item> <item>517</item> <item>518</item> <item>519</item> <item>520</item> <item>521</item> <item>522</item> </oprand_edges> <opcode>call</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>33</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_34"> <Value> <Obj> <type>0</type> <id>47</id> <name>round_val_write_ln79</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>79</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>79</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>297</item> <item>298</item> </oprand_edges> <opcode>store</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="4" object_id="_35"> <Value> <Obj> <type>0</type> <id>48</id> <name>nb_write_ln80</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>80</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>80</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>300</item> <item>301</item> </oprand_edges> <opcode>store</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>4</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_36"> <Value> <Obj> <type>0</type> <id>49</id> <name>_ln106</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>106</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>106</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>22</count> <item_version>0</item_version> <item>303</item> <item>304</item> <item>306</item> <item>460</item> <item>506</item> <item>523</item> <item>524</item> <item>525</item> <item>526</item> <item>527</item> <item>528</item> <item>529</item> <item>530</item> <item>531</item> <item>532</item> <item>533</item> <item>534</item> <item>535</item> <item>536</item> <item>537</item> <item>538</item> <item>562</item> </oprand_edges> <opcode>call</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>1.86</m_delay> <m_topoIndex>36</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_37"> <Value> <Obj> <type>0</type> <id>50</id> <name>_ln107</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>107</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>107</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>307</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>37</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_38"> <Value> <Obj> <type>0</type> <id>52</id> <name>i_0_i</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>i</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>4</count> <item_version>0</item_version> <item>309</item> <item>310</item> <item>311</item> <item>312</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>38</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_39"> <Value> <Obj> <type>0</type> <id>53</id> <name>round_val_load</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>107</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>107</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>6</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>313</item> <item>548</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>0.00</m_delay> <m_topoIndex>39</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_40"> <Value> <Obj> <type>0</type> <id>54</id> <name>trunc_ln107</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>107</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>107</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>5</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>314</item> </oprand_edges> <opcode>trunc</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>40</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_41"> <Value> <Obj> <type>0</type> <id>55</id> <name>add_ln107</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>107</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>107</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>5</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>316</item> <item>317</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.78</m_delay> <m_topoIndex>41</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_42"> <Value> <Obj> <type>0</type> <id>56</id> <name>zext_ln107</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>107</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>107</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>318</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>42</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_43"> <Value> <Obj> <type>0</type> <id>57</id> <name>icmp_ln107</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>107</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>107</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>1</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>319</item> <item>320</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>2.47</m_delay> <m_topoIndex>43</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_44"> <Value> <Obj> <type>0</type> <id>58</id> <name>_ln107</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>107</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>107</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>321</item> <item>322</item> <item>323</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>44</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_45"> <Value> <Obj> <type>0</type> <id>60</id> <name>nb_load_1</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>109</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>109</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>324</item> <item>550</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>0.00</m_delay> <m_topoIndex>45</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_46"> <Value> <Obj> <type>0</type> <id>61</id> <name>_ln109</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>109</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>109</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>5</count> <item_version>0</item_version> <item>326</item> <item>327</item> <item>328</item> <item>461</item> <item>572</item> </oprand_edges> <opcode>call</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>3.07</m_delay> <m_topoIndex>46</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_47"> <Value> <Obj> <type>0</type> <id>62</id> <name>nb_load_2</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>110</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>110</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>329</item> <item>551</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>0.00</m_delay> <m_topoIndex>49</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_48"> <Value> <Obj> <type>0</type> <id>63</id> <name>_ln110</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>110</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>110</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>9</count> <item_version>0</item_version> <item>331</item> <item>332</item> <item>333</item> <item>334</item> <item>462</item> <item>539</item> <item>563</item> <item>571</item> <item>573</item> </oprand_edges> <opcode>call</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>8.51</m_delay> <m_topoIndex>50</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_49"> <Value> <Obj> <type>0</type> <id>64</id> <name>i</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>107</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>107</second> </item> </second> </item> </inlineStackInfo> <originalName>i</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>335</item> <item>336</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>51</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_50"> <Value> <Obj> <type>0</type> <id>65</id> <name>_ln107</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>107</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>107</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>337</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>52</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_51"> <Value> <Obj> <type>0</type> <id>67</id> <name>nb_load</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>112</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>112</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>338</item> <item>549</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>0.00</m_delay> <m_topoIndex>47</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_52"> <Value> <Obj> <type>0</type> <id>68</id> <name>_ln112</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>112</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>112</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>5</count> <item_version>0</item_version> <item>339</item> <item>340</item> <item>341</item> <item>463</item> <item>569</item> </oprand_edges> <opcode>call</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>3.07</m_delay> <m_topoIndex>48</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_53"> <Value> <Obj> <type>0</type> <id>69</id> <name>_ln113</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>113</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>113</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>8</count> <item_version>0</item_version> <item>342</item> <item>343</item> <item>344</item> <item>464</item> <item>540</item> <item>564</item> <item>568</item> <item>570</item> </oprand_edges> <opcode>call</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>1.86</m_delay> <m_topoIndex>53</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_54"> <Value> <Obj> <type>0</type> <id>70</id> <name>_ln123</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>123</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>123</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>345</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>54</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_55"> <Value> <Obj> <type>0</type> <id>72</id> <name>i_2_i</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>i</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>5</bitwidth> </Value> <oprand_edges> <count>4</count> <item_version>0</item_version> <item>346</item> <item>347</item> <item>349</item> <item>350</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>55</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_56"> <Value> <Obj> <type>0</type> <id>73</id> <name>icmp_ln123</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>123</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>123</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>1</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>351</item> <item>353</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.36</m_delay> <m_topoIndex>56</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_57"> <Value> <Obj> <type>0</type> <id>75</id> <name>i_1</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>123</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>123</second> </item> </second> </item> </inlineStackInfo> <originalName>i</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>5</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>354</item> <item>356</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.78</m_delay> <m_topoIndex>57</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_58"> <Value> <Obj> <type>0</type> <id>76</id> <name>_ln123</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>123</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>123</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>357</item> <item>358</item> <item>359</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>58</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_59"> <Value> <Obj> <type>0</type> <id>78</id> <name>zext_ln124</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>124</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>124</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>64</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>360</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>59</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_60"> <Value> <Obj> <type>0</type> <id>79</id> <name>statemt_addr</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>124</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>124</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>5</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>361</item> <item>363</item> <item>364</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>60</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_61"> <Value> <Obj> <type>0</type> <id>80</id> <name>statemt_load</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>124</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>124</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>365</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>61</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_62"> <Value> <Obj> <type>0</type> <id>81</id> <name>out_enc_statemt_addr</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>124</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>124</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>366</item> <item>367</item> <item>368</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>62</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_63"> <Value> <Obj> <type>0</type> <id>82</id> <name>out_enc_statemt_load</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>124</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>124</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>8</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>369</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>63</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_64"> <Value> <Obj> <type>0</type> <id>83</id> <name>zext_ln124_1</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>124</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>124</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>370</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>67</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_65"> <Value> <Obj> <type>0</type> <id>84</id> <name>icmp_ln124</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>124</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>124</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>1</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>371</item> <item>372</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>2.47</m_delay> <m_topoIndex>68</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_66"> <Value> <Obj> <type>0</type> <id>85</id> <name>zext_ln124_2</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>124</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>124</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>373</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>69</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_67"> <Value> <Obj> <type>0</type> <id>86</id> <name>main_result_load</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>124</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>124</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>374</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>0.00</m_delay> <m_topoIndex>70</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_68"> <Value> <Obj> <type>0</type> <id>87</id> <name>add_ln124</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>124</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>124</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>375</item> <item>376</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>71</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_69"> <Value> <Obj> <type>0</type> <id>88</id> <name>main_result_write_ln124</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>124</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>124</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>377</item> <item>378</item> <item>544</item> </oprand_edges> <opcode>store</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>72</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_70"> <Value> <Obj> <type>0</type> <id>89</id> <name>_ln123</name> <fileName>aes/aes_enc.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>123</lineNumber> <contextFuncName>encrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>117</second> </item> <item> <first> <first>aes/aes_enc.c</first> <second>encrypt</second> </first> <second>123</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>379</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>73</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_71"> <Value> <Obj> <type>0</type> <id>91</id> <name>_ln73</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>73</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>73</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>8</count> <item_version>0</item_version> <item>380</item> <item>381</item> <item>465</item> <item>466</item> <item>467</item> <item>574</item> <item>576</item> <item>586</item> </oprand_edges> <opcode>call</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>64</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_72"> <Value> <Obj> <type>0</type> <id>92</id> <name>round_val_write_ln78</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>78</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>78</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>4</count> <item_version>0</item_version> <item>383</item> <item>384</item> <item>552</item> <item>558</item> </oprand_edges> <opcode>store</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>65</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_73"> <Value> <Obj> <type>0</type> <id>93</id> <name>nb_write_ln79</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>79</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>79</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>4</count> <item_version>0</item_version> <item>385</item> <item>386</item> <item>554</item> <item>559</item> </oprand_edges> <opcode>store</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>66</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_74"> <Value> <Obj> <type>0</type> <id>94</id> <name>_ln109</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>109</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>109</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>10</count> <item_version>0</item_version> <item>387</item> <item>388</item> <item>390</item> <item>468</item> <item>542</item> <item>565</item> <item>575</item> <item>577</item> <item>584</item> <item>587</item> </oprand_edges> <opcode>call</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>1.86</m_delay> <m_topoIndex>74</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_75"> <Value> <Obj> <type>0</type> <id>95</id> <name>nb_load_3</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>111</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>111</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>391</item> <item>545</item> <item>555</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>0.00</m_delay> <m_topoIndex>75</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_76"> <Value> <Obj> <type>0</type> <id>96</id> <name>_ln111</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>111</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>111</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>9</count> <item_version>0</item_version> <item>393</item> <item>394</item> <item>395</item> <item>469</item> <item>541</item> <item>566</item> <item>578</item> <item>585</item> <item>588</item> </oprand_edges> <opcode>call</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>3.07</m_delay> <m_topoIndex>76</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_77"> <Value> <Obj> <type>0</type> <id>97</id> <name>round_val_load_1</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>113</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>113</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>6</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>396</item> <item>546</item> <item>553</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>0.00</m_delay> <m_topoIndex>77</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_78"> <Value> <Obj> <type>0</type> <id>98</id> <name>zext_ln113</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>113</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>113</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>397</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>78</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_79"> <Value> <Obj> <type>0</type> <id>99</id> <name>_ln113</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>113</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>113</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>398</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>79</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_80"> <Value> <Obj> <type>0</type> <id>101</id> <name>i_0_in_i</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>i</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>4</count> <item_version>0</item_version> <item>399</item> <item>400</item> <item>401</item> <item>402</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>80</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_81"> <Value> <Obj> <type>0</type> <id>102</id> <name>i_2</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>113</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>113</second> </item> </second> </item> </inlineStackInfo> <originalName>i</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>403</item> <item>405</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>81</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_82"> <Value> <Obj> <type>0</type> <id>103</id> <name>icmp_ln113</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>113</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>113</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>1</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>406</item> <item>407</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>2.47</m_delay> <m_topoIndex>82</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_83"> <Value> <Obj> <type>0</type> <id>104</id> <name>_ln113</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>113</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>113</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>408</item> <item>409</item> <item>410</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>83</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_84"> <Value> <Obj> <type>0</type> <id>106</id> <name>nb_load_4</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>115</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>115</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>411</item> <item>556</item> <item>560</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>0.00</m_delay> <m_topoIndex>85</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_85"> <Value> <Obj> <type>0</type> <id>107</id> <name>_ln115</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>115</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>115</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>12</count> <item_version>0</item_version> <item>413</item> <item>414</item> <item>415</item> <item>416</item> <item>470</item> <item>579</item> <item>580</item> <item>589</item> <item>591</item> <item>595</item> <item>596</item> <item>598</item> </oprand_edges> <opcode>call</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>8.51</m_delay> <m_topoIndex>86</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_86"> <Value> <Obj> <type>0</type> <id>108</id> <name>nb_load_5</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>116</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>116</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>417</item> <item>557</item> <item>561</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>0.00</m_delay> <m_topoIndex>87</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_87"> <Value> <Obj> <type>0</type> <id>109</id> <name>_ln116</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>116</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>116</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>11</count> <item_version>0</item_version> <item>418</item> <item>419</item> <item>420</item> <item>471</item> <item>543</item> <item>567</item> <item>581</item> <item>590</item> <item>592</item> <item>597</item> <item>599</item> </oprand_edges> <opcode>call</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>3.07</m_delay> <m_topoIndex>88</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_88"> <Value> <Obj> <type>0</type> <id>110</id> <name>_ln113</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>113</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>113</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>421</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>89</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_89"> <Value> <Obj> <type>0</type> <id>112</id> <name>_ln119</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>119</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>119</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>11</count> <item_version>0</item_version> <item>422</item> <item>423</item> <item>424</item> <item>472</item> <item>582</item> <item>583</item> <item>593</item> <item>594</item> <item>600</item> <item>601</item> <item>602</item> </oprand_edges> <opcode>call</opcode> <m_Display>0</m_Display> <m_isOnCriticalPath>0</m_isOnCriticalPath> <m_isLCDNode>0</m_isLCDNode> <m_isStartOfPath>0</m_isStartOfPath> <m_delay>1.86</m_delay> <m_topoIndex>84</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_90"> <Value> <Obj> <type>0</type> <id>113</id> <name>_ln129</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>129</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>129</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>425</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>90</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_91"> <Value> <Obj> <type>0</type> <id>115</id> <name>i_2_i5</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName>i</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>5</bitwidth> </Value> <oprand_edges> <count>4</count> <item_version>0</item_version> <item>426</item> <item>427</item> <item>428</item> <item>429</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>91</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_92"> <Value> <Obj> <type>0</type> <id>116</id> <name>icmp_ln129</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>129</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>129</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>1</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>430</item> <item>431</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.36</m_delay> <m_topoIndex>92</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_93"> <Value> <Obj> <type>0</type> <id>118</id> <name>i_3</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>129</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>129</second> </item> </second> </item> </inlineStackInfo> <originalName>i</originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>5</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>432</item> <item>433</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.78</m_delay> <m_topoIndex>93</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_94"> <Value> <Obj> <type>0</type> <id>119</id> <name>_ln129</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>129</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>129</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>434</item> <item>435</item> <item>436</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>94</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_95"> <Value> <Obj> <type>0</type> <id>121</id> <name>zext_ln130</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>130</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>130</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>64</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>437</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>95</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_96"> <Value> <Obj> <type>0</type> <id>122</id> <name>statemt_addr_1</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>130</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>130</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>5</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>438</item> <item>439</item> <item>440</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>96</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_97"> <Value> <Obj> <type>0</type> <id>123</id> <name>statemt_load_1</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>130</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>130</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>441</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>97</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_98"> <Value> <Obj> <type>0</type> <id>124</id> <name>out_dec_statemt_addr</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>130</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>130</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>4</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>442</item> <item>443</item> <item>444</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>98</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_99"> <Value> <Obj> <type>0</type> <id>125</id> <name>out_dec_statemt_load</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>130</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>130</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>8</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>445</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>99</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_100"> <Value> <Obj> <type>0</type> <id>126</id> <name>zext_ln130_1</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>130</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>130</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>446</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>101</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_101"> <Value> <Obj> <type>0</type> <id>127</id> <name>icmp_ln130</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>130</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>130</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>1</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>447</item> <item>448</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>2.47</m_delay> <m_topoIndex>102</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_102"> <Value> <Obj> <type>0</type> <id>128</id> <name>zext_ln130_2</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>130</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>130</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>449</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>103</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_103"> <Value> <Obj> <type>0</type> <id>129</id> <name>main_result_load_1</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>130</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>130</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>450</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>0.00</m_delay> <m_topoIndex>104</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_104"> <Value> <Obj> <type>0</type> <id>130</id> <name>add_ln130</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>130</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>130</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <oprand_edges> <count>2</count> <item_version>0</item_version> <item>451</item> <item>452</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>105</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_105"> <Value> <Obj> <type>0</type> <id>131</id> <name>main_result_write_ln130</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>130</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>130</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>3</count> <item_version>0</item_version> <item>453</item> <item>454</item> <item>547</item> </oprand_edges> <opcode>store</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>106</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_106"> <Value> <Obj> <type>0</type> <id>132</id> <name>_ln129</name> <fileName>aes/aes_dec.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>129</lineNumber> <contextFuncName>decrypt</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>2</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>118</second> </item> <item> <first> <first>aes/aes_dec.c</first> <second>decrypt</second> </first> <second>129</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>455</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>107</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> <item class_id_reference="4" object_id="_107"> <Value> <Obj> <type>0</type> <id>134</id> <name>_ln119</name> <fileName>aes/aes.c</fileName> <fileDirectory>G:\AES</fileDirectory> <lineNumber>119</lineNumber> <contextFuncName>aes_main</contextFuncName> <inlineStackInfo> <count>1</count> <item_version>0</item_version> <item> <first>G:\AES</first> <second> <count>1</count> <item_version>0</item_version> <item> <first> <first>aes/aes.c</first> <second>aes_main</second> </first> <second>119</second> </item> </second> </item> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <oprand_edges> <count>1</count> <item_version>0</item_version> <item>456</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>100</m_topoIndex> <m_clusterGroupNumber>-1</m_clusterGroupNumber> </item> </nodes> <consts class_id="13" tracking_level="0" version="0"> <count>79</count> <item_version>0</item_version> <item class_id="14" tracking_level="1" version="0" object_id="_108"> <Value> <Obj> <type>2</type> <id>136</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>50</content> </item> <item class_id_reference="14" object_id="_109"> <Value> <Obj> <type>2</type> <id>138</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>0</content> </item> <item class_id_reference="14" object_id="_110"> <Value> <Obj> <type>2</type> <id>141</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>67</content> </item> <item class_id_reference="14" object_id="_111"> <Value> <Obj> <type>2</type> <id>143</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>1</content> </item> <item class_id_reference="14" object_id="_112"> <Value> <Obj> <type>2</type> <id>146</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>246</content> </item> <item class_id_reference="14" object_id="_113"> <Value> <Obj> <type>2</type> <id>148</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>2</content> </item> <item class_id_reference="14" object_id="_114"> <Value> <Obj> <type>2</type> <id>151</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>168</content> </item> <item class_id_reference="14" object_id="_115"> <Value> <Obj> <type>2</type> <id>153</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>3</content> </item> <item class_id_reference="14" object_id="_116"> <Value> <Obj> <type>2</type> <id>156</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>136</content> </item> <item class_id_reference="14" object_id="_117"> <Value> <Obj> <type>2</type> <id>158</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>4</content> </item> <item class_id_reference="14" object_id="_118"> <Value> <Obj> <type>2</type> <id>161</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>90</content> </item> <item class_id_reference="14" object_id="_119"> <Value> <Obj> <type>2</type> <id>163</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>5</content> </item> <item class_id_reference="14" object_id="_120"> <Value> <Obj> <type>2</type> <id>166</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>48</content> </item> <item class_id_reference="14" object_id="_121"> <Value> <Obj> <type>2</type> <id>168</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>6</content> </item> <item class_id_reference="14" object_id="_122"> <Value> <Obj> <type>2</type> <id>171</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>141</content> </item> <item class_id_reference="14" object_id="_123"> <Value> <Obj> <type>2</type> <id>173</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>7</content> </item> <item class_id_reference="14" object_id="_124"> <Value> <Obj> <type>2</type> <id>176</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>49</content> </item> <item class_id_reference="14" object_id="_125"> <Value> <Obj> <type>2</type> <id>178</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>8</content> </item> <item class_id_reference="14" object_id="_126"> <Value> <Obj> <type>2</type> <id>182</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>9</content> </item> <item class_id_reference="14" object_id="_127"> <Value> <Obj> <type>2</type> <id>185</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>152</content> </item> <item class_id_reference="14" object_id="_128"> <Value> <Obj> <type>2</type> <id>187</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>10</content> </item> <item class_id_reference="14" object_id="_129"> <Value> <Obj> <type>2</type> <id>190</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>162</content> </item> <item class_id_reference="14" object_id="_130"> <Value> <Obj> <type>2</type> <id>192</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>11</content> </item> <item class_id_reference="14" object_id="_131"> <Value> <Obj> <type>2</type> <id>195</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>224</content> </item> <item class_id_reference="14" object_id="_132"> <Value> <Obj> <type>2</type> <id>197</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>12</content> </item> <item class_id_reference="14" object_id="_133"> <Value> <Obj> <type>2</type> <id>200</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>55</content> </item> <item class_id_reference="14" object_id="_134"> <Value> <Obj> <type>2</type> <id>202</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>13</content> </item> <item class_id_reference="14" object_id="_135"> <Value> <Obj> <type>2</type> <id>205</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>7</content> </item> <item class_id_reference="14" object_id="_136"> <Value> <Obj> <type>2</type> <id>207</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>14</content> </item> <item class_id_reference="14" object_id="_137"> <Value> <Obj> <type>2</type> <id>210</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>52</content> </item> <item class_id_reference="14" object_id="_138"> <Value> <Obj> <type>2</type> <id>212</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>15</content> </item> <item class_id_reference="14" object_id="_139"> <Value> <Obj> <type>2</type> <id>215</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>43</content> </item> <item class_id_reference="14" object_id="_140"> <Value> <Obj> <type>2</type> <id>217</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>0</content> </item> <item class_id_reference="14" object_id="_141"> <Value> <Obj> <type>2</type> <id>220</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>126</content> </item> <item class_id_reference="14" object_id="_142"> <Value> <Obj> <type>2</type> <id>222</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>1</content> </item> <item class_id_reference="14" object_id="_143"> <Value> <Obj> <type>2</type> <id>225</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>21</content> </item> <item class_id_reference="14" object_id="_144"> <Value> <Obj> <type>2</type> <id>227</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>2</content> </item> <item class_id_reference="14" object_id="_145"> <Value> <Obj> <type>2</type> <id>230</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>22</content> </item> <item class_id_reference="14" object_id="_146"> <Value> <Obj> <type>2</type> <id>232</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>3</content> </item> <item class_id_reference="14" object_id="_147"> <Value> <Obj> <type>2</type> <id>235</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>40</content> </item> <item class_id_reference="14" object_id="_148"> <Value> <Obj> <type>2</type> <id>237</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>4</content> </item> <item class_id_reference="14" object_id="_149"> <Value> <Obj> <type>2</type> <id>240</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>174</content> </item> <item class_id_reference="14" object_id="_150"> <Value> <Obj> <type>2</type> <id>242</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>5</content> </item> <item class_id_reference="14" object_id="_151"> <Value> <Obj> <type>2</type> <id>245</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>210</content> </item> <item class_id_reference="14" object_id="_152"> <Value> <Obj> <type>2</type> <id>247</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>6</content> </item> <item class_id_reference="14" object_id="_153"> <Value> <Obj> <type>2</type> <id>250</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>166</content> </item> <item class_id_reference="14" object_id="_154"> <Value> <Obj> <type>2</type> <id>252</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>7</content> </item> <item class_id_reference="14" object_id="_155"> <Value> <Obj> <type>2</type> <id>255</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>171</content> </item> <item class_id_reference="14" object_id="_156"> <Value> <Obj> <type>2</type> <id>257</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>8</content> </item> <item class_id_reference="14" object_id="_157"> <Value> <Obj> <type>2</type> <id>260</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>247</content> </item> <item class_id_reference="14" object_id="_158"> <Value> <Obj> <type>2</type> <id>262</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>9</content> </item> <item class_id_reference="14" object_id="_159"> <Value> <Obj> <type>2</type> <id>266</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>10</content> </item> <item class_id_reference="14" object_id="_160"> <Value> <Obj> <type>2</type> <id>270</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>11</content> </item> <item class_id_reference="14" object_id="_161"> <Value> <Obj> <type>2</type> <id>273</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>9</content> </item> <item class_id_reference="14" object_id="_162"> <Value> <Obj> <type>2</type> <id>275</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>12</content> </item> <item class_id_reference="14" object_id="_163"> <Value> <Obj> <type>2</type> <id>278</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>207</content> </item> <item class_id_reference="14" object_id="_164"> <Value> <Obj> <type>2</type> <id>280</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>13</content> </item> <item class_id_reference="14" object_id="_165"> <Value> <Obj> <type>2</type> <id>283</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>79</content> </item> <item class_id_reference="14" object_id="_166"> <Value> <Obj> <type>2</type> <id>285</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>14</content> </item> <item class_id_reference="14" object_id="_167"> <Value> <Obj> <type>2</type> <id>288</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>60</content> </item> <item class_id_reference="14" object_id="_168"> <Value> <Obj> <type>2</type> <id>290</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>3</const_type> <content>15</content> </item> <item class_id_reference="14" object_id="_169"> <Value> <Obj> <type>2</type> <id>293</id> <name>KeySchedule</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <const_type>6</const_type> <content>&lt;constant:KeySchedule&gt;</content> </item> <item class_id_reference="14" object_id="_170"> <Value> <Obj> <type>2</type> <id>296</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>6</bitwidth> </Value> <const_type>0</const_type> <content>0</content> </item> <item class_id_reference="14" object_id="_171"> <Value> <Obj> <type>2</type> <id>299</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>4</content> </item> <item class_id_reference="14" object_id="_172"> <Value> <Obj> <type>2</type> <id>302</id> <name>AddRoundKey</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <const_type>6</const_type> <content>&lt;constant:AddRoundKey&gt;</content> </item> <item class_id_reference="14" object_id="_173"> <Value> <Obj> <type>2</type> <id>305</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>0</content> </item> <item class_id_reference="14" object_id="_174"> <Value> <Obj> <type>2</type> <id>308</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>1</content> </item> <item class_id_reference="14" object_id="_175"> <Value> <Obj> <type>2</type> <id>315</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>5</bitwidth> </Value> <const_type>0</const_type> <content>9</content> </item> <item class_id_reference="14" object_id="_176"> <Value> <Obj> <type>2</type> <id>325</id> <name>ByteSub_ShiftRow</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <const_type>6</const_type> <content>&lt;constant:ByteSub_ShiftRow&gt;</content> </item> <item class_id_reference="14" object_id="_177"> <Value> <Obj> <type>2</type> <id>330</id> <name>MixColumn_AddRoundKe</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <const_type>6</const_type> <content>&lt;constant:MixColumn_AddRoundKe&gt;</content> </item> <item class_id_reference="14" object_id="_178"> <Value> <Obj> <type>2</type> <id>348</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>5</bitwidth> </Value> <const_type>0</const_type> <content>0</content> </item> <item class_id_reference="14" object_id="_179"> <Value> <Obj> <type>2</type> <id>352</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>5</bitwidth> </Value> <const_type>0</const_type> <content>16</content> </item> <item class_id_reference="14" object_id="_180"> <Value> <Obj> <type>2</type> <id>355</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>5</bitwidth> </Value> <const_type>0</const_type> <content>1</content> </item> <item class_id_reference="14" object_id="_181"> <Value> <Obj> <type>2</type> <id>362</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>64</bitwidth> </Value> <const_type>0</const_type> <content>0</content> </item> <item class_id_reference="14" object_id="_182"> <Value> <Obj> <type>2</type> <id>382</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>6</bitwidth> </Value> <const_type>0</const_type> <content>10</content> </item> <item class_id_reference="14" object_id="_183"> <Value> <Obj> <type>2</type> <id>389</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>10</content> </item> <item class_id_reference="14" object_id="_184"> <Value> <Obj> <type>2</type> <id>392</id> <name>InversShiftRow_ByteS</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <const_type>6</const_type> <content>&lt;constant:InversShiftRow_ByteS&gt;</content> </item> <item class_id_reference="14" object_id="_185"> <Value> <Obj> <type>2</type> <id>404</id> <name>empty</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>32</bitwidth> </Value> <const_type>0</const_type> <content>4294967295</content> </item> <item class_id_reference="14" object_id="_186"> <Value> <Obj> <type>2</type> <id>412</id> <name>AddRoundKey_InversMi</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <bitwidth>0</bitwidth> </Value> <const_type>6</const_type> <content>&lt;constant:AddRoundKey_InversMi&gt;</content> </item> </consts> <blocks class_id="15" tracking_level="0" version="0"> <count>13</count> <item_version>0</item_version> <item class_id="16" tracking_level="1" version="0" object_id="_187"> <Obj> <type>3</type> <id>51</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>37</count> <item_version>0</item_version> <item>14</item> <item>15</item> <item>16</item> <item>17</item> <item>18</item> <item>19</item> <item>20</item> <item>21</item> <item>22</item> <item>23</item> <item>24</item> <item>25</item> <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>49</item> <item>50</item> </node_objs> </item> <item class_id_reference="16" object_id="_188"> <Obj> <type>3</type> <id>59</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>7</count> <item_version>0</item_version> <item>52</item> <item>53</item> <item>54</item> <item>55</item> <item>56</item> <item>57</item> <item>58</item> </node_objs> </item> <item class_id_reference="16" object_id="_189"> <Obj> <type>3</type> <id>66</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>6</count> <item_version>0</item_version> <item>60</item> <item>61</item> <item>62</item> <item>63</item> <item>64</item> <item>65</item> </node_objs> </item> <item class_id_reference="16" object_id="_190"> <Obj> <type>3</type> <id>71</id> <name>.preheader.preheader.i</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>4</count> <item_version>0</item_version> <item>67</item> <item>68</item> <item>69</item> <item>70</item> </node_objs> </item> <item class_id_reference="16" object_id="_191"> <Obj> <type>3</type> <id>77</id> <name>.preheader.i</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>4</count> <item_version>0</item_version> <item>72</item> <item>73</item> <item>75</item> <item>76</item> </node_objs> </item> <item class_id_reference="16" object_id="_192"> <Obj> <type>3</type> <id>90</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>12</count> <item_version>0</item_version> <item>78</item> <item>79</item> <item>80</item> <item>81</item> <item>82</item> <item>83</item> <item>84</item> <item>85</item> <item>86</item> <item>87</item> <item>88</item> <item>89</item> </node_objs> </item> <item class_id_reference="16" object_id="_193"> <Obj> <type>3</type> <id>100</id> <name>encrypt.exit</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>9</count> <item_version>0</item_version> <item>91</item> <item>92</item> <item>93</item> <item>94</item> <item>95</item> <item>96</item> <item>97</item> <item>98</item> <item>99</item> </node_objs> </item> <item class_id_reference="16" object_id="_194"> <Obj> <type>3</type> <id>105</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>4</count> <item_version>0</item_version> <item>101</item> <item>102</item> <item>103</item> <item>104</item> </node_objs> </item> <item class_id_reference="16" object_id="_195"> <Obj> <type>3</type> <id>111</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>5</count> <item_version>0</item_version> <item>106</item> <item>107</item> <item>108</item> <item>109</item> <item>110</item> </node_objs> </item> <item class_id_reference="16" object_id="_196"> <Obj> <type>3</type> <id>114</id> <name>.preheader.preheader.i4</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>2</count> <item_version>0</item_version> <item>112</item> <item>113</item> </node_objs> </item> <item class_id_reference="16" object_id="_197"> <Obj> <type>3</type> <id>120</id> <name>.preheader.i6</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>4</count> <item_version>0</item_version> <item>115</item> <item>116</item> <item>118</item> <item>119</item> </node_objs> </item> <item class_id_reference="16" object_id="_198"> <Obj> <type>3</type> <id>133</id> <name></name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>12</count> <item_version>0</item_version> <item>121</item> <item>122</item> <item>123</item> <item>124</item> <item>125</item> <item>126</item> <item>127</item> <item>128</item> <item>129</item> <item>130</item> <item>131</item> <item>132</item> </node_objs> </item> <item class_id_reference="16" object_id="_199"> <Obj> <type>3</type> <id>135</id> <name>decrypt.exit</name> <fileName></fileName> <fileDirectory></fileDirectory> <lineNumber>0</lineNumber> <contextFuncName></contextFuncName> <inlineStackInfo> <count>0</count> <item_version>0</item_version> </inlineStackInfo> <originalName></originalName> <rtlName></rtlName> <coreName></coreName> </Obj> <node_objs> <count>1</count> <item_version>0</item_version> <item>134</item> </node_objs> </item> </blocks> <edges class_id="17" tracking_level="0" version="0"> <count>371</count> <item_version>0</item_version> <item class_id="18" tracking_level="1" version="0" object_id="_200"> <id>137</id> <edge_type>1</edge_type> <source_obj>136</source_obj> <sink_obj>14</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_201"> <id>139</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>138</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_202"> <id>140</id> <edge_type>1</edge_type> <source_obj>138</source_obj> <sink_obj>14</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_203"> <id>142</id> <edge_type>1</edge_type> <source_obj>141</source_obj> <sink_obj>15</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_204"> <id>144</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>143</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_205"> <id>145</id> <edge_type>1</edge_type> <source_obj>143</source_obj> <sink_obj>15</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_206"> <id>147</id> <edge_type>1</edge_type> <source_obj>146</source_obj> <sink_obj>16</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_207"> <id>149</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>148</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_208"> <id>150</id> <edge_type>1</edge_type> <source_obj>148</source_obj> <sink_obj>16</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_209"> <id>152</id> <edge_type>1</edge_type> <source_obj>151</source_obj> <sink_obj>17</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_210"> <id>154</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>153</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_211"> <id>155</id> <edge_type>1</edge_type> <source_obj>153</source_obj> <sink_obj>17</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_212"> <id>157</id> <edge_type>1</edge_type> <source_obj>156</source_obj> <sink_obj>18</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_213"> <id>159</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>158</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_214"> <id>160</id> <edge_type>1</edge_type> <source_obj>158</source_obj> <sink_obj>18</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_215"> <id>162</id> <edge_type>1</edge_type> <source_obj>161</source_obj> <sink_obj>19</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_216"> <id>164</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>163</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_217"> <id>165</id> <edge_type>1</edge_type> <source_obj>163</source_obj> <sink_obj>19</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_218"> <id>167</id> <edge_type>1</edge_type> <source_obj>166</source_obj> <sink_obj>20</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_219"> <id>169</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>168</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_220"> <id>170</id> <edge_type>1</edge_type> <source_obj>168</source_obj> <sink_obj>20</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_221"> <id>172</id> <edge_type>1</edge_type> <source_obj>171</source_obj> <sink_obj>21</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_222"> <id>174</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>173</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_223"> <id>175</id> <edge_type>1</edge_type> <source_obj>173</source_obj> <sink_obj>21</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_224"> <id>177</id> <edge_type>1</edge_type> <source_obj>176</source_obj> <sink_obj>22</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_225"> <id>179</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>178</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_226"> <id>180</id> <edge_type>1</edge_type> <source_obj>178</source_obj> <sink_obj>22</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_227"> <id>181</id> <edge_type>1</edge_type> <source_obj>176</source_obj> <sink_obj>23</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_228"> <id>183</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>182</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_229"> <id>184</id> <edge_type>1</edge_type> <source_obj>182</source_obj> <sink_obj>23</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_230"> <id>186</id> <edge_type>1</edge_type> <source_obj>185</source_obj> <sink_obj>24</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_231"> <id>188</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>187</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_232"> <id>189</id> <edge_type>1</edge_type> <source_obj>187</source_obj> <sink_obj>24</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_233"> <id>191</id> <edge_type>1</edge_type> <source_obj>190</source_obj> <sink_obj>25</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_234"> <id>193</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>192</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_235"> <id>194</id> <edge_type>1</edge_type> <source_obj>192</source_obj> <sink_obj>25</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_236"> <id>196</id> <edge_type>1</edge_type> <source_obj>195</source_obj> <sink_obj>26</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_237"> <id>198</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>197</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_238"> <id>199</id> <edge_type>1</edge_type> <source_obj>197</source_obj> <sink_obj>26</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_239"> <id>201</id> <edge_type>1</edge_type> <source_obj>200</source_obj> <sink_obj>27</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_240"> <id>203</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>202</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_241"> <id>204</id> <edge_type>1</edge_type> <source_obj>202</source_obj> <sink_obj>27</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_242"> <id>206</id> <edge_type>1</edge_type> <source_obj>205</source_obj> <sink_obj>28</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_243"> <id>208</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>207</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_244"> <id>209</id> <edge_type>1</edge_type> <source_obj>207</source_obj> <sink_obj>28</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_245"> <id>211</id> <edge_type>1</edge_type> <source_obj>210</source_obj> <sink_obj>29</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_246"> <id>213</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>212</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_247"> <id>214</id> <edge_type>1</edge_type> <source_obj>212</source_obj> <sink_obj>29</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_248"> <id>216</id> <edge_type>1</edge_type> <source_obj>215</source_obj> <sink_obj>30</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_249"> <id>218</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>217</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_250"> <id>219</id> <edge_type>1</edge_type> <source_obj>217</source_obj> <sink_obj>30</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_251"> <id>221</id> <edge_type>1</edge_type> <source_obj>220</source_obj> <sink_obj>31</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_252"> <id>223</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>222</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_253"> <id>224</id> <edge_type>1</edge_type> <source_obj>222</source_obj> <sink_obj>31</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_254"> <id>226</id> <edge_type>1</edge_type> <source_obj>225</source_obj> <sink_obj>32</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_255"> <id>228</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>227</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_256"> <id>229</id> <edge_type>1</edge_type> <source_obj>227</source_obj> <sink_obj>32</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_257"> <id>231</id> <edge_type>1</edge_type> <source_obj>230</source_obj> <sink_obj>33</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_258"> <id>233</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>232</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_259"> <id>234</id> <edge_type>1</edge_type> <source_obj>232</source_obj> <sink_obj>33</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_260"> <id>236</id> <edge_type>1</edge_type> <source_obj>235</source_obj> <sink_obj>34</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_261"> <id>238</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>237</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_262"> <id>239</id> <edge_type>1</edge_type> <source_obj>237</source_obj> <sink_obj>34</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_263"> <id>241</id> <edge_type>1</edge_type> <source_obj>240</source_obj> <sink_obj>35</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_264"> <id>243</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>242</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_265"> <id>244</id> <edge_type>1</edge_type> <source_obj>242</source_obj> <sink_obj>35</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_266"> <id>246</id> <edge_type>1</edge_type> <source_obj>245</source_obj> <sink_obj>36</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_267"> <id>248</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>247</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_268"> <id>249</id> <edge_type>1</edge_type> <source_obj>247</source_obj> <sink_obj>36</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_269"> <id>251</id> <edge_type>1</edge_type> <source_obj>250</source_obj> <sink_obj>37</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_270"> <id>253</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>252</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_271"> <id>254</id> <edge_type>1</edge_type> <source_obj>252</source_obj> <sink_obj>37</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_272"> <id>256</id> <edge_type>1</edge_type> <source_obj>255</source_obj> <sink_obj>38</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_273"> <id>258</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>257</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_274"> <id>259</id> <edge_type>1</edge_type> <source_obj>257</source_obj> <sink_obj>38</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_275"> <id>261</id> <edge_type>1</edge_type> <source_obj>260</source_obj> <sink_obj>39</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_276"> <id>263</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>262</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_277"> <id>264</id> <edge_type>1</edge_type> <source_obj>262</source_obj> <sink_obj>39</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_278"> <id>265</id> <edge_type>1</edge_type> <source_obj>225</source_obj> <sink_obj>40</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_279"> <id>267</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>266</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_280"> <id>268</id> <edge_type>1</edge_type> <source_obj>266</source_obj> <sink_obj>40</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_281"> <id>269</id> <edge_type>1</edge_type> <source_obj>156</source_obj> <sink_obj>41</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_282"> <id>271</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>270</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_283"> <id>272</id> <edge_type>1</edge_type> <source_obj>270</source_obj> <sink_obj>41</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_284"> <id>274</id> <edge_type>1</edge_type> <source_obj>273</source_obj> <sink_obj>42</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_285"> <id>276</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>275</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_286"> <id>277</id> <edge_type>1</edge_type> <source_obj>275</source_obj> <sink_obj>42</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_287"> <id>279</id> <edge_type>1</edge_type> <source_obj>278</source_obj> <sink_obj>43</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_288"> <id>281</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>280</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_289"> <id>282</id> <edge_type>1</edge_type> <source_obj>280</source_obj> <sink_obj>43</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_290"> <id>284</id> <edge_type>1</edge_type> <source_obj>283</source_obj> <sink_obj>44</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_291"> <id>286</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>285</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_292"> <id>287</id> <edge_type>1</edge_type> <source_obj>285</source_obj> <sink_obj>44</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_293"> <id>289</id> <edge_type>1</edge_type> <source_obj>288</source_obj> <sink_obj>45</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_294"> <id>291</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>290</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_295"> <id>292</id> <edge_type>1</edge_type> <source_obj>290</source_obj> <sink_obj>45</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_296"> <id>294</id> <edge_type>1</edge_type> <source_obj>293</source_obj> <sink_obj>46</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_297"> <id>295</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>46</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_298"> <id>297</id> <edge_type>1</edge_type> <source_obj>296</source_obj> <sink_obj>47</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_299"> <id>298</id> <edge_type>1</edge_type> <source_obj>5</source_obj> <sink_obj>47</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_300"> <id>300</id> <edge_type>1</edge_type> <source_obj>299</source_obj> <sink_obj>48</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_301"> <id>301</id> <edge_type>1</edge_type> <source_obj>6</source_obj> <sink_obj>48</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_302"> <id>303</id> <edge_type>1</edge_type> <source_obj>302</source_obj> <sink_obj>49</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_303"> <id>304</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>49</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_304"> <id>306</id> <edge_type>1</edge_type> <source_obj>305</source_obj> <sink_obj>49</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_305"> <id>307</id> <edge_type>2</edge_type> <source_obj>59</source_obj> <sink_obj>50</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_306"> <id>309</id> <edge_type>1</edge_type> <source_obj>308</source_obj> <sink_obj>52</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_307"> <id>310</id> <edge_type>2</edge_type> <source_obj>51</source_obj> <sink_obj>52</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_308"> <id>311</id> <edge_type>1</edge_type> <source_obj>64</source_obj> <sink_obj>52</sink_obj> <is_back_edge>1</is_back_edge> </item> <item class_id_reference="18" object_id="_309"> <id>312</id> <edge_type>2</edge_type> <source_obj>66</source_obj> <sink_obj>52</sink_obj> <is_back_edge>1</is_back_edge> </item> <item class_id_reference="18" object_id="_310"> <id>313</id> <edge_type>1</edge_type> <source_obj>5</source_obj> <sink_obj>53</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_311"> <id>314</id> <edge_type>1</edge_type> <source_obj>53</source_obj> <sink_obj>54</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_312"> <id>316</id> <edge_type>1</edge_type> <source_obj>315</source_obj> <sink_obj>55</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_313"> <id>317</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="18" object_id="_314"> <id>318</id> <edge_type>1</edge_type> <source_obj>55</source_obj> <sink_obj>56</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_315"> <id>319</id> <edge_type>1</edge_type> <source_obj>52</source_obj> <sink_obj>57</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_316"> <id>320</id> <edge_type>1</edge_type> <source_obj>56</source_obj> <sink_obj>57</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_317"> <id>321</id> <edge_type>1</edge_type> <source_obj>57</source_obj> <sink_obj>58</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_318"> <id>322</id> <edge_type>2</edge_type> <source_obj>66</source_obj> <sink_obj>58</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_319"> <id>323</id> <edge_type>2</edge_type> <source_obj>71</source_obj> <sink_obj>58</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_320"> <id>324</id> <edge_type>1</edge_type> <source_obj>6</source_obj> <sink_obj>60</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_321"> <id>326</id> <edge_type>1</edge_type> <source_obj>325</source_obj> <sink_obj>61</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_322"> <id>327</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>61</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_323"> <id>328</id> <edge_type>1</edge_type> <source_obj>60</source_obj> <sink_obj>61</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_324"> <id>329</id> <edge_type>1</edge_type> <source_obj>6</source_obj> <sink_obj>62</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_325"> <id>331</id> <edge_type>1</edge_type> <source_obj>330</source_obj> <sink_obj>63</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_326"> <id>332</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>63</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_327"> <id>333</id> <edge_type>1</edge_type> <source_obj>62</source_obj> <sink_obj>63</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_328"> <id>334</id> <edge_type>1</edge_type> <source_obj>52</source_obj> <sink_obj>63</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_329"> <id>335</id> <edge_type>1</edge_type> <source_obj>52</source_obj> <sink_obj>64</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_330"> <id>336</id> <edge_type>1</edge_type> <source_obj>308</source_obj> <sink_obj>64</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_331"> <id>337</id> <edge_type>2</edge_type> <source_obj>59</source_obj> <sink_obj>65</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_332"> <id>338</id> <edge_type>1</edge_type> <source_obj>6</source_obj> <sink_obj>67</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_333"> <id>339</id> <edge_type>1</edge_type> <source_obj>325</source_obj> <sink_obj>68</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_334"> <id>340</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>68</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_335"> <id>341</id> <edge_type>1</edge_type> <source_obj>67</source_obj> <sink_obj>68</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_336"> <id>342</id> <edge_type>1</edge_type> <source_obj>302</source_obj> <sink_obj>69</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_337"> <id>343</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>69</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_338"> <id>344</id> <edge_type>1</edge_type> <source_obj>52</source_obj> <sink_obj>69</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_339"> <id>345</id> <edge_type>2</edge_type> <source_obj>77</source_obj> <sink_obj>70</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_340"> <id>346</id> <edge_type>1</edge_type> <source_obj>75</source_obj> <sink_obj>72</sink_obj> <is_back_edge>1</is_back_edge> </item> <item class_id_reference="18" object_id="_341"> <id>347</id> <edge_type>2</edge_type> <source_obj>90</source_obj> <sink_obj>72</sink_obj> <is_back_edge>1</is_back_edge> </item> <item class_id_reference="18" object_id="_342"> <id>349</id> <edge_type>1</edge_type> <source_obj>348</source_obj> <sink_obj>72</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_343"> <id>350</id> <edge_type>2</edge_type> <source_obj>71</source_obj> <sink_obj>72</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_344"> <id>351</id> <edge_type>1</edge_type> <source_obj>72</source_obj> <sink_obj>73</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_345"> <id>353</id> <edge_type>1</edge_type> <source_obj>352</source_obj> <sink_obj>73</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_346"> <id>354</id> <edge_type>1</edge_type> <source_obj>72</source_obj> <sink_obj>75</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_347"> <id>356</id> <edge_type>1</edge_type> <source_obj>355</source_obj> <sink_obj>75</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_348"> <id>357</id> <edge_type>1</edge_type> <source_obj>73</source_obj> <sink_obj>76</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_349"> <id>358</id> <edge_type>2</edge_type> <source_obj>90</source_obj> <sink_obj>76</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_350"> <id>359</id> <edge_type>2</edge_type> <source_obj>100</source_obj> <sink_obj>76</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_351"> <id>360</id> <edge_type>1</edge_type> <source_obj>72</source_obj> <sink_obj>78</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_352"> <id>361</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>79</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_353"> <id>363</id> <edge_type>1</edge_type> <source_obj>362</source_obj> <sink_obj>79</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_354"> <id>364</id> <edge_type>1</edge_type> <source_obj>78</source_obj> <sink_obj>79</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_355"> <id>365</id> <edge_type>1</edge_type> <source_obj>79</source_obj> <sink_obj>80</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_356"> <id>366</id> <edge_type>1</edge_type> <source_obj>8</source_obj> <sink_obj>81</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_357"> <id>367</id> <edge_type>1</edge_type> <source_obj>362</source_obj> <sink_obj>81</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_358"> <id>368</id> <edge_type>1</edge_type> <source_obj>78</source_obj> <sink_obj>81</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_359"> <id>369</id> <edge_type>1</edge_type> <source_obj>81</source_obj> <sink_obj>82</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_360"> <id>370</id> <edge_type>1</edge_type> <source_obj>82</source_obj> <sink_obj>83</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_361"> <id>371</id> <edge_type>1</edge_type> <source_obj>80</source_obj> <sink_obj>84</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_362"> <id>372</id> <edge_type>1</edge_type> <source_obj>83</source_obj> <sink_obj>84</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_363"> <id>373</id> <edge_type>1</edge_type> <source_obj>84</source_obj> <sink_obj>85</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_364"> <id>374</id> <edge_type>1</edge_type> <source_obj>9</source_obj> <sink_obj>86</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_365"> <id>375</id> <edge_type>1</edge_type> <source_obj>86</source_obj> <sink_obj>87</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_366"> <id>376</id> <edge_type>1</edge_type> <source_obj>85</source_obj> <sink_obj>87</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_367"> <id>377</id> <edge_type>1</edge_type> <source_obj>87</source_obj> <sink_obj>88</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_368"> <id>378</id> <edge_type>1</edge_type> <source_obj>9</source_obj> <sink_obj>88</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_369"> <id>379</id> <edge_type>2</edge_type> <source_obj>77</source_obj> <sink_obj>89</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_370"> <id>380</id> <edge_type>1</edge_type> <source_obj>293</source_obj> <sink_obj>91</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_371"> <id>381</id> <edge_type>1</edge_type> <source_obj>4</source_obj> <sink_obj>91</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_372"> <id>383</id> <edge_type>1</edge_type> <source_obj>382</source_obj> <sink_obj>92</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_373"> <id>384</id> <edge_type>1</edge_type> <source_obj>5</source_obj> <sink_obj>92</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_374"> <id>385</id> <edge_type>1</edge_type> <source_obj>299</source_obj> <sink_obj>93</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_375"> <id>386</id> <edge_type>1</edge_type> <source_obj>6</source_obj> <sink_obj>93</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_376"> <id>387</id> <edge_type>1</edge_type> <source_obj>302</source_obj> <sink_obj>94</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_377"> <id>388</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>94</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_378"> <id>390</id> <edge_type>1</edge_type> <source_obj>389</source_obj> <sink_obj>94</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_379"> <id>391</id> <edge_type>1</edge_type> <source_obj>6</source_obj> <sink_obj>95</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_380"> <id>393</id> <edge_type>1</edge_type> <source_obj>392</source_obj> <sink_obj>96</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_381"> <id>394</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>96</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_382"> <id>395</id> <edge_type>1</edge_type> <source_obj>95</source_obj> <sink_obj>96</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_383"> <id>396</id> <edge_type>1</edge_type> <source_obj>5</source_obj> <sink_obj>97</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_384"> <id>397</id> <edge_type>1</edge_type> <source_obj>97</source_obj> <sink_obj>98</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_385"> <id>398</id> <edge_type>2</edge_type> <source_obj>105</source_obj> <sink_obj>99</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_386"> <id>399</id> <edge_type>1</edge_type> <source_obj>98</source_obj> <sink_obj>101</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_387"> <id>400</id> <edge_type>2</edge_type> <source_obj>100</source_obj> <sink_obj>101</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_388"> <id>401</id> <edge_type>1</edge_type> <source_obj>102</source_obj> <sink_obj>101</sink_obj> <is_back_edge>1</is_back_edge> </item> <item class_id_reference="18" object_id="_389"> <id>402</id> <edge_type>2</edge_type> <source_obj>111</source_obj> <sink_obj>101</sink_obj> <is_back_edge>1</is_back_edge> </item> <item class_id_reference="18" object_id="_390"> <id>403</id> <edge_type>1</edge_type> <source_obj>101</source_obj> <sink_obj>102</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_391"> <id>405</id> <edge_type>1</edge_type> <source_obj>404</source_obj> <sink_obj>102</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_392"> <id>406</id> <edge_type>1</edge_type> <source_obj>102</source_obj> <sink_obj>103</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_393"> <id>407</id> <edge_type>1</edge_type> <source_obj>305</source_obj> <sink_obj>103</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_394"> <id>408</id> <edge_type>1</edge_type> <source_obj>103</source_obj> <sink_obj>104</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_395"> <id>409</id> <edge_type>2</edge_type> <source_obj>114</source_obj> <sink_obj>104</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_396"> <id>410</id> <edge_type>2</edge_type> <source_obj>111</source_obj> <sink_obj>104</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_397"> <id>411</id> <edge_type>1</edge_type> <source_obj>6</source_obj> <sink_obj>106</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_398"> <id>413</id> <edge_type>1</edge_type> <source_obj>412</source_obj> <sink_obj>107</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_399"> <id>414</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>107</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_400"> <id>415</id> <edge_type>1</edge_type> <source_obj>106</source_obj> <sink_obj>107</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_401"> <id>416</id> <edge_type>1</edge_type> <source_obj>102</source_obj> <sink_obj>107</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_402"> <id>417</id> <edge_type>1</edge_type> <source_obj>6</source_obj> <sink_obj>108</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_403"> <id>418</id> <edge_type>1</edge_type> <source_obj>392</source_obj> <sink_obj>109</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_404"> <id>419</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>109</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_405"> <id>420</id> <edge_type>1</edge_type> <source_obj>108</source_obj> <sink_obj>109</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_406"> <id>421</id> <edge_type>2</edge_type> <source_obj>105</source_obj> <sink_obj>110</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_407"> <id>422</id> <edge_type>1</edge_type> <source_obj>302</source_obj> <sink_obj>112</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_408"> <id>423</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>112</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_409"> <id>424</id> <edge_type>1</edge_type> <source_obj>305</source_obj> <sink_obj>112</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_410"> <id>425</id> <edge_type>2</edge_type> <source_obj>120</source_obj> <sink_obj>113</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_411"> <id>426</id> <edge_type>1</edge_type> <source_obj>118</source_obj> <sink_obj>115</sink_obj> <is_back_edge>1</is_back_edge> </item> <item class_id_reference="18" object_id="_412"> <id>427</id> <edge_type>2</edge_type> <source_obj>133</source_obj> <sink_obj>115</sink_obj> <is_back_edge>1</is_back_edge> </item> <item class_id_reference="18" object_id="_413"> <id>428</id> <edge_type>1</edge_type> <source_obj>348</source_obj> <sink_obj>115</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_414"> <id>429</id> <edge_type>2</edge_type> <source_obj>114</source_obj> <sink_obj>115</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_415"> <id>430</id> <edge_type>1</edge_type> <source_obj>115</source_obj> <sink_obj>116</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_416"> <id>431</id> <edge_type>1</edge_type> <source_obj>352</source_obj> <sink_obj>116</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_417"> <id>432</id> <edge_type>1</edge_type> <source_obj>115</source_obj> <sink_obj>118</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_418"> <id>433</id> <edge_type>1</edge_type> <source_obj>355</source_obj> <sink_obj>118</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_419"> <id>434</id> <edge_type>1</edge_type> <source_obj>116</source_obj> <sink_obj>119</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_420"> <id>435</id> <edge_type>2</edge_type> <source_obj>133</source_obj> <sink_obj>119</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_421"> <id>436</id> <edge_type>2</edge_type> <source_obj>135</source_obj> <sink_obj>119</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_422"> <id>437</id> <edge_type>1</edge_type> <source_obj>115</source_obj> <sink_obj>121</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_423"> <id>438</id> <edge_type>1</edge_type> <source_obj>7</source_obj> <sink_obj>122</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_424"> <id>439</id> <edge_type>1</edge_type> <source_obj>362</source_obj> <sink_obj>122</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_425"> <id>440</id> <edge_type>1</edge_type> <source_obj>121</source_obj> <sink_obj>122</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_426"> <id>441</id> <edge_type>1</edge_type> <source_obj>122</source_obj> <sink_obj>123</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_427"> <id>442</id> <edge_type>1</edge_type> <source_obj>11</source_obj> <sink_obj>124</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_428"> <id>443</id> <edge_type>1</edge_type> <source_obj>362</source_obj> <sink_obj>124</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_429"> <id>444</id> <edge_type>1</edge_type> <source_obj>121</source_obj> <sink_obj>124</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_430"> <id>445</id> <edge_type>1</edge_type> <source_obj>124</source_obj> <sink_obj>125</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_431"> <id>446</id> <edge_type>1</edge_type> <source_obj>125</source_obj> <sink_obj>126</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_432"> <id>447</id> <edge_type>1</edge_type> <source_obj>123</source_obj> <sink_obj>127</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_433"> <id>448</id> <edge_type>1</edge_type> <source_obj>126</source_obj> <sink_obj>127</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_434"> <id>449</id> <edge_type>1</edge_type> <source_obj>127</source_obj> <sink_obj>128</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_435"> <id>450</id> <edge_type>1</edge_type> <source_obj>9</source_obj> <sink_obj>129</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_436"> <id>451</id> <edge_type>1</edge_type> <source_obj>129</source_obj> <sink_obj>130</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_437"> <id>452</id> <edge_type>1</edge_type> <source_obj>128</source_obj> <sink_obj>130</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_438"> <id>453</id> <edge_type>1</edge_type> <source_obj>130</source_obj> <sink_obj>131</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_439"> <id>454</id> <edge_type>1</edge_type> <source_obj>9</source_obj> <sink_obj>131</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_440"> <id>455</id> <edge_type>2</edge_type> <source_obj>120</source_obj> <sink_obj>132</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_441"> <id>456</id> <edge_type>1</edge_type> <source_obj>305</source_obj> <sink_obj>134</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_442"> <id>457</id> <edge_type>1</edge_type> <source_obj>1</source_obj> <sink_obj>46</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_443"> <id>458</id> <edge_type>1</edge_type> <source_obj>2</source_obj> <sink_obj>46</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_444"> <id>459</id> <edge_type>1</edge_type> <source_obj>3</source_obj> <sink_obj>46</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_445"> <id>460</id> <edge_type>1</edge_type> <source_obj>1</source_obj> <sink_obj>49</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_446"> <id>461</id> <edge_type>1</edge_type> <source_obj>2</source_obj> <sink_obj>61</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_447"> <id>462</id> <edge_type>1</edge_type> <source_obj>1</source_obj> <sink_obj>63</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_448"> <id>463</id> <edge_type>1</edge_type> <source_obj>2</source_obj> <sink_obj>68</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_449"> <id>464</id> <edge_type>1</edge_type> <source_obj>1</source_obj> <sink_obj>69</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_450"> <id>465</id> <edge_type>1</edge_type> <source_obj>1</source_obj> <sink_obj>91</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_451"> <id>466</id> <edge_type>1</edge_type> <source_obj>2</source_obj> <sink_obj>91</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_452"> <id>467</id> <edge_type>1</edge_type> <source_obj>3</source_obj> <sink_obj>91</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_453"> <id>468</id> <edge_type>1</edge_type> <source_obj>1</source_obj> <sink_obj>94</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_454"> <id>469</id> <edge_type>1</edge_type> <source_obj>10</source_obj> <sink_obj>96</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_455"> <id>470</id> <edge_type>1</edge_type> <source_obj>1</source_obj> <sink_obj>107</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_456"> <id>471</id> <edge_type>1</edge_type> <source_obj>10</source_obj> <sink_obj>109</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_457"> <id>472</id> <edge_type>1</edge_type> <source_obj>1</source_obj> <sink_obj>112</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_458"> <id>490</id> <edge_type>2</edge_type> <source_obj>51</source_obj> <sink_obj>59</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_459"> <id>491</id> <edge_type>2</edge_type> <source_obj>59</source_obj> <sink_obj>71</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_460"> <id>492</id> <edge_type>2</edge_type> <source_obj>59</source_obj> <sink_obj>66</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_461"> <id>493</id> <edge_type>2</edge_type> <source_obj>66</source_obj> <sink_obj>59</sink_obj> <is_back_edge>1</is_back_edge> </item> <item class_id_reference="18" object_id="_462"> <id>494</id> <edge_type>2</edge_type> <source_obj>71</source_obj> <sink_obj>77</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_463"> <id>495</id> <edge_type>2</edge_type> <source_obj>77</source_obj> <sink_obj>100</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_464"> <id>496</id> <edge_type>2</edge_type> <source_obj>77</source_obj> <sink_obj>90</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_465"> <id>497</id> <edge_type>2</edge_type> <source_obj>90</source_obj> <sink_obj>77</sink_obj> <is_back_edge>1</is_back_edge> </item> <item class_id_reference="18" object_id="_466"> <id>498</id> <edge_type>2</edge_type> <source_obj>100</source_obj> <sink_obj>105</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_467"> <id>499</id> <edge_type>2</edge_type> <source_obj>105</source_obj> <sink_obj>111</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_468"> <id>500</id> <edge_type>2</edge_type> <source_obj>105</source_obj> <sink_obj>114</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_469"> <id>501</id> <edge_type>2</edge_type> <source_obj>111</source_obj> <sink_obj>105</sink_obj> <is_back_edge>1</is_back_edge> </item> <item class_id_reference="18" object_id="_470"> <id>502</id> <edge_type>2</edge_type> <source_obj>114</source_obj> <sink_obj>120</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_471"> <id>503</id> <edge_type>2</edge_type> <source_obj>120</source_obj> <sink_obj>135</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_472"> <id>504</id> <edge_type>2</edge_type> <source_obj>120</source_obj> <sink_obj>133</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_473"> <id>505</id> <edge_type>2</edge_type> <source_obj>133</source_obj> <sink_obj>120</sink_obj> <is_back_edge>1</is_back_edge> </item> <item class_id_reference="18" object_id="_474"> <id>506</id> <edge_type>4</edge_type> <source_obj>46</source_obj> <sink_obj>49</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_475"> <id>507</id> <edge_type>4</edge_type> <source_obj>45</source_obj> <sink_obj>46</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_476"> <id>508</id> <edge_type>4</edge_type> <source_obj>44</source_obj> <sink_obj>46</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_477"> <id>509</id> <edge_type>4</edge_type> <source_obj>43</source_obj> <sink_obj>46</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_478"> <id>510</id> <edge_type>4</edge_type> <source_obj>42</source_obj> <sink_obj>46</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_479"> <id>511</id> <edge_type>4</edge_type> <source_obj>41</source_obj> <sink_obj>46</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_480"> <id>512</id> <edge_type>4</edge_type> <source_obj>40</source_obj> <sink_obj>46</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_481"> <id>513</id> <edge_type>4</edge_type> <source_obj>39</source_obj> <sink_obj>46</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_482"> <id>514</id> <edge_type>4</edge_type> <source_obj>38</source_obj> <sink_obj>46</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_483"> <id>515</id> <edge_type>4</edge_type> <source_obj>37</source_obj> <sink_obj>46</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_484"> <id>516</id> <edge_type>4</edge_type> <source_obj>36</source_obj> <sink_obj>46</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_485"> <id>517</id> <edge_type>4</edge_type> <source_obj>35</source_obj> <sink_obj>46</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_486"> <id>518</id> <edge_type>4</edge_type> <source_obj>34</source_obj> <sink_obj>46</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_487"> <id>519</id> <edge_type>4</edge_type> <source_obj>33</source_obj> <sink_obj>46</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_488"> <id>520</id> <edge_type>4</edge_type> <source_obj>32</source_obj> <sink_obj>46</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_489"> <id>521</id> <edge_type>4</edge_type> <source_obj>31</source_obj> <sink_obj>46</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_490"> <id>522</id> <edge_type>4</edge_type> <source_obj>30</source_obj> <sink_obj>46</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_491"> <id>523</id> <edge_type>4</edge_type> <source_obj>29</source_obj> <sink_obj>49</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_492"> <id>524</id> <edge_type>4</edge_type> <source_obj>28</source_obj> <sink_obj>49</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_493"> <id>525</id> <edge_type>4</edge_type> <source_obj>27</source_obj> <sink_obj>49</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_494"> <id>526</id> <edge_type>4</edge_type> <source_obj>26</source_obj> <sink_obj>49</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_495"> <id>527</id> <edge_type>4</edge_type> <source_obj>25</source_obj> <sink_obj>49</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_496"> <id>528</id> <edge_type>4</edge_type> <source_obj>24</source_obj> <sink_obj>49</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_497"> <id>529</id> <edge_type>4</edge_type> <source_obj>23</source_obj> <sink_obj>49</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_498"> <id>530</id> <edge_type>4</edge_type> <source_obj>22</source_obj> <sink_obj>49</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_499"> <id>531</id> <edge_type>4</edge_type> <source_obj>21</source_obj> <sink_obj>49</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_500"> <id>532</id> <edge_type>4</edge_type> <source_obj>20</source_obj> <sink_obj>49</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_501"> <id>533</id> <edge_type>4</edge_type> <source_obj>19</source_obj> <sink_obj>49</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_502"> <id>534</id> <edge_type>4</edge_type> <source_obj>18</source_obj> <sink_obj>49</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_503"> <id>535</id> <edge_type>4</edge_type> <source_obj>17</source_obj> <sink_obj>49</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_504"> <id>536</id> <edge_type>4</edge_type> <source_obj>16</source_obj> <sink_obj>49</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_505"> <id>537</id> <edge_type>4</edge_type> <source_obj>15</source_obj> <sink_obj>49</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_506"> <id>538</id> <edge_type>4</edge_type> <source_obj>14</source_obj> <sink_obj>49</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_507"> <id>539</id> <edge_type>4</edge_type> <source_obj>61</source_obj> <sink_obj>63</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_508"> <id>540</id> <edge_type>4</edge_type> <source_obj>68</source_obj> <sink_obj>69</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_509"> <id>541</id> <edge_type>4</edge_type> <source_obj>94</source_obj> <sink_obj>96</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_510"> <id>542</id> <edge_type>4</edge_type> <source_obj>91</source_obj> <sink_obj>94</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_511"> <id>543</id> <edge_type>4</edge_type> <source_obj>107</source_obj> <sink_obj>109</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_512"> <id>544</id> <edge_type>4</edge_type> <source_obj>86</source_obj> <sink_obj>88</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_513"> <id>545</id> <edge_type>4</edge_type> <source_obj>93</source_obj> <sink_obj>95</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_514"> <id>546</id> <edge_type>4</edge_type> <source_obj>92</source_obj> <sink_obj>97</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_515"> <id>547</id> <edge_type>4</edge_type> <source_obj>129</source_obj> <sink_obj>131</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_516"> <id>548</id> <edge_type>4</edge_type> <source_obj>47</source_obj> <sink_obj>53</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_517"> <id>549</id> <edge_type>4</edge_type> <source_obj>48</source_obj> <sink_obj>67</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_518"> <id>550</id> <edge_type>4</edge_type> <source_obj>48</source_obj> <sink_obj>60</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_519"> <id>551</id> <edge_type>4</edge_type> <source_obj>48</source_obj> <sink_obj>62</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_520"> <id>552</id> <edge_type>4</edge_type> <source_obj>47</source_obj> <sink_obj>92</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_521"> <id>553</id> <edge_type>4</edge_type> <source_obj>47</source_obj> <sink_obj>97</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_522"> <id>554</id> <edge_type>4</edge_type> <source_obj>48</source_obj> <sink_obj>93</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_523"> <id>555</id> <edge_type>4</edge_type> <source_obj>48</source_obj> <sink_obj>95</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_524"> <id>556</id> <edge_type>4</edge_type> <source_obj>48</source_obj> <sink_obj>106</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_525"> <id>557</id> <edge_type>4</edge_type> <source_obj>48</source_obj> <sink_obj>108</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_526"> <id>558</id> <edge_type>4</edge_type> <source_obj>53</source_obj> <sink_obj>92</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_527"> <id>559</id> <edge_type>4</edge_type> <source_obj>67</source_obj> <sink_obj>93</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_528"> <id>560</id> <edge_type>4</edge_type> <source_obj>93</source_obj> <sink_obj>106</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_529"> <id>561</id> <edge_type>4</edge_type> <source_obj>93</source_obj> <sink_obj>108</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_530"> <id>562</id> <edge_type>4</edge_type> <source_obj>46</source_obj> <sink_obj>49</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_531"> <id>563</id> <edge_type>4</edge_type> <source_obj>61</source_obj> <sink_obj>63</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_532"> <id>564</id> <edge_type>4</edge_type> <source_obj>68</source_obj> <sink_obj>69</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_533"> <id>565</id> <edge_type>4</edge_type> <source_obj>91</source_obj> <sink_obj>94</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_534"> <id>566</id> <edge_type>4</edge_type> <source_obj>94</source_obj> <sink_obj>96</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_535"> <id>567</id> <edge_type>4</edge_type> <source_obj>107</source_obj> <sink_obj>109</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_536"> <id>568</id> <edge_type>4</edge_type> <source_obj>46</source_obj> <sink_obj>69</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_537"> <id>569</id> <edge_type>4</edge_type> <source_obj>49</source_obj> <sink_obj>68</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_538"> <id>570</id> <edge_type>4</edge_type> <source_obj>49</source_obj> <sink_obj>69</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_539"> <id>571</id> <edge_type>4</edge_type> <source_obj>46</source_obj> <sink_obj>63</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_540"> <id>572</id> <edge_type>4</edge_type> <source_obj>49</source_obj> <sink_obj>61</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_541"> <id>573</id> <edge_type>4</edge_type> <source_obj>49</source_obj> <sink_obj>63</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_542"> <id>574</id> <edge_type>4</edge_type> <source_obj>46</source_obj> <sink_obj>91</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_543"> <id>575</id> <edge_type>4</edge_type> <source_obj>46</source_obj> <sink_obj>94</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_544"> <id>576</id> <edge_type>4</edge_type> <source_obj>49</source_obj> <sink_obj>91</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_545"> <id>577</id> <edge_type>4</edge_type> <source_obj>49</source_obj> <sink_obj>94</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_546"> <id>578</id> <edge_type>4</edge_type> <source_obj>49</source_obj> <sink_obj>96</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_547"> <id>579</id> <edge_type>4</edge_type> <source_obj>46</source_obj> <sink_obj>107</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_548"> <id>580</id> <edge_type>4</edge_type> <source_obj>49</source_obj> <sink_obj>107</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_549"> <id>581</id> <edge_type>4</edge_type> <source_obj>49</source_obj> <sink_obj>109</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_550"> <id>582</id> <edge_type>4</edge_type> <source_obj>46</source_obj> <sink_obj>112</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_551"> <id>583</id> <edge_type>4</edge_type> <source_obj>49</source_obj> <sink_obj>112</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_552"> <id>584</id> <edge_type>4</edge_type> <source_obj>68</source_obj> <sink_obj>94</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_553"> <id>585</id> <edge_type>4</edge_type> <source_obj>68</source_obj> <sink_obj>96</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_554"> <id>586</id> <edge_type>4</edge_type> <source_obj>69</source_obj> <sink_obj>91</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_555"> <id>587</id> <edge_type>4</edge_type> <source_obj>69</source_obj> <sink_obj>94</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_556"> <id>588</id> <edge_type>4</edge_type> <source_obj>69</source_obj> <sink_obj>96</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_557"> <id>589</id> <edge_type>4</edge_type> <source_obj>68</source_obj> <sink_obj>107</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_558"> <id>590</id> <edge_type>4</edge_type> <source_obj>68</source_obj> <sink_obj>109</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_559"> <id>591</id> <edge_type>4</edge_type> <source_obj>69</source_obj> <sink_obj>107</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_560"> <id>592</id> <edge_type>4</edge_type> <source_obj>69</source_obj> <sink_obj>109</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_561"> <id>593</id> <edge_type>4</edge_type> <source_obj>68</source_obj> <sink_obj>112</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_562"> <id>594</id> <edge_type>4</edge_type> <source_obj>69</source_obj> <sink_obj>112</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_563"> <id>595</id> <edge_type>4</edge_type> <source_obj>91</source_obj> <sink_obj>107</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_564"> <id>596</id> <edge_type>4</edge_type> <source_obj>94</source_obj> <sink_obj>107</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_565"> <id>597</id> <edge_type>4</edge_type> <source_obj>94</source_obj> <sink_obj>109</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_566"> <id>598</id> <edge_type>4</edge_type> <source_obj>96</source_obj> <sink_obj>107</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_567"> <id>599</id> <edge_type>4</edge_type> <source_obj>96</source_obj> <sink_obj>109</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_568"> <id>600</id> <edge_type>4</edge_type> <source_obj>91</source_obj> <sink_obj>112</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_569"> <id>601</id> <edge_type>4</edge_type> <source_obj>94</source_obj> <sink_obj>112</sink_obj> <is_back_edge>0</is_back_edge> </item> <item class_id_reference="18" object_id="_570"> <id>602</id> <edge_type>4</edge_type> <source_obj>96</source_obj> <sink_obj>112</sink_obj> <is_back_edge>0</is_back_edge> </item> </edges> </cdfg> <cdfg_regions class_id="19" tracking_level="0" version="0"> <count>10</count> <item_version>0</item_version> <item class_id="20" tracking_level="1" version="0" object_id="_571"> <mId>1</mId> <mTag>aes_main</mTag> <mType>0</mType> <sub_regions> <count>9</count> <item_version>0</item_version> <item>2</item> <item>3</item> <item>4</item> <item>5</item> <item>6</item> <item>7</item> <item>8</item> <item>9</item> <item>10</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>-1</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> <item class_id_reference="20" object_id="_572"> <mId>2</mId> <mTag>Entry</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>51</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>590</mMinLatency> <mMaxLatency>630</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> <item class_id_reference="20" object_id="_573"> <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>59</item> <item>66</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>-1</mMinLatency> <mMaxLatency>-1</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> <item class_id_reference="20" object_id="_574"> <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>71</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>21</mMinLatency> <mMaxLatency>51</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> <item class_id_reference="20" object_id="_575"> <mId>5</mId> <mTag>Loop 2</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>77</item> <item>90</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>16</mMinTripCount> <mMaxTripCount>16</mMaxTripCount> <mMinLatency>48</mMinLatency> <mMaxLatency>48</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> <item class_id_reference="20" object_id="_576"> <mId>6</mId> <mTag>Region 2</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>100</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>585</mMinLatency> <mMaxLatency>655</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> <item class_id_reference="20" object_id="_577"> <mId>7</mId> <mTag>Loop 3</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>105</item> <item>111</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>-1</mMinLatency> <mMaxLatency>-1</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> <item class_id_reference="20" object_id="_578"> <mId>8</mId> <mTag>Region 3</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>114</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>18</mMinLatency> <mMaxLatency>18</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> <item class_id_reference="20" object_id="_579"> <mId>9</mId> <mTag>Loop 4</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>120</item> <item>133</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>16</mMinTripCount> <mMaxTripCount>16</mMaxTripCount> <mMinLatency>48</mMinLatency> <mMaxLatency>48</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> <item class_id_reference="20" object_id="_580"> <mId>10</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>135</item> </basic_blocks> <mII>-1</mII> <mDepth>-1</mDepth> <mMinTripCount>-1</mMinTripCount> <mMaxTripCount>-1</mMaxTripCount> <mMinLatency>0</mMinLatency> <mMaxLatency>0</mMaxLatency> <mIsDfPipe>0</mIsDfPipe> <mDfPipe class_id="-1"></mDfPipe> </item> </cdfg_regions> <fsm class_id="-1"></fsm> <res class_id="-1"></res> <node_label_latency class_id="24" tracking_level="0" version="0"> <count>107</count> <item_version>0</item_version> <item class_id="25" tracking_level="0" version="0"> <first>14</first> <second class_id="26" tracking_level="0" version="0"> <first>2</first> <second>0</second> </second> </item> <item> <first>15</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>16</first> <second> <first>3</first> <second>0</second> </second> </item> <item> <first>17</first> <second> <first>3</first> <second>0</second> </second> </item> <item> <first>18</first> <second> <first>4</first> <second>0</second> </second> </item> <item> <first>19</first> <second> <first>4</first> <second>0</second> </second> </item> <item> <first>20</first> <second> <first>5</first> <second>0</second> </second> </item> <item> <first>21</first> <second> <first>5</first> <second>0</second> </second> </item> <item> <first>22</first> <second> <first>6</first> <second>0</second> </second> </item> <item> <first>23</first> <second> <first>6</first> <second>0</second> </second> </item> <item> <first>24</first> <second> <first>7</first> <second>0</second> </second> </item> <item> <first>25</first> <second> <first>7</first> <second>0</second> </second> </item> <item> <first>26</first> <second> <first>8</first> <second>0</second> </second> </item> <item> <first>27</first> <second> <first>8</first> <second>0</second> </second> </item> <item> <first>28</first> <second> <first>9</first> <second>0</second> </second> </item> <item> <first>29</first> <second> <first>9</first> <second>0</second> </second> </item> <item> <first>30</first> <second> <first>0</first> <second>0</second> </second> </item> <item> <first>31</first> <second> <first>0</first> <second>0</second> </second> </item> <item> <first>32</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>33</first> <second> <first>1</first> <second>0</second> </second> </item> <item> <first>34</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>35</first> <second> <first>2</first> <second>0</second> </second> </item> <item> <first>36</first> <second> <first>3</first> <second>0</second> </second> </item> <item> <first>37</first> <second> <first>3</first> <second>0</second> </second> </item> <item> <first>38</first> <second> <first>4</first> <second>0</second> </second> </item> <item> <first>39</first> <second> <first>4</first> <second>0</second> </second> </item> <item> <first>40</first> <second> <first>5</first> <second>0</second> </second> </item> <item> <first>41</first> <second> <first>5</first> <second>0</second> </second> </item> <item> <first>42</first> <second> <first>6</first> <second>0</second> </second> </item> <item> <first>43</first> <second> <first>6</first> <second>0</second> </second> </item> <item> <first>44</first> <second> <first>7</first> <second>0</second> </second> </item> <item> <first>45</first> <second> <first>7</first> <second>0</second> </second> </item> <item> <first>46</first> <second> <first>8</first> <second>1</second> </second> </item> <item> <first>47</first> <second> <first>0</first> <second>0</second> </second> </item> <item> <first>48</first> <second> <first>0</first> <second>0</second> </second> </item> <item> <first>49</first> <second> <first>10</first> <second>1</second> </second> </item> <item> <first>50</first> <second> <first>11</first> <second>0</second> </second> </item> <item> <first>52</first> <second> <first>12</first> <second>0</second> </second> </item> <item> <first>53</first> <second> <first>12</first> <second>0</second> </second> </item> <item> <first>54</first> <second> <first>12</first> <second>0</second> </second> </item> <item> <first>55</first> <second> <first>12</first> <second>0</second> </second> </item> <item> <first>56</first> <second> <first>12</first> <second>0</second> </second> </item> <item> <first>57</first> <second> <first>12</first> <second>0</second> </second> </item> <item> <first>58</first> <second> <first>12</first> <second>0</second> </second> </item> <item> <first>60</first> <second> <first>12</first> <second>0</second> </second> </item> <item> <first>61</first> <second> <first>12</first> <second>1</second> </second> </item> <item> <first>62</first> <second> <first>14</first> <second>0</second> </second> </item> <item> <first>63</first> <second> <first>14</first> <second>1</second> </second> </item> <item> <first>64</first> <second> <first>14</first> <second>0</second> </second> </item> <item> <first>65</first> <second> <first>15</first> <second>0</second> </second> </item> <item> <first>67</first> <second> <first>12</first> <second>0</second> </second> </item> <item> <first>68</first> <second> <first>12</first> <second>1</second> </second> </item> <item> <first>69</first> <second> <first>17</first> <second>1</second> </second> </item> <item> <first>70</first> <second> <first>18</first> <second>0</second> </second> </item> <item> <first>72</first> <second> <first>19</first> <second>0</second> </second> </item> <item> <first>73</first> <second> <first>19</first> <second>0</second> </second> </item> <item> <first>75</first> <second> <first>19</first> <second>0</second> </second> </item> <item> <first>76</first> <second> <first>19</first> <second>0</second> </second> </item> <item> <first>78</first> <second> <first>19</first> <second>0</second> </second> </item> <item> <first>79</first> <second> <first>19</first> <second>0</second> </second> </item> <item> <first>80</first> <second> <first>19</first> <second>1</second> </second> </item> <item> <first>81</first> <second> <first>19</first> <second>0</second> </second> </item> <item> <first>82</first> <second> <first>19</first> <second>1</second> </second> </item> <item> <first>83</first> <second> <first>20</first> <second>0</second> </second> </item> <item> <first>84</first> <second> <first>20</first> <second>0</second> </second> </item> <item> <first>85</first> <second> <first>21</first> <second>0</second> </second> </item> <item> <first>86</first> <second> <first>21</first> <second>0</second> </second> </item> <item> <first>87</first> <second> <first>21</first> <second>0</second> </second> </item> <item> <first>88</first> <second> <first>21</first> <second>0</second> </second> </item> <item> <first>89</first> <second> <first>21</first> <second>0</second> </second> </item> <item> <first>91</first> <second> <first>19</first> <second>1</second> </second> </item> <item> <first>92</first> <second> <first>19</first> <second>0</second> </second> </item> <item> <first>93</first> <second> <first>19</first> <second>0</second> </second> </item> <item> <first>94</first> <second> <first>23</first> <second>1</second> </second> </item> <item> <first>95</first> <second> <first>25</first> <second>0</second> </second> </item> <item> <first>96</first> <second> <first>25</first> <second>1</second> </second> </item> <item> <first>97</first> <second> <first>26</first> <second>0</second> </second> </item> <item> <first>98</first> <second> <first>26</first> <second>0</second> </second> </item> <item> <first>99</first> <second> <first>26</first> <second>0</second> </second> </item> <item> <first>101</first> <second> <first>27</first> <second>0</second> </second> </item> <item> <first>102</first> <second> <first>27</first> <second>0</second> </second> </item> <item> <first>103</first> <second> <first>27</first> <second>0</second> </second> </item> <item> <first>104</first> <second> <first>27</first> <second>0</second> </second> </item> <item> <first>106</first> <second> <first>28</first> <second>0</second> </second> </item> <item> <first>107</first> <second> <first>28</first> <second>1</second> </second> </item> <item> <first>108</first> <second> <first>30</first> <second>0</second> </second> </item> <item> <first>109</first> <second> <first>30</first> <second>1</second> </second> </item> <item> <first>110</first> <second> <first>31</first> <second>0</second> </second> </item> <item> <first>112</first> <second> <first>27</first> <second>1</second> </second> </item> <item> <first>113</first> <second> <first>32</first> <second>0</second> </second> </item> <item> <first>115</first> <second> <first>33</first> <second>0</second> </second> </item> <item> <first>116</first> <second> <first>33</first> <second>0</second> </second> </item> <item> <first>118</first> <second> <first>33</first> <second>0</second> </second> </item> <item> <first>119</first> <second> <first>33</first> <second>0</second> </second> </item> <item> <first>121</first> <second> <first>33</first> <second>0</second> </second> </item> <item> <first>122</first> <second> <first>33</first> <second>0</second> </second> </item> <item> <first>123</first> <second> <first>33</first> <second>1</second> </second> </item> <item> <first>124</first> <second> <first>33</first> <second>0</second> </second> </item> <item> <first>125</first> <second> <first>33</first> <second>1</second> </second> </item> <item> <first>126</first> <second> <first>34</first> <second>0</second> </second> </item> <item> <first>127</first> <second> <first>34</first> <second>0</second> </second> </item> <item> <first>128</first> <second> <first>35</first> <second>0</second> </second> </item> <item> <first>129</first> <second> <first>35</first> <second>0</second> </second> </item> <item> <first>130</first> <second> <first>35</first> <second>0</second> </second> </item> <item> <first>131</first> <second> <first>35</first> <second>0</second> </second> </item> <item> <first>132</first> <second> <first>35</first> <second>0</second> </second> </item> <item> <first>134</first> <second> <first>33</first> <second>0</second> </second> </item> </node_label_latency> <bblk_ent_exit class_id="27" tracking_level="0" version="0"> <count>13</count> <item_version>0</item_version> <item class_id="28" tracking_level="0" version="0"> <first>51</first> <second class_id="29" tracking_level="0" version="0"> <first>0</first> <second>11</second> </second> </item> <item> <first>59</first> <second> <first>12</first> <second>12</second> </second> </item> <item> <first>66</first> <second> <first>12</first> <second>15</second> </second> </item> <item> <first>71</first> <second> <first>12</first> <second>15</second> </second> </item> <item> <first>77</first> <second> <first>16</first> <second>16</second> </second> </item> <item> <first>90</first> <second> <first>16</first> <second>18</second> </second> </item> <item> <first>100</first> <second> <first>16</first> <second>21</second> </second> </item> <item> <first>105</first> <second> <first>22</first> <second>22</second> </second> </item> <item> <first>111</first> <second> <first>23</first> <second>26</second> </second> </item> <item> <first>114</first> <second> <first>22</first> <second>23</second> </second> </item> <item> <first>120</first> <second> <first>24</first> <second>24</second> </second> </item> <item> <first>133</first> <second> <first>24</first> <second>26</second> </second> </item> <item> <first>135</first> <second> <first>24</first> <second>24</second> </second> </item> </bblk_ent_exit> <regions class_id="30" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </regions> <dp_fu_nodes class_id="31" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </dp_fu_nodes> <dp_fu_nodes_expression class_id="32" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </dp_fu_nodes_expression> <dp_fu_nodes_module> <count>0</count> <item_version>0</item_version> </dp_fu_nodes_module> <dp_fu_nodes_io> <count>0</count> <item_version>0</item_version> </dp_fu_nodes_io> <return_ports> <count>0</count> <item_version>0</item_version> </return_ports> <dp_mem_port_nodes class_id="33" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </dp_mem_port_nodes> <dp_reg_nodes> <count>0</count> <item_version>0</item_version> </dp_reg_nodes> <dp_regname_nodes> <count>0</count> <item_version>0</item_version> </dp_regname_nodes> <dp_reg_phi> <count>0</count> <item_version>0</item_version> </dp_reg_phi> <dp_regname_phi> <count>0</count> <item_version>0</item_version> </dp_regname_phi> <dp_port_io_nodes class_id="34" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </dp_port_io_nodes> <port2core class_id="35" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </port2core> <node2core> <count>0</count> <item_version>0</item_version> </node2core> </syndb> </boost_serialization>
with Ada.Unchecked_Conversion; package body Memory_Compare is ------------ -- memcmp -- ------------ function memcmp (S1 : Address; S2 : Address; N : size_t) return int is subtype mem is char_array (size_t); type memptr is access mem; function to_memptr is new Ada.Unchecked_Conversion (Address, memptr); s1_p : constant memptr := to_memptr (S1); s2_p : constant memptr := to_memptr (S2); begin for J in 0 .. N - 1 loop if s1_p (J) < s2_p (J) then return -1; elsif s1_p (J) > s2_p (J) then return 1; end if; end loop; return 0; end memcmp; end Memory_Compare;
----------------------------------------------------------------------- -- servlet-rest-operation -- REST API Operation Definition -- Copyright (C) 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. ----------------------------------------------------------------------- generic Handler : Operation_Access; Method : Method_Type := GET; URI : String; Permission : Security.Permissions.Permission_Index := Security.Permissions.NONE; package Servlet.Rest.Operation is function Definition return Descriptor_Access; end Servlet.Rest.Operation;
-- Score PIXAL le 07/10/2020 à 17:04 : 100% with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with Ada.Characters.Handling; use Ada.Characters.Handling; procedure Robot_Type_1 is --| Le type T_Direction |--------------------------------------------------- type T_Direction is (NORD, EST, SUD, OUEST); procedure Get_Direction (Direction: out T_Direction ; Consigne: String) is Taille_Max: constant Integer := 10; -- suffisant pour une direction Direction_Texte: String (1..Taille_Max); -- une direction lue au clavier Taille: Integer; -- la taille effective de Direction_Texte begin -- Demander la direction (String) Put (Consigne); Get_Line (Direction_Texte, Taille); --! Lire une chaîne de caractère --! Réalise un Skip_Line -- Convertir la direction en texte en T_Direction Direction := T_Direction'Value (To_Upper (Direction_Texte (1..Taille))); end Get_Direction; --| Le type T_Robot |------------------------------------------------------- type T_Robot is -- ^ Y -- | -- | Robot de coordonnées (4, 2) direction OUEST -- 2 | <o -- 1 | -- -+--------------------------------> -- | 1 2 3 4 Y record Abscisse, Ordonnee: Integer; -- les coordonnées Direction: T_Direction; -- direction du robot end record; -- Initialiser un robot à partir se son abscisse, sont ordonnée et sa direction. procedure Initialiser ( Robot : out T_Robot; Abscisse, Ordonnee: in Integer; Direction: T_Direction ) with Post => Robot.Abscisse = Abscisse and Robot.Ordonnee = Ordonnee and Robot.Direction = Direction is begin Robot := T_Robot'(Abscisse, Ordonnee, Direction); end Initialiser; -- Afficher un robot sous la forme "(X, Y)>Direction>". procedure Put (Robot: in T_Robot) is begin Put ("("); Put (Robot.Abscisse, 1); Put (", "); Put (Robot.Ordonnee, 1); Put (")>"); Put (To_Lower (T_Direction'Image(Robot.Direction))); Put (">"); end Put; -- Afficher un robot en ajout un retour à la ligne. procedure Put_Line (Robot: in T_Robot) is begin Put (Robot); New_Line; end Put_Line; -- Faire avancer le robot d'une case suivant sa direction courante. procedure Avancer (Robot : in out T_Robot) is begin case Robot.Direction is when NORD => Robot.Ordonnee := Robot.Ordonnee + 1; when SUD => Robot.Ordonnee := Robot.Ordonnee - 1; when EST => Robot.Abscisse := Robot.Abscisse + 1; when OUEST => Robot.Abscisse := Robot.Abscisse - 1; end case; end Avancer; -- Faire pivoter le robot dans le sens NORD, EST, SUD, OUEST procedure Pivoter (Robot : in out T_Robot) is begin Robot.Direction := T_Direction'Val((T_Direction'Pos(Robot.Direction) + 1) mod 4); end Pivoter; --| Le type T_Environnement |----------------------------------------------- MAX_X: constant Integer := 100; MAX_Y: constant Integer := 50; type T_Case is (LIBRE, OBSTACLE); type T_Environnement is array (-MAX_x..MAX_X, -MAX_Y..MAX_Y) of T_Case; -- Faire avancer le robot d'une case suivant sa direction courante dans une -- environnement. On considère qu'il peut y avoir plusieurs robots dans la -- même case de l'environnement. Le robot n'avance pas s'il y a un obstrable. -- Il ne peut pas sortir de l'environnement. procedure Avancer (Robot : in out T_Robot ; Environnement : T_Environnement) with Pre => -MAX_X <= Robot.Abscisse and Robot.Abscisse <= Max_X and -MAX_Y <= Robot.Ordonnee and Robot.Ordonnee <= Max_Y is type T_VecteurDeplacement is array (T_Direction) of Integer; -- Invariant : les valeurs sont 0, 1 ou -1 DX: constant T_VecteurDeplacement := (0, 1, 0, -1); -- déplacmeent suivant l'axe des X DY: constant T_VecteurDeplacement := (1, 0, -1, 0); -- déplacmeent suivant l'axe des Y Nouveau_X, Nouveau_Y: Integer; -- nouvelles coordonnées du robot si pas d'obstacle begin -- Calculer les nouvelles coordonnées théoriques du robot Nouveau_X := Robot.Abscisse + DX (Robot.direction); Nouveau_Y := Robot.Ordonnee + DY (Robot.direction); if (-MAX_X <= Nouveau_X and Nouveau_X <= Max_X and -MAX_Y <= Nouveau_Y and Nouveau_Y <= Max_Y) and then Environnement (Nouveau_X, Nouveau_Y) = LIBRE then Robot.Abscisse := Nouveau_X; Robot.Ordonnee := Nouveau_Y; else null; -- le robot ne bouge pas end if; end Avancer; -- Faire pivoter le robot dans le sens NORD, EST, SUD, OUEST dans -- l'environnement considéré. -- Remarque : l'environnement n'a pas d'impact sur cette opération. procedure Pivoter (Robot : in out T_Robot; Environnement : in T_Environnement) is begin Pivoter (Robot); end Pivoter; -- Faire avancer le robot jusqu'à un obstacle ou aux limites de -- l'environnement. procedure Foncer(Robot : in out T_Robot; Environnement : in T_Environnement) is Ancien_X, Ancien_Y: Integer; begin loop Ancien_X := Robot.Abscisse; Ancien_Y := Robot.Ordonnee; Avancer(Robot, Environnement); exit when Ancien_X = Robot.Abscisse and Ancien_Y = Robot.Ordonnee; end loop; end Foncer; --| Sous-programmes qui manipulent les sous-programmes précédents |--------- -- Lire les informations d'un robot. procedure Lire_Robot (Robot : out T_Robot) is Abscisse, Ordonnee: Integer; -- les coordonnées initiales du robot Direction: T_Direction; -- la direction initiale du robot begin -- Demander l'abscisse Put ("Abscisse : "); Get (Abscisse); Skip_Line; -- Demander l'ordonnée Put ("Ordonnée : "); Get (Ordonnee); Skip_Line; -- Demander la direction Get_Direction (direction, "Direction : "); Initialiser (Robot, Abscisse, Ordonnee, Direction); end Lire_Robot; -- programme de test PIXAL pour le robot et ses sous-programmes procedure Exemple_Robot is Robot1 : T_Robot; begin Lire_Robot (Robot1); Put ("Robot lu : "); Put_Line (Robot1); for i in 1..4 loop Put ("Avancer : "); Avancer (Robot1); Put_Line (Robot1); Put ("Pivoter : "); Pivoter (Robot1); Put_Line (Robot1); end loop; end Exemple_Robot; procedure Exemple_Robot_Dans_Environnment is Robot1 : T_Robot; Environnement : T_Environnement; -- un exemple d'environnement begin -- Saisir le robot Lire_Robot (Robot1); Put ("Robot lu : "); Put_Line (Robot1); -- Initialiser l'environnement Environnement := (others => (others => LIBRE)); -- environnement vide Environnement ((Robot1.Abscisse + 20) mod MAX_X, Robot1.Ordonnee) := OBSTACLE; -- Faire foncer le robot Put_Line ("Le robot fonce..."); Foncer (Robot1, environnement); -- Afficher le robot Put ("Le robot s'arrête en : "); Put_Line (Robot1); end Exemple_Robot_Dans_Environnment; --| Le programme principal |------------------------------------------------ Type_Test: Character; begin -- Choisir le type de test Put ("Type de test : "); Get (Type_Test); Skip_Line; -- Lancer le test choisi case To_Lower (Type_Test) is when 'r' => Exemple_Robot; when 'e' => Exemple_Robot_Dans_Environnment; when others => Put ("Test inconnu"); end case; -- QUESTIONS -- 1: a: Elles ont été déclarés dans cet ordre pour simplifier l'affectation -- ex: NORD+1 = EST qui est bien un pivotage de 90deg. -- 1: b: L'utilisateur saisie une direction en ecrivant son nom -- 1: c: La procédure Get_Direction n'est pas robuste car si l'utilisateur entre une direction -- inconnue, la fonction jete un erreur. -- 1: d: Oui, car Get n'a pas de signature identique à Get_Direction -- (vu que T_Direction est definie par l'utilisateur). -- -- 3: a: T_Case admet deux valeurs (LIBRE, OCCUPE), Boolean admet aussi deux valeurs (True, False) -- donc on peux prendre le type Boolean au lieu de T_Case. (mais si Case = True, on veut dire quoi?) -- 3: b: DX et DY correspondent aux changements de position en relation avec la Direction -- ex: DX(NORD) = 0 car en direction nord on ne fait pas de déplacements sur l'axe X end Robot_Type_1;
with System.Storage_Elements; use System.Storage_Elements; with AUnit.Assertions; use AUnit.Assertions; with AAA.Strings; with Test_Utils; use Test_Utils; package body Testsuite.Decode.Basic_Tests is pragma Style_Checks ("gnatyM120-s"); ---------------- -- Basic_Test -- ---------------- procedure Basic_Test (Fixture : in out Decoder_Fixture; Input, Expected : Storage_Array) is Expected_Frame : constant Data_Frame := From_Array (Expected); begin Fixture.Decoder.Clear; for Elt of Input loop Fixture.Decoder.Receive (Elt); end loop; Fixture.Decoder.End_Of_Test; Assert (Fixture.Decoder.Number_Of_Frames = 1, "Unexpected number of output frames: " & Fixture.Decoder.Number_Of_Frames'Img & ASCII.LF & "Input : " & Image (Input)); declare Output_Frame : constant Data_Frame := Fixture.Decoder.Get_Frame (0); begin if Output_Frame /= Expected_Frame then declare Diff : constant AAA.Strings.Vector := Test_Utils.Diff (From_Array (Expected), Fixture.Decoder.Get_Frame (0)); begin Assert (False, "Input : " & Image (Input) & ASCII.LF & Diff.Flatten (ASCII.LF)); end; end if; end; end Basic_Test; --------------- -- Test_Zero -- --------------- procedure Test_Zero (Fixture : in out Decoder_Fixture) is begin -- Basic tests from the wikipedia COBS page... Basic_Test (Fixture, Input => (1, 1, 0), Expected => (0 => 0)); Basic_Test (Fixture, Input => (1, 1, 1, 0), Expected => (0, 0)); Basic_Test (Fixture, Input => (3, 1, 2, 2, 3, 0), Expected => (1, 2, 0, 3)); end Test_Zero; ---------------- -- Test_1_254 -- ---------------- procedure Test_1_254 (Fixture : in out Decoder_Fixture) is Long_Input : Storage_Array (0 .. 255); begin for X in Long_Input'Range loop Long_Input (X) := Storage_Element (X); end loop; Basic_Test (Fixture, Input => (0 => 16#FF#) & Long_Input (1 .. 254) & (0 => 16#00#), Expected => Long_Input (1 .. 254)); end Test_1_254; ---------------- -- Test_0_254 -- ---------------- procedure Test_0_254 (Fixture : in out Decoder_Fixture) is Long_Input : Storage_Array (0 .. 255); begin for X in Long_Input'Range loop Long_Input (X) := Storage_Element (X); end loop; Basic_Test (Fixture, Input => (16#01#, 16#FF#) & Long_Input (1 .. 254) & (0 => 16#00#), Expected => Long_Input (0 .. 254)); end Test_0_254; ---------------- -- Test_1_255 -- ---------------- procedure Test_1_255 (Fixture : in out Decoder_Fixture) is Long_Input : Storage_Array (0 .. 255); begin for X in Long_Input'Range loop Long_Input (X) := Storage_Element (X); end loop; Basic_Test (Fixture, Input => (0 => 16#FF#) & Long_Input (1 .. 254) & (16#02#, 16#FF#, 16#00#), Expected => Long_Input (1 .. 255)); end Test_1_255; ------------------ -- Test_2_255_0 -- ------------------ procedure Test_2_255_0 (Fixture : in out Decoder_Fixture) is Long_Input : Storage_Array (0 .. 255); begin for X in Long_Input'Range loop Long_Input (X) := Storage_Element (X); end loop; Basic_Test (Fixture, Input => (0 => 16#FF#) & Long_Input (2 .. 255) & (16#01#, 16#01#, 16#00#), Expected => Long_Input (2 .. 255) & (0 => 16#0#)); end Test_2_255_0; -------------------- -- Test_3_255_0_1 -- -------------------- procedure Test_3_255_0_1 (Fixture : in out Decoder_Fixture) is Long_Input : Storage_Array (0 .. 255); begin for X in Long_Input'Range loop Long_Input (X) := Storage_Element (X); end loop; Basic_Test (Fixture, Input => (0 => 16#FE#) & Long_Input (3 .. 255) & (16#02#, 16#01#, 16#00#), Expected => Long_Input (3 .. 255) & (16#0#, 16#01#)); end Test_3_255_0_1; --------------- -- Add_Tests -- --------------- procedure Add_Tests (Suite : in out AUnit.Test_Suites.Test_Suite'Class) is begin Suite.Add_Test (Decoder_Caller.Create ("Basics", Test_Zero'Access)); Suite.Add_Test (Decoder_Caller.Create ("1 .. 254", Test_1_254'Access)); Suite.Add_Test (Decoder_Caller.Create ("0 .. 254", Test_0_254'Access)); Suite.Add_Test (Decoder_Caller.Create ("1 .. 255", Test_1_255'Access)); Suite.Add_Test (Decoder_Caller.Create ("2 .. 255 & 0", Test_2_255_0'Access)); Suite.Add_Test (Decoder_Caller.Create ("3 .. 255 & 0 & 1", Test_3_255_0_1'Access)); end Add_Tests; end Testsuite.Decode.Basic_Tests;
-- 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/>. package Pck is procedure Hello; procedure There; -- The name of that procedure needs to be greater (in terms -- of alphabetical order) than the name of the procedure above. end Pck;
------------------------------------------------------------------------------ -- 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.Task_Identification; package Ada.Asynchronous_Task_Control is pragma Preelaborate (Asynchronous_Task_Control); procedure Hold (T : in Ada.Task_Identification.Task_Id); procedure Continue (T : in Ada.Task_Identification.Task_Id); function Is_Held (T : in Ada.Task_Identification.Task_Id) return Boolean; end Ada.Asynchronous_Task_Control;
----------------------------------------------------------------------- -- AWA.Events.Models -- AWA.Events.Models ----------------------------------------------------------------------- -- File generated by ada-gen DO NOT MODIFY -- Template used: templates/model/package-body.xhtml -- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095 ----------------------------------------------------------------------- -- Copyright (C) 2019 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.Unchecked_Deallocation; with Util.Beans.Objects.Time; package body AWA.Events.Models is use type ADO.Objects.Object_Record_Access; use type ADO.Objects.Object_Ref; pragma Warnings (Off, "formal parameter * is not referenced"); function Message_Type_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER, Of_Class => MESSAGE_TYPE_DEF'Access); begin ADO.Objects.Set_Value (Result, Id); return Result; end Message_Type_Key; function Message_Type_Key (Id : in String) return ADO.Objects.Object_Key is Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER, Of_Class => MESSAGE_TYPE_DEF'Access); begin ADO.Objects.Set_Value (Result, Id); return Result; end Message_Type_Key; function "=" (Left, Right : Message_Type_Ref'Class) return Boolean is begin return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right); end "="; procedure Set_Field (Object : in out Message_Type_Ref'Class; Impl : out Message_Type_Access) is Result : ADO.Objects.Object_Record_Access; begin Object.Prepare_Modify (Result); Impl := Message_Type_Impl (Result.all)'Access; end Set_Field; -- Internal method to allocate the Object_Record instance procedure Allocate (Object : in out Message_Type_Ref) is Impl : Message_Type_Access; begin Impl := new Message_Type_Impl; ADO.Objects.Set_Object (Object, Impl.all'Access); end Allocate; -- ---------------------------------------- -- Data object: Message_Type -- ---------------------------------------- procedure Set_Id (Object : in out Message_Type_Ref; Value : in ADO.Identifier) is Impl : Message_Type_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value); end Set_Id; function Get_Id (Object : in Message_Type_Ref) return ADO.Identifier is Impl : constant Message_Type_Access := Message_Type_Impl (Object.Get_Object.all)'Access; begin return Impl.Get_Key_Value; end Get_Id; procedure Set_Name (Object : in out Message_Type_Ref; Value : in String) is Impl : Message_Type_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_String (Impl.all, 2, Impl.Name, Value); end Set_Name; procedure Set_Name (Object : in out Message_Type_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String) is Impl : Message_Type_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Unbounded_String (Impl.all, 2, Impl.Name, Value); end Set_Name; function Get_Name (Object : in Message_Type_Ref) return String is begin return Ada.Strings.Unbounded.To_String (Object.Get_Name); end Get_Name; function Get_Name (Object : in Message_Type_Ref) return Ada.Strings.Unbounded.Unbounded_String is Impl : constant Message_Type_Access := Message_Type_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Name; end Get_Name; -- Copy of the object. procedure Copy (Object : in Message_Type_Ref; Into : in out Message_Type_Ref) is Result : Message_Type_Ref; begin if not Object.Is_Null then declare Impl : constant Message_Type_Access := Message_Type_Impl (Object.Get_Load_Object.all)'Access; Copy : constant Message_Type_Access := new Message_Type_Impl; begin ADO.Objects.Set_Object (Result, Copy.all'Access); Copy.Copy (Impl.all); Copy.Name := Impl.Name; end; end if; Into := Result; end Copy; procedure Find (Object : in out Message_Type_Ref; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean) is Impl : constant Message_Type_Access := new Message_Type_Impl; begin Impl.Find (Session, Query, Found); if Found then ADO.Objects.Set_Object (Object, Impl.all'Access); else ADO.Objects.Set_Object (Object, null); Destroy (Impl); end if; end Find; procedure Load (Object : in out Message_Type_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier) is Impl : constant Message_Type_Access := new Message_Type_Impl; Found : Boolean; Query : ADO.SQL.Query; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Impl.Find (Session, Query, Found); if not Found then Destroy (Impl); raise ADO.Objects.NOT_FOUND; end if; ADO.Objects.Set_Object (Object, Impl.all'Access); end Load; procedure Load (Object : in out Message_Type_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier; Found : out Boolean) is Impl : constant Message_Type_Access := new Message_Type_Impl; Query : ADO.SQL.Query; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Impl.Find (Session, Query, Found); if not Found then Destroy (Impl); else ADO.Objects.Set_Object (Object, Impl.all'Access); end if; end Load; procedure Save (Object : in out Message_Type_Ref; Session : in out ADO.Sessions.Master_Session'Class) is Impl : ADO.Objects.Object_Record_Access := Object.Get_Object; begin if Impl = null then Impl := new Message_Type_Impl; ADO.Objects.Set_Object (Object, Impl); end if; if not ADO.Objects.Is_Created (Impl.all) then Impl.Create (Session); else Impl.Save (Session); end if; end Save; procedure Delete (Object : in out Message_Type_Ref; Session : in out ADO.Sessions.Master_Session'Class) is Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object; begin if Impl /= null then Impl.Delete (Session); end if; end Delete; -- -------------------- -- Free the object -- -------------------- procedure Destroy (Object : access Message_Type_Impl) is type Message_Type_Impl_Ptr is access all Message_Type_Impl; procedure Unchecked_Free is new Ada.Unchecked_Deallocation (Message_Type_Impl, Message_Type_Impl_Ptr); pragma Warnings (Off, "*redundant conversion*"); Ptr : Message_Type_Impl_Ptr := Message_Type_Impl (Object.all)'Access; pragma Warnings (On, "*redundant conversion*"); begin Unchecked_Free (Ptr); end Destroy; procedure Find (Object : in out Message_Type_Impl; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean) is Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Query, MESSAGE_TYPE_DEF'Access); begin Stmt.Execute; if Stmt.Has_Elements then Object.Load (Stmt, Session); Stmt.Next; Found := not Stmt.Has_Elements; else Found := False; end if; end Find; overriding procedure Load (Object : in out Message_Type_Impl; Session : in out ADO.Sessions.Session'Class) is Found : Boolean; Query : ADO.SQL.Query; Id : constant ADO.Identifier := Object.Get_Key_Value; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Object.Find (Session, Query, Found); if not Found then raise ADO.Objects.NOT_FOUND; end if; end Load; procedure Save (Object : in out Message_Type_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Stmt : ADO.Statements.Update_Statement := Session.Create_Statement (MESSAGE_TYPE_DEF'Access); begin if Object.Is_Modified (1) then Stmt.Save_Field (Name => COL_0_1_NAME, -- id Value => Object.Get_Key); Object.Clear_Modified (1); end if; if Object.Is_Modified (2) then Stmt.Save_Field (Name => COL_1_1_NAME, -- name Value => Object.Name); Object.Clear_Modified (2); end if; if Stmt.Has_Save_Fields then Stmt.Set_Filter (Filter => "id = ?"); Stmt.Add_Param (Value => Object.Get_Key); declare Result : Integer; begin Stmt.Execute (Result); if Result /= 1 then if Result /= 0 then raise ADO.Objects.UPDATE_ERROR; end if; end if; end; end if; end Save; procedure Create (Object : in out Message_Type_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Query : ADO.Statements.Insert_Statement := Session.Create_Statement (MESSAGE_TYPE_DEF'Access); Result : Integer; begin Session.Allocate (Id => Object); Query.Save_Field (Name => COL_0_1_NAME, -- id Value => Object.Get_Key); Query.Save_Field (Name => COL_1_1_NAME, -- name Value => Object.Name); Query.Execute (Result); if Result /= 1 then raise ADO.Objects.INSERT_ERROR; end if; ADO.Objects.Set_Created (Object); end Create; procedure Delete (Object : in out Message_Type_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Stmt : ADO.Statements.Delete_Statement := Session.Create_Statement (MESSAGE_TYPE_DEF'Access); begin Stmt.Set_Filter (Filter => "id = ?"); Stmt.Add_Param (Value => Object.Get_Key); Stmt.Execute; end Delete; -- ------------------------------ -- Get the bean attribute identified by the name. -- ------------------------------ overriding function Get_Value (From : in Message_Type_Ref; Name : in String) return Util.Beans.Objects.Object is Obj : ADO.Objects.Object_Record_Access; Impl : access Message_Type_Impl; begin if From.Is_Null then return Util.Beans.Objects.Null_Object; end if; Obj := From.Get_Load_Object; Impl := Message_Type_Impl (Obj.all)'Access; if Name = "id" then return ADO.Objects.To_Object (Impl.Get_Key); elsif Name = "name" then return Util.Beans.Objects.To_Object (Impl.Name); end if; return Util.Beans.Objects.Null_Object; end Get_Value; procedure List (Object : in out Message_Type_Vector; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class) is Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Query, MESSAGE_TYPE_DEF'Access); begin Stmt.Execute; Message_Type_Vectors.Clear (Object); while Stmt.Has_Elements loop declare Item : Message_Type_Ref; Impl : constant Message_Type_Access := new Message_Type_Impl; begin Impl.Load (Stmt, Session); ADO.Objects.Set_Object (Item, Impl.all'Access); Object.Append (Item); end; Stmt.Next; end loop; end List; -- ------------------------------ -- Load the object from current iterator position -- ------------------------------ procedure Load (Object : in out Message_Type_Impl; Stmt : in out ADO.Statements.Query_Statement'Class; Session : in out ADO.Sessions.Session'Class) is pragma Unreferenced (Session); begin Object.Set_Key_Value (Stmt.Get_Identifier (0)); Object.Name := Stmt.Get_Unbounded_String (1); ADO.Objects.Set_Created (Object); end Load; function Queue_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER, Of_Class => QUEUE_DEF'Access); begin ADO.Objects.Set_Value (Result, Id); return Result; end Queue_Key; function Queue_Key (Id : in String) return ADO.Objects.Object_Key is Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER, Of_Class => QUEUE_DEF'Access); begin ADO.Objects.Set_Value (Result, Id); return Result; end Queue_Key; function "=" (Left, Right : Queue_Ref'Class) return Boolean is begin return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right); end "="; procedure Set_Field (Object : in out Queue_Ref'Class; Impl : out Queue_Access) is Result : ADO.Objects.Object_Record_Access; begin Object.Prepare_Modify (Result); Impl := Queue_Impl (Result.all)'Access; end Set_Field; -- Internal method to allocate the Object_Record instance procedure Allocate (Object : in out Queue_Ref) is Impl : Queue_Access; begin Impl := new Queue_Impl; Impl.Server_Id := 0; ADO.Objects.Set_Object (Object, Impl.all'Access); end Allocate; -- ---------------------------------------- -- Data object: Queue -- ---------------------------------------- procedure Set_Id (Object : in out Queue_Ref; Value : in ADO.Identifier) is Impl : Queue_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value); end Set_Id; function Get_Id (Object : in Queue_Ref) return ADO.Identifier is Impl : constant Queue_Access := Queue_Impl (Object.Get_Object.all)'Access; begin return Impl.Get_Key_Value; end Get_Id; procedure Set_Server_Id (Object : in out Queue_Ref; Value : in Integer) is Impl : Queue_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Integer (Impl.all, 2, Impl.Server_Id, Value); end Set_Server_Id; function Get_Server_Id (Object : in Queue_Ref) return Integer is Impl : constant Queue_Access := Queue_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Server_Id; end Get_Server_Id; procedure Set_Name (Object : in out Queue_Ref; Value : in String) is Impl : Queue_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_String (Impl.all, 3, Impl.Name, Value); end Set_Name; procedure Set_Name (Object : in out Queue_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String) is Impl : Queue_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Unbounded_String (Impl.all, 3, Impl.Name, Value); end Set_Name; function Get_Name (Object : in Queue_Ref) return String is begin return Ada.Strings.Unbounded.To_String (Object.Get_Name); end Get_Name; function Get_Name (Object : in Queue_Ref) return Ada.Strings.Unbounded.Unbounded_String is Impl : constant Queue_Access := Queue_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Name; end Get_Name; -- Copy of the object. procedure Copy (Object : in Queue_Ref; Into : in out Queue_Ref) is Result : Queue_Ref; begin if not Object.Is_Null then declare Impl : constant Queue_Access := Queue_Impl (Object.Get_Load_Object.all)'Access; Copy : constant Queue_Access := new Queue_Impl; begin ADO.Objects.Set_Object (Result, Copy.all'Access); Copy.Copy (Impl.all); Copy.Server_Id := Impl.Server_Id; Copy.Name := Impl.Name; end; end if; Into := Result; end Copy; procedure Find (Object : in out Queue_Ref; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean) is Impl : constant Queue_Access := new Queue_Impl; begin Impl.Find (Session, Query, Found); if Found then ADO.Objects.Set_Object (Object, Impl.all'Access); else ADO.Objects.Set_Object (Object, null); Destroy (Impl); end if; end Find; procedure Load (Object : in out Queue_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier) is Impl : constant Queue_Access := new Queue_Impl; Found : Boolean; Query : ADO.SQL.Query; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Impl.Find (Session, Query, Found); if not Found then Destroy (Impl); raise ADO.Objects.NOT_FOUND; end if; ADO.Objects.Set_Object (Object, Impl.all'Access); end Load; procedure Load (Object : in out Queue_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier; Found : out Boolean) is Impl : constant Queue_Access := new Queue_Impl; Query : ADO.SQL.Query; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Impl.Find (Session, Query, Found); if not Found then Destroy (Impl); else ADO.Objects.Set_Object (Object, Impl.all'Access); end if; end Load; procedure Save (Object : in out Queue_Ref; Session : in out ADO.Sessions.Master_Session'Class) is Impl : ADO.Objects.Object_Record_Access := Object.Get_Object; begin if Impl = null then Impl := new Queue_Impl; ADO.Objects.Set_Object (Object, Impl); end if; if not ADO.Objects.Is_Created (Impl.all) then Impl.Create (Session); else Impl.Save (Session); end if; end Save; procedure Delete (Object : in out Queue_Ref; Session : in out ADO.Sessions.Master_Session'Class) is Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object; begin if Impl /= null then Impl.Delete (Session); end if; end Delete; -- -------------------- -- Free the object -- -------------------- procedure Destroy (Object : access Queue_Impl) is type Queue_Impl_Ptr is access all Queue_Impl; procedure Unchecked_Free is new Ada.Unchecked_Deallocation (Queue_Impl, Queue_Impl_Ptr); pragma Warnings (Off, "*redundant conversion*"); Ptr : Queue_Impl_Ptr := Queue_Impl (Object.all)'Access; pragma Warnings (On, "*redundant conversion*"); begin Unchecked_Free (Ptr); end Destroy; procedure Find (Object : in out Queue_Impl; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean) is Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Query, QUEUE_DEF'Access); begin Stmt.Execute; if Stmt.Has_Elements then Object.Load (Stmt, Session); Stmt.Next; Found := not Stmt.Has_Elements; else Found := False; end if; end Find; overriding procedure Load (Object : in out Queue_Impl; Session : in out ADO.Sessions.Session'Class) is Found : Boolean; Query : ADO.SQL.Query; Id : constant ADO.Identifier := Object.Get_Key_Value; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Object.Find (Session, Query, Found); if not Found then raise ADO.Objects.NOT_FOUND; end if; end Load; procedure Save (Object : in out Queue_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Stmt : ADO.Statements.Update_Statement := Session.Create_Statement (QUEUE_DEF'Access); begin if Object.Is_Modified (1) then Stmt.Save_Field (Name => COL_0_2_NAME, -- id Value => Object.Get_Key); Object.Clear_Modified (1); end if; if Object.Is_Modified (2) then Stmt.Save_Field (Name => COL_1_2_NAME, -- server_id Value => Object.Server_Id); Object.Clear_Modified (2); end if; if Object.Is_Modified (3) then Stmt.Save_Field (Name => COL_2_2_NAME, -- name Value => Object.Name); Object.Clear_Modified (3); end if; if Stmt.Has_Save_Fields then Stmt.Set_Filter (Filter => "id = ?"); Stmt.Add_Param (Value => Object.Get_Key); declare Result : Integer; begin Stmt.Execute (Result); if Result /= 1 then if Result /= 0 then raise ADO.Objects.UPDATE_ERROR; end if; end if; end; end if; end Save; procedure Create (Object : in out Queue_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Query : ADO.Statements.Insert_Statement := Session.Create_Statement (QUEUE_DEF'Access); Result : Integer; begin Session.Allocate (Id => Object); Query.Save_Field (Name => COL_0_2_NAME, -- id Value => Object.Get_Key); Query.Save_Field (Name => COL_1_2_NAME, -- server_id Value => Object.Server_Id); Query.Save_Field (Name => COL_2_2_NAME, -- name Value => Object.Name); Query.Execute (Result); if Result /= 1 then raise ADO.Objects.INSERT_ERROR; end if; ADO.Objects.Set_Created (Object); end Create; procedure Delete (Object : in out Queue_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Stmt : ADO.Statements.Delete_Statement := Session.Create_Statement (QUEUE_DEF'Access); begin Stmt.Set_Filter (Filter => "id = ?"); Stmt.Add_Param (Value => Object.Get_Key); Stmt.Execute; end Delete; -- ------------------------------ -- Get the bean attribute identified by the name. -- ------------------------------ overriding function Get_Value (From : in Queue_Ref; Name : in String) return Util.Beans.Objects.Object is Obj : ADO.Objects.Object_Record_Access; Impl : access Queue_Impl; begin if From.Is_Null then return Util.Beans.Objects.Null_Object; end if; Obj := From.Get_Load_Object; Impl := Queue_Impl (Obj.all)'Access; if Name = "id" then return ADO.Objects.To_Object (Impl.Get_Key); elsif Name = "server_id" then return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Server_Id)); elsif Name = "name" then return Util.Beans.Objects.To_Object (Impl.Name); end if; return Util.Beans.Objects.Null_Object; end Get_Value; -- ------------------------------ -- Load the object from current iterator position -- ------------------------------ procedure Load (Object : in out Queue_Impl; Stmt : in out ADO.Statements.Query_Statement'Class; Session : in out ADO.Sessions.Session'Class) is pragma Unreferenced (Session); begin Object.Set_Key_Value (Stmt.Get_Identifier (0)); Object.Server_Id := Stmt.Get_Integer (1); Object.Name := Stmt.Get_Unbounded_String (2); ADO.Objects.Set_Created (Object); end Load; function Message_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER, Of_Class => MESSAGE_DEF'Access); begin ADO.Objects.Set_Value (Result, Id); return Result; end Message_Key; function Message_Key (Id : in String) return ADO.Objects.Object_Key is Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER, Of_Class => MESSAGE_DEF'Access); begin ADO.Objects.Set_Value (Result, Id); return Result; end Message_Key; function "=" (Left, Right : Message_Ref'Class) return Boolean is begin return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right); end "="; procedure Set_Field (Object : in out Message_Ref'Class; Impl : out Message_Access) is Result : ADO.Objects.Object_Record_Access; begin Object.Prepare_Modify (Result); Impl := Message_Impl (Result.all)'Access; end Set_Field; -- Internal method to allocate the Object_Record instance procedure Allocate (Object : in out Message_Ref) is Impl : Message_Access; begin Impl := new Message_Impl; Impl.Create_Date := ADO.DEFAULT_TIME; Impl.Priority := 0; Impl.Count := 0; Impl.Server_Id := 0; Impl.Task_Id := 0; Impl.Status := AWA.Events.Models.Message_Status_Type'First; Impl.Processing_Date.Is_Null := True; Impl.Version := 0; Impl.Entity_Id := ADO.NO_IDENTIFIER; Impl.Entity_Type := 0; Impl.Finish_Date.Is_Null := True; ADO.Objects.Set_Object (Object, Impl.all'Access); end Allocate; -- ---------------------------------------- -- Data object: Message -- ---------------------------------------- procedure Set_Id (Object : in out Message_Ref; Value : in ADO.Identifier) is Impl : Message_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value); end Set_Id; function Get_Id (Object : in Message_Ref) return ADO.Identifier is Impl : constant Message_Access := Message_Impl (Object.Get_Object.all)'Access; begin return Impl.Get_Key_Value; end Get_Id; procedure Set_Create_Date (Object : in out Message_Ref; Value : in Ada.Calendar.Time) is Impl : Message_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Time (Impl.all, 2, Impl.Create_Date, Value); end Set_Create_Date; function Get_Create_Date (Object : in Message_Ref) return Ada.Calendar.Time is Impl : constant Message_Access := Message_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Create_Date; end Get_Create_Date; procedure Set_Priority (Object : in out Message_Ref; Value : in Integer) is Impl : Message_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Integer (Impl.all, 3, Impl.Priority, Value); end Set_Priority; function Get_Priority (Object : in Message_Ref) return Integer is Impl : constant Message_Access := Message_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Priority; end Get_Priority; procedure Set_Count (Object : in out Message_Ref; Value : in Integer) is Impl : Message_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Integer (Impl.all, 4, Impl.Count, Value); end Set_Count; function Get_Count (Object : in Message_Ref) return Integer is Impl : constant Message_Access := Message_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Count; end Get_Count; procedure Set_Parameters (Object : in out Message_Ref; Value : in String) is Impl : Message_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_String (Impl.all, 5, Impl.Parameters, Value); end Set_Parameters; procedure Set_Parameters (Object : in out Message_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String) is Impl : Message_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Unbounded_String (Impl.all, 5, Impl.Parameters, Value); end Set_Parameters; function Get_Parameters (Object : in Message_Ref) return String is begin return Ada.Strings.Unbounded.To_String (Object.Get_Parameters); end Get_Parameters; function Get_Parameters (Object : in Message_Ref) return Ada.Strings.Unbounded.Unbounded_String is Impl : constant Message_Access := Message_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Parameters; end Get_Parameters; procedure Set_Server_Id (Object : in out Message_Ref; Value : in Integer) is Impl : Message_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Integer (Impl.all, 6, Impl.Server_Id, Value); end Set_Server_Id; function Get_Server_Id (Object : in Message_Ref) return Integer is Impl : constant Message_Access := Message_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Server_Id; end Get_Server_Id; procedure Set_Task_Id (Object : in out Message_Ref; Value : in Integer) is Impl : Message_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Integer (Impl.all, 7, Impl.Task_Id, Value); end Set_Task_Id; function Get_Task_Id (Object : in Message_Ref) return Integer is Impl : constant Message_Access := Message_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Task_Id; end Get_Task_Id; procedure Set_Status (Object : in out Message_Ref; Value : in AWA.Events.Models.Message_Status_Type) is procedure Set_Field_Enum is new ADO.Objects.Set_Field_Operation (Message_Status_Type); Impl : Message_Access; begin Set_Field (Object, Impl); Set_Field_Enum (Impl.all, 8, Impl.Status, Value); end Set_Status; function Get_Status (Object : in Message_Ref) return AWA.Events.Models.Message_Status_Type is Impl : constant Message_Access := Message_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Status; end Get_Status; procedure Set_Processing_Date (Object : in out Message_Ref; Value : in ADO.Nullable_Time) is Impl : Message_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Time (Impl.all, 9, Impl.Processing_Date, Value); end Set_Processing_Date; function Get_Processing_Date (Object : in Message_Ref) return ADO.Nullable_Time is Impl : constant Message_Access := Message_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Processing_Date; end Get_Processing_Date; function Get_Version (Object : in Message_Ref) return Integer is Impl : constant Message_Access := Message_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Version; end Get_Version; procedure Set_Entity_Id (Object : in out Message_Ref; Value : in ADO.Identifier) is Impl : Message_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Identifier (Impl.all, 11, Impl.Entity_Id, Value); end Set_Entity_Id; function Get_Entity_Id (Object : in Message_Ref) return ADO.Identifier is Impl : constant Message_Access := Message_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Entity_Id; end Get_Entity_Id; procedure Set_Entity_Type (Object : in out Message_Ref; Value : in ADO.Entity_Type) is Impl : Message_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Entity_Type (Impl.all, 12, Impl.Entity_Type, Value); end Set_Entity_Type; function Get_Entity_Type (Object : in Message_Ref) return ADO.Entity_Type is Impl : constant Message_Access := Message_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Entity_Type; end Get_Entity_Type; procedure Set_Finish_Date (Object : in out Message_Ref; Value : in ADO.Nullable_Time) is Impl : Message_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Time (Impl.all, 13, Impl.Finish_Date, Value); end Set_Finish_Date; function Get_Finish_Date (Object : in Message_Ref) return ADO.Nullable_Time is Impl : constant Message_Access := Message_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Finish_Date; end Get_Finish_Date; procedure Set_Queue (Object : in out Message_Ref; Value : in AWA.Events.Models.Queue_Ref'Class) is Impl : Message_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Object (Impl.all, 14, Impl.Queue, Value); end Set_Queue; function Get_Queue (Object : in Message_Ref) return AWA.Events.Models.Queue_Ref'Class is Impl : constant Message_Access := Message_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Queue; end Get_Queue; procedure Set_Message_Type (Object : in out Message_Ref; Value : in AWA.Events.Models.Message_Type_Ref'Class) is Impl : Message_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Object (Impl.all, 15, Impl.Message_Type, Value); end Set_Message_Type; function Get_Message_Type (Object : in Message_Ref) return AWA.Events.Models.Message_Type_Ref'Class is Impl : constant Message_Access := Message_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Message_Type; end Get_Message_Type; procedure Set_User (Object : in out Message_Ref; Value : in AWA.Users.Models.User_Ref'Class) is Impl : Message_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Object (Impl.all, 16, Impl.User, Value); end Set_User; function Get_User (Object : in Message_Ref) return AWA.Users.Models.User_Ref'Class is Impl : constant Message_Access := Message_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.User; end Get_User; procedure Set_Session (Object : in out Message_Ref; Value : in AWA.Users.Models.Session_Ref'Class) is Impl : Message_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Object (Impl.all, 17, Impl.Session, Value); end Set_Session; function Get_Session (Object : in Message_Ref) return AWA.Users.Models.Session_Ref'Class is Impl : constant Message_Access := Message_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Session; end Get_Session; -- Copy of the object. procedure Copy (Object : in Message_Ref; Into : in out Message_Ref) is Result : Message_Ref; begin if not Object.Is_Null then declare Impl : constant Message_Access := Message_Impl (Object.Get_Load_Object.all)'Access; Copy : constant Message_Access := new Message_Impl; begin ADO.Objects.Set_Object (Result, Copy.all'Access); Copy.Copy (Impl.all); Copy.Create_Date := Impl.Create_Date; Copy.Priority := Impl.Priority; Copy.Count := Impl.Count; Copy.Parameters := Impl.Parameters; Copy.Server_Id := Impl.Server_Id; Copy.Task_Id := Impl.Task_Id; Copy.Status := Impl.Status; Copy.Processing_Date := Impl.Processing_Date; Copy.Version := Impl.Version; Copy.Entity_Id := Impl.Entity_Id; Copy.Entity_Type := Impl.Entity_Type; Copy.Finish_Date := Impl.Finish_Date; Copy.Queue := Impl.Queue; Copy.Message_Type := Impl.Message_Type; Copy.User := Impl.User; Copy.Session := Impl.Session; end; end if; Into := Result; end Copy; procedure Find (Object : in out Message_Ref; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean) is Impl : constant Message_Access := new Message_Impl; begin Impl.Find (Session, Query, Found); if Found then ADO.Objects.Set_Object (Object, Impl.all'Access); else ADO.Objects.Set_Object (Object, null); Destroy (Impl); end if; end Find; procedure Load (Object : in out Message_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier) is Impl : constant Message_Access := new Message_Impl; Found : Boolean; Query : ADO.SQL.Query; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Impl.Find (Session, Query, Found); if not Found then Destroy (Impl); raise ADO.Objects.NOT_FOUND; end if; ADO.Objects.Set_Object (Object, Impl.all'Access); end Load; procedure Load (Object : in out Message_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier; Found : out Boolean) is Impl : constant Message_Access := new Message_Impl; Query : ADO.SQL.Query; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Impl.Find (Session, Query, Found); if not Found then Destroy (Impl); else ADO.Objects.Set_Object (Object, Impl.all'Access); end if; end Load; procedure Save (Object : in out Message_Ref; Session : in out ADO.Sessions.Master_Session'Class) is Impl : ADO.Objects.Object_Record_Access := Object.Get_Object; begin if Impl = null then Impl := new Message_Impl; ADO.Objects.Set_Object (Object, Impl); end if; if not ADO.Objects.Is_Created (Impl.all) then Impl.Create (Session); else Impl.Save (Session); end if; end Save; procedure Delete (Object : in out Message_Ref; Session : in out ADO.Sessions.Master_Session'Class) is Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object; begin if Impl /= null then Impl.Delete (Session); end if; end Delete; -- -------------------- -- Free the object -- -------------------- procedure Destroy (Object : access Message_Impl) is type Message_Impl_Ptr is access all Message_Impl; procedure Unchecked_Free is new Ada.Unchecked_Deallocation (Message_Impl, Message_Impl_Ptr); pragma Warnings (Off, "*redundant conversion*"); Ptr : Message_Impl_Ptr := Message_Impl (Object.all)'Access; pragma Warnings (On, "*redundant conversion*"); begin Unchecked_Free (Ptr); end Destroy; procedure Find (Object : in out Message_Impl; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean) is Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Query, MESSAGE_DEF'Access); begin Stmt.Execute; if Stmt.Has_Elements then Object.Load (Stmt, Session); Stmt.Next; Found := not Stmt.Has_Elements; else Found := False; end if; end Find; overriding procedure Load (Object : in out Message_Impl; Session : in out ADO.Sessions.Session'Class) is Found : Boolean; Query : ADO.SQL.Query; Id : constant ADO.Identifier := Object.Get_Key_Value; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Object.Find (Session, Query, Found); if not Found then raise ADO.Objects.NOT_FOUND; end if; end Load; procedure Save (Object : in out Message_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Stmt : ADO.Statements.Update_Statement := Session.Create_Statement (MESSAGE_DEF'Access); begin if Object.Is_Modified (1) then Stmt.Save_Field (Name => COL_0_3_NAME, -- id Value => Object.Get_Key); Object.Clear_Modified (1); end if; if Object.Is_Modified (2) then Stmt.Save_Field (Name => COL_1_3_NAME, -- create_date Value => Object.Create_Date); Object.Clear_Modified (2); end if; if Object.Is_Modified (3) then Stmt.Save_Field (Name => COL_2_3_NAME, -- priority Value => Object.Priority); Object.Clear_Modified (3); end if; if Object.Is_Modified (4) then Stmt.Save_Field (Name => COL_3_3_NAME, -- count Value => Object.Count); Object.Clear_Modified (4); end if; if Object.Is_Modified (5) then Stmt.Save_Field (Name => COL_4_3_NAME, -- parameters Value => Object.Parameters); Object.Clear_Modified (5); end if; if Object.Is_Modified (6) then Stmt.Save_Field (Name => COL_5_3_NAME, -- server_id Value => Object.Server_Id); Object.Clear_Modified (6); end if; if Object.Is_Modified (7) then Stmt.Save_Field (Name => COL_6_3_NAME, -- task_id Value => Object.Task_Id); Object.Clear_Modified (7); end if; if Object.Is_Modified (8) then Stmt.Save_Field (Name => COL_7_3_NAME, -- status Value => Integer (Message_Status_Type'Pos (Object.Status))); Object.Clear_Modified (8); end if; if Object.Is_Modified (9) then Stmt.Save_Field (Name => COL_8_3_NAME, -- processing_date Value => Object.Processing_Date); Object.Clear_Modified (9); end if; if Object.Is_Modified (11) then Stmt.Save_Field (Name => COL_10_3_NAME, -- entity_id Value => Object.Entity_Id); Object.Clear_Modified (11); end if; if Object.Is_Modified (12) then Stmt.Save_Field (Name => COL_11_3_NAME, -- entity_type Value => Object.Entity_Type); Object.Clear_Modified (12); end if; if Object.Is_Modified (13) then Stmt.Save_Field (Name => COL_12_3_NAME, -- finish_date Value => Object.Finish_Date); Object.Clear_Modified (13); end if; if Object.Is_Modified (14) then Stmt.Save_Field (Name => COL_13_3_NAME, -- queue_id Value => Object.Queue); Object.Clear_Modified (14); end if; if Object.Is_Modified (15) then Stmt.Save_Field (Name => COL_14_3_NAME, -- message_type_id Value => Object.Message_Type); Object.Clear_Modified (15); end if; if Object.Is_Modified (16) then Stmt.Save_Field (Name => COL_15_3_NAME, -- user_id Value => Object.User); Object.Clear_Modified (16); end if; if Object.Is_Modified (17) then Stmt.Save_Field (Name => COL_16_3_NAME, -- session_id Value => Object.Session); Object.Clear_Modified (17); end if; if Stmt.Has_Save_Fields then Object.Version := Object.Version + 1; Stmt.Save_Field (Name => "version", Value => Object.Version); Stmt.Set_Filter (Filter => "id = ? and version = ?"); Stmt.Add_Param (Value => Object.Get_Key); Stmt.Add_Param (Value => Object.Version - 1); declare Result : Integer; begin Stmt.Execute (Result); if Result /= 1 then if Result /= 0 then raise ADO.Objects.UPDATE_ERROR; else raise ADO.Objects.LAZY_LOCK; end if; end if; end; end if; end Save; procedure Create (Object : in out Message_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Query : ADO.Statements.Insert_Statement := Session.Create_Statement (MESSAGE_DEF'Access); Result : Integer; begin Object.Version := 1; Session.Allocate (Id => Object); Query.Save_Field (Name => COL_0_3_NAME, -- id Value => Object.Get_Key); Query.Save_Field (Name => COL_1_3_NAME, -- create_date Value => Object.Create_Date); Query.Save_Field (Name => COL_2_3_NAME, -- priority Value => Object.Priority); Query.Save_Field (Name => COL_3_3_NAME, -- count Value => Object.Count); Query.Save_Field (Name => COL_4_3_NAME, -- parameters Value => Object.Parameters); Query.Save_Field (Name => COL_5_3_NAME, -- server_id Value => Object.Server_Id); Query.Save_Field (Name => COL_6_3_NAME, -- task_id Value => Object.Task_Id); Query.Save_Field (Name => COL_7_3_NAME, -- status Value => Integer (Message_Status_Type'Pos (Object.Status))); Query.Save_Field (Name => COL_8_3_NAME, -- processing_date Value => Object.Processing_Date); Query.Save_Field (Name => COL_9_3_NAME, -- version Value => Object.Version); Query.Save_Field (Name => COL_10_3_NAME, -- entity_id Value => Object.Entity_Id); Query.Save_Field (Name => COL_11_3_NAME, -- entity_type Value => Object.Entity_Type); Query.Save_Field (Name => COL_12_3_NAME, -- finish_date Value => Object.Finish_Date); Query.Save_Field (Name => COL_13_3_NAME, -- queue_id Value => Object.Queue); Query.Save_Field (Name => COL_14_3_NAME, -- message_type_id Value => Object.Message_Type); Query.Save_Field (Name => COL_15_3_NAME, -- user_id Value => Object.User); Query.Save_Field (Name => COL_16_3_NAME, -- session_id Value => Object.Session); Query.Execute (Result); if Result /= 1 then raise ADO.Objects.INSERT_ERROR; end if; ADO.Objects.Set_Created (Object); end Create; procedure Delete (Object : in out Message_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Stmt : ADO.Statements.Delete_Statement := Session.Create_Statement (MESSAGE_DEF'Access); begin Stmt.Set_Filter (Filter => "id = ?"); Stmt.Add_Param (Value => Object.Get_Key); Stmt.Execute; end Delete; -- ------------------------------ -- Get the bean attribute identified by the name. -- ------------------------------ overriding function Get_Value (From : in Message_Ref; Name : in String) return Util.Beans.Objects.Object is Obj : ADO.Objects.Object_Record_Access; Impl : access Message_Impl; begin if From.Is_Null then return Util.Beans.Objects.Null_Object; end if; Obj := From.Get_Load_Object; Impl := Message_Impl (Obj.all)'Access; if Name = "id" then return ADO.Objects.To_Object (Impl.Get_Key); elsif Name = "create_date" then return Util.Beans.Objects.Time.To_Object (Impl.Create_Date); elsif Name = "priority" then return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Priority)); elsif Name = "count" then return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Count)); elsif Name = "parameters" then return Util.Beans.Objects.To_Object (Impl.Parameters); elsif Name = "server_id" then return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Server_Id)); elsif Name = "task_id" then return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Task_Id)); elsif Name = "status" then return AWA.Events.Models.Message_Status_Type_Objects.To_Object (Impl.Status); elsif Name = "processing_date" then if Impl.Processing_Date.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.Time.To_Object (Impl.Processing_Date.Value); end if; elsif Name = "entity_id" then return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Entity_Id)); elsif Name = "entity_type" then return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Entity_Type)); elsif Name = "finish_date" then if Impl.Finish_Date.Is_Null then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.Time.To_Object (Impl.Finish_Date.Value); end if; end if; return Util.Beans.Objects.Null_Object; end Get_Value; procedure List (Object : in out Message_Vector; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class) is Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Query, MESSAGE_DEF'Access); begin Stmt.Execute; Message_Vectors.Clear (Object); while Stmt.Has_Elements loop declare Item : Message_Ref; Impl : constant Message_Access := new Message_Impl; begin Impl.Load (Stmt, Session); ADO.Objects.Set_Object (Item, Impl.all'Access); Object.Append (Item); end; Stmt.Next; end loop; end List; -- ------------------------------ -- Load the object from current iterator position -- ------------------------------ procedure Load (Object : in out Message_Impl; Stmt : in out ADO.Statements.Query_Statement'Class; Session : in out ADO.Sessions.Session'Class) is begin Object.Set_Key_Value (Stmt.Get_Identifier (0)); Object.Create_Date := Stmt.Get_Time (1); Object.Priority := Stmt.Get_Integer (2); Object.Count := Stmt.Get_Integer (3); Object.Parameters := Stmt.Get_Unbounded_String (4); Object.Server_Id := Stmt.Get_Integer (5); Object.Task_Id := Stmt.Get_Integer (6); Object.Status := Message_Status_Type'Val (Stmt.Get_Integer (7)); Object.Processing_Date := Stmt.Get_Nullable_Time (8); Object.Entity_Id := Stmt.Get_Identifier (10); Object.Entity_Type := ADO.Entity_Type (Stmt.Get_Integer (11)); Object.Finish_Date := Stmt.Get_Nullable_Time (12); if not Stmt.Is_Null (13) then Object.Queue.Set_Key_Value (Stmt.Get_Identifier (13), Session); end if; if not Stmt.Is_Null (14) then Object.Message_Type.Set_Key_Value (Stmt.Get_Identifier (14), Session); end if; if not Stmt.Is_Null (15) then Object.User.Set_Key_Value (Stmt.Get_Identifier (15), Session); end if; if not Stmt.Is_Null (16) then Object.Session.Set_Key_Value (Stmt.Get_Identifier (16), Session); end if; Object.Version := Stmt.Get_Integer (9); ADO.Objects.Set_Created (Object); end Load; end AWA.Events.Models;
-- This spec has been automatically generated from msp430g2553.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with System; -- System Clock package MSP430_SVD.SYSTEM_CLOCK is pragma Preelaborate; --------------- -- Registers -- --------------- -- XIN/XOUT Cap 0 type BCSCTL3_XCAP_Field is (-- XIN/XOUT Cap : 0 pF Xcap_0, -- XIN/XOUT Cap : 6 pF Xcap_1, -- XIN/XOUT Cap : 10 pF Xcap_2, -- XIN/XOUT Cap : 12.5 pF Xcap_3) with Size => 2; for BCSCTL3_XCAP_Field use (Xcap_0 => 0, Xcap_1 => 1, Xcap_2 => 2, Xcap_3 => 3); -- Mode 0 for LFXT1 (XTS = 0) type BCSCTL3_LFXT1S_Field is (-- Mode 0 for LFXT1 : Normal operation Lfxt1S_0, -- Mode 1 for LFXT1 : Reserved Lfxt1S_1, -- Mode 2 for LFXT1 : VLO Lfxt1S_2, -- Mode 3 for LFXT1 : Digital input signal Lfxt1S_3) with Size => 2; for BCSCTL3_LFXT1S_Field use (Lfxt1S_0 => 0, Lfxt1S_1 => 1, Lfxt1S_2 => 2, Lfxt1S_3 => 3); -- Mode 0 for XT2 type BCSCTL3_XT2S_Field is (-- Mode 0 for XT2 : 0.4 - 1 MHz Xt2S_0, -- Mode 1 for XT2 : 1 - 4 MHz Xt2S_1, -- Mode 2 for XT2 : 2 - 16 MHz Xt2S_2, -- Mode 3 for XT2 : Digital input signal Xt2S_3) with Size => 2; for BCSCTL3_XT2S_Field use (Xt2S_0 => 0, Xt2S_1 => 1, Xt2S_2 => 2, Xt2S_3 => 3); -- Basic Clock System Control 3 type BCSCTL3_Register is record -- Low/high Frequency Oscillator Fault Flag LFXT1OF : MSP430_SVD.Bit := 16#0#; -- High frequency oscillator 2 fault flag XT2OF : MSP430_SVD.Bit := 16#0#; -- XIN/XOUT Cap 0 XCAP : BCSCTL3_XCAP_Field := MSP430_SVD.SYSTEM_CLOCK.Xcap_0; -- Mode 0 for LFXT1 (XTS = 0) LFXT1S : BCSCTL3_LFXT1S_Field := MSP430_SVD.SYSTEM_CLOCK.Lfxt1S_0; -- Mode 0 for XT2 XT2S : BCSCTL3_XT2S_Field := MSP430_SVD.SYSTEM_CLOCK.Xt2S_0; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for BCSCTL3_Register use record LFXT1OF at 0 range 0 .. 0; XT2OF at 0 range 1 .. 1; XCAP at 0 range 2 .. 3; LFXT1S at 0 range 4 .. 5; XT2S at 0 range 6 .. 7; end record; -- DCOCTL_MOD array type DCOCTL_MOD_Field_Array is array (0 .. 4) of MSP430_SVD.Bit with Component_Size => 1, Size => 5; -- Type definition for DCOCTL_MOD type DCOCTL_MOD_Field (As_Array : Boolean := False) is record case As_Array is when False => -- MOD as a value Val : MSP430_SVD.UInt5; when True => -- MOD as an array Arr : DCOCTL_MOD_Field_Array; end case; end record with Unchecked_Union, Size => 5; for DCOCTL_MOD_Field use record Val at 0 range 0 .. 4; Arr at 0 range 0 .. 4; end record; -- DCOCTL_DCO array type DCOCTL_DCO_Field_Array is array (0 .. 2) of MSP430_SVD.Bit with Component_Size => 1, Size => 3; -- Type definition for DCOCTL_DCO type DCOCTL_DCO_Field (As_Array : Boolean := False) is record case As_Array is when False => -- DCO as a value Val : MSP430_SVD.UInt3; when True => -- DCO as an array Arr : DCOCTL_DCO_Field_Array; end case; end record with Unchecked_Union, Size => 3; for DCOCTL_DCO_Field use record Val at 0 range 0 .. 2; Arr at 0 range 0 .. 2; end record; -- DCO Clock Frequency Control type DCOCTL_Register is record -- Modulation Bit 0 MOD_k : DCOCTL_MOD_Field := (As_Array => False, Val => 16#0#); -- DCO Select Bit 0 DCO : DCOCTL_DCO_Field := (As_Array => False, Val => 16#0#); end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for DCOCTL_Register use record MOD_k at 0 range 0 .. 4; DCO at 0 range 5 .. 7; end record; -- BCSCTL1_RSEL array type BCSCTL1_RSEL_Field_Array is array (0 .. 3) of MSP430_SVD.Bit with Component_Size => 1, Size => 4; -- Type definition for BCSCTL1_RSEL type BCSCTL1_RSEL_Field (As_Array : Boolean := False) is record case As_Array is when False => -- RSEL as a value Val : MSP430_SVD.UInt4; when True => -- RSEL as an array Arr : BCSCTL1_RSEL_Field_Array; end case; end record with Unchecked_Union, Size => 4; for BCSCTL1_RSEL_Field use record Val at 0 range 0 .. 3; Arr at 0 range 0 .. 3; end record; -- ACLK Divider 0 type BCSCTL1_DIVA_Field is (-- ACLK Divider 0: /1 Diva_0, -- ACLK Divider 1: /2 Diva_1, -- ACLK Divider 2: /4 Diva_2, -- ACLK Divider 3: /8 Diva_3) with Size => 2; for BCSCTL1_DIVA_Field use (Diva_0 => 0, Diva_1 => 1, Diva_2 => 2, Diva_3 => 3); -- Basic Clock System Control 1 type BCSCTL1_Register is record -- Range Select Bit 0 RSEL : BCSCTL1_RSEL_Field := (As_Array => False, Val => 16#0#); -- ACLK Divider 0 DIVA : BCSCTL1_DIVA_Field := MSP430_SVD.SYSTEM_CLOCK.Diva_0; -- LFXTCLK 0:Low Freq. / 1: High Freq. XTS : MSP430_SVD.Bit := 16#0#; -- Enable XT2CLK XT2OFF : MSP430_SVD.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for BCSCTL1_Register use record RSEL at 0 range 0 .. 3; DIVA at 0 range 4 .. 5; XTS at 0 range 6 .. 6; XT2OFF at 0 range 7 .. 7; end record; -- SMCLK Divider 0 type BCSCTL2_DIVS_Field is (-- SMCLK Divider 0: /1 Divs_0, -- SMCLK Divider 1: /2 Divs_1, -- SMCLK Divider 2: /4 Divs_2, -- SMCLK Divider 3: /8 Divs_3) with Size => 2; for BCSCTL2_DIVS_Field use (Divs_0 => 0, Divs_1 => 1, Divs_2 => 2, Divs_3 => 3); -- MCLK Divider 0 type BCSCTL2_DIVM_Field is (-- MCLK Divider 0: /1 Divm_0, -- MCLK Divider 1: /2 Divm_1, -- MCLK Divider 2: /4 Divm_2, -- MCLK Divider 3: /8 Divm_3) with Size => 2; for BCSCTL2_DIVM_Field use (Divm_0 => 0, Divm_1 => 1, Divm_2 => 2, Divm_3 => 3); -- MCLK Source Select 0 type BCSCTL2_SELM_Field is (-- MCLK Source Select 0: DCOCLK Selm_0, -- MCLK Source Select 1: DCOCLK Selm_1, -- MCLK Source Select 2: XT2CLK/LFXTCLK Selm_2, -- MCLK Source Select 3: LFXTCLK Selm_3) with Size => 2; for BCSCTL2_SELM_Field use (Selm_0 => 0, Selm_1 => 1, Selm_2 => 2, Selm_3 => 3); -- Basic Clock System Control 2 type BCSCTL2_Register is record -- unspecified Reserved_0_0 : MSP430_SVD.Bit := 16#0#; -- SMCLK Divider 0 DIVS : BCSCTL2_DIVS_Field := MSP430_SVD.SYSTEM_CLOCK.Divs_0; -- SMCLK Source Select 0:DCOCLK / 1:XT2CLK/LFXTCLK SELS : MSP430_SVD.Bit := 16#0#; -- MCLK Divider 0 DIVM : BCSCTL2_DIVM_Field := MSP430_SVD.SYSTEM_CLOCK.Divm_0; -- MCLK Source Select 0 SELM : BCSCTL2_SELM_Field := MSP430_SVD.SYSTEM_CLOCK.Selm_0; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for BCSCTL2_Register use record Reserved_0_0 at 0 range 0 .. 0; DIVS at 0 range 1 .. 2; SELS at 0 range 3 .. 3; DIVM at 0 range 4 .. 5; SELM at 0 range 6 .. 7; end record; ----------------- -- Peripherals -- ----------------- -- System Clock type SYSTEM_CLOCK_Peripheral is record -- Basic Clock System Control 3 BCSCTL3 : aliased BCSCTL3_Register; -- DCO Clock Frequency Control DCOCTL : aliased DCOCTL_Register; -- Basic Clock System Control 1 BCSCTL1 : aliased BCSCTL1_Register; -- Basic Clock System Control 2 BCSCTL2 : aliased BCSCTL2_Register; end record with Volatile; for SYSTEM_CLOCK_Peripheral use record BCSCTL3 at 16#1# range 0 .. 7; DCOCTL at 16#4# range 0 .. 7; BCSCTL1 at 16#5# range 0 .. 7; BCSCTL2 at 16#6# range 0 .. 7; end record; -- System Clock SYSTEM_CLOCK_Periph : aliased SYSTEM_CLOCK_Peripheral with Import, Address => SYSTEM_CLOCK_Base; end MSP430_SVD.SYSTEM_CLOCK;
----------------------------------------------------------------------- -- package body Crout_LU, LU decomposition, with equation solving -- Copyright (C) 2008-2018 Jonathan S. Parker -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --------------------------------------------------------------------------------- package body Crout_LU is Zero : constant Real := +0.0; One : constant Real := +1.0; Two : constant Real := +2.0; Min_Allowed_Real : constant Real := Two ** (Real'Machine_Emin - Real'Machine_Emin / 8); --------- -- "-" -- --------- function "-" (A, B : in Col_Vector) return Col_Vector is Result : Col_Vector; begin for J in Index loop Result(J) := A(J) - B(J); end loop; return Result; end "-"; ------------- -- Product -- ------------- function Product (A : Matrix; V : Row_Vector; Final_Index : Index := Index'Last; Starting_Index : Index := Index'First) return Row_Vector is Result : Col_Vector := (others => Zero); Sum : Real; begin for i in Starting_Index .. Final_Index loop Sum := Zero; for j in Starting_Index .. Final_Index loop Sum := Sum + A(i, j) * V(j); end loop; Result (i) := Sum; end loop; return Result; end Product; -------------------------- -- Scale_Cols_Then_Rows -- -------------------------- procedure Scale_Cols_Then_Rows (A : in out Matrix; Scalings : out Scale_Vectors; Final_Index : in Index := Index'Last; Starting_Index : in Index := Index'First) is Sum, Scale_Factor : Real; Power_of_Two : Integer; begin -- Scale each column to near unity: Scalings (For_Cols) := (others => One); for Col in Starting_Index .. Final_Index loop Sum := Zero; for j in Starting_Index .. Final_Index loop Sum := Sum + Abs A(j, Col); end loop; Power_of_Two := Real'Exponent (Sum + Min_Allowed_Real); Scale_Factor := Two ** (-Power_of_Two); for j in Starting_Index .. Final_Index loop A(j, Col) := Scale_Factor * A(j, Col); end loop; Scalings (For_Cols)(Col) := Scale_Factor; end loop; -- Scale each row to near unity: Scalings (For_Rows) := (others => One); for Row in Starting_Index .. Final_Index loop Sum := Zero; for j in Starting_Index .. Final_Index loop Sum := Sum + Abs A(Row, j); end loop; Power_of_Two := Real'Exponent (Sum + Min_Allowed_Real); Scale_Factor := Two ** (-Power_of_Two); for j in Starting_Index .. Final_Index loop A(Row, j) := Scale_Factor * A(Row, j); end loop; Scalings (For_Rows)(Row) := Scale_Factor; end loop; end Scale_Cols_Then_Rows; ------------------ -- LU_Decompose -- ------------------ -- The upper matrix is U, the lower L. -- We assume that the diagonal elements of L are One. Thus -- the diagonal elements of U but not L appear on the -- the diagonal of the output matrix A. procedure LU_Decompose (A : in out Matrix; Scalings : out Scale_Vectors; Row_Permutation : out Rearrangement; Final_Index : in Index := Index'Last; Starting_Index : in Index := Index'First; Scaling_Desired : in Boolean := False) is Stage : Index; tmp_Index, The_Pivotal_Row : Index; Sum, tmp : Real; Min_Allowed_Pivot_Val, Reciprocal_Pivot_Val : Real; Pivot_Val, Abs_Pivot_Val : Real; Min_Pivot_Ratio : constant Real := Two**(-Real'Machine_Mantissa-24); Max_Pivot_Val : Real := Min_Allowed_Real; ----------------------------- -- Find_Max_Element_Of_Col -- ----------------------------- procedure Find_Max_Element_Of_Col (Col_ID : in Index; Starting_Index : in Index; Index_of_Max_Element : out Index; Val_of_Max_Element : out Real; Abs_Val_of_Max_Element : out Real) is Pivot_Val, Abs_Pivot_Val : Real; begin Val_of_Max_Element := A (Starting_Index, Col_ID); Abs_Val_of_Max_Element := Abs (Val_of_Max_Element); Index_of_Max_Element := Starting_Index; if Final_Index > Starting_Index then for k in Starting_Index+1..Final_Index loop Pivot_Val := A (k, Col_ID); Abs_Pivot_Val := Abs (Pivot_Val); if Abs_Pivot_Val > Abs_Val_of_Max_Element then Val_of_Max_Element := Pivot_Val; Abs_Val_of_Max_Element := Abs_Pivot_Val; Index_of_Max_Element := k; end if; end loop; end if; end Find_Max_Element_Of_Col; begin for I in Index loop Row_Permutation(I) := I; end loop; Scalings(Diag_Inverse) := (others => Zero); Scalings(For_Cols) := (others => One); Scalings(For_Rows) := (others => One); if Scaling_Desired then Scale_Cols_Then_Rows (A, Scalings, Final_Index, Starting_Index); end if; -- Step 0: 1 X 1 matrices: if Final_Index = Starting_Index then Pivot_Val := A(Starting_Index, Starting_Index); if Abs (Pivot_Val) < Min_Allowed_Real then A(Starting_Index, Starting_Index) := Zero; else A(Starting_Index, Starting_Index) := Pivot_Val; Scalings(Diag_Inverse)(Starting_Index) := One / Pivot_Val; end if; return; end if; -- Process goes through stages Starting_Index..Final_Index. -- The last stage is a special case. -- -- At each stage calculate row "stage" of the Upper -- matrix U and Col "Stage" of the Lower matrix L. -- The matrix A is overwritten with these, because the elements -- of A in those places are never needed in future stages. -- However, the elements of U and L ARE needed in those places, -- so to get those elements we access A (which stores them). for Stage in Starting_Index .. Final_Index-1 loop if Stage > Starting_Index then for Row in Stage .. Final_Index loop Sum := Zero; for K in Starting_Index .. Stage-1 loop --Sum := Sum + L(Row, K)*U(K, Stage); Sum := Sum + A(Row, K)*A(K, Stage); end loop; A(Row, Stage) := A(Row, Stage) - Sum; end loop; end if; -- Step 2. Swap rows of L and A if necessary. -- Do it by swapping rows of A. -- Notice that the Rows of U that have already been calculated and -- stored in A, namely (1..Stage-1), are untouched by the swap. Find_Max_Element_Of_Col (Col_ID => Stage, Starting_Index => Stage, Index_of_Max_Element => The_Pivotal_Row, Val_of_Max_Element => Pivot_Val, Abs_Val_of_Max_Element => Abs_Pivot_Val); if The_Pivotal_Row /= Stage then for j in Starting_Index .. Final_Index loop tmp := A(The_Pivotal_Row, j); A(The_Pivotal_Row, j) := A(Stage, j); A(Stage, j) := tmp; end loop; tmp_Index := Row_Permutation(The_Pivotal_Row); Row_Permutation(The_Pivotal_Row) := Row_Permutation(Stage); Row_Permutation(Stage) := tmp_Index; end if; -- Step 3: -- Update Ith_row = Stage of the upper triangular matrix U. -- Update Ith_col = Stage of the lower triangular matrix L. -- The rules are that the diagonal elements of L are 1 even -- though Pivot_Val * Reciprocal_Pivot_Val /= 1. -- Constraint is that L*U = A when possible. if Abs_Pivot_Val > Max_Pivot_Val then Max_Pivot_Val := Abs_Pivot_Val; end if; Min_Allowed_Pivot_Val := Max_Pivot_Val * Min_Pivot_Ratio + Min_Allowed_Real; if (Abs_Pivot_Val < Abs Min_Allowed_Pivot_Val) then Reciprocal_Pivot_Val := Zero; else Reciprocal_Pivot_Val := One / Pivot_Val; end if; Scalings(Diag_Inverse)(Stage) := Reciprocal_Pivot_Val; A(Stage, Stage) := Pivot_Val; for Row in Stage+1 .. Final_Index loop A(Row, Stage) := A(Row, Stage) * Reciprocal_Pivot_Val; end loop; if Stage > Starting_Index then for Col in Stage+1 .. Final_Index loop Sum := Zero; for K in Starting_Index .. Stage-1 loop --Sum := Sum + L(Stage, K)*U(K, Col); Sum := Sum + A(Stage, K)*A(K, Col); end loop; --U(Stage, Col) := A(Stage, Col) - Sum; A(Stage, Col) := A(Stage, Col) - Sum; end loop; end if; end loop; -- Stage -- Step 4: Get final row and column. Stage := Final_Index; Sum := Zero; for K in Starting_Index .. Stage-1 loop --Sum := Sum + L(Stage, K)*U(K, Stage); Sum := Sum + A(Stage, K)*A(K, Stage); end loop; Pivot_Val := A(Stage, Stage) - Sum; Abs_Pivot_Val := Abs Pivot_Val; Min_Allowed_Pivot_Val := Max_Pivot_Val * Min_Pivot_Ratio + Min_Allowed_Real; if (Abs_Pivot_Val < Abs Min_Allowed_Pivot_Val) then Reciprocal_Pivot_Val := Zero; else Reciprocal_Pivot_Val := One / Pivot_Val; end if; Scalings(Diag_Inverse)(Stage) := Reciprocal_Pivot_Val; A(Stage, Stage) := Pivot_Val; end LU_Decompose; -------------- -- LU_Solve -- -------------- procedure LU_Solve (X : out Row_Vector; B : in Row_Vector; A_LU : in Matrix; Scalings : in Scale_Vectors; Row_Permutation : in Rearrangement; Final_Index : in Index := Index'Last; Starting_Index : in Index := Index'First) is Z, B2, B_s : Row_Vector; Sum : Real; begin X := (others => Zero); -- A*X = B was changed to (S_r*A*S_c) * (S_c^(-1)*X) = (S_r*B). -- The matrix LU'd was (S_r*A*S_c). Let B_s = (S_r*B). Solve for -- X_s = (S_c^(-1)*X). -- -- The matrix equation is now P*L*U*X_s = B_s (the scaled B). -- -- First assume L*U*X_s is B2, and solve for B2 in the equation P*B2 = B_s. -- Permute the elements of the vector B_s according to "Permutation": -- Get B_s = S_r*B: for i in Starting_Index .. Final_Index loop B_s(i) := Scalings(For_Rows)(i) * B(i); end loop; -- Get B2 by solving P*B2 = B_s = B: for i in Starting_Index .. Final_Index loop B2(i) := B_s(Row_Permutation(i)); end loop; -- The matrix equation is now L*U*X = B2. -- Assume U*X is Z, and solve for Z in the equation L*Z = B2. -- Remember that by assumption L(I, I) = One, U(I, I) /= One. Z(Starting_Index) := B2(Starting_Index); if Starting_Index < Final_Index then for Row in Starting_Index+1 .. Final_Index loop Sum := Zero; for Col in Starting_Index .. Row-1 loop Sum := Sum + A_LU(Row, Col) * Z(Col); end loop; Z(Row) := B2(Row) - Sum; end loop; end if; -- Solve for X_s in the equation U X_s = Z. X(Final_Index) := Z(Final_Index) * Scalings(Diag_Inverse)(Final_Index); if Final_Index > Starting_Index then for Row in reverse Starting_Index .. Final_Index-1 loop Sum := Zero; for Col in Row+1 .. Final_Index loop Sum := Sum + A_LU(Row, Col) * X(Col); end loop; X(Row) := (Z(Row) - Sum) * Scalings(Diag_Inverse)(Row); end loop; end if; -- Solved for the scaled X_s (but called it X); now get the real X: for i in Starting_Index .. Final_Index loop X(i) := Scalings(For_Cols)(i) * X(i); end loop; end LU_Solve; end Crout_LU;
with Ada.Text_IO; with Ada.Direct_IO; with Ada.Command_Line; procedure Brainfuck is package CL renames Ada.Command_Line; package Text_IO renames Ada.Text_IO; package Direct_IO is new Ada.Direct_IO(Character); use type Direct_IO.Count; type Cell is mod 256; type Tape_Position is mod 5000; type Program_Tape is array (Tape_Position'Range) of Cell; pragma Pack (Program_Tape); Input_File : Direct_IO.File_Type; File_Position : Direct_IO.Positive_Count; Counter : Integer; Current_Char : Character; Tape : Program_Tape; Current_Cell : Tape_Position; begin if CL.Argument_Count /= 1 then Text_IO.Put_Line(Text_IO.Standard_Error, "Please supply the filename of a brainfuck program"); CL.Set_Exit_Status(CL.Failure); return; end if; begin Direct_IO.Open( File => Input_File, Mode => Direct_IO.In_File, Name => CL.Argument(1) ); exception when others => Text_IO.Put_Line(Text_IO.Standard_Error, "Can not open the file '" & CL.Argument(1) & "'. Does it exist?"); CL.Set_Exit_Status(CL.Failure); return; end; Tape := (others => 0); Current_Cell := Tape_Position'First; while not Direct_IO.End_Of_File(Input_File) loop Direct_IO.Read(Input_File, Current_Char); case Current_Char is when '>' => Current_Cell := Current_Cell + 1; when '<' => Current_Cell := Current_Cell - 1; when '+' => Tape(Current_Cell) := Tape(Current_Cell) + 1; when '-' => Tape(Current_Cell) := Tape(Current_Cell) - 1; when '.' => Text_IO.Put(Character'Val(Tape(Current_Cell))); when ',' => Text_IO.Get(Current_Char); Tape(Current_Cell) := Character'Pos(Current_Char); when '[' => if Tape(Current_Cell) = 0 then Counter := 1; while Counter > 0 and not Direct_IO.End_Of_File(Input_File) loop Direct_IO.Read(Input_File, Current_Char); if Current_Char = '[' then Counter := Counter + 1; elsif Current_Char = ']' then Counter := Counter - 1; end if; end loop; end if; when ']' => if Tape(Current_Cell) /= 0 then Counter := 0; File_Position := Direct_IO.Index(Input_File) - 1; loop Direct_IO.Set_Index(Input_File, File_Position); Direct_IO.Read(Input_File, Current_Char); if Current_Char = ']' then Counter := Counter + 1; elsif Current_Char = '[' then Counter := Counter - 1; end if; File_Position := File_Position - 1; exit when Counter < 1; end loop; end if; when others => null; end case; end loop; Direct_IO.Close(Input_File); end Brainfuck;
pragma License (Unrestricted); -- implementation unit required by compiler package System.Fat_LLF is pragma Pure; package Attr_Long_Long_Float is -- required for Long_Long_Float'Adjacent by compiler (s-fatgen.ads) function Adjacent (X, Towards : Long_Long_Float) return Long_Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_nextafterl"; -- required for Long_Long_Float'Ceiling by compiler (s-fatgen.ads) function Ceiling (X : Long_Long_Float) return Long_Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_ceill"; -- required for Long_Long_Float'Compose by compiler (s-fatgen.ads) function Compose (Fraction : Long_Long_Float; Exponent : Integer) return Long_Long_Float; -- required for Long_Long_Float'Copy_Sign by compiler (s-fatgen.ads) function Copy_Sign (X, Y : Long_Long_Float) return Long_Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_copysignl"; -- required for Long_Long_Float'Exponent by compiler (s-fatgen.ads) function Exponent (X : Long_Long_Float) return Integer; -- required for Long_Long_Float'Floor by compiler (s-fatgen.ads) function Floor (X : Long_Long_Float) return Long_Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_floorl"; -- required for Long_Long_Float'Fraction by compiler (s-fatgen.ads) function Fraction (X : Long_Long_Float) return Long_Long_Float; -- required for Long_Long_Float'Leading_Part by compiler (s-fatgen.ads) function Leading_Part (X : Long_Long_Float; Radix_Digits : Integer) return Long_Long_Float; -- required for Long_Long_Float'Machine by compiler (s-fatgen.ads) function Machine (X : Long_Long_Float) return Long_Long_Float; -- required for LLF'Machine_Rounding by compiler (s-fatgen.ads) function Machine_Rounding (X : Long_Long_Float) return Long_Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_nearbyintl"; -- required for Long_Long_Float'Model by compiler (s-fatgen.ads) function Model (X : Long_Long_Float) return Long_Long_Float renames Machine; -- required for Long_Long_Float'Pred by compiler (s-fatgen.ads) function Pred (X : Long_Long_Float) return Long_Long_Float; -- required for Long_Long_Float'Remainder by compiler (s-fatgen.ads) function Remainder (X, Y : Long_Long_Float) return Long_Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_remainderl"; -- required for Long_Long_Float'Rounding by compiler (s-fatgen.ads) function Rounding (X : Long_Long_Float) return Long_Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_roundl"; -- required for Long_Long_Float'Scaling by compiler (s-fatgen.ads) function Scaling (X : Long_Long_Float; Adjustment : Integer) return Long_Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_ldexpl"; -- required for Long_Long_Float'Succ by compiler (s-fatgen.ads) function Succ (X : Long_Long_Float) return Long_Long_Float; -- required for Long_Long_Float'Truncation by compiler (s-fatgen.ads) function Truncation (X : Long_Long_Float) return Long_Long_Float with Import, Convention => Intrinsic, External_Name => "__builtin_truncl"; -- required for LLF'Unbiased_Rounding by compiler (s-fatgen.ads) function Unbiased_Rounding (X : Long_Long_Float) return Long_Long_Float; -- required for Long_Long_Float'Valid by compiler (s-fatgen.ads) function Valid (X : not null access Long_Long_Float) return Boolean; type S is new String (1 .. Long_Long_Float'Size / Character'Size); type P is access all S; for P'Storage_Size use 0; end Attr_Long_Long_Float; end System.Fat_LLF;
-- CC3011D.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 WHEN A GENERIC PACKAGE INSTANTIATION CONTAINS DECLARATIONS -- OF SUBPROGRAMS WITH THE SAME SPECIFICATIONS, THE CALLS TO THE -- SUBPROGRAMS ARE NOT AMBIGIOUS WITHIN THE GENERIC BODY. -- SPS 5/7/82 -- SPS 2/7/83 WITH REPORT; USE REPORT; PROCEDURE CC3011D IS BEGIN TEST ("CC3011D", "SUBPROGRAMS WITH SAME SPECIFICATIONS NOT" & " AMBIGIOUS WITHIN GENERIC BODY"); DECLARE TYPE FLAG IS (PRT,PRS); XX : FLAG; GENERIC TYPE S IS PRIVATE; TYPE T IS PRIVATE; V1 : S; V2 : T; PACKAGE P1 IS PROCEDURE PR(X : S); PROCEDURE PR(X : T); END P1; PACKAGE BODY P1 IS PROCEDURE PR (X : S) IS BEGIN XX := PRS; END; PROCEDURE PR (X : T ) IS BEGIN XX := PRT; END; BEGIN XX := PRT; PR (V1); IF XX /= PRS THEN FAILED ("WRONG BINDING FOR PR WITH TYPE S"); END IF; XX := PRS; PR (V2); IF XX /= PRT THEN FAILED ("WRONG BINDING FOR PR WITH TYPE T"); END IF; END P1; PACKAGE PAK IS NEW P1 (INTEGER, INTEGER, 1, 2); BEGIN NULL; END; RESULT; END CC3011D;
------------------------------------------------------------------------------ -- -- -- 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.Tables.CMOF_Attributes; with AMF.Internals.Element_Collections; package body AMF.Internals.CMOF_Directed_Relationships is use AMF.Internals.Tables.CMOF_Attributes; ---------------- -- Get_Source -- ---------------- overriding function Get_Source (Self : not null access constant CMOF_Directed_Relationship_Proxy) return AMF.CMOF.Elements.Collections.Set_Of_CMOF_Element is begin return AMF.CMOF.Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (Internal_Get_Source (Self.Element))); end Get_Source; ---------------- -- Get_Target -- ---------------- overriding function Get_Target (Self : not null access constant CMOF_Directed_Relationship_Proxy) return AMF.CMOF.Elements.Collections.Set_Of_CMOF_Element is begin return AMF.CMOF.Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (Internal_Get_Target (Self.Element))); end Get_Target; end AMF.Internals.CMOF_Directed_Relationships;
-- This file is generated by SWIG. Please do *not* modify by hand. -- with c_math_c; with c_math_c.Vector_3; with Interfaces.C; package bullet_c.ray_Collision is -- Item -- type Item is record near_Object : access bullet_c.Object; hit_Fraction : aliased c_math_c.Real; Normal_world : aliased c_math_c.Vector_3.Item; Site_world : aliased c_math_c.Vector_3.Item; end record; -- Items -- type Items is array (Interfaces.C.size_t range <>) of aliased bullet_c.ray_Collision.Item; -- Pointer -- type Pointer is access all bullet_c.ray_Collision.Item; -- Pointers -- type Pointers is array (Interfaces.C .size_t range <>) of aliased bullet_c.ray_Collision.Pointer; -- Pointer_Pointer -- type Pointer_Pointer is access all bullet_c.ray_Collision.Pointer; function construct return bullet_c.ray_Collision.Item; private pragma Import (C, construct, "Ada_new_ray_Collision"); end bullet_c.ray_Collision;
-- -- Copyright (C) 2021 Jeremy Grosser <jeremy@synack.me> -- -- SPDX-License-Identifier: BSD-3-Clause -- with Graphics; with Bitmaps; package Game is procedure Initialize; procedure HBlank (Y : Graphics.Row); procedure VBlank (N : Graphics.Frame_Number); private type Screen_Coordinate is record Y : Graphics.Row; X : Graphics.Column; end record; procedure Blit (Position : Screen_Coordinate; B : not null Bitmaps.Any_Bitmap); subtype Grid_Row is Integer range 1 .. (Graphics.Row'Last / Bitmaps.Height); subtype Grid_Column is Integer range 1 .. (Graphics.Column'Last / Bitmaps.Width); function To_Screen_Coordinate (Y : Grid_Row; X : Grid_Column) return Screen_Coordinate; end Game;
----------------------------------------------------------------------- -- babel-streams-cached -- Cached stream management -- Copyright (C) 2014, 2015 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. ----------------------------------------------------------------------- -- == Cached Stream == -- The <tt>Babel.Streams.Cached</tt> package provides a cached stream where the whole -- stream is read in one or several stream buffers. package Babel.Streams.Cached is type Stream_Type is new Babel.Streams.Stream_Type with private; type Stream_Access is access all Stream_Type'Class; -- Load the file stream into the cache and use the buffer pool to obtain more buffers -- for the cache. procedure Load (Stream : in out Stream_Type; File : in out Babel.Streams.Stream_Type'Class; Pool : in out Babel.Files.Buffers.Buffer_Pool); -- Read the data stream as much as possible and return the result in a buffer. -- The buffer is owned by the stream and need not be released. The same buffer may -- or may not be returned by the next <tt>Read</tt> operation. -- A null buffer is returned when the end of the data stream is reached. overriding procedure Read (Stream : in out Stream_Type; Buffer : out Babel.Files.Buffers.Buffer_Access); -- Write the buffer in the data stream. overriding procedure Write (Stream : in out Stream_Type; Buffer : in Babel.Files.Buffers.Buffer_Access); -- Prepare to read again the data stream from the beginning. overriding procedure Rewind (Stream : in out Stream_Type); private type Stream_Type is new Babel.Streams.Stream_Type with record Input : Babel.Streams.Stream_Access; Output : Babel.Streams.Stream_Access; Buffers : Babel.Files.Buffers.Buffer_Access_Vector; Current : Babel.Files.Buffers.Buffer_Access_Cursor; end record; -- Release the buffers associated with the cache. overriding procedure Finalize (Stream : in out Stream_Type); end Babel.Streams.Cached;
-- part of FreeTypeAda, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "COPYING" with FT.Errors; with FT.Faces; package FT.API.Glyphs is pragma Preelaborate; procedure FT_Done_Glyph (Glyph : Glyph_Ptr); pragma Import (C, FT_Done_Glyph, "FT_Done_Glyph"); -- tell the compiler that we are aware that Bool is 8-bit and will need to -- be a char on the C side. pragma Warnings (Off, "8-bit Ada Boolean"); function FT_Glyph_To_Bitmap (theGlyph : Glyph_Ptr; Mode : Faces.Render_Mode; Origin : access Vector; Destroy : Bool) return Errors.Error_Code; pragma Import (C, FT_Glyph_To_Bitmap, "FT_Glyph_To_Bitmap"); pragma Warnings (On, "8-bit Ada Boolean"); function FT_Get_Glyph (Slot_Ptr : Glyph_Slot_Ptr; aGlyph : access Glyph_Ptr) return Errors.Error_Code; pragma Import (C, FT_Get_Glyph, "FT_Get_Glyph"); function FT_Render_Glyph (Slot : access Glyph_Slot_Record; Mode : Faces.Render_Mode) return Errors.Error_Code; pragma Import (C, FT_Render_Glyph, "FT_Render_Glyph"); end FT.API.Glyphs;
------------------------------------------------------------------------------ -- -- -- Common UUID Handling Package -- -- - RFC 4122 Implementation - -- -- -- -- Version 1.0 -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Version 1 (Time-based) UUID Generation Package -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2018, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contibutors: -- -- * Aninda Poddar (ANNEXI-STRAYLINE) -- -- -- -- First release review and refinement -- -- * Richard Wai (ANNEXI-STRAYLINE) -- -- -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- -- -- * Neither the name of ANNEXI-STRAYLINE 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 ANNEXI-STRAYLINE -- -- 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 System; with Ada.Calendar; use Ada.Calendar; with Ada.Calendar.Formatting; use Ada.Calendar.Formatting; with Ada.Calendar.Arithmetic; with Ada.Exceptions; use Ada; with Hex.Modular_Codec; package body UUIDs.Version_1 is type Bitfield_4 is mod 2**4 with Size => 4; type Bitfield_6 is mod 2**6 with Size => 6; type Bitfield_12 is mod 2**12 with Size => 12; type Bitfield_14 is mod 2**14 with Size => 14; type Bitfield_60 is mod 2**60 with Size => 60; -- -- State Management Utilities -- package Node_ID_Hex_Codec is new Hex.Modular_Codec (Bitfield_48, 48); ----------------- -- Format_Time -- ----------------- -- Takes a 60-bit UUID Version 1 timestamp (RFC 4122, Section 4.1.4), and -- breaks it out into the UUID standard fields, in a portable way which is -- machine-endian independent. procedure Format_Time (From_Timestamp: in Timestamp; Time_High : out Bitfield_12; Time_Low : out Bitfield_32; Time_Mid : out Bitfield_16) with Inline => True is begin -- To extract the high 12 bits of the total time field -- (Total_100_Nano_Seconds) mask everything other than the first 12 bits -- and shift the bitfield 60 by 48 bits -- to get the 12 most significant bits into Time_High Time_High := (Bitfield_12((From_Timestamp and 16#fff0_0000_0000_000#) / 2**48)); Time_Mid := (Bitfield_16((From_Timestamp and 16#000f_fff0_0000_000#) / 2**32)); Time_Low := (Bitfield_32((From_Timestamp and 16#0000_000f_ffff_fff#))); end Format_Time; ----------------------- -- Extract_Timestamp -- ----------------------- -- Extract the UUID Version 1 timestamp (RFC 4122, Section 4.1.4) from the -- current State (itself just a Version 1 UUID) function Extract_Timestamp (State: Version_1_State) return Timestamp with Inline => True is -- Extract the last time stamp to later compare with the current -- time generated according to RFC 4122 begin return UUID_timestamp: Timestamp := 0 do -- Mask the first 4 bits containing the version number, leaving -- the high bits of the timestamp, then shift left by 48 bits, -- putting it at the most significant 12 bits of the timestamp. UUID_timestamp := Timestamp (State.Last_ID.time_hi_and_version and 16#0fff#) * 2**48; -- Insert the time_mid in the last time stamp by shifting left -- 32 bits, and dropping it in with an or operation UUID_timestamp := (Timestamp (State.Last_ID.time_mid) * 2**32) or UUID_timestamp; -- The low bits get dropped in as-is UUID_timestamp := UUID_timestamp + Timestamp (State.Last_ID.time_low); end return; end Extract_Timestamp; -- -- Implementation of Specification -- --------------------- -- Standard_Source -- --------------------- -- Generates a 60-bit unsigned modular timestamp value as specified in -- RFC 4122, Section 4.1.4: -- "The timestamp is a 60-bit value. For UUID version 1, this is represented -- by Coordinated Universal Time (UTC) as a count of 100-nanosecond -- intervals since 00:00:00.00, 15 October 1582 (the date of Gregorian -- reform to the Christian calendar)." function Standard_Source return Timestamp is -- Generate a current timestamp from the system clock use Ada.Calendar.Arithmetic; Old_1901 : Time; Days_1901_Now : Day_Count; Seconds : Duration; Leap_Seconds : Leap_Seconds_Count; Total_Days : Timestamp; Total_Seconds : Timestamp; Now : Time := Clock; Days_1582_1901 : constant := 116225; begin Old_1901:= Time_Of (Year => 1901, Month => 1, Day => 1, Hour => 0, Minute => 0, Second => 0); -- At the time of writing, the Ada 2012 Reference Manual states this is -- the earliest possible time which may be represented by a value of type -- Time. We need to use this as a base point, from which we will add on -- the days from 1582/01/01:00:00:00.00 until 1900/12/31:00:00:00.00 UTC -- Get the time difference from now to Jan 1st 1901 Difference (Left => Now, Right => Old_1901, Days => Days_1901_Now, Seconds => Seconds, Leap_Seconds => Leap_Seconds); -- Though the Ada RM doesn't specifically state that Clock should be in -- UTC, it does suggest as much. For most uses, this will likely be true. -- RFC 4122 does not require the time to be UTC, but rather that it is -- consistent. Implementations may want to audit UUID generation to ensure -- that clock is set correctly, if this is a cause for concern. -- Get the current time as a 60-bit count of 100-nanosecond intervals -- since 00:00:00.00, 15 October 1582 Total_Days := Timestamp (Days_1901_Now + Days_1582_1901); -- Add all the seconds Total_Seconds := (Total_Days * 24 * 60 * 60) + Timestamp (Seconds) + Timestamp (Leap_Seconds); -- Multiply to get 100 ns (10_000_000 100 ns intervals/s) and return return (Total_Seconds * 10_000_000); end Standard_Source; --------------- -- New_State -- --------------- function New_State (Node_ID : Node_ID_Hex; Initial_Clock_Sequence: Clock_Sequence; Initial_Timestamp : Timestamp := Standard_Source; Fail_Active : Boolean := False) return Version_1_State is Node_48_Bits: Bitfield_48; Time_High : Bitfield_12; Time_Low : Bitfield_32; Time_Mid : Bitfield_16; Clock_Low : Bitfield_8; Clock_High : Bitfield_6; begin -- Convert node_id_hex to 48 bits. This may be needed for handling an -- exception, and so is placed out here if not Hex.Valid_Hex_String (Node_Id) then raise Constraint_Error with "Node ID is not a valid hexadecimal"; end if; Node_48_Bits := Node_ID_Hex_Codec.Decode (Node_ID); return State: Version_1_State do -- Period start set to the current (initial) clock sequence State.Period_Start := Initial_Clock_Sequence; -- Masking everything other that the 6 most significant bits of -- clock_sequence for clock_seq_high and shift richt2e by 8 bits -- to keep only the 6 bits Clock_High := Bitfield_6 ((Initial_Clock_Sequence and 2#1111_1100_0000_00#) / 2**8); Clock_Low := Bitfield_8 ((Initial_Clock_Sequence and 2#0000_0011_1111_11#)); State.Last_ID.clock_seq_low := Bitfield_8 (Clock_Low); -- Insert the variant number into the clock_seq_hi_and_reserved part State.Last_ID.clock_seq_hi_and_reserved := Bitfield_8 (Clock_High) or 2#1000_0000#; ----- -- The above statements should not possibly result in an exception, -- whereas the below very well may. If Fail_Active is enabled, we can -- catch this and at least return a valid state, with a zeroed timestamp -- Get the current time as a 60-bit count of 100-nanosecond intervals -- since 00:00:00.00, 15 October 1582, and set it as the "Previous -- TS" for the state State.Base_TS := Initial_Timestamp; -- Set-up the value for "Last_ID" State.Last_ID.node := Node_48_Bits; -- Split our 60-bit full timestamp into the requisite individual -- bitfields for insertion into the actual UUID Format_Time (From_Timestamp => State.Base_TS, Time_High => Time_High, Time_Mid => Time_Mid, Time_Low => Time_Low); State.Last_ID.time_low := Time_Low; State.Last_ID.time_mid := Time_Mid; State.Last_ID.time_hi_and_version := (Bitfield_16 (Time_High)) or 16#1000#; -- RFC 4122 states that the high bit is set. exception when others => if Fail_Active then State.Last_ID.time_low := 0; State.Last_ID.time_mid := 0; State.Last_ID.time_hi_and_version := 16#1000#; else raise; end if; end return; exception when others => if Fail_Active then return Version_1_State' (Last_ID => (node => Node_48_Bits, others => <>), others => <>); else raise; end if; end New_State; --------------------- -- Extract_Node_ID -- --------------------- function Extract_Node_ID (State: Version_1_State) return Node_ID_Hex is begin return Node_ID: Node_ID_Hex do Node_ID_Hex_Codec.Encode (Value => State.Last_ID.node, Buffer => Node_ID); end return; end Extract_Node_ID; ----------------------- -- Generic_Generator -- ----------------------- function Generic_Generator (State : in out Version_1_State; Overrun: in Sequence_Overrun) return UUID is UUID_Last_Node_ID : Bitfield_48; UUID_Last_Timestamp: Timestamp; Current_Timestamp : Timestamp; Time_High : Bitfield_12; Time_Low : Bitfield_32; Time_Mid : Bitfield_16; This_Sequence : Clock_Sequence; Clock_Low : Bitfield_8; Clock_High : Bitfield_6; Overrun_Decision : Sequence_Overrun := Overrun; begin -- From the last UUID generator state read the values of: -- timestamp, clock sequence, and node ID UUID_Last_Node_ID := State.Last_ID.node; UUID_Last_Timestamp := Extract_Timestamp (State); -- Get the current time as a 60-bit count of 100-nanosecond intervals -- since 00:00:00.00, 15 October 1582 -- Get current node ID -- Extracting the last clock sequence from State, to be the assumed -- current sequence, unless we absolutely need to increment it This_Sequence := Extract_Sequence (State.Last_ID); -- An interesting problem occurs when generating Version 1 UUIDs on -- typical server hardware: the generation rate is very high, but the -- system clock tick is often not very fine-grain. -- -- We will attempt to be smart about this by synthesizing clock ticks, -- and backing off said synthesis when we find that we have outrun the -- system clock, at which point we will fall back to clock sequence -- incrementation. -- -- We achieve this by recording the last valid "Base" timestamp in the -- state, which lets us detect an actual system clock advancement. -- -- Note that for new or restored states, the "Base timestamp" is zero, -- and so we are assured that we will see a "new clock tick" this time. -- If the state was restored from an "advanced" state, then the "last" -- timestamp will be in the future, which simulates a clock overrun -- condition, and causes us to increment the clock sequence until the -- clock catches-up. This is conformant with RFC 4122. Current_Timestamp := Timestamp_Source; -- First-off, we take a look at if Current_Timestamp = State.Base_TS then -- This means the system clock has not advanced since last time we -- generated an ID. So we will therefore simply synthesize a clock -- tick, and skip to the end Current_Timestamp := UUID_Last_Timestamp + 1; -- It also marks a new clock sequence period for the state State.Period_Start := This_Sequence; else -- Otherwise, we now that we have a new clock tick. We need to decide -- if we can use it (and update State.Base_TS), or otherwise it means -- we have overrun the system clock, and we need to wait for it to -- catch up by incrementing the clock sequence. This leaves a -- possibility that we will need to implement an explicit delay and -- retry. We will put all the logic into a loop, so that we can -- appropriately handle a clock sequence overrun, should it happen. -- Note that for newly Restored states, the initial Base_TS is always -- zero, which works out perfectly by ensuring only the clock sequence -- increments until the system clock catches up loop if Current_Timestamp > UUID_Last_Timestamp then -- This means we have a new valid (advanced) timestamp, and -- we can safely use this and commit it as the new Base_TS State.Base_TS := Current_Timestamp; -- Also marks a new clock sequence period State.Period_Start := This_Sequence; exit; else -- Assume last timestamp Current_Timestamp := UUID_Last_Timestamp; -- This is the classic use-case for clock sequence -- incrementation. We are unable to increment the last used -- timestamp, and so we must make the UUID unique by changing the -- clock sequence. if (This_Sequence + 1) = State.Period_Start then -- We have an clock sequence overrun! case Overrun_Decision is when Delay_or_Error => delay (System.Tick * 2); -- This is the only delay, so next iteration, we need -- to act as if we are configured for Error on overrun Overrun_Decision := Error; when Delay_Until => delay System.Tick; when Error => raise Generation_Failed with "Clock sequence overrun"; end case; else -- Clock sequence is OK for increment This_Sequence := This_Sequence + 1; exit; end if; end if; -- If we get here, it means we are trying again (after a delay) Current_Timestamp := Timestamp_Source; end loop; end if; -- Finally, we have a valid timestamp and clock sequence with which to -- generate our new UUID -- Format a UUID from the current timestamp, clock sequence, and node Format_Time (From_Timestamp => Current_Timestamp, Time_High => Time_High, Time_Mid => Time_Mid, Time_Low => Time_Low); return Generated_UUID: UUID do -- Format time Generated_UUID.time_low := Time_Low; Generated_UUID.time_mid := Time_Mid; Generated_UUID.time_hi_and_version := (Bitfield_16 (Time_High)) or 16#1000#; -- Masking everything other that the 6 most significant bits of -- clock_sequence for clock_seq_high and shift left by 8 bits -- to keep only the 6 bits Clock_High := Bitfield_6 ((This_Sequence and 2#11_1111_0000_0000#) / 2**8); Clock_Low := Bitfield_8 (This_Sequence and 2#00_0000_1111_1111#); Generated_UUID.clock_seq_low := Bitfield_8 (Clock_Low); -- Insert the variant number into the clock_seq_hi_and_reserved part Generated_UUID.clock_seq_hi_and_reserved := Bitfield_8 (Clock_High) or 2#1000_0000#; -- Copy in the node ID Generated_UUID.node := UUID_Last_Node_ID; -- Save the id to the State State.Last_ID := Generated_UUID; end return; exception when e: others => raise Generation_Failed with "Generation raised an exception: " & Exceptions.Exception_Information (e); end Generic_Generator; --------------------- -- Local_Generator -- --------------------- package body Local_Generator is State: Version_1_State; function Generate_Actual is new Generic_Generator (Timestamp_Source); -------------- -- Generate -- -------------- function Generate (Overrun: Sequence_Overrun := Default_Overrun) return UUID is (Generate_Actual (State => State, Overrun => Overrun)); ------------------ -- Export_State -- ------------------ function Export_State (Advance: Duration := 0.0) return Version_1_State is UUID_Last_timestamp : Timestamp; Time_High : Bitfield_12; Time_Low : Bitfield_32; Time_Mid : Bitfield_16; begin -- Check for a default Advance of 0.0 if Advance = 0.0 then return State; end if; UUID_Last_Timestamp := Extract_Timestamp (State); -- Add the advance nanoseconds (10,000,000 100ns/s) UUID_Last_Timestamp := UUID_Last_Timestamp + Timestamp (Advance * 10_000_000); return Advanced_State: Version_1_State := State do -- We copy out the current State, only updating the advance -- timestamp, and clearing the Base_TS; Format_Time (From_Timestamp => UUID_Last_timestamp, Time_High => Time_High, Time_Mid => Time_Mid , Time_Low => Time_Low); Advanced_State.Last_ID.time_low := Time_Low; Advanced_State.Last_ID.time_mid := Time_Mid; -- Insert the version number of 1 into the time_hi_and_version part Advanced_State.Last_ID.time_hi_and_version := Bitfield_16 (Time_High) or 16#1000#; Advanced_State.Base_TS := 0; end return; end Export_State; ------------------ -- Import_State -- ------------------ procedure Import_State (New_State: Version_1_State) is begin State := New_State; end Import_State; end Local_Generator; ---------------------- -- Global_Generator -- ---------------------- package body Global_Generator is package Generator is new Local_Generator (Default_Overrun => Default_Overrun, Timestamp_Source => Timestamp_Source); -- Protected body from which to call The Local Generator -- Global Lock protected Protected_Generator is procedure Generate (ID: out UUID; Overrun: in Sequence_Overrun); function Export_State (Advance: duration) return Version_1_State; procedure Import_State (New_State: Version_1_State); end Protected_Generator; protected body Protected_Generator is procedure Generate (ID: out UUID; Overrun: in Sequence_Overrun) is begin ID := Generator.Generate (Overrun); end Generate; function Export_State (Advance: duration) return Version_1_State is begin return Generator.Export_State (Advance); end Export_State; procedure Import_State (New_State: Version_1_State) is begin Generator.Import_State (New_State); end Import_State; end Protected_Generator; -------------- -- Generate -- -------------- function Generate (Overrun: Sequence_Overrun := Default_Overrun) return UUID is begin return ID: UUID do Protected_Generator.Generate (ID => ID, Overrun => Overrun); end return; end Generate; ------------------ -- Export_State -- ------------------ function Export_State (Advance: Duration := 0.0) return Version_1_State is begin return ID: Version_1_State do ID := Protected_Generator.Export_State(Advance); end return; end Export_State; ------------------ -- Import_State -- ------------------ procedure Import_State (New_State: Version_1_State) is begin Protected_Generator.Import_State(New_State); end Import_State; end Global_Generator; end UUIDs.Version_1;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . W I D _ L L U -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package contains the routine used for Width attribute for all -- non-static unsigned integer (modular integer) subtypes. Note we only -- have one routine, since this seems a fairly marginal function. with System.Unsigned_Types; package System.Wid_LLU is pragma Pure; function Width_Long_Long_Unsigned (Lo, Hi : System.Unsigned_Types.Long_Long_Unsigned) return Natural; -- Compute Width attribute for non-static type derived from a modular -- integer type. The arguments Lo, Hi are the bounds of the type. end System.Wid_LLU;
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2021 The progress_indicators authors -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. package body Progress_Indicators.Work_Trackers is protected body Work_Tracker is procedure Start_Work (Amount : Natural) is begin Current.Total := Current.Total + Amount; end Start_Work; procedure Finish_Work (Amount : Natural) is begin Current.Completed := Current.Completed + Amount; end Finish_Work; function Report return Status_Report is (Current); end Work_Tracker; end Progress_Indicators.Work_Trackers;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E X P _ C H 9 -- -- -- -- B o d y -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ with Atree; use Atree; with Aspects; use Aspects; with Checks; use Checks; with Einfo; use Einfo; with Elists; use Elists; with Errout; use Errout; with Exp_Ch3; use Exp_Ch3; with Exp_Ch6; use Exp_Ch6; with Exp_Ch11; use Exp_Ch11; with Exp_Dbug; use Exp_Dbug; with Exp_Sel; use Exp_Sel; with Exp_Smem; use Exp_Smem; with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; with Freeze; use Freeze; with Hostparm; with Itypes; use Itypes; with Namet; use Namet; with Nlists; use Nlists; with Nmake; use Nmake; with Opt; use Opt; with Restrict; use Restrict; with Rident; use Rident; with Rtsfind; use Rtsfind; with Sem; use Sem; with Sem_Aux; use Sem_Aux; with Sem_Ch5; use Sem_Ch5; with Sem_Ch6; use Sem_Ch6; with Sem_Ch8; use Sem_Ch8; with Sem_Ch9; use Sem_Ch9; with Sem_Ch11; use Sem_Ch11; with Sem_Ch13; use Sem_Ch13; with Sem_Elab; use Sem_Elab; with Sem_Eval; use Sem_Eval; with Sem_Res; use Sem_Res; with Sem_Util; use Sem_Util; with Sinfo; use Sinfo; with Snames; use Snames; with Stand; use Stand; with Targparm; use Targparm; with Tbuild; use Tbuild; with Uintp; use Uintp; with Validsw; use Validsw; package body Exp_Ch9 is -- The following constant establishes the upper bound for the index of -- an entry family. It is used to limit the allocated size of protected -- types with defaulted discriminant of an integer type, when the bound -- of some entry family depends on a discriminant. The limitation to entry -- families of 128K should be reasonable in all cases, and is a documented -- implementation restriction. Entry_Family_Bound : constant Pos := 2**16; ----------------------- -- Local Subprograms -- ----------------------- function Actual_Index_Expression (Sloc : Source_Ptr; Ent : Entity_Id; Index : Node_Id; Tsk : Entity_Id) return Node_Id; -- Compute the index position for an entry call. Tsk is the target task. If -- the bounds of some entry family depend on discriminants, the expression -- computed by this function uses the discriminants of the target task. procedure Add_Object_Pointer (Loc : Source_Ptr; Conc_Typ : Entity_Id; Decls : List_Id); -- Prepend an object pointer declaration to the declaration list Decls. -- This object pointer is initialized to a type conversion of the System. -- Address pointer passed to entry barrier functions and entry body -- procedures. procedure Add_Formal_Renamings (Spec : Node_Id; Decls : List_Id; Ent : Entity_Id; Loc : Source_Ptr); -- Create renaming declarations for the formals, inside the procedure that -- implements an entry body. The renamings make the original names of the -- formals accessible to gdb, and serve no other purpose. -- Spec is the specification of the procedure being built. -- Decls is the list of declarations to be enhanced. -- Ent is the entity for the original entry body. function Build_Accept_Body (Astat : Node_Id) return Node_Id; -- Transform accept statement into a block with added exception handler. -- Used both for simple accept statements and for accept alternatives in -- select statements. Astat is the accept statement. function Build_Barrier_Function (N : Node_Id; Ent : Entity_Id; Pid : Node_Id) return Node_Id; -- Build the function body returning the value of the barrier expression -- for the specified entry body. function Build_Barrier_Function_Specification (Loc : Source_Ptr; Def_Id : Entity_Id) return Node_Id; -- Build a specification for a function implementing the protected entry -- barrier of the specified entry body. procedure Build_Contract_Wrapper (E : Entity_Id; Decl : Node_Id); -- Build the body of a wrapper procedure for an entry or entry family that -- has contract cases, preconditions, or postconditions. The body gathers -- the executable contract items and expands them in the usual way, and -- performs the entry call itself. This way preconditions are evaluated -- before the call is queued. E is the entry in question, and Decl is the -- enclosing synchronized type declaration at whose freeze point the -- generated body is analyzed. function Build_Corresponding_Record (N : Node_Id; Ctyp : Node_Id; Loc : Source_Ptr) return Node_Id; -- Common to tasks and protected types. Copy discriminant specifications, -- build record declaration. N is the type declaration, Ctyp is the -- concurrent entity (task type or protected type). function Build_Dispatching_Tag_Check (K : Entity_Id; N : Node_Id) return Node_Id; -- Utility to create the tree to check whether the dispatching call in -- a timed entry call, a conditional entry call, or an asynchronous -- transfer of control is a call to a primitive of a non-synchronized type. -- K is the temporary that holds the tagged kind of the target object, and -- N is the enclosing construct. function Build_Entry_Count_Expression (Concurrent_Type : Node_Id; Component_List : List_Id; Loc : Source_Ptr) return Node_Id; -- Compute number of entries for concurrent object. This is a count of -- simple entries, followed by an expression that computes the length -- of the range of each entry family. A single array with that size is -- allocated for each concurrent object of the type. function Build_Find_Body_Index (Typ : Entity_Id) return Node_Id; -- Build the function that translates the entry index in the call -- (which depends on the size of entry families) into an index into the -- Entry_Bodies_Array, to determine the body and barrier function used -- in a protected entry call. A pointer to this function appears in every -- protected object. function Build_Find_Body_Index_Spec (Typ : Entity_Id) return Node_Id; -- Build subprogram declaration for previous one function Build_Lock_Free_Protected_Subprogram_Body (N : Node_Id; Prot_Typ : Node_Id; Unprot_Spec : Node_Id) return Node_Id; -- N denotes a subprogram body of protected type Prot_Typ. Unprot_Spec is -- the subprogram specification of the unprotected version of N. Transform -- N such that it invokes the unprotected version of the body. function Build_Lock_Free_Unprotected_Subprogram_Body (N : Node_Id; Prot_Typ : Node_Id) return Node_Id; -- N denotes a subprogram body of protected type Prot_Typ. Build a version -- of N where the original statements of N are synchronized through atomic -- actions such as compare and exchange. Prior to invoking this routine, it -- has been established that N can be implemented in a lock-free fashion. function Build_Parameter_Block (Loc : Source_Ptr; Actuals : List_Id; Formals : List_Id; Decls : List_Id) return Entity_Id; -- Generate an access type for each actual parameter in the list Actuals. -- Create an encapsulating record that contains all the actuals and return -- its type. Generate: -- type Ann1 is access all <actual1-type> -- ... -- type AnnN is access all <actualN-type> -- type Pnn is record -- <formal1> : Ann1; -- ... -- <formalN> : AnnN; -- end record; function Build_Protected_Entry (N : Node_Id; Ent : Entity_Id; Pid : Node_Id) return Node_Id; -- Build the procedure implementing the statement sequence of the specified -- entry body. function Build_Protected_Entry_Specification (Loc : Source_Ptr; Def_Id : Entity_Id; Ent_Id : Entity_Id) return Node_Id; -- Build a specification for the procedure implementing the statements of -- the specified entry body. Add attributes associating it with the entry -- defining identifier Ent_Id. function Build_Protected_Spec (N : Node_Id; Obj_Type : Entity_Id; Ident : Entity_Id; Unprotected : Boolean := False) return List_Id; -- Utility shared by Build_Protected_Sub_Spec and Expand_Access_Protected_ -- Subprogram_Type. Builds signature of protected subprogram, adding the -- formal that corresponds to the object itself. For an access to protected -- subprogram, there is no object type to specify, so the parameter has -- type Address and mode In. An indirect call through such a pointer will -- convert the address to a reference to the actual object. The object is -- a limited record and therefore a by_reference type. function Build_Protected_Subprogram_Body (N : Node_Id; Pid : Node_Id; N_Op_Spec : Node_Id) return Node_Id; -- This function is used to construct the protected version of a protected -- subprogram. Its statement sequence first defers abort, then locks the -- associated protected object, and then enters a block that contains a -- call to the unprotected version of the subprogram (for details, see -- Build_Unprotected_Subprogram_Body). This block statement requires a -- cleanup handler that unlocks the object in all cases. For details, -- see Exp_Ch7.Expand_Cleanup_Actions. function Build_Renamed_Formal_Declaration (New_F : Entity_Id; Formal : Entity_Id; Comp : Entity_Id; Renamed_Formal : Node_Id) return Node_Id; -- Create a renaming declaration for a formal, within a protected entry -- body or an accept body. The renamed object is a component of the -- parameter block that is a parameter in the entry call. -- -- In Ada 2012, if the formal is an incomplete tagged type, the renaming -- does not dereference the corresponding component to prevent an illegal -- use of the incomplete type (AI05-0151). function Build_Selected_Name (Prefix : Entity_Id; Selector : Entity_Id; Append_Char : Character := ' ') return Name_Id; -- Build a name in the form of Prefix__Selector, with an optional character -- appended. This is used for internal subprograms generated for operations -- of protected types, including barrier functions. For the subprograms -- generated for entry bodies and entry barriers, the generated name -- includes a sequence number that makes names unique in the presence of -- entry overloading. This is necessary because entry body procedures and -- barrier functions all have the same signature. procedure Build_Simple_Entry_Call (N : Node_Id; Concval : Node_Id; Ename : Node_Id; Index : Node_Id); -- Some comments here would be useful ??? function Build_Task_Proc_Specification (T : Entity_Id) return Node_Id; -- This routine constructs a specification for the procedure that we will -- build for the task body for task type T. The spec has the form: -- -- procedure tnameB (_Task : access tnameV); -- -- where name is the character name taken from the task type entity that -- is passed as the argument to the procedure, and tnameV is the task -- value type that is associated with the task type. function Build_Unprotected_Subprogram_Body (N : Node_Id; Pid : Node_Id) return Node_Id; -- This routine constructs the unprotected version of a protected -- subprogram body, which contains all of the code in the original, -- unexpanded body. This is the version of the protected subprogram that is -- called from all protected operations on the same object, including the -- protected version of the same subprogram. procedure Build_Wrapper_Bodies (Loc : Source_Ptr; Typ : Entity_Id; N : Node_Id); -- Ada 2005 (AI-345): Typ is either a concurrent type or the corresponding -- record of a concurrent type. N is the insertion node where all bodies -- will be placed. This routine builds the bodies of the subprograms which -- serve as an indirection mechanism to overriding primitives of concurrent -- types, entries and protected procedures. Any new body is analyzed. procedure Build_Wrapper_Specs (Loc : Source_Ptr; Typ : Entity_Id; N : in out Node_Id); -- Ada 2005 (AI-345): Typ is either a concurrent type or the corresponding -- record of a concurrent type. N is the insertion node where all specs -- will be placed. This routine builds the specs of the subprograms which -- serve as an indirection mechanism to overriding primitives of concurrent -- types, entries and protected procedures. Any new spec is analyzed. procedure Collect_Entry_Families (Loc : Source_Ptr; Cdecls : List_Id; Current_Node : in out Node_Id; Conctyp : Entity_Id); -- For each entry family in a concurrent type, create an anonymous array -- type of the right size, and add a component to the corresponding_record. function Concurrent_Object (Spec_Id : Entity_Id; Conc_Typ : Entity_Id) return Entity_Id; -- Given a subprogram entity Spec_Id and concurrent type Conc_Typ, return -- the entity associated with the concurrent object in the Protected_Body_ -- Subprogram or the Task_Body_Procedure of Spec_Id. The returned entity -- denotes formal parameter _O, _object or _task. function Copy_Result_Type (Res : Node_Id) return Node_Id; -- Copy the result type of a function specification, when building the -- internal operation corresponding to a protected function, or when -- expanding an access to protected function. If the result is an anonymous -- access to subprogram itself, we need to create a new signature with the -- same parameter names and the same resolved types, but with new entities -- for the formals. function Create_Secondary_Stack_For_Task (T : Node_Id) return Boolean; -- Return whether a secondary stack for the task T should be created by the -- expander. The secondary stack for a task will be created by the expander -- if the size of the stack has been specified by the Secondary_Stack_Size -- representation aspect and either the No_Implicit_Heap_Allocations or -- No_Implicit_Task_Allocations restrictions are in effect and the -- No_Secondary_Stack restriction is not. procedure Debug_Private_Data_Declarations (Decls : List_Id); -- Decls is a list which may contain the declarations created by Install_ -- Private_Data_Declarations. All generated entities are marked as needing -- debug info and debug nodes are manually generation where necessary. This -- step of the expansion must to be done after private data has been moved -- to its final resting scope to ensure proper visibility of debug objects. procedure Ensure_Statement_Present (Loc : Source_Ptr; Alt : Node_Id); -- If control flow optimizations are suppressed, and Alt is an accept, -- delay, or entry call alternative with no trailing statements, insert -- a null trailing statement with the given Loc (which is the sloc of -- the accept, delay, or entry call statement). There might not be any -- generated code for the accept, delay, or entry call itself (the effect -- of these statements is part of the general processing done for the -- enclosing selective accept, timed entry call, or asynchronous select), -- and the null statement is there to carry the sloc of that statement to -- the back-end for trace-based coverage analysis purposes. procedure Extract_Dispatching_Call (N : Node_Id; Call_Ent : out Entity_Id; Object : out Entity_Id; Actuals : out List_Id; Formals : out List_Id); -- Given a dispatching call, extract the entity of the name of the call, -- its actual dispatching object, its actual parameters and the formal -- parameters of the overridden interface-level version. If the type of -- the dispatching object is an access type then an explicit dereference -- is returned in Object. procedure Extract_Entry (N : Node_Id; Concval : out Node_Id; Ename : out Node_Id; Index : out Node_Id); -- Given an entry call, returns the associated concurrent object, the entry -- name, and the entry family index. function Family_Offset (Loc : Source_Ptr; Hi : Node_Id; Lo : Node_Id; Ttyp : Entity_Id; Cap : Boolean) return Node_Id; -- Compute (Hi - Lo) for two entry family indexes. Hi is the index in an -- accept statement, or the upper bound in the discrete subtype of an entry -- declaration. Lo is the corresponding lower bound. Ttyp is the concurrent -- type of the entry. If Cap is true, the result is capped according to -- Entry_Family_Bound. function Family_Size (Loc : Source_Ptr; Hi : Node_Id; Lo : Node_Id; Ttyp : Entity_Id; Cap : Boolean) return Node_Id; -- Compute (Hi - Lo) + 1 Max 0, to determine the number of entries in a -- family, and handle properly the superflat case. This is equivalent to -- the use of 'Length on the index type, but must use Family_Offset to -- handle properly the case of bounds that depend on discriminants. If -- Cap is true, the result is capped according to Entry_Family_Bound. procedure Find_Enclosing_Context (N : Node_Id; Context : out Node_Id; Context_Id : out Entity_Id; Context_Decls : out List_Id); -- Subsidiary routine to procedures Build_Activation_Chain_Entity and -- Build_Master_Entity. Given an arbitrary node in the tree, find the -- nearest enclosing body, block, package, or return statement and return -- its constituents. Context is the enclosing construct, Context_Id is -- the scope of Context_Id and Context_Decls is the declarative list of -- Context. function Index_Object (Spec_Id : Entity_Id) return Entity_Id; -- Given a subprogram identifier, return the entity which is associated -- with the protection entry index in the Protected_Body_Subprogram or -- the Task_Body_Procedure of Spec_Id. The returned entity denotes formal -- parameter _E. function Is_Potentially_Large_Family (Base_Index : Entity_Id; Conctyp : Entity_Id; Lo : Node_Id; Hi : Node_Id) return Boolean; -- Determine whether an entry family is potentially large because one of -- its bounds denotes a discrminant. function Is_Private_Primitive_Subprogram (Id : Entity_Id) return Boolean; -- Determine whether Id is a function or a procedure and is marked as a -- private primitive. function Null_Statements (Stats : List_Id) return Boolean; -- Used to check DO-END sequence. Checks for equivalent of DO NULL; END. -- Allows labels, and pragma Warnings/Unreferenced in the sequence as well -- to still count as null. Returns True for a null sequence. The argument -- is the list of statements from the DO-END sequence. function Parameter_Block_Pack (Loc : Source_Ptr; Blk_Typ : Entity_Id; Actuals : List_Id; Formals : List_Id; Decls : List_Id; Stmts : List_Id) return Entity_Id; -- Set the components of the generated parameter block with the values -- of the actual parameters. Generate aliased temporaries to capture the -- values for types that are passed by copy. Otherwise generate a reference -- to the actual's value. Return the address of the aggregate block. -- Generate: -- Jnn1 : alias <formal-type1>; -- Jnn1 := <actual1>; -- ... -- P : Blk_Typ := ( -- Jnn1'unchecked_access; -- <actual2>'reference; -- ...); function Parameter_Block_Unpack (Loc : Source_Ptr; P : Entity_Id; Actuals : List_Id; Formals : List_Id) return List_Id; -- Retrieve the values of the components from the parameter block and -- assign then to the original actual parameters. Generate: -- <actual1> := P.<formal1>; -- ... -- <actualN> := P.<formalN>; procedure Reset_Scopes_To (Bod : Node_Id; E : Entity_Id); -- Reset the scope of declarations and blocks at the top level of Bod to -- be E. Bod is either a block or a subprogram body. Used after expanding -- various kinds of entry bodies into their corresponding constructs. This -- is needed during unnesting to determine whether a body generated for an -- entry or an accept alternative includes uplevel references. function Trivial_Accept_OK return Boolean; -- If there is no DO-END block for an accept, or if the DO-END block has -- only null statements, then it is possible to do the Rendezvous with much -- less overhead using the Accept_Trivial routine in the run-time library. -- However, this is not always a valid optimization. Whether it is valid or -- not depends on the Task_Dispatching_Policy. The issue is whether a full -- rescheduling action is required or not. In FIFO_Within_Priorities, such -- a rescheduling is required, so this optimization is not allowed. This -- function returns True if the optimization is permitted. ----------------------------- -- Actual_Index_Expression -- ----------------------------- function Actual_Index_Expression (Sloc : Source_Ptr; Ent : Entity_Id; Index : Node_Id; Tsk : Entity_Id) return Node_Id is Ttyp : constant Entity_Id := Etype (Tsk); Expr : Node_Id; Num : Node_Id; Lo : Node_Id; Hi : Node_Id; Prev : Entity_Id; S : Node_Id; function Actual_Family_Offset (Hi, Lo : Node_Id) return Node_Id; -- Compute difference between bounds of entry family -------------------------- -- Actual_Family_Offset -- -------------------------- function Actual_Family_Offset (Hi, Lo : Node_Id) return Node_Id is function Actual_Discriminant_Ref (Bound : Node_Id) return Node_Id; -- Replace a reference to a discriminant with a selected component -- denoting the discriminant of the target task. ----------------------------- -- Actual_Discriminant_Ref -- ----------------------------- function Actual_Discriminant_Ref (Bound : Node_Id) return Node_Id is Typ : constant Entity_Id := Etype (Bound); B : Node_Id; begin if not Is_Entity_Name (Bound) or else Ekind (Entity (Bound)) /= E_Discriminant then if Nkind (Bound) = N_Attribute_Reference then return Bound; else B := New_Copy_Tree (Bound); end if; else B := Make_Selected_Component (Sloc, Prefix => New_Copy_Tree (Tsk), Selector_Name => New_Occurrence_Of (Entity (Bound), Sloc)); Analyze_And_Resolve (B, Typ); end if; return Make_Attribute_Reference (Sloc, Attribute_Name => Name_Pos, Prefix => New_Occurrence_Of (Etype (Bound), Sloc), Expressions => New_List (B)); end Actual_Discriminant_Ref; -- Start of processing for Actual_Family_Offset begin return Make_Op_Subtract (Sloc, Left_Opnd => Actual_Discriminant_Ref (Hi), Right_Opnd => Actual_Discriminant_Ref (Lo)); end Actual_Family_Offset; -- Start of processing for Actual_Index_Expression begin -- The queues of entries and entry families appear in textual order in -- the associated record. The entry index is computed as the sum of the -- number of queues for all entries that precede the designated one, to -- which is added the index expression, if this expression denotes a -- member of a family. -- The following is a place holder for the count of simple entries Num := Make_Integer_Literal (Sloc, 1); -- We construct an expression which is a series of addition operations. -- See comments in Entry_Index_Expression, which is identical in -- structure. if Present (Index) then S := Entry_Index_Type (Ent); -- First make sure the index is in range if requested. The index type -- has been directly set on the prefix, see Resolve_Entry. if Do_Range_Check (Index) then Generate_Range_Check (Index, Etype (Prefix (Parent (Index))), CE_Range_Check_Failed); end if; Expr := Make_Op_Add (Sloc, Left_Opnd => Num, Right_Opnd => Actual_Family_Offset ( Make_Attribute_Reference (Sloc, Attribute_Name => Name_Pos, Prefix => New_Occurrence_Of (Base_Type (S), Sloc), Expressions => New_List (Relocate_Node (Index))), Type_Low_Bound (S))); else Expr := Num; end if; -- Now add lengths of preceding entries and entry families Prev := First_Entity (Ttyp); while Chars (Prev) /= Chars (Ent) or else (Ekind (Prev) /= Ekind (Ent)) or else not Sem_Ch6.Type_Conformant (Ent, Prev) loop if Ekind (Prev) = E_Entry then Set_Intval (Num, Intval (Num) + 1); elsif Ekind (Prev) = E_Entry_Family then S := Entry_Index_Type (Prev); -- The need for the following full view retrieval stems from this -- complex case of nested generics and tasking: -- generic -- type Formal_Index is range <>; -- ... -- package Outer is -- type Index is private; -- generic -- ... -- package Inner is -- procedure P; -- end Inner; -- private -- type Index is new Formal_Index range 1 .. 10; -- end Outer; -- package body Outer is -- task type T is -- entry Fam (Index); -- (2) -- entry E; -- end T; -- package body Inner is -- (3) -- procedure P is -- begin -- T.E; -- (1) -- end P; -- end Inner; -- ... -- We are currently building the index expression for the entry -- call "T.E" (1). Part of the expansion must mention the range -- of the discrete type "Index" (2) of entry family "Fam". -- However only the private view of type "Index" is available to -- the inner generic (3) because there was no prior mention of -- the type inside "Inner". This visibility requirement is -- implicit and cannot be detected during the construction of -- the generic trees and needs special handling. if In_Instance_Body and then Is_Private_Type (S) and then Present (Full_View (S)) then S := Full_View (S); end if; Lo := Type_Low_Bound (S); Hi := Type_High_Bound (S); Expr := Make_Op_Add (Sloc, Left_Opnd => Expr, Right_Opnd => Make_Op_Add (Sloc, Left_Opnd => Actual_Family_Offset (Hi, Lo), Right_Opnd => Make_Integer_Literal (Sloc, 1))); -- Other components are anonymous types to be ignored else null; end if; Next_Entity (Prev); end loop; return Expr; end Actual_Index_Expression; -------------------------- -- Add_Formal_Renamings -- -------------------------- procedure Add_Formal_Renamings (Spec : Node_Id; Decls : List_Id; Ent : Entity_Id; Loc : Source_Ptr) is Ptr : constant Entity_Id := Defining_Identifier (Next (First (Parameter_Specifications (Spec)))); -- The name of the formal that holds the address of the parameter block -- for the call. Comp : Entity_Id; Decl : Node_Id; Formal : Entity_Id; New_F : Entity_Id; Renamed_Formal : Node_Id; begin Formal := First_Formal (Ent); while Present (Formal) loop Comp := Entry_Component (Formal); New_F := Make_Defining_Identifier (Sloc (Formal), Chars => Chars (Formal)); Set_Etype (New_F, Etype (Formal)); Set_Scope (New_F, Ent); -- Now we set debug info needed on New_F even though it does not come -- from source, so that the debugger will get the right information -- for these generated names. Set_Debug_Info_Needed (New_F); if Ekind (Formal) = E_In_Parameter then Set_Ekind (New_F, E_Constant); else Set_Ekind (New_F, E_Variable); Set_Extra_Constrained (New_F, Extra_Constrained (Formal)); end if; Set_Actual_Subtype (New_F, Actual_Subtype (Formal)); Renamed_Formal := Make_Selected_Component (Loc, Prefix => Make_Explicit_Dereference (Loc, Unchecked_Convert_To (Entry_Parameters_Type (Ent), Make_Identifier (Loc, Chars (Ptr)))), Selector_Name => New_Occurrence_Of (Comp, Loc)); Decl := Build_Renamed_Formal_Declaration (New_F, Formal, Comp, Renamed_Formal); Append (Decl, Decls); Set_Renamed_Object (Formal, New_F); Next_Formal (Formal); end loop; end Add_Formal_Renamings; ------------------------ -- Add_Object_Pointer -- ------------------------ procedure Add_Object_Pointer (Loc : Source_Ptr; Conc_Typ : Entity_Id; Decls : List_Id) is Rec_Typ : constant Entity_Id := Corresponding_Record_Type (Conc_Typ); Decl : Node_Id; Obj_Ptr : Node_Id; begin -- Create the renaming declaration for the Protection object of a -- protected type. _Object is used by Complete_Entry_Body. -- ??? An attempt to make this a renaming was unsuccessful. -- Build the entity for the access type Obj_Ptr := Make_Defining_Identifier (Loc, New_External_Name (Chars (Rec_Typ), 'P')); -- Generate: -- _object : poVP := poVP!O; Decl := Make_Object_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uObject), Object_Definition => New_Occurrence_Of (Obj_Ptr, Loc), Expression => Unchecked_Convert_To (Obj_Ptr, Make_Identifier (Loc, Name_uO))); Set_Debug_Info_Needed (Defining_Identifier (Decl)); Prepend_To (Decls, Decl); -- Generate: -- type poVP is access poV; Decl := Make_Full_Type_Declaration (Loc, Defining_Identifier => Obj_Ptr, Type_Definition => Make_Access_To_Object_Definition (Loc, Subtype_Indication => New_Occurrence_Of (Rec_Typ, Loc))); Set_Debug_Info_Needed (Defining_Identifier (Decl)); Prepend_To (Decls, Decl); end Add_Object_Pointer; ----------------------- -- Build_Accept_Body -- ----------------------- function Build_Accept_Body (Astat : Node_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (Astat); Stats : constant Node_Id := Handled_Statement_Sequence (Astat); New_S : Node_Id; Hand : Node_Id; Call : Node_Id; Ohandle : Node_Id; begin -- At the end of the statement sequence, Complete_Rendezvous is called. -- A label skipping the Complete_Rendezvous, and all other accept -- processing, has already been added for the expansion of requeue -- statements. The Sloc is copied from the last statement since it -- is really part of this last statement. Call := Build_Runtime_Call (Sloc (Last (Statements (Stats))), RE_Complete_Rendezvous); Insert_Before (Last (Statements (Stats)), Call); Analyze (Call); -- Ada 2020 (AI12-0279) if Has_Yield_Aspect (Entity (Entry_Direct_Name (Astat))) and then RTE_Available (RE_Yield) then Insert_Action_After (Call, Make_Procedure_Call_Statement (Loc, New_Occurrence_Of (RTE (RE_Yield), Loc))); end if; -- If exception handlers are present, then append Complete_Rendezvous -- calls to the handlers, and construct the required outer block. As -- above, the Sloc is copied from the last statement in the sequence. if Present (Exception_Handlers (Stats)) then Hand := First (Exception_Handlers (Stats)); while Present (Hand) loop Call := Build_Runtime_Call (Sloc (Last (Statements (Hand))), RE_Complete_Rendezvous); Append (Call, Statements (Hand)); Analyze (Call); -- Ada 2020 (AI12-0279) if Has_Yield_Aspect (Entity (Entry_Direct_Name (Astat))) and then RTE_Available (RE_Yield) then Insert_Action_After (Call, Make_Procedure_Call_Statement (Loc, New_Occurrence_Of (RTE (RE_Yield), Loc))); end if; Next (Hand); end loop; New_S := Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List ( Make_Block_Statement (Loc, Handled_Statement_Sequence => Stats))); else New_S := Stats; end if; -- At this stage we know that the new statement sequence does -- not have an exception handler part, so we supply one to call -- Exceptional_Complete_Rendezvous. This handler is -- when all others => -- Exceptional_Complete_Rendezvous (Get_GNAT_Exception); -- We handle Abort_Signal to make sure that we properly catch the abort -- case and wake up the caller. Call := Make_Procedure_Call_Statement (Sloc (Stats), Name => New_Occurrence_Of ( RTE (RE_Exceptional_Complete_Rendezvous), Sloc (Stats)), Parameter_Associations => New_List ( Make_Function_Call (Sloc (Stats), Name => New_Occurrence_Of (RTE (RE_Get_GNAT_Exception), Sloc (Stats))))); Ohandle := Make_Others_Choice (Loc); Set_All_Others (Ohandle); Set_Exception_Handlers (New_S, New_List ( Make_Implicit_Exception_Handler (Loc, Exception_Choices => New_List (Ohandle), Statements => New_List (Call)))); -- Ada 2020 (AI12-0279) if Has_Yield_Aspect (Entity (Entry_Direct_Name (Astat))) and then RTE_Available (RE_Yield) then Insert_Action_After (Call, Make_Procedure_Call_Statement (Loc, New_Occurrence_Of (RTE (RE_Yield), Loc))); end if; Set_Parent (New_S, Astat); -- temp parent for Analyze call Analyze_Exception_Handlers (Exception_Handlers (New_S)); Expand_Exception_Handlers (New_S); -- Exceptional_Complete_Rendezvous must be called with abort still -- deferred, which is the case for a "when all others" handler. return New_S; end Build_Accept_Body; ----------------------------------- -- Build_Activation_Chain_Entity -- ----------------------------------- procedure Build_Activation_Chain_Entity (N : Node_Id) is function Has_Activation_Chain (Stmt : Node_Id) return Boolean; -- Determine whether an extended return statement has activation chain -------------------------- -- Has_Activation_Chain -- -------------------------- function Has_Activation_Chain (Stmt : Node_Id) return Boolean is Decl : Node_Id; begin Decl := First (Return_Object_Declarations (Stmt)); while Present (Decl) loop if Nkind (Decl) = N_Object_Declaration and then Chars (Defining_Identifier (Decl)) = Name_uChain then return True; end if; Next (Decl); end loop; return False; end Has_Activation_Chain; -- Local variables Context : Node_Id; Context_Id : Entity_Id; Decls : List_Id; -- Start of processing for Build_Activation_Chain_Entity begin -- No action needed if the run-time has no tasking support if Global_No_Tasking then return; end if; -- Activation chain is never used for sequential elaboration policy, see -- comment for Create_Restricted_Task_Sequential in s-tarest.ads). if Partition_Elaboration_Policy = 'S' then return; end if; Find_Enclosing_Context (N, Context, Context_Id, Decls); -- If activation chain entity has not been declared already, create one if Nkind (Context) = N_Extended_Return_Statement or else No (Activation_Chain_Entity (Context)) then -- Since extended return statements do not store the entity of the -- chain, examine the return object declarations to avoid creating -- a duplicate. if Nkind (Context) = N_Extended_Return_Statement and then Has_Activation_Chain (Context) then return; end if; declare Loc : constant Source_Ptr := Sloc (Context); Chain : Entity_Id; Decl : Node_Id; begin Chain := Make_Defining_Identifier (Sloc (N), Name_uChain); -- Note: An extended return statement is not really a task -- activator, but it does have an activation chain on which to -- store the tasks temporarily. On successful return, the tasks -- on this chain are moved to the chain passed in by the caller. -- We do not build an Activation_Chain_Entity for an extended -- return statement, because we do not want to build a call to -- Activate_Tasks. Task activation is the responsibility of the -- caller. if Nkind (Context) /= N_Extended_Return_Statement then Set_Activation_Chain_Entity (Context, Chain); end if; Decl := Make_Object_Declaration (Loc, Defining_Identifier => Chain, Aliased_Present => True, Object_Definition => New_Occurrence_Of (RTE (RE_Activation_Chain), Loc)); Prepend_To (Decls, Decl); -- Ensure that _chain appears in the proper scope of the context if Context_Id /= Current_Scope then Push_Scope (Context_Id); Analyze (Decl); Pop_Scope; else Analyze (Decl); end if; end; end if; end Build_Activation_Chain_Entity; ---------------------------- -- Build_Barrier_Function -- ---------------------------- function Build_Barrier_Function (N : Node_Id; Ent : Entity_Id; Pid : Node_Id) return Node_Id is Ent_Formals : constant Node_Id := Entry_Body_Formal_Part (N); Cond : constant Node_Id := Condition (Ent_Formals); Loc : constant Source_Ptr := Sloc (Cond); Func_Id : constant Entity_Id := Barrier_Function (Ent); Op_Decls : constant List_Id := New_List; Stmt : Node_Id; Func_Body : Node_Id; begin -- Add a declaration for the Protection object, renaming declarations -- for the discriminals and privals and finally a declaration for the -- entry family index (if applicable). Install_Private_Data_Declarations (Sloc (N), Spec_Id => Func_Id, Conc_Typ => Pid, Body_Nod => N, Decls => Op_Decls, Barrier => True, Family => Ekind (Ent) = E_Entry_Family); -- If compiling with -fpreserve-control-flow, make sure we insert an -- IF statement so that the back-end knows to generate a conditional -- branch instruction, even if the condition is just the name of a -- boolean object. Note that Expand_N_If_Statement knows to preserve -- such redundant IF statements under -fpreserve-control-flow -- (whether coming from this routine, or directly from source). if Opt.Suppress_Control_Flow_Optimizations then Stmt := Make_Implicit_If_Statement (Cond, Condition => Cond, Then_Statements => New_List ( Make_Simple_Return_Statement (Loc, New_Occurrence_Of (Standard_True, Loc))), Else_Statements => New_List ( Make_Simple_Return_Statement (Loc, New_Occurrence_Of (Standard_False, Loc)))); else Stmt := Make_Simple_Return_Statement (Loc, Cond); end if; -- Note: the condition in the barrier function needs to be properly -- processed for the C/Fortran boolean possibility, but this happens -- automatically since the return statement does this normalization. Func_Body := Make_Subprogram_Body (Loc, Specification => Build_Barrier_Function_Specification (Loc, Make_Defining_Identifier (Loc, Chars (Func_Id))), Declarations => Op_Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List (Stmt))); Set_Is_Entry_Barrier_Function (Func_Body); return Func_Body; end Build_Barrier_Function; ------------------------------------------ -- Build_Barrier_Function_Specification -- ------------------------------------------ function Build_Barrier_Function_Specification (Loc : Source_Ptr; Def_Id : Entity_Id) return Node_Id is begin Set_Debug_Info_Needed (Def_Id); return Make_Function_Specification (Loc, Defining_Unit_Name => Def_Id, Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uO), Parameter_Type => New_Occurrence_Of (RTE (RE_Address), Loc)), Make_Parameter_Specification (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uE), Parameter_Type => New_Occurrence_Of (RTE (RE_Protected_Entry_Index), Loc))), Result_Definition => New_Occurrence_Of (Standard_Boolean, Loc)); end Build_Barrier_Function_Specification; -------------------------- -- Build_Call_With_Task -- -------------------------- function Build_Call_With_Task (N : Node_Id; E : Entity_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (N); begin return Make_Function_Call (Loc, Name => New_Occurrence_Of (E, Loc), Parameter_Associations => New_List (Concurrent_Ref (N))); end Build_Call_With_Task; ----------------------------- -- Build_Class_Wide_Master -- ----------------------------- procedure Build_Class_Wide_Master (Typ : Entity_Id) is Loc : constant Source_Ptr := Sloc (Typ); Master_Decl : Node_Id; Master_Id : Entity_Id; Master_Scope : Entity_Id; Name_Id : Node_Id; Related_Node : Node_Id; Ren_Decl : Node_Id; begin -- No action needed if the run-time has no tasking support if Global_No_Tasking then return; end if; -- Find the declaration that created the access type, which is either a -- type declaration, or an object declaration with an access definition, -- in which case the type is anonymous. if Is_Itype (Typ) then Related_Node := Associated_Node_For_Itype (Typ); else Related_Node := Parent (Typ); end if; Master_Scope := Find_Master_Scope (Typ); -- Nothing to do if the master scope already contains a _master entity. -- The only exception to this is the following scenario: -- Source_Scope -- Transient_Scope_1 -- _master -- Transient_Scope_2 -- use of master -- In this case the source scope is marked as having the master entity -- even though the actual declaration appears inside an inner scope. If -- the second transient scope requires a _master, it cannot use the one -- already declared because the entity is not visible. Name_Id := Make_Identifier (Loc, Name_uMaster); Master_Decl := Empty; if not Has_Master_Entity (Master_Scope) or else No (Current_Entity_In_Scope (Name_Id)) then declare Ins_Nod : Node_Id; begin Set_Has_Master_Entity (Master_Scope); Master_Decl := Build_Master_Declaration (Loc); -- Ensure that the master declaration is placed before its use Ins_Nod := Find_Hook_Context (Related_Node); while not Is_List_Member (Ins_Nod) loop Ins_Nod := Parent (Ins_Nod); end loop; Insert_Before (First (List_Containing (Ins_Nod)), Master_Decl); Analyze (Master_Decl); -- Mark the containing scope as a task master. Masters associated -- with return statements are already marked at this stage (see -- Analyze_Subprogram_Body). if Ekind (Current_Scope) /= E_Return_Statement then declare Par : Node_Id := Related_Node; begin while Nkind (Par) /= N_Compilation_Unit loop Par := Parent (Par); -- If we fall off the top, we are at the outer level, -- and the environment task is our effective master, -- so nothing to mark. if Nkind (Par) in N_Block_Statement | N_Subprogram_Body | N_Task_Body then Set_Is_Task_Master (Par); exit; end if; end loop; end; end if; end; end if; Master_Id := Make_Defining_Identifier (Loc, New_External_Name (Chars (Typ), 'M')); -- Generate: -- typeMnn renames _master; Ren_Decl := Make_Object_Renaming_Declaration (Loc, Defining_Identifier => Master_Id, Subtype_Mark => New_Occurrence_Of (Standard_Integer, Loc), Name => Name_Id); -- If the master is declared locally, add the renaming declaration -- immediately after it, to prevent access-before-elaboration in the -- back-end. if Present (Master_Decl) then Insert_After (Master_Decl, Ren_Decl); Analyze (Ren_Decl); else Insert_Action (Related_Node, Ren_Decl); end if; Set_Master_Id (Typ, Master_Id); end Build_Class_Wide_Master; ---------------------------- -- Build_Contract_Wrapper -- ---------------------------- procedure Build_Contract_Wrapper (E : Entity_Id; Decl : Node_Id) is Conc_Typ : constant Entity_Id := Scope (E); Loc : constant Source_Ptr := Sloc (E); procedure Add_Discriminant_Renamings (Obj_Id : Entity_Id; Decls : List_Id); -- Add renaming declarations for all discriminants of concurrent type -- Conc_Typ. Obj_Id is the entity of the wrapper formal parameter which -- represents the concurrent object. procedure Add_Matching_Formals (Formals : List_Id; Actuals : in out List_Id); -- Add formal parameters that match those of entry E to list Formals. -- The routine also adds matching actuals for the new formals to list -- Actuals. procedure Transfer_Pragma (Prag : Node_Id; To : in out List_Id); -- Relocate pragma Prag to list To. The routine creates a new list if -- To does not exist. -------------------------------- -- Add_Discriminant_Renamings -- -------------------------------- procedure Add_Discriminant_Renamings (Obj_Id : Entity_Id; Decls : List_Id) is Discr : Entity_Id; begin -- Inspect the discriminants of the concurrent type and generate a -- renaming for each one. if Has_Discriminants (Conc_Typ) then Discr := First_Discriminant (Conc_Typ); while Present (Discr) loop Prepend_To (Decls, Make_Object_Renaming_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Chars (Discr)), Subtype_Mark => New_Occurrence_Of (Etype (Discr), Loc), Name => Make_Selected_Component (Loc, Prefix => New_Occurrence_Of (Obj_Id, Loc), Selector_Name => Make_Identifier (Loc, Chars (Discr))))); Next_Discriminant (Discr); end loop; end if; end Add_Discriminant_Renamings; -------------------------- -- Add_Matching_Formals -- -------------------------- procedure Add_Matching_Formals (Formals : List_Id; Actuals : in out List_Id) is Formal : Entity_Id; New_Formal : Entity_Id; begin -- Inspect the formal parameters of the entry and generate a new -- matching formal with the same name for the wrapper. A reference -- to the new formal becomes an actual in the entry call. Formal := First_Formal (E); while Present (Formal) loop New_Formal := Make_Defining_Identifier (Loc, Chars (Formal)); Append_To (Formals, Make_Parameter_Specification (Loc, Defining_Identifier => New_Formal, In_Present => In_Present (Parent (Formal)), Out_Present => Out_Present (Parent (Formal)), Parameter_Type => New_Occurrence_Of (Etype (Formal), Loc))); if No (Actuals) then Actuals := New_List; end if; Append_To (Actuals, New_Occurrence_Of (New_Formal, Loc)); Next_Formal (Formal); end loop; end Add_Matching_Formals; --------------------- -- Transfer_Pragma -- --------------------- procedure Transfer_Pragma (Prag : Node_Id; To : in out List_Id) is New_Prag : Node_Id; begin if No (To) then To := New_List; end if; New_Prag := Relocate_Node (Prag); Set_Analyzed (New_Prag, False); Append (New_Prag, To); end Transfer_Pragma; -- Local variables Items : constant Node_Id := Contract (E); Actuals : List_Id := No_List; Call : Node_Id; Call_Nam : Node_Id; Decls : List_Id := No_List; Formals : List_Id; Has_Pragma : Boolean := False; Index_Id : Entity_Id; Obj_Id : Entity_Id; Prag : Node_Id; Wrapper_Id : Entity_Id; -- Start of processing for Build_Contract_Wrapper begin -- This routine generates a specialized wrapper for a protected or task -- entry [family] which implements precondition/postcondition semantics. -- Preconditions and case guards of contract cases are checked before -- the protected action or rendezvous takes place. Postconditions and -- consequences of contract cases are checked after the protected action -- or rendezvous takes place. The structure of the generated wrapper is -- as follows: -- procedure Wrapper -- (Obj_Id : Conc_Typ; -- concurrent object -- [Index : Index_Typ;] -- index of entry family -- [Formal_1 : ...; -- parameters of original entry -- Formal_N : ...]) -- is -- [Discr_1 : ... renames Obj_Id.Discr_1; -- discriminant -- Discr_N : ... renames Obj_Id.Discr_N;] -- renamings -- <precondition checks> -- <case guard checks> -- procedure _Postconditions is -- begin -- <postcondition checks> -- <consequence checks> -- end _Postconditions; -- begin -- Entry_Call (Obj_Id, [Index,] [Formal_1, Formal_N]); -- _Postconditions; -- end Wrapper; -- Create the wrapper only when the entry has at least one executable -- contract item such as contract cases, precondition or postcondition. if Present (Items) then -- Inspect the list of pre/postconditions and transfer all available -- pragmas to the declarative list of the wrapper. Prag := Pre_Post_Conditions (Items); while Present (Prag) loop if Pragma_Name_Unmapped (Prag) in Name_Postcondition | Name_Precondition and then Is_Checked (Prag) then Has_Pragma := True; Transfer_Pragma (Prag, To => Decls); end if; Prag := Next_Pragma (Prag); end loop; -- Inspect the list of test/contract cases and transfer only contract -- cases pragmas to the declarative part of the wrapper. Prag := Contract_Test_Cases (Items); while Present (Prag) loop if Pragma_Name (Prag) = Name_Contract_Cases and then Is_Checked (Prag) then Has_Pragma := True; Transfer_Pragma (Prag, To => Decls); end if; Prag := Next_Pragma (Prag); end loop; end if; -- The entry lacks executable contract items and a wrapper is not needed if not Has_Pragma then return; end if; -- Create the profile of the wrapper. The first formal parameter is the -- concurrent object. Obj_Id := Make_Defining_Identifier (Loc, Chars => New_External_Name (Chars (Conc_Typ), 'A')); Formals := New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => Obj_Id, Out_Present => True, In_Present => True, Parameter_Type => New_Occurrence_Of (Conc_Typ, Loc))); -- Construct the call to the original entry. The call will be gradually -- augmented with an optional entry index and extra parameters. Call_Nam := Make_Selected_Component (Loc, Prefix => New_Occurrence_Of (Obj_Id, Loc), Selector_Name => New_Occurrence_Of (E, Loc)); -- When creating a wrapper for an entry family, the second formal is the -- entry index. if Ekind (E) = E_Entry_Family then Index_Id := Make_Defining_Identifier (Loc, Name_I); Append_To (Formals, Make_Parameter_Specification (Loc, Defining_Identifier => Index_Id, Parameter_Type => New_Occurrence_Of (Entry_Index_Type (E), Loc))); -- The call to the original entry becomes an indexed component to -- accommodate the entry index. Call_Nam := Make_Indexed_Component (Loc, Prefix => Call_Nam, Expressions => New_List (New_Occurrence_Of (Index_Id, Loc))); end if; -- Add formal parameters to match those of the entry and build actuals -- for the entry call. Add_Matching_Formals (Formals, Actuals); Call := Make_Procedure_Call_Statement (Loc, Name => Call_Nam, Parameter_Associations => Actuals); -- Add renaming declarations for the discriminants of the enclosing type -- as the various contract items may reference them. Add_Discriminant_Renamings (Obj_Id, Decls); Wrapper_Id := Make_Defining_Identifier (Loc, New_External_Name (Chars (E), 'E')); Set_Contract_Wrapper (E, Wrapper_Id); Set_Is_Entry_Wrapper (Wrapper_Id); -- The wrapper body is analyzed when the enclosing type is frozen Append_Freeze_Action (Defining_Entity (Decl), Make_Subprogram_Body (Loc, Specification => Make_Procedure_Specification (Loc, Defining_Unit_Name => Wrapper_Id, Parameter_Specifications => Formals), Declarations => Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List (Call)))); end Build_Contract_Wrapper; -------------------------------- -- Build_Corresponding_Record -- -------------------------------- function Build_Corresponding_Record (N : Node_Id; Ctyp : Entity_Id; Loc : Source_Ptr) return Node_Id is Rec_Ent : constant Entity_Id := Make_Defining_Identifier (Loc, New_External_Name (Chars (Ctyp), 'V')); Disc : Entity_Id; Dlist : List_Id; New_Disc : Entity_Id; Cdecls : List_Id; begin Set_Corresponding_Record_Type (Ctyp, Rec_Ent); Set_Ekind (Rec_Ent, E_Record_Type); Set_Has_Delayed_Freeze (Rec_Ent, Has_Delayed_Freeze (Ctyp)); Set_Is_Concurrent_Record_Type (Rec_Ent, True); Set_Corresponding_Concurrent_Type (Rec_Ent, Ctyp); Set_Stored_Constraint (Rec_Ent, No_Elist); Cdecls := New_List; -- Use discriminals to create list of discriminants for record, and -- create new discriminals for use in default expressions, etc. It is -- worth noting that a task discriminant gives rise to 5 entities; -- a) The original discriminant. -- b) The discriminal for use in the task. -- c) The discriminant of the corresponding record. -- d) The discriminal for the init proc of the corresponding record. -- e) The local variable that renames the discriminant in the procedure -- for the task body. -- In fact the discriminals b) are used in the renaming declarations -- for e). See details in einfo (Handling of Discriminants). if Present (Discriminant_Specifications (N)) then Dlist := New_List; Disc := First_Discriminant (Ctyp); while Present (Disc) loop New_Disc := CR_Discriminant (Disc); Append_To (Dlist, Make_Discriminant_Specification (Loc, Defining_Identifier => New_Disc, Discriminant_Type => New_Occurrence_Of (Etype (Disc), Loc), Expression => New_Copy (Discriminant_Default_Value (Disc)))); Next_Discriminant (Disc); end loop; else Dlist := No_List; end if; -- Now we can construct the record type declaration. Note that this -- record is "limited tagged". It is "limited" to reflect the underlying -- limitedness of the task or protected object that it represents, and -- ensuring for example that it is properly passed by reference. It is -- "tagged" to give support to dispatching calls through interfaces. We -- propagate here the list of interfaces covered by the concurrent type -- (Ada 2005: AI-345). return Make_Full_Type_Declaration (Loc, Defining_Identifier => Rec_Ent, Discriminant_Specifications => Dlist, Type_Definition => Make_Record_Definition (Loc, Component_List => Make_Component_List (Loc, Component_Items => Cdecls), Tagged_Present => Ada_Version >= Ada_2005 and then Is_Tagged_Type (Ctyp), Interface_List => Interface_List (N), Limited_Present => True)); end Build_Corresponding_Record; --------------------------------- -- Build_Dispatching_Tag_Check -- --------------------------------- function Build_Dispatching_Tag_Check (K : Entity_Id; N : Node_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (N); begin return Make_Op_Or (Loc, Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (K, Loc), Right_Opnd => New_Occurrence_Of (RTE (RE_TK_Limited_Tagged), Loc)), Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (K, Loc), Right_Opnd => New_Occurrence_Of (RTE (RE_TK_Tagged), Loc))); end Build_Dispatching_Tag_Check; ---------------------------------- -- Build_Entry_Count_Expression -- ---------------------------------- function Build_Entry_Count_Expression (Concurrent_Type : Node_Id; Component_List : List_Id; Loc : Source_Ptr) return Node_Id is Eindx : Nat; Ent : Entity_Id; Ecount : Node_Id; Comp : Node_Id; Lo : Node_Id; Hi : Node_Id; Typ : Entity_Id; Large : Boolean; begin -- Count number of non-family entries Eindx := 0; Ent := First_Entity (Concurrent_Type); while Present (Ent) loop if Ekind (Ent) = E_Entry then Eindx := Eindx + 1; end if; Next_Entity (Ent); end loop; Ecount := Make_Integer_Literal (Loc, Eindx); -- Loop through entry families building the addition nodes Ent := First_Entity (Concurrent_Type); Comp := First (Component_List); while Present (Ent) loop if Ekind (Ent) = E_Entry_Family then while Chars (Ent) /= Chars (Defining_Identifier (Comp)) loop Next (Comp); end loop; Typ := Entry_Index_Type (Ent); Hi := Type_High_Bound (Typ); Lo := Type_Low_Bound (Typ); Large := Is_Potentially_Large_Family (Base_Type (Typ), Concurrent_Type, Lo, Hi); Ecount := Make_Op_Add (Loc, Left_Opnd => Ecount, Right_Opnd => Family_Size (Loc, Hi, Lo, Concurrent_Type, Large)); end if; Next_Entity (Ent); end loop; return Ecount; end Build_Entry_Count_Expression; ------------------------------ -- Build_Master_Declaration -- ------------------------------ function Build_Master_Declaration (Loc : Source_Ptr) return Node_Id is Master_Decl : Node_Id; begin -- Generate a dummy master if tasks or tasking hierarchies are -- prohibited. -- _Master : constant Master_Id := 3; if not Tasking_Allowed or else Restrictions.Set (No_Task_Hierarchy) or else not RTE_Available (RE_Current_Master) then declare Expr : Node_Id; begin -- RE_Library_Task_Level is not always available in configurable -- RunTime if not RTE_Available (RE_Library_Task_Level) then Expr := Make_Integer_Literal (Loc, Uint_3); else Expr := New_Occurrence_Of (RTE (RE_Library_Task_Level), Loc); end if; Master_Decl := Make_Object_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uMaster), Constant_Present => True, Object_Definition => New_Occurrence_Of (Standard_Integer, Loc), Expression => Expr); end; -- Generate: -- _master : constant Integer := Current_Master.all; else Master_Decl := Make_Object_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uMaster), Constant_Present => True, Object_Definition => New_Occurrence_Of (Standard_Integer, Loc), Expression => Make_Explicit_Dereference (Loc, New_Occurrence_Of (RTE (RE_Current_Master), Loc))); end if; return Master_Decl; end Build_Master_Declaration; --------------------------- -- Build_Parameter_Block -- --------------------------- function Build_Parameter_Block (Loc : Source_Ptr; Actuals : List_Id; Formals : List_Id; Decls : List_Id) return Entity_Id is Actual : Entity_Id; Comp_Nam : Node_Id; Comps : List_Id; Formal : Entity_Id; Has_Comp : Boolean := False; Rec_Nam : Node_Id; begin Actual := First (Actuals); Comps := New_List; Formal := Defining_Identifier (First (Formals)); while Present (Actual) loop if not Is_Controlling_Actual (Actual) then -- Generate: -- type Ann is access all <actual-type> Comp_Nam := Make_Temporary (Loc, 'A'); Set_Is_Param_Block_Component_Type (Comp_Nam); Append_To (Decls, Make_Full_Type_Declaration (Loc, Defining_Identifier => Comp_Nam, Type_Definition => Make_Access_To_Object_Definition (Loc, All_Present => True, Constant_Present => Ekind (Formal) = E_In_Parameter, Subtype_Indication => New_Occurrence_Of (Etype (Actual), Loc)))); -- Generate: -- Param : Ann; Append_To (Comps, Make_Component_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Chars (Formal)), Component_Definition => Make_Component_Definition (Loc, Aliased_Present => False, Subtype_Indication => New_Occurrence_Of (Comp_Nam, Loc)))); Has_Comp := True; end if; Next_Actual (Actual); Next_Formal_With_Extras (Formal); end loop; Rec_Nam := Make_Temporary (Loc, 'P'); if Has_Comp then -- Generate: -- type Pnn is record -- Param1 : Ann1; -- ... -- ParamN : AnnN; -- where Pnn is a parameter wrapping record, Param1 .. ParamN are -- the original parameter names and Ann1 .. AnnN are the access to -- actual types. Append_To (Decls, Make_Full_Type_Declaration (Loc, Defining_Identifier => Rec_Nam, Type_Definition => Make_Record_Definition (Loc, Component_List => Make_Component_List (Loc, Comps)))); else -- Generate: -- type Pnn is null record; Append_To (Decls, Make_Full_Type_Declaration (Loc, Defining_Identifier => Rec_Nam, Type_Definition => Make_Record_Definition (Loc, Null_Present => True, Component_List => Empty))); end if; return Rec_Nam; end Build_Parameter_Block; -------------------------------------- -- Build_Renamed_Formal_Declaration -- -------------------------------------- function Build_Renamed_Formal_Declaration (New_F : Entity_Id; Formal : Entity_Id; Comp : Entity_Id; Renamed_Formal : Node_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (New_F); Decl : Node_Id; begin -- If the formal is a tagged incomplete type, it is already passed -- by reference, so it is sufficient to rename the pointer component -- that corresponds to the actual. Otherwise we need to dereference -- the pointer component to obtain the actual. if Is_Incomplete_Type (Etype (Formal)) and then Is_Tagged_Type (Etype (Formal)) then Decl := Make_Object_Renaming_Declaration (Loc, Defining_Identifier => New_F, Subtype_Mark => New_Occurrence_Of (Etype (Comp), Loc), Name => Renamed_Formal); else Decl := Make_Object_Renaming_Declaration (Loc, Defining_Identifier => New_F, Subtype_Mark => New_Occurrence_Of (Etype (Formal), Loc), Name => Make_Explicit_Dereference (Loc, Renamed_Formal)); end if; return Decl; end Build_Renamed_Formal_Declaration; -------------------------- -- Build_Wrapper_Bodies -- -------------------------- procedure Build_Wrapper_Bodies (Loc : Source_Ptr; Typ : Entity_Id; N : Node_Id) is Rec_Typ : Entity_Id; function Build_Wrapper_Body (Loc : Source_Ptr; Subp_Id : Entity_Id; Obj_Typ : Entity_Id; Formals : List_Id) return Node_Id; -- Ada 2005 (AI-345): Build the body that wraps a primitive operation -- associated with a protected or task type. Subp_Id is the subprogram -- name which will be wrapped. Obj_Typ is the type of the new formal -- parameter which handles dispatching and object notation. Formals are -- the original formals of Subp_Id which will be explicitly replicated. ------------------------ -- Build_Wrapper_Body -- ------------------------ function Build_Wrapper_Body (Loc : Source_Ptr; Subp_Id : Entity_Id; Obj_Typ : Entity_Id; Formals : List_Id) return Node_Id is Body_Spec : Node_Id; begin Body_Spec := Build_Wrapper_Spec (Subp_Id, Obj_Typ, Formals); -- The subprogram is not overriding or is not a primitive declared -- between two views. if No (Body_Spec) then return Empty; end if; declare Actuals : List_Id := No_List; Conv_Id : Node_Id; First_Form : Node_Id; Formal : Node_Id; Nam : Node_Id; begin -- Map formals to actuals. Use the list built for the wrapper -- spec, skipping the object notation parameter. First_Form := First (Parameter_Specifications (Body_Spec)); Formal := First_Form; Next (Formal); if Present (Formal) then Actuals := New_List; while Present (Formal) loop Append_To (Actuals, Make_Identifier (Loc, Chars => Chars (Defining_Identifier (Formal)))); Next (Formal); end loop; end if; -- Special processing for primitives declared between a private -- type and its completion: the wrapper needs a properly typed -- parameter if the wrapped operation has a controlling first -- parameter. Note that this might not be the case for a function -- with a controlling result. if Is_Private_Primitive_Subprogram (Subp_Id) then if No (Actuals) then Actuals := New_List; end if; if Is_Controlling_Formal (First_Formal (Subp_Id)) then Prepend_To (Actuals, Unchecked_Convert_To (Corresponding_Concurrent_Type (Obj_Typ), Make_Identifier (Loc, Name_uO))); else Prepend_To (Actuals, Make_Identifier (Loc, Chars => Chars (Defining_Identifier (First_Form)))); end if; Nam := New_Occurrence_Of (Subp_Id, Loc); else -- An access-to-variable object parameter requires an explicit -- dereference in the unchecked conversion. This case occurs -- when a protected entry wrapper must override an interface -- level procedure with interface access as first parameter. -- O.all.Subp_Id (Formal_1, ..., Formal_N) if Nkind (Parameter_Type (First_Form)) = N_Access_Definition then Conv_Id := Make_Explicit_Dereference (Loc, Prefix => Make_Identifier (Loc, Name_uO)); else Conv_Id := Make_Identifier (Loc, Name_uO); end if; Nam := Make_Selected_Component (Loc, Prefix => Unchecked_Convert_To (Corresponding_Concurrent_Type (Obj_Typ), Conv_Id), Selector_Name => New_Occurrence_Of (Subp_Id, Loc)); end if; -- Create the subprogram body. For a function, the call to the -- actual subprogram has to be converted to the corresponding -- record if it is a controlling result. if Ekind (Subp_Id) = E_Function then declare Res : Node_Id; begin Res := Make_Function_Call (Loc, Name => Nam, Parameter_Associations => Actuals); if Has_Controlling_Result (Subp_Id) then Res := Unchecked_Convert_To (Corresponding_Record_Type (Etype (Subp_Id)), Res); end if; return Make_Subprogram_Body (Loc, Specification => Body_Spec, Declarations => Empty_List, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List ( Make_Simple_Return_Statement (Loc, Res)))); end; else return Make_Subprogram_Body (Loc, Specification => Body_Spec, Declarations => Empty_List, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List ( Make_Procedure_Call_Statement (Loc, Name => Nam, Parameter_Associations => Actuals)))); end if; end; end Build_Wrapper_Body; -- Start of processing for Build_Wrapper_Bodies begin if Is_Concurrent_Type (Typ) then Rec_Typ := Corresponding_Record_Type (Typ); else Rec_Typ := Typ; end if; -- Generate wrapper bodies for a concurrent type which implements an -- interface. if Present (Interfaces (Rec_Typ)) then declare Insert_Nod : Node_Id; Prim : Entity_Id; Prim_Elmt : Elmt_Id; Prim_Decl : Node_Id; Subp : Entity_Id; Wrap_Body : Node_Id; Wrap_Id : Entity_Id; begin Insert_Nod := N; -- Examine all primitive operations of the corresponding record -- type, looking for wrapper specs. Generate bodies in order to -- complete them. Prim_Elmt := First_Elmt (Primitive_Operations (Rec_Typ)); while Present (Prim_Elmt) loop Prim := Node (Prim_Elmt); if (Ekind (Prim) = E_Function or else Ekind (Prim) = E_Procedure) and then Is_Primitive_Wrapper (Prim) then Subp := Wrapped_Entity (Prim); Prim_Decl := Parent (Parent (Prim)); Wrap_Body := Build_Wrapper_Body (Loc, Subp_Id => Subp, Obj_Typ => Rec_Typ, Formals => Parameter_Specifications (Parent (Subp))); Wrap_Id := Defining_Unit_Name (Specification (Wrap_Body)); Set_Corresponding_Spec (Wrap_Body, Prim); Set_Corresponding_Body (Prim_Decl, Wrap_Id); Insert_After (Insert_Nod, Wrap_Body); Insert_Nod := Wrap_Body; Analyze (Wrap_Body); end if; Next_Elmt (Prim_Elmt); end loop; end; end if; end Build_Wrapper_Bodies; ------------------------ -- Build_Wrapper_Spec -- ------------------------ function Build_Wrapper_Spec (Subp_Id : Entity_Id; Obj_Typ : Entity_Id; Formals : List_Id) return Node_Id is function Overriding_Possible (Iface_Op : Entity_Id; Wrapper : Entity_Id) return Boolean; -- Determine whether a primitive operation can be overridden by Wrapper. -- Iface_Op is the candidate primitive operation of an interface type, -- Wrapper is the generated entry wrapper. function Replicate_Formals (Loc : Source_Ptr; Formals : List_Id) return List_Id; -- An explicit parameter replication is required due to the Is_Entry_ -- Formal flag being set for all the formals of an entry. The explicit -- replication removes the flag that would otherwise cause a different -- path of analysis. ------------------------- -- Overriding_Possible -- ------------------------- function Overriding_Possible (Iface_Op : Entity_Id; Wrapper : Entity_Id) return Boolean is Iface_Op_Spec : constant Node_Id := Parent (Iface_Op); Wrapper_Spec : constant Node_Id := Parent (Wrapper); function Type_Conformant_Parameters (Iface_Op_Params : List_Id; Wrapper_Params : List_Id) return Boolean; -- Determine whether the parameters of the generated entry wrapper -- and those of a primitive operation are type conformant. During -- this check, the first parameter of the primitive operation is -- skipped if it is a controlling argument: protected functions -- may have a controlling result. -------------------------------- -- Type_Conformant_Parameters -- -------------------------------- function Type_Conformant_Parameters (Iface_Op_Params : List_Id; Wrapper_Params : List_Id) return Boolean is Iface_Op_Param : Node_Id; Iface_Op_Typ : Entity_Id; Wrapper_Param : Node_Id; Wrapper_Typ : Entity_Id; begin -- Skip the first (controlling) parameter of primitive operation Iface_Op_Param := First (Iface_Op_Params); if Present (First_Formal (Iface_Op)) and then Is_Controlling_Formal (First_Formal (Iface_Op)) then Next (Iface_Op_Param); end if; Wrapper_Param := First (Wrapper_Params); while Present (Iface_Op_Param) and then Present (Wrapper_Param) loop Iface_Op_Typ := Find_Parameter_Type (Iface_Op_Param); Wrapper_Typ := Find_Parameter_Type (Wrapper_Param); -- The two parameters must be mode conformant if not Conforming_Types (Iface_Op_Typ, Wrapper_Typ, Mode_Conformant) then return False; end if; Next (Iface_Op_Param); Next (Wrapper_Param); end loop; -- One of the lists is longer than the other if Present (Iface_Op_Param) or else Present (Wrapper_Param) then return False; end if; return True; end Type_Conformant_Parameters; -- Start of processing for Overriding_Possible begin if Chars (Iface_Op) /= Chars (Wrapper) then return False; end if; -- If an inherited subprogram is implemented by a protected procedure -- or an entry, then the first parameter of the inherited subprogram -- must be of mode OUT or IN OUT, or access-to-variable parameter. if Ekind (Iface_Op) = E_Procedure and then Present (Parameter_Specifications (Iface_Op_Spec)) then declare Obj_Param : constant Node_Id := First (Parameter_Specifications (Iface_Op_Spec)); begin if not Out_Present (Obj_Param) and then Nkind (Parameter_Type (Obj_Param)) /= N_Access_Definition then return False; end if; end; end if; return Type_Conformant_Parameters (Parameter_Specifications (Iface_Op_Spec), Parameter_Specifications (Wrapper_Spec)); end Overriding_Possible; ----------------------- -- Replicate_Formals -- ----------------------- function Replicate_Formals (Loc : Source_Ptr; Formals : List_Id) return List_Id is New_Formals : constant List_Id := New_List; Formal : Node_Id; Param_Type : Node_Id; begin Formal := First (Formals); -- Skip the object parameter when dealing with primitives declared -- between two views. if Is_Private_Primitive_Subprogram (Subp_Id) and then not Has_Controlling_Result (Subp_Id) then Next (Formal); end if; while Present (Formal) loop -- Create an explicit copy of the entry parameter -- When creating the wrapper subprogram for a primitive operation -- of a protected interface we must construct an equivalent -- signature to that of the overriding operation. For regular -- parameters we can just use the type of the formal, but for -- access to subprogram parameters we need to reanalyze the -- parameter type to create local entities for the signature of -- the subprogram type. Using the entities of the overriding -- subprogram will result in out-of-scope errors in the back-end. if Nkind (Parameter_Type (Formal)) = N_Access_Definition then Param_Type := Copy_Separate_Tree (Parameter_Type (Formal)); else Param_Type := New_Occurrence_Of (Etype (Parameter_Type (Formal)), Loc); end if; Append_To (New_Formals, Make_Parameter_Specification (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Chars => Chars (Defining_Identifier (Formal))), In_Present => In_Present (Formal), Out_Present => Out_Present (Formal), Null_Exclusion_Present => Null_Exclusion_Present (Formal), Parameter_Type => Param_Type)); Next (Formal); end loop; return New_Formals; end Replicate_Formals; -- Local variables Loc : constant Source_Ptr := Sloc (Subp_Id); First_Param : Node_Id := Empty; Iface : Entity_Id; Iface_Elmt : Elmt_Id; Iface_Op : Entity_Id; Iface_Op_Elmt : Elmt_Id; Overridden_Subp : Entity_Id; -- Start of processing for Build_Wrapper_Spec begin -- No point in building wrappers for untagged concurrent types pragma Assert (Is_Tagged_Type (Obj_Typ)); -- Check if this subprogram has a profile that matches some interface -- primitive. Check_Synchronized_Overriding (Subp_Id, Overridden_Subp); if Present (Overridden_Subp) then First_Param := First (Parameter_Specifications (Parent (Overridden_Subp))); -- An entry or a protected procedure can override a routine where the -- controlling formal is either IN OUT, OUT or is of access-to-variable -- type. Since the wrapper must have the exact same signature as that of -- the overridden subprogram, we try to find the overriding candidate -- and use its controlling formal. -- Check every implemented interface elsif Present (Interfaces (Obj_Typ)) then Iface_Elmt := First_Elmt (Interfaces (Obj_Typ)); Search : while Present (Iface_Elmt) loop Iface := Node (Iface_Elmt); -- Check every interface primitive if Present (Primitive_Operations (Iface)) then Iface_Op_Elmt := First_Elmt (Primitive_Operations (Iface)); while Present (Iface_Op_Elmt) loop Iface_Op := Node (Iface_Op_Elmt); -- Ignore predefined primitives if not Is_Predefined_Dispatching_Operation (Iface_Op) then Iface_Op := Ultimate_Alias (Iface_Op); -- The current primitive operation can be overridden by -- the generated entry wrapper. if Overriding_Possible (Iface_Op, Subp_Id) then First_Param := First (Parameter_Specifications (Parent (Iface_Op))); exit Search; end if; end if; Next_Elmt (Iface_Op_Elmt); end loop; end if; Next_Elmt (Iface_Elmt); end loop Search; end if; -- Do not generate the wrapper if no interface primitive is covered by -- the subprogram and it is not a primitive declared between two views -- (see Process_Full_View). if No (First_Param) and then not Is_Private_Primitive_Subprogram (Subp_Id) then return Empty; end if; declare Wrapper_Id : constant Entity_Id := Make_Defining_Identifier (Loc, Chars (Subp_Id)); New_Formals : List_Id; Obj_Param : Node_Id; Obj_Param_Typ : Entity_Id; begin -- Minimum decoration is needed to catch the entity in -- Sem_Ch6.Override_Dispatching_Operation. if Ekind (Subp_Id) = E_Function then Set_Ekind (Wrapper_Id, E_Function); else Set_Ekind (Wrapper_Id, E_Procedure); end if; Set_Is_Primitive_Wrapper (Wrapper_Id); Set_Wrapped_Entity (Wrapper_Id, Subp_Id); Set_Is_Private_Primitive (Wrapper_Id, Is_Private_Primitive_Subprogram (Subp_Id)); -- Process the formals New_Formals := Replicate_Formals (Loc, Formals); -- A function with a controlling result and no first controlling -- formal needs no additional parameter. if Has_Controlling_Result (Subp_Id) and then (No (First_Formal (Subp_Id)) or else not Is_Controlling_Formal (First_Formal (Subp_Id))) then null; -- Routine Subp_Id has been found to override an interface primitive. -- If the interface operation has an access parameter, create a copy -- of it, with the same null exclusion indicator if present. elsif Present (First_Param) then if Nkind (Parameter_Type (First_Param)) = N_Access_Definition then Obj_Param_Typ := Make_Access_Definition (Loc, Subtype_Mark => New_Occurrence_Of (Obj_Typ, Loc), Null_Exclusion_Present => Null_Exclusion_Present (Parameter_Type (First_Param)), Constant_Present => Constant_Present (Parameter_Type (First_Param))); else Obj_Param_Typ := New_Occurrence_Of (Obj_Typ, Loc); end if; Obj_Param := Make_Parameter_Specification (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Chars => Name_uO), In_Present => In_Present (First_Param), Out_Present => Out_Present (First_Param), Parameter_Type => Obj_Param_Typ); Prepend_To (New_Formals, Obj_Param); -- If we are dealing with a primitive declared between two views, -- implemented by a synchronized operation, we need to create -- a default parameter. The mode of the parameter must match that -- of the primitive operation. else pragma Assert (Is_Private_Primitive_Subprogram (Subp_Id)); Obj_Param := Make_Parameter_Specification (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uO), In_Present => In_Present (Parent (First_Entity (Subp_Id))), Out_Present => Ekind (Subp_Id) /= E_Function, Parameter_Type => New_Occurrence_Of (Obj_Typ, Loc)); Prepend_To (New_Formals, Obj_Param); end if; -- Build the final spec. If it is a function with a controlling -- result, it is a primitive operation of the corresponding -- record type, so mark the spec accordingly. if Ekind (Subp_Id) = E_Function then declare Res_Def : Node_Id; begin if Has_Controlling_Result (Subp_Id) then Res_Def := New_Occurrence_Of (Corresponding_Record_Type (Etype (Subp_Id)), Loc); else Res_Def := New_Copy (Result_Definition (Parent (Subp_Id))); end if; return Make_Function_Specification (Loc, Defining_Unit_Name => Wrapper_Id, Parameter_Specifications => New_Formals, Result_Definition => Res_Def); end; else return Make_Procedure_Specification (Loc, Defining_Unit_Name => Wrapper_Id, Parameter_Specifications => New_Formals); end if; end; end Build_Wrapper_Spec; ------------------------- -- Build_Wrapper_Specs -- ------------------------- procedure Build_Wrapper_Specs (Loc : Source_Ptr; Typ : Entity_Id; N : in out Node_Id) is Def : Node_Id; Rec_Typ : Entity_Id; procedure Scan_Declarations (L : List_Id); -- Common processing for visible and private declarations -- of a protected type. procedure Scan_Declarations (L : List_Id) is Decl : Node_Id; Wrap_Decl : Node_Id; Wrap_Spec : Node_Id; begin if No (L) then return; end if; Decl := First (L); while Present (Decl) loop Wrap_Spec := Empty; if Nkind (Decl) = N_Entry_Declaration and then Ekind (Defining_Identifier (Decl)) = E_Entry then Wrap_Spec := Build_Wrapper_Spec (Subp_Id => Defining_Identifier (Decl), Obj_Typ => Rec_Typ, Formals => Parameter_Specifications (Decl)); elsif Nkind (Decl) = N_Subprogram_Declaration then Wrap_Spec := Build_Wrapper_Spec (Subp_Id => Defining_Unit_Name (Specification (Decl)), Obj_Typ => Rec_Typ, Formals => Parameter_Specifications (Specification (Decl))); end if; if Present (Wrap_Spec) then Wrap_Decl := Make_Subprogram_Declaration (Loc, Specification => Wrap_Spec); Insert_After (N, Wrap_Decl); N := Wrap_Decl; Analyze (Wrap_Decl); end if; Next (Decl); end loop; end Scan_Declarations; -- start of processing for Build_Wrapper_Specs begin if Is_Protected_Type (Typ) then Def := Protected_Definition (Parent (Typ)); else pragma Assert (Is_Task_Type (Typ)); Def := Task_Definition (Parent (Typ)); end if; Rec_Typ := Corresponding_Record_Type (Typ); -- Generate wrapper specs for a concurrent type which implements an -- interface. Operations in both the visible and private parts may -- implement progenitor operations. if Present (Interfaces (Rec_Typ)) and then Present (Def) then Scan_Declarations (Visible_Declarations (Def)); Scan_Declarations (Private_Declarations (Def)); end if; end Build_Wrapper_Specs; --------------------------- -- Build_Find_Body_Index -- --------------------------- function Build_Find_Body_Index (Typ : Entity_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (Typ); Ent : Entity_Id; E_Typ : Entity_Id; Has_F : Boolean := False; Index : Nat; If_St : Node_Id := Empty; Lo : Node_Id; Hi : Node_Id; Decls : List_Id := New_List; Ret : Node_Id := Empty; Spec : Node_Id; Siz : Node_Id := Empty; procedure Add_If_Clause (Expr : Node_Id); -- Add test for range of current entry function Convert_Discriminant_Ref (Bound : Node_Id) return Node_Id; -- If a bound of an entry is given by a discriminant, retrieve the -- actual value of the discriminant from the enclosing object. ------------------- -- Add_If_Clause -- ------------------- procedure Add_If_Clause (Expr : Node_Id) is Cond : Node_Id; Stats : constant List_Id := New_List ( Make_Simple_Return_Statement (Loc, Expression => Make_Integer_Literal (Loc, Index + 1))); begin -- Index for current entry body Index := Index + 1; -- Compute total length of entry queues so far if No (Siz) then Siz := Expr; else Siz := Make_Op_Add (Loc, Left_Opnd => Siz, Right_Opnd => Expr); end if; Cond := Make_Op_Le (Loc, Left_Opnd => Make_Identifier (Loc, Name_uE), Right_Opnd => Siz); -- Map entry queue indexes in the range of the current family -- into the current index, that designates the entry body. if No (If_St) then If_St := Make_Implicit_If_Statement (Typ, Condition => Cond, Then_Statements => Stats, Elsif_Parts => New_List); Ret := If_St; else Append_To (Elsif_Parts (If_St), Make_Elsif_Part (Loc, Condition => Cond, Then_Statements => Stats)); end if; end Add_If_Clause; ------------------------------ -- Convert_Discriminant_Ref -- ------------------------------ function Convert_Discriminant_Ref (Bound : Node_Id) return Node_Id is B : Node_Id; begin if Is_Entity_Name (Bound) and then Ekind (Entity (Bound)) = E_Discriminant then B := Make_Selected_Component (Loc, Prefix => Unchecked_Convert_To (Corresponding_Record_Type (Typ), Make_Explicit_Dereference (Loc, Make_Identifier (Loc, Name_uObject))), Selector_Name => Make_Identifier (Loc, Chars (Bound))); Set_Etype (B, Etype (Entity (Bound))); else B := New_Copy_Tree (Bound); end if; return B; end Convert_Discriminant_Ref; -- Start of processing for Build_Find_Body_Index begin Spec := Build_Find_Body_Index_Spec (Typ); Ent := First_Entity (Typ); while Present (Ent) loop if Ekind (Ent) = E_Entry_Family then Has_F := True; exit; end if; Next_Entity (Ent); end loop; if not Has_F then -- If the protected type has no entry families, there is a one-one -- correspondence between entry queue and entry body. Ret := Make_Simple_Return_Statement (Loc, Expression => Make_Identifier (Loc, Name_uE)); else -- Suppose entries e1, e2, ... have size l1, l2, ... we generate -- the following: -- if E <= l1 then return 1; -- elsif E <= l1 + l2 then return 2; -- ... Index := 0; Siz := Empty; Ent := First_Entity (Typ); Add_Object_Pointer (Loc, Typ, Decls); while Present (Ent) loop if Ekind (Ent) = E_Entry then Add_If_Clause (Make_Integer_Literal (Loc, 1)); elsif Ekind (Ent) = E_Entry_Family then E_Typ := Entry_Index_Type (Ent); Hi := Convert_Discriminant_Ref (Type_High_Bound (E_Typ)); Lo := Convert_Discriminant_Ref (Type_Low_Bound (E_Typ)); Add_If_Clause (Family_Size (Loc, Hi, Lo, Typ, False)); end if; Next_Entity (Ent); end loop; if Index = 1 then Decls := New_List; Ret := Make_Simple_Return_Statement (Loc, Expression => Make_Integer_Literal (Loc, 1)); else pragma Assert (Present (Ret)); if Nkind (Ret) = N_If_Statement then -- Ranges are in increasing order, so last one doesn't need -- guard. declare Nod : constant Node_Id := Last (Elsif_Parts (Ret)); begin Remove (Nod); Set_Else_Statements (Ret, Then_Statements (Nod)); end; end if; end if; end if; return Make_Subprogram_Body (Loc, Specification => Spec, Declarations => Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List (Ret))); end Build_Find_Body_Index; -------------------------------- -- Build_Find_Body_Index_Spec -- -------------------------------- function Build_Find_Body_Index_Spec (Typ : Entity_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (Typ); Id : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => New_External_Name (Chars (Typ), 'F')); Parm1 : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uO); Parm2 : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uE); begin return Make_Function_Specification (Loc, Defining_Unit_Name => Id, Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => Parm1, Parameter_Type => New_Occurrence_Of (RTE (RE_Address), Loc)), Make_Parameter_Specification (Loc, Defining_Identifier => Parm2, Parameter_Type => New_Occurrence_Of (RTE (RE_Protected_Entry_Index), Loc))), Result_Definition => New_Occurrence_Of ( RTE (RE_Protected_Entry_Index), Loc)); end Build_Find_Body_Index_Spec; ----------------------------------------------- -- Build_Lock_Free_Protected_Subprogram_Body -- ----------------------------------------------- function Build_Lock_Free_Protected_Subprogram_Body (N : Node_Id; Prot_Typ : Node_Id; Unprot_Spec : Node_Id) return Node_Id is Actuals : constant List_Id := New_List; Loc : constant Source_Ptr := Sloc (N); Spec : constant Node_Id := Specification (N); Unprot_Id : constant Entity_Id := Defining_Unit_Name (Unprot_Spec); Formal : Node_Id; Prot_Spec : Node_Id; Stmt : Node_Id; begin -- Create the protected version of the body Prot_Spec := Build_Protected_Sub_Specification (N, Prot_Typ, Protected_Mode); -- Build the actual parameters which appear in the call to the -- unprotected version of the body. Formal := First (Parameter_Specifications (Prot_Spec)); while Present (Formal) loop Append_To (Actuals, Make_Identifier (Loc, Chars (Defining_Identifier (Formal)))); Next (Formal); end loop; -- Function case, generate: -- return <Unprot_Func_Call>; if Nkind (Spec) = N_Function_Specification then Stmt := Make_Simple_Return_Statement (Loc, Expression => Make_Function_Call (Loc, Name => Make_Identifier (Loc, Chars (Unprot_Id)), Parameter_Associations => Actuals)); -- Procedure case, call the unprotected version else Stmt := Make_Procedure_Call_Statement (Loc, Name => Make_Identifier (Loc, Chars (Unprot_Id)), Parameter_Associations => Actuals); end if; return Make_Subprogram_Body (Loc, Declarations => Empty_List, Specification => Prot_Spec, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List (Stmt))); end Build_Lock_Free_Protected_Subprogram_Body; ------------------------------------------------- -- Build_Lock_Free_Unprotected_Subprogram_Body -- ------------------------------------------------- -- Procedures which meet the lock-free implementation requirements and -- reference a unique scalar component Comp are expanded in the following -- manner: -- procedure P (...) is -- Expected_Comp : constant Comp_Type := -- Comp_Type -- (System.Atomic_Primitives.Lock_Free_Read_N -- (_Object.Comp'Address)); -- begin -- loop -- declare -- <original declarations before the object renaming declaration -- of Comp> -- -- Desired_Comp : Comp_Type := Expected_Comp; -- Comp : Comp_Type renames Desired_Comp; -- -- <original delarations after the object renaming declaration -- of Comp> -- -- begin -- <original statements> -- exit when System.Atomic_Primitives.Lock_Free_Try_Write_N -- (_Object.Comp'Address, -- Interfaces.Unsigned_N (Expected_Comp), -- Interfaces.Unsigned_N (Desired_Comp)); -- end; -- end loop; -- end P; -- Each return and raise statement of P is transformed into an atomic -- status check: -- if System.Atomic_Primitives.Lock_Free_Try_Write_N -- (_Object.Comp'Address, -- Interfaces.Unsigned_N (Expected_Comp), -- Interfaces.Unsigned_N (Desired_Comp)); -- then -- <original statement> -- else -- goto L0; -- end if; -- Functions which meet the lock-free implementation requirements and -- reference a unique scalar component Comp are expanded in the following -- manner: -- function F (...) return ... is -- <original declarations before the object renaming declaration -- of Comp> -- -- Expected_Comp : constant Comp_Type := -- Comp_Type -- (System.Atomic_Primitives.Lock_Free_Read_N -- (_Object.Comp'Address)); -- Comp : Comp_Type renames Expected_Comp; -- -- <original delarations after the object renaming declaration of -- Comp> -- -- begin -- <original statements> -- end F; function Build_Lock_Free_Unprotected_Subprogram_Body (N : Node_Id; Prot_Typ : Node_Id) return Node_Id is function Referenced_Component (N : Node_Id) return Entity_Id; -- Subprograms which meet the lock-free implementation criteria are -- allowed to reference only one unique component. Return the prival -- of the said component. -------------------------- -- Referenced_Component -- -------------------------- function Referenced_Component (N : Node_Id) return Entity_Id is Comp : Entity_Id; Decl : Node_Id; Source_Comp : Entity_Id := Empty; begin -- Find the unique source component which N references in its -- statements. for Index in 1 .. Lock_Free_Subprogram_Table.Last loop declare Element : Lock_Free_Subprogram renames Lock_Free_Subprogram_Table.Table (Index); begin if Element.Sub_Body = N then Source_Comp := Element.Comp_Id; exit; end if; end; end loop; if No (Source_Comp) then return Empty; end if; -- Find the prival which corresponds to the source component within -- the declarations of N. Decl := First (Declarations (N)); while Present (Decl) loop -- Privals appear as object renamings if Nkind (Decl) = N_Object_Renaming_Declaration then Comp := Defining_Identifier (Decl); if Present (Prival_Link (Comp)) and then Prival_Link (Comp) = Source_Comp then return Comp; end if; end if; Next (Decl); end loop; return Empty; end Referenced_Component; -- Local variables Comp : constant Entity_Id := Referenced_Component (N); Loc : constant Source_Ptr := Sloc (N); Hand_Stmt_Seq : Node_Id := Handled_Statement_Sequence (N); Decls : List_Id := Declarations (N); -- Start of processing for Build_Lock_Free_Unprotected_Subprogram_Body begin -- Add renamings for the protection object, discriminals, privals, and -- the entry index constant for use by debugger. Debug_Private_Data_Declarations (Decls); -- Perform the lock-free expansion when the subprogram references a -- protected component. if Present (Comp) then Protected_Component_Ref : declare Comp_Decl : constant Node_Id := Parent (Comp); Comp_Sel_Nam : constant Node_Id := Name (Comp_Decl); Comp_Type : constant Entity_Id := Etype (Comp); Is_Procedure : constant Boolean := Ekind (Corresponding_Spec (N)) = E_Procedure; -- Indicates if N is a protected procedure body Block_Decls : List_Id := No_List; Try_Write : Entity_Id; Desired_Comp : Entity_Id; Decl : Node_Id; Label : Node_Id; Label_Id : Entity_Id := Empty; Read : Entity_Id; Expected_Comp : Entity_Id; Stmt : Node_Id; Stmts : List_Id := New_Copy_List (Statements (Hand_Stmt_Seq)); Typ_Size : Int; Unsigned : Entity_Id; function Process_Node (N : Node_Id) return Traverse_Result; -- Transform a single node if it is a return statement, a raise -- statement or a reference to Comp. procedure Process_Stmts (Stmts : List_Id); -- Given a statement sequence Stmts, wrap any return or raise -- statements in the following manner: -- -- if System.Atomic_Primitives.Lock_Free_Try_Write_N -- (_Object.Comp'Address, -- Interfaces.Unsigned_N (Expected_Comp), -- Interfaces.Unsigned_N (Desired_Comp)) -- then -- <Stmt>; -- else -- goto L0; -- end if; ------------------ -- Process_Node -- ------------------ function Process_Node (N : Node_Id) return Traverse_Result is procedure Wrap_Statement (Stmt : Node_Id); -- Wrap an arbitrary statement inside an if statement where the -- condition does an atomic check on the state of the object. -------------------- -- Wrap_Statement -- -------------------- procedure Wrap_Statement (Stmt : Node_Id) is begin -- The first time through, create the declaration of a label -- which is used to skip the remainder of source statements -- if the state of the object has changed. if No (Label_Id) then Label_Id := Make_Identifier (Loc, New_External_Name ('L', 0)); Set_Entity (Label_Id, Make_Defining_Identifier (Loc, Chars (Label_Id))); end if; -- Generate: -- if System.Atomic_Primitives.Lock_Free_Try_Write_N -- (_Object.Comp'Address, -- Interfaces.Unsigned_N (Expected_Comp), -- Interfaces.Unsigned_N (Desired_Comp)) -- then -- <Stmt>; -- else -- goto L0; -- end if; Rewrite (Stmt, Make_Implicit_If_Statement (N, Condition => Make_Function_Call (Loc, Name => New_Occurrence_Of (Try_Write, Loc), Parameter_Associations => New_List ( Make_Attribute_Reference (Loc, Prefix => Relocate_Node (Comp_Sel_Nam), Attribute_Name => Name_Address), Unchecked_Convert_To (Unsigned, New_Occurrence_Of (Expected_Comp, Loc)), Unchecked_Convert_To (Unsigned, New_Occurrence_Of (Desired_Comp, Loc)))), Then_Statements => New_List (Relocate_Node (Stmt)), Else_Statements => New_List ( Make_Goto_Statement (Loc, Name => New_Occurrence_Of (Entity (Label_Id), Loc))))); end Wrap_Statement; -- Start of processing for Process_Node begin -- Wrap each return and raise statement that appear inside a -- procedure. Skip the last return statement which is added by -- default since it is transformed into an exit statement. if Is_Procedure and then ((Nkind (N) = N_Simple_Return_Statement and then N /= Last (Stmts)) or else Nkind (N) = N_Extended_Return_Statement or else (Nkind (N) in N_Raise_xxx_Error | N_Raise_Statement and then Comes_From_Source (N))) then Wrap_Statement (N); return Skip; end if; -- Force reanalysis Set_Analyzed (N, False); return OK; end Process_Node; procedure Process_Nodes is new Traverse_Proc (Process_Node); ------------------- -- Process_Stmts -- ------------------- procedure Process_Stmts (Stmts : List_Id) is Stmt : Node_Id; begin Stmt := First (Stmts); while Present (Stmt) loop Process_Nodes (Stmt); Next (Stmt); end loop; end Process_Stmts; -- Start of processing for Protected_Component_Ref begin -- Get the type size if Known_Static_Esize (Comp_Type) then Typ_Size := UI_To_Int (Esize (Comp_Type)); -- If the Esize (Object_Size) is unknown at compile time, look at -- the RM_Size (Value_Size) since it may have been set by an -- explicit representation clause. elsif Known_Static_RM_Size (Comp_Type) then Typ_Size := UI_To_Int (RM_Size (Comp_Type)); -- Should not happen since this has already been checked in -- Allows_Lock_Free_Implementation (see Sem_Ch9). else raise Program_Error; end if; -- Retrieve all relevant atomic routines and types case Typ_Size is when 8 => Try_Write := RTE (RE_Lock_Free_Try_Write_8); Read := RTE (RE_Lock_Free_Read_8); Unsigned := RTE (RE_Uint8); when 16 => Try_Write := RTE (RE_Lock_Free_Try_Write_16); Read := RTE (RE_Lock_Free_Read_16); Unsigned := RTE (RE_Uint16); when 32 => Try_Write := RTE (RE_Lock_Free_Try_Write_32); Read := RTE (RE_Lock_Free_Read_32); Unsigned := RTE (RE_Uint32); when 64 => Try_Write := RTE (RE_Lock_Free_Try_Write_64); Read := RTE (RE_Lock_Free_Read_64); Unsigned := RTE (RE_Uint64); when others => raise Program_Error; end case; -- Generate: -- Expected_Comp : constant Comp_Type := -- Comp_Type -- (System.Atomic_Primitives.Lock_Free_Read_N -- (_Object.Comp'Address)); Expected_Comp := Make_Defining_Identifier (Loc, New_External_Name (Chars (Comp), Suffix => "_saved")); Decl := Make_Object_Declaration (Loc, Defining_Identifier => Expected_Comp, Object_Definition => New_Occurrence_Of (Comp_Type, Loc), Constant_Present => True, Expression => Unchecked_Convert_To (Comp_Type, Make_Function_Call (Loc, Name => New_Occurrence_Of (Read, Loc), Parameter_Associations => New_List ( Make_Attribute_Reference (Loc, Prefix => Relocate_Node (Comp_Sel_Nam), Attribute_Name => Name_Address))))); -- Protected procedures if Is_Procedure then -- Move the original declarations inside the generated block Block_Decls := Decls; -- Reset the declarations list of the protected procedure to -- contain only Decl. Decls := New_List (Decl); -- Generate: -- Desired_Comp : Comp_Type := Expected_Comp; Desired_Comp := Make_Defining_Identifier (Loc, New_External_Name (Chars (Comp), Suffix => "_current")); -- Insert the declarations of Expected_Comp and Desired_Comp in -- the block declarations right before the renaming of the -- protected component. Insert_Before (Comp_Decl, Make_Object_Declaration (Loc, Defining_Identifier => Desired_Comp, Object_Definition => New_Occurrence_Of (Comp_Type, Loc), Expression => New_Occurrence_Of (Expected_Comp, Loc))); -- Protected function else Desired_Comp := Expected_Comp; -- Insert the declaration of Expected_Comp in the function -- declarations right before the renaming of the protected -- component. Insert_Before (Comp_Decl, Decl); end if; -- Rewrite the protected component renaming declaration to be a -- renaming of Desired_Comp. -- Generate: -- Comp : Comp_Type renames Desired_Comp; Rewrite (Comp_Decl, Make_Object_Renaming_Declaration (Loc, Defining_Identifier => Defining_Identifier (Comp_Decl), Subtype_Mark => New_Occurrence_Of (Comp_Type, Loc), Name => New_Occurrence_Of (Desired_Comp, Loc))); -- Wrap any return or raise statements in Stmts in same the manner -- described in Process_Stmts. Process_Stmts (Stmts); -- Generate: -- exit when System.Atomic_Primitives.Lock_Free_Try_Write_N -- (_Object.Comp'Address, -- Interfaces.Unsigned_N (Expected_Comp), -- Interfaces.Unsigned_N (Desired_Comp)) if Is_Procedure then Stmt := Make_Exit_Statement (Loc, Condition => Make_Function_Call (Loc, Name => New_Occurrence_Of (Try_Write, Loc), Parameter_Associations => New_List ( Make_Attribute_Reference (Loc, Prefix => Relocate_Node (Comp_Sel_Nam), Attribute_Name => Name_Address), Unchecked_Convert_To (Unsigned, New_Occurrence_Of (Expected_Comp, Loc)), Unchecked_Convert_To (Unsigned, New_Occurrence_Of (Desired_Comp, Loc))))); -- Small optimization: transform the default return statement -- of a procedure into the atomic exit statement. if Nkind (Last (Stmts)) = N_Simple_Return_Statement then Rewrite (Last (Stmts), Stmt); else Append_To (Stmts, Stmt); end if; end if; -- Create the declaration of the label used to skip the rest of -- the source statements when the object state changes. if Present (Label_Id) then Label := Make_Label (Loc, Label_Id); Append_To (Decls, Make_Implicit_Label_Declaration (Loc, Defining_Identifier => Entity (Label_Id), Label_Construct => Label)); Append_To (Stmts, Label); end if; -- Generate: -- loop -- declare -- <Decls> -- begin -- <Stmts> -- end; -- end loop; if Is_Procedure then Stmts := New_List ( Make_Loop_Statement (Loc, Statements => New_List ( Make_Block_Statement (Loc, Declarations => Block_Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Stmts))), End_Label => Empty)); end if; Hand_Stmt_Seq := Make_Handled_Sequence_Of_Statements (Loc, Statements => Stmts); end Protected_Component_Ref; end if; -- Make an unprotected version of the subprogram for use within the same -- object, with new name and extra parameter representing the object. return Make_Subprogram_Body (Loc, Specification => Build_Protected_Sub_Specification (N, Prot_Typ, Unprotected_Mode), Declarations => Decls, Handled_Statement_Sequence => Hand_Stmt_Seq); end Build_Lock_Free_Unprotected_Subprogram_Body; ------------------------- -- Build_Master_Entity -- ------------------------- procedure Build_Master_Entity (Obj_Or_Typ : Entity_Id) is Loc : constant Source_Ptr := Sloc (Obj_Or_Typ); Context : Node_Id; Context_Id : Entity_Id; Decl : Node_Id; Decls : List_Id; Par : Node_Id; begin -- No action needed if the run-time has no tasking support if Global_No_Tasking then return; end if; if Is_Itype (Obj_Or_Typ) then Par := Associated_Node_For_Itype (Obj_Or_Typ); else Par := Parent (Obj_Or_Typ); end if; -- For transient scopes check if the master entity is already defined if Is_Type (Obj_Or_Typ) and then Ekind (Scope (Obj_Or_Typ)) = E_Block and then Is_Internal (Scope (Obj_Or_Typ)) then declare Master_Scope : constant Entity_Id := Find_Master_Scope (Obj_Or_Typ); begin if Has_Master_Entity (Master_Scope) or else Is_Finalizer (Master_Scope) then return; end if; if Present (Current_Entity_In_Scope (Name_uMaster)) then return; end if; end; end if; -- When creating a master for a record component which is either a task -- or access-to-task, the enclosing record is the master scope and the -- proper insertion point is the component list. if Is_Record_Type (Current_Scope) then Context := Par; Context_Id := Current_Scope; Decls := List_Containing (Context); -- Default case for object declarations and access types. Note that the -- context is updated to the nearest enclosing body, block, package, or -- return statement. else Find_Enclosing_Context (Par, Context, Context_Id, Decls); end if; -- Nothing to do if the context already has a master; internally built -- finalizers don't need a master. if Has_Master_Entity (Context_Id) or else Is_Finalizer (Context_Id) then return; end if; Decl := Build_Master_Declaration (Loc); -- The master is inserted at the start of the declarative list of the -- context. Prepend_To (Decls, Decl); -- In certain cases where transient scopes are involved, the immediate -- scope is not always the proper master scope. Ensure that the master -- declaration and entity appear in the same context. if Context_Id /= Current_Scope then Push_Scope (Context_Id); Analyze (Decl); Pop_Scope; else Analyze (Decl); end if; -- Mark the enclosing scope and its associated construct as being task -- masters. Set_Has_Master_Entity (Context_Id); while Present (Context) and then Nkind (Context) /= N_Compilation_Unit loop if Nkind (Context) in N_Block_Statement | N_Subprogram_Body | N_Task_Body then Set_Is_Task_Master (Context); exit; elsif Nkind (Parent (Context)) = N_Subunit then Context := Corresponding_Stub (Parent (Context)); end if; Context := Parent (Context); end loop; end Build_Master_Entity; --------------------------- -- Build_Master_Renaming -- --------------------------- procedure Build_Master_Renaming (Ptr_Typ : Entity_Id; Ins_Nod : Node_Id := Empty) is Loc : constant Source_Ptr := Sloc (Ptr_Typ); Context : Node_Id; Master_Decl : Node_Id; Master_Id : Entity_Id; begin -- No action needed if the run-time has no tasking support if Global_No_Tasking then return; end if; -- Determine the proper context to insert the master renaming if Present (Ins_Nod) then Context := Ins_Nod; elsif Is_Itype (Ptr_Typ) then Context := Associated_Node_For_Itype (Ptr_Typ); -- When the context references a discriminant or a component of a -- private type and we are processing declarations in the private -- part of the enclosing package, we must insert the master renaming -- before the full declaration of the private type; otherwise the -- master renaming would be inserted in the public part of the -- package (and hence before the declaration of _master). if In_Private_Part (Current_Scope) then declare Ctx : Node_Id := Context; begin if Nkind (Context) = N_Discriminant_Specification then Ctx := Parent (Ctx); else while Nkind (Ctx) in N_Component_Declaration | N_Component_List loop Ctx := Parent (Ctx); end loop; end if; if Nkind (Ctx) in N_Private_Type_Declaration | N_Private_Extension_Declaration then Context := Parent (Full_View (Defining_Identifier (Ctx))); end if; end; end if; else Context := Parent (Ptr_Typ); end if; -- Generate: -- <Ptr_Typ>M : Master_Id renames _Master; -- and add a numeric suffix to the name to ensure that it is -- unique in case other access types in nested constructs -- are homonyms of this one. Master_Id := Make_Defining_Identifier (Loc, New_External_Name (Chars (Ptr_Typ), 'M', -1)); Master_Decl := Make_Object_Renaming_Declaration (Loc, Defining_Identifier => Master_Id, Subtype_Mark => New_Occurrence_Of (RTE (RE_Master_Id), Loc), Name => Make_Identifier (Loc, Name_uMaster)); Insert_Action (Context, Master_Decl); -- The renamed master now services the access type Set_Master_Id (Ptr_Typ, Master_Id); end Build_Master_Renaming; --------------------------- -- Build_Protected_Entry -- --------------------------- function Build_Protected_Entry (N : Node_Id; Ent : Entity_Id; Pid : Node_Id) return Node_Id is Bod_Decls : constant List_Id := New_List; Decls : constant List_Id := Declarations (N); End_Lab : constant Node_Id := End_Label (Handled_Statement_Sequence (N)); End_Loc : constant Source_Ptr := Sloc (Last (Statements (Handled_Statement_Sequence (N)))); -- Used for the generated call to Complete_Entry_Body Loc : constant Source_Ptr := Sloc (N); Bod_Id : Entity_Id; Bod_Spec : Node_Id; Bod_Stmts : List_Id; Complete : Node_Id; Ohandle : Node_Id; Proc_Body : Node_Id; EH_Loc : Source_Ptr; -- Used for the exception handler, inserted at end of the body begin -- Set the source location on the exception handler only when debugging -- the expanded code (see Make_Implicit_Exception_Handler). if Debug_Generated_Code then EH_Loc := End_Loc; -- Otherwise the inserted code should not be visible to the debugger else EH_Loc := No_Location; end if; Bod_Id := Make_Defining_Identifier (Loc, Chars => Chars (Protected_Body_Subprogram (Ent))); Bod_Spec := Build_Protected_Entry_Specification (Loc, Bod_Id, Empty); -- Add the following declarations: -- type poVP is access poV; -- _object : poVP := poVP (_O); -- where _O is the formal parameter associated with the concurrent -- object. These declarations are needed for Complete_Entry_Body. Add_Object_Pointer (Loc, Pid, Bod_Decls); -- Add renamings for all formals, the Protection object, discriminals, -- privals and the entry index constant for use by debugger. Add_Formal_Renamings (Bod_Spec, Bod_Decls, Ent, Loc); Debug_Private_Data_Declarations (Decls); -- Put the declarations and the statements from the entry Bod_Stmts := New_List ( Make_Block_Statement (Loc, Declarations => Decls, Handled_Statement_Sequence => Handled_Statement_Sequence (N))); -- Analyze now and reset scopes for declarations so that Scope fields -- currently denoting the entry will now denote the block scope, and -- the block's scope will be set to the new procedure entity. Analyze_Statements (Bod_Stmts); Set_Scope (Entity (Identifier (First (Bod_Stmts))), Bod_Id); Reset_Scopes_To (First (Bod_Stmts), Entity (Identifier (First (Bod_Stmts)))); case Corresponding_Runtime_Package (Pid) is when System_Tasking_Protected_Objects_Entries => Append_To (Bod_Stmts, Make_Procedure_Call_Statement (End_Loc, Name => New_Occurrence_Of (RTE (RE_Complete_Entry_Body), Loc), Parameter_Associations => New_List ( Make_Attribute_Reference (End_Loc, Prefix => Make_Selected_Component (End_Loc, Prefix => Make_Identifier (End_Loc, Name_uObject), Selector_Name => Make_Identifier (End_Loc, Name_uObject)), Attribute_Name => Name_Unchecked_Access)))); when System_Tasking_Protected_Objects_Single_Entry => -- Historically, a call to Complete_Single_Entry_Body was -- inserted, but it was a null procedure. null; when others => raise Program_Error; end case; -- When exceptions cannot be propagated, we never need to call -- Exception_Complete_Entry_Body. if No_Exception_Handlers_Set then return Make_Subprogram_Body (Loc, Specification => Bod_Spec, Declarations => Bod_Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Bod_Stmts, End_Label => End_Lab)); else Ohandle := Make_Others_Choice (Loc); Set_All_Others (Ohandle); case Corresponding_Runtime_Package (Pid) is when System_Tasking_Protected_Objects_Entries => Complete := New_Occurrence_Of (RTE (RE_Exceptional_Complete_Entry_Body), Loc); when System_Tasking_Protected_Objects_Single_Entry => Complete := New_Occurrence_Of (RTE (RE_Exceptional_Complete_Single_Entry_Body), Loc); when others => raise Program_Error; end case; -- Establish link between subprogram body entity and source entry Set_Corresponding_Protected_Entry (Bod_Id, Ent); -- Create body of entry procedure. The renaming declarations are -- placed ahead of the block that contains the actual entry body. Proc_Body := Make_Subprogram_Body (Loc, Specification => Bod_Spec, Declarations => Bod_Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Bod_Stmts, End_Label => End_Lab, Exception_Handlers => New_List ( Make_Implicit_Exception_Handler (EH_Loc, Exception_Choices => New_List (Ohandle), Statements => New_List ( Make_Procedure_Call_Statement (EH_Loc, Name => Complete, Parameter_Associations => New_List ( Make_Attribute_Reference (EH_Loc, Prefix => Make_Selected_Component (EH_Loc, Prefix => Make_Identifier (EH_Loc, Name_uObject), Selector_Name => Make_Identifier (EH_Loc, Name_uObject)), Attribute_Name => Name_Unchecked_Access), Make_Function_Call (EH_Loc, Name => New_Occurrence_Of (RTE (RE_Get_GNAT_Exception), Loc))))))))); Reset_Scopes_To (Proc_Body, Protected_Body_Subprogram (Ent)); return Proc_Body; end if; end Build_Protected_Entry; ----------------------------------------- -- Build_Protected_Entry_Specification -- ----------------------------------------- function Build_Protected_Entry_Specification (Loc : Source_Ptr; Def_Id : Entity_Id; Ent_Id : Entity_Id) return Node_Id is P : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uP); begin Set_Debug_Info_Needed (Def_Id); if Present (Ent_Id) then Append_Elmt (P, Accept_Address (Ent_Id)); end if; return Make_Procedure_Specification (Loc, Defining_Unit_Name => Def_Id, Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uO), Parameter_Type => New_Occurrence_Of (RTE (RE_Address), Loc)), Make_Parameter_Specification (Loc, Defining_Identifier => P, Parameter_Type => New_Occurrence_Of (RTE (RE_Address), Loc)), Make_Parameter_Specification (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uE), Parameter_Type => New_Occurrence_Of (RTE (RE_Protected_Entry_Index), Loc)))); end Build_Protected_Entry_Specification; -------------------------- -- Build_Protected_Spec -- -------------------------- function Build_Protected_Spec (N : Node_Id; Obj_Type : Entity_Id; Ident : Entity_Id; Unprotected : Boolean := False) return List_Id is Loc : constant Source_Ptr := Sloc (N); Decl : Node_Id; Formal : Entity_Id; New_Plist : List_Id; New_Param : Node_Id; begin New_Plist := New_List; Formal := First_Formal (Ident); while Present (Formal) loop New_Param := Make_Parameter_Specification (Loc, Defining_Identifier => Make_Defining_Identifier (Sloc (Formal), Chars (Formal)), Aliased_Present => Aliased_Present (Parent (Formal)), In_Present => In_Present (Parent (Formal)), Out_Present => Out_Present (Parent (Formal)), Parameter_Type => New_Occurrence_Of (Etype (Formal), Loc)); if Unprotected then Set_Protected_Formal (Formal, Defining_Identifier (New_Param)); Set_Ekind (Defining_Identifier (New_Param), Ekind (Formal)); end if; Append (New_Param, New_Plist); Next_Formal (Formal); end loop; -- If the subprogram is a procedure and the context is not an access -- to protected subprogram, the parameter is in-out. Otherwise it is -- an in parameter. Decl := Make_Parameter_Specification (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uObject), In_Present => True, Out_Present => (Etype (Ident) = Standard_Void_Type and then not Is_RTE (Obj_Type, RE_Address)), Parameter_Type => New_Occurrence_Of (Obj_Type, Loc)); Set_Debug_Info_Needed (Defining_Identifier (Decl)); Prepend_To (New_Plist, Decl); return New_Plist; end Build_Protected_Spec; --------------------------------------- -- Build_Protected_Sub_Specification -- --------------------------------------- function Build_Protected_Sub_Specification (N : Node_Id; Prot_Typ : Entity_Id; Mode : Subprogram_Protection_Mode) return Node_Id is Loc : constant Source_Ptr := Sloc (N); Decl : Node_Id; Def_Id : Entity_Id; New_Id : Entity_Id; New_Plist : List_Id; New_Spec : Node_Id; Append_Chr : constant array (Subprogram_Protection_Mode) of Character := (Dispatching_Mode => ' ', Protected_Mode => 'P', Unprotected_Mode => 'N'); begin if Ekind (Defining_Unit_Name (Specification (N))) = E_Subprogram_Body then Decl := Unit_Declaration_Node (Corresponding_Spec (N)); else Decl := N; end if; Def_Id := Defining_Unit_Name (Specification (Decl)); New_Plist := Build_Protected_Spec (Decl, Corresponding_Record_Type (Prot_Typ), Def_Id, Mode = Unprotected_Mode); New_Id := Make_Defining_Identifier (Loc, Chars => Build_Selected_Name (Prot_Typ, Def_Id, Append_Chr (Mode))); -- Reference the original nondispatching subprogram since the analysis -- of the object.operation notation may need its original name (see -- Sem_Ch4.Names_Match). if Mode = Dispatching_Mode then Set_Ekind (New_Id, Ekind (Def_Id)); Set_Original_Protected_Subprogram (New_Id, Def_Id); end if; -- Link the protected or unprotected version to the original subprogram -- it emulates. Set_Ekind (New_Id, Ekind (Def_Id)); Set_Protected_Subprogram (New_Id, Def_Id); -- The unprotected operation carries the user code, and debugging -- information must be generated for it, even though this spec does -- not come from source. It is also convenient to allow gdb to step -- into the protected operation, even though it only contains lock/ -- unlock calls. Set_Debug_Info_Needed (New_Id); -- If a pragma Eliminate applies to the source entity, the internal -- subprograms will be eliminated as well. Set_Is_Eliminated (New_Id, Is_Eliminated (Def_Id)); -- It seems we should set Has_Nested_Subprogram here, but instead we -- currently set it in Expand_N_Protected_Body, because the entity -- created here isn't the one that Corresponding_Spec of the body -- will later be set to, and that's the entity where it's needed. ??? Set_Has_Nested_Subprogram (New_Id, Has_Nested_Subprogram (Def_Id)); if Nkind (Specification (Decl)) = N_Procedure_Specification then New_Spec := Make_Procedure_Specification (Loc, Defining_Unit_Name => New_Id, Parameter_Specifications => New_Plist); -- Create a new specification for the anonymous subprogram type else New_Spec := Make_Function_Specification (Loc, Defining_Unit_Name => New_Id, Parameter_Specifications => New_Plist, Result_Definition => Copy_Result_Type (Result_Definition (Specification (Decl)))); Set_Return_Present (Defining_Unit_Name (New_Spec)); end if; return New_Spec; end Build_Protected_Sub_Specification; ------------------------------------- -- Build_Protected_Subprogram_Body -- ------------------------------------- function Build_Protected_Subprogram_Body (N : Node_Id; Pid : Node_Id; N_Op_Spec : Node_Id) return Node_Id is Exc_Safe : constant Boolean := not Might_Raise (N); -- True if N cannot raise an exception Loc : constant Source_Ptr := Sloc (N); Op_Spec : constant Node_Id := Specification (N); P_Op_Spec : constant Node_Id := Build_Protected_Sub_Specification (N, Pid, Protected_Mode); Lock_Kind : RE_Id; Lock_Name : Node_Id; Lock_Stmt : Node_Id; Object_Parm : Node_Id; Pformal : Node_Id; R : Node_Id; Return_Stmt : Node_Id := Empty; -- init to avoid gcc 3 warning Pre_Stmts : List_Id := No_List; -- init to avoid gcc 3 warning Stmts : List_Id; Sub_Body : Node_Id; Uactuals : List_Id; Unprot_Call : Node_Id; begin -- Build a list of the formal parameters of the protected version of -- the subprogram to use as the actual parameters of the unprotected -- version. Uactuals := New_List; Pformal := First (Parameter_Specifications (P_Op_Spec)); while Present (Pformal) loop Append_To (Uactuals, Make_Identifier (Loc, Chars (Defining_Identifier (Pformal)))); Next (Pformal); end loop; -- Make a call to the unprotected version of the subprogram built above -- for use by the protected version built below. if Nkind (Op_Spec) = N_Function_Specification then if Exc_Safe then R := Make_Temporary (Loc, 'R'); Unprot_Call := Make_Object_Declaration (Loc, Defining_Identifier => R, Constant_Present => True, Object_Definition => New_Copy (Result_Definition (N_Op_Spec)), Expression => Make_Function_Call (Loc, Name => Make_Identifier (Loc, Chars => Chars (Defining_Unit_Name (N_Op_Spec))), Parameter_Associations => Uactuals)); Return_Stmt := Make_Simple_Return_Statement (Loc, Expression => New_Occurrence_Of (R, Loc)); else Unprot_Call := Make_Simple_Return_Statement (Loc, Expression => Make_Function_Call (Loc, Name => Make_Identifier (Loc, Chars => Chars (Defining_Unit_Name (N_Op_Spec))), Parameter_Associations => Uactuals)); end if; if Has_Aspect (Pid, Aspect_Exclusive_Functions) and then (No (Find_Value_Of_Aspect (Pid, Aspect_Exclusive_Functions)) or else Is_True (Static_Boolean (Find_Value_Of_Aspect (Pid, Aspect_Exclusive_Functions)))) then Lock_Kind := RE_Lock; else Lock_Kind := RE_Lock_Read_Only; end if; else Unprot_Call := Make_Procedure_Call_Statement (Loc, Name => Make_Identifier (Loc, Chars (Defining_Unit_Name (N_Op_Spec))), Parameter_Associations => Uactuals); Lock_Kind := RE_Lock; end if; -- Wrap call in block that will be covered by an at_end handler if not Exc_Safe then Unprot_Call := Make_Block_Statement (Loc, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List (Unprot_Call))); end if; -- Make the protected subprogram body. This locks the protected -- object and calls the unprotected version of the subprogram. case Corresponding_Runtime_Package (Pid) is when System_Tasking_Protected_Objects_Entries => Lock_Name := New_Occurrence_Of (RTE (RE_Lock_Entries), Loc); when System_Tasking_Protected_Objects_Single_Entry => Lock_Name := New_Occurrence_Of (RTE (RE_Lock_Entry), Loc); when System_Tasking_Protected_Objects => Lock_Name := New_Occurrence_Of (RTE (Lock_Kind), Loc); when others => raise Program_Error; end case; Object_Parm := Make_Attribute_Reference (Loc, Prefix => Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_uObject), Selector_Name => Make_Identifier (Loc, Name_uObject)), Attribute_Name => Name_Unchecked_Access); Lock_Stmt := Make_Procedure_Call_Statement (Loc, Name => Lock_Name, Parameter_Associations => New_List (Object_Parm)); if Abort_Allowed then Stmts := New_List ( Build_Runtime_Call (Loc, RE_Abort_Defer), Lock_Stmt); else Stmts := New_List (Lock_Stmt); end if; if not Exc_Safe then Append (Unprot_Call, Stmts); else if Nkind (Op_Spec) = N_Function_Specification then Pre_Stmts := Stmts; Stmts := Empty_List; else Append (Unprot_Call, Stmts); end if; -- Historical note: Previously, call to the cleanup was inserted -- here. This is now done by Build_Protected_Subprogram_Call_Cleanup, -- which is also shared by the 'not Exc_Safe' path. Build_Protected_Subprogram_Call_Cleanup (Op_Spec, Pid, Loc, Stmts); if Nkind (Op_Spec) = N_Function_Specification then Append_To (Stmts, Return_Stmt); Append_To (Pre_Stmts, Make_Block_Statement (Loc, Declarations => New_List (Unprot_Call), Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Stmts))); Stmts := Pre_Stmts; end if; end if; Sub_Body := Make_Subprogram_Body (Loc, Declarations => Empty_List, Specification => P_Op_Spec, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Stmts)); -- Mark this subprogram as a protected subprogram body so that the -- cleanup will be inserted. This is done only in the 'not Exc_Safe' -- path as otherwise the cleanup has already been inserted. if not Exc_Safe then Set_Is_Protected_Subprogram_Body (Sub_Body); end if; return Sub_Body; end Build_Protected_Subprogram_Body; ------------------------------------- -- Build_Protected_Subprogram_Call -- ------------------------------------- procedure Build_Protected_Subprogram_Call (N : Node_Id; Name : Node_Id; Rec : Node_Id; External : Boolean := True) is Loc : constant Source_Ptr := Sloc (N); Sub : constant Entity_Id := Entity (Name); New_Sub : Node_Id; Params : List_Id; begin if External then New_Sub := New_Occurrence_Of (External_Subprogram (Sub), Loc); else New_Sub := New_Occurrence_Of (Protected_Body_Subprogram (Sub), Loc); end if; if Present (Parameter_Associations (N)) then Params := New_Copy_List_Tree (Parameter_Associations (N)); else Params := New_List; end if; -- If the type is an untagged derived type, convert to the root type, -- which is the one on which the operations are defined. if Nkind (Rec) = N_Unchecked_Type_Conversion and then not Is_Tagged_Type (Etype (Rec)) and then Is_Derived_Type (Etype (Rec)) then Set_Etype (Rec, Root_Type (Etype (Rec))); Set_Subtype_Mark (Rec, New_Occurrence_Of (Root_Type (Etype (Rec)), Sloc (N))); end if; Prepend (Rec, Params); if Ekind (Sub) = E_Procedure then Rewrite (N, Make_Procedure_Call_Statement (Loc, Name => New_Sub, Parameter_Associations => Params)); else pragma Assert (Ekind (Sub) = E_Function); Rewrite (N, Make_Function_Call (Loc, Name => New_Sub, Parameter_Associations => Params)); -- Preserve type of call for subsequent processing (required for -- call to Wrap_Transient_Expression in the case of a shared passive -- protected). Set_Etype (N, Etype (New_Sub)); end if; if External and then Nkind (Rec) = N_Unchecked_Type_Conversion and then Is_Entity_Name (Expression (Rec)) and then Is_Shared_Passive (Entity (Expression (Rec))) then Add_Shared_Var_Lock_Procs (N); end if; end Build_Protected_Subprogram_Call; --------------------------------------------- -- Build_Protected_Subprogram_Call_Cleanup -- --------------------------------------------- procedure Build_Protected_Subprogram_Call_Cleanup (Op_Spec : Node_Id; Conc_Typ : Node_Id; Loc : Source_Ptr; Stmts : List_Id) is Nam : Node_Id; begin -- If the associated protected object has entries, a protected -- procedure has to service entry queues. In this case generate: -- Service_Entries (_object._object'Access); if Nkind (Op_Spec) = N_Procedure_Specification and then Has_Entries (Conc_Typ) then case Corresponding_Runtime_Package (Conc_Typ) is when System_Tasking_Protected_Objects_Entries => Nam := New_Occurrence_Of (RTE (RE_Service_Entries), Loc); when System_Tasking_Protected_Objects_Single_Entry => Nam := New_Occurrence_Of (RTE (RE_Service_Entry), Loc); when others => raise Program_Error; end case; Append_To (Stmts, Make_Procedure_Call_Statement (Loc, Name => Nam, Parameter_Associations => New_List ( Make_Attribute_Reference (Loc, Prefix => Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_uObject), Selector_Name => Make_Identifier (Loc, Name_uObject)), Attribute_Name => Name_Unchecked_Access)))); else -- Generate: -- Unlock (_object._object'Access); case Corresponding_Runtime_Package (Conc_Typ) is when System_Tasking_Protected_Objects_Entries => Nam := New_Occurrence_Of (RTE (RE_Unlock_Entries), Loc); when System_Tasking_Protected_Objects_Single_Entry => Nam := New_Occurrence_Of (RTE (RE_Unlock_Entry), Loc); when System_Tasking_Protected_Objects => Nam := New_Occurrence_Of (RTE (RE_Unlock), Loc); when others => raise Program_Error; end case; Append_To (Stmts, Make_Procedure_Call_Statement (Loc, Name => Nam, Parameter_Associations => New_List ( Make_Attribute_Reference (Loc, Prefix => Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_uObject), Selector_Name => Make_Identifier (Loc, Name_uObject)), Attribute_Name => Name_Unchecked_Access)))); end if; -- Generate: -- Abort_Undefer; if Abort_Allowed then Append_To (Stmts, Build_Runtime_Call (Loc, RE_Abort_Undefer)); end if; end Build_Protected_Subprogram_Call_Cleanup; ------------------------- -- Build_Selected_Name -- ------------------------- function Build_Selected_Name (Prefix : Entity_Id; Selector : Entity_Id; Append_Char : Character := ' ') return Name_Id is Select_Buffer : String (1 .. Hostparm.Max_Name_Length); Select_Len : Natural; begin Get_Name_String (Chars (Selector)); Select_Len := Name_Len; Select_Buffer (1 .. Select_Len) := Name_Buffer (1 .. Name_Len); Get_Name_String (Chars (Prefix)); -- If scope is anonymous type, discard suffix to recover name of -- single protected object. Otherwise use protected type name. if Name_Buffer (Name_Len) = 'T' then Name_Len := Name_Len - 1; end if; Add_Str_To_Name_Buffer ("__"); for J in 1 .. Select_Len loop Add_Char_To_Name_Buffer (Select_Buffer (J)); end loop; -- Now add the Append_Char if specified. The encoding to follow -- depends on the type of entity. If Append_Char is either 'N' or 'P', -- then the entity is associated to a protected type subprogram. -- Otherwise, it is a protected type entry. For each case, the -- encoding to follow for the suffix is documented in exp_dbug.ads. -- It would be better to encapsulate this as a routine in Exp_Dbug ??? if Append_Char /= ' ' then if Append_Char = 'P' or Append_Char = 'N' then Add_Char_To_Name_Buffer (Append_Char); return Name_Find; else Add_Str_To_Name_Buffer ((1 => '_', 2 => Append_Char)); return New_External_Name (Name_Find, ' ', -1); end if; else return Name_Find; end if; end Build_Selected_Name; ----------------------------- -- Build_Simple_Entry_Call -- ----------------------------- -- A task entry call is converted to a call to Call_Simple -- declare -- P : parms := (parm, parm, parm); -- begin -- Call_Simple (acceptor-task, entry-index, P'Address); -- parm := P.param; -- parm := P.param; -- ... -- end; -- Here Pnn is an aggregate of the type constructed for the entry to hold -- the parameters, and the constructed aggregate value contains either the -- parameters or, in the case of non-elementary types, references to these -- parameters. Then the address of this aggregate is passed to the runtime -- routine, along with the task id value and the task entry index value. -- Pnn is only required if parameters are present. -- The assignments after the call are present only in the case of in-out -- or out parameters for elementary types, and are used to assign back the -- resulting values of such parameters. -- Note: the reason that we insert a block here is that in the context -- of selects, conditional entry calls etc. the entry call statement -- appears on its own, not as an element of a list. -- A protected entry call is converted to a Protected_Entry_Call: -- declare -- P : E1_Params := (param, param, param); -- Pnn : Boolean; -- Bnn : Communications_Block; -- declare -- P : E1_Params := (param, param, param); -- Bnn : Communications_Block; -- begin -- Protected_Entry_Call ( -- Object => po._object'Access, -- E => <entry index>; -- Uninterpreted_Data => P'Address; -- Mode => Simple_Call; -- Block => Bnn); -- parm := P.param; -- parm := P.param; -- ... -- end; procedure Build_Simple_Entry_Call (N : Node_Id; Concval : Node_Id; Ename : Node_Id; Index : Node_Id) is begin Expand_Call (N); -- If call has been inlined, nothing left to do if Nkind (N) = N_Block_Statement then return; end if; -- Convert entry call to Call_Simple call declare Loc : constant Source_Ptr := Sloc (N); Parms : constant List_Id := Parameter_Associations (N); Stats : constant List_Id := New_List; Actual : Node_Id; Call : Node_Id; Comm_Name : Entity_Id; Conctyp : Node_Id; Decls : List_Id; Ent : Entity_Id; Ent_Acc : Entity_Id; Formal : Node_Id; Iface_Tag : Entity_Id; Iface_Typ : Entity_Id; N_Node : Node_Id; N_Var : Node_Id; P : Entity_Id; Parm1 : Node_Id; Parm2 : Node_Id; Parm3 : Node_Id; Pdecl : Node_Id; Plist : List_Id; X : Entity_Id; Xdecl : Node_Id; begin -- Simple entry and entry family cases merge here Ent := Entity (Ename); Ent_Acc := Entry_Parameters_Type (Ent); Conctyp := Etype (Concval); -- Special case for protected subprogram calls if Is_Protected_Type (Conctyp) and then Is_Subprogram (Entity (Ename)) then if not Is_Eliminated (Entity (Ename)) then Build_Protected_Subprogram_Call (N, Ename, Convert_Concurrent (Concval, Conctyp)); Analyze (N); end if; return; end if; -- First parameter is the Task_Id value from the task value or the -- Object from the protected object value, obtained by selecting -- the _Task_Id or _Object from the result of doing an unchecked -- conversion to convert the value to the corresponding record type. if Nkind (Concval) = N_Function_Call and then Is_Task_Type (Conctyp) and then Ada_Version >= Ada_2005 then declare ExpR : constant Node_Id := Relocate_Node (Concval); Obj : constant Entity_Id := Make_Temporary (Loc, 'F', ExpR); Decl : Node_Id; begin Decl := Make_Object_Declaration (Loc, Defining_Identifier => Obj, Object_Definition => New_Occurrence_Of (Conctyp, Loc), Expression => ExpR); Set_Etype (Obj, Conctyp); Decls := New_List (Decl); Rewrite (Concval, New_Occurrence_Of (Obj, Loc)); end; else Decls := New_List; end if; Parm1 := Concurrent_Ref (Concval); -- Second parameter is the entry index, computed by the routine -- provided for this purpose. The value of this expression is -- assigned to an intermediate variable to assure that any entry -- family index expressions are evaluated before the entry -- parameters. if not Is_Protected_Type (Conctyp) or else Corresponding_Runtime_Package (Conctyp) = System_Tasking_Protected_Objects_Entries then X := Make_Defining_Identifier (Loc, Name_uX); Xdecl := Make_Object_Declaration (Loc, Defining_Identifier => X, Object_Definition => New_Occurrence_Of (RTE (RE_Task_Entry_Index), Loc), Expression => Actual_Index_Expression ( Loc, Entity (Ename), Index, Concval)); Append_To (Decls, Xdecl); Parm2 := New_Occurrence_Of (X, Loc); else Xdecl := Empty; Parm2 := Empty; end if; -- The third parameter is the packaged parameters. If there are -- none, then it is just the null address, since nothing is passed. if No (Parms) then Parm3 := New_Occurrence_Of (RTE (RE_Null_Address), Loc); P := Empty; -- Case of parameters present, where third argument is the address -- of a packaged record containing the required parameter values. else -- First build a list of parameter values, which are references to -- objects of the parameter types. Plist := New_List; Actual := First_Actual (N); Formal := First_Formal (Ent); while Present (Actual) loop -- If it is a by-copy type, copy it to a new variable. The -- packaged record has a field that points to this variable. if Is_By_Copy_Type (Etype (Actual)) then N_Node := Make_Object_Declaration (Loc, Defining_Identifier => Make_Temporary (Loc, 'J'), Aliased_Present => True, Object_Definition => New_Occurrence_Of (Etype (Formal), Loc)); -- Mark the object as not needing initialization since the -- initialization is performed separately, avoiding errors -- on cases such as formals of null-excluding access types. Set_No_Initialization (N_Node); -- We must make a separate assignment statement for the -- case of limited types. We cannot assign it unless the -- Assignment_OK flag is set first. An out formal of an -- access type or whose type has a Default_Value must also -- be initialized from the actual (see RM 6.4.1 (13-13.1)), -- but no constraint, predicate, or null-exclusion check is -- applied before the call. if Ekind (Formal) /= E_Out_Parameter or else Is_Access_Type (Etype (Formal)) or else (Is_Scalar_Type (Etype (Formal)) and then Present (Default_Aspect_Value (Etype (Formal)))) then N_Var := New_Occurrence_Of (Defining_Identifier (N_Node), Loc); Set_Assignment_OK (N_Var); Append_To (Stats, Make_Assignment_Statement (Loc, Name => N_Var, Expression => Relocate_Node (Actual))); -- Mark the object as internal, so we don't later reset -- No_Initialization flag in Default_Initialize_Object, -- which would lead to needless default initialization. -- We don't set this outside the if statement, because -- out scalar parameters without Default_Value do require -- default initialization if Initialize_Scalars applies. Set_Is_Internal (Defining_Identifier (N_Node)); -- If actual is an out parameter of a null-excluding -- access type, there is access check on entry, so set -- Suppress_Assignment_Checks on the generated statement -- that assigns the actual to the parameter block. Set_Suppress_Assignment_Checks (Last (Stats)); end if; Append (N_Node, Decls); Append_To (Plist, Make_Attribute_Reference (Loc, Attribute_Name => Name_Unchecked_Access, Prefix => New_Occurrence_Of (Defining_Identifier (N_Node), Loc))); else -- Interface class-wide formal if Ada_Version >= Ada_2005 and then Ekind (Etype (Formal)) = E_Class_Wide_Type and then Is_Interface (Etype (Formal)) then Iface_Typ := Etype (Etype (Formal)); -- Generate: -- formal_iface_type! (actual.iface_tag)'reference Iface_Tag := Find_Interface_Tag (Etype (Actual), Iface_Typ); pragma Assert (Present (Iface_Tag)); Append_To (Plist, Make_Reference (Loc, Unchecked_Convert_To (Iface_Typ, Make_Selected_Component (Loc, Prefix => Relocate_Node (Actual), Selector_Name => New_Occurrence_Of (Iface_Tag, Loc))))); else -- Generate: -- actual'reference Append_To (Plist, Make_Reference (Loc, Relocate_Node (Actual))); end if; end if; Next_Actual (Actual); Next_Formal_With_Extras (Formal); end loop; -- Now build the declaration of parameters initialized with the -- aggregate containing this constructed parameter list. P := Make_Defining_Identifier (Loc, Name_uP); Pdecl := Make_Object_Declaration (Loc, Defining_Identifier => P, Object_Definition => New_Occurrence_Of (Designated_Type (Ent_Acc), Loc), Expression => Make_Aggregate (Loc, Expressions => Plist)); Parm3 := Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (P, Loc), Attribute_Name => Name_Address); Append (Pdecl, Decls); end if; -- Now we can create the call, case of protected type if Is_Protected_Type (Conctyp) then case Corresponding_Runtime_Package (Conctyp) is when System_Tasking_Protected_Objects_Entries => -- Change the type of the index declaration Set_Object_Definition (Xdecl, New_Occurrence_Of (RTE (RE_Protected_Entry_Index), Loc)); -- Some additional declarations for protected entry calls if No (Decls) then Decls := New_List; end if; -- Bnn : Communications_Block; Comm_Name := Make_Temporary (Loc, 'B'); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Comm_Name, Object_Definition => New_Occurrence_Of (RTE (RE_Communication_Block), Loc))); -- Some additional statements for protected entry calls -- Protected_Entry_Call -- (Object => po._object'Access, -- E => <entry index>; -- Uninterpreted_Data => P'Address; -- Mode => Simple_Call; -- Block => Bnn); Call := Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Protected_Entry_Call), Loc), Parameter_Associations => New_List ( Make_Attribute_Reference (Loc, Attribute_Name => Name_Unchecked_Access, Prefix => Parm1), Parm2, Parm3, New_Occurrence_Of (RTE (RE_Simple_Call), Loc), New_Occurrence_Of (Comm_Name, Loc))); when System_Tasking_Protected_Objects_Single_Entry => -- Protected_Single_Entry_Call -- (Object => po._object'Access, -- Uninterpreted_Data => P'Address); Call := Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Protected_Single_Entry_Call), Loc), Parameter_Associations => New_List ( Make_Attribute_Reference (Loc, Attribute_Name => Name_Unchecked_Access, Prefix => Parm1), Parm3)); when others => raise Program_Error; end case; -- Case of task type else Call := Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Call_Simple), Loc), Parameter_Associations => New_List (Parm1, Parm2, Parm3)); end if; Append_To (Stats, Call); -- If there are out or in/out parameters by copy add assignment -- statements for the result values. if Present (Parms) then Actual := First_Actual (N); Formal := First_Formal (Ent); Set_Assignment_OK (Actual); while Present (Actual) loop if Is_By_Copy_Type (Etype (Actual)) and then Ekind (Formal) /= E_In_Parameter then N_Node := Make_Assignment_Statement (Loc, Name => New_Copy (Actual), Expression => Make_Explicit_Dereference (Loc, Make_Selected_Component (Loc, Prefix => New_Occurrence_Of (P, Loc), Selector_Name => Make_Identifier (Loc, Chars (Formal))))); -- In all cases (including limited private types) we want -- the assignment to be valid. Set_Assignment_OK (Name (N_Node)); -- If the call is the triggering alternative in an -- asynchronous select, or the entry_call alternative of a -- conditional entry call, the assignments for in-out -- parameters are incorporated into the statement list that -- follows, so that there are executed only if the entry -- call succeeds. if (Nkind (Parent (N)) = N_Triggering_Alternative and then N = Triggering_Statement (Parent (N))) or else (Nkind (Parent (N)) = N_Entry_Call_Alternative and then N = Entry_Call_Statement (Parent (N))) then if No (Statements (Parent (N))) then Set_Statements (Parent (N), New_List); end if; Prepend (N_Node, Statements (Parent (N))); else Insert_After (Call, N_Node); end if; end if; Next_Actual (Actual); Next_Formal_With_Extras (Formal); end loop; end if; -- Finally, create block and analyze it Rewrite (N, Make_Block_Statement (Loc, Declarations => Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Stats))); Analyze (N); end; end Build_Simple_Entry_Call; -------------------------------- -- Build_Task_Activation_Call -- -------------------------------- procedure Build_Task_Activation_Call (N : Node_Id) is function Activation_Call_Loc return Source_Ptr; -- Find a suitable source location for the activation call ------------------------- -- Activation_Call_Loc -- ------------------------- function Activation_Call_Loc return Source_Ptr is begin -- The activation call must carry the location of the "end" keyword -- when the context is a package declaration. if Nkind (N) = N_Package_Declaration then return End_Keyword_Location (N); -- Otherwise the activation call must carry the location of the -- "begin" keyword. else return Begin_Keyword_Location (N); end if; end Activation_Call_Loc; -- Local variables Chain : Entity_Id; Call : Node_Id; Loc : Source_Ptr; Name : Node_Id; Owner : Node_Id; Stmt : Node_Id; -- Start of processing for Build_Task_Activation_Call begin -- For sequential elaboration policy, all the tasks will be activated at -- the end of the elaboration. if Partition_Elaboration_Policy = 'S' then return; -- Do not create an activation call for a package spec if the package -- has a completing body. The activation call will be inserted after -- the "begin" of the body. elsif Nkind (N) = N_Package_Declaration and then Present (Corresponding_Body (N)) then return; end if; -- Obtain the activation chain entity. Block statements, entry bodies, -- subprogram bodies, and task bodies keep the entity in their nodes. -- Package bodies on the other hand store it in the declaration of the -- corresponding package spec. Owner := N; if Nkind (Owner) = N_Package_Body then Owner := Unit_Declaration_Node (Corresponding_Spec (Owner)); end if; Chain := Activation_Chain_Entity (Owner); -- Nothing to do when there are no tasks to activate. This is indicated -- by a missing activation chain entity; also skip generating it when -- it is a ghost entity. if No (Chain) or else Is_Ignored_Ghost_Entity (Chain) then return; end if; -- The location of the activation call must be as close as possible to -- the intended semantic location of the activation because the ABE -- mechanism relies heavily on accurate locations. Loc := Activation_Call_Loc; if Restricted_Profile then Name := New_Occurrence_Of (RTE (RE_Activate_Restricted_Tasks), Loc); else Name := New_Occurrence_Of (RTE (RE_Activate_Tasks), Loc); end if; Call := Make_Procedure_Call_Statement (Loc, Name => Name, Parameter_Associations => New_List (Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Chain, Loc), Attribute_Name => Name_Unchecked_Access))); if Nkind (N) = N_Package_Declaration then if Present (Private_Declarations (Specification (N))) then Append (Call, Private_Declarations (Specification (N))); else Append (Call, Visible_Declarations (Specification (N))); end if; else -- The call goes at the start of the statement sequence after the -- start of exception range label if one is present. if Present (Handled_Statement_Sequence (N)) then Stmt := First (Statements (Handled_Statement_Sequence (N))); -- A special case, skip exception range label if one is present -- (from front end zcx processing). if Nkind (Stmt) = N_Label and then Exception_Junk (Stmt) then Next (Stmt); end if; -- Another special case, if the first statement is a block from -- optimization of a local raise to a goto, then the call goes -- inside this block. if Nkind (Stmt) = N_Block_Statement and then Exception_Junk (Stmt) then Stmt := First (Statements (Handled_Statement_Sequence (Stmt))); end if; -- Insertion point is after any exception label pushes, since we -- want it covered by any local handlers. while Nkind (Stmt) in N_Push_xxx_Label loop Next (Stmt); end loop; -- Now we have the proper insertion point Insert_Before (Stmt, Call); else Set_Handled_Statement_Sequence (N, Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List (Call))); end if; end if; Analyze (Call); if Legacy_Elaboration_Checks then Check_Task_Activation (N); end if; end Build_Task_Activation_Call; ------------------------------- -- Build_Task_Allocate_Block -- ------------------------------- procedure Build_Task_Allocate_Block (Actions : List_Id; N : Node_Id; Args : List_Id) is T : constant Entity_Id := Entity (Expression (N)); Init : constant Entity_Id := Base_Init_Proc (T); Loc : constant Source_Ptr := Sloc (N); Chain : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uChain); Blkent : constant Entity_Id := Make_Temporary (Loc, 'A'); Block : Node_Id; begin Block := Make_Block_Statement (Loc, Identifier => New_Occurrence_Of (Blkent, Loc), Declarations => New_List ( -- _Chain : Activation_Chain; Make_Object_Declaration (Loc, Defining_Identifier => Chain, Aliased_Present => True, Object_Definition => New_Occurrence_Of (RTE (RE_Activation_Chain), Loc))), Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List ( -- Init (Args); Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Init, Loc), Parameter_Associations => Args), -- Activate_Tasks (_Chain); Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Activate_Tasks), Loc), Parameter_Associations => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Chain, Loc), Attribute_Name => Name_Unchecked_Access))))), Has_Created_Identifier => True, Is_Task_Allocation_Block => True); Append_To (Actions, Make_Implicit_Label_Declaration (Loc, Defining_Identifier => Blkent, Label_Construct => Block)); Append_To (Actions, Block); Set_Activation_Chain_Entity (Block, Chain); end Build_Task_Allocate_Block; ----------------------------------------------- -- Build_Task_Allocate_Block_With_Init_Stmts -- ----------------------------------------------- procedure Build_Task_Allocate_Block_With_Init_Stmts (Actions : List_Id; N : Node_Id; Init_Stmts : List_Id) is Loc : constant Source_Ptr := Sloc (N); Chain : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uChain); Blkent : constant Entity_Id := Make_Temporary (Loc, 'A'); Block : Node_Id; begin Append_To (Init_Stmts, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Activate_Tasks), Loc), Parameter_Associations => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Chain, Loc), Attribute_Name => Name_Unchecked_Access)))); Block := Make_Block_Statement (Loc, Identifier => New_Occurrence_Of (Blkent, Loc), Declarations => New_List ( -- _Chain : Activation_Chain; Make_Object_Declaration (Loc, Defining_Identifier => Chain, Aliased_Present => True, Object_Definition => New_Occurrence_Of (RTE (RE_Activation_Chain), Loc))), Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Init_Stmts), Has_Created_Identifier => True, Is_Task_Allocation_Block => True); Append_To (Actions, Make_Implicit_Label_Declaration (Loc, Defining_Identifier => Blkent, Label_Construct => Block)); Append_To (Actions, Block); Set_Activation_Chain_Entity (Block, Chain); end Build_Task_Allocate_Block_With_Init_Stmts; ----------------------------------- -- Build_Task_Proc_Specification -- ----------------------------------- function Build_Task_Proc_Specification (T : Entity_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (T); Spec_Id : Entity_Id; begin -- Case of explicit task type, suffix TB if Comes_From_Source (T) then Spec_Id := Make_Defining_Identifier (Loc, New_External_Name (Chars (T), "TB")); -- Case of anonymous task type, suffix B else Spec_Id := Make_Defining_Identifier (Loc, New_External_Name (Chars (T), 'B')); end if; Set_Is_Internal (Spec_Id); -- Associate the procedure with the task, if this is the declaration -- (and not the body) of the procedure. if No (Task_Body_Procedure (T)) then Set_Task_Body_Procedure (T, Spec_Id); end if; return Make_Procedure_Specification (Loc, Defining_Unit_Name => Spec_Id, Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uTask), Parameter_Type => Make_Access_Definition (Loc, Subtype_Mark => New_Occurrence_Of (Corresponding_Record_Type (T), Loc))))); end Build_Task_Proc_Specification; --------------------------------------- -- Build_Unprotected_Subprogram_Body -- --------------------------------------- function Build_Unprotected_Subprogram_Body (N : Node_Id; Pid : Node_Id) return Node_Id is Decls : constant List_Id := Declarations (N); begin -- Add renamings for the Protection object, discriminals, privals, and -- the entry index constant for use by debugger. Debug_Private_Data_Declarations (Decls); -- Make an unprotected version of the subprogram for use within the same -- object, with a new name and an additional parameter representing the -- object. return Make_Subprogram_Body (Sloc (N), Specification => Build_Protected_Sub_Specification (N, Pid, Unprotected_Mode), Declarations => Decls, Handled_Statement_Sequence => Handled_Statement_Sequence (N)); end Build_Unprotected_Subprogram_Body; ---------------------------- -- Collect_Entry_Families -- ---------------------------- procedure Collect_Entry_Families (Loc : Source_Ptr; Cdecls : List_Id; Current_Node : in out Node_Id; Conctyp : Entity_Id) is Efam : Entity_Id; Efam_Decl : Node_Id; Efam_Type : Entity_Id; begin Efam := First_Entity (Conctyp); while Present (Efam) loop if Ekind (Efam) = E_Entry_Family then Efam_Type := Make_Temporary (Loc, 'F'); declare Eityp : constant Entity_Id := Entry_Index_Type (Efam); Lo : constant Node_Id := Type_Low_Bound (Eityp); Hi : constant Node_Id := Type_High_Bound (Eityp); Bdecl : Node_Id; Bityp : Entity_Id; begin Bityp := Base_Type (Eityp); if Is_Potentially_Large_Family (Bityp, Conctyp, Lo, Hi) then Bityp := Make_Temporary (Loc, 'B'); Bdecl := Make_Subtype_Declaration (Loc, Defining_Identifier => Bityp, Subtype_Indication => Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (Standard_Integer, Loc), Constraint => Make_Range_Constraint (Loc, Range_Expression => Make_Range (Loc, Make_Integer_Literal (Loc, -Entry_Family_Bound), Make_Integer_Literal (Loc, Entry_Family_Bound - 1))))); Insert_After (Current_Node, Bdecl); Current_Node := Bdecl; Analyze (Bdecl); end if; Efam_Decl := Make_Full_Type_Declaration (Loc, Defining_Identifier => Efam_Type, Type_Definition => Make_Unconstrained_Array_Definition (Loc, Subtype_Marks => (New_List (New_Occurrence_Of (Bityp, Loc))), Component_Definition => Make_Component_Definition (Loc, Aliased_Present => False, Subtype_Indication => New_Occurrence_Of (Standard_Character, Loc)))); end; Insert_After (Current_Node, Efam_Decl); Current_Node := Efam_Decl; Analyze (Efam_Decl); Append_To (Cdecls, Make_Component_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Chars (Efam)), Component_Definition => Make_Component_Definition (Loc, Aliased_Present => False, Subtype_Indication => Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (Efam_Type, Loc), Constraint => Make_Index_Or_Discriminant_Constraint (Loc, Constraints => New_List ( New_Occurrence_Of (Entry_Index_Type (Efam), Loc))))))); end if; Next_Entity (Efam); end loop; end Collect_Entry_Families; ----------------------- -- Concurrent_Object -- ----------------------- function Concurrent_Object (Spec_Id : Entity_Id; Conc_Typ : Entity_Id) return Entity_Id is begin -- Parameter _O or _object if Is_Protected_Type (Conc_Typ) then return First_Formal (Protected_Body_Subprogram (Spec_Id)); -- Parameter _task else pragma Assert (Is_Task_Type (Conc_Typ)); return First_Formal (Task_Body_Procedure (Conc_Typ)); end if; end Concurrent_Object; ---------------------- -- Copy_Result_Type -- ---------------------- function Copy_Result_Type (Res : Node_Id) return Node_Id is New_Res : constant Node_Id := New_Copy_Tree (Res); Par_Spec : Node_Id; Formal : Entity_Id; begin -- If the result type is an access_to_subprogram, we must create new -- entities for its spec. if Nkind (New_Res) = N_Access_Definition and then Present (Access_To_Subprogram_Definition (New_Res)) then -- Provide new entities for the formals Par_Spec := First (Parameter_Specifications (Access_To_Subprogram_Definition (New_Res))); while Present (Par_Spec) loop Formal := Defining_Identifier (Par_Spec); Set_Defining_Identifier (Par_Spec, Make_Defining_Identifier (Sloc (Formal), Chars (Formal))); Next (Par_Spec); end loop; end if; return New_Res; end Copy_Result_Type; -------------------- -- Concurrent_Ref -- -------------------- -- The expression returned for a reference to a concurrent object has the -- form: -- taskV!(name)._Task_Id -- for a task, and -- objectV!(name)._Object -- for a protected object. For the case of an access to a concurrent -- object, there is an extra explicit dereference: -- taskV!(name.all)._Task_Id -- objectV!(name.all)._Object -- here taskV and objectV are the types for the associated records, which -- contain the required _Task_Id and _Object fields for tasks and protected -- objects, respectively. -- For the case of a task type name, the expression is -- Self; -- i.e. a call to the Self function which returns precisely this Task_Id -- For the case of a protected type name, the expression is -- objectR -- which is a renaming of the _object field of the current object -- record, passed into protected operations as a parameter. function Concurrent_Ref (N : Node_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (N); Ntyp : constant Entity_Id := Etype (N); Dtyp : Entity_Id; Sel : Name_Id; function Is_Current_Task (T : Entity_Id) return Boolean; -- Check whether the reference is to the immediately enclosing task -- type, or to an outer one (rare but legal). --------------------- -- Is_Current_Task -- --------------------- function Is_Current_Task (T : Entity_Id) return Boolean is Scop : Entity_Id; begin Scop := Current_Scope; while Present (Scop) and then Scop /= Standard_Standard loop if Scop = T then return True; elsif Is_Task_Type (Scop) then return False; -- If this is a procedure nested within the task type, we must -- assume that it can be called from an inner task, and therefore -- cannot treat it as a local reference. elsif Is_Overloadable (Scop) and then In_Open_Scopes (T) then return False; else Scop := Scope (Scop); end if; end loop; -- We know that we are within the task body, so should have found it -- in scope. raise Program_Error; end Is_Current_Task; -- Start of processing for Concurrent_Ref begin if Is_Access_Type (Ntyp) then Dtyp := Designated_Type (Ntyp); if Is_Protected_Type (Dtyp) then Sel := Name_uObject; else Sel := Name_uTask_Id; end if; return Make_Selected_Component (Loc, Prefix => Unchecked_Convert_To (Corresponding_Record_Type (Dtyp), Make_Explicit_Dereference (Loc, N)), Selector_Name => Make_Identifier (Loc, Sel)); elsif Is_Entity_Name (N) and then Is_Concurrent_Type (Entity (N)) then if Is_Task_Type (Entity (N)) then if Is_Current_Task (Entity (N)) then return Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Self), Loc)); else declare Decl : Node_Id; T_Self : constant Entity_Id := Make_Temporary (Loc, 'T'); T_Body : constant Node_Id := Parent (Corresponding_Body (Parent (Entity (N)))); begin Decl := Make_Object_Declaration (Loc, Defining_Identifier => T_Self, Object_Definition => New_Occurrence_Of (RTE (RO_ST_Task_Id), Loc), Expression => Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Self), Loc))); Prepend (Decl, Declarations (T_Body)); Analyze (Decl); Set_Scope (T_Self, Entity (N)); return New_Occurrence_Of (T_Self, Loc); end; end if; else pragma Assert (Is_Protected_Type (Entity (N))); return New_Occurrence_Of (Find_Protection_Object (Current_Scope), Loc); end if; else if Is_Protected_Type (Ntyp) then Sel := Name_uObject; elsif Is_Task_Type (Ntyp) then Sel := Name_uTask_Id; else raise Program_Error; end if; return Make_Selected_Component (Loc, Prefix => Unchecked_Convert_To (Corresponding_Record_Type (Ntyp), New_Copy_Tree (N)), Selector_Name => Make_Identifier (Loc, Sel)); end if; end Concurrent_Ref; ------------------------ -- Convert_Concurrent -- ------------------------ function Convert_Concurrent (N : Node_Id; Typ : Entity_Id) return Node_Id is begin if not Is_Concurrent_Type (Typ) then return N; else return Unchecked_Convert_To (Corresponding_Record_Type (Typ), New_Copy_Tree (N)); end if; end Convert_Concurrent; ------------------------------------- -- Create_Secondary_Stack_For_Task -- ------------------------------------- function Create_Secondary_Stack_For_Task (T : Node_Id) return Boolean is begin return (Restriction_Active (No_Implicit_Heap_Allocations) or else Restriction_Active (No_Implicit_Task_Allocations)) and then not Restriction_Active (No_Secondary_Stack) and then Has_Rep_Pragma (T, Name_Secondary_Stack_Size, Check_Parents => False); end Create_Secondary_Stack_For_Task; ------------------------------------- -- Debug_Private_Data_Declarations -- ------------------------------------- procedure Debug_Private_Data_Declarations (Decls : List_Id) is Debug_Nod : Node_Id; Decl : Node_Id; begin Decl := First (Decls); while Present (Decl) and then not Comes_From_Source (Decl) loop -- Declaration for concurrent entity _object and its access type, -- along with the entry index subtype: -- type prot_typVP is access prot_typV; -- _object : prot_typVP := prot_typV (_O); -- subtype Jnn is <Type of Index> range Low .. High; if Nkind (Decl) in N_Full_Type_Declaration | N_Object_Declaration then Set_Debug_Info_Needed (Defining_Identifier (Decl)); -- Declaration for the Protection object, discriminals, privals, and -- entry index constant: -- conc_typR : protection_typ renames _object._object; -- discr_nameD : discr_typ renames _object.discr_name; -- discr_nameD : discr_typ renames _task.discr_name; -- prival_name : comp_typ renames _object.comp_name; -- J : constant Jnn := -- Jnn'Val (_E - <Index expression> + Jnn'Pos (Jnn'First)); elsif Nkind (Decl) = N_Object_Renaming_Declaration then Set_Debug_Info_Needed (Defining_Identifier (Decl)); Debug_Nod := Debug_Renaming_Declaration (Decl); if Present (Debug_Nod) then Insert_After (Decl, Debug_Nod); end if; end if; Next (Decl); end loop; end Debug_Private_Data_Declarations; ------------------------------ -- Ensure_Statement_Present -- ------------------------------ procedure Ensure_Statement_Present (Loc : Source_Ptr; Alt : Node_Id) is Stmt : Node_Id; begin if Opt.Suppress_Control_Flow_Optimizations and then Is_Empty_List (Statements (Alt)) then Stmt := Make_Null_Statement (Loc); -- Mark NULL statement as coming from source so that it is not -- eliminated by GIGI. -- Another covert channel. If this is a requirement, it must be -- documented in sinfo/einfo ??? Set_Comes_From_Source (Stmt, True); Set_Statements (Alt, New_List (Stmt)); end if; end Ensure_Statement_Present; ---------------------------- -- Entry_Index_Expression -- ---------------------------- function Entry_Index_Expression (Sloc : Source_Ptr; Ent : Entity_Id; Index : Node_Id; Ttyp : Entity_Id) return Node_Id is Expr : Node_Id; Num : Node_Id; Lo : Node_Id; Hi : Node_Id; Prev : Entity_Id; S : Node_Id; begin -- The queues of entries and entry families appear in textual order in -- the associated record. The entry index is computed as the sum of the -- number of queues for all entries that precede the designated one, to -- which is added the index expression, if this expression denotes a -- member of a family. -- The following is a place holder for the count of simple entries Num := Make_Integer_Literal (Sloc, 1); -- We construct an expression which is a series of addition operations. -- The first operand is the number of single entries that precede this -- one, the second operand is the index value relative to the start of -- the referenced family, and the remaining operands are the lengths of -- the entry families that precede this entry, i.e. the constructed -- expression is: -- number_simple_entries + -- (s'pos (index-value) - s'pos (family'first)) + 1 + -- family'length + ... -- where index-value is the given index value, and s is the index -- subtype (we have to use pos because the subtype might be an -- enumeration type preventing direct subtraction). Note that the task -- entry array is one-indexed. -- The upper bound of the entry family may be a discriminant, so we -- retrieve the lower bound explicitly to compute offset, rather than -- using the index subtype which may mention a discriminant. if Present (Index) then S := Entry_Index_Type (Ent); -- First make sure the index is in range if requested. The index type -- is the pristine Entry_Index_Type of the entry. if Do_Range_Check (Index) then Generate_Range_Check (Index, S, CE_Range_Check_Failed); end if; Expr := Make_Op_Add (Sloc, Left_Opnd => Num, Right_Opnd => Family_Offset (Sloc, Make_Attribute_Reference (Sloc, Attribute_Name => Name_Pos, Prefix => New_Occurrence_Of (Base_Type (S), Sloc), Expressions => New_List (Relocate_Node (Index))), Type_Low_Bound (S), Ttyp, False)); else Expr := Num; end if; -- Now add lengths of preceding entries and entry families Prev := First_Entity (Ttyp); while Chars (Prev) /= Chars (Ent) or else (Ekind (Prev) /= Ekind (Ent)) or else not Sem_Ch6.Type_Conformant (Ent, Prev) loop if Ekind (Prev) = E_Entry then Set_Intval (Num, Intval (Num) + 1); elsif Ekind (Prev) = E_Entry_Family then S := Entry_Index_Type (Prev); Lo := Type_Low_Bound (S); Hi := Type_High_Bound (S); Expr := Make_Op_Add (Sloc, Left_Opnd => Expr, Right_Opnd => Family_Size (Sloc, Hi, Lo, Ttyp, False)); -- Other components are anonymous types to be ignored else null; end if; Next_Entity (Prev); end loop; return Expr; end Entry_Index_Expression; --------------------------- -- Establish_Task_Master -- --------------------------- procedure Establish_Task_Master (N : Node_Id) is Call : Node_Id; begin if Restriction_Active (No_Task_Hierarchy) = False then Call := Build_Runtime_Call (Sloc (N), RE_Enter_Master); -- The block may have no declarations (and nevertheless be a task -- master) if it contains a call that may return an object that -- contains tasks. if No (Declarations (N)) then Set_Declarations (N, New_List (Call)); else Prepend_To (Declarations (N), Call); end if; Analyze (Call); end if; end Establish_Task_Master; -------------------------------- -- Expand_Accept_Declarations -- -------------------------------- -- Part of the expansion of an accept statement involves the creation of -- a declaration that can be referenced from the statement sequence of -- the accept: -- Ann : Address; -- This declaration is inserted immediately before the accept statement -- and it is important that it be inserted before the statements of the -- statement sequence are analyzed. Thus it would be too late to create -- this declaration in the Expand_N_Accept_Statement routine, which is -- why there is a separate procedure to be called directly from Sem_Ch9. -- Ann is used to hold the address of the record containing the parameters -- (see Expand_N_Entry_Call for more details on how this record is built). -- References to the parameters do an unchecked conversion of this address -- to a pointer to the required record type, and then access the field that -- holds the value of the required parameter. The entity for the address -- variable is held as the top stack element (i.e. the last element) of the -- Accept_Address stack in the corresponding entry entity, and this element -- must be set in place before the statements are processed. -- The above description applies to the case of a stand alone accept -- statement, i.e. one not appearing as part of a select alternative. -- For the case of an accept that appears as part of a select alternative -- of a selective accept, we must still create the declaration right away, -- since Ann is needed immediately, but there is an important difference: -- The declaration is inserted before the selective accept, not before -- the accept statement (which is not part of a list anyway, and so would -- not accommodate inserted declarations) -- We only need one address variable for the entire selective accept. So -- the Ann declaration is created only for the first accept alternative, -- and subsequent accept alternatives reference the same Ann variable. -- We can distinguish the two cases by seeing whether the accept statement -- is part of a list. If not, then it must be in an accept alternative. -- To expand the requeue statement, a label is provided at the end of the -- accept statement or alternative of which it is a part, so that the -- statement can be skipped after the requeue is complete. This label is -- created here rather than during the expansion of the accept statement, -- because it will be needed by any requeue statements within the accept, -- which are expanded before the accept. procedure Expand_Accept_Declarations (N : Node_Id; Ent : Entity_Id) is Loc : constant Source_Ptr := Sloc (N); Stats : constant Node_Id := Handled_Statement_Sequence (N); Ann : Entity_Id := Empty; Adecl : Node_Id; Lab : Node_Id; Ldecl : Node_Id; Ldecl2 : Node_Id; begin if Expander_Active then -- If we have no handled statement sequence, we may need to build -- a dummy sequence consisting of a null statement. This can be -- skipped if the trivial accept optimization is permitted. if not Trivial_Accept_OK and then (No (Stats) or else Null_Statements (Statements (Stats))) then Set_Handled_Statement_Sequence (N, Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List (Make_Null_Statement (Loc)))); end if; -- Create and declare two labels to be placed at the end of the -- accept statement. The first label is used to allow requeues to -- skip the remainder of entry processing. The second label is used -- to skip the remainder of entry processing if the rendezvous -- completes in the middle of the accept body. if Present (Handled_Statement_Sequence (N)) then declare Ent : Entity_Id; begin Ent := Make_Temporary (Loc, 'L'); Lab := Make_Label (Loc, New_Occurrence_Of (Ent, Loc)); Ldecl := Make_Implicit_Label_Declaration (Loc, Defining_Identifier => Ent, Label_Construct => Lab); Append (Lab, Statements (Handled_Statement_Sequence (N))); Ent := Make_Temporary (Loc, 'L'); Lab := Make_Label (Loc, New_Occurrence_Of (Ent, Loc)); Ldecl2 := Make_Implicit_Label_Declaration (Loc, Defining_Identifier => Ent, Label_Construct => Lab); Append (Lab, Statements (Handled_Statement_Sequence (N))); end; else Ldecl := Empty; Ldecl2 := Empty; end if; -- Case of stand alone accept statement if Is_List_Member (N) then if Present (Handled_Statement_Sequence (N)) then Ann := Make_Temporary (Loc, 'A'); Adecl := Make_Object_Declaration (Loc, Defining_Identifier => Ann, Object_Definition => New_Occurrence_Of (RTE (RE_Address), Loc)); Insert_Before_And_Analyze (N, Adecl); Insert_Before_And_Analyze (N, Ldecl); Insert_Before_And_Analyze (N, Ldecl2); end if; -- Case of accept statement which is in an accept alternative else declare Acc_Alt : constant Node_Id := Parent (N); Sel_Acc : constant Node_Id := Parent (Acc_Alt); Alt : Node_Id; begin pragma Assert (Nkind (Acc_Alt) = N_Accept_Alternative); pragma Assert (Nkind (Sel_Acc) = N_Selective_Accept); -- ??? Consider a single label for select statements if Present (Handled_Statement_Sequence (N)) then Prepend (Ldecl2, Statements (Handled_Statement_Sequence (N))); Analyze (Ldecl2); Prepend (Ldecl, Statements (Handled_Statement_Sequence (N))); Analyze (Ldecl); end if; -- Find first accept alternative of the selective accept. A -- valid selective accept must have at least one accept in it. Alt := First (Select_Alternatives (Sel_Acc)); while Nkind (Alt) /= N_Accept_Alternative loop Next (Alt); end loop; -- If this is the first accept statement, then we have to -- create the Ann variable, as for the stand alone case, except -- that it is inserted before the selective accept. Similarly, -- a label for requeue expansion must be declared. if N = Accept_Statement (Alt) then Ann := Make_Temporary (Loc, 'A'); Adecl := Make_Object_Declaration (Loc, Defining_Identifier => Ann, Object_Definition => New_Occurrence_Of (RTE (RE_Address), Loc)); Insert_Before_And_Analyze (Sel_Acc, Adecl); -- If this is not the first accept statement, then find the Ann -- variable allocated by the first accept and use it. else Ann := Node (Last_Elmt (Accept_Address (Entity (Entry_Direct_Name (Accept_Statement (Alt)))))); end if; end; end if; -- Merge here with Ann either created or referenced, and Adecl -- pointing to the corresponding declaration. Remaining processing -- is the same for the two cases. if Present (Ann) then Append_Elmt (Ann, Accept_Address (Ent)); Set_Debug_Info_Needed (Ann); end if; -- Create renaming declarations for the entry formals. Each reference -- to a formal becomes a dereference of a component of the parameter -- block, whose address is held in Ann. These declarations are -- eventually inserted into the accept block, and analyzed there so -- that they have the proper scope for gdb and do not conflict with -- other declarations. if Present (Parameter_Specifications (N)) and then Present (Handled_Statement_Sequence (N)) then declare Comp : Entity_Id; Decl : Node_Id; Formal : Entity_Id; New_F : Entity_Id; Renamed_Formal : Node_Id; begin Push_Scope (Ent); Formal := First_Formal (Ent); while Present (Formal) loop Comp := Entry_Component (Formal); New_F := Make_Defining_Identifier (Loc, Chars (Formal)); Set_Etype (New_F, Etype (Formal)); Set_Scope (New_F, Ent); -- Now we set debug info needed on New_F even though it does -- not come from source, so that the debugger will get the -- right information for these generated names. Set_Debug_Info_Needed (New_F); if Ekind (Formal) = E_In_Parameter then Set_Ekind (New_F, E_Constant); else Set_Ekind (New_F, E_Variable); Set_Extra_Constrained (New_F, Extra_Constrained (Formal)); end if; Set_Actual_Subtype (New_F, Actual_Subtype (Formal)); Renamed_Formal := Make_Selected_Component (Loc, Prefix => Make_Explicit_Dereference (Loc, Unchecked_Convert_To ( Entry_Parameters_Type (Ent), New_Occurrence_Of (Ann, Loc))), Selector_Name => New_Occurrence_Of (Comp, Loc)); Decl := Build_Renamed_Formal_Declaration (New_F, Formal, Comp, Renamed_Formal); if No (Declarations (N)) then Set_Declarations (N, New_List); end if; Append (Decl, Declarations (N)); Set_Renamed_Object (Formal, New_F); Next_Formal (Formal); end loop; End_Scope; end; end if; end if; end Expand_Accept_Declarations; --------------------------------------------- -- Expand_Access_Protected_Subprogram_Type -- --------------------------------------------- procedure Expand_Access_Protected_Subprogram_Type (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); T : constant Entity_Id := Defining_Identifier (N); D_T : constant Entity_Id := Designated_Type (T); D_T2 : constant Entity_Id := Make_Temporary (Loc, 'D'); E_T : constant Entity_Id := Make_Temporary (Loc, 'E'); P_List : constant List_Id := Build_Protected_Spec (N, RTE (RE_Address), D_T, False); Comps : List_Id; Decl1 : Node_Id; Decl2 : Node_Id; Def1 : Node_Id; begin -- Create access to subprogram with full signature if Etype (D_T) /= Standard_Void_Type then Def1 := Make_Access_Function_Definition (Loc, Parameter_Specifications => P_List, Result_Definition => Copy_Result_Type (Result_Definition (Type_Definition (N)))); else Def1 := Make_Access_Procedure_Definition (Loc, Parameter_Specifications => P_List); end if; Decl1 := Make_Full_Type_Declaration (Loc, Defining_Identifier => D_T2, Type_Definition => Def1); -- Declare the new types before the original one since the latter will -- refer to them through the Equivalent_Type slot. Insert_Before_And_Analyze (N, Decl1); -- Associate the access to subprogram with its original access to -- protected subprogram type. Needed by the backend to know that this -- type corresponds with an access to protected subprogram type. Set_Original_Access_Type (D_T2, T); -- Create Equivalent_Type, a record with two components for an access to -- object and an access to subprogram. Comps := New_List ( Make_Component_Declaration (Loc, Defining_Identifier => Make_Temporary (Loc, 'P'), Component_Definition => Make_Component_Definition (Loc, Aliased_Present => False, Subtype_Indication => New_Occurrence_Of (RTE (RE_Address), Loc))), Make_Component_Declaration (Loc, Defining_Identifier => Make_Temporary (Loc, 'S'), Component_Definition => Make_Component_Definition (Loc, Aliased_Present => False, Subtype_Indication => New_Occurrence_Of (D_T2, Loc)))); Decl2 := Make_Full_Type_Declaration (Loc, Defining_Identifier => E_T, Type_Definition => Make_Record_Definition (Loc, Component_List => Make_Component_List (Loc, Component_Items => Comps))); Insert_Before_And_Analyze (N, Decl2); Set_Equivalent_Type (T, E_T); end Expand_Access_Protected_Subprogram_Type; -------------------------- -- Expand_Entry_Barrier -- -------------------------- procedure Expand_Entry_Barrier (N : Node_Id; Ent : Entity_Id) is Cond : constant Node_Id := Condition (Entry_Body_Formal_Part (N)); Prot : constant Entity_Id := Scope (Ent); Spec_Decl : constant Node_Id := Parent (Prot); Func_Id : Entity_Id := Empty; -- The entity of the barrier function function Is_Global_Entity (N : Node_Id) return Traverse_Result; -- Check whether entity in Barrier is external to protected type. -- If so, barrier may not be properly synchronized. function Is_Pure_Barrier (N : Node_Id) return Traverse_Result; -- Check whether N meets the Pure_Barriers restriction. Return OK if -- so. function Is_Simple_Barrier (N : Node_Id) return Boolean; -- Check whether N meets the Simple_Barriers restriction. Return OK if -- so. ---------------------- -- Is_Global_Entity -- ---------------------- function Is_Global_Entity (N : Node_Id) return Traverse_Result is E : Entity_Id; S : Entity_Id; begin if Is_Entity_Name (N) and then Present (Entity (N)) then E := Entity (N); S := Scope (E); if Ekind (E) = E_Variable then -- If the variable is local to the barrier function generated -- during expansion, it is ok. If expansion is not performed, -- then Func is Empty so this test cannot succeed. if Scope (E) = Func_Id then null; -- A protected call from a barrier to another object is ok elsif Ekind (Etype (E)) = E_Protected_Type then null; -- If the variable is within the package body we consider -- this safe. This is a common (if dubious) idiom. elsif S = Scope (Prot) and then Is_Package_Or_Generic_Package (S) and then Nkind (Parent (E)) = N_Object_Declaration and then Nkind (Parent (Parent (E))) = N_Package_Body then null; else Error_Msg_N ("potentially unsynchronized barrier??", N); Error_Msg_N ("\& should be private component of type??", N); end if; end if; end if; return OK; end Is_Global_Entity; procedure Check_Unprotected_Barrier is new Traverse_Proc (Is_Global_Entity); ----------------------- -- Is_Simple_Barrier -- ----------------------- function Is_Simple_Barrier (N : Node_Id) return Boolean is Renamed : Node_Id; begin if Is_Static_Expression (N) then return True; elsif Ada_Version >= Ada_2020 and then Nkind (N) in N_Selected_Component | N_Indexed_Component and then Statically_Names_Object (N) then -- Restriction relaxed in Ada2020 to allow statically named -- subcomponents. return Is_Simple_Barrier (Prefix (N)); end if; -- Check if the name is a component of the protected object. If -- the expander is active, the component has been transformed into a -- renaming of _object.all.component. Original_Node is needed in case -- validity checking is enabled, in which case the simple object -- reference will have been rewritten. if Expander_Active then -- The expanded name may have been constant folded in which case -- the original node is not necessarily an entity name (e.g. an -- indexed component). if not Is_Entity_Name (Original_Node (N)) then return False; end if; Renamed := Renamed_Object (Entity (Original_Node (N))); return Present (Renamed) and then Nkind (Renamed) = N_Selected_Component and then Chars (Prefix (Prefix (Renamed))) = Name_uObject; elsif not Is_Entity_Name (N) then return False; else return Is_Protected_Component (Entity (N)); end if; end Is_Simple_Barrier; --------------------- -- Is_Pure_Barrier -- --------------------- function Is_Pure_Barrier (N : Node_Id) return Traverse_Result is begin case Nkind (N) is when N_Expanded_Name | N_Identifier => -- Because of N_Expanded_Name case, return Skip instead of OK. if No (Entity (N)) then return Abandon; elsif Is_Numeric_Type (Entity (N)) then return Skip; end if; case Ekind (Entity (N)) is when E_Constant | E_Discriminant => return Skip; when E_Enumeration_Literal | E_Named_Integer | E_Named_Real => if not Is_OK_Static_Expression (N) then return Abandon; end if; return Skip; when E_Component => return Skip; when E_Variable => if Is_Simple_Barrier (N) then return Skip; end if; when E_Function => -- The count attribute has been transformed into run-time -- calls. if Is_RTE (Entity (N), RE_Protected_Count) or else Is_RTE (Entity (N), RE_Protected_Count_Entry) then return Skip; end if; when others => null; end case; when N_Function_Call => -- Function call checks are carried out as part of the analysis -- of the function call name. return OK; when N_Character_Literal | N_Integer_Literal | N_Real_Literal => return OK; when N_Op_Boolean | N_Op_Not => if Ekind (Entity (N)) = E_Operator then return OK; end if; when N_Short_Circuit | N_If_Expression | N_Case_Expression => return OK; when N_Indexed_Component | N_Selected_Component => if Statically_Names_Object (N) then return Is_Pure_Barrier (Prefix (N)); else return Abandon; end if; when N_Case_Expression_Alternative => -- do not traverse Discrete_Choices subtree if Is_Pure_Barrier (Expression (N)) /= Abandon then return Skip; end if; when N_Expression_With_Actions => -- this may occur in the case of a Count attribute reference if Original_Node (N) /= N and then Is_Pure_Barrier (Original_Node (N)) /= Abandon then return Skip; end if; when N_Membership_Test => if Is_Pure_Barrier (Left_Opnd (N)) /= Abandon and then All_Membership_Choices_Static (N) then return Skip; end if; when N_Type_Conversion => -- Conversions to Universal_Integer do not raise constraint -- errors. Likewise if the expression's type is statically -- compatible with the target's type. if Etype (N) = Universal_Integer or else Subtypes_Statically_Compatible (Etype (Expression (N)), Etype (N)) then return OK; end if; when N_Unchecked_Type_Conversion => return OK; when others => null; end case; return Abandon; end Is_Pure_Barrier; function Check_Pure_Barriers is new Traverse_Func (Is_Pure_Barrier); -- Local variables Cond_Id : Entity_Id; Entry_Body : Node_Id; Func_Body : Node_Id := Empty; -- Start of processing for Expand_Entry_Barrier begin if No_Run_Time_Mode then Error_Msg_CRT ("entry barrier", N); return; end if; -- Prevent cascaded errors if Nkind (Cond) = N_Error then return; end if; -- The body of the entry barrier must be analyzed in the context of the -- protected object, but its scope is external to it, just as any other -- unprotected version of a protected operation. The specification has -- been produced when the protected type declaration was elaborated. We -- build the body, insert it in the enclosing scope, but analyze it in -- the current context. A more uniform approach would be to treat the -- barrier just as a protected function, and discard the protected -- version of it because it is never called. if Expander_Active then Func_Body := Build_Barrier_Function (N, Ent, Prot); Func_Id := Barrier_Function (Ent); Set_Corresponding_Spec (Func_Body, Func_Id); Entry_Body := Parent (Corresponding_Body (Spec_Decl)); if Nkind (Parent (Entry_Body)) = N_Subunit then Entry_Body := Corresponding_Stub (Parent (Entry_Body)); end if; Insert_Before_And_Analyze (Entry_Body, Func_Body); Set_Discriminals (Spec_Decl); Set_Scope (Func_Id, Scope (Prot)); else Analyze_And_Resolve (Cond, Any_Boolean); end if; -- Check Simple_Barriers and Pure_Barriers restrictions. -- Note that it is safe to be calling Check_Restriction from here, even -- though this is part of the expander, since Expand_Entry_Barrier is -- called from Sem_Ch9 even in -gnatc mode. if not Is_Simple_Barrier (Cond) then -- flag restriction violation Check_Restriction (Simple_Barriers, Cond); end if; if Check_Pure_Barriers (Cond) = Abandon then -- flag restriction violation Check_Restriction (Pure_Barriers, Cond); -- Emit warning if barrier contains global entities and is thus -- potentially unsynchronized (if Pure_Barriers restrictions -- are met then no need to check for this). Check_Unprotected_Barrier (Cond); end if; if Is_Entity_Name (Cond) then Cond_Id := Entity (Cond); -- Perform a small optimization of simple barrier functions. If the -- scope of the condition's entity is not the barrier function, then -- the condition does not depend on any of the generated renamings. -- If this is the case, eliminate the renamings as they are useless. -- This optimization is not performed when the condition was folded -- and validity checks are in effect because the original condition -- may have produced at least one check that depends on the generated -- renamings. if Expander_Active and then Scope (Cond_Id) /= Func_Id and then not Validity_Check_Operands then Set_Declarations (Func_Body, Empty_List); end if; -- Note that after analysis variables in this context will be -- replaced by the corresponding prival, that is to say a renaming -- of a selected component of the form _Object.Var. If expansion is -- disabled, as within a generic, we check that the entity appears in -- the current scope. end if; end Expand_Entry_Barrier; ------------------------------ -- Expand_N_Abort_Statement -- ------------------------------ -- Expand abort T1, T2, .. Tn; into: -- Abort_Tasks (Task_List'(1 => T1.Task_Id, 2 => T2.Task_Id ...)) procedure Expand_N_Abort_Statement (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Tlist : constant List_Id := Names (N); Count : Nat; Aggr : Node_Id; Tasknm : Node_Id; begin Aggr := Make_Aggregate (Loc, Component_Associations => New_List); Count := 0; Tasknm := First (Tlist); while Present (Tasknm) loop Count := Count + 1; -- A task interface class-wide type object is being aborted. Retrieve -- its _task_id by calling a dispatching routine. if Ada_Version >= Ada_2005 and then Ekind (Etype (Tasknm)) = E_Class_Wide_Type and then Is_Interface (Etype (Tasknm)) and then Is_Task_Interface (Etype (Tasknm)) then Append_To (Component_Associations (Aggr), Make_Component_Association (Loc, Choices => New_List (Make_Integer_Literal (Loc, Count)), Expression => -- Task_Id (Tasknm._disp_get_task_id) Make_Unchecked_Type_Conversion (Loc, Subtype_Mark => New_Occurrence_Of (RTE (RO_ST_Task_Id), Loc), Expression => Make_Selected_Component (Loc, Prefix => New_Copy_Tree (Tasknm), Selector_Name => Make_Identifier (Loc, Name_uDisp_Get_Task_Id))))); else Append_To (Component_Associations (Aggr), Make_Component_Association (Loc, Choices => New_List (Make_Integer_Literal (Loc, Count)), Expression => Concurrent_Ref (Tasknm))); end if; Next (Tasknm); end loop; Rewrite (N, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Abort_Tasks), Loc), Parameter_Associations => New_List ( Make_Qualified_Expression (Loc, Subtype_Mark => New_Occurrence_Of (RTE (RE_Task_List), Loc), Expression => Aggr)))); Analyze (N); end Expand_N_Abort_Statement; ------------------------------- -- Expand_N_Accept_Statement -- ------------------------------- -- This procedure handles expansion of accept statements that stand alone, -- i.e. they are not part of an accept alternative. The expansion of -- accept statement in accept alternatives is handled by the routines -- Expand_N_Accept_Alternative and Expand_N_Selective_Accept. The -- following description applies only to stand alone accept statements. -- If there is no handled statement sequence, or only null statements, then -- this is called a trivial accept, and the expansion is: -- Accept_Trivial (entry-index) -- If there is a handled statement sequence, then the expansion is: -- Ann : Address; -- {Lnn : Label} -- begin -- begin -- Accept_Call (entry-index, Ann); -- Renaming_Declarations for formals -- <statement sequence from N_Accept_Statement node> -- Complete_Rendezvous; -- <<Lnn>> -- -- exception -- when ... => -- <exception handler from N_Accept_Statement node> -- Complete_Rendezvous; -- when ... => -- <exception handler from N_Accept_Statement node> -- Complete_Rendezvous; -- ... -- end; -- exception -- when all others => -- Exceptional_Complete_Rendezvous (Get_GNAT_Exception); -- end; -- The first three declarations were already inserted ahead of the accept -- statement by the Expand_Accept_Declarations procedure, which was called -- directly from the semantics during analysis of the accept statement, -- before analyzing its contained statements. -- The declarations from the N_Accept_Statement, as noted in Sinfo, come -- from possible expansion activity (the original source of course does -- not have any declarations associated with the accept statement, since -- an accept statement has no declarative part). In particular, if the -- expander is active, the first such declaration is the declaration of -- the Accept_Params_Ptr entity (see Sem_Ch9.Analyze_Accept_Statement). -- The two blocks are merged into a single block if the inner block has -- no exception handlers, but otherwise two blocks are required, since -- exceptions might be raised in the exception handlers of the inner -- block, and Exceptional_Complete_Rendezvous must be called. procedure Expand_N_Accept_Statement (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Stats : constant Node_Id := Handled_Statement_Sequence (N); Ename : constant Node_Id := Entry_Direct_Name (N); Eindx : constant Node_Id := Entry_Index (N); Eent : constant Entity_Id := Entity (Ename); Acstack : constant Elist_Id := Accept_Address (Eent); Ann : constant Entity_Id := Node (Last_Elmt (Acstack)); Ttyp : constant Entity_Id := Etype (Scope (Eent)); Blkent : Entity_Id; Call : Node_Id; Block : Node_Id; begin -- If the accept statement is not part of a list, then its parent must -- be an accept alternative, and, as described above, we do not do any -- expansion for such accept statements at this level. if not Is_List_Member (N) then pragma Assert (Nkind (Parent (N)) = N_Accept_Alternative); return; -- Trivial accept case (no statement sequence, or null statements). -- If the accept statement has declarations, then just insert them -- before the procedure call. elsif Trivial_Accept_OK and then (No (Stats) or else Null_Statements (Statements (Stats))) then -- Remove declarations for renamings, because the parameter block -- will not be assigned. declare D : Node_Id; Next_D : Node_Id; begin D := First (Declarations (N)); while Present (D) loop Next_D := Next (D); if Nkind (D) = N_Object_Renaming_Declaration then Remove (D); end if; D := Next_D; end loop; end; if Present (Declarations (N)) then Insert_Actions (N, Declarations (N)); end if; Rewrite (N, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Accept_Trivial), Loc), Parameter_Associations => New_List ( Entry_Index_Expression (Loc, Entity (Ename), Eindx, Ttyp)))); Analyze (N); -- Ada 2020 (AI12-0279) if Has_Yield_Aspect (Eent) and then RTE_Available (RE_Yield) then Insert_Action_After (N, Make_Procedure_Call_Statement (Loc, New_Occurrence_Of (RTE (RE_Yield), Loc))); end if; -- Discard Entry_Address that was created for it, so it will not be -- emitted if this accept statement is in the statement part of a -- delay alternative. if Present (Stats) then Remove_Last_Elmt (Acstack); end if; -- Case of statement sequence present else -- Construct the block, using the declarations from the accept -- statement if any to initialize the declarations of the block. Blkent := Make_Temporary (Loc, 'A'); Set_Ekind (Blkent, E_Block); Set_Etype (Blkent, Standard_Void_Type); Set_Scope (Blkent, Current_Scope); Block := Make_Block_Statement (Loc, Identifier => New_Occurrence_Of (Blkent, Loc), Declarations => Declarations (N), Handled_Statement_Sequence => Build_Accept_Body (N)); -- Reset the Scope of local entities associated with the accept -- statement (that currently reference the entry scope) to the -- block scope, to avoid having references to the locals treated -- as up-level references. Reset_Scopes_To (Block, Blkent); -- For the analysis of the generated declarations, the parent node -- must be properly set. Set_Parent (Block, Parent (N)); Set_Parent (Blkent, Block); -- Prepend call to Accept_Call to main statement sequence If the -- accept has exception handlers, the statement sequence is wrapped -- in a block. Insert call and renaming declarations in the -- declarations of the block, so they are elaborated before the -- handlers. Call := Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Accept_Call), Loc), Parameter_Associations => New_List ( Entry_Index_Expression (Loc, Entity (Ename), Eindx, Ttyp), New_Occurrence_Of (Ann, Loc))); if Parent (Stats) = N then Prepend (Call, Statements (Stats)); else Set_Declarations (Parent (Stats), New_List (Call)); end if; Analyze (Call); Push_Scope (Blkent); declare D : Node_Id; Next_D : Node_Id; Typ : Entity_Id; begin D := First (Declarations (N)); while Present (D) loop Next_D := Next (D); if Nkind (D) = N_Object_Renaming_Declaration then -- The renaming declarations for the formals were created -- during analysis of the accept statement, and attached to -- the list of declarations. Place them now in the context -- of the accept block or subprogram. Remove (D); Typ := Entity (Subtype_Mark (D)); Insert_After (Call, D); Analyze (D); -- If the formal is class_wide, it does not have an actual -- subtype. The analysis of the renaming declaration creates -- one, but we need to retain the class-wide nature of the -- entity. if Is_Class_Wide_Type (Typ) then Set_Etype (Defining_Identifier (D), Typ); end if; end if; D := Next_D; end loop; end; End_Scope; -- Replace the accept statement by the new block Rewrite (N, Block); Analyze (N); -- Last step is to unstack the Accept_Address value Remove_Last_Elmt (Acstack); end if; end Expand_N_Accept_Statement; ---------------------------------- -- Expand_N_Asynchronous_Select -- ---------------------------------- -- This procedure assumes that the trigger statement is an entry call or -- a dispatching procedure call. A delay alternative should already have -- been expanded into an entry call to the appropriate delay object Wait -- entry. -- If the trigger is a task entry call, the select is implemented with -- a Task_Entry_Call: -- declare -- B : Boolean; -- C : Boolean; -- P : parms := (parm, parm, parm); -- -- Clean is added by Exp_Ch7.Expand_Cleanup_Actions -- procedure _clean is -- begin -- ... -- Cancel_Task_Entry_Call (C); -- ... -- end _clean; -- begin -- Abort_Defer; -- Task_Entry_Call -- (<acceptor-task>, -- Acceptor -- <entry-index>, -- E -- P'Address, -- Uninterpreted_Data -- Asynchronous_Call, -- Mode -- B); -- Rendezvous_Successful -- begin -- begin -- Abort_Undefer; -- <abortable-part> -- at end -- _clean; -- Added by Exp_Ch7.Expand_Cleanup_Actions -- end; -- exception -- when Abort_Signal => Abort_Undefer; -- end; -- parm := P.param; -- parm := P.param; -- ... -- if not C then -- <triggered-statements> -- end if; -- end; -- Note that Build_Simple_Entry_Call is used to expand the entry of the -- asynchronous entry call (by Expand_N_Entry_Call_Statement procedure) -- as follows: -- declare -- P : parms := (parm, parm, parm); -- begin -- Call_Simple (acceptor-task, entry-index, P'Address); -- parm := P.param; -- parm := P.param; -- ... -- end; -- so the task at hand is to convert the latter expansion into the former -- If the trigger is a protected entry call, the select is implemented -- with Protected_Entry_Call: -- declare -- P : E1_Params := (param, param, param); -- Bnn : Communications_Block; -- begin -- declare -- -- Clean is added by Exp_Ch7.Expand_Cleanup_Actions -- procedure _clean is -- begin -- ... -- if Enqueued (Bnn) then -- Cancel_Protected_Entry_Call (Bnn); -- end if; -- ... -- end _clean; -- begin -- begin -- Protected_Entry_Call -- (po._object'Access, -- Object -- <entry index>, -- E -- P'Address, -- Uninterpreted_Data -- Asynchronous_Call, -- Mode -- Bnn); -- Block -- if Enqueued (Bnn) then -- <abortable-part> -- end if; -- at end -- _clean; -- Added by Exp_Ch7.Expand_Cleanup_Actions -- end; -- exception -- when Abort_Signal => Abort_Undefer; -- end; -- if not Cancelled (Bnn) then -- <triggered-statements> -- end if; -- end; -- Build_Simple_Entry_Call is used to expand the all to a simple protected -- entry call: -- declare -- P : E1_Params := (param, param, param); -- Bnn : Communications_Block; -- begin -- Protected_Entry_Call -- (po._object'Access, -- Object -- <entry index>, -- E -- P'Address, -- Uninterpreted_Data -- Simple_Call, -- Mode -- Bnn); -- Block -- parm := P.param; -- parm := P.param; -- ... -- end; -- Ada 2005 (AI-345): If the trigger is a dispatching call, the select is -- expanded into: -- declare -- B : Boolean := False; -- Bnn : Communication_Block; -- C : Ada.Tags.Prim_Op_Kind; -- D : System.Storage_Elements.Dummy_Communication_Block; -- K : Ada.Tags.Tagged_Kind := -- Ada.Tags.Get_Tagged_Kind (Ada.Tags.Tag (<object>)); -- P : Parameters := (Param1 .. ParamN); -- S : Integer; -- U : Boolean; -- begin -- if K = Ada.Tags.TK_Limited_Tagged -- or else K = Ada.Tags.TK_Tagged -- then -- <dispatching-call>; -- <triggering-statements>; -- else -- S := -- Ada.Tags.Get_Offset_Index -- (Ada.Tags.Tag (<object>), DT_Position (<dispatching-call>)); -- _Disp_Get_Prim_Op_Kind (<object>, S, C); -- if C = POK_Protected_Entry then -- declare -- procedure _clean is -- begin -- if Enqueued (Bnn) then -- Cancel_Protected_Entry_Call (Bnn); -- end if; -- end _clean; -- begin -- begin -- _Disp_Asynchronous_Select -- (<object>, S, P'Address, D, B); -- Bnn := Communication_Block (D); -- Param1 := P.Param1; -- ... -- ParamN := P.ParamN; -- if Enqueued (Bnn) then -- <abortable-statements> -- end if; -- at end -- _clean; -- Added by Exp_Ch7.Expand_Cleanup_Actions -- end; -- exception -- when Abort_Signal => Abort_Undefer; -- end; -- if not Cancelled (Bnn) then -- <triggering-statements> -- end if; -- elsif C = POK_Task_Entry then -- declare -- procedure _clean is -- begin -- Cancel_Task_Entry_Call (U); -- end _clean; -- begin -- Abort_Defer; -- _Disp_Asynchronous_Select -- (<object>, S, P'Address, D, B); -- Bnn := Communication_Bloc (D); -- Param1 := P.Param1; -- ... -- ParamN := P.ParamN; -- begin -- begin -- Abort_Undefer; -- <abortable-statements> -- at end -- _clean; -- Added by Exp_Ch7.Expand_Cleanup_Actions -- end; -- exception -- when Abort_Signal => Abort_Undefer; -- end; -- if not U then -- <triggering-statements> -- end if; -- end; -- else -- <dispatching-call>; -- <triggering-statements> -- end if; -- end if; -- end; -- The job is to convert this to the asynchronous form -- If the trigger is a delay statement, it will have been expanded into -- a call to one of the GNARL delay procedures. This routine will convert -- this into a protected entry call on a delay object and then continue -- processing as for a protected entry call trigger. This requires -- declaring a Delay_Block object and adding a pointer to this object to -- the parameter list of the delay procedure to form the parameter list of -- the entry call. This object is used by the runtime to queue the delay -- request. -- For a description of the use of P and the assignments after the call, -- see Expand_N_Entry_Call_Statement. procedure Expand_N_Asynchronous_Select (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Abrt : constant Node_Id := Abortable_Part (N); Trig : constant Node_Id := Triggering_Alternative (N); Abort_Block_Ent : Entity_Id; Abortable_Block : Node_Id; Actuals : List_Id; Astats : List_Id; Blk_Ent : constant Entity_Id := Make_Temporary (Loc, 'A'); Blk_Typ : Entity_Id; Call : Node_Id; Call_Ent : Entity_Id; Cancel_Param : Entity_Id; Cleanup_Block : Node_Id; Cleanup_Block_Ent : Entity_Id; Cleanup_Stmts : List_Id; Conc_Typ_Stmts : List_Id; Concval : Node_Id; Dblock_Ent : Entity_Id; Decl : Node_Id; Decls : List_Id; Ecall : Node_Id; Ename : Node_Id; Enqueue_Call : Node_Id; Formals : List_Id; Hdle : List_Id; Handler_Stmt : Node_Id; Index : Node_Id; Lim_Typ_Stmts : List_Id; N_Orig : Node_Id; Obj : Entity_Id; Param : Node_Id; Params : List_Id; Pdef : Entity_Id; ProtE_Stmts : List_Id; ProtP_Stmts : List_Id; Stmt : Node_Id; Stmts : List_Id; TaskE_Stmts : List_Id; Tstats : List_Id; B : Entity_Id; -- Call status flag Bnn : Entity_Id; -- Communication block C : Entity_Id; -- Call kind K : Entity_Id; -- Tagged kind P : Entity_Id; -- Parameter block S : Entity_Id; -- Primitive operation slot T : Entity_Id; -- Additional status flag procedure Rewrite_Abortable_Part; -- If the trigger is a dispatching call, the expansion inserts multiple -- copies of the abortable part. This is both inefficient, and may lead -- to duplicate definitions that the back-end will reject, when the -- abortable part includes loops. This procedure rewrites the abortable -- part into a call to a generated procedure. ---------------------------- -- Rewrite_Abortable_Part -- ---------------------------- procedure Rewrite_Abortable_Part is Proc : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uA); Decl : Node_Id; begin Decl := Make_Subprogram_Body (Loc, Specification => Make_Procedure_Specification (Loc, Defining_Unit_Name => Proc), Declarations => New_List, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Astats)); Insert_Before (N, Decl); Analyze (Decl); -- Rewrite abortable part into a call to this procedure Astats := New_List ( Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Proc, Loc))); end Rewrite_Abortable_Part; -- Start of processing for Expand_N_Asynchronous_Select begin -- Asynchronous select is not supported on restricted runtimes. Don't -- try to expand. if Restricted_Profile then return; end if; Process_Statements_For_Controlled_Objects (Trig); Process_Statements_For_Controlled_Objects (Abrt); Ecall := Triggering_Statement (Trig); Ensure_Statement_Present (Sloc (Ecall), Trig); -- Retrieve Astats and Tstats now because the finalization machinery may -- wrap them in blocks. Astats := Statements (Abrt); Tstats := Statements (Trig); -- The arguments in the call may require dynamic allocation, and the -- call statement may have been transformed into a block. The block -- may contain additional declarations for internal entities, and the -- original call is found by sequential search. if Nkind (Ecall) = N_Block_Statement then Ecall := First (Statements (Handled_Statement_Sequence (Ecall))); while Nkind (Ecall) not in N_Procedure_Call_Statement | N_Entry_Call_Statement loop Next (Ecall); end loop; end if; -- This is either a dispatching call or a delay statement used as a -- trigger which was expanded into a procedure call. if Nkind (Ecall) = N_Procedure_Call_Statement then if Ada_Version >= Ada_2005 and then (No (Original_Node (Ecall)) or else Nkind (Original_Node (Ecall)) not in N_Delay_Relative_Statement | N_Delay_Until_Statement) then Extract_Dispatching_Call (Ecall, Call_Ent, Obj, Actuals, Formals); Rewrite_Abortable_Part; Decls := New_List; Stmts := New_List; -- Call status flag processing, generate: -- B : Boolean := False; B := Build_B (Loc, Decls); -- Communication block processing, generate: -- Bnn : Communication_Block; Bnn := Make_Temporary (Loc, 'B'); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Bnn, Object_Definition => New_Occurrence_Of (RTE (RE_Communication_Block), Loc))); -- Call kind processing, generate: -- C : Ada.Tags.Prim_Op_Kind; C := Build_C (Loc, Decls); -- Tagged kind processing, generate: -- K : Ada.Tags.Tagged_Kind := -- Ada.Tags.Get_Tagged_Kind (Ada.Tags.Tag (<object>)); -- Dummy communication block, generate: -- D : Dummy_Communication_Block; Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uD), Object_Definition => New_Occurrence_Of (RTE (RE_Dummy_Communication_Block), Loc))); K := Build_K (Loc, Decls, Obj); -- Parameter block processing Blk_Typ := Build_Parameter_Block (Loc, Actuals, Formals, Decls); P := Parameter_Block_Pack (Loc, Blk_Typ, Actuals, Formals, Decls, Stmts); -- Dispatch table slot processing, generate: -- S : Integer; S := Build_S (Loc, Decls); -- Additional status flag processing, generate: -- Tnn : Boolean; T := Make_Temporary (Loc, 'T'); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => T, Object_Definition => New_Occurrence_Of (Standard_Boolean, Loc))); ------------------------------ -- Protected entry handling -- ------------------------------ -- Generate: -- Param1 := P.Param1; -- ... -- ParamN := P.ParamN; Cleanup_Stmts := Parameter_Block_Unpack (Loc, P, Actuals, Formals); -- Generate: -- Bnn := Communication_Block (D); Prepend_To (Cleanup_Stmts, Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Bnn, Loc), Expression => Make_Unchecked_Type_Conversion (Loc, Subtype_Mark => New_Occurrence_Of (RTE (RE_Communication_Block), Loc), Expression => Make_Identifier (Loc, Name_uD)))); -- Generate: -- _Disp_Asynchronous_Select (<object>, S, P'Address, D, B); Prepend_To (Cleanup_Stmts, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Find_Prim_Op (Etype (Etype (Obj)), Name_uDisp_Asynchronous_Select), Loc), Parameter_Associations => New_List ( New_Copy_Tree (Obj), -- <object> New_Occurrence_Of (S, Loc), -- S Make_Attribute_Reference (Loc, -- P'Address Prefix => New_Occurrence_Of (P, Loc), Attribute_Name => Name_Address), Make_Identifier (Loc, Name_uD), -- D New_Occurrence_Of (B, Loc)))); -- B -- Generate: -- if Enqueued (Bnn) then -- <abortable-statements> -- end if; Append_To (Cleanup_Stmts, Make_Implicit_If_Statement (N, Condition => Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Enqueued), Loc), Parameter_Associations => New_List (New_Occurrence_Of (Bnn, Loc))), Then_Statements => New_Copy_List_Tree (Astats))); -- Wrap the statements in a block. Exp_Ch7.Expand_Cleanup_Actions -- will then generate a _clean for the communication block Bnn. -- Generate: -- declare -- procedure _clean is -- begin -- if Enqueued (Bnn) then -- Cancel_Protected_Entry_Call (Bnn); -- end if; -- end _clean; -- begin -- Cleanup_Stmts -- at end -- _clean; -- end; Cleanup_Block_Ent := Make_Temporary (Loc, 'C'); Cleanup_Block := Build_Cleanup_Block (Loc, Cleanup_Block_Ent, Cleanup_Stmts, Bnn); -- Wrap the cleanup block in an exception handling block -- Generate: -- begin -- Cleanup_Block -- exception -- when Abort_Signal => Abort_Undefer; -- end; Abort_Block_Ent := Make_Temporary (Loc, 'A'); ProtE_Stmts := New_List ( Make_Implicit_Label_Declaration (Loc, Defining_Identifier => Abort_Block_Ent), Build_Abort_Block (Loc, Abort_Block_Ent, Cleanup_Block_Ent, Cleanup_Block)); -- Generate: -- if not Cancelled (Bnn) then -- <triggering-statements> -- end if; Append_To (ProtE_Stmts, Make_Implicit_If_Statement (N, Condition => Make_Op_Not (Loc, Right_Opnd => Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Cancelled), Loc), Parameter_Associations => New_List (New_Occurrence_Of (Bnn, Loc)))), Then_Statements => New_Copy_List_Tree (Tstats))); ------------------------- -- Task entry handling -- ------------------------- -- Generate: -- Param1 := P.Param1; -- ... -- ParamN := P.ParamN; TaskE_Stmts := Parameter_Block_Unpack (Loc, P, Actuals, Formals); -- Generate: -- Bnn := Communication_Block (D); Append_To (TaskE_Stmts, Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Bnn, Loc), Expression => Make_Unchecked_Type_Conversion (Loc, Subtype_Mark => New_Occurrence_Of (RTE (RE_Communication_Block), Loc), Expression => Make_Identifier (Loc, Name_uD)))); -- Generate: -- _Disp_Asynchronous_Select (<object>, S, P'Address, D, B); Prepend_To (TaskE_Stmts, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of ( Find_Prim_Op (Etype (Etype (Obj)), Name_uDisp_Asynchronous_Select), Loc), Parameter_Associations => New_List ( New_Copy_Tree (Obj), -- <object> New_Occurrence_Of (S, Loc), -- S Make_Attribute_Reference (Loc, -- P'Address Prefix => New_Occurrence_Of (P, Loc), Attribute_Name => Name_Address), Make_Identifier (Loc, Name_uD), -- D New_Occurrence_Of (B, Loc)))); -- B -- Generate: -- Abort_Defer; Prepend_To (TaskE_Stmts, Build_Runtime_Call (Loc, RE_Abort_Defer)); -- Generate: -- Abort_Undefer; -- <abortable-statements> Cleanup_Stmts := New_Copy_List_Tree (Astats); Prepend_To (Cleanup_Stmts, Build_Runtime_Call (Loc, RE_Abort_Undefer)); -- Wrap the statements in a block. Exp_Ch7.Expand_Cleanup_Actions -- will generate a _clean for the additional status flag. -- Generate: -- declare -- procedure _clean is -- begin -- Cancel_Task_Entry_Call (U); -- end _clean; -- begin -- Cleanup_Stmts -- at end -- _clean; -- end; Cleanup_Block_Ent := Make_Temporary (Loc, 'C'); Cleanup_Block := Build_Cleanup_Block (Loc, Cleanup_Block_Ent, Cleanup_Stmts, T); -- Wrap the cleanup block in an exception handling block -- Generate: -- begin -- Cleanup_Block -- exception -- when Abort_Signal => Abort_Undefer; -- end; Abort_Block_Ent := Make_Temporary (Loc, 'A'); Append_To (TaskE_Stmts, Make_Implicit_Label_Declaration (Loc, Defining_Identifier => Abort_Block_Ent)); Append_To (TaskE_Stmts, Build_Abort_Block (Loc, Abort_Block_Ent, Cleanup_Block_Ent, Cleanup_Block)); -- Generate: -- if not T then -- <triggering-statements> -- end if; Append_To (TaskE_Stmts, Make_Implicit_If_Statement (N, Condition => Make_Op_Not (Loc, Right_Opnd => New_Occurrence_Of (T, Loc)), Then_Statements => New_Copy_List_Tree (Tstats))); ---------------------------------- -- Protected procedure handling -- ---------------------------------- -- Generate: -- <dispatching-call>; -- <triggering-statements> ProtP_Stmts := New_Copy_List_Tree (Tstats); Prepend_To (ProtP_Stmts, New_Copy_Tree (Ecall)); -- Generate: -- S := Ada.Tags.Get_Offset_Index -- (Ada.Tags.Tag (<object>), DT_Position (Call_Ent)); Conc_Typ_Stmts := New_List (Build_S_Assignment (Loc, S, Obj, Call_Ent)); -- Generate: -- _Disp_Get_Prim_Op_Kind (<object>, S, C); Append_To (Conc_Typ_Stmts, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Find_Prim_Op (Etype (Etype (Obj)), Name_uDisp_Get_Prim_Op_Kind), Loc), Parameter_Associations => New_List ( New_Copy_Tree (Obj), New_Occurrence_Of (S, Loc), New_Occurrence_Of (C, Loc)))); -- Generate: -- if C = POK_Procedure_Entry then -- ProtE_Stmts -- elsif C = POK_Task_Entry then -- TaskE_Stmts -- else -- ProtP_Stmts -- end if; Append_To (Conc_Typ_Stmts, Make_Implicit_If_Statement (N, Condition => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (C, Loc), Right_Opnd => New_Occurrence_Of (RTE (RE_POK_Protected_Entry), Loc)), Then_Statements => ProtE_Stmts, Elsif_Parts => New_List ( Make_Elsif_Part (Loc, Condition => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (C, Loc), Right_Opnd => New_Occurrence_Of (RTE (RE_POK_Task_Entry), Loc)), Then_Statements => TaskE_Stmts)), Else_Statements => ProtP_Stmts)); -- Generate: -- <dispatching-call>; -- <triggering-statements> Lim_Typ_Stmts := New_Copy_List_Tree (Tstats); Prepend_To (Lim_Typ_Stmts, New_Copy_Tree (Ecall)); -- Generate: -- if K = Ada.Tags.TK_Limited_Tagged -- or else K = Ada.Tags.TK_Tagged -- then -- Lim_Typ_Stmts -- else -- Conc_Typ_Stmts -- end if; Append_To (Stmts, Make_Implicit_If_Statement (N, Condition => Build_Dispatching_Tag_Check (K, N), Then_Statements => Lim_Typ_Stmts, Else_Statements => Conc_Typ_Stmts)); Rewrite (N, Make_Block_Statement (Loc, Declarations => Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Stmts))); Analyze (N); return; -- Delay triggering statement processing else -- Add a Delay_Block object to the parameter list of the delay -- procedure to form the parameter list of the Wait entry call. Dblock_Ent := Make_Temporary (Loc, 'D'); Pdef := Entity (Name (Ecall)); if Is_RTE (Pdef, RO_CA_Delay_For) then Enqueue_Call := New_Occurrence_Of (RTE (RE_Enqueue_Duration), Loc); elsif Is_RTE (Pdef, RO_CA_Delay_Until) then Enqueue_Call := New_Occurrence_Of (RTE (RE_Enqueue_Calendar), Loc); else pragma Assert (Is_RTE (Pdef, RO_RT_Delay_Until)); Enqueue_Call := New_Occurrence_Of (RTE (RE_Enqueue_RT), Loc); end if; Append_To (Parameter_Associations (Ecall), Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Dblock_Ent, Loc), Attribute_Name => Name_Unchecked_Access)); -- Create the inner block to protect the abortable part Hdle := New_List (Build_Abort_Block_Handler (Loc)); Prepend_To (Astats, Build_Runtime_Call (Loc, RE_Abort_Undefer)); Abortable_Block := Make_Block_Statement (Loc, Identifier => New_Occurrence_Of (Blk_Ent, Loc), Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Astats), Has_Created_Identifier => True, Is_Asynchronous_Call_Block => True); -- Append call to if Enqueue (When, DB'Unchecked_Access) then Rewrite (Ecall, Make_Implicit_If_Statement (N, Condition => Make_Function_Call (Loc, Name => Enqueue_Call, Parameter_Associations => Parameter_Associations (Ecall)), Then_Statements => New_List (Make_Block_Statement (Loc, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List ( Make_Implicit_Label_Declaration (Loc, Defining_Identifier => Blk_Ent, Label_Construct => Abortable_Block), Abortable_Block), Exception_Handlers => Hdle))))); Stmts := New_List (Ecall); -- Construct statement sequence for new block Append_To (Stmts, Make_Implicit_If_Statement (N, Condition => Make_Function_Call (Loc, Name => New_Occurrence_Of ( RTE (RE_Timed_Out), Loc), Parameter_Associations => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Dblock_Ent, Loc), Attribute_Name => Name_Unchecked_Access))), Then_Statements => Tstats)); -- The result is the new block Set_Entry_Cancel_Parameter (Blk_Ent, Dblock_Ent); Rewrite (N, Make_Block_Statement (Loc, Declarations => New_List ( Make_Object_Declaration (Loc, Defining_Identifier => Dblock_Ent, Aliased_Present => True, Object_Definition => New_Occurrence_Of (RTE (RE_Delay_Block), Loc))), Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Stmts))); Analyze (N); return; end if; else N_Orig := N; end if; Extract_Entry (Ecall, Concval, Ename, Index); Build_Simple_Entry_Call (Ecall, Concval, Ename, Index); Stmts := Statements (Handled_Statement_Sequence (Ecall)); Decls := Declarations (Ecall); if Is_Protected_Type (Etype (Concval)) then -- Get the declarations of the block expanded from the entry call Decl := First (Decls); while Present (Decl) and then (Nkind (Decl) /= N_Object_Declaration or else not Is_RTE (Etype (Object_Definition (Decl)), RE_Communication_Block)) loop Next (Decl); end loop; pragma Assert (Present (Decl)); Cancel_Param := Defining_Identifier (Decl); -- Change the mode of the Protected_Entry_Call call -- Protected_Entry_Call ( -- Object => po._object'Access, -- E => <entry index>; -- Uninterpreted_Data => P'Address; -- Mode => Asynchronous_Call; -- Block => Bnn); -- Skip assignments to temporaries created for in-out parameters -- This makes unwarranted assumptions about the shape of the expanded -- tree for the call, and should be cleaned up ??? Stmt := First (Stmts); while Nkind (Stmt) /= N_Procedure_Call_Statement loop Next (Stmt); end loop; Call := Stmt; Param := First (Parameter_Associations (Call)); while Present (Param) and then not Is_RTE (Etype (Param), RE_Call_Modes) loop Next (Param); end loop; pragma Assert (Present (Param)); Rewrite (Param, New_Occurrence_Of (RTE (RE_Asynchronous_Call), Loc)); Analyze (Param); -- Append an if statement to execute the abortable part -- Generate: -- if Enqueued (Bnn) then Append_To (Stmts, Make_Implicit_If_Statement (N, Condition => Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Enqueued), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Cancel_Param, Loc))), Then_Statements => Astats)); Abortable_Block := Make_Block_Statement (Loc, Identifier => New_Occurrence_Of (Blk_Ent, Loc), Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Stmts), Has_Created_Identifier => True, Is_Asynchronous_Call_Block => True); -- Aborts are not deferred at beginning of exception handlers in -- ZCX mode. if ZCX_Exceptions then Handler_Stmt := Make_Null_Statement (Loc); else Handler_Stmt := Build_Runtime_Call (Loc, RE_Abort_Undefer); end if; Stmts := New_List ( Make_Block_Statement (Loc, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List ( Make_Implicit_Label_Declaration (Loc, Defining_Identifier => Blk_Ent, Label_Construct => Abortable_Block), Abortable_Block), -- exception Exception_Handlers => New_List ( Make_Implicit_Exception_Handler (Loc, -- when Abort_Signal => -- Abort_Undefer.all; Exception_Choices => New_List (New_Occurrence_Of (Stand.Abort_Signal, Loc)), Statements => New_List (Handler_Stmt))))), -- if not Cancelled (Bnn) then -- triggered statements -- end if; Make_Implicit_If_Statement (N, Condition => Make_Op_Not (Loc, Right_Opnd => Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Cancelled), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Cancel_Param, Loc)))), Then_Statements => Tstats)); -- Asynchronous task entry call else if No (Decls) then Decls := New_List; end if; B := Make_Defining_Identifier (Loc, Name_uB); -- Insert declaration of B in declarations of existing block Prepend_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => B, Object_Definition => New_Occurrence_Of (Standard_Boolean, Loc))); Cancel_Param := Make_Defining_Identifier (Loc, Name_uC); -- Insert the declaration of C in the declarations of the existing -- block. The variable is initialized to something (True or False, -- does not matter) to prevent CodePeer from complaining about a -- possible read of an uninitialized variable. Prepend_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Cancel_Param, Object_Definition => New_Occurrence_Of (Standard_Boolean, Loc), Expression => New_Occurrence_Of (Standard_False, Loc), Has_Init_Expression => True)); -- Remove and save the call to Call_Simple Stmt := First (Stmts); -- Skip assignments to temporaries created for in-out parameters. -- This makes unwarranted assumptions about the shape of the expanded -- tree for the call, and should be cleaned up ??? while Nkind (Stmt) /= N_Procedure_Call_Statement loop Next (Stmt); end loop; Call := Stmt; -- Create the inner block to protect the abortable part Hdle := New_List (Build_Abort_Block_Handler (Loc)); Prepend_To (Astats, Build_Runtime_Call (Loc, RE_Abort_Undefer)); Abortable_Block := Make_Block_Statement (Loc, Identifier => New_Occurrence_Of (Blk_Ent, Loc), Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Astats), Has_Created_Identifier => True, Is_Asynchronous_Call_Block => True); Insert_After (Call, Make_Block_Statement (Loc, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List ( Make_Implicit_Label_Declaration (Loc, Defining_Identifier => Blk_Ent, Label_Construct => Abortable_Block), Abortable_Block), Exception_Handlers => Hdle))); -- Create new call statement Params := Parameter_Associations (Call); Append_To (Params, New_Occurrence_Of (RTE (RE_Asynchronous_Call), Loc)); Append_To (Params, New_Occurrence_Of (B, Loc)); Rewrite (Call, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Task_Entry_Call), Loc), Parameter_Associations => Params)); -- Construct statement sequence for new block Append_To (Stmts, Make_Implicit_If_Statement (N, Condition => Make_Op_Not (Loc, New_Occurrence_Of (Cancel_Param, Loc)), Then_Statements => Tstats)); -- Protected the call against abort Prepend_To (Stmts, Build_Runtime_Call (Loc, RE_Abort_Defer)); end if; Set_Entry_Cancel_Parameter (Blk_Ent, Cancel_Param); -- The result is the new block Rewrite (N_Orig, Make_Block_Statement (Loc, Declarations => Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Stmts))); Analyze (N_Orig); end Expand_N_Asynchronous_Select; ------------------------------------- -- Expand_N_Conditional_Entry_Call -- ------------------------------------- -- The conditional task entry call is converted to a call to -- Task_Entry_Call: -- declare -- B : Boolean; -- P : parms := (parm, parm, parm); -- begin -- Task_Entry_Call -- (<acceptor-task>, -- Acceptor -- <entry-index>, -- E -- P'Address, -- Uninterpreted_Data -- Conditional_Call, -- Mode -- B); -- Rendezvous_Successful -- parm := P.param; -- parm := P.param; -- ... -- if B then -- normal-statements -- else -- else-statements -- end if; -- end; -- For a description of the use of P and the assignments after the call, -- see Expand_N_Entry_Call_Statement. Note that the entry call of the -- conditional entry call has already been expanded (by the Expand_N_Entry -- _Call_Statement procedure) as follows: -- declare -- P : parms := (parm, parm, parm); -- begin -- ... info for in-out parameters -- Call_Simple (acceptor-task, entry-index, P'Address); -- parm := P.param; -- parm := P.param; -- ... -- end; -- so the task at hand is to convert the latter expansion into the former -- The conditional protected entry call is converted to a call to -- Protected_Entry_Call: -- declare -- P : parms := (parm, parm, parm); -- Bnn : Communications_Block; -- begin -- Protected_Entry_Call -- (po._object'Access, -- Object -- <entry index>, -- E -- P'Address, -- Uninterpreted_Data -- Conditional_Call, -- Mode -- Bnn); -- Block -- parm := P.param; -- parm := P.param; -- ... -- if Cancelled (Bnn) then -- else-statements -- else -- normal-statements -- end if; -- end; -- Ada 2005 (AI-345): A dispatching conditional entry call is converted -- into: -- declare -- B : Boolean := False; -- C : Ada.Tags.Prim_Op_Kind; -- K : Ada.Tags.Tagged_Kind := -- Ada.Tags.Get_Tagged_Kind (Ada.Tags.Tag (<object>)); -- P : Parameters := (Param1 .. ParamN); -- S : Integer; -- begin -- if K = Ada.Tags.TK_Limited_Tagged -- or else K = Ada.Tags.TK_Tagged -- then -- <dispatching-call>; -- <triggering-statements> -- else -- S := -- Ada.Tags.Get_Offset_Index -- (Ada.Tags.Tag (<object>), DT_Position (<dispatching-call>)); -- _Disp_Conditional_Select (<object>, S, P'Address, C, B); -- if C = POK_Protected_Entry -- or else C = POK_Task_Entry -- then -- Param1 := P.Param1; -- ... -- ParamN := P.ParamN; -- end if; -- if B then -- if C = POK_Procedure -- or else C = POK_Protected_Procedure -- or else C = POK_Task_Procedure -- then -- <dispatching-call>; -- end if; -- <triggering-statements> -- else -- <else-statements> -- end if; -- end if; -- end; procedure Expand_N_Conditional_Entry_Call (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Alt : constant Node_Id := Entry_Call_Alternative (N); Blk : Node_Id := Entry_Call_Statement (Alt); Actuals : List_Id; Blk_Typ : Entity_Id; Call : Node_Id; Call_Ent : Entity_Id; Conc_Typ_Stmts : List_Id; Decl : Node_Id; Decls : List_Id; Formals : List_Id; Lim_Typ_Stmts : List_Id; N_Stats : List_Id; Obj : Entity_Id; Param : Node_Id; Params : List_Id; Stmt : Node_Id; Stmts : List_Id; Transient_Blk : Node_Id; Unpack : List_Id; B : Entity_Id; -- Call status flag C : Entity_Id; -- Call kind K : Entity_Id; -- Tagged kind P : Entity_Id; -- Parameter block S : Entity_Id; -- Primitive operation slot begin Process_Statements_For_Controlled_Objects (N); if Ada_Version >= Ada_2005 and then Nkind (Blk) = N_Procedure_Call_Statement then Extract_Dispatching_Call (Blk, Call_Ent, Obj, Actuals, Formals); Decls := New_List; Stmts := New_List; -- Call status flag processing, generate: -- B : Boolean := False; B := Build_B (Loc, Decls); -- Call kind processing, generate: -- C : Ada.Tags.Prim_Op_Kind; C := Build_C (Loc, Decls); -- Tagged kind processing, generate: -- K : Ada.Tags.Tagged_Kind := -- Ada.Tags.Get_Tagged_Kind (Ada.Tags.Tag (<object>)); K := Build_K (Loc, Decls, Obj); -- Parameter block processing Blk_Typ := Build_Parameter_Block (Loc, Actuals, Formals, Decls); P := Parameter_Block_Pack (Loc, Blk_Typ, Actuals, Formals, Decls, Stmts); -- Dispatch table slot processing, generate: -- S : Integer; S := Build_S (Loc, Decls); -- Generate: -- S := Ada.Tags.Get_Offset_Index -- (Ada.Tags.Tag (<object>), DT_Position (Call_Ent)); Conc_Typ_Stmts := New_List (Build_S_Assignment (Loc, S, Obj, Call_Ent)); -- Generate: -- _Disp_Conditional_Select (<object>, S, P'Address, C, B); Append_To (Conc_Typ_Stmts, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of ( Find_Prim_Op (Etype (Etype (Obj)), Name_uDisp_Conditional_Select), Loc), Parameter_Associations => New_List ( New_Copy_Tree (Obj), -- <object> New_Occurrence_Of (S, Loc), -- S Make_Attribute_Reference (Loc, -- P'Address Prefix => New_Occurrence_Of (P, Loc), Attribute_Name => Name_Address), New_Occurrence_Of (C, Loc), -- C New_Occurrence_Of (B, Loc)))); -- B -- Generate: -- if C = POK_Protected_Entry -- or else C = POK_Task_Entry -- then -- Param1 := P.Param1; -- ... -- ParamN := P.ParamN; -- end if; Unpack := Parameter_Block_Unpack (Loc, P, Actuals, Formals); -- Generate the if statement only when the packed parameters need -- explicit assignments to their corresponding actuals. if Present (Unpack) then Append_To (Conc_Typ_Stmts, Make_Implicit_If_Statement (N, Condition => Make_Or_Else (Loc, Left_Opnd => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (C, Loc), Right_Opnd => New_Occurrence_Of (RTE ( RE_POK_Protected_Entry), Loc)), Right_Opnd => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (C, Loc), Right_Opnd => New_Occurrence_Of (RTE (RE_POK_Task_Entry), Loc))), Then_Statements => Unpack)); end if; -- Generate: -- if B then -- if C = POK_Procedure -- or else C = POK_Protected_Procedure -- or else C = POK_Task_Procedure -- then -- <dispatching-call> -- end if; -- <normal-statements> -- else -- <else-statements> -- end if; N_Stats := New_Copy_Separate_List (Statements (Alt)); Prepend_To (N_Stats, Make_Implicit_If_Statement (N, Condition => Make_Or_Else (Loc, Left_Opnd => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (C, Loc), Right_Opnd => New_Occurrence_Of (RTE (RE_POK_Procedure), Loc)), Right_Opnd => Make_Or_Else (Loc, Left_Opnd => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (C, Loc), Right_Opnd => New_Occurrence_Of (RTE ( RE_POK_Protected_Procedure), Loc)), Right_Opnd => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (C, Loc), Right_Opnd => New_Occurrence_Of (RTE ( RE_POK_Task_Procedure), Loc)))), Then_Statements => New_List (Blk))); Append_To (Conc_Typ_Stmts, Make_Implicit_If_Statement (N, Condition => New_Occurrence_Of (B, Loc), Then_Statements => N_Stats, Else_Statements => Else_Statements (N))); -- Generate: -- <dispatching-call>; -- <triggering-statements> Lim_Typ_Stmts := New_Copy_Separate_List (Statements (Alt)); Prepend_To (Lim_Typ_Stmts, New_Copy_Tree (Blk)); -- Generate: -- if K = Ada.Tags.TK_Limited_Tagged -- or else K = Ada.Tags.TK_Tagged -- then -- Lim_Typ_Stmts -- else -- Conc_Typ_Stmts -- end if; Append_To (Stmts, Make_Implicit_If_Statement (N, Condition => Build_Dispatching_Tag_Check (K, N), Then_Statements => Lim_Typ_Stmts, Else_Statements => Conc_Typ_Stmts)); Rewrite (N, Make_Block_Statement (Loc, Declarations => Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Stmts))); -- As described above, the entry alternative is transformed into a -- block that contains the gnulli call, and possibly assignment -- statements for in-out parameters. The gnulli call may itself be -- rewritten into a transient block if some unconstrained parameters -- require it. We need to retrieve the call to complete its parameter -- list. else Transient_Blk := First_Real_Statement (Handled_Statement_Sequence (Blk)); if Present (Transient_Blk) and then Nkind (Transient_Blk) = N_Block_Statement then Blk := Transient_Blk; end if; Stmts := Statements (Handled_Statement_Sequence (Blk)); Stmt := First (Stmts); while Nkind (Stmt) /= N_Procedure_Call_Statement loop Next (Stmt); end loop; Call := Stmt; Params := Parameter_Associations (Call); if Is_RTE (Entity (Name (Call)), RE_Protected_Entry_Call) then -- Substitute Conditional_Entry_Call for Simple_Call parameter Param := First (Params); while Present (Param) and then not Is_RTE (Etype (Param), RE_Call_Modes) loop Next (Param); end loop; pragma Assert (Present (Param)); Rewrite (Param, New_Occurrence_Of (RTE (RE_Conditional_Call), Loc)); Analyze (Param); -- Find the Communication_Block parameter for the call to the -- Cancelled function. Decl := First (Declarations (Blk)); while Present (Decl) and then not Is_RTE (Etype (Object_Definition (Decl)), RE_Communication_Block) loop Next (Decl); end loop; -- Add an if statement to execute the else part if the call -- does not succeed (as indicated by the Cancelled predicate). Append_To (Stmts, Make_Implicit_If_Statement (N, Condition => Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Cancelled), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Defining_Identifier (Decl), Loc))), Then_Statements => Else_Statements (N), Else_Statements => Statements (Alt))); else B := Make_Defining_Identifier (Loc, Name_uB); -- Insert declaration of B in declarations of existing block if No (Declarations (Blk)) then Set_Declarations (Blk, New_List); end if; Prepend_To (Declarations (Blk), Make_Object_Declaration (Loc, Defining_Identifier => B, Object_Definition => New_Occurrence_Of (Standard_Boolean, Loc))); -- Create new call statement Append_To (Params, New_Occurrence_Of (RTE (RE_Conditional_Call), Loc)); Append_To (Params, New_Occurrence_Of (B, Loc)); Rewrite (Call, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Task_Entry_Call), Loc), Parameter_Associations => Params)); -- Construct statement sequence for new block Append_To (Stmts, Make_Implicit_If_Statement (N, Condition => New_Occurrence_Of (B, Loc), Then_Statements => Statements (Alt), Else_Statements => Else_Statements (N))); end if; -- The result is the new block Rewrite (N, Make_Block_Statement (Loc, Declarations => Declarations (Blk), Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Stmts))); end if; Analyze (N); Reset_Scopes_To (N, Entity (Identifier (N))); end Expand_N_Conditional_Entry_Call; --------------------------------------- -- Expand_N_Delay_Relative_Statement -- --------------------------------------- -- Delay statement is implemented as a procedure call to Delay_For -- defined in Ada.Calendar.Delays in order to reduce the overhead of -- simple delays imposed by the use of Protected Objects. procedure Expand_N_Delay_Relative_Statement (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Proc : Entity_Id; begin -- Try to use Ada.Calendar.Delays.Delay_For if available. if RTE_Available (RO_CA_Delay_For) then Proc := RTE (RO_CA_Delay_For); -- Otherwise, use System.Relative_Delays.Delay_For and emit an error -- message if not available. This is the implementation used on -- restricted platforms when Ada.Calendar is not available. else Proc := RTE (RO_RD_Delay_For); end if; Rewrite (N, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Proc, Loc), Parameter_Associations => New_List (Expression (N)))); Analyze (N); end Expand_N_Delay_Relative_Statement; ------------------------------------ -- Expand_N_Delay_Until_Statement -- ------------------------------------ -- Delay Until statement is implemented as a procedure call to -- Delay_Until defined in Ada.Calendar.Delays and Ada.Real_Time.Delays. procedure Expand_N_Delay_Until_Statement (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Typ : Entity_Id; begin if Is_RTE (Base_Type (Etype (Expression (N))), RO_CA_Time) then Typ := RTE (RO_CA_Delay_Until); else Typ := RTE (RO_RT_Delay_Until); end if; Rewrite (N, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Typ, Loc), Parameter_Associations => New_List (Expression (N)))); Analyze (N); end Expand_N_Delay_Until_Statement; ------------------------- -- Expand_N_Entry_Body -- ------------------------- procedure Expand_N_Entry_Body (N : Node_Id) is begin -- Associate discriminals with the next protected operation body to be -- expanded. if Present (Next_Protected_Operation (N)) then Set_Discriminals (Parent (Current_Scope)); end if; end Expand_N_Entry_Body; ----------------------------------- -- Expand_N_Entry_Call_Statement -- ----------------------------------- -- An entry call is expanded into GNARLI calls to implement a simple entry -- call (see Build_Simple_Entry_Call). procedure Expand_N_Entry_Call_Statement (N : Node_Id) is Concval : Node_Id; Ename : Node_Id; Index : Node_Id; begin if No_Run_Time_Mode then Error_Msg_CRT ("entry call", N); return; end if; -- If this entry call is part of an asynchronous select, don't expand it -- here; it will be expanded with the select statement. Don't expand -- timed entry calls either, as they are translated into asynchronous -- entry calls. -- ??? This whole approach is questionable; it may be better to go back -- to allowing the expansion to take place and then attempting to fix it -- up in Expand_N_Asynchronous_Select. The tricky part is figuring out -- whether the expanded call is on a task or protected entry. if (Nkind (Parent (N)) /= N_Triggering_Alternative or else N /= Triggering_Statement (Parent (N))) and then (Nkind (Parent (N)) /= N_Entry_Call_Alternative or else N /= Entry_Call_Statement (Parent (N)) or else Nkind (Parent (Parent (N))) /= N_Timed_Entry_Call) then Extract_Entry (N, Concval, Ename, Index); Build_Simple_Entry_Call (N, Concval, Ename, Index); end if; end Expand_N_Entry_Call_Statement; -------------------------------- -- Expand_N_Entry_Declaration -- -------------------------------- -- If there are parameters, then first, each of the formals is marked by -- setting Is_Entry_Formal. Next a record type is built which is used to -- hold the parameter values. The name of this record type is entryP where -- entry is the name of the entry, with an additional corresponding access -- type called entryPA. The record type has matching components for each -- formal (the component names are the same as the formal names). For -- elementary types, the component type matches the formal type. For -- composite types, an access type is declared (with the name formalA) -- which designates the formal type, and the type of the component is this -- access type. Finally the Entry_Component of each formal is set to -- reference the corresponding record component. procedure Expand_N_Entry_Declaration (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Entry_Ent : constant Entity_Id := Defining_Identifier (N); Components : List_Id; Formal : Node_Id; Ftype : Entity_Id; Last_Decl : Node_Id; Component : Entity_Id; Ctype : Entity_Id; Decl : Node_Id; Rec_Ent : Entity_Id; Acc_Ent : Entity_Id; begin Formal := First_Formal (Entry_Ent); Last_Decl := N; -- Most processing is done only if parameters are present if Present (Formal) then Components := New_List; -- Loop through formals while Present (Formal) loop Set_Is_Entry_Formal (Formal); Component := Make_Defining_Identifier (Sloc (Formal), Chars (Formal)); Set_Entry_Component (Formal, Component); Set_Entry_Formal (Component, Formal); Ftype := Etype (Formal); -- Declare new access type and then append Ctype := Make_Temporary (Loc, 'A'); Set_Is_Param_Block_Component_Type (Ctype); Decl := Make_Full_Type_Declaration (Loc, Defining_Identifier => Ctype, Type_Definition => Make_Access_To_Object_Definition (Loc, All_Present => True, Constant_Present => Ekind (Formal) = E_In_Parameter, Subtype_Indication => New_Occurrence_Of (Ftype, Loc))); Insert_After (Last_Decl, Decl); Last_Decl := Decl; Append_To (Components, Make_Component_Declaration (Loc, Defining_Identifier => Component, Component_Definition => Make_Component_Definition (Loc, Aliased_Present => False, Subtype_Indication => New_Occurrence_Of (Ctype, Loc)))); Next_Formal_With_Extras (Formal); end loop; -- Create the Entry_Parameter_Record declaration Rec_Ent := Make_Temporary (Loc, 'P'); Decl := Make_Full_Type_Declaration (Loc, Defining_Identifier => Rec_Ent, Type_Definition => Make_Record_Definition (Loc, Component_List => Make_Component_List (Loc, Component_Items => Components))); Insert_After (Last_Decl, Decl); Last_Decl := Decl; -- Construct and link in the corresponding access type Acc_Ent := Make_Temporary (Loc, 'A'); Set_Entry_Parameters_Type (Entry_Ent, Acc_Ent); Decl := Make_Full_Type_Declaration (Loc, Defining_Identifier => Acc_Ent, Type_Definition => Make_Access_To_Object_Definition (Loc, All_Present => True, Subtype_Indication => New_Occurrence_Of (Rec_Ent, Loc))); Insert_After (Last_Decl, Decl); end if; end Expand_N_Entry_Declaration; ----------------------------- -- Expand_N_Protected_Body -- ----------------------------- -- Protected bodies are expanded to the completion of the subprograms -- created for the corresponding protected type. These are a protected and -- unprotected version of each protected subprogram in the object, a -- function to calculate each entry barrier, and a procedure to execute the -- sequence of statements of each protected entry body. For example, for -- protected type ptype: -- function entB -- (O : System.Address; -- E : Protected_Entry_Index) -- return Boolean -- is -- <discriminant renamings> -- <private object renamings> -- begin -- return <barrier expression>; -- end entB; -- procedure pprocN (_object : in out poV;...) is -- <discriminant renamings> -- <private object renamings> -- begin -- <sequence of statements> -- end pprocN; -- procedure pprocP (_object : in out poV;...) is -- procedure _clean is -- Pn : Boolean; -- begin -- ptypeS (_object, Pn); -- Unlock (_object._object'Access); -- Abort_Undefer.all; -- end _clean; -- begin -- Abort_Defer.all; -- Lock (_object._object'Access); -- pprocN (_object;...); -- at end -- _clean; -- end pproc; -- function pfuncN (_object : poV;...) return Return_Type is -- <discriminant renamings> -- <private object renamings> -- begin -- <sequence of statements> -- end pfuncN; -- function pfuncP (_object : poV) return Return_Type is -- procedure _clean is -- begin -- Unlock (_object._object'Access); -- Abort_Undefer.all; -- end _clean; -- begin -- Abort_Defer.all; -- Lock (_object._object'Access); -- return pfuncN (_object); -- at end -- _clean; -- end pfunc; -- procedure entE -- (O : System.Address; -- P : System.Address; -- E : Protected_Entry_Index) -- is -- <discriminant renamings> -- <private object renamings> -- type poVP is access poV; -- _Object : ptVP := ptVP!(O); -- begin -- begin -- <statement sequence> -- Complete_Entry_Body (_Object._Object); -- exception -- when all others => -- Exceptional_Complete_Entry_Body ( -- _Object._Object, Get_GNAT_Exception); -- end; -- end entE; -- The type poV is the record created for the protected type to hold -- the state of the protected object. procedure Expand_N_Protected_Body (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Pid : constant Entity_Id := Corresponding_Spec (N); Lock_Free_Active : constant Boolean := Uses_Lock_Free (Pid); -- This flag indicates whether the lock free implementation is active Current_Node : Node_Id; Disp_Op_Body : Node_Id; New_Op_Body : Node_Id; Op_Body : Node_Id; Op_Decl : Node_Id; Op_Id : Entity_Id; function Build_Dispatching_Subprogram_Body (N : Node_Id; Pid : Node_Id; Prot_Bod : Node_Id) return Node_Id; -- Build a dispatching version of the protected subprogram body. The -- newly generated subprogram contains a call to the original protected -- body. The following code is generated: -- -- function <protected-function-name> (Param1 .. ParamN) return -- <return-type> is -- begin -- return <protected-function-name>P (Param1 .. ParamN); -- end <protected-function-name>; -- -- or -- -- procedure <protected-procedure-name> (Param1 .. ParamN) is -- begin -- <protected-procedure-name>P (Param1 .. ParamN); -- end <protected-procedure-name> --------------------------------------- -- Build_Dispatching_Subprogram_Body -- --------------------------------------- function Build_Dispatching_Subprogram_Body (N : Node_Id; Pid : Node_Id; Prot_Bod : Node_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (N); Actuals : List_Id; Formal : Node_Id; Spec : Node_Id; Stmts : List_Id; begin -- Generate a specification without a letter suffix in order to -- override an interface function or procedure. Spec := Build_Protected_Sub_Specification (N, Pid, Dispatching_Mode); -- The formal parameters become the actuals of the protected function -- or procedure call. Actuals := New_List; Formal := First (Parameter_Specifications (Spec)); while Present (Formal) loop Append_To (Actuals, Make_Identifier (Loc, Chars (Defining_Identifier (Formal)))); Next (Formal); end loop; if Nkind (Spec) = N_Procedure_Specification then Stmts := New_List ( Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Corresponding_Spec (Prot_Bod), Loc), Parameter_Associations => Actuals)); else pragma Assert (Nkind (Spec) = N_Function_Specification); Stmts := New_List ( Make_Simple_Return_Statement (Loc, Expression => Make_Function_Call (Loc, Name => New_Occurrence_Of (Corresponding_Spec (Prot_Bod), Loc), Parameter_Associations => Actuals))); end if; return Make_Subprogram_Body (Loc, Declarations => Empty_List, Specification => Spec, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Stmts)); end Build_Dispatching_Subprogram_Body; -- Start of processing for Expand_N_Protected_Body begin if No_Run_Time_Mode then Error_Msg_CRT ("protected body", N); return; end if; -- This is the proper body corresponding to a stub. The declarations -- must be inserted at the point of the stub, which in turn is in the -- declarative part of the parent unit. if Nkind (Parent (N)) = N_Subunit then Current_Node := Corresponding_Stub (Parent (N)); else Current_Node := N; end if; Op_Body := First (Declarations (N)); -- The protected body is replaced with the bodies of its protected -- operations, and the declarations for internal objects that may -- have been created for entry family bounds. Rewrite (N, Make_Null_Statement (Sloc (N))); Analyze (N); while Present (Op_Body) loop case Nkind (Op_Body) is when N_Subprogram_Declaration => null; when N_Subprogram_Body => -- Do not create bodies for eliminated operations if not Is_Eliminated (Defining_Entity (Op_Body)) and then not Is_Eliminated (Corresponding_Spec (Op_Body)) then if Lock_Free_Active then New_Op_Body := Build_Lock_Free_Unprotected_Subprogram_Body (Op_Body, Pid); else New_Op_Body := Build_Unprotected_Subprogram_Body (Op_Body, Pid); end if; Insert_After (Current_Node, New_Op_Body); Current_Node := New_Op_Body; Analyze (New_Op_Body); -- When the original protected body has nested subprograms, -- the new body also has them, so set the flag accordingly -- and reset the scopes of the top-level nested subprograms -- and other declaration entities so that they now refer to -- the new body's entity. (It would preferable to do this -- within Build_Protected_Sub_Specification, which is called -- from Build_Unprotected_Subprogram_Body, but the needed -- subprogram entity isn't available via Corresponding_Spec -- until after the above Analyze call.) if Has_Nested_Subprogram (Corresponding_Spec (Op_Body)) then Set_Has_Nested_Subprogram (Corresponding_Spec (New_Op_Body)); Reset_Scopes_To (New_Op_Body, Corresponding_Spec (New_Op_Body)); end if; -- Build the corresponding protected operation. This is -- needed only if this is a public or private operation of -- the type. -- Why do we need to test for Corresponding_Spec being -- present here when it's assumed to be set further above -- in the Is_Eliminated test??? if Present (Corresponding_Spec (Op_Body)) then Op_Decl := Unit_Declaration_Node (Corresponding_Spec (Op_Body)); if Nkind (Parent (Op_Decl)) = N_Protected_Definition then if Lock_Free_Active then New_Op_Body := Build_Lock_Free_Protected_Subprogram_Body (Op_Body, Pid, Specification (New_Op_Body)); else New_Op_Body := Build_Protected_Subprogram_Body ( Op_Body, Pid, Specification (New_Op_Body)); end if; Insert_After (Current_Node, New_Op_Body); Analyze (New_Op_Body); Current_Node := New_Op_Body; -- Generate an overriding primitive operation body for -- this subprogram if the protected type implements -- an interface. if Ada_Version >= Ada_2005 and then Present (Interfaces ( Corresponding_Record_Type (Pid))) then Disp_Op_Body := Build_Dispatching_Subprogram_Body ( Op_Body, Pid, New_Op_Body); Insert_After (Current_Node, Disp_Op_Body); Analyze (Disp_Op_Body); Current_Node := Disp_Op_Body; end if; end if; end if; end if; when N_Entry_Body => Op_Id := Defining_Identifier (Op_Body); New_Op_Body := Build_Protected_Entry (Op_Body, Op_Id, Pid); Insert_After (Current_Node, New_Op_Body); Current_Node := New_Op_Body; Analyze (New_Op_Body); when N_Implicit_Label_Declaration => null; when N_Call_Marker | N_Itype_Reference => New_Op_Body := New_Copy (Op_Body); Insert_After (Current_Node, New_Op_Body); Current_Node := New_Op_Body; when N_Freeze_Entity => New_Op_Body := New_Copy (Op_Body); if Present (Entity (Op_Body)) and then Freeze_Node (Entity (Op_Body)) = Op_Body then Set_Freeze_Node (Entity (Op_Body), New_Op_Body); end if; Insert_After (Current_Node, New_Op_Body); Current_Node := New_Op_Body; Analyze (New_Op_Body); when N_Pragma => New_Op_Body := New_Copy (Op_Body); Insert_After (Current_Node, New_Op_Body); Current_Node := New_Op_Body; Analyze (New_Op_Body); when N_Object_Declaration => pragma Assert (not Comes_From_Source (Op_Body)); New_Op_Body := New_Copy (Op_Body); Insert_After (Current_Node, New_Op_Body); Current_Node := New_Op_Body; Analyze (New_Op_Body); when others => raise Program_Error; end case; Next (Op_Body); end loop; -- Finally, create the body of the function that maps an entry index -- into the corresponding body index, except when there is no entry, or -- in a Ravenscar-like profile. if Corresponding_Runtime_Package (Pid) = System_Tasking_Protected_Objects_Entries then New_Op_Body := Build_Find_Body_Index (Pid); Insert_After (Current_Node, New_Op_Body); Current_Node := New_Op_Body; Analyze (New_Op_Body); end if; -- Ada 2005 (AI-345): Construct the primitive wrapper bodies after the -- protected body. At this point all wrapper specs have been created, -- frozen and included in the dispatch table for the protected type. if Ada_Version >= Ada_2005 then Build_Wrapper_Bodies (Loc, Pid, Current_Node); end if; end Expand_N_Protected_Body; ----------------------------------------- -- Expand_N_Protected_Type_Declaration -- ----------------------------------------- -- First we create a corresponding record type declaration used to -- represent values of this protected type. -- The general form of this type declaration is -- type poV (discriminants) is record -- _Object : aliased <kind>Protection -- [(<entry count> [, <handler count>])]; -- [entry_family : array (bounds) of Void;] -- <private data fields> -- end record; -- The discriminants are present only if the corresponding protected type -- has discriminants, and they exactly mirror the protected type -- discriminants. The private data fields similarly mirror the private -- declarations of the protected type. -- The Object field is always present. It contains RTS specific data used -- to control the protected object. It is declared as Aliased so that it -- can be passed as a pointer to the RTS. This allows the protected record -- to be referenced within RTS data structures. An appropriate Protection -- type and discriminant are generated. -- The Service field is present for protected objects with entries. It -- contains sufficient information to allow the entry service procedure for -- this object to be called when the object is not known till runtime. -- One entry_family component is present for each entry family in the -- task definition (see Expand_N_Task_Type_Declaration). -- When a protected object is declared, an instance of the protected type -- value record is created. The elaboration of this declaration creates the -- correct bounds for the entry families, and also evaluates the priority -- expression if needed. The initialization routine for the protected type -- itself then calls Initialize_Protection with appropriate parameters to -- initialize the value of the Task_Id field. Install_Handlers may be also -- called if a pragma Attach_Handler applies. -- Note: this record is passed to the subprograms created by the expansion -- of protected subprograms and entries. It is an in parameter to protected -- functions and an in out parameter to procedures and entry bodies. The -- Entity_Id for this created record type is placed in the -- Corresponding_Record_Type field of the associated protected type entity. -- Next we create a procedure specifications for protected subprograms and -- entry bodies. For each protected subprograms two subprograms are -- created, an unprotected and a protected version. The unprotected version -- is called from within other operations of the same protected object. -- We also build the call to register the procedure if a pragma -- Interrupt_Handler applies. -- A single subprogram is created to service all entry bodies; it has an -- additional boolean out parameter indicating that the previous entry call -- made by the current task was serviced immediately, i.e. not by proxy. -- The O parameter contains a pointer to a record object of the type -- described above. An untyped interface is used here to allow this -- procedure to be called in places where the type of the object to be -- serviced is not known. This must be done, for example, when a call that -- may have been requeued is cancelled; the corresponding object must be -- serviced, but which object that is not known till runtime. -- procedure ptypeS -- (O : System.Address; P : out Boolean); -- procedure pprocN (_object : in out poV); -- procedure pproc (_object : in out poV); -- function pfuncN (_object : poV); -- function pfunc (_object : poV); -- ... -- Note that this must come after the record type declaration, since -- the specs refer to this type. procedure Expand_N_Protected_Type_Declaration (N : Node_Id) is Discr_Map : constant Elist_Id := New_Elmt_List; Loc : constant Source_Ptr := Sloc (N); Prot_Typ : constant Entity_Id := Defining_Identifier (N); Lock_Free_Active : constant Boolean := Uses_Lock_Free (Prot_Typ); -- This flag indicates whether the lock free implementation is active Pdef : constant Node_Id := Protected_Definition (N); -- This contains two lists; one for visible and one for private decls Current_Node : Node_Id := N; E_Count : Int; Entries_Aggr : Node_Id; Rec_Decl : Node_Id; Rec_Id : Entity_Id; procedure Check_Inlining (Subp : Entity_Id); -- If the original operation has a pragma Inline, propagate the flag -- to the internal body, for possible inlining later on. The source -- operation is invisible to the back-end and is never actually called. procedure Expand_Entry_Declaration (Decl : Node_Id); -- Create the entry barrier and the procedure body for entry declaration -- Decl. All generated subprograms are added to Entry_Bodies_Array. function Static_Component_Size (Comp : Entity_Id) return Boolean; -- When compiling under the Ravenscar profile, private components must -- have a static size, or else a protected object will require heap -- allocation, violating the corresponding restriction. It is preferable -- to make this check here, because it provides a better error message -- than the back-end, which refers to the object as a whole. procedure Register_Handler; -- For a protected operation that is an interrupt handler, add the -- freeze action that will register it as such. procedure Replace_Access_Definition (Comp : Node_Id); -- If a private component of the type is an access to itself, this -- is not a reference to the current instance, but an access type out -- of which one might construct a list. If such a component exists, we -- create an incomplete type for the equivalent record type, and -- a named access type for it, that replaces the access definition -- of the original component. This is similar to what is done for -- records in Check_Anonymous_Access_Components, but simpler, because -- the corresponding record type has no previous declaration. -- This needs to be done only once, even if there are several such -- access components. The following entity stores the constructed -- access type. Acc_T : Entity_Id := Empty; -------------------- -- Check_Inlining -- -------------------- procedure Check_Inlining (Subp : Entity_Id) is begin if Is_Inlined (Subp) then Set_Is_Inlined (Protected_Body_Subprogram (Subp)); Set_Is_Inlined (Subp, False); end if; if Has_Pragma_No_Inline (Subp) then Set_Has_Pragma_No_Inline (Protected_Body_Subprogram (Subp)); end if; end Check_Inlining; --------------------------- -- Static_Component_Size -- --------------------------- function Static_Component_Size (Comp : Entity_Id) return Boolean is Typ : constant Entity_Id := Etype (Comp); C : Entity_Id; begin if Is_Scalar_Type (Typ) then return True; elsif Is_Array_Type (Typ) then return Compile_Time_Known_Bounds (Typ); elsif Is_Record_Type (Typ) then C := First_Component (Typ); while Present (C) loop if not Static_Component_Size (C) then return False; end if; Next_Component (C); end loop; return True; -- Any other type will be checked by the back-end else return True; end if; end Static_Component_Size; ------------------------------ -- Expand_Entry_Declaration -- ------------------------------ procedure Expand_Entry_Declaration (Decl : Node_Id) is Ent_Id : constant Entity_Id := Defining_Entity (Decl); Bar_Id : Entity_Id; Bod_Id : Entity_Id; Subp : Node_Id; begin E_Count := E_Count + 1; -- Create the protected body subprogram Bod_Id := Make_Defining_Identifier (Loc, Chars => Build_Selected_Name (Prot_Typ, Ent_Id, 'E')); Set_Protected_Body_Subprogram (Ent_Id, Bod_Id); Subp := Make_Subprogram_Declaration (Loc, Specification => Build_Protected_Entry_Specification (Loc, Bod_Id, Ent_Id)); Insert_After (Current_Node, Subp); Current_Node := Subp; Analyze (Subp); -- Build a wrapper procedure to handle contract cases, preconditions, -- and postconditions. Build_Contract_Wrapper (Ent_Id, N); -- Create the barrier function Bar_Id := Make_Defining_Identifier (Loc, Chars => Build_Selected_Name (Prot_Typ, Ent_Id, 'B')); Set_Barrier_Function (Ent_Id, Bar_Id); Subp := Make_Subprogram_Declaration (Loc, Specification => Build_Barrier_Function_Specification (Loc, Bar_Id)); Set_Is_Entry_Barrier_Function (Subp); Insert_After (Current_Node, Subp); Current_Node := Subp; Analyze (Subp); Set_Protected_Body_Subprogram (Bar_Id, Bar_Id); Set_Scope (Bar_Id, Scope (Ent_Id)); -- Collect pointers to the protected subprogram and the barrier -- of the current entry, for insertion into Entry_Bodies_Array. Append_To (Expressions (Entries_Aggr), Make_Aggregate (Loc, Expressions => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Bar_Id, Loc), Attribute_Name => Name_Unrestricted_Access), Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Bod_Id, Loc), Attribute_Name => Name_Unrestricted_Access)))); end Expand_Entry_Declaration; ---------------------- -- Register_Handler -- ---------------------- procedure Register_Handler is -- All semantic checks already done in Sem_Prag Prot_Proc : constant Entity_Id := Defining_Unit_Name (Specification (Current_Node)); Proc_Address : constant Node_Id := Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Prot_Proc, Loc), Attribute_Name => Name_Address); RTS_Call : constant Entity_Id := Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Register_Interrupt_Handler), Loc), Parameter_Associations => New_List (Proc_Address)); begin Append_Freeze_Action (Prot_Proc, RTS_Call); end Register_Handler; ------------------------------- -- Replace_Access_Definition -- ------------------------------- procedure Replace_Access_Definition (Comp : Node_Id) is Loc : constant Source_Ptr := Sloc (Comp); Inc_T : Node_Id; Inc_D : Node_Id; Acc_Def : Node_Id; Acc_D : Node_Id; begin if No (Acc_T) then Inc_T := Make_Defining_Identifier (Loc, Chars (Rec_Id)); Inc_D := Make_Incomplete_Type_Declaration (Loc, Inc_T); Acc_T := Make_Temporary (Loc, 'S'); Acc_Def := Make_Access_To_Object_Definition (Loc, Subtype_Indication => New_Occurrence_Of (Inc_T, Loc)); Acc_D := Make_Full_Type_Declaration (Loc, Defining_Identifier => Acc_T, Type_Definition => Acc_Def); Insert_Before (Rec_Decl, Inc_D); Analyze (Inc_D); Insert_Before (Rec_Decl, Acc_D); Analyze (Acc_D); end if; Set_Access_Definition (Comp, Empty); Set_Subtype_Indication (Comp, New_Occurrence_Of (Acc_T, Loc)); end Replace_Access_Definition; -- Local variables Body_Arr : Node_Id; Body_Id : Entity_Id; Cdecls : List_Id; Comp : Node_Id; Expr : Node_Id; New_Priv : Node_Id; Obj_Def : Node_Id; Object_Comp : Node_Id; Priv : Node_Id; Sub : Node_Id; -- Start of processing for Expand_N_Protected_Type_Declaration begin if Present (Corresponding_Record_Type (Prot_Typ)) then return; else Rec_Decl := Build_Corresponding_Record (N, Prot_Typ, Loc); Rec_Id := Defining_Identifier (Rec_Decl); end if; Cdecls := Component_Items (Component_List (Type_Definition (Rec_Decl))); Qualify_Entity_Names (N); -- If the type has discriminants, their occurrences in the declaration -- have been replaced by the corresponding discriminals. For components -- that are constrained by discriminants, their homologues in the -- corresponding record type must refer to the discriminants of that -- record, so we must apply a new renaming to subtypes_indications: -- protected discriminant => discriminal => record discriminant -- This replacement is not applied to default expressions, for which -- the discriminal is correct. if Has_Discriminants (Prot_Typ) then declare Disc : Entity_Id; Decl : Node_Id; begin Disc := First_Discriminant (Prot_Typ); Decl := First (Discriminant_Specifications (Rec_Decl)); while Present (Disc) loop Append_Elmt (Discriminal (Disc), Discr_Map); Append_Elmt (Defining_Identifier (Decl), Discr_Map); Next_Discriminant (Disc); Next (Decl); end loop; end; end if; -- Fill in the component declarations -- Add components for entry families. For each entry family, create an -- anonymous type declaration with the same size, and analyze the type. Collect_Entry_Families (Loc, Cdecls, Current_Node, Prot_Typ); pragma Assert (Present (Pdef)); Insert_After (Current_Node, Rec_Decl); Current_Node := Rec_Decl; -- Add private field components if Present (Private_Declarations (Pdef)) then Priv := First (Private_Declarations (Pdef)); while Present (Priv) loop if Nkind (Priv) = N_Component_Declaration then if not Static_Component_Size (Defining_Identifier (Priv)) then -- When compiling for a restricted profile, the private -- components must have a static size. If not, this is an -- error for a single protected declaration, and rates a -- warning on a protected type declaration. if not Comes_From_Source (Prot_Typ) then -- It's ok to be checking this restriction at expansion -- time, because this is only for the restricted profile, -- which is not subject to strict RM conformance, so it -- is OK to miss this check in -gnatc mode. Check_Restriction (No_Implicit_Heap_Allocations, Priv); Check_Restriction (No_Implicit_Protected_Object_Allocations, Priv); elsif Restriction_Active (No_Implicit_Heap_Allocations) then if not Discriminated_Size (Defining_Identifier (Priv)) then -- Any object of the type will be non-static Error_Msg_N ("component has non-static size??", Priv); Error_Msg_NE ("\creation of protected object of type& will " & "violate restriction " & "No_Implicit_Heap_Allocations??", Priv, Prot_Typ); else -- Object will be non-static if discriminants are Error_Msg_NE ("creation of protected object of type& with " & "non-static discriminants will violate " & "restriction No_Implicit_Heap_Allocations??", Priv, Prot_Typ); end if; -- Likewise for No_Implicit_Protected_Object_Allocations elsif Restriction_Active (No_Implicit_Protected_Object_Allocations) then if not Discriminated_Size (Defining_Identifier (Priv)) then -- Any object of the type will be non-static Error_Msg_N ("component has non-static size??", Priv); Error_Msg_NE ("\creation of protected object of type& will " & "violate restriction " & "No_Implicit_Protected_Object_Allocations??", Priv, Prot_Typ); else -- Object will be non-static if discriminants are Error_Msg_NE ("creation of protected object of type& with " & "non-static discriminants will violate " & "restriction " & "No_Implicit_Protected_Object_Allocations??", Priv, Prot_Typ); end if; end if; end if; -- The component definition consists of a subtype indication, -- or (in Ada 2005) an access definition. Make a copy of the -- proper definition. declare Old_Comp : constant Node_Id := Component_Definition (Priv); Oent : constant Entity_Id := Defining_Identifier (Priv); Nent : constant Entity_Id := Make_Defining_Identifier (Sloc (Oent), Chars => Chars (Oent)); New_Comp : Node_Id; begin if Present (Subtype_Indication (Old_Comp)) then New_Comp := Make_Component_Definition (Sloc (Oent), Aliased_Present => False, Subtype_Indication => New_Copy_Tree (Subtype_Indication (Old_Comp), Discr_Map)); else New_Comp := Make_Component_Definition (Sloc (Oent), Aliased_Present => False, Access_Definition => New_Copy_Tree (Access_Definition (Old_Comp), Discr_Map)); -- A self-reference in the private part becomes a -- self-reference to the corresponding record. if Entity (Subtype_Mark (Access_Definition (New_Comp))) = Prot_Typ then Replace_Access_Definition (New_Comp); end if; end if; New_Priv := Make_Component_Declaration (Loc, Defining_Identifier => Nent, Component_Definition => New_Comp, Expression => Expression (Priv)); Set_Has_Per_Object_Constraint (Nent, Has_Per_Object_Constraint (Oent)); Append_To (Cdecls, New_Priv); end; elsif Nkind (Priv) = N_Subprogram_Declaration then -- Make the unprotected version of the subprogram available -- for expansion of intra object calls. There is need for -- a protected version only if the subprogram is an interrupt -- handler, otherwise this operation can only be called from -- within the body. Sub := Make_Subprogram_Declaration (Loc, Specification => Build_Protected_Sub_Specification (Priv, Prot_Typ, Unprotected_Mode)); Insert_After (Current_Node, Sub); Analyze (Sub); Set_Protected_Body_Subprogram (Defining_Unit_Name (Specification (Priv)), Defining_Unit_Name (Specification (Sub))); Check_Inlining (Defining_Unit_Name (Specification (Priv))); Current_Node := Sub; Sub := Make_Subprogram_Declaration (Loc, Specification => Build_Protected_Sub_Specification (Priv, Prot_Typ, Protected_Mode)); Insert_After (Current_Node, Sub); Analyze (Sub); Current_Node := Sub; if Is_Interrupt_Handler (Defining_Unit_Name (Specification (Priv))) then if not Restricted_Profile then Register_Handler; end if; end if; end if; Next (Priv); end loop; end if; -- Except for the lock-free implementation, append the _Object field -- with the right type to the component list. We need to compute the -- number of entries, and in some cases the number of Attach_Handler -- pragmas. if not Lock_Free_Active then declare Entry_Count_Expr : constant Node_Id := Build_Entry_Count_Expression (Prot_Typ, Cdecls, Loc); Num_Attach_Handler : Nat := 0; Protection_Subtype : Node_Id; Ritem : Node_Id; begin if Has_Attach_Handler (Prot_Typ) then Ritem := First_Rep_Item (Prot_Typ); while Present (Ritem) loop if Nkind (Ritem) = N_Pragma and then Pragma_Name (Ritem) = Name_Attach_Handler then Num_Attach_Handler := Num_Attach_Handler + 1; end if; Next_Rep_Item (Ritem); end loop; end if; -- Determine the proper protection type. There are two special -- cases: 1) when the protected type has dynamic interrupt -- handlers, and 2) when it has static handlers and we use a -- restricted profile. if Has_Attach_Handler (Prot_Typ) and then not Restricted_Profile then Protection_Subtype := Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (RTE (RE_Static_Interrupt_Protection), Loc), Constraint => Make_Index_Or_Discriminant_Constraint (Loc, Constraints => New_List ( Entry_Count_Expr, Make_Integer_Literal (Loc, Num_Attach_Handler)))); elsif Has_Interrupt_Handler (Prot_Typ) and then not Restriction_Active (No_Dynamic_Attachment) then Protection_Subtype := Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (RTE (RE_Dynamic_Interrupt_Protection), Loc), Constraint => Make_Index_Or_Discriminant_Constraint (Loc, Constraints => New_List (Entry_Count_Expr))); else case Corresponding_Runtime_Package (Prot_Typ) is when System_Tasking_Protected_Objects_Entries => Protection_Subtype := Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (RTE (RE_Protection_Entries), Loc), Constraint => Make_Index_Or_Discriminant_Constraint (Loc, Constraints => New_List (Entry_Count_Expr))); when System_Tasking_Protected_Objects_Single_Entry => Protection_Subtype := New_Occurrence_Of (RTE (RE_Protection_Entry), Loc); when System_Tasking_Protected_Objects => Protection_Subtype := New_Occurrence_Of (RTE (RE_Protection), Loc); when others => raise Program_Error; end case; end if; Object_Comp := Make_Component_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uObject), Component_Definition => Make_Component_Definition (Loc, Aliased_Present => True, Subtype_Indication => Protection_Subtype)); end; -- Put the _Object component after the private component so that it -- be finalized early as required by 9.4 (20) Append_To (Cdecls, Object_Comp); end if; -- Analyze the record declaration immediately after construction, -- because the initialization procedure is needed for single object -- declarations before the next entity is analyzed (the freeze call -- that generates this initialization procedure is found below). Analyze (Rec_Decl, Suppress => All_Checks); -- Ada 2005 (AI-345): Construct the primitive entry wrappers before -- the corresponding record is frozen. If any wrappers are generated, -- Current_Node is updated accordingly. if Ada_Version >= Ada_2005 then Build_Wrapper_Specs (Loc, Prot_Typ, Current_Node); end if; -- Collect pointers to entry bodies and their barriers, to be placed -- in the Entry_Bodies_Array for the type. For each entry/family we -- add an expression to the aggregate which is the initial value of -- this array. The array is declared after all protected subprograms. if Has_Entries (Prot_Typ) then Entries_Aggr := Make_Aggregate (Loc, Expressions => New_List); else Entries_Aggr := Empty; end if; -- Build two new procedure specifications for each protected subprogram; -- one to call from outside the object and one to call from inside. -- Build a barrier function and an entry body action procedure -- specification for each protected entry. Initialize the entry body -- array. If subprogram is flagged as eliminated, do not generate any -- internal operations. E_Count := 0; Comp := First (Visible_Declarations (Pdef)); while Present (Comp) loop if Nkind (Comp) = N_Subprogram_Declaration then Sub := Make_Subprogram_Declaration (Loc, Specification => Build_Protected_Sub_Specification (Comp, Prot_Typ, Unprotected_Mode)); Insert_After (Current_Node, Sub); Analyze (Sub); Set_Protected_Body_Subprogram (Defining_Unit_Name (Specification (Comp)), Defining_Unit_Name (Specification (Sub))); Check_Inlining (Defining_Unit_Name (Specification (Comp))); -- Make the protected version of the subprogram available for -- expansion of external calls. Current_Node := Sub; Sub := Make_Subprogram_Declaration (Loc, Specification => Build_Protected_Sub_Specification (Comp, Prot_Typ, Protected_Mode)); Insert_After (Current_Node, Sub); Analyze (Sub); Current_Node := Sub; -- Generate an overriding primitive operation specification for -- this subprogram if the protected type implements an interface -- and Build_Wrapper_Spec did not generate its wrapper. if Ada_Version >= Ada_2005 and then Present (Interfaces (Corresponding_Record_Type (Prot_Typ))) then declare Found : Boolean := False; Prim_Elmt : Elmt_Id; Prim_Op : Node_Id; begin Prim_Elmt := First_Elmt (Primitive_Operations (Corresponding_Record_Type (Prot_Typ))); while Present (Prim_Elmt) loop Prim_Op := Node (Prim_Elmt); if Is_Primitive_Wrapper (Prim_Op) and then Wrapped_Entity (Prim_Op) = Defining_Entity (Specification (Comp)) then Found := True; exit; end if; Next_Elmt (Prim_Elmt); end loop; if not Found then Sub := Make_Subprogram_Declaration (Loc, Specification => Build_Protected_Sub_Specification (Comp, Prot_Typ, Dispatching_Mode)); Insert_After (Current_Node, Sub); Analyze (Sub); Current_Node := Sub; end if; end; end if; -- If a pragma Interrupt_Handler applies, build and add a call to -- Register_Interrupt_Handler to the freezing actions of the -- protected version (Current_Node) of the subprogram: -- system.interrupts.register_interrupt_handler -- (prot_procP'address); if not Restricted_Profile and then Is_Interrupt_Handler (Defining_Unit_Name (Specification (Comp))) then Register_Handler; end if; elsif Nkind (Comp) = N_Entry_Declaration then Expand_Entry_Declaration (Comp); end if; Next (Comp); end loop; -- If there are some private entry declarations, expand it as if they -- were visible entries. if Present (Private_Declarations (Pdef)) then Comp := First (Private_Declarations (Pdef)); while Present (Comp) loop if Nkind (Comp) = N_Entry_Declaration then Expand_Entry_Declaration (Comp); end if; Next (Comp); end loop; end if; -- Create the declaration of an array object which contains the values -- of aspect/pragma Max_Queue_Length for all entries of the protected -- type. This object is later passed to the appropriate protected object -- initialization routine. if Has_Entries (Prot_Typ) and then Corresponding_Runtime_Package (Prot_Typ) = System_Tasking_Protected_Objects_Entries then declare Count : Int; Item : Entity_Id; Max_Vals : Node_Id; Maxes : List_Id; Maxes_Id : Entity_Id; Need_Array : Boolean := False; begin -- First check if there is any Max_Queue_Length pragma Item := First_Entity (Prot_Typ); while Present (Item) loop if Is_Entry (Item) and then Has_Max_Queue_Length (Item) then Need_Array := True; exit; end if; Next_Entity (Item); end loop; -- Gather the Max_Queue_Length values of all entries in a list. A -- value of zero indicates that the entry has no limitation on its -- queue length. if Need_Array then Count := 0; Item := First_Entity (Prot_Typ); Maxes := New_List; while Present (Item) loop if Is_Entry (Item) then Count := Count + 1; Append_To (Maxes, Make_Integer_Literal (Loc, Get_Max_Queue_Length (Item))); end if; Next_Entity (Item); end loop; -- Create the declaration of the array object. Generate: -- Maxes_Id : aliased constant -- Protected_Entry_Queue_Max_Array -- (1 .. Count) := (..., ...); Maxes_Id := Make_Defining_Identifier (Loc, Chars => New_External_Name (Chars (Prot_Typ), 'B')); Max_Vals := Make_Object_Declaration (Loc, Defining_Identifier => Maxes_Id, Aliased_Present => True, Constant_Present => True, Object_Definition => Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (RTE (RE_Protected_Entry_Queue_Max_Array), Loc), Constraint => Make_Index_Or_Discriminant_Constraint (Loc, Constraints => New_List ( Make_Range (Loc, Make_Integer_Literal (Loc, 1), Make_Integer_Literal (Loc, Count))))), Expression => Make_Aggregate (Loc, Maxes)); -- A pointer to this array will be placed in the corresponding -- record by its initialization procedure so this needs to be -- analyzed here. Insert_After (Current_Node, Max_Vals); Current_Node := Max_Vals; Analyze (Max_Vals); Set_Entry_Max_Queue_Lengths_Array (Prot_Typ, Maxes_Id); end if; end; end if; -- Emit declaration for Entry_Bodies_Array, now that the addresses of -- all protected subprograms have been collected. if Has_Entries (Prot_Typ) then Body_Id := Make_Defining_Identifier (Sloc (Prot_Typ), Chars => New_External_Name (Chars (Prot_Typ), 'A')); case Corresponding_Runtime_Package (Prot_Typ) is when System_Tasking_Protected_Objects_Entries => Expr := Entries_Aggr; Obj_Def := Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (RTE (RE_Protected_Entry_Body_Array), Loc), Constraint => Make_Index_Or_Discriminant_Constraint (Loc, Constraints => New_List ( Make_Range (Loc, Make_Integer_Literal (Loc, 1), Make_Integer_Literal (Loc, E_Count))))); when System_Tasking_Protected_Objects_Single_Entry => Expr := Remove_Head (Expressions (Entries_Aggr)); Obj_Def := New_Occurrence_Of (RTE (RE_Entry_Body), Loc); when others => raise Program_Error; end case; Body_Arr := Make_Object_Declaration (Loc, Defining_Identifier => Body_Id, Aliased_Present => True, Constant_Present => True, Object_Definition => Obj_Def, Expression => Expr); -- A pointer to this array will be placed in the corresponding record -- by its initialization procedure so this needs to be analyzed here. Insert_After (Current_Node, Body_Arr); Current_Node := Body_Arr; Analyze (Body_Arr); Set_Entry_Bodies_Array (Prot_Typ, Body_Id); -- Finally, build the function that maps an entry index into the -- corresponding body. A pointer to this function is placed in each -- object of the type. Except for a ravenscar-like profile (no abort, -- no entry queue, 1 entry) if Corresponding_Runtime_Package (Prot_Typ) = System_Tasking_Protected_Objects_Entries then Sub := Make_Subprogram_Declaration (Loc, Specification => Build_Find_Body_Index_Spec (Prot_Typ)); Insert_After (Current_Node, Sub); Analyze (Sub); end if; end if; end Expand_N_Protected_Type_Declaration; -------------------------------- -- Expand_N_Requeue_Statement -- -------------------------------- -- A nondispatching requeue statement is expanded into one of four GNARLI -- operations, depending on the source and destination (task or protected -- object). A dispatching requeue statement is expanded into a call to the -- predefined primitive _Disp_Requeue. In addition, code is generated to -- jump around the remainder of processing for the original entry and, if -- the destination is (different) protected object, to attempt to service -- it. The following illustrates the various cases: -- procedure entE -- (O : System.Address; -- P : System.Address; -- E : Protected_Entry_Index) -- is -- <discriminant renamings> -- <private object renamings> -- type poVP is access poV; -- _object : ptVP := ptVP!(O); -- begin -- begin -- <start of statement sequence for entry> -- -- Requeue from one protected entry body to another protected -- -- entry. -- Requeue_Protected_Entry ( -- _object._object'Access, -- new._object'Access, -- E, -- Abort_Present); -- return; -- <some more of the statement sequence for entry> -- -- Requeue from an entry body to a task entry -- Requeue_Protected_To_Task_Entry ( -- New._task_id, -- E, -- Abort_Present); -- return; -- <rest of statement sequence for entry> -- Complete_Entry_Body (_object._object); -- exception -- when all others => -- Exceptional_Complete_Entry_Body ( -- _object._object, Get_GNAT_Exception); -- end; -- end entE; -- Requeue of a task entry call to a task entry -- Accept_Call (E, Ann); -- <start of statement sequence for accept statement> -- Requeue_Task_Entry (New._task_id, E, Abort_Present); -- goto Lnn; -- <rest of statement sequence for accept statement> -- <<Lnn>> -- Complete_Rendezvous; -- exception -- when all others => -- Exceptional_Complete_Rendezvous (Get_GNAT_Exception); -- Requeue of a task entry call to a protected entry -- Accept_Call (E, Ann); -- <start of statement sequence for accept statement> -- Requeue_Task_To_Protected_Entry ( -- new._object'Access, -- E, -- Abort_Present); -- newS (new, Pnn); -- goto Lnn; -- <rest of statement sequence for accept statement> -- <<Lnn>> -- Complete_Rendezvous; -- exception -- when all others => -- Exceptional_Complete_Rendezvous (Get_GNAT_Exception); -- Ada 2012 (AI05-0030): Dispatching requeue to an interface primitive -- marked by pragma Implemented (XXX, By_Entry). -- The requeue is inside a protected entry: -- procedure entE -- (O : System.Address; -- P : System.Address; -- E : Protected_Entry_Index) -- is -- <discriminant renamings> -- <private object renamings> -- type poVP is access poV; -- _object : ptVP := ptVP!(O); -- begin -- begin -- <start of statement sequence for entry> -- _Disp_Requeue -- (<interface class-wide object>, -- True, -- _object'Address, -- Ada.Tags.Get_Offset_Index -- (Tag (_object), -- <interface dispatch table index of target entry>), -- Abort_Present); -- return; -- <rest of statement sequence for entry> -- Complete_Entry_Body (_object._object); -- exception -- when all others => -- Exceptional_Complete_Entry_Body ( -- _object._object, Get_GNAT_Exception); -- end; -- end entE; -- The requeue is inside a task entry: -- Accept_Call (E, Ann); -- <start of statement sequence for accept statement> -- _Disp_Requeue -- (<interface class-wide object>, -- False, -- null, -- Ada.Tags.Get_Offset_Index -- (Tag (_object), -- <interface dispatch table index of target entrt>), -- Abort_Present); -- newS (new, Pnn); -- goto Lnn; -- <rest of statement sequence for accept statement> -- <<Lnn>> -- Complete_Rendezvous; -- exception -- when all others => -- Exceptional_Complete_Rendezvous (Get_GNAT_Exception); -- Ada 2012 (AI05-0030): Dispatching requeue to an interface primitive -- marked by pragma Implemented (XXX, By_Protected_Procedure). The requeue -- statement is replaced by a dispatching call with actual parameters taken -- from the inner-most accept statement or entry body. -- Target.Primitive (Param1, ..., ParamN); -- Ada 2012 (AI05-0030): Dispatching requeue to an interface primitive -- marked by pragma Implemented (XXX, By_Any | Optional) or not marked -- at all. -- declare -- S : constant Offset_Index := -- Get_Offset_Index (Tag (Concval), DT_Position (Ename)); -- C : constant Prim_Op_Kind := Get_Prim_Op_Kind (Tag (Concval), S); -- begin -- if C = POK_Protected_Entry -- or else C = POK_Task_Entry -- then -- <statements for dispatching requeue> -- elsif C = POK_Protected_Procedure then -- <dispatching call equivalent> -- else -- raise Program_Error; -- end if; -- end; procedure Expand_N_Requeue_Statement (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Conc_Typ : Entity_Id; Concval : Node_Id; Ename : Node_Id; Index : Node_Id; Old_Typ : Entity_Id; function Build_Dispatching_Call_Equivalent return Node_Id; -- Ada 2012 (AI05-0030): N denotes a dispatching requeue statement of -- the form Concval.Ename. It is statically known that Ename is allowed -- to be implemented by a protected procedure. Create a dispatching call -- equivalent of Concval.Ename taking the actual parameters from the -- inner-most accept statement or entry body. function Build_Dispatching_Requeue return Node_Id; -- Ada 2012 (AI05-0030): N denotes a dispatching requeue statement of -- the form Concval.Ename. It is statically known that Ename is allowed -- to be implemented by a protected or a task entry. Create a call to -- primitive _Disp_Requeue which handles the low-level actions. function Build_Dispatching_Requeue_To_Any return Node_Id; -- Ada 2012 (AI05-0030): N denotes a dispatching requeue statement of -- the form Concval.Ename. Ename is either marked by pragma Implemented -- (XXX, By_Any | Optional) or not marked at all. Create a block which -- determines at runtime whether Ename denotes an entry or a procedure -- and perform the appropriate kind of dispatching select. function Build_Normal_Requeue return Node_Id; -- N denotes a nondispatching requeue statement to either a task or a -- protected entry. Build the appropriate runtime call to perform the -- action. function Build_Skip_Statement (Search : Node_Id) return Node_Id; -- For a protected entry, create a return statement to skip the rest of -- the entry body. Otherwise, create a goto statement to skip the rest -- of a task accept statement. The lookup for the enclosing entry body -- or accept statement starts from Search. --------------------------------------- -- Build_Dispatching_Call_Equivalent -- --------------------------------------- function Build_Dispatching_Call_Equivalent return Node_Id is Call_Ent : constant Entity_Id := Entity (Ename); Obj : constant Node_Id := Original_Node (Concval); Acc_Ent : Node_Id; Actuals : List_Id; Formal : Node_Id; Formals : List_Id; begin -- Climb the parent chain looking for the inner-most entry body or -- accept statement. Acc_Ent := N; while Present (Acc_Ent) and then Nkind (Acc_Ent) not in N_Accept_Statement | N_Entry_Body loop Acc_Ent := Parent (Acc_Ent); end loop; -- A requeue statement should be housed inside an entry body or an -- accept statement at some level. If this is not the case, then the -- tree is malformed. pragma Assert (Present (Acc_Ent)); -- Recover the list of formal parameters if Nkind (Acc_Ent) = N_Entry_Body then Acc_Ent := Entry_Body_Formal_Part (Acc_Ent); end if; Formals := Parameter_Specifications (Acc_Ent); -- Create the actual parameters for the dispatching call. These are -- simply copies of the entry body or accept statement formals in the -- same order as they appear. Actuals := No_List; if Present (Formals) then Actuals := New_List; Formal := First (Formals); while Present (Formal) loop Append_To (Actuals, Make_Identifier (Loc, Chars (Defining_Identifier (Formal)))); Next (Formal); end loop; end if; -- Generate: -- Obj.Call_Ent (Actuals); return Make_Procedure_Call_Statement (Loc, Name => Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Chars (Obj)), Selector_Name => Make_Identifier (Loc, Chars (Call_Ent))), Parameter_Associations => Actuals); end Build_Dispatching_Call_Equivalent; ------------------------------- -- Build_Dispatching_Requeue -- ------------------------------- function Build_Dispatching_Requeue return Node_Id is Params : constant List_Id := New_List; begin -- Process the "with abort" parameter Prepend_To (Params, New_Occurrence_Of (Boolean_Literals (Abort_Present (N)), Loc)); -- Process the entry wrapper's position in the primary dispatch -- table parameter. Generate: -- Ada.Tags.Get_Entry_Index -- (T => To_Tag_Ptr (Obj'Address).all, -- Position => -- Ada.Tags.Get_Offset_Index -- (Ada.Tags.Tag (Concval), -- <interface dispatch table position of Ename>)); -- Note that Obj'Address is recursively expanded into a call to -- Base_Address (Obj). if Tagged_Type_Expansion then Prepend_To (Params, Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Get_Entry_Index), Loc), Parameter_Associations => New_List ( Make_Explicit_Dereference (Loc, Unchecked_Convert_To (RTE (RE_Tag_Ptr), Make_Attribute_Reference (Loc, Prefix => New_Copy_Tree (Concval), Attribute_Name => Name_Address))), Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Get_Offset_Index), Loc), Parameter_Associations => New_List ( Unchecked_Convert_To (RTE (RE_Tag), Concval), Make_Integer_Literal (Loc, DT_Position (Entity (Ename)))))))); -- VM targets else Prepend_To (Params, Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Get_Entry_Index), Loc), Parameter_Associations => New_List ( Make_Attribute_Reference (Loc, Prefix => Concval, Attribute_Name => Name_Tag), Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Get_Offset_Index), Loc), Parameter_Associations => New_List ( -- Obj_Tag Make_Attribute_Reference (Loc, Prefix => Concval, Attribute_Name => Name_Tag), -- Tag_Typ Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Etype (Concval), Loc), Attribute_Name => Name_Tag), -- Position Make_Integer_Literal (Loc, DT_Position (Entity (Ename)))))))); end if; -- Specific actuals for protected to XXX requeue if Is_Protected_Type (Old_Typ) then Prepend_To (Params, Make_Attribute_Reference (Loc, -- _object'Address Prefix => Concurrent_Ref (New_Occurrence_Of (Old_Typ, Loc)), Attribute_Name => Name_Address)); Prepend_To (Params, -- True New_Occurrence_Of (Standard_True, Loc)); -- Specific actuals for task to XXX requeue else pragma Assert (Is_Task_Type (Old_Typ)); Prepend_To (Params, -- null New_Occurrence_Of (RTE (RE_Null_Address), Loc)); Prepend_To (Params, -- False New_Occurrence_Of (Standard_False, Loc)); end if; -- Add the object parameter Prepend_To (Params, New_Copy_Tree (Concval)); -- Generate: -- _Disp_Requeue (<Params>); -- Find entity for Disp_Requeue operation, which belongs to -- the type and may not be directly visible. declare Elmt : Elmt_Id; Op : Entity_Id := Empty; begin Elmt := First_Elmt (Primitive_Operations (Etype (Conc_Typ))); while Present (Elmt) loop Op := Node (Elmt); exit when Chars (Op) = Name_uDisp_Requeue; Next_Elmt (Elmt); end loop; pragma Assert (Present (Op)); return Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Op, Loc), Parameter_Associations => Params); end; end Build_Dispatching_Requeue; -------------------------------------- -- Build_Dispatching_Requeue_To_Any -- -------------------------------------- function Build_Dispatching_Requeue_To_Any return Node_Id is Call_Ent : constant Entity_Id := Entity (Ename); Obj : constant Node_Id := Original_Node (Concval); Skip : constant Node_Id := Build_Skip_Statement (N); C : Entity_Id; Decls : List_Id; S : Entity_Id; Stmts : List_Id; begin Decls := New_List; Stmts := New_List; -- Dispatch table slot processing, generate: -- S : Integer; S := Build_S (Loc, Decls); -- Call kind processing, generate: -- C : Ada.Tags.Prim_Op_Kind; C := Build_C (Loc, Decls); -- Generate: -- S := Ada.Tags.Get_Offset_Index -- (Ada.Tags.Tag (Obj), DT_Position (Call_Ent)); Append_To (Stmts, Build_S_Assignment (Loc, S, Obj, Call_Ent)); -- Generate: -- _Disp_Get_Prim_Op_Kind (Obj, S, C); Append_To (Stmts, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of ( Find_Prim_Op (Etype (Etype (Obj)), Name_uDisp_Get_Prim_Op_Kind), Loc), Parameter_Associations => New_List ( New_Copy_Tree (Obj), New_Occurrence_Of (S, Loc), New_Occurrence_Of (C, Loc)))); Append_To (Stmts, -- if C = POK_Protected_Entry -- or else C = POK_Task_Entry -- then Make_Implicit_If_Statement (N, Condition => Make_Op_Or (Loc, Left_Opnd => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (C, Loc), Right_Opnd => New_Occurrence_Of (RTE (RE_POK_Protected_Entry), Loc)), Right_Opnd => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (C, Loc), Right_Opnd => New_Occurrence_Of (RTE (RE_POK_Task_Entry), Loc))), -- Dispatching requeue equivalent Then_Statements => New_List ( Build_Dispatching_Requeue, Skip), -- elsif C = POK_Protected_Procedure then Elsif_Parts => New_List ( Make_Elsif_Part (Loc, Condition => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (C, Loc), Right_Opnd => New_Occurrence_Of ( RTE (RE_POK_Protected_Procedure), Loc)), -- Dispatching call equivalent Then_Statements => New_List ( Build_Dispatching_Call_Equivalent))), -- else -- raise Program_Error; -- end if; Else_Statements => New_List ( Make_Raise_Program_Error (Loc, Reason => PE_Explicit_Raise)))); -- Wrap everything into a block return Make_Block_Statement (Loc, Declarations => Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Stmts)); end Build_Dispatching_Requeue_To_Any; -------------------------- -- Build_Normal_Requeue -- -------------------------- function Build_Normal_Requeue return Node_Id is Params : constant List_Id := New_List; Param : Node_Id; RT_Call : Node_Id; begin -- Process the "with abort" parameter Prepend_To (Params, New_Occurrence_Of (Boolean_Literals (Abort_Present (N)), Loc)); -- Add the index expression to the parameters. It is common among all -- four cases. Prepend_To (Params, Entry_Index_Expression (Loc, Entity (Ename), Index, Conc_Typ)); if Is_Protected_Type (Old_Typ) then declare Self_Param : Node_Id; begin Self_Param := Make_Attribute_Reference (Loc, Prefix => Concurrent_Ref (New_Occurrence_Of (Old_Typ, Loc)), Attribute_Name => Name_Unchecked_Access); -- Protected to protected requeue if Is_Protected_Type (Conc_Typ) then RT_Call := New_Occurrence_Of ( RTE (RE_Requeue_Protected_Entry), Loc); Param := Make_Attribute_Reference (Loc, Prefix => Concurrent_Ref (Concval), Attribute_Name => Name_Unchecked_Access); -- Protected to task requeue else pragma Assert (Is_Task_Type (Conc_Typ)); RT_Call := New_Occurrence_Of ( RTE (RE_Requeue_Protected_To_Task_Entry), Loc); Param := Concurrent_Ref (Concval); end if; Prepend_To (Params, Param); Prepend_To (Params, Self_Param); end; else pragma Assert (Is_Task_Type (Old_Typ)); -- Task to protected requeue if Is_Protected_Type (Conc_Typ) then RT_Call := New_Occurrence_Of ( RTE (RE_Requeue_Task_To_Protected_Entry), Loc); Param := Make_Attribute_Reference (Loc, Prefix => Concurrent_Ref (Concval), Attribute_Name => Name_Unchecked_Access); -- Task to task requeue else pragma Assert (Is_Task_Type (Conc_Typ)); RT_Call := New_Occurrence_Of (RTE (RE_Requeue_Task_Entry), Loc); Param := Concurrent_Ref (Concval); end if; Prepend_To (Params, Param); end if; return Make_Procedure_Call_Statement (Loc, Name => RT_Call, Parameter_Associations => Params); end Build_Normal_Requeue; -------------------------- -- Build_Skip_Statement -- -------------------------- function Build_Skip_Statement (Search : Node_Id) return Node_Id is Skip_Stmt : Node_Id; begin -- Build a return statement to skip the rest of the entire body if Is_Protected_Type (Old_Typ) then Skip_Stmt := Make_Simple_Return_Statement (Loc); -- If the requeue is within a task, find the end label of the -- enclosing accept statement and create a goto statement to it. else declare Acc : Node_Id; Label : Node_Id; begin -- Climb the parent chain looking for the enclosing accept -- statement. Acc := Parent (Search); while Present (Acc) and then Nkind (Acc) /= N_Accept_Statement loop Acc := Parent (Acc); end loop; -- The last statement is the second label used for completing -- the rendezvous the usual way. The label we are looking for -- is right before it. Label := Prev (Last (Statements (Handled_Statement_Sequence (Acc)))); pragma Assert (Nkind (Label) = N_Label); -- Generate a goto statement to skip the rest of the accept Skip_Stmt := Make_Goto_Statement (Loc, Name => New_Occurrence_Of (Entity (Identifier (Label)), Loc)); end; end if; Set_Analyzed (Skip_Stmt); return Skip_Stmt; end Build_Skip_Statement; -- Start of processing for Expand_N_Requeue_Statement begin -- Extract the components of the entry call Extract_Entry (N, Concval, Ename, Index); Conc_Typ := Etype (Concval); -- Examine the scope stack in order to find nearest enclosing protected -- or task type. This will constitute our invocation source. Old_Typ := Current_Scope; while Present (Old_Typ) and then not Is_Protected_Type (Old_Typ) and then not Is_Task_Type (Old_Typ) loop Old_Typ := Scope (Old_Typ); end loop; -- Ada 2012 (AI05-0030): We have a dispatching requeue of the form -- Concval.Ename where the type of Concval is class-wide concurrent -- interface. if Ada_Version >= Ada_2012 and then Present (Concval) and then Is_Class_Wide_Type (Conc_Typ) and then Is_Concurrent_Interface (Conc_Typ) then declare Has_Impl : Boolean := False; Impl_Kind : Name_Id := No_Name; begin -- Check whether the Ename is flagged by pragma Implemented if Has_Rep_Pragma (Entity (Ename), Name_Implemented) then Has_Impl := True; Impl_Kind := Implementation_Kind (Entity (Ename)); end if; -- The procedure_or_entry_NAME is guaranteed to be overridden by -- an entry. Create a call to predefined primitive _Disp_Requeue. if Has_Impl and then Impl_Kind = Name_By_Entry then Rewrite (N, Build_Dispatching_Requeue); Analyze (N); Insert_After (N, Build_Skip_Statement (N)); -- The procedure_or_entry_NAME is guaranteed to be overridden by -- a protected procedure. In this case the requeue is transformed -- into a dispatching call. elsif Has_Impl and then Impl_Kind = Name_By_Protected_Procedure then Rewrite (N, Build_Dispatching_Call_Equivalent); Analyze (N); -- The procedure_or_entry_NAME's implementation kind is either -- By_Any, Optional, or pragma Implemented was not applied at all. -- In this case a runtime test determines whether Ename denotes an -- entry or a protected procedure and performs the appropriate -- call. else Rewrite (N, Build_Dispatching_Requeue_To_Any); Analyze (N); end if; end; -- Processing for regular (nondispatching) requeues else Rewrite (N, Build_Normal_Requeue); Analyze (N); Insert_After (N, Build_Skip_Statement (N)); end if; end Expand_N_Requeue_Statement; ------------------------------- -- Expand_N_Selective_Accept -- ------------------------------- procedure Expand_N_Selective_Accept (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Alts : constant List_Id := Select_Alternatives (N); -- Note: in the below declarations a lot of new lists are allocated -- unconditionally which may well not end up being used. That's not -- a good idea since it wastes space gratuitously ??? Accept_Case : List_Id; Accept_List : constant List_Id := New_List; Alt : Node_Id; Alt_List : constant List_Id := New_List; Alt_Stats : List_Id; Ann : Entity_Id := Empty; Check_Guard : Boolean := True; Decls : constant List_Id := New_List; Stats : constant List_Id := New_List; Body_List : constant List_Id := New_List; Trailing_List : constant List_Id := New_List; Choices : List_Id; Else_Present : Boolean := False; Terminate_Alt : Node_Id := Empty; Select_Mode : Node_Id; Delay_Case : List_Id; Delay_Count : Integer := 0; Delay_Val : Entity_Id; Delay_Index : Entity_Id; Delay_Min : Entity_Id; Delay_Num : Pos := 1; Delay_Alt_List : List_Id := New_List; Delay_List : constant List_Id := New_List; D : Entity_Id; M : Entity_Id; First_Delay : Boolean := True; Guard_Open : Entity_Id; End_Lab : Node_Id; Index : Pos := 1; Lab : Node_Id; Num_Alts : Nat; Num_Accept : Nat := 0; Proc : Node_Id; Time_Type : Entity_Id := Empty; Select_Call : Node_Id; Qnam : constant Entity_Id := Make_Defining_Identifier (Loc, New_External_Name ('S', 0)); Xnam : constant Entity_Id := Make_Defining_Identifier (Loc, New_External_Name ('J', 1)); ----------------------- -- Local subprograms -- ----------------------- function Accept_Or_Raise return List_Id; -- For the rare case where delay alternatives all have guards, and -- all of them are closed, it is still possible that there were open -- accept alternatives with no callers. We must reexamine the -- Accept_List, and execute a selective wait with no else if some -- accept is open. If none, we raise program_error. procedure Add_Accept (Alt : Node_Id); -- Process a single accept statement in a select alternative. Build -- procedure for body of accept, and add entry to dispatch table with -- expression for guard, in preparation for call to run time select. function Make_And_Declare_Label (Num : Int) return Node_Id; -- Manufacture a label using Num as a serial number and declare it. -- The declaration is appended to Decls. The label marks the trailing -- statements of an accept or delay alternative. function Make_Select_Call (Select_Mode : Entity_Id) return Node_Id; -- Build call to Selective_Wait runtime routine procedure Process_Delay_Alternative (Alt : Node_Id; Index : Int); -- Add code to compare value of delay with previous values, and -- generate case entry for trailing statements. procedure Process_Accept_Alternative (Alt : Node_Id; Index : Int; Proc : Node_Id); -- Add code to call corresponding procedure, and branch to -- trailing statements, if any. --------------------- -- Accept_Or_Raise -- --------------------- function Accept_Or_Raise return List_Id is Cond : Node_Id; Stats : List_Id; J : constant Entity_Id := Make_Temporary (Loc, 'J'); begin -- We generate the following: -- for J in q'range loop -- if q(J).S /=null_task_entry then -- selective_wait (simple_mode,...); -- done := True; -- exit; -- end if; -- end loop; -- -- if no rendez_vous then -- raise program_error; -- end if; -- Note that the code needs to know that the selector name -- in an Accept_Alternative is named S. Cond := Make_Op_Ne (Loc, Left_Opnd => Make_Selected_Component (Loc, Prefix => Make_Indexed_Component (Loc, Prefix => New_Occurrence_Of (Qnam, Loc), Expressions => New_List (New_Occurrence_Of (J, Loc))), Selector_Name => Make_Identifier (Loc, Name_S)), Right_Opnd => New_Occurrence_Of (RTE (RE_Null_Task_Entry), Loc)); Stats := New_List ( Make_Implicit_Loop_Statement (N, 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_Occurrence_Of (Qnam, Loc), Attribute_Name => Name_Range, Expressions => New_List ( Make_Integer_Literal (Loc, 1))))), Statements => New_List ( Make_Implicit_If_Statement (N, Condition => Cond, Then_Statements => New_List ( Make_Select_Call ( New_Occurrence_Of (RTE (RE_Simple_Mode), Loc)), Make_Exit_Statement (Loc)))))); Append_To (Stats, Make_Raise_Program_Error (Loc, Condition => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (Xnam, Loc), Right_Opnd => New_Occurrence_Of (RTE (RE_No_Rendezvous), Loc)), Reason => PE_All_Guards_Closed)); return Stats; end Accept_Or_Raise; ---------------- -- Add_Accept -- ---------------- procedure Add_Accept (Alt : Node_Id) is Acc_Stm : constant Node_Id := Accept_Statement (Alt); Ename : constant Node_Id := Entry_Direct_Name (Acc_Stm); Eloc : constant Source_Ptr := Sloc (Ename); Eent : constant Entity_Id := Entity (Ename); Index : constant Node_Id := Entry_Index (Acc_Stm); Call : Node_Id; Expr : Node_Id; Null_Body : Node_Id; PB_Ent : Entity_Id; Proc_Body : Node_Id; -- Start of processing for Add_Accept begin if No (Ann) then Ann := Node (Last_Elmt (Accept_Address (Eent))); end if; if Present (Condition (Alt)) then Expr := Make_If_Expression (Eloc, New_List ( Condition (Alt), Entry_Index_Expression (Eloc, Eent, Index, Scope (Eent)), New_Occurrence_Of (RTE (RE_Null_Task_Entry), Eloc))); else Expr := Entry_Index_Expression (Eloc, Eent, Index, Scope (Eent)); end if; if Present (Handled_Statement_Sequence (Accept_Statement (Alt))) then Null_Body := New_Occurrence_Of (Standard_False, Eloc); -- Always add call to Abort_Undefer when generating code, since -- this is what the runtime expects (abort deferred in -- Selective_Wait). In CodePeer mode this only confuses the -- analysis with unknown calls, so don't do it. if not CodePeer_Mode then Call := Build_Runtime_Call (Loc, RE_Abort_Undefer); Insert_Before (First (Statements (Handled_Statement_Sequence (Accept_Statement (Alt)))), Call); Analyze (Call); end if; PB_Ent := Make_Defining_Identifier (Eloc, New_External_Name (Chars (Ename), 'A', Num_Accept)); -- Link the acceptor to the original receiving entry Set_Ekind (PB_Ent, E_Procedure); Set_Receiving_Entry (PB_Ent, Eent); if Comes_From_Source (Alt) then Set_Debug_Info_Needed (PB_Ent); end if; Proc_Body := Make_Subprogram_Body (Eloc, Specification => Make_Procedure_Specification (Eloc, Defining_Unit_Name => PB_Ent), Declarations => Declarations (Acc_Stm), Handled_Statement_Sequence => Build_Accept_Body (Accept_Statement (Alt))); Reset_Scopes_To (Proc_Body, PB_Ent); -- During the analysis of the body of the accept statement, any -- zero cost exception handler records were collected in the -- Accept_Handler_Records field of the N_Accept_Alternative node. -- This is where we move them to where they belong, namely the -- newly created procedure. Set_Handler_Records (PB_Ent, Accept_Handler_Records (Alt)); Append (Proc_Body, Body_List); else Null_Body := New_Occurrence_Of (Standard_True, Eloc); -- if accept statement has declarations, insert above, given that -- we are not creating a body for the accept. if Present (Declarations (Acc_Stm)) then Insert_Actions (N, Declarations (Acc_Stm)); end if; end if; Append_To (Accept_List, Make_Aggregate (Eloc, Expressions => New_List (Null_Body, Expr))); Num_Accept := Num_Accept + 1; end Add_Accept; ---------------------------- -- Make_And_Declare_Label -- ---------------------------- function Make_And_Declare_Label (Num : Int) return Node_Id is Lab_Id : Node_Id; begin Lab_Id := Make_Identifier (Loc, New_External_Name ('L', Num)); Lab := Make_Label (Loc, Lab_Id); Append_To (Decls, Make_Implicit_Label_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Chars (Lab_Id)), Label_Construct => Lab)); return Lab; end Make_And_Declare_Label; ---------------------- -- Make_Select_Call -- ---------------------- function Make_Select_Call (Select_Mode : Entity_Id) return Node_Id is Params : constant List_Id := New_List; begin Append_To (Params, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Qnam, Loc), Attribute_Name => Name_Unchecked_Access)); Append_To (Params, Select_Mode); Append_To (Params, New_Occurrence_Of (Ann, Loc)); Append_To (Params, New_Occurrence_Of (Xnam, Loc)); return Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Selective_Wait), Loc), Parameter_Associations => Params); end Make_Select_Call; -------------------------------- -- Process_Accept_Alternative -- -------------------------------- procedure Process_Accept_Alternative (Alt : Node_Id; Index : Int; Proc : Node_Id) is Astmt : constant Node_Id := Accept_Statement (Alt); Alt_Stats : List_Id; begin Adjust_Condition (Condition (Alt)); -- Accept with body if Present (Handled_Statement_Sequence (Astmt)) then Alt_Stats := New_List ( Make_Procedure_Call_Statement (Sloc (Proc), Name => New_Occurrence_Of (Defining_Unit_Name (Specification (Proc)), Sloc (Proc)))); -- Accept with no body (followed by trailing statements) else declare Entry_Id : constant Entity_Id := Entity (Entry_Direct_Name (Accept_Statement (Alt))); begin -- Ada 2020 (AI12-0279) if Has_Yield_Aspect (Entry_Id) and then RTE_Available (RE_Yield) then Alt_Stats := New_List ( Make_Procedure_Call_Statement (Sloc (Proc), New_Occurrence_Of (RTE (RE_Yield), Sloc (Proc)))); else Alt_Stats := Empty_List; end if; end; end if; Ensure_Statement_Present (Sloc (Astmt), Alt); -- After the call, if any, branch to trailing statements, if any. -- We create a label for each, as well as the corresponding label -- declaration. if not Is_Empty_List (Statements (Alt)) then Lab := Make_And_Declare_Label (Index); Append (Lab, Trailing_List); Append_List (Statements (Alt), Trailing_List); Append_To (Trailing_List, Make_Goto_Statement (Loc, Name => New_Copy (Identifier (End_Lab)))); else Lab := End_Lab; end if; Append_To (Alt_Stats, Make_Goto_Statement (Loc, Name => New_Copy (Identifier (Lab)))); Append_To (Alt_List, Make_Case_Statement_Alternative (Loc, Discrete_Choices => New_List (Make_Integer_Literal (Loc, Index)), Statements => Alt_Stats)); end Process_Accept_Alternative; ------------------------------- -- Process_Delay_Alternative -- ------------------------------- procedure Process_Delay_Alternative (Alt : Node_Id; Index : Int) is Dloc : constant Source_Ptr := Sloc (Delay_Statement (Alt)); Cond : Node_Id; Delay_Alt : List_Id; begin -- Deal with C/Fortran boolean as delay condition Adjust_Condition (Condition (Alt)); -- Determine the smallest specified delay -- for each delay alternative generate: -- if guard-expression then -- Delay_Val := delay-expression; -- Guard_Open := True; -- if Delay_Val < Delay_Min then -- Delay_Min := Delay_Val; -- Delay_Index := Index; -- end if; -- end if; -- The enclosing if-statement is omitted if there is no guard if Delay_Count = 1 or else First_Delay then First_Delay := False; Delay_Alt := New_List ( Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Delay_Min, Loc), Expression => Expression (Delay_Statement (Alt)))); if Delay_Count > 1 then Append_To (Delay_Alt, Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Delay_Index, Loc), Expression => Make_Integer_Literal (Loc, Index))); end if; else Delay_Alt := New_List ( Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Delay_Val, Loc), Expression => Expression (Delay_Statement (Alt)))); if Time_Type = Standard_Duration then Cond := Make_Op_Lt (Loc, Left_Opnd => New_Occurrence_Of (Delay_Val, Loc), Right_Opnd => New_Occurrence_Of (Delay_Min, Loc)); else -- The scope of the time type must define a comparison -- operator. The scope itself may not be visible, so we -- construct a node with entity information to insure that -- semantic analysis can find the proper operator. Cond := Make_Function_Call (Loc, Name => Make_Selected_Component (Loc, Prefix => New_Occurrence_Of (Scope (Time_Type), Loc), Selector_Name => Make_Operator_Symbol (Loc, Chars => Name_Op_Lt, Strval => No_String)), Parameter_Associations => New_List ( New_Occurrence_Of (Delay_Val, Loc), New_Occurrence_Of (Delay_Min, Loc))); Set_Entity (Prefix (Name (Cond)), Scope (Time_Type)); end if; Append_To (Delay_Alt, Make_Implicit_If_Statement (N, Condition => Cond, Then_Statements => New_List ( Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Delay_Min, Loc), Expression => New_Occurrence_Of (Delay_Val, Loc)), Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Delay_Index, Loc), Expression => Make_Integer_Literal (Loc, Index))))); end if; if Check_Guard then Append_To (Delay_Alt, Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Guard_Open, Loc), Expression => New_Occurrence_Of (Standard_True, Loc))); end if; if Present (Condition (Alt)) then Delay_Alt := New_List ( Make_Implicit_If_Statement (N, Condition => Condition (Alt), Then_Statements => Delay_Alt)); end if; Append_List (Delay_Alt, Delay_List); Ensure_Statement_Present (Dloc, Alt); -- If the delay alternative has a statement part, add choice to the -- case statements for delays. if not Is_Empty_List (Statements (Alt)) then if Delay_Count = 1 then Append_List (Statements (Alt), Delay_Alt_List); else Append_To (Delay_Alt_List, Make_Case_Statement_Alternative (Loc, Discrete_Choices => New_List ( Make_Integer_Literal (Loc, Index)), Statements => Statements (Alt))); end if; elsif Delay_Count = 1 then -- If the single delay has no trailing statements, add a branch -- to the exit label to the selective wait. Delay_Alt_List := New_List ( Make_Goto_Statement (Loc, Name => New_Copy (Identifier (End_Lab)))); end if; end Process_Delay_Alternative; -- Start of processing for Expand_N_Selective_Accept begin Process_Statements_For_Controlled_Objects (N); -- First insert some declarations before the select. The first is: -- Ann : Address -- This variable holds the parameters passed to the accept body. This -- declaration has already been inserted by the time we get here by -- a call to Expand_Accept_Declarations made from the semantics when -- processing the first accept statement contained in the select. We -- can find this entity as Accept_Address (E), where E is any of the -- entries references by contained accept statements. -- The first step is to scan the list of Selective_Accept_Statements -- to find this entity, and also count the number of accepts, and -- determine if terminated, delay or else is present: Num_Alts := 0; Alt := First (Alts); while Present (Alt) loop Process_Statements_For_Controlled_Objects (Alt); if Nkind (Alt) = N_Accept_Alternative then Add_Accept (Alt); elsif Nkind (Alt) = N_Delay_Alternative then Delay_Count := Delay_Count + 1; -- If the delays are relative delays, the delay expressions have -- type Standard_Duration. Otherwise they must have some time type -- recognized by GNAT. if Nkind (Delay_Statement (Alt)) = N_Delay_Relative_Statement then Time_Type := Standard_Duration; else Time_Type := Etype (Expression (Delay_Statement (Alt))); if Is_RTE (Base_Type (Etype (Time_Type)), RO_CA_Time) or else Is_RTE (Base_Type (Etype (Time_Type)), RO_RT_Time) then null; else -- Move this check to sem??? Error_Msg_NE ( "& is not a time type (RM 9.6(6))", Expression (Delay_Statement (Alt)), Time_Type); Time_Type := Standard_Duration; Set_Etype (Expression (Delay_Statement (Alt)), Any_Type); end if; end if; if No (Condition (Alt)) then -- This guard will always be open Check_Guard := False; end if; elsif Nkind (Alt) = N_Terminate_Alternative then Adjust_Condition (Condition (Alt)); Terminate_Alt := Alt; end if; Num_Alts := Num_Alts + 1; Next (Alt); end loop; Else_Present := Present (Else_Statements (N)); -- At the same time (see procedure Add_Accept) we build the accept list: -- Qnn : Accept_List (1 .. num-select) := ( -- (null-body, entry-index), -- (null-body, entry-index), -- .. -- (null_body, entry-index)); -- In the above declaration, null-body is True if the corresponding -- accept has no body, and false otherwise. The entry is either the -- entry index expression if there is no guard, or if a guard is -- present, then an if expression of the form: -- (if guard then entry-index else Null_Task_Entry) -- If a guard is statically known to be false, the entry can simply -- be omitted from the accept list. Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Qnam, Object_Definition => New_Occurrence_Of (RTE (RE_Accept_List), Loc), Aliased_Present => True, Expression => Make_Qualified_Expression (Loc, Subtype_Mark => New_Occurrence_Of (RTE (RE_Accept_List), Loc), Expression => Make_Aggregate (Loc, Expressions => Accept_List)))); -- Then we declare the variable that holds the index for the accept -- that will be selected for service: -- Xnn : Select_Index; Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Xnam, Object_Definition => New_Occurrence_Of (RTE (RE_Select_Index), Loc), Expression => New_Occurrence_Of (RTE (RE_No_Rendezvous), Loc))); -- After this follow procedure declarations for each accept body -- procedure Pnn is -- begin -- ... -- end; -- where the ... are statements from the corresponding procedure body. -- No parameters are involved, since the parameters are passed via Ann -- and the parameter references have already been expanded to be direct -- references to Ann (see Exp_Ch2.Expand_Entry_Parameter). Furthermore, -- any embedded tasking statements (which would normally be illegal in -- procedures), have been converted to calls to the tasking runtime so -- there is no problem in putting them into procedures. -- The original accept statement has been expanded into a block in -- the same fashion as for simple accepts (see Build_Accept_Body). -- Note: we don't really need to build these procedures for the case -- where no delay statement is present, but it is just as easy to -- build them unconditionally, and not significantly inefficient, -- since if they are short they will be inlined anyway. -- The procedure declarations have been assembled in Body_List -- If delays are present, we must compute the required delay. -- We first generate the declarations: -- Delay_Index : Boolean := 0; -- Delay_Min : Some_Time_Type.Time; -- Delay_Val : Some_Time_Type.Time; -- Delay_Index will be set to the index of the minimum delay, i.e. the -- active delay that is actually chosen as the basis for the possible -- delay if an immediate rendez-vous is not possible. -- In the most common case there is a single delay statement, and this -- is handled specially. if Delay_Count > 0 then -- Generate the required declarations Delay_Val := Make_Defining_Identifier (Loc, New_External_Name ('D', 1)); Delay_Index := Make_Defining_Identifier (Loc, New_External_Name ('D', 2)); Delay_Min := Make_Defining_Identifier (Loc, New_External_Name ('D', 3)); pragma Assert (Present (Time_Type)); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Delay_Val, Object_Definition => New_Occurrence_Of (Time_Type, Loc))); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Delay_Index, Object_Definition => New_Occurrence_Of (Standard_Integer, Loc), Expression => Make_Integer_Literal (Loc, 0))); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Delay_Min, Object_Definition => New_Occurrence_Of (Time_Type, Loc), Expression => Unchecked_Convert_To (Time_Type, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Underlying_Type (Time_Type), Loc), Attribute_Name => Name_Last)))); -- Create Duration and Delay_Mode objects used for passing a delay -- value to RTS D := Make_Temporary (Loc, 'D'); M := Make_Temporary (Loc, 'M'); declare Discr : Entity_Id; begin -- Note that these values are defined in s-osprim.ads and must -- be kept in sync: -- -- Relative : constant := 0; -- Absolute_Calendar : constant := 1; -- Absolute_RT : constant := 2; if Time_Type = Standard_Duration then Discr := Make_Integer_Literal (Loc, 0); elsif Is_RTE (Base_Type (Etype (Time_Type)), RO_CA_Time) then Discr := Make_Integer_Literal (Loc, 1); else pragma Assert (Is_RTE (Base_Type (Etype (Time_Type)), RO_RT_Time)); Discr := Make_Integer_Literal (Loc, 2); end if; Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => D, Object_Definition => New_Occurrence_Of (Standard_Duration, Loc))); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => M, Object_Definition => New_Occurrence_Of (Standard_Integer, Loc), Expression => Discr)); end; if Check_Guard then Guard_Open := Make_Defining_Identifier (Loc, New_External_Name ('G', 1)); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Guard_Open, Object_Definition => New_Occurrence_Of (Standard_Boolean, Loc), Expression => New_Occurrence_Of (Standard_False, Loc))); end if; -- Delay_Count is zero, don't need M and D set (suppress warning) else M := Empty; D := Empty; end if; if Present (Terminate_Alt) then -- If the terminate alternative guard is False, use -- Simple_Mode; otherwise use Terminate_Mode. if Present (Condition (Terminate_Alt)) then Select_Mode := Make_If_Expression (Loc, New_List (Condition (Terminate_Alt), New_Occurrence_Of (RTE (RE_Terminate_Mode), Loc), New_Occurrence_Of (RTE (RE_Simple_Mode), Loc))); else Select_Mode := New_Occurrence_Of (RTE (RE_Terminate_Mode), Loc); end if; elsif Else_Present or Delay_Count > 0 then Select_Mode := New_Occurrence_Of (RTE (RE_Else_Mode), Loc); else Select_Mode := New_Occurrence_Of (RTE (RE_Simple_Mode), Loc); end if; Select_Call := Make_Select_Call (Select_Mode); Append (Select_Call, Stats); -- Now generate code to act on the result. There is an entry -- in this case for each accept statement with a non-null body, -- followed by a branch to the statements that follow the Accept. -- In the absence of delay alternatives, we generate: -- case X is -- when No_Rendezvous => -- omitted if simple mode -- goto Lab0; -- when 1 => -- P1n; -- goto Lab1; -- when 2 => -- P2n; -- goto Lab2; -- when others => -- goto Exit; -- end case; -- -- Lab0: Else_Statements; -- goto exit; -- Lab1: Trailing_Statements1; -- goto Exit; -- -- Lab2: Trailing_Statements2; -- goto Exit; -- ... -- Exit: -- Generate label for common exit End_Lab := Make_And_Declare_Label (Num_Alts + 1); -- First entry is the default case, when no rendezvous is possible Choices := New_List (New_Occurrence_Of (RTE (RE_No_Rendezvous), Loc)); if Else_Present then -- If no rendezvous is possible, the else part is executed Lab := Make_And_Declare_Label (0); Alt_Stats := New_List ( Make_Goto_Statement (Loc, Name => New_Copy (Identifier (Lab)))); Append (Lab, Trailing_List); Append_List (Else_Statements (N), Trailing_List); Append_To (Trailing_List, Make_Goto_Statement (Loc, Name => New_Copy (Identifier (End_Lab)))); else Alt_Stats := New_List ( Make_Goto_Statement (Loc, Name => New_Copy (Identifier (End_Lab)))); end if; Append_To (Alt_List, Make_Case_Statement_Alternative (Loc, Discrete_Choices => Choices, Statements => Alt_Stats)); -- We make use of the fact that Accept_Index is an integer type, and -- generate successive literals for entries for each accept. Only those -- for which there is a body or trailing statements get a case entry. Alt := First (Select_Alternatives (N)); Proc := First (Body_List); while Present (Alt) loop if Nkind (Alt) = N_Accept_Alternative then Process_Accept_Alternative (Alt, Index, Proc); Index := Index + 1; if Present (Handled_Statement_Sequence (Accept_Statement (Alt))) then Next (Proc); end if; elsif Nkind (Alt) = N_Delay_Alternative then Process_Delay_Alternative (Alt, Delay_Num); Delay_Num := Delay_Num + 1; end if; Next (Alt); end loop; -- An others choice is always added to the main case, as well -- as the delay case (to satisfy the compiler). Append_To (Alt_List, Make_Case_Statement_Alternative (Loc, Discrete_Choices => New_List (Make_Others_Choice (Loc)), Statements => New_List (Make_Goto_Statement (Loc, Name => New_Copy (Identifier (End_Lab)))))); Accept_Case := New_List ( Make_Case_Statement (Loc, Expression => New_Occurrence_Of (Xnam, Loc), Alternatives => Alt_List)); Append_List (Trailing_List, Accept_Case); Append_List (Body_List, Decls); -- Construct case statement for trailing statements of delay -- alternatives, if there are several of them. if Delay_Count > 1 then Append_To (Delay_Alt_List, Make_Case_Statement_Alternative (Loc, Discrete_Choices => New_List (Make_Others_Choice (Loc)), Statements => New_List (Make_Null_Statement (Loc)))); Delay_Case := New_List ( Make_Case_Statement (Loc, Expression => New_Occurrence_Of (Delay_Index, Loc), Alternatives => Delay_Alt_List)); else Delay_Case := Delay_Alt_List; end if; -- If there are no delay alternatives, we append the case statement -- to the statement list. if Delay_Count = 0 then Append_List (Accept_Case, Stats); -- Delay alternatives present else -- If delay alternatives are present we generate: -- find minimum delay. -- DX := minimum delay; -- M := <delay mode>; -- Timed_Selective_Wait (Q'Unchecked_Access, Delay_Mode, P, -- DX, MX, X); -- -- if X = No_Rendezvous then -- case statement for delay statements. -- else -- case statement for accept alternatives. -- end if; declare Cases : Node_Id; Stmt : Node_Id; Parms : List_Id; Parm : Node_Id; Conv : Node_Id; begin -- The type of the delay expression is known to be legal if Time_Type = Standard_Duration then Conv := New_Occurrence_Of (Delay_Min, Loc); elsif Is_RTE (Base_Type (Etype (Time_Type)), RO_CA_Time) then Conv := Make_Function_Call (Loc, New_Occurrence_Of (RTE (RO_CA_To_Duration), Loc), New_List (New_Occurrence_Of (Delay_Min, Loc))); else pragma Assert (Is_RTE (Base_Type (Etype (Time_Type)), RO_RT_Time)); Conv := Make_Function_Call (Loc, New_Occurrence_Of (RTE (RO_RT_To_Duration), Loc), New_List (New_Occurrence_Of (Delay_Min, Loc))); end if; Stmt := Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (D, Loc), Expression => Conv); -- Change the value for Accept_Modes. (Else_Mode -> Delay_Mode) Parms := Parameter_Associations (Select_Call); Parm := First (Parms); while Present (Parm) and then Parm /= Select_Mode loop Next (Parm); end loop; pragma Assert (Present (Parm)); Rewrite (Parm, New_Occurrence_Of (RTE (RE_Delay_Mode), Loc)); Analyze (Parm); -- Prepare two new parameters of Duration and Delay_Mode type -- which represent the value and the mode of the minimum delay. Next (Parm); Insert_After (Parm, New_Occurrence_Of (M, Loc)); Insert_After (Parm, New_Occurrence_Of (D, Loc)); -- Create a call to RTS Rewrite (Select_Call, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Timed_Selective_Wait), Loc), Parameter_Associations => Parms)); -- This new call should follow the calculation of the minimum -- delay. Insert_List_Before (Select_Call, Delay_List); if Check_Guard then Stmt := Make_Implicit_If_Statement (N, Condition => New_Occurrence_Of (Guard_Open, Loc), Then_Statements => New_List ( New_Copy_Tree (Stmt), New_Copy_Tree (Select_Call)), Else_Statements => Accept_Or_Raise); Rewrite (Select_Call, Stmt); else Insert_Before (Select_Call, Stmt); end if; Cases := Make_Implicit_If_Statement (N, Condition => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (Xnam, Loc), Right_Opnd => New_Occurrence_Of (RTE (RE_No_Rendezvous), Loc)), Then_Statements => Delay_Case, Else_Statements => Accept_Case); Append (Cases, Stats); end; end if; Append (End_Lab, Stats); -- Replace accept statement with appropriate block Rewrite (N, Make_Block_Statement (Loc, Declarations => Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Stats))); Analyze (N); -- Note: have to worry more about abort deferral in above code ??? -- Final step is to unstack the Accept_Address entries for all accept -- statements appearing in accept alternatives in the select statement Alt := First (Alts); while Present (Alt) loop if Nkind (Alt) = N_Accept_Alternative then Remove_Last_Elmt (Accept_Address (Entity (Entry_Direct_Name (Accept_Statement (Alt))))); end if; Next (Alt); end loop; end Expand_N_Selective_Accept; ------------------------------------------- -- Expand_N_Single_Protected_Declaration -- ------------------------------------------- -- A single protected declaration should never be present after semantic -- analysis because it is transformed into a protected type declaration -- and an accompanying anonymous object. This routine ensures that the -- transformation takes place. procedure Expand_N_Single_Protected_Declaration (N : Node_Id) is begin raise Program_Error; end Expand_N_Single_Protected_Declaration; -------------------------------------- -- Expand_N_Single_Task_Declaration -- -------------------------------------- -- A single task declaration should never be present after semantic -- analysis because it is transformed into a task type declaration and -- an accompanying anonymous object. This routine ensures that the -- transformation takes place. procedure Expand_N_Single_Task_Declaration (N : Node_Id) is begin raise Program_Error; end Expand_N_Single_Task_Declaration; ------------------------ -- Expand_N_Task_Body -- ------------------------ -- Given a task body -- task body tname is -- <declarations> -- begin -- <statements> -- end x; -- This expansion routine converts it into a procedure and sets the -- elaboration flag for the procedure to true, to represent the fact -- that the task body is now elaborated: -- procedure tnameB (_Task : access tnameV) is -- discriminal : dtype renames _Task.discriminant; -- procedure _clean is -- begin -- Abort_Defer.all; -- Complete_Task; -- Abort_Undefer.all; -- return; -- end _clean; -- begin -- Abort_Undefer.all; -- <declarations> -- System.Task_Stages.Complete_Activation; -- <statements> -- at end -- _clean; -- end tnameB; -- tnameE := True; -- In addition, if the task body is an activator, then a call to activate -- tasks is added at the start of the statements, before the call to -- Complete_Activation, and if in addition the task is a master then it -- must be established as a master. These calls are inserted and analyzed -- in Expand_Cleanup_Actions, when the Handled_Sequence_Of_Statements is -- expanded. -- There is one discriminal declaration line generated for each -- discriminant that is present to provide an easy reference point for -- discriminant references inside the body (see Exp_Ch2.Expand_Name). -- Note on relationship to GNARLI definition. In the GNARLI definition, -- task body procedures have a profile (Arg : System.Address). That is -- needed because GNARLI has to use the same access-to-subprogram type -- for all task types. We depend here on knowing that in GNAT, passing -- an address argument by value is identical to passing a record value -- by access (in either case a single pointer is passed), so even though -- this procedure has the wrong profile. In fact it's all OK, since the -- callings sequence is identical. procedure Expand_N_Task_Body (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Ttyp : constant Entity_Id := Corresponding_Spec (N); Call : Node_Id; New_N : Node_Id; Insert_Nod : Node_Id; -- Used to determine the proper location of wrapper body insertions begin -- if no task body procedure, means we had an error in configurable -- run-time mode, and there is no point in proceeding further. if No (Task_Body_Procedure (Ttyp)) then return; end if; -- Add renaming declarations for discriminals and a declaration for the -- entry family index (if applicable). Install_Private_Data_Declarations (Loc, Task_Body_Procedure (Ttyp), Ttyp, N, Declarations (N)); -- Add a call to Abort_Undefer at the very beginning of the task -- body since this body is called with abort still deferred. if Abort_Allowed then Call := Build_Runtime_Call (Loc, RE_Abort_Undefer); Insert_Before (First (Statements (Handled_Statement_Sequence (N))), Call); Analyze (Call); end if; -- The statement part has already been protected with an at_end and -- cleanup actions. The call to Complete_Activation must be placed -- at the head of the sequence of statements of that block. The -- declarations have been merged in this sequence of statements but -- the first real statement is accessible from the First_Real_Statement -- field (which was set for exactly this purpose). if Restricted_Profile then Call := Build_Runtime_Call (Loc, RE_Complete_Restricted_Activation); else Call := Build_Runtime_Call (Loc, RE_Complete_Activation); end if; Insert_Before (First_Real_Statement (Handled_Statement_Sequence (N)), Call); Analyze (Call); New_N := Make_Subprogram_Body (Loc, Specification => Build_Task_Proc_Specification (Ttyp), Declarations => Declarations (N), Handled_Statement_Sequence => Handled_Statement_Sequence (N)); Set_Is_Task_Body_Procedure (New_N); -- If the task contains generic instantiations, cleanup actions are -- delayed until after instantiation. Transfer the activation chain to -- the subprogram, to insure that the activation call is properly -- generated. It the task body contains inner tasks, indicate that the -- subprogram is a task master. if Delay_Cleanups (Ttyp) then Set_Activation_Chain_Entity (New_N, Activation_Chain_Entity (N)); Set_Is_Task_Master (New_N, Is_Task_Master (N)); end if; Rewrite (N, New_N); Analyze (N); -- Set elaboration flag immediately after task body. If the body is a -- subunit, the flag is set in the declarative part containing the stub. if Nkind (Parent (N)) /= N_Subunit then Insert_After (N, Make_Assignment_Statement (Loc, Name => Make_Identifier (Loc, New_External_Name (Chars (Ttyp), 'E')), Expression => New_Occurrence_Of (Standard_True, Loc))); end if; -- Ada 2005 (AI-345): Construct the primitive entry wrapper bodies after -- the task body. At this point all wrapper specs have been created, -- frozen and included in the dispatch table for the task type. if Ada_Version >= Ada_2005 then if Nkind (Parent (N)) = N_Subunit then Insert_Nod := Corresponding_Stub (Parent (N)); else Insert_Nod := N; end if; Build_Wrapper_Bodies (Loc, Ttyp, Insert_Nod); end if; end Expand_N_Task_Body; ------------------------------------ -- Expand_N_Task_Type_Declaration -- ------------------------------------ -- We have several things to do. First we must create a Boolean flag used -- to mark if the body is elaborated yet. This variable gets set to True -- when the body of the task is elaborated (we can't rely on the normal -- ABE mechanism for the task body, since we need to pass an access to -- this elaboration boolean to the runtime routines). -- taskE : aliased Boolean := False; -- Next a variable is declared to hold the task stack size (either the -- default : Unspecified_Size, or a value that is set by a pragma -- Storage_Size). If the value of the pragma Storage_Size is static, then -- the variable is initialized with this value: -- taskZ : Size_Type := Unspecified_Size; -- or -- taskZ : Size_Type := Size_Type (size_expression); -- Note: No variable is needed to hold the task relative deadline since -- its value would never be static because the parameter is of a private -- type (Ada.Real_Time.Time_Span). -- Next we create a corresponding record type declaration used to represent -- values of this task. The general form of this type declaration is -- type taskV (discriminants) is record -- _Task_Id : Task_Id; -- entry_family : array (bounds) of Void; -- _Priority : Integer := priority_expression; -- _Size : Size_Type := size_expression; -- _Secondary_Stack_Size : Size_Type := size_expression; -- _Task_Info : Task_Info_Type := task_info_expression; -- _CPU : Integer := cpu_range_expression; -- _Relative_Deadline : Time_Span := time_span_expression; -- _Domain : Dispatching_Domain := dd_expression; -- end record; -- The discriminants are present only if the corresponding task type has -- discriminants, and they exactly mirror the task type discriminants. -- The Id field is always present. It contains the Task_Id value, as set by -- the call to Create_Task. Note that although the task is limited, the -- task value record type is not limited, so there is no problem in passing -- this field as an out parameter to Create_Task. -- One entry_family component is present for each entry family in the task -- definition. The bounds correspond to the bounds of the entry family -- (which may depend on discriminants). The element type is void, since we -- only need the bounds information for determining the entry index. Note -- that the use of an anonymous array would normally be illegal in this -- context, but this is a parser check, and the semantics is quite prepared -- to handle such a case. -- The _Size field is present only if a Storage_Size pragma appears in the -- task definition. The expression captures the argument that was present -- in the pragma, and is used to override the task stack size otherwise -- associated with the task type. -- The _Secondary_Stack_Size field is present only the task entity has a -- Secondary_Stack_Size rep item. It will be filled at the freeze point, -- when the record init proc is built, to capture the expression of the -- rep item (see Build_Record_Init_Proc in Exp_Ch3). Note that it cannot -- be filled here since aspect evaluations are delayed till the freeze -- point. -- The _Priority field is present only if the task entity has a Priority or -- Interrupt_Priority rep item (pragma, aspect specification or attribute -- definition clause). It will be filled at the freeze point, when the -- record init proc is built, to capture the expression of the rep item -- (see Build_Record_Init_Proc in Exp_Ch3). Note that it cannot be filled -- here since aspect evaluations are delayed till the freeze point. -- The _Task_Info field is present only if a Task_Info pragma appears in -- the task definition. The expression captures the argument that was -- present in the pragma, and is used to provide the Task_Image parameter -- to the call to Create_Task. -- The _CPU field is present only if the task entity has a CPU rep item -- (pragma, aspect specification or attribute definition clause). It will -- be filled at the freeze point, when the record init proc is built, to -- capture the expression of the rep item (see Build_Record_Init_Proc in -- Exp_Ch3). Note that it cannot be filled here since aspect evaluations -- are delayed till the freeze point. -- The _Relative_Deadline field is present only if a Relative_Deadline -- pragma appears in the task definition. The expression captures the -- argument that was present in the pragma, and is used to provide the -- Relative_Deadline parameter to the call to Create_Task. -- The _Domain field is present only if the task entity has a -- Dispatching_Domain rep item (pragma, aspect specification or attribute -- definition clause). It will be filled at the freeze point, when the -- record init proc is built, to capture the expression of the rep item -- (see Build_Record_Init_Proc in Exp_Ch3). Note that it cannot be filled -- here since aspect evaluations are delayed till the freeze point. -- When a task is declared, an instance of the task value record is -- created. The elaboration of this declaration creates the correct bounds -- for the entry families, and also evaluates the size, priority, and -- task_Info expressions if needed. The initialization routine for the task -- type itself then calls Create_Task with appropriate parameters to -- initialize the value of the Task_Id field. -- Note: the address of this record is passed as the "Discriminants" -- parameter for Create_Task. Since Create_Task merely passes this onto the -- body procedure, it does not matter that it does not quite match the -- GNARLI model of what is being passed (the record contains more than just -- the discriminants, but the discriminants can be found from the record -- value). -- The Entity_Id for this created record type is placed in the -- Corresponding_Record_Type field of the associated task type entity. -- Next we create a procedure specification for the task body procedure: -- procedure taskB (_Task : access taskV); -- Note that this must come after the record type declaration, since -- the spec refers to this type. It turns out that the initialization -- procedure for the value type references the task body spec, but that's -- fine, since it won't be generated till the freeze point for the type, -- which is certainly after the task body spec declaration. -- Finally, we set the task index value field of the entry attribute in -- the case of a simple entry. procedure Expand_N_Task_Type_Declaration (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); TaskId : constant Entity_Id := Defining_Identifier (N); Tasktyp : constant Entity_Id := Etype (Defining_Identifier (N)); Tasknm : constant Name_Id := Chars (Tasktyp); Taskdef : constant Node_Id := Task_Definition (N); Body_Decl : Node_Id; Cdecls : List_Id; Decl_Stack : Node_Id; Decl_SS : Node_Id; Elab_Decl : Node_Id; Ent_Stack : Entity_Id; Proc_Spec : Node_Id; Rec_Decl : Node_Id; Rec_Ent : Entity_Id; Size_Decl : Entity_Id; Task_Size : Node_Id; function Get_Relative_Deadline_Pragma (T : Node_Id) return Node_Id; -- Searches the task definition T for the first occurrence of the pragma -- Relative Deadline. The caller has ensured that the pragma is present -- in the task definition. Note that this routine cannot be implemented -- with the Rep Item chain mechanism since Relative_Deadline pragmas are -- not chained because their expansion into a procedure call statement -- would cause a break in the chain. ---------------------------------- -- Get_Relative_Deadline_Pragma -- ---------------------------------- function Get_Relative_Deadline_Pragma (T : Node_Id) return Node_Id is N : Node_Id; begin N := First (Visible_Declarations (T)); while Present (N) loop if Nkind (N) = N_Pragma and then Pragma_Name (N) = Name_Relative_Deadline then return N; end if; Next (N); end loop; N := First (Private_Declarations (T)); while Present (N) loop if Nkind (N) = N_Pragma and then Pragma_Name (N) = Name_Relative_Deadline then return N; end if; Next (N); end loop; raise Program_Error; end Get_Relative_Deadline_Pragma; -- Start of processing for Expand_N_Task_Type_Declaration begin -- If already expanded, nothing to do if Present (Corresponding_Record_Type (Tasktyp)) then return; end if; -- Here we will do the expansion Rec_Decl := Build_Corresponding_Record (N, Tasktyp, Loc); Rec_Ent := Defining_Identifier (Rec_Decl); Cdecls := Component_Items (Component_List (Type_Definition (Rec_Decl))); Qualify_Entity_Names (N); -- First create the elaboration variable Elab_Decl := Make_Object_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Sloc (Tasktyp), Chars => New_External_Name (Tasknm, 'E')), Aliased_Present => True, Object_Definition => New_Occurrence_Of (Standard_Boolean, Loc), Expression => New_Occurrence_Of (Standard_False, Loc)); Insert_After (N, Elab_Decl); -- Next create the declaration of the size variable (tasknmZ) Set_Storage_Size_Variable (Tasktyp, Make_Defining_Identifier (Sloc (Tasktyp), Chars => New_External_Name (Tasknm, 'Z'))); if Present (Taskdef) and then Has_Storage_Size_Pragma (Taskdef) and then Is_OK_Static_Expression (Expression (First (Pragma_Argument_Associations (Get_Rep_Pragma (TaskId, Name_Storage_Size))))) then Size_Decl := Make_Object_Declaration (Loc, Defining_Identifier => Storage_Size_Variable (Tasktyp), Object_Definition => New_Occurrence_Of (RTE (RE_Size_Type), Loc), Expression => Convert_To (RTE (RE_Size_Type), Relocate_Node (Expression (First (Pragma_Argument_Associations (Get_Rep_Pragma (TaskId, Name_Storage_Size))))))); else Size_Decl := Make_Object_Declaration (Loc, Defining_Identifier => Storage_Size_Variable (Tasktyp), Object_Definition => New_Occurrence_Of (RTE (RE_Size_Type), Loc), Expression => New_Occurrence_Of (RTE (RE_Unspecified_Size), Loc)); end if; Insert_After (Elab_Decl, Size_Decl); -- Next build the rest of the corresponding record declaration. This is -- done last, since the corresponding record initialization procedure -- will reference the previously created entities. -- Fill in the component declarations -- first the _Task_Id field Append_To (Cdecls, Make_Component_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uTask_Id), Component_Definition => Make_Component_Definition (Loc, Aliased_Present => False, Subtype_Indication => New_Occurrence_Of (RTE (RO_ST_Task_Id), Loc)))); -- Declare static ATCB (that is, created by the expander) if we are -- using the Restricted run time. if Restricted_Profile then Append_To (Cdecls, Make_Component_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uATCB), Component_Definition => Make_Component_Definition (Loc, Aliased_Present => True, Subtype_Indication => Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (RTE (RE_Ada_Task_Control_Block), Loc), Constraint => Make_Index_Or_Discriminant_Constraint (Loc, Constraints => New_List (Make_Integer_Literal (Loc, 0))))))); end if; -- Declare static stack (that is, created by the expander) if we are -- using the Restricted run time on a bare board configuration. if Restricted_Profile and then Preallocated_Stacks_On_Target then -- First we need to extract the appropriate stack size Ent_Stack := Make_Defining_Identifier (Loc, Name_uStack); if Present (Taskdef) and then Has_Storage_Size_Pragma (Taskdef) then declare Expr_N : constant Node_Id := Expression (First ( Pragma_Argument_Associations ( Get_Rep_Pragma (TaskId, Name_Storage_Size)))); Etyp : constant Entity_Id := Etype (Expr_N); P : constant Node_Id := Parent (Expr_N); begin -- The stack is defined inside the corresponding record. -- Therefore if the size of the stack is set by means of -- a discriminant, we must reference the discriminant of the -- corresponding record type. if Nkind (Expr_N) in N_Has_Entity and then Present (Discriminal_Link (Entity (Expr_N))) then Task_Size := New_Occurrence_Of (CR_Discriminant (Discriminal_Link (Entity (Expr_N))), Loc); Set_Parent (Task_Size, P); Set_Etype (Task_Size, Etyp); Set_Analyzed (Task_Size); else Task_Size := New_Copy_Tree (Expr_N); end if; end; else Task_Size := New_Occurrence_Of (RTE (RE_Default_Stack_Size), Loc); end if; Decl_Stack := Make_Component_Declaration (Loc, Defining_Identifier => Ent_Stack, Component_Definition => Make_Component_Definition (Loc, Aliased_Present => True, Subtype_Indication => Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (RTE (RE_Storage_Array), Loc), Constraint => Make_Index_Or_Discriminant_Constraint (Loc, Constraints => New_List (Make_Range (Loc, Low_Bound => Make_Integer_Literal (Loc, 1), High_Bound => Convert_To (RTE (RE_Storage_Offset), Task_Size))))))); Append_To (Cdecls, Decl_Stack); -- The appropriate alignment for the stack is ensured by the run-time -- code in charge of task creation. end if; -- Declare a static secondary stack if the conditions for a statically -- generated stack are met. if Create_Secondary_Stack_For_Task (TaskId) then declare Size_Expr : constant Node_Id := Expression (First ( Pragma_Argument_Associations ( Get_Rep_Pragma (TaskId, Name_Secondary_Stack_Size)))); Stack_Size : Node_Id; begin -- The secondary stack is defined inside the corresponding -- record. Therefore if the size of the stack is set by means -- of a discriminant, we must reference the discriminant of the -- corresponding record type. if Nkind (Size_Expr) in N_Has_Entity and then Present (Discriminal_Link (Entity (Size_Expr))) then Stack_Size := New_Occurrence_Of (CR_Discriminant (Discriminal_Link (Entity (Size_Expr))), Loc); Set_Parent (Stack_Size, Parent (Size_Expr)); Set_Etype (Stack_Size, Etype (Size_Expr)); Set_Analyzed (Stack_Size); else Stack_Size := New_Copy_Tree (Size_Expr); end if; -- Create the secondary stack for the task Decl_SS := Make_Component_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uSecondary_Stack), Component_Definition => Make_Component_Definition (Loc, Aliased_Present => True, Subtype_Indication => Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (RTE (RE_SS_Stack), Loc), Constraint => Make_Index_Or_Discriminant_Constraint (Loc, Constraints => New_List ( Convert_To (RTE (RE_Size_Type), Stack_Size)))))); Append_To (Cdecls, Decl_SS); end; end if; -- Add components for entry families Collect_Entry_Families (Loc, Cdecls, Size_Decl, Tasktyp); -- Add the _Priority component if a Interrupt_Priority or Priority rep -- item is present. if Has_Rep_Item (TaskId, Name_Priority, Check_Parents => False) then Append_To (Cdecls, Make_Component_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uPriority), Component_Definition => Make_Component_Definition (Loc, Aliased_Present => False, Subtype_Indication => New_Occurrence_Of (Standard_Integer, Loc)))); end if; -- Add the _Size component if a Storage_Size pragma is present if Present (Taskdef) and then Has_Storage_Size_Pragma (Taskdef) then Append_To (Cdecls, Make_Component_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uSize), Component_Definition => Make_Component_Definition (Loc, Aliased_Present => False, Subtype_Indication => New_Occurrence_Of (RTE (RE_Size_Type), Loc)), Expression => Convert_To (RTE (RE_Size_Type), New_Copy_Tree ( Expression (First ( Pragma_Argument_Associations ( Get_Rep_Pragma (TaskId, Name_Storage_Size)))))))); end if; -- Add the _Secondary_Stack_Size component if a Secondary_Stack_Size -- pragma is present. if Has_Rep_Pragma (TaskId, Name_Secondary_Stack_Size, Check_Parents => False) then Append_To (Cdecls, Make_Component_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uSecondary_Stack_Size), Component_Definition => Make_Component_Definition (Loc, Aliased_Present => False, Subtype_Indication => New_Occurrence_Of (RTE (RE_Size_Type), Loc)))); end if; -- Add the _Task_Info component if a Task_Info pragma is present if Has_Rep_Pragma (TaskId, Name_Task_Info, Check_Parents => False) then Append_To (Cdecls, Make_Component_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uTask_Info), Component_Definition => Make_Component_Definition (Loc, Aliased_Present => False, Subtype_Indication => New_Occurrence_Of (RTE (RE_Task_Info_Type), Loc)), Expression => New_Copy ( Expression (First ( Pragma_Argument_Associations ( Get_Rep_Pragma (TaskId, Name_Task_Info, Check_Parents => False))))))); end if; -- Add the _CPU component if a CPU rep item is present if Has_Rep_Item (TaskId, Name_CPU, Check_Parents => False) then Append_To (Cdecls, Make_Component_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uCPU), Component_Definition => Make_Component_Definition (Loc, Aliased_Present => False, Subtype_Indication => New_Occurrence_Of (RTE (RE_CPU_Range), Loc)))); end if; -- Add the _Relative_Deadline component if a Relative_Deadline pragma is -- present. If we are using a restricted run time this component will -- not be added (deadlines are not allowed by the Ravenscar profile), -- unless the task dispatching policy is EDF (for GNAT_Ravenscar_EDF -- profile). if (not Restricted_Profile or else Task_Dispatching_Policy = 'E') and then Present (Taskdef) and then Has_Relative_Deadline_Pragma (Taskdef) then Append_To (Cdecls, Make_Component_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uRelative_Deadline), Component_Definition => Make_Component_Definition (Loc, Aliased_Present => False, Subtype_Indication => New_Occurrence_Of (RTE (RE_Time_Span), Loc)), Expression => Convert_To (RTE (RE_Time_Span), New_Copy_Tree ( Expression (First ( Pragma_Argument_Associations ( Get_Relative_Deadline_Pragma (Taskdef)))))))); end if; -- Add the _Dispatching_Domain component if a Dispatching_Domain rep -- item is present. If we are using a restricted run time this component -- will not be added (dispatching domains are not allowed by the -- Ravenscar profile). if not Restricted_Profile and then Has_Rep_Item (TaskId, Name_Dispatching_Domain, Check_Parents => False) then Append_To (Cdecls, Make_Component_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uDispatching_Domain), Component_Definition => Make_Component_Definition (Loc, Aliased_Present => False, Subtype_Indication => New_Occurrence_Of (RTE (RE_Dispatching_Domain_Access), Loc)))); end if; Insert_After (Size_Decl, Rec_Decl); -- Analyze the record declaration immediately after construction, -- because the initialization procedure is needed for single task -- declarations before the next entity is analyzed. Analyze (Rec_Decl); -- Create the declaration of the task body procedure Proc_Spec := Build_Task_Proc_Specification (Tasktyp); Body_Decl := Make_Subprogram_Declaration (Loc, Specification => Proc_Spec); Set_Is_Task_Body_Procedure (Body_Decl); Insert_After (Rec_Decl, Body_Decl); -- The subprogram does not comes from source, so we have to indicate the -- need for debugging information explicitly. if Comes_From_Source (Original_Node (N)) then Set_Debug_Info_Needed (Defining_Entity (Proc_Spec)); end if; -- Ada 2005 (AI-345): Construct the primitive entry wrapper specs before -- the corresponding record has been frozen. if Ada_Version >= Ada_2005 then Build_Wrapper_Specs (Loc, Tasktyp, Rec_Decl); end if; -- Ada 2005 (AI-345): We must defer freezing to allow further -- declaration of primitive subprograms covering task interfaces if Ada_Version <= Ada_95 then -- Now we can freeze the corresponding record. This needs manually -- freezing, since it is really part of the task type, and the task -- type is frozen at this stage. We of course need the initialization -- procedure for this corresponding record type and we won't get it -- in time if we don't freeze now. declare L : constant List_Id := Freeze_Entity (Rec_Ent, N); begin if Is_Non_Empty_List (L) then Insert_List_After (Body_Decl, L); end if; end; end if; -- Complete the expansion of access types to the current task type, if -- any were declared. Expand_Previous_Access_Type (Tasktyp); -- Create wrappers for entries that have contract cases, preconditions -- and postconditions. declare Ent : Entity_Id; begin Ent := First_Entity (Tasktyp); while Present (Ent) loop if Ekind (Ent) in E_Entry | E_Entry_Family then Build_Contract_Wrapper (Ent, N); end if; Next_Entity (Ent); end loop; end; end Expand_N_Task_Type_Declaration; ------------------------------- -- Expand_N_Timed_Entry_Call -- ------------------------------- -- A timed entry call in normal case is not implemented using ATC mechanism -- anymore for efficiency reason. -- select -- T.E; -- S1; -- or -- delay D; -- S2; -- end select; -- is expanded as follows: -- 1) When T.E is a task entry_call; -- declare -- B : Boolean; -- X : Task_Entry_Index := <entry index>; -- DX : Duration := To_Duration (D); -- M : Delay_Mode := <discriminant>; -- P : parms := (parm, parm, parm); -- begin -- Timed_Protected_Entry_Call -- (<acceptor-task>, X, P'Address, DX, M, B); -- if B then -- S1; -- else -- S2; -- end if; -- end; -- 2) When T.E is a protected entry_call; -- declare -- B : Boolean; -- X : Protected_Entry_Index := <entry index>; -- DX : Duration := To_Duration (D); -- M : Delay_Mode := <discriminant>; -- P : parms := (parm, parm, parm); -- begin -- Timed_Protected_Entry_Call -- (<object>'unchecked_access, X, P'Address, DX, M, B); -- if B then -- S1; -- else -- S2; -- end if; -- end; -- 3) Ada 2005 (AI-345): When T.E is a dispatching procedure call, there -- is no delay and the triggering statements are executed. We first -- determine the kind of the triggering call and then execute a -- synchronized operation or a direct call. -- declare -- B : Boolean := False; -- C : Ada.Tags.Prim_Op_Kind; -- DX : Duration := To_Duration (D) -- K : Ada.Tags.Tagged_Kind := -- Ada.Tags.Get_Tagged_Kind (Ada.Tags.Tag (<object>)); -- M : Integer :=...; -- P : Parameters := (Param1 .. ParamN); -- S : Integer; -- begin -- if K = Ada.Tags.TK_Limited_Tagged -- or else K = Ada.Tags.TK_Tagged -- then -- <dispatching-call>; -- B := True; -- else -- S := -- Ada.Tags.Get_Offset_Index -- (Ada.Tags.Tag (<object>), DT_Position (<dispatching-call>)); -- _Disp_Timed_Select (<object>, S, P'Address, DX, M, C, B); -- if C = POK_Protected_Entry -- or else C = POK_Task_Entry -- then -- Param1 := P.Param1; -- ... -- ParamN := P.ParamN; -- end if; -- if B then -- if C = POK_Procedure -- or else C = POK_Protected_Procedure -- or else C = POK_Task_Procedure -- then -- <dispatching-call>; -- end if; -- end if; -- end if; -- if B then -- <triggering-statements> -- else -- <timed-statements> -- end if; -- end; -- The triggering statement and the sequence of timed statements have not -- been analyzed yet (see Analyzed_Timed_Entry_Call), but they may contain -- global references if within an instantiation. procedure Expand_N_Timed_Entry_Call (N : Node_Id) is Actuals : List_Id; Blk_Typ : Entity_Id; Call : Node_Id; Call_Ent : Entity_Id; Conc_Typ_Stmts : List_Id; Concval : Node_Id := Empty; -- init to avoid warning D_Alt : constant Node_Id := Delay_Alternative (N); D_Conv : Node_Id; D_Disc : Node_Id; D_Stat : Node_Id := Delay_Statement (D_Alt); D_Stats : List_Id; D_Type : Entity_Id; Decls : List_Id; Dummy : Node_Id; E_Alt : constant Node_Id := Entry_Call_Alternative (N); E_Call : Node_Id := Entry_Call_Statement (E_Alt); E_Stats : List_Id; Ename : Node_Id; Formals : List_Id; Index : Node_Id; Is_Disp_Select : Boolean; Lim_Typ_Stmts : List_Id; Loc : constant Source_Ptr := Sloc (D_Stat); N_Stats : List_Id; Obj : Entity_Id; Param : Node_Id; Params : List_Id; Stmt : Node_Id; Stmts : List_Id; Unpack : List_Id; B : Entity_Id; -- Call status flag C : Entity_Id; -- Call kind D : Entity_Id; -- Delay K : Entity_Id; -- Tagged kind M : Entity_Id; -- Delay mode P : Entity_Id; -- Parameter block S : Entity_Id; -- Primitive operation slot -- Start of processing for Expand_N_Timed_Entry_Call begin -- Under the Ravenscar profile, timed entry calls are excluded. An error -- was already reported on spec, so do not attempt to expand the call. if Restriction_Active (No_Select_Statements) then return; end if; Process_Statements_For_Controlled_Objects (E_Alt); Process_Statements_For_Controlled_Objects (D_Alt); Ensure_Statement_Present (Sloc (D_Stat), D_Alt); -- Retrieve E_Stats and D_Stats now because the finalization machinery -- may wrap them in blocks. E_Stats := Statements (E_Alt); D_Stats := Statements (D_Alt); -- The arguments in the call may require dynamic allocation, and the -- call statement may have been transformed into a block. The block -- may contain additional declarations for internal entities, and the -- original call is found by sequential search. if Nkind (E_Call) = N_Block_Statement then E_Call := First (Statements (Handled_Statement_Sequence (E_Call))); while Nkind (E_Call) not in N_Procedure_Call_Statement | N_Entry_Call_Statement loop Next (E_Call); end loop; end if; Is_Disp_Select := Ada_Version >= Ada_2005 and then Nkind (E_Call) = N_Procedure_Call_Statement; if Is_Disp_Select then Extract_Dispatching_Call (E_Call, Call_Ent, Obj, Actuals, Formals); Decls := New_List; Stmts := New_List; -- Generate: -- B : Boolean := False; B := Build_B (Loc, Decls); -- Generate: -- C : Ada.Tags.Prim_Op_Kind; C := Build_C (Loc, Decls); -- Because the analysis of all statements was disabled, manually -- analyze the delay statement. Analyze (D_Stat); D_Stat := Original_Node (D_Stat); else -- Build an entry call using Simple_Entry_Call Extract_Entry (E_Call, Concval, Ename, Index); Build_Simple_Entry_Call (E_Call, Concval, Ename, Index); Decls := Declarations (E_Call); Stmts := Statements (Handled_Statement_Sequence (E_Call)); if No (Decls) then Decls := New_List; end if; -- Generate: -- B : Boolean; B := Make_Defining_Identifier (Loc, Name_uB); Prepend_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => B, Object_Definition => New_Occurrence_Of (Standard_Boolean, Loc))); end if; -- Duration and mode processing D_Type := Base_Type (Etype (Expression (D_Stat))); -- Use the type of the delay expression (Calendar or Real_Time) to -- generate the appropriate conversion. if Nkind (D_Stat) = N_Delay_Relative_Statement then D_Disc := Make_Integer_Literal (Loc, 0); D_Conv := Relocate_Node (Expression (D_Stat)); elsif Is_RTE (D_Type, RO_CA_Time) then D_Disc := Make_Integer_Literal (Loc, 1); D_Conv := Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RO_CA_To_Duration), Loc), Parameter_Associations => New_List (New_Copy (Expression (D_Stat)))); else pragma Assert (Is_RTE (D_Type, RO_RT_Time)); D_Disc := Make_Integer_Literal (Loc, 2); D_Conv := Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RO_RT_To_Duration), Loc), Parameter_Associations => New_List (New_Copy (Expression (D_Stat)))); end if; D := Make_Temporary (Loc, 'D'); -- Generate: -- D : Duration; Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => D, Object_Definition => New_Occurrence_Of (Standard_Duration, Loc))); M := Make_Temporary (Loc, 'M'); -- Generate: -- M : Integer := (0 | 1 | 2); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => M, Object_Definition => New_Occurrence_Of (Standard_Integer, Loc), Expression => D_Disc)); -- Parameter block processing -- Manually create the parameter block for dispatching calls. In the -- case of entries, the block has already been created during the call -- to Build_Simple_Entry_Call. if Is_Disp_Select then -- Compute the delay at this stage because the evaluation of its -- expression must not occur earlier (see ACVC C97302A). Append_To (Stmts, Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (D, Loc), Expression => D_Conv)); -- Tagged kind processing, generate: -- K : Ada.Tags.Tagged_Kind := -- Ada.Tags.Get_Tagged_Kind (Ada.Tags.Tag <object>)); K := Build_K (Loc, Decls, Obj); Blk_Typ := Build_Parameter_Block (Loc, Actuals, Formals, Decls); P := Parameter_Block_Pack (Loc, Blk_Typ, Actuals, Formals, Decls, Stmts); -- Dispatch table slot processing, generate: -- S : Integer; S := Build_S (Loc, Decls); -- Generate: -- S := Ada.Tags.Get_Offset_Index -- (Ada.Tags.Tag (<object>), DT_Position (Call_Ent)); Conc_Typ_Stmts := New_List (Build_S_Assignment (Loc, S, Obj, Call_Ent)); -- Generate: -- _Disp_Timed_Select (<object>, S, P'Address, D, M, C, B); -- where Obj is the controlling formal parameter, S is the dispatch -- table slot number of the dispatching operation, P is the wrapped -- parameter block, D is the duration, M is the duration mode, C is -- the call kind and B is the call status. Params := New_List; Append_To (Params, New_Copy_Tree (Obj)); Append_To (Params, New_Occurrence_Of (S, Loc)); Append_To (Params, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (P, Loc), Attribute_Name => Name_Address)); Append_To (Params, New_Occurrence_Of (D, Loc)); Append_To (Params, New_Occurrence_Of (M, Loc)); Append_To (Params, New_Occurrence_Of (C, Loc)); Append_To (Params, New_Occurrence_Of (B, Loc)); Append_To (Conc_Typ_Stmts, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Find_Prim_Op (Etype (Etype (Obj)), Name_uDisp_Timed_Select), Loc), Parameter_Associations => Params)); -- Generate: -- if C = POK_Protected_Entry -- or else C = POK_Task_Entry -- then -- Param1 := P.Param1; -- ... -- ParamN := P.ParamN; -- end if; Unpack := Parameter_Block_Unpack (Loc, P, Actuals, Formals); -- Generate the if statement only when the packed parameters need -- explicit assignments to their corresponding actuals. if Present (Unpack) then Append_To (Conc_Typ_Stmts, Make_Implicit_If_Statement (N, Condition => Make_Or_Else (Loc, Left_Opnd => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (C, Loc), Right_Opnd => New_Occurrence_Of (RTE (RE_POK_Protected_Entry), Loc)), Right_Opnd => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (C, Loc), Right_Opnd => New_Occurrence_Of (RTE (RE_POK_Task_Entry), Loc))), Then_Statements => Unpack)); end if; -- Generate: -- if B then -- if C = POK_Procedure -- or else C = POK_Protected_Procedure -- or else C = POK_Task_Procedure -- then -- <dispatching-call> -- end if; -- end if; N_Stats := New_List ( Make_Implicit_If_Statement (N, Condition => Make_Or_Else (Loc, Left_Opnd => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (C, Loc), Right_Opnd => New_Occurrence_Of (RTE (RE_POK_Procedure), Loc)), Right_Opnd => Make_Or_Else (Loc, Left_Opnd => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (C, Loc), Right_Opnd => New_Occurrence_Of (RTE ( RE_POK_Protected_Procedure), Loc)), Right_Opnd => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (C, Loc), Right_Opnd => New_Occurrence_Of (RTE (RE_POK_Task_Procedure), Loc)))), Then_Statements => New_List (E_Call))); Append_To (Conc_Typ_Stmts, Make_Implicit_If_Statement (N, Condition => New_Occurrence_Of (B, Loc), Then_Statements => N_Stats)); -- Generate: -- <dispatching-call>; -- B := True; Lim_Typ_Stmts := New_List (New_Copy_Tree (E_Call), Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (B, Loc), Expression => New_Occurrence_Of (Standard_True, Loc))); -- Generate: -- if K = Ada.Tags.TK_Limited_Tagged -- or else K = Ada.Tags.TK_Tagged -- then -- Lim_Typ_Stmts -- else -- Conc_Typ_Stmts -- end if; Append_To (Stmts, Make_Implicit_If_Statement (N, Condition => Build_Dispatching_Tag_Check (K, N), Then_Statements => Lim_Typ_Stmts, Else_Statements => Conc_Typ_Stmts)); -- Generate: -- if B then -- <triggering-statements> -- else -- <timed-statements> -- end if; Append_To (Stmts, Make_Implicit_If_Statement (N, Condition => New_Occurrence_Of (B, Loc), Then_Statements => E_Stats, Else_Statements => D_Stats)); else -- Simple case of a nondispatching trigger. Skip assignments to -- temporaries created for in-out parameters. -- This makes unwarranted assumptions about the shape of the expanded -- tree for the call, and should be cleaned up ??? Stmt := First (Stmts); while Nkind (Stmt) /= N_Procedure_Call_Statement loop Next (Stmt); end loop; -- Compute the delay at this stage because the evaluation of -- its expression must not occur earlier (see ACVC C97302A). Insert_Before (Stmt, Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (D, Loc), Expression => D_Conv)); Call := Stmt; Params := Parameter_Associations (Call); -- For a protected type, we build a Timed_Protected_Entry_Call if Is_Protected_Type (Etype (Concval)) then -- Create a new call statement Param := First (Params); while Present (Param) and then not Is_RTE (Etype (Param), RE_Call_Modes) loop Next (Param); end loop; Dummy := Remove_Next (Next (Param)); -- Remove garbage is following the Cancel_Param if present Dummy := Next (Param); -- Remove the mode of the Protected_Entry_Call call, then remove -- the Communication_Block of the Protected_Entry_Call call, and -- finally add Duration and a Delay_Mode parameter pragma Assert (Present (Param)); Rewrite (Param, New_Occurrence_Of (D, Loc)); Rewrite (Dummy, New_Occurrence_Of (M, Loc)); -- Add a Boolean flag for successful entry call Append_To (Params, New_Occurrence_Of (B, Loc)); case Corresponding_Runtime_Package (Etype (Concval)) is when System_Tasking_Protected_Objects_Entries => Rewrite (Call, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Timed_Protected_Entry_Call), Loc), Parameter_Associations => Params)); when others => raise Program_Error; end case; -- For the task case, build a Timed_Task_Entry_Call else -- Create a new call statement Append_To (Params, New_Occurrence_Of (D, Loc)); Append_To (Params, New_Occurrence_Of (M, Loc)); Append_To (Params, New_Occurrence_Of (B, Loc)); Rewrite (Call, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Timed_Task_Entry_Call), Loc), Parameter_Associations => Params)); end if; Append_To (Stmts, Make_Implicit_If_Statement (N, Condition => New_Occurrence_Of (B, Loc), Then_Statements => E_Stats, Else_Statements => D_Stats)); end if; Rewrite (N, Make_Block_Statement (Loc, Declarations => Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Stmts))); Analyze (N); -- Some items in Decls used to be in the N_Block in E_Call that is -- constructed in Expand_Entry_Call, and are now in the new Block -- into which N has been rewritten. Adjust their scopes to reflect that. if Nkind (E_Call) = N_Block_Statement then Obj := First_Entity (Entity (Identifier (E_Call))); while Present (Obj) loop Set_Scope (Obj, Entity (Identifier (N))); Next_Entity (Obj); end loop; end if; Reset_Scopes_To (N, Entity (Identifier (N))); end Expand_N_Timed_Entry_Call; ---------------------------------------- -- Expand_Protected_Body_Declarations -- ---------------------------------------- procedure Expand_Protected_Body_Declarations (N : Node_Id; Spec_Id : Entity_Id) is begin if No_Run_Time_Mode then Error_Msg_CRT ("protected body", N); return; elsif Expander_Active then -- Associate discriminals with the first subprogram or entry body to -- be expanded. if Present (First_Protected_Operation (Declarations (N))) then Set_Discriminals (Parent (Spec_Id)); end if; end if; end Expand_Protected_Body_Declarations; ------------------------- -- External_Subprogram -- ------------------------- function External_Subprogram (E : Entity_Id) return Entity_Id is Subp : constant Entity_Id := Protected_Body_Subprogram (E); begin -- The internal and external subprograms follow each other on the entity -- chain. Note that previously private operations had no separate -- external subprogram. We now create one in all cases, because a -- private operation may actually appear in an external call, through -- a 'Access reference used for a callback. -- If the operation is a function that returns an anonymous access type, -- the corresponding itype appears before the operation, and must be -- skipped. -- This mechanism is fragile, there should be a real link between the -- two versions of the operation, but there is no place to put it ??? if Is_Access_Type (Next_Entity (Subp)) then return Next_Entity (Next_Entity (Subp)); else return Next_Entity (Subp); end if; end External_Subprogram; ------------------------------ -- Extract_Dispatching_Call -- ------------------------------ procedure Extract_Dispatching_Call (N : Node_Id; Call_Ent : out Entity_Id; Object : out Entity_Id; Actuals : out List_Id; Formals : out List_Id) is Call_Nam : Node_Id; begin pragma Assert (Nkind (N) = N_Procedure_Call_Statement); if Present (Original_Node (N)) then Call_Nam := Name (Original_Node (N)); else Call_Nam := Name (N); end if; -- Retrieve the name of the dispatching procedure. It contains the -- dispatch table slot number. loop case Nkind (Call_Nam) is when N_Identifier => exit; when N_Selected_Component => Call_Nam := Selector_Name (Call_Nam); when others => raise Program_Error; end case; end loop; Actuals := Parameter_Associations (N); Call_Ent := Entity (Call_Nam); Formals := Parameter_Specifications (Parent (Call_Ent)); Object := First (Actuals); if Present (Original_Node (Object)) then Object := Original_Node (Object); end if; -- If the type of the dispatching object is an access type then return -- an explicit dereference of a copy of the object, and note that this -- is the controlling actual of the call. if Is_Access_Type (Etype (Object)) then Object := Make_Explicit_Dereference (Sloc (N), New_Copy_Tree (Object)); Analyze (Object); Set_Is_Controlling_Actual (Object); end if; end Extract_Dispatching_Call; ------------------- -- Extract_Entry -- ------------------- procedure Extract_Entry (N : Node_Id; Concval : out Node_Id; Ename : out Node_Id; Index : out Node_Id) is Nam : constant Node_Id := Name (N); begin -- For a simple entry, the name is a selected component, with the -- prefix being the task value, and the selector being the entry. if Nkind (Nam) = N_Selected_Component then Concval := Prefix (Nam); Ename := Selector_Name (Nam); Index := Empty; -- For a member of an entry family, the name is an indexed component -- where the prefix is a selected component, whose prefix in turn is -- the task value, and whose selector is the entry family. The single -- expression in the expressions list of the indexed component is the -- subscript for the family. else pragma Assert (Nkind (Nam) = N_Indexed_Component); Concval := Prefix (Prefix (Nam)); Ename := Selector_Name (Prefix (Nam)); Index := First (Expressions (Nam)); end if; -- Through indirection, the type may actually be a limited view of a -- concurrent type. When compiling a call, the non-limited view of the -- type is visible. if From_Limited_With (Etype (Concval)) then Set_Etype (Concval, Non_Limited_View (Etype (Concval))); end if; end Extract_Entry; ------------------- -- Family_Offset -- ------------------- function Family_Offset (Loc : Source_Ptr; Hi : Node_Id; Lo : Node_Id; Ttyp : Entity_Id; Cap : Boolean) return Node_Id is Ityp : Entity_Id; Real_Hi : Node_Id; Real_Lo : Node_Id; function Convert_Discriminant_Ref (Bound : Node_Id) return Node_Id; -- If one of the bounds is a reference to a discriminant, replace with -- corresponding discriminal of type. Within the body of a task retrieve -- the renamed discriminant by simple visibility, using its generated -- name. Within a protected object, find the original discriminant and -- replace it with the discriminal of the current protected operation. ------------------------------ -- Convert_Discriminant_Ref -- ------------------------------ function Convert_Discriminant_Ref (Bound : Node_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (Bound); B : Node_Id; D : Entity_Id; begin if Is_Entity_Name (Bound) and then Ekind (Entity (Bound)) = E_Discriminant then if Is_Task_Type (Ttyp) and then Has_Completion (Ttyp) then B := Make_Identifier (Loc, Chars (Entity (Bound))); Find_Direct_Name (B); elsif Is_Protected_Type (Ttyp) then D := First_Discriminant (Ttyp); while Chars (D) /= Chars (Entity (Bound)) loop Next_Discriminant (D); end loop; B := New_Occurrence_Of (Discriminal (D), Loc); else B := New_Occurrence_Of (Discriminal (Entity (Bound)), Loc); end if; elsif Nkind (Bound) = N_Attribute_Reference then return Bound; else B := New_Copy_Tree (Bound); end if; return Make_Attribute_Reference (Loc, Attribute_Name => Name_Pos, Prefix => New_Occurrence_Of (Etype (Bound), Loc), Expressions => New_List (B)); end Convert_Discriminant_Ref; -- Start of processing for Family_Offset begin Real_Hi := Convert_Discriminant_Ref (Hi); Real_Lo := Convert_Discriminant_Ref (Lo); if Cap then if Is_Task_Type (Ttyp) then Ityp := RTE (RE_Task_Entry_Index); else Ityp := RTE (RE_Protected_Entry_Index); end if; Real_Hi := Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Ityp, Loc), Attribute_Name => Name_Min, Expressions => New_List ( Real_Hi, Make_Integer_Literal (Loc, Entry_Family_Bound - 1))); Real_Lo := Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Ityp, Loc), Attribute_Name => Name_Max, Expressions => New_List ( Real_Lo, Make_Integer_Literal (Loc, -Entry_Family_Bound))); end if; return Make_Op_Subtract (Loc, Real_Hi, Real_Lo); end Family_Offset; ----------------- -- Family_Size -- ----------------- function Family_Size (Loc : Source_Ptr; Hi : Node_Id; Lo : Node_Id; Ttyp : Entity_Id; Cap : Boolean) return Node_Id is Ityp : Entity_Id; begin if Is_Task_Type (Ttyp) then Ityp := RTE (RE_Task_Entry_Index); else Ityp := RTE (RE_Protected_Entry_Index); end if; return Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Ityp, Loc), Attribute_Name => Name_Max, Expressions => New_List ( Make_Op_Add (Loc, Left_Opnd => Family_Offset (Loc, Hi, Lo, Ttyp, Cap), Right_Opnd => Make_Integer_Literal (Loc, 1)), Make_Integer_Literal (Loc, 0))); end Family_Size; ---------------------------- -- Find_Enclosing_Context -- ---------------------------- procedure Find_Enclosing_Context (N : Node_Id; Context : out Node_Id; Context_Id : out Entity_Id; Context_Decls : out List_Id) is begin -- Traverse the parent chain looking for an enclosing body, block, -- package or return statement. Context := Parent (N); while Present (Context) loop if Nkind (Context) in N_Entry_Body | N_Extended_Return_Statement | N_Package_Body | N_Package_Declaration | N_Subprogram_Body | N_Task_Body then exit; -- Do not consider block created to protect a list of statements with -- an Abort_Defer / Abort_Undefer_Direct pair. elsif Nkind (Context) = N_Block_Statement and then not Is_Abort_Block (Context) then exit; end if; Context := Parent (Context); end loop; pragma Assert (Present (Context)); -- Extract the constituents of the context if Nkind (Context) = N_Extended_Return_Statement then Context_Decls := Return_Object_Declarations (Context); Context_Id := Return_Statement_Entity (Context); -- Package declarations and bodies use a common library-level activation -- chain or task master, therefore return the package declaration as the -- proper carrier for the appropriate flag. elsif Nkind (Context) = N_Package_Body then Context_Decls := Declarations (Context); Context_Id := Corresponding_Spec (Context); Context := Parent (Context_Id); if Nkind (Context) = N_Defining_Program_Unit_Name then Context := Parent (Parent (Context)); else Context := Parent (Context); end if; elsif Nkind (Context) = N_Package_Declaration then Context_Decls := Visible_Declarations (Specification (Context)); Context_Id := Defining_Unit_Name (Specification (Context)); if Nkind (Context_Id) = N_Defining_Program_Unit_Name then Context_Id := Defining_Identifier (Context_Id); end if; else if Nkind (Context) = N_Block_Statement then Context_Id := Entity (Identifier (Context)); if No (Declarations (Context)) then Set_Declarations (Context, New_List); end if; elsif Nkind (Context) = N_Entry_Body then Context_Id := Defining_Identifier (Context); elsif Nkind (Context) = N_Subprogram_Body then if Present (Corresponding_Spec (Context)) then Context_Id := Corresponding_Spec (Context); else Context_Id := Defining_Unit_Name (Specification (Context)); if Nkind (Context_Id) = N_Defining_Program_Unit_Name then Context_Id := Defining_Identifier (Context_Id); end if; end if; elsif Nkind (Context) = N_Task_Body then Context_Id := Corresponding_Spec (Context); else raise Program_Error; end if; Context_Decls := Declarations (Context); end if; pragma Assert (Present (Context_Id)); pragma Assert (Present (Context_Decls)); end Find_Enclosing_Context; ----------------------- -- Find_Master_Scope -- ----------------------- function Find_Master_Scope (E : Entity_Id) return Entity_Id is S : Entity_Id; begin -- In Ada 2005, the master is the innermost enclosing scope that is not -- transient. If the enclosing block is the rewriting of a call or the -- scope is an extended return statement this is valid master. The -- master in an extended return is only used within the return, and is -- subsequently overwritten in Move_Activation_Chain, but it must exist -- now before that overwriting occurs. S := Scope (E); if Ada_Version >= Ada_2005 then while Is_Internal (S) loop if Nkind (Parent (S)) = N_Block_Statement and then Has_Master_Entity (S) then exit; elsif Ekind (S) = E_Return_Statement then exit; else S := Scope (S); end if; end loop; end if; return S; end Find_Master_Scope; ------------------------------- -- First_Protected_Operation -- ------------------------------- function First_Protected_Operation (D : List_Id) return Node_Id is First_Op : Node_Id; begin First_Op := First (D); while Present (First_Op) and then Nkind (First_Op) not in N_Subprogram_Body | N_Entry_Body loop Next (First_Op); end loop; return First_Op; end First_Protected_Operation; --------------------------------------- -- Install_Private_Data_Declarations -- --------------------------------------- procedure Install_Private_Data_Declarations (Loc : Source_Ptr; Spec_Id : Entity_Id; Conc_Typ : Entity_Id; Body_Nod : Node_Id; Decls : List_Id; Barrier : Boolean := False; Family : Boolean := False) is Is_Protected : constant Boolean := Is_Protected_Type (Conc_Typ); Decl : Node_Id; Def : Node_Id; Insert_Node : Node_Id := Empty; Obj_Ent : Entity_Id; procedure Add (Decl : Node_Id); -- Add a single declaration after Insert_Node. If this is the first -- addition, Decl is added to the front of Decls and it becomes the -- insertion node. function Replace_Bound (Bound : Node_Id) return Node_Id; -- The bounds of an entry index may depend on discriminants, create a -- reference to the corresponding prival. Otherwise return a duplicate -- of the original bound. --------- -- Add -- --------- procedure Add (Decl : Node_Id) is begin if No (Insert_Node) then Prepend_To (Decls, Decl); else Insert_After (Insert_Node, Decl); end if; Insert_Node := Decl; end Add; ------------------- -- Replace_Bound -- ------------------- function Replace_Bound (Bound : Node_Id) return Node_Id is begin if Nkind (Bound) = N_Identifier and then Is_Discriminal (Entity (Bound)) then return Make_Identifier (Loc, Chars (Entity (Bound))); else return Duplicate_Subexpr (Bound); end if; end Replace_Bound; -- Start of processing for Install_Private_Data_Declarations begin -- Step 1: Retrieve the concurrent object entity. Obj_Ent can denote -- formal parameter _O, _object or _task depending on the context. Obj_Ent := Concurrent_Object (Spec_Id, Conc_Typ); -- Special processing of _O for barrier functions, protected entries -- and families. if Barrier or else (Is_Protected and then (Ekind (Spec_Id) = E_Entry or else Ekind (Spec_Id) = E_Entry_Family)) then declare Conc_Rec : constant Entity_Id := Corresponding_Record_Type (Conc_Typ); Typ_Id : constant Entity_Id := Make_Defining_Identifier (Loc, New_External_Name (Chars (Conc_Rec), 'P')); begin -- Generate: -- type prot_typVP is access prot_typV; Decl := Make_Full_Type_Declaration (Loc, Defining_Identifier => Typ_Id, Type_Definition => Make_Access_To_Object_Definition (Loc, Subtype_Indication => New_Occurrence_Of (Conc_Rec, Loc))); Add (Decl); -- Generate: -- _object : prot_typVP := prot_typV (_O); Decl := Make_Object_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uObject), Object_Definition => New_Occurrence_Of (Typ_Id, Loc), Expression => Unchecked_Convert_To (Typ_Id, New_Occurrence_Of (Obj_Ent, Loc))); Add (Decl); -- Set the reference to the concurrent object Obj_Ent := Defining_Identifier (Decl); end; end if; -- Step 2: Create the Protection object and build its declaration for -- any protected entry (family) of subprogram. Note for the lock-free -- implementation, the Protection object is not needed anymore. if Is_Protected and then not Uses_Lock_Free (Conc_Typ) then declare Prot_Ent : constant Entity_Id := Make_Temporary (Loc, 'R'); Prot_Typ : RE_Id; begin Set_Protection_Object (Spec_Id, Prot_Ent); -- Determine the proper protection type if Has_Attach_Handler (Conc_Typ) and then not Restricted_Profile then Prot_Typ := RE_Static_Interrupt_Protection; elsif Has_Interrupt_Handler (Conc_Typ) and then not Restriction_Active (No_Dynamic_Attachment) then Prot_Typ := RE_Dynamic_Interrupt_Protection; else case Corresponding_Runtime_Package (Conc_Typ) is when System_Tasking_Protected_Objects_Entries => Prot_Typ := RE_Protection_Entries; when System_Tasking_Protected_Objects_Single_Entry => Prot_Typ := RE_Protection_Entry; when System_Tasking_Protected_Objects => Prot_Typ := RE_Protection; when others => raise Program_Error; end case; end if; -- Generate: -- conc_typR : protection_typ renames _object._object; Decl := Make_Object_Renaming_Declaration (Loc, Defining_Identifier => Prot_Ent, Subtype_Mark => New_Occurrence_Of (RTE (Prot_Typ), Loc), Name => Make_Selected_Component (Loc, Prefix => New_Occurrence_Of (Obj_Ent, Loc), Selector_Name => Make_Identifier (Loc, Name_uObject))); Add (Decl); end; end if; -- Step 3: Add discriminant renamings (if any) if Has_Discriminants (Conc_Typ) then declare D : Entity_Id; begin D := First_Discriminant (Conc_Typ); while Present (D) loop -- Adjust the source location Set_Sloc (Discriminal (D), Loc); -- Generate: -- discr_name : discr_typ renames _object.discr_name; -- or -- discr_name : discr_typ renames _task.discr_name; Decl := Make_Object_Renaming_Declaration (Loc, Defining_Identifier => Discriminal (D), Subtype_Mark => New_Occurrence_Of (Etype (D), Loc), Name => Make_Selected_Component (Loc, Prefix => New_Occurrence_Of (Obj_Ent, Loc), Selector_Name => Make_Identifier (Loc, Chars (D)))); Add (Decl); -- Set debug info needed on this renaming declaration even -- though it does not come from source, so that the debugger -- will get the right information for these generated names. Set_Debug_Info_Needed (Discriminal (D)); Next_Discriminant (D); end loop; end; end if; -- Step 4: Add private component renamings (if any) if Is_Protected then Def := Protected_Definition (Parent (Conc_Typ)); if Present (Private_Declarations (Def)) then declare Comp : Node_Id; Comp_Id : Entity_Id; Decl_Id : Entity_Id; begin Comp := First (Private_Declarations (Def)); while Present (Comp) loop if Nkind (Comp) = N_Component_Declaration then Comp_Id := Defining_Identifier (Comp); Decl_Id := Make_Defining_Identifier (Loc, Chars (Comp_Id)); -- Minimal decoration if Ekind (Spec_Id) = E_Function then Set_Ekind (Decl_Id, E_Constant); else Set_Ekind (Decl_Id, E_Variable); end if; Set_Prival (Comp_Id, Decl_Id); Set_Prival_Link (Decl_Id, Comp_Id); Set_Is_Aliased (Decl_Id, Is_Aliased (Comp_Id)); Set_Is_Independent (Decl_Id, Is_Independent (Comp_Id)); -- Generate: -- comp_name : comp_typ renames _object.comp_name; Decl := Make_Object_Renaming_Declaration (Loc, Defining_Identifier => Decl_Id, Subtype_Mark => New_Occurrence_Of (Etype (Comp_Id), Loc), Name => Make_Selected_Component (Loc, Prefix => New_Occurrence_Of (Obj_Ent, Loc), Selector_Name => Make_Identifier (Loc, Chars (Comp_Id)))); Add (Decl); end if; Next (Comp); end loop; end; end if; end if; -- Step 5: Add the declaration of the entry index and the associated -- type for barrier functions and entry families. if (Barrier and Family) or else Ekind (Spec_Id) = E_Entry_Family then declare E : constant Entity_Id := Index_Object (Spec_Id); Index : constant Entity_Id := Defining_Identifier (Entry_Index_Specification (Entry_Body_Formal_Part (Body_Nod))); Index_Con : constant Entity_Id := Make_Defining_Identifier (Loc, Chars (Index)); High : Node_Id; Index_Typ : Entity_Id; Low : Node_Id; begin -- Minimal decoration Set_Ekind (Index_Con, E_Constant); Set_Entry_Index_Constant (Index, Index_Con); Set_Discriminal_Link (Index_Con, Index); -- Retrieve the bounds of the entry family High := Type_High_Bound (Etype (Index)); Low := Type_Low_Bound (Etype (Index)); -- In the simple case the entry family is given by a subtype mark -- and the index constant has the same type. if Is_Entity_Name (Original_Node ( Discrete_Subtype_Definition (Parent (Index)))) then Index_Typ := Etype (Index); -- Otherwise a new subtype declaration is required else High := Replace_Bound (High); Low := Replace_Bound (Low); Index_Typ := Make_Temporary (Loc, 'J'); -- Generate: -- subtype Jnn is <Etype of Index> range Low .. High; Decl := Make_Subtype_Declaration (Loc, Defining_Identifier => Index_Typ, Subtype_Indication => Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (Base_Type (Etype (Index)), Loc), Constraint => Make_Range_Constraint (Loc, Range_Expression => Make_Range (Loc, Low, High)))); Add (Decl); end if; Set_Etype (Index_Con, Index_Typ); -- Create the object which designates the index: -- J : constant Jnn := -- Jnn'Val (_E - <index expr> + Jnn'Pos (Jnn'First)); -- -- where Jnn is the subtype created above or the original type of -- the index, _E is a formal of the protected body subprogram and -- <index expr> is the index of the first family member. Decl := Make_Object_Declaration (Loc, Defining_Identifier => Index_Con, Constant_Present => True, Object_Definition => New_Occurrence_Of (Index_Typ, Loc), Expression => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Index_Typ, Loc), Attribute_Name => Name_Val, Expressions => New_List ( Make_Op_Add (Loc, Left_Opnd => Make_Op_Subtract (Loc, Left_Opnd => New_Occurrence_Of (E, Loc), Right_Opnd => Entry_Index_Expression (Loc, Defining_Identifier (Body_Nod), Empty, Conc_Typ)), Right_Opnd => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Index_Typ, Loc), Attribute_Name => Name_Pos, Expressions => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Index_Typ, Loc), Attribute_Name => Name_First))))))); Add (Decl); end; end if; end Install_Private_Data_Declarations; --------------------------------- -- Is_Potentially_Large_Family -- --------------------------------- function Is_Potentially_Large_Family (Base_Index : Entity_Id; Conctyp : Entity_Id; Lo : Node_Id; Hi : Node_Id) return Boolean is begin return Scope (Base_Index) = Standard_Standard and then Base_Index = Base_Type (Standard_Integer) and then Has_Discriminants (Conctyp) and then Present (Discriminant_Default_Value (First_Discriminant (Conctyp))) and then (Denotes_Discriminant (Lo, True) or else Denotes_Discriminant (Hi, True)); end Is_Potentially_Large_Family; ------------------------------------- -- Is_Private_Primitive_Subprogram -- ------------------------------------- function Is_Private_Primitive_Subprogram (Id : Entity_Id) return Boolean is begin return (Ekind (Id) = E_Function or else Ekind (Id) = E_Procedure) and then Is_Private_Primitive (Id); end Is_Private_Primitive_Subprogram; ------------------ -- Index_Object -- ------------------ function Index_Object (Spec_Id : Entity_Id) return Entity_Id is Bod_Subp : constant Entity_Id := Protected_Body_Subprogram (Spec_Id); Formal : Entity_Id; begin Formal := First_Formal (Bod_Subp); while Present (Formal) loop -- Look for formal parameter _E if Chars (Formal) = Name_uE then return Formal; end if; Next_Formal (Formal); end loop; -- A protected body subprogram should always have the parameter in -- question. raise Program_Error; end Index_Object; -------------------------------- -- Make_Initialize_Protection -- -------------------------------- function Make_Initialize_Protection (Protect_Rec : Entity_Id) return List_Id is Loc : constant Source_Ptr := Sloc (Protect_Rec); P_Arr : Entity_Id; Pdec : Node_Id; Ptyp : constant Node_Id := Corresponding_Concurrent_Type (Protect_Rec); Args : List_Id; L : constant List_Id := New_List; Has_Entry : constant Boolean := Has_Entries (Ptyp); Prio_Type : Entity_Id; Prio_Var : Entity_Id := Empty; Restricted : constant Boolean := Restricted_Profile; begin -- We may need two calls to properly initialize the object, one to -- Initialize_Protection, and possibly one to Install_Handlers if we -- have a pragma Attach_Handler. -- Get protected declaration. In the case of a task type declaration, -- this is simply the parent of the protected type entity. In the single -- protected object declaration, this parent will be the implicit type, -- and we can find the corresponding single protected object declaration -- by searching forward in the declaration list in the tree. -- Is the test for N_Single_Protected_Declaration needed here??? Nodes -- of this type should have been removed during semantic analysis. Pdec := Parent (Ptyp); while Nkind (Pdec) not in N_Protected_Type_Declaration | N_Single_Protected_Declaration loop Next (Pdec); end loop; -- Build the parameter list for the call. Note that _Init is the name -- of the formal for the object to be initialized, which is the task -- value record itself. Args := New_List; -- For lock-free implementation, skip initializations of the Protection -- object. if not Uses_Lock_Free (Defining_Identifier (Pdec)) then -- Object parameter. This is a pointer to the object of type -- Protection used by the GNARL to control the protected object. Append_To (Args, Make_Attribute_Reference (Loc, Prefix => Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uObject)), Attribute_Name => Name_Unchecked_Access)); -- Priority parameter. Set to Unspecified_Priority unless there is a -- Priority rep item, in which case we take the value from the pragma -- or attribute definition clause, or there is an Interrupt_Priority -- rep item and no Priority rep item, and we set the ceiling to -- Interrupt_Priority'Last, an implementation-defined value, see -- (RM D.3(10)). if Has_Rep_Item (Ptyp, Name_Priority, Check_Parents => False) then declare Prio_Clause : constant Node_Id := Get_Rep_Item (Ptyp, Name_Priority, Check_Parents => False); Prio : Node_Id; begin -- Pragma Priority if Nkind (Prio_Clause) = N_Pragma then Prio := Expression (First (Pragma_Argument_Associations (Prio_Clause))); -- Get_Rep_Item returns either priority pragma if Pragma_Name (Prio_Clause) = Name_Priority then Prio_Type := RTE (RE_Any_Priority); else Prio_Type := RTE (RE_Interrupt_Priority); end if; -- Attribute definition clause Priority else if Chars (Prio_Clause) = Name_Priority then Prio_Type := RTE (RE_Any_Priority); else Prio_Type := RTE (RE_Interrupt_Priority); end if; Prio := Expression (Prio_Clause); end if; -- Always create a locale variable to capture the priority. -- The priority is also passed to Install_Restriced_Handlers. -- Note that it is really necessary to create this variable -- explicitly. It might be thought that removing side effects -- would the appropriate approach, but that could generate -- declarations improperly placed in the enclosing scope. Prio_Var := Make_Temporary (Loc, 'R', Prio); Append_To (L, Make_Object_Declaration (Loc, Defining_Identifier => Prio_Var, Object_Definition => New_Occurrence_Of (Prio_Type, Loc), Expression => Relocate_Node (Prio))); Append_To (Args, New_Occurrence_Of (Prio_Var, Loc)); end; -- When no priority is specified but an xx_Handler pragma is, we -- default to System.Interrupts.Default_Interrupt_Priority, see -- D.3(10). elsif Has_Attach_Handler (Ptyp) or else Has_Interrupt_Handler (Ptyp) then Append_To (Args, New_Occurrence_Of (RTE (RE_Default_Interrupt_Priority), Loc)); -- Normal case, no priority or xx_Handler specified, default priority else Append_To (Args, New_Occurrence_Of (RTE (RE_Unspecified_Priority), Loc)); end if; -- Deadline_Floor parameter for GNAT_Ravenscar_EDF runtimes if Restricted_Profile and Task_Dispatching_Policy = 'E' then Deadline_Floor : declare Item : constant Node_Id := Get_Rep_Item (Ptyp, Name_Deadline_Floor, Check_Parents => False); Deadline : Node_Id; begin if Present (Item) then -- Pragma Deadline_Floor if Nkind (Item) = N_Pragma then Deadline := Expression (First (Pragma_Argument_Associations (Item))); -- Attribute definition clause Deadline_Floor else pragma Assert (Nkind (Item) = N_Attribute_Definition_Clause); Deadline := Expression (Item); end if; Append_To (Args, Deadline); -- Unusual case: default deadline else Append_To (Args, New_Occurrence_Of (RTE (RE_Time_Span_Zero), Loc)); end if; end Deadline_Floor; end if; -- Test for Compiler_Info parameter. This parameter allows entry body -- procedures and barrier functions to be called from the runtime. It -- is a pointer to the record generated by the compiler to represent -- the protected object. -- A protected type without entries that covers an interface and -- overrides the abstract routines with protected procedures is -- considered equivalent to a protected type with entries in the -- context of dispatching select statements. -- Protected types with interrupt handlers (when not using a -- restricted profile) are also considered equivalent to protected -- types with entries. -- The types which are used (Static_Interrupt_Protection and -- Dynamic_Interrupt_Protection) are derived from Protection_Entries. declare Pkg_Id : constant RTU_Id := Corresponding_Runtime_Package (Ptyp); Called_Subp : RE_Id; begin case Pkg_Id is when System_Tasking_Protected_Objects_Entries => Called_Subp := RE_Initialize_Protection_Entries; -- Argument Compiler_Info Append_To (Args, Make_Attribute_Reference (Loc, Prefix => Make_Identifier (Loc, Name_uInit), Attribute_Name => Name_Address)); when System_Tasking_Protected_Objects_Single_Entry => Called_Subp := RE_Initialize_Protection_Entry; -- Argument Compiler_Info Append_To (Args, Make_Attribute_Reference (Loc, Prefix => Make_Identifier (Loc, Name_uInit), Attribute_Name => Name_Address)); when System_Tasking_Protected_Objects => Called_Subp := RE_Initialize_Protection; when others => raise Program_Error; end case; -- Entry_Queue_Maxes parameter. This is an access to an array of -- naturals representing the entry queue maximums for each entry -- in the protected type. Zero represents no max. The access is -- null if there is no limit for all entries (usual case). if Has_Entry and then Pkg_Id = System_Tasking_Protected_Objects_Entries then if Present (Entry_Max_Queue_Lengths_Array (Ptyp)) then Append_To (Args, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Entry_Max_Queue_Lengths_Array (Ptyp), Loc), Attribute_Name => Name_Unrestricted_Access)); else Append_To (Args, Make_Null (Loc)); end if; -- Edge cases exist where entry initialization functions are -- called, but no entries exist, so null is appended. elsif Pkg_Id = System_Tasking_Protected_Objects_Entries then Append_To (Args, Make_Null (Loc)); end if; -- Entry_Bodies parameter. This is a pointer to an array of -- pointers to the entry body procedures and barrier functions of -- the object. If the protected type has no entries this object -- will not exist, in this case, pass a null (it can happen when -- there are protected interrupt handlers or interfaces). if Has_Entry then P_Arr := Entry_Bodies_Array (Ptyp); -- Argument Entry_Body (for single entry) or Entry_Bodies (for -- multiple entries). Append_To (Args, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (P_Arr, Loc), Attribute_Name => Name_Unrestricted_Access)); if Pkg_Id = System_Tasking_Protected_Objects_Entries then -- Find index mapping function (clumsy but ok for now) while Ekind (P_Arr) /= E_Function loop Next_Entity (P_Arr); end loop; Append_To (Args, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (P_Arr, Loc), Attribute_Name => Name_Unrestricted_Access)); end if; elsif Pkg_Id = System_Tasking_Protected_Objects_Single_Entry then -- This is the case where we have a protected object with -- interfaces and no entries, and the single entry restriction -- is in effect. We pass a null pointer for the entry -- parameter because there is no actual entry. Append_To (Args, Make_Null (Loc)); elsif Pkg_Id = System_Tasking_Protected_Objects_Entries then -- This is the case where we have a protected object with no -- entries and: -- - either interrupt handlers with non restricted profile, -- - or interfaces -- Note that the types which are used for interrupt handlers -- (Static/Dynamic_Interrupt_Protection) are derived from -- Protection_Entries. We pass two null pointers because there -- is no actual entry, and the initialization procedure needs -- both Entry_Bodies and Find_Body_Index. Append_To (Args, Make_Null (Loc)); Append_To (Args, Make_Null (Loc)); end if; Append_To (L, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (Called_Subp), Loc), Parameter_Associations => Args)); end; end if; if Has_Attach_Handler (Ptyp) then -- We have a list of N Attach_Handler (ProcI, ExprI), and we have to -- make the following call: -- Install_Handlers (_object, -- ((Expr1, Proc1'access), ...., (ExprN, ProcN'access)); -- or, in the case of Ravenscar: -- Install_Restricted_Handlers -- (Prio, ((Expr1, Proc1'access), ...., (ExprN, ProcN'access))); declare Args : constant List_Id := New_List; Table : constant List_Id := New_List; Ritem : Node_Id := First_Rep_Item (Ptyp); begin -- Build the Priority parameter (only for ravenscar) if Restricted then -- Priority comes from a pragma if Present (Prio_Var) then Append_To (Args, New_Occurrence_Of (Prio_Var, Loc)); -- Priority is the default one else Append_To (Args, New_Occurrence_Of (RTE (RE_Default_Interrupt_Priority), Loc)); end if; end if; -- Build the Attach_Handler table argument while Present (Ritem) loop if Nkind (Ritem) = N_Pragma and then Pragma_Name (Ritem) = Name_Attach_Handler then declare Handler : constant Node_Id := First (Pragma_Argument_Associations (Ritem)); Interrupt : constant Node_Id := Next (Handler); Expr : constant Node_Id := Expression (Interrupt); begin Append_To (Table, Make_Aggregate (Loc, Expressions => New_List ( Unchecked_Convert_To (RTE (RE_System_Interrupt_Id), Expr), Make_Attribute_Reference (Loc, Prefix => Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Duplicate_Subexpr_No_Checks (Expression (Handler))), Attribute_Name => Name_Access)))); end; end if; Next_Rep_Item (Ritem); end loop; -- Append the table argument we just built Append_To (Args, Make_Aggregate (Loc, Table)); -- Append the Install_Handlers (or Install_Restricted_Handlers) -- call to the statements. if Restricted then -- Call a simplified version of Install_Handlers to be used -- when the Ravenscar restrictions are in effect -- (Install_Restricted_Handlers). Append_To (L, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Install_Restricted_Handlers), Loc), Parameter_Associations => Args)); else if not Uses_Lock_Free (Defining_Identifier (Pdec)) then -- First, prepends the _object argument Prepend_To (Args, Make_Attribute_Reference (Loc, Prefix => Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uObject)), Attribute_Name => Name_Unchecked_Access)); end if; -- Then, insert call to Install_Handlers Append_To (L, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Install_Handlers), Loc), Parameter_Associations => Args)); end if; end; end if; return L; end Make_Initialize_Protection; --------------------------- -- Make_Task_Create_Call -- --------------------------- function Make_Task_Create_Call (Task_Rec : Entity_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (Task_Rec); Args : List_Id; Ecount : Node_Id; Name : Node_Id; Tdec : Node_Id; Tdef : Node_Id; Tnam : Name_Id; Ttyp : Node_Id; begin Ttyp := Corresponding_Concurrent_Type (Task_Rec); Tnam := Chars (Ttyp); -- Get task declaration. In the case of a task type declaration, this is -- simply the parent of the task type entity. In the single task -- declaration, this parent will be the implicit type, and we can find -- the corresponding single task declaration by searching forward in the -- declaration list in the tree. -- Is the test for N_Single_Task_Declaration needed here??? Nodes of -- this type should have been removed during semantic analysis. Tdec := Parent (Ttyp); while Nkind (Tdec) not in N_Task_Type_Declaration | N_Single_Task_Declaration loop Next (Tdec); end loop; -- Now we can find the task definition from this declaration Tdef := Task_Definition (Tdec); -- Build the parameter list for the call. Note that _Init is the name -- of the formal for the object to be initialized, which is the task -- value record itself. Args := New_List; -- Priority parameter. Set to Unspecified_Priority unless there is a -- Priority rep item, in which case we take the value from the rep item. -- Not used on Ravenscar_EDF profile. if not (Restricted_Profile and then Task_Dispatching_Policy = 'E') then if Has_Rep_Item (Ttyp, Name_Priority, Check_Parents => False) then Append_To (Args, Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uPriority))); else Append_To (Args, New_Occurrence_Of (RTE (RE_Unspecified_Priority), Loc)); end if; end if; -- Optional Stack parameter if Restricted_Profile then -- If the stack has been preallocated by the expander then -- pass its address. Otherwise, pass a null address. if Preallocated_Stacks_On_Target then Append_To (Args, Make_Attribute_Reference (Loc, Prefix => Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uStack)), Attribute_Name => Name_Address)); else Append_To (Args, New_Occurrence_Of (RTE (RE_Null_Address), Loc)); end if; end if; -- Size parameter. If no Storage_Size pragma is present, then -- the size is taken from the taskZ variable for the type, which -- is either Unspecified_Size, or has been reset by the use of -- a Storage_Size attribute definition clause. If a pragma is -- present, then the size is taken from the _Size field of the -- task value record, which was set from the pragma value. if Present (Tdef) and then Has_Storage_Size_Pragma (Tdef) then Append_To (Args, Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uSize))); else Append_To (Args, New_Occurrence_Of (Storage_Size_Variable (Ttyp), Loc)); end if; -- Secondary_Stack parameter used for restricted profiles if Restricted_Profile then -- If the secondary stack has been allocated by the expander then -- pass its access pointer. Otherwise, pass null. if Create_Secondary_Stack_For_Task (Ttyp) then Append_To (Args, Make_Attribute_Reference (Loc, Prefix => Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uSecondary_Stack)), Attribute_Name => Name_Unrestricted_Access)); else Append_To (Args, Make_Null (Loc)); end if; end if; -- Secondary_Stack_Size parameter. Set RE_Unspecified_Size unless there -- is a Secondary_Stack_Size pragma, in which case take the value from -- the pragma. If the restriction No_Secondary_Stack is active then a -- size of 0 is passed regardless to prevent the allocation of the -- unused stack. if Restriction_Active (No_Secondary_Stack) then Append_To (Args, Make_Integer_Literal (Loc, 0)); elsif Has_Rep_Pragma (Ttyp, Name_Secondary_Stack_Size, Check_Parents => False) then Append_To (Args, Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uSecondary_Stack_Size))); else Append_To (Args, New_Occurrence_Of (RTE (RE_Unspecified_Size), Loc)); end if; -- Task_Info parameter. Set to Unspecified_Task_Info unless there is a -- Task_Info pragma, in which case we take the value from the pragma. if Has_Rep_Pragma (Ttyp, Name_Task_Info, Check_Parents => False) then Append_To (Args, Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uTask_Info))); else Append_To (Args, New_Occurrence_Of (RTE (RE_Unspecified_Task_Info), Loc)); end if; -- CPU parameter. Set to Unspecified_CPU unless there is a CPU rep item, -- in which case we take the value from the rep item. The parameter is -- passed as an Integer because in the case of unspecified CPU the -- value is not in the range of CPU_Range. if Has_Rep_Item (Ttyp, Name_CPU, Check_Parents => False) then Append_To (Args, Convert_To (Standard_Integer, Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uCPU)))); else Append_To (Args, New_Occurrence_Of (RTE (RE_Unspecified_CPU), Loc)); end if; if not Restricted_Profile or else Task_Dispatching_Policy = 'E' then -- Deadline parameter. If no Relative_Deadline pragma is present, -- then the deadline is Time_Span_Zero. If a pragma is present, then -- the deadline is taken from the _Relative_Deadline field of the -- task value record, which was set from the pragma value. Note that -- this parameter must not be generated for the restricted profiles -- since Ravenscar does not allow deadlines. -- Case where pragma Relative_Deadline applies: use given value if Present (Tdef) and then Has_Relative_Deadline_Pragma (Tdef) then Append_To (Args, Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uRelative_Deadline))); -- No pragma Relative_Deadline apply to the task else Append_To (Args, New_Occurrence_Of (RTE (RE_Time_Span_Zero), Loc)); end if; end if; if not Restricted_Profile then -- Dispatching_Domain parameter. If no Dispatching_Domain rep item is -- present, then the dispatching domain is null. If a rep item is -- present, then the dispatching domain is taken from the -- _Dispatching_Domain field of the task value record, which was set -- from the rep item value. -- Case where Dispatching_Domain rep item applies: use given value if Has_Rep_Item (Ttyp, Name_Dispatching_Domain, Check_Parents => False) then Append_To (Args, Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uDispatching_Domain))); -- No pragma or aspect Dispatching_Domain applies to the task else Append_To (Args, Make_Null (Loc)); end if; -- Number of entries. This is an expression of the form: -- n + _Init.a'Length + _Init.a'B'Length + ... -- where a,b... are the entry family names for the task definition Ecount := Build_Entry_Count_Expression (Ttyp, Component_Items (Component_List (Type_Definition (Parent (Corresponding_Record_Type (Ttyp))))), Loc); Append_To (Args, Ecount); -- Master parameter. This is a reference to the _Master parameter of -- the initialization procedure, except in the case of the pragma -- Restrictions (No_Task_Hierarchy) where the value is fixed to -- System.Tasking.Library_Task_Level. if Restriction_Active (No_Task_Hierarchy) = False then Append_To (Args, Make_Identifier (Loc, Name_uMaster)); else Append_To (Args, New_Occurrence_Of (RTE (RE_Library_Task_Level), Loc)); end if; end if; -- State parameter. This is a pointer to the task body procedure. The -- required value is obtained by taking 'Unrestricted_Access of the task -- body procedure and converting it (with an unchecked conversion) to -- the type required by the task kernel. For further details, see the -- description of Expand_N_Task_Body. We use 'Unrestricted_Access rather -- than 'Address in order to avoid creating trampolines. declare Body_Proc : constant Node_Id := Get_Task_Body_Procedure (Ttyp); Subp_Ptr_Typ : constant Node_Id := Create_Itype (E_Access_Subprogram_Type, Tdec); Ref : constant Node_Id := Make_Itype_Reference (Loc); begin Set_Directly_Designated_Type (Subp_Ptr_Typ, Body_Proc); Set_Etype (Subp_Ptr_Typ, Subp_Ptr_Typ); -- Be sure to freeze a reference to the access-to-subprogram type, -- otherwise gigi will complain that it's in the wrong scope, because -- it's actually inside the init procedure for the record type that -- corresponds to the task type. Set_Itype (Ref, Subp_Ptr_Typ); Append_Freeze_Action (Task_Rec, Ref); Append_To (Args, Unchecked_Convert_To (RTE (RE_Task_Procedure_Access), Make_Qualified_Expression (Loc, Subtype_Mark => New_Occurrence_Of (Subp_Ptr_Typ, Loc), Expression => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Body_Proc, Loc), Attribute_Name => Name_Unrestricted_Access)))); end; -- Discriminants parameter. This is just the address of the task -- value record itself (which contains the discriminant values Append_To (Args, Make_Attribute_Reference (Loc, Prefix => Make_Identifier (Loc, Name_uInit), Attribute_Name => Name_Address)); -- Elaborated parameter. This is an access to the elaboration Boolean Append_To (Args, Make_Attribute_Reference (Loc, Prefix => Make_Identifier (Loc, New_External_Name (Tnam, 'E')), Attribute_Name => Name_Unchecked_Access)); -- Add Chain parameter (not done for sequential elaboration policy, see -- comment for Create_Restricted_Task_Sequential in s-tarest.ads). if Partition_Elaboration_Policy /= 'S' then Append_To (Args, Make_Identifier (Loc, Name_uChain)); end if; -- Task name parameter. Take this from the _Task_Id parameter to the -- init call unless there is a Task_Name pragma, in which case we take -- the value from the pragma. if Has_Rep_Pragma (Ttyp, Name_Task_Name, Check_Parents => False) then -- Copy expression in full, because it may be dynamic and have -- side effects. Append_To (Args, New_Copy_Tree (Expression (First (Pragma_Argument_Associations (Get_Rep_Pragma (Ttyp, Name_Task_Name, Check_Parents => False)))))); else Append_To (Args, Make_Identifier (Loc, Name_uTask_Name)); end if; -- Created_Task parameter. This is the _Task_Id field of the task -- record value Append_To (Args, Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_uInit), Selector_Name => Make_Identifier (Loc, Name_uTask_Id))); declare Create_RE : RE_Id; begin if Restricted_Profile then if Partition_Elaboration_Policy = 'S' then Create_RE := RE_Create_Restricted_Task_Sequential; else Create_RE := RE_Create_Restricted_Task; end if; else Create_RE := RE_Create_Task; end if; Name := New_Occurrence_Of (RTE (Create_RE), Loc); end; return Make_Procedure_Call_Statement (Loc, Name => Name, Parameter_Associations => Args); end Make_Task_Create_Call; ------------------------------ -- Next_Protected_Operation -- ------------------------------ function Next_Protected_Operation (N : Node_Id) return Node_Id is Next_Op : Node_Id; begin -- Check whether there is a subsequent body for a protected operation -- in the current protected body. In Ada2012 that includes expression -- functions that are completions. Next_Op := Next (N); while Present (Next_Op) and then Nkind (Next_Op) not in N_Subprogram_Body | N_Entry_Body | N_Expression_Function loop Next (Next_Op); end loop; return Next_Op; end Next_Protected_Operation; --------------------- -- Null_Statements -- --------------------- function Null_Statements (Stats : List_Id) return Boolean is Stmt : Node_Id; begin Stmt := First (Stats); while Nkind (Stmt) /= N_Empty and then (Nkind (Stmt) in N_Null_Statement | N_Label or else (Nkind (Stmt) = N_Pragma and then Pragma_Name_Unmapped (Stmt) in Name_Unreferenced | Name_Unmodified | Name_Warnings)) loop Next (Stmt); end loop; return Nkind (Stmt) = N_Empty; end Null_Statements; -------------------------- -- Parameter_Block_Pack -- -------------------------- function Parameter_Block_Pack (Loc : Source_Ptr; Blk_Typ : Entity_Id; Actuals : List_Id; Formals : List_Id; Decls : List_Id; Stmts : List_Id) return Node_Id is Actual : Entity_Id; Expr : Node_Id := Empty; Formal : Entity_Id; Has_Param : Boolean := False; P : Entity_Id; Params : List_Id; Temp_Asn : Node_Id; Temp_Nam : Node_Id; begin Actual := First (Actuals); Formal := Defining_Identifier (First (Formals)); Params := New_List; while Present (Actual) loop if Is_By_Copy_Type (Etype (Actual)) then -- Generate: -- Jnn : aliased <formal-type> Temp_Nam := Make_Temporary (Loc, 'J'); Append_To (Decls, Make_Object_Declaration (Loc, Aliased_Present => True, Defining_Identifier => Temp_Nam, Object_Definition => New_Occurrence_Of (Etype (Formal), Loc))); -- The object is initialized with an explicit assignment -- later. Indicate that it does not need an initialization -- to prevent spurious warnings if the type excludes null. Set_No_Initialization (Last (Decls)); if Ekind (Formal) /= E_Out_Parameter then -- Generate: -- Jnn := <actual> Temp_Asn := New_Occurrence_Of (Temp_Nam, Loc); Set_Assignment_OK (Temp_Asn); Append_To (Stmts, Make_Assignment_Statement (Loc, Name => Temp_Asn, Expression => New_Copy_Tree (Actual))); end if; -- If the actual is not controlling, generate: -- Jnn'unchecked_access -- and add it to aggegate for access to formals. Note that the -- actual may be by-copy but still be a controlling actual if it -- is an access to class-wide interface. if not Is_Controlling_Actual (Actual) then Append_To (Params, Make_Attribute_Reference (Loc, Attribute_Name => Name_Unchecked_Access, Prefix => New_Occurrence_Of (Temp_Nam, Loc))); Has_Param := True; end if; -- The controlling parameter is omitted else if not Is_Controlling_Actual (Actual) then Append_To (Params, Make_Reference (Loc, New_Copy_Tree (Actual))); Has_Param := True; end if; end if; Next_Actual (Actual); Next_Formal_With_Extras (Formal); end loop; if Has_Param then Expr := Make_Aggregate (Loc, Params); end if; -- Generate: -- P : Ann := ( -- J1'unchecked_access; -- <actual2>'reference; -- ...); P := Make_Temporary (Loc, 'P'); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => P, Object_Definition => New_Occurrence_Of (Blk_Typ, Loc), Expression => Expr)); return P; end Parameter_Block_Pack; ---------------------------- -- Parameter_Block_Unpack -- ---------------------------- function Parameter_Block_Unpack (Loc : Source_Ptr; P : Entity_Id; Actuals : List_Id; Formals : List_Id) return List_Id is Actual : Entity_Id; Asnmt : Node_Id; Formal : Entity_Id; Has_Asnmt : Boolean := False; Result : constant List_Id := New_List; begin Actual := First (Actuals); Formal := Defining_Identifier (First (Formals)); while Present (Actual) loop if Is_By_Copy_Type (Etype (Actual)) and then Ekind (Formal) /= E_In_Parameter then -- Generate: -- <actual> := P.<formal>; Asnmt := Make_Assignment_Statement (Loc, Name => New_Copy (Actual), Expression => Make_Explicit_Dereference (Loc, Make_Selected_Component (Loc, Prefix => New_Occurrence_Of (P, Loc), Selector_Name => Make_Identifier (Loc, Chars (Formal))))); Set_Assignment_OK (Name (Asnmt)); Append_To (Result, Asnmt); Has_Asnmt := True; end if; Next_Actual (Actual); Next_Formal_With_Extras (Formal); end loop; if Has_Asnmt then return Result; else return New_List (Make_Null_Statement (Loc)); end if; end Parameter_Block_Unpack; --------------------- -- Reset_Scopes_To -- --------------------- procedure Reset_Scopes_To (Bod : Node_Id; E : Entity_Id) is function Reset_Scope (N : Node_Id) return Traverse_Result; -- Temporaries may have been declared during expansion of the procedure -- created for an entry body or an accept alternative. Indicate that -- their scope is the new body, to ensure proper generation of uplevel -- references where needed during unnesting. procedure Reset_Scopes is new Traverse_Proc (Reset_Scope); ----------------- -- Reset_Scope -- ----------------- function Reset_Scope (N : Node_Id) return Traverse_Result is Decl : Node_Id; begin -- If this is a block statement with an Identifier, it forms a scope, -- so we want to reset its scope but not look inside. if N /= Bod and then Nkind (N) = N_Block_Statement and then Present (Identifier (N)) then Set_Scope (Entity (Identifier (N)), E); return Skip; -- Ditto for a package declaration or a full type declaration, etc. elsif (Nkind (N) = N_Package_Declaration and then N /= Specification (N)) or else Nkind (N) in N_Declaration or else Nkind (N) in N_Renaming_Declaration then Set_Scope (Defining_Entity (N), E); return Skip; elsif N = Bod then -- Scan declarations in new body. Declarations in the statement -- part will be handled during later traversal. Decl := First (Declarations (N)); while Present (Decl) loop Reset_Scopes (Decl); Next (Decl); end loop; elsif Nkind (N) = N_Freeze_Entity then -- Scan the actions associated with a freeze node, which may -- actually be declarations with entities that need to have -- their scopes reset. Decl := First (Actions (N)); while Present (Decl) loop Reset_Scopes (Decl); Next (Decl); end loop; elsif N /= Bod and then Nkind (N) in N_Proper_Body then -- A subprogram without a separate declaration may be encountered, -- and we need to reset the subprogram's entity's scope. if Nkind (N) = N_Subprogram_Body then Set_Scope (Defining_Entity (Specification (N)), E); end if; return Skip; end if; return OK; end Reset_Scope; -- Start of processing for Reset_Scopes_To begin Reset_Scopes (Bod); end Reset_Scopes_To; ---------------------- -- Set_Discriminals -- ---------------------- procedure Set_Discriminals (Dec : Node_Id) is D : Entity_Id; Pdef : Entity_Id; D_Minal : Entity_Id; begin pragma Assert (Nkind (Dec) = N_Protected_Type_Declaration); Pdef := Defining_Identifier (Dec); if Has_Discriminants (Pdef) then D := First_Discriminant (Pdef); while Present (D) loop D_Minal := Make_Defining_Identifier (Sloc (D), Chars => New_External_Name (Chars (D), 'D')); Set_Ekind (D_Minal, E_Constant); Set_Etype (D_Minal, Etype (D)); Set_Scope (D_Minal, Pdef); Set_Discriminal (D, D_Minal); Set_Discriminal_Link (D_Minal, D); Next_Discriminant (D); end loop; end if; end Set_Discriminals; ----------------------- -- Trivial_Accept_OK -- ----------------------- function Trivial_Accept_OK return Boolean is begin case Opt.Task_Dispatching_Policy is -- If we have the default task dispatching policy in effect, we can -- definitely do the optimization (one way of looking at this is to -- think of the formal definition of the default policy being allowed -- to run any task it likes after a rendezvous, so even if notionally -- a full rescheduling occurs, we can say that our dispatching policy -- (i.e. the default dispatching policy) reorders the queue to be the -- same as just before the call. when ' ' => return True; -- FIFO_Within_Priorities certainly does not permit this -- optimization since the Rendezvous is a scheduling action that may -- require some other task to be run. when 'F' => return False; -- For now, disallow the optimization for all other policies. This -- may be over-conservative, but it is certainly not incorrect. when others => return False; end case; end Trivial_Accept_OK; end Exp_Ch9;
-- part of OpenGLAda, (c) 2020 Felix Krause -- released under the terms of the MIT license, see the file "COPYING" with GL.Buffers; with GL.Types.Colors; with GL.Fixed.Matrix; with GL.Images; with GL.Immediate; with GL.Objects.Textures.Targets; with GL.Pixels; with GL.Toggles; with GL.Types; with GL_Test.Display_Backend; procedure Images_Test_JPG is use GL.Fixed.Matrix; use GL.Types; use GL.Types.Doubles; Texture : GL.Objects.Textures.Texture; begin GL_Test.Display_Backend.Init; GL_Test.Display_Backend.Open_Window (1000, 498); GL.Images.Load_File_To_Texture ("../ada2012-color.jpg", Texture, GL.Pixels.RGB); Projection.Load_Identity; Projection.Apply_Orthogonal (-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); GL.Buffers.Set_Color_Clear_Value (Colors.Color'(1.0, 0.0, 0.0, 1.0)); while GL_Test.Display_Backend.Window_Opened loop GL.Buffers.Clear ((others => True)); GL.Objects.Textures.Set_Active_Unit (0); GL.Toggles.Enable (GL.Toggles.Texture_2D); GL.Objects.Textures.Targets.Texture_2D.Bind (Texture); declare Token : GL.Immediate.Input_Token := GL.Immediate.Start (Quads); begin GL.Immediate.Set_Texture_Coordinates (Vector2'(0.0, 0.0)); Token.Add_Vertex (Vector2'(-1.0, -1.0)); GL.Immediate.Set_Texture_Coordinates (Vector2'(0.0, 1.0)); Token.Add_Vertex (Vector2'(-1.0, 1.0)); GL.Immediate.Set_Texture_Coordinates (Vector2'(1.0, 1.0)); Token.Add_Vertex (Vector2'(1.0, 1.0)); GL.Immediate.Set_Texture_Coordinates (Vector2'(1.0, 0.0)); Token.Add_Vertex (Vector2'(1.0, -1.0)); end; GL.Toggles.Disable (GL.Toggles.Texture_2D); GL_Test.Display_Backend.Swap_Buffers; GL_Test.Display_Backend.Poll_Events; end loop; GL_Test.Display_Backend.Shutdown; end Images_Test_JPG;
with Interfaces; use Interfaces; with STM32GD; with STM32GD.Board; use STM32GD.Board; with CBOR_Codec; with Utils; package body Host_Message is Sensor_Reading_Tag : constant Natural := 6; Voltage_Tag : constant Natural := 7; Temperature_Tag : constant Natural := 8; Humidity_Tag : constant Natural := 9; Pressure_Tag : constant Natural := 10; Lux_Tag : constant Natural := 11; UV_Index_Tag : constant Natural := 12; Motion_Tag : constant Natural := 13; Sound_Level_Tag : constant Natural := 14; CO2_Tag : constant Natural := 15; Test_Packet_Tag : constant Natural := 64; Heartbeat_Tag : constant Natural := 65; Log_Message_Tag : constant Natural := 66; Ping_Tag : constant Natural := 67; Register_Value_Tag : constant Natural := 68; Error_Message_Tag : constant Natural := 69; Modem_Message_Tag : constant Natural := 70; Modem_ID_Tag : constant Natural := 71; RF_Packet_Tag : constant Natural := 72; Status_Cmd_Tag : constant Natural := 256; Ping_Cmd_Tag : constant Natural := 257; Reset_Cmd_Tag : constant Natural := 258; UID : STM32GD.UID_Type := STM32GD.UID; Message : array (1 .. 256) of Character; Message_Index : Natural; type Heartbeat_Range is range 0 .. 999; Heartbeat : Heartbeat_Range := Heartbeat_Range'First; procedure Write_Message (C : Unsigned_8); function Read_Message return Unsigned_8; package CBOR is new CBOR_Codec (Write => Write_Message, Read => Read_Message); procedure Start_Message is begin Message_Index := Message'First; CBOR.Encode_Tag (Modem_Message_Tag); CBOR.Encode_Array (2); CBOR.Encode_Tag (Modem_ID_Tag); CBOR.Encode_Integer (Integer (UID (1) xor UID (2) xor UID (3))); end Start_Message; procedure Write_Message (C : Unsigned_8) is H : Utils.Hex_String_Byte; begin H := Utils.To_Hex_String (C); Message (Message_Index) := H (1); Message (Message_Index + 1) := H (2); Message_Index := Message_Index + 2; end Write_Message; function Read_Message return Unsigned_8 is begin return 0; end Read_Message; procedure Send_Message is begin for I in 1 .. Message_Index - 1 loop Text_IO.Put (Message (I)); end loop; Text_IO.New_Line; end Send_Message; procedure Send_Hello is begin Start_Message; CBOR.Encode_Tag (Log_Message_Tag); CBOR.Encode_Byte_String ("Starting"); Send_Message; end Send_Hello; procedure Send_Packet (Packet: Packet_Type; Length: Unsigned_8) is begin if Length > 0 and then Length < Packet'Length then Start_Message; CBOR.Encode_Tag (RF_Packet_Tag); CBOR.Encode_Additional_Data (Integer (Length), CBOR.Byte_String); for I in 0 .. Length - 1 loop Write_Message (Packet (Packet'First + I)); end loop; Send_Message; end if; end Send_Packet; procedure Send_Heartbeat is U : Utils.Hex_String_Word; begin U := Utils.To_Hex_String (UID (1) xor UID (2) xor UID (3)); Start_Message; CBOR.Encode_Tag (Heartbeat_Tag); CBOR.Encode_Array (2); CBOR.Encode_Byte_String (U); CBOR.Encode_Integer (Integer (Heartbeat)); Send_Message; Heartbeat := Heartbeat + 1; if Heartbeat = Heartbeat_Range'Last then Heartbeat := Heartbeat_Range'First; end if; end Send_Heartbeat; procedure Send_Error_Message (M : String) is begin Start_Message; CBOR.Encode_Tag (Log_Message_Tag); CBOR.Encode_Byte_String (M); Send_Message; end Send_Error_Message; end Host_Message;
------------------------------------------------------------------------------ -- -- -- 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.Internals.Extents; with AMF.Internals.Tables.CMOF_Constructors; with AMF.Internals.Tables.CMOF_Element_Table; with AMF.Internals.Tables.Standard_Profile_L2_String_Data_00; package body AMF.Internals.Tables.Standard_Profile_L2_Metamodel.Objects is ---------------- -- Initialize -- ---------------- procedure Initialize is Extent : constant AMF.Internals.AMF_Extent := AMF.Internals.Extents.Allocate_Extent (AMF.Internals.Tables.Standard_Profile_L2_String_Data_00.MS_0049'Access); begin Base := AMF.Internals.Tables.CMOF_Element_Table.Last; Initialize_1 (Extent); Initialize_2 (Extent); Initialize_3 (Extent); Initialize_4 (Extent); Initialize_5 (Extent); Initialize_6 (Extent); Initialize_7 (Extent); Initialize_8 (Extent); Initialize_9 (Extent); Initialize_10 (Extent); Initialize_11 (Extent); Initialize_12 (Extent); Initialize_13 (Extent); Initialize_14 (Extent); Initialize_15 (Extent); Initialize_16 (Extent); Initialize_17 (Extent); Initialize_18 (Extent); Initialize_19 (Extent); Initialize_20 (Extent); Initialize_21 (Extent); Initialize_22 (Extent); Initialize_23 (Extent); Initialize_24 (Extent); Initialize_25 (Extent); Initialize_26 (Extent); Initialize_27 (Extent); Initialize_28 (Extent); Initialize_29 (Extent); Initialize_30 (Extent); Initialize_31 (Extent); Initialize_32 (Extent); Initialize_33 (Extent); Initialize_34 (Extent); Initialize_35 (Extent); Initialize_36 (Extent); Initialize_37 (Extent); Initialize_38 (Extent); Initialize_39 (Extent); Initialize_40 (Extent); Initialize_41 (Extent); Initialize_42 (Extent); Initialize_43 (Extent); Initialize_44 (Extent); Initialize_45 (Extent); Initialize_46 (Extent); Initialize_47 (Extent); Initialize_48 (Extent); Initialize_49 (Extent); Initialize_50 (Extent); Initialize_51 (Extent); Initialize_52 (Extent); Initialize_53 (Extent); Initialize_54 (Extent); Initialize_55 (Extent); Initialize_56 (Extent); Initialize_57 (Extent); Initialize_58 (Extent); Initialize_59 (Extent); Initialize_60 (Extent); Initialize_61 (Extent); Initialize_62 (Extent); Initialize_63 (Extent); Initialize_64 (Extent); Initialize_65 (Extent); Initialize_66 (Extent); Initialize_67 (Extent); Initialize_68 (Extent); Initialize_69 (Extent); Initialize_70 (Extent); Initialize_71 (Extent); Initialize_72 (Extent); Initialize_73 (Extent); Initialize_74 (Extent); Initialize_75 (Extent); Initialize_76 (Extent); Initialize_77 (Extent); Initialize_78 (Extent); Initialize_79 (Extent); Initialize_80 (Extent); Initialize_81 (Extent); Initialize_82 (Extent); Initialize_83 (Extent); Initialize_84 (Extent); Initialize_85 (Extent); Initialize_86 (Extent); Initialize_87 (Extent); Initialize_88 (Extent); Initialize_89 (Extent); Initialize_90 (Extent); Initialize_91 (Extent); Initialize_92 (Extent); Initialize_93 (Extent); Initialize_94 (Extent); Initialize_95 (Extent); Initialize_96 (Extent); Initialize_97 (Extent); Initialize_98 (Extent); Initialize_99 (Extent); Initialize_100 (Extent); Initialize_101 (Extent); Initialize_102 (Extent); Initialize_103 (Extent); Initialize_104 (Extent); Initialize_105 (Extent); Initialize_106 (Extent); Initialize_107 (Extent); Initialize_108 (Extent); Initialize_109 (Extent); Initialize_110 (Extent); Initialize_111 (Extent); Initialize_112 (Extent); Initialize_113 (Extent); Initialize_114 (Extent); Initialize_115 (Extent); Initialize_116 (Extent); Initialize_117 (Extent); Initialize_118 (Extent); Initialize_119 (Extent); Initialize_120 (Extent); Initialize_121 (Extent); Initialize_122 (Extent); Initialize_123 (Extent); Initialize_124 (Extent); Initialize_125 (Extent); Initialize_126 (Extent); Initialize_127 (Extent); Initialize_128 (Extent); Initialize_129 (Extent); Initialize_130 (Extent); Initialize_131 (Extent); Initialize_132 (Extent); Initialize_133 (Extent); Initialize_134 (Extent); Initialize_135 (Extent); Initialize_136 (Extent); Initialize_137 (Extent); Initialize_138 (Extent); Initialize_139 (Extent); Initialize_140 (Extent); Initialize_141 (Extent); Initialize_142 (Extent); Initialize_143 (Extent); Initialize_144 (Extent); Initialize_145 (Extent); Initialize_146 (Extent); Initialize_147 (Extent); Initialize_148 (Extent); Initialize_149 (Extent); Initialize_150 (Extent); Initialize_151 (Extent); Initialize_152 (Extent); Initialize_153 (Extent); Initialize_154 (Extent); Initialize_155 (Extent); Initialize_156 (Extent); Initialize_157 (Extent); Initialize_158 (Extent); Initialize_159 (Extent); Initialize_160 (Extent); Initialize_161 (Extent); Initialize_162 (Extent); Initialize_163 (Extent); Initialize_164 (Extent); Initialize_165 (Extent); Initialize_166 (Extent); Initialize_167 (Extent); Initialize_168 (Extent); Initialize_169 (Extent); Initialize_170 (Extent); Initialize_171 (Extent); Initialize_172 (Extent); Initialize_173 (Extent); Initialize_174 (Extent); Initialize_175 (Extent); Initialize_176 (Extent); Initialize_177 (Extent); Initialize_178 (Extent); Initialize_179 (Extent); Initialize_180 (Extent); end Initialize; ------------------ -- Initialize_1 -- ------------------ procedure Initialize_1 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_1; ------------------ -- Initialize_2 -- ------------------ procedure Initialize_2 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_2; ------------------ -- Initialize_3 -- ------------------ procedure Initialize_3 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_3; ------------------ -- Initialize_4 -- ------------------ procedure Initialize_4 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_4; ------------------ -- Initialize_5 -- ------------------ procedure Initialize_5 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_5; ------------------ -- Initialize_6 -- ------------------ procedure Initialize_6 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_6; ------------------ -- Initialize_7 -- ------------------ procedure Initialize_7 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_7; ------------------ -- Initialize_8 -- ------------------ procedure Initialize_8 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_8; ------------------ -- Initialize_9 -- ------------------ procedure Initialize_9 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_9; ------------------- -- Initialize_10 -- ------------------- procedure Initialize_10 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_10; ------------------- -- Initialize_11 -- ------------------- procedure Initialize_11 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_11; ------------------- -- Initialize_12 -- ------------------- procedure Initialize_12 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_12; ------------------- -- Initialize_13 -- ------------------- procedure Initialize_13 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_13; ------------------- -- Initialize_14 -- ------------------- procedure Initialize_14 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_14; ------------------- -- Initialize_15 -- ------------------- procedure Initialize_15 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_15; ------------------- -- Initialize_16 -- ------------------- procedure Initialize_16 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_16; ------------------- -- Initialize_17 -- ------------------- procedure Initialize_17 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_17; ------------------- -- Initialize_18 -- ------------------- procedure Initialize_18 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_18; ------------------- -- Initialize_19 -- ------------------- procedure Initialize_19 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_19; ------------------- -- Initialize_20 -- ------------------- procedure Initialize_20 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_20; ------------------- -- Initialize_21 -- ------------------- procedure Initialize_21 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_21; ------------------- -- Initialize_22 -- ------------------- procedure Initialize_22 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_22; ------------------- -- Initialize_23 -- ------------------- procedure Initialize_23 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_23; ------------------- -- Initialize_24 -- ------------------- procedure Initialize_24 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_24; ------------------- -- Initialize_25 -- ------------------- procedure Initialize_25 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_25; ------------------- -- Initialize_26 -- ------------------- procedure Initialize_26 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_26; ------------------- -- Initialize_27 -- ------------------- procedure Initialize_27 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_27; ------------------- -- Initialize_28 -- ------------------- procedure Initialize_28 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_28; ------------------- -- Initialize_29 -- ------------------- procedure Initialize_29 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_29; ------------------- -- Initialize_30 -- ------------------- procedure Initialize_30 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_30; ------------------- -- Initialize_31 -- ------------------- procedure Initialize_31 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_31; ------------------- -- Initialize_32 -- ------------------- procedure Initialize_32 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_32; ------------------- -- Initialize_33 -- ------------------- procedure Initialize_33 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_33; ------------------- -- Initialize_34 -- ------------------- procedure Initialize_34 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_34; ------------------- -- Initialize_35 -- ------------------- procedure Initialize_35 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_35; ------------------- -- Initialize_36 -- ------------------- procedure Initialize_36 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_36; ------------------- -- Initialize_37 -- ------------------- procedure Initialize_37 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_37; ------------------- -- Initialize_38 -- ------------------- procedure Initialize_38 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_38; ------------------- -- Initialize_39 -- ------------------- procedure Initialize_39 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_39; ------------------- -- Initialize_40 -- ------------------- procedure Initialize_40 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_40; ------------------- -- Initialize_41 -- ------------------- procedure Initialize_41 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_41; ------------------- -- Initialize_42 -- ------------------- procedure Initialize_42 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_42; ------------------- -- Initialize_43 -- ------------------- procedure Initialize_43 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_43; ------------------- -- Initialize_44 -- ------------------- procedure Initialize_44 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_44; ------------------- -- Initialize_45 -- ------------------- procedure Initialize_45 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_45; ------------------- -- Initialize_46 -- ------------------- procedure Initialize_46 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_46; ------------------- -- Initialize_47 -- ------------------- procedure Initialize_47 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_47; ------------------- -- Initialize_48 -- ------------------- procedure Initialize_48 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_48; ------------------- -- Initialize_49 -- ------------------- procedure Initialize_49 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_49; ------------------- -- Initialize_50 -- ------------------- procedure Initialize_50 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_50; ------------------- -- Initialize_51 -- ------------------- procedure Initialize_51 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_51; ------------------- -- Initialize_52 -- ------------------- procedure Initialize_52 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_52; ------------------- -- Initialize_53 -- ------------------- procedure Initialize_53 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_53; ------------------- -- Initialize_54 -- ------------------- procedure Initialize_54 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_54; ------------------- -- Initialize_55 -- ------------------- procedure Initialize_55 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_55; ------------------- -- Initialize_56 -- ------------------- procedure Initialize_56 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_56; ------------------- -- Initialize_57 -- ------------------- procedure Initialize_57 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_57; ------------------- -- Initialize_58 -- ------------------- procedure Initialize_58 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_58; ------------------- -- Initialize_59 -- ------------------- procedure Initialize_59 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_59; ------------------- -- Initialize_60 -- ------------------- procedure Initialize_60 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_60; ------------------- -- Initialize_61 -- ------------------- procedure Initialize_61 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_61; ------------------- -- Initialize_62 -- ------------------- procedure Initialize_62 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_62; ------------------- -- Initialize_63 -- ------------------- procedure Initialize_63 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_63; ------------------- -- Initialize_64 -- ------------------- procedure Initialize_64 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_64; ------------------- -- Initialize_65 -- ------------------- procedure Initialize_65 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_65; ------------------- -- Initialize_66 -- ------------------- procedure Initialize_66 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_66; ------------------- -- Initialize_67 -- ------------------- procedure Initialize_67 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_67; ------------------- -- Initialize_68 -- ------------------- procedure Initialize_68 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_68; ------------------- -- Initialize_69 -- ------------------- procedure Initialize_69 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_69; ------------------- -- Initialize_70 -- ------------------- procedure Initialize_70 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_70; ------------------- -- Initialize_71 -- ------------------- procedure Initialize_71 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_71; ------------------- -- Initialize_72 -- ------------------- procedure Initialize_72 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_72; ------------------- -- Initialize_73 -- ------------------- procedure Initialize_73 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_73; ------------------- -- Initialize_74 -- ------------------- procedure Initialize_74 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_74; ------------------- -- Initialize_75 -- ------------------- procedure Initialize_75 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_75; ------------------- -- Initialize_76 -- ------------------- procedure Initialize_76 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_76; ------------------- -- Initialize_77 -- ------------------- procedure Initialize_77 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_77; ------------------- -- Initialize_78 -- ------------------- procedure Initialize_78 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_78; ------------------- -- Initialize_79 -- ------------------- procedure Initialize_79 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_79; ------------------- -- Initialize_80 -- ------------------- procedure Initialize_80 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_80; ------------------- -- Initialize_81 -- ------------------- procedure Initialize_81 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_81; ------------------- -- Initialize_82 -- ------------------- procedure Initialize_82 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_82; ------------------- -- Initialize_83 -- ------------------- procedure Initialize_83 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_83; ------------------- -- Initialize_84 -- ------------------- procedure Initialize_84 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_84; ------------------- -- Initialize_85 -- ------------------- procedure Initialize_85 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_85; ------------------- -- Initialize_86 -- ------------------- procedure Initialize_86 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_86; ------------------- -- Initialize_87 -- ------------------- procedure Initialize_87 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_87; ------------------- -- Initialize_88 -- ------------------- procedure Initialize_88 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_88; ------------------- -- Initialize_89 -- ------------------- procedure Initialize_89 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_89; ------------------- -- Initialize_90 -- ------------------- procedure Initialize_90 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_90; ------------------- -- Initialize_91 -- ------------------- procedure Initialize_91 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_91; ------------------- -- Initialize_92 -- ------------------- procedure Initialize_92 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_92; ------------------- -- Initialize_93 -- ------------------- procedure Initialize_93 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_93; ------------------- -- Initialize_94 -- ------------------- procedure Initialize_94 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_94; ------------------- -- Initialize_95 -- ------------------- procedure Initialize_95 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Package; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_95; ------------------- -- Initialize_96 -- ------------------- procedure Initialize_96 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Package_Import; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_96; ------------------- -- Initialize_97 -- ------------------- procedure Initialize_97 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_97; ------------------- -- Initialize_98 -- ------------------- procedure Initialize_98 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_98; ------------------- -- Initialize_99 -- ------------------- procedure Initialize_99 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_99; -------------------- -- Initialize_100 -- -------------------- procedure Initialize_100 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_100; -------------------- -- Initialize_101 -- -------------------- procedure Initialize_101 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_101; -------------------- -- Initialize_102 -- -------------------- procedure Initialize_102 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_102; -------------------- -- Initialize_103 -- -------------------- procedure Initialize_103 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_103; -------------------- -- Initialize_104 -- -------------------- procedure Initialize_104 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_104; -------------------- -- Initialize_105 -- -------------------- procedure Initialize_105 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_105; -------------------- -- Initialize_106 -- -------------------- procedure Initialize_106 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_106; -------------------- -- Initialize_107 -- -------------------- procedure Initialize_107 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_107; -------------------- -- Initialize_108 -- -------------------- procedure Initialize_108 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_108; -------------------- -- Initialize_109 -- -------------------- procedure Initialize_109 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_109; -------------------- -- Initialize_110 -- -------------------- procedure Initialize_110 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_110; -------------------- -- Initialize_111 -- -------------------- procedure Initialize_111 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_111; -------------------- -- Initialize_112 -- -------------------- procedure Initialize_112 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_112; -------------------- -- Initialize_113 -- -------------------- procedure Initialize_113 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_113; -------------------- -- Initialize_114 -- -------------------- procedure Initialize_114 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_114; -------------------- -- Initialize_115 -- -------------------- procedure Initialize_115 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_115; -------------------- -- Initialize_116 -- -------------------- procedure Initialize_116 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_116; -------------------- -- Initialize_117 -- -------------------- procedure Initialize_117 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_117; -------------------- -- Initialize_118 -- -------------------- procedure Initialize_118 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_118; -------------------- -- Initialize_119 -- -------------------- procedure Initialize_119 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_119; -------------------- -- Initialize_120 -- -------------------- procedure Initialize_120 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_120; -------------------- -- Initialize_121 -- -------------------- procedure Initialize_121 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_121; -------------------- -- Initialize_122 -- -------------------- procedure Initialize_122 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_122; -------------------- -- Initialize_123 -- -------------------- procedure Initialize_123 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_123; -------------------- -- Initialize_124 -- -------------------- procedure Initialize_124 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_124; -------------------- -- Initialize_125 -- -------------------- procedure Initialize_125 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_125; -------------------- -- Initialize_126 -- -------------------- procedure Initialize_126 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_126; -------------------- -- Initialize_127 -- -------------------- procedure Initialize_127 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_127; -------------------- -- Initialize_128 -- -------------------- procedure Initialize_128 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_128; -------------------- -- Initialize_129 -- -------------------- procedure Initialize_129 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_129; -------------------- -- Initialize_130 -- -------------------- procedure Initialize_130 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_130; -------------------- -- Initialize_131 -- -------------------- procedure Initialize_131 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_131; -------------------- -- Initialize_132 -- -------------------- procedure Initialize_132 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_132; -------------------- -- Initialize_133 -- -------------------- procedure Initialize_133 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_133; -------------------- -- Initialize_134 -- -------------------- procedure Initialize_134 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_134; -------------------- -- Initialize_135 -- -------------------- procedure Initialize_135 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_135; -------------------- -- Initialize_136 -- -------------------- procedure Initialize_136 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_136; -------------------- -- Initialize_137 -- -------------------- procedure Initialize_137 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_137; -------------------- -- Initialize_138 -- -------------------- procedure Initialize_138 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_138; -------------------- -- Initialize_139 -- -------------------- procedure Initialize_139 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_139; -------------------- -- Initialize_140 -- -------------------- procedure Initialize_140 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_140; -------------------- -- Initialize_141 -- -------------------- procedure Initialize_141 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_141; -------------------- -- Initialize_142 -- -------------------- procedure Initialize_142 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_142; -------------------- -- Initialize_143 -- -------------------- procedure Initialize_143 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_143; -------------------- -- Initialize_144 -- -------------------- procedure Initialize_144 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_144; -------------------- -- Initialize_145 -- -------------------- procedure Initialize_145 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_145; -------------------- -- Initialize_146 -- -------------------- procedure Initialize_146 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_146; -------------------- -- Initialize_147 -- -------------------- procedure Initialize_147 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_147; -------------------- -- Initialize_148 -- -------------------- procedure Initialize_148 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_148; -------------------- -- Initialize_149 -- -------------------- procedure Initialize_149 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_149; -------------------- -- Initialize_150 -- -------------------- procedure Initialize_150 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_150; -------------------- -- Initialize_151 -- -------------------- procedure Initialize_151 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_151; -------------------- -- Initialize_152 -- -------------------- procedure Initialize_152 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_152; -------------------- -- Initialize_153 -- -------------------- procedure Initialize_153 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_153; -------------------- -- Initialize_154 -- -------------------- procedure Initialize_154 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_154; -------------------- -- Initialize_155 -- -------------------- procedure Initialize_155 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_155; -------------------- -- Initialize_156 -- -------------------- procedure Initialize_156 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_156; -------------------- -- Initialize_157 -- -------------------- procedure Initialize_157 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_157; -------------------- -- Initialize_158 -- -------------------- procedure Initialize_158 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_158; -------------------- -- Initialize_159 -- -------------------- procedure Initialize_159 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_159; -------------------- -- Initialize_160 -- -------------------- procedure Initialize_160 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_160; -------------------- -- Initialize_161 -- -------------------- procedure Initialize_161 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_161; -------------------- -- Initialize_162 -- -------------------- procedure Initialize_162 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_162; -------------------- -- Initialize_163 -- -------------------- procedure Initialize_163 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_163; -------------------- -- Initialize_164 -- -------------------- procedure Initialize_164 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_164; -------------------- -- Initialize_165 -- -------------------- procedure Initialize_165 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_165; -------------------- -- Initialize_166 -- -------------------- procedure Initialize_166 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_166; -------------------- -- Initialize_167 -- -------------------- procedure Initialize_167 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_167; -------------------- -- Initialize_168 -- -------------------- procedure Initialize_168 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_168; -------------------- -- Initialize_169 -- -------------------- procedure Initialize_169 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_169; -------------------- -- Initialize_170 -- -------------------- procedure Initialize_170 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_170; -------------------- -- Initialize_171 -- -------------------- procedure Initialize_171 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_171; -------------------- -- Initialize_172 -- -------------------- procedure Initialize_172 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_172; -------------------- -- Initialize_173 -- -------------------- procedure Initialize_173 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_173; -------------------- -- Initialize_174 -- -------------------- procedure Initialize_174 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_174; -------------------- -- Initialize_175 -- -------------------- procedure Initialize_175 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_175; -------------------- -- Initialize_176 -- -------------------- procedure Initialize_176 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_176; -------------------- -- Initialize_177 -- -------------------- procedure Initialize_177 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_177; -------------------- -- Initialize_178 -- -------------------- procedure Initialize_178 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_178; -------------------- -- Initialize_179 -- -------------------- procedure Initialize_179 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_179; -------------------- -- Initialize_180 -- -------------------- procedure Initialize_180 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Tag; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_180; end AMF.Internals.Tables.Standard_Profile_L2_Metamodel.Objects;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E X P _ S M E M -- -- -- -- S p e c -- -- -- -- Copyright (C) 1998-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. -- -- -- ------------------------------------------------------------------------------ -- This package contains routines involved in the required expansions for -- handling shared memory accesses for variables in Shared_Passive packages. -- See detailed documentation in System.Shared_Storage spec for a full -- description of the approach that is taken for handling distributed -- shared memory. This expansion unit in the compiler is responsible -- for generating the calls to routines in System.Shared_Storage. with Types; use Types; package Exp_Smem is procedure Expand_Shared_Passive_Variable (N : Node_Id); -- N is the identifier for a shared passive variable. This routine is -- responsible for determining if this is an assigned to N, or a -- reference to N, and generating the required calls to the shared -- memory read/write procedures. procedure Add_Shared_Var_Lock_Procs (N : Node_Id); -- The argument is a protected subprogram call, before it is rewritten -- by Exp_Ch9.Build_Protected_Subprogram_Call. This routine, which is -- called only in the case of an external call to a protected object -- that has Is_Shared_Passive set, deals with installing a transient scope -- and acquiring the appropriate global lock calls for this case. It also -- generates the necessary read/write calls for the protected object within -- the lock region. function Make_Shared_Var_Procs (N : Node_Id) return Node_Id; -- N is the node for the declaration of a shared passive variable. -- This procedure constructs an instantiation of -- System.Shared_Storage.Shared_Var_Procs that contains the read and -- assignment procedures for the shared memory variable. -- See System.Shared_Storage for a full description of these procedures -- and how they are used. The last inserted node is returned. end Exp_Smem;
------------------------------------------------------------------------------ -- -- -- 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; package body AMF.Internals.UML_Slots is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant UML_Slot_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_Slot (AMF.UML.Slots.UML_Slot_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant UML_Slot_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_Slot (AMF.UML.Slots.UML_Slot_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant UML_Slot_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_Slot (Visitor, AMF.UML.Slots.UML_Slot_Access (Self), Control); end if; end Visit_Element; -------------------------- -- Get_Defining_Feature -- -------------------------- overriding function Get_Defining_Feature (Self : not null access constant UML_Slot_Proxy) return AMF.UML.Structural_Features.UML_Structural_Feature_Access is begin return AMF.UML.Structural_Features.UML_Structural_Feature_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Defining_Feature (Self.Element))); end Get_Defining_Feature; -------------------------- -- Set_Defining_Feature -- -------------------------- overriding procedure Set_Defining_Feature (Self : not null access UML_Slot_Proxy; To : AMF.UML.Structural_Features.UML_Structural_Feature_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Defining_Feature (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Defining_Feature; ------------------------- -- Get_Owning_Instance -- ------------------------- overriding function Get_Owning_Instance (Self : not null access constant UML_Slot_Proxy) return AMF.UML.Instance_Specifications.UML_Instance_Specification_Access is begin return AMF.UML.Instance_Specifications.UML_Instance_Specification_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Instance (Self.Element))); end Get_Owning_Instance; ------------------------- -- Set_Owning_Instance -- ------------------------- overriding procedure Set_Owning_Instance (Self : not null access UML_Slot_Proxy; To : AMF.UML.Instance_Specifications.UML_Instance_Specification_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Instance (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Owning_Instance; --------------- -- Get_Value -- --------------- overriding function Get_Value (Self : not null access constant UML_Slot_Proxy) return AMF.UML.Value_Specifications.Collections.Ordered_Set_Of_UML_Value_Specification is begin return AMF.UML.Value_Specifications.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Value (Self.Element))); end Get_Value; end AMF.Internals.UML_Slots;
-------------------------------------------------------------------------------- -- MIT License -- -- Copyright (c) 2020 Zane Myers -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in all -- copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -- SOFTWARE. -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- --< @group Vulkan Math GenMatrix -------------------------------------------------------------------------------- --< @summary --< This generic package provides constructors, getters, and setters for generic --< matrix types. --< --< @description --< The Vkm_Matrix type is a generic floating point matrix that can contain up to --< 4 rows and 4 columns. -------------------------------------------------------------------------------- generic type Base_Type is digits <>; type Base_Vector_Type (<>) is tagged private; with function Image (instance : Base_Vector_Type) return String; ---------------------------------------------------------------------------- --< @summary --< Retrieve the x-component of the vector. --< --< @description --< Retrieve the x-component of the vector. --< --< @param vec --< The vector to retrieve the x-component from. --< --< @return --< The x-component of the vector. ---------------------------------------------------------------------------- with function x (vec : in Base_Vector_Type) return Base_Type; ---------------------------------------------------------------------------- --< @summary --< Retrieve the y-component of the vector. --< --< @description --< Retrieve the y-component of the vector. --< --< @param vec --< The vector to retrieve the y-component from. --< --< @return --< The y-component of the vector. ---------------------------------------------------------------------------- with function y (vec : in Base_Vector_Type) return Base_Type; ---------------------------------------------------------------------------- --< @summary --< Retrieve the z-component of the vector. --< --< @description --< Retrieve the z-component of the vector. --< --< @param vec --< The vector to retrieve the z-component from. --< --< @return --< The z-component of the vector. ---------------------------------------------------------------------------- with function z (vec : in Base_Vector_Type) return Base_Type; ---------------------------------------------------------------------------- --< @summary --< Retrieve the w-component of the vector. --< --< @description --< Retrieve the w-component of the vector. --< --< @param vec --< The vector to retrieve the w-component from. --< --< @return --< The w-component of the vector. ---------------------------------------------------------------------------- with function w (vec : in Base_Vector_Type) return Base_Type; ---------------------------------------------------------------------------- --< @summary --< Set the component of the vector. --< --< @description --< Set the component of the vector. --< --< @param vec --< The vector to set the component for. --< ---------------------------------------------------------------------------- with procedure Set(vec : in out Base_Vector_Type; index : in Vkm_Indices; value : in Base_Type); with function Get(vec : in Base_Vector_Type; index : in Vkm_Indices) return Base_Type; ---------------------------------------------------------------------------- --< @summary --< Construct a Base_Vector_Type. --< --< @description --< Construct a Base_Vector_Type. --< --< @param size --< The number of components in the Base_Vector_Type. --< --< @param value1 --< The value to set for the x-component of the Base_Vector_Type. --< --< @param value2 --< The value to set for the y-component of the Base_Vector_Type. --< --< @param value3 --< The value to set for the z-component of the Base_Vector_Type. --< --< @param value4 --< The value to set for the w-component of the Base_Vector_Type. --< --< @return --< The w-component of the vector. ---------------------------------------------------------------------------- with function Make_GenType ( size : in Vkm_Length; value1, value2, value3, value4 : in Base_Type := 0.0) return Base_Vector_Type; package Vulkan.Math.GenMatrix is pragma Preelaborate; pragma Pure; INCOMPATIBLE_MATRICES : exception; ---------------------------------------------------------------------------- -- Types ---------------------------------------------------------------------------- --< The matrix type is a 2D array with indices in the range of the Vkm_Indices --< type [0 .. 3]. Because of this, the number of columns is 1-4 and the --< number of rows is 1-4. type Vkm_Matrix is array(Vkm_Indices range <>, Vkm_Indices range <>) of aliased Base_Type; pragma Convention(C,Vkm_Matrix); --< The matrix is a discriminant tagged record which encapsulates the --< Vkm_Matrix type. This allows use of "." to perform functions on an --< instance of matrix. --< --< @field last_column_index --< The discriminant, last_column_index, determines the number of columns in the --< matrix. --< --< @field last_row_index --< The discriminant, last_row_index, determines the number of rows in the matrix. --< --< @field data --< The matrix data for the record. This information is able to be --< passed to a C/C++ context. type Vkm_GenMatrix(last_column_index : Vkm_Indices; last_row_index : Vkm_Indices) is tagged record data : Vkm_Matrix(Vkm_Indices'First .. last_column_index, Vkm_Indices'First .. last_row_index); end record; --< A reference to a generic matrix type. The Vkm_GenMatrix instance is --< automatically dereferenced on use. type Vkm_GenMatrix_Reference(instance : not null access Vkm_GenMatrix) is null record with Implicit_Dereference => instance; ---------------------------------------------------------------------------- --< @summary --< The image of the matrix --< --< @description --< Generates a human readable string which contains the contents of the --< instance of Vkm_GenMatrix. For a 2x2 matrix, this appears as a list of --< the row vectors --< --< "[ " & Image(mat.r0) & ", " & Image(mat.r1) & " ]" --< --< The Image() subprogram that is supplied during generic instantiation is used --< to print the component of Base_Vector_Type. --< --< @param instance --< The instance of Vkm_GenMatrix. --< --< @return --< The human readable image of the matrix ---------------------------------------------------------------------------- function Image (instance : in Vkm_GenMatrix) return String; ---------------------------------------------------------------------------- -- Element Getters ---------------------------------------------------------------------------- --< @summary --< Vkm_GenMatrix element accessor. --< --< @description --< Gets the value of an element at the specified column and row index. --< --< @param instance --< The Vkm_GenMatrix instance to get the element value of. --< --< @param col_index --< The index of the column at which to get an element. --< --< @param row_index --< The index of the row at which to get an element. --< --< @return --< The value of the specified element. ---------------------------------------------------------------------------- function Element(instance : in Vkm_GenMatrix; col_index, row_index : in Vkm_Indices) return Base_Type; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c0r0 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 0, 0)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c0r1 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 0, 1)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c0r2 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 0, 2)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c0r3 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 0, 3)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c1r0 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 1, 0)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c1r1 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 1, 1)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c1r2 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 1, 2)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c1r3 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 1, 3)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c2r0 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 2, 0)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c2r1 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 2, 1)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c2r2 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 2, 2)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c2r3 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 2, 3)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c3r0 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 3, 0)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c3r1 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 3, 1)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c3r2 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 3, 2)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c3r3 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 3, 3)) with Inline; ---------------------------------------------------------------------------- -- Element Setters ---------------------------------------------------------------------------- --< @summary --< Vkm_GenMatrix element accessor. --< --< @description --< Sets the element at the specified column and row index to a value. --< --< @param instance --< The Vkm_GenMatrix instance to set the element of. --< --< @param col_index --< The index of the column at which to set an element. --< --< @param row_index --< The index of the row at which to set an element. --< --< @param value --< The value to set the specified element. ---------------------------------------------------------------------------- procedure Element( instance : in out Vkm_GenMatrix; col_index, row_index : in Vkm_Indices; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c0r0( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c0r1( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c0r2( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c0r3( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c1r0( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c1r1( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c1r2( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c1r3( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c2r0( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c2r1( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c2r2( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c2r3( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c3r0( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c3r1( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c3r2( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c3r3( instance : in out Vkm_GenMatrix; value : in Base_Type); ---------------------------------------------------------------------------- --< @summary --< Vkm_GenMatrix element accessor. --< --< @description --< Sets the element at the specified column and row index to a value. A --< reference to the matrix is returned upon completion. --< --< @param instance --< The Vkm_GenMatrix instance to set the element of. --< --< @param col_index --< The index of the column at which to set an element. --< --< @param row_index --< The index of the row at which to set an element. --< --< @param value --< The value to set the specified element. --< --< @return --< A reference to the Vkm_GenMatrix instance. ---------------------------------------------------------------------------- function Element( instance : in out Vkm_GenMatrix; col_index, row_index : in Vkm_Indices ; value : in Base_Type ) return Vkm_GenMatrix_Reference; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c0r0 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 0, 0, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c0r1 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 0, 1, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c0r2 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 0, 2, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c0r3 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 0, 3, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c1r0 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 1, 0, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c1r1 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 1, 1, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c1r2 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 1, 2, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c1r3 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 1, 3, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c2r0 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 2, 0, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c2r1 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 2, 1, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c2r2 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 2, 2, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c2r3 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 2, 3, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c3r0 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 3, 0, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c3r1 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 3, 1, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c3r2 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 3, 2, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c3r3 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 3, 3, value)) with Inline; ---------------------------------------------------------------------------- -- Column Accessors ---------------------------------------------------------------------------- --< @summary --< Get the indicated column of the matrix as a vector. --< --< @description --< Retrieve the indicated column of the matrix as a vector: --< --< cI := [ instance.cIr0 instance.cIr1 ... instance.cIrN ] --< --< @param instance --< The instance of Vkm_GenMatrix from which the column is retrieved. --< --< @param col_index --< The index of the column to retrieve from the matrix. --< --< @return --< The vector that contains all elements in the indicated column. ---------------------------------------------------------------------------- function Column ( instance : in Vkm_GenMatrix; col_index : in Vkm_Indices) return Base_Vector_Type is (Make_GenType( To_Vkm_Length(instance.last_row_index), instance.Element(col_index, 0), instance.Element(col_index, 1), instance.Element(col_index, 2), instance.Element(col_index, 3))) with Inline; --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix from which to retrieve a column. --< --< @return --< The indicated column from the matrix. function c0 ( instance : in Vkm_GenMatrix) return Base_Vector_Type is (Column(instance, 0)) with Inline; --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix from which to retrieve a column. --< --< @return --< The indicated column from the matrix. function c1 ( instance : in Vkm_GenMatrix) return Base_Vector_Type is (Column(instance, 1)) with Inline; --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix from which to retrieve a column. --< --< @return --< The indicated column from the matrix. function c2 ( instance : in Vkm_GenMatrix) return Base_Vector_Type is (Column(instance, 2)) with Inline; --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix from which to retrieve a column. --< --< @return --< The indicated column from the matrix. function c3 ( instance : in Vkm_GenMatrix) return Base_Vector_Type is (Column(instance, 3)) with Inline; ---------------------------------------------------------------------------- --< @summary --< Set the indicated column of the matrix given a vector. --< --< @description --< Sets the indicated column of the matrix to the specified value. --< --< @param instance --< The instance of Vkm_GenMatrix for which the column is set. --< --< @param col_index --< The index of the column to set for the matrix. --< --< @param col_val --< The vector value to set the column to. ---------------------------------------------------------------------------- procedure Column ( instance : in out Vkm_GenMatrix; col_index : in Vkm_Indices; col_val : in Base_Vector_Type); --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a column. --< --< @param col_val --< The vector to set the column equal to. procedure c0 ( instance : in out Vkm_GenMatrix; col_val : in Base_Vector_Type); --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a column. --< --< @param col_val --< The vector to set the column equal to. procedure c1 ( instance : in out Vkm_GenMatrix; col_val : in Base_Vector_Type); --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a column. --< --< @param col_val --< The vector to set the column equal to. procedure c2 ( instance : in out Vkm_GenMatrix; col_val : in Base_Vector_Type); --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a column. --< --< @param col_val --< The vector to set the column equal to. procedure c3 ( instance : in out Vkm_GenMatrix; col_val : in Base_Vector_Type); ---------------------------------------------------------------------------- --< @summary --< Set the indicated column of the matrix given a vector. --< --< @description --< Sets the indicated column of the matrix to the specified value. --< --< @param instance --< The instance of Vkm_GenMatrix for which the column is set. --< --< @param col_index --< The index of the column to set for the matrix. --< --< @param col_val --< The vector value to set the column to. --< --< @return --< A reference to the Vkm_GenMatrix instance. ---------------------------------------------------------------------------- function Column( instance : in out Vkm_GenMatrix; col_index : in Vkm_Indices ; col_val : in Base_Vector_Type) return Vkm_GenMatrix_Reference; --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a column. --< --< @param col_val --< The vector to set the column equal to. --< --< @return --< A reference to the instance of Vkm_GenMatrix. function c0 ( instance : in out Vkm_GenMatrix; col_val : in Base_Vector_Type) return Vkm_GenMatrix_Reference is (Column(instance, 0, col_val)) with Inline; --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a column. --< --< @param col_val --< The vector to set the column equal to. --< --< @return --< A reference to the instance of Vkm_GenMatrix. function c1 ( instance : in out Vkm_GenMatrix; col_val : in Base_Vector_Type) return Vkm_GenMatrix_Reference is (Column(instance, 1, col_val)) with Inline; --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a column. --< --< @param col_val --< The vector to set the column equal to. --< --< @return --< A reference to the instance of Vkm_GenMatrix. function c2 ( instance : in out Vkm_GenMatrix; col_val : in Base_Vector_Type) return Vkm_GenMatrix_Reference is (Column(instance, 2, col_val)) with Inline; --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a column. --< --< @param col_val --< The vector to set the column equal to. --< --< @return --< A reference to the instance of Vkm_GenMatrix. function c3 ( instance : in out Vkm_GenMatrix; col_val : in Base_Vector_Type) return Vkm_GenMatrix_Reference is (Column(instance, 3, col_val)) with Inline; ---------------------------------------------------------------------------- -- Row Accessors ---------------------------------------------------------------------------- --< @summary --< Get the indicated row of the matrix as a vector. --< --< @description --< Retrieve the indicated row of the matrix as a vector: --< --< rI := [ instance.c0rI instance.c1rI ... instance.cNrI ] --< --< @param instance --< The instance of Vkm_GenMatrix from which the row is retrieved. --< --< @param row_index --< The index of the row to retrieve from the matrix. --< --< @return --< The vector that contains all elements in the indicated row. ---------------------------------------------------------------------------- function Row ( instance : in Vkm_GenMatrix; row_index : in Vkm_Indices) return Base_Vector_Type is (Make_GenType( To_Vkm_Length(instance.last_column_index), instance.Element(0, row_index), instance.Element(1, row_index), instance.Element(2, row_index), instance.Element(3, row_index))) with Inline; --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix from which to retrieve a row. --< --< @return --< The indicated row from the matrix. function r0 (instance : in Vkm_GenMatrix) return Base_Vector_Type is (Row(instance, 0)) with Inline; --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix from which to retrieve a row. --< --< @return --< The indicated row from the matrix. function r1 (instance : in Vkm_GenMatrix) return Base_Vector_Type is (Row(instance, 1)) with Inline; --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix from which to retrieve a row. --< --< @return --< The indicated row from the matrix. function r2 (instance : in Vkm_GenMatrix) return Base_Vector_Type is (Row(instance, 2)) with Inline; --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix from which to retrieve a row. --< --< @return --< The indicated row from the matrix. function r3 (instance : in Vkm_GenMatrix) return Base_Vector_Type is (Row(instance, 3)) with Inline; ---------------------------------------------------------------------------- --< @summary --< Set the indicated row of the matrix given a vector. --< --< @description --< Sets the indicated row of the matrix to the specified value. --< --< @param instance --< The instance of Vkm_GenMatrix for which the row is set. --< --< @param row_index --< The index of the row to set for the matrix. --< --< @param row_val --< The vector value to set the row to. ---------------------------------------------------------------------------- procedure Row ( instance : in out Vkm_GenMatrix; row_index : in Vkm_Indices; row_val : in Base_Vector_Type); --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a row. --< --< @param row_val --< The the value to set a row of the matrix to. procedure r0 ( instance : in out Vkm_GenMatrix; row_val : in Base_Vector_Type); --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a row. --< --< @param row_val --< The the value to set a row of the matrix to. procedure r1 ( instance : in out Vkm_GenMatrix; row_val : in Base_Vector_Type); --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a row. --< --< @param row_val --< The the value to set a row of the matrix to. procedure r2 ( instance : in out Vkm_GenMatrix; row_val : in Base_Vector_Type); --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a row. --< --< @param row_val --< The the value to set a row of the matrix to. procedure r3 ( instance : in out Vkm_GenMatrix; row_val : in Base_Vector_Type); ---------------------------------------------------------------------------- --< @summary --< Set the indicated row of the matrix given a vector. --< --< @description --< Sets the indicated row of the matrix to the specified value. --< --< @param instance --< The instance of Vkm_GenMatrix for which the row is set. --< --< @param row_index --< The index of the row to set for the matrix. --< --< @param row_val --< The vector value to set the row to. --< --< @return --< A reference to the Vkm_GenMatrix instance. ---------------------------------------------------------------------------- function Row ( instance : in out Vkm_GenMatrix; row_index : in Vkm_Indices; row_val : in Base_Vector_Type) return Vkm_GenMatrix_Reference; --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a row. --< --< @param row_val --< The the value to set a row of the matrix to. --< --< @return --< A reference to the modified matrix. function r0 ( instance : in out Vkm_GenMatrix; row_val : in Base_Vector_Type) return Vkm_GenMatrix_Reference is (Row(instance, 0, row_val)) with Inline; --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a row. --< --< @param row_val --< The the value to set a row of the matrix to. --< --< @return --< A reference to the modified matrix. function r1 ( instance : in out Vkm_GenMatrix; row_val : in Base_Vector_Type) return Vkm_GenMatrix_Reference is (Row(instance, 1, row_val)) with Inline; --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a row. --< --< @param row_val --< The the value to set a row of the matrix to. --< --< @return --< A reference to the modified matrix. function r2 ( instance : in out Vkm_GenMatrix; row_val : in Base_Vector_Type) return Vkm_GenMatrix_Reference is (Row(instance, 2, row_val)) with Inline; --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a row. --< --< @param row_val --< The the value to set a row of the matrix to. --< --< @return --< A reference to the modified matrix. function r3 ( instance : in out Vkm_GenMatrix; row_val : in Base_Vector_Type) return Vkm_GenMatrix_Reference is (Row(instance, 3, row_val)) with Inline; ---------------------------------------------------------------------------- -- Operations ---------------------------------------------------------------------------- --< @summary --< Constructor for Vkm_GenMatrix type. --< --< @description --< Creates a new instance of Vkm_GenMatrix with the indicated number of rows --< and columns. Each element is initialized as specified: --< --< \ c0 c1 c2 c3 cN --< r0 | c0r0_val c1r0_val c2r0_val c3r0_val | --< r1 | c0r1_val c1r1_val c2r1_val c3r1_val | --< r2 | c0r2_val c1r2_val c2r2_val c3r2_val | --< r3 | c0r3_val c1r3_val c2r3_val c3r3_val | --< rN --< --< If no value is supplied for an element a default value of 0.0 is used. --< If the indices in the element name are not within matrix bounds, value --< specifiedis ignored. --< --< @param cN --< The last index that can be used for accessing columns in the matrix. --< --< @param rN --< The last index that can be used for accessing rows in the matrix. --< --< @param c0r0_val --< The value to set for the element at column 0 and row 0. --< --< @param c0r1_val --< The value to set for the element at column 0 and row 1. --< --< @param c0r2_val --< The value to set for the element at column 0 and row 2. --< --< @param c0r3_val --< The value to set for the element at column 0 and row 3. --< --< @param c1r0_val --< The value to set for the element at column 1 and row 0. --< --< @param c1r1_val --< The value to set for the element at column 1 and row 1. --< --< @param c1r2_val --< The value to set for the element at column 1 and row 2. --< --< @param c1r3_val --< The value to set for the element at column 1 and row 3. --< --< @param c2r0_val --< The value to set for the element at column 2 and row 0. --< --< @param c2r1_val --< The value to set for the element at column 2 and row 1. --< --< @param c2r2_val --< The value to set for the element at column 2 and row 2. --< --< @param c2r3_val --< The value to set for the element at column 2 and row 3. --< --< @param c3r0_val --< The value to set for the element at column 3 and row 0. --< --< @param c3r1_val --< The value to set for the element at column 3 and row 1. --< --< @param c3r2_val --< The value to set for the element at column 3 and row 2. --< --< @param c3r3_val --< The value to set for the element at column 3 and row 3. --< --< @return --< The new Vkm_GenMatrix instance. ---------------------------------------------------------------------------- function Make_GenMatrix( cN, rN : in Vkm_Indices; c0r0_val, c0r1_val, c0r2_val, c0r3_val, c1r0_val, c1r1_val, c1r2_val, c1r3_val, c2r0_val, c2r1_val, c2r2_val, c2r3_val, c3r0_val, c3r1_val, c3r2_val, c3r3_val : in Base_Type := 0.0) return Vkm_GenMatrix; ---------------------------------------------------------------------------- --< @summary --< Constructor for Vkm_GenMatrix type. --< --< @description --< Creates a new instance of Vkm_GenMatrix with the indicated number of rows --< and columns. Each element is initialized as specified: --< --< \ c0 c1 c2 c3 cN --< r0 | diag 0.0 0.0 0.0 | --< r1 | 0.0 diag 0.0 0.0 | --< r2 | 0.0 0.0 diag 0.0 | --< r3 | 0.0 0.0 0.0 diag | --< rN --< --< @param cN --< The last index that can be used for accessing columns in the matrix. --< --< @param rN --< The last index that can be used for accessing rows in the matrix. --< --< @param diag --< The value to set on the diagonal. --< --< @return --< The new Vkm_GenMatrix instance. ---------------------------------------------------------------------------- function Make_GenMatrix( cN, rN : in Vkm_Indices; diag : in Base_Type) return Vkm_GenMatrix is (Make_GenMatrix( cN => cN, rN => rN, c0r0_val => diag, c1r1_val => diag, c2r2_val => diag, c3r3_val => diag)) with Inline; ---------------------------------------------------------------------------- --< @summary --< Constructor for Vkm_GenMatrix type. --< --< @description --< Creates a new instance of Vkm_GenMatrix with the indicated number of rows --< and columns. Each element is initialized as specified: --< --< \ c0 c1 c2 c3 cN --< r0 | sub.c0r0 sub.c1r0 sub.c2r0 sub.c3r0 | --< r1 | sub.c0r1 sub.c1r1 sub.c2r1 sub.c3r1 | --< r2 | sub.c0r2 sub.c1r2 sub.c2r2 sub.c3r2 | --< r3 | sub.c0r3 sub.c1r3 sub.c2r3 sub.c3r3 | --< rN --< --< --< @param cN --< The last index that can be used for accessing columns in the matrix. --< --< @param rN --< The last index that can be used for accessing rows in the matrix. --< --< @param sub --< The submatrix used to initialize elements of the new instance of matrix. --< If an element is out of bounds for the submatrix, the corresponding value --< of the identity matrix is used instead. --< --< @return --< The new Vkm_GenMatrix instance. ---------------------------------------------------------------------------- function Make_GenMatrix( cN, rN : in Vkm_Indices; sub : in Vkm_GenMatrix) return Vkm_GenMatrix is (Make_GenMatrix( cN => cN, rN => rN, c0r0_val => sub.c0r0, c0r1_val => sub.c0r1, c0r2_val => sub.c0r2, c0r3_val => sub.c0r3, c1r0_val => sub.c1r0, c1r1_val => sub.c1r1, c1r2_val => sub.c1r2, c1r3_val => sub.c1r3, c2r0_val => sub.c2r0, c2r1_val => sub.c2r1, c2r2_val => sub.c2r2, c2r3_val => sub.c2r3, c3r0_val => sub.c3r0, c3r1_val => sub.c3r1, c3r2_val => sub.c3r2, c3r3_val => sub.c3r3)) with Inline; ---------------------------------------------------------------------------- --< @summary --< Constructor for Vkm_GenMatrix type. --< --< @description --< Creates a new instance of Vkm_GenMatrix with the indicated number of rows --< and columns. Each element is initialized as specified: --< --< \ c0 c1 c2 c3 cN --< r0 | diag.x 0.0 0.0 0.0 | --< r1 | 0.0 diag.y 0.0 0.0 | --< r2 | 0.0 0.0 diag.z 0.0 | --< r3 | 0.0 0.0 0.0 diag.w | --< rN --< --< @param cN --< The last index that can be used for accessing columns in the matrix. --< --< @param rN --< The last index that can be used for accessing rows in the matrix. --< --< @param diag --< The value to set on the diagonal. --< --< @return --< The new Vkm_GenMatrix instance. ---------------------------------------------------------------------------- function Make_GenMatrix( cN, rN : in Vkm_Indices; diag : in Base_Vector_Type) return Vkm_GenMatrix is (Make_GenMatrix( cN => cN, rN => rN, c0r0_val => x(diag), c1r1_val => y(diag), c2r2_val => z(diag), c3r3_val => w(diag))) with Inline; ---------------------------------------------------------------------------- --< @summary --< Determine whether two matrices are equal to each other. --< --< @description --< Determines whether every element of the two matrices are equal to each --< other. --< --< @param left --< The variable that is to the left of the equality operator. --< --< @param right --< The variable that is to the right of the equality operator. --< --< @return --< True if the matrices are equal to each other. Otherwise, false. ---------------------------------------------------------------------------- function Op_Is_Equal( left, right : in Vkm_GenMatrix) return Vkm_Bool; ---------------------------------------------------------------------------- --< @summary --< Linear algebraic matrix multiplication --< --< @description --< Perform linear algebraic matrix multiplication for the two matrices. --< --< @param left --< The left matrix in the computation. --< --< @param right --< The right matrix in the computation. --< --< The result of linear algebraic multiplication for the two matrices. ---------------------------------------------------------------------------- function Op_Matrix_Mult_Matrix ( left, right : in Vkm_GenMatrix) return Vkm_GenMatrix; ---------------------------------------------------------------------------- --< @summary --< Multiplication operator for a Vkm_GenMatrix matrix and a Vkm_GenFType value. --< --< @description --< Perform Multiplication component-wise on the matrix and vector. --< --< @param left --< The matrix that is multiplied with the vector. --< --< @param right --< The vector that is multiplied by the matrix. --< --< @return --< The product of the matrix with the vector. ---------------------------------------------------------------------------- function Op_Matrix_Mult_Vector ( left : in Vkm_GenMatrix; right : in Base_Vector_Type ) return Base_Vector_Type; ---------------------------------------------------------------------------- --< @summary --< Multiplication operator for a Vkm_GenMatrix matrix and a Vkm_GenFType value. --< --< @description --< Perform Multiplication component-wise on the matrix and vector. --< --< @param left --< The vector that is multiplied with the matrix. --< --< @param right --< The matrix that is multiplied by the vector. --< --< @return --< The product of the vector with the matrix. ---------------------------------------------------------------------------- function Op_Vector_Mult_Matrix ( left : in Base_Vector_Type; right : in Vkm_GenMatrix) return Base_Vector_Type; ---------------------------------------------------------------------------- --< @summary --< Apply function component-wise on a matrix --< --< @description --< Applies function component-wise on a matrix, yielding the following --< matrix: --< --< | Func(im1.c0r0) ... Func(im1.cNr0) | --< | ... ... | --< | Func(im1.c0rN) ... Func(im1.cNrN) | --< --< @param im1 --< The input Vkm_GenMatrix parameter. --< --< @return --< The result from applying the generic function Func component-wise on a --< matrix. ---------------------------------------------------------------------------- generic with function Func (is1 : in Base_Type) return Base_Type; function Apply_Func_IM_RM (im1 : in Vkm_GenMatrix) return Vkm_GenMatrix; ---------------------------------------------------------------------------- --< @summary --< Apply function component-wise on two matrices. --< --< @description --< Applies function component-wise on two matrices, yielding the following --< matrix: --< --< | Func(im1.c0r0, im2.c0r0) ... Func(im1.cNr0, im2.cNr0) | --< | ... ... | --< | Func(im1.c0rN, im2.c0rN) ... Func(im1.cNrN, im2.cNrN) | --< --< @param im1 --< The first input Vkm_GenMatrix parameter. --< --< @param im2 --< The second input Vkm_GenMatrix parameter. --< --< @return --< The result from applying the generic function Func component-wise on both --< matrices. ---------------------------------------------------------------------------- generic with function Func (is1, is2 : in Base_Type) return Base_Type; function Apply_Func_IM_IM_RM (im1, im2 : in Vkm_GenMatrix) return Vkm_GenMatrix; ---------------------------------------------------------------------------- --< @summary --< Apply function component-wise on a matrix and a scalar. --< --< @description --< Applies function component-wise on a matrix and a scalar, yielding the --< following matrix: --< --< | Func(im1.c0r0, is1) ... Func(im1.cNr0, is1) | --< | ... ... | --< | Func(im1.c0rN, is1) ... Func(im1.cNrN, is1) | --< --< @param im1 --< The first input Vkm_GenMatrix parameter. --< --< @param is1 --< The second input Vkm_GenMatrix parameter. --< --< @return --< The result from applying the generic function Func component-wise on both --< matrices. ---------------------------------------------------------------------------- generic with function Func (is1, is2 : in Base_Type) return Base_Type; function Apply_Func_IM_IS_RM ( im1 : in Vkm_GenMatrix; is1 : in Base_Type ) return Vkm_GenMatrix; ---------------------------------------------------------------------------- --< @summary --< Apply function component-wise on a matrix and a scalar. --< --< @description --< Applies function component-wise on a matrix and a scalar, yielding the --< following matrix: --< --< | Func(is1, im1.c0r0) ... Func(is1, im1.cNr0) | --< | ... ... | --< | Func(is1, im1.c0rN) ... Func(is1, im1.cNrN) | --< --< @param is1 --< The first input Vkm_GenMatrix parameter. --< --< @param im1 --< The second input Vkm_GenMatrix parameter. --< --< @return --< The result from applying the generic function Func component-wise on both --< matrices. ---------------------------------------------------------------------------- generic with function Func (is1, is2 : in Base_Type) return Base_Type; function Apply_Func_IS_IM_RM ( is1 : in Base_Type; im1 : in Vkm_GenMatrix) return Vkm_GenMatrix; end Vulkan.Math.GenMatrix;
-- -- -- package Copyright (c) Dmitry A. Kazakov -- -- Parsers.Multiline_Source.Text_IO Luebeck -- -- Interface Winter, 2004 -- -- -- -- Last revision : 09:24 09 Apr 2010 -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU General Public License as -- -- published by the Free Software Foundation; either version 2 of -- -- the License, or (at your option) any later version. This library -- -- is distributed in the hope that it will be useful, but WITHOUT -- -- ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have -- -- received a copy of the GNU General Public License along with -- -- this library; if not, write to the Free Software Foundation, -- -- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from -- -- this unit, or you link this unit with other files to produce an -- -- executable, this unit does not by itself cause the resulting -- -- executable to be covered by the GNU General Public License. This -- -- exception does not however invalidate any other reasons why the -- -- executable file might be covered by the GNU Public License. -- --____________________________________________________________________-- -- -- This package provides an implementation of code sources based on -- the standard text I/O package. -- with Ada.Text_IO; use Ada.Text_IO; package Parsers.Multiline_Source.Text_IO is -- -- Source -- The source contained by a file -- type Source (File : access File_Type) is new Multiline_Source.Source with private; -- -- Get_Line -- Overrides Parsers.Multiline_Source... -- procedure Get_Line (Code : in out Source); private type Source (File : access File_Type) is new Multiline_Source.Source with null record; end Parsers.Multiline_Source.Text_IO;
----------------------------------------------------------------------- -- keystore-repository-keys -- Data keys management -- Copyright (C) 2019 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 Keystore.Repository.Entries; package body Keystore.Repository.Keys is use type Interfaces.Unsigned_32; use type Interfaces.Unsigned_64; procedure Load_Next_Keys (Manager : in out Wallet_Manager; Iterator : in out Data_Key_Iterator) is Index : Interfaces.Unsigned_32; Count : Interfaces.Unsigned_16; Offset : IO.Block_Index; begin Iterator.Directory := Wallet_Data_Key_List.Element (Iterator.Key_Iter).Directory; Entries.Load_Directory (Manager, Iterator.Directory, Iterator.Current); Iterator.Key_Header_Pos := Iterator.Directory.Key_Pos; Iterator.Key_Last_Pos := Iterator.Directory.Key_Pos; Iterator.Key_Count := 0; -- Scan each data key entry. Offset := IO.Block_Index'Last; while Offset > Iterator.Key_Header_Pos loop Offset := Offset - DATA_KEY_HEADER_SIZE; Iterator.Current.Pos := Offset; Index := Marshallers.Get_Unsigned_32 (Iterator.Current); Count := Marshallers.Get_Unsigned_16 (Iterator.Current); if Index = Interfaces.Unsigned_32 (Iterator.Entry_Id) then Iterator.Key_Header_Pos := Offset; Iterator.Current.Pos := Offset; Iterator.Key_Count := Count; Iterator.Count := Count; Iterator.Key_Last_Pos := Offset - Key_Slot_Size (Count); return; end if; Offset := Offset - Key_Slot_Size (Count); end loop; end Load_Next_Keys; procedure Initialize (Manager : in out Wallet_Manager; Iterator : in out Data_Key_Iterator; Item : in Wallet_Entry_Access) is begin Iterator.Key_Iter := Item.Data_Blocks.First; Iterator.Entry_Id := Item.Id; Iterator.Current_Offset := 0; Iterator.Key_Pos := IO.Block_Index'Last; Iterator.Key_Count := 0; Iterator.Key_Header_Pos := IO.Block_Index'Last; Iterator.Key_Last_Pos := IO.Block_Index'Last; Iterator.Count := 0; Iterator.Item := Item; Iterator.Data_Size := 0; if Wallet_Data_Key_List.Has_Element (Iterator.Key_Iter) then Load_Next_Keys (Manager, Iterator); else Iterator.Directory := null; end if; end Initialize; function Has_Data_Key (Iterator : in Data_Key_Iterator) return Boolean is begin return Iterator.Directory /= null; end Has_Data_Key; function Is_Last_Key (Iterator : in Data_Key_Iterator) return Boolean is begin return Iterator.Count = 0 and Iterator.Directory /= null; end Is_Last_Key; procedure Next_Data_Key (Manager : in out Wallet_Repository; Iterator : in out Data_Key_Iterator) is Pos : IO.Block_Index; begin Iterator.Current_Offset := Iterator.Current_Offset + Interfaces.Unsigned_64 (Iterator.Data_Size); loop -- Extract the next data key from the current directory block. if Iterator.Count > 0 then Iterator.Current.Pos := Iterator.Current.Pos - DATA_KEY_ENTRY_SIZE; Pos := Iterator.Current.Pos; Iterator.Data_Block := Marshallers.Get_Storage_Block (Iterator.Current); Iterator.Data_Size := Marshallers.Get_Buffer_Size (Iterator.Current); Iterator.Key_Pos := Iterator.Current.Pos; Iterator.Current.Pos := Pos; Iterator.Count := Iterator.Count - 1; return; end if; if not Wallet_Data_Key_List.Has_Element (Iterator.Key_Iter) then Iterator.Directory := null; Iterator.Data_Size := 0; return; end if; Wallet_Data_Key_List.Next (Iterator.Key_Iter); if not Wallet_Data_Key_List.Has_Element (Iterator.Key_Iter) then Iterator.Directory := null; Iterator.Data_Size := 0; return; end if; Load_Next_Keys (Manager, Iterator); end loop; end Next_Data_Key; procedure Mark_Data_Key (Iterator : in Data_Key_Iterator; Mark : in out Data_Key_Marker) is begin Mark.Directory := Iterator.Directory; Mark.Key_Header_Pos := Iterator.Key_Header_Pos; Mark.Key_Count := Iterator.Count; end Mark_Data_Key; procedure Delete_Key (Manager : in out Wallet_Repository; Iterator : in out Data_Key_Iterator; Mark : in out Data_Key_Marker) is Buf : constant Buffers.Buffer_Accessor := Iterator.Current.Buffer.Data.Value; Key_Start_Pos : IO.Block_Index; Next_Iter : Wallet_Data_Key_List.Cursor; Key_Pos : IO.Block_Index; Del_Count : Key_Count_Type; Del_Size : IO.Buffer_Size; New_Count : Key_Count_Type; begin if Mark.Key_Count = Iterator.Key_Count then -- Erase header + all keys Del_Count := Iterator.Key_Count; Del_Size := Key_Slot_Size (Del_Count) + DATA_KEY_HEADER_SIZE; Key_Start_Pos := Iterator.Key_Header_Pos - Key_Slot_Size (Iterator.Key_Count); else -- Erase some data keys but not all of them (the entry was updated and truncated). Del_Count := Mark.Key_Count + 1; Del_Size := Key_Slot_Size (Del_Count); Iterator.Current.Pos := Mark.Key_Header_Pos + 4; New_Count := Iterator.Key_Count - Mark.Key_Count - 1; Marshallers.Put_Unsigned_16 (Iterator.Current, New_Count); Key_Start_Pos := Iterator.Key_Header_Pos - Key_Slot_Size (New_Count); end if; Iterator.Item.Block_Count := Iterator.Item.Block_Count - Natural (Del_Count); Key_Pos := Iterator.Directory.Key_Pos; if Key_Pos + Del_Size < Key_Start_Pos then Buf.Data (Key_Pos + Del_Size .. Key_Start_Pos + Del_Size - 1) := Buf.Data (Key_Pos + 1 .. Key_Start_Pos); end if; Buf.Data (Key_Pos + 1 .. Key_Pos + Del_Size) := (others => 0); Iterator.Directory.Key_Pos := Key_Pos + Del_Size; if Iterator.Directory.Count > 0 or Iterator.Directory.Key_Pos < IO.Block_Index'Last then Iterator.Current.Pos := IO.BT_DATA_START + 4 - 1; Marshallers.Put_Block_Index (Iterator.Current, Iterator.Directory.Key_Pos); Manager.Modified.Include (Iterator.Current.Buffer.Block, Iterator.Current.Buffer.Data); else Manager.Stream.Release (Iterator.Directory.Block); end if; if Mark.Key_Count = Iterator.Key_Count then Next_Iter := Wallet_Data_Key_List.Next (Iterator.Key_Iter); Iterator.Item.Data_Blocks.Delete (Iterator.Key_Iter); Iterator.Key_Iter := Next_Iter; else if not Wallet_Data_Key_List.Has_Element (Iterator.Key_Iter) then Iterator.Directory := null; return; end if; Wallet_Data_Key_List.Next (Iterator.Key_Iter); end if; if not Wallet_Data_Key_List.Has_Element (Iterator.Key_Iter) then Iterator.Directory := null; return; end if; Load_Next_Keys (Manager, Iterator); Mark_Data_Key (Iterator, Mark); end Delete_Key; procedure Prepare_Append (Iterator : in out Data_Key_Iterator) is begin Iterator.Key_Iter := Iterator.Item.Data_Blocks.Last; if Wallet_Data_Key_List.Has_Element (Iterator.Key_Iter) then Iterator.Directory := Wallet_Data_Key_List.Element (Iterator.Key_Iter).Directory; end if; end Prepare_Append; procedure Allocate_Key_Slot (Manager : in out Wallet_Repository; Iterator : in out Data_Key_Iterator; Data_Block : in IO.Storage_Block; Size : in IO.Buffer_Size; Key_Pos : out IO.Block_Index; Key_Block : out IO.Storage_Block) is Key_Start : IO.Block_Index; Key_Last : IO.Block_Index; begin if Iterator.Directory = null or else Iterator.Directory.Available < DATA_KEY_ENTRY_SIZE or else Iterator.Key_Count = Key_Count_Type'Last then Entries.Find_Directory_Block (Manager, DATA_KEY_ENTRY_SIZE * 4, Iterator.Directory); Iterator.Directory.Available := Iterator.Directory.Available + DATA_KEY_ENTRY_SIZE * 4; if Iterator.Directory.Count > 0 then Entries.Load_Directory (Manager, Iterator.Directory, Iterator.Current); else Iterator.Current.Buffer := Manager.Current.Buffer; end if; Iterator.Key_Header_Pos := Iterator.Directory.Key_Pos - DATA_KEY_HEADER_SIZE; Iterator.Directory.Available := Iterator.Directory.Available - DATA_KEY_HEADER_SIZE; Iterator.Directory.Key_Pos := Iterator.Key_Header_Pos; Iterator.Key_Last_Pos := Iterator.Key_Header_Pos; Iterator.Current.Pos := Iterator.Key_Header_Pos; Iterator.Key_Count := 0; Marshallers.Put_Unsigned_32 (Iterator.Current, Interfaces.Unsigned_32 (Iterator.Entry_Id)); Marshallers.Put_Unsigned_16 (Iterator.Current, 0); Marshallers.Put_Unsigned_32 (Iterator.Current, 0); Iterator.Item.Data_Blocks.Append (Wallet_Data_Key_Entry '(Iterator.Directory, 0)); end if; declare Buf : constant Buffers.Buffer_Accessor := Iterator.Current.Buffer.Data.Value; begin -- Shift keys before the current slot. Key_Start := Iterator.Directory.Key_Pos; Key_Last := Iterator.Key_Last_Pos; if Key_Last /= Key_Start then Buf.Data (Key_Start - DATA_KEY_ENTRY_SIZE .. Key_Last - DATA_KEY_ENTRY_SIZE) := Buf.Data (Key_Start .. Key_Last); end if; -- Grow the key slot area by one key slot. Key_Last := Key_Last - DATA_KEY_ENTRY_SIZE; Key_Start := Key_Start - DATA_KEY_ENTRY_SIZE; Iterator.Key_Last_Pos := Key_Last; Iterator.Directory.Key_Pos := Key_Start; Iterator.Directory.Available := Iterator.Directory.Available - DATA_KEY_ENTRY_SIZE; Iterator.Current.Pos := IO.BT_DATA_START + 4 - 1; Marshallers.Put_Block_Index (Iterator.Current, Key_Start); -- Insert the new data key. Iterator.Key_Count := Iterator.Key_Count + 1; Iterator.Current.Pos := Iterator.Key_Header_Pos + 4; Marshallers.Put_Unsigned_16 (Iterator.Current, Iterator.Key_Count); Iterator.Current.Pos := Iterator.Key_Header_Pos - Key_Slot_Size (Iterator.Key_Count); Marshallers.Put_Storage_Block (Iterator.Current, Data_Block); Marshallers.Put_Buffer_Size (Iterator.Current, Size); Iterator.Key_Pos := Iterator.Current.Pos; Manager.Modified.Include (Iterator.Current.Buffer.Block, Iterator.Current.Buffer.Data); Iterator.Item.Block_Count := Iterator.Item.Block_Count + 1; Key_Pos := Iterator.Key_Pos; Key_Block := Iterator.Current.Buffer.Block; end; end Allocate_Key_Slot; procedure Update_Key_Slot (Manager : in out Wallet_Repository; Iterator : in out Data_Key_Iterator; Size : in IO.Buffer_Size) is Pos : IO.Block_Index; begin pragma Assert (Iterator.Directory /= null); if Iterator.Data_Size /= Size then Pos := Iterator.Current.Pos; Iterator.Current.Pos := Iterator.Key_Pos - 2; Marshallers.Put_Buffer_Size (Iterator.Current, Size); Iterator.Current.Pos := Pos; end if; Manager.Modified.Include (Iterator.Current.Buffer.Block, Iterator.Current.Buffer.Data); end Update_Key_Slot; procedure Create_Wallet (Manager : in out Wallet_Repository; Item : in Wallet_Entry_Access; Master_Block : in Keystore.IO.Storage_Block; Keys : in out Keystore.Keys.Key_Manager) is Iter : Data_Key_Iterator; Key_Pos : IO.Block_Index; Key_Block : IO.Storage_Block; begin Initialize (Manager, Iter, Item); Allocate_Key_Slot (Manager, Iter, Master_Block, IO.Buffer_Size'Last, Key_Pos, Key_Block); Iter.Current.Pos := Key_Pos; Keystore.Keys.Create_Master_Key (Keys, Iter.Current, Manager.Config.Key); end Create_Wallet; procedure Open_Wallet (Manager : in out Wallet_Repository; Item : in Wallet_Entry_Access; Keys : in out Keystore.Keys.Key_Manager) is Iter : Data_Key_Iterator; begin Initialize (Manager, Iter, Item); Next_Data_Key (Manager, Iter); pragma Assert (Has_Data_Key (Iter)); Iter.Current.Pos := Iter.Key_Pos; Keystore.Keys.Load_Master_Key (Keys, Iter.Current, Manager.Config.Key); end Open_Wallet; end Keystore.Repository.Keys;
------------------------------------------------------------------------------ -- -- -- 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. ------------------------------------------------------------------------------ -- Specifies a trace relationship between model elements or sets of model -- elements that represent the same concept in different models. Traces are -- mainly used for tracking requirements and changes across models. Since -- model changes can occur in both directions, the directionality of the -- dependency can often be ignored. The mapping specifies the relationship -- between the two, but it is rarely computable and is usually informal. ------------------------------------------------------------------------------ limited with AMF.UML.Abstractions; package AMF.Standard_Profile_L2.Traces is pragma Preelaborate; type Standard_Profile_L2_Trace is limited interface; type Standard_Profile_L2_Trace_Access is access all Standard_Profile_L2_Trace'Class; for Standard_Profile_L2_Trace_Access'Storage_Size use 0; not overriding function Get_Base_Abstraction (Self : not null access constant Standard_Profile_L2_Trace) return AMF.UML.Abstractions.UML_Abstraction_Access is abstract; -- Getter of Trace::base_Abstraction. -- not overriding procedure Set_Base_Abstraction (Self : not null access Standard_Profile_L2_Trace; To : AMF.UML.Abstractions.UML_Abstraction_Access) is abstract; -- Setter of Trace::base_Abstraction. -- end AMF.Standard_Profile_L2.Traces;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Tools Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 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$ ------------------------------------------------------------------------------ with Asis; with Engines.Contexts; with League.Strings; package Properties.Expressions.Allocation is function Code (Engine : access Engines.Contexts.Context; Element : Asis.Expression; Name : Engines.Text_Property) return League.Strings.Universal_String; end Properties.Expressions.Allocation;
-- Copyright (c) 1990 Regents of the University of California. -- All rights reserved. -- -- The primary authors of ayacc were David Taback and Deepak Tolani. -- Enhancements were made by Ronald J. Schmalz. -- -- Send requests for ayacc information to ayacc-info@ics.uci.edu -- Send bug reports for ayacc to ayacc-bugs@ics.uci.edu -- -- Redistribution and use in source and binary forms are permitted -- provided that the above copyright notice and this paragraph are -- duplicated in all such forms and that any documentation, -- advertising materials, and other materials related to such -- distribution and use acknowledge that the software was developed -- by the University of California, Irvine. The name of the -- University may not be used to endorse or promote products derived -- from this software without specific prior written permission. -- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. -- Module : verbose_file.ada -- Component of : ayacc -- Version : 1.2 -- Date : 11/21/86 12:38:37 -- SCCS File : disk21~/rschm/hasee/sccs/ayacc/sccs/sxverbose_file.ada -- $Header: verbose_file.a,v 0.1 86/04/01 15:14:39 ada Exp $ -- $Log: verbose_file.a,v $ -- Revision 0.1 86/04/01 15:14:39 ada -- This version fixes some minor bugs with empty grammars -- and $$ expansion. It also uses vads5.1b enhancements -- such as pragma inline. -- -- -- Revision 0.0 86/02/19 18:54:29 ada -- -- These files comprise the initial version of Ayacc -- designed and implemented by David Taback and Deepak Tolani. -- Ayacc has been compiled and tested under the Verdix Ada compiler -- version 4.06 on a vax 11/750 running Unix 4.2BSD. -- with Symbol_Table, Rule_Table, LR0_Machine; use Symbol_Table, Rule_Table, LR0_Machine; package Verbose_File is procedure Open; procedure Close; procedure Write (Ch : in Character); procedure Write (S : in String); procedure Write_Line (S : in String := ""); procedure Print_Item (Item_1 : in Item); procedure Print_Item_Set (Set_1 : in Item_Set); procedure Print_Grammar_Symbol (Sym: in Grammar_Symbol); procedure Print_Rule (R : in Rule); end Verbose_File;
----------------------------------------------------------------------- -- util-processes-tests - Test for processes -- Copyright (C) 2011, 2016, 2018, 2019, 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 Util.Tests; package Util.Processes.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; -- Tests when the process is not launched procedure Test_No_Process (T : in out Test); -- Test executing a process procedure Test_Spawn (T : in out Test); -- Test output pipe redirection: read the process standard output procedure Test_Output_Pipe (T : in out Test); -- Test input pipe redirection: write the process standard input procedure Test_Input_Pipe (T : in out Test); -- Test error pipe redirection: read the process standard error procedure Test_Error_Pipe (T : in out Test); -- Test shell splitting. procedure Test_Shell_Splitting_Pipe (T : in out Test); -- Test launching several processes through pipes in several threads. procedure Test_Multi_Spawn (T : in out Test); -- Test output file redirection. procedure Test_Output_Redirect (T : in out Test); -- Test input file redirection. procedure Test_Input_Redirect (T : in out Test); -- Test changing working directory. procedure Test_Set_Working_Directory (T : in out Test); -- Test setting specific environment variables. procedure Test_Set_Environment (T : in out Test); -- Test various errors. procedure Test_Errors (T : in out Test); -- Test launching and stopping a process. procedure Test_Stop (T : in out Test); -- Test various errors (pipe streams). procedure Test_Pipe_Errors (T : in out Test); -- Test launching and stopping a process (pipe streams). procedure Test_Pipe_Stop (T : in out Test); -- Test the Tools.Execute operation. procedure Test_Tools_Execute (T : in out Test); end Util.Processes.Tests;
package body Opt46_Pkg is function Last (T : Instance) return Table_Index_Type is begin return Table_Index_Type (T.P.Last_Val); end Last; end Opt46_Pkg;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2016-2020, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ package Beacon is procedure Initialize_Radio; procedure Send_Beacon_Packet; end Beacon;
-- Copyright 2012-2019 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with Pck; use Pck; procedure Foo is type Small is range 0 .. 1000; Small_Value : Small := 10; begin for J in 1 .. 10 loop Small_Value := Small_Value + Small (J); Do_Nothing (Small_Value'Address); -- STOP end loop; end Foo;
------------------------------------------------------------------------------ -- -- -- Internet Protocol Suite Package -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * Richard Wai (ANNEXI-STRAYLINE) -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- -- -- * Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- This package contains the os-specific layout of the "addrinfo" (netdb.h) -- structure -- This is the "BSD" version, where ai_addr follows ai_canonname. -- This applies to FreeBSD, NetBSD and Solaris (Illumos) -- -- Note that this format is still technicalls POSIX complient, since -- POSIX does not actually specify the ordering of the members of -- struct addrinfo. The naming here is really to reflect the (probably) -- historial reasons for these two different orderings with Interfaces.C; use Interfaces.C; with Interfaces.C.Strings; use Interfaces.C.Strings; with System.Storage_Elements; with INET.Internal.OS_Constants; private package INET.IP.OS_Address_Info is subtype socklen_t is Internal.OS_Constants.socklen_t; Null_Chars_Ptr: Strings.chars_ptr renames Strings.Null_Ptr; type Void_Pointer is access System.Storage_Elements.Storage_Element with Storage_Size => 0, Convention => C; type struct_addrinfo; type addrinfo_ptr is access struct_addrinfo with Storage_Size => 0, Convention => C; -- struct addrinfo - getaddrinfo(3) (POSIX) <netdb.h> type struct_addrinfo is record ai_flags : int := 0; ai_family : int := 0; ai_socktype : int := 0; ai_protocol : int := 0; ai_addrlen : socklen_t := 0; ai_canonname: Strings.chars_ptr := Null_Chars_Ptr; ai_addr : Void_Pointer := null; ai_next : addrinfo_ptr := null; end record with Convention => C; end INET.IP.OS_Address_Info;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . T E X T _ I O . F I X E D _ I O -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2006, 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 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. -- -- -- ------------------------------------------------------------------------------ -- In Ada 95, the package Ada.Text_IO.Fixed_IO is a subpackage of Text_IO. -- This is for compatibility with Ada 83. In GNAT we make it a child package -- to avoid loading the necessary code if Fixed_IO is not instantiated. See -- routine Rtsfind.Text_IO_Kludge for a description of how we patch up the -- difference in semantics so that it is invisible to the Ada programmer. private generic type Num is delta <>; package Ada.Text_IO.Fixed_IO is Default_Fore : Field := Num'Fore; Default_Aft : Field := Num'Aft; Default_Exp : Field := 0; procedure Get (File : File_Type; Item : out Num; Width : Field := 0); procedure Get (Item : out Num; Width : Field := 0); procedure Put (File : File_Type; Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp); procedure Put (Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp); procedure Get (From : String; Item : out Num; Last : out Positive); procedure Put (To : out String; Item : Num; Aft : Field := Default_Aft; Exp : Field := Default_Exp); private pragma Inline (Get); pragma Inline (Put); end Ada.Text_IO.Fixed_IO;
-- Copyright (c) 2017 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body Ada_Pretty.Clauses is -------------- -- Document -- -------------- overriding function Document (Self : Aspect; Printer : not null access League.Pretty_Printers.Printer'Class; Pad : Natural) return League.Pretty_Printers.Document is Result : League.Pretty_Printers.Document := Printer.New_Document; begin Result.Append (Self.Name.Document (Printer, Pad)); if Self.Value /= null then declare Value : League.Pretty_Printers.Document := Printer.New_Document; begin Value.New_Line; Value.Append (Self.Value.Document (Printer, 0).Group); Value.Nest (2); Value.Group; Result.Put (" =>"); Result.Append (Value); end; end if; return Result; end Document; -------------- -- Document -- -------------- overriding function Document (Self : Pragma_Node; Printer : not null access League.Pretty_Printers.Printer'Class; Pad : Natural) return League.Pretty_Printers.Document is Result : League.Pretty_Printers.Document := Printer.New_Document; begin Result.New_Line; Result.Put ("pragma "); Result.Append (Self.Name.Document (Printer, 0)); if Self.Arguments /= null then Result.Put (" ("); Result.Append (Self.Arguments.Document (Printer, Pad)); Result.Put (")"); end if; Result.Put (";"); return Result; end Document; -------------- -- Document -- -------------- overriding function Document (Self : Use_Clause; Printer : not null access League.Pretty_Printers.Printer'Class; Pad : Natural) return League.Pretty_Printers.Document is Result : League.Pretty_Printers.Document := Printer.New_Document; begin Result.New_Line; Result.Put ("use "); if Self.Use_Type then Result.Put ("type "); end if; Result.Append (Self.Name.Document (Printer, Pad)); Result.Put (";"); return Result; end Document; -------------- -- Document -- -------------- overriding function Document (Self : With_Clause; Printer : not null access League.Pretty_Printers.Printer'Class; Pad : Natural) return League.Pretty_Printers.Document is Result : League.Pretty_Printers.Document := Printer.New_Document; begin Result.New_Line; if Self.Is_Limited then Result.Put ("limited "); end if; if Self.Is_Private then Result.Put ("private "); end if; Result.Put ("with "); Result.Append (Self.Name.Document (Printer, Pad)); Result.Put (";"); return Result; end Document; ---------- -- Join -- ---------- overriding function Join (Self : Aspect; List : Node_Access_Array; Pad : Natural; Printer : not null access League.Pretty_Printers.Printer'Class) return League.Pretty_Printers.Document is Result : League.Pretty_Printers.Document := Printer.New_Document; begin Result.Append (Self.Document (Printer, Pad)); for J in List'Range loop Result.Put (","); Result.New_Line; Result.Put (" "); Result.Append (List (J).Document (Printer, Pad)); end loop; return Result; end Join; ---------------- -- New_Aspect -- ---------------- function New_Aspect (Name : not null Node_Access; Value : Node_Access) return Node'Class is begin return Aspect'(Name, Value); end New_Aspect; ---------------- -- New_Pragma -- ---------------- function New_Pragma (Name : not null Node_Access; Arguments : Node_Access) return Node'Class is begin return Pragma_Node'(Name, Arguments); end New_Pragma; ------------- -- New_Use -- ------------- function New_Use (Name : not null Node_Access; Use_Type : Boolean) return Node'Class is begin return Use_Clause'(Name, Use_Type); end New_Use; -------------- -- New_With -- -------------- function New_With (Name : not null Node_Access; Is_Limited : Boolean; Is_Private : Boolean) return Node'Class is begin return With_Clause'(Name, Is_Limited, Is_Private); end New_With; end Ada_Pretty.Clauses;
package Parse_Goto is type Small_Integer is range -32_000 .. 32_000; type Goto_Entry is record Nonterm : Small_Integer; Newstate : Small_Integer; end record; --pragma suppress(index_check); subtype Row is Integer range -1 .. Integer'Last; type Goto_Parse_Table is array (Row range <>) of Goto_Entry; Goto_Matrix : constant Goto_Parse_Table := ((-1,-1) -- Dummy Entry. -- State 0 ,(-3, 1),(-2, 2) -- State 1 ,(-4, 3) -- State 2 -- State 3 ,(-8, 10) ,(-5, 9) -- State 4 -- State 5 -- State 6 -- State 7 -- State 8 -- State 9 ,(-6, 12) -- State 10 -- State 11 -- State 12 ,(-7, 14) -- State 13 ,(-9, 15) -- State 14 ,(-18, 28),(-17, 26),(-16, 24),(-15, 25) ,(-12, 20),(-11, 18),(-10, 34) -- State 15 -- State 16 -- State 17 -- State 18 ,(-18, 28) ,(-17, 26),(-16, 24),(-15, 25),(-12, 37) -- State 19 ,(-18, 28),(-17, 26),(-16, 24),(-15, 25) ,(-12, 40) -- State 20 ,(-13, 42) -- State 21 -- State 22 -- State 23 ,(-14, 45) -- State 24 ,(-18, 28) ,(-17, 26),(-15, 48) -- State 25 ,(-18, 28),(-17, 49) -- State 26 -- State 27 -- State 28 -- State 29 -- State 30 ,(-19, 54) -- State 31 ,(-18, 28),(-17, 26),(-16, 24) ,(-15, 25),(-12, 55) -- State 32 -- State 33 ,(-20, 56) -- State 34 -- State 35 -- State 36 -- State 37 ,(-13, 60) -- State 38 ,(-18, 28),(-17, 26),(-16, 24),(-15, 25) ,(-12, 61) -- State 39 -- State 40 ,(-13, 62) -- State 41 -- State 42 -- State 43 ,(-18, 28),(-17, 26) ,(-15, 63) -- State 44 -- State 45 -- State 46 -- State 47 -- State 48 ,(-18, 28),(-17, 49) -- State 49 -- State 50 -- State 51 -- State 52 -- State 53 -- State 54 -- State 55 -- State 56 -- State 57 ,(-20, 72) -- State 58 -- State 59 -- State 60 -- State 61 ,(-13, 73) -- State 62 -- State 63 ,(-18, 28),(-17, 49) -- State 64 -- State 65 -- State 66 -- State 67 -- State 68 -- State 69 -- State 70 -- State 71 -- State 72 -- State 73 -- State 74 -- State 75 -- State 76 -- State 77 -- State 78 -- State 79 -- State 80 -- State 81 -- State 82 ); -- The offset vector GOTO_OFFSET : array (0.. 82) of Integer := ( 0, 2, 3, 3, 5, 5, 5, 5, 5, 5, 6, 6, 6, 7, 8, 15, 15, 15, 15, 20, 25, 26, 26, 26, 27, 30, 32, 32, 32, 32, 32, 33, 38, 38, 39, 39, 39, 39, 40, 45, 45, 46, 46, 46, 49, 49, 49, 49, 49, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 52, 52, 52, 53, 53, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55); subtype Rule is Natural; subtype Nonterminal is Integer; Rule_Length : array (Rule range 0 .. 52) of Natural := ( 2, 5, 0, 5, 0, 2, 1, 1, 1, 3, 1, 1, 4, 0, 0, 4, 3, 3, 2, 2, 1, 1, 3, 3, 1, 1, 1, 0, 3, 2, 1, 2, 2, 1, 2, 2, 2, 6, 5, 4, 1, 1, 1, 3, 3, 1, 3, 4, 4, 2, 0, 2, 0); Get_LHS_Rule: array (Rule range 0 .. 52) of Nonterminal := (-1, -2,-3,-4,-4,-4,-5,-8,-8, -9,-9,-9,-6,-6,-7,-10,-10, -10,-10,-10,-10,-10,-11,-14,-14, -14,-13,-13,-12,-12,-12,-16,-15, -15,-17,-17,-17,-17,-17,-17,-17, -17,-17,-17,-17,-17,-18,-18,-20, -20,-20,-19,-19); end Parse_Goto;
------------------------------------------------------------------------------ -- -- -- GNAT RUNTIME COMPONENTS -- -- -- -- S Y S T E M . P A C K _ 3 6 -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1992-1999 Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with System.Storage_Elements; with System.Unsigned_Types; with Unchecked_Conversion; package body System.Pack_36 is subtype Ofs is System.Storage_Elements.Storage_Offset; subtype Uns is System.Unsigned_Types.Unsigned; subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7; use type System.Storage_Elements.Storage_Offset; use type System.Unsigned_Types.Unsigned; type Cluster is record E0, E1, E2, E3, E4, E5, E6, E7 : Bits_36; end record; for Cluster use record E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1; E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1; E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1; E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1; E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1; E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1; E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1; E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1; end record; for Cluster'Size use Bits * 8; for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment, 1 + 1 * Boolean'Pos (Bits mod 2 = 0) + 2 * Boolean'Pos (Bits mod 4 = 0)); -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. type Cluster_Ref is access Cluster; function To_Ref is new Unchecked_Conversion (System.Address, Cluster_Ref); -- The following declarations are for the case where the address -- passed to GetU_36 or SetU_36 is not guaranteed to be aligned. -- These routines are used when the packed array is itself a -- component of a packed record, and therefore may not be aligned. type ClusterU is new Cluster; for ClusterU'Alignment use 1; type ClusterU_Ref is access ClusterU; function To_Ref is new Unchecked_Conversion (System.Address, ClusterU_Ref); ------------ -- Get_36 -- ------------ function Get_36 (Arr : System.Address; N : Natural) return Bits_36 is C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8)); begin case N07 (Uns (N) mod 8) is when 0 => return C.E0; when 1 => return C.E1; when 2 => return C.E2; when 3 => return C.E3; when 4 => return C.E4; when 5 => return C.E5; when 6 => return C.E6; when 7 => return C.E7; end case; end Get_36; ------------- -- GetU_36 -- ------------- function GetU_36 (Arr : System.Address; N : Natural) return Bits_36 is C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8)); begin case N07 (Uns (N) mod 8) is when 0 => return C.E0; when 1 => return C.E1; when 2 => return C.E2; when 3 => return C.E3; when 4 => return C.E4; when 5 => return C.E5; when 6 => return C.E6; when 7 => return C.E7; end case; end GetU_36; ------------ -- Set_36 -- ------------ procedure Set_36 (Arr : System.Address; N : Natural; E : Bits_36) is C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8)); begin case N07 (Uns (N) mod 8) is when 0 => C.E0 := E; when 1 => C.E1 := E; when 2 => C.E2 := E; when 3 => C.E3 := E; when 4 => C.E4 := E; when 5 => C.E5 := E; when 6 => C.E6 := E; when 7 => C.E7 := E; end case; end Set_36; ------------- -- SetU_36 -- ------------- procedure SetU_36 (Arr : System.Address; N : Natural; E : Bits_36) is C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8)); begin case N07 (Uns (N) mod 8) is when 0 => C.E0 := E; when 1 => C.E1 := E; when 2 => C.E2 := E; when 3 => C.E3 := E; when 4 => C.E4 := E; when 5 => C.E5 := E; when 6 => C.E6 := E; when 7 => C.E7 := E; end case; end SetU_36; end System.Pack_36;
package Oalign1 is Klunk1 : Integer := 12; for Klunk1'Alignment use Standard'Maximum_Alignment; end;
with Interfaces; use Interfaces; package body Natools.Static_Maps.S_Expressions.Conditionals.Strings.S is P : constant array (0 .. 0) of Natural := (0 .. 0 => 4); T1 : constant array (0 .. 0) of Unsigned_8 := (0 .. 0 => 4); T2 : constant array (0 .. 0) of Unsigned_8 := (0 .. 0 => 3); G : constant array (0 .. 4) of Unsigned_8 := (0, 0, 0, 0, 1); function Hash (S : String) return Natural is F : constant Natural := S'First - 1; L : constant Natural := S'Length; F1, F2 : Natural := 0; J : Natural; begin for K in P'Range loop exit when L < P (K); J := Character'Pos (S (P (K) + F)); F1 := (F1 + Natural (T1 (K)) * J) mod 5; F2 := (F2 + Natural (T2 (K)) * J) mod 5; end loop; return (Natural (G (F1)) + Natural (G (F2))) mod 2; end Hash; end Natools.Static_Maps.S_Expressions.Conditionals.Strings.S;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . F A T _ V A X _ D _ F L O A T -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2005,2009 Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package contains an instantiation of the floating-point attribute -- runtime routines for VAX D-float for use on VMS targets. with System.Fat_Gen; package System.Fat_VAX_D_Float is pragma Pure; pragma Warnings (Off); -- This unit is normally used only for VMS, but we compile it for other -- targets for the convenience of testing vms code using -gnatdm. type Fat_VAX_D is digits 9; pragma Float_Representation (VAX_Float, Fat_VAX_D); -- Note the only entity from this package that is accessed by Rtsfind -- is the name of the package instantiation. Entities within this package -- (i.e. the individual floating-point attribute routines) are accessed -- by name using selected notation. package Attr_VAX_D_Float is new System.Fat_Gen (Fat_VAX_D); end System.Fat_VAX_D_Float;